Module Simula

Class RTS_TEXTOBJ

java.lang.Object
simula.runtime.RTS_RTObject
simula.runtime.RTS_TEXTOBJ

public final class RTS_TEXTOBJ extends RTS_RTObject
The Text Object.

A text object is conceptually an instance of

    class TEXTOBJ( SIZE, CONST); integer SIZE; boolean CONST;
    begin character array MAIN( 1:SIZE ); end;
 
Any text value processed by the program is contained within a text frame, i.e. a non-empty segment of the MAIN attribute of some TEXTOBJ instance, or it is empty (i.e. notext). See 2.5.

Any non-empty sequence of consecutive elements of the array attribute MAIN constitutes a text frame. More specifically, any text frame is completely identified by the following information:

  • a reference to the text object containing the frame,
  • the start position of the frame, being an ordinal number less than or equal to SIZE,
  • the length of the frame.

A frame which is completely contained by another frame is called a "subframe" of that frame. The text frame associated with the entire array attribute MAIN is called the "main frame" of the text object. All frames of the text object are subframes of the main frame.

Note: A main frame is a subframe of no frame except itself.

The frames of a text object are either all constant or all variable, as indicated by the attribute CONST. The value of this attribute remains fixed throughout the lifetime of the text object. A constant main frame always corresponds to a string (see 1.6).

The attribute SIZE is always positive and remains fixed throughout the lifetime of a text object.

Note: The identifier TEXTOBJ and its three attribute identifiers are not accessible to the user. Instead, properties of a text object are accessible through text variables, using the dot notation.

Note: In this implementation the characters in MAIN are indexed 0 through SIZE-1.

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • SIZE

      final int SIZE
      Number of characters in the text object.
    • CONST

      final boolean CONST
      True: Indicates a text constant
    • MAIN

      final char[] MAIN
      The characters
  • Constructor Details

    • RTS_TEXTOBJ

      RTS_TEXTOBJ(int size, boolean cnst)
      Create a new TEXTOBJ of the given size.
      Parameters:
      size - the givent size
      cnst - true if this text object is constant
    • RTS_TEXTOBJ

      RTS_TEXTOBJ(String s)
      Create a new TEXTOBJ with initial text.
      Parameters:
      s - the initial text value
  • Method Details

    • fill

      void fill(char c)
      Utility to fill the text object with the given character.
      Parameters:
      c - the given character
    • edText

      String edText(int start, int length)
      Edit a part of this text into a String.
      Parameters:
      start - the start index
      length - the length
      Returns:
      the resulting String
    • toString

      public String toString()
      Description copied from class: RTS_RTObject
      Returns a string representation of the object.
      Overrides:
      toString in class RTS_RTObject