de.fhdarmstadt.fbi.dtree.model
Class NodePattern

java.lang.Object
  extended byde.fhdarmstadt.fbi.dtree.model.NodePattern
All Implemented Interfaces:
RegularPattern

public class NodePattern
extends java.lang.Object
implements RegularPattern

A node pattern encapsulates a Perl-Syntax regular pattern together with a positive or negative classification.

Instances of this class are unmodifiable.


Constructor Summary
NodePattern(java.lang.String pattern, Classification classification)
          Creates a new (unmodifiable) Node pattern.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks, whether a certain object is equal to this pattern.
 Classification getClassification()
          Returns the classification for this pattern.
 java.lang.String getPattern()
          Returns the regular pattern string.
 int hashCode()
          Returns a hash code value for the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodePattern

public NodePattern(java.lang.String pattern,
                   Classification classification)
Creates a new (unmodifiable) Node pattern.

Parameters:
pattern - the pattern
classification - the classification for this pattern.
Throws:
java.lang.NullPointerException - if pattern or classification are null
java.lang.IllegalArgumentException - if the classification is UNKNOWN.
Method Detail

getClassification

public Classification getClassification()
Returns the classification for this pattern.

Specified by:
getClassification in interface RegularPattern
Returns:
the classification, either Classification.POSITIVE or Classification.NEGATIVE.

getPattern

public java.lang.String getPattern()
Returns the regular pattern string.

Specified by:
getPattern in interface RegularPattern
Returns:
the pattern string, never null.
See Also:
Pattern

equals

public boolean equals(java.lang.Object o)
Checks, whether a certain object is equal to this pattern. The test should return true, if the pattern and the classification are equal.

Specified by:
equals in interface RegularPattern
Parameters:
o - the pattern.
Returns:
true, if the given object is a pattern and is equal to this pattern.

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

Returns:
a hash code value for this object.
See Also:
Object.equals(Object)