analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / 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 static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
16
17 /**
18 * Trace import helper class
19 *
20 * @author Matthew Khouzam
21 */
22 public class TraceValidationHelper implements Comparable<TraceValidationHelper> {
23
24 private final String fTraceToScan;
25 private final String fTraceType;
26
27 /**
28 * Trace To validate constructor
29 *
30 * @param traceToScan
31 * the path of the trace
32 * @param traceType
33 * the trace type of the trace to add (canonical name)
34 */
35 public TraceValidationHelper(String traceToScan, String traceType) {
36 this.fTraceToScan = traceToScan;
37 this.fTraceType = traceType;
38 }
39
40 /**
41 * @return the trace filename
42 */
43 public String getTraceToScan() {
44 return fTraceToScan;
45 }
46
47 /**
48 * @return the trace type canonical name
49 */
50 public String getTraceType() {
51 return fTraceType;
52 }
53
54 @Override
55 public int hashCode() {
56 final int prime = 31;
57 int result = 1;
58 result = prime * result + ((fTraceToScan == null) ? 0 : fTraceToScan.hashCode());
59 result = prime * result + ((fTraceType == null) ? 0 : fTraceType.hashCode());
60 return result;
61 }
62
63 @Override
64 public boolean equals(Object obj) {
65 if (this == obj) {
66 return true;
67 }
68 if (obj == null) {
69 return false;
70 }
71 if (!(obj instanceof TraceValidationHelper)) {
72 return false;
73 }
74 TraceValidationHelper other = (TraceValidationHelper) obj;
75 if (!equalsNullable(fTraceToScan, other.fTraceToScan)) {
76 return false;
77 }
78 if(!equalsNullable(fTraceType, other.fTraceType)){
79 return false;
80 }
81 return true;
82 }
83
84 @Override
85 public int compareTo(TraceValidationHelper o) {
86 int retVal = fTraceToScan.compareTo(o.getTraceToScan());
87 if (retVal == 0) {
88 retVal = fTraceType.compareTo(o.fTraceType);
89 }
90 return retVal;
91 }
92 }
This page took 0.045065 seconds and 6 git commands to generate.