net.sourceforge.wurfl.lang.oneparam
Class IfOp<V,R>

java.lang.Object
  extended by net.sourceforge.wurfl.lang.twoparam.TwoParamOp<V,Curry,R>
      extended by net.sourceforge.wurfl.lang.oneparam.OneParamOp<V,R>
          extended by net.sourceforge.wurfl.lang.oneparam.IfOp<V,R>

public final class IfOp<V,R>
extends OneParamOp<V,R>

Construct an "if" operation that will execute its "else" body if the supplied condition is false, and will otherwise execute its regular body.

Version:
$Id$

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sourceforge.wurfl.lang.oneparam.OneParamOp
OneParamOp.Type
 
Field Summary
protected  OneParamOp<V,R> body
           
protected  Condition con
           
protected  OneParamOp<V,R> elseBody
           
 
Fields inherited from class net.sourceforge.wurfl.lang.twoparam.TwoParamOp
logger
 
Constructor Summary
IfOp(Condition<V> con, OneParamOp<V,R> body, OneParamOp<V,R> elseBody)
          Construct an "if" operation that will execute its "else" body if the supplied condition is false, and will otherwise execute its regular body.
 
Method Summary
 boolean equals(Object o)
          Return true if the provided object equals this one.
 R execute(V str)
          Execute this object's "else" body if this object's condition evaluates to null; otherwise execute the main body.
 String getDescription()
           
 
Methods inherited from class net.sourceforge.wurfl.lang.oneparam.OneParamOp
execute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

con

protected Condition con

body

protected OneParamOp<V,R> body

elseBody

protected OneParamOp<V,R> elseBody
Constructor Detail

IfOp

public IfOp(Condition<V> con,
            OneParamOp<V,R> body,
            OneParamOp<V,R> elseBody)
Construct an "if" operation that will execute its "else" body if the supplied condition is false, and will otherwise execute its regular body.

Parameters:
con - the condition to eval to determine which body to execute
body - the body to execute if the condition is true
elseBody - the body to execute if the condition is false
Method Detail

equals

public boolean equals(Object o)
Return true if the provided object equals this one. Equality is tested only between condition and body, not elseBody.

Overrides:
equals in class Object
Returns:
true if the provided object equals this one

execute

public R execute(V str)
Execute this object's "else" body if this object's condition evaluates to null; otherwise execute the main body.

Specified by:
execute in class OneParamOp<V,R>

getDescription

public String getDescription()


Copyright © 2012 ScientiaMobile Inc.. All Rights Reserved.