Beispiel #1
0
 private boolean initIneqs(
     ExpressionNode fe, FunctionalNVar functional, IneqTree tree, boolean negate) {
   int op = fe.getOperation();
   ExpressionNode leftTree = fe.getLeftTree();
   ExpressionNode rightTree = fe.getRightTree();
   if (op == ExpressionNode.GREATER
       || op == ExpressionNode.GREATER_EQUAL
       || op == ExpressionNode.LESS
       || op == ExpressionNode.LESS_EQUAL) {
     Inequality newIneq =
         new Inequality(
             kernel,
             leftTree,
             rightTree,
             adjustOp(op, negate),
             getFunction().getFunctionVariables(),
             functional);
     if (newIneq.getType() != Inequality.INEQUALITY_INVALID) {
       if (newIneq.getType() != Inequality.INEQUALITY_1VAR_X
           && newIneq.getType() != Inequality.INEQUALITY_1VAR_Y)
         newIneq.getBorder().setInverseFill(newIneq.isAboveBorder());
       tree.setIneq(newIneq);
     }
     return newIneq.getType() != Inequality.INEQUALITY_INVALID;
   } else if (op == ExpressionNode.AND
       || op == ExpressionNode.OR
       || op == ExpressionNode.EQUAL_BOOLEAN
       || op == ExpressionNode.NOT_EQUAL) {
     tree.operation = adjustOp(op, negate);
     tree.left = new IneqTree();
     tree.right = new IneqTree();
     return initIneqs(leftTree, functional, tree.left, negate)
         && initIneqs(rightTree, functional, tree.right, negate);
   } else if (op == ExpressionNode.NOT) {
     return initIneqs(leftTree, functional, tree, !negate);
   } else if (op == ExpressionNode.FUNCTION_NVAR) {
     FunctionalNVar nv = (FunctionalNVar) leftTree.getLeft();
     IneqTree otherTree = nv.getIneqs();
     if (otherTree == null || otherTree.getSize() == 0) {
       return false;
     }
     tree.left = otherTree.left;
     tree.right = otherTree.right;
     tree.operation = otherTree.operation;
     tree.ineq = otherTree.ineq;
     return true;
   } else return false;
 }