|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmodel.Feed
public class Feed
The Feed class represents an RSS feed. A Feed itself has a title, description, url, and a date that it was last updated. Under some circumstances, a Feed is also a collection of Articles: the knowsChildren boolean determines whether this is the case. A feed created by a parser, or in general added to under any circumstances, contains some Articles; otherwise, a feed does not contain articles, and if you want a feed's articles, you should ask a database.
| Field Summary | |
|---|---|
private java.util.List<Article> |
articles
|
private java.lang.String |
description
|
private int |
id
|
private boolean |
knowsChildren
|
private java.util.Date |
lastUpdatedByFeed
|
private java.util.Date |
lastUpdatedByUser
|
private int |
parentid
|
private java.util.Date |
publishedDate
|
private java.lang.String |
title
|
private int |
updateInterval
|
private java.lang.String |
url
|
| Constructor Summary | |
|---|---|
Feed(int id,
int parentid,
java.lang.String title,
java.lang.String description,
java.lang.String url,
java.util.Date lastUpdatedByFeed,
java.util.Date lastUpdatedByUser,
java.util.Date publishedDate,
int updateInterval)
Constructor that is used when the DBHandler creates and returns a string, so this feed should have an id. |
|
Feed(java.lang.String title,
java.lang.String description,
java.lang.String url,
java.util.Date lastUpdatedByFeed,
java.util.Date lastUpdatedByUser,
java.util.Date publishedDate)
Constructor that is used when the RomeFeedParser creates a feed, so this kind of feed should not have an id. |
|
| Method Summary | |
|---|---|
boolean |
addArticle(Article a)
The method addArticle adds the specified article to the feed, if it is not already in the feed. |
void |
addArticles(java.util.List<Article> a)
Adds a list of articles to the feed, calling the addArticle method. |
java.util.List<Article> |
getChildren()
Gets the articles from a feed, should rarely be used as the database should be the source of this type of information, except when the parser is creating the feed. |
java.lang.String |
getDescription()
Gets the description of the feed. |
int |
getId()
Gets the id of the feed, if it has one; throws an error otherwise. |
java.util.Date |
getLastUpdatedByFeed()
Returns the date when the feed was last updated. |
java.util.Date |
getLastUpdatedByUser()
Returns the date the feed was last updated by the user. |
int |
getParentId()
Gets the id of the feed's parent folder, if it has one; throws an error otherwise. |
java.util.Date |
getPublishedDate()
Returns the date the feed was published. |
java.lang.String |
getTitle()
Gets the title of the Feed, which should not be null (but might conceivably be the empty string ""). |
int |
getUpdateInterval()
Gets the updateInterval of the feed, an integer representing how frequently the application should try to update the feed. |
java.lang.String |
getUrl()
Gets the url of the Feed. |
private boolean |
hasArticle(Article a)
The method hasArticle tests if the article is already in the feed, based on the article.isSame() method. |
static boolean |
isSame(Feed f1,
Feed f2)
Tests equivalence of two feeds by comparing the two feeds' URLs. |
boolean |
knowsChildren()
This method returns a boolean indication whether or not this feed is actually containing its children, which isn't trivial because feeds returned by the database don't have references to their children. |
boolean |
removeArticle(Article a)
The method removeArticle attempts to remove the specified article from the Feed. |
private void |
setKnowsChildren(boolean b)
sets the knowsChildren private data field. |
void |
setTitle(java.lang.String title)
Sets the title of the feed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private boolean knowsChildren
private java.lang.String title
private java.lang.String description
private java.lang.String url
private int id
private int parentid
private int updateInterval
private java.util.Date lastUpdatedByFeed
private java.util.Date lastUpdatedByUser
private java.util.Date publishedDate
private java.util.List<Article> articles
| Constructor Detail |
|---|
public Feed(int id,
int parentid,
java.lang.String title,
java.lang.String description,
java.lang.String url,
java.util.Date lastUpdatedByFeed,
java.util.Date lastUpdatedByUser,
java.util.Date publishedDate,
int updateInterval)
id - Guaranteed unique (comes from database).parentid - title - description - url - lastUpdatedByFeed - lastUpdatedByUser - publishedDate - updateInterval -
public Feed(java.lang.String title,
java.lang.String description,
java.lang.String url,
java.util.Date lastUpdatedByFeed,
java.util.Date lastUpdatedByUser,
java.util.Date publishedDate)
title - description - url - lastUpdatedByFeed - lastUpdatedByUser - publishedDate - | Method Detail |
|---|
public boolean addArticle(Article a)
public void addArticles(java.util.List<Article> a)
a - The list of articles to be added to the feed.private boolean hasArticle(Article a)
a - Article to be compared.
public boolean removeArticle(Article a)
public static boolean isSame(Feed f1,
Feed f2)
f1 - First feed to be testedf2 - Second feed to be tested
public java.util.List<Article> getChildren()
throws java.lang.IllegalAccessException
java.lang.IllegalAccessException - if the feed has not yet been instantiated with its children (for instance, it is newly created)public boolean knowsChildren()
private void setKnowsChildren(boolean b)
b - public java.lang.String getDescription()
public int getId()
java.lang.IllegalAccessError - If this feed was constructed as "small" (without an id), throw this exception.public int getParentId()
java.lang.IllegalAccessError - If this feed was constructed as "small" (without a parent id), throw this exception.public java.util.Date getLastUpdatedByFeed()
public java.util.Date getLastUpdatedByUser()
public java.util.Date getPublishedDate()
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
title - String New title for feed.public java.lang.String getUrl()
public int getUpdateInterval()
java.lang.IllegalAccessError - If the feed has not been instantiated with an update interval, give this exception.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||