예제 #1
0
 /** Add all from collection. */
 public void setPrecompiled(CompilationCache precompiled) {
   if (this.precompiled != null) {
     this.precompiled.getObjects().addAll(precompiled.getObjects());
   } else {
     this.precompiled = precompiled;
   }
 }
예제 #2
0
 /** Add object. */
 public void add(ProtocolObject o) {
   if (o instanceof TableSnapshotPacket) {
     addTableSnapshot((TableSnapshotPacket) o);
   } else if (o instanceof TableUpdatePacket) {
     addTableUpdate((TableUpdatePacket) o);
   } else if (o instanceof TournamentSnapshotPacket) {
     addMttSnapshot((TournamentSnapshotPacket) o);
   } else if (o instanceof TournamentUpdatePacket) {
     addMttUpdate((TournamentUpdatePacket) o);
   } else {
     log.warn("Unknown packet type: " + (o == null ? "null" : o.getClass().getName()));
     precompiled.getObjects().add(o);
   }
 }
예제 #3
0
 /**
  * Send all objects. This method returns the number of actual objects sent (as some objects may
  * have been aggregated into lists).
  *
  * @return The number of objects sent, or 0
  */
 public int commit() {
   int i = 0;
   /*if(fulFlag.get()) {
   	log.debug(" *** Starting commit for client: " + client);
   }*/
   if (precompiled != null) {
     i += precompiled.getObjects().size();
     /*if(fulFlag.get()) {
     	log.debug(" *** Precompiled: " + i);
     }*/
     send(precompiled);
   }
   if (tableSnapshots != null) {
     send(new TableSnapshotListPacket(tableSnapshots));
     /*if(fulFlag.get()) {
     	log.debug(" *** Table snapshots: " + tableSnapshots.size());
     }*/
     i++;
   }
   if (tableUpdates != null) {
     send(new TableUpdateListPacket(tableUpdates));
     /*if(fulFlag.get()) {
     	log.debug(" *** Table updates: " + tableUpdates.size());
     }*/
     i++;
   }
   if (mttSnapshots != null) {
     send(new TournamentSnapshotListPacket(mttSnapshots));
     /*if(fulFlag.get()) {
     	log.debug(" *** Mtt snapshots: " + mttSnapshots.size());
     }*/
     i++;
   }
   if (mttUpdates != null) {
     send(new TournamentUpdateListPacket(mttUpdates));
     /*if(fulFlag.get()) {
     	log.debug(" *** Mtt updates: " + mttUpdates.size());
     }*/
     i++;
   }
   return i;
 }