de.jstacs.data
Class AlphabetContainerParameterSet

java.lang.Object
  extended by de.jstacs.parameters.ParameterSet
      extended by de.jstacs.data.AlphabetContainerParameterSet
All Implemented Interfaces:
RangeIterator, Storable, Cloneable

public class AlphabetContainerParameterSet
extends ParameterSet

Class for the ParameterSet of an AlphabetContainer.

Author:
Jan Grau

Nested Class Summary
static class AlphabetContainerParameterSet.AlphabetArrayParameterSet
          Class for the parameters of an array of Alphabets of defined length.
static class AlphabetContainerParameterSet.SectionDefinedAlphabetParameterSet
          Class for the parameters of an array of Alphabets where each alphabet may be used for one or more sections of positions.
 
Nested classes/interfaces inherited from class de.jstacs.parameters.ParameterSet
ParameterSet.ParameterList
 
Field Summary
 
Fields inherited from class de.jstacs.parameters.ParameterSet
alternativeInstanceClass, errorMessage, parameters, parent, ranged
 
Constructor Summary
AlphabetContainerParameterSet(Alphabet alph)
          Creates a new AlphabetContainerParameterSet from a single Alphabet.
AlphabetContainerParameterSet(Alphabet[] alphabets)
          Creates a new AlphabetContainerParameterSet from an array of Alphabets.
AlphabetContainerParameterSet(Alphabet[] alphabets, int[] indexes)
          Creates a new AlphabetContainerParameterSet from an array of Alphabets and an array of ints defining the number of the alphabet in alphabets that is used for that position in indexes.
AlphabetContainerParameterSet(boolean discrete, boolean simple)
          Creates a new AlphabetContainerParameterSet.
AlphabetContainerParameterSet(StringBuffer representation)
          Creates a new AlphabetContainerParameterSet from its XML-representation.
 
Method Summary
 AlphabetContainerParameterSet clone()
          Creates a full clone (deep copy) of this ParameterSet.
protected  void fromXML(StringBuffer representation)
          Parses the instance fields of a ParameterSet from the XML-representation as returned by ParameterSet.toXML().
 String getInstanceComment()
          Returns a comment (a textual description) of the class that can be constructed using this ParameterSet.
 String getInstanceName()
          Returns the name of an instance of the class that can be constructed using this ParameterSet.
 int getPossibleLength()
          Returns the length of the alphabet that can be instantiated using this set.
 boolean isDiscrete()
          If this method returns true all postions use DiscreteAlphabetParameterSets.
 boolean isSimple()
          If this method returns true all postions use the same alphabet.
protected  void loadParameters()
          Loads the parameters for this ParameterSet.
 StringBuffer toXML()
          This method returns an XML-representation of an instance of the implementing class.
 
Methods inherited from class de.jstacs.parameters.ParameterSet
getErrorMessage, getId, getInstance, getInstanceClass, getNumberOfParameters, getNumberOfValues, getParameterAt, getParent, hasDefaultOrIsSet, initParameterList, initParameterList, isAtomic, isRanged, makeRanged, next, parametersLoaded, propagateId, recieveId, replaceParametersWithRangedInstance, reset, resetToFirst, setAlternativeInstanceClass, setParent, simplify, valuesToString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlphabetContainerParameterSet

public AlphabetContainerParameterSet(boolean discrete,
                                     boolean simple)
Creates a new AlphabetContainerParameterSet. If discrete is true, only the parameters for discrete Alphabets are defined. Is simple is true, only a single alphabet is expected.

Parameters:
discrete - if the alphabet(s) shall be discrete
simple - if there shall be only a single Alphabet

AlphabetContainerParameterSet

public AlphabetContainerParameterSet(StringBuffer representation)
                              throws NonParsableException
Creates a new AlphabetContainerParameterSet from its XML-representation.

Parameters:
representation - the XML-representation
Throws:
NonParsableException - is thrown if representation could not be parsed

AlphabetContainerParameterSet

public AlphabetContainerParameterSet(Alphabet alph)
                              throws Exception
Creates a new AlphabetContainerParameterSet from a single Alphabet.

Parameters:
alph - the Alphabet
Throws:
Exception - is thrown if an error occurred during the creation of the appropriate Parameters

AlphabetContainerParameterSet

public AlphabetContainerParameterSet(Alphabet[] alphabets)
                              throws Exception
Creates a new AlphabetContainerParameterSet from an array of Alphabets.

Parameters:
alphabets - the Alphabets
Throws:
Exception - is thrown if an error occurred during the creation of the appropriate Parameters

AlphabetContainerParameterSet

public AlphabetContainerParameterSet(Alphabet[] alphabets,
                                     int[] indexes)
                              throws Exception
Creates a new AlphabetContainerParameterSet from an array of Alphabets and an array of ints defining the number of the alphabet in alphabets that is used for that position in indexes.

Parameters:
alphabets - the Alphabets
indexes - the indexes
Throws:
Exception - is thrown if an error occurred during the creation of the appropriate Parameters
Method Detail

clone

public AlphabetContainerParameterSet clone()
                                    throws CloneNotSupportedException
Description copied from class: ParameterSet
Creates a full clone (deep copy) of this ParameterSet. As a convenience-method the user can use fillWithStandardFieldsForClone(ParameterSet) on a newly created instance of a subclass of ParameterSet to obtain a clone/copy of all standard member variables (those already defined in ParameterSet) in the passed ParameterSet. Using this method, the cloning-process becomes merely three-step:
This method fulfils the conventions of Object's method clone()

Overrides:
clone in class ParameterSet
Returns:
a deep clone of this ParameterSet
Throws:
CloneNotSupportedException

isDiscrete

public boolean isDiscrete()
If this method returns true all postions use DiscreteAlphabetParameterSets.

Returns:
true if all postions are discrete

isSimple

public boolean isSimple()
If this method returns true all postions use the same alphabet.

Returns:
true if all postions use the same alphabet

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML-representation of an instance of the implementing class.

Specified by:
toXML in interface Storable
Overrides:
toXML in class ParameterSet
Returns:
the XML-representation

fromXML

protected void fromXML(StringBuffer representation)
                throws NonParsableException
Description copied from class: ParameterSet
Parses the instance fields of a ParameterSet from the XML-representation as returned by ParameterSet.toXML().

Overrides:
fromXML in class ParameterSet
Parameters:
representation - the XML-representation
Throws:
NonParsableException - is thrown if the XML-code could not be parsed

getPossibleLength

public int getPossibleLength()
Returns the length of the alphabet that can be instantiated using this set.

Returns:
the length

loadParameters

protected void loadParameters()
                       throws Exception
Description copied from class: ParameterSet
Loads the parameters for this ParameterSet. This is in most cases done by simply creating a new ArrayList<Parameter> for the field parameters/code> and filling it with instances of subclasses of Parameter

Specified by:
loadParameters in class ParameterSet
Throws:
Exception - an Exception is thrown if the parameters could not be loaded
See Also:
ParameterSet.parameters, Parameter

getInstanceName

public String getInstanceName()
Description copied from class: ParameterSet
Returns the name of an instance of the class that can be constructed using this ParameterSet.

Specified by:
getInstanceName in class ParameterSet
Returns:
the name

getInstanceComment

public String getInstanceComment()
Description copied from class: ParameterSet
Returns a comment (a textual description) of the class that can be constructed using this ParameterSet.

Specified by:
getInstanceComment in class ParameterSet
Returns:
the comment