public final class ContentModel extends Object implements Serializable
a = new ContentModel('+', A, null); // a reprensents A+ b = new ContentModel('&', B, a); // b represents B & A+ c = new ContentModel('*', b, null); // c represents ( B & A+) * d = new ContentModel('|', new ContentModel('*', A, null), new ContentModel('?', B, null)); // d represents ( A* | B? )where the valid operations are:
E*
E occurs zero or more timesE+
E occurs one or more timesE?
E occurs once or not atl allA,B
A occurs before BA|B
both A and B are permitted in any order.
The '|' alone does not permit the repetetive occurence of A or B
(use (A|B)*
.A&B
both A and B must occur once (in any order)Modifier and Type | Field and Description |
---|---|
Object |
content
The document content, containing either Element or the enclosed
content model (that would be in the parentheses in BNF expression).
|
ContentModel |
next
The next content model model ( = pointer to the next element of
the linked list) for the binary expression (',','&' or '|').
|
int |
type
Specifies the BNF operation between this node and the node,
stored in the field
next (or for this node, if it is
an unary operation. |
Constructor and Description |
---|
ContentModel()
Create a content model initializing all fields to default values.
|
ContentModel(Element a_content)
Create a content model, consisting of the single element.
|
ContentModel(int a_type,
ContentModel a_content)
Create a content model, involving expression of the given type.
|
ContentModel(int a_type,
Object a_content,
ContentModel a_next)
Create a content model, involving binary expression of the given type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
empty()
Checks if the content model matches an empty input stream.
|
Element |
first()
Get the element, stored in the
next.content . |
boolean |
first(Object token)
Checks if this object can potentially be the first token in the
ContenModel list.
|
void |
getElements(Vector<Element> elements)
Adds all list elements to the given vector, ignoring the
operations between the elements.
|
String |
toString()
Returns a string representation (an expression) of this content model.
|
public ContentModel next
public Object content
public int type
next
(or for this node, if it is
an unary operation.public ContentModel()
public ContentModel(Element a_content)
a = new ContentModel('+', A, null); // a reprensents A+
b = new ContentModel('&', B, a); // b represents B & A+
c = new ContentModel('*', b, null); // c represents ( B & A+) *
d = new ContentModel('|', A,
new ContentModel('?',b, null);
// d represents
public ContentModel(int a_type, ContentModel a_content)
a_type
- The expression operation type ('*','?' or '+'a_content
- The content for that the expression is applied.public ContentModel(int a_type, Object a_content, ContentModel a_next)
a_type
- The expression operation type ( ',', '|' or '&').a_content
- The content of the left part of the expression.a_next
- The content model, representing the right part of the
expression.public void getElements(Vector<Element> elements)
elements
- - a vector to add the values to.public boolean empty()
public Element first()
next.content
.
The method is programmed as the part of the standard API, but not
used in this implementation.next
.public boolean first(Object token)
public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)