laser.alphabet.labelpattern
Interface ClassSetLabelPatternInterface<L extends LabelInterface>

Type Parameters:
L - The type of Label with respect to which this ClassSetLabelPatternInterface has meaning.
All Superinterfaces:
java.lang.Cloneable, java.lang.Comparable<LabelPatternInterface<? extends L>>, LabelPatternInterface<L>, java.io.Serializable
All Known Implementing Classes:
ClassSetLabelPattern

public interface ClassSetLabelPatternInterface<L extends LabelInterface>
extends LabelPatternInterface<L>

An interface implemented by "class set" LabelPatterns.

The LabelPattern "class set," with respect to an Alphabet of the correct type, specifies the subset, S, of Labels in the Alphabet that have been explicitly specified as being included in S.

Labels can be added to the ClassSetLabelPattern, effectively specifying them as being included in S. Likewise, they can be removed, thus retracting such specification.

LabelPatterns can also be added to the ClassSetLabelPattern, specifying their participation in determining S. Likewise, such participation can be retracted by removing the LabelPatterns.

The subset S that ClassSetLabelPattern P specifies is defined as follows: With respect to an Alphabet of the correct type, A, S is the union of the subsets of A specified by each of the LabelPatterns included in P, unioned with the set of all Labels that are included in P and contained in A.

Note that when adding and removing Labels and LabelPatterns to and from the ClassSetLabelPattern, simple tests for equality are used. Labels are only compared to Labels via their equals methods, and LabelPatterns are only compared to LabelPatterns via their equals methods. Even though in the context of some Alphabet, a Label associated with this ClassSetLabelPattern might also be in the subset specified by some LabelPattern associated with this ClassSetLabelPattern, such relationships are not considered when adding or removing Labels or LabelPatterns.

For example, consider Alphabet A containing Label L. LabelPattern P, with respect to A, specifies the subset {L}. If both L and P are specified as being included in some ClassSetLabelPattern (by the addIncludedLabel and addIncludedLabelPattern methods), and L is subsequently removed (via the removeIncludedLabel method), then with respect to A, the subset the ClassSetLabelPattern specifies still contains L because even though L itself was removed from the ClassSetLabelPattern, the simple equality test does not affect P's participation in the subset's specification.

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

Method Summary
 boolean addIncludedLabel(L label)
          Specifies the given Label as being included in the subset this LabelPattern specifies.
 boolean addIncludedLabelPattern(LabelPatternInterface<L> labelPattern)
          Specifies the given LabelPattern as participating in determining the subset this LabelPattern specifies.
 boolean addIncludedLabelPatterns(java.util.Set<? extends LabelPatternInterface<L>> labelPatterns)
          Specifies each LabelPattern in the given Set as participating in determining the subset this LabelPattern specifies.
 boolean addIncludedLabels(java.util.Set<? extends L> labels)
          Specifies each Label in the given Set as being included in the subset this LabelPattern specifies.
 java.util.Set<LabelPatternInterface<L>> getIncludedLabelPatterns()
          Returns a Set containing all of the LabelPatterns specified as participating in determining the subset this ClassSetLabelPattern specifies.
 java.util.Set<L> getIncludedLabels()
          Returns a Set containing all of the Labels specified as being included in the subset this ClassSetLabelPattern specifies.
 boolean removeIncludedLabel(L label)
          Removes the specification that the given Label is to be included in the subset this LabelPattern specifies.
 boolean removeIncludedLabelPattern(LabelPatternInterface<L> labelPattern)
          Removes the specification that the given LabelPattern is to participate in determining the subset this LabelPattern specifies.
 boolean removeIncludedLabelPatterns(java.util.Set<? extends LabelPatternInterface<L>> labelPatterns)
          Removes the specification that each LabelPattern in the given Set is to participate in determining the subset this LabelPattern specifies.
 boolean removeIncludedLabels(java.util.Set<? extends L> labels)
          Removes the specification that each Label in the given Set is to be included in the subset this LabelPattern specifies.
 
Methods inherited from interface laser.alphabet.labelpattern.LabelPatternInterface
clone, equals, getMatchingLabels, hashCode
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

addIncludedLabel

boolean addIncludedLabel(L label)
Specifies the given Label as being included in the subset this LabelPattern specifies. If an equal Label (according to its equals method) is already specified as being so included, false is returned and this ClassSetLabelPattern is unchanged, otherwise true is returned.

Parameters:
label - Label to be included.
Returns:
false if an equal Label is already specified as being included, true otherwise.
Throws:
java.lang.NullPointerException - if the specified Label is null.

addIncludedLabels

boolean addIncludedLabels(java.util.Set<? extends L> labels)
Specifies each Label in the given Set as being included in the subset this LabelPattern specifies. If an equal Label (according to its equals method) to every Label in the given Set is already specified as being so included, false is returned and this LabelPattern is unchanged, otherwise true is returned.

