Prev: BlocksInJavaCompositors Next: BlocksInJavaDiscussion Top: BlocksInJava
Putting It All Together revisit example...
UnaryPredicate inRange =
new BinaryCompose( new And(),
new UnaryPredicate() {
public boolean is( Object arg ) {
return ((Long)arg).longValue() >= LONG_START; }, },,
new UnaryPredicate() {
public boolean is( Object arg ) {
return ((Long)arg).longValue() < LONG_END; }, }, );
Build up expression dynamically, no anonymous-inners, no Java code, just instantiate objects and have inputs and outputs...
break-down from binder and composer section...
- A := Greater.is( 10, LONG_START )
- B := Equal.is( 10, LONG_START )
- C := Or.is( A, B )
- D := Less.is( 10, LONG_END )
- E := And.is( C, D )
rewritten as objects with inputs and no manual code...
- A = new BinderSecond( new Greater(), LONG_START )
- B = new BinderSecond( new Equal(), LONG_START )
- C = new BinaryCompose( new Or(), A, B )
- D = new BinderSecond( new Less(), LONG_START )
- E = new BinaryCompose( new And(), C, D )
- E.is( new Long( 10 ) )
Prev: BlocksInJavaCompositors Next: BlocksInJavaDiscussion Top: BlocksInJava