com.fdsapi.arrays
Class ConditionalEquals

java.lang.Object
  |
  +--com.fdsapi.arrays.ConditionalBase
        |
        +--com.fdsapi.arrays.ConditionalEquals
All Implemented Interfaces:
Conditional

public class ConditionalEquals
extends ConditionalBase

Conditional object that tests equality of objects. i.e. col1=7 or col2=Steve It simply calls the columns equals method against the comparison value passed into the contructor. If both column and comparison values are null the Conditional returns true, but if only one of them is null the Conditional returns false.

View Code


Field Summary
 
Fields inherited from class com.fdsapi.arrays.ConditionalBase
col
 
Constructor Summary
ConditionalEquals(int col, java.lang.Object comparisonValue)
          Constructor that takes the col number that should be compared and the Object that the column should be Compared against.
ConditionalEquals(int col, java.lang.Object comparisonValue, Conditional nextConditional)
          Constructor that takes the col number that should be compared and the Object that the column should be Compared against, as well as the next Conditional in the decorator chaing.
 
Method Summary
 java.lang.String getType()
          Returns '=' which is used to make a String representation of this Conditional
protected  boolean isTrueThis(java.lang.Object[] row)
          Overridden method that determines if the column to be compared and the Comparison value match by calling the columns equal method against the comparison value.
 java.lang.String toString()
          Make a String representation of this Conditional
 
Methods inherited from class com.fdsapi.arrays.ConditionalBase
getConditionalString, getNextConditional, isTrue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConditionalEquals

public ConditionalEquals(int col,
                         java.lang.Object comparisonValue)
Constructor that takes the col number that should be compared and the Object that the column should be Compared against. Note the column equals method must be able to take ComparisonValue's Object type.


ConditionalEquals

public ConditionalEquals(int col,
                         java.lang.Object comparisonValue,
                         Conditional nextConditional)
Constructor that takes the col number that should be compared and the Object that the column should be Compared against, as well as the next Conditional in the decorator chaing. Note the column equals method must be able to take ComparisonValue's Object type.

Method Detail

isTrueThis

protected boolean isTrueThis(java.lang.Object[] row)
Overridden method that determines if the column to be compared and the Comparison value match by calling the columns equal method against the comparison value. equals is called on the comparison value, not the row value as this approach is more flexible.

Specified by:
isTrueThis in class ConditionalBase

getType

public java.lang.String getType()
Returns '=' which is used to make a String representation of this Conditional


toString

public java.lang.String toString()
Make a String representation of this Conditional

Overrides:
toString in class java.lang.Object