From 55f64675b42ac8d3c557cc850f78664bee006f6f Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:32:44 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../java/gtPlusPlus/api/objects/data/AutoMap.java | 6 ++++++ .../gtPlusPlus/api/objects/data/FlexiblePair.java | 3 ++- .../java/gtPlusPlus/api/objects/data/ObjMap.java | 24 +++++++++++++--------- .../java/gtPlusPlus/api/objects/data/Pair.java | 3 ++- .../gtPlusPlus/api/objects/data/TypeCounter.java | 7 ++++--- .../api/objects/data/WeightedCollection.java | 3 ++- .../api/objects/data/weakref/WeakAutoMap.java | 4 +++- 7 files changed, 33 insertions(+), 17 deletions(-) (limited to 'src/main/java/gtPlusPlus/api/objects/data') diff --git a/src/main/java/gtPlusPlus/api/objects/data/AutoMap.java b/src/main/java/gtPlusPlus/api/objects/data/AutoMap.java index f0687fae4f..92ba97e722 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/main/java/gtPlusPlus/api/objects/data/AutoMap.java @@ -34,6 +34,7 @@ public class AutoMap implements Iterable, Cloneable, Serializable, Collect /** * Generates an AutoMap from the List. + * * @param aList - Data to be inserted into the AutoMap. */ public AutoMap(List aList) { @@ -45,8 +46,10 @@ public class AutoMap implements Iterable, Cloneable, Serializable, Collect } } } + /** * Generates an AutoMap from a Set. + * * @param aList - Data to be inserted into the AutoMap. */ public AutoMap(Set aList) { @@ -58,8 +61,10 @@ public class AutoMap implements Iterable, Cloneable, Serializable, Collect } } } + /** * Generates an AutoMap from a Collection. + * * @param aList - Data to be inserted into the AutoMap. */ public AutoMap(Collection aList) { @@ -74,6 +79,7 @@ public class AutoMap implements Iterable, Cloneable, Serializable, Collect /** * Generates an AutoMap from a Array. + * * @param aArray - Data to be inserted into the AutoMap. */ public AutoMap(V[] aArray) { diff --git a/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java index 698e56ae45..8ec21dab59 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java +++ b/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java @@ -1,8 +1,9 @@ package gtPlusPlus.api.objects.data; -import com.google.common.base.Objects; import java.io.Serializable; +import com.google.common.base.Objects; + public class FlexiblePair implements Serializable { /** diff --git a/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java b/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java index 1f8a4baa2c..eff314f9ae 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java +++ b/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java @@ -6,6 +6,7 @@ import java.util.Arrays; * Object-2-object map based on IntIntMap4a */ public class ObjMap { + private static final Object FREE_KEY = new Object(); private static final Object REMOVED_KEY = new Object(); @@ -51,7 +52,7 @@ public class ObjMap { if (k == FREE_KEY) return null; // end of chain already if (k.equals(key)) // we check FREE and REMOVED prior to this call - return (V) m_data[ptr + 1]; + return (V) m_data[ptr + 1]; while (true) { ptr = (ptr + 2) & m_mask2; // that's next index k = m_data[ptr]; @@ -72,7 +73,7 @@ public class ObjMap { m_data[ptr] = key; m_data[ptr + 1] = value; if (m_size >= m_threshold) rehash(m_data.length * 2); // size is set inside - else ++m_size; + else++m_size; return null; } else if (k.equals(key)) // we check FREE and REMOVED prior to this call { @@ -92,7 +93,7 @@ public class ObjMap { m_data[ptr] = key; m_data[ptr + 1] = value; if (m_size >= m_threshold) rehash(m_data.length * 2); // size is set inside - else ++m_size; + else++m_size; return null; } else if (k.equals(key)) { final Object ret = m_data[ptr + 1]; @@ -196,9 +197,11 @@ public class ObjMap { /** Taken from FastUtil implementation */ - /** Return the least power of two greater than or equal to the specified value. + /** + * Return the least power of two greater than or equal to the specified value. * - *

Note that this function will return 1 when the argument is 0. + *

+ * Note that this function will return 1 when the argument is 0. * * @param x a long integer smaller than or equal to 262. * @return the least power of two greater than or equal to the specified value. @@ -214,18 +217,19 @@ public class ObjMap { return (x | x >> 32) + 1; } - /** Returns the least power of two smaller than or equal to 230 and larger than or equal to Math.ceil( expected / f ). + /** + * Returns the least power of two smaller than or equal to 230 and larger than or equal to + * Math.ceil( expected / f ). * * @param expected the expected number of elements in a hash table. - * @param f the load factor. + * @param f the load factor. * @return the minimum possible size for a backing array. * @throws IllegalArgumentException if the necessary size is larger than 230. */ public static int arraySize(final int expected, final float f) { final long s = Math.max(2, nextPowerOfTwo((long) Math.ceil(expected / f))); - if (s > (1 << 30)) - throw new IllegalArgumentException( - "Too large (" + expected + " expected elements with load factor " + f + ")"); + if (s > (1 << 30)) throw new IllegalArgumentException( + "Too large (" + expected + " expected elements with load factor " + f + ")"); return (int) s; } diff --git a/src/main/java/gtPlusPlus/api/objects/data/Pair.java b/src/main/java/gtPlusPlus/api/objects/data/Pair.java index 33b2ade368..93bf075c8f 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/Pair.java +++ b/src/main/java/gtPlusPlus/api/objects/data/Pair.java @@ -1,8 +1,9 @@ package gtPlusPlus.api.objects.data; -import com.google.common.base.Objects; import java.io.Serializable; +import com.google.common.base.Objects; + public class Pair implements Serializable { /** diff --git a/src/main/java/gtPlusPlus/api/objects/data/TypeCounter.java b/src/main/java/gtPlusPlus/api/objects/data/TypeCounter.java index 6acf62aa53..c282ce1eb3 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/TypeCounter.java +++ b/src/main/java/gtPlusPlus/api/objects/data/TypeCounter.java @@ -1,16 +1,16 @@ package gtPlusPlus.api.objects.data; -import gtPlusPlus.api.objects.Logger; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; +import gtPlusPlus.api.objects.Logger; + public class TypeCounter implements Set { - private Map> mInternalMap = - new LinkedHashMap>(); + private Map> mInternalMap = new LinkedHashMap>(); private String mHighestValueKey; private int mHighestValue = 0; private final Class mClass; @@ -21,6 +21,7 @@ public class TypeCounter implements Set { } public static class InternalTypeCounterObject { + private final Z mObject; private int mCounter = 0; diff --git a/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java b/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java index 20eed5cdc5..46cb8b35d9 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java +++ b/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java @@ -1,6 +1,5 @@ package gtPlusPlus.api.objects.data; -import gtPlusPlus.api.objects.random.XSTR; import java.util.Collection; import java.util.Map; import java.util.NavigableMap; @@ -8,6 +7,8 @@ import java.util.Random; import java.util.Set; import java.util.TreeMap; +import gtPlusPlus.api.objects.random.XSTR; + public class WeightedCollection implements Map { private NavigableMap map = new TreeMap(); diff --git a/src/main/java/gtPlusPlus/api/objects/data/weakref/WeakAutoMap.java b/src/main/java/gtPlusPlus/api/objects/data/weakref/WeakAutoMap.java index fcf6131611..c9176c00c5 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/weakref/WeakAutoMap.java +++ b/src/main/java/gtPlusPlus/api/objects/data/weakref/WeakAutoMap.java @@ -1,9 +1,11 @@ package gtPlusPlus.api.objects.data.weakref; -import gtPlusPlus.api.objects.data.AutoMap; import java.util.WeakHashMap; +import gtPlusPlus.api.objects.data.AutoMap; + public class WeakAutoMap extends AutoMap { + private static final long serialVersionUID = 8328345351801363386L; public WeakAutoMap() { -- cgit