public class CharSequence
This class implements a sequence of characters stored as an array that provides random access to any position in constant time.
The input can come from any source, provided it is encapsulated in a proper Reader instance. The stream is expected to be ready (i.e. the next read operation must return the first character of the sequence) and it is not closed when its end is reached, so the client is allowed to reset it and maybe use it for another purpose.
Sequences can contain letters only although lines started with the COMMENT_CHAR character ('>') are regarded as comments and are completely skipped. White spaces (including tabs, line feeds and carriage returns) are also ignored throughout.
This class is used by two sequence alignment algorithms: class SmithWaterman and class NeedlemanWunsch.
protected static char COMMENT_CHAR
The character used to start a comment line in a sequence file. When this character is found, the rest of the line is ignored.
protected kotlin.Array[] sequence
Stores the sequence as an array of characters.
public CharSequence(java.io.Reader reader)
Creates a new instance of a CharSequence, loading the sequence data from the Reader input stream.
reader - source of characters for this sequenceIOException - if an I/O exception occurs when reading the inputInvalidSequenceException - if the input does not contain a valid sequencepublic int length()
Returns the number of characters of this sequence.
public char charAt(int pos)
Returns the character at a given position. For the client, the first character is at position 1, while the last character is at position length(). This is convinient for sequence alignment algorithms based on a classic dynamic programming matrix since the sequences usually start at row/column 1. This method does not check boundaries, therefore an ArrayIndexOutOfBoundsException may be raised if pos is out of bounds.
pos - position of character (from 1 to length() inclusive)public java.lang.String toString()
Returns a string representation of the sequence.