com.fdsapi.arrays
Class ConditionalCompositeImp

java.lang.Object
  |
  +--com.fdsapi.arrays.ConditionalCompositeImp
All Implemented Interfaces:
Conditional, ConditionalComposite

public class ConditionalCompositeImp
extends java.lang.Object
implements ConditionalComposite

Used for grouping conditionals in the ArraySQL and ArrayFilter classes. This composite can correspond to a paren level/or condition, or an and condition. As this class implements the composite design pattern it can also contain itself. Here are some examples.

select * from array where col0='steve' and col1='souza' - creates 2 composites. One for the root holder of the where clause and the other for the and clause

select * from array where col0='steve' and col1='souza' or col1='jones' - same as above

select * from array where (col0='steve' and col1='souza' or col1='jones') - 3 composites. the root composite, the paren level (an or is created), and the and composite.

*

View Code


Constructor Summary
ConditionalCompositeImp(java.lang.String type)
          Creates a new instance of ConditionalCompositeImp
 
Method Summary
 void addConditional(Conditional conditional)
          Add a conditional to the Composite.
 void addNot()
          Negate the boolean return status of the entire composite.
 java.lang.String getType()
          Returns the empty string
 boolean isTrue(java.lang.Object[] row)
          Returns true if the row passed in should be kept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionalCompositeImp

public ConditionalCompositeImp(java.lang.String type)
Creates a new instance of ConditionalCompositeImp

Method Detail

isTrue

public boolean isTrue(java.lang.Object[] row)
Description copied from interface: ConditionalComposite
Returns true if the row passed in should be kept

Specified by:
isTrue in interface ConditionalComposite

addConditional

public void addConditional(Conditional conditional)
Add a conditional to the Composite. after addConditional() is called then either the Composite must be evaluated or addAnd(), or addOr() must be called. Sample: composite.addConditional(new ConditionalEquals(2,"steve"));

Specified by:
addConditional in interface ConditionalComposite

addNot

public void addNot()
Negate the boolean return status of the entire composite. i.e. if the composite is true then this method would change that to false and vice versa

Specified by:
addNot in interface ConditionalComposite

getType

public java.lang.String getType()
Returns the empty string

Specified by:
getType in interface Conditional