Examples of IteratorTemplate


Examples of org.springframework.rules.closure.support.IteratorTemplate

    collection.add("Item 1");
    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection.iterator());
    assertTrue(template.allTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item");
      }
    }));
    try {
      assertEquals(false, template.allTrue(new Constraint() {
        public boolean test(Object o) {
          return ((String)o).startsWith("Element");
        }
      }));
      fail("Should have failed");
View Full Code Here

Examples of org.springframework.rules.closure.support.IteratorTemplate

    collection.add("Item 1");
    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    assertTrue(template.allTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item");
      }
    }));
    assertEquals(false, template.allTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    }));
  }
View Full Code Here

Examples of org.springframework.rules.closure.support.IteratorTemplate

    collection.add("Item 1");
    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    assertTrue(template.anyTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 5");
      }
    }));
    assertEquals(false, template.anyTrue(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    }));
  }
View Full Code Here

Examples of org.springframework.rules.closure.support.IteratorTemplate

    collection.add("Item 1");
    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    assertEquals("Item 4", template.findFirst(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 4");
      }
    }));
    assertEquals(null, template.findFirst(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    }));
  }
View Full Code Here

Examples of org.springframework.rules.closure.support.IteratorTemplate

    collection.add("Item 1");
    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
    ElementGenerator finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 4");
      }
    });
    finder.run(new Block() {
      protected void handle(Object o) {
        assertEquals("Item 4", o);
      }
    });
    finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    });
    finder.run(new Block() {
View Full Code Here

Examples of org.springframework.rules.closure.support.IteratorTemplate

    collection.add("Item 1");
    collection.add("Item 2");
    collection.add("Item 3");
    collection.add("Item 4");
    collection.add("Item 5");
    IteratorTemplate template = new IteratorTemplate(collection);
        runUntilCounter = 0;
        template.runUntil(new Block() {
            protected void handle(Object o) {
                runUntilCounter++;
            }
        }, new Constraint() {
      public boolean test(Object o) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.