|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.text.html.parser.ContentModel
public final class ContentModel
A representation of the element content. The instances of this class can be arranged into the linked list, representing a BNF expression. The content model is constructed as a branched tree structure in the following way:
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public ContentModel next
public Object content
public int type
next (or for this node, if it is
an unary operation.
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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 ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||