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