Skip to content

Package: OrElseNode

OrElseNode

nameinstructionbranchcomplexitylinemethod
OrElseNode(AbstractNode, AbstractNode)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
interpret(CommunicationManager)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

1: package pruefskript.parser.nodes;
2:
3: import pruefskript.CommunicationManager;
4: import pruefskript.parser.exceptions.CheckScriptException;
5: import pruefskript.parser.exceptions.VariableDoesNotExistException;
6: import pruefskript.parser.values.AbstractReturnValue;
7:
8: /**
9: *
10: * @author Gruppe Pruefskripte I
11: *
12: */
13: public class OrElseNode extends AbstractBinaryOperationNode {
14:         /**
15:          *
16:          * @param operand1
17:          * @param operand2
18:          */
19:         public OrElseNode(final AbstractNode operand1, final AbstractNode operand2) {
20:                 super(operand1, operand2);
21:         }
22:
23:         /**
24:          * Either operand1 or operand2 is interpreted and returned.
25:          */
26:         @Override
27:         public AbstractReturnValue interpret(final CommunicationManager mgr)
28:                         throws CheckScriptException {
29:                 try {
30:                         return this.getOperand1().interpret(mgr);
31:                 } catch (final VariableDoesNotExistException e) {
32:                         return this.getOperand2().interpret(mgr);
33:                 }
34:         }
35:
36: }