org.millscript.millscript.expr
Class AppendExpr

java.lang.Object
  extended by org.millscript.millscript.expr.Expr<A>
      extended by org.millscript.millscript.expr.BinaryOpExpr<AppendAction>
          extended by org.millscript.millscript.expr.AppendExpr
All Implemented Interfaces:
OneResult

public final class AppendExpr
extends BinaryOpExpr<AppendAction>

This class implements an append expression. The left and right hand side expressions must produce single results that are compatible for appending.

See Also:
AppendSyntax, AppendAction

Constructor Summary
AppendExpr(Expr<?> a, Expr<?> b)
          Creates a new append expression with the specified left and right hand side expressions.
 
Method Summary
static Expr make(Expr a, Expr b)
          Returns an expression which appends the specified left and right hand side expressions.
 AppendAction newAction(Action a, Action b)
          Compiles this expression into an action.
 
Methods inherited from class org.millscript.millscript.expr.BinaryOpExpr
compileIt, resolve
 
Methods inherited from class org.millscript.millscript.expr.Expr
arity, compile, isIntegerExpr, resolveList, setLineNumber, setOrigin, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppendExpr

public AppendExpr(Expr<?> a,
                  Expr<?> b)
Creates a new append expression with the specified left and right hand side expressions.

Parameters:
a - the left hand expression
b - the right hand expression, to append to the left
Method Detail

make

public static Expr make(Expr a,
                        Expr b)
Returns an expression which appends the specified left and right hand side expressions. This method provides some compile-time optimisation, as it avoids creating additional unnecessary objects in the expression tree. If the left and right hand side expression are constant Strings, we create a new constant expression by appending the right to the left. Otherwise we create a normal apply expression.

Parameters:
a - the left hand side expression
b - the right hand side expression
Returns:
a ConstantExpr if the left and right hand side expressions are both constant Strings, otherwise an AppendExpr

newAction

public AppendAction newAction(Action a,
                              Action b)
Description copied from class: BinaryOpExpr
Compiles this expression into an action. This is method performs the expression specific compilation, but does not need to handle the left and right hand side expression compilation.

Specified by:
newAction in class BinaryOpExpr<AppendAction>
Parameters:
a - the compiled left hand side expression
b - the compiled right hand side expression
Returns:
the Action for this expression
See Also:
BinaryOpExpr.newAction(org.millscript.millscript.action.Action, org.millscript.millscript.action.Action)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.