--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.segmentstore.core;
+
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * A segment with fields
+ *
+ * @author Matthew Khouzam
+ * @since 1.2
+ */
+public interface IContentSegment extends ISegment {
+
+ /**
+ * Get the content, like an event
+ *
+ * @return a Map of key values
+ */
+ Map<@NonNull String, @NonNull ?> getContent();
+}
import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.segmentstore.core.IContentSegment;
import org.eclipse.tracecompass.segmentstore.core.ISegment;
import org.eclipse.tracecompass.segmentstore.core.segment.interfaces.INamedSegment;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
*
* @author Jean-Christian Kouame
*/
-public class TmfXmlPatternSegment implements INamedSegment {
+public class TmfXmlPatternSegment implements INamedSegment, IContentSegment {
/**
* The serial version UID
private final int fScale;
private final long fStart;
private final long fEnd;
- private final String fSegmentName;
- private transient Map<@NonNull String, @NonNull ITmfStateValue> fContent;
+ private final @NonNull String fSegmentName;
+ private transient @NonNull Map<@NonNull String, @NonNull ITmfStateValue> fContent;
/**
* Constructs an XML pattern segment
fStart = start;
fEnd = end;
fScale = scale;
- fSegmentName = segmentName;
+ fSegmentName = String.valueOf(segmentName);
fContent = Collections.unmodifiableMap(fields);
}
/**
* Get the content of the pattern segment
+ *
* @return The content
*/
+ @Override
public Map<@NonNull String, @NonNull ITmfStateValue> getContent() {
return fContent;
}
/**
* Get the timestamp scale of the pattern segment
+ *
* @return The timestamp scale
*/
public int getScale() {
if (ret != 0) {
return ret;
}
+ ret = IContentSegment.super.compareTo(o);
+ if (ret != 0) {
+ return ret;
+ }
return toString().compareTo(o.toString());
}