com.gmail.thejcwk.semantics
Class Filter

java.lang.Object
  extended by com.gmail.thejcwk.semantics.Filter
All Implemented Interfaces:
java.io.Serializable

public class Filter
extends java.lang.Object
implements java.io.Serializable

Encapsulates a filter that can be applied to a PhraseCollection. This filter specifies an operation, an attribute type and a value. The operation details whether phrases matching the value should be ADDed, REMOVEd or ISOLATEd. The attribute type variable specifies which attribute of a phrase the value is applicable to.

Version:
0.1
Author:
Jan Kroeze
See Also:
Serialized Form

Nested Class Summary
static class Filter.ATTRIBUTE_TYPE
           
static class Filter.OPERATION
           
 
Constructor Summary
Filter(Filter.OPERATION anOperation, Filter.ATTRIBUTE_TYPE anAttrType, java.lang.String aValue)
          Create a new filter.
 
Method Summary
 Filter.ATTRIBUTE_TYPE getAttrType()
          Returns a value that specifies which attribute this Filter checks against.
 Filter.OPERATION getOperation()
          Returns the operation specified by this Filter.
 java.lang.String getValue()
          Returns the value this Filter checks against.
 boolean matches(Phrase p)
          Determines if this filter is applicable to the specified phrase.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Filter

public Filter(Filter.OPERATION anOperation,
              Filter.ATTRIBUTE_TYPE anAttrType,
              java.lang.String aValue)
Create a new filter. This filter will apply anOperation to all phrases whose anAttrTypes match aValue.

Parameters:
anOperation - Value of type OPERATION.
anAttrType - Value of type ATTRIBUTE_TYPE.
aValue - String.
Method Detail

getAttrType

public Filter.ATTRIBUTE_TYPE getAttrType()
Returns a value that specifies which attribute this Filter checks against.

Returns:
An ATTRIBUTE_TYPE object.

getOperation

public Filter.OPERATION getOperation()
Returns the operation specified by this Filter.

Returns:
An OPERATION object.

getValue

public java.lang.String getValue()
Returns the value this Filter checks against.

Returns:
A String object.

matches

public boolean matches(Phrase p)
Determines if this filter is applicable to the specified phrase.

Parameters:
p - A Phrase.
Returns:
True / false.

toString

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