Class Variable

java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Variable
All Implemented Interfaces:
Formattable, Serializable, Cloneable
Direct Known Subclasses:
BoundVariable, FreeVariable

public abstract class Variable extends Format
Common base class for FreeVariable and BoundVariable
See Also:
  • Field Details

    • DEFAULT_PREFIX

      public static final String DEFAULT_PREFIX
      The default prefix for parsing and display of variables.
      See Also:
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Returns either the explicit name of FreeVariable, or the position number of a BoundVariable.
      Returns:
      the name (given or numeric)
    • getPrefix

      public String getPrefix()
      Return the prefix used for parsing and display.
      Returns:
      the prefix used for parsing and display.
    • indent

      public Format indent(int i)
      Returns a format structure which combines the behaviour of the given variable with the given indentation.

      (An indentation stored locally to the Variable instance would get lost when the variable is replaced. Therefore the result is append(variable, empty).indent(i). The empty format is inserted to avoid a de-normal compound format.)

      Specified by:
      indent in class Format
      Parameters:
      i - the new value for indent.
      Returns:
      an new format with identical values but i, or this, if i is its indent value.
    • doprint

      protected void doprint(FormatPrinter v)
      Description copied from class: Format
      Over-ridden by all sub-classes of Format, for performing the print operations.
      Specified by:
      doprint in class Format
      Parameters:
      v - realizes the dynamic context for printing
    • bottom

      protected Format bottom()
      Throws always an IllegalArgumentException.
      Returns:
      nothing, since an IllegalArgumentException is always thrown.
      Throws:
      IllegalArgumentException - always
    • debugPrefix

      public String debugPrefix(int n)
      Description copied from class: Format
      Deliver the concatenation of the text contents, limited by the given number of characters, approximately. Useful for debugging purpose.
      Specified by:
      debugPrefix in class Format
      Parameters:
      n - the maximal number of characters which can be generated per tree node.
      Returns:
      the concatenated, unformatted text contents.