Parameters:
labels - Labels to be included.
Returns:
false if an equal Label (according to its equals method) to every Label in the given Set is already specified as being included in the subset this LabelPattern specifies, true otherwise.
Throws:
java.lang.NullPointerException - if the specified Set or any Label it contains is null.

addIncludedLabelPattern

boolean addIncludedLabelPattern(LabelPatternInterface<L> labelPattern)
Specifies the given LabelPattern as participating in determining the subset this LabelPattern specifies. If an equal LabelPattern (according to its equals method) is already so specified, false is returned and this ClassSetLabelPattern is unchanged, otherwise true is returned.

Parameters:
labelPattern - LabelPattern to be included.
Returns:
false if an equal LabelPattern is already specified as participating, true otherwise.
Throws:
java.lang.NullPointerException - if the specified LabelPattern is null.

addIncludedLabelPatterns

boolean addIncludedLabelPatterns(java.util.Set<? extends LabelPatternInterface<L>> labelPatterns)
Specifies each LabelPattern in the given Set as participating in determining the subset this LabelPattern specifies. If an equal LabelPattern (according to its equals method) to every Label in the given Set is already so specified, false is returned and this LabelPattern is unchanged, otherwise true is returned.

Parameters:
labelPatterns - LabelPatterns to be included.
Returns:
false if an equal LabelPattern (according to its equals method) to every Label in the given Set is already specified as participating in determining the subset this LabelPattern specifies, true otherwise.
Throws:
java.lang.NullPointerException - if the specified Set or any LabelPattern it contains is null.

getIncludedLabels

java.util.Set<L> getIncludedLabels()
Returns a Set containing all of the Labels specified as being included in the subset this ClassSetLabelPattern specifies. This Set is a copy, thus modifying it or any of the Labels it contains has no effect on the ClassSetLabelPattern, nor does modifying the ClassSetLabelPattern have any effect on the returned Set or any of the Labels it contains.

Returns:
a Set containing all of the Labels specified as being included in the subset this ClassSetLabelPattern specifies.

getIncludedLabelPatterns

java.util.Set<LabelPatternInterface<L>> getIncludedLabelPatterns()
Returns a Set containing all of the LabelPatterns specified as participating in determining the subset this ClassSetLabelPattern specifies. This Set is a copy, thus modifying it or any of the LabelPatterns it contains has no effect on the ClassSetLabelPattern, nor does modifying the ClassSetLabelPattern have any effect on the returned Set or any of the LabelPatterns it contains.

Returns:
a Set containing all of the LabelPatterns specified as participating in determining the subset this ClassSetLabelPattern specifies.

removeIncludedLabel

boolean removeIncludedLabel(L label)
Removes the specification that the given Label is to be included in the subset this LabelPattern specifies. If an equal Label (according to its equals method) was specified as being so included, true is returned, otherwise false is returned and this ClassSetLabelPattern is unchanged.

Parameters:
label - Label no longer to be included.
Returns:
true if a Label equal to the given Label was specified as being included, false otherwise.
Throws:
java.lang.NullPointerException - if the specified Label is null.

removeIncludedLabels

boolean removeIncludedLabels(java.util.Set<? extends L> labels)
Removes the specification that each Label in the given Set is to be included in the subset this LabelPattern specifies. If an equal Label (according to its equals method) to any Label in the given Set was specified as being so included, true is returned, otherwise false is returned and this LabelPattern is unchanged.

Parameters:
labels - Labels no longer to be included.
Returns:
true If an equal Label (according to its equals method) to any Label in the given Set was specified as being included in the subset this LabelPattern specifies, false otherwise.
Throws:
java.lang.NullPointerException - if the specified Set or any Label it contains is null.

removeIncludedLabelPattern

boolean removeIncludedLabelPattern(LabelPatternInterface<L> labelPattern)
Removes the specification that the given LabelPattern is to participate in determining the subset this LabelPattern specifies. If an equal LabelPattern (according to its equals method) was so specified, true is returned, otherwise false is returned and this ClassSetLabelPattern is unchanged.

Parameters:
labelPattern - LabelPattern no longer to be included.
Returns:
true if a LabelPattern equal to the given Label was specified as participating, false otherwise.
Throws:
java.lang.NullPointerException - if the specified LabelPattern is null.

removeIncludedLabelPatterns

boolean removeIncludedLabelPatterns(java.util.Set<? extends LabelPatternInterface<L>> labelPatterns)
Removes the specification that each LabelPattern in the given Set is to participate in determining the subset this LabelPattern specifies. If an equal LabelPattern (according to its equals method) to any of the LabelPatterns in the given Set was so specified, true is returned, otherwise false is returned and this ClassSetLabelPattern is unchanged.

Parameters:
labelPatterns - LabelPatterns no longer to be included.
Returns:
true if an equal LabelPattern (according to its equals method) to any of the LabelPatterns in the given Set was specified as participating in determining the subset this LabelPattern specifies, false otherwise.
Throws:
java.lang.NullPointerException - if the specified Set or any LabelPattern it contains is null.