package forum;
/**
* Represents a response to a topic.
*
* @author Simon Brown
*/
public class Response extends Posting {
/** the Topic to which this response is associated */
private Topic topic;
/** a flag indicating whether this repsonse has been deleted */
private boolean deleted = false;
/**
* Creates a new response with the specified information.
*
* @param user the User that posted the response
* @param text the text of the response
*/
public Response(User user, String text) {
super(user, text);
}
/**
* Determines whether this response has been deleted from the topic.
*
* @return true if it has been deleted,
* false otherwise (if it is still visible)
*/
public boolean isDeleted() {
return this.deleted;
}
/**
* Sets whether this response has been deleted from the topic.
*
* @param b true if this response is to be deleted, false otherwise
*/
public void setDeleted(boolean b) {
this.deleted = b;
}
/**
* Setter for the topic property.
*
* @param topic the Topic instance
*/
public void setTopic(Topic topic) {
this.topic = topic;
}
/**
* Getter for the topic property.
*
* @return the Topic instance
*/
public Topic getTopic() {
return this.topic;
}
}