org.progeeks.graph
Class MetaObjectRangePredicate

java.lang.Object
  extended by org.progeeks.graph.MetaObjectRangePredicate
All Implemented Interfaces:
java.io.Serializable, org.apache.commons.collections.Predicate

public class MetaObjectRangePredicate
extends java.lang.Object
implements org.apache.commons.collections.Predicate, java.io.Serializable

Predicate that evaluates a value to determine if it falls within a min and a max range ( inclusive, for now ).
Upper and lower ranges are not necessarily required. Evaluation is handled as follow:

metaClass and metaClassName are optional parameters, but are mutually exclusive.

fieldName is a required parameter. TODO: - re-evaluate fieldName being required since other Meta* predicates don't.

Version:
$Revision: 1.7 $
Author:
Dave Garvis
See Also:
Serialized Form

Field Summary
static int EXCLUSIVE
          Flag to specify the min and max value should be exclusive.
static int MAX_EXCLUSIVE
          Flag to specify if the max value should be exclusive.
static int MIN_EXCLUSIVE
          Flag to specify if the min value should be exclusive.
 
Constructor Summary
MetaObjectRangePredicate()
           
MetaObjectRangePredicate(MetaClass metaClass, java.lang.String field, java.lang.Comparable maxValue, java.lang.Comparable minValue)
           
MetaObjectRangePredicate(MetaClass metaClass, java.lang.String field, java.lang.Comparable maxValue, java.lang.Comparable minValue, int inclusiveFlags)
           
MetaObjectRangePredicate(java.lang.String metaClassName, java.lang.String field, java.lang.Comparable maxValue, java.lang.Comparable minValue)
           
MetaObjectRangePredicate(java.lang.String metaClassName, java.lang.String field, java.lang.Comparable maxValue, java.lang.Comparable minValue, int inclusiveFlags)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 boolean evaluate(java.lang.Object obj)
          Returns true if the specified node is a meta-object whose field value fall within min and max range.
 int getExclusiveFlags()
          Gets the inclusive flags.
 java.lang.String getFieldName()
          Returns the field name for which we are checking.
 java.lang.Comparable getMaxValue()
           
 MetaClass getMetaClass()
          Returns the meta-class for which we are searching.
 java.lang.String getMetaClassName()
          Returns the meta-class name for which we are searching.
 java.lang.Comparable getMinValue()
           
 int hashCode()
           
 void setExclusiveFlags(int exclusiveFlags)
          Sets the inclusive flags
 void setFieldName(java.lang.String field)
          Sets the field name for this predicate.
 void setMaxValue(java.lang.Comparable maxValue)
          Set the maximum acceptable value in the range.
 void setMetaClass(MetaClass metaClass)
          Sets the meta-class to be searched later.
 void setMetaClassName(java.lang.String metaClassName)
          Sets the metaClassName for this predicate.
 void setMinValue(java.lang.Comparable minValue)
          Set the minimum acceptable value in the range.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_EXCLUSIVE

public static final int MIN_EXCLUSIVE
Flag to specify if the min value should be exclusive.

See Also:
Constant Field Values

MAX_EXCLUSIVE

public static final int MAX_EXCLUSIVE
Flag to specify if the max value should be exclusive.

See Also:
Constant Field Values

EXCLUSIVE

public static final int EXCLUSIVE
Flag to specify the min and max value should be exclusive.

See Also:
Constant Field Values
Constructor Detail

MetaObjectRangePredicate

public MetaObjectRangePredicate()

MetaObjectRangePredicate

public MetaObjectRangePredicate(java.lang.String metaClassName,
                                java.lang.String field,
                                java.lang.Comparable maxValue,
                                java.lang.Comparable minValue)

MetaObjectRangePredicate

public MetaObjectRangePredicate(java.lang.String metaClassName,
                                java.lang.String field,
                                java.lang.Comparable maxValue,
                                java.lang.Comparable minValue,
                                int inclusiveFlags)

MetaObjectRangePredicate

public MetaObjectRangePredicate(MetaClass metaClass,
                                java.lang.String field,
                                java.lang.Comparable maxValue,
                                java.lang.Comparable minValue)

MetaObjectRangePredicate

public MetaObjectRangePredicate(MetaClass metaClass,
                                java.lang.String field,
                                java.lang.Comparable maxValue,
                                java.lang.Comparable minValue,
                                int inclusiveFlags)
Method Detail

getMetaClass

public MetaClass getMetaClass()
Returns the meta-class for which we are searching.


setMetaClass

public void setMetaClass(MetaClass metaClass)
Sets the meta-class to be searched later.


getMetaClassName

public java.lang.String getMetaClassName()
Returns the meta-class name for which we are searching.


setMetaClassName

public void setMetaClassName(java.lang.String metaClassName)
Sets the metaClassName for this predicate.


getFieldName

public java.lang.String getFieldName()
Returns the field name for which we are checking.


setFieldName

public void setFieldName(java.lang.String field)
Sets the field name for this predicate.


setMaxValue

public void setMaxValue(java.lang.Comparable maxValue)
Set the maximum acceptable value in the range.


getMaxValue

public java.lang.Comparable getMaxValue()

setMinValue

public void setMinValue(java.lang.Comparable minValue)
Set the minimum acceptable value in the range.


getMinValue

public java.lang.Comparable getMinValue()

getExclusiveFlags

public int getExclusiveFlags()
Gets the inclusive flags.


setExclusiveFlags

public void setExclusiveFlags(int exclusiveFlags)
Sets the inclusive flags


evaluate

public boolean evaluate(java.lang.Object obj)
Returns true if the specified node is a meta-object whose field value fall within min and max range.

Specified by:
evaluate in interface org.apache.commons.collections.Predicate

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.