Method
getLeftIndex
(final StringBuilder expression, int startIndex)
Source from the content-addressed store, hash-verified
| 85 | } |
| 86 | |
| 87 | private static int getLeftIndex(final StringBuilder expression, int startIndex) |
| 88 | { |
| 89 | int startIndex1 = startIndex; |
| 90 | int parenth = 0; |
| 91 | char c; |
| 92 | do |
| 93 | { |
| 94 | startIndex1--; |
| 95 | if (startIndex1 >= 0) |
| 96 | { |
| 97 | c = expression.charAt(startIndex1); |
| 98 | } |
| 99 | else |
| 100 | { |
| 101 | break; |
| 102 | } |
| 103 | if (c == ')') |
| 104 | { |
| 105 | parenth++; |
| 106 | } |
| 107 | else if (c == '(') |
| 108 | { |
| 109 | parenth--; |
| 110 | } |
| 111 | } |
| 112 | while ((parenth > 0) || (c == 'd') || (c == '*') || (c == '/') || (c == ' ') || Character.isDigit(c)); |
| 113 | return startIndex1 + 1; |
| 114 | } |
| 115 | |
| 116 | private static int getRightIndex(final StringBuilder expression, int startIndex) |
| 117 | { |
Tested by
no test coverage detected