|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SubTextInput | Line # 24 | 12 | 8 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(31) | |||
Result | |||
0.9
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test12 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test12 | 1 PASS | |
0.9
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test05 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test05 | 1 PASS | |
0.9
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test04 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test04 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration6 org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration6 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3b org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3b | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration2 org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration2 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test09 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test09 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test06 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test06 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1b org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1b | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration4 org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration4 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test11 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test11 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test01 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test01 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3c org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3c | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test08 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test08 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test07 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test07 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test02 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test02 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test10 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test10 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1 org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3 org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3 | 1 PASS | |
0.8
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration5 org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration5 | 1 PASS | |
0.7
|
org.qedeq.base.io.SubTextInputTest.testGetAbsoluteEnd org.qedeq.base.io.SubTextInputTest.testGetAbsoluteEnd | 1 PASS | |
0.7
|
org.qedeq.base.io.SubTextInputTest.testGetAbsoluteSubstring org.qedeq.base.io.SubTextInputTest.testGetAbsoluteSubstring | 1 PASS | |
0.7
|
org.qedeq.base.io.SubTextInputTest.testGetAbsolutePosition org.qedeq.base.io.SubTextInputTest.testGetAbsolutePosition | 1 PASS | |
0.6
|
org.qedeq.base.io.SubTextInputTest.testGetAbsoluteStart org.qedeq.base.io.SubTextInputTest.testGetAbsoluteStart | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind2 org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind2 | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin2 org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin2 | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test03 org.qedeq.kernel.bo.service.unicode.Latex2UnicodeParserTest.test03 | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind3 org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind3 | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind | 1 PASS | |
0.4
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPluginFast org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPluginFast | 1 PASS | |
1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org | |
2 | * | |
3 | * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>. | |
4 | * | |
5 | * "Hilbert II" is free software; you can redistribute | |
6 | * it and/or modify it under the terms of the GNU General Public | |
7 | * License as published by the Free Software Foundation; either | |
8 | * version 2 of the License, or (at your option) any later version. | |
9 | * | |
10 | * This program 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 | ||
16 | package org.qedeq.base.io; | |
17 | ||
18 | ||
19 | /** | |
20 | * Wraps a text output stream. | |
21 | * | |
22 | * @author Michael Meyling | |
23 | */ | |
24 | public class SubTextInput extends TextInput { | |
25 | ||
26 | /** Absolute start of this input relative to base {@link SubTextInput}. */ | |
27 | private final int absoluteStart; | |
28 | ||
29 | /** Absolute end of this input relative to base {@link SubTextInput}. */ | |
30 | private final int absoluteEnd; | |
31 | ||
32 | /** | |
33 | * Constructor. | |
34 | * | |
35 | * @param source Text input. | |
36 | */ | |
37 | 3942 | public SubTextInput(final String source) { |
38 | 3942 | super(source); |
39 | 3942 | this.absoluteStart = 0; |
40 | 3942 | this.absoluteEnd = source.length(); |
41 | } | |
42 | ||
43 | /** | |
44 | * Constructor. | |
45 | * | |
46 | * @param original Parent input. | |
47 | * @param absoluteStart Input part starts here. | |
48 | * @param absoluteEnd Input part ends here. | |
49 | */ | |
50 | 4855 | public SubTextInput(final SubTextInput original, final int absoluteStart, final int absoluteEnd) { |
51 | 4855 | super(original.getAbsoluteSubstring(absoluteStart, absoluteEnd)); |
52 | 4855 | this.absoluteStart = absoluteStart; |
53 | 4855 | this.absoluteEnd = absoluteEnd; |
54 | } | |
55 | ||
56 | /** | |
57 | * Get the absolute start position of the current {@link SubTextInput}. | |
58 | * | |
59 | * @return Absolute start position. | |
60 | */ | |
61 | 702365 | public int getAbsoluteStart() { |
62 | 702365 | return absoluteStart; |
63 | } | |
64 | ||
65 | /** | |
66 | * Get the absolute end position of the current {@link SubTextInput}. | |
67 | * | |
68 | * @return Absolute end position. | |
69 | */ | |
70 | 2 | public int getAbsoluteEnd() { |
71 | 2 | return absoluteEnd; |
72 | } | |
73 | ||
74 | /** | |
75 | * Get the absolute position of the current position. | |
76 | * | |
77 | * @return Absolute position of current position. | |
78 | */ | |
79 | 692648 | public int getAbsolutePosition() { |
80 | 692648 | return getAbsoluteStart() + getPosition(); |
81 | } | |
82 | ||
83 | /** | |
84 | * Set the current position by calculating the relative position | |
85 | * from the given absolute position. | |
86 | * | |
87 | * @param absolutePosition This should be the absolute position. | |
88 | */ | |
89 | 3 | public void setAbsolutePosition(final int absolutePosition) { |
90 | 3 | setPosition(absolutePosition - getAbsoluteStart()); |
91 | } | |
92 | ||
93 | /** | |
94 | * Get sub string of source. The given parameters have values for the underlying original | |
95 | * SubTextInput at the base. | |
96 | * | |
97 | * @param absoluteFrom Absolute start of sub string. | |
98 | * @param absoluteTo Absolute end of sub string. | |
99 | * @return Sub string. | |
100 | */ | |
101 | 4856 | public String getAbsoluteSubstring(final int absoluteFrom, final int absoluteTo) { |
102 | 4856 | return getSubstring(absoluteFrom - getAbsoluteStart(), absoluteTo - getAbsoluteStart()); |
103 | } | |
104 | ||
105 | /** | |
106 | * Get sub string of source as a new {@link SubTextInput}. The given parameters have | |
107 | * values for the underlying original SubTextInput at the base. | |
108 | * | |
109 | * @param absoluteFrom Absolute start of sub string. | |
110 | * @param absoluteTo Absolute end of sub string. | |
111 | * @return Sub string. | |
112 | */ | |
113 | 4851 | public SubTextInput getSubTextInput(final int absoluteFrom, final int absoluteTo) { |
114 | 4851 | return new SubTextInput(this, absoluteFrom, absoluteTo); |
115 | } | |
116 | ||
117 | } |
|