Package common.model

Examples of common.model.Assert


        if (j < height - 1) {
          vars.add(label(number(i, j), number(i, j + 1)));
        }
        String[] vs = new String[vars.size()];
        vars.toArray(vs);
        statements.add(new Assert(PredicateHelper.singleOne(vs)));
      }
    }
    statements.add(new Check());
    return statements;
  }
View Full Code Here


        if (j < height - 1 && check(i, j + 1)) {
          vars.add(label(number(i, j), number(i, j + 1)));
        }
        String[] vs = new String[vars.size()];
        vars.toArray(vs);
        statements.add(new Assert(PredicateHelper.singleOne(vs)));
      }
    }
    statements.add(new Check());
    return statements;
  }
View Full Code Here

          Type.Int));
    }
    // Range Check
    for (int i = 0; i < total; i++) {
      String var = MessageFormat.format(varPattern, i);
      result.add(new Assert(new Predicate(Operator.AND, new Predicate(
          Operator.GE, new Variable(var), new Constant(1)),
          new Predicate(Operator.LE, new Variable(var), new Constant(
              size * size)))));
    }
    // Assigned values
    for (int[] assign : assigned) {
      String var = MessageFormat.format(varPattern,
          translate(assign[0], assign[1]));
      result.add(new Assert(new Predicate(Operator.EQUAL, new Variable(
          var), new Constant(assign[2]))));
    }
    // Limitations
    // Columns and rows
    for (int i = 0; i < size * size; i++) {
      for (int j = 0; j < size * size; j++) {
        for (int k = j + 1; k < size * size; k++) {
          result.add(new Assert(new Predicate(Operator.NOT,
              new Predicate(Operator.EQUAL, new Variable(
                  MessageFormat.format(varPattern,
                      translate(i, j))), new Variable(
                  MessageFormat.format(varPattern,
                      translate(i, k)))))));
          result.add(new Assert(new Predicate(Operator.NOT,
              new Predicate(Operator.EQUAL, new Variable(
                  MessageFormat.format(varPattern,
                      translate(j, i))), new Variable(
                  MessageFormat.format(varPattern,
                      translate(k, i)))))));
          result.add(new Assert(new Predicate(Operator.NOT,
              new Predicate(Operator.EQUAL, new Variable(
                  MessageFormat.format(varPattern,
                      sqrtranslate(i, j))), new Variable(
                  MessageFormat.format(varPattern,
                      sqrtranslate(i, k)))))));
View Full Code Here

TOP

Related Classes of common.model.Assert

Copyright © 2018 www.massapicom. 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.