@Test public void test4() { String input = "0 * 1 * 1"; ParseBooleanOriginal tester = new ParseBooleanOriginal(input); int testResults = tester.process(); assertEquals("Result",0, testResults ); }
public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1.matcher(_input); Matcher m2 = p2.matcher(_input); if(m1.find() || m2.find()) { return 1; } Matcher m4 = p4.matcher(_input); String foundInnerLogic; String parsed; while (m4.find()) { foundInnerLogic = m4.group(); if(foundInnerLogic != null){ parsed = parseInnerLogic(foundInnerLogic); String matched = foundInnerLogic; _input = _input.replace(matched, parsed); _input = _input.replace("!0", "1"); _input = _input.replace("!1", "0"); m4 = p4.matcher(_input); } } _input = parseInnerLogic(_input); return Integer.parseInt(_input); }
ParseBooleanOriginal { public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1.matcher(_input); Matcher m2 = p2.matcher(_input); if(m1.find() || m2.find()) { return 1; } Matcher m4 = p4.matcher(_input); String foundInnerLogic; String parsed; while (m4.find()) { foundInnerLogic = m4.group(); if(foundInnerLogic != null){ parsed = parseInnerLogic(foundInnerLogic); String matched = foundInnerLogic; _input = _input.replace(matched, parsed); _input = _input.replace("!0", "1"); _input = _input.replace("!1", "0"); m4 = p4.matcher(_input); } } _input = parseInnerLogic(_input); return Integer.parseInt(_input); } }
ParseBooleanOriginal { public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1.matcher(_input); Matcher m2 = p2.matcher(_input); if(m1.find() || m2.find()) { return 1; } Matcher m4 = p4.matcher(_input); String foundInnerLogic; String parsed; while (m4.find()) { foundInnerLogic = m4.group(); if(foundInnerLogic != null){ parsed = parseInnerLogic(foundInnerLogic); String matched = foundInnerLogic; _input = _input.replace(matched, parsed); _input = _input.replace("!0", "1"); _input = _input.replace("!1", "0"); m4 = p4.matcher(_input); } } _input = parseInnerLogic(_input); return Integer.parseInt(_input); } ParseBooleanOriginal(String input); }
ParseBooleanOriginal { public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1.matcher(_input); Matcher m2 = p2.matcher(_input); if(m1.find() || m2.find()) { return 1; } Matcher m4 = p4.matcher(_input); String foundInnerLogic; String parsed; while (m4.find()) { foundInnerLogic = m4.group(); if(foundInnerLogic != null){ parsed = parseInnerLogic(foundInnerLogic); String matched = foundInnerLogic; _input = _input.replace(matched, parsed); _input = _input.replace("!0", "1"); _input = _input.replace("!1", "0"); m4 = p4.matcher(_input); } } _input = parseInnerLogic(_input); return Integer.parseInt(_input); } ParseBooleanOriginal(String input); int process(); static void main(String[] args); }
ParseBooleanOriginal { public int process() { _input = _input.replaceAll(" ", ""); _input = _input.replaceAll("!1", "0"); _input = _input.replaceAll("!0", "1"); Matcher m = p.matcher(_input); if(m.find()) { _input = _input.substring(1,_input.length()-1); } Matcher m1 = p1.matcher(_input); Matcher m2 = p2.matcher(_input); if(m1.find() || m2.find()) { return 1; } Matcher m4 = p4.matcher(_input); String foundInnerLogic; String parsed; while (m4.find()) { foundInnerLogic = m4.group(); if(foundInnerLogic != null){ parsed = parseInnerLogic(foundInnerLogic); String matched = foundInnerLogic; _input = _input.replace(matched, parsed); _input = _input.replace("!0", "1"); _input = _input.replace("!1", "0"); m4 = p4.matcher(_input); } } _input = parseInnerLogic(_input); return Integer.parseInt(_input); } ParseBooleanOriginal(String input); int process(); static void main(String[] args);  }