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