mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 01:56:44 +00:00
more nuanced wallet compare with master wallets first
This commit is contained in:
parent
fe61c633ae
commit
61317f15ac
1 changed files with 23 additions and 3 deletions
|
@ -1534,11 +1534,31 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Wallet other) {
|
public int compareTo(Wallet other) {
|
||||||
if(getStandardAccountType() != null && other.getStandardAccountType() != null) {
|
if(isMasterWallet() && !other.isMasterWallet()) {
|
||||||
return getStandardAccountType().ordinal() - other.getStandardAccountType().ordinal();
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getAccountIndex() - other.getAccountIndex();
|
if(!isMasterWallet() && other.isMasterWallet()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getStandardAccountType() != null && other.getStandardAccountType() != null) {
|
||||||
|
int standardAccountDiff = getStandardAccountType().ordinal() - other.getStandardAccountType().ordinal();
|
||||||
|
if(standardAccountDiff != 0) {
|
||||||
|
return standardAccountDiff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int accountIndexDiff = getAccountIndex() - other.getAccountIndex();
|
||||||
|
if(accountIndexDiff != 0) {
|
||||||
|
return accountIndexDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(name != null && other.name != null) {
|
||||||
|
return name.compareTo(other.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue