1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xerces.internal.dom;
23
24/**
25 * Represents an XML (or HTML) comment.
26 *
27 * @xerces.internal
28 *
29 * @since  PR-DOM-Level-1-19980818.
30 */
31public class DeferredCommentImpl
32    extends CommentImpl
33    implements DeferredNode {
34
35    //
36    // Constants
37    //
38
39    /** Serialization version. */
40    static final long serialVersionUID = 6498796371083589338L;
41
42    //
43    // Data
44    //
45
46    /** Node index. */
47    protected transient int fNodeIndex;
48
49    //
50    // Constructors
51    //
52
53    /**
54     * This is the deferred constructor. Only the fNodeIndex is given here. All other data,
55     * can be requested from the ownerDocument via the index.
56     */
57    DeferredCommentImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
58        super(ownerDocument, null);
59
60        fNodeIndex = nodeIndex;
61        needsSyncData(true);
62
63    } // <init>(DeferredDocumentImpl,int)
64
65    //
66    // DeferredNode methods
67    //
68
69    /** Returns the node index. */
70    public int getNodeIndex() {
71        return fNodeIndex;
72    }
73
74    //
75    // Protected methods
76    //
77
78    /** Synchronizes the data (name and value) for fast nodes. */
79    protected void synchronizeData() {
80
81        // no need to sync in the future
82        needsSyncData(false);
83
84        // fluff data
85        DeferredDocumentImpl ownerDocument =
86            (DeferredDocumentImpl) this.ownerDocument();
87        data = ownerDocument.getNodeValueString(fNodeIndex);
88
89    } // synchronizeData()
90
91} // class DeferredCommentImpl
92