Skip to content

Package: WhitespaceState

WhitespaceState

nameinstructionbranchcomplexitylinemethod
WhitespaceState(String, Position)
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%
accept(ScannerStateVisitor)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
create(Position)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
finish(TokenStream)
M: 0 C: 12
100%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

1: package de.fhdw.wtf.dsl.scanner.modelScanner.state;
2:
3: import de.fhdw.wtf.common.stream.TokenStream;
4: import de.fhdw.wtf.common.token.Position;
5: import de.fhdw.wtf.common.token.WhitespaceToken;
6:
7: /**
8: * ScannerState for recognition of whitespace.
9: */
10: public final class WhitespaceState extends MultiCharState {
11:         
12:         /**
13:          * PRIVATE Constructor.
14:          *
15:          * @param currentInput
16:          * startInput.
17:          * @param firstPosition
18:          * of the first char.
19:          */
20:         private WhitespaceState(final String currentInput, final Position firstPosition) {
21:                 super(currentInput, firstPosition);
22:         }
23:         
24:         /**
25:          * Factorymethod for {@link WhitespaceState}.
26:          *
27:          * @param firstPosition
28:          * of the first char.
29:          * @return the {@link WhitespaceState}.
30:          */
31:         public static WhitespaceState create(final Position firstPosition) {
32:                 return new WhitespaceState("", firstPosition);
33:         }
34:         
35:         @Override
36:         public void finish(final TokenStream outputStream) {
37:•                if (!this.getCurrentInput().isEmpty()) {
38:                         outputStream.add(WhitespaceToken.create(this.getCurrentInput(), this.getFirstPosition()));
39:                 }
40:         }
41:         
42:         @Override
43:         public boolean accept(final ScannerStateVisitor visitor) {
44:                 return visitor.handleWhitespaceState();
45:         }
46:         
47: }