Class TextPosn


public class TextPosn extends TextPosnBase
Class TextPosition represents a position in a particular text stream. We refer to it as a tracked position, meaning that the stream tracks it and will update it as insertions and deletions occur at locations in the stream before this position. For information on a position object that is not tracked, please see the base class, TextPosnBase.

For more information, please see the extenral documentation and the base class.

  • Constructor Details

    • TextPosn

      public TextPosn()
      Default constructor.

      The position is not initially associated with any stream.

    • TextPosn

      public TextPosn(TextPosn oSource)
      Copy constructor.

      Copy all contents of the source position, including stream association, index and before/after state.

      Parameters:
      oSource - Source position object to copy.
    • TextPosn

      public TextPosn(TextPosnBase oSource)
      Copy (base class) constructor.

      This method creates the position objecgt by copying the stream association, index and before/after type from an object in the base class, TextPosnBase. Note: even though this copies the base class, the new position object will be tracked by the stream.

      Parameters:
      oSource - Base class position object to copy.
    • TextPosn

      public TextPosn(TextStream poNewStream)
      Constructor with stream and optional position type.

      Construct a position object associated with the given stream and optional position type. The position is placed before the first non-attribute item in the stream.

      Parameters:
      poNewStream - Stream to associate with. NULL creates a position object with no initial association.
    • TextPosn

      public TextPosn(TextStream poNewStream, int nNewIndex, int eNewPosn)
      Constructor with stream, index and optional position type.

      Construct a position object associated with the given stream and optional position type. The position is placed at the specified index.

      Parameters:
      poNewStream - Stream to associate with. NULL creates a position object with no initial association.
      nNewIndex - Index number for the position. Will be truncated if too large.
      eNewPosn - (optional) Position type to use for the object. Default is POSN_AFTER.
    • TextPosn

      public TextPosn(TextStream poNewStream, int nNewIndex)
  • Method Details

    • equals

      public boolean equals(Object object)
      Description copied from class: TextPosnBase
      Equality comparison. Two text positions are considered equal if they are associated with the same stream, have the same index number. Note that the operation does not compare any other attributes (e.g., before/after, affinity, RTL etc.) This is so that equality comparison has a consistent behaviour with greater/less than comparisons.
      Overrides:
      equals in class TextPosnBase
      Parameters:
      object - - Position to compare against.
      Returns:
      TRUE if the positions are equal; FALSE if not.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TextPosnBase
    • copyFrom

      public void copyFrom(TextPosn oSource)
      Assignment operator.

      Copy the entire content of the source position object including stream association, index and before/after type. The position object will be tracked by the new stream (if not NULL) and will no longer be tracked by its old stream.

      Parameters:
      oSource - Source position object to copy.
    • copyFrom

      public void copyFrom(TextPosnBase oSource)
      Assignment operator from base class.

      Copy the entire content of the source position object including stream association, index and before/after type. The position object will be tracked by the new stream (if not NULL) and will no longer be tracked by its old stream.

      Overrides:
      copyFrom in class TextPosnBase
      Parameters:
      oSource - Source (base class) position object to copy.
    • associate

      public void associate(TextStream poNewStream, int eNewPosn)
      Overridden: Associate position with a new stream.

      This method overrides the base class implementation. It associates the position object with the specified stream, immediately before the first non-attribute item. The position object will be tracked by the new stream (if not NULL) and will no longer be tracked by its old stream.

      Overrides:
      associate in class TextPosnBase
      Parameters:
      poNewStream - Stream to associate with. NULL leaves the position object unassociated (and untracked).
      eNewPosn - (optional) Position type to use for the object. Default is POSN_AFTER.
    • associate

      public void associate(TextStream poNewStream, int nNewIndex, int eNewPosn)
      Overridden: Associate position with a new stream and index.

      This method overrides the base class implementation. It associates the position object with the specified stream, at the specified index position. The position object will be tracked by the new stream (if not NULL) and will no longer be tracked by its old stream.

      Overrides:
      associate in class TextPosnBase
      Parameters:
      poNewStream - Stream to associate with. NULL leaves the position object unassociated (and untracked).
      nNewIndex - Index of this position in the new stream. If the value is too large, it is truncated.
      eNewPosn - (optional) Position type to use for the object. Default is POSN_AFTER.
    • associate

      public void associate(TextStream poNewStream)
      Overrides:
      associate in class TextPosnBase
    • para

      public void para()
      Description copied from class: TextPosnBase
      Overridden: Insert a paragraph mark. This method implements a virtual method declared in base class TextMkBase. It simply calls the InsertPara() method.
      Overrides:
      para in class TextPosnBase
    • text

      public void text(String sText)
      Description copied from class: TextPosnBase
      Overridden: Insert text. This method implements a virtual method declared in base class TextMkBase. It simply calls the appropriate Insert() overload.
      Overrides:
      text in class TextPosnBase
      Parameters:
      sText - - Text to be inserted.
    • attr

      public void attr(TextAttr oAttr)
      Description copied from class: TextPosnBase
      Overridden: Insert attribute change. This method implements a virtual method declared in base class TextMkBase. It simply calls the appropriate Attribute() overload.
      Overrides:
      attr in class TextPosnBase
      Parameters:
      oAttr - - Attribute change to insert.