diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-12-20 19:52:39 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-12-20 19:52:39 -0800 |
commit | 24b292bc472ba66fa12ddf49ab2ceb0513b3063d (patch) | |
tree | e556daaa4802759a2683b7818746651d0da1d981 /src/github/daneren2005 | |
parent | d6b422d63993314d6e4f5fc8823e21254512fcee (diff) | |
download | dsub-24b292bc472ba66fa12ddf49ab2ceb0513b3063d.tar.gz dsub-24b292bc472ba66fa12ddf49ab2ceb0513b3063d.tar.bz2 dsub-24b292bc472ba66fa12ddf49ab2ceb0513b3063d.zip |
#222 Sort albums by year
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/domain/MusicDirectory.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index 24f61311..b5707daf 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -374,7 +374,17 @@ public class MusicDirectory implements Serializable { } else if(!lhs.isDirectory() && rhs.isDirectory()) { return 1; } else if(lhs.isDirectory() && rhs.isDirectory()) { - return lhs.getTitle().compareToIgnoreCase(rhs.getTitle()); + Integer lhsYear = lhs.getYear(); + Integer rhsYear = rhs.getYear(); + if(lhsYear != null && rhsYear != null) { + return lhsYear.compareTo(rhsYear); + } else if(lhsYear != null) { + return -1; + } else if(rhsYear != null) { + return 1; + } else { + return lhs.getTitle().compareToIgnoreCase(rhs.getTitle()); + } } Integer lhsDisc = lhs.getDiscNumber(); |