|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.models.discrete.Constraint
public abstract class Constraint
The main class for all constraints on models. This class centralize all specific constraint from a partitioning constraint.
Field Summary | |
---|---|
protected double[] |
counts
The counts for each specific constraint |
protected double[] |
freq
The frequencies estimated from the counts |
protected int[] |
usedPositions
The used positions |
Constructor Summary | |
---|---|
Constraint(int[] usedPositions,
int n)
The main constructor. |
|
Constraint(StringBuffer xml)
The constructor for creating an object from an StringBuffer. |
Method Summary | |
---|---|
void |
add(int index,
double weight)
Adds the weight to the count with index index . |
void |
add(Sequence seq,
int start,
double weight)
This method determines the specific constraint that is fulfilled by the sequence and adds the weight
to the specific counter. |
protected abstract void |
appendAdditionalInfo(StringBuffer xml)
This method appends additional information that are not stored in the base class to the StringBuffer. |
protected Constraint |
clone()
|
abstract void |
estimate(double ess)
Estimates the (smoothed) relative frequencies using the ess. |
protected void |
estimateUnConditional(int start,
int end,
double pc,
boolean exceptionWhenNoData)
Estimates unconditionally. |
protected abstract void |
extractAdditionalInfo(StringBuffer xml)
This method parses additional information from the StringBuffer that are not parsed in the base class. |
double |
getCount(int index)
Returns the current count with index index |
double |
getFreq(int index)
Returns the current frequency with index index |
double |
getFreq(Sequence seq,
int start)
This method determines the specific constraint that is fullfilled by the sequence beginning at start . |
int |
getMarginalOrder()
Returns the marginal order i.e. the number of used random variables. |
int |
getNumberOfSpecificConstraints()
Returns the number of specific constraint. |
int |
getPosition(int index)
Returns the position with index index |
int[] |
getPositions()
Returns a clone of array of used positions. |
protected abstract String |
getXMLTag()
Returns the XML-tag that is used for the class to en- or decode. |
void |
reset()
This method resets all member variables the are in someway counters, frequencies, ... |
abstract int |
satisfiesSpecificConstraint(Sequence seq,
int start)
This method returns the index of the specific constraint that is fullfilled by the sequence beginning at start . |
abstract String |
toString()
|
StringBuffer |
toXML()
This method returns an XML-representation of an instance of the implementing class. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[] counts
protected double[] freq
protected int[] usedPositions
Constructor Detail |
---|
public Constraint(int[] usedPositions, int n)
usedPositions
- the used positions (will be cloned), hva to be non-negativen
- the number of specific constraintspublic Constraint(StringBuffer xml) throws NonParsableException
xml
- the StringBuffer
NonParsableException
- if the StringBuffer is not parseableMethod Detail |
---|
public void add(int index, double weight)
weight
to the count with index index
.
index
- the indexweight
- the weightpublic void add(Sequence seq, int start, double weight)
weight
to the specific counter.
seq
- the sequencestart
- the start positionweight
- the weight for the sequenceprotected Constraint clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public abstract void estimate(double ess)
ess
- the ESSprotected void estimateUnConditional(int start, int end, double pc, boolean exceptionWhenNoData)
start
- the start indexend
- the end indexpc
- the pseudocount for each parameterexceptionWhenNoData
- if true
an (runtime) exception is thrown if no data was available to estimate the
parametersprotected abstract void appendAdditionalInfo(StringBuffer xml)
xml
- the StringBuffer that is used for appending additional informationpublic double getCount(int index)
index
index
- the index
public double getFreq(int index)
index
index
- the index
public double getFreq(Sequence seq, int start)
start
.
seq
- the sequencestart
- the start position
public int getMarginalOrder()
public int getNumberOfSpecificConstraints()
public int getPosition(int index)
index
index
- the index
index
public int[] getPositions()
protected abstract String getXMLTag()
public void reset()
public abstract int satisfiesSpecificConstraint(Sequence seq, int start)
start
.
seq
- the sequencestart
- the start position
protected abstract void extractAdditionalInfo(StringBuffer xml) throws NonParsableException
xml
- the StringBuffer to parse
NonParsableException
- if something with the parsing went wrongpublic abstract String toString()
toString
in class Object
public StringBuffer toXML()
Storable
toXML
in interface Storable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |