'STRAP:multiple sequence alignments '

charite.christo
Class ByteArray

java.lang.Object
  extended by charite.christo.ByteArray
All Implemented Interfaces:
ChRunnable, CharSequence, Comparable

public final class ByteArray
extends Object
implements CharSequence, Comparable, ChRunnable

Similar to java.lang.StringBuffer but more efficient. Consumes only 8 bit and does not throw OutOfMemory as aften as StringBuffer. Contains an 8bit byte array to store text. Line ends are returned as an array of text positions.


Field Summary
static Object CLEAR
           
static long STRING_POOL
           
static long STRING_TRIM
           
 
Fields inherited from interface charite.christo.interfaces.ChRunnable
APPEND, DOWNLOAD_FINISHED, INTERPRET_LINE, LOG, SET_ICON_IMAGE
 
Constructor Summary
ByteArray(byte[] bb)
           
ByteArray(byte[] bb, int from, int to)
           
ByteArray(CharSequence cs)
           
ByteArray(int l)
           
 
Method Summary
 ByteArray append(char ch)
           
 ByteArray append(char ch, int times)
           
 ByteArray append(double f)
           
 ByteArray append(double number, int wInt, int wFrac)
           
 ByteArray append(int num)
           
 ByteArray append(int num, int width)
           
 ByteArray append(Object s)
           
 ByteArray append(Object o, int from, int to)
           
 ByteArray appendln(Object s)
           
 ByteArray appendSomeBytes(long n, int num)
           
 char charAt(int i)
           
 int compareTo(Object anotherString)
           
 ByteArray delBlanksL()
           
 ByteArray delBlanksR()
           
 ByteArray delSuffix(String s)
           
 ByteArray enlargeCapacityBy(int reserve)
           
 boolean equals(Object o)
           
 ByteArray filter(int type, Object o, int from, int to, char toUpper)
           
 ByteArray foldText(byte[] bb, int from, int to, int lettersPerLine)
           
 int getBegin()
          First text position +1
 byte[] getBytes()
          The byte array used internally to store the text;
 int getEnd()
          Last text position +1
 int[] getLineEnds()
          Indices of the '\n'.
 int getModificationCount()
           
 int hashCode()
           
 int idxToRow(int position)
           
 void insidePreTags()
          Counts the '\n'.
 int length()
           
 byte[] newByteArray(int b, int e)
          returns the text between getBegin() and getEnd()
 String newString()
           
 String newString(int from, int to)
           
 ByteArray onlyLetters(byte[] bb, int from, int to)
           
 boolean onlyWhiteSpace()
           
 ByteArray removeLeadingSpace()
           
 ByteArray replace(char c, char replacement)
           
 ByteArray replace(char needle, char replacement, int from, int to)
           
 boolean replace(int from, int to, Object oReplacement)
           
 ByteArray replace(Object needle, Object replacement)
           
 ByteArray replace(Object oNeedle, Object replacement, int from, int to)
           
 Object run(String id, Object arg)
           
 ByteArray set(byte[] bb, int b, int e)
           
 ByteArray setBegin(int index)
           
 ByteArray setEnd(int index)
           
 void setLowercaseForcharAt(boolean b)
           
 void setTextSegment(Segment s)
           
 CharSequence subSequence(int start, int end)
           
 String[] toLineStrings(int options0)
          Creates a String array[] One String for each line;
 String toString()
           
 String toString(int from, int to, long options)
           
static byte[] trimSize(ByteArray ba)
          Optimizes the size of the byte array, if (getEnd()-getBegin()) is less than getBytes().length then the size of the byte array.
 ByteArray urlEncode(Object text)
           
 ByteArray urlEncode(Object text, int from, int to)
           
 void write(OutputStream os)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLEAR

public static final Object CLEAR

STRING_POOL

public static final long STRING_POOL
See Also:
Constant Field Values

STRING_TRIM

public static final long STRING_TRIM
See Also:
Constant Field Values
Constructor Detail

ByteArray

public ByteArray(CharSequence cs)

