Example #1
0
 public static Type flip(Type type) {
   if (Type.POSITIVE.equals(type)) {
     return Type.NEGATIVE;
   } else {
     return Type.POSITIVE;
   }
 }
Example #2
0
  @Override
  public String toString() {
    StringBuilder st = new StringBuilder();
    st.append('(');
    //        st.append(Type.POSITIVE.equals(type) ? "(" : "not(");

    String op =
        (Type.POSITIVE.equals(type) ? "" : "n") + (Operator.AND.equals(operator) ? "and " : "or ");
    for (int i = 0; i < children.length; i++) {
      ILogical child = children[i];
      if (child.isLit()) {
        st.append(((BoolVar) child).getName());
      } else {
        st.append(child.toString());
      }
      st.append(" ").append(op);
    }
    st.replace(st.length() - (op.length() + 1), st.length(), "");
    st.append(')');
    return st.toString();
  }