// clone
// ------------------------------------------------------------------------
- public void testClone() throws Exception {
- ITmfEventField clone = fStructTerminalField1.clone();
- assertEquals("clone", fStructTerminalField1, clone);
-
- clone = fField1.clone();
+ public void testFieldClone() throws Exception {
+ TmfEventField clone = fField1.clone();
+ assertTrue("clone", fField1.clone().equals(fField1));
+ assertTrue("clone", clone.clone().equals(clone));
assertEquals("clone", fField1, clone);
+ assertEquals("clone", clone, fField1);
clone = fRootField.clone();
+ assertTrue("clone", fRootField.clone().equals(fRootField));
+ assertTrue("clone", clone.clone().equals(clone));
assertEquals("clone", fRootField, clone);
+ assertEquals("clone", clone, fRootField);
+ }
+
+ public void testStructFieldClone() throws Exception {
+ TmfEventField clone = fStructTerminalField1.clone();
+ assertTrue("clone", fStructTerminalField1.clone().equals(fStructTerminalField1));
+ assertTrue("clone", clone.clone().equals(clone));
+ assertEquals("clone", fStructTerminalField1, clone);
+ assertEquals("clone", clone, fStructTerminalField1);
clone = fStructRootField.clone();
+ assertTrue("clone", fStructRootField.clone().equals(fStructRootField));
+ assertTrue("clone", clone.clone().equals(clone));
assertEquals("clone", fStructRootField, clone);
+ assertEquals("clone", clone, fStructRootField);
}
// ------------------------------------------------------------------------
private final ITmfEventField fContent1 = new TmfEventField(fRawContent1, fFields1);
private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, 2, 5);
private final String fReference1 = "Some reference";
- private final TmfEvent fEvent1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
+ private final ITmfEvent fEvent1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
private final Object fValue2a = "Another string";
private final Object fValue2b = Integer.valueOf(-4);
private final ITmfEventField fContent2 = new TmfEventField(fRawContent2, fFields2);
private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, 2, 5);
private final String fReference2 = "Some other reference";
- private final TmfEvent fEvent2 = new TmfEvent(null, 1, fTimestamp2, fSource, fType, fContent2, fReference2);
+ private final ITmfEvent fEvent2 = new TmfEvent(null, 1, fTimestamp2, fSource, fType, fContent2, fReference2);
private final String fTracePath = "testfiles" + File.separator + "A-Test-10K";
private class TestEvent extends TmfEvent {
- public TestEvent(TmfEvent event) {
+ public TestEvent(ITmfEvent event) {
super(event);
}
}
}
- public void testClone() throws Exception {
+ public void testClone1() throws Exception {
ITmfEvent clone = fEvent1.clone();
+
+ assertTrue("clone", fEvent1.clone().equals(fEvent1));
+ assertTrue("clone", clone.clone().equals(clone));
+
assertEquals("clone", fEvent1, clone);
+ assertEquals("clone", clone, fEvent1);
}
public void testClone2() throws Exception {
- ITmfEvent event = new MyEvent();
- ITmfEvent clone = event.clone();
+ TmfEvent event = new MyEvent();
+ TmfEvent clone = event.clone();
+
+ assertTrue("clone", event.clone().equals(event));
+ assertTrue("clone", clone.clone().equals(clone));
+
+ assertEquals("clone", event, clone);
assertEquals("clone", clone, event);
}
private final String[] fLabels1 = new String[] { fLabel0, fLabel1 };
private final String[] fLabels2 = new String[] { fLabel1, fLabel0, fLabel1 };
- private final TmfEventType fType0 = new TmfEventType(fContext1, fTypeId1, TmfEventField.makeRoot(fLabels0));
- private final TmfEventType fType1 = new TmfEventType(fContext1, fTypeId2, TmfEventField.makeRoot(fLabels1));
- private final TmfEventType fType2 = new TmfEventType(fContext2, fTypeId1, TmfEventField.makeRoot(fLabels2));
- private final TmfEventType fType3 = new TmfEventType(fContext2, fTypeId2, TmfEventField.makeRoot(fLabels1));
+ private final ITmfEventType fType0 = new TmfEventType(fContext1, fTypeId1, TmfEventField.makeRoot(fLabels0));
+ private final ITmfEventType fType1 = new TmfEventType(fContext1, fTypeId2, TmfEventField.makeRoot(fLabels1));
+ private final ITmfEventType fType2 = new TmfEventType(fContext2, fTypeId1, TmfEventField.makeRoot(fLabels2));
+ private final ITmfEventType fType3 = new TmfEventType(fContext2, fTypeId2, TmfEventField.makeRoot(fLabels1));
// ------------------------------------------------------------------------
// Housekeeping
public void testClone() throws Exception {
ITmfEventType clone = fType1.clone();
+
+ assertTrue("clone", fType1.clone().equals(fType1));
+ assertTrue("clone", clone.clone().equals(clone));
+
+ assertEquals("clone", clone, fType1);
assertEquals("clone", fType1, clone);
}
public void testClone2() throws Exception {
ITmfEventType type = new TmfEventType();
ITmfEventType clone = type.clone();
+
+ assertTrue("clone", type.clone().equals(type));
+ assertTrue("clone", clone.clone().equals(clone));
+
assertEquals("clone", clone, type);
+ assertEquals("clone", type, clone);
}
// ------------------------------------------------------------------------
}
public void testClone() throws Exception {
- ITmfTimestamp timestamp = ts0.clone();
- assertEquals("clone", timestamp, ts0);
+ ITmfTimestamp clone = ts0.clone();
+
+ assertTrue("clone", ts0.clone().equals(ts0));
+ assertTrue("clone", clone.clone().equals(clone));
+
+ assertEquals("clone", clone, ts0);
+ assertEquals("clone", ts0, clone);
}
public void testClone2() throws Exception {
MyTimestamp timestamp = new MyTimestamp();
MyTimestamp clone = timestamp.clone();
+
+ assertTrue("clone", timestamp.clone().equals(timestamp));
+ assertTrue("clone", clone.clone().equals(clone));
+
assertEquals("clone", clone, timestamp);
+ assertEquals("clone", timestamp, clone);
}
// ------------------------------------------------------------------------
TmfTimeRange range = new TmfTimeRange(ts1, ts2);
TmfTimeRange clone = range.clone();
+ assertTrue("clone", range.clone().equals(range));
+ assertTrue("clone", clone.clone().equals(clone));
+
assertEquals("clone", range, clone);
assertEquals("clone", ts1, clone.getStartTime());
assertEquals("clone", ts2, clone.getEndTime());
public void testClone() throws Exception {
ITmfTimestamp clone = ts0.clone();
+
+ assertTrue("clone", ts0.clone().equals(ts0));
+ assertTrue("clone", clone.clone().equals(clone));
+
assertEquals("clone", clone, ts0);
+ assertEquals("clone", ts0, clone);
}
public void testClone2() throws Exception {
MyTimestamp timestamp = new MyTimestamp();
MyTimestamp clone = timestamp.clone();
+
+ assertTrue("clone", timestamp.clone().equals(timestamp));
+ assertTrue("clone", clone.clone().equals(clone));
+
assertEquals("clone", clone, timestamp);
+ assertEquals("clone", timestamp, clone);
}
// ------------------------------------------------------------------------
*
* @param type the other type
*/
- public TmfEventType(TmfEventType type) {
+ public TmfEventType(ITmfEventType type) {
if (type == null)
throw new IllegalArgumentException();
- fContext = type.fContext;
- fTypeId = type.fTypeId;
- fRootField = type.fRootField;
+ fContext = type.getContext();
+ fTypeId = type.getName();
+ fRootField = type.getRootField();
}
// ------------------------------------------------------------------------
\r
import java.text.ParseException;\r
import java.text.SimpleDateFormat;\r
+import java.util.Arrays;\r
import java.util.Date;\r
import java.util.HashMap;\r
import java.util.Map;\r
fData = null;\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see java.lang.Object#hashCode()\r
+ */\r
+ @Override\r
+ public int hashCode() {\r
+ final int prime = 31;\r
+ int result = super.hashCode();\r
+ result = prime * result + ((fDefinition == null) ? 0 : fDefinition.hashCode());\r
+ return result;\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see java.lang.Object#equals(java.lang.Object)\r
+ */\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ if (this == obj) {\r
+ return true;\r
+ }\r
+ if (!super.equals(obj)) {\r
+ return false;\r
+ }\r
+ if (!(obj instanceof CustomEvent)) {\r
+ return false;\r
+ }\r
+ CustomEvent other = (CustomEvent) obj;\r
+ if (fDefinition == null) {\r
+ if (other.fDefinition != null) {\r
+ return false;\r
+ }\r
+ } else if (!fDefinition.equals(other.fDefinition)) {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
}\r
\r
@Override\r
public void setContent(ITmfEventField content) {\r
- setContent(content);\r
+ super.setContent(content);\r
}\r
\r
public void processGroups(InputLine input, Matcher matcher) {\r
\r
@Override\r
public void setContent(ITmfEventField content) {\r
- setContent(content);\r
+ super.setContent(content);\r
}\r
\r
public void parseInput(String value, String name, int inputAction, String inputFormat) {\r