net.cscott.sdr.calls.ast
Class Condition
java.lang.Object
net.cscott.sdr.calls.ast.AstNode
net.cscott.sdr.calls.ast.Condition
public class Condition
- extends AstNode
Condition
represents an invocation of a Predicate
with zero or more arguments. The arguments can be text strings, numbers, or
sub-conditions; see the Apply
class for the basic idea.
String and number arguments are stored as zero-argument conditions.
- Version:
- $Id: Condition.java,v 1.6 2006-10-17 16:29:05 cananian Exp $
- Author:
- C. Scott Ananian
Fields inherited from class net.cscott.sdr.calls.ast.AstNode |
type |
predicate
public final String predicate
args
public final List<Condition> args
Condition
public Condition(String predicate,
List<Condition> args)
accept
public <T> Condition accept(TransformVisitor<T> v,
T t)
- Specified by:
accept
in class AstNode
accept
public <RESULT,CLOSURE> RESULT accept(ValueVisitor<RESULT,CLOSURE> v,
CLOSURE cl)
- Specified by:
accept
in class AstNode
argsToString
public String argsToString()
- Overrides:
argsToString
in class AstNode
getPredicate
public Predicate getPredicate()
getArg
public Condition getArg(int n)
getNumberArg
public Fraction getNumberArg(int n)
getStringArg
public String getStringArg(int n)
makeCondition
public static Condition makeCondition(String condition)
makeCondition
public static Condition makeCondition(String condition,
Fraction number)
makeCondition
public static Condition makeCondition(String condition,
Condition... subConditions)
build
public Condition build(String predicate,
List<Condition> args)
- Factory: creates new Condition only if it would differ from this.
Copyright (c) 2006 C. Scott Ananian