* @version 1.1
* @author Francois Chouinard
*/
-public class TmfTimestamp implements ITmfTimestamp, Cloneable {
+public class TmfTimestamp implements ITmfTimestamp {
// ------------------------------------------------------------------------
// Constants
/**
* The timestamp raw value (mantissa)
*/
- private long fValue;
+ private final long fValue;
/**
* The timestamp scale (magnitude)
*/
- private int fScale;
+ private final int fScale;
/**
* The value precision (tolerance)
*/
- private int fPrecision;
+ private final int fPrecision;
// ------------------------------------------------------------------------
// Constructors
fPrecision = timestamp.getPrecision();
}
- // ------------------------------------------------------------------------
- // Setters
- // ------------------------------------------------------------------------
-
- protected void setValue(long value, int scale, int precision) {
- fValue = value;
- fScale = scale;
- fPrecision = precision;
- }
-
// ------------------------------------------------------------------------
// ITmfTimestamp
// ------------------------------------------------------------------------
// Handle the trivial case
if (fScale == scale && offset == 0) {
- return new TmfTimestamp(this);
+ return this;
}
// In case of big bang and big crunch just return this (no need to normalize)
return new TmfTimestamp(value, fScale, fPrecision + nts.getPrecision());
}
- // ------------------------------------------------------------------------
- // Cloneable
- // ------------------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- @Override
- public TmfTimestamp clone() {
- TmfTimestamp clone = null;
- try {
- clone = (TmfTimestamp) super.clone();
- clone.fValue = fValue;
- clone.fScale = fScale;
- clone.fPrecision = fPrecision;
- } catch (final CloneNotSupportedException e) {
- }
- return clone;
- }
-
// ------------------------------------------------------------------------
// Comparable
// ------------------------------------------------------------------------