public class LoopAndMethodCounterRewrite extends ASTRewriteRule
ASTRewriteRule.RewriteArguments, ASTRewriteRule.RewritePossibilities| Constructor and Description |
|---|
LoopAndMethodCounterRewrite() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
describeRule()
Returns a human-readable description of what this rule does.
|
static boolean |
doesPairCheckCounter(Pair<org.eclipse.jdt.core.dom.Statement> statements)
Returns whether the given pair of statements checks a loop counter.
|
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 |
isLoopCounter(org.eclipse.jdt.core.dom.VariableDeclarationStatement variable)
Returns whether the given VariableDeclarationStatement instance declares a loop counter, and should therefore be
removed before presenting the corrected code to the user again.
|
static boolean |
isMethodCounter(org.eclipse.jdt.core.dom.FieldDeclaration field)
Returns whether the given FieldDeclaration instance declares a method counter, and should therefore be removed
before presenting the corrected code to the user again.
|
static void |
resetStaticCounters(java.lang.Class<?> clazz)
Resets all static method counters to the value of zero.
|
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, preProcesspublic static void resetStaticCounters(java.lang.Class<?> clazz)
clazz - The class to reset the static method counters in.public static boolean isMethodCounter(org.eclipse.jdt.core.dom.FieldDeclaration field)
public static boolean isLoopCounter(org.eclipse.jdt.core.dom.VariableDeclarationStatement variable)
public static boolean doesPairCheckCounter(Pair<org.eclipse.jdt.core.dom.Statement> statements)
public java.lang.String describeRule()
ASTRewriteRuleLanguage instance.describeRule in class ASTRewriteRulepublic java.util.Collection<ASTRewriteRule.RewritePossibilities> getRewritePossibilities(org.eclipse.jdt.core.dom.ASTNode node)
ASTRewriteRulegetRewritePossibilities in class ASTRewriteRulenode - 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)
ASTRewriteRuleASTRewriteRule.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 ASTRewriteRulenode - 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.