public class Isomorphism.Mapping
extends java.lang.Object
Isomorphism
,
represents a mapping according to a given key equality.Modifier and Type | Method and Description |
---|---|
<S> S |
getCopy(Copyable<? extends S> node)
Make a shallow copy of the given
Copyable , or fetch an existing
mapping if one has been made via this Isomorphism . |
<S> S |
getDeepCopy(Copyable<? extends S> node)
Make a deep copy of the given
Copyable , or fetch an existing
mapping if one has been made via this Isomorphism . |
java.util.Set<?> |
getMappedNodes() |
<S,C> S |
getMapping(C node,
java.util.function.Function<C,S> mapping)
Make a mapping of the given node, or fetch an existing mapping if one has
been made via this
Isomorphism . |
java.lang.Object |
getMapping(java.lang.Object node)
Fetch an existing mapping if one has been made via this
Isomorphism . |
<S,C> S |
getPartialMapping(C node,
java.util.function.BiFunction<C,java.util.function.Consumer<java.util.function.Supplier<S>>,S> mapping)
Make a mapping of the given node, or fetch an existing mapping if one has
been made via this
Isomorphism . |
<S,C> S |
getPartialMapping(C node,
java.util.function.Supplier<S> partial,
java.util.function.Function<C,S> mapping)
Make a mapping of the given node, or fetch an existing mapping if one has
been made via this
Isomorphism . |
<S,C> S |
getProxiedMapping(C node,
java.lang.Class<? extends S> proxyClass,
java.util.function.Function<C,S> mapping)
Make a mapping of the given node, or fetch an existing mapping if one has
been made via this
Isomorphism . |
<S,C> S |
getProxiedMapping(C node,
java.lang.ClassLoader classLoader,
java.lang.Class<? extends S> proxyClass,
java.util.function.Function<C,S> mapping)
Make a mapping of the given node, or fetch an existing mapping if one has
been made via this
Isomorphism . |
boolean |
isEmpty() |
<S,C> void |
putMapping(C node,
S mapping)
Make a mapping of the given node, or fetch an existing mapping if one has
been made via this
Isomorphism . |
public <S> S getCopy(Copyable<? extends S> node)
Copyable
, or fetch an existing
mapping if one has been made via this Isomorphism
.S
- the type of the resultnode
- the graph node to copypublic <S> S getDeepCopy(Copyable<? extends S> node)
Copyable
, or fetch an existing
mapping if one has been made via this Isomorphism
.S
- the type of the resultnode
- the graph node to copypublic <S,C> void putMapping(C node, S mapping)
Isomorphism
.S
- the type of the nodeC
- the type of the resultnode
- the graph node to mapmapping
- the mapping to providepublic boolean isEmpty()
public java.util.Set<?> getMappedNodes()
public java.lang.Object getMapping(java.lang.Object node)
Isomorphism
.node
- the graph node to mappublic <S,C> S getMapping(C node, java.util.function.Function<C,S> mapping)
Isomorphism
.S
- the type of the nodeC
- the type of the resultnode
- the graph node to mapmapping
- the mapping function to applypublic <S,C> S getPartialMapping(C node, java.util.function.BiFunction<C,java.util.function.Consumer<java.util.function.Supplier<S>>,S> mapping)
Isomorphism
.
In the case of recursive graph structures we sometimes may need access to a partially constructed mapping, as we may revisit a node during the construction of its own mapping.
Once the mapping is calculated, the partial result will be removed from the isomorphism, and future attempts to map the node will return the complete result, though often the two references will be identity equal.
S
- the type of the nodeC
- the type of the resultnode
- the graph node to mapmapping
- the mapping function to apply, also accepting a consumer which
can be called back with a partial resultpublic <S,C> S getPartialMapping(C node, java.util.function.Supplier<S> partial, java.util.function.Function<C,S> mapping)
Isomorphism
.
In the case of recursive graph structures we sometimes may need access to a partially constructed mapping, as we may revisit a node during the construction of its own mapping.
Once the mapping is calculated, the partial result will be removed from the isomorphism, and future attempts to map the node will return the complete result, though often the two references will be identity equal.
S
- the type of the nodeC
- the type of the resultnode
- the graph node to mappartial
- a partial mapping to use until the proper mapping is computedmapping
- the mapping function to apply, also accepting a consumer which
can be called back with a partial resultpublic <S,C> S getProxiedMapping(C node, java.lang.Class<? extends S> proxyClass, java.util.function.Function<C,S> mapping)
Isomorphism
.
In the case of recursive graph structures we sometimes may need access to a proxied mapping, as we may revisit a node during the construction of its own mapping.
Once the mapping is calculated, the proxied result will be removed from the isomorphism, and future attempts to map the node will return the complete result.
S
- the type of the nodeC
- the type of the resultnode
- the graph node to mapproxyClass
- the class of the result to proxymapping
- the mapping function to applypublic <S,C> S getProxiedMapping(C node, java.lang.ClassLoader classLoader, java.lang.Class<? extends S> proxyClass, java.util.function.Function<C,S> mapping)
Isomorphism
.
In the case of recursive graph structures we sometimes may need access to a proxied mapping, as we may revisit a node during the construction of its own mapping.
Once the mapping is calculated, the proxied result will be removed from the isomorphism, and future attempts to map the node will return the complete result.
S
- the type of the nodeC
- the type of the resultnode
- the graph node to mapclassLoader
- the class loader to use for the proxyproxyClass
- the class of the result to proxymapping
- the mapping function to apply