de.unidu.is.expressions
Class Arg2Expression

java.lang.Object
  extended byde.unidu.is.expressions.AbstractExpression
      extended byde.unidu.is.expressions.Arg2Expression
All Implemented Interfaces:
Expression
Direct Known Subclasses:
DifferenceExpression, EqualsExpression, FractionExpression, ProductExpression, SumExpression

public class Arg2Expression
extends AbstractExpression

An expression with an operator and two arguments, e.g. the sum of two expressions.

Since:
2003-10-27
Version:
$Revision: 1.5 $, $Date: 2005/02/21 17:29:18 $
Author:
Henrik Nottelmann

Field Summary
protected  Expression arg1
          First argument of this expression.
protected  Expression arg2
          Second argument of this expression.
protected  java.lang.String op
          Expression operator.
 
Constructor Summary
Arg2Expression(java.lang.String op, Expression arg1, Expression arg2)
          Creates a new expression object.
 
Method Summary
 Expression getArg1()
          Returns the first argument.
 Expression getArg2()
          Returns the second argument.
 java.lang.String getOp()
          Returns the operator symbol.
 java.lang.String getSQLTemplate()
          Returns a string representation for this expression which can be used as a template in an SQL statement.
 Expression substitute(java.util.Map binding)
          Performs an substitution for variables, e.g. for each key variable in the specified binding, all occurences of ${key} are replaced by the corresponding value in the map.
 java.lang.String toString()
          Returns the expression in infix notation, embedded in round brackets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

op

protected java.lang.String op
Expression operator.


arg1

protected Expression arg1
First argument of this expression.


arg2

protected Expression arg2
Second argument of this expression.

Constructor Detail

Arg2Expression

public Arg2Expression(java.lang.String op,
                      Expression arg1,
                      Expression arg2)
Creates a new expression object.

Parameters:
op - expression operator
arg1 - first argument of this expression
arg2 - second argument of this expression
Method Detail

substitute

public Expression substitute(java.util.Map binding)
Performs an substitution for variables, e.g. for each key variable in the specified binding, all occurences of ${key} are replaced by the corresponding value in the map.

Only the arguments are substituted.

Specified by:
substitute in interface Expression
Overrides:
substitute in class AbstractExpression
Parameters:
binding - variable binding
Returns:
expression after substitution

toString

public java.lang.String toString()
Returns the expression in infix notation, embedded in round brackets.

Returns:
expression as a string

getSQLTemplate

public java.lang.String getSQLTemplate()
Returns a string representation for this expression which can be used as a template in an SQL statement.

Specified by:
getSQLTemplate in interface Expression
Overrides:
getSQLTemplate in class AbstractExpression
Returns:
template for SQL statements

getArg1

public Expression getArg1()
Returns the first argument.

Returns:
first argument

getArg2

public Expression getArg2()
Returns the second argument.

Returns:
second argument

getOp

public java.lang.String getOp()
Returns the operator symbol.

Returns:
operator symbol