private void generatedSubclassCodesWithSortingLabels(RDFSNamedClass icdCategory, Collection subclses, String seedCode){
Map mapLabels = new HashMap();
Collection colSortingLabels = new ArrayList();
for(Iterator it = subclses.iterator(); it.hasNext();){
RDFSNamedClass subcls = (RDFSNamedClass) it.next();
//It seems that sorting label may duplicate, so we added additional text to keep it unique
String sortingLabel = this.getSortingLabelForSubclass(subcls) + subcls.getBrowserText();
colSortingLabels.add(sortingLabel);
mapLabels.put(sortingLabel, subcls);
}
Object[] arraySortedCodes = new Object[colSortingLabels.size()];
Object[] arraySortingLabels = colSortingLabels.toArray();
Arrays.sort(arraySortingLabels);
int arraySize = arraySortingLabels.length;
if(arraySize > 26){
System.out.println("too many|" + icdCategory.getBrowserText() + "|" + arraySize);
}
for(int i = 0; i < arraySortingLabels.length; i++){
if(i > 154){
System.out.println("size>154, check please!");
break;
}
String slabel = (String) arraySortingLabels[i];
String scode = seedCode + this.tbdcodes[i];
arraySortedCodes[i] = scode;
RDFSNamedClass ssubcls = (RDFSNamedClass)mapLabels.get(slabel);
//debug
//if(this.isMissingCodes(scode)){
// System.out.println("Got the missing code:" + scode + "|" + ssubcls.getBrowserText());
// this.mapGeneratedCodes.put(ssubcls, scode);
//}
//need debug, why ssubcls is the same
if(!mapGeneratedCodes.containsKey(ssubcls)){
this.mapGeneratedCodes.put(ssubcls, scode);
//System.out.println(scode);
//debug
if(this.isMissingCodes(scode)){
System.out.println("Not the missing code:" + scode + "|" + ssubcls.getBrowserText() + "|" + ssubcls.getURI());
}
}else{
String dupCode = (String) this.mapGeneratedCodes.get(ssubcls);
System.out.println("duplicate code:" + dupCode + "|missing code:" + scode + "|" + ssubcls.getBrowserText());
}
}