tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomTxtTraceContext.java
index 660f61c83df7a2ce43fb4497f708dfee7e441521..741ce53e1f3ffab08b4ddc689e3917a57cbfe7e4 100644 (file)
-/*******************************************************************************\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.io.IOException;\r
-import java.util.regex.Matcher;\r
-\r
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;\r
-import org.eclipse.linuxtools.tmf.core.io.BufferedRandomAccessFile;\r
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;\r
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;\r
-\r
-public class CustomTxtTraceContext extends TmfContext {\r
-    public BufferedRandomAccessFile raFile;\r
-    public Matcher firstLineMatcher;\r
-    public String firstLine;\r
-    public long nextLineLocation;\r
-    public InputLine inputLine;\r
-\r
-    public CustomTxtTraceContext(ITmfLocation<?> location, long rank) {\r
-        super(location, rank);\r
-    }\r
-\r
-    @Override\r
-    public void dispose() {\r
-        if (raFile != null) {\r
-            try {\r
-                raFile.close();\r
-            } catch (IOException e) {\r
-            }\r
-        }\r
-        super.dispose();\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 + ((firstLine == null) ? 0 : firstLine.hashCode());\r
-        result = prime * result + ((firstLineMatcher == null) ? 0 : firstLineMatcher.hashCode());\r
-        result = prime * result + ((inputLine == null) ? 0 : inputLine.hashCode());\r
-        result = prime * result + (int) (nextLineLocation ^ (nextLineLocation >>> 32));\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 CustomTxtTraceContext)) {\r
-            return false;\r
-        }\r
-        CustomTxtTraceContext other = (CustomTxtTraceContext) obj;\r
-        if (firstLine == null) {\r
-            if (other.firstLine != null) {\r
-                return false;\r
-            }\r
-        } else if (!firstLine.equals(other.firstLine)) {\r
-            return false;\r
-        }\r
-        if (firstLineMatcher == null) {\r
-            if (other.firstLineMatcher != null) {\r
-                return false;\r
-            }\r
-        } else if (!firstLineMatcher.equals(other.firstLineMatcher)) {\r
-            return false;\r
-        }\r
-        if (inputLine == null) {\r
-            if (other.inputLine != null) {\r
-                return false;\r
-            }\r
-        } else if (!inputLine.equals(other.inputLine)) {\r
-            return false;\r
-        }\r
-        if (nextLineLocation != other.nextLineLocation) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 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.InputLine;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+
+/**
+ * Trace context for custom text traces.
+ *
+ * @author Patrick Tassé
+ */
+public class CustomTxtTraceContext extends TmfContext {
+
+    /** Regex matcher for the first line of the trace */
+    public Matcher firstLineMatcher;
+
+    /** First line of the text file */
+    public String firstLine;
+
+    /** Position in the file where the 'current' next line is */
+    public long nextLineLocation;
+
+    /** InputLine object for the currently read line */
+    public InputLine inputLine;
+
+    /**
+     * Constructor.
+     *
+     * @param location
+     *            Location in the trace
+     * @param rank
+     *            Rank of the event at this location
+     */
+    public CustomTxtTraceContext(ITmfLocation location, long rank) {
+        super(location, rank);
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((firstLine == null) ? 0 : firstLine.hashCode());
+        result = prime * result + ((firstLineMatcher == null) ? 0 : firstLineMatcher.hashCode());
+        result = prime * result + ((inputLine == null) ? 0 : inputLine.hashCode());
+        result = prime * result + (int) (nextLineLocation ^ (nextLineLocation >>> 32));
+        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 CustomTxtTraceContext)) {
+            return false;
+        }
+        CustomTxtTraceContext other = (CustomTxtTraceContext) obj;
+        if (firstLine == null) {
+            if (other.firstLine != null) {
+                return false;
+            }
+        } else if (!firstLine.equals(other.firstLine)) {
+            return false;
+        }
+        if (firstLineMatcher == null) {
+            if (other.firstLineMatcher != null) {
+                return false;
+            }
+        } else if (!firstLineMatcher.equals(other.firstLineMatcher)) {
+            return false;
+        }
+        if (inputLine == null) {
+            if (other.inputLine != null) {
+                return false;
+            }
+        } else if (!inputLine.equals(other.inputLine)) {
+            return false;
+        }
+        if (nextLineLocation != other.nextLineLocation) {
+            return false;
+        }
+        return true;
+    }
+
 }
\ No newline at end of file
This page took 0.026562 seconds and 5 git commands to generate.