@LabelMap/LabelMap.m
2095645b
 function map = LabelMap(label,value)
 %LabelMap(labelCellList,valueCellList) maps Label to Classvalues suitable for
 %SVM
 
 if nargin == 2
     if ~ (iscell(label) && iscell(value))
         error('LabelMap:Constructor:argsNoCell','Arguments have to be CellArrays. Vectors not yet supported. sorry.');
     end   
     if(any(size(label) ~= size(value)))
         error('LabelMap:Constructor:sizeDontMatch','Label List and Value List must be the same size!');
     end
     
     map.labelToValue = java.util.HashMap;
     map.valueToLabel = java.util.HashMap;
     
     for i = 1:max(size(label)) % cell array is 1:x or x:1, indexing is same
        map.labelToValue.put(label{i},value{i}); 
        map.valueToLabel.put(value{i},label{i});
     end
     
     map = class(map,'LabelMap');
 else
     error('LabelMap:Constructor:noArgs','Sorry, default constructor not supported yet!');
 end
 
 end