sig
  module type EXPOSURE =
    sig
      type projection
      and marker
      and matchinghalf
      and submarker
      and splitmessage
      and joinmessage
      and matching =
        Swarm.EXPOSURE.matchinghalf * Swarm.EXPOSURE.matchinghalf
      and bindhalf
      val matchings :
        Swarm.EXPOSURE.marker * Swarm.EXPOSURE.marker ->
        Swarm.EXPOSURE.matching list
      val affinity : Swarm.EXPOSURE.matching -> int
    end
  exception No_matching_marker
  exception Invalid_matchinghalf
  exception No_such_binding
  module type SWARM =
    sig
      type projection
      and marker
      and submarker
      and matchinghalf
      and splitmessage
      and joinmessage
      and matching = Swarm.SWARM.matchinghalf * Swarm.SWARM.matchinghalf
      and bindhalf
      and 'a resident
      and 'a bindholder
      class type notifier_type =
        object
          method get_symmetric :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf -> Swarm.SWARM.bindhalf
          method join :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.bindhalf -> Swarm.SWARM.joinmessage -> unit
          method notify : unit
          method release :
            Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
          method split :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf -> Swarm.SWARM.splitmessage -> unit
          method transfer :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
        end
      type whichsplit = SplitFirst | SplitSecond
      and splitpart =
        Swarm.SWARM.projection ->
        Swarm.SWARM.bindhalf ->
        Swarm.SWARM.whichsplit *
        (Swarm.SWARM.projection * Swarm.SWARM.bindhalf)
      and joinpart =
        Swarm.SWARM.whichsplit ->
        Swarm.SWARM.projection ->
        Swarm.SWARM.bindhalf -> Swarm.SWARM.projection * Swarm.SWARM.bindhalf
      class type core =
        object ('a)
          method click : unit -> bool
          method get_full_marker :
            Swarm.SWARM.projection -> Swarm.SWARM.marker
          method get_projection : unit -> Swarm.SWARM.projection list
          method get_submarker :
            Swarm.SWARM.projection ->
            Swarm.SWARM.matchinghalf -> Swarm.SWARM.submarker
          method has_active : Swarm.SWARM.projection -> bool
          method is_started : unit -> bool
          method reset_notifier : unit -> unit
          method set_notifier : Swarm.SWARM.notifier_type -> unit
          method start : unit -> unit
          method stop : unit -> unit
          method tarjoin :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            '->
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.joinmessage ->
            ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
            Swarm.SWARM.joinpart
          method tarsplit :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.splitmessage ->
            ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
            ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
            Swarm.SWARM.splitpart
          method unimate_dock :
            Swarm.SWARM.projection ->
            Swarm.SWARM.matchinghalf ->
            Swarm.SWARM.submarker -> Swarm.SWARM.bindhalf
          method unimate_prop :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf -> 'Swarm.SWARM.bindholder -> unit
          method unimate_undock :
            Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
          method unirelease :
            Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
        end
      class base_core :
        object ('a)
          method is_started : unit -> bool
          method ngetsym :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf -> Swarm.SWARM.bindhalf
          method njoin :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.bindhalf -> Swarm.SWARM.joinmessage -> unit
          method nnotify : unit -> unit
          method nrelease :
            Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
          method nsplit :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf -> Swarm.SWARM.splitmessage -> unit
          method ntransfer :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
          method reset_notifier : unit -> unit
          method set_notifier : Swarm.SWARM.notifier_type -> unit
          method start : unit -> unit
          method stop : unit -> unit
          method tarjoin :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            '->
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.joinmessage ->
            ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
            Swarm.SWARM.joinpart
          method tarsplit :
            Swarm.SWARM.projection ->
            Swarm.SWARM.bindhalf ->
            Swarm.SWARM.splitmessage ->
            ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
            ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
            Swarm.SWARM.splitpart
        end
      class type ['a] t =
        object
          constraint 'a = #Swarm.SWARM.core
          method break : unit -> unit
          method get_core : 'Swarm.SWARM.resident -> 'a
          method is_running : unit -> bool
          method list_residents : 'Swarm.SWARM.resident list
          method remove : 'Swarm.SWARM.resident -> unit
          method run : unit -> unit
          method shelter : '-> 'Swarm.SWARM.resident
          method start_all : unit -> unit
          method start_resident : 'Swarm.SWARM.resident -> unit
          method stop_all : unit -> unit
          method stop_resident : 'Swarm.SWARM.resident -> unit
          method wake : 'Swarm.SWARM.resident -> unit
        end
      val make : unit -> #Swarm.SWARM.core Swarm.SWARM.t
    end
  module type SWARMMAKER =
    functor (R : EXPOSURE->
      sig
        type projection = R.projection
        and marker = R.marker
        and submarker = R.submarker
        and matchinghalf = R.matchinghalf
        and splitmessage = R.splitmessage
        and joinmessage = R.joinmessage
        and matching = Swarm.SWARM.matchinghalf * Swarm.SWARM.matchinghalf
        and bindhalf = R.bindhalf
        and 'a resident
        and 'a bindholder
        class type notifier_type =
          object
            method get_symmetric :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf -> Swarm.SWARM.bindhalf
            method join :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.bindhalf -> Swarm.SWARM.joinmessage -> unit
            method notify : unit
            method release :
              Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
            method split :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf -> Swarm.SWARM.splitmessage -> unit
            method transfer :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
          end
        type whichsplit = SplitFirst | SplitSecond
        and splitpart =
          Swarm.SWARM.projection ->
          Swarm.SWARM.bindhalf ->
          Swarm.SWARM.whichsplit *
          (Swarm.SWARM.projection * Swarm.SWARM.bindhalf)
        and joinpart =
          Swarm.SWARM.whichsplit ->
          Swarm.SWARM.projection ->
          Swarm.SWARM.bindhalf ->
          Swarm.SWARM.projection * Swarm.SWARM.bindhalf
        class type core =
          object ('a)
            method click : unit -> bool
            method get_full_marker :
              Swarm.SWARM.projection -> Swarm.SWARM.marker
            method get_projection : unit -> Swarm.SWARM.projection list
            method get_submarker :
              Swarm.SWARM.projection ->
              Swarm.SWARM.matchinghalf -> Swarm.SWARM.submarker
            method has_active : Swarm.SWARM.projection -> bool
            method is_started : unit -> bool
            method reset_notifier : unit -> unit
            method set_notifier : Swarm.SWARM.notifier_type -> unit
            method start : unit -> unit
            method stop : unit -> unit
            method tarjoin :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              '->
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.joinmessage ->
              ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
              Swarm.SWARM.joinpart
            method tarsplit :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.splitmessage ->
              ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
              ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
              Swarm.SWARM.splitpart
            method unimate_dock :
              Swarm.SWARM.projection ->
              Swarm.SWARM.matchinghalf ->
              Swarm.SWARM.submarker -> Swarm.SWARM.bindhalf
            method unimate_prop :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf -> 'Swarm.SWARM.bindholder -> unit
            method unimate_undock :
              Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
            method unirelease :
              Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
          end
        class base_core :
          object ('a)
            method is_started : unit -> bool
            method ngetsym :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf -> Swarm.SWARM.bindhalf
            method njoin :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.bindhalf -> Swarm.SWARM.joinmessage -> unit
            method nnotify : unit -> unit
            method nrelease :
              Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
            method nsplit :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf -> Swarm.SWARM.splitmessage -> unit
            method ntransfer :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.projection -> Swarm.SWARM.bindhalf -> unit
            method reset_notifier : unit -> unit
            method set_notifier : Swarm.SWARM.notifier_type -> unit
            method start : unit -> unit
            method stop : unit -> unit
            method tarjoin :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              '->
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.joinmessage ->
              ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
              Swarm.SWARM.joinpart
            method tarsplit :
              Swarm.SWARM.projection ->
              Swarm.SWARM.bindhalf ->
              Swarm.SWARM.splitmessage ->
              ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
              ('a * Swarm.SWARM.projection * Swarm.SWARM.bindhalf) *
              Swarm.SWARM.splitpart
          end
        class type ['a] t =
          object
            constraint 'a = #Swarm.SWARM.core
            method break : unit -> unit
            method get_core : 'Swarm.SWARM.resident -> 'a
            method is_running : unit -> bool
            method list_residents : 'Swarm.SWARM.resident list
            method remove : 'Swarm.SWARM.resident -> unit
            method run : unit -> unit
            method shelter : '-> 'Swarm.SWARM.resident
            method start_all : unit -> unit
            method start_resident : 'Swarm.SWARM.resident -> unit
            method stop_all : unit -> unit
            method stop_resident : 'Swarm.SWARM.resident -> unit
            method wake : 'Swarm.SWARM.resident -> unit
          end
        val make : unit -> #Swarm.SWARM.core Swarm.SWARM.t
      end
  module SerializedSwarm : SWARMMAKER
end