de.jstacs.data
Class Sequence.RecursiveSequence<T>

java.lang.Object
  extended by de.jstacs.data.Sequence<T>
      extended by de.jstacs.data.Sequence.RecursiveSequence<T>
Type Parameters:
T - the type of each position
All Implemented Interfaces:
Comparable<Sequence<T>>
Direct Known Subclasses:
PermutedSequence, Sequence.CompositeSequence, Sequence.SubSequence
Enclosing class:
Sequence<T>

public abstract static class Sequence.RecursiveSequence<T>
extends Sequence<T>

This is the main class for subsequences, composite sequences, ... . All these sequences are defined on an existing Sequence. After creating an Sequence.RecursiveSequence, no SequenceAnnotation of the internally Sequence is returned by Sequence.getAnnotation(), ...

Author:
Jens Keilwagen

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.data.Sequence
Sequence.CompositeSequence<T>, Sequence.RecursiveSequence<T>, Sequence.SubSequence<T>
 
Field Summary
protected  Sequence<T> content
          The internal sequence.
 
Fields inherited from class de.jstacs.data.Sequence
alphabetCon, annotation, rc
 
Constructor Summary
Sequence.RecursiveSequence(AlphabetContainer alphabet, Sequence<T> seq)
          Creates a new Sequence.RecursiveSequence on the Sequence seq with the AlphabetContainer alphabet using the annotation of the given Sequence.
Sequence.RecursiveSequence(AlphabetContainer alphabet, SequenceAnnotation[] annotation, Sequence<T> seq)
          Creates a new Sequence.RecursiveSequence on the Sequence seq with the AlphabetContainer alphabet and the annotation annotation.
 
Method Summary
protected  void addToRepresentation(Object representation, int pos, String delim)
          This method adds the information of one position to the representation using the specified delimiter
 int compareTo(T t1, T t2)
          This method compares to container and is used in Sequence.compareTo(Sequence).
 double continuousVal(int pos)
          Returns the continuous value at position pos of the Sequence.
 int discreteVal(int pos)
          Returns the discrete value at position pos of the Sequence.
 void fillContainer(T container, int pos)
          The method fills the content of a specific position in to the container.
 T getEmptyContainer()
          The method returns a container that can be used for accessing the symbols for each position.
protected  Object getEmptyRepresentation()
          Returns an empty representation which is used to create the String representation of this instance in the method Sequence.toString(String, int, int).
protected abstract  int getIndex(int pos)
          Returns the index in the internal sequence.
protected  String getStringRepresentation(Object representation)
          This method creates a String representation from the given representation.
protected  int hashCodeForPos(int pos)
          This method is used in Sequence.hashCode() and the hash code for one specific position.
 boolean isMultiDimensional()
          The method returns true if the sequence is multidimensional, otherwise .
 
Methods inherited from class de.jstacs.data.Sequence
annotate, compareTo, complement, complement, create, create, create, equals, flatCloneWithoutAnnotation, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, getLength, getNumberOfSequenceAnnotationsByType, getSequenceAnnotationByType, getSequenceAnnotationByTypeAndIdentifier, getSubSequence, getSubSequence, getSubSequence, getSubSequence, hashCode, matches, reverse, reverse, reverseComplement, reverseComplement, toDiscrete, toString, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

content

protected Sequence<T> content
The internal sequence.

Constructor Detail

Sequence.RecursiveSequence

public Sequence.RecursiveSequence(AlphabetContainer alphabet,
                                  SequenceAnnotation[] annotation,
                                  Sequence<T> seq)
Creates a new Sequence.RecursiveSequence on the Sequence seq with the AlphabetContainer alphabet and the annotation annotation.

Parameters:
alphabet - the AlphabetContainer
annotation - the annotation of the Sequence.RecursiveSequence
seq - the sequence
See Also:
Sequence.Sequence(AlphabetContainer, SequenceAnnotation[])

Sequence.RecursiveSequence

public Sequence.RecursiveSequence(AlphabetContainer alphabet,
                                  Sequence<T> seq)
