New node pattern to express alternatives.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4435 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2012-02-08 15:31:40 +00:00
parent f557348885
commit 3f26b1d108
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package com.ibm.wala.cast.tree.pattern;
import com.ibm.wala.cast.tree.CAstNode;
/**
* Pattern to match one of two alternatives.
*
* @author mschaefer
*
*/
public class Alt implements NodePattern {
private final NodePattern left, right;
public Alt(NodePattern left, NodePattern right) {
this.left = left;
this.right = right;
}
public boolean matches(CAstNode node) {
return left.matches(node) || right.matches(node);
}
}