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