Collective			group of named network participants	

superclass: Object

This class allows to conveniently access a set of named network addresses independent of the actual computer they are located on (see: NamedNetAddr). It encapsulates automatic joining of participants. 

Joining and quitting automatically can be sometimes error prone (e.g. when another participant crashes). For the simplest case, it ios always possible to only send messages to all. For this, no participant needs to be registered.

	*new(myName, groupName, participants)
	
		return a new instance of Collective, and add participants to it (optional).
		Different subclasses of Participation make this more convenient.
		
		myName - a symbol which is the identifier within the current group
		groupName  - a symbol which is the identifier of this group (default: \all)	
		participants - a list of pairs of names and hostnames in the group.
		
		// example
		a = Collective(\lisa, \session, [\joe, "127.0.0.1", \lisa, "127.0.0.1"]);
		b = Collective(\joe, \session, [\joe, "127.0.0.1", \lisa, "127.0.0.1"]);
		a.start; b.start;
		x = a.makeResponder(nil, \chat, { |t, r, msg| msg[1].postln }).add;
		y = b.makeResponder(nil, \chat, { |t, r, msg| msg[1].postln }).add;
		a.sendToAll(\chat, "hello joe!");
		a.sendToName(\joe, \chat, "hello joe");
		a.sendToName(\lisa, \chat, "hi lisa");
		a.stop; b.stop; x.remove; y.remove;

	*default
	
		return one single default collective - similar to TempoClock. If not set explicitly, return one with a randomly generated name.
	
	*makeName
	
		returns a random name, with the last byte of the hostname attached to it

	
	newAddrAction_(func) -	an optional action that is evaluated when a new address is received.
	sortFunc_(func) - if sortFunc is given, addresses are sorted when new addr was added.

Examples

// a randomly generated name, and three instances of collective. Like this one may 
// test network apps locally and later transfer them to multiple computers.

a = { Collective.new }.dup(3);
a.do(_.autoCollect(true));
a[0].everybody.postln;
a.do(_.makeWin);

// create responders from each one
(
r = a.collect { |coll| 
	coll.makeResponder(nil, \test, { |t, r, msg| 
				(coll.myName + "received:" + msg[1]).postln 
	}).add 
}
);
									
a.choose.sendToAll(\test, "this is a test");
a.choose.sendToName(b = a.choose.myName, \test, "this is a test sent to" + b);

// quit.
a.do {|coll| coll.quit }; // quit: notify the others. stop: stop collecting
a.collect(_.everybody); // all empty.
r.do(_.remove); // remove responders