summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/feed/FeedComponent.java
blob: 48b2437708980df960b96750128e4fd18cff0506 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package de.danoeh.antennapod.feed;

/**
 * Represents every possible component of a feed
 *
 * @author daniel
 */
public abstract class FeedComponent {

    protected long id;

    public FeedComponent() {
        super();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    /**
     * Update this FeedComponent's attributes with the attributes from another
     * FeedComponent. This method should only update attributes which where read from
     * the feed.
     */
    public void updateFromOther(FeedComponent other) {
    }

    /**
     * Compare's this FeedComponent's attribute values with another FeedComponent's
     * attribute values. This method will only compare attributes which were
     * read from the feed.
     *
     * @return true if attribute values are different, false otherwise
     */
    public boolean compareWithOther(FeedComponent other) {
        return false;
    }


    /**
     * Should return a non-null, human-readable String so that the item can be
     * identified by the user. Can be title, download-url, etc.
     */
    public abstract String getHumanReadableIdentifier();

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FeedComponent that = (FeedComponent) o;

        if (id != that.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return (int) (id ^ (id >>> 32));
    }
}