de.unidu.is.expressions
Class ArgNExpression

java.lang.Object
  extended byde.unidu.is.expressions.AbstractExpression
      extended byde.unidu.is.expressions.ArgNExpression
All Implemented Interfaces:
Expression
Direct Known Subclasses:
ProductNExpression, SumNExpression

public class ArgNExpression
extends AbstractExpression

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

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

Field Summary
protected  java.util.List args
          List of arguments of this expression.
protected  java.lang.String op
          Expression operator.
 
Constructor Summary
ArgNExpression(java.lang.String op, java.util.List args)
          Creates a new expression object.
 
Method Summary
 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.


args

protected java.util.List args
List of arguments of this expression.

Constructor Detail

ArgNExpression

public ArgNExpression(java.lang.String op,
                      java.util.List args)
Creates a new expression object.

Parameters:
op - expression operator
args - list of arguments 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