KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportcalculator > SharedBoolean


1 package com.calipso.reportgenerator.reportcalculator;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.HashMap JavaDoc;
5
6 /**
7  *
8  * User: Breto
9  * Date: 30/09/2005
10  * Time: 18:19:18
11  *
12  */

13 public class SharedBoolean extends SharedData implements Serializable JavaDoc {
14   private Boolean JavaDoc value;
15   static final private HashMap JavaDoc booleans = new HashMap JavaDoc(3);
16
17
18   public SharedBoolean(Boolean JavaDoc value) {
19     this.value = value;
20     booleans.put(value, this);
21   }
22
23   public Object JavaDoc getValue() {
24     return value;
25   }
26
27   static public SharedBoolean newFrom(Boolean JavaDoc aValue) {
28     Object JavaDoc bool;
29
30     bool = booleans.get(aValue);
31     if (bool == null) {
32       return new SharedBoolean(aValue);
33     }
34     else {
35       return (SharedBoolean) bool;
36     }
37   }
38
39 }
40
Popular Tags