89 private Map<String, CommodityStats> priceData =
new HashMap<String, CommodityStats>();
206 float totalSupply = 0;
207 float totalDemand = 0;
208 float totalStockpiles = 0;
209 float minSupplyPrice = Float.MAX_VALUE;
210 float maxDemandPrice = 0;
212 float totalSupplyPrice = 0;
213 float totalDemandPrice = 0;
220 float supply = demand;
223 if (supply < 10 && demand < 10 && stockpile < 10)
continue;
225 float supplyPrice = Math.round(market.getSupplyPrice(com.
getId(), 1,
true));
226 float demandPrice = Math.round(market.getDemandPrice(com.
getId(), 1,
true));
228 if (supplyPrice < minSupplyPrice) {
229 minSupplyPrice = supplyPrice;
231 if (demandPrice > maxDemandPrice) {
232 maxDemandPrice = demandPrice;
235 totalSupply += supply;
236 totalDemand += demand;
237 totalStockpiles += stockpile;
239 totalSupplyPrice += stockpile * supplyPrice;
240 totalDemandPrice += demand * demandPrice;
243 CommodityStats stats =
getStats(commodityId);
245 stats.setTotalSupply(totalSupply);
246 stats.setTotalDemand(totalDemand);
247 stats.setTotalStockpiles(totalStockpiles);
248 stats.setMaxDemandPrice(maxDemandPrice);
249 stats.setMinSupplyPrice(minSupplyPrice);
251 if (totalStockpiles > 0) {
252 stats.setAverageSupplyPrice(totalSupplyPrice / totalStockpiles);
254 stats.setAverageSupplyPrice(0);
257 if (totalDemand > 0) {
258 stats.setAverageDemandPrice(totalDemandPrice / totalDemand);
260 stats.setAverageDemandPrice(0);