Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mauda
Class Exercise

    java.lang.Object
      mauda.SimpleExercise
          mauda.Exercise

Direct Known Subclasses:
  EvalExercise, FeedbackExercise, GenExercise, PlayerExercise

    public class Exercise

extends SimpleExercise

A central class to hold all relevant exercise-specific values and references to important other classes. Extends SimpleExercise with GUI-specific needs.

Author:
  Markus Krebs

Field Summary
`static int` | `BOTHOPERATION` Show both operations and suboperations in the interactive-menu
`static jedas.CompPanel` | `compPanel`
`static jedas.ControlPanel` | `controlPanel`
`static java.awt.event.MouseListener` | `interactive`
`JedasPanel` | `jedasPanel`
`static int` | `NOPOPUP` Allow no user-inputs in the interactive-menu
`static int` | `OPERATION` Show only operations in the interactive-menu
`java.util.Vector` | `opsToAnimate`
`static boolean` | `quickAnim`
`static jedas.Scheduler` | `scheduler`
`static int` | `SUBOPERATION` Show only suboperations in the interactive-menu

Fields inherited from class mauda.SimpleExercise
`availableOperations, availableSubOperations, operationExecuter`

Constructor Summary
`Exercise(java.lang.String type)` Creates a new exercise

Method Summary
`boolean` | `actionsAllowed()` Returns the actions-allowed state
`java.util.Vector` | `addFullLoadedMessage(java.util.Vector v)`
`void` | `animate()` Starts the jedas-animation.
`void` | `back()` Performs a step back.
`void` | `commit(OperationQueue oq)` Adds several operations (from OperationQueue) to the animation-operations that the JedasPanel should execute
`void` | `commit(SimpleOperation so)` Adds an operation to the animation-queue
`void` | `commit(java.lang.String operation, java.lang.String alert)` Generates a failure-message in respect to the operation, that should executed.
`void` | `commit(java.util.Vector v)` Adds several operations/exercise-update-events to the animation-operations that the JedasPanel should execute
`void` | `commitInteractive(SimpleOperation so)` Adds an operation to the animation-queue.
`void` | `forward()` Performs a step forward.
`int` | `getInteractiveMode()` Gets the current editing-mode
`UndoRedo` | `getUndoRedo()` Gets the undo/redo-handler
`boolean` | `isModified()` Returns the modification-state of the exericse
`java.lang.String` | `isReadyToSave()` Checking for correct exercises.
`void` | `jumpToBeginning()` Jumps to the beginning of the exercise.
`void` | `jumpToEnd()`
`java.util.HashMap` | `load(java.lang.String filename)` Loads an exercise
`void` | `redo()` Performs a redo.
`void` | `reset()` Prepares the exercise-object for loading a new exercise, or to generate a new exercise.
`java.util.HashMap` | `save(java.lang.String filename)` Saves an exercise.
`void` | `setActionsAllowed(boolean b)` Turns actions for buttons/menus on or off
`void` | `setDifficulty(int difficulty)` Sets the difficulty
`void` | `setInteractiveMode(int mode)` Mode for editing on exercise
`void` | `setMode(int mode)` Sets the mode of the exercise, e.g.
`void` | `setModified(boolean m)` Sets the modification-state of the exercise
`static void` | `setQuickAnim(boolean b)` Sets the quick-animation-mode for the jedas-panel
`void` | `stopPlaying()` This methods stops the jedas-animation immediatly after the operation that is currently executed.
`void` | `switchTo(java.lang.String plugInName)` Switches between available PlugIns.
`void` | `undo()` Performs an undo.

Methods inherited from class mauda.SimpleExercise
`addExerciseUpdateListener, addExerciseUpdateListenerFirst, getAvailableOperations, getAvailableSubOperations, getDataDirectory, getDefaultFilename, getDifficulty, getDSObject, getFilename, getMetaData, getMode, getOperationExecuter, getOperationRecorder, getPlugInHandler, init, load, loadConfig, operationExecuted, removeExerciseUpdateListener, sendExerciseUpdateMessages, setAvailableOperations, setAvailableSubOperations, setDataDirectory, setDefaultFilename, setDSObject, setFilename, setMetaData, setOperationExecuter, setPlugInHandler, updateMetaDataInitTodoRating`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### jedasPanel

    public JedasPanel jedasPanel

### scheduler

    public static jedas.Scheduler scheduler

### controlPanel

    public static jedas.ControlPanel controlPanel

### compPanel

    public static jedas.CompPanel compPanel

### interactive

    public static java.awt.event.MouseListener interactive

### quickAnim

    public static boolean quickAnim

### opsToAnimate

    public java.util.Vector opsToAnimate

### OPERATION

    public static final int OPERATION

  Show only operations in the interactive-menu

  See Also:
    Constant Field Values

### SUBOPERATION

    public static final int SUBOPERATION

  Show only suboperations in the interactive-menu

  See Also:
    Constant Field Values

### BOTHOPERATION

    public static final int BOTHOPERATION

  Show both operations and suboperations in the interactive-menu

  See Also:
    Constant Field Values

### NOPOPUP

    public static final int NOPOPUP

  Allow no user-inputs in the interactive-menu

  See Also:
    Constant Field Values

Constructor Detail

### Exercise

    public Exercise(java.lang.String type)

  Creates a new exercise

  Parameters:
    `type` - the plug-in-type, e.g. FibHeap

Method Detail

### setModified

    public void setModified(boolean m)

  Sets the modification-state of the exercise

  Parameters:
    `m` - true if modified, false otherwise

