OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 93 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 93 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 29... Line 29...
29
 
29
 
30
    private final List<SearchSpec> items;
30
    private final List<SearchSpec> items;
31
 
31
 
32
    public SearchList() {
32
    public SearchList() {
33
        super();
33
        super();
34
        this.items = new OrderedSet<SearchSpec>();
34
        this.items = new OrderedSet<>();
35
    }
35
    }
36
 
36
 
37
    public void addSearchItem(SearchSpec item) {
37
    public void addSearchItem(SearchSpec item) {
38
        this.items.add(item);
38
        this.items.add(item);
39
    }
39
    }
40
 
40
 
41
    public void removeSearchItem(SearchSpec item) {
41
    public void removeSearchItem(SearchSpec item) {
42
        this.items.remove(item);
42
        this.items.remove(item);
43
    }
43
    }
44
 
44
 
-
 
45
    @Override
45
    public boolean isEmpty() {
46
    public boolean isEmpty() {
46
        for (final SearchSpec s : this.items)
47
        for (final SearchSpec s : this.items)
47
            if (!s.isEmpty())
48
            if (!s.isEmpty())
48
                return false;
49
                return false;
49
        return true;
50
        return true;
50
    }
51
    }
51
 
52
 
-
 
53
    @Override
52
    public boolean match(Object line) {
54
    public boolean match(Object line) {
53
        return this.match((List) line);
55
        return this.match((List<?>) line);
54
    }
56
    }
55
 
57
 
56
    // fait un AND de tous les éléments
58
    // fait un AND de tous les éléments
57
    private boolean match(List line) {
59
    private boolean match(List<?> line) {
58
        // List de String, cad 1 String par colonne
60
        // List de String, cad 1 String par colonne
59
 
61
 
60
        boolean result = false;
62
        boolean result = false;
61
        final int stop = this.items.size();
63
        final int stop = this.items.size();
62
        for (int i = 0; i < stop; i++) {
64
        for (int i = 0; i < stop; i++) {
Line 67... Line 69...
67
            result = true;
69
            result = true;
68
        }
70
        }
69
        return result;
71
        return result;
70
    }
72
    }
71
 
73
 
-
 
74
    @Override
72
    public String toString() {
75
    public String toString() {
73
        final StringBuffer sb = new StringBuffer(this.items.size() * 32);
76
        final StringBuffer sb = new StringBuffer(this.items.size() * 32);
74
        sb.append("SearchList:" + this.items.size() + " items");
77
        sb.append("SearchList:" + this.items.size() + " items");
75
        for (final SearchSpec item : this.items) {
78
        for (final SearchSpec item : this.items) {
76
            sb.append("\n");
79
            sb.append("\n");