CargoBatch cb = (CargoBatch)batches.next();
CargoBatch cb = (CargoBatch)((Entry) batches.next()).getKey();
    private void processTrainBundle() {        Iterator batches = trainAfter.cargoBatchIterator();	StationModel station = (StationModel)w.get(KEY.STATIONS, stationId,		stationPrincipal);        CargoBundle cargoDroppedOff = new CargoBundleImpl();        //Unload the cargo that the station demands        while (batches.hasNext()) {            CargoBatch cb = (CargoBatch)batches.next();            //if the cargo is demanded and its not from this station originally...            DemandAtStation demand = station.getDemand();            int cargoType = cb.getCargoType();            if ((demand.isCargoDemanded(cargoType)) &&                    (stationId != cb.getStationOfOrigin())) {                int amount = trainAfter.getAmount(cb);                cargoDroppedOff.addCargo(cb, amount);                //Now perform any conversions..                ConvertedAtStation converted = station.getConverted();                if (converted.isCargoConverted(cargoType)) {                    int newCargoType = converted.getConversion(cargoType);                    CargoBatch newCargoBatch = new CargoBatch(newCargoType,                            station.x, station.y, 0, stationId);                    stationAfter.addCargo(newCargoBatch, amount);                }                batches.remove();            }        }        payment = ProcessCargoAtStationMoveGenerator.processCargo(w,		cargoDroppedOff, trainPrincipal, this.stationId,		stationPrincipal);        //Unload the cargo that there isn't space for on the train regardless of whether the station        // demands it.        int[] spaceAvailable = this.getSpaceAvailableOnTrain();        for (int cargoType = 0; cargoType < spaceAvailable.length;                cargoType++) {            if (spaceAvailable[cargoType] < 0) {                int amount2transfer = -spaceAvailable[cargoType];                transferCargo(cargoType, amount2transfer, trainAfter,                    stationAfter);            }        }    }