org.activemath.feedback.therapies
Class Therapy

java.lang.Object
  extended by org.activemath.feedback.therapies.Therapy
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
GuideNavigation, PraiseNavigation, Present

public class Therapy
extends Object
implements Comparable

This class is supposed to hold the 'therapy' following a certain 'diagnose' inferred by the org.activemath.feedback.SuggestionEngine.
It contains messages to be displayed to the user, as well as a list of Prescriptions. These are basically presentation actions that are not immediately displayed, but instead have to be requested by the user, e.g. by following a generated link.
A Therapy keeps also track of the diagnoses that caused its generation in its anamnesis.


Field Summary
static String CONTENT_PRESENTATION
           
static String GUIDE_NAVIGATION
           
protected  String message
           
protected  String name
           
static String SKIPPED_BEGINNING
           
protected  boolean smile
           
 
Constructor Summary
Therapy(String name, String type)
           
 
Method Summary
 void addDiagnose(Diagnose diagnose)
          Adds a Diagnose to this Therapy's anamnesis.
 void addPrescription(Prescription p)
           
 int compareTo(Object therapy)
          Compares two therapies.
 List getAnamnesis()
          Returns this Therapy's anamnesis.
 String getMessage()
           
 String getName()
           
 List getPrescriptions()
           
 boolean getSmile()
           
 long getTimestamp()
           
 String getType()
           
 void setAnamnesis(List l)
          Sets this Therapy's anamnesis List.
 void setMessage(String message)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GUIDE_NAVIGATION

public static final String GUIDE_NAVIGATION
See Also:
Constant Field Values

SKIPPED_BEGINNING

public static final String SKIPPED_BEGINNING
See Also:
Constant Field Values

CONTENT_PRESENTATION

public static final String CONTENT_PRESENTATION
See Also:
Constant Field Values

name

protected String name

message

protected String message

smile

protected boolean smile
Constructor Detail

Therapy

public Therapy(String name,
               String type)
Method Detail

addPrescription

public void addPrescription(Prescription p)

addDiagnose

public void addDiagnose(Diagnose diagnose)
Adds a Diagnose to this Therapy's anamnesis.

Parameters:
diagnose - the Diagnose to add to this Therapy's anamnesis.

getAnamnesis

public List getAnamnesis()
Returns this Therapy's anamnesis. It's a List that contains all diagnoses responsible for the generation of this Therapy.

Returns:
a list of Diagnose objects responsible for the generation of this Therapy.

setAnamnesis

public void setAnamnesis(List l)
Sets this Therapy's anamnesis List. The List has to contain Diagnose objects responsible for the generation of this Therapy.

Parameters:
l - The Anamnesis List to be set for this Therapy.

compareTo

public int compareTo(Object therapy)
Compares two therapies.
Comparison is needed in oreder to arrange the Therapies chronologically, so the timestamp field is subject to comparison.

Specified by:
compareTo in interface Comparable
Parameters:
therapy - The Object that is to be compared to this Therapy.
Returns:
sgn(therapy.timestamp-this.timestamp), or -1 if therapy is not instanceof Therapy

toString

public String toString()
Overrides:
toString in class Object

getTimestamp

public long getTimestamp()
Returns:
Returns the timestamp.

getPrescriptions

public List getPrescriptions()

getName

public String getName()
Returns:
Returns the name.

getType

public String getType()
Returns:
Returns the type.

getMessage

public String getMessage()
Returns:
Returns the message.

setMessage

public void setMessage(String message)
Parameters:
message - The message to set.

getSmile

public boolean getSmile()