|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.parameters.ParameterSet
de.jstacs.parameters.InstanceParameterSet<T>
de.jstacs.parameters.SequenceScoringParameterSet<T>
T
- the type of the SequenceScoringParameterSet
public abstract class SequenceScoringParameterSet<T extends InstantiableFromParameterSet>
Abstract class for a ParameterSet
containing all parameters necessary
to construct an Object
that implements
InstantiableFromParameterSet
. This parameter set handles the
AlphabetContainer
and if necessary the length of a sequence, so it is
well suited as parameter set for AbstractTrainableStatisticalModel
and
AbstractClassifier
.
InstantiableFromParameterSet
,
ParameterSet
,
AbstractTrainableStatisticalModel
,
AbstractClassifier
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.jstacs.parameters.ParameterSet |
---|
ParameterSet.ParameterList |
Field Summary | |
---|---|
protected Parameter |
alphabet
The alphabet the model works on |
protected Parameter |
length
The length of sequences the model can work on or 0 for
arbitrary length |
Fields inherited from class de.jstacs.parameters.ParameterSet |
---|
errorMessage, parameters, parent |
Constructor Summary | |
---|---|
SequenceScoringParameterSet(Class<T> instanceClass,
AlphabetContainer.AlphabetContainerType type,
boolean simple)
Constructs an InstanceParameterSet having empty parameter values. |
|
SequenceScoringParameterSet(Class<T> instanceClass,
AlphabetContainer.AlphabetContainerType type,
boolean simple,
boolean variableLength)
Constructs a SequenceScoringParameterSet having empty parameter
values. |
|
SequenceScoringParameterSet(Class<T> instanceClass,
AlphabetContainer alphabet)
Constructs a SequenceScoringParameterSet for an object that can
handle sequences of variable length and with the
AlphabetContainer alphabet . |
|
SequenceScoringParameterSet(Class<T> instanceClass,
AlphabetContainer alphabet,
int length,
boolean variableLength)
Constructs a SequenceScoringParameterSet from an
AlphabetContainer and the length of a sequence. |
|
SequenceScoringParameterSet(StringBuffer representation)
The standard constructor for the interface Storable . |
Method Summary | |
---|---|
SequenceScoringParameterSet<T> |
clone()
Creates a full clone (deep copy) of this ParameterSet . |
boolean |
equals(Object o)
|
protected void |
fromXML(StringBuffer representation)
Parses the instance fields of a ParameterSet from the XML
representation as returned by ParameterSet.toXML() . |
AlphabetContainer |
getAlphabetContainer()
Returns the AlphabetContainer of the current instance. |
int |
getLength()
Returns the length of the sequences the model can work on. |
int |
getNumberOfParameters()
Returns the number of parameters in the ParameterSet . |
Parameter |
getParameterAt(int i)
Returns the Parameter at position i . |
boolean |
hasDefaultOrIsSet()
Returns true if all parameters in this ParameterSet
are either set by the user or have default values. |
void |
reset()
Resets all Parameter s in this ParameterSet to their
default values or null if not default value was provided. |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
Methods inherited from class de.jstacs.parameters.InstanceParameterSet |
---|
getInstance, getInstanceClass, getInstanceComment, getInstanceName |
Methods inherited from class de.jstacs.parameters.ParameterSet |
---|
fromGalaxy, getAllParameterNames, getComment, getComment, getErrorMessage, getIndex, getName, getName, getParameterForName, getParent, initParameterList, initParameterList, isAtomic, isComparable, parametersLoaded, setParent, toGalaxy |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Parameter alphabet
protected Parameter length
0
for
arbitrary length
Constructor Detail |
---|
public SequenceScoringParameterSet(Class<T> instanceClass, AlphabetContainer.AlphabetContainerType type, boolean simple)
InstanceParameterSet
having empty parameter values.
This constructor should only be used if the object can handle sequences
of fixed length.
instanceClass
- the class of the instancetype
- the type of the alphabet(s)simple
- determines whether the alphabet should be simpleAlphabetContainer.AlphabetContainerType
public SequenceScoringParameterSet(Class<T> instanceClass, AlphabetContainer.AlphabetContainerType type, boolean simple, boolean variableLength)
SequenceScoringParameterSet
having empty parameter
values. The user can specify a-priori if the object can handle sequences
of variable lengths. If that is the case the object is not queried from
the user as it is 0
anyway.
instanceClass
- the (sub-)class of the instancetype
- the type of the alphabet(s)simple
- determines whether the alphabet should be simplevariableLength
- true
if the object can handle sequences of
arbitrary length, false
otherwiseAlphabetContainer.AlphabetContainerType
public SequenceScoringParameterSet(StringBuffer representation) throws NonParsableException
Storable
.
Constructs a SequenceScoringParameterSet
from its XML
representation. Automatically calls the current implementation of
fromXML(StringBuffer)
.
representation
- the XML representation as StringBuffer
NonParsableException
- if the StringBuffer
representation
could
not be parsedpublic SequenceScoringParameterSet(Class<T> instanceClass, AlphabetContainer alphabet, int length, boolean variableLength) throws Exception
SequenceScoringParameterSet
from an
AlphabetContainer
and the length of a sequence. This constructor
can be used to implement a SequenceScoringParameterSet
that is
already instantiated with known parameter values.
instanceClass
- the class of the instancealphabet
- the AlphabetContainer
for a sequencelength
- the length of sequencevariableLength
- true
if the object can handle sequences of
arbitrary length, false
otherwise
Exception
- if the alphabets or the length are not in the expected range
of valuespublic SequenceScoringParameterSet(Class<T> instanceClass, AlphabetContainer alphabet) throws Exception
SequenceScoringParameterSet
for an object that can
handle sequences of variable length and with the
AlphabetContainer
alphabet
. This constructor can be
used to implement a SequenceScoringParameterSet
that is already
instantiated with known parameter values.
0
.
instanceClass
- the (sub-)class of the instancealphabet
- the AlphabetContainer
for a sequence
Exception
- if the alphabets or the length are not in the expected range
of valuesMethod Detail |
---|
public boolean hasDefaultOrIsSet()
ParameterSet
true
if all parameters in this ParameterSet
are either set by the user or have default values. If any additional
constraints are required on your parameters you should either specify
some ParameterValidator
on these parameters or implement these
constraints by overriding this method in your implementation of
ParameterSet
. It is recommended to specify a useful remark which
constraint failed in the member-variable errorMessage
, which
will be displayed to the user. In the overriding method
super.
ParameterSet.hasDefaultOrIsSet()
should be called prior to
checking specific constraints.
hasDefaultOrIsSet
in class ParameterSet
true
if all parameters have some allowed value set,
false
otherwisepublic void reset()
ParameterSet
Parameter
s in this ParameterSet
to their
default values or null
if not default value was provided.
reset
in class ParameterSet
Parameter.reset()
public AlphabetContainer getAlphabetContainer()
AlphabetContainer
of the current instance.
AlphabetContainer
public int getLength() throws IllegalArgumentException
IllegalArgumentException
- if the length is not correct, i.e. the length is not suitable
for the chosen requirementsprotected void fromXML(StringBuffer representation) throws NonParsableException
ParameterSet
ParameterSet
from the XML
representation as returned by ParameterSet.toXML()
.
fromXML
in class InstanceParameterSet<T extends InstantiableFromParameterSet>
representation
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedParameterSet.toXML()
public int getNumberOfParameters()
ParameterSet
ParameterSet
.
getNumberOfParameters
in class ParameterSet
ParameterSet
public Parameter getParameterAt(int i)
ParameterSet
Parameter
at position i
.
getParameterAt
in class ParameterSet
i
- the position in the ParameterSet
Parameter
at position i
public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.
toXML
in interface Storable
toXML
in class InstanceParameterSet<T extends InstantiableFromParameterSet>
public boolean equals(Object o)
equals
in class Object
public SequenceScoringParameterSet<T> clone() throws CloneNotSupportedException
ParameterSet
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:ParameterSet
, most
likely with an empty constructor or the one taking just the instance
class.
this.fillWithStandardFieldsForClone
on this
instance.
Object
's method
Object.clone()
.
clone
in class ParameterSet
ParameterSet
CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |