}
return builder.build();
}
public static DistanceFunction getDistanceFunction(String action) throws Exception{
DistanceFunction distanceFunction;
String[] tmp = action.split("\\|", 2);
action = tmp[0].trim().toLowerCase();
if(distanceFunctions.containsKey(action)){
distanceFunction= distanceFunctions.get(action).getClass().newInstance();
}else{
throw new Exception("Distance Function "+action+" was not found!");
}
if(tmp.length > 1) {
distanceFunction.setParameters(tmp[1]);
}
return distanceFunction;
}