TITLE:: FluidLabelSet
summary:: A set of labels associated with IDs
categories:: FluidManipulation
related:: Classes/FluidDataSet, Classes/FluidKMeans

DESCRIPTION::
FluidLabelSet is a server-side container of associations between labels (from a link::Classes/FluidDataSet::) and IDs, for instance from some clustering or classification of the points in a data set.


CLASSMETHODS::

METHOD:: new
Make a new instance of a label set, uniquely identified by its name. Creating an instance with a name already in use will throw an exception. Use link::Classes/FluidLabelSet#*at:: or free the existing instance.
ARGUMENT:: server
The link::Classes/Server:: on which to create the label set.
ARGUMENT:: name
symbol with the label set's name.

METHOD:: at
Retrieve a label set from the cache.
ARGUMENT:: server
The link::Classes/Server:: on which to create the label set.
ARGUMENT:: name
symbol or string with the label set's name.


INSTANCEMETHODS::

PRIVATE:: init, id

METHOD:: addLabel
Add a label to the label set.
ARGUMENT:: id
symbol or string with the ID for this label.
ARGUMENT:: label
symbol or string with the label to add.
ARGUMENT:: action
function to run when the operation completes.

METHOD:: updateLabel
Change a label in the label set.

METHOD:: getLabel
Retrieve the label associated with an ID. Will report an error if the ID isn't present in the set.

METHOD:: deleteLabel
Remove a id-label pair from the label set.

METHOD:: clear
Empty the label set.


METHOD:: print
Post an abbreviated content of the label set in the window by default, but you can supply a custom action instead.

EXAMPLES::

code::
~ls = FluidLabelSet.new(s,\labelset_example);

["one", "two", "three"].collect{|x,i| ~ls.addLabel(i, x);};
~ls.print;

~ls.free;
::
