de.jstacs.data.sequences
Class PermutedSequence<T>

java.lang.Object
  extended by de.jstacs.data.sequences.Sequence<T>
      extended by de.jstacs.data.sequences.Sequence.RecursiveSequence<T>
          extended by de.jstacs.data.sequences.PermutedSequence<T>
Type Parameters:
T - the type of each position
All Implemented Interfaces:
Comparable<Sequence<T>>

public class PermutedSequence<T>
extends Sequence.RecursiveSequence<T>

This class is for permuted sequences.

Author:
Jan Grau

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.data.sequences.Sequence
Sequence.CompositeSequence<T>, Sequence.RecursiveSequence<T>, Sequence.SubSequence<T>
 
Field Summary
 
Fields inherited from class de.jstacs.data.sequences.Sequence.RecursiveSequence
content
 
Fields inherited from class de.jstacs.data.sequences.Sequence
alphabetCon, annotation, rc
 
Constructor Summary
PermutedSequence(Sequence<T> seq)
          Creates a new PermutedSequence by shuffling the symbols of a given Sequence.
PermutedSequence(Sequence<T> seq, int[] permutation)
          Creates a new PermutedSequence for a given permutation
 
Method Summary
protected  PermutedSequence<T> flatCloneWithoutAnnotation()
          Works in analogy to Object.clone(), but does not clone the annotation.
protected  int getIndex(int pos)
          Returns the index in the internal sequence.
 int getLength()
          Returns the length of the Sequence.
 
Methods inherited from class de.jstacs.data.sequences.Sequence.RecursiveSequence
addToRepresentation, compareTo, continuousVal, discreteVal, fillContainer, getEmptyContainer, getEmptyRepresentation, getStringRepresentation, hashCodeForPos, isMultiDimensional
 
Methods inherited from class de.jstacs.data.sequences.Sequence
annotate, compareTo, complement, complement, create, create, create, equals, getAlphabetContainer, getAnnotation, getCompositeSequence, getCompositeSequence, getHammingDistance, 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
 

Constructor Detail

PermutedSequence

public PermutedSequence(Sequence<T> seq)
                 throws WrongAlphabetException
Creates a new PermutedSequence by shuffling the symbols of a given Sequence.

Parameters:
seq - the initial sequence
Throws:
WrongAlphabetException - if the AlphabetContainer is not simple
See Also:
Sequence.RecursiveSequence.Sequence.RecursiveSequence(de.jstacs.data.AlphabetContainer, de.jstacs.data.sequences.Sequence)

PermutedSequence

public PermutedSequence(Sequence<T> seq,
                        int[] permutation)
                 throws WrongAlphabetException,
                        Exception
Creates a new PermutedSequence for a given permutation

Parameters:
seq - the original sequence
permutation - the permutation of the sequence
Throws:
WrongAlphabetException - if the AlphabetContainer is not simple
Exception - if the length of the permutation does not match that of the sequence
See Also:
Sequence.RecursiveSequence.Sequence.RecursiveSequence(de.jstacs.data.AlphabetContainer, de.jstacs.data.sequences.Sequence)
Method Detail

getIndex

protected int getIndex(int pos)
Description copied from class: Sequence.RecursiveSequence
Returns the index in the internal sequence.

Specified by:
getIndex in class Sequence.RecursiveSequence<T>
Parameters:
pos - the index in the external sequence
Returns:
the index in the internal sequence

getLength

public int getLength()
Description copied from class: Sequence
Returns the length of the Sequence.

Specified by:
getLength in class Sequence<T>
Returns:
the length of the Sequence

flatCloneWithoutAnnotation

protected PermutedSequence<T> flatCloneWithoutAnnotation()
Description copied from class: Sequence
Works in analogy to Object.clone(), but does not clone the annotation. This method is used in Sequence.annotate(boolean, SequenceAnnotation...).

Specified by:
flatCloneWithoutAnnotation in class Sequence<T>
Returns:
the cloned Sequence without annotation