Skip to content

Commit

Permalink
feat(api): quda functional interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Sep 16, 2022
1 parent 94ffcf8 commit 52e56f4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
@@ -0,0 +1,8 @@
package org.auioc.mcmod.arnicalib.api.java.function;

@FunctionalInterface
public interface QuadConsumer<A, B, C, D> {

void accept(A a, B b, C c, D d);

}
@@ -0,0 +1,8 @@
package org.auioc.mcmod.arnicalib.api.java.function;

@FunctionalInterface
public interface QuadFunction<A, B, C, D, R> {

R apply(A a, B b, C c, D d);

}
@@ -0,0 +1,24 @@
package org.auioc.mcmod.arnicalib.api.java.function;

import java.util.Objects;

@FunctionalInterface
public interface QuadPredicate<A, B, C, D> {

boolean test(A a, B b, C c, D d);

default QuadPredicate<A, B, C, D> negate() {
return (A a, B b, C c, D d) -> !test(a, b, c, d);
}

default QuadPredicate<A, B, C, D> and(QuadPredicate<? super A, ? super B, ? super C, ? super D> other) {
Objects.requireNonNull(other);
return (A a, B b, C c, D d) -> test(a, b, c, d) && other.test(a, b, c, d);
}

default QuadPredicate<A, B, C, D> or(QuadPredicate<? super A, ? super B, ? super C, ? super D> other) {
Objects.requireNonNull(other);
return (A a, B b, C c, D d) -> test(a, b, c, d) || other.test(a, b, c, d);
}

}

0 comments on commit 52e56f4

Please sign in to comment.