Skip to content

Class Data

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.Data
public final class Data extends Object
The entries that a read or a catalog produced, in definition order (§3.1).
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    An entry.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the entries, in definition order.
    @Nullable Value
    find(String name)
    Finds an entry.
    <V extends @Nullable Object>
    V
    get(Field<V> field)
    Gets an entry through its handle, as the Java type that the handle promises: long for an IntField<Long>, List<long[]> for an IntField<List<long[]>>, and null for an absent entry of an optional handle.
    get(String name)
    Gets an entry.
    Returns the dzn document (appendix B), which is empty for data without entries.
    Returns the canonical data document (§3.3), with its final newline.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • entries

      public List<Data.Entry> entries()
      Returns the entries, in definition order.
      Returns:
      the entries, in definition order
    • find

      public @Nullable Value find(String name)
      Finds an entry.
      Parameters:
      name - the name of the entry
      Returns:
      its value, or null if there is none
    • get

      public Value get(String name)
      Gets an entry.
      Parameters:
      name - the name of the entry
      Returns:
      its value
      Throws:
      IllegalStateException - if there is no such entry
    • get

      public <V extends @Nullable Object> V get(Field<V> field)
      Gets an entry through its handle, as the Java type that the handle promises: long for an IntField<Long>, List<long[]> for an IntField<List<long[]>>, and null for an absent entry of an optional handle.
      Type Parameters:
      V - the type of the entry's value
      Parameters:
      field - the handle of the entry
      Returns:
      its value
      Throws:
      IllegalStateException - if the entry is missing, or has another type or depth than the handle promises
    • toJson

      public String toJson()
      Returns the canonical data document (§3.3), with its final newline.
      Returns:
      the canonical data document (§3.3), with its final newline
    • toDzn

      public String toDzn()
      Returns the dzn document (appendix B), which is empty for data without entries.
      Returns:
      the dzn document (appendix B), which is empty for data without entries