Commit | Line | Data |
---|---|---|
bcb8c2cb PT |
1 | /******************************************************************************* |
2 | * Copyright (c) 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 | * Patrick Tasse - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.trace; |
bcb8c2cb PT |
14 | |
15 | import org.eclipse.core.runtime.Status; | |
16 | ||
17 | /** | |
18 | * A class representing the validation status of a trace against a particular | |
19 | * trace type. | |
bcb8c2cb PT |
20 | */ |
21 | public class TraceValidationStatus extends Status { | |
22 | ||
23 | private int fConfidence; | |
24 | ||
25 | /** | |
26 | * Construct a successful validation status with a confidence level | |
27 | * | |
d16bb0dd BH |
28 | * @param confidence |
29 | * the confidence level, 0 is lowest | |
30 | * @param pluginId | |
31 | * the unique identifier of the relevant plug-in | |
bcb8c2cb PT |
32 | */ |
33 | public TraceValidationStatus(int confidence, String pluginId) { | |
d16bb0dd BH |
34 | this(confidence, OK, pluginId, OK_STATUS.getMessage(), null); |
35 | } | |
36 | ||
37 | /** | |
38 | * Full constructor for construct a validation status with a confidence | |
39 | * level, severity and exception | |
40 | * | |
41 | * @param confidence | |
42 | * the confidence level, 0 is lowest | |
43 | * @param severity | |
44 | * the severity; one of <code>OK</code>, <code>ERROR</code>, | |
45 | * <code>INFO</code>, <code>WARNING</code>, or | |
46 | * <code>CANCEL</code> | |
47 | * @param pluginId | |
48 | * the unique identifier of the relevant plug-in | |
49 | * @param message | |
50 | * a human-readable message, localized to the current locale | |
51 | * @param exception | |
52 | * a low-level exception, or <code>null</code> if not applicable | |
53 | * @since 1.0 | |
54 | */ | |
55 | public TraceValidationStatus(int confidence, int severity, String pluginId, String message, Throwable exception) { | |
56 | super(severity, pluginId, message, exception); | |
bcb8c2cb PT |
57 | if (confidence < 0) { |
58 | throw new IllegalArgumentException(); | |
59 | } | |
60 | fConfidence = confidence; | |
61 | } | |
62 | ||
63 | /** | |
64 | * Gets the confidence level | |
65 | * | |
66 | * @return the confidence level, 0 is lowest | |
67 | */ | |
68 | public int getConfidence() { | |
69 | return fConfidence; | |
70 | } | |
71 | } |