コード例 #1
0
 @Override
 public void unloadData(Compacter compactedData) throws CompactedDataCorruptException {
   if (compactedData.getSize() < 4) {
     throw new CompactedDataCorruptException().setCorruptData(compactedData);
   }
   mType = compactedData.getInt(1);
   if (!isValidType(mType)) {
     throw new CompactedDataCorruptException().setCorruptData(compactedData);
   }
   setFirstReIndex(compactedData.getInt(2));
   setSecondReIndex(compactedData.getInt(3));
 }
コード例 #2
0
 @Override
 public void unloadData(Compacter data) throws CompactedDataCorruptException {
   if (data.getSize() < 4) {
     throw new CompactedDataCorruptException("Too little data in compressor.")
         .setCorruptData(data);
   }
   rawScoreTeam1 = data.getInt(0);
   rawScoreTeam2 = data.getInt(1);
   String finisherData = data.getData(2);
   finishers = new int[finisherData.length()];
   for (int i = 0; i < finishers.length; i++) {
     finishers[i] = Integer.parseInt(String.valueOf(finisherData.charAt(i)), 10);
   }
   String tichuData = data.getData(3);
   TichuBidType[] bids = new TichuBidType[TichuGame.TOTAL_PLAYERS];
   for (int i = 0; i < bids.length; i++) {
     bids[i] = TichuBidType.getFromKey(String.valueOf(tichuData.charAt(i)));
   }
   finishers = completeFinishers(finishers, rawScoreTeam1, rawScoreTeam2);
   tichus = makeTichus(bids, finishers[0]);
   try {
     checkAndThrowTichuRoundState();
   } catch (InadequateRoundInfo e) {
     throw new CompactedDataCorruptException(e).setCorruptData(data);
   }
 }