merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / runner / convwatch / TriState.java
blobba4504bbc7d42506da60a728939b34ac89a505a2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TriState.java,v $
10 * $Revision: 1.3.8.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package convwatch;
33 public class TriState
35 public static final TriState TRUE = new TriState(1);
36 public static final TriState FALSE = new TriState(0);
37 public static final TriState UNSET = new TriState(-1);
39 int m_nValue;
41 /**
42 Allocates a <code>TriState</code> object representing the
43 <code>value</code> argument.
45 @param value the value of the <code>TriState</code>.
47 public TriState(int value)
49 m_nValue = value;
52 /**
53 Returns the value of this TriState object as an int
54 * @return the primitive <code>int</code> value of this object.
56 public int intValue()
58 return m_nValue;
60 /**
61 Returns <code>true</code> if and only if the argument is not
62 <code>null</code> and is a <code>TriState</code> object that
63 contains the same <code>int</code> value as this object.
65 @param obj the object to compare with.
66 @return <code>true</code> if the objects are the same;
67 <code>false</code> otherwise.
70 public boolean equals(Object obj)
72 if ((obj != null) &&
73 (obj instanceof TriState))
75 return m_nValue == ((TriState)obj).intValue();
77 return false;