package org.adridadou.ethereum.values;


import java.math.BigInteger;

/**
 * Created by davidroon on 06.11.16.
 * This code is released under Apache 2 license
 */
public class EthValue implements Comparable<EthValue> {
    private final BigInteger value;
    private static final BigInteger ETHER_CONVERSION = BigInteger.valueOf(1_000_000_000_000_000_000L);

    public EthValue(BigInteger value) {
        this.value = value;
    }

    public static EthValue ether(final BigInteger value) {
        return new EthValue(value.multiply(ETHER_CONVERSION));
    }

    public static EthValue wei(final int value) {
        return wei(BigInteger.valueOf(value));
    }

    public static EthValue wei(final BigInteger value) {
        return new EthValue(value);
    }

    public BigInteger inWei() {
        return value;
    }

    @Override
    public int compareTo(EthValue o) {
        return value.compareTo(o.value);
    }
}

@@ -921,11 +921,489 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        if (this == o) return true;%0A        if (o == null %7C%7C getClass() != o.getClass()) return false;%0A%0A        EthValue ethValue = (EthValue) o;%0A%0A        return value != null ? value.equals(ethValue.value) : ethValue.value == null;%0A%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return value != null ? value.hashCode() : 0;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return value + %22 Wei%22;%0A    %7D
 %0A%7D%0A

add equals + hashCode to comparable class