KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > dom > DeferredCommentImpl


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.dom;
18
19 /**
20  * Represents an XML (or HTML) comment.
21  *
22  * @xerces.internal
23  *
24  * @version $Id: DeferredCommentImpl.java,v 1.11 2004/10/05 17:12:51 mrglavas Exp $
25  * @since PR-DOM-Level-1-19980818.
26  */

27 public class DeferredCommentImpl
28     extends CommentImpl
29     implements 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, int nodeIndex) {
54         super(ownerDocument, null);
55
56         fNodeIndex = nodeIndex;
57         needsSyncData(true);
58
59     } // <init>(DeferredDocumentImpl,int)
60

61     //
62
// DeferredNode methods
63
//
64

65     /** Returns the node index. */
66     public int getNodeIndex() {
67         return fNodeIndex;
68     }
69
70     //
71
// Protected methods
72
//
73

74     /** Synchronizes the data (name and value) for fast nodes. */
75     protected void synchronizeData() {
76
77         // no need to sync in the future
78
needsSyncData(false);
79
80         // fluff data
81
DeferredDocumentImpl ownerDocument =
82             (DeferredDocumentImpl) this.ownerDocument();
83         data = ownerDocument.getNodeValueString(fNodeIndex);
84
85     } // synchronizeData()
86

87 } // class DeferredCommentImpl
88
Popular Tags