Module type Swarm.EXPOSURE


module type EXPOSURE = sig  end
This module separates all the matching computation software away from the residents proper. A module of type EXPOSURE must be given as a parameter to the SWARMMAKER functor in order to create a SWARM. The ultimate residents of the Swarm object will have projections, markers, etc. of the types defined in the exposure.


type projection
This type is used to index the projections of a resident. While conceptually each resident may have different "kinds" of projections, the type is unified across all the residents. int is often used.


type marker
The type of the markings which tag each projection. The same comment given above applies.


type matchinghalf
Used to define the matching, which is returned by the matchings function, both below. A matchinghalf is used to identify a possible match between a pair of markers, on a specific member of the pair. This is meaningful since two markers can have multiple matchings.


type submarker
FIXME: ...


type splitmessage
FIXME: ...


type joinmessage

type matching = matchinghalf * matchinghalf
A matchinghalf on each member of a pair of markers fully identifies a matching. Note that the order is significant.


type bindhalf
An element of this type is returned when a matching is successful, and is retained by the Swarm object and passed back to the resident upon release. FIXME: Somehow, the semantics of this type don't really belong to the EXPOSURE module type, but I don't know where else to place them.

ANOTHER FIXME: Right now, the bindhalf is defined in a very unsafe manner, as it serves two purposes simultaneously: it is used as a holder of a binding (useful as memory upon release, for instance) and also as a holder for resident-specific information (useful to have access to the fragment of a ligand for instance). Change this in the future by introducing a object which delegates to two bindhalves, to be used as a holder.


val matchings : marker * marker -> matching list
The central role of an EXPOSURE module is to calculate the matchings between a pair of makers, which is what this function does. If the return list is empty, the markers do not match; a single matching indicates an unambiguous match; multiple matchings an ambiguous match, as in the case of a regular expression matching multiple substrings of a string.
val affinity : matching -> int
Each matching can be further tagged with a strength, called the affinity. For instance, the affinity may be based on the relative position of the two projections involved (which must be saved in the matching for this to be computable).