aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Ic2ExpReactorPlanner
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/Ic2ExpReactorPlanner')
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java148
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/BigintStorage.java18
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java101
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/Reactor.java72
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/SimulationData.java6
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/TaloniusDecoder.java2
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/Condensator.java15
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/CoolantCell.java15
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java20
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/FuelRod.java23
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/Plating.java21
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/ReactorItem.java134
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/Reflector.java15
-rw-r--r--src/main/java/Ic2ExpReactorPlanner/components/Vent.java21
14 files changed, 263 insertions, 348 deletions
diff --git a/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java b/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java
index e83e46ce59..45c1f5bdf5 100644
--- a/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java
+++ b/src/main/java/Ic2ExpReactorPlanner/AutomationSimulator.java
@@ -1,12 +1,13 @@
package Ic2ExpReactorPlanner;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
import Ic2ExpReactorPlanner.components.ReactorItem;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.List;
/**
*
@@ -85,8 +86,8 @@ public class AutomationSimulator {
return null;
}
- public AutomationSimulator(
- final Reactor reactor, final ArrayList<String> output2, final GT_TileEntity_ComputerCube aTile) {
+ public AutomationSimulator(final Reactor reactor, final ArrayList<String> output2,
+ final GT_TileEntity_ComputerCube aTile) {
this.reactor = reactor;
this.output = output2;
this.mReactor = aTile;
@@ -208,9 +209,8 @@ public class AutomationSimulator {
if (active) {
activeTime++;
currentActiveTime++;
- if (reactor.isPulsed()
- && (reactor.getCurrentHeat() >= suspendTemp
- || (reactorTicks % clockPeriod) >= onPulseDuration)) {
+ if (reactor.isPulsed() && (reactor.getCurrentHeat() >= suspendTemp
+ || (reactorTicks % clockPeriod) >= onPulseDuration)) {
active = false;
minActiveTime = Math.min(currentActiveTime, minActiveTime);
maxActiveTime = Math.max(currentActiveTime, maxActiveTime);
@@ -221,14 +221,13 @@ public class AutomationSimulator {
currentInactiveTime++;
if (reactor.isAutomated() && pauseTimer > 0) {
pauseTimer--;
- } else if ((reactor.isPulsed()
- && reactor.getCurrentHeat() <= resumeTemp
+ } else if ((reactor.isPulsed() && reactor.getCurrentHeat() <= resumeTemp
&& (reactorTicks % clockPeriod) < onPulseDuration)) {
- active = true;
- minInactiveTime = Math.min(currentInactiveTime, minInactiveTime);
- maxInactiveTime = Math.max(currentInactiveTime, maxInactiveTime);
- currentInactiveTime = 0;
- }
+ active = true;
+ minInactiveTime = Math.min(currentInactiveTime, minInactiveTime);
+ maxInactiveTime = Math.max(currentInactiveTime, maxInactiveTime);
+ currentInactiveTime = 0;
+ }
}
}
minEUoutput = Math.min(lastEUoutput, minEUoutput);
@@ -405,8 +404,10 @@ public class AutomationSimulator {
ReactorItem component = reactor.getComponentAt(row, col);
if (component != null) {
if (component.getVentCoolingCapacity() > 0) {
- component.info.append("ComponentInfo.UsedCooling " + component.getBestVentCooling() + " | "
- + component.getVentCoolingCapacity());
+ component.info.append(
+ "ComponentInfo.UsedCooling " + component.getBestVentCooling()
+ + " | "
+ + component.getVentCoolingCapacity());
totalEffectiveVentCooling += component.getBestVentCooling();
totalVentCoolingCapacity += component.getVentCoolingCapacity();
} else if (component.getBestCellCooling() > 0) {
@@ -417,15 +418,21 @@ public class AutomationSimulator {
totalCondensatorCooling += component.getBestCondensatorCooling();
} else if (component.getMaxHeatGenerated() > 0) {
if (!reactor.isFluid() && component.getMaxEUGenerated() > 0) {
- component.info.append("ComponentInfo.GeneratedEU " + component.getMinEUGenerated() + " | "
- + component.getMaxEUGenerated());
+ component.info.append(
+ "ComponentInfo.GeneratedEU " + component.getMinEUGenerated()
+ + " | "
+ + component.getMaxEUGenerated());
}
- component.info.append("ComponentInfo.GeneratedHeat " + component.getMinHeatGenerated() + " | "
- + component.getMaxHeatGenerated());
+ component.info.append(
+ "ComponentInfo.GeneratedHeat " + component.getMinHeatGenerated()
+ + " | "
+ + component.getMaxHeatGenerated());
}
if (component.getMaxReachedHeat() > 0) {
- component.info.append("ComponentInfo.ReachedHeat " + component.getMaxReachedHeat() + " | "
- + component.getMaxHeat());
+ component.info.append(
+ "ComponentInfo.ReachedHeat " + component.getMaxReachedHeat()
+ + " | "
+ + component.getMaxHeat());
}
}
}
@@ -464,15 +471,11 @@ public class AutomationSimulator {
// }
// return null;
- /* catch (Throwable e) {
- if (cooldownTicks == 0) {
- publish("Simulation.ErrorReactor", reactorTicks);
- } else {
- publish("Simulation.ErrorCooldown", cooldownTicks);
- }
- publish(e.toString(), " ", Arrays.toString(e.getStackTrace()); // NO18N
-
- }*/
+ /*
+ * catch (Throwable e) { if (cooldownTicks == 0) { publish("Simulation.ErrorReactor", reactorTicks); } else {
+ * publish("Simulation.ErrorCooldown", cooldownTicks); } publish(e.toString(), " ",
+ * Arrays.toString(e.getStackTrace()); // NO18N }
+ */
data.explosionPower = (int) explosionPower;
data.totalReactorTicks = reactorTicks;
long endTime = System.nanoTime();
@@ -508,29 +511,28 @@ public class AutomationSimulator {
}
} else if (component.getAutomationThreshold() < component.getInitialHeat()
&& component.getCurrentHeat() <= component.getAutomationThreshold()) {
- component.clearCurrentHeat();
- component.info.append("ComponentInfo.ReplacedTime | " + reactorTicks);
- if (component.getReactorPause() > 0) {
- active = false;
- pauseTimer = Math.max(pauseTimer, component.getReactorPause());
- minActiveTime = Math.min(currentActiveTime, minActiveTime);
- maxActiveTime = Math.max(currentActiveTime, maxActiveTime);
- currentActiveTime = 0;
+ component.clearCurrentHeat();
+ component.info.append("ComponentInfo.ReplacedTime | " + reactorTicks);
+ if (component.getReactorPause() > 0) {
+ active = false;
+ pauseTimer = Math.max(pauseTimer, component.getReactorPause());
+ minActiveTime = Math.min(currentActiveTime, minActiveTime);
+ maxActiveTime = Math.max(currentActiveTime, maxActiveTime);
+ currentActiveTime = 0;
+ }
+ }
+ } else if (component.isBroken() || (component.getMaxDamage() > 1
+ && component.getCurrentDamage() >= component.getAutomationThreshold())) {
+ component.clearDamage();
+ component.info.append("ComponentInfo.ReplacedTime | " + reactorTicks);
+ if (component.getReactorPause() > 0) {
+ active = false;
+ pauseTimer = Math.max(pauseTimer, component.getReactorPause());
+ minActiveTime = Math.min(currentActiveTime, minActiveTime);
+ maxActiveTime = Math.max(currentActiveTime, maxActiveTime);
+ currentActiveTime = 0;
+ }
}
- }
- } else if (component.isBroken()
- || (component.getMaxDamage() > 1
- && component.getCurrentDamage() >= component.getAutomationThreshold())) {
- component.clearDamage();
- component.info.append("ComponentInfo.ReplacedTime | " + reactorTicks);
- if (component.getReactorPause() > 0) {
- active = false;
- pauseTimer = Math.max(pauseTimer, component.getReactorPause());
- minActiveTime = Math.min(currentActiveTime, minActiveTime);
- maxActiveTime = Math.max(currentActiveTime, maxActiveTime);
- currentActiveTime = 0;
- }
- }
}
if (reactor.isUsingReactorCoolantInjectors() && component != null && component.needsCoolantInjected()) {
component.injectCoolant();
@@ -668,34 +670,16 @@ public class AutomationSimulator {
protected void process(List<String> chunks) {
/*
- for (String chunk : chunks) {
- if (chunk.isEmpty()) {
- output.add(""); // NO18N
- }
- else {
- if (chunk.matches("R\\dC\\d:.*")) { // NO18N
- String temp = chunk.substring(5);
- int row = chunk.charAt(1) - '0';
- int col = chunk.charAt(3) - '0';
- if (temp.startsWith("0x")) { // NO18N
- mReactorComponents[row][col].setBackground(Color.decode(temp));
- if ("0xC0C0C0".equals(temp)) {
- mReactorComponents[row][col].setToolTipText(null);
- }
- else if ("0xFF0000".equals(temp)) {
- mReactorComponents[row][col].setToolTipText(getI18n("ComponentTooltip.Broken"));
- }
- else if ("0xFFA500".equals(temp)) {
- mReactorComponents[row][col].setToolTipText(getI18n("ComponentTooltip.ResidualHeat"));
- }
- }
- }
- else {
- output.add(chunk);
- }
- }
- }
- */
+ * for (String chunk : chunks) { if (chunk.isEmpty()) { output.add(""); // NO18N } else { if
+ * (chunk.matches("R\\dC\\d:.*")) { // NO18N String temp = chunk.substring(5); int row = chunk.charAt(1) - '0';
+ * int col = chunk.charAt(3) - '0'; if (temp.startsWith("0x")) { // NO18N
+ * mReactorComponents[row][col].setBackground(Color.decode(temp)); if ("0xC0C0C0".equals(temp)) {
+ * mReactorComponents[row][col].setToolTipText(null); } else if ("0xFF0000".equals(temp)) {
+ * mReactorComponents[row][col].setToolTipText(getI18n("ComponentTooltip.Broken")); } else if
+ * ("0xFFA500".equals(temp)) {
+ * mReactorComponents[row][col].setToolTipText(getI18n("ComponentTooltip.ResidualHeat")); } } } else {
+ * output.add(chunk); } } }
+ */
}
public void cancel() {
diff --git a/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java b/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java
index b9ca1760c6..d9d4d62c3c 100644
--- a/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java
+++ b/src/main/java/Ic2ExpReactorPlanner/BigintStorage.java
@@ -4,20 +4,21 @@ import java.math.BigInteger;
import java.util.Base64;
/**
- * Stores numbers of varying size inside a BigInteger, expecting each to have
- * a defined limit (which need not be an exact power of 2). Numbers are to be
- * extracted in reverse order they were stored, and special values can be used
- * to make certain values optional for inclusion (the calling class is
- * responsible for handling this logic, though).
+ * Stores numbers of varying size inside a BigInteger, expecting each to have a defined limit (which need not be an
+ * exact power of 2). Numbers are to be extracted in reverse order they were stored, and special values can be used to
+ * make certain values optional for inclusion (the calling class is responsible for handling this logic, though).
+ *
* @author Brian McCloud
*/
public class BigintStorage {
+
private BigInteger storedValue = BigInteger.ZERO;
/**
- * Stores the specified value. Requires that 0 &lt;= value &lt;= max.
+ * Stores the specified value. Requires that 0 &lt;= value &lt;= max.
+ *
* @param value the value to store.
- * @param max the expected maximum for the value.
+ * @param max the expected maximum for the value.
*/
public void store(int value, int max) {
if (value < 0 || value > max) {
@@ -28,6 +29,7 @@ public class BigintStorage {
/**
* Extracts a value based on the specified maximum.
+ *
* @param max the expected maximum for the value.
* @return the extracted value.
*/
@@ -39,6 +41,7 @@ public class BigintStorage {
/**
* Takes input of a Base64 string, and converts it to a BigintStorage.
+ *
* @param code the Base64-encoded string (presumed to be from @outputBase64)
* @return the converted storage object.
*/
@@ -51,6 +54,7 @@ public class BigintStorage {
/**
* Outputs the current value of this BigintStorage as a Base64-encoded string.
+ *
* @return the Base64-encoded string.
*/
public String outputBase64() {
diff --git a/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java b/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java
index 865c3d7c41..6b35efd47b 100644
--- a/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java
+++ b/src/main/java/Ic2ExpReactorPlanner/ComponentFactory.java
@@ -1,10 +1,14 @@
/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * To change this license header, choose License Headers in Project Properties. To change this template file, choose
+ * Tools | Templates and open the template in the editor.
*/
package Ic2ExpReactorPlanner;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
import Ic2ExpReactorPlanner.components.Condensator;
import Ic2ExpReactorPlanner.components.CoolantCell;
import Ic2ExpReactorPlanner.components.Exchanger;
@@ -22,21 +26,18 @@ import gtPlusPlus.xmod.bartworks.BW_Utils;
import gtPlusPlus.xmod.bartworks.BW_Utils.NonMeta_MaterialItem;
import gtPlusPlus.xmod.goodgenerator.GG_Utils;
import gtPlusPlus.xmod.goodgenerator.GG_Utils.GG_Fuel_Rod;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
/**
* Factory class to handle creating components by id or name.
+ *
* @author Brian McCloud
*/
public class ComponentFactory {
public static int MAX_COMPONENT_ID = 64;
- static ItemList[] aGtItems =
- new ItemList[] {ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4};
+ static ItemList[] aGtItems = new ItemList[] { ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2,
+ ItemList.Moxcell_4 };
private ComponentFactory() {
// do nothing, this class should not be instantiated.
@@ -52,8 +53,7 @@ public class ComponentFactory {
new FuelRod(
1,
"fuelRodUranium",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumSimple", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumSimple", 1).copy()),
20e3,
1,
null,
@@ -66,8 +66,7 @@ public class ComponentFactory {
new FuelRod(
2,
"dualFuelRodUranium",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumDual", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumDual", 1).copy()),
20e3,
1,
null,
@@ -80,8 +79,7 @@ public class ComponentFactory {
new FuelRod(
3,
"quadFuelRodUranium",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumQuad", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorUraniumQuad", 1).copy()),
20e3,
1,
null,
@@ -92,7 +90,16 @@ public class ComponentFactory {
ITEM_LIST.put(
aID++,
new FuelRod(
- 4, "fuelRodMox", new GT_ItemStack(aGtItems[1].get(1).copy()), 10e3, 1, null, 100, 2, 1, true));
+ 4,
+ "fuelRodMox",
+ new GT_ItemStack(aGtItems[1].get(1).copy()),
+ 10e3,
+ 1,
+ null,
+ 100,
+ 2,
+ 1,
+ true));
ITEM_LIST.put(
aID++,
new FuelRod(
@@ -124,8 +131,7 @@ public class ComponentFactory {
new Reflector(
7,
"neutronReflector",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorReflector", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorReflector", 1).copy()),
30e3,
1,
null));
@@ -134,8 +140,7 @@ public class ComponentFactory {
new Reflector(
8,
"thickNeutronReflector",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorReflectorThick", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorReflectorThick", 1).copy()),
120e3,
1,
null));
@@ -144,8 +149,7 @@ public class ComponentFactory {
new Vent(
9,
"heatVent",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorVent", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVent", 1).copy()),
1,
1000,
null,
@@ -157,8 +161,7 @@ public class ComponentFactory {
new Vent(
10,
"advancedHeatVent",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentDiamond", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentDiamond", 1).copy()),
1,
1000,
null,
@@ -170,8 +173,7 @@ public class ComponentFactory {
new Vent(
11,
"reactorHeatVent",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorVentCore", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentCore", 1).copy()),
1,
1000,
null,
@@ -183,8 +185,7 @@ public class ComponentFactory {
new Vent(
12,
"componentHeatVent",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorVentSpread", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentSpread", 1).copy()),
1,
1,
null,
@@ -196,8 +197,7 @@ public class ComponentFactory {
new Vent(
13,
"overclockedHeatVent",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorVentGold", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorVentGold", 1).copy()),
1,
1000,
null,
@@ -209,8 +209,7 @@ public class ComponentFactory {
new CoolantCell(
14,
"coolantCell10k",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantSimple", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantSimple", 1).copy()),
1,
10e3,
null));
@@ -219,8 +218,7 @@ public class ComponentFactory {
new CoolantCell(
15,
"coolantCell30k",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantTriple", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantTriple", 1).copy()),
1,
30e3,
null));
@@ -229,8 +227,7 @@ public class ComponentFactory {
new CoolantCell(
16,
"coolantCell60k",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorCoolantSix", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCoolantSix", 1).copy()),
1,
60e3,
null));
@@ -239,8 +236,7 @@ public class ComponentFactory {
new Exchanger(
17,
"heatExchanger",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorHeatSwitch", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitch", 1).copy()),
1,
2500,
null,
@@ -251,8 +247,7 @@ public class ComponentFactory {
new Exchanger(
18,
"advancedHeatExchanger",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchDiamond", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchDiamond", 1).copy()),
1,
10e3,
null,
@@ -263,8 +258,7 @@ public class ComponentFactory {
new Exchanger(
19,
"coreHeatExchanger",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchCore", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchCore", 1).copy()),
1,
5000,
null,
@@ -275,8 +269,7 @@ public class ComponentFactory {
new Exchanger(
20,
"componentHeatExchanger",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchSpread", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorHeatSwitchSpread", 1).copy()),
1,
5000,
null,
@@ -287,8 +280,7 @@ public class ComponentFactory {
new Plating(
21,
"reactorPlating",
- new GT_ItemStack(
- GT_ModHandler.getIC2Item("reactorPlating", 1).copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlating", 1).copy()),
1,
1,
null,
@@ -299,8 +291,7 @@ public class ComponentFactory {
new Plating(
22,
"heatCapacityReactorPlating",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlatingHeat", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlatingHeat", 1).copy()),
1,
1,
null,
@@ -311,8 +302,7 @@ public class ComponentFactory {
new Plating(
23,
"containmentReactorPlating",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlatingExplosive", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorPlatingExplosive", 1).copy()),
1,
1,
null,
@@ -323,8 +313,7 @@ public class ComponentFactory {
new Condensator(
24,
"rshCondensator",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCondensator", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCondensator", 1).copy()),
1,
20e3,
null));
@@ -333,8 +322,7 @@ public class ComponentFactory {
new Condensator(
25,
"lzhCondensator",
- new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCondensatorLap", 1)
- .copy()),
+ new GT_ItemStack(GT_ModHandler.getIC2Item("reactorCondensatorLap", 1).copy()),
1,
100e3,
null));
@@ -784,6 +772,7 @@ public class ComponentFactory {
/**
* Gets a default instances of the specified component (such as for drawing button images)
+ *
* @param id the id of the component.
* @return the component with the specified id, or null if the id is out of range.
*/
@@ -798,6 +787,7 @@ public class ComponentFactory {
/**
* Gets a default instances of the specified component (such as for drawing button images)
+ *
* @param name the name of the component.
* @return the component with the specified name, or null if the name is not found.
*/
@@ -810,6 +800,7 @@ public class ComponentFactory {
/**
* Creates a new instance of the specified component.
+ *
* @param id the id of the component to create.
* @return a new instance of the specified component, or null if the id is out of range.
*/
@@ -824,6 +815,7 @@ public class ComponentFactory {
/**
* Creates a new instance of the specified component.
+ *
* @param name the name of the component to create.
* @return a new instance of the specified component, or null if the name is not found.
*/
@@ -836,6 +828,7 @@ public class ComponentFactory {
/**
* Get the number of defined components.
+ *
* @return the number of defined components.
*/
public static int getComponentCount() {
diff --git a/src/main/java/Ic2ExpReactorPlanner/Reactor.java b/src/main/java/Ic2ExpReactorPlanner/Reactor.java
index 6dfc379b8d..cbfd549552 100644
--- a/src/main/java/Ic2ExpReactorPlanner/Reactor.java
+++ b/src/main/java/Ic2ExpReactorPlanner/Reactor.java
@@ -1,16 +1,17 @@
/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * To change this license header, choose License Headers in Project Properties. To change this template file, choose
+ * Tools | Templates and open the template in the editor.
*/
package Ic2ExpReactorPlanner;
-import Ic2ExpReactorPlanner.components.ReactorItem;
import java.awt.HeadlessException;
import java.util.ArrayList;
+import Ic2ExpReactorPlanner.components.ReactorItem;
+
/**
* Represents an IndustrialCraft2 Nuclear Reactor.
+ *
* @author Brian McCloud
*/
public class Reactor {
@@ -106,6 +107,7 @@ public class Reactor {
/**
* Adjust the maximum heat
+ *
* @param adjustment the adjustment amount (negative values decrease the max heat).
*/
public void adjustMaxHeat(final double adjustment) {
@@ -113,7 +115,9 @@ public class Reactor {
}
/**
- * Set the current heat of the reactor. Mainly to be used for simulating a pre-heated reactor, or for resetting to 0 for a new simulation.
+ * Set the current heat of the reactor. Mainly to be used for simulating a pre-heated reactor, or for resetting to 0
+ * for a new simulation.
+ *
* @param currentHeat the heat to set
*/
public void setCurrentHeat(final double currentHeat) {
@@ -122,6 +126,7 @@ public class Reactor {
/**
* Adjusts the reactor's current heat by a specified amount
+ *
* @param adjustment the adjustment amount.
*/
public void adjustCurrentHeat(final double adjustment) {
@@ -133,6 +138,7 @@ public class Reactor {
/**
* add some EU output.
+ *
* @param amount the amount of EU to output over 1 reactor tick (20 game ticks).
*/
public void addEUOutput(final double amount) {
@@ -148,6 +154,7 @@ public class Reactor {
/**
* Gets a list of the materials needed to build the components.
+ *
* @return a list of the materials needed to build the components.
*/
public ArrayList getMaterials() {
@@ -174,7 +181,9 @@ public class Reactor {
}
/**
- * Adds to the amount of heat vented this reactor tick, in case it is a new-style reactor with a pressure vessel and outputting heat to fluid instead of EU.
+ * Adds to the amount of heat vented this reactor tick, in case it is a new-style reactor with a pressure vessel and
+ * outputting heat to fluid instead of EU.
+ *
* @param amount the amount to add.
*/
public void ventHeat(final double amount) {
@@ -190,14 +199,18 @@ public class Reactor {
/**
* Get a code that represents the component set, which can be passed between forum users, etc.
- * @return a code representing some ids for the components and arrangement. Passing the same code to setCode() should re-create an identical reactor setup, even if other changes have happened in the meantime.
+ *
+ * @return a code representing some ids for the components and arrangement. Passing the same code to setCode()
+ * should re-create an identical reactor setup, even if other changes have happened in the meantime.
*/
public String getCode() {
return "erp=" + buildCodeString();
}
/**
- * Sets a code to configure the entire grid all at once. Expects the code to have originally been output by getCode().
+ * Sets a code to configure the entire grid all at once. Expects the code to have originally been output by
+ * getCode().
+ *
* @param code the code of the reactor setup to use.
*/
public void setCode(final String code) {
@@ -329,8 +342,7 @@ public class Reactor {
} else {
String tempCode = code;
if (code.startsWith("http://www.talonfiremage.pwp.blueyonder.co.uk/v3/reactorplanner.html?")) { // NOI18N
- tempCode = code.replace(
- "http://www.talonfiremage.pwp.blueyonder.co.uk/v3/reactorplanner.html?", ""); // NOI18N
+ tempCode = code.replace("http://www.talonfiremage.pwp.blueyonder.co.uk/v3/reactorplanner.html?", ""); // NOI18N
}
if (tempCode.matches("[0-9a-z]+")) { // NOI18N
// Possibly a code from Talonius's old planner
@@ -569,7 +581,7 @@ public class Reactor {
if (component != null) {
int id = component.id;
// only store automation details for a component if non-default, and add a flag bit to indicate
- // their presence. null components don't even need the flag bit.
+ // their presence. null components don't even need the flag bit.
if (component.getInitialHeat() > 0
|| component.getAutomationThreshold()
!= ComponentFactory.getDefaultComponent(id).getAutomationThreshold()
@@ -605,32 +617,22 @@ public class Reactor {
final ReactorItem component = getComponentAt(row, col);
final int id = (component != null) ? component.id : 0;
result.append(String.format("%02X", id)); // NOI18N
- if (component != null
- && (component.getInitialHeat() > 0
- || (automated
- && component.getAutomationThreshold()
- != ComponentFactory.getDefaultComponent(id)
- .getAutomationThreshold())
- || (automated
- && component.getReactorPause()
- != ComponentFactory.getDefaultComponent(id)
- .getReactorPause()))) {
+ if (component != null && (component.getInitialHeat() > 0
+ || (automated && component.getAutomationThreshold()