ExpressionToLogicalGatesConverter(String)   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
package yalep.code;
2
3
import org.antlr.v4.runtime.CharStreams;
0 ignored issues
show
Unused Code introduced by
Remove this unused import 'org.antlr.v4.runtime.CharStreams'.
Loading history...
4
import org.antlr.v4.runtime.CommonTokenStream;
0 ignored issues
show
Unused Code introduced by
Remove this unused import 'org.antlr.v4.runtime.CommonTokenStream'.
Loading history...
5
import yalep.antlr.generated.LogicalExpressionLexer;
0 ignored issues
show
Unused Code introduced by
Remove this unused import 'yalep.antlr.generated.LogicalExpressionLexer'.
Loading history...
6
import yalep.antlr.generated.LogicalExpressionParser;
0 ignored issues
show
Unused Code introduced by
Remove this unused import 'yalep.antlr.generated.LogicalExpressionParser'.
Loading history...
7
import yalep.exceptions.WrongExpressionFormatException;
8
9
public class ExpressionToLogicalGatesConverter {
10
11
    private String expression;
12
    private Integer answer;
0 ignored issues
show
Unused Code introduced by
Consider removing the unused private field answer.
Loading history...
13
14
    public ExpressionToLogicalGatesConverter(String expression) throws WrongExpressionFormatException {
15
        LogicalExpressionValidityChecker.expressionIsValid(expression);
16
        this.expression = expression.substring(0, expression.indexOf("="));
17
        this.expression = this.expression.replaceAll(" ","");
18
        answer = Integer.parseInt(expression.substring(expression.indexOf("=") + 1));
19
    }
20
}
21