Skip to content

Package: Condition2State

Condition2State

nameinstructionbranchcomplexitylinemethod
Condition2State(Scanner, Integer, Integer, String)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
action(Character, Buffer, String)
M: 45 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
finish(Buffer, String)
M: 16 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: *
3: */
4: package scanner;
5:
6: import basic.Buffer;
7: import basic.PrinterConstants;
8: import model.Position;
9: import symbols.AbstractSymbol;
10: import symbols.StringSymbol;
11:
12: /**
13: * @author Hendrik
14: *
15: */
16: public class Condition2State extends AbstractState {
17:         /**
18:          * collected Chracters.
19:          */
20:         private String collected;
21:
22:         /**
23:          * This constructor initialize the new ConditionState1.
24:          *
25:          * @param myScanner
26:          * is the used scanner.
27:          * @param beginningColumn
28:          * is the Begin Column of the Symbol
29:          * @param beginningRow
30:          * is the beginning row of the symbol
31:          * @param collected
32:          * collected Characters
33:          */
34:         public Condition2State(final Scanner myScanner, final Integer beginningColumn,
35:                         final Integer beginningRow, final String collected) {
36:                 super(myScanner, beginningColumn, beginningRow);
37:                 this.collected = collected;
38:         }
39:
40:         /*
41:          * (non-Javadoc)
42:          *
43:          * @see scanner.AbstractState#action(java.lang.Character, basic.Buffer, java.lang.String)
44:          */
45:         @Override
46:         public AbstractState action(final Character character,
47:                         final Buffer<AbstractSymbol> currentResult, final String dataPath)
48:                         throws InterruptedException {
49:                 final AbstractState state;
50:•                if (character.equals(PrinterConstants.QUOTATIONMARK.charAt(0))) {
51:                         this.finish(currentResult, dataPath);
52:                         this.getMyScanner().skip();
53:                         state = new ConditionEndState(getMyScanner(), this.getMyScanner().getColumnCounter(),
54:                                         getBeginningRow());
55:
56:                 } else {
57:                         this.collected = this.collected + character.toString();
58:                         this.getMyScanner().skip();
59:                         state = this;
60:
61:                 }
62:
63:                 return state;
64:
65:         }
66:
67:         /*
68:          * (non-Javadoc)
69:          *
70:          * @see scanner.AbstractState#finish(basic.Buffer, java.lang.String)
71:          */
72:         @Override
73:         protected void finish(final Buffer<AbstractSymbol> currentResult, final String dataPath)
74:                         throws InterruptedException {
75:                 currentResult.put(new StringSymbol(this.collected,
76:                                 new Position(this.getBeginningRow(), this.getBeginningColumn(), dataPath)));
77:
78:         }
79:
80: }