Package edu.umd.cs.findbugs.ba.bcp
Class Wild
java.lang.Object
edu.umd.cs.findbugs.ba.bcp.PatternElement
edu.umd.cs.findbugs.ba.bcp.Wild
A wildcard PatternElement, which matches any kind of instruction
indiscriminately.
- Author:
- David Hovemeyer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptBranch
(Edge edge, org.apache.bcel.generic.InstructionHandle source) Return whether or not it is acceptable to take the given branch.match
(org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) Return whether or not this element matches the given instruction with the given Bindings in effect.int
maxOccur()
Return the maximum number of instructions this PatternElement must match in the ByteCodePattern.int
minOccur()
Return the minimum number of instructions this PatternElement must match in the ByteCodePattern.void
setMinAndMax
(int min, int max) Set min and max values.Methods inherited from class edu.umd.cs.findbugs.ba.bcp.PatternElement
addOrCheckDefinition, allowTrailingEdges, dominatedBy, getDominatedBy, getLabel, getNext, label, lookup, setAllowTrailingEdges, setIndex, setNext, toString
-
Constructor Details
-
Wild
public Wild()Default constructor. Creates a wildcard that matches from 0 to Integer.MAX_VALUE instructions. -
Wild
public Wild(int max) Constructor. Matches any number of instructions from 0 to the maximum specified.- Parameters:
max
- the maximum number of instructions the wildcard may match
-
Wild
public Wild(int min, int max) Constructor.- Parameters:
min
- minimum number of times the wildcard must matchmax
- maximum number of times the wildcard may match
-
-
Method Details
-
setMinAndMax
public void setMinAndMax(int min, int max) Set min and max values.- Parameters:
min
- minimum number of times the wildcard must matchmax
- maximum number of times the wildcard may match
-
minOccur
public int minOccur()Description copied from class:PatternElement
Return the minimum number of instructions this PatternElement must match in the ByteCodePattern.- Specified by:
minOccur
in classPatternElement
-
maxOccur
public int maxOccur()Description copied from class:PatternElement
Return the maximum number of instructions this PatternElement must match in the ByteCodePattern.- Specified by:
maxOccur
in classPatternElement
-
acceptBranch
Description copied from class:PatternElement
Return whether or not it is acceptable to take the given branch.- Specified by:
acceptBranch
in classPatternElement
- Parameters:
edge
- the Edge representing the branchsource
- the source instruction of the branch- Returns:
- true if the Edge is acceptable, false if not
-
match
public MatchResult match(org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) throws DataflowAnalysisException Description copied from class:PatternElement
Return whether or not this element matches the given instruction with the given Bindings in effect.- Specified by:
match
in classPatternElement
- Parameters:
handle
- the instructioncpg
- the ConstantPoolGen from the methodbefore
- the ValueNumberFrame representing values in the Java stack frame just before the execution of the instructionafter
- the ValueNumberFrame representing values in the Java stack frame just after the execution of the instructionbindingSet
- the set of Bindings- Returns:
- if the match is successful, returns a MatchResult with the PatternElement and BindingSet; if the match is not successful, returns null
- Throws:
DataflowAnalysisException
-