index = society.indexOf("<node name=");
index = society.indexOf("<healthMonitor name=");
  private String getXmlForEN(String society) {    StringBuffer sb = new StringBuffer();    sb.append("<?xml version=\"1.0\"?>\n" +        "<CougaarSociety identifier=\"baseline\">\n");    int index = society.indexOf("<nodes count=");    index = society.indexOf("\"", index);    int nodesCount = Integer.parseInt(society.substring(index+1, society.indexOf("\"", index+1)));    index = society.indexOf("<agents count=");    index = society.indexOf("\"", index);    int agentsCount = Integer.parseInt(society.substring(index+1, society.indexOf("\"", index+1)));    for(int i=0; i<nodesCount; i++) {      index = society.indexOf("<node name=");      index = society.indexOf("\"", index);      society = society.substring(index);      String nodeName = society.substring(1, society.indexOf("\"", 1));      int stateIndex1 = society.indexOf("state=\"");      int stateIndex2 = society.indexOf("\"", stateIndex1+8);      String state = society.substring(stateIndex1+7, stateIndex2);      if(state.equals("DEAD")){        continue;      }      sb.append("  <CougaarNode name=\"" + nodeName + "\">\n");      sb.append("    <Attribute name=\"Memory\" value=\"nodeMemory\"/>\n");      sb.append("    <Attribute name=\"ProbabilityOfFailure\" value=\"0.2\"/>\n");      sb.append("    <Attribute name=\"CPU\" value=\"nodeCPU\"/>\n");      sb.append("    <Attribute name=\"OperatingSystem\" value=\"LINUX\"/>\n");      String tmp = society;      int childAgents = 0;      for(int j=0; j<agentsCount; j++) {        index = tmp.indexOf("<agent name=");        index = tmp.indexOf("\"", index);        tmp = tmp.substring(index);        String agentName = tmp.substring(1, tmp.indexOf("\"", 1));        index = tmp.indexOf("current=");        index = tmp.indexOf("\"", index);        tmp = tmp.substring(index);        String parent = tmp.substring(1, tmp.indexOf("\"", 1));        if(parent.equals(nodeName)) {          sb.append("    <CougaarAgent name=\"" + agentName + "\">\n");          sb.append("      <Requirement name=\"CPU\" value=\"50\"/>\n");          sb.append("      <Requirement name=\"Memory\" value=\"30\"/>\n");          sb.append("      <Requirement name=\"OperatingSystem\" value=\"LINUX\"/>\n");          sb.append("      <Requirement name=\"BandwidthReceived_" + agentName + "\" value=\"3\"/>\n");          sb.append("      <Requirement name=\"BandwidthSent_" + agentName + "\" value=\"3\"/>\n");          sb.append("    </CougaarAgent>\n");          childAgents ++;        }      }      int nodeCPU = childAgents * 50 + 200;      index = sb.lastIndexOf("nodeCPU");      sb.replace(index, index+7, Integer.toString(nodeCPU));      int nodeMemory = childAgents * 30 + 200;      index = sb.lastIndexOf("nodeMemory");      sb.replace(index, index+10, Integer.toString(nodeMemory));      sb.append("  </CougaarNode>\n");    }    sb.append("</CougaarSociety>");    //origSocietys.put(comm, sb.toString());    return sb.toString();  }