T - the type of all objects mapped to Subdivision.faces()public interface SubdivisionMap<T>
Subdivision to arbitrary objects.
Provides an application-specific mapping of all Subdivision.faces()
of a planar Subdivision to arbitrary objects. The use of an interface
allows clients to implement the most efficient mapping for their concrete
Subdivision structure and object type.
Since the Subdivision has no knowledge of any SubdivisionMap
instances that reference it, clients must manually update any such instances
whenever the underlying Subdivision changes.
| Modifier and Type | Method and Description |
|---|---|
default T |
fromFace(SubdivisionFace face)
Converts the specified
SubdivisionFace into the associated T instance. |
Subdivision |
source()
Gets the
Subdivision that contains all mapped Subdivision.faces(). |
java.lang.Object |
target()
Gets the
Object that defines all mapped T instances. |
default SubdivisionFace |
toFace(T value)
Converts the specified T instance into the associated
SubdivisionFace. |
Subdivision source()
Subdivision that contains all mapped Subdivision.faces().
Never null. Multiple SubdivisionMap implementations may refer to the
same source(), mapping its Subdivision.faces() to different objects.Subdivision that contains all Subdivision.faces() accepted
and returned by fromFace(org.kynosarges.tektosyne.subdivision.SubdivisionFace) and toFace(T), respectivelyjava.lang.Object target()
Object that defines all mapped T instances.
May be null if providing a container for all associated T instances
is impossible or inconvenient.Object that defines all T instances returned and accepted
by fromFace(org.kynosarges.tektosyne.subdivision.SubdivisionFace) and toFace(T), respectivelydefault T fromFace(SubdivisionFace face)
SubdivisionFace into the associated T instance.face - the SubdivisionFace to convertfacejava.lang.IllegalArgumentException - if source() does not contain facejava.lang.UnsupportedOperationException - if not overridden by an implementing classjava.lang.NullPointerException - if face is nulldefault SubdivisionFace toFace(T value)
SubdivisionFace.value - the T instance to convertSubdivisionFace associated with valuejava.lang.IllegalArgumentException - if value does not map to any
SubdivisionFace within source()java.lang.UnsupportedOperationException - if not overridden by an implementing class