diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-12-18 17:27:22 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-12-18 17:27:22 +0100 |
commit | aa7e58dc42f05f94954a0a4ca6f03420d4c97a74 (patch) | |
tree | af2b2a3d2f995f45e5aca483ec5abf1b6ad13109 /src/de/danoeh/antennapod/feed/Feed.java | |
parent | d07afe16ae5235a4da4018997d66323fcf6b2b45 (diff) | |
download | AntennaPod-aa7e58dc42f05f94954a0a4ca6f03420d4c97a74.zip |
Added "updateFromOther" and "compareWithOther" methods
Diffstat (limited to 'src/de/danoeh/antennapod/feed/Feed.java')
-rw-r--r-- | src/de/danoeh/antennapod/feed/Feed.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/de/danoeh/antennapod/feed/Feed.java b/src/de/danoeh/antennapod/feed/Feed.java index 7640ef7d1..8e93d54ee 100644 --- a/src/de/danoeh/antennapod/feed/Feed.java +++ b/src/de/danoeh/antennapod/feed/Feed.java @@ -171,6 +171,72 @@ public class Feed extends FeedFile { } } + public void updateFromOther(Feed other) { + super.updateFromOther(other); + if (other.title != null) { + title = other.title; + } + if (other.feedIdentifier != null) { + feedIdentifier = other.feedIdentifier; + } + if (other.link != null) { + link = other.link; + } + if (other.description != null) { + description = other.description; + } + if (other.language != null) { + language = other.language; + } + if (other.author != null) { + author = other.author; + } + if (other.paymentLink != null) { + paymentLink = other.paymentLink; + } + } + + public boolean compareWithOther(Feed other) { + if (super.compareWithOther(other)) { + return true; + } + if (!title.equals(other.title)) { + return true; + } + if (other.feedIdentifier != null) { + if (feedIdentifier == null + || !feedIdentifier.equals(other.feedIdentifier)) { + return true; + } + } + if (other.link != null) { + if (link == null || !link.equals(other.link)) { + return true; + } + } + if (other.description != null) { + if (description == null || !description.equals(other.description)) { + return true; + } + } + if (other.language != null) { + if (language == null || !language.equals(other.language)) { + return true; + } + } + if (other.author != null) { + if (author == null || !author.equals(other.author)) { + return true; + } + } + if (other.paymentLink != null) { + if (paymentLink == null || !paymentLink.equals(other.paymentLink)) { + return true; + } + } + return false; + } + @Override public int getTypeAsInt() { return FEEDFILETYPE_FEED; |