net.sourceforge.esw.service.log.expression
Class ComparableFilterExpression

java.lang.Object
  |
  +--net.sourceforge.esw.service.log.expression.ComparableFilterExpression
All Implemented Interfaces:
IFilterExpression, java.io.Serializable
Direct Known Subclasses:
EqualsFilterExpression, GreaterThanEqualsFilterExpression, GreaterThanFilterExpression, LessThanEqualsFilterExpression, LessThanFilterExpression

public abstract class ComparableFilterExpression
extends java.lang.Object
implements IFilterExpression

A ComparableFilterExpression

ComparableFilterExpression

See Also:
Serialized Form

Field Summary
protected  boolean bFirstID
           
protected  boolean bSecondID
           
protected  java.lang.Comparable firstComparable
           
protected  java.lang.String firstIDValue
           
protected  java.lang.Object firstValue
           
protected  java.lang.Comparable secondComparable
           
protected  java.lang.String secondIDValue
           
protected  java.lang.Object secondValue
           
 
Constructor Summary
ComparableFilterExpression()
          Creates a new ComparableFilterExpression.
ComparableFilterExpression(java.lang.Object fValue, java.lang.Object sValue)
          Creates a new ComparableFilterExpression.
 
Method Summary
abstract  boolean checkCompare(int compare)
          Checks this compareTo returnValue and see if it satisfies the Expression
protected  void checkValues()
           
 boolean equals(java.lang.Object testObj)
           
 boolean evaluate(INode aNode)
          Evaluates this ComparableFilterExpression in against this INode of data
abstract  java.lang.String getCompareTypeString()
          Returns a String that describes this Compare Operation
 java.lang.Object getFirstValue()
           
protected static java.lang.String getID(java.lang.String idString)
           
 java.lang.Object getSecondValue()
           
protected static boolean isID(java.lang.String testID)
           
 java.lang.String stringEncode()
          Encode this expression into a string form.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

firstValue

protected java.lang.Object firstValue

secondValue

protected java.lang.Object secondValue

bFirstID

protected boolean bFirstID

firstIDValue

protected java.lang.String firstIDValue

firstComparable

protected java.lang.Comparable firstComparable

bSecondID

protected boolean bSecondID

secondIDValue

protected java.lang.String secondIDValue

secondComparable

protected java.lang.Comparable secondComparable
Constructor Detail

ComparableFilterExpression

public ComparableFilterExpression(java.lang.Object fValue,
                                  java.lang.Object sValue)
Creates a new ComparableFilterExpression.

ComparableFilterExpression

public ComparableFilterExpression()
Creates a new ComparableFilterExpression.
Method Detail

getFirstValue

public java.lang.Object getFirstValue()

getSecondValue

public java.lang.Object getSecondValue()

evaluate

public boolean evaluate(INode aNode)
                 throws UncomparableExpressionObjectException
Evaluates this ComparableFilterExpression in against this INode of data

The meat of this is that it checks to see if either of the two values are a comparable. If one or both are, it uses the compareTo method of compare to compare the firstValue to the secondValue and see if the first value is greater than the second value. If one of the values is an object, then it uses that object as a key into the aNode to get a comparable value out either something that can directly be used as a Comparable, or passed into the method of the other value which must be a comparable. If neither of the values are a comparable... who knows... bueller... bueller... But most things that would be used as an ID would be a comparable... so maybe we should check for a valid id into the node first... How about we specify some way that a id should be encoded so that we know its an id... the $ID$ type specifier looks to be good... so if either value is a string, then it should pull the value out of the INode, then do comparable stuffs on it...

Specified by:
evaluate in interface IFilterExpression
Parameters:
infoDatum - the data to check
Returns:
boolean always returns false

stringEncode

public java.lang.String stringEncode()
Encode this expression into a string form. Just returns a 0 length string right now

Specified by:
stringEncode in interface IFilterExpression
Returns:
String this Expression in string form

getCompareTypeString

public abstract java.lang.String getCompareTypeString()
Returns a String that describes this Compare Operation

Returns:
String this Expression in string form

checkCompare

public abstract boolean checkCompare(int compare)
Checks this compareTo returnValue and see if it satisfies the Expression

Parameters:
compare - the value from the compareTo method
Returns:
boolean is this expression valid?

equals

public boolean equals(java.lang.Object testObj)
Overrides:
equals in class java.lang.Object

checkValues

protected void checkValues()

isID

protected static boolean isID(java.lang.String testID)

getID

protected static java.lang.String getID(java.lang.String idString)


Copyright 2002 Free Software Foundation. All Rights Reserved.