mauda
Class Failure

java.lang.Object
  extended by mauda.Failure

public class Failure
extends java.lang.Object

Storage-class for failures, with important internal attributes.

Author:
Markus Krebs

Field Summary
static int ADDITIONAL_FALSE_SUBOP
          All suboperation are correct for a specific operation, but there additional false suboperations, which are unnecessary for that operation.
static int DIFFERENT
          Correct and incorrect suboperations differ from each other
static int MISSING_SUBOP
          All suboperation are correct for a specific operation, but there are missing some suboperations.
static int NO_DESCRIPTION
          No failure description associated to this failure
 
Constructor Summary
Failure()
          Creates a new Failure-Object
 
Method Summary
 void addDifferentOperation(SimpleOperation so)
          If the current failure is of type MISSING_SUBOP or ADDITION_FALSE this methods add one suboperation to the failure-suboperations.
 boolean containsOffset(int p)
          Tests if a given offset lies inside this failure
 int getDescription()
          Gets the description-ID
 java.lang.String getDescriptionString()
          Gets a string-representation of the failure
 int getMaxOffset()
          Gets the maximum offset
 int getOffset()
          Gets the offset.
 int getOpNr()
          Gets the Operation-Number
 int getSubOpNr()
          Gets the SubOperation-Number
 void setCorrectOp(SimpleOperation so)
          Sets the correct operation for the position where failure occured.
 void setCurrentOp(SimpleOperation so)
          Sets the current operation, the user executed.
 void setDescription(int d)
          Sets the description-ID of the Failure.
 void setMaxOffset(int p)
          A failure have a specific range, and the maximal offset of the OperationRecorder that this failure belongs to, is set here.
 void setOffset(int p)
          Sets the offset inside the OperationRecorder the failure belongs to.
 void setOpNr(int n)
          Operations like e.g.
 void setSubOpNr(int n)
          SubOperations like e.g.
 void setSuperOp(Operation op)
          Sets the operation the failure coressponds to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_DESCRIPTION

public static final int NO_DESCRIPTION
No failure description associated to this failure

See Also:
Constant Field Values

DIFFERENT

public static final int DIFFERENT
Correct and incorrect suboperations differ from each other

See Also:
Constant Field Values

MISSING_SUBOP

public static final int MISSING_SUBOP
All suboperation are correct for a specific operation, but there are missing some suboperations.

See Also:
Constant Field Values

ADDITIONAL_FALSE_SUBOP

public static final int ADDITIONAL_FALSE_SUBOP
All suboperation are correct for a specific operation, but there additional false suboperations, which are unnecessary for that operation.

See Also:
Constant Field Values
Constructor Detail

Failure

public Failure()
Creates a new Failure-Object

Method Detail

setSuperOp

public void setSuperOp(Operation op)
Sets the operation the failure coressponds to.

Parameters:
op - Operation

setCorrectOp

public void setCorrectOp(SimpleOperation so)
Sets the correct operation for the position where failure occured.

Parameters:
so -

setCurrentOp

public void setCurrentOp(SimpleOperation so)
Sets the current operation, the user executed.

Parameters:
so -

setOffset

public void setOffset(int p)
Sets the offset inside the OperationRecorder the failure belongs to.

Parameters:
p - OperationRecorder-Offset

getOffset

public int getOffset()
Gets the offset.

Returns:
OperationRecorder-Offset
See Also:
setOffset(int)

setMaxOffset

public void setMaxOffset(int p)
A failure have a specific range, and the maximal offset of the OperationRecorder that this failure belongs to, is set here.

Parameters:
p - OperationRecorder-Offset

getMaxOffset

public int getMaxOffset()
Gets the maximum offset

Returns:
OperationRecorder-Offset
See Also:
setMaxOffset(int)

setOpNr

public void setOpNr(int n)
Operations like e.g. FibHeap: INSERT, are counted from the beginning of the exercise. So this method sets the number of the operation, the failure belongs to.

Parameters:
n - Operation-Number

getOpNr

public int getOpNr()
Gets the Operation-Number

Returns:
Operation-Number

setSubOpNr

public void setSubOpNr(int n)
SubOperations like e.g. FibHeap: updatemin, are counted inside the corresponding operation (like INSERT). So this method sets the number of the suboperation inside the operation this failure belongs to, namely to the first incorrect suboperation inside operation.

Parameters:
n - SubOperation-Number

getSubOpNr

public int getSubOpNr()
Gets the SubOperation-Number

Returns:
SubOperation-Number

setDescription

public void setDescription(int d)
Sets the description-ID of the Failure.

Parameters:
d - Values: NO_DESCRIPTION, ADDITIONAL_FALSE, DIFFERENT, MISSING_SUBOP

getDescription

public int getDescription()
Gets the description-ID

Returns:
Description-ID
See Also:
setDescription(int)

addDifferentOperation

public void addDifferentOperation(SimpleOperation so)
If the current failure is of type MISSING_SUBOP or ADDITION_FALSE this methods add one suboperation to the failure-suboperations.

Parameters:
so - SimpleOperation

getDescriptionString

public java.lang.String getDescriptionString()
Gets a string-representation of the failure

Returns:
string-representation of the failure

containsOffset

public boolean containsOffset(int p)
Tests if a given offset lies inside this failure

Parameters:
p - The offset to test
Returns:
true if the given offset involved in this failure, false otherwise