KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > htmlparser > nodeDecorators > AbstractNodeDecorator


1 // HTMLParser Library $Name: v1_5_20050313 $ - A java-based parser for HTML
2
// http://sourceforge.org/projects/htmlparser
3
// Copyright (C) 2004 Joshua Kerievsky
4
//
5
// Revision Control Information
6
//
7
// $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/nodeDecorators/AbstractNodeDecorator.java,v $
8
// $Author: derrickoswald $
9
// $Date: 2004/07/02 00:49:27 $
10
// $Revision: 1.22 $
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
//
26

27 package org.htmlparser.nodeDecorators;
28
29 import org.htmlparser.Node;
30 import org.htmlparser.Text;
31 import org.htmlparser.NodeFilter;
32 import org.htmlparser.lexer.Page;
33 import org.htmlparser.util.NodeList;
34 import org.htmlparser.util.ParserException;
35 import org.htmlparser.visitors.NodeVisitor;
36
37 public abstract class AbstractNodeDecorator implements Text
38 {
39     protected Text delegate;
40
41     protected AbstractNodeDecorator(Text delegate)
42     {
43         this.delegate = delegate;
44     }
45
46     /**
47      * Clone this object.
48      * Exposes java.lang.Object clone as a public method.
49      * @return A clone of this object.
50      * @exception CloneNotSupportedException This shouldn't be thrown since
51      * the {@link Node} interface extends Cloneable.
52      */

53     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc
54     {
55         return (super.clone ());
56     }
57
58     public void accept (NodeVisitor visitor)
59     {
60         delegate.accept (visitor);
61     }
62
63     public void collectInto(NodeList list, NodeFilter filter) {
64         delegate.collectInto(list, filter);
65     }
66
67     public int elementBegin() {
68         return delegate.elementBegin();
69     }
70
71     public int elementEnd() {
72         return delegate.elementEnd();
73     }
74
75     /**
76      * Gets the starting position of the node.
77      * @return The start position.
78      */

79     public int getStartPosition ()
80     {
81         return (delegate.getStartPosition ());
82     }
83
84     /**
85      * Sets the starting position of the node.
86      * @param position The new start position.
87      */

88     public void setStartPosition (int position)
89     {
90         delegate.setStartPosition (position);
91     }
92
93     /**
94      * Gets the ending position of the node.
95      * @return The end position.
96      */

97     public int getEndPosition ()
98     {
99         return (delegate.getEndPosition ());
100     }
101
102     /**
103      * Sets the ending position of the node.
104      * @param position The new end position.
105      */

106     public void setEndPosition (int position)
107     {
108         delegate.setEndPosition (position);
109     }
110     
111     /**
112      * Get the page this node came from.
113      * @return The page that supplied this node.
114      */

115     public Page getPage ()
116     {
117         return (delegate.getPage ());
118     }
119
120     /**
121      * Set the page this node came from.
122      * @param page The page that supplied this node.
123      */

124     public void setPage (Page page)
125     {
126         delegate.setPage (page);
127     }
128
129     public boolean equals(Object JavaDoc arg0)
130     {
131         return delegate.equals(arg0);
132     }
133
134     public Node getParent() {
135         return delegate.getParent();
136     }
137
138     public String JavaDoc getText() {
139         return delegate.getText();
140     }
141
142     public void setParent(Node node) {
143         delegate.setParent(node);
144     }
145
146     /**
147      * Get the children of this node.
148      * @return The list of children contained by this node, if it's been set, <code>null</code> otherwise.
149      */

150     public NodeList getChildren ()
151     {
152         return (delegate.getChildren ());
153     }
154
155     /**
156      * Set the children of this node.
157      * @param children The new list of children this node contains.
158      */

159     public void setChildren (NodeList children)
160     {
161         delegate.setChildren (children);
162     }
163
164     public void setText(String JavaDoc text) {
165         delegate.setText(text);
166     }
167
168     public String JavaDoc toHtml() {
169         return delegate.toHtml();
170     }
171
172     public String JavaDoc toPlainTextString() {
173         return delegate.toPlainTextString();
174     }
175
176     public String JavaDoc toString() {
177         return delegate.toString();
178     }
179
180     public void doSemanticAction () throws ParserException {
181         delegate.doSemanticAction ();
182     }
183 }
184
Popular Tags