summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/javax/swing/text/html/parser/models
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-16 01:27:14 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-16 01:27:14 +0000
commita63c2657c94913d72b3cd388730d61edcb09fc69 (patch)
tree8762d1f992e2f725a6bde1ff966ed6f1e5f4f823 /libjava/gnu/javax/swing/text/html/parser/models
parent6484dceb0094998183c2f8d3c8c27c6f4e53b8a9 (diff)
downloadppe42-gcc-a63c2657c94913d72b3cd388730d61edcb09fc69.tar.gz
ppe42-gcc-a63c2657c94913d72b3cd388730d61edcb09fc69.zip
Major merge with Classpath.
Removed many duplicate files. * HACKING: Updated.x * classpath: Imported new directory. * standard.omit: New file. * Makefile.in, aclocal.m4, configure: Rebuilt. * sources.am: New file. * configure.ac: Run Classpath configure script. Moved code around to support. Disable xlib AWT peers (temporarily). * Makefile.am (SUBDIRS): Added 'classpath' (JAVAC): Removed. (AM_CPPFLAGS): Added more -I options. (BOOTCLASSPATH): Simplified. Completely redid how sources are built. Include sources.am. * include/Makefile.am (tool_include__HEADERS): Removed jni.h. * include/jni.h: Removed (in Classpath). * scripts/classes.pl: Updated to look at built classes. * scripts/makemake.tcl: New file. * testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Added -I options. (gcj_jni_invocation_compile_c_to_binary): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102082 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/javax/swing/text/html/parser/models')
-rwxr-xr-xlibjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java62
-rwxr-xr-xlibjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java77
-rwxr-xr-xlibjava/gnu/javax/swing/text/html/parser/models/list.java382
-rwxr-xr-xlibjava/gnu/javax/swing/text/html/parser/models/noTagModel.java75
-rwxr-xr-xlibjava/gnu/javax/swing/text/html/parser/models/node.java337
-rwxr-xr-xlibjava/gnu/javax/swing/text/html/parser/models/transformer.java201
6 files changed, 0 insertions, 1134 deletions
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java b/libjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java
deleted file mode 100755
index 5a19a1bc13c..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* PCDATAonly_model.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. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * The model, allowing only PCDATA in it (like for element OPTION).
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class PCDATAonly_model
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
-
- public PCDATAonly_model()
- {
- super((char) 0, (char) 0, null);
- }
-
- public Object show(Object x)
- {
- return x.toString().equalsIgnoreCase("#pcdata") ? Boolean.TRUE : Boolean.FALSE;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java b/libjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java
deleted file mode 100755
index 14514d58458..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* TableRowContentModel.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. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-import javax.swing.text.html.parser.DTD;
-import javax.swing.text.html.parser.Element;
-
-/**
- * Table row content model.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class TableRowContentModel
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
- final Element TD;
-
- public TableRowContentModel(DTD dtd)
- {
- super((char) 0, (char) 0, null);
- TD = dtd.getElement("TD");
- }
-
- public Object show(Object x)
- {
- // Always accept TD and TH
- String s = x.toString();
- if (s.equalsIgnoreCase("TD") || s.equalsIgnoreCase("TH"))
- return Boolean.TRUE;
-
- // Suggest closing in response to TR:
- if (s.equalsIgnoreCase("TR"))
- return Boolean.FALSE;
-
- // Recommend TD for other cases:
- return TD;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/list.java b/libjava/gnu/javax/swing/text/html/parser/models/list.java
deleted file mode 100755
index b77ef7fd850..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/list.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/* 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. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * Part of the internal representation of the content model.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class list
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
-
- /**
- * 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.
- */
- public static boolean CLEAR;
-
- /**
- * A list of nodes.
- */
- public final node[] nodes;
-
- /**
- * Creates a new model list that is a member of some enclosing list.
- * @param binary_operator An operator with that this list is connected
- * with other members of the enclosing list.
- * @param unary_operator The unary operator for this list.
- * @param a_nodes The nodes inside this list.
- */
- public list(char binary_operator, char unary_operator, node[] a_nodes)
- {
- super(binary_operator, unary_operator, a_nodes);
- nodes = a_nodes;
- }
-
- /**
- * Creates a new model list. Assigns the previous field.
- * @param a_nodes The nodes for this list.
- * @throws an error if the node elements are connected by the
- * different operations. This is not supported, use grouping.
- */
- public list(node[] a_nodes)
- throws Error
- {
- this(',', (char) 0, a_nodes);
-
- int operation = nodes [ 0 ].binary;
-
- for (int i = 0; i < nodes.length; i++)
- {
- if (CLEAR && nodes [ i ].binary != operation)
- throw new Error("List members can only be connected by " +
- "the same operation, use grouping"
- );
-
- if (i > 0)
- nodes [ i ].previous = nodes [ i - 1 ];
- }
- }
-
- /**
- * Returns true if all members in the list are closed.
- */
- public boolean isClosed()
- {
- if (super.isClosed())
- return true;
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].isClosed())
- return false;
- }
- return true;
- }
-
- /**
- * Find the token that could match as the next token in
- * the token list.
- *
- * @return Such token object or null if none is found.
- */
- public Object findFreeNode()
- {
- Object fn;
- for (int j = 0; j < nodes.length; j++)
- {
- if (!nodes [ j ].isClosed())
- {
- fn = nodes [ j ].findFreeNode();
- if (fn != null)
- return fn;
- }
- }
- return null;
- }
-
- /**
- * Tries to match this list agains the given token sequence.
- * @param tokens the sequence of the tokens to match.
- * @return true if the valid match is found.
- */
- public boolean matches(Object[] tokens)
- {
- reset();
-
- Object x;
- boolean m;
- boolean matched = false;
-
- for (int i = 0; i < tokens.length; i++)
- {
- matched = false;
- x = tokens [ i ];
-
- nodescan:
- for (int j = 0; j < nodes.length; j++)
- {
- if (!nodes [ j ].isClosed())
- {
- m = nodes [ j ].performMatch(x);
-
- if (m)
- {
- matched = true;
- break nodescan;
- }
- }
- }
- if (!matched)
- return false;
- }
-
- boolean valid = true;
-
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].valid())
- valid = false;
- }
-
- return valid;
- }
-
- /**
- * The list never closes, despite it is trated as closed
- * if all members in the list are closed.
- * @return false.
- */
- public boolean mustClose()
- {
- return false;
- }
-
- /**
- * Perform a match operation for the single token
- * against this list.
- * @param token a token to match.
- * @return true if the match is found.
- */
- public boolean performMatch(Object token)
- {
- boolean ok = false;
- Matching:
- for (int i = 0; i < nodes.length; i++)
- {
- ok = nodes [ i ].performMatch(token);
-
- if (ok)
- break Matching;
- }
-
- if (ok)
- matches();
-
- return ok;
- }
-
- /**
- * Prepeares the list for the next matching operation.
- */
- public void reset()
- {
- super.reset();
- for (int i = 0; i < nodes.length; i++)
- nodes [ i ].reset();
- }
-
- /**
- * 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.
- * @return 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.
- */
- public Object show(Object x)
- {
- boolean m;
- boolean matched = false;
-
- nodescan:
- for (int j = 0; j < nodes.length; j++)
- {
- if (!nodes [ j ].isClosed())
- {
- m = nodes [ j ].performMatch(x);
-
- if (m)
- {
- matched = true;
- break nodescan;
- }
- else
- {
- // For comma operation, only first not closed
- // node must be tested for a match.
- // unless it allows matching zero times.
- if (binary == ',' &&
- !(nodes [ j ].unary == '?' || nodes [ j ].unary == '*')
- )
- break nodescan;
- }
- }
- }
-
- if (!matched)
- {
- // Find and return that would be matched.
- Object freeNode = findFreeNode();
- if (freeNode == null)
- return Boolean.FALSE;
- else
- return freeNode;
- }
-
- for (int i = 0; i < nodes.length; i++)
- if (!nodes [ i ].validPreliminary())
- {
- return Boolean.FALSE;
- }
-
- return Boolean.TRUE;
- }
-
- /**
- * Returns a string representation of the list.
- * @return String representation, similar to BNF expression.
- */
- public String toString()
- {
- StringBuffer b = new StringBuffer();
- b.append(" ( ");
- for (int i = 0; i < nodes.length; i++)
- {
- if (i > 0)
- b.append(" " + (char) nodes [ i ].binary + " ");
- b.append(nodes [ i ]);
- }
-
- b.append(" )");
- if (unary != 0)
- b.append((char) unary);
- else
- b.append(' ');
- return b.toString();
- }
-
- /**
- * Returns true if all memebers in the list are valid.
- */
- public boolean valid()
- {
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].valid())
- return false;
- }
- return true;
- }
-
- /**
- * 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.
- */
- public boolean validPreliminary()
- {
- if (silenceAllowed())
- {
- boolean everVisited = false;
- for (int i = 0; i < nodes.length; i++)
- {
- if (nodes [ i ].visits > 0)
- {
- everVisited = true;
- break;
- }
- }
- if (!everVisited)
- return true;
- }
-
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].validPreliminary())
- return false;
- }
- return true;
- }
-
- /**
- * Closes all members in the list.
- */
- protected void close()
- {
- super.close();
- for (int i = 0; i < nodes.length; i++)
- {
- nodes [ i ].close();
- }
- }
-
- /**
- * Compare given token with the token of this node.
- * If the token represents a <code>list</code>, the call may be
- * delegeted to the child subnodes.
- * @param a_token A token to compare.
- * @return True if the token matches the token of this node.
- */
- protected boolean compare(Object a_token)
- {
- return performMatch(a_token);
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/noTagModel.java b/libjava/gnu/javax/swing/text/html/parser/models/noTagModel.java
deleted file mode 100755
index 8aac14d8e16..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/noTagModel.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* noTagModel.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. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * Disallows a single given tag at the current content level only.
- * <p>@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)</p>
- */
-public class noTagModel
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
- final String[] no;
-
- public noTagModel(String[] noTag)
- {
- super((char) 0, (char) 0, null);
- no = noTag;
- }
-
- public noTagModel(String noTag)
- {
- super((char) 0, (char) 0, null);
- no = new String[] { noTag };
- }
-
- public Object show(Object x)
- {
- for (int i = 0; i < no.length; i++)
- {
- if (x.toString().equalsIgnoreCase(no [ i ]))
- return Boolean.FALSE;
- }
- return Boolean.TRUE;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/node.java b/libjava/gnu/javax/swing/text/html/parser/models/node.java
deleted file mode 100755
index c615ddff350..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/node.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/* node.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. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * Part of the internal representation of the content model.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
-
- /**
- * The token to match (can be instance of list).
- */
- public Object token;
-
- /**
- * True for the node that cannot be visited again.
- */
- public boolean _closed;
-
- /**
- * The binary operation for this node.
- */
- public char binary;
-
- /**
- * The unary opeation for this node.
- */
- public char unary;
-
- /**
- * The number of times the node already was visited.
- */
- public int visits;
-
- /**
- * The previous node in content model (used for closing nodes).
- */
- public node previous;
-
- /**
- * Creates a new node.
- * @param binary_operator The operator, connecting all nodes in the list.
- * The nodes, connected by the different operators, must be arranged into
- * the different lists.
- * @param unary_operator The unary operator for this node or zero if
- * no such was specified.
- * @param token The token to match. This can be either a string or
- * the new instance of the list.
- * @param a_previous The previous node in the list, null for the first
- * node. This is used for propagating the closing operation for the
- * comma delimited list.
- */
- public node(char binary_operator, char unary_operator, Object a_token)
- {
- if (a_token != null)
- if (a_token.getClass().equals(node.class))
- throw new Error("Creating node in node is redundant and ineffective.");
-
- binary = binary_operator;
- unary = unary_operator;
- token = a_token;
- }
-
- /**
- * Checks if this node is in the closed state.
- * @return True if the node is closed.
- */
- public boolean isClosed()
- {
- return _closed;
- }
-
- /**
- * Check if closing this node means closing the previous node.
- */
- public boolean closePrevious()
- {
- return binary == ',';
- }
-
- /**
- * Return the token object if it could match as a next token in
- * a token list of null if it could not.
- * @return
- */
- public Object findFreeNode()
- {
- boolean ok;
- if (isClosed() || silenceAllowed())
- return null;
-
- // Try if the node would stay valid after a one more visit.
- visits++;
- ok = valid();
- visits--;
-
- if (ok)
- {
- if (token instanceof node)
- return ((node) token).findFreeNode();
- else
- return token;
- }
- else
- return null;
- }
-
- /**
- * Check if the current situation is such that the node must be closed
- * now.
- */
- public boolean mustClose()
- {
- switch (unary)
- {
- case 0 :
- return true;
-
- case '*' :
- return false;
-
- case '+' :
- return false;
-
- case '?' :
- return visits <= 1;
-
- default :
- throw new Error("Invalid unary operation " + unary + " ( '" +
- (char) unary + "' )"
- );
- }
- }
-
- /**
- * Do the match operation with the given token. This sets various
- * flags.
- * @param token The token to match.
- * @return true if the the token matches node, false if it does not match
- * or if the node is closed.
- */
- public boolean performMatch(Object a_token)
- {
- if (isClosed())
- return false;
-
- boolean matches = compare(a_token);
- if (matches)
- matches();
-
- return matches;
- }
-
- /**
- * Prepares the node for matching against a new list of tokens.
- */
- public void reset()
- {
- _closed = false;
- visits = 0;
- }
-
- /**
- * Check if the provided token can match this node.
- * In the case of match, the node 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.
- * @return 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.
- */
- public Object show(Object x)
- {
- if (compare(x))
- return performMatch(x) ? Boolean.TRUE : Boolean.FALSE;
-
- Object recommended = findFreeNode();
- return recommended != null ? recommended : Boolean.FALSE;
- }
-
- /**
- * Check if it would be a valid case if this node is visited zero times.
- * Nodes with unary operator * or ? need not be matched to make a
- * model valid.
- */
- public boolean silenceAllowed()
- {
- return unary == '?' || unary == '*';
- }
-
- /**
- * Returns a string representation of the list.
- * @return String representation, similar to BNF expression.
- */
- public String toString()
- {
- StringBuffer b = new StringBuffer();
-
- b.append(token);
- if (unary != 0)
- b.append((char) unary);
- else
- b.append('\'');
-
- return b.toString();
- }
-
- /**
- * Check if the node state is valid.
- */
- public boolean valid()
- {
- switch (unary)
- {
- case 0 :
- if (binary == '|')
- return true;
- else
- return visits == 1;
-
- case '*' :
- return true;
-
- case '+' :
- return visits > 0;
-
- case '?' :
- return visits <= 1;
-
- default :
- throw new Error("Invalid unary operation " + unary + " ( '" +
- (char) unary + "' )"
- );
- }
- }
-
- public boolean validPreliminary()
- {
- return visits == 0 || valid();
- }
-
- /**
- * Closes this node and, if closePrevious() returs true, calls close() for
- * the previous node.
- */
- protected void close()
- {
- _closed = true;
- if (previous != null && closePrevious())
- previous.close();
- }
-
- /**
- * Compare the provided token object with the token object of this node.
- */
- protected boolean compare(Object a_token)
- {
- if (token instanceof Object[])
- throw new Error("Invalid token object, probably the 'list' " +
- "should be used. "
- );
-
- if (token instanceof node[])
- throw new Error("Do not use 'node' for the array of nodes, use 'list'. ");
-
- if (token instanceof node)
- {
- return ((node) token).performMatch(a_token);
- }
-
- boolean rt = false;
-
- if (token == a_token)
- rt = true;
- if (token.equals(a_token))
- rt = true;
- if (token.toString().equalsIgnoreCase(a_token.toString()))
- rt = true;
-
- return rt;
- }
-
- /**
- * Fire the changes that must happen then the token matches this node.
- */
- protected void matches()
- {
- visits++;
- if (mustClose())
- close();
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/transformer.java b/libjava/gnu/javax/swing/text/html/parser/models/transformer.java
deleted file mode 100755
index 22ae3c3fa52..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/transformer.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/* transformer.java -- Content model transforms.
- 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. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-import javax.swing.text.html.parser.ContentModel;
-import javax.swing.text.html.parser.DTD;
-
-/**
- * Transforms the standard ContentModel tree into the internal representation,
- * used in this implementation.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class transformer
- implements Serializable
-{
- private static final long serialVersionUID = 1;
-
- /**
- * All binary operators.
- */
- protected static String binary = "&|,";
-
- /**
- * All unary operators.
- */
- protected static String unary = "+*?";
-
- /**
- * Measure length of the linked list of the content models.
- * @param c The heading element of the linked list.
- * @return the length of the list (0 for null 1 if c!=null and c.next==null,
- * etc.
- */
- public static int measureChainLength(ContentModel c)
- {
- if (c == null)
- return 0;
- else
- return measureChainLength(c.next) + 1;
- }
-
- /**
- * Transform into internal representation without usind dtd.
- * This should be used only for testing.
- */
- public static node transform(ContentModel c)
- {
- return transform(c, null);
- }
-
- /**
- * Transform into internal representation.
- * @param c a model to transform
- * @return a transformed model
- * @throws Error if the model structure contains errors.
- */
- public static node transform(ContentModel c, DTD dtd)
- {
- // Handle the special cases first.
- if (c.content instanceof node)
- return (node) c.content;
-
- // Do the typical transform.
- node n;
-
- /* Case with the single token */
- if (c.next == null)
- {
- n = optionalTransform(c, dtd);
- }
- else /* Case with the chain of the multiple tokens. */
- {
- node[] l = new node[ measureChainLength(c) ];
- ContentModel m = c;
- for (int i = 0; i < l.length; i++)
- {
- if (m.content instanceof ContentModel)
- {
- ContentModel nested = (ContentModel) m.content;
- if (nested.next == null &&
- !(nested.content instanceof ContentModel)
- )
- {
- l [ i ] =
- new node((char) m.type, (char) nested.type, nested.content);
- }
- else
- {
- l [ i ] = transform(nested, dtd);
- }
- }
- else
- l [ i ] = new node((char) 0, (char) 0, m.content);
- addtype(l [ i ], (char) m.type);
- m = m.next;
- }
-
- if (isBinary(c.type))
- for (int i = 0; i < l.length; i++)
- {
- l [ i ].binary = (char) c.type;
- }
-
- n = new list(l);
- }
-
- addtype(n, (char) c.type);
-
- return n;
- }
-
- /**
- * True for binary operator
- * @param c a character to test
- * @return true for [ ,&| ], false otherwise.
- */
- private static boolean isBinary(int c)
- {
- return binary.indexOf((char) c) >= 0;
- }
-
- /**
- * True for unary operator.
- * @param c a character to test
- * @return true for [ +?* ], false otherwise.
- */
- private static boolean isUnary(int c)
- {
- return unary.indexOf((char) c) >= 0;
- }
-
- /**
- * Assign an operation type for the given node.
- * @param n A node to set the operation to.
- * @param type Either binary or unary operation, is assigned to the
- * corresponding field of the node.
- * @throws error if the operation type is not
- * representing a valid unary or binary operation.
- */
- private static void addtype(node n, char type)
- {
- if (isBinary(type))
- n.binary = type;
-
- else if (isUnary(type))
- n.unary = type;
-
- else if (type != 0)
- throw new Error("Invalid operation '" + (char) type + "'");
- }
-
- private static node optionalTransform(ContentModel c, DTD dtd)
- {
- node n;
- if (c.content instanceof ContentModel)
- n = transform((ContentModel) c.content, dtd);
- else
-
- /* A single token with the specified operation */
- n = new node((char) 0, (char) 0, c.content);
- return n;
- }
-}
OpenPOWER on IntegriCloud