Skip to content

Class Iris

Javadoc 27 generates this reference during each site build from the exported packages and the annotation processor. The Java guide shows the API in use.

java.lang.Object
dev.gecode.iris.build.Iris
public final class Iris extends Object
Builds reader specs from Java code. Import its members with import static dev.gecode.iris.build.Iris.*;.

Handles are typed constants that name entries: int2("machine") is an IntField<List<long[]>>, and data.get(machine) returns a List<long[]>. Each statement is a static method, which adds the statement to the innermost open block; a block statement takes its body as a lambda, which runs with that block open. A scoped value holds the open block, so a statement called outside a builder body throws IllegalStateException.

static final IntField<Long> n = int0("n");
static final IntField<long[]> x = int1("x");
static final Spec spec =
    spec(
        "numbers",
        () -> {
          read(n, atLeast(0));
          repeat(n, () -> read(x, intType()));
        });

A mistake that one statement shows throws BuildException at that call; the checks of the whole spec throw it from Builder.build(). Either way its call site is the line of the caller's code that made the statement.

  • Method Details

    • builder

      public static Builder builder(Runnable body)
      Builds a reader spec: body adds its statements.
      Parameters:
      body - the statements
      Returns:
      the builder, whose Builder.build() gives the spec
      Throws:
      BuildException - if a statement fails a check
    • builder

      public static Builder builder(String format, Runnable body)
      Builds a reader spec that starts with format name.
      Parameters:
      format - the format name
      body - the statements
      Returns:
      the builder, whose Builder.build() gives the spec
      Throws:
      BuildException - if a statement fails a check
    • spec

      public static Spec spec(Runnable body)
      Builds and parses a reader spec.
      Parameters:
      body - the statements
      Returns:
      the spec
      Throws:
      BuildException - if a check fails, or the language rejects the text
    • spec

      public static Spec spec(String format, Runnable body)
      Builds and parses a reader spec that starts with format name.
      Parameters:
      format - the format name
      body - the statements
      Returns:
      the spec
      Throws:
      BuildException - if a check fails, or the language rejects the text
    • int0

      public static IntField<Long> int0(String name)
      Returns the handle of a single integer.
      Parameters:
      name - the entry name
      Returns:
      the handle of a single integer
      Throws:
      BuildException - if name is not an Iris name
    • int1

      public static IntField<long[]> int1(String name)
      Returns the handle of an array of integers.
      Parameters:
      name - the entry name
      Returns:
      the handle of an array of integers
      Throws:
      BuildException - if name is not an Iris name
    • int2

      public static IntField<List<long[]>> int2(String name)
      Returns the handle of a two-dimensional array of integers.
      Parameters:
      name - the entry name
      Returns:
      the handle of a two-dimensional array of integers
      Throws:
      BuildException - if name is not an Iris name
    • int3

      public static IntField<List<List<long[]>>> int3(String name)
      Returns the handle of a three-dimensional array of integers.
      Parameters:
      name - the entry name
      Returns:
      the handle of a three-dimensional array of integers
      Throws:
      BuildException - if name is not an Iris name
    • intN

      public static IntField<Value> intN(String name, int depth)
      Returns the handle of integers at any depth, read as a Value.
      Parameters:
      name - the entry name
      depth - the depth
      Returns:
      the handle of integers at any depth, read as a Value
      Throws:
      BuildException - if name is not an Iris name
    • float0

      public static FloatField<Double> float0(String name)
      Returns the handle of a single float.
      Parameters:
      name - the entry name
      Returns:
      the handle of a single float
      Throws:
      BuildException - if name is not an Iris name
    • float1

      public static FloatField<double[]> float1(String name)
      Returns the handle of an array of floats.
      Parameters:
      name - the entry name
      Returns:
      the handle of an array of floats
      Throws:
      BuildException - if name is not an Iris name
    • float2

      public static FloatField<List<double[]>> float2(String name)
      Returns the handle of a two-dimensional array of floats.
      Parameters:
      name - the entry name
      Returns:
      the handle of a two-dimensional array of floats
      Throws:
      BuildException - if name is not an Iris name
    • float3

      public static FloatField<List<List<double[]>>> float3(String name)
      Returns the handle of a three-dimensional array of floats.
      Parameters:
      name - the entry name
      Returns:
      the handle of a three-dimensional array of floats
      Throws:
      BuildException - if name is not an Iris name
    • floatN

      public static FloatField<Value> floatN(String name, int depth)
      Returns the handle of floats at any depth, read as a Value.
      Parameters:
      name - the entry name
      depth - the depth
      Returns:
      the handle of floats at any depth, read as a Value
      Throws:
      BuildException - if name is not an Iris name
    • num0

      public static NumField<Number> num0(String name)
      Returns the handle of a single num, a Long or a Double as the data decides.
      Parameters:
      name - the entry name
      Returns:
      the handle of a single num, a Long or a Double as the data decides
      Throws:
      BuildException - if name is not an Iris name
    • num1

      public static NumField<List<Number>> num1(String name)
      Returns the handle of an array of nums.
      Parameters:
      name - the entry name
      Returns:
      the handle of an array of nums
      Throws:
      BuildException - if name is not an Iris name
    • num2

      public static NumField<List<List<Number>>> num2(String name)
      Returns the handle of a two-dimensional array of nums.
      Parameters:
      name - the entry name
      Returns:
      the handle of a two-dimensional array of nums
      Throws:
      BuildException - if name is not an Iris name
    • num3

      public static NumField<List<List<List<Number>>>> num3(String name)
      Returns the handle of a three-dimensional array of nums.
      Parameters:
      name - the entry name
      Returns:
      the handle of a three-dimensional array of nums
      Throws:
      BuildException - if name is not an Iris name
    • numN

      public static NumField<Value> numN(String name, int depth)
      Returns the handle of nums at any depth, read as a Value.
      Parameters:
      name - the entry name
      depth - the depth
      Returns:
      the handle of nums at any depth, read as a Value
      Throws:
      BuildException - if name is not an Iris name
    • string0

      public static StringField<String> string0(String name)
      Returns the handle of a single string.
      Parameters:
      name - the entry name
      Returns:
      the handle of a single string
      Throws:
      BuildException - if name is not an Iris name
    • string1

      public static StringField<List<String>> string1(String name)
      Returns the handle of an array of strings.
      Parameters:
      name - the entry name
      Returns:
      the handle of an array of strings
      Throws:
      BuildException - if name is not an Iris name
    • string2

      public static StringField<List<List<String>>> string2(String name)
      Returns the handle of a two-dimensional array of strings.
      Parameters:
      name - the entry name
      Returns:
      the handle of a two-dimensional array of strings
      Throws:
      BuildException - if name is not an Iris name
    • string3

      public static StringField<List<List<List<String>>>> string3(String name)
      Returns the handle of a three-dimensional array of strings.
      Parameters:
      name - the entry name
      Returns:
      the handle of a three-dimensional array of strings
      Throws:
      BuildException - if name is not an Iris name
    • stringN

      public static StringField<Value> stringN(String name, int depth)
      Returns the handle of strings at any depth, read as a Value.
      Parameters:
      name - the entry name
      depth - the depth
      Returns:
      the handle of strings at any depth, read as a Value
      Throws:
      BuildException - if name is not an Iris name
    • dynamic

      public static DynField dynamic(String name)
      Returns the handle of an entry whose value type and depth are open, read as a Value that is null when the entry is absent.
      Parameters:
      name - the entry name
      Returns:
      the handle of an entry whose value type and depth are open, read as a Value that is null when the entry is absent
      Throws:
      BuildException - if name is not an Iris name
    • forward

      public static <H extends Field<?>> H forward(String name, Class<? extends HandleKind<H>> kind)
      Declares a name in the open builder and returns its handle, of the kind kind names: Int.class, Real.class, Num.class, Str.class or Dyn.class. The handle is a required value at depth 0, or open for Dyn.class, and belongs to this builder.

      forward("_", Str.class) is the handle of the entry that store _ keeps. Builder.build() reports a handle that nothing defines, and a definition that does not have its type, unless an earlier one always precedes it.

      Type Parameters:
      H - the handle class
      Parameters:
      name - the entry name, which may be _
      kind - the kind of handle
      Returns:
      the handle
      Throws:
      BuildException - if name is not an Iris name or is already declared
    • undefined

      public static DynField undefined(String name)
      Declares a name that is deliberately left undefined, as in check !defined(name), and returns its handle. Defining it fails Builder.build().
      Parameters:
      name - the entry name
      Returns:
      the handle
      Throws:
      BuildException - if name is not an Iris name or is already declared
    • declare

      public static <H extends Field<?>> H declare(H handle)
      Declares the name of handle, a handle from a factory such as int0(String), in the open builder, and returns the handle. Its first use would declare the name too, but a use accepts a name that an equal handle declared before; this fails when anything has declared the name.

      A builder whose definitions take a name rather than a handle, such as the Kotlin builder, declares each name with it, so that a helper called twice with one name is an error rather than a redefinition. Redefinition goes through the handle.

      Type Parameters:
      H - the handle class
      Parameters:
      handle - the handle to declare
      Returns:
      handle
      Throws:
      BuildException - if the name is already declared in this builder
      IllegalArgumentException - if handle does not come from a factory
    • recordName

      public static RecordName recordName()
      Returns a record name, printed with names the builder chooses.
      Returns:
      a record name, printed with names the builder chooses
    • recordName

      public static RecordName recordName(String each, String list)
      Returns a record name, printed as each for the current record and list for all of them.
      Parameters:
      each - the each name, which may be _
      list - the as name, which may be _
      Returns:
      a record name, printed as each for the current record and list for all of them
      Throws:
      BuildException - if a name is not an Iris name
    • format

      public static void format(String name)
      format name, a name of this format.
      Parameters:
      name - the format name
    • comment

      public static void comment(String marker, String... more)
      comment "text"....
      Parameters:
      marker - a comment marker
      more - more comment markers
    • stop

      public static void stop(String marker, String... more)
      stop "text"....
      Parameters:
      marker - a stop marker
      more - more stop markers
    • tokens

      public static void tokens(String characters)
      tokens "characters".
      Parameters:
      characters - the characters that are tokens of their own
    • separators

      public static void separators(String characters)
      separators "characters".
      Parameters:
      characters - the characters that separate tokens
    • ignoreTrailing

      public static void ignoreTrailing()
      ignore trailing.
    • instances

      public static void instances(Runnable body)
      instances { ... }.
      Parameters:
      body - the statements of one instance
    • read

      public static DynField read(Field<?> target, Type<?> type)
      x: type, reading a value into the entry of target.
      Parameters:
      target - the handle of the entry
      type - the type, with any dimensions and options
      Returns:
      the handle of the name as this definition leaves it
    • read

      public static void read(Discard target, Type<?> type)
      _: type, reading a value without storing it.
      Parameters:
      target - discard()
      type - the type, with any dimensions and options
    • list

      public static DynField list(Field<?> target, ListReading reading)
      list x: type until end.
      Parameters:
      target - the handle of the entry
      reading - the type and end, from type.until(end)
      Returns:
      the handle of the name as this definition leaves it
    • list

      public static void list(Discard target, ListReading reading)
      list _: type until end.
      Parameters:
      target - discard()
      reading - the type and end, from type.until(end)
    • let

      public static DynField let(Field<?> target, Expr value)
      let x = value.
      Parameters:
      target - the handle of the entry
      value - the value
      Returns:
      the handle of the name as this definition leaves it
    • let

      public static void let(Discard target, Expr value)
      let _ = value, which evaluates value without storing it.
      Parameters:
      target - discard()
      value - the value
    • param

      public static DynField param(Field<?> target)
      param p, whose value and type the caller decides.
      Parameters:
      target - the handle of the parameter
      Returns:
      the handle of the name as this definition leaves it
    • param

      public static DynField param(Field<?> target, Expr defaultValue)
      param p = default. A caller's value is a scalar, so the parameter is a scalar in its block when the default is one there: a scalar expression, or a handle of depth 0 at the top level. Any other default gives an open depth, which only dynamic(name) accepts.
      Parameters:
      target - the handle of the parameter
      defaultValue - the value when the caller gives none
      Returns:
      the handle of the name as this definition leaves it
    • set

      public static void set(IntField<?> handle, IntExpr value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if value has another depth than the handle
    • set

      public static void set(IntField<?> handle, long value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if the handle is not a single value
    • set

      public static void set(FloatField<?> handle, FloatExpr value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if value has another depth than the handle
    • set

      public static void set(FloatField<?> handle, double value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if the handle is not a single value
    • set

      public static void set(NumField<?> handle, NumExpr value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if value has another depth than the handle
    • set

      public static void set(StringField<?> handle, StringExpr value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if value has another depth than the handle
    • set

      public static void set(StringField<?> handle, String value)
      let x = value through a handle, keeping its type and depth.
      Parameters:
      handle - the handle
      value - the value
      Throws:
      BuildException - if the handle is not a single value
    • set

      public static void set(DynField handle, Expr value)
      let x = value through a handle whose type is open.
      Parameters:
      handle - the handle
      value - the value
    • defineType

      public static IntType defineType(String name, IntType type)
      type name = type, usable wherever a type is. The type it returns belongs to this declaration: Builder.build() reports a use where another declaration of the name is visible.
      Parameters:
      name - the type name
      type - the type, without dimensions
      Returns:
      the named type
    • defineType

      public static FloatType defineType(String name, FloatType type)
      type name = type.
      Parameters:
      name - the type name
      type - the type, without dimensions
      Returns:
      the named type
    • defineType

      public static NumType defineType(String name, NumType type)
      type name = type.
      Parameters:
      name - the type name
      type - the type, without dimensions
      Returns:
      the named type
    • defineType

      public static StringType defineType(String name, StringType type)
      type name = type.
      Parameters:
      name - the type name
      type - the type, without dimensions
      Returns:
      the named type
    • check

      public static void check(Expr condition)
      check condition.
      Parameters:
      condition - the condition
    • check

      public static void check(Expr condition, String message)
      check condition "message".
      Parameters:
      condition - the condition
      message - the message when it fails
    • expect

      public static void expect(String word, String... more)
      expect "text"....
      Parameters:
      word - an expected word
      more - more expected words
    • line

      public static void line(Object... parts)
      line "pattern".
      Parameters:
      parts - the pattern: text, handles, parts and patterns, as pattern(Object...) takes
    • find

      public static void find(Object... parts)
      find "pattern".
      Parameters:
      parts - the pattern: text, handles, parts and patterns, as pattern(Object...) takes
    • skipLine

      public static void skipLine()
      skip line.
    • skipLines

      public static void skipLines(Expr count)
      skip count lines.
      Parameters:
      count - the number of lines
    • skipLines

      public static void skipLines(long count)
      skip count lines.
      Parameters:
      count - the number of lines
    • index

      public static void index(Expr position)
      index position.
      Parameters:
      position - the position
    • index

      public static void index(long position)
      index position.
      Parameters:
      position - the position
    • repeat

      public static void repeat(Expr count, Runnable body)
      repeat count { ... }.
      Parameters:
      count - the number of times
      body - the statements of one time
    • repeat

      public static void repeat(long count, Runnable body)
      repeat count { ... }.
      Parameters:
      count - the number of times
      body - the statements of one time
    • repeat

      public static void repeat(Expr count, RecordName record, Runnable body)
      repeat count { ... }, whose records record names.
      Parameters:
      count - the number of times
      record - the record name, which no other repeat of this builder binds
      body - the statements of one time
      Throws:
      BuildException - if another repeat bound record
    • repeat

      public static void repeat(long count, RecordName record, Runnable body)
      repeat count { ... }, whose records record names.
      Parameters:
      count - the number of times
      record - the record name, which no other repeat of this builder binds
      body - the statements of one time
      Throws:
      BuildException - if another repeat bound record
    • repeatUntilEof

      public static void repeatUntilEof(Runnable body)
      repeat until eof { ... }.
      Parameters:
      body - the statements of one time
    • repeatUntilEof

      public static void repeatUntilEof(RecordName record, Runnable body)
      repeat until eof { ... }, whose records record names.
      Parameters:
      record - the record name, which no other repeat of this builder binds
      body - the statements of one time
      Throws:
      BuildException - if another repeat bound record
    • repeatUntil

      public static void repeatUntil(Until until, Runnable body)
      repeat until "text"... { ... }.
      Parameters:
      until - the terminators, from until(String, String...), with any store
      body - the statements of one time
    • repeatUntil

      public static void repeatUntil(Until until, RecordName record, Runnable body)
      repeat until "text"... { ... }, whose records record names.
      Parameters:
      until - the terminators, from until(String, String...), with any store
      record - the record name, which no other repeat of this builder binds
      body - the statements of one time
      Throws:
      BuildException - if another repeat bound record
    • until

      public static Until until(String terminator, String... more)
      Returns the terminators until "text"... of a repeat or sections.
      Parameters:
      terminator - a terminator
      more - more terminators
      Returns:
      the terminators until "text"... of a repeat or sections
    • skipOther

      public static SectionClause skipOther()
      Returns the skip other clause of sections.
      Returns:
      the skip other clause of sections
    • sections

      public static void sections(Runnable body)
      sections { ... }, whose body holds only arms.
      Parameters:
      body - the arms
    • sections

      public static void sections(SectionClause clause, Runnable body)
      sections clause { ... }.
      Parameters:
      clause - the clause
      body - the arms
    • sections

      public static void sections(SectionClause first, SectionClause second, Runnable body)
      sections clause clause { ... }.
      Parameters:
      first - the first clause
      second - the second clause
      body - the arms
    • sections

      public static void sections(SectionClause first, SectionClause second, SectionClause third, Runnable body)
      sections clause clause clause { ... }.
      Parameters:
      first - the first clause
      second - the second clause
      third - the third clause
      body - the arms
    • sections

      public static void sections(List<? extends SectionClause> clauses, Runnable body)
      sections clause... { ... }, with any number of clauses.
      Parameters:
      clauses - the clauses, in order
      body - the arms
    • optional

      public static ArmOption optional()
      Returns the optional option of an arm.
      Returns:
      the optional option of an arm
    • last

      public static ArmOption last()
      Returns the last option of an arm.
      Returns:
      the last option of an arm
    • arm

      public static void arm(String text, ArmOption... options)
      An arm of the enclosing sections, with no body.
      Parameters:
      text - the pattern, as text
      options - optional() and last()
    • arm

      public static void arm(Pattern pattern, ArmOption... options)
      An arm of the enclosing sections, with no body.
      Parameters:
      pattern - the pattern
      options - optional() and last()
    • arm

      public static void arm(String text, Runnable body)
      An arm of the enclosing sections.
      Parameters:
      text - the pattern, as text
      body - the statements after the arm's line
    • arm

      public static void arm(Pattern pattern, Runnable body)
      An arm of the enclosing sections.
      Parameters:
      pattern - the pattern
      body - the statements after the arm's line
    • arm

      public static void arm(String text, ArmOption option, Runnable body)
      An arm of the enclosing sections.
      Parameters:
      text - the pattern, as text
      option - optional() or last()
      body - the statements after the arm's line
    • arm

      public static void arm(Pattern pattern, ArmOption option, Runnable body)
      An arm of the enclosing sections.
      Parameters:
      pattern - the pattern
      option - optional() or last()
      body - the statements after the arm's line
    • arm

      public static void arm(String text, ArmOption first, ArmOption second, Runnable body)
      An arm of the enclosing sections.
      Parameters:
      text - the pattern, as text
      first - optional() or last()
      second - optional() or last()
      body - the statements after the arm's line
    • arm

      public static void arm(Pattern pattern, ArmOption first, ArmOption second, Runnable body)
      An arm of the enclosing sections.
      Parameters:
      pattern - the pattern
      first - optional() or last()
      second - optional() or last()
      body - the statements after the arm's line
    • ifThen

      public static void ifThen(Expr condition, Runnable body)
      if condition { ... }. What its block defines may be absent.
      Parameters:
      condition - the condition
      body - the statements when it holds
    • elseIf

      public static void elseIf(Expr condition, Runnable body)
      else if condition { ... }, directly after an ifThen or elseIf block.
      Parameters:
      condition - the condition
      body - the statements when it holds
      Throws:
      BuildException - if no ifThen or elseIf block comes just before
    • otherwise

      public static void otherwise(Runnable body)
      else { ... }, directly after an ifThen or elseIf block.
      Parameters:
      body - the statements when no condition holds
      Throws:
      BuildException - if no ifThen or elseIf block comes just before
    • elseReadIf

      public static DynField elseReadIf(Field<?> target, Type<?> type)
      else if:type: the else branch is a declaration of the name if, which the target must have.
      Parameters:
      target - the handle of the entry named if
      type - the type
      Returns:
      the handle of the name as this definition leaves it
      Throws:
      BuildException - if no ifThen or elseIf block comes just before, or the target has another name
    • intType

      public static IntType intType()
      Returns int.
      Returns:
      int
    • floatType

      public static FloatType floatType()
      Returns float.
      Returns:
      float
    • numType

      public static NumType numType()
      Returns num, an integer or a float as the data decides.
      Returns:
      num, an integer or a float as the data decides
    • word

      public static StringType word()
      Returns word.
      Returns:
      word
    • rest

      public static StringType rest()
      Returns rest, the rest of the line.
      Returns:
      rest, the rest of the line
    • alphabet

      public static Alphabet alphabet(String symbols)
      Returns alphabet "symbols".
      Parameters:
      symbols - the symbols, whose indices are the values
      Returns:
      alphabet "symbols"
    • range

      public static Range range(NumericExpr lo)
      Returns lo.., which Range.to(NumericExpr) and Range.below(NumericExpr) bound.
      Parameters:
      lo - the lower bound
      Returns:
      lo.., which Range.to(NumericExpr) and Range.below(NumericExpr) bound
      Throws:
      IllegalArgumentException - if the bound is a float
    • range

      public static Range range(long lo)
      Returns lo.., which Range.to(NumericExpr) and Range.below(NumericExpr) bound.
      Parameters:
      lo - the lower bound
      Returns:
      lo.., which Range.to(NumericExpr) and Range.below(NumericExpr) bound
    • atLeast

      public static IntType atLeast(NumericExpr lo)
      Returns lo.., the integers from lo up.
      Parameters:
      lo - the lower bound
      Returns:
      lo.., the integers from lo up
      Throws:
      IllegalArgumentException - if the bound is a float
    • atLeast

      public static IntType atLeast(long lo)
      Returns lo.., the integers from lo up.
      Parameters:
      lo - the lower bound
      Returns:
      lo.., the integers from lo up
    • atMost

      public static IntType atMost(NumericExpr hi)
      Returns ..hi, the integers up to hi.
      Parameters:
      hi - the upper bound
      Returns:
      ..hi, the integers up to hi
      Throws:
      IllegalArgumentException - if the bound is a float
    • atMost

      public static IntType atMost(long hi)
      Returns ..hi, the integers up to hi.
      Parameters:
      hi - the upper bound
      Returns:
      ..hi, the integers up to hi
    • below

      public static IntType below(NumericExpr hi)
      Returns ..<hi, the integers below hi.
      Parameters:
      hi - the upper bound
      Returns:
      ..<hi, the integers below hi
      Throws:
      IllegalArgumentException - if the bound is a float
    • below

      public static IntType below(long hi)
      Returns ..<hi, the integers below hi.
      Parameters:
      hi - the upper bound
      Returns:
      ..<hi, the integers below hi
    • pattern

      public static Pattern pattern(Object... parts)
      Returns a line pattern of text and parts.
      Parameters:
      parts - the parts: String text; a handle, which is {x} and reads a word; a Part such as capture(Field, Type); discard(), which is {_}; or another pattern
      Returns:
      a line pattern of text and parts
      Throws:
      IllegalArgumentException - for a part of another class
    • capture

      public static Part capture(Field<?> handle, Type<?> type)
      Returns {x:type}, which reads type into the entry of handle.
      Parameters:
      handle - the handle of the entry
      type - the type, without dimensions
      Returns:
      {x:type}, which reads type into the entry of handle
    • ref

      public static Part ref(Field<?> handle)
      Returns {$x}, which matches the current value of handle's entry.
      Parameters:
      handle - the handle of the entry
      Returns:
      {$x}, which matches the current value of handle's entry
    • validate

      public static Part validate(Type<?> type)
      Returns {:type}, which checks the text without storing it.
      Parameters:
      type - the type, without dimensions
      Returns:
      {:type}, which checks the text without storing it
    • blank

      public static Part blank()
      Returns {}, which matches a word without storing it.
      Returns:
      {}, which matches a word without storing it
    • discard

      public static Discard discard()
      Returns _: a target that reads without storing, and {_} in a pattern.
      Returns:
      _: a target that reads without storing, and {_} in a pattern
    • discard

      public static Part discard(Type<?> type)
      Returns {_:type}, a discarded capture with a type.
      Parameters:
      type - the type, without dimensions
      Returns:
      {_:type}, a discarded capture with a type
    • restOfLine

      public static Part restOfLine()
      Returns the trailing ... of a pattern.
      Returns:
      the trailing ... of a pattern
    • lit

      public static IntExpr lit(long value)
      Returns an integer literal.
      Parameters:
      value - the integer
      Returns:
      an integer literal
    • lit

      public static FloatExpr lit(double value)
      Returns a float literal.
      Parameters:
      value - the float
      Returns:
      a float literal
    • lit

      public static StringExpr lit(String value)
      Returns a string literal.
      Parameters:
      value - the string
      Returns:
      a string literal
    • sum

      public static IntExpr sum(Expr first, Expr... more)
      Returns sum(a, b, ...); of one array, the sum of its elements.
      Parameters:
      first - the first argument
      more - more arguments
      Returns:
      sum(a, b, ...); of one array, the sum of its elements
    • sum

      public static IntExpr sum(List<? extends Expr> arguments)
      Returns sum(a, b, ...).
      Parameters:
      arguments - the arguments, at least one
      Returns:
      sum(a, b, ...)
    • min

      public static IntExpr min(Expr first, Expr... more)
      Returns min(a, b, ...); of one array, its least element.
      Parameters:
      first - the first argument
      more - more arguments
      Returns:
      min(a, b, ...); of one array, its least element
    • min

      public static IntExpr min(List<? extends Expr> arguments)
      Returns min(a, b, ...).
      Parameters:
      arguments - the arguments, at least one
      Returns:
      min(a, b, ...)
    • max

      public static IntExpr max(Expr first, Expr... more)
      Returns max(a, b, ...); of one array, its greatest element.
      Parameters:
      first - the first argument
      more - more arguments
      Returns:
      max(a, b, ...); of one array, its greatest element
    • max

      public static IntExpr max(List<? extends Expr> arguments)
      Returns max(a, b, ...).
      Parameters:
      arguments - the arguments, at least one
      Returns:
      max(a, b, ...)
    • distinct

      public static IntExpr distinct(Expr first, Expr... more)
      Returns distinct(a, b, ...); of one array, whether its elements differ.
      Parameters:
      first - the first argument
      more - more arguments
      Returns:
      distinct(a, b, ...); of one array, whether its elements differ
    • distinct

      public static IntExpr distinct(List<? extends Expr> arguments)
      Returns distinct(a, b, ...).
      Parameters:
      arguments - the arguments, at least one
      Returns:
      distinct(a, b, ...)
    • sum

      public static <E> IntExpr sum(Domain<E> domain, Function<? super E, ? extends Expr> body)
      Returns sum(x in domain: body).
      Type Parameters:
      E - what the domain gives the body
      Parameters:
      domain - the domain
      body - a function of the comprehension variable
      Returns:
      sum(x in domain: body)
    • all

      public static <E> IntExpr all(Domain<E> domain, Function<? super E, ? extends Expr> body)
      Returns all(x in domain: body).
      Type Parameters:
      E - what the domain gives the body
      Parameters:
      domain - the domain
      body - a function of the comprehension variable
      Returns:
      all(x in domain: body)
    • any

      public static <E> IntExpr any(Domain<E> domain, Function<? super E, ? extends Expr> body)
      Returns any(x in domain: body).
      Type Parameters:
      E - what the domain gives the body
      Parameters:
      domain - the domain
      body - a function of the comprehension variable
      Returns:
      any(x in domain: body)
    • count

      public static <E> IntExpr count(Domain<E> domain, Function<? super E, ? extends Expr> body)
      Returns count(x in domain: body).
      Type Parameters:
      E - what the domain gives the body
      Parameters:
      domain - the domain
      body - a function of the comprehension variable
      Returns:
      count(x in domain: body)
    • count

      public static IntExpr count(Domain<?> domain)
      Returns count(domain).
      Parameters:
      domain - the domain
      Returns:
      count(domain)
    • size

      public static IntExpr size(Domain<?> domain)
      Returns size(domain).
      Parameters:
      domain - the domain
      Returns:
      size(domain)
    • defined

      public static IntExpr defined(Expr name)
      Returns defined(name).
      Parameters:
      name - a handle, a lookup or a comprehension variable
      Returns:
      defined(name)
    • defined

      public static IntExpr defined(RecordName record)
      Returns defined(records), of the record list of record.
      Parameters:
      record - the record name
      Returns:
      defined(records), of the record list of record
    • defined

      public static IntExpr defined(RecordList records)
      Returns defined(records).
      Parameters:
      records - the record list
      Returns:
      defined(records)
    • defined

      public static IntExpr defined(RecordExpr record)
      Returns defined(record).
      Parameters:
      record - the record
      Returns:
      defined(record)
    • over

      public static <E> Over<E> over(Domain<E> domain)
      Returns domain, whose comprehension variable Over.named(String) can name.
      Type Parameters:
      E - what the domain gives the body
      Parameters:
      domain - the domain
      Returns:
      domain, whose comprehension variable Over.named(String) can name