fj.data.optic.Traversal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionaljava Show documentation
Show all versions of functionaljava Show documentation
Functional Java is an open source library that supports closures for the Java programming language
package fj.data.optic;
import fj.F;
import fj.F3;
import fj.F4;
import fj.F5;
import fj.F6;
import fj.F7;
import fj.Monoid;
import fj.P1;
import fj.control.Trampoline;
import fj.control.parallel.Promise;
import fj.data.Either;
import fj.data.IO;
import fj.data.List;
import fj.data.Option;
import fj.data.Stream;
import fj.data.Validation;
import fj.data.vector.V2;
public final class Traversal extends PTraversal {
final PTraversal pTraversal;
public Traversal(final PTraversal pTraversal) {
this.pTraversal = pTraversal;
}
@Override
public F> modifyFunctionF(final F> f) {
return pTraversal.modifyFunctionF(f);
}
@Override
public F> modifyEitherF(final F> f) {
return pTraversal.modifyEitherF(f);
}
@Override
public F> modifyIOF(final F> f) {
return pTraversal.modifyIOF(f);
}
@Override
public F> modifyTrampolineF(final F> f) {
return pTraversal.modifyTrampolineF(f);
}
@Override
public F> modifyPromiseF(final F> f) {
return pTraversal.modifyPromiseF(f);
}
@Override
public F> modifyListF(final F> f) {
return pTraversal.modifyListF(f);
}
@Override
public F> modifyOptionF(final F> f) {
return pTraversal.modifyOptionF(f);
}
@Override
public F> modifyStreamF(final F> f) {
return pTraversal.modifyStreamF(f);
}
@Override
public F> modifyP1F(final F> f) {
return pTraversal.modifyP1F(f);
}
@Override
public F> modifyValidationF(final F> f) {
return pTraversal.modifyValidationF(f);
}
@Override
public F> modifyV2F(final F> f) {
return pTraversal.modifyV2F(f);
}
@Override
public F foldMap(final Monoid monoid, final F f) {
return pTraversal.foldMap(monoid, f);
}
/** join two {@link Traversal} with the same target */
public Traversal, A> sum(final Traversal other) {
return new Traversal<>(pTraversal.sum(other.pTraversal));
}
/***************************************************************/
/** Compose methods between a {@link Traversal} and another Optics */
/***************************************************************/
/** compose a {@link Traversal} with a {@link Setter} */
public Setter composeSetter(final Setter other) {
return new Setter<>(pTraversal.composeSetter(other.pSetter));
}
/** compose a {@link Traversal} with a {@link Traversal} */
public Traversal composeTraversal(final Traversal other) {
return new Traversal<>(pTraversal.composeTraversal(other.pTraversal));
}
/*********************************************************************/
/** Transformation methods to view a {@link Traversal} as another Optics */
/*********************************************************************/
/** view a {@link Traversal} as a {@link Setter} */
@Override
public Setter asSetter() {
return new Setter<>(pTraversal.asSetter());
}
public static Traversal id() {
return new Traversal<>(PTraversal.pId());
}
public static Traversal, S> codiagonal() {
return new Traversal<>(PTraversal.pCodiagonal());
}
public static Traversal traversal(final F get1, final F get2, final F3 set) {
return new Traversal<>(PTraversal.pTraversal(get1, get2, set));
}
public static Traversal traversal(final F get1, final F get2, final F get3,
final F4 set) {
return new Traversal<>(PTraversal.pTraversal(get1, get2, get3, set));
}
public static Traversal traversal(final F get1, final F get2, final F get3,
final F get4, final F5 set) {
return new Traversal<>(PTraversal.pTraversal(get1, get2, get3, get4, set));
}
public static Traversal traversal(final F get1, final F get2, final F get3,
final F get4, final F get5, final F6 set) {
return new Traversal<>(PTraversal.pTraversal(get1, get2, get3, get4, get5, set));
}
public static Traversal traversal(final F get1, final F get2, final F get3,
final F get4, final F get5, final F get6, final F7 set) {
return new Traversal<>(PTraversal.pTraversal(get1, get2, get3, get4, get5, get6,
set));
}
}