org.quattor.pan.dml.operators
Class IfElse

java.lang.Object
  extended by org.quattor.pan.dml.AbstractOperation
      extended by org.quattor.pan.dml.operators.IfElse
All Implemented Interfaces:
Operation

public final class IfElse
extends AbstractOperation

Implements an if operation with an optional else clause.

Author:
loomis

Field Summary
 
Fields inherited from class org.quattor.pan.dml.AbstractOperation
ops, sourceRange
 
Method Summary
 Element execute(Context context)
          Perform the if statement.
static Operation newOperation(SourceRange sourceRange, Operation... ops)
           
 
Methods inherited from class org.quattor.pan.dml.AbstractOperation
calculateArgs, calculateTerms, checkInvalidSelfContext, checkRestrictedContext, getOperations, getSourceRange, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newOperation

public static Operation newOperation(SourceRange sourceRange,
                                     Operation... ops)
                              throws SyntaxException
Throws:
SyntaxException

execute

public Element execute(Context context)
Perform the if statement. It will pop a boolean from the data stack. If that boolean is false the next operand if popped from the operand stack; if true, nothing is done.

Specified by:
execute in interface Operation
Specified by:
execute in class AbstractOperation
Parameters:
context - evaluation context for the statement
Returns:
Element produced by running operation


Copyright © 2011 Quattor. All Rights Reserved.