com.almworks.jira.structure.api.util.La2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of structure-api Show documentation
Show all versions of structure-api Show documentation
Public API for the Structure Plugin for JIRA
package com.almworks.jira.structure.api.util;
import org.jetbrains.annotations.NotNull;
import java.util.function.BiFunction;
public abstract class La2 implements BiFunction {
public abstract R la(A1 a1, A2 a2);
@Override
public R apply(A1 a1, A2 a2) {
return la(a1, a2);
}
public La la(final A1 a1) {
return new La() {
@Override
public R la(A2 a2) {
return La2.this.la(a1, a2);
}
};
}
public static La2 uncurry(@NotNull final La> curried) {
return new La2() {
@Override
public R la(A1 a1, A2 a2) {
La f = curried.la(a1);
return f == null ? null : f.la(a2);
}
};
}
public static Const const2(R ret) {
return new Const(ret);
}
public static Binder2 bind2(La f) {
return new Binder2(f);
}
public static final La2 sum = new La2() {
@Override
public Integer la(Integer x, Integer y) {
return x + y;
}
};
public static class Const {
private final R myR;
public Const(R r) {
myR = r;
}
public La2 f() {
return uncurry(La.>constant(La.constant(myR)));
}
}
public static class Binder2 {
private final La myF;
public Binder2(La f) {
myF = f;
}
public La2 create() {
return new La2() {
@Override
public R la(A1 a1, A2 a2) {
return myF.la(a2);
}
};
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy