OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 73 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 73 Rev 180
Line 11... Line 11...
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.xml;
14
 package org.openconcerto.xml;
15
 
15
 
-
 
16
import org.openconcerto.utils.Tuple2.List2;
16
import org.openconcerto.utils.cc.IPredicate;
17
import org.openconcerto.utils.cc.IPredicate;
17
import org.openconcerto.xml.SimpleXMLPath.Node;
18
import org.openconcerto.xml.SimpleXMLPath.Node;
18
 
19
 
19
import java.util.ArrayList;
20
import java.util.ArrayList;
20
import java.util.Collections;
21
import java.util.Collections;
Line 48... Line 49...
48
     */
49
     */
49
    public static Step<Attribute> getAnyAttributeStep() {
50
    public static Step<Attribute> getAnyAttributeStep() {
50
        return ANY_ATTRIBUTE;
51
        return ANY_ATTRIBUTE;
51
    }
52
    }
52
 
53
 
-
 
54
    public static Step<Attribute> createAttributeStepFromQualifiedName(final String qName) {
-
 
55
        final List2<String> splitName = XMLUtils.splitQualifiedName(qName);
-
 
56
        return createAttributeStep(splitName.get1(), splitName.get0());
-
 
57
    }
-
 
58
 
53
    public static Step<Attribute> createAttributeStep(final String name, final String ns) {
59
    public static Step<Attribute> createAttributeStep(final String name, final String ns) {
54
        return createAttributeStep(name, ns, null);
60
        return createAttributeStep(name, ns, null);
55
    }
61
    }
56
 
62
 
57
    public static Step<Attribute> createAttributeStep(final String name, final String ns, final IPredicate<Attribute> pred) {
63
    public static Step<Attribute> createAttributeStep(final String name, final String ns, final IPredicate<Attribute> pred) {
Line 65... Line 71...
65
     */
71
     */
66
    public static Step<Element> getAnyChildElementStep() {
72
    public static Step<Element> getAnyChildElementStep() {
67
        return ANY_CHILD_ELEMENT;
73
        return ANY_CHILD_ELEMENT;
68
    }
74
    }
69
 
75
 
-
 
76
    public static Step<Element> createElementStepFromQualifiedName(final String qName) {
-
 
77
        final List2<String> splitName = XMLUtils.splitQualifiedName(qName);
-
 
78
        return createElementStep(splitName.get1(), splitName.get0());
-
 
79
    }
-
 
80
 
70
    public static Step<Element> createElementStep(final String name, final String ns) {
81
    public static Step<Element> createElementStep(final String name, final String ns) {
71
        return createElementStep(name, ns, null);
82
        return createElementStep(name, ns, null);
72
    }
83
    }
73
 
84
 
74
    public static Step<Element> createElementStep(final String name, final String ns, final IPredicate<Element> pred) {
85
    public static Step<Element> createElementStep(final String name, final String ns, final IPredicate<Element> pred) {
Line 158... Line 169...
158
            nextNodes(res, n, jdom.get(i));
169
            nextNodes(res, n, jdom.get(i));
159
        }
170
        }
160
        return res;
171
        return res;
161
    }
172
    }
162
 
173
 
-
 
174
    final List<String> getValues(List<T> jdom) {
-
 
175
        final List<String> res = new ArrayList<>();
-
 
176
        for (final T n : jdom)
-
 
177
            res.add(this.node.getValue(n));
-
 
178
        return res;
-
 
179
    }
-
 
180
 
163
    @Override
181
    @Override
164
    public final String toString() {
182
    public final String toString() {
165
        return this.getClass().getSimpleName() + " " + this.getAxis() + " " + this.ns + ":" + this.name;
183
        return this.getClass().getSimpleName() + " " + this.getAxis() + " " + this.ns + ":" + this.name;
166
    }
184
    }
167
}
185
}