org.progeeks.graph
Class FieldComparePredicate

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

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

Predicate which compares field values of the specified field against the specified value. Class evaluation limiting may be achieved by specifying the metaClass or metaClassName properties.

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

Field Summary
static int EQUALS
          Public constants of available operations.
static int GREATER_THAN
           
static int GREATER_THAN_EQUAL_TO
           
static int LESS_THAN
           
static int LESS_THAN_EQUAL_TO
           
static int MATCHES
           
static int NOT_EQUALS
           
 
Constructor Summary
FieldComparePredicate()
           
FieldComparePredicate(MetaClass metaClass)
          Constructor to create a MateObjectPredicate from a MetaClass.
FieldComparePredicate(MetaClass metaClass, java.lang.String field, java.lang.Object value)
          Constructor to create a MateObjectPredicate from a MetaClass, field and value.
FieldComparePredicate(java.lang.String metaClassName, java.lang.String field, java.lang.Object value)
          Constructor to create a MateObjectPredicate from a meta class name, field and value.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 boolean evaluate(java.lang.Object obj)
          Returns true if the specified node is a meta-object with the correct field value.
 java.lang.String getFieldName()
          Returns the field name for which we are checking.
 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.
 int getOperation()
          Gets the operation used for this evaluation.
 java.lang.Object getValue()
          Returns the value for which we are looking.
 int hashCode()
           
 void setFieldName(java.lang.String field)
          Sets the field name for this predicate.
 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 setOperation(int op)
          Set the operation used in the evaluation
 void setValue(java.lang.Object value)
          Sets the value assocaited with the field of this predicate.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUALS

public static final int EQUALS
Public constants of available operations.

See Also:
Constant Field Values

NOT_EQUALS

public static final int NOT_EQUALS
See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
See Also:
Constant Field Values

LESS_THAN_EQUAL_TO

public static final int LESS_THAN_EQUAL_TO
See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
See Also:
Constant Field Values

GREATER_THAN_EQUAL_TO

public static final int GREATER_THAN_EQUAL_TO
See Also:
Constant Field Values

MATCHES

public static final int MATCHES
See Also:
Constant Field Values
Constructor Detail

FieldComparePredicate

public FieldComparePredicate()

FieldComparePredicate

public FieldComparePredicate(MetaClass metaClass)
Constructor to create a MateObjectPredicate from a MetaClass.


FieldComparePredicate

public FieldComparePredicate(java.lang.String metaClassName,
                             java.lang.String field,
                             java.lang.Object value)
Constructor to create a MateObjectPredicate from a meta class name, field and value.


FieldComparePredicate

public FieldComparePredicate(MetaClass metaClass,
                             java.lang.String field,
                             java.lang.Object value)
Constructor to create a MateObjectPredicate from a MetaClass, field and value.

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.


getValue

public java.lang.Object getValue()
Returns the value for which we are looking.


setValue

public void setValue(java.lang.Object value)
Sets the value assocaited with the field of this predicate.


setOperation

public void setOperation(int op)
Set the operation used in the evaluation


getOperation

public int getOperation()
Gets the operation used for this evaluation.


evaluate

public boolean evaluate(java.lang.Object obj)
Returns true if the specified node is a meta-object with the correct field value.
Evaluation happens as follows:

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.