laser.alphabet.labelpattern
Class AllLabelPattern<L extends LabelInterface>

java.lang.Object
  extended by laser.alphabet.labelpattern.AllLabelPattern<L>
Type Parameters:
L - The type of Label with respect to which this AllLabelPattern has meaning.
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<LabelPatternInterface<? extends L>>, LabelPatternInterface<L>

public class AllLabelPattern<L extends LabelInterface>
extends java.lang.Object
implements LabelPatternInterface<L>

This class represents an "all" LabelPattern. The LabelPattern . or "all," with respect to an Alphabet of the correct type, specifies the set of all Labels in the Alphabet.

LabelPatterns should only be instantiated by LabelPattern factories.

Author:
Nathan A. Jokel (laser-software@cs.umass.edu)
See Also:
laser.alphabetinterface.labelpatterninterface.LabelPatternInterface, laser.alphabetinterface.labelpatterninterface.LabelPatternFactoryInterface, Serialized Form

Constructor Summary
protected AllLabelPattern(java.lang.Class<L> labelClass)
          Creates a new all LabelPattern.
 
Method Summary
 LabelPatternInterface<L> clone()
          Returns a copy of this AllLabelPattern.
 int compareTo(LabelPatternInterface<? extends L> pattern)
          Compares this AllLabelPattern with the specified LabelPattern for order.
 boolean equals(java.lang.Object obj)
          Compares this AllLabelPattern with the specified Object for equality.
 java.util.Set<L> getMatchingLabels(AlphabetInterface<? extends L> alphabet)
          Returns a Set containing the subset of Labels of the specified Alphabet that this LabelPattern specifies.
 int hashCode()
          Returns a hash code value for this AllLabelPattern.
 java.lang.String toString()
          Returns the String representation of this LabelPattern.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AllLabelPattern

protected AllLabelPattern(java.lang.Class<L> labelClass)
Creates a new all LabelPattern. This constructor should not be used to instantiate AllLabelPatterns; they should only be instantiated by the factory method LabelPatternFactoryInterface.createAllLabelPatternInterface().

See Also:
laser.alphabetinterface.labelpatterninterface.LabelPatternFactoryInterface#createAllLabelPatternInterface
Method Detail

clone

public LabelPatternInterface<L> clone()
Returns a copy of this AllLabelPattern.

Specified by:
clone in interface LabelPatternInterface<L extends LabelInterface>
Overrides:
clone in class java.lang.Object
Returns:
The copy.
See Also:
Object.clone()

compareTo

public int compareTo(LabelPatternInterface<? extends L> pattern)
Compares this AllLabelPattern with the specified LabelPattern for order. The order is determined by comparing the String representations of the LabelPatterns.

If this AllLabelPattern is less than the specified LabelPattern, a negative integer is returned. If this AllLabelPattern is equal to the specified LabelPattern, zero is returned. If this AllLabelPattern is greater than the specified LabelPattern, a positive integer is returned.

Specified by:
compareTo in interface java.lang.Comparable<LabelPatternInterface<? extends L extends LabelInterface>>
Parameters:
pattern - The LabelPatternInterface to compare with this AllLabelPattern.
Returns:
a negative integer when this AllLabelPattern is less than the specified LabelPattern, zero when this AllLabelPattern is equal to the specified LabelPattern, and a positive integer when this AllLabelPattern is greater than the specified LabelPattern.
Throws:
java.lang.NullPointerException - if the specified LabelPattern is null.

equals

public boolean equals(java.lang.Object obj)
Compares this AllLabelPattern with the specified Object for equality. Returns true if the specified Object is also an AllLabelPattern, and it has meaning with respect to the same types of Alphabets and Labels, false otherwise.

Specified by:
equals in interface LabelPatternInterface<L extends LabelInterface>
Overrides:
equals in class java.lang.Object
Parameters:
obj - The Object to test for equality.
Returns:
true if the specified Object is also an AllLabelPattern, and it has meaning with respect to the same types of Alphabets and Labels, false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this AllLabelPattern.

Specified by:
hashCode in interface LabelPatternInterface<L extends LabelInterface>
Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this AllLabelPattern.

toString

public java.lang.String toString()
Returns the String representation of this LabelPattern.

Overrides:
toString in class java.lang.Object
Returns:
The String representation of this LabelPattern.
See Also:
Object.toString()

getMatchingLabels

public java.util.Set<L> getMatchingLabels(AlphabetInterface<? extends L> alphabet)
Returns a Set containing the subset of Labels of the specified Alphabet that this LabelPattern specifies.

Specified by:
getMatchingLabels in interface LabelPatternInterface<L extends LabelInterface>
Parameters:
alphabet - The Alphabet of which this LabelPattern is to specify a subset.
Returns:
The subset.
Throws:
java.lang.NullPointerException - When the specified Alphabet is null.
See Also:
laser.alphabetinterface.labelpatterninterface.LabelPatternInterface