javax.swing.text.html.parser
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)Field Summary | |
---|---|
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 Summary | |
---|---|
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. |
Method Summary | |
---|---|
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.
|
next
(or for this node, if it is
an unary operation.
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
Parameters: a_type The expression operation type ('*','?' or '+' a_content The content for that the expression is applied.
Parameters: 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.
Returns: true if the content field is equal to null.
next.content
.
The method is programmed as the part of the standard API, but not
used in this implementation.Returns: the value of the field next
.
Parameters: elements - a vector to add the values to.