All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iodesystems.fn.logic.Condition Maven / Gradle / Ivy

Go to download

Fn is a lazy Java Library that helps utilize some rudimentary functional concepts with more nounular objects

There is a newer version: 3.0.4
Show newest version
package com.iodesystems.fn.logic;

public abstract class Condition implements Where {
    public static  Condition of(final Where where) {
        return new Condition() {
            @Override
            public boolean is(A a) {
                return where.is(a);
            }
        };
    }

    public Condition or(final Where where) {
        return new Condition() {
            @Override
            public boolean is(A a) {
                return Condition.this.is(a) || where.is(a);
            }
        };
    }

    public Condition and(final Where where) {
        return new Condition() {
            @Override
            public boolean is(A a) {
                return Condition.this.is(a) && where.is(a);
            }
        };
    }

    public static  Condition not(final Where filter) {
        return new Condition() {
            @Override
            public boolean is(V v) {
                return !filter.is(v);
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy