Class marimba.text.Text
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class marimba.text.Text

java.lang.Object
   |
   +----marimba.text.Text

public class Text
extends Object
This class implements a text object. This stores information about the actual bytes/chars in the text as well as any style information. TextView provides a view onto this text, and, of course, there can be multiple views onto a single text widget.
Version:
1.20, 12/15/96
Author:
Jonathan Payne

Variable Index

 o count
Number of characters in this buffer.
 o data
The actual characters.
 o styles
The style references in this document.

Constructor Index

 o Text()
 o Text(int)

Method Index

 o addView(TextView)
Adds a new text view to views.
 o applyStyleChange(StyleChange, int, int)
 o applyStyleChangeCheck(StyleChange, int, int)
Applies a style change to the range from POS0 to POS1.
 o byteAt(int)
Returns the byte at POS.
 o clear()
Deletes all the text in the buffer.
 o delete(int, int)
Deletes N bytes starting at POS0.
 o deleteStyles(int, int)
Deletes all styles in the range from POS0 to POS1.
 o deleteWhiteSpace(int)
Deletes all the white space around POS.
 o getBeginningOfLine(int)
Returns the position that is the beginning of the line containing pos.
 o getBytes()
Returns the byte array.
 o getColumnFor(int)
Returns the indent of a line, in character positions, for the specified POS.
 o getEndOfLine(int)
Returns the position that is the end of the line containing pos.
 o getIndent(int)
Moves to the indent (first non white space character) in line containing POS.
 o getLinePos(int)
Return the position of the Nth line in the buffer.
 o getLinePos(int, int)
Returns the position of the beginning of the nth line from the specified pos.
 o getNextLine(int)
Returns the position of the beginning of the next line.
 o getNextWord(int, int)
Moves forward or backward a word (Emacs style).
 o getNextWordStart(int)
 o getPosFor(int, int)
Returns the buffer position that hits the specified column on the line containing POS.
 o getRichText()
Returns a "rich text" representation of the text.
 o getStyles()
 o getWordEnd(int, int)
Returns the position that is the end (or beginning if direction < 0) of the word that POS is part of.
 o indentTo(int, int)
Indent to the specified destination column, starting at the specified position, using the smallest combination of Tabs and Spaces as possible.
 o insert(byte[], int, int, int)
Inserts LENGTH bytes from BYTES at offset OFF into this text buffer at POS.
 o insert(InputStream, int)
Inserts stream IN at POS, until EOF is reached.
 o insert(int, int)
Inserts character C at POS into this text.
 o insert(String, int)
Inserts string S at POS.
 o insert(String, int, int)
Inserts LENGTH characters of string S at POS.
 o isDigit(int)
 o isLetter(int)
 o isWordChar(int)
 o length()
Returns the length of the text.
 o notifyDelete(int, int)
Notifies views of a deletion just before it occurs.
 o notifyDeleteAfter(int, int)
Notifies views of a deletion after the fact.
 o notifyDirtyRegion(int, int)
Notifies views that a region of characters have changed (due to a style change, most likely).
 o notifyInsert(int, int)
Notifies views of an insertion.
 o removeView(TextView)
Removes a text view from views.
 o scan(int, int, int)
Searches for the first instance of the specified character C, starting from POS, in the specified direction.
 o search(String, int, int)
Searches for string S starting at POS moving forward if DIRECTION is > 0, backwards otherwise.
 o setRichText(String)
Sets the value of the text from a "rich text" representation.
 o skipWhiteSpace(int, int)
Skips over white space.
 o substring(int)
Returns contents of the text from POS0 to the end as a string.
 o substring(int, int)
Returns contents of the text from POS0 to POS1 as a string.
 o toString()
Returns the entire text object as a String.

Variables

 o data
  protected byte data[]
The actual characters.
 o count
  protected int count
Number of characters in this buffer.
 o styles
  protected StylePool styles
The style references in this document.

Constructors

 o Text
  public Text(int size)
 o Text
  public Text()

Methods

 o isLetter
  public static boolean isLetter(int c)
 o isDigit
  public static boolean isDigit(int c)
 o isWordChar
  public static boolean isWordChar(int c)
 o getStyles
  public StylePool getStyles()
 o addView
  protected void addView(TextView view)
Adds a new text view to views.
 o removeView
  protected void removeView(TextView view)
Removes a text view from views.
 o notifyInsert
  protected void notifyInsert(int pos,
                              int count)
Notifies views of an insertion.
 o notifyDelete
  protected void notifyDelete(int pos,
                              int count)
Notifies views of a deletion just before it occurs.
 o notifyDeleteAfter
  protected void notifyDeleteAfter(int pos,
                                   int count)
Notifies views of a deletion after the fact.
 o notifyDirtyRegion
  protected void notifyDirtyRegion(int pos0,
                                   int pos1)
