package org.eclipse.tracecompass.ctf.core.event.types;
+import java.nio.ByteOrder;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
*
* @since 1.1
*/
- public static class Pair {
+ public static final class Pair {
private final long fFirst;
private final long fSecond;
return fContainerType.getMaximumSize();
}
+ /**
+ * @since 2.0
+ */
+ @Override
+ public boolean isByteOrderSet() {
+ return fContainerType.isByteOrderSet();
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public ByteOrder getByteOrder() {
+ return fContainerType.getByteOrder();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
return fTable.add(low, high, label);
}
+ /**
+ * Add a value. Do not overlap, this is <em><strong>not</strong></em> an
+ * interval tree. This could be seen more as a collection of segments.
+ *
+ * @param label
+ * the name of the value.
+ * @return was the value be added? true == success
+ * @since 2.0
+ */
+ public boolean add(@Nullable String label) {
+ fLabels.add(label);
+ return fTable.add(label);
+ }
+
/**
* Check if the label for a value (enum a{day=0,night=1} would return "day"
* for query(0)
public EnumTable() {
}
+ public synchronized boolean add(@Nullable String label) {
+ LabelAndRange lastAdded = ranges.isEmpty() ? new LabelAndRange(-1, -1, "") : ranges.get(ranges.size() - 1); //$NON-NLS-1$
+ return add(lastAdded.low + 1, lastAdded.high + 1, label);
+ }
+
public synchronized boolean add(long low, long high, @Nullable String label) {
LabelAndRange newRange = new LabelAndRange(low, high, label);
}
sb.append("type:").append(fContainerType.toString()); //$NON-NLS-1$
sb.append(']');
- String string = sb.toString();
- if (string == null) {
- throw new IllegalStateException();
- }
- return string;
+ return sb.toString();
}
@Override