org.expasy.jpl.commons.collection.symbol.seq
Class SymbolSequenceImpl<E>

java.lang.Object
  extended by org.expasy.jpl.commons.collection.symbol.seq.SymbolSequenceImpl<E>
Type Parameters:
E - the element type.
All Implemented Interfaces:
Serializable, Sequence<E>, SymbolSequence<E>

public final class SymbolSequenceImpl<E>
extends Object
implements SymbolSequence<E>, Serializable

A sequence of symbol letters defined by an alphabet.

Version:
1.0
Author:
nikitin
See Also:
Serialized Form

Nested Class Summary
static class SymbolSequenceImpl.Builder<E>
          This builder builds an instance of JPLAASequence given a numerous number of possible parameters.
 
Constructor Summary
  SymbolSequenceImpl()
          for serialization only
protected SymbolSequenceImpl(SymbolSequenceImpl.Builder<E> builder)
          The only constructor that build an instance of JPLAASequence.
 
Method Summary
 char charAt(int i)
           
 SymbolSequenceImpl<E> clone()
           
 boolean equals(Object obj)
          Return true if 2 aa sequences are identical
 SymbolSequenceImpl.Builder<E> getBuilder()
           
static
<E> Pattern
getSequencePattern(Symbol.SymbolType<E> type)
           
 Symbol<E> getSymbolAt(int i)
          Returns the symbol character at position i.
 Symbol.SymbolType<E> getSymbolType()
           
 int hashCode()
          Same length JPLAASequence have the same hash code.
 boolean isAmbiguous()
           
 int length()
           
 SymbolSequenceImpl<E> subSequence(int start, int end)
          Warning: [start, end[
 String toString()
           
 String toSymbolString()
           
 E valueAt(int i)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SymbolSequenceImpl

public SymbolSequenceImpl()
for serialization only


SymbolSequenceImpl

protected SymbolSequenceImpl(SymbolSequenceImpl.Builder<E> builder)
                      throws ParseException
The only constructor that build an instance of JPLAASequence.

Parameters:
builder - the builder needed to build the instance.
Throws:
ParseException
ParseException - if the sequence string is not well formatted.
JPLAAByteUndefinedException
Method Detail

getSequencePattern

public static <E> Pattern getSequencePattern(Symbol.SymbolType<E> type)

getBuilder

public SymbolSequenceImpl.Builder<E> getBuilder()

clone

public SymbolSequenceImpl<E> clone()
Overrides:
clone in class Object

equals

public boolean equals(Object obj)
Return true if 2 aa sequences are identical

Overrides:
equals in class Object

hashCode

public int hashCode()
Same length JPLAASequence have the same hash code.

Overrides:
hashCode in class Object

length

public final int length()
Specified by:
length in interface Sequence<E>
Returns:
the length of the amino-acid sequence.

isAmbiguous

public boolean isAmbiguous()
Specified by:
isAmbiguous in interface SymbolSequence<E>
Returns:
true if the sequence contains ambiguous symbols. An ambiguous symbol maps more than one T-data object.

getSymbolType

public final Symbol.SymbolType<E> getSymbolType()
Specified by:
getSymbolType in interface SymbolSequence<E>
Returns:
the type of symbol

getSymbolAt

public final Symbol<E> getSymbolAt(int i)
Returns the symbol character at position i.

Specified by:
getSymbolAt in interface SymbolSequence<E>
Returns:
the symbol character at position i.
Throws:
SequenceOutOfBoundsException - if i is out of byte array bounds.

valueAt

public final E valueAt(int i)
Specified by:
valueAt in interface Sequence<E>
Returns:
the T-typed value at the specified sequence index.

charAt

public final char charAt(int i)
Specified by:
charAt in interface SymbolSequence<E>
Returns:
the symbol character at index i

subSequence

public SymbolSequenceImpl<E> subSequence(int start,
                                         int end)
Warning: [start, end[

Specified by:
subSequence in interface Sequence<E>
Returns:
a new Sequence that is a subsequence of this sequence.

toSymbolString

public final String toSymbolString()
Specified by:
toSymbolString in interface SymbolSequence<E>
Returns:
the symbol string representation

toString

public String toString()
Overrides:
toString in class Object
Returns:
the amino acid string without the N and C terminus informations.


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.