public class ListPattern extends Pattern implements java.lang.Iterable<PrimitivePattern>
Constructor and Description |
---|
ListPattern() |
ListPattern(Modality modality) |
Modifier and Type | Method and Description |
---|---|
void |
add(PrimitivePattern pattern)
Used in constructing instances by
Pattern class. |
ListPattern |
append(ListPattern pattern)
Return a new ListPattern formed from the contents of this list pattern and the
contents of the given pattern appended to it.
|
ListPattern |
append(PrimitivePattern pattern)
Return a new ListPattern formed from the contents of this list pattern and
the given PrimitivePattern appended to it.
|
ListPattern |
clone()
Construct a copy of this pattern, so that it can be modified
without affecting the original.
|
boolean |
contains(PrimitivePattern given) |
boolean |
equals(ListPattern pattern)
Two patterns are equal if they contain the same items.
|
ListPattern |
getFirstItem()
Construct a new pattern containing just the first item in this one.
|
PrimitivePattern |
getItem(int index)
Retrieve the indexed item from the list pattern.
|
Modality |
getModality()
Accessor to retrieve the modality of the pattern.
|
java.lang.String |
getModalityString()
Convert the modality into a string.
|
boolean |
isAction()
Accessor method to check action modality.
|
boolean |
isEmpty()
Check if the list pattern is empty, holding no patterns.
|
boolean |
isFinished()
Accessor method to _finished property.
|
static boolean |
isSameModality(ListPattern pattern1,
ListPattern pattern2)
Class level method to check if two patterns have the same modality.
|
boolean |
isSimilarTo(ListPattern pattern,
int k)
Compare this list pattern with a given list pattern, returning true if
the two share k or more items.
|
boolean |
isVerbal()
Accessor method to check verbal modality.
|
boolean |
isVisual()
Accessor method to check visual modality.
|
java.util.Iterator<PrimitivePattern> |
iterator()
Support iteration over the items of a list pattern.
|
boolean |
matches(Pattern givenPattern)
Two patterns match if they are both ListPatterns and this ListPattern
is a presequence of given pattern.
|
ListPattern |
remove(ListPattern pattern)
Return a new ListPattern forming the parts of this pattern without
the matching elements of the given pattern.
|
void |
setFinished()
Set the _finished property to true.
|
void |
setModality(Modality modality)
Mutator to change modality of pattern.
|
void |
setNotFinished()
Set the _finished property to false.
|
int |
size()
Return the number of patterns held inside the list pattern.
|
ListPattern |
sort(java.util.Comparator<PrimitivePattern> comparator)
Return a new list pattern with the items sorted using the given comparator.
|
java.lang.String |
toString()
Render the list pattern as a string.
|
makeActionList, makeNumber, makeString, makeVerbalList, makeVerbalList, makeVisualList, makeVisualList
public ListPattern()
public ListPattern(Modality modality)
public void add(PrimitivePattern pattern)
Pattern
class.
Add pattern to list, unless the pattern is 'finished'.public ListPattern clone()
clone
in class java.lang.Object
public int size()
public boolean isEmpty()
public PrimitivePattern getItem(int index)
public boolean isFinished()
public static boolean isSameModality(ListPattern pattern1, ListPattern pattern2)
public Modality getModality()
public void setModality(Modality modality)
public boolean isVisual()
public boolean isVerbal()
public boolean isAction()
public java.lang.String getModalityString()
public void setFinished()
public void setNotFinished()
public boolean equals(ListPattern pattern)
public boolean matches(Pattern givenPattern)
public ListPattern remove(ListPattern pattern)
public ListPattern append(ListPattern pattern)
public ListPattern append(PrimitivePattern pattern)
public ListPattern getFirstItem()
public java.lang.String toString()
public boolean contains(PrimitivePattern given)
public boolean isSimilarTo(ListPattern pattern, int k)
public ListPattern sort(java.util.Comparator<PrimitivePattern> comparator)
public java.util.Iterator<PrimitivePattern> iterator()
iterator
in interface java.lang.Iterable<PrimitivePattern>