comefrom: <gouthampradhan>stack_BasicCalculator_1.java
code: public int calculate(String s) {
      Stack<String> stack = new Stack<>();
      String num = "";
      s = "(" + s + ")";
      for (char c : s.toCharArray()) {
        switch (c) {
          case ' ':
          case '(':
          case '+':
          case '-':
            if (!num.equals("")) {
              stack.push(String.valueOf(num));
              num = "";
            }
            if (c != ' ') { 
              stack.push(String.valueOf(c));
            }
            break;
          case ')':
            if (!num.equals("")) {
              stack.push(String.valueOf(num));
              num = "";
            }
            int sum = 0;
            int prev = 0; 
            while (!stack.isEmpty()) {
              String top = stack.pop();
              if (top.equals("-")) {
                sum -= (prev * 2);
                prev = 0;
              } else if (top.equals("+")) {
              } else if (top.equals("(")) {
                stack.push(String.valueOf(sum));
                break;
              } else {
                sum += Integer.parseInt(top);
                prev = Integer.parseInt(top);
              }
            }
            break;
          default:
            num += String.valueOf(c);
            break;
        }
      }
      return Integer.parseInt(stack.peek());
    }
masked: public int sample_funcname ( String var_1 ) {
    Stack < String > var_3 = new Stack < > ( ) ;
    String var_5 = "" ;
    var_1 = "(" + var_1 + ")" ;
    for ( char var_9 : var_1 . toCharArray ( ) ) {
      switch ( var_9 ) {
        case ' ' : case '(' : case '+' : case '-' : if ( ! var_5 . equals ( "" ) ) {
          var_3 . push ( String . valueOf ( var_5 ) ) ;
          var_5 = "" ;
        }
        if ( var_9 != ' ' ) {
          var_3 . push ( String . valueOf ( var_9 ) ) ;
        }
        break ;
        case ')' : if ( ! var_5 . equals ( "" ) ) {
          var_3 . push ( String . valueOf ( var_5 ) ) ;
          var_5 = "" ;
        }
        int var_19 = 0 ;
        int var_20 = 0 ;
        while ( ! var_3 . isEmpty ( ) ) {
          String var_23 = var_3 . pop ( ) ;
          if ( var_23 . equals ( "-" ) ) {
            var_19 -= ( var_20 * 2 ) ;
            var_20 = 0 ;
          }
          else if ( var_23 . equals ( "+" ) ) {
          }
          else if ( var_23 . equals ( "(" ) ) {
            var_3 . push ( String . valueOf ( var_19 ) ) ;
            break ;
          }
          else {
            var_19 += Integer . parseInt ( var_23 ) ;
            var_20 = Integer . parseInt ( var_23 ) ;
          }
        }
        break ;
        default : var_5 += String . valueOf ( var_9 ) ;
        break ;
      }
    }
    return Integer . parseInt ( var_3 . peek ( ) ) ;
  }
  