edu.rit.compbio.seq
Class Sequence
- java.lang.Object
-
- edu.rit.compbio.seq.Sequence
-
- Direct Known Subclasses:
- ProteinSequence
public abstract class Sequence extends java.lang.ObjectClass Sequence is the abstract base class for a biological sequence.In a program, a sequence is represented as a byte array (type byte[]). For a sequence of length L, the byte array contains L+1 bytes. The byte at index 0 is unused and contains a value of -1. The bytes at indexes 1 through L contain the elements of the sequence. These are generally represented as small integers starting at 0, not as characters.
-
-
Constructor Summary
Constructors Constructor and Description Sequence()Construct a new sequence.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract charcharAt(int i)Returns a character version of this sequence's element at the given index.java.lang.Stringdescription()Get this sequence's description.java.lang.StringelementsToString()Returns a string version of this sequence's elements.booleanequals(java.lang.Object obj)Determine if this sequence is equal to the given object.inthashCode()Returns a hash code for this sequence.intlength()Get this sequence's length L.byte[]sequence()Get this sequence's elements.
-
-
-
Method Detail
-
description
public java.lang.String description()
Get this sequence's description.- Returns:
- Description string.
-
length
public int length()
Get this sequence's length L. This is the number of elements in this sequence.- Returns:
- Length L.
-
sequence
public byte[] sequence()
Get this sequence's elements. The return value is a byte array of length L+1. The byte at index 0 is unused and contains a value of -1. The bytes at indexes 1 through L contain the elements.Note: Do not alter the contents of the returned byte array.
- Returns:
- Array of elements.
-
equals
public boolean equals(java.lang.Object obj)
Determine if this sequence is equal to the given object. Two sequences are equal if they have the same elements.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- Object to test.- Returns:
- True if obj is equal to this sequence, false otherwise.
-
hashCode
public int hashCode()
Returns a hash code for this sequence.- Overrides:
hashCodein classjava.lang.Object- Returns:
- Hash code.
-
charAt
public abstract char charAt(int i)
Returns a character version of this sequence's element at the given index.- Parameters:
i- Index in the range 1 .. L.- Returns:
- Character corresponding to element i.
-
elementsToString
public java.lang.String elementsToString()
Returns a string version of this sequence's elements.- Returns:
- String version.
-
-
DMelt 3.0 © DataMelt by jWork.ORG