git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
2095645
Branches
Tags
master
SVMCrossVal.git
javahelper
LabelMap.java
SVMCrossVal toolbox init
Christoph Budziszewski
commited
2095645
at 2008-12-17 13:45:29
LabelMap.java
Blame
History
Raw
import java.util.HashMap; class LabelMap { private HashMap<String,Double> labelToValue; private HashMap<Double,String> valueToLabel; public LabelMap(){ this(2); } public LabelMap(int numberOfLabels){ labelToValue = new HashMap<String,Double>(numberOfLabels+1,1); valueToLabel = new HashMap<Double,String>(numberOfLabels+1,1); } public void add(String label, double value){ labelToValue.put(label,value); valueToLabel.put(value,label); } public String getLabel(double value){ return valueToLabel.get(value); } public Double getValue(String label){ return labelToValue.get(label); } public String toString(){ StringBuffer s = new StringBuffer("LabelMap: \n"); for( String key : labelToValue.keySet()){ s.append(key+'\t'+labelToValue.get(key)+"\n"); } return s.toString(); } }