Class Field

All Implemented Interfaces:
Comparable<Item>, Iterable<Item>, Map.Entry<Value,Value>, Debug, Display
Direct Known Subclasses:
Attr, Slot

public abstract class Field extends Item implements Map.Entry<Value,Value>
  • Method Details

    • isDefined

      public final boolean isDefined()
      Always returns true because a Field can never be Absent.
      Specified by:
      isDefined in class Item
    • isDistinct

      public final boolean isDistinct()
      Always returns true because a Field can be neither Extant nor Absent.
      Specified by:
      isDistinct in class Item
    • isDefinite

      public boolean isDefinite()
      Always returns true because a Field cannot be one of: an empty Record, False, Extant, or Absent.
      Specified by:
      isDefinite in class Item
    • key

      public abstract Value key()
      Returns the key component of this Field.
      Specified by:
      key in class Item
    • getKey

      public Value getKey()
      Returns the key component of this Field. Equivalent to key().
      Specified by:
      getKey in interface Map.Entry<Value,Value>
    • value

      public abstract Value value()
      Returns the value component of this Field.
    • getValue

      public Value getValue()
      Returns the value component of this Field. Equivalent to value().
      Specified by:
      getValue in interface Map.Entry<Value,Value>
    • setValue

      public abstract Value setValue(Value value)
      Sets the value of this Field to the new value, returning the old value.
      Specified by:
      setValue in interface Map.Entry<Value,Value>
      Throws:
      UnsupportedOperationException - if this Field is immutable.
    • updatedValue

      public abstract Field updatedValue(Value value)
      Returns a copy of this Field with the updated value.
    • toValue

      public Value toValue()
      Returns the value component of this Field. Equivalent to value().
      Specified by:
      toValue in class Item
    • tag

      public final String tag()
      Always returns null because a Field can't be a Record, so it can't have a first member Attr whose key string could be returned.
      Specified by:
      tag in class Item
    • target

      public final Value target()
      Always returns the value component of this Field.
      Specified by:
      target in class Item
    • flattened

      public final Value flattened()
      Always returns Absent because a Field can't be flattened into a Value.
      Specified by:
      flattened in class Item
    • unflattened

      public final Record unflattened()
      Returns a Record containing just this Field.
      Specified by:
      unflattened in class Item
    • header

      public final Value header(String tag)
      Always returns Absent because a Field can't be a Record, so it can't have a head Attr whose value could be returned if its key were equal to the tag.
      Specified by:
      header in class Item
    • headers

      public final Record headers(String tag)
      Always returns null because a Field can't be a Record, so it can't have a head Attr whose value could be returned as a Record if its key is equal to the tag.
      Specified by:
      headers in class Item
    • head

      public final Item head()
      Always returns Absent because a Field can't be a Record, so it can't have a first member.
      Specified by:
      head in class Item
    • tail

      public final Record tail()
      Always returns an empty Record because a Field can't itself be a Record, so it can't have any non-first members.
      Specified by:
      tail in class Item
    • body

      public final Value body()
      Always returns Absent because a Field can't be a Record, so it can't have any non-first members to flatten, and because a Field isn't a distinct Value, so it can't return Extant.
      Specified by:
      body in class Item
    • length

      public final int length()
      Always returns 0 because a Field can't be a Record, so it can't contain any members.
      Specified by:
      length in class Item
    • contains

      public final boolean contains(Item item)
      Always returns false because a Field can't be a Record, so it can't have a member equal to item.
      Specified by:
      contains in class Item
    • containsKey

      public final boolean containsKey(Value key)
      Always returns false because a Field can't be a Record, so it can't have a Field member whose key is equal to the given key.
      Specified by:
      containsKey in class Item
    • containsKey

      public final boolean containsKey(String key)
      Always returns false because a Field can't be a Record, so it can't have a Field member whose key string is equal to the given key.
      Specified by:
      containsKey in class Item
    • containsValue

      public final boolean containsValue(Value value)
      Always returns false because a Field can't be a Record, so it can't have a Field member whose value is equal to the given value.
      Specified by:
      containsValue in class Item
    • get

      public final Value get(Value key)
      Always returns Absent because a Field can't be a Record, so it can't have a Field member whose key is equal to the given key.
      Specified by:
      get in class Item
    • get

      public final Value get(String key)
      Always returns Absent because a Field can't be a Record, so it can't have a Field member whose key string is equal to the given key.
      Specified by:
      get in class Item
    • getAttr

      public final Value getAttr(Text key)
      Always returns Absent because a Field can't be a Record, so it can't have an Attr member whose key is equal to the given key.
      Specified by:
      getAttr in class Item
    • getAttr

      public final Value getAttr(String key)
      Always returns Absent because a Field can't be a Record, so it can't have an Attr member whose key string is equal to the given key.
      Specified by:
      getAttr in class Item
    • getSlot

      public final Value getSlot(Value key)
      Always returns Absent because a Field can't be a Record, so it can't have a Slot member whose key is equal to the given key.
      Specified by:
      getSlot in class Item
    • getSlot

      public final Value getSlot(String key)
      Always returns Absent because a Field can't be a Record, so it can't have a Slot member whose key string is equal to the given key.
      Specified by:
      getSlot in class Item
    • getField

      public final Field getField(Value key)
      Always returns null because a Field can't be a Record, so it can't have a Field member whose key is equal to the given key.
      Specified by:
      getField in class Item
    • getField

      public final Field getField(String key)
      Always returns null because a Field can't be a Record, so it can't have a Field member whose key string is equal to the given key.
      Specified by:
      getField in class Item
    • getItem

      public final Item getItem(int index)
      Always returns Absent because a Field can't be a Record, so it can't have a member at the given index.
      Specified by:
      getItem in class Item
    • removed

      public Field removed(Value key)
      Specified by:
      removed in class Item
    • removed

      public Field removed(String key)
      Specified by:
      removed in class Item
    • conditional

      public Item conditional(Item thenTerm, Item elseTerm)
      Specified by:
      conditional in class Item
    • conditional

      public Field conditional(Field thenTerm, Field elseTerm)
    • or

      public Item or(Item that)
      Specified by:
      or in class Item
    • or

      public Field or(Field that)
    • and

      public Item and(Item that)
      Specified by:
      and in class Item
    • and

      public Field and(Field that)
    • lambda

      public Value lambda(Value template)
      Specified by:
      lambda in class Item
    • stringValue

      public final String stringValue()
      Converts the value of this Field into a String value, if possible.
      Specified by:
      stringValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a String value.
    • stringValue

      public final String stringValue(String orElse)
      Converts the value of this Field into a String value, if possible; otherwise returns orElse if the value of this Field can't be converted into a string value.
      Specified by:
      stringValue in class Item
    • byteValue

      public final byte byteValue()
      Converts the value of this Field into a primitive byte value, if possible.
      Specified by:
      byteValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive byte value.
    • byteValue

      public final byte byteValue(byte orElse)
      Converts the value of this Field into a primitive byte value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive byte value.
      Specified by:
      byteValue in class Item
    • shortValue

      public final short shortValue()
      Converts the value of this Field into a primitive short value, if possible.
      Specified by:
      shortValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive short value.
    • shortValue

      public final short shortValue(short orElse)
      Converts the value of this Field into a primitive short value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive short value.
      Specified by:
      shortValue in class Item
    • intValue

      public final int intValue()
      Converts the value of this Field into a primitive int value, if possible.
      Specified by:
      intValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive int value.
    • intValue

      public final int intValue(int orElse)
      Converts the value of this Field into a primitive int value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive int value.
      Specified by:
      intValue in class Item
    • longValue

      public final long longValue()
      Converts the value of this Field into a primitive long value, if possible.
      Specified by:
      longValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive long value.
    • longValue

      public final long longValue(long orElse)
      Converts the value of this Field into a primitive long value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive long value.
      Specified by:
      longValue in class Item
    • floatValue

      public final float floatValue()
      Converts the value of this Field into a primitive float value, if possible.
      Specified by:
      floatValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive float value.
    • floatValue

      public final float floatValue(float orElse)
      Converts the value of this Field into a primitive float value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive float value.
      Specified by:
      floatValue in class Item
    • doubleValue

      public final double doubleValue()
      Converts the value of this Field into a primitive double value, if possible.
      Specified by:
      doubleValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive double value.
    • doubleValue

      public final double doubleValue(double orElse)
      Converts the value of this Field into a primitive double value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive double value.
      Specified by:
      doubleValue in class Item
    • integerValue

      public final BigInteger integerValue()
      Converts the value of this Field into a BigInteger value, if possible.
      Specified by:
      integerValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a BigInteger value.
    • integerValue

      public final BigInteger integerValue(BigInteger orElse)
      Converts the value of this Field into a BigInteger value, if possible; otherwise returns orElse if the value of this Field can't be converted into a BigInteger value.
      Specified by:
      integerValue in class Item
    • numberValue

      public final Number numberValue()
      Converts the value of this Field into a Number object, if possible.
      Specified by:
      numberValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a Number object.
    • numberValue

      public final Number numberValue(Number orElse)
      Converts the value of this Field into a Number object, if possible; otherwise returns orElse if the value of this Field can't be converted into a Number object.
      Specified by:
      numberValue in class Item
    • charValue

      public final char charValue()
      Converts the value of this Field into a primitive char value, if possible.
      Specified by:
      charValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive char value.
    • charValue

      public final char charValue(char orElse)
      Converts the value of this Field into a primitive char value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive char value.
      Specified by:
      charValue in class Item
    • booleanValue

      public final boolean booleanValue()
      Converts the value of this Field into a primitive boolean value, if possible.
      Specified by:
      booleanValue in class Item
      Throws:
      UnsupportedOperationException - if the value of this Field can't be converted into a primitive boolean value.
    • booleanValue

      public final boolean booleanValue(boolean orElse)
      Converts the value of this Field into a primitive boolean value, if possible; otherwise returns orElse if the value of this Field can't be converted into a primitive boolean value.
      Specified by:
      booleanValue in class Item
    • branch

      public abstract Field branch()
      Specified by:
      branch in class Item
    • commit

      public abstract Field commit()
      Description copied from class: Item
      Flags this Item as immutable, recursively if it is a Record, then returns this Item.
      Specified by:
      commit in class Item
    • of

      public static Field of(Object object)