/** *######################################################################### * * A component of the Gatherer application, part of the Greenstone digital * library suite from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * Author: John Thompson, Greenstone Digital Library, University of Waikato * * Copyright (C) 1999 New Zealand Digital Library Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *######################################################################## */ package org.greenstone.gatherer.util; /************************************************************************************** * Written: 04/07/03 * Revised: **************************************************************************************/ /** Like a boolean except with three states, true, false and undecided. */ public class Troolean { static final private byte FALSE = 0; static final private byte TRUE = 1; static final private byte UNDECIDED = -1; private byte state = UNDECIDED; public Troolean() { } public Troolean(boolean state) { set(state); } public boolean isDecided() { return (state != UNDECIDED); } public boolean isFalse() { return (state == FALSE); } public boolean isTrue() { return (state == TRUE); } public void reset() { state = UNDECIDED; } public void set(boolean state) { if(state) { this.state = TRUE; } else { this.state = FALSE; } } }