Internalize some more TMF APIs
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomXmlTraceContext.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.io.IOException;
16
17 import org.eclipse.linuxtools.tmf.core.io.BufferedRandomAccessFile;
18 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
19 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
20
21 public class CustomXmlTraceContext extends TmfContext {
22 public BufferedRandomAccessFile raFile;
23
24 public CustomXmlTraceContext(ITmfLocation<?> location, long rank) {
25 super(location, rank);
26 }
27
28 @Override
29 public void dispose() {
30 if (raFile != null) {
31 try {
32 raFile.close();
33 } catch (IOException e) {
34 }
35 }
36 super.dispose();
37 }
38
39 /* (non-Javadoc)
40 * @see java.lang.Object#hashCode()
41 */
42 @Override
43 public int hashCode() {
44 final int prime = 31;
45 int result = super.hashCode();
46 result = prime * result + ((raFile == null) ? 0 : raFile.hashCode());
47 return result;
48 }
49
50 /* (non-Javadoc)
51 * @see java.lang.Object#equals(java.lang.Object)
52 */
53 @Override
54 public boolean equals(Object obj) {
55 if (this == obj) {
56 return true;
57 }
58 if (!super.equals(obj)) {
59 return false;
60 }
61 if (!(obj instanceof CustomXmlTraceContext)) {
62 return false;
63 }
64 CustomXmlTraceContext other = (CustomXmlTraceContext) obj;
65 if (raFile == null) {
66 if (other.raFile != null) {
67 return false;
68 }
69 } else if (!raFile.equals(other.raFile)) {
70 return false;
71 }
72 return true;
73 }
74
75 }
This page took 0.035336 seconds and 6 git commands to generate.