summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/funcutils/Isomorphism.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-12-01 20:19:34 -0500
committerBen Culkin <scorpress@gmail.com>2020-12-01 20:19:34 -0500
commitfefd6eb2917b9a0856c247353545cc13876b6eda (patch)
tree374e2d31426accd3f00c6bbbff2ff75123d92da2 /base/src/main/java/bjc/utils/funcutils/Isomorphism.java
parent03de62016afa4e392f32069ec28ad58ee38699da (diff)
An assortment of changes/new things
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils/Isomorphism.java')
-rw-r--r--base/src/main/java/bjc/utils/funcutils/Isomorphism.java59
1 files changed, 0 insertions, 59 deletions
diff --git a/base/src/main/java/bjc/utils/funcutils/Isomorphism.java b/base/src/main/java/bjc/utils/funcutils/Isomorphism.java
deleted file mode 100644
index c219d7f..0000000
--- a/base/src/main/java/bjc/utils/funcutils/Isomorphism.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package bjc.utils.funcutils;
-
-import java.util.function.Function;
-
-/**
- * A pair of functions to transform between a pair of types.
- *
- * @author bjculkin
- *
- * @param <S>
- * The source type of the isomorphism.
- *
- * @param <D>
- * The destination type of isomorphism.
- */
-public class Isomorphism<S, D> {
- /* The function to the destination type. */
- private Function<S, D> toFunc;
- /* The function to the source type. */
- private Function<D, S> fromFunc;
-
- /**
- * Create a new isomorphism.
- *
- * @param to
- * The 'forward' function, from the source to the definition.
- *
- * @param from
- * The 'backward' function, from the definition to the source.
- */
- public Isomorphism(Function<S, D> to, Function<D, S> from) {
- toFunc = to;
- fromFunc = from;
- }
-
- /**
- * Apply the isomorphism forward.
- *
- * @param val
- * The source value.
- *
- * @return The destination value.
- */
- public D to(S val) {
- return toFunc.apply(val);
- }
-
- /**
- * Apply the isomorphism backward.
- *
- * @param val
- * The destination value.
- *
- * @return The source value.
- */
- public S from(D val) {
- return fromFunc.apply(val);
- }
-}