pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,100 +18,82 @@
package appeng.me.energy;
import appeng.api.networking.energy.IEnergyWatcher;
public class EnergyThreshold implements Comparable<EnergyThreshold> {
public class EnergyThreshold implements Comparable<EnergyThreshold>
{
private final double threshold;
private final IEnergyWatcher watcher;
private final int watcherHash;
private final double threshold;
private final IEnergyWatcher watcher;
private final int watcherHash;
public EnergyThreshold(final double lim, final IEnergyWatcher watcher) {
this.threshold = lim;
this.watcher = watcher;
this.watcherHash = watcher.hashCode();
}
public EnergyThreshold( final double lim, final IEnergyWatcher watcher )
{
this.threshold = lim;
this.watcher = watcher;
this.watcherHash = watcher.hashCode();
}
/**
* Special constructor to allow querying a for a subset of thresholds.
*
* @param lim
* @param bound
*/
public EnergyThreshold(final double lim, final int bound) {
this.threshold = lim;
this.watcher = null;
this.watcherHash = bound;
}
/**
* Special constructor to allow querying a for a subset of thresholds.
*
* @param lim
* @param bound
*/
public EnergyThreshold( final double lim, final int bound )
{
this.threshold = lim;
this.watcher = null;
this.watcherHash = bound;
}
public IEnergyWatcher getEnergyWatcher() {
return this.watcher;
}
public IEnergyWatcher getEnergyWatcher()
{
return this.watcher;
}
@Override
public int compareTo(EnergyThreshold o) {
int a = Double.compare(this.threshold, o.threshold);
@Override
public int compareTo( EnergyThreshold o )
{
int a = Double.compare( this.threshold, o.threshold );
if (a == 0) {
return Integer.compare(this.watcherHash, o.watcherHash);
}
if( a == 0 )
{
return Integer.compare( this.watcherHash, o.watcherHash );
}
return a;
}
return a;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(this.threshold);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((this.watcher == null) ? 0 : this.watcher.hashCode());
return result;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits( this.threshold );
result = prime * result + (int) ( temp ^ ( temp >>> 32 ) );
result = prime * result + ( ( this.watcher == null ) ? 0 : this.watcher.hashCode() );
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
@Override
public boolean equals( Object obj )
{
if( this == obj )
{
return true;
}
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
EnergyThreshold other = (EnergyThreshold) obj;
if (Double.doubleToLongBits(this.threshold) != Double.doubleToLongBits(other.threshold)) {
return false;
}
EnergyThreshold other = (EnergyThreshold) obj;
if( Double.doubleToLongBits( this.threshold ) != Double.doubleToLongBits( other.threshold ) )
{
return false;
}
if( this.watcher == null )
{
if( other.watcher != null )
{
return false;
}
}
else if( !this.watcher.equals( other.watcher ) )
{
return false;
}
return true;
}
if (this.watcher == null) {
if (other.watcher != null) {
return false;
}
} else if (!this.watcher.equals(other.watcher)) {
return false;
}
return true;
}
}