* <p>
* This class maps an event timestamp to a generic location.
*/
-public class TmfCheckpoint implements Comparable<TmfCheckpoint> {
+@SuppressWarnings("rawtypes")
+public class TmfCheckpoint implements Comparable<TmfCheckpoint>, Cloneable {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private final TmfTimestamp fTimestamp;
- private final ITmfLocation<?> fLocation;
+ private TmfTimestamp fTimestamp;
+ private ITmfLocation<? extends Comparable> fLocation;
// ------------------------------------------------------------------------
// Constructors
* @param ts the checkpoint timestamp
* @param location the corresponding trace location
*/
- public TmfCheckpoint(TmfTimestamp ts, ITmfLocation<?> location) {
+ public TmfCheckpoint(TmfTimestamp ts, ITmfLocation<? extends Comparable> location) {
fTimestamp = ts;
fLocation = location;
}
// Object
// ------------------------------------------------------------------------
+ @Override
+ public TmfCheckpoint clone() {
+ TmfCheckpoint result = null;
+ try {
+ result = (TmfCheckpoint) super.clone();
+ result.fTimestamp = new TmfTimestamp(fTimestamp);
+ result.fLocation = fLocation.clone();
+ return result;
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
@Override
public int hashCode() {
return fTimestamp.hashCode();
}
@Override
+ @SuppressWarnings("nls")
public String toString() {
return "[TmfCheckpoint(" + fTimestamp + "," + fLocation + ")]";
}
// Comparable
// ------------------------------------------------------------------------
- public int compareTo(TmfCheckpoint other) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compareTo(TmfCheckpoint other) {
+ if (fTimestamp == null || other.fTimestamp == null) {
+ return fLocation.getLocation().compareTo(other.fLocation.getLocation());
+ }
return fTimestamp.compareTo(other.fTimestamp, false);
}