javax.swing.text.html.parser
Class ContentModel
- Serializable
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)
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.
|
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 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.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
content
public Object content
The document content, containing either Element or the enclosed
content model (that would be in the parentheses in BNF expression).
next
public ContentModel next
The next content model model ( = pointer to the next element of
the linked list) for the binary expression (',','&' or '|'). Null
for the last element in the list.
type
public 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.
ContentModel
public ContentModel()
Create a content model initializing all fields to default values.
ContentModel
public ContentModel(int a_type,
Object a_content,
ContentModel a_next)
Create a content model, involving binary expression of the given type.
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.
ContentModel
public ContentModel(int a_type,
ContentModel a_content)
Create a content model, involving expression of the given type.
a_type
- The expression operation type ('*','?' or '+'a_content
- The content for that the expression is applied.
ContentModel
public ContentModel(Element a_content)
Create a content model, consisting of the single element.
Examples:
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
empty
public boolean empty()
Checks if the content model matches an empty input stream.
The empty content is created using SGML DTD keyword EMPTY.
The empty model is a model with the content field equal to null.
- true if the content field is equal to null.
first
public Element first()
Get the element, stored in the next.content
.
The method is programmed as the part of the standard API, but not
used in this implementation.
- the value of the field
next
.
first
public boolean first(Object token)
Checks if this object can potentially be the first token in the
ContenModel list. The method is programmed as the part of the
standard API, but not used in this implementation.
getElements
public void getElements(Vector elements)
Adds all list elements to the given vector, ignoring the
operations between the elements. The old vector values are not
discarded.
elements
- - a vector to add the values to.
toString
public String toString()
Returns a string representation (an expression) of this content model.
The expression has BNF-like syntax, except the absence of the
unary operator is additionally indicated by " ' ". It is
advisable to check the created models for correctness using this
method.
- toString in interface Object
ContentModel.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.