@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException {
if(args.size() < 1 || args.size() > 3){
throw new TemplateModelException("Wrong number of arguments");
}
SimpleHash tagCloudHash = new SimpleHash(new HashMap<String,Integer>());
List<TagLabel> tags = getTagLabelFromArg1(args.get(0));
int numOfFontSize = 6;
if(args.size() > 1){
numOfFontSize = getNumOfFontSize(args.get(1));
}
/*
if(args.size() > 2){
String[] filter = getFilterPattern(args.get(2));
}
*/
int[] maxMin = getMaxMin(tags);
int max = maxMin[0];
int min = maxMin[1];
double[] threshold = compThreshold(max, min, numOfFontSize);
for(TagLabel aTag : tags){
boolean fontSetFlag = false;
for (int i = 0; i < numOfFontSize; i++) {
if (fontSetFlag == false) {
if (aTag.getCount() <= threshold[i]) {
tagCloudHash.put(aTag.getLabel(),i+1);
fontSetFlag = true;
}
} else {
break;
}