29ce22be8f76ef35ad1910490808f01c0326ea0c
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / project / model / TraceValidationHelper.java
1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 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 * Matthew Khouzam - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.core.project.model;
14
15 import java.util.Objects;
16
17 /**
18 * Trace import helper class
19 *
20 * @author Matthew Khouzam
21 * @deprecated Use TmfTraceType.getTraceTypeHelpers and
22 * {@link TraceTypeHelper#validate(String)} or
23 * {@link TraceTypeHelper#validateWithConfidence(String)}
24 */
25 @Deprecated
26 public class TraceValidationHelper implements Comparable<TraceValidationHelper> {
27
28 private final String fTraceToScan;
29 private final String fTraceType;
30
31 /**
32 * Trace To validate constructor
33 *
34 * @param traceToScan
35 * the path of the trace
36 * @param traceType
37 * the trace type of the trace to add (canonical name)
38 */
39 public TraceValidationHelper(String traceToScan, String traceType) {
40 this.fTraceToScan = traceToScan;
41 this.fTraceType = traceType;
42 }
43
44 /**
45 * @return the trace filename
46 */
47 public String getTraceToScan() {
48 return fTraceToScan;
49 }
50
51 /**
52 * @return the trace type canonical name
53 */
54 public String getTraceType() {
55 return fTraceType;
56 }
57
58 @Override
59 public int hashCode() {
60 final int prime = 31;
61 int result = 1;
62 result = prime * result + ((fTraceToScan == null) ? 0 : fTraceToScan.hashCode());
63 result = prime * result + ((fTraceType == null) ? 0 : fTraceType.hashCode());
64 return result;
65 }
66
67 @Override
68 public boolean equals(Object obj) {
69 if (this == obj) {
70 return true;
71 }
72 if (obj == null) {
73 return false;
74 }
75 if (!(obj instanceof TraceValidationHelper)) {
76 return false;
77 }
78 TraceValidationHelper other = (TraceValidationHelper) obj;
79 if (!Objects.equals(fTraceToScan, other.fTraceToScan)) {
80 return false;
81 }
82 if(!Objects.equals(fTraceType, other.fTraceType)){
83 return false;
84 }
85 return true;
86 }
87
88 @Override
89 public int compareTo(TraceValidationHelper o) {
90 int retVal = fTraceToScan.compareTo(o.getTraceToScan());
91 if (retVal == 0) {
92 retVal = fTraceType.compareTo(o.fTraceType);
93 }
94 return retVal;
95 }
96 }
This page took 0.032131 seconds and 4 git commands to generate.