Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*-
   * See the file LICENSE for redistribution information.
   *
   * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
   *
   */
  
  package com.sleepycat.je.tree.dupConvert;
  
 
A DupCountLN represents the transactional part of the root of a duplicate tree, specifically the count of dupes in the tree. Obsolete in log version 8, only used by DupConvert and some log readers.
 
 public final class DupCountLN extends LN {
 
     private static final String BEGIN_TAG = "<dupCountLN>";
     private static final String END_TAG = "</dupCountLN>";
 
     private int dupCount;

    
Create an empty DupCountLN, to be filled in from the log.
 
     public DupCountLN() {
         super();
          = 0;
     }
 
     public int getDupCount() {
         return ;
     }

    

Returns:
true if this node is a duplicate-bearing node type, false if otherwise.
 
     @Override
     public boolean containsDuplicates() {
         return true;
     }
 
     @Override
     public boolean isDeleted() {
         return false;
     }

    
Compute the approximate size of this node in memory for evictor invocation purposes.
 
     @Override
     public long getMemorySizeIncludedByParent() {
         return .;
     }
 
     /*
      * Dumping
      */
 
     @Override
     public String toString() {
         return dumpString(0, true);
     }
 
     @Override
     public String beginTag() {
         return ;
     }
 
     @Override
     public String endTag() {
         return ;
     }
 
     @Override
     public String dumpString(int nSpacesboolean dumpTags) {
         StringBuilder sb = new StringBuilder();
         if (dumpTags) {
             sb.append(TreeUtils.indent(nSpaces));
             sb.append(beginTag());
             sb.append('\n');
         }
         sb.append(TreeUtils.indent(nSpaces+2));
         sb.append("<count v=\"").append().append("\"/>").append('\n');
         sb.append(super.dumpString(nSpacesfalse));
         if (dumpTags) {
             sb.append(TreeUtils.indent(nSpaces));
            sb.append(endTag());
        }
        return sb.toString();
    }
    /*
     * Logging
     */

    
Return the correct log entry type for a DupCountLN depends on whether it's transactional.
    @Override
    protected LogEntryType getLogType(boolean isInsert,
                                      boolean isTransactional) {
        return isTransactional ? . :
                                 .;
    }

    
    @Override
    public int getLogSize() {
        throw EnvironmentFailureException.unexpectedState();
    }

    
    @Override
    public void writeToLog(ByteBuffer logBuffer) {
        throw EnvironmentFailureException.unexpectedState();
    }

    
    @Override
    public void readFromLog(ByteBuffer itemBufferint entryVersion) {
        super.readFromLog(itemBufferentryVersion);
         = LogUtils.readInt(itemBuffer, (entryVersion < 6));
    }

    
    @Override
    public boolean logicalEquals(Loggable other) {
        return false;
    }

    
Dump additional fields
    @Override
    protected void dumpLogAdditional(StringBuilder sbboolean verbose) {
        super.dumpLogAdditional(sbverbose);
        sb.append("<count v=\"").append().append("\"/>");
    }
New to GrepCode? Check out our FAQ X