Class Format.Prior

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

public static class Format.Prior extends Format
This format prints the "parens" format, if it is (directly or indirectly) contained in a Prior Format with a higher priority 'level" (numerically larger priority code).
If it has the same priority, then a different value of "alternative" selects the "parens" format. So does a negative "alternative" value.
Otherwise it prints the "noparens" format. The priority of the outermost level, when initially calling Format.FormatPrinter.startPrinting(Format), is defined as 0(zero). The preparatory calculations of the format's width requirements are only heuristical and use the maximum values, because the final print context is (naturally) not known.
See Also:
  • Field Details

    • level

      public final int level
      The paren version will be printed if this format is contained (maybe indirectly) in another Prior with higher priority.
    • alternative

      public final int alternative
      The paren version will be printed if this format is contained (maybe indirectly) in another Prior with same priority and different alternative, or if this alternative == -1.
    • noparens

      public final Format noparens
    • parens

      public final Format parens
  • Constructor Details

    • Prior

      protected Prior(int level, int alternative, Format noparens, Format parens, int indent)
      Sets all fields of the new instance.
    • Prior

      protected Prior(int level, int alternative, Format noparens, Format parens)
      Sets all fields of the new instance, but the indentation to Format.INDENT_NOT_SET.
  • Method Details

    • debugPrefix

      public String debugPrefix(int n)
      Description copied from class: Format
      Overridden by subclasses to deliver a printable representation for debugging purpose.
      Specified by:
      debugPrefix in class Format
      Parameters:
      n - the maximal number of characters
    • doprint

      protected void doprint(Format.FormatPrinter v)
      Description copied from class: Format
      Over-ridden by all sub-classes of Format, for performing the adquate print operations. To be printed is the raison d'ĂȘtre of Format objects. These methods do not use the Visitor/Matcher framework, but direct method invocation and basic method dispatch for descending to child nodes.
      Specified by:
      doprint in class Format
    • indent

      public Format.Prior indent(int i)
      Description copied from class: Format
      Returns a clone of this with the new value of Format.indent. (The built-in "clone()" functionality cannot be used, since field "indent" is final).
      Specified by:
      indent in class Format