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