-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComparativeComputionExample.java
53 lines (40 loc) · 1.25 KB
/
ComparativeComputionExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package example;
import com.shimizukenta.property.BooleanCompution;
import com.shimizukenta.property.IntegerProperty;
public class ComparativeComputionExample implements Runnable {
public ComparativeComputionExample() {
/* Nothing */
}
@Override
public void run() {
System.out.println("run: " + this.getClass());
System.out.println();
/* build instance */
IntegerProperty a = IntegerProperty.newInstance(3);
IntegerProperty b = IntegerProperty.newInstance(4);
/* getter */
System.out.println("get a: " + a.intValue());
System.out.println("get b: " + b.intValue());
System.out.println();
BooleanCompution aGT3 = a.computeIsGreaterThan(3);
BooleanCompution aEQ5 = a.computeIsEqualTo(5);
BooleanCompution aLTb = a.computeIsLessThan(b);
System.out.println("a > 3 : " + aGT3);
System.out.println("a == 5 : " + aEQ5);
System.out.println("a < b : " + aLTb);
System.out.println();
System.out.println("set a: " + 5);
a.set(5);
System.out.println("a > 3 : " + aGT3);
System.out.println("a == 5 : " + aEQ5);
System.out.println("a < b : " + aLTb);
}
public static void main(String[] args) {
try {
new ComparativeComputionExample().run();
}
catch ( Throwable t ) {
t.printStackTrace();
}
}
}