@Override public int compare(MechSummary ms1, MechSummary ms2) { switch (m_nType) { case T_CHASSIS: return ms1.getChassis().compareTo(ms2.getChassis()); case T_MODEL: return ms1.getModel().compareTo(ms2.getModel()); case T_WEIGHT: return Double.compare(ms1.getTons(), ms2.getTons()); case T_BV: return Integer.compare(ms1.getBV(), ms2.getBV()); case T_YEAR: return Integer.compare(ms1.getYear(), ms2.getYear()); case T_COST: return Long.compare(ms1.getCost(), ms2.getCost()); case T_LEVEL: return ms1.getLevel().compareTo(ms2.getLevel()); default: return 0; } } }
.getType())); w.write(","); w.write(Double.toString(unit.getTons())); w.write(","); if (unit.isClan()) {
public int getWeightClass() { double tons; if (getUnitType().equals("BattleArmor")){ tons = getSuitWeight(); } else { tons = getTons(); } if (isSupport()) { return EntityWeightClass.getSupportWeightClass(m_nTons, m_sUnitSubType); } return EntityWeightClass.getWeightClass(tons, getUnitType()); }
@Override public Object getValueAt(int rowIndex, int columnIndex) { MechSummary ms = units.get(rowIndex); switch(columnIndex) { case COL_NAME: return ms.getName(); case COL_WEIGHT_CLASS: return EntityWeightClass.getClassName(EntityWeightClass.getWeightClass(ms.getTons(), ms.getUnitType())); case COL_MOVEMENT: StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(ms.getWalkMp())).append("/") .append(String.valueOf(ms.getRunMp())); if (formationType.isGround()) { sb.append("/").append(String.valueOf(ms.getJumpMp())); } return sb.toString(); case COL_ROLE: ModelRecord mr = RATGenerator.getInstance().getModelRecord(ms.getName()); if (null == mr) { return UnitRole.UNDETERMINED.toString(); } else { return UnitRoleHandler.getRoleFor(mr.getKey()).toString(); } default: Function<MechSummary,?> metric = formationType.getReportMetric(colNames.get(columnIndex)); return metric == null? "?" : metric.apply(ms); } } }
public Object getValueAt(int row, int col) { MechSummary ms = data[row]; if(col == COL_MODEL) { return ms.getModel(); } if(col == COL_CHASSIS) { return ms.getChassis(); } if(col == COL_WEIGHT) { return ms.getTons(); } if(col == COL_BV) { return ms.getBV(); } if(col == COL_YEAR) { return ms.getYear(); } if(col == COL_COST) { return formatter.format(getPurchasePrice(ms)); } return "?"; }
csvLine.append(mech.getTons() + ",");
|| summary.getTons() != en.getWeight() || !summary.getUnitType().equals(UnitType.determineUnitType(en))) { continue;
if (ms.getTons() <= 39) { weightClass = EntityWeightClass.WEIGHT_LIGHT; } else if (ms.getTons() <= 59) { weightClass = EntityWeightClass.WEIGHT_MEDIUM; } else if (ms.getTons() <= 79) { weightClass = EntityWeightClass.WEIGHT_HEAVY; } else if (ms.getTons() <= 100) { weightClass = EntityWeightClass.WEIGHT_ASSAULT; } else {
private void stockBattleArmorSuits(Campaign c) { //this is just a test for(MechSummary summary : MechSummaryCache.getInstance().getAllMechs()) { if(!summary.getUnitType().equals("BattleArmor")) { continue; } //FIXME: I can't pull entity movement mode and quad shape off of mechsummary //try loading the full entity, but this might take too long if(null != summary) { Entity newEntity = null; try { newEntity = new MechFileParser(summary.getSourceFile(), summary.getEntryName()).getEntity(); } catch (EntityLoadingException e) { e.printStackTrace(); } if(null != newEntity) { BattleArmorSuit ba = new BattleArmorSuit(summary.getChassis(), summary.getModel(), (int)summary.getTons(), 1, summary.getWeightClass(), summary.getWalkMp(), summary.getJumpMp(), newEntity.entityIsQuad(), summary.isClan(), newEntity.getMovementMode(), c); parts.add(ba); } } } }
return ms.getTons();