⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paramentity.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
/** * org/ozone-db/xml/dom/ParamEntity.java * * The contents of this file are subject to the OpenXML Public * License Version 1.0; you may not use this file except in compliance * with the License. You may obtain a copy of the License at * http://www.openxml.org/license.html * * THIS SOFTWARE IS DISTRIBUTED ON AN "AS IS" BASIS WITHOUT WARRANTY * OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE INITIAL DEVELOPER * AND ALL CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING * RIGHTS AND LIMITATIONS UNDER THE LICENSE. * * The Initial Developer of this code under the License is Assaf Arkin. * Portions created by Assaf Arkin are Copyright (C) 1998, 1999. * All Rights Reserved. *//** * Changes for Persistent DOM running with ozone are * Copyright 1999 by SMB GmbH. All rights reserved. */package org.ozoneDB.xml.dom;import java.io.*;import org.w3c.dom.*;/** * Implements a parameter entity. * <P> * Notes: * <OL> * <LI>Node type is {@link NodeImpl#PARAM_ENTITY_NODE} * <LI>Node supports childern * <LI>Node does not have a value * <LI>Node only accessible from {@link org.w3c.dom.DocumentType} * </OL> * * * @version $Revision: 1.11 $ $Date: 2000/10/28 16:55:23 $ * @author <a href="mailto:arkin@trendline.co.il">Assaf Arkin</a> * @see NodeImpl */public class ParamEntity extends NodeImpl implements ParamEntityProxy {        final static long serialVersionUID = 1;            public short getNodeType() {        return PARAM_ENTITY_NODE;    }             public String getPublicId() {        return _publicId;    }             public void setPublicId( String publicId ) {        _publicId = publicId;    }             public String getSystemId() {        return _systemId;    }             public void setSystemId( String systemId ) {        _systemId = systemId;    }             /**     * Returns true if entity is an internal entity. An internal entity is one     * for which a value has been defined. An external entity is one for which     * an external entity has been assigned through either system or public     * identifiers.     *     * @return True if internal entity     */    public boolean isInternal() {        return _internalValue != null;    }             /**     * Returns the parsing state of this entity.     *     * @return State of entity     */    public short getState() {        return _state;    }             /**     * Changes the parsing state of this entity. Note that only some changes     * are allowed: from declared to parsing, parsed or not found; from parsing     * to parsed or not found; from not found to declared.     *     * @param newState New state of entity     */    public void setState( short newState ) {        if (_state == STATE_DECLARED && newState == STATE_PARSING || _state == STATE_NOT_FOUND && newState                 == STATE_DECLARED) {            _state = newState;        } else if ((_state == STATE_DECLARED || _state == STATE_PARSING) && (newState == STATE_PARSED || newState                 == STATE_NOT_FOUND)) {            _state = newState;        } else {            throw new IllegalStateException( "Cannot switch from state " + _state + " to state " + newState + "." );        }     }             public final String getInternal() {        return _internalValue;    }             public final void setInternal( String internalValue ) {        _internalValue = internalValue;    }             public synchronized boolean equals( Object other ) {        ParamEntityProxy otherX;                // Test for node equality (this covers entity name and all its children)        // and then test for specific entity qualities.        if (super.equals( other )) {            otherX = (ParamEntityProxy)other;            // If this entity is internal, both entities must be internal and have            // equal internal value.            if (this.isInternal()) {                return otherX.isInternal() && this.getInternal().equals( otherX.getInternal() );            }             // External or unparsed: either public id are both null, or public id            // equals in both (and same for system id).            return                     (this.getPublicId() == null && otherX.getPublicId() == null || this.getPublicId() != null                     && this.getPublicId().equals( otherX.getPublicId() )) && (this.getSystemId() == null                     && otherX.getSystemId() == null || this.getSystemId() != null && this.getSystemId().equals(                    otherX.getSystemId() ));        }         return false;    }             public final Object clone() {        ParamEntityProxy clone = null;        try {            clone = (ParamEntityProxy)database().createObject( ParamEntity.class.getName() );            ((NodeProxy)clone).init( _ownerDocument, getNodeName(), null, true );            cloneInto( (NodeProxy)clone, true );        } catch (Exception except) {        }         return clone;    }             public final Node cloneNode( boolean deep ) {        ParamEntityProxy clone = null;        try {            clone = (ParamEntityProxy)database().createObject( ParamEntity.class.getName() );            ((NodeProxy)clone).init( _ownerDocument, getNodeName(), null, true );            cloneInto( (NodeProxy)clone, deep );        } catch (Exception except) {        }         return clone;    }             public String toString() {        String name;        String value;                name = getNodeName();        if (name.length() > 32) {            name = name.substring( 0, 32 ) + "..";        }         if (isInternal()) {            value = getInternal();            if (value.length() > 64) {                value = value.substring( 0, 64 ) + "..";            }             name = name + "] [" + value;        } else {            if (getSystemId() != null) {                name = name + "] SYSTEM [" + getSystemId();            }             if (getPublicId() != null) {                name = name + "] PUBLIC [" + getPublicId();            }         }         return "PEntity decl: [" + name + "]";    }             public synchronized void cloneInto( NodeProxy into, boolean deep ) {        super.cloneInto( into, deep );        ((ParamEntityProxy)into).setSystemId( this.getSystemId() );        ((ParamEntityProxy)into).setPublicId( this.getPublicId() );        ((ParamEntityProxy)into).setInternal( this.getInternal() );        ((ParamEntityProxy)into).setState( this.getState() );    }             /**     * Constructs an external parameter entity. Entity system identifier must be     * provided, public identifier is optional.     *     * @param owner The owner document     * @param name The entity name     * @param systemId The system identifier     * @param publicId The public identifier, if specified     */    public ParamEntity( DocumentImpl owner, String name, String systemId, String publicId ) {        super( owner, name, null, true );        if (systemId == null) {            throw new NullPointerException( "Argument 'systemId' cannot be null." );        }         _systemId = systemId;        _publicId = publicId;        _state = STATE_DECLARED;    }            /**     * Constructs an internal parameter entity. Entity value must be provided.     *     * @param owner The owner document     * @param name The entity name     * @param internalValue The unparsed entity value     */    public ParamEntity( DocumentImpl owner, String name, String internalValue ) {        super( owner, name, null, true );        init( owner, name, internalValue );    }            private ParamEntity( DocumentImpl owner, String name ) {        super( owner, name, null, true );    }            public ParamEntity() {        super();    }            public void init( DocumentProxy owner, String name ) {        super.init( owner, name, null, true );    }             public void init( DocumentProxy owner, String name, String value ) {        super.init( owner, name, null, true );        if (value == null) {            throw new NullPointerException( "Argument 'internalValue' cannot be null." );        }         _systemId = null;        _publicId = null;        _state = STATE_DECLARED;        _internalValue = value;    }             public void init( DocumentProxy owner, String name, String systemId, String publicId ) {    }         /**     * The system identifier of this entity, if specified.     */    private String _systemId;            /**     * The public identifier of this entity, if specified.     */    private String _publicId;            /**     * Identifies the state of this entity as yet to be parsed, being parsed,     * has been parsed, or cannot be found.     */    private short _state;            /**     * Holds the internal value of the entity.     */    private String _internalValue;            /**     * Entity has been declared but not parsed. This is the initial state for     * an entity after it has been declared in the DTD but before it is used     * in the document contents.     */    public final static short STATE_DECLARED = 0;            /**     * Entity is being parsed. This state designates that the entity is being     * parsed right now. State is used to identify circular references.     */    public final static short STATE_PARSING = 1;            /**     * Entity has been parsed. This state indicates that entity has been parsed     * and it's parsed contents is contained in its child nodes.     */    public final static short STATE_PARSED = 2;            /**     * Entity not found. The entity could not be parsed before.     */    public final static short STATE_NOT_FOUND = 3;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -