edu.iu.iv.modeling.tarl.topic.impl
Class DefaultTopic

java.lang.Object
  |
  +--edu.iu.iv.modeling.tarl.topic.impl.DefaultTopic
All Implemented Interfaces:
Topic

public class DefaultTopic
extends java.lang.Object
implements Topic

This class provides a default implementation of the TopicInterface. It represents the identifier of the topic as an integer; it associates a name with each Topic and it associates a list of keywords as an ExtendedHashSet.

Author:
Jeegar T Maru
See Also:
DefaultAuthor, DefaultPublication, Topic

Constructor Summary
DefaultTopic()
          Creates a new instance for a default Topic.
DefaultTopic(int id)
          Creates a new instance for a Topic with the specified id.
DefaultTopic(int id, java.lang.String name)
          Creates a new instance for a Topic with the specified id, and the specified name
DefaultTopic(int id, java.lang.String name, ExtendedHashSet keywords)
          Creates a new instance for a DefaultTopic with the specified id, name and Topic
 
Method Summary
 boolean equals(Topic topic)
          Tests whether the current Topic is the same as the Topic given by the parameter
 int getId()
          Returns the id of the Topic
 ExtendedHashSet getKeywords()
          Returns the keywords of the Topic
 java.lang.String getName()
          Returns the name of the Topic
 void initialize(int id)
          Initializes the Topic with the given integer identification
 void setKeywords(java.util.Collection keywords)
          Stores the list of keywords of the Topic
 void setName(java.lang.String name)
          Stores the name of the Topic as a String
 java.lang.String toString()
          Return the details of the Topic as a String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultTopic

public DefaultTopic()
Creates a new instance for a default Topic.


DefaultTopic

public DefaultTopic(int id)
Creates a new instance for a Topic with the specified id. A Topic must have an id at the very least.

Parameters:
id - Specifies the unique id for the newly instantiated topic

DefaultTopic

public DefaultTopic(int id,
                    java.lang.String name)
             throws java.lang.NullPointerException
Creates a new instance for a Topic with the specified id, and the specified name

Parameters:
id - Specifies the unique id for the newly instantiated topic
name - Specifies the name of the newly instantiated topic
Throws:
java.lang.NullPointerException - if the specified name is null

DefaultTopic

public DefaultTopic(int id,
                    java.lang.String name,
                    ExtendedHashSet keywords)
             throws java.lang.NullPointerException
Creates a new instance for a DefaultTopic with the specified id, name and Topic

Parameters:
id - Specifies the unique id for the newly instantiated topic
name - Specifies the name of the newly instantiated topic
keywords - Specifies the extended hashset of keywords for the newly instantiated topic
Throws:
java.lang.NullPointerException - if the specified name is null
Method Detail

initialize

public void initialize(int id)
Initializes the Topic with the given integer identification

Specified by:
initialize in interface Topic
Parameters:
id - Specifies the integer id used for identification

getId

public int getId()
Returns the id of the Topic

Specified by:
getId in interface Topic
Returns:
the id of the topic as an integer

getName

public java.lang.String getName()
Returns the name of the Topic

Returns:
the name of the topic as a string

getKeywords

public ExtendedHashSet getKeywords()
Returns the keywords of the Topic

Returns:
the keywords of the topic as a extended hash set

setName

public void setName(java.lang.String name)
Stores the name of the Topic as a String

Parameters:
name - Specifies the name of the topic

setKeywords

public void setKeywords(java.util.Collection keywords)
Stores the list of keywords of the Topic

Parameters:
keywords - Specifies the collection of keywords

equals

public boolean equals(Topic topic)
Tests whether the current Topic is the same as the Topic given by the parameter

Specified by:
equals in interface Topic
Parameters:
topic - Specifies the topic to be equated against
Returns:
true if the current topic and the specified topic are equal

toString

public java.lang.String toString()
Return the details of the Topic as a String

Overrides:
toString in class java.lang.Object
Returns:
a string describing the topic