public Object getValueAt(int row, int col) {
   if (row < data.size()) {
     GameObject obj = (GameObject) data.get(row);
     switch (col) {
       case 0:
         return new Long(obj.getId());
       case 1:
         return obj.getName();
       case 2:
         GameObject hb = obj.getHeldBy();
         return hb == null ? "" : hb.toString();
       case 3:
         return new Integer(obj.getHoldCount());
       default:
         throw new IllegalArgumentException("Invalid column index");
     }
   }
   return null;
 }
Пример #2
0
 public static SpellMasterWrapper getSpellMaster(GameData data) {
   // System.out.println("MASTER_ID = "+MASTER_ID+", dataid = "+data.dataid);
   if (MASTER_ID == null) {
     // System.out.println(data.toIdentifier()+": MASTER_ID is null");
     GamePool pool = new GamePool(data.getGameObjects());
     ArrayList list = pool.find(SPELL_MASTER_KEY);
     GameObject gm = null;
     if (list != null && list.size() == 1) {
       gm = (GameObject) list.iterator().next();
       // System.out.println(data.toIdentifier()+": Found a SpellMaster!");
     }
     if (gm == null) {
       gm = data.createNewObject();
       gm.setName(SPELL_MASTER_KEY);
       gm.setThisAttribute(SPELL_MASTER_KEY);
       // System.out.println(data.toIdentifier()+": Creating a new SpellMaster!");
     }
     MASTER_ID = new Long(gm.getId());
     return new SpellMasterWrapper(gm);
   } else {
     return new SpellMasterWrapper(data.getGameObject(MASTER_ID));
   }
 }