Interface CommonList

All Superinterfaces:
Cloneable, FeatureStructure
All Known Subinterfaces:
NonEmptyList
All Known Implementing Classes:
EmptyFloatList, EmptyFSList, EmptyIntegerList, EmptyStringList, FloatList, FSList, IntegerList, NonEmptyFloatList, NonEmptyFSList, NonEmptyIntegerList, NonEmptyStringList, StringList

public interface CommonList extends FeatureStructure
This class is the super class of list nodes (both empty and non empty)
  • Field Details

  • Method Details

    • getNthNode

      default CommonList getNthNode(int i)
      Get the nth node.
      Parameters:
      i - -
      Returns:
      the nth node, which may be an "empty" node
    • getNonEmptyNthNode

      default CommonList getNonEmptyNthNode(int i)
      Like GetNthNode, but throws exception if empty
      Parameters:
      i - -
      Returns:
      -
    • getLength

      default int getLength()
      length of a list, handling list loops. returns the number of unique nodes in the list
      Returns:
      the number of items in the list
    • walkList_saxException

      default void walkList_saxException(org.apache.uima.internal.util.function.Consumer_withSaxException<NonEmptyList> consumer, Runnable foundLoop) throws SAXException
      Walks a list, executing the consumer on each element. If a loop is found, the foundloop method is run.
      Parameters:
      consumer - a Consumer with Sax Exception
      foundLoop - run if a loop happens
      Throws:
      SAXException - -
    • walkList

      default void walkList(Consumer<NonEmptyList> consumer, Runnable foundLoop)
      Walks a list, executing the consumer on each element. If a loop is found, the foundloop method is run.
      Parameters:
      consumer - a Consumer (with no declared exceptions)
      foundLoop - run if a loop happens
    • createNonEmptyNode

      CommonList createNonEmptyNode()
      Creates a non empty node
      Returns:
      a new non empty node
    • emptyList

      CommonList emptyList()
      Returns:
      a shared instance of the empty node.
    • get_headAsString

      default String get_headAsString()
      Internal use overridden in nonempty nodes Return the head value of a list as a string suitable for serialization. For FeatureStructure values, return the _id.
      Returns:
      value suitable for serialization
    • set_headFromString

      default void set_headFromString(String v)
      Internal use overridden in nonempty nodes used when deserializing
      Parameters:
      v - value to set, as a string
    • insertNode

      default CommonList insertNode()
      insert a new nonempty node following this node
      Returns:
      the new node
    • pushNode

      default CommonList pushNode()
      Creates a new node and pushes it onto the front of the existing node
      Returns:
      the new node
    • getCommonTail

      default CommonList getCommonTail()
      default impl for empty and nonempty lists
      Returns:
      - instance of CommonList This has to be named differently from getTail, otherwise the "default" method in the interface appears as declared method in reflection named getTail which conflicts with the one returning a specific typed value
    • setTail

      default void setTail(CommonList v)
      sets the tail of this node
      Parameters:
      v - the tail
    • anyListToOutput

      default void anyListToOutput(XmiSerializationSharedData sharedData, CasSerializerSupport.CasDocSerializer cds, Consumer<String> out)
      Internal Use. List to String for XMI and JSON serialization, for the special format where all the list elements are in one serialized item Go thru a list, calling the ListOutput append method to append strings (to arrays, or string buffers) Stop at the end node, or a null, or a loop (no error reported here)
      Parameters:
      sharedData - -
      cds - -
      out - - a Consumer of strings
    • anyListToStringList

      default List<String> anyListToStringList(XmiSerializationSharedData sharedData, CasSerializerSupport.CasDocSerializer cds)
      Internal use
      Parameters:
      sharedData - -
      cds - -
      Returns:
      -
    • isEmpty

      default boolean isEmpty()
      Returns:
      true if this object represents an empty list