From ae6b4362fce94c2d5c81f64d612a604971239d31 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 12 Mar 2015 08:19:57 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java |   29 ++++++-----------------------
 1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java
index d746127..c5640ce 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexOutputBuffer.java
@@ -26,6 +26,8 @@
  */
 package org.opends.server.backends.pluggable;
 
+import static org.opends.server.backends.pluggable.Importer.indexComparator;
+
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
@@ -104,9 +106,6 @@
   /** Used to iterate over the buffer when writing to a scratch file. */
   private int position;
 
-  /** The comparator to use sort the keys. */
-  private ComparatorBuffer<byte[]> comparator;
-
   /**
    * Used to make sure that an instance of this class is put on the
    * correct scratch file writer work queue for processing.
@@ -152,7 +151,6 @@
     recordOffset = size - 1;
     keys = 0;
     position = 0;
-    comparator = null;
     indexKey = null;
   }
 
@@ -231,18 +229,6 @@
   }
 
   /**
-   * Set the comparator to be used in the buffer processing to the specified
-   * comparator.
-   *
-   * @param comparator The comparator to set the buffer's comparator to.
-   */
-  public void setComparator(ComparatorBuffer<byte[]> comparator)
-  {
-    this.comparator = comparator;
-  }
-
-
-  /**
    * Return a buffer's current position value.
    *
    * @return The buffer's current position value.
@@ -252,7 +238,6 @@
     return position;
   }
 
-
   /**
    * Set a buffer's position value to the specified position.
    *
@@ -263,7 +248,6 @@
     this.position = position;
   }
 
-
   /**
    * Sort the buffer.
    */
@@ -271,7 +255,6 @@
     sort(0, keys);
   }
 
-
   /**
    * Add the specified key byte array and EntryID to the buffer.
    *
@@ -455,7 +438,7 @@
     int yKeyLen = readInt(buffer, yoffSet);
     int yKey = INT_SIZE + yoffSet;
 
-    int cmp = comparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKeyLen, yIndexID);
+    int cmp = indexComparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKeyLen, yIndexID);
     return evaluateReturnCode(cmp, op);
   }
 
@@ -467,7 +450,7 @@
     int xKeyLen = readInt(buffer, xoffSet);
     int xKey = INT_SIZE + xoffSet;
 
-    int cmp = comparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKey.length, yIndexID);
+    int cmp = indexComparator.compare(buffer, xKey, xKeyLen, xIndexID, yKey, yKey.length, yIndexID);
     return evaluateReturnCode(cmp, op);
   }
 
@@ -486,7 +469,7 @@
     offset += REC_OVERHEAD + LONG_SIZE;
     int keyLen = readInt(buffer, offset);
     int key = INT_SIZE + offset;
-    return comparator.compare(buffer, key, keyLen, b, b.length) == 0
+    return indexComparator.compare(buffer, key, keyLen, b, b.length) == 0
         && indexID == bIndexID;
   }
 
@@ -510,7 +493,7 @@
     int keyLen = readInt(buffer, offset);
     int key = INT_SIZE + offset;
 
-    final int cmp = comparator.compare(buffer, key, keyLen, keyBuf.array(), keyBuf.limit());
+    final int cmp = indexComparator.compare(buffer, key, keyLen, keyBuf.array(), keyBuf.limit());
     if (cmp != 0)
     {
       return cmp;

--
Gitblit v1.10.0