Blocks In Java Putting It Together


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...

  1. A := Greater.is( 10, LONG_START )
  2. B := Equal.is( 10, LONG_START )
  3. C := Or.is( A, B )
  4. D := Less.is( 10, LONG_END )
  5. E := And.is( C, D )

rewritten as objects with inputs and no manual code...

  1. A = new BinderSecond( new Greater(), LONG_START )
  2. B = new BinderSecond( new Equal(), LONG_START )
  3. C = new BinaryCompose( new Or(), A, B )
  4. D = new BinderSecond( new Less(), LONG_START )
  5. E = new BinaryCompose( new And(), C, D )

-- RobertDiFalco


Prev: BlocksInJavaCompositors Next: BlocksInJavaDiscussion Top: BlocksInJava


EditText of this page (last edited December 17, 2006) or FindPage with title or text search