コード例 #1
0
ファイル: Get.java プロジェクト: HYXYH/fizteh-java-2014
 public Get(final String[] currentArgs, CurrentTable ct, TableProviderClass tableProviderClass) {
   if (currentArgs.length != 2) {
     System.err.println("wrong number of argument to Get");
     System.exit(1);
   }
   if (ct.containsKey(currentArgs[1])) {
     System.out.println(tableProviderClass.serialize(ct, ct.get(currentArgs[1])));
   } else {
     System.out.println("Not found");
   }
 }
コード例 #2
0
ファイル: Put.java プロジェクト: HYXYH/fizteh-java-2014
 public Put(final String[] currentArgs, CurrentTable ct, TableProviderClass tableProviderClass) {
   if (currentArgs.length != 3) {
     System.err.println("wrong number of argument to Put");
     System.exit(1);
   }
   if (ct.containsKey(currentArgs[1])) {
     System.out.println("overwrite\n" + "old value = " + ct.get(currentArgs[1]));
   } else {
     System.out.println("new");
   }
   try {
     ct.put(currentArgs[1], tableProviderClass.deserialize(ct, currentArgs[2]));
   } catch (Throwable e) {
     System.err.println("problem with put");
     System.exit(2);
   }
   ct.write();
 }