<commit_before>package com.matao.fundamental;

import java.util.Stack;

/**
 * Created by matao on 5/27/16.
 * Dijkstra 双栈算数表达式求值算法
 * 1) 将操作数压入操作数栈
 * 2) 将运算符压入运算符栈
 * 3) 忽略左括号
 * 4) 遇到右括号时,弹出一个操作符,弹出所需数量的操作数,并将运算符和操作数的运算结果压入操作数栈
 */
public class Evaluate {
    public static void main(String[] args) {
        String exp = "(1+((2+3)*(4*5)))";     // expected 101

        Stack<Character> operations = new Stack<>();
        Stack<Double> values = new Stack<>();
        for (int i = 0; i < exp.length(); i++) {
            char c = exp.charAt(i);
            switch (c) {
                case '(':
                    break;
                case '+':
                case '-':<commit_msg>refactor(evaluate): replace jdk stack with self implemented stack<commit_after>package com.matao.fundamental;

/**
 * Created by matao on 5/27/16.
 * Dijkstra 双栈算数表达式求值算法
 * 1) 将操作数压入操作数栈
 * 2) 将运算符压入运算符栈
 * 3) 忽略左括号
 * 4) 遇到右括号时,弹出一个操作符,弹出所需数量的操作数,并将运算符和操作数的运算结果压入操作数栈
 */
public class Evaluate {
    public static void main(String[] args) {
        String exp = "(1+((2+3)*(4*5)))";     // expected 101

        Stack<Character> operations = new Stack<>();
        Stack<Double> values = new Stack<>();
        for (int i = 0; i < exp.length(); i++) {
            char c = exp.charAt(i);
            switch (c) {
                case '(':
                    break;
                case '+':
                case '-':
{'fraction_non_alphanumeric': 0.14599574769666904, 'fraction_numerical': 0.025513819985825654, 'mean_word_length': 2.0106609808102345, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3219919', 'n_tokens_mistral': 587, 'n_tokens_neox': 611, 'n_words': 117}