### isModified

    public boolean isModified()

  Returns the modification-state of the exericse

  Returns:
    true if exercise was modified, false otherwise

### addFullLoadedMessage

    public java.util.Vector addFullLoadedMessage(java.util.Vector v)

### reset

    public void reset()

  Prepares the exercise-object for loading a new exercise, or to generate a new exercise. This method generates also an `ExerciseUpdateEvent` with the id `RESET`, and sends it to its listeners.

### switchTo

    public void switchTo(java.lang.String plugInName)

  Description copied from class: `SimpleExercise`
  Switches between available PlugIns.

  Overrides:
    `switchTo` in class `SimpleExercise`
  Parameters:
    `plugInName` - The name of the PlugIn

### setMode

    public void setMode(int mode)

  Description copied from class: `SimpleExercise`
  Sets the mode of the exercise, e.g. NORMAL or FAULT

  Overrides:
    `setMode` in class `SimpleExercise`
  Parameters:
    `mode` - mode-ID
  See Also:
    `ExerciseMode`

### setQuickAnim

    public static void setQuickAnim(boolean b)

  Sets the quick-animation-mode for the jedas-panel

  Parameters:
    `b` - true turns quick-animation on, false off

### setInteractiveMode

    public void setInteractiveMode(int mode)

  Mode for editing on exercise

  Parameters:
    `mode` - see NOPOPUP OPERATION SUBOPERATION BOTHOPERATION

### getInteractiveMode

    public int getInteractiveMode()

  Gets the current editing-mode

  Returns:
    editing-mode
  See Also:
    `setInteractiveMode(int)`

### setActionsAllowed

    public void setActionsAllowed(boolean b)

  Turns actions for buttons/menus on or off

  Parameters:
    `b` - true to turn on actions, false otherwise

### actionsAllowed

    public boolean actionsAllowed()

  Returns the actions-allowed state

  Returns:
    actions-allowed-state

### getUndoRedo

    public UndoRedo getUndoRedo()

  Gets the undo/redo-handler

  Returns:
    UndoRedo

### setDifficulty

    public void setDifficulty(int difficulty)

  Description copied from class: `SimpleExercise`
  Sets the difficulty

  Overrides:
    `setDifficulty` in class `SimpleExercise`
  Parameters:
    `difficulty` - difficulty-ID
  See Also:
    `Difficulties`

### animate

    public void animate()

  Starts the jedas-animation. This means that the operations in the animation-queue are executed in the JedasPanel.

### back

    public void back()

  Performs a step back. That means that an ExerciseUpdateEvent with the ID BACK will be transmitted to all ExerciseListeners.

### forward

    public void forward()

  Performs a step forward. That means that an ExerciseUpdateEvent with the ID FORWARD will be transmitted to all ExerciseListeners.

### undo

    public void undo()

  Performs an undo. That means that an ExerciseUpdateEvent with the ID UNDO will be transmitted to all ExerciseListeners.

### redo

    public void redo()

  Performs a redo. That means that an ExerciseUpdateEvent with the ID REDO will be transmitted to all ExerciseListeners.

### jumpToBeginning

    public void jumpToBeginning()

  Jumps to the beginning of the exercise.

### jumpToEnd

    public void jumpToEnd()

### commit

    public void commit(SimpleOperation so)

  Adds an operation to the animation-queue

  Parameters:
    `so` - SimpleOperation

### commitInteractive

    public void commitInteractive(SimpleOperation so)

  Adds an operation to the animation-queue. This method should be called by the interactive-class (e.g. FibHeapInteractive) to distinguish between interactive-events and execution of e.g. operations while loading.

  Parameters:
    `so` - SimpleOperation

### commit

    public void commit(java.util.Vector v)

  Adds several operations/exercise-update-events to the animation-operations that the JedasPanel should execute

  Parameters:
    `v` - Vector of operations and/or ExerciseUpdateEvents

### commit

    public void commit(OperationQueue oq)

  Adds several operations (from OperationQueue) to the animation-operations that the JedasPanel should execute

  Parameters:
    `oq` - OperationQueue

### stopPlaying

    public void stopPlaying()

  This methods stops the jedas-animation immediatly after the operation that is currently executed.

### commit

    public void commit(java.lang.String operation,
                       java.lang.String alert)

  Generates a failure-message in respect to the operation, that should executed. This method should be called by the interactive-class (e.g. FibHeapInteractive) in the case, that a selected operation cannot be executed. Example: FibHeap: link only on root-nodes allowed, and the data-structure of FibHeap not supports link on non-root-nodes.

  Parameters:
    `operation` - The ID of the selected operation
    `alert` - A description, why this operation cannot be executed.

### load

    public java.util.HashMap load(java.lang.String filename)

  Description copied from class: `SimpleExercise`
  Loads an exercise

  Overrides:
    `load` in class `SimpleExercise`
  Parameters:
    `filename` - Filename
  Returns:
    HashMap-representation of the exercise

### save

    public java.util.HashMap save(java.lang.String filename)

  Description copied from class: `SimpleExercise`
  Saves an exercise. If the filename is null, the exercise won't be saved to disc, but returned as an HashMap.

  Overrides:
    `save` in class `SimpleExercise`
  Parameters:
    `filename` - Filename
  Returns:
    HashMap-representation of the exercise

### isReadyToSave

    public java.lang.String isReadyToSave()

  Checking for correct exercises. E.g.: if a FaultMode exercise contains an error.

  Returns:
    "OK" if the exercise is ready for saving, otherwise a string representing why it is incorrect

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD