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
CommitLineData
d04ec5a7 1/*******************************************************************************
60ae41e1 2 * Copyright (c) 2013, 2014 Ericsson
d04ec5a7
MK
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
2bdf0193 13package org.eclipse.tracecompass.tmf.core.project.model;
d04ec5a7 14
7709e228
MK
15import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
16
d04ec5a7
MK
17/**
18 * Trace import helper class
19 *
20 * @author Matthew Khouzam
d04ec5a7
MK
21 */
22public 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;
7709e228 75 if (!equalsNullable(fTraceToScan, other.fTraceToScan)) {
d04ec5a7
MK
76 return false;
77 }
7709e228 78 if(!equalsNullable(fTraceType, other.fTraceType)){
d04ec5a7
MK
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.069111 seconds and 5 git commands to generate.