com.iodesystems.fn.logic.Condition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fn Show documentation
Show all versions of fn Show documentation
Fn is a lazy Java Library that helps utilize some rudimentary functional concepts with more nounular
objects
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);
}
};
}
}