gnu.javax.swing.text.html.parser.models

Class list

Implemented Interfaces:
Serializable

public class list
extends node
implements Serializable

Part of the internal representation of the content model.
See Also:
Serialized Form

Field Summary

static boolean
CLEAR
Setting to true means that the list nodes must always be connected by the same operation.
node[]
nodes
A list of nodes.

Fields inherited from class gnu.javax.swing.text.html.parser.models.node

_closed, binary, previous, token, unary, visits

Constructor Summary

list(char binary_operator, char unary_operator, node[] a_nodes)
Creates a new model list that is a member of some enclosing list.
list(node[] a_nodes)
Creates a new model list.

Method Summary

protected void
close()
Closes all members in the list.
protected boolean
compare(Object a_token)
Compare given token with the token of this node.
Object
findFreeNode()
Find the token that could match as the next token in the token list.
boolean
isClosed()
Returns true if all members in the list are closed.
boolean
matches(Object[] tokens)
Tries to match this list agains the given token sequence.
boolean
mustClose()
The list never closes, despite it is trated as closed if all members in the list are closed.
boolean
performMatch(Object token)
Perform a match operation for the single token against this list.
void
reset()
Prepeares the list for the next matching operation.
Object
show(Object x)
Check if the provided token can match as a next token in the list.
String
toString()
Returns a string representation of the list.
boolean
valid()
Returns true if all memebers in the list are valid.
boolean
validPreliminary()
Returns true if all memebers in the list are either valid or unvisited.

Methods inherited from class gnu.javax.swing.text.html.parser.models.node

close, closePrevious, compare, findFreeNode, isClosed, matches, mustClose, performMatch, reset, show, silenceAllowed, toString, valid, validPreliminary

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

CLEAR

public static boolean CLEAR
Setting to true means that the list nodes must always be connected by the same operation. This is far safer and clearer, but not required by default standard.

nodes

public final node[] nodes
A list of nodes.

Constructor Details

list

public list(char binary_operator,
            char unary_operator,
            node[] a_nodes)
Creates a new model list that is a member of some enclosing list.
Parameters:
binary_operator - An operator with that this list is connected with other members of the enclosing list.
unary_operator - The unary operator for this list.
a_nodes - The nodes inside this list.

list

public list(node[] a_nodes)
            throws Error
Creates a new model list. Assigns the previous field.
Parameters:
a_nodes - The nodes for this list.

Method Details

close

protected void close()
Closes all members in the list.
Overrides:
close in interface node

compare

protected boolean compare(Object a_token)
Compare given token with the token of this node. If the token represents a list, the call may be delegeted to the child subnodes.
Overrides:
compare in interface node
Parameters:
a_token - A token to compare.
Returns:
True if the token matches the token of this node.

findFreeNode

public Object findFreeNode()
Find the token that could match as the next token in the token list.
Overrides:
findFreeNode in interface node
Returns:
Such token object or null if none is found.

isClosed

public boolean isClosed()
Returns true if all members in the list are closed.
Overrides:
isClosed in interface node

matches

public boolean matches(Object[] tokens)
Tries to match this list agains the given token sequence.
Parameters:
tokens - the sequence of the tokens to match.
Returns:
true if the valid match is found.

mustClose

public boolean mustClose()
The list never closes, despite it is trated as closed if all members in the list are closed.
Overrides:
mustClose in interface node
Returns:
false.

performMatch

public boolean performMatch(Object token)
Perform a match operation for the single token against this list.
Overrides:
performMatch in interface node
Parameters:
token - a token to match.
Returns:
true if the match is found.

reset

public void reset()
Prepeares the list for the next matching operation.
Overrides:
reset in interface node

show

public Object show(Object x)
Check if the provided token can match as a next token in the list. In the case of match, the list state changes, moving current position after the matched token. However if this method returns a suggested new token to insert before the provided one, the state of the list does not change.
Overrides:
show in interface node
Returns:
Boolean.TRUE if the match is found, Boolean.FALSE if the match is not possible and no token can be inserted to make the match valid. Otherwise, returns the token object that can be inserted before the last token in the list, probably (not for sure) making the match valid. If the object is an instance of Element or TagElement, it is first ensured that the object flag "omit start" is set.

toString

public String toString()
Returns a string representation of the list.
Overrides:
toString in interface node
Returns:
String representation, similar to BNF expression.

valid

public boolean valid()
Returns true if all memebers in the list are valid.
Overrides:
valid in interface node

validPreliminary

public boolean validPreliminary()
Returns true if all memebers in the list are either valid or unvisited. The unvisited members can become valid after more tokens will be shown.
Overrides:
validPreliminary in interface node

list.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.