question: protected String checkProduction ( final Territory to , final Collection < Unit > units , final PlayerID player ) { final List < Territory > producers = getAllProducers ( to , player , units ) ; if ( producers . isEmpty ( ) ) { return "No factory in or adjacent to " + to . getName ( ) ; } Collections . sort ( producers , getBestProducerComparator ( to , units , player ) ) ; if ( ! getCanAllUnitsWithRequiresUnitsBePlacedCorrectly ( units , to ) ) { return "Cannot place more units which require units, than production capacity of territories with the required units" ; } final int maxUnitsToBePlaced = getMaxUnitsToBePlaced ( units , to , player , true ) ; if ( ( maxUnitsToBePlaced != - 1 ) && ( maxUnitsToBePlaced < units . size ( ) ) ) { return "Cannot place " + units . size ( ) + " more units in " + to . getName ( ) ; } return null ; }
target:  Test whether or not the territory has the factory resources to support the placement. AlreadyProduced maps territory->units already produced this turn by that territory.