Creates a new Sequence.RecursiveSequence on the Sequence seq with the AlphabetContainer alphabet using the annotation of the given Sequence.

Parameters:
alphabet - the AlphabetContainer
seq - the sequence
Method Detail

continuousVal

public double continuousVal(int pos)
Description copied from class: Sequence
Returns the continuous value at position pos of the Sequence.

Specified by:
continuousVal in class Sequence<T>
Parameters:
pos - the position of the Sequence
Returns:
the continuous value at position pos of the Sequence

discreteVal

public int discreteVal(int pos)
Description copied from class: Sequence
Returns the discrete value at position pos of the Sequence.

Specified by:
discreteVal in class Sequence<T>
Parameters:
pos - the position of the Sequence
Returns:
the discrete value at position pos of the Sequence

getIndex

protected abstract int getIndex(int pos)
Returns the index in the internal sequence.

Parameters:
pos - the index in the external sequence
Returns:
the index in the internal sequence

isMultiDimensional

public boolean isMultiDimensional()
Description copied from class: Sequence
The method returns true if the sequence is multidimensional, otherwise .

Specified by:
isMultiDimensional in class Sequence<T>
Returns:
true if the sequence is multidimensional, otherwise

getEmptyContainer

public T getEmptyContainer()
Description copied from class: Sequence
The method returns a container that can be used for accessing the symbols for each position. This is especially of interest for multidimensional sequences.

Specified by:
getEmptyContainer in class Sequence<T>
Returns:
a container that can be used for accessing the symbols for each position
See Also:
Sequence.fillContainer(Object, int), Sequence.isMultiDimensional()

fillContainer

public void fillContainer(T container,
                          int pos)
Description copied from class: Sequence
The method fills the content of a specific position in to the container. This is especially of interest for multidimensional sequences.

Specified by:
fillContainer in class Sequence<T>
Parameters:
container - the container which is used for filling the content.
pos - the position
See Also:
Sequence.getEmptyContainer(), Sequence.isMultiDimensional()

compareTo

public int compareTo(T t1,
                     T t2)
Description copied from class: Sequence
This method compares to container and is used in Sequence.compareTo(Sequence).

Specified by:
compareTo in class Sequence<T>
Parameters:
t1 - the first container
t2 - the second container
Returns:
zero if arguments are equal
See Also:
Sequence.getEmptyContainer(), Sequence.fillContainer(Object, int), Comparable.compareTo(java.lang.Object)

getEmptyRepresentation

protected Object getEmptyRepresentation()
Description copied from class: Sequence
Returns an empty representation which is used to create the String representation of this instance in the method Sequence.toString(String, int, int).

Specified by:
getEmptyRepresentation in class Sequence<T>
Returns:
an empty representation which is used to create the String representation
See Also:
Sequence.toString(String, int, int)

addToRepresentation

protected void addToRepresentation(Object representation,
                                   int pos,
                                   String delim)
Description copied from class: Sequence
This method adds the information of one position to the representation using the specified delimiter

Specified by:
addToRepresentation in class Sequence<T>
Parameters:
representation - the representation
pos - the position
delim - the delimiter separating the information for different positions
See Also:
Sequence.getEmptyRepresentation(), Sequence.toString(String, int, int)

getStringRepresentation

protected String getStringRepresentation(Object representation)
Description copied from class: Sequence
This method creates a String representation from the given representation.

Specified by:
getStringRepresentation in class Sequence<T>
Parameters:
representation - the representation instance (which should be created by Sequence.getEmptyContainer() and filled by Sequence.addToRepresentation(Object, int, String))
Returns:
a String representation
See Also:
Sequence.getEmptyRepresentation(), Sequence.addToRepresentation(Object, int, String), Sequence.toString(String, int, int)

hashCodeForPos

protected int hashCodeForPos(int pos)
Description copied from class: Sequence
This method is used in Sequence.hashCode() and the hash code for one specific position.

Specified by:
hashCodeForPos in class Sequence<T>
Parameters:
pos - the position
Returns:
the hash code for the position