Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AppendLineFactory |
|
| 1.0;1 | ||||
AppendLineFactory$1 |
|
| 1.0;1 | ||||
AppendLineFactory$AppendLineIteratorOperation |
|
| 1.0;1 |
1 | package org.jtheque.primary.utils.web.analyzers.generic.operation.iterator; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import org.jdom.Element; | |
20 | import org.jtheque.core.utils.file.XMLException; | |
21 | import org.jtheque.core.utils.file.XMLReader; | |
22 | import org.jtheque.primary.utils.web.analyzers.generic.Factory; | |
23 | import org.jtheque.primary.utils.web.analyzers.generic.operation.ScannerPossessor; | |
24 | import org.jtheque.primary.utils.web.analyzers.generic.value.BuilderPossessor; | |
25 | ||
26 | /** | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | 0 | final class AppendLineFactory implements Factory<IteratorOperation> { |
30 | @Override | |
31 | public boolean canFactor(Element element, XMLReader reader){ | |
32 | 0 | return "appendLine".equals(element.getName()); |
33 | } | |
34 | ||
35 | @Override | |
36 | public IteratorOperation factor(Element n, XMLReader reader) throws XMLException{ | |
37 | 0 | return new AppendLineIteratorOperation(); |
38 | } | |
39 | ||
40 | /** | |
41 | * An operation which append the line to the builder. | |
42 | * | |
43 | * @author Baptiste Wicht | |
44 | */ | |
45 | 0 | private static final class AppendLineIteratorOperation implements IteratorOperation { |
46 | @Override | |
47 | public String perform(String line, ScannerPossessor analyzer, BuilderPossessor iterator){ | |
48 | 0 | iterator.getBuilder().append(line); |
49 | ||
50 | 0 | return line; |
51 | } | |
52 | } | |
53 | } |