Notifies views that a region of characters have changed (due to a style change, most likely).
 o insert
  public synchronized void insert(String s,
                                  int pos)
Inserts string S at POS.
 o insert
  public synchronized void insert(String s,
                                  int pos,
                                  int length)
Inserts LENGTH characters of string S at POS.
 o insert
  public synchronized void insert(byte bytes[],
                                  int off,
                                  int length,
                                  int pos)
Inserts LENGTH bytes from BYTES at offset OFF into this text buffer at POS.
 o insert
  public synchronized void insert(int c,
                                  int pos)
Inserts character C at POS into this text.
 o insert
  public synchronized void insert(InputStream in,
                                  int pos) throws IOException
Inserts stream IN at POS, until EOF is reached.
 o delete
  public synchronized void delete(int pos0,
                                  int n)
Deletes N bytes starting at POS0.
 o clear
  public void clear()
Deletes all the text in the buffer.
 o substring
  public synchronized String substring(int pos0,
                                       int pos1)
Returns contents of the text from POS0 to POS1 as a string.
 o substring
  public synchronized String substring(int pos0)
Returns contents of the text from POS0 to the end as a string.
 o toString
  public synchronized String toString()
Returns the entire text object as a String.
Overrides:
toString in class Object
 o getBytes
  public final byte[] getBytes()
Returns the byte array.
 o scan
  public final synchronized int scan(int c,
                                     int pos,
                                     int direction)
Searches for the first instance of the specified character C, starting from POS, in the specified direction. If DIRECTION is > 0 , the search is forward; otherwise it's backward. Returns -1 if there's no such character. When the direction is backward, the scan starts at the character before POS. When the direction is forward, the scan starts at POS.
 o search
  public final synchronized int search(String s,
                                       int pos,
                                       int direction)
Searches for string S starting at POS moving forward if DIRECTION is > 0, backwards otherwise. Returns -1 if no such string is found.
 o length
  public final int length()
Returns the length of the text.
 o byteAt
  public final synchronized int byteAt(int pos)
Returns the byte at POS.
 o applyStyleChange
  public synchronized void applyStyleChange(StyleChange sc,
                                            int pos0,
                                            int pos1)
 o applyStyleChangeCheck
  public synchronized boolean applyStyleChangeCheck(StyleChange sc,
                                                    int pos0,
                                                    int pos1)
Applies a style change to the range from POS0 to POS1.
 o deleteStyles
  public synchronized void deleteStyles(int pos0,
                                        int pos1)
Deletes all styles in the range from POS0 to POS1.
 o getRichText
  public synchronized String getRichText()
Returns a "rich text" representation of the text.
 o setRichText
  public synchronized void setRichText(String s)
Sets the value of the text from a "rich text" representation.
 o getBeginningOfLine
  public synchronized int getBeginningOfLine(int pos)
Returns the position that is the beginning of the line containing pos.
 o getEndOfLine
  public synchronized int getEndOfLine(int pos)
Returns the position that is the end of the line containing pos.
 o getNextLine
  public synchronized int getNextLine(int pos)
Returns the position of the beginning of the next line. If pos is on the last line, returns -1.
 o getLinePos
  public synchronized int getLinePos(int pos,
                                     int n)
Returns the position of the beginning of the nth line from the specified pos.
 o getLinePos
  public int getLinePos(int n)
Return the position of the Nth line in the buffer.
 o getWordEnd
  public synchronized int getWordEnd(int pos,
                                     int direction)
Returns the position that is the end (or beginning if direction < 0) of the word that POS is part of. If POS is not part of a word, the position is unchanged.
 o getNextWord
  public synchronized int getNextWord(int pos,
                                      int direction)
Moves forward or backward a word (Emacs style). Returns the new position.
 o getNextWordStart
  public synchronized int getNextWordStart(int pos)
 o getColumnFor
  public synchronized int getColumnFor(int pos)
Returns the indent of a line, in character positions, for the specified POS.
 o getPosFor
  public synchronized int getPosFor(int column,
                                    int pos)
Returns the buffer position that hits the specified column on the line containing POS.
 o skipWhiteSpace
  public synchronized int skipWhiteSpace(int pos,
                                         int direction)
Skips over white space.
 o getIndent
  public synchronized int getIndent(int pos)
Moves to the indent (first non white space character) in line containing POS.
 o deleteWhiteSpace
  public synchronized int deleteWhiteSpace(int pos)
Deletes all the white space around POS. Returns the resulting buffer position.
 o indentTo
  public synchronized int indentTo(int pos,
                                   int destcol)
Indent to the specified destination column, starting at the specified position, using the smallest combination of Tabs and Spaces as possible.

All Packages  Class Hierarchy  This Package  Previous  Next  Index