From bd07aca95ded3a333233f49ed1a78bcc246c3f6c Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Thu, 3 Oct 2013 01:54:21 -0400 Subject: [PATCH] Added imperial unit enum --- src/com/builtbroken/common/Pair.java | 3 ++ .../common/{ => lang}/TextHelper.java | 2 +- .../common/science/units/ElectricUnit.java | 3 ++ .../common/science/units/ForceUnit.java | 2 +- .../common/science/units/ImperialUnits.java | 42 +++++++++++++++++++ .../common/science/units/MetricUnit.java | 3 ++ .../common/science/units/TemperatureUnit.java | 4 +- .../core/common/debug/TileEntityInfFluid.java | 2 +- 8 files changed, 57 insertions(+), 4 deletions(-) rename src/com/builtbroken/common/{ => lang}/TextHelper.java (98%) create mode 100644 src/com/builtbroken/common/science/units/ImperialUnits.java diff --git a/src/com/builtbroken/common/Pair.java b/src/com/builtbroken/common/Pair.java index 73423d0b5..00678d129 100644 --- a/src/com/builtbroken/common/Pair.java +++ b/src/com/builtbroken/common/Pair.java @@ -1,5 +1,8 @@ package com.builtbroken.common; +/** Container for two objects + * + * @author Robert Seifert */ public class Pair { private final L left; diff --git a/src/com/builtbroken/common/TextHelper.java b/src/com/builtbroken/common/lang/TextHelper.java similarity index 98% rename from src/com/builtbroken/common/TextHelper.java rename to src/com/builtbroken/common/lang/TextHelper.java index 0fed603d0..78b6885a8 100644 --- a/src/com/builtbroken/common/TextHelper.java +++ b/src/com/builtbroken/common/lang/TextHelper.java @@ -1,4 +1,4 @@ -package com.builtbroken.common; +package com.builtbroken.common.lang; import java.awt.Color; diff --git a/src/com/builtbroken/common/science/units/ElectricUnit.java b/src/com/builtbroken/common/science/units/ElectricUnit.java index 95d35ffd4..2c6282d03 100644 --- a/src/com/builtbroken/common/science/units/ElectricUnit.java +++ b/src/com/builtbroken/common/science/units/ElectricUnit.java @@ -1,5 +1,8 @@ package com.builtbroken.common.science.units; +/** Units of measure for work with electricity + * + * @author Robert Seifert */ public enum ElectricUnit { AMPERE("Amp", "I"), diff --git a/src/com/builtbroken/common/science/units/ForceUnit.java b/src/com/builtbroken/common/science/units/ForceUnit.java index 5efa41521..daf06b821 100644 --- a/src/com/builtbroken/common/science/units/ForceUnit.java +++ b/src/com/builtbroken/common/science/units/ForceUnit.java @@ -1,6 +1,6 @@ package com.builtbroken.common.science.units; -/** Units of messure for force +/** Units of measure for force * * @author Rsobert Seifert */ public enum ForceUnit diff --git a/src/com/builtbroken/common/science/units/ImperialUnits.java b/src/com/builtbroken/common/science/units/ImperialUnits.java new file mode 100644 index 000000000..f97cd7c05 --- /dev/null +++ b/src/com/builtbroken/common/science/units/ImperialUnits.java @@ -0,0 +1,42 @@ +package com.builtbroken.common.science.units; + +/** @Source http://en.wikipedia.org/wiki/Imperial_units + * @author Robert Seifert */ +public enum ImperialUnits +{ + thou("thou", "th", (float) (1 / 12000)), + inch("inch", "in", (float) (1 / 12)), + foot("foot", "ft", 1), + yard("yard", "yd", 3), + chain("chain", "ch", 66), + furlong("furlong", "fur", 660), + mile("mile", "mi", 5280), + + /** Not official used anymore */ + league("league", "lea", 15840), + + /** Maritime units */ + fathom("fathom", "ftm", 6.08f), + /** Maritime units */ + cable("cable", "", 608), + /** Maritime units */ + nautical("nautical mile", "", 6080), + + /** Gunter's sruvey unit */ + link("link", "", (float) (66 / 100)), + /** Gunter's sruvey unit */ + rod("rod", "", (float) (66 / 4)); + + public String name, symbol; + float toFeet; + + public static final ImperialUnits[] mainUnits = { inch, foot, yard, mile }; + + private ImperialUnits(String name, String symbol, float toFeet) + { + this.name = name; + this.symbol = symbol; + this.toFeet = toFeet; + } + +} diff --git a/src/com/builtbroken/common/science/units/MetricUnit.java b/src/com/builtbroken/common/science/units/MetricUnit.java index 8cc6d10c8..51adde948 100644 --- a/src/com/builtbroken/common/science/units/MetricUnit.java +++ b/src/com/builtbroken/common/science/units/MetricUnit.java @@ -1,5 +1,8 @@ package com.builtbroken.common.science.units; +/** Metric measurement system units + * + * @author Robert Seifert */ public enum MetricUnit { MICRO("Micro", "u", 0.000001f), diff --git a/src/com/builtbroken/common/science/units/TemperatureUnit.java b/src/com/builtbroken/common/science/units/TemperatureUnit.java index 82b2c8358..0c28f53ec 100644 --- a/src/com/builtbroken/common/science/units/TemperatureUnit.java +++ b/src/com/builtbroken/common/science/units/TemperatureUnit.java @@ -1,5 +1,8 @@ package com.builtbroken.common.science.units; +/** Units of measure for temperature + * + * @author Robert Seifert */ public enum TemperatureUnit { Fahrenheit("Fahrenheit", "F", new ITempConversion() @@ -58,7 +61,6 @@ public enum TemperatureUnit public String name, symbol; public ITempConversion conversion; - private TemperatureUnit(String name, String symbol, ITempConversion conversion) { this.name = name; diff --git a/src/dark/core/common/debug/TileEntityInfFluid.java b/src/dark/core/common/debug/TileEntityInfFluid.java index b151e4686..5780ce2ec 100644 --- a/src/dark/core/common/debug/TileEntityInfFluid.java +++ b/src/dark/core/common/debug/TileEntityInfFluid.java @@ -15,7 +15,7 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import universalelectricity.core.vector.Vector3; -import com.builtbroken.common.TextHelper.TextColor; +import com.builtbroken.common.lang.TextHelper.TextColor; import dark.core.prefab.helpers.FluidHelper;