KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dom4j > tree > DefaultComment


1 /*
2  * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
3  *
4  * This software is open source.
5  * See the bottom of this file for the licence.
6  */

7
8 package org.dom4j.tree;
9
10 import org.dom4j.Element;
11
12 /**
13  * <p>
14  * <code>DefaultComment</code> is the default Comment implementation. It is a
15  * doubly linked node which supports the parent relationship and can be modified
16  * in place.
17  * </p>
18  *
19  * @author <a HREF="mailto:jstrachan@apache.org">James Strachan </a>
20  * @version $Revision: 1.11 $
21  */

22 public class DefaultComment extends FlyweightComment {
23     /** The parent of this node */
24     private Element parent;
25
26     /**
27      * DOCUMENT ME!
28      *
29      * @param text
30      * is the Comment text
31      */

32     public DefaultComment(String JavaDoc text) {
33         super(text);
34     }
35
36     /**
37      * DOCUMENT ME!
38      *
39      * @param parent
40      * is the parent element
41      * @param text
42      * is the Comment text
43      */

44     public DefaultComment(Element parent, String JavaDoc text) {
45         super(text);
46         this.parent = parent;
47     }
48
49     public void setText(String JavaDoc text) {
50         this.text = text;
51     }
52
53     public Element getParent() {
54         return parent;
55     }
56
57     public void setParent(Element parent) {
58         this.parent = parent;
59     }
60
61     public boolean supportsParent() {
62         return true;
63     }
64
65     public boolean isReadOnly() {
66         return false;
67     }
68 }
69
70 /*
71  * Redistribution and use of this software and associated documentation
72  * ("Software"), with or without modification, are permitted provided that the
73  * following conditions are met:
74  *
75  * 1. Redistributions of source code must retain copyright statements and
76  * notices. Redistributions must also contain a copy of this document.
77  *
78  * 2. Redistributions in binary form must reproduce the above copyright notice,
79  * this list of conditions and the following disclaimer in the documentation
80  * and/or other materials provided with the distribution.
81  *
82  * 3. The name "DOM4J" must not be used to endorse or promote products derived
83  * from this Software without prior written permission of MetaStuff, Ltd. For
84  * written permission, please contact dom4j-info@metastuff.com.
85  *
86  * 4. Products derived from this Software may not be called "DOM4J" nor may
87  * "DOM4J" appear in their names without prior written permission of MetaStuff,
88  * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
89  *
90  * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
91  *
92  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
93  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
95  * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
96  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
97  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
98  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
99  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
100  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
102  * POSSIBILITY OF SUCH DAMAGE.
103  *
104  * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
105  */

106
Popular Tags