aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2019-02-16 10:00:48 +0100
committerTec <daniel112092@gmail.com>2019-02-16 10:00:48 +0100
commit4869f1f4842d6aa28ea77e8dc544b93762c5a25c (patch)
treeb0c19edd07add94951b20c9d210e1a6589892e28
parentee4bd9f91d4b8f85b550730aa1e3c63d91b3be2f (diff)
downloadGT5-Unofficial-4869f1f4842d6aa28ea77e8dc544b93762c5a25c.tar.gz
GT5-Unofficial-4869f1f4842d6aa28ea77e8dc544b93762c5a25c.tar.bz2
GT5-Unofficial-4869f1f4842d6aa28ea77e8dc544b93762c5a25c.zip
Move to util
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java15
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java15
2 files changed, 14 insertions, 16 deletions
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index 1fd479939c..7a5366f337 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -24,8 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,6 +38,18 @@ public final class Util {
private Util() {
}
+ @SuppressWarnings("ComparatorMethodParameterNotUsed")
+ public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
+ SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(
+ (e1, e2) -> {
+ int res = e1.getValue().compareTo(e2.getValue());
+ return res != 0 ? res : 1; // Special fix to preserve items with equal values
+ }
+ );
+ sortedEntries.addAll(map.entrySet());
+ return sortedEntries;
+ }
+
public static String intBitsToString(int number) {
StringBuilder result = new StringBuilder(16);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
index 926c5e5d30..eca3dde6cb 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
@@ -25,6 +25,7 @@ import java.util.*;
import static com.github.technus.tectech.CommonValues.V;
import static com.github.technus.tectech.Util.StructureBuilder;
+import static com.github.technus.tectech.Util.entriesSortedByValues;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
import static gregtech.api.GregTech_API.*;
@@ -78,20 +79,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
private long outputCurrentParam = 0;
private int scanTimeMinParam = 0;
- static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
- SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(
- new Comparator<Map.Entry<K, V>>() {
- @Override
- public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) {
- int res = e1.getValue().compareTo(e2.getValue());
- return res != 0 ? res : 1; // Special fix to preserve items with equal values
- }
- }
- );
- sortedEntries.addAll(map.entrySet());
- return sortedEntries;
- }
-
//region structure
private static final String[][] shape0 = new String[][]{//3 16 0
{"\u000F", "A . ",},