|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfable.adt.FableComponent
fable.adt.Article
public class Article
This class represents an article.
Constructor Summary | |
---|---|
Article(Article a)
Constructs a brand new article (cloning) an original one |
|
Article(java.util.Date date,
java.lang.String title,
java.lang.String author,
java.lang.String summary)
Construct a new Article with provided date, title, author, and summary. |
|
Article(java.util.Date date,
java.lang.String title,
java.lang.String articleURL,
java.lang.String author,
java.lang.String summary)
Construct a new Article with provided date, title, articleURL, author, and summary. |
Method Summary | |
---|---|
void |
accept(FableVisitor v)
Accept the visitor v to visit this. |
void |
acceptRecursive(FableVisitor v)
Accept the visitor v to visit this, and recurse on children of this. |
boolean |
activate()
Activates it to the GUI |
void |
addArticleMarkChangeListener(ArticleMarkChangeListener amcl)
Add a listener for mark change of this article. |
boolean |
addChild(FableComponent fc)
Article cannot have any children, so it will always return false. |
void |
addKeywords(java.util.Set<java.lang.String> keywords)
Add keywords to register as the article's keyword. |
java.net.URL |
getArticleURL()
Returns an URL object represents where the article is. |
java.lang.String |
getAuthor()
Returns a string that is a name of the author. |
java.lang.String |
getContent()
Returns the path of the html file in the file system that contains the data If there is no such path, it returns an empty string |
java.lang.String |
getSummary()
Returns a string that is a summary of this. |
boolean |
isKeywordRegistered(java.lang.String keyword)
Returns ture if the keyword is registered for this article. |
boolean |
isMarkedAs(Mark m)
Returns true if this article is marked as m. |
boolean |
isSimilarTo(FableComponent fc)
Returns true if this article and the FableComponent are similar. |
void |
refresh()
Refreshes this article according to the articleURL. |
void |
removeAllListeners()
Removes all the listeners associated with this FableComponent. |
void |
removeArticleMarkChangeListener(ArticleMarkChangeListener amcl)
Remove a listener for mark change of this article. |
void |
setContent(java.lang.String newContent)
Replace the content of this article with the newContent. |
void |
setKeywords(java.util.Set<java.lang.String> keywords)
Set the keywords of this article. |
void |
setMark(Mark m,
boolean b)
Set the mark m as boolean b. |
void |
setSummary(java.lang.String newSummary)
Sets the summary of the Article |
java.lang.String |
toString()
Returns string representation of this article. |
Methods inherited from class fable.adt.FableComponent |
---|
addStructuralChangeListener, getChildren, getDate, getDescendants, getParent, getPosition, getTitle, isAncestorOf, moveDown, moveUp, removeChild, removeStructuralChangeListener, setParent, setPosition, setTitle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Article(java.util.Date date, java.lang.String title, java.lang.String articleURL, java.lang.String author, java.lang.String summary) throws java.net.MalformedURLException
date
- a date that the article is posted.title
- a title of the article.articleURL
- a string corresponds to the article URL.author
- a string represents the author.summary
- a string represents the summary of this article.
java.net.MalformedURLException
- if articleURL is not a correct URL.
java.lang.NullPointerException
- if any of the parameters is null.public Article(java.util.Date date, java.lang.String title, java.lang.String author, java.lang.String summary)
date
- a date that the article is posted.title
- a title of the article.author
- a string represents the author.summary
- a string represents the summary of this article.
java.net.MalformedURLException
- if articleURL is not a correct URL.
java.lang.NullPointerException
- if any of the parameters is null.public Article(Article a) throws java.net.MalformedURLException
a
- Article to duplicate
java.net.MalformedURLException
- if URL is invalid
java.lang.NullPointerException
- if a is null.Method Detail |
---|
public boolean activate()
FableComponent
activate
in class FableComponent
public void refresh() throws java.io.IOException
java.io.IOException
- if connecting to the URL is failed.public java.lang.String toString()
toString
in class java.lang.Object
public final boolean isMarkedAs(Mark m)
true
from isMarkedAs( Mark.Read )
, then we
know that the article is marked as read.
m
- mark to be checked.
public boolean isSimilarTo(FableComponent fc)
isSimilarTo
in class FableComponent
fc
- FableComponent to
public boolean isKeywordRegistered(java.lang.String keyword)
keyword
- query keyword.
public boolean addChild(FableComponent fc)
addChild
in interface FableContainer
addChild
in class FableComponent
fc
- FableComponent object.
public final void addArticleMarkChangeListener(ArticleMarkChangeListener amcl)
amcl
- a listener to be added to this.
java.lang.NullPointerException
- if amcl is null.public final void addKeywords(java.util.Set<java.lang.String> keywords)
keywords
- keywords to be added.
java.lang.NullPointerException
- when keywords is null.public final void removeArticleMarkChangeListener(ArticleMarkChangeListener amcl)
amcl
- a listener to be removed from this.
java.lang.NullPointerException
- if amcl is null.public void removeAllListeners()
removeAllListeners
in class FableComponent
public java.net.URL getArticleURL()
public java.lang.String getAuthor()
public java.lang.String getSummary()
public java.lang.String getContent()
public void setContent(java.lang.String newContent)
newContent
- a string to be the content of this.public void setMark(Mark m, boolean b)
setMark( Mark.READ, true )
, it makes the article marked as
read.
m
- mark to change the status.b
- boolean value of desired state of the mark.
java.lang.NullPointerException
- if m is null.public void setKeywords(java.util.Set<java.lang.String> keywords)
keywords
- keywords to replace current keywords.
java.lang.NullPointerException
- if keywords is null.public void setSummary(java.lang.String newSummary)
newSummary
- The new summary
java.lang.NullPointerException
- when newSummary is null.public void accept(FableVisitor v)
FableComponent
accept
in class FableComponent
v
- the visitor to visit this.public void acceptRecursive(FableVisitor v)
FableComponent
acceptRecursive
in class FableComponent
v
- the visitor to visit this and decendants of this.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |