コード例 #1
0
 private void writeSendingArrayList(
     PrintWriter pw, String indent, HashMap item, String arrayName) {
   String type = (String) item.get("TYPE");
   HashMap contents = (HashMap) item.get("CONTENTS");
   String name = Utility.makeLocalVariable((String) item.get("NAME"));
   String type2 = (String) contents.get("TYPE");
   String name2 = Utility.makeLocalVariable((String) contents.get("NAME"));
   String comment2 = (String) contents.get("COMMENT");
   pw.println(indent + "Iterator itr = " + arrayName + ".iterator();");
   pw.println(indent + "while ( itr.hasNext() ) {");
   if (type2.equals("HashMap")) {
     pw.println(indent + "  HashMap " + name2 + " = " + "(HashMap)itr.next();");
     writeSendingHashMap(pw, indent, contents, name2);
   } else if (type2.equals("ArrayList")) {
     pw.print(indent + "  ArrayList " + name2 + " = (ArrayList)itr.next();");
     writeSendingArrayList(pw, indent, contents, name2);
   } else {
     pw.print(indent + "  fAgent.sendMassage(" + name2 + ".toString());");
     pw.println(" // " + comment2);
   }
   pw.println(indent + "}");
 }
コード例 #2
0
 private void writeSendingHashMap(PrintWriter pw, String indent, HashMap item, String hashName) {
   String coreClassName = "UC" + fCmdDef.getCmdName() + "Core";
   String type = (String) item.get("TYPE");
   ArrayList contents = (ArrayList) item.get("CONTENTS");
   Iterator itr = contents.iterator();
   while (itr.hasNext()) {
     HashMap item2 = (HashMap) itr.next();
     String type2 = (String) item2.get("TYPE");
     String name2 = (String) item2.get("NAME");
     String key2 = Utility.makeKeyString(type2, name2);
     String comment2 = (String) item2.get("COMMENT");
     String localVariableName = Utility.makeLocalVariable(name2);
     if (type2.equals("HashMap")) {
       pw.print(
           indent
               + "HashMap "
               + localVariableName
               + " = (HashMap)"
               + hashName
               + ".get("
               + coreClassName
               + "."
               + key2
               + ");");
       pw.println(" // " + comment2);
       writeSendingHashMap(pw, indent, item2, localVariableName);
     } else if (type2.equals("ArrayList")) {
       pw.print(
           indent
               + "ArrayList "
               + localVariableName
               + " = (ArrayList)"
               + hashName
               + ".get("
               + coreClassName
               + "."
               + key2
               + ");");
       pw.println(" // " + comment2);
       writeSendingArrayList(pw, indent, item2, localVariableName);
     } else {
       String str = indent + "fAgent.sendMessage(" + hashName + ".get(";
       str += "UC" + fCmdDef.getCmdName() + "Core." + key2 + ").toString());";
       pw.print(str);
       pw.println(" // " + comment2);
     }
   }
 }