jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredNotationImpl.java
author chegar
Sun, 17 Aug 2014 15:51:56 +0100
changeset 25868 686eef1e7a79
parent 12457 jaxp/src/com/sun/org/apache/xerces/internal/dom/DeferredNotationImpl.java@c348e06f0e82
child 44797 8b3b3b911b8a
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 1999-2002,2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xerces.internal.dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 * Notations are how the Document Type Description (DTD) records hints
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
 * about the format of an XML "unparsed entity" -- in other words,
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
 * non-XML data bound to this document type, which some applications
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 * may wish to consult when manipulating the document. A Notation
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 * represents a name-value pair, with its nodeName being set to the
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 * declared name of the notation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 * <P>
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * Notations are also used to formally declare the "targets" of
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * Processing Instructions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * <P>
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * Note that the Notation's data is non-DOM information; the DOM only
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * records what and where it is.
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * <P>
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * See the XML 1.0 spec, sections 4.7 and 2.6, for more info.
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * <P>
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * Level 1 of the DOM does not support editing Notation contents.
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * @xerces.internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * @since  PR-DOM-Level-1-19980818.
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
public class DeferredNotationImpl
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
    extends NotationImpl
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
    implements DeferredNode {
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
    // Constants
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
    /** Serialization version. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
    static final long serialVersionUID = 5705337172887990848L;
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
    // Data
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
    /** Node index. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
    protected transient int fNodeIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
    // Constructors
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
     * This is the deferred constructor. Only the fNodeIndex is given here.
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
     * All other data, can be requested from the ownerDocument via the index.
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
    DeferredNotationImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
        super(ownerDocument, null);
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
        fNodeIndex = nodeIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
        needsSyncData(true);
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
    } // <init>(DeferredDocumentImpl,int)
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
    // DeferredNode methods
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
    /** Returns the node index. */
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
    public int getNodeIndex() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
        return fNodeIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
    // Protected methods
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
     * Synchronizes the data. This is special because of the way
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
     * that the "fast" notation stores its information internally.
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
    protected void synchronizeData() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
        // no need to synchronize again
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
        needsSyncData(false);
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
        // name
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
        DeferredDocumentImpl ownerDocument =
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
            (DeferredDocumentImpl)this.ownerDocument();
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
        name = ownerDocument.getNodeName(fNodeIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
        ownerDocument.getNodeType(fNodeIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
        // public and system ids
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
        publicId = ownerDocument.getNodeValue(fNodeIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
        systemId = ownerDocument.getNodeURI(fNodeIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
        int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
        ownerDocument.getNodeType(extraDataIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
        baseURI = ownerDocument.getNodeName(extraDataIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
    } // synchronizeData()
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
} // class DeferredNotationImpl