/**
* Return the int representing this field's value type
- *
+ *
* @return the field type
*/
public abstract int getFieldType();
/**
* Return this field's value. You can cast it to the correct type depending
* on what getFieldType says.
- *
+ *
* @return the field value
*/
@Override
/**
* Other methods defined by ITmfEventField, but not used here: the CTF
* fields do not have sub-fields (yet!)
- *
+ *
* @return the field names
*/
@Override
return null;
}
+ @SuppressWarnings("unused")
@Override
public String getFieldName(int index) {
return null;
return null;
}
+ @SuppressWarnings("unused")
@Override
public ITmfEventField getField(String fieldName) {
return null;
}
+ @SuppressWarnings("unused")
@Override
public ITmfEventField getField(int index) {
return null;
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
fScale = (byte) -9;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = (prime * result) + ((fTrace == null) ? 0 : fTrace.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof CtfTmfTimestamp)) {
+ return false;
+ }
+ CtfTmfTimestamp other = (CtfTmfTimestamp) obj;
+ if (fTrace == null) {
+ if (other.fTrace != null) {
+ return false;
+ }
+ } else if (!fTrace.equals(other.fTrace)) {
+ return false;
+ }
+ return true;
+ }
+
/*
* (non-Javadoc)
*
*/
@Override
public String toString() {
+ final long timestamp = fValue;
+ final Date d = new Date(timestamp / 1000000);
+ final DateFormat df = new SimpleDateFormat("HH:mm:ss."); //$NON-NLS-1$
+ final long nanos = (timestamp % 1000000000);
+ StringBuilder output = new StringBuilder();
+ output.append(df.format(d));
+ output.append(String.format("%09d", nanos)); //$NON-NLS-1$
+ return output.toString();
+ }
+
+ public String toFullDateString(){
final long timestamp = fValue;
final Date d = new Date(timestamp / 1000000);
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); //$NON-NLS-1$
super();
}
+ @SuppressWarnings("unused")
@Override
public void initTrace(String name, String path, Class<CtfTmfEvent> eventType)
throws FileNotFoundException {
* was not found or was not recognized as a CTF trace. Throw into
* the new type of exception expected by the rest of TMF.
*/
- System.err.println("Cannot find file " + path); //$NON-NLS-1$
throw new FileNotFoundException(e.getMessage());
}
this.iterator = new CtfIterator(this, 0, 0);
// this.fEndTime.clone()));
}
+ @SuppressWarnings("unused")
@Override
public void indexTrace(boolean waitForCompletion) {
+ // do nothing
}
@Override
TmfSignalManager.dispatchSignal(signal);
}
+ @SuppressWarnings("unused")
@Override
public boolean validate(IProject project, String path) {
try {
* FIXME merge with getNextEvent below once they both use the same parameter
* type.
*/
+ @SuppressWarnings("unused")
@Override
public CtfTmfEvent getNext(ITmfContext context) {
iterator.advance();
@Override
public ITmfContext seekLocation(ITmfLocation<?> location) {
- if (location == null) {
- location = new CtfLocation(0L);
+ CtfLocation currentLocation = (CtfLocation) location;
+ if (currentLocation == null) {
+ currentLocation = new CtfLocation(0L);
}
- iterator.setLocation(location);
+ iterator.setLocation(currentLocation);
return iterator;
}
@Override
public double getLocationRatio(ITmfLocation<?> location) {
- CtfIterator curLocation = (CtfIterator) location;
- return ((double) curLocation.getCurrentEvent().getTimestampValue() - curLocation
+ CtfLocation curLocation = (CtfLocation) location;
+ iterator.seek(curLocation.getLocation());
+ return ((double) iterator.getCurrentEvent().getTimestampValue() - iterator
.getStartTime())
- / (curLocation.getEndTime() - curLocation.getStartTime());
+ / (iterator.getEndTime() - iterator.getStartTime());
}
@Override
return iterator;
}
+ @SuppressWarnings("unused")
@Override
- public CtfTmfEvent getNextEvent(ITmfContext context) {
+ public CtfTmfEvent getNextEvent( ITmfContext context) {
iterator.advance();
return iterator.getCurrentEvent();
}
+ @SuppressWarnings("unused")
@Override
public CtfTmfEvent parseEvent(ITmfContext context) {
return iterator.getCurrentEvent();