class Checkpoint extends InternalDatabusEventsListenerAbstract implements Serializable, Cloneable {

  @Override
  public boolean equals(Object other)
  {
    if (null == other) return false;
    if (this == other) return true;
    if (!(other instanceof Checkpoint)) return false;
    Checkpoint otherCp = (Checkpoint)other;

    boolean success = (currentWindowScn == otherCp.currentWindowScn &&
                       prevWindowScn == otherCp.prevWindowScn &&
                       currentWindowOffset == otherCp.currentWindowOffset &&
                       snapShotOffset == otherCp.getSnapshotOffset());
    if (success)
    {
      //Unfortunately, we cannot use the the Map.equals() method.
      //If a checkpoint is deserialized from a string, the ObjectMapper may create Integer objects for some fields while
      //the other checkpoint may have Longs. For java, Integer(-1) != Long(-1). Go figure.
      for (Map.Entry<String, Object> e: internalData.entrySet())
      {
        String k = e.getKey();
        Object v = e.getValue();
        Object otherV = otherCp.internalData.get(k);
        if (v instanceof Number)
        {
          success = (otherV instanceof Number) && (((Number) v).longValue() == ((Number)otherV).longValue());
        }
        else
        {
          success = v.equals(otherV);
        }
        if (!success) break;
      }
    }
    return success;
  }

  @SuppressWarnings("unchecked") public  Checkpoint(String serializedCheckpoint);
  public  Checkpoint();

}