forked from mobnetic/BitcoinChecker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrencyPairInfo.java
36 lines (27 loc) · 1.04 KB
/
CurrencyPairInfo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.mobnetic.coinguardian.model;
public class CurrencyPairInfo implements Comparable<CurrencyPairInfo>{
protected final String currencyBase;
protected final String currencyCounter;
protected final String currencyPairId;
public CurrencyPairInfo(String currencyBase, String currencyCounter, String currencyPairId) {
this.currencyBase = currencyBase;
this.currencyCounter = currencyCounter;
this.currencyPairId = currencyPairId;
}
public String getCurrencyBase() {
return currencyBase;
}
public String getCurrencyCounter() {
return currencyCounter;
}
public String getCurrencyPairId() {
return currencyPairId;
}
@Override
public int compareTo(CurrencyPairInfo another) throws NullPointerException {
if(currencyBase==null || another.currencyBase==null || currencyCounter==null || another.currencyCounter==null)
throw new NullPointerException();
int compBase = currencyBase.compareToIgnoreCase(another.currencyBase);
return compBase!=0 ? compBase : currencyCounter.compareToIgnoreCase(another.currencyCounter);
}
}