net.sourceforge.wurfl.lang.twoparam
Class IfOp<V1,V2,R>

java.lang.Object
  extended by net.sourceforge.wurfl.lang.twoparam.TwoParamOp<V1,V2,R>
      extended by net.sourceforge.wurfl.lang.twoparam.IfOp<V1,V2,R>

public final class IfOp<V1,V2,R>
extends TwoParamOp<V1,V2,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$

Field Summary
protected  TwoParamOp<V1,V2,R> body
           
protected  Condition<V2> con
           
protected  TwoParamOp<V1,V2,R> elseBody
           
protected  org.slf4j.Logger logger
           
 
Constructor Summary
IfOp(Condition<V2> con, TwoParamOp<V1,V2,R> body, TwoParamOp<V1,V2,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(V1 v1, V2 v2)
          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 java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger

con

protected Condition<V2> con

body

protected TwoParamOp<V1,V2,R> body

elseBody

protected TwoParamOp<V1,V2,R> elseBody
Constructor Detail

IfOp

public IfOp(Condition<V2> con,
            TwoParamOp<V1,V2,R> body,
            TwoParamOp<V1,V2,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(V1 v1,
                 V2 v2)
Execute this object's "else" body if this object's condition evaluates to null; otherwise execute the main body.

Specified by:
execute in class TwoParamOp<V1,V2,R>

getDescription

public String getDescription()


Copyright © 2012 ScientiaMobile Inc.. All Rights Reserved.