Package com.ms.fx Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class FxText

Constructors , Methods , Fields

public class FxText 
{
  // Fields
  public char buffer[];
  public int nChars;
  public int nBuffSize;

  // Constructors
  public FxText();
  public FxText(String newBuff);
  public FxText(char newBuff[]);
  public FxText(char newBuff[], int offset, int length);

  // Methods
  public boolean isWhite(int i);
  public boolean isWhite(int i, boolean treatLFasWhite);
  public int getWordBreak( int iChar );
  public void ensureResize(int amountNeeded);
  public int length();
  public void append(char key);
  public void append(char key[]);
  public void append(char key[], int offs, int len);
  public void setText(char newBuff[]);
  public void setText(String s);
  public void setText(char newBuff[], int offset, int nCharsNew);
  public void insert(char key, int iPos);
  public void insert(char key[], int offs, int keyLen, int iPos);
  public void insert(char key[], int iPos);
  public boolean isDelimiter(int iPos);
  public void remove(int iPos, int numberToRemove);
  public char getChar(int idx);
}

The FxText class is similar to StringBuffer; however, there is no synchronization on the buffer. This makes it a lot faster. The buffers are designed to be plugged into UI components.


Constructors


FxText

public FxText();

Creates an empty sentence.


FxText

public FxText(String newBuff);

Creates a new sentence based on a string.

ParameterDescription
newBuff The string to base the new sentence on.


FxText

public FxText(char newBuff[]);

Creates a new sentence based on a character array.

ParameterDescription
newBuff The array of characters to base the new sentence on.


FxText

public FxText(char newBuff[], int offset, int length);

Creates a new sentence based on a portion of a character array.

ParameterDescription
newBuff The array of characters to base the new sentence on.
offset The offset to use.
length The length of the array used.


Methods


isWhite

public boolean isWhite(int i);

Checks if a character is classified as a white space.

Return Value:

Returns true if it is a white space; otherwise, returns false.

ParameterDescription
i The offset in buffer.


isWhite

public boolean isWhite(int i, boolean treatLFasWhite);

Checks if a character is classified as a white space and whether to include a line feed.

Return Value:

Returns true if it is considered white space; otherwise, returns false.

ParameterDescription
i The offset in buffer.
treatLFasWhite The Boolean value that determines if a line feed should be included.

Remarks:

This method is useful for marking the end of a line of text.


getWordBreak

public int getWordBreak(int iChar);

Retrieves the numbers of characters in the next word.

Return Value:

Returns the number of characters in the next word.

ParameterDescription
iChar The location to start looking for the next word.

Remarks:

The next word includes leading white space, but not trailing.


ensureResize

public void ensureResize(int amountNeeded);

Ensures that the buffer has enough room in it.

Return Value:

No return value.

ParameterDescription
amountNeeded The amount of memory needed for the buffer.


length

public int length();

Retrieves the number of characters in the buffer.

Return Value:

Returns the number of characters in the buffer.


append

public void append(char key);

Appends a character to the end of the buffer.

Return Value:

No return value.

ParameterDescription
key The character to append.


append

public void append(char key[]);

Appends an array of characters to the end of the buffer.

Return Value:

No return value.

ParameterDescription
key The array of characters to append.


append

public void append(char key[], int offs, int len);

Appends an array of characters to the end of the buffer, using a specified offset and length.

Return Value:

No return value.

ParameterDescription
key The array of characters to append.
offs The specified offset.
len The length of the array.


setText

public void setText(char newBuff[]);

Replaces the text in the sentence with that of a character array.

Return Value:

No return value.

ParameterDescription
newBuff[] A character array.


setText

public void setText(String s);

Replaces the text in the sentence with that of a specified string.

Return Value:

No return value.

ParameterDescription
s The string to replace the sentence.


setText

public void setText(char newBuff[], int offset, int nCharsNew);

Replaces the text in the sentence with that of a character array, starting at a specified offset.

Return Value:

No return value.

ParameterDescription
newBuff[] A character array.
offset The specified offset.
nCharsNew The number of new characters from the character array.


insert

public void insert(char key, int iPos);

Inserts a character into the buffer.

Return Value:

No return value.

ParameterDescription
key The character to insert.
iPos The position in the buffer to insert the character.


insert

public void insert(char key[], int offs, int keyLen, int iPos);

Inserts an array of characters into the buffer.

Return Value:

No return value.

ParameterDescription
key The array of characters to insert.
offs The specified offset.
keyLen The length of the character array.
iPos The position in the buffer to insert the character.


insert

public void insert(char key[], int iPos);

Inserts an array of characters into the buffer.

Return Value:

No return value.

ParameterDescription
key The array of characters to insert.
iPos The position in the buffer to insert the characters.


isDelimiter

public boolean isDelimiter(int iPos);

Checks if the character is a delimiter.

Return Value:

Returns true if it is a delimiter; otherwise, returns false.

ParameterDescription
iPos The position of the character to check.


remove

public void remove(int iPos, int numberToRemove);

Deletes one or more characters.

Return Value:

No return value.

ParameterDescription
iPos The position to start the deletion.
numberToRemove The number of characters to remove.


getChar

public char getChar(int idx);

Retrieves the character at the given location.

Return Value:

Returns the character at position idx.

ParameterDescription
idx The location of the character.


Fields

buffer[]
The buffer containing the sentence.
nChars
The number of characters in the buffer.
nBuffSize
The size of the buffer.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.