KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > util > MutableBoolean


1 package org.tigris.scarab.util;
2 /* ================================================================
3  * Copyright (c) 2000-2002 CollabNet. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * 3. The end-user documentation included with the redistribution, if
17  * any, must include the following acknowlegement: "This product includes
18  * software developed by Collab.Net <http://www.Collab.Net/>."
19  * Alternately, this acknowlegement may appear in the software itself, if
20  * and wherever such third-party acknowlegements normally appear.
21  *
22  * 4. The hosted project names must not be used to endorse or promote
23  * products derived from this software without prior written
24  * permission. For written permission, please contact info@collab.net.
25  *
26  * 5. Products derived from this software may not use the "Tigris" or
27  * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
28  * prior written permission of Collab.Net.
29  *
30  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
31  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33  * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
34  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
36  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
38  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  *
42  * ====================================================================
43  *
44  * This software consists of voluntary contributions made by many
45  * individuals on behalf of Collab.Net.
46  */

47
48 /**
49  * This class represents a mutable boolean, i.e. you can
50  * set it's state after creation.
51  * @author <a HREF="mailto:dabbous@saxess.com">Hussayn Dabbous</a>
52  */

53 public class MutableBoolean
54 {
55
56     /**
57      * The boolean state (true/false)
58      */

59     boolean state=false;
60  
61
62     /**
63      * The constructor defines the initial state of the instance.
64      * @param theState
65      */

66     public MutableBoolean(boolean theState)
67     {
68         this.set(theState);
69     }
70
71
72     /**
73      * Set the internal state to true/false
74      * @param theState
75      */

76     public void set(boolean theState)
77     {
78         this.state = theState;
79     }
80     
81
82     /**
83      * Get the internal state.
84      * @return
85      */

86     public boolean booleanValue()
87     {
88         return this.state;
89     }
90
91 }
92
Popular Tags