[Htmlparser-cvs] htmlparser/src/org/htmlparser AbstractNode.java,1.7,1.8 Node.java,1.33,1.34 RemarkN
Brought to you by:
derrickoswald
|
From: <der...@us...> - 2003-08-23 17:24:47
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser In directory sc8-pr-cvs1:/tmp/cvs-serv20167 Modified Files: AbstractNode.java Node.java RemarkNode.java StringNode.java Log Message: Sixth drop for new i/o subsystem. Isolated htmllexer.jar file and made it compileable and runnable on JDK 1.1 systems. The build.xml file now has four new targets for separate compiling and jaring of the lexer and parser. Significantly refactored the existing Node interface and AbstractNode class to achieve isolation. They now support get/setChildren(), rather than CompositeTag. Various scanners that were directly accessing the childTags node list were affected. The get/setParent is now a generic Node rather than a CompositeTag. The visitor accept() signature was changed to Object to avoid dragging in visitors code. This was *not* changed on classes derived from Tag, although it could be. ChainedException now uses/returns a Vector. Removed the cruft from lexer nodes where possible. Index: AbstractNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/AbstractNode.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractNode.java 11 Aug 2003 00:18:28 -0000 1.7 --- AbstractNode.java 23 Aug 2003 17:14:44 -0000 1.8 *************** *** 29,37 **** package org.htmlparser; ! import java.io.*; ! import org.htmlparser.tags.*; ! import org.htmlparser.util.*; ! import org.htmlparser.visitors.*; /** --- 29,35 ---- package org.htmlparser; ! import java.io.Serializable; ! import org.htmlparser.util.NodeList; /** *************** *** 50,60 **** /** ! * If parent of this tag */ ! protected CompositeTag parent = null; ! ! public AbstractNode(int nodeBegin, int nodeEnd) { ! this.nodeBegin = nodeBegin; ! this.nodeEnd = nodeEnd; } --- 48,70 ---- /** ! * The parent of this node. */ ! protected Node parent; ! ! /** ! * The children of this node. ! */ ! protected NodeList children; ! ! /** ! * Create an abstract node with the page positions given. ! * @param begin The starting position of the node. ! * @param end The ending position of the node. ! */ ! public AbstractNode (int begin, int end) ! { ! nodeBegin = begin; ! nodeEnd = end; ! parent = null; } *************** *** 166,170 **** } ! public abstract void accept(NodeVisitor visitor); /** --- 176,180 ---- } ! public abstract void accept(Object visitor); /** *************** *** 176,195 **** /** ! * Get the parent of this tag * @return The parent of this node, if it's been set, <code>null</code> otherwise. */ ! public CompositeTag getParent() { ! return parent; } ! /** ! * Sets the parent of this tag ! * @param tag */ ! public void setParent(CompositeTag tag) { ! parent = tag; } ! /** * Returns the text of the string line */ --- 186,228 ---- /** ! * Get the parent of this node. ! * This will always return null when parsing without scanners, ! * i.e. if semantic parsing was not performed. ! * The object returned from this method can be safely cast to a <code>CompositeTag</code>. * @return The parent of this node, if it's been set, <code>null</code> otherwise. */ ! public Node getParent () ! { ! return (parent); } ! /** ! * Sets the parent of this node. ! * @param node The node that contains this node. Must be a <code>CompositeTag</code>. */ ! public void setParent (Node node) ! { ! parent = node; } ! /** ! * Get the children of this node. ! * @return The list of children contained by this node, if it's been set, <code>null</code> otherwise. ! */ ! public NodeList getChildren () ! { ! return (children); ! } ! ! /** ! * Set the children of this node. ! * @param children The new list of children this node contains. ! */ ! public void setChildren (NodeList children) ! { ! this.children = children; ! } ! ! /** * Returns the text of the string line */ Index: Node.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Node.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Node.java 11 Aug 2003 00:18:28 -0000 1.33 --- Node.java 23 Aug 2003 17:14:44 -0000 1.34 *************** *** 31,37 **** package org.htmlparser; - import org.htmlparser.tags.CompositeTag; import org.htmlparser.util.NodeList; - import org.htmlparser.visitors.NodeVisitor; public interface Node { --- 31,35 ---- *************** *** 128,145 **** */ public abstract int elementEnd(); ! public abstract void accept(NodeVisitor visitor); ! /** ! * Get the parent of this tag * @return The parent of this node, if it's been set, <code>null</code> otherwise. */ ! public abstract CompositeTag getParent(); ! /** ! * Sets the parent of this tag ! * @param tag */ ! public abstract void setParent(CompositeTag tag); ! /** * Returns the text of the string line --- 126,159 ---- */ public abstract int elementEnd(); ! ! public abstract void accept(Object visitor); /** ! * Get the parent of this node. ! * This will always return null when parsing without scanners, ! * i.e. if semantic parsing was not performed. ! * The object returned from this method can be safely cast to a <code>CompositeTag</code>. * @return The parent of this node, if it's been set, <code>null</code> otherwise. */ ! public abstract Node getParent (); ! ! /** ! * Sets the parent of this node. ! * @param node The node that contains this node. Must be a <code>CompositeTag</code>. */ ! public abstract void setParent (Node node); ! ! /** ! * Get the children of this node. ! * @return The list of children contained by this node, if it's been set, <code>null</code> otherwise. ! */ ! public abstract NodeList getChildren (); ! ! /** ! * Set the children of this node. ! * @param children The new list of children this node contains. ! */ ! public abstract void setChildren (NodeList children); ! /** * Returns the text of the string line Index: RemarkNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/RemarkNode.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** RemarkNode.java 11 Aug 2003 00:18:28 -0000 1.24 --- RemarkNode.java 23 Aug 2003 17:14:44 -0000 1.25 *************** *** 83,88 **** } ! public void accept(NodeVisitor visitor) { ! visitor.visitRemarkNode(this); } --- 83,88 ---- } ! public void accept(Object visitor) { ! ((NodeVisitor)visitor).visitRemarkNode(this); } Index: StringNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/StringNode.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** StringNode.java 11 Aug 2003 00:18:28 -0000 1.32 --- StringNode.java 23 Aug 2003 17:14:44 -0000 1.33 *************** *** 88,93 **** } ! public void accept(NodeVisitor visitor) { ! visitor.visitStringNode(this); } } --- 88,93 ---- } ! public void accept(Object visitor) { ! ((NodeVisitor)visitor).visitStringNode(this); } } |