Examples of BinaryConstraint


Examples of org.springframework.rules.closure.BinaryConstraint

     *            Type used to resolve messages.
     */
    public StringLengthConstraint(RelationalOperator operator, int length, String type) {
        Assert.notNull(operator, "The relational operator is required");
        Assert.isTrue(length > 0, "length is required");
        BinaryConstraint comparer = operator.getConstraint();
        Constraint lengthConstraint = bind(comparer, length);
        this.lengthConstraint = testResultOf(StringLength.instance(),
                lengthConstraint);
        this.type = type;
    }
View Full Code Here

Examples of org.springframework.rules.closure.BinaryConstraint

    Number n1 = new Integer(25);
    Number n11 = new Integer(25);
    Number n2 = new Integer(30);
    Number n3 = new Integer(-15);
    Number n4 = new Integer(26);
    BinaryConstraint p = GreaterThan.instance();
    Assert.notNull(p);
    assertTrue(p.test(n2, n1));
    assertFalse(p.test(n3, n2));

    p = GreaterThanEqualTo.instance();
    assertTrue(p.test(n2, n2));
    assertFalse(p.test(n1, n4));
    assertTrue(p.test(n4, n1));

    p = LessThan.instance();
    assertTrue(p.test(n1, n2));
    assertFalse(p.test(n2, n3));

    p = LessThanEqualTo.instance();
    assertTrue(p.test(n2, n2));
    assertFalse(p.test(n4, n1));
    assertTrue(p.test(n1, n4));

    p = EqualTo.instance();
    assertTrue(p.test(n1, n11));
    assertTrue(p.test(n2, n2));
    assertFalse(p.test(n1, n2));
  }
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.