| java.lang.Object edu.umd.cs.findbugs.ba.bcp.PatternElement
All known Subclasses: edu.umd.cs.findbugs.ba.bcp.SingleInstruction, edu.umd.cs.findbugs.ba.bcp.Opcode, edu.umd.cs.findbugs.ba.bcp.Wild, edu.umd.cs.findbugs.ba.bcp.Invoke, edu.umd.cs.findbugs.ba.bcp.MatchAny,
PatternElement | abstract public class PatternElement (Code) | | A PatternElement is an element of a ByteCodePattern.
It potentially matches some number of bytecode instructions.
|
Method Summary | |
abstract public boolean | acceptBranch(Edge edge, InstructionHandle source) Return whether or not it is acceptable to take the given branch. | protected static BindingSet | addOrCheckDefinition(String varName, Variable variable, BindingSet bindingSet) Add a variable definition to the given BindingSet, or if
there is an existing definition, make sure it is consistent with
the new definition. | public boolean | allowTrailingEdges() Return whether or not this PatternElement may match trailing edges. | public PatternElement | dominatedBy(String dominatedBy) Set the label of another pattern element whose first
matched instruction must dominate the instruction(s) matched
by this element. | public String | getDominatedBy() Get the label of the pattern element whose first
matched instruction must dominate the instruction(s) matched
by this element. | public String | getLabel() Get the label of this PatternElement. | public PatternElement | getNext() Get the next PatternElement. | public PatternElement | label(String label) Set a label for this PatternElement. | public static Variable | lookup(String varName, BindingSet bindingSet) Look up a variable definition in given BindingSet. | abstract public MatchResult | match(InstructionHandle handle, ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) Return whether or not this element matches the given
instruction with the given Bindings in effect. | abstract public int | maxOccur() Return the maximum number of instructions this PatternElement
must match in the ByteCodePattern. | abstract public int | minOccur() Return the minimum number of instructions this PatternElement
must match in the ByteCodePattern. | public PatternElement | setAllowTrailingEdges(boolean allowTrailingEdges) Set whether or not this PatternElement allows trailing edges to be matched.
By default, trailing edges may be matched. | public void | setIndex(int index) Set the index. | public void | setNext(PatternElement patternElement) Set the next PatternElement. | public String | toString() |
acceptBranch | abstract public boolean acceptBranch(Edge edge, InstructionHandle source)(Code) | | Return whether or not it is acceptable to take the given branch.
Parameters: edge - the Edge representing the branch Parameters: source - the source instruction of the branch true if the Edge is acceptable, false if not |
addOrCheckDefinition | protected static BindingSet addOrCheckDefinition(String varName, Variable variable, BindingSet bindingSet)(Code) | | Add a variable definition to the given BindingSet, or if
there is an existing definition, make sure it is consistent with
the new definition.
Parameters: varName - the name of the variable Parameters: variable - the Variable which should be added or checked for consistency Parameters: bindingSet - the existing set of bindings the updated BindingSet (if the variable is consistent with theprevious bindings), or null if the new variable is inconsistent withthe previous bindings |
allowTrailingEdges | public boolean allowTrailingEdges()(Code) | | Return whether or not this PatternElement may match trailing edges.
|
dominatedBy | public PatternElement dominatedBy(String dominatedBy)(Code) | | Set the label of another pattern element whose first
matched instruction must dominate the instruction(s) matched
by this element.
|
getDominatedBy | public String getDominatedBy()(Code) | | Get the label of the pattern element whose first
matched instruction must dominate the instruction(s) matched
by this element.
|
getLabel | public String getLabel()(Code) | | Get the label of this PatternElement.
the label, or null if the PatternElement is not labeled |
label | public PatternElement label(String label)(Code) | | Set a label for this PatternElement.
Parameters: label - the label this object |
lookup | public static Variable lookup(String varName, BindingSet bindingSet)(Code) | | Look up a variable definition in given BindingSet.
Parameters: varName - the name of the variable Parameters: bindingSet - the BindingSet to look in the Variable, or null if no Variable is bound to the name |
match | abstract public MatchResult match(InstructionHandle handle, ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) throws DataflowAnalysisException(Code) | | Return whether or not this element matches the given
instruction with the given Bindings in effect.
Parameters: handle - the instruction Parameters: cpg - the ConstantPoolGen from the method Parameters: before - the ValueNumberFrame representing values in the Java stack framejust before the execution of the instruction Parameters: after - the ValueNumberFrame representing values in the Java stack framejust after the execution of the instruction Parameters: bindingSet - the set of Bindings if the match is successful, returns a MatchResult with the PatternElementand BindingSet; if the match is not successful, returns null |
maxOccur | abstract public int maxOccur()(Code) | | Return the maximum number of instructions this PatternElement
must match in the ByteCodePattern.
|
minOccur | abstract public int minOccur()(Code) | | Return the minimum number of instructions this PatternElement
must match in the ByteCodePattern.
|
setAllowTrailingEdges | public PatternElement setAllowTrailingEdges(boolean allowTrailingEdges)(Code) | | Set whether or not this PatternElement allows trailing edges to be matched.
By default, trailing edges may be matched. When this value is set
to false, it ensures that the successor instruction must be in the
same basic block.
Parameters: allowTrailingEdges - true if trailing edges may be matched,false if trailing edges will never be matched |
setIndex | public void setIndex(int index)(Code) | | Set the index. This is just for debugging.
|
|
|