ByteArray

public ByteArray(byte[] bb)

ByteArray

public ByteArray(byte[] bb,
                 int from,
                 int to)

ByteArray

public ByteArray(int l)
Method Detail

getBegin

public int getBegin()
First text position +1


getEnd

public int getEnd()
Last text position +1


getBytes

public byte[] getBytes()
The byte array used internally to store the text;


setBegin

public ByteArray setBegin(int index)

setEnd

public ByteArray setEnd(int index)

set

public ByteArray set(byte[] bb,
                     int b,
                     int e)

getLineEnds

public int[] getLineEnds()
Indices of the '\n'. If trailing '\n' is missing inlcude also text-length+1 .


insidePreTags

public void insidePreTags()
Counts the '\n'. If the trailing '\n' is missing then ++1.


delBlanksL

public ByteArray delBlanksL()

delBlanksR

public ByteArray delBlanksR()

trimSize

public static byte[] trimSize(ByteArray ba)
Optimizes the size of the byte array, if (getEnd()-getBegin()) is less than getBytes().length then the size of the byte array.


newByteArray

public byte[] newByteArray(int b,
                           int e)
returns the text between getBegin() and getEnd()


newString

public String newString()

newString

public String newString(int from,
                        int to)

toString

public String toString(int from,
                       int to,
                       long options)

toLineStrings

public String[] toLineStrings(int options0)
Creates a String array[] One String for each line;


idxToRow

public int idxToRow(int position)

getModificationCount

public int getModificationCount()

setTextSegment

public void setTextSegment(Segment s)

onlyWhiteSpace

public boolean onlyWhiteSpace()

enlargeCapacityBy

public ByteArray enlargeCapacityBy(int reserve)

append

public final ByteArray append(int num)

append

public final ByteArray append(char ch)

append

public final ByteArray append(char ch,
                              int times)

appendSomeBytes

public ByteArray appendSomeBytes(long n,
                                 int num)

append

public final ByteArray append(double f)

appendln

public final ByteArray appendln(Object s)

append

public final ByteArray append(Object s)

append

public final ByteArray append(Object o,
                              int from,
                              int to)

filter

public ByteArray filter(int type,
                        Object o,
                        int from,
                        int to,
                        char toUpper)

append

public ByteArray append(int num,
                        int width)

append

public ByteArray append(double number,
                        int wInt,
                        int wFrac)

replace

public ByteArray replace(char c,
                         char replacement)

foldText

public ByteArray foldText(byte[] bb,
                          int from,
                          int to,
                          int lettersPerLine)

onlyLetters

public ByteArray onlyLetters(byte[] bb,
                             int from,
                             int to)

urlEncode

public ByteArray urlEncode(Object text)

urlEncode

public ByteArray urlEncode(Object text,
                           int from,
                           int to)

delSuffix

public ByteArray delSuffix(String s)

write

public void write(OutputStream os)
           throws IOException
Throws:
IOException

toString

public String toString()
Specified by:
toString in interface CharSequence
Overrides:
toString in class Object

setLowercaseForcharAt

public void setLowercaseForcharAt(boolean b)

charAt

public char charAt(int i)
Specified by:
charAt in interface CharSequence

length

public int length()
Specified by:
length in interface CharSequence

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSequence

replace

public boolean replace(int from,
                       int to,
                       Object oReplacement)

replace

public ByteArray replace(char needle,
                         char replacement,
                         int from,
                         int to)

replace

public ByteArray replace(Object needle,
                         Object replacement)

replace

public ByteArray replace(Object oNeedle,
                         Object replacement,
                         int from,
                         int to)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(Object anotherString)
Specified by:
compareTo in interface Comparable

hashCode

public int hashCode()
Overrides:
hashCode in class Object

removeLeadingSpace

public ByteArray removeLeadingSpace()

run

public Object run(String id,
                  Object arg)
Specified by:
run in interface ChRunnable

'STRAP:multiple sequence alignments '

'The most important classes are StrapAlign, StrapProtein and StrapEvent.'