public String registerName(final String name,final Operator operator){
  if (operatorNameMap.get(name) != null) {
    String baseName=name;
    int index=baseName.indexOf(" (");
    if (index >= 0) {
      baseName=baseName.substring(0,index);
    }
    int i=2;
    while (operatorNameMap.get(baseName + " (" + i+ ")") != null) {
      i++;
    }
    String newName=baseName + " (" + i+ ")";
    operatorNameMap.put(newName,operator);
    return newName;
  }
 else {
    operatorNameMap.put(name,operator);
    return name;
  }
}

public String registerName ( final String name , final Operator operator ) { if ( operatorNameMap . get ( name ) != null ) { String baseName = name ; int index = baseName . indexOf ( " (" ) ; if ( index >= 0 ) { baseName = baseName . substring ( 0 , index ) ; } int i = 2 ; while ( operatorNameMap . get ( baseName + " (" + i + ")" ) != null ) { i ++ ; } String newName = baseName + " (" + i + ")" ; operatorNameMap . put ( newName , operator ) ; return newName ; } else { operatorNameMap . put ( name , operator ) ; return name ; } }
returns a & quot ; name ( i ) & quot ; if name is already in use . this new name should then be used as operator name .
