1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
6 * All rights reserved. This program and the accompanying materials are
7 * made available under the terms of the Eclipse Public License v1.0 which
8 * accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
18 * A state value that contains no particular value. It is sometimes needed over
19 * a "null" reference, since we avoid NPE's this way.
21 * It can also be read either as a String ("nullValue") or an Integer (-1).
24 * @author Alexandre Montplaisir
26 final class NullStateValue
extends TmfStateValue
{
28 private static final byte[] EMPTY_ARRAY
= new byte[0];
29 private static final String STR_VALUE
= "nullValue"; //$NON-NLS-1$
32 public Type
getType() {
37 public boolean isNull() {
42 public boolean equals(@Nullable Object object
) {
43 return (object
instanceof NullStateValue
);
47 public int hashCode() {
52 public String
toString() {
57 public byte[] serialize() {
61 // ------------------------------------------------------------------------
62 // Unboxing methods. Null values can be unboxed into any type.
63 // ------------------------------------------------------------------------
66 public int unboxInt() {
71 public long unboxLong() {
76 public double unboxDouble() {
81 public String
unboxStr() {
86 public int compareTo(@Nullable ITmfStateValue other
) {
88 throw new IllegalArgumentException();
90 if (other
instanceof NullStateValue
) {
94 * For every other state value type, we defer to how that type wants to
95 * be compared against null values.
97 return -(other
.compareTo(this));
This page took 0.034659 seconds and 5 git commands to generate.