From bcf686add35bda4a6ac5c3d085abe151ea018e8e Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 14 Jan 2009 08:29:50 +0000
Subject: [PATCH] 

---
 opends/src/server/org/opends/server/replication/common/ChangeNumber.java |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/common/ChangeNumber.java b/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
index 8c8ef70..1a8a379 100644
--- a/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
+++ b/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Copyright 2006-2009 Sun Microsystems, Inc.
  */
 package org.opends.server.replication.common;
 
@@ -35,9 +35,13 @@
                                      java.lang.Comparable<ChangeNumber>
 {
   private static final long serialVersionUID = -8802722277749190740L;
-  private long timeStamp;
-  private int seqnum;
-  private short serverId;
+  private final long timeStamp;
+  private final int seqnum;
+  private final short serverId;
+
+  // A String representation of the ChangeNumber suitable for network
+  // transmission.
+  private String formatedString = null;;
 
   /**
    * Create a new ChangeNumber from a String.
@@ -54,6 +58,8 @@
 
     temp = str.substring(20, 28);
     seqnum = Integer.parseInt(temp, 16);
+
+    formatedString = str;
   }
 
   /**
@@ -141,11 +147,27 @@
    */
   public String toString()
   {
+    return format();
+  }
+
+  /**
+   * Convert the ChangeNumber to a String that is suitable for network
+   * transmission.
+   *
+   * @return the string
+   */
+  public String format()
+  {
+    if (formatedString != null)
+      return formatedString;
+
     return String.format("%016x%04x%08x", timeStamp, serverId, seqnum);
   }
 
   /**
-   * Convert the ChangeNumber to a printable String that is .
+   * Convert the ChangeNumber to a printable String with a user friendly
+   * format.
+   *
    * @return the string
    */
   public String toStringUI()

--
Gitblit v1.10.0