replaced.clear(); Set<String> keySet=targetsField.keySet(); String[] names=new String[keySet.size()]; keySet.toArray(names); for(int i=0;i<names.length;i++) { String name=names[i];  CType type=getType(name, unit.getFields()); if(type==null) break;  Set<Object>tmpSet = targetsField.get(name).keySet(); Integer[] ints=new Integer[tmpSet.size()]; tmpSet.toArray(ints); int top=0; for(int j=0;j<ints.length;j++) { int newInt=ints[j].intValue(); if(newInt>top) top=newInt;
replaced.clear();  for(String name : targetsField.keySet()) {   JVariableDefinition var = getDefn(name, unit.getFields()); CType arrayType = var.getType(); if(arrayType==null) { continue; } assert arrayType instanceof CArrayType;  CType baseType = ((CArrayType)arrayType).getBaseType(); JExpression init = var.getValue();  JExpression[] elems; if (init == null) { elems = null; } else if (init instanceof JArrayInitializer) { elems = ((JArrayInitializer)init).getElems(); } else { throw new AssertionError("unexpected array field initialization " + init.getClass());
    public void destroyFieldArrays(SIRCodeUnit unit) {        replaced.clear();        Set<String> keySet=targetsField.keySet();        String[] names=new String[keySet.size()];        keySet.toArray(names);        for(int i=0;i<names.length;i++) {            String name=names[i];            //CType type=(CType)((HashMap)targetsField.get(name)).remove(Boolean.TRUE);            CType type=getType(name, unit.getFields());            if(type==null)                break;            // XXX: Want Set<Integer>, previosly reused keySet.            Set<Object>tmpSet = targetsField.get(name).keySet();            Integer[] ints=new Integer[tmpSet.size()];            tmpSet.toArray(ints);            int top=0;            for(int j=0;j<ints.length;j++) {                int newInt=ints[j].intValue();                if(newInt>top)                    top=newInt;            }            String[] newFields=new String[top+1];            for(int j=0;j<ints.length;j++) {                int newInt=ints[j].intValue();                JFieldDeclaration newField=toField(name,newInt,type);                unit.addField(newField);                newFields[newInt]=newField.getVariable().getIdent();            }            replaced.put(name,newFields);        }        JMethodDeclaration[] methods = unit.getMethods();         for(int i=0;i<methods.length;i++) {            JMethodDeclaration method=methods[i];            //if(!(method.getName().startsWith("work")||method.getName().startsWith("initWork")))                method.getBody().accept(this);        }    }