View Javadoc

1   package org.catacomb.interlish.content;
2   
3   
4   public class BooleanValue extends PrimitiveValue {
5   
6   
7       private boolean boolval;
8   
9       private BooleanValue peer;
10  
11  
12      public BooleanValue() {
13          super();
14          boolval = false;
15      }
16  
17      public BooleanValue(boolean b) {
18          super();
19          boolval = b;
20      }
21  
22  
23      public String toString() {
24          return (boolval ?  "true" : "false");
25      }
26  
27      public void silentSetBoolean(boolean b) {
28          boolval = b;
29          logChange();
30          if (peer != null) {
31              peer.silentSetBoolean(b);
32          }
33      }
34  
35      public boolean getBoolean() {
36          boolean ret = boolval;
37          if (peer != null) {
38              ret = peer.getBoolean();
39          }
40          return ret;
41      }
42  
43      public boolean is() {
44          return getBoolean();
45      }
46  
47  
48      public void reportableSetBoolean(boolean b, Object src) {
49          silentSetBoolean(b);
50          reportValueChange(src);
51          if (peer != null) {
52              peer.reportableSetBoolean(b, src);
53          }
54      }
55  
56  
57      public void setPeer(BooleanValue dv) {
58          peer = dv;
59      }
60  
61      public void releasePeer() {
62          peer = null;
63      }
64  
65      public void copyFrom(BooleanValue src) {
66          boolval = src.boolval;
67      }
68  
69  
70  
71  }