public class ListElement extends NLGElement
ListElement is used to define elements that can be grouped
together and treated in a similar manner. The list element itself adds no
additional meaning to the realisation. For example, the syntax processor
takes a phrase element and produces a list element containing inflected word
elements. Phrase elements only have meaning within the syntax processing
while the morphology processor (the next in the sequence) needs to work with
inflected words. Using the list element helps to keep the inflected word
elements together.
There is no sorting within the list element and components are added in the order they are given.
features| Constructor and Description |
|---|
ListElement()
Creates a new list element with no components.
|
ListElement(List<NLGElement> components)
Creates a new list element containing the given components.
|
ListElement(NLGElement newComponent)
Creates a new list element containing the given component.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addComponent(NLGElement newComponent)
Adds the given component to the list element.
|
void |
addComponents(List<NLGElement> newComponents)
Adds the given components to the list element.
|
List<NLGElement> |
getChildren()
Retrieves the children for this element.
|
NLGElement |
getFirst()
Retrieves the first component in the list.
|
String |
printTree(String indent) |
void |
setComponents(List<NLGElement> newComponents)
Replaces the current components in the list element with the given list.
|
int |
size()
Retrieves the number of components in this list element.
|
String |
toString() |
clearAllFeatures, equals, equals, getAllFeatureNames, getAllFeatures, getCategory, getFactory, getFeature, getFeatureAsBoolean, getFeatureAsDouble, getFeatureAsElement, getFeatureAsElementList, getFeatureAsFloat, getFeatureAsInteger, getFeatureAsList, getFeatureAsLong, getFeatureAsString, getFeatureAsStringList, getParent, getRealisation, getTense, hasFeature, isA, isNegated, isPlural, removeFeature, setCategory, setFactory, setFeature, setFeature, setFeature, setFeature, setFeature, setFeature, setNegated, setParent, setPlural, setRealisation, setTensepublic ListElement()
public ListElement(List<NLGElement> components)
components - the initial components for this list element.public ListElement(NLGElement newComponent)
newComponent - the initial component for this list element.public List<NLGElement> getChildren()
NLGElementgetChildren in class NLGElementList of NLGElements representing the
children of this element.public void addComponent(NLGElement newComponent)
newComponent - the NLGElement component to be added.public void addComponents(List<NLGElement> newComponents)
newComponents - a List of NLGElements to be added.public void setComponents(List<NLGElement> newComponents)
newComponents - a List of NLGElements to be used as
the components.public String toString()
toString in class NLGElementpublic String printTree(String indent)
printTree in class NLGElementpublic int size()
public NLGElement getFirst()
NLGElement at the top of the list.Copyright © 2020. All Rights Reserved.