Last change
on this file since 9519 was 8846, checked in by Don-vip, 9 years ago |
sonar - fb-contrib - minor performance improvements:
- Method passes constant String of length 1 to character overridden method
- Method needlessly boxes a boolean constant
- Method uses iterator().next() on a List to get the first item
- Method converts String to boxed primitive using excessive boxing
- Method converts String to primitive using excessive boxing
- Method creates array using constants
- Class defines List based fields but uses them like Sets
|
-
Property svn:eol-style
set to
native
|
File size:
877 bytes
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools.template_engine;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.actions.search.SearchCompiler.Match;
|
---|
5 |
|
---|
6 | public class SearchExpressionCondition implements TemplateEntry {
|
---|
7 |
|
---|
8 | private final Match condition;
|
---|
9 | private final TemplateEntry text;
|
---|
10 |
|
---|
11 | public SearchExpressionCondition(Match condition, TemplateEntry text) {
|
---|
12 | this.condition = condition;
|
---|
13 | this.text = text;
|
---|
14 | }
|
---|
15 |
|
---|
16 | @Override
|
---|
17 | public void appendText(StringBuilder result, TemplateEngineDataProvider dataProvider) {
|
---|
18 | text.appendText(result, dataProvider);
|
---|
19 | }
|
---|
20 |
|
---|
21 | @Override
|
---|
22 | public boolean isValid(TemplateEngineDataProvider dataProvider) {
|
---|
23 | return dataProvider.evaluateCondition(condition);
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public String toString() {
|
---|
28 | return condition.toString() + " '" + text + '\'';
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.