Class Format.Compound

java.lang.Object
eu.bandm.tools.format.Format
eu.bandm.tools.format.Format.Compound
All Implemented Interfaces:
Formattable, Serializable, Cloneable
Direct Known Subclasses:
Format.Append, Format.Beneath, Format.Beside, Format.Block, Format.Comment, Format.Line, Format.Tabular
Enclosing class:
Format

public abstract static class Format.Compound extends Format
The base class for all formats which combine (= "contain") sub-formats.
See Also:
  • Field Details

    • subs

      public final List<Format> subs
      All sub-formats. This list is unmodifiable.
  • Constructor Details

    • Compound

      protected Compound(List<Format> f)
      A constructor
      Parameters:
      f - list of sub-formats, should not be empty
    • Compound

      protected Compound(int i, int a, List<Format> f)
      A constructor
      Parameters:
      i - minwidth
      a - maxnwidth
      f - list of sub-formats, should not be empty
    • Compound

      protected Compound(int i, int a, boolean m, List<Format> f)
      A constructor
      Parameters:
      i - minwidth
      a - maxnwidth
      m - isMultiLine
      f - list of sub-formats, should not be empty
    • Compound

      protected Compound(int i, int a, boolean m, boolean g, int indent, List<Format> f)
      A constructor used by our (mere technical) "clone" replacement
      Parameters:
      i - minwidth
      a - maxnwidth
      m - is always multiLine
      g - is ground
      indent - indentation
      f - list of sub-formats, should not be empty
  • Method Details

    • constructor

      abstract CompoundConstructor constructor()
      Delivers the reification of the constructor. That enum type has "apply()" methods which generate a corresponding instance. This is used for the implementation of "clone-with-overwrite", etc.
    • indent

      public Format.Compound 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
    • mutate

      public abstract Format.Compound mutate(Consumer<List<Format>> mapSubs)
      Creates a new instance of the same class as this, with sub-formats altered by the given consumer function.
    • eval

      public Format eval(Format.Context c, boolean partial)
      Creates a new clone in which variables are replaced by their definition, according to the Context.
      Overrides:
      eval in class Format
      partial - decides when a Variable not defined in the context is found: if true the Variable stays aunaltered; if false an IllegalArgumentException is thrown.
    • 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