@Override @Before public void setup() { super.setup(); engine = Mockito.mock(Engine.class); Mockito.when(engine.getFaction()).thenReturn(faction); Mockito.when(engine.getHardpointType()).thenReturn(HardPointType.NONE); Mockito.when(engine.getRating()).thenReturn(250); Mockito.when(engine.getType()).thenReturn(EngineType.XL); Mockito.when(engine.isCompatible(Matchers.any(Upgrades.class))).thenReturn(true); structureType = Mockito.mock(StructureUpgrade.class); armorType = Mockito.mock(ArmorUpgrade.class); heatSinkType = Mockito.mock(HeatSinkUpgrade.class); items = new HashMap<>(); components = new ComponentOmniMech[Location.values().length]; for (Location location : Location.values()) { items.put(location, new ArrayList<Item>()); components[location.ordinal()] = Mockito.mock(ComponentOmniMech.class); Mockito.when(components[location.ordinal()].isAllowed(Matchers.any(Item.class))) .thenReturn(true); Mockito.when( components[location.ordinal()].isAllowed( Matchers.any(Item.class), Matchers.any(Engine.class))) .thenReturn(true); Mockito.when(components[location.ordinal()].getFixedItems()).thenReturn(items.get(location)); } componentBases = components; items.get(Location.CenterTorso).add(engine); // Mockito.when(components[Location.Head.ordinal()].getArmorMax()).thenReturn(18); // Mockito.when(components[Location.LeftArm.ordinal()].getArmorMax()).thenReturn(48); // Mockito.when(components[Location.LeftTorso.ordinal()].getArmorMax()).thenReturn(64); // Mockito.when(components[Location.LeftLeg.ordinal()].getArmorMax()).thenReturn(64); // Mockito.when(components[Location.CenterTorso.ordinal()].getArmorMax()).thenReturn(92); // Mockito.when(components[Location.RightArm.ordinal()].getArmorMax()).thenReturn(48); // Mockito.when(components[Location.RightTorso.ordinal()].getArmorMax()).thenReturn(64); // Mockito.when(components[Location.RightLeg.ordinal()].getArmorMax()).thenReturn(64); Mockito.when(components[Location.Head.ordinal()].getDynamicArmorSlots()).thenReturn(1); Mockito.when(components[Location.CenterTorso.ordinal()].getDynamicArmorSlots()).thenReturn(1); Mockito.when(components[Location.LeftTorso.ordinal()].getDynamicArmorSlots()).thenReturn(3); Mockito.when(components[Location.RightArm.ordinal()].getDynamicArmorSlots()).thenReturn(2); Mockito.when(components[Location.LeftLeg.ordinal()].getDynamicStructureSlots()).thenReturn(1); Mockito.when(components[Location.RightTorso.ordinal()].getDynamicStructureSlots()) .thenReturn(1); Mockito.when(components[Location.LeftArm.ordinal()].getDynamicStructureSlots()).thenReturn(3); Mockito.when(components[Location.RightLeg.ordinal()].getDynamicStructureSlots()).thenReturn(2); Mockito.when(structureType.getExtraSlots()).thenReturn(7); Mockito.when(armorType.getExtraSlots()).thenReturn(7); }
public void updateGraph() { DefaultTableXYDataset dataset = new DefaultTableXYDataset(); for (Entry entry : chassis) { XYSeries series = new XYSeries(entry.name, false, false); if (entry.representant instanceof ChassisStandard) { ChassisStandard chassisStandard = (ChassisStandard) entry.representant; for (int rating = chassisStandard.getEngineMin(); rating <= chassisStandard.getEngineMax(); rating += 5) { if (rating < 100) { continue; // TODO: Remove this when they remove the engine limit. } double speed = TopSpeed.calculate( rating, chassisStandard.getMovementProfileBase(), chassisStandard.getMassMax(), efficiencies.getSpeedModifier()); series.add(speed, payloadStatistics.calculate(chassisStandard, rating)); } } else { // Omnimech ChassisOmniMech chassisOmniMech = (ChassisOmniMech) entry.representant; Engine engine = chassisOmniMech.getFixedEngine(); double minSpeed = TopSpeed.calculate( engine.getRating(), chassisOmniMech.getMovementProfileMin(), chassisOmniMech.getMassMax(), efficiencies.getSpeedModifier()); double stockSpeed = TopSpeed.calculate( engine.getRating(), chassisOmniMech.getMovementProfileStock(), chassisOmniMech.getMassMax(), efficiencies.getSpeedModifier()); double maxSpeed = TopSpeed.calculate( engine.getRating(), chassisOmniMech.getMovementProfileMax(), chassisOmniMech.getMassMax(), efficiencies.getSpeedModifier()); double payload = payloadStatistics.calculate(chassisOmniMech); if (minSpeed != stockSpeed) { series.add(minSpeed, payload); } series.add(stockSpeed, payload); if (maxSpeed != stockSpeed) { series.add(maxSpeed, payload); } } dataset.addSeries(series); } setChart(makeChart(dataset)); XYPlot plot = (XYPlot) getChart().getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, true); renderer.setBaseShapesFilled(false); plot.setRenderer(renderer); }