1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.primitives;
14 public class MutableBoolean implements Comparable<MutableBoolean> {
18 public MutableBoolean() {}
20 public MutableBoolean(boolean value) { this.value = value; }
22 public boolean getValue() {
26 public void setValue(boolean newValue) {
27 this.value = newValue;
30 public boolean booleanValue() {
34 public int compareTo(MutableBoolean b) {
35 return (b.value == value ? 0 : (value ? 1 : -1));
38 public int hashCode() {
39 return value ? 1231 : 1237;
42 public boolean equals(Object obj) {
43 if (obj == null) return false;
44 if (obj == this) return true;
46 if (obj instanceof MutableBoolean) {
47 return value == ((MutableBoolean)obj).booleanValue();
53 public String toString() {
54 return value ? "true" : "false";