Package de.jplag

Class TokenPrinter

java.lang.Object
de.jplag.TokenPrinter

public final class TokenPrinter extends Object
Utility class for printing JPlag tokens from a submission. Each line of code is printed starting with the line number. Under these lines the tokens are annotated in the format |TOKEN|. The first vertical line marks the token start, while the last vertical line marks the token end. Tokens that are shorter than the name do not end with a vertical line, e.g. |TOKEN. Tokens with length 1 or 0 are printed in lower case, e.g. |token.
Author:
Timur Saglam
  • Method Details

    • printTokens

      public static String printTokens(List<Token> tokens)
      Creates a string representation of a set of files line by line and adds the tokens under the lines.
      Parameters:
      tokens - is the list of tokens parsed from the files.
      Returns:
      the string representation.
    • printTokens

      public static String printTokens(List<Token> tokens, File rootDirectory)
      Creates a string representation of a set of files line by line and adds the tokens under the lines.
      Parameters:
      tokens - is the list of tokens parsed from the files.
      rootDirectory - is the common rootDirectory of the files.
      Returns:
      the string representation.
    • printTokens

      public static String printTokens(List<Token> tokenList, File rootDirectory, Optional<String> suffix)
      Creates a string representation of a collection of files line by line and adds the tokens under the lines.
      Parameters:
      tokenList - is the list of tokens parsed from the files.
      rootDirectory - is the common directory of the files.
      suffix - is the optional view file suffix.
      Returns:
      the string representation.