From c7ab736ed396b178babaa0120661cca653e6f85f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 18 Nov 2013 13:51:55 +0000
Subject: [PATCH] FirstChangeNumberVirtualAttributeProvider.java, LastChangeNumberVirtualAttributeProvider.java: Updated copy/pasted javadocs.

---
 opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java b/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
index 2a569ad..2b14cc0 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java
@@ -973,6 +973,8 @@
       else
       {
         key = new DatabaseEntry();
+        // JNR: I suspect this is equivalent to writing cursor.getFirst().
+        // If it is, then please change the code to make it clearer.
         status = cursor.getNext(key, data, LockMode.DEFAULT);
       }
 
@@ -987,19 +989,15 @@
           break;
         }
 
-        // reached a regular change record
-        // test whether we reached the 'stop' target
-        if (!csn.isNewerThan(stop))
-        {
-          // let's loop
-          distanceToCounterRecords[START]++;
-          status = cursor.getNext(key, data, LockMode.DEFAULT);
-        }
-        else
-        {
-          // reached the end
+        // it is a regular change record
+        if (csn.isNewerThan(stop))
+        { // we are outside the range: we reached the 'stop' target
           break;
         }
+
+        distanceToCounterRecords[START]++;
+        status = cursor.getNext(key, data, LockMode.DEFAULT);
+        // loop to update the distance and possibly find a counter record
       }
     }
     finally
@@ -1040,13 +1038,14 @@
         }
 
         // it is a regular change record
-        if (!csn.isOlderThan(start))
-        {
-          distanceToCounterRecords[STOP]++;
-          status = cursor.getPrev(key, data, LockMode.DEFAULT);
-        }
-        else
+        if (csn.isOlderThan(start))
+        { // we are outside the range: we reached the 'start' target
           break;
+        }
+
+        distanceToCounterRecords[STOP]++;
+        status = cursor.getPrev(key, data, LockMode.DEFAULT);
+        // loop to update the distance and possibly find a counter record
       }
       return true;
     }
@@ -1133,7 +1132,8 @@
    *
    * @param csn
    *          The CSN to test
-   * @return true if the provided CSN is a counter, false otherwise
+   * @return true if the provided CSN is a counter record, false if the change
+   *         is a regular/normal change that was performed on the replica.
    */
   private static boolean isACounterRecord(CSN csn)
   {

--
Gitblit v1.10.0