[AUTO] Cleanup code

This commit is contained in:
dfsek 2020-11-23 23:02:36 -07:00
parent 65c2ad6b7a
commit f309bd8809
6 changed files with 85 additions and 83 deletions

View File

@ -12,8 +12,8 @@ import java.util.Map;
public class BiomeSnowConfig extends TerraConfigSection { public class BiomeSnowConfig extends TerraConfigSection {
private final int[] snowHeights; private final int[] snowHeights;
private boolean doSnow = false;
private final boolean physics; private final boolean physics;
private boolean doSnow = false;
public BiomeSnowConfig(TerraConfig parent) throws InvalidConfigurationException { public BiomeSnowConfig(TerraConfig parent) throws InvalidConfigurationException {
super(parent); super(parent);

View File

@ -50,7 +50,9 @@ public class NoiseFunction2 implements NoiseFunction {
double zz = z >= 0 ? z * 2 : z * -2 - 1; double zz = z >= 0 ? z * 2 : z * -2 - 1;
double key = (xx >= zz) ? (xx * xx + xx + zz) : (zz * zz + xx); double key = (xx >= zz) ? (xx * xx + xx + zz) : (zz * zz + xx);
double value = this.get(key); double value = this.get(key);
if (this.size() > cacheSize) { this.clear(); } if(this.size() > cacheSize) {
this.clear();
}
return (value == 4.9E-324D ? addAndReturn(noise.getNoise(x, z), key) : value); return (value == 4.9E-324D ? addAndReturn(noise.getNoise(x, z), key) : value);
} }

View File

@ -36,18 +36,18 @@ package com.dfsek.terra.util.hash;
import java.io.Serializable; import java.io.Serializable;
public abstract class HashIntrinsic implements Serializable { public abstract class HashIntrinsic implements Serializable {
private static final long serialVersionUID = 8058099372006904458L;
protected static final int DEFAULT_INITIAL_CAPACITY = 16;
protected static final int MAXIMUM_CAPACITY = 1073741824;
protected static final float DEFAULT_LOAD_FACTOR = 0.75F;
protected int size;
protected int threshold;
protected float loadFactor;
protected int capMinus1;
public static final int FLOAT_EXP_BIT_MASK = 2139095040; public static final int FLOAT_EXP_BIT_MASK = 2139095040;
public static final int FLOAT_SIGNIF_BIT_MASK = 8388607; public static final int FLOAT_SIGNIF_BIT_MASK = 8388607;
public static final long DOUBLE_EXP_BIT_MASK = 9218868437227405312L; public static final long DOUBLE_EXP_BIT_MASK = 9218868437227405312L;
public static final long DOUBLE_SIGNIF_BIT_MASK = 4503599627370495L; public static final long DOUBLE_SIGNIF_BIT_MASK = 4503599627370495L;
protected static final int DEFAULT_INITIAL_CAPACITY = 16;
protected static final int MAXIMUM_CAPACITY = 1073741824;
protected static final float DEFAULT_LOAD_FACTOR = 0.75F;
private static final long serialVersionUID = 8058099372006904458L;
protected int size;
protected int threshold;
protected float loadFactor;
protected int capMinus1;
protected HashIntrinsic(int initialCapacity, float loadFactor) { protected HashIntrinsic(int initialCapacity, float loadFactor) {
if(initialCapacity <= 0) { if(initialCapacity <= 0) {

View File

@ -202,6 +202,46 @@ public class HashMapDoubleDouble extends HashIntrinsic {
return new HashMapDoubleDouble.Iterator(); return new HashMapDoubleDouble.Iterator();
} }
public static class Entry implements Serializable {
private static final long serialVersionUID = 7972173983741231238L;
private final double key;
private double value;
private HashMapDoubleDouble.Entry next;
public Entry(double key, double val, HashMapDoubleDouble.Entry n) {
this.key = key;
this.value = val;
this.next = n;
}
public final double getKey() {
return this.key;
}
public final double getValue() {
return this.value;
}
public final double setValue(double newValue) {
double oldValue = this.value;
this.value = newValue;
return oldValue;
}
public final boolean equals(Object o) {
HashMapDoubleDouble.Entry e = (HashMapDoubleDouble.Entry) o;
return this.key == e.key && this.value == e.value;
}
public final String toString() {
return this.key + " = " + this.value;
}
public final int hashCode() {
return hashCodeDouble(key) + hashCodeDouble(value);
}
}
public class Iterator { public class Iterator {
HashMapDoubleDouble.Entry next; HashMapDoubleDouble.Entry next;
int index; int index;
@ -248,44 +288,4 @@ public class HashMapDoubleDouble extends HashIntrinsic {
} }
} }
} }
public static class Entry implements Serializable {
private final double key;
private double value;
private HashMapDoubleDouble.Entry next;
private static final long serialVersionUID = 7972173983741231238L;
public Entry(double key, double val, HashMapDoubleDouble.Entry n) {
this.key = key;
this.value = val;
this.next = n;
}
public final double getKey() {
return this.key;
}
public final double getValue() {
return this.value;
}
public final double setValue(double newValue) {
double oldValue = this.value;
this.value = newValue;
return oldValue;
}
public final boolean equals(Object o) {
HashMapDoubleDouble.Entry e = (HashMapDoubleDouble.Entry)o;
return this.key == e.key && this.value == e.value;
}
public final String toString() {
return this.key + " = " + this.value;
}
public final int hashCode() {
return hashCodeDouble(key) + hashCodeDouble(value);
}
}
} }