statesystem: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / statesystem / core / statevalue / ITmfStateValue.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 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 * Alexandre Montplaisir - Initial API
11 ******************************************************************************/
12
13 package org.eclipse.tracecompass.statesystem.core.statevalue;
14
15 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
16
17 /**
18 * This is the interface for using state values and reading their contents.
19 *
20 * @author Alexandre Montplaisir
21 */
22 public interface ITmfStateValue extends Comparable<ITmfStateValue> {
23
24 /**
25 * The supported types of state values
26 */
27 public enum Type {
28 /** Null value, for an interval not carrying any information */
29 NULL,
30 /** 32-bit integer value */
31 INTEGER,
32 /** 64-bit integer value */
33 LONG,
34 /** IEEE 754 double precision number */
35 DOUBLE,
36 /** Variable-length string value */
37 STRING,
38 }
39
40 /**
41 * Each implementation has to define which one (among the supported types)
42 * they implement. There could be more than one implementation of each type,
43 * depending on the needs of the different users.
44 *
45 * @return The ITmfStateValue.Type enum representing the type of this value
46 */
47 Type getType();
48
49 /**
50 * Only "null values" should return true here
51 *
52 * @return True if this type of SV is considered "null", false if it
53 * contains a real value.
54 */
55 boolean isNull();
56
57 /**
58 * Read the contained value as an 'int' primitive
59 *
60 * @return The integer contained in the state value
61 * @throws StateValueTypeException
62 * If the contained value cannot be read as an integer
63 */
64 int unboxInt();
65
66 /**
67 * Read the contained value as a 'long' primitive
68 *
69 * @return The long contained in the state value
70 * @throws StateValueTypeException
71 * If the contained value cannot be read as a long
72 */
73 long unboxLong();
74
75 /**
76 * Read the contained value as a 'double' primitive
77 *
78 * @return The double contained in the state value
79 * @throws StateValueTypeException
80 * If the contained value cannot be read as a double
81 */
82 double unboxDouble();
83
84 /**
85 * Read the contained value as a String
86 *
87 * @return The String contained in the state value
88 * @throws StateValueTypeException
89 * If the contained value cannot be read as a String
90 */
91 String unboxStr();
92
93 }
This page took 0.034097 seconds and 5 git commands to generate.