mauda.feedback
Class FeedbackObject

java.lang.Object
  extended by mauda.feedback.FeedbackObject
All Implemented Interfaces:
java.util.Comparator

public class FeedbackObject
extends java.lang.Object
implements java.util.Comparator

Indepented object for storing adequat feedback.

Author:
Markus Krebs

Field Summary
static int CORRECT
          Defines that the operation is correct
static int INCORRECT
          Defines that the operation is incorrect
static int INCORRECT_MISSING
          Defines that this object is associated to the failure "missing-suboperations", what means that all performed operations are correct, but there are missing some suboperations to complete the actual operation
static int UNKNOWN
          Defines an unknown correctness
 
Constructor Summary
FeedbackObject()
          Create a FeedbackObject
 
Method Summary
 java.lang.Object clone()
           
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String genMessage(java.lang.String img1, java.lang.String txt1, java.lang.String img2, java.lang.String txt2)
          Generates a 2x2 table-HTML-Message from the given parameters
 int getCorrectness()
          Gets the correctness
 SubOperation getCorrectSubOperation()
          Gets the correct suboperation the feedback belongs to
 java.util.Vector getMessages()
          Gets the messages
 java.lang.String getNextMessage()
          Gets the next message.
 Operation getOperation()
          Gets the operation the feedback belongs to
 int getOpNr()
          Gets the Operation-Number
 java.lang.String getPrevMessage()
          Gets the previous message.
 SubOperation getSubOperation()
           
 int getSubOpNr()
          Gets the SubOperation-Number
 void load(java.util.HashMap hm)
          Loads this FeedbackObject with the parameters defined in the deliverd HashMap-representation
 java.util.HashMap save()
          Converts this FeedbackObject in a HashMap-representation for saving-purposes.
 void setCorrectness(int c)
          Sets the correctness
 void setCorrectSubOperation(SubOperation subop)
          Sets the correct suboperation the feedback belongs to
 void setLocationShow(boolean b)
          Sets that when getNextMessage or getPrevMessage is called, that the returned HTML-message contains information about the position of the failure.
 void setMessagePosition(int p)
          Sets the current message-position inside the messages that are associated to this FeedbackObject
 void setMessages(java.util.Vector m)
          Sets the messages
 void setOperation(Operation op)
          Sets the operation the feedback belongs to
 void setOpNr(int n)
          Sets the Operation-Number inside the exercise
 void setSubOperation(SubOperation subop)
           
 void setSubOpNr(int n)
          Sets the SubOperation-Number inside the operation, the suboperation belongs to
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
Defines an unknown correctness

See Also:
Constant Field Values

CORRECT

public static final int CORRECT
Defines that the operation is correct

See Also:
Constant Field Values

INCORRECT

public static final int INCORRECT
Defines that the operation is incorrect

See Also:
Constant Field Values

INCORRECT_MISSING

public static final int INCORRECT_MISSING
Defines that this object is associated to the failure "missing-suboperations", what means that all performed operations are correct, but there are missing some suboperations to complete the actual operation

See Also:
Constant Field Values
Constructor Detail

FeedbackObject

public FeedbackObject()
Create a FeedbackObject

Method Detail

setMessages

public void setMessages(java.util.Vector m)
Sets the messages

Parameters:
m - Vector of messages

getMessages

public java.util.Vector getMessages()
Gets the messages

Returns:
Vector of messages

setOperation

public void setOperation(Operation op)
Sets the operation the feedback belongs to

Parameters:
op - Operation

getOperation

public Operation getOperation()
Gets the operation the feedback belongs to

Returns:
Operation

setSubOperation

public void setSubOperation(SubOperation subop)

getSubOperation

public SubOperation getSubOperation()

setCorrectSubOperation

public void setCorrectSubOperation(SubOperation subop)
Sets the correct suboperation the feedback belongs to

Parameters:
subop - SubOperation

getCorrectSubOperation

public SubOperation getCorrectSubOperation()
Gets the correct suboperation the feedback belongs to

Returns:
SubOperation

setOpNr

public void setOpNr(int n)
Sets the Operation-Number inside the exercise

Parameters:
n - Operation-Number

getOpNr

public int getOpNr()
Gets the Operation-Number

Returns:
Operation-Number

setSubOpNr

public void setSubOpNr(int n)
Sets the SubOperation-Number inside the operation, the suboperation belongs to

Parameters:
n - SubOperation-Number

getSubOpNr

public int getSubOpNr()
Gets the SubOperation-Number

Returns:
SubOperation-Number

setCorrectness

public void setCorrectness(int c)
Sets the correctness

Parameters:
c - correctness-ID
See Also:
UNKNOWN, CORRECT, INCORRECT, INCORRECT_MISSING

getCorrectness

public int getCorrectness()
Gets the correctness

Returns:
correctness-ID
See Also:
setCorrectness(int)

setMessagePosition

public void setMessagePosition(int p)
Sets the current message-position inside the messages that are associated to this FeedbackObject

Parameters:
p - message-position

getNextMessage

public java.lang.String getNextMessage()
Gets the next message. Internally there is a counter which is increased to every call to this method

Returns:
HTML-Message

getPrevMessage

public java.lang.String getPrevMessage()
Gets the previous message. Internally there is a counter which is decreased to every call to this method

Returns:
HTML-Message

setLocationShow

public void setLocationShow(boolean b)
Sets that when getNextMessage or getPrevMessage is called, that the returned HTML-message contains information about the position of the failure. E.g.: Location: INSERT 7 / updatemin

Parameters:
b - true for displaying the location, false otherwise

genMessage

public java.lang.String genMessage(java.lang.String img1,
                                   java.lang.String txt1,
                                   java.lang.String img2,
                                   java.lang.String txt2)
Generates a 2x2 table-HTML-Message from the given parameters

Parameters:
img1 - The image that should be displayed in the upper-left-cell of the message
txt1 - The HTML-text that should be displayed in the upper-right-cell of the message
img2 - The image that should be displayed in the lower-left-cell of the message
txt2 - The HTML-text that should be displayed in the upper-right-cell of the message
Returns:
A HTML-Message

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

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

save

public java.util.HashMap save()
Converts this FeedbackObject in a HashMap-representation for saving-purposes.

Returns:
HashMap-representation

load

public void load(java.util.HashMap hm)
Loads this FeedbackObject with the parameters defined in the deliverd HashMap-representation

Parameters:
hm - HashMap-representation