| 1 19 20 package edu.umd.cs.findbugs.ba.bcp; 21 22 import org.apache.bcel.generic.ConstantPoolGen; 23 import org.apache.bcel.generic.InstructionHandle; 24 25 import edu.umd.cs.findbugs.annotations.SuppressWarnings; 26 import edu.umd.cs.findbugs.ba.DataflowAnalysisException; 27 import edu.umd.cs.findbugs.ba.Edge; 28 import edu.umd.cs.findbugs.ba.vna.ValueNumberFrame; 29 30 42 public class MatchAny extends PatternElement { 43 private PatternElement[] childList; 44 45 50 @SuppressWarnings ("EI2") 51 public MatchAny(PatternElement[] childList) { 52 this.childList = childList; 53 } 54 55 @Override  56 public PatternElement label(String label) { 57 for (PatternElement aChildList : childList) { 58 aChildList.label(label); 59 } 60 return this; 61 } 62 63 @Override  64 public PatternElement setAllowTrailingEdges(boolean allowTrailingEdges) { 65 for (PatternElement aChildList : childList) 69 aChildList.setAllowTrailingEdges(allowTrailingEdges); 70 71 return this; 72 } 73 74 @Override  75 public MatchResult match(InstructionHandle handle, ConstantPoolGen cpg, 76 ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) throws DataflowAnalysisException { 77 78 for (PatternElement child : childList) { 79 MatchResult matchResult = child.match(handle, cpg, before, after, bindingSet); 80 if (matchResult != null) 81 return matchResult; 82 } 83 84 return null; 85 86 } 87 88 @Override  89 public boolean acceptBranch(Edge edge, InstructionHandle source) { 90 throw new IllegalStateException ("shouldn't happen"); 93 } 94 95 @Override  96 public int minOccur() { 97 return 1; 98 } 99 100 @Override  101 public int maxOccur() { 102 return 1; 103 } 104 } 105 106 | Popular Tags |