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