From aa7e58dc42f05f94954a0a4ca6f03420d4c97a74 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Tue, 18 Dec 2012 17:27:22 +0100 Subject: Added "updateFromOther" and "compareWithOther" methods --- src/de/danoeh/antennapod/feed/Feed.java | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'src/de/danoeh/antennapod/feed/Feed.java') 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; -- cgit v1.2.3