|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
DefaultEntity.java | - | 20% | 22,2% | 21,1% |
|
1 | /* | |
2 | * Copyright 2001-2004 (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 | * $Id: DefaultEntity.java,v 1.9 2004/06/25 08:03:41 maartenc Exp $ | |
8 | */ | |
9 | ||
10 | package org.dom4j.tree; | |
11 | ||
12 | import org.dom4j.Element; | |
13 | ||
14 | /** <p><code>DefaultEntity</code> is the default Entity implementation. | |
15 | * It is a doubly linked node which supports the parent relationship | |
16 | * and can be modified in place.</p> | |
17 | * | |
18 | * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> | |
19 | * @version $Revision: 1.9 $ | |
20 | */ | |
21 | public class DefaultEntity extends FlyweightEntity { | |
22 | ||
23 | /** The parent of this node */ | |
24 | private Element parent; | |
25 | ||
26 | /** Creates the <code>Entity</code> with the specified name | |
27 | * | |
28 | * @param name is the name of the entity | |
29 | */ | |
30 | 0 | public DefaultEntity(String name) { |
31 | 0 | super( name ); |
32 | } | |
33 | ||
34 | /** Creates the <code>Entity</code> with the specified name | |
35 | * and text. | |
36 | * | |
37 | * @param name is the name of the entity | |
38 | * @param text is the text of the entity | |
39 | */ | |
40 | 8 | public DefaultEntity(String name,String text) { |
41 | 8 | super( name, text ); |
42 | } | |
43 | ||
44 | ||
45 | /** Creates the <code>Entity</code> with the specified name | |
46 | * and text. | |
47 | * | |
48 | * @param parent is the parent element | |
49 | * @param name is the name of the entity | |
50 | * @param text is the text of the entity | |
51 | */ | |
52 | 0 | public DefaultEntity(Element parent,String name,String text) { |
53 | 0 | super( name, text ); |
54 | 0 | this.parent = parent; |
55 | } | |
56 | ||
57 | ||
58 | 0 | public void setName(String name) { |
59 | 0 | this.name = name; |
60 | } | |
61 | ||
62 | 0 | public void setText(String text) { |
63 | 0 | this.text = text; |
64 | } | |
65 | ||
66 | ||
67 | ||
68 | 0 | public Element getParent() { |
69 | 0 | return parent; |
70 | } | |
71 | ||
72 | 8 | public void setParent(Element parent) { |
73 | 8 | this.parent = parent; |
74 | } | |
75 | ||
76 | 0 | public boolean supportsParent() { |
77 | 0 | return true; |
78 | } | |
79 | ||
80 | 0 | public boolean isReadOnly() { |
81 | 0 | return false; |
82 | } | |
83 | ||
84 | } | |
85 | ||
86 | ||
87 | ||
88 | ||
89 | /* | |
90 | * Redistribution and use of this software and associated documentation | |
91 | * ("Software"), with or without modification, are permitted provided | |
92 | * that the following conditions are met: | |
93 | * | |
94 | * 1. Redistributions of source code must retain copyright | |
95 | * statements and notices. Redistributions must also contain a | |
96 | * copy of this document. | |
97 | * | |
98 | * 2. Redistributions in binary form must reproduce the | |
99 | * above copyright notice, this list of conditions and the | |
100 | * following disclaimer in the documentation and/or other | |
101 | * materials provided with the distribution. | |
102 | * | |
103 | * 3. The name "DOM4J" must not be used to endorse or promote | |
104 | * products derived from this Software without prior written | |
105 | * permission of MetaStuff, Ltd. For written permission, | |
106 | * please contact dom4j-info@metastuff.com. | |
107 | * | |
108 | * 4. Products derived from this Software may not be called "DOM4J" | |
109 | * nor may "DOM4J" appear in their names without prior written | |
110 | * permission of MetaStuff, Ltd. DOM4J is a registered | |
111 | * trademark of MetaStuff, Ltd. | |
112 | * | |
113 | * 5. Due credit should be given to the DOM4J Project - | |
114 | * http://www.dom4j.org | |
115 | * | |
116 | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS | |
117 | * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT | |
118 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
119 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
120 | * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
121 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
122 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
123 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
124 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
125 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
126 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
127 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
128 | * | |
129 | * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. | |
130 | * | |
131 | * $Id: DefaultEntity.java,v 1.9 2004/06/25 08:03:41 maartenc Exp $ | |
132 | */ |
|