OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 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.utils.cc;
14
 package org.openconcerto.utils.cc;
15
 
15
 
16
import org.apache.commons.collections.Predicate;
-
 
17
 
-
 
18
public abstract class IPredicate<E> implements Predicate {
16
public abstract class IPredicate<E> {
19
 
17
 
20
    private static final IPredicate<Object> truePred = new IPredicate<Object>() {
18
    private static final IPredicate<Object> truePred = new IPredicate<Object>() {
21
        @Override
19
        @Override
22
        public boolean evaluateChecked(Object input) {
20
        public boolean evaluateChecked(Object input) {
23
            return true;
21
            return true;
Line 49... Line 47...
49
    @SuppressWarnings("unchecked")
47
    @SuppressWarnings("unchecked")
50
    public static final <N> IPredicate<N> notNullPredicate() {
48
    public static final <N> IPredicate<N> notNullPredicate() {
51
        return (IPredicate<N>) NotNullPred;
49
        return (IPredicate<N>) NotNullPred;
52
    }
50
    }
53
 
51
 
54
    @SuppressWarnings("unchecked")
-
 
55
    @Override
-
 
56
    public boolean evaluate(Object object) {
-
 
57
        return this.evaluateChecked((E) object);
-
 
58
    }
-
 
59
 
-
 
60
    public abstract boolean evaluateChecked(E input);
52
    public abstract boolean evaluateChecked(E input);
61
 
53
 
62
    public final <F extends E> IPredicate<F> cast() {
54
    public final <F extends E> IPredicate<F> cast() {
63
        // this class never returns E, only takes it as argument
55
        // this class never returns E, only takes it as argument
64
        // but we cannot return this instance :
56
        // but we cannot return this instance :