|
sdr 0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.cscott.sdr.calls.ast.AstNode
net.cscott.sdr.calls.ast.Expr
public class Expr
Expr represents an expression to be computed at evaluation time.
The value of an Expr may depend on the DanceState at the
time it is evaluated.
| Field Summary | |
|---|---|
List<Expr> |
args
|
String |
atom
|
| Fields inherited from class net.cscott.sdr.calls.ast.AstNode |
|---|
type |
| Constructor Summary | |
|---|---|
Expr(String atom,
Expr... args)
|
|
Expr(String atom,
List<Expr> args)
|
|
| Method Summary | ||
|---|---|---|
|
accept(TransformVisitor<T> v,
T t)
Visitor pattern implementation for transformations. |
|
|
accept(ValueVisitor<RESULT,CLOSURE> v,
CLOSURE cl)
Visitor pattern implementation for computations. |
|
String |
argsToString()
|
|
Expr |
build(String atom,
List<Expr> args)
Factory: creates new Expr only if it would differ from this. |
|
|
evaluate(Class<T> type,
DanceState ds)
Evaluate the Expr in the given DanceState to yield
a result of the requested type. |
|
boolean |
isConstant(Class<?> type)
Returns true iff the value of this Expr is independent of the
DanceState. |
|
static Expr |
literal(Fraction f)
|
|
static Expr |
literal(String s)
|
|
String |
toShortString()
Emit an apply in the form it appears in the call definition lists. |
|
String |
toString()
Output AST tree in lisp-like notation. |
|
| Methods inherited from class net.cscott.sdr.calls.ast.AstNode |
|---|
valueOf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final String atom
public final List<Expr> args
| Constructor Detail |
|---|
public Expr(String atom,
List<Expr> args)
public Expr(String atom,
Expr... args)
| Method Detail |
|---|
public static Expr literal(String s)
public static Expr literal(Fraction f)
public final <T> T evaluate(Class<T> type,
DanceState ds)
throws ExprFunc.EvaluationException
Expr in the given DanceState to yield
a result of the requested type.
ExprFunc.EvaluationExceptionpublic final boolean isConstant(Class<?> type)
Expr is independent of the
DanceState.
public <T> Expr accept(TransformVisitor<T> v,
T t)
AstNodeAstNode accepts a TransformVisitor and a
value, and returns an instance of its own type (ie,
Seq.accept(tv, "A") returns a Seq).
The 't' parameter is a closure.
accept in class AstNode
public <RESULT,CLOSURE> RESULT accept(ValueVisitor<RESULT,CLOSURE> v,
CLOSURE cl)
AstNodeAstNode accepts a ValueVisitor and a closure,
and returns an object of the appropriate result type.
accept in class AstNodepublic String argsToString()
argsToString in class AstNodepublic String toString()
AstNode
toString in class AstNodepublic String toShortString()
public Expr build(String atom,
List<Expr> args)
|
sdr 0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||