Clover coverage report - dom4j - 1.6.1 Coverage timestamp: ma mei 16 2005 14:23:01 GMT+01:00 FRAMES NO FRAMES |
file stats: | LOC: | 108 |  | Methods: | 9
| NCLOC: | 40 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
AbstractEntity.java | 0% | 8,3% | 22,2% | 12% |

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 java.io.IOException;
11 |  | import java.io.Writer;
12 |  |
13 |  | import org.dom4j.Element;
14 |  | import org.dom4j.Entity;
15 |  | import org.dom4j.Visitor;
16 |  |
17 |  | /**
18 |  | * <p>
19 |  | * <code>AbstractEntity</code> is an abstract base class for tree implementors
20 |  | * to use for implementation inheritence.
21 |  | * </p>
22 |  | *
23 |  | * @author <a href="mailto:james.strachan@metastuff.com">James Strachan </a>
24 |  | * @version $Revision: 1.15 $
25 |  | */
26 |  | public abstract class AbstractEntity extends AbstractNode implements Entity {
27 | 4 | public AbstractEntity() {
28 |  | }
29 |  |
30 | 2 | public short getNodeType() {
31 | 2 | return ENTITY_REFERENCE_NODE;
32 |  | }
33 |  |
34 | 0 | public String getPath(Element context) {
35 |  | // From XPaths perspective, entities are included in text
36 | 0 | Element parent = getParent();
37 |  |
38 | 0 | return ((parent != null) && (parent != context)) ? (parent
39 |  | .getPath(context) + "/text()") : "text()";
40 |  | }
41 |  |
42 | 0 | public String getUniquePath(Element context) {
43 |  | // From XPaths perspective, entities are included in text
44 | 0 | Element parent = getParent();
45 |  |
46 | 0 | return ((parent != null) && (parent != context)) ? (parent
47 |  | .getUniquePath(context) + "/text()") : "text()";
48 |  | }
49 |  |
50 | 0 | public String toString() {
51 | 0 | return super.toString() + " [Entity: &" + getName() + ";]";
52 |  | }
53 |  |
54 | 0 | public String getStringValue() {
55 | 0 | return "&" + getName() + ";";
56 |  | }
57 |  |
58 | 0 | public String asXML() {
59 | 0 | return "&" + getName() + ";";
60 |  | }
61 |  |
62 | 0 | public void write(Writer writer) throws IOException {
63 | 0 | writer.write("&");
64 | 0 | writer.write(getName());
65 | 0 | writer.write(";");
66 |  | }
67 |  |
68 | 0 | public void accept(Visitor visitor) {
69 | 0 | visitor.visit(this);
70 |  | }
71 |  | }
72 |  |
73 |  | /*
74 |  | * Redistribution and use of this software and associated documentation
75 |  | * ("Software"), with or without modification, are permitted provided that the
76 |  | * following conditions are met:
77 |  | *
78 |  | * 1. Redistributions of source code must retain copyright statements and
79 |  | * notices. Redistributions must also contain a copy of this document.
80 |  | *
81 |  | * 2. Redistributions in binary form must reproduce the above copyright notice,
82 |  | * this list of conditions and the following disclaimer in the documentation
83 |  | * and/or other materials provided with the distribution.
84 |  | *
85 |  | * 3. The name "DOM4J" must not be used to endorse or promote products derived
86 |  | * from this Software without prior written permission of MetaStuff, Ltd. For
87 |  | * written permission, please contact dom4j-info@metastuff.com.
88 |  | *
89 |  | * 4. Products derived from this Software may not be called "DOM4J" nor may
90 |  | * "DOM4J" appear in their names without prior written permission of MetaStuff,
91 |  | * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
92 |  | *
93 |  | * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
94 |  | *
95 |  | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
96 |  | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97 |  | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
98 |  | * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
99 |  | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
100 |  | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
101 |  | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
102 |  | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
103 |  | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
104 |  | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
105 |  | * POSSIBILITY OF SUCH DAMAGE.
106 |  | *
107 |  | * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
108 |  | */