Commit | Line | Data |
---|---|---|
4208b510 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir | |
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 | ||
10 | package org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types; | |
11 | ||
12 | import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString; | |
13 | ||
14 | import org.eclipse.jdt.annotation.Nullable; | |
15 | ||
16 | class LamiBoolean extends LamiData { | |
17 | ||
18 | private static final LamiBoolean TRUE = new LamiBoolean(true); | |
19 | private static final LamiBoolean FALSE = new LamiBoolean(false); | |
20 | ||
21 | public static LamiBoolean instance(boolean value) { | |
22 | return (value ? TRUE : FALSE); | |
23 | } | |
24 | ||
25 | private final boolean fValue; | |
26 | ||
27 | private LamiBoolean(boolean value) { | |
28 | fValue = value; | |
29 | } | |
30 | ||
31 | public boolean getValue() { | |
32 | return fValue; | |
33 | } | |
34 | ||
35 | @Override | |
36 | public @Nullable String toString() { | |
37 | return (fValue ? | |
38 | nullToEmptyString(Messages.LamiBoolean_Yes) : | |
39 | nullToEmptyString(Messages.LamiBoolean_No)); | |
40 | } | |
41 | } |