private void generateCodes(Collection icdCategories){
Map mapCategoryLetter = new HashMap();
for(Iterator it = icdCategories.iterator(); it.hasNext();){
RDFSNamedClass icdCategory = (RDFSNamedClass) it.next();
String code = this.getClassCode(icdCategory);
//System.out.println(code + "|" + icdCategory.getBrowserText());
if(code.equals("TBD")){
//get all sibling classes with code tbd
Collection siblingclses = this.getSiblingClassesWithCodeTBD(icdCategory);
if(siblingclses != null){
int index = 1;
Map mapUsercodeCategory = new HashMap();
Collection userCodes = new ArrayList();
//loop once to get all others assigned
for(Iterator it11 = siblingclses.iterator(); it11.hasNext();){
RDFSNamedClass siblingcls = (RDFSNamedClass) it11.next();
//if(siblingcls.getBrowserText().indexOf("LA10z0") >= 0 ||
//siblingcls.getBrowserText().indexOf("LD32") >= 0){
//System.out.println("sibling:" + siblingcls.getBrowserText());
//}
//get user assigned code
//String usercode = this.getUserAssignedCodeForLabel(siblingcls);
String usercode = siblingcls.getBrowserText();
//String usercode = this.getSortingLabelForSubclass(siblingcls); // introducing sorting label
String sortingLabel = this.getSortingLabelForSubclass(siblingcls);
usercode = sortingLabel + usercode;
if(!userCodes.contains(usercode))
userCodes.add(usercode);
if(!mapUsercodeCategory.containsKey(usercode))
mapUsercodeCategory.put(usercode, siblingcls);
}
//subcode = supercode + tbdcodes[index-1];
//System.out.println(code + "|" + supercode + "|" + category.getBrowserText() + "|" + supercls.getBrowserText());
//index++;
//sorting usercodes
Object[] arrayUserCodes = userCodes.toArray();
Arrays.sort(arrayUserCodes);
for(int i = 0; i < arrayUserCodes.length; i++){
String userCode = (String) arrayUserCodes[i];
RDFSNamedClass theCategory = (RDFSNamedClass) mapUsercodeCategory.get(userCode);
String letter = tbdcodes[i];
this.assignCodeToCategory(theCategory, letter);
if(!mapCategoryLetter.containsKey(theCategory)){
mapCategoryLetter.put(theCategory, letter);
//System.out.println(theCategory.getBrowserText() + "|" + letter);
}
}
}
}
}
for(int h = 0; h < 20; h++){
System.out.println("Num. Codes Not Assigned:" + colCodesNotAssigned.size());
for(Iterator it2 = colCodesNotAssigned.iterator(); it2.hasNext();){
RDFSNamedClass codeNotAssigned = (RDFSNamedClass) it2.next();
String parentCode = this.getParentCode(codeNotAssigned);
if(parentCode != null){
String letter = (String) mapCategoryLetter.get(codeNotAssigned);
String gCode = parentCode + "." + letter;