Package org.apache.uima.jcas.cas
Interface CommonList
-
- All Superinterfaces:
java.lang.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 Summary
Fields Modifier and Type Field Description static java.lang.String
_FeatName_head
static java.lang.String
_FeatName_tail
static java.util.List<java.lang.String>
EMPTY_LIST_STRING
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
anyListToOutput(XmiSerializationSharedData sharedData, CasSerializerSupport.CasDocSerializer cds, java.util.function.Consumer<java.lang.String> out)
Internal Use.default java.util.List<java.lang.String>
anyListToStringList(XmiSerializationSharedData sharedData, CasSerializerSupport.CasDocSerializer cds)
Internal useCommonList
createNonEmptyNode()
Creates a non empty nodeCommonList
emptyList()
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.default CommonList
getCommonTail()
default impl for empty and nonempty listsdefault int
getLength()
length of a list, handling list loops.default CommonList
getNonEmptyNthNode(int i)
Like GetNthNode, but throws exception if emptydefault CommonList
getNthNode(int i)
Get the nth node.default CommonList
insertNode()
insert a new nonempty node following this nodedefault boolean
isEmpty()
default CommonList
pushNode()
Creates a new node and pushes it onto the front of the existing nodedefault void
set_headFromString(java.lang.String v)
Internal use overridden in nonempty nodes used when deserializingdefault void
setTail(CommonList v)
sets the tail of this nodedefault void
walkList(java.util.function.Consumer<NonEmptyList> consumer, java.lang.Runnable foundLoop)
Walks a list, executing the consumer on each element.default void
walkList_saxException(Consumer_withSaxException<NonEmptyList> consumer, java.lang.Runnable foundLoop)
Walks a list, executing the consumer on each element.-
Methods inherited from interface org.apache.uima.cas.FeatureStructure
_getTypeCode, _id, clone, equals, getAddress, getBooleanValue, getByteValue, getCAS, getDoubleValue, getFeatureValue, getFeatureValueAsString, getFloatValue, getIntValue, getJCas, getLongValue, getShortValue, getStringValue, getType, hashCode, setBooleanValue, setByteValue, setDoubleValue, setFeatureValue, setFeatureValueFromString, setFloatValue, setIntValue, setLongValue, setShortValue, setStringValue
-
-
-
-
Field Detail
-
_FeatName_head
static final java.lang.String _FeatName_head
- See Also:
- Constant Field Values
-
_FeatName_tail
static final java.lang.String _FeatName_tail
- See Also:
- Constant Field Values
-
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 ExceptionfoundLoop
- 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
-
anyListToStringList
default java.util.List<java.lang.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
-
-