es.ucm.fdi.hysteria.game.scene
Class Topic

java.lang.Object
  extended by es.ucm.fdi.hysteria.game.scene.Topic
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Topic
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class implements a topic to talk about

Author:
Sandor
See Also:
Serialized Form

Field Summary
protected  boolean _enabled
           
protected  boolean _final
           
protected  java.lang.String _text
           
protected  java.lang.String _title
           
protected  boolean _watched
           
 
Constructor Summary
Topic(java.lang.String title, java.lang.String text)
          Constructor
Topic(java.lang.String title, java.lang.String text, boolean end)
          Constructor
Topic(java.lang.String title, java.lang.String text, boolean end, boolean enabled)
          Constructor
 
Method Summary
 void addItem(Item i)
          It adds an item to the topic
 boolean addRelated(Topic topic, boolean enable)
          It adds a topic to enable or disable after this topic ends.
 java.lang.Object clone()
           
 ItemRepository getItems()
          It returns the items linked
 java.lang.String getTitle()
          It returns the topic title
 boolean givesItem()
          This topic gives any item?
 boolean isEnabled()
          Is the topic enabled?
 boolean isFinal()
          Is the topic final (And ends the scene)?
 java.lang.String reportText()
          It returns the topic text if it's enabled, and then enables or disables the topics related.
 void setEnabled(boolean enabled)
          Sets the "enabled" flag to the value given
 boolean wasWatched()
          Was the topic watched?
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_enabled

protected boolean _enabled

_watched

protected boolean _watched

_final

protected boolean _final

_title

protected java.lang.String _title

_text

protected java.lang.String _text
Constructor Detail

Topic

public Topic(java.lang.String title,
             java.lang.String text)
Constructor

Parameters:
title - The topic title
text - The topic text

Topic

public Topic(java.lang.String title,
             java.lang.String text,
             boolean end)
Constructor

Parameters:
title - The topic title
text - The topic text
end - Is the topic final?

Topic

public Topic(java.lang.String title,
             java.lang.String text,
             boolean end,
             boolean enabled)
Constructor

Parameters:
title - The topic title
text - The topic text
end - Is the topic final?
enabled - Is the topic enabled?
Method Detail

getTitle

public java.lang.String getTitle()
It returns the topic title

Returns:
The title

reportText

public java.lang.String reportText()
It returns the topic text if it's enabled, and then enables or disables the topics related.

Returns:
The topic text

wasWatched

public boolean wasWatched()
Was the topic watched?

Returns:
True if it was watched

isEnabled

public boolean isEnabled()
Is the topic enabled?

Returns:
True if its enabled

isFinal

public boolean isFinal()
Is the topic final (And ends the scene)?

Returns:
True if it's final

setEnabled

public void setEnabled(boolean enabled)
Sets the "enabled" flag to the value given

Parameters:
enabled - The value

addRelated

public boolean addRelated(Topic topic,
                          boolean enable)
It adds a topic to enable or disable after this topic ends.

Parameters:
topic - The topic
enable - It has to enable, or disable the topic?
Returns:
True if the operation was successful

addItem

public void addItem(Item i)
It adds an item to the topic

Parameters:
i - The item

givesItem

public boolean givesItem()
This topic gives any item?

Returns:
True if it gives at least an item

getItems

public ItemRepository getItems()
It returns the items linked

Returns:
The items

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object