Interface CommonList

    • Field Detail

      • EMPTY_LIST_STRING

        static final java.util.List<java.lang.String> EMPTY_LIST_STRING
    • Method Detail

      • 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​(Consumer_withSaxException<NonEmptyList> consumer,
                                           java.lang.Runnable foundLoop)
                                    throws org.xml.sax.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:
        org.xml.sax.SAXException - -
      • walkList

        default void walkList​(java.util.function.Consumer<NonEmptyList> consumer,
                              java.lang.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 java.lang.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​(java.lang.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,
                                     java.util.function.Consumer<java.lang.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
      • isEmpty

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