X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.core%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fcore%2Fctfadaptor%2FCtfLocation.java;h=01da9726134c640bf15dfae5bbb3a166a187e9ba;hb=d62bb1853c3388385d5ce10b0302b3dde139c3ab;hp=f218d3ff538e15ec661399a89d3a86760a1db388;hpb=dd08a8935a9a5ee300989ec9ba35cab83a972303;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java index f218d3ff53..01da972613 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java @@ -21,9 +21,9 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation; * @version 1.0 * @author Matthew Khouzam */ -public class CtfLocation implements ITmfLocation, Cloneable { +public final class CtfLocation implements ITmfLocation { - private CtfLocationData fLocation; + private final CtfLocationData fLocation; /** * An invalid location @@ -31,14 +31,13 @@ public class CtfLocation implements ITmfLocation, Cloneable { public static final CtfLocationData INVALID_LOCATION = new CtfLocationData(-1, -1); /** - * Copy constructor + * Constructor for CtfLocation. Uses a default index of 0. * - * @param location - * Other location to copy - * @since 2.0 + * @param timestamp + * The timestamp of this location */ - public CtfLocation(CtfLocationData location) { - setLocation(location); + public CtfLocation(final ITmfTimestamp timestamp) { + this(timestamp.getValue(), 0); } /** @@ -50,30 +49,8 @@ public class CtfLocation implements ITmfLocation, Cloneable { * The index of this location for this timestamp * @since 2.0 */ - public CtfLocation(ITmfTimestamp timestamp, long index) { - setLocation(new CtfLocationData(timestamp.getValue(), index)); - } - - /** - * Constructor for CtfLocation. Uses a default index of 0. - * - * @param timestamp - * The timestamp of this location - */ - @Deprecated - public CtfLocation(ITmfTimestamp timestamp) { - setLocation(new CtfLocationData(timestamp.getValue(), 0)); - } - - /** - * Move this location to another location's position. - * - * @param location - * The location to seek to - * @since 2.0 - */ - public void setLocation(CtfLocationData location) { - this.fLocation = location; + public CtfLocation(final ITmfTimestamp timestamp, long index) { + this(timestamp.getValue(), index); } /** @@ -85,20 +62,30 @@ public class CtfLocation implements ITmfLocation, Cloneable { * The new index * @since 2.0 */ - public void setLocation(long timestampValue, long index) { - this.fLocation = new CtfLocationData(timestampValue, index); + public CtfLocation(final long timestampValue, final long index) { + this(new CtfLocationData(timestampValue, index)); } + /** + * Copy constructor + * + * @param location + * Other location to copy + * @since 2.0 + */ + public CtfLocation(final CtfLocationData location) { + fLocation = location; + } /** * Get the Location Data of this location * * @return The CtfLocationData - * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocation() + * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocationInfo() * @since 2.0 */ @Override - public CtfLocationData getLocation() { + public CtfLocationData getLocationInfo() { return fLocation; } @@ -150,11 +137,10 @@ public class CtfLocation implements ITmfLocation, Cloneable { */ @Override public String toString() { - if( this.getLocation().equals(CtfLocation.INVALID_LOCATION )) { + if( this.getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) { return "CtfLocation: INVALID"; //$NON-NLS-1$ } - return "CtfLocation: " + getLocation().toString(); //$NON-NLS-1$ + return "CtfLocation: " + getLocationInfo().toString(); //$NON-NLS-1$ } - }