-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- *\r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;\r
-\r
-import java.util.regex.Matcher;\r
-\r
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;\r
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;\r
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfEventType;\r
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
-\r
-public class CustomTxtEvent extends CustomEvent {\r
-\r
- public CustomTxtEvent(CustomTxtTraceDefinition definition) {\r
- super(definition);\r
- setType(new CustomTxtEventType(definition));\r
- }\r
-\r
- public CustomTxtEvent(CustomTxtTraceDefinition definition, TmfEvent other) {\r
- super(definition, other);\r
- }\r
-\r
- public CustomTxtEvent(CustomTxtTraceDefinition definition, ITmfTrace parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) {\r
- super(definition, parentTrace, timestamp, source, type, reference);\r
- }\r
-\r
- @Override\r
- public void setContent(ITmfEventField content) {\r
- super.setContent(content);\r
- }\r
-\r
- public void processGroups(InputLine input, Matcher matcher) {\r
- if (input.columns == null) {\r
- return;\r
- }\r
- for (int i = 0; i < input.columns.size(); i++) {\r
- InputData column = input.columns.get(i);\r
- if (i < matcher.groupCount() && matcher.group(i + 1) != null) {\r
- String value = matcher.group(i + 1).trim();\r
- if (value.length() == 0) {\r
- continue;\r
- }\r
- String name = column.name;\r
- if (column.action == CustomTraceDefinition.ACTION_SET) {\r
- fData.put(name, value);\r
- if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
- fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);\r
- }\r
- } else if (column.action == CustomTraceDefinition.ACTION_APPEND) {\r
- String s = fData.get(name);\r
- if (s != null) {\r
- fData.put(name, s + value);\r
- } else {\r
- fData.put(name, value);\r
- }\r
- if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
- String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r
- if (timeStampInputFormat != null) {\r
- fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + column.format);\r
- } else {\r
- fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);\r
- }\r
- }\r
- } else if (column.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
- String s = fData.get(name);\r
- if (s != null) {\r
- fData.put(name, s + " | " + value); //$NON-NLS-1$\r
- } else {\r
- fData.put(name, value);\r
- }\r
- if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
- String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r
- if (timeStampInputFormat != null) {\r
- fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + column.format); //$NON-NLS-1$\r
- } else {\r
- fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010 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:
+ * Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
+
+import java.util.regex.Matcher;
+
+import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;
+import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+public class CustomTxtEvent extends CustomEvent {
+
+ public CustomTxtEvent(CustomTxtTraceDefinition definition) {
+ super(definition);
+ setType(new CustomTxtEventType(definition));
+ }
+
+ public CustomTxtEvent(CustomTxtTraceDefinition definition, TmfEvent other) {
+ super(definition, other);
+ }
+
+ public CustomTxtEvent(CustomTxtTraceDefinition definition, ITmfTrace parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) {
+ super(definition, parentTrace, timestamp, source, type, reference);
+ }
+
+ @Override
+ public void setContent(ITmfEventField content) {
+ super.setContent(content);
+ }
+
+ public void processGroups(InputLine input, Matcher matcher) {
+ if (input.columns == null) {
+ return;
+ }
+ for (int i = 0; i < input.columns.size(); i++) {
+ InputData column = input.columns.get(i);
+ if (i < matcher.groupCount() && matcher.group(i + 1) != null) {
+ String value = matcher.group(i + 1).trim();
+ if (value.length() == 0) {
+ continue;
+ }
+ String name = column.name;
+ if (column.action == CustomTraceDefinition.ACTION_SET) {
+ fData.put(name, value);
+ if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);
+ }
+ } else if (column.action == CustomTraceDefinition.ACTION_APPEND) {
+ String s = fData.get(name);
+ if (s != null) {
+ fData.put(name, s + value);
+ } else {
+ fData.put(name, value);
+ }
+ if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
+ if (timeStampInputFormat != null) {
+ fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + column.format);
+ } else {
+ fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);
+ }
+ }
+ } else if (column.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
+ String s = fData.get(name);
+ if (s != null) {
+ fData.put(name, s + " | " + value); //$NON-NLS-1$
+ } else {
+ fData.put(name, value);
+ }
+ if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
+ if (timeStampInputFormat != null) {
+ fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + column.format); //$NON-NLS-1$
+ } else {
+ fData.put(TIMESTAMP_INPUT_FORMAT_KEY, column.format);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}