package scotch.data.bigint; import static java.util.Arrays.asList; import static scotch.runtime.RuntimeSupport.callable; import java.math.BigInteger; import java.util.List; import scotch.data.eq.Eq; import scotch.runtime.Callable; import scotch.symbol.InstanceGetter; import scotch.symbol.TypeInstance; import scotch.symbol.TypeParameters; import scotch.symbol.type.TypeDescriptor; @SuppressWarnings("unused") @TypeInstance(typeClass = "scotch.data.eq.Eq") public class EqBigInt implements Eq<BigInteger> { private static final Callable<EqBigInt> INSTANCE = callable(EqBigInt::new); @InstanceGetter public static Callable<EqBigInt> instance() { return INSTANCE; } @TypeParameters public static List<TypeDescriptor> parameters() { return asList(BigInt.TYPE); } private EqBigInt() { // intentionally empty } @Override public Callable<Boolean> eq(Callable<BigInteger> left, Callable<BigInteger> right) { return callable(() -> left.call().equals(right.call())); } }