edu.iu.iv.modeling.tarl.author.impl
Class DefaultAuthor

java.lang.Object
  |
  +--edu.iu.iv.modeling.tarl.author.impl.DefaultAuthor
All Implemented Interfaces:
Author

public class DefaultAuthor
extends java.lang.Object
implements Author

This class defines a default implementation for the AuthorInterface. The implementation stores the following properties of the Author :


Extension : If the model is to be extended to include Agent-based modeling, the Author class would need to be modified/extended to make an Author capable of reasoning and making decisions (basically, making it an Agent).

Author:
Jeegar T Maru
See Also:
Topic, Author

Constructor Summary
DefaultAuthor()
          Creates a new instance for an Author with the specified id and Topic.
DefaultAuthor(int id, Topic topic)
          Creates a new instance for an Author with the specified id and Topic.
DefaultAuthor(int id, Topic topic, int maximum_age)
          Creates a new instance for an Author with the specified id, Topic and maximum age
 
Method Summary
 void deactivate()
          Notifies the Author of deactivation.
 boolean equals(Author author)
          Tests whether the current Author is the same as the Author given by the parameter
 int getAge()
          Returns the age of the Author
 int getId()
          Returns the id of the Author
 int getMaximumAge()
          Returns the maximum age of the Author
 Topic getTopic()
          Returns the Topic of the Author
 void initialize(int id, Topic topic)
          Initializes the Author with the specified identifier and Topic
 void initialize(int id, Topic topic, int maximum_age)
          Initializes the Author with the specified identifier, Topic and the maximum age
 boolean isActive()
          Tests whether the Author is active for the current year
 java.lang.String toString()
          Returns the details of the Author as a String
 void yearEndNotification()
          Notifies the Author that the current year has terminated.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultAuthor

public DefaultAuthor()
Creates a new instance for an Author with the specified id and Topic. An Author should have an id and a Topic at the very least. Assumes that the maximum age of the Author is infinity.


DefaultAuthor

public DefaultAuthor(int id,
                     Topic topic)
              throws TarlException
Creates a new instance for an Author with the specified id and Topic. An Author should have an id and a Topic at the very least. Assumes that the maximum age of the Author is infinity.

Parameters:
id - Specifies the unique id for the newly instantiated author
topic - Specifies the topic for the newly instantiated author
Throws:
TarlException - if the specified topic is null

DefaultAuthor

public DefaultAuthor(int id,
                     Topic topic,
                     int maximum_age)
              throws TarlException
Creates a new instance for an Author with the specified id, Topic and maximum age

Parameters:
id - Specifies the unique id for the newly instantiated author
topic - Specifies the topic for the newly instantiated author
maximum_age - Specifies the maximum age for the newly instantiated author
Throws:
TarlException - if the specified topic is null
Method Detail

initialize

public void initialize(int id,
                       Topic topic)
Initializes the Author with the specified identifier and Topic

Specified by:
initialize in interface Author
Parameters:
id - Specifies the unique identifier of the author
topic - Specifies the topic of the author

initialize

public void initialize(int id,
                       Topic topic,
                       int maximum_age)
Initializes the Author with the specified identifier, Topic and the maximum age

Specified by:
initialize in interface Author
Parameters:
id - Specifies the unique identifier of the author
topic - Specifies the topic of the author
maximum_age - Specifies the maximum age of the author

getId

public int getId()
Returns the id of the Author

Specified by:
getId in interface Author
Returns:
the id of the author as an integer

getTopic

public Topic getTopic()
Returns the Topic of the Author
Specified by:
getTopic in interface Author
Returns:
the topic of the author

getMaximumAge

public int getMaximumAge()
Returns the maximum age of the Author
Returns:
the maximum age of the author as an integer

getAge

public int getAge()
Returns the age of the Author

Returns:
the age of the author as an integer

equals

public boolean equals(Author author)
Tests whether the current Author is the same as the Author given by the parameter

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

isActive

public boolean isActive()
Tests whether the Author is active for the current year

Specified by:
isActive in interface Author
Returns:
true if the author is active

deactivate

public void deactivate()
Notifies the Author of deactivation. Asks the Author to not produce any Publications henceforth.

Specified by:
deactivate in interface Author

yearEndNotification

public void yearEndNotification()
Notifies the Author that the current year has terminated. Allows the Author to increment his/her age or do book-keeping activities.

Specified by:
yearEndNotification in interface Author

toString

public java.lang.String toString()
Returns the details of the Author as a String

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