private LinkedList<Object> OperatorTree(Queue<Object> rpn){
        LinkedList<Object> operand = new LinkedList<Object>();
        while(!rpn.isEmpty()){
            if(rpn.peek() instanceof Operator){
                Operator opt = (Operator) rpn.poll();
                opt.wrap(operand);
                operand.addFirst(opt);
                continue;
            }
            if(rpn.peek() instanceof Elobj){
                ((Elobj) rpn.peek()).setEc(ec);
            }
            operand.addFirst(rpn.poll());
        }
        return operand;
    }
private LinkedList<Object> OperatorTree(Queue<Object> rpn){
        LinkedList<Object> operand = new LinkedList<Object>();
        while(!rpn.isEmpty()){
            if(rpn.peek() instanceof Operator){
                Operator opt = (Operator) rpn.poll();
                opt.wrap(operand);
                operand.addFirst(opt);
                continue;
            }
            if(rpn.peek() instanceof Elobj){
                ((Elobj) rpn.peek()).setEc(ec);
            }
            operand.addFirst(rpn.poll());
        }
        return operand;
    }
private LinkedList < Object > OperatorTree ( Queue < Object > rpn ) { LinkedList < Object > operand = new LinkedList < Object > ( ) ; while ( ! rpn . isEmpty ( ) ) { if ( rpn . peek ( ) instanceof Operator ) { Operator opt = ( Operator ) rpn . poll ( ) ; opt . wrap ( operand ) ; operand . addFirst ( opt ) ; continue ; } if ( rpn . peek ( ) instanceof Elobj ) { ( ( Elobj ) rpn . peek ( ) ) . setEc ( ec ) ; } operand . addFirst ( rpn . poll ( ) ) ; } return operand ; }
转换成操作树
转换成操作树