Applied-Energistics-2-tiler.../me/energy/EnergyThreshold.java

36 lines
660 B
Java
Raw Normal View History

package appeng.me.energy;
import appeng.api.networking.energy.IEnergyWatcher;
import appeng.util.ItemSorters;
public class EnergyThreshold implements Comparable<EnergyThreshold>
{
public final double Limit;
public final IEnergyWatcher watcher;
final int hash;
public EnergyThreshold(double lim, IEnergyWatcher wat) {
Limit = lim;
watcher = wat;
if ( watcher != null )
hash = watcher.hashCode() ^ ((Double) lim).hashCode();
else
hash = ((Double) lim).hashCode();
}
@Override
public int hashCode()
{
return hash;
}
@Override
public int compareTo(EnergyThreshold o)
{
2014-08-06 04:05:54 +02:00
return ItemSorters.compareDouble( Limit, o.Limit );
}
}