001/*
002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
003 * 
004 * This software is open source. 
005 * See the bottom of this file for the licence.
006 * 
007 * $Id: DefaultEntity.java,v 1.5 2001/06/20 18:59:23 jstrachan Exp $
008 */
009
010package org.dom4j.tree;
011
012import org.dom4j.Node;
013import org.dom4j.Element;
014
015/** <p><code>DefaultEntity</code> is the default Entity implementation.
016  * It is a doubly linked node which supports the parent relationship 
017  * and can be modified in place.</p>
018  *
019  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
020  * @version $Revision: 1.5 $
021  */
022public class DefaultEntity extends FlyweightEntity {
023
024    /** The parent of this node */
025    private Element parent;
026
027    /** Creates the <code>Entity</code> with the specified name
028      *
029      * @param name is the name of the entity
030      */
031    public DefaultEntity(String name) {
032        super( name );
033    }
034
035    /** Creates the <code>Entity</code> with the specified name
036      * and text.
037      *
038      * @param name is the name of the entity
039      * @param text is the text of the entity
040      */
041    public DefaultEntity(String name,String text) {
042        super( name, text );
043    }
044    
045    
046    /** Creates the <code>Entity</code> with the specified name
047      * and text.
048      *
049      * @param parent is the parent element
050      * @param name is the name of the entity
051      * @param text is the text of the entity
052      */
053    public DefaultEntity(Element parent,String name,String text) {
054        super( name, text );
055        this.parent = parent;
056    }
057
058    
059    public void setName(String name) {
060        this.name = name;
061    }
062    
063    public void setText(String text) {
064        this.text = text;
065    }
066    
067    
068
069    public Element getParent() {
070        return parent;
071    }
072
073    public void setParent(Element parent) {
074        this.parent = parent;
075    }
076    
077    public boolean supportsParent() {
078        return true;
079    }
080    
081    public boolean isReadOnly() {
082        return false;
083    }
084
085}
086
087
088
089
090/*
091 * Redistribution and use of this software and associated documentation
092 * ("Software"), with or without modification, are permitted provided
093 * that the following conditions are met:
094 *
095 * 1. Redistributions of source code must retain copyright
096 *    statements and notices.  Redistributions must also contain a
097 *    copy of this document.
098 *
099 * 2. Redistributions in binary form must reproduce the
100 *    above copyright notice, this list of conditions and the
101 *    following disclaimer in the documentation and/or other
102 *    materials provided with the distribution.
103 *
104 * 3. The name "DOM4J" must not be used to endorse or promote
105 *    products derived from this Software without prior written
106 *    permission of MetaStuff, Ltd.  For written permission,
107 *    please contact dom4j-info@metastuff.com.
108 *
109 * 4. Products derived from this Software may not be called "DOM4J"
110 *    nor may "DOM4J" appear in their names without prior written
111 *    permission of MetaStuff, Ltd. DOM4J is a registered
112 *    trademark of MetaStuff, Ltd.
113 *
114 * 5. Due credit should be given to the DOM4J Project
115 *    (http://dom4j.org/).
116 *
117 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
118 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
119 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
120 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
121 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
122 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
123 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
124 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
125 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
126 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
127 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
128 * OF THE POSSIBILITY OF SUCH DAMAGE.
129 *
130 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
131 *
132 * $Id: DefaultEntity.java,v 1.5 2001/06/20 18:59:23 jstrachan Exp $
133 */