crystal-wallet-android/app/src/main/java/cy/agorise/crystalwallet/enums/CryptoCoin.java

54 lines
1.3 KiB
Java
Raw Normal View History

package cy.agorise.crystalwallet.enums;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* This represents each supported Crypto Coin
*
* Created by Henry Varona on 12/9/2017.
*/
public enum CryptoCoin implements Serializable {
2017-09-13 21:52:36 +00:00
BITCOIN(CryptoNet.BITCOIN,"BTC",8),
BITCOIN_TEST(CryptoNet.BITCOIN_TEST,"BTC",8),
LITECOIN(CryptoNet.LITECOIN,"LTC",8),
DASH(CryptoNet.DASH,"DASH",8),
DOGECOIN(CryptoNet.DOGECOIN,"DOGE",8),
BITSHARES(CryptoNet.BITSHARES,"BTS",5);
protected CryptoNet cryptoNet;
protected String label;
protected int precision;
2017-09-13 21:52:36 +00:00
CryptoCoin(CryptoNet cryptoNet, String label, int precision){
this.cryptoNet = cryptoNet;
this.label = label;
this.precision = precision;
2017-09-13 21:52:36 +00:00
}
public CryptoNet getCryptoNet(){
return this.cryptoNet;
}
public String getLabel(){
return this.label;
}
public int getPrecision(){
return this.precision;
}
public static List<CryptoCoin> getByCryptoNet(CryptoNet cryptoNet){
List<CryptoCoin> result = new ArrayList<CryptoCoin>();
for (CryptoCoin nextCryptoCoin : CryptoCoin.values()){
if (nextCryptoCoin.getCryptoNet().equals(cryptoNet)) {
result.add(nextCryptoCoin);
}
}
return result;
}
2017-09-13 21:52:36 +00:00
}