/*******************************************************************************
* Copyright (c) 2009, 2010, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
* Francois Chouinard - Updated as per TMF Trace Model 1.0
package org.eclipse.linuxtools.tmf.core.trace;
/**
- * <b><u>TmfContext</u></b>
+ * A basic implementation of ITmfContext.
* <p>
- * Trace context structure. It ties a trace location to an event rank. The
- * context should be enough to restore the trace state so the corresponding
- * event can be read.
+ * It ties a trace location to an event rank. The context should be enough to
+ * restore the trace state so the corresponding event can be read.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfLocation
*/
public class TmfContext implements ITmfContext, Cloneable {
// ------------------------------------------------------------------------
// The trace location
- private ITmfLocation<? extends Comparable<?>> fLocation;
+ private ITmfLocation fLocation;
// The event rank
private long fRank;
/**
* Simple constructor (unknown rank)
- *
+ *
* @param location the event location
*/
- public TmfContext(final ITmfLocation<? extends Comparable<?>> location) {
+ public TmfContext(final ITmfLocation location) {
this(location, UNKNOWN_RANK);
}
/**
* Full constructor
- *
+ *
* @param location the event location
* @param rank the event rank
*/
- public TmfContext(final ITmfLocation<? extends Comparable<?>> location, final long rank) {
+ public TmfContext(final ITmfLocation location, final long rank) {
fLocation = location;
fRank = rank;
}
/**
* Copy constructor
- *
+ *
* @param context the other context
*/
public TmfContext(final TmfContext context) {
- if (context == null)
+ if (context == null) {
throw new IllegalArgumentException();
+ }
fLocation = context.fLocation;
fRank = context.fRank;
}
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getLocation()
*/
@Override
- public ITmfLocation<? extends Comparable<?>> getLocation() {
+ public ITmfLocation getLocation() {
return fLocation;
}
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setLocation(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
*/
@Override
- public void setLocation(final ITmfLocation<? extends Comparable<?>> location) {
+ public void setLocation(final ITmfLocation location) {
fLocation = location;
}
*/
@Override
public void increaseRank() {
- if (hasValidRank())
+ if (hasValidRank()) {
fRank++;
+ }
}
/* (non-Javadoc)
*/
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final TmfContext other = (TmfContext) obj;
if (fLocation == null) {
- if (other.fLocation != null)
+ if (other.fLocation != null) {
return false;
- } else if (!fLocation.equals(other.fLocation))
+ }
+ } else if (!fLocation.equals(other.fLocation)) {
return false;
- if (fRank != other.fRank)
+ }
+ if (fRank != other.fRank) {
return false;
+ }
return true;
}