yalep.code.ExpressionToLogicalGatesConverter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 10
rs 10
c 2
b 0
f 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A ExpressionToLogicalGatesConverter(String) 0 5 1
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