sdr 0.21

net.cscott.sdr.calls.ast
Class Condition

java.lang.Object
  extended by net.cscott.sdr.calls.ast.AstNode
      extended by 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

Field Summary
 List<Condition> args
           
 String predicate
           
 
Fields inherited from class net.cscott.sdr.calls.ast.AstNode
type
 
Constructor Summary
Condition(String predicate, List<Condition> args)
           
 
Method Summary
<T> Condition
accept(TransformVisitor<T> v, T t)
           
<RESULT,CLOSURE>
RESULT
accept(ValueVisitor<RESULT,CLOSURE> v, CLOSURE cl)
           
 String argsToString()
           
 Condition build(String predicate, List<Condition> args)
          Factory: creates new Condition only if it would differ from this.
 Condition getArg(int n)
           
 Fraction getNumberArg(int n)
           
 Predicate getPredicate()
           
 String getStringArg(int n)
           
static Condition makeCondition(String condition)
           
static Condition makeCondition(String condition, Condition... subConditions)
           
static Condition makeCondition(String condition, Fraction number)
           
 
Methods inherited from class net.cscott.sdr.calls.ast.AstNode
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

predicate

public final String predicate

args

public final List<Condition> args
Constructor Detail

Condition

public Condition(String predicate,
                 List<Condition> args)
Method Detail

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.


sdr 0.21

Copyright (c) 2006 C. Scott Ananian