Class Annotated<A>

java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Annotated<A>
Type Parameters:
A - the type of the the annotated data
All Implemented Interfaces:
Formattable, Serializable, Cloneable
Direct Known Subclasses:
ReferenceFormat

public class Annotated<A> extends Format
Realizes a data annotation. Each instance combines some format content with some data value.
See Also:
  • Field Details

    • format

      protected final Format format
      The printable contents which shall be annotated.
    • annotation

      @Opt protected final A annotation
      The annotation value.
  • Constructor Details

    • Annotated

      public Annotated(Format format, @Opt A annotation)
      Sole Constructor.

      (An annotated format is transparent for printing and thus carries no own indentation value.)

      Parameters:
      format - to be annotated with the given data
      annotation - the data to annotate to the given format
  • 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
    • indent

      public Annotated<A> indent(int i)
      Set the indentation intedend for the rendering of this foramt. An annotated format is transparent for printing and thus carries no own indentation value. Therefore this intention is propagated to the contained format.
      Specified by:
      indent in class Format
      Parameters:
      i - new indentation value
      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)
    • eval

      public Format eval(Context c, boolean partial)
      Description copied from class: Format
      Return the result of replacing all variables with the bindings in the given context.
      Overrides:
      eval in class Format
      Parameters:
      c - defines the replacement for variables by name and number.
      partial - decides when a Variable not defined in the context is found: if true the Variable stays aunaltered; if false an IllegalArgumentException is thrown.
      Returns:
      a format with all or some variables replaced
    • 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.
    • getFormat

      public Format getFormat()
      Getter used by diagnosis.
      Returns:
      the format which is annotated
    • getAnnotation

      public A getAnnotation()
      Getter used by diagnosis.
      Returns:
      the annotated data