private Double readNextNumber(Stack<CalculationToken> calculationStack){
  CalculationToken calculationToken=calculationStack.pop();
  DoubleToken doubleToken;
  Double nextNumber;
  if (calculationToken instanceof OperationToken) {
    calculationToken=calculationStack.pop();
    doubleToken=(DoubleToken)calculationToken;
    nextNumber=-doubleToken.getNumber();
  }
 else {
    doubleToken=(DoubleToken)calculationToken;
    nextNumber=doubleToken.getNumber();
  }
  return nextNumber;
}

private Double readNextNumber ( Stack < CalculationToken > calculationStack ) { CalculationToken calculationToken = calculationStack . pop ( ) ; DoubleToken doubleToken ; Double nextNumber ; if ( calculationToken instanceof OperationToken ) { calculationToken = calculationStack . pop ( ) ; doubleToken = ( DoubleToken ) calculationToken ; nextNumber = - doubleToken . getNumber ( ) ; } else { doubleToken = ( DoubleToken ) calculationToken ; nextNumber = doubleToken . getNumber ( ) ; } return nextNumber ; }
a function to read the next number on the stack ( allows for reading even in cases of unary minuses )
