public class PathOutputRewrite extends ASTRewriteRule
ASTRewriteRule.RewriteArguments, ASTRewriteRule.RewritePossibilities
Constructor and Description |
---|
PathOutputRewrite() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
describeRule()
Returns a human-readable description of what this rule does.
|
static int |
distanceBetweenPaths(java.lang.String first,
java.lang.String second)
Calculates the Levenshtein distance between two path strings.
|
static java.lang.String |
extractPathInformation(java.lang.String output)
Extracts the lines containing path information from the given output string.
|
java.util.Collection<ASTRewriteRule.RewritePossibilities> |
getRewritePossibilities(org.eclipse.jdt.core.dom.ASTNode node)
Return the collection of rewrite possibilities for the given node.
|
static boolean |
isPathOutputStatement(org.eclipse.jdt.core.dom.Statement statement)
Returns whether the given statement is a path output statement, i.e.
|
(package private) static <T> int |
levenshteinDistance(java.util.List<T> firstParts,
java.util.List<T> secondParts,
java.lang.Integer[][] cache) |
void |
rewrite(org.eclipse.jdt.core.dom.ASTNode node,
org.eclipse.jdt.core.dom.rewrite.ASTRewrite rewrite,
ASTRewriteRule.RewriteArguments args)
Produce a rewrite according to the given
ASTRewriteRule.RewriteArguments . |
createRewritePossibilities, createRewritePossibilities, preProcess
public static int distanceBetweenPaths(java.lang.String first, java.lang.String second)
first
- The first line-separated path string.second
- The second line-separated path string.extractPathInformation(String)
static <T> int levenshteinDistance(java.util.List<T> firstParts, java.util.List<T> secondParts, java.lang.Integer[][] cache)
public static boolean isPathOutputStatement(org.eclipse.jdt.core.dom.Statement statement)
statement
- The statement to check.public static java.lang.String extractPathInformation(java.lang.String output)
output
- The output string from System.out calls in a rewritten program.public java.util.Collection<ASTRewriteRule.RewritePossibilities> getRewritePossibilities(org.eclipse.jdt.core.dom.ASTNode node)
ASTRewriteRule
getRewritePossibilities
in class ASTRewriteRule
node
- The node for which to get the collection of rewrite possibilities.public void rewrite(org.eclipse.jdt.core.dom.ASTNode node, org.eclipse.jdt.core.dom.rewrite.ASTRewrite rewrite, ASTRewriteRule.RewriteArguments args)
ASTRewriteRule
ASTRewriteRule.RewriteArguments
. This rule must be the same as ASTRewriteRule.RewritePossibilities.getSource()
for the
given arguments' rewrite possibilites instance. Otherwise, the behavior is not determined. This method may not produce any rewrite, if the
ASTRewriteRule.RewriteArguments.getVersion()
is 0. In other cases, it will produce some rewrite.rewrite
in class ASTRewriteRule
node
- The node for which to produce the rewrite.rewrite
- The ASTRewrite instance to use for rewriting the node.args
- The rewrite arguments. This rule must match the source of the arguments.public java.lang.String describeRule()
ASTRewriteRule
Language
instance.describeRule
in class ASTRewriteRule