Merge branch 'lttng-kepler'
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomTxtTraceContext.java
1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
14
15 import java.util.regex.Matcher;
16
17 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
18 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
19 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
20
21 public class CustomTxtTraceContext extends TmfContext {
22 public Matcher firstLineMatcher;
23 public String firstLine;
24 public long nextLineLocation;
25 public InputLine inputLine;
26
27 public CustomTxtTraceContext(ITmfLocation location, long rank) {
28 super(location, rank);
29 }
30
31 /* (non-Javadoc)
32 * @see java.lang.Object#hashCode()
33 */
34 @Override
35 public int hashCode() {
36 final int prime = 31;
37 int result = super.hashCode();
38 result = prime * result + ((firstLine == null) ? 0 : firstLine.hashCode());
39 result = prime * result + ((firstLineMatcher == null) ? 0 : firstLineMatcher.hashCode());
40 result = prime * result + ((inputLine == null) ? 0 : inputLine.hashCode());
41 result = prime * result + (int) (nextLineLocation ^ (nextLineLocation >>> 32));
42 return result;
43 }
44
45 /* (non-Javadoc)
46 * @see java.lang.Object#equals(java.lang.Object)
47 */
48 @Override
49 public boolean equals(Object obj) {
50 if (this == obj) {
51 return true;
52 }
53 if (!super.equals(obj)) {
54 return false;
55 }
56 if (!(obj instanceof CustomTxtTraceContext)) {
57 return false;
58 }
59 CustomTxtTraceContext other = (CustomTxtTraceContext) obj;
60 if (firstLine == null) {
61 if (other.firstLine != null) {
62 return false;
63 }
64 } else if (!firstLine.equals(other.firstLine)) {
65 return false;
66 }
67 if (firstLineMatcher == null) {
68 if (other.firstLineMatcher != null) {
69 return false;
70 }
71 } else if (!firstLineMatcher.equals(other.firstLineMatcher)) {
72 return false;
73 }
74 if (inputLine == null) {
75 if (other.inputLine != null) {
76 return false;
77 }
78 } else if (!inputLine.equals(other.inputLine)) {
79 return false;
80 }
81 if (nextLineLocation != other.nextLineLocation) {
82 return false;
83 }
84 return true;
85 }
86
87 }
This page took 0.041533 seconds and 6 git commands to generate.