Class Empty

java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Empty
All Implemented Interfaces:
Formattable, Serializable, Cloneable

public class Empty extends Format
A format which prints as an empty string in any printing context. Needed for instance in "case" expressions, when one alternative shall produce no output at all.
See Also:
  • Constructor Details

    • Empty

      protected Empty()
      Constructor, leaving the indentation unspecified.
  • Method Details

    • 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
    • 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.
    • indent

      public Empty indent(int i)
      Indentation of an empty format is not considered by the printing visitors, so that empty formats can safely be dropped when compressing the argument lists for compounds. Since empty formats can come into play spontaneously, when a variable is replaced, there is no error message when the indentation is set, but silent dropping.
      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.
      Throws:
      IllegalArgumentException - if ident value not valid, see Format.checkValidIndent(int)