laser.alphabet
Interface AlphabetFactoryInterface<L extends LabelInterface>

Type Parameters:
L - The type of Label this factory creates.
All Known Subinterfaces:
AlphabetInterface<L>, LabelPatternFactoryInterface<L>
All Known Implementing Classes:
AbstractLabelPatternFactory, Alphabet, IndexedAlphabet, IndexedAlphabetFactory, IndexedLabelPatternFactory, StringAlphabetFactory, StringLabelPatternFactory

public interface AlphabetFactoryInterface<L extends LabelInterface>

This interface is implemented by all types of Alphabet factories. An AlphabetFactory, as in the factory design pattern, (Design Patterns, Gamma, Helm, Johnson, and Vlissides, p87, 1995) is used to create Labels and Alphabets of one type that is specific to that particular factory.

Author:
Nathan A. Jokel (laser-software@cs.umass.edu)
See Also:
AlphabetInterface, LabelInterface

Method Summary
 AlphabetInterface<L> createAlphabetInterface(java.lang.Object... args)
          Creates an Alphabet of the appropriate type for the factory.
 L createLabelInterface(java.lang.String inputString)
          Gets a Label of the type appropriate for the factory.
 java.lang.Object[] getCreateAlphabetArgs(AlphabetInterface<L> alphabet)
          Gets any required arguments for the create alphabet method from the given alphabet.
 boolean isValidLabel(java.lang.String s)
          Returns true if the specified String specifies a valid Label of the type this factory creates, false otherwise.
 AlphabetInterface<L> unmodifiableAlphabet(AlphabetInterface<L> alphabet)
          Returns an unmodifiable view of the specified Alphabet (optional operation).
 

Method Detail

createLabelInterface

L createLabelInterface(java.lang.String inputString)
                                              throws AlphabetInterfaceException
Gets a Label of the type appropriate for the factory.

Parameters:
inputString - The String from which the Label is constructed.
Returns:
The Label.
Throws:
AlphabetInterfaceException - When the label for the specified inputSting cannot be created.

createAlphabetInterface

AlphabetInterface<L> createAlphabetInterface(java.lang.Object... args)
                                                                    throws AlphabetInterfaceException
Creates an Alphabet of the appropriate type for the factory.

Parameters:
args - The input arguments used in the construction of the Alphabet.
Returns:
The Alphabet.
Throws:
AlphabetInterfaceException - When the Alphabet cannot be created from the specified input arguments.

getCreateAlphabetArgs

java.lang.Object[] getCreateAlphabetArgs(AlphabetInterface<L> alphabet)
Gets any required arguments for the create alphabet method from the given alphabet.

PRECONDITION: The alphabet must be non-null.

Parameters:
alphabet - The alphabet to use as a prototype
Returns:
Any required arguments for the create alphabet method

isValidLabel

boolean isValidLabel(java.lang.String s)
Returns true if the specified String specifies a valid Label of the type this factory creates, false otherwise.

Parameters:
s - The String.
Returns:
true if the specified String specifies a valid Label of the type this factory creates, false otherwise.
Throws:
java.lang.NullPointerException - The specified String is null.
See Also:
createLabelInterface(String)

unmodifiableAlphabet

AlphabetInterface<L> unmodifiableAlphabet(AlphabetInterface<L> alphabet)
Returns an unmodifiable view of the specified Alphabet (optional operation). Any attempt to modify the returned Alphabet will result in an UnsupportedOperationException being thrown.

Parameters:
alphabet - The Alphabet.
Returns:
An unmodifiable view of the specified Alphabet.
Throws:
java.lang.NullPointerException - the specified Alphabet is null.
java.lang.UnsupportedOperationException - this method is not supported.