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 OperationRecorder

    java.lang.Object
      mauda.OperationRecorder

All Implemented Interfaces:
  ExerciseUpdateListener

    public class OperationRecorder

extends java.lang.Object
implements ExerciseUpdateListener

Records all executed operations, and provides methods to manipulate them.

Author:
  Markus Krebs

Constructor Summary
`OperationRecorder()` Creates a OperationRecorder

Method Summary
`void` | `add(java.lang.Object obj)` Adds an operation to the recorder.
`void` | `addEntry(java.lang.Object o)` Adds an entry to the end
`void` | `addOperations(java.util.Vector v)` Adds all operations of the Vector to the recorder.
`boolean` | `canUndo()` Check if an undo is possible
`void` | `clear()` Clears all entries
`void` | `decreaseTodoPosition()` Decreases the todo-position, what means that the border between init- and todo-operations moves up.
`void` | `exerciseUpdate(ExerciseUpdateEvent e)` Invoked when an Event occures
`OperationQueue` | `getAllInitOperationQueue()` Gets the init-operations as an `OperationQueue`.
`OperationQueue` | `getAllTodoOperationQueue()` Gets the todo-operations as an `OperationQueue`.
`SubOperation` | `getCorrectSubOperation(int opnr, int subopnr)` Gets the correct subopnr'th suboperation of the opnr'th operation.
`int` | `getCurrentOffset()` Gets the current offset (recorder-internal-value)
`java.lang.Object` | `getCurrentOperation()` Gets the current operation
`int` | `getCurrentOperationNr()` Gets the number of the current operation, counted from 0.
`int` | `getCurrentSubOperationNr()` Gets the number of the current suboperation, counted from 0, inside the current Operation.
`java.lang.Object` | `getEntry(int offset)` Gets the entry at the specified offset
`Failure` | `getFirstFailure()` Gets the first failure in an exercise represented by a failure-object.
`OperationQueue` | `getInitOperationQueue()` Gets the init-operations as an `OperationQueue`.
`java.util.Vector` | `getInitOperations()` Gets the init-operations as an `Vector`.
`Failure` | `getLimitedFailure(int offset)` Gets the first failure that lies beyond the specified offset.
`java.lang.Object` | `getNextOperation()` Gets the operation that follows to the actual operation.
`int` | `getOffset(int opnr, int subopnr)` Gets the overall-offset (internal) of the subopnr'th suboperation inside the opnr'th operation. opnr must be a value started at 0, but subopnr can be value started at -1.
`Operation` | `getOperation(int opnr)` Gets the opnr'th operation.
`int` | `getOperationCount()` Returns the number of operations executed
`int` | `getPossibleTodoPosition(int newTodoPosition)` Creates a possible todo-position from the given todo-position
`SubOperation` | `getSubOperation(int opnr, int subopnr)` Gets the present subopnr'th suboperation of the opnr'th operation.
`OperationQueue` | `getTodoOperationQueue()` Gets the todo-operations as an `OperationQueue`.
`java.util.Vector` | `getTodoOperations()` Gets the todo-operations as an `Vector`.
`int` | `getTodoPosition()` Gets the current todo-position
`Failure` | `getUnlimitedFailure(int offset)` Gets the first failure that lies beyond the specified offset.
`void` | `goInTodoMode()` Switch the OperationRecorder in the todo-state, what means that all following operations are todo-operations for the exercise.
`void` | `increaseTodoPosition()` Increases the todo-position, what means that the border between init- and todo-operations moves down.
`boolean` | `isValidTodoPosition()` Tests if the todo-position is allowed.
`void` | `setTodoPosition(int p)` Sets the border between init- and todo-operations manually.
`java.lang.String` | `toString()`

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

Constructor Detail

### OperationRecorder

    public OperationRecorder()

  Creates a OperationRecorder

Method Detail

### exerciseUpdate

    public void exerciseUpdate(ExerciseUpdateEvent e)

  Description copied from interface: `ExerciseUpdateListener`
  Invoked when an Event occures

  Specified by:
    `exerciseUpdate` in interface `ExerciseUpdateListener`
  Parameters:
    `e` - The event

### add

    public void add(java.lang.Object obj)

  Adds an operation to the recorder. Normally this method is called, when an operation was executed in the `JedasPanel`

  Parameters:
    `obj` - The executed operation

### clear

    public void clear()

  Clears all entries

### getCurrentOperation

    public java.lang.Object getCurrentOperation()

  Gets the current operation

  Returns:
    current operation

### getCurrentOffset

    public int getCurrentOffset()

  Gets the current offset (recorder-internal-value)

  Returns:
    current offset

### getNextOperation

    public java.lang.Object getNextOperation()

  Gets the operation that follows to the actual operation. If there exists no next operation `null` will be returned.

  Returns:
    Following operation

### goInTodoMode

    public void goInTodoMode()

  Switch the OperationRecorder in the todo-state, what means that all following operations are todo-operations for the exercise.

### getPossibleTodoPosition

    public int getPossibleTodoPosition(int newTodoPosition)

  Creates a possible todo-position from the given todo-position

  Parameters:
    `newTodoPosition` - the new todo-position
  Returns:
    a possible todo-position

### decreaseTodoPosition

    public void decreaseTodoPosition()

  Decreases the todo-position, what means that the border between init- and todo-operations moves up. The last init- operation becomes a todo-operation

  See Also:
    `increaseTodoPosition()`

### increaseTodoPosition

    public void increaseTodoPosition()

  Increases the todo-position, what means that the border between init- and todo-operations moves down. The first todo- operation becomes a init-operation

  See Also:
    `decreaseTodoPosition()`

### setTodoPosition

    public void setTodoPosition(int p)

  Sets the border between init- and todo-operations manually. The parameter hereby is the offset, where to place the new todo-position.

  Parameters:
    `p` - new todo-position
  See Also:
    `getTodoPosition()`, `increaseTodoPosition()`, `decreaseTodoPosition()`

### getTodoPosition

    public int getTodoPosition()

  Gets the current todo-position

  Returns:
    todo-position
  See Also:
    `setTodoPosition(int)`, `increaseTodoPosition()`, `decreaseTodoPosition()`

### isValidTodoPosition

    public boolean isValidTodoPosition()

  Tests if the todo-position is allowed. An invalid todo-position might e.g. a position that lies between two suboperations.

  Returns:
    true if valid, false if invalid

### getFirstFailure

    public Failure getFirstFailure()

  Gets the first failure in an exercise represented by a failure-object. Important: The search of failure will be limited to the actual position, what means that when the first failure lies after the current position, no failure (null) will be reported!

  Returns:
    Failure or `null` if no failure

### getUnlimitedFailure

    public Failure getUnlimitedFailure(int offset)

  Gets the first failure that lies beyond the specified offset. The search is not limited to the current position => unlimited. Important: The specified offset must lie on an Operation (not on SubOperation).

  Parameters:
    `offset` - start of the search
  Returns:
    Failure of `null` if no failure

### getLimitedFailure

    public Failure getLimitedFailure(int offset)

  Gets the first failure that lies beyond the specified offset. The search is limited to the current position => limited. Important: The specified offset must lie on an Operation (not on SubOperation).

  Parameters:
    `offset` - start of the search
  Returns:
    Failure of `null` if no failure

### getInitOperationQueue

    public OperationQueue getInitOperationQueue()

  Gets the init-operations as an `OperationQueue`. Important:
  - The return is limited to the current position.
  - The manually performed SubOperations will be delivered as SubOperations of the corresponding Operation

  Returns:
    init-operations
  See Also:
    `getAllInitOperationQueue()`

### getAllInitOperationQueue

    public OperationQueue getAllInitOperationQueue()

  Gets the init-operations as an `OperationQueue`. Important:
  - The return is not limited to the current position, what means all present init-operations will be returned.
  - The manually performed SubOperations will be delivered as SubOperations of the corresponding Operation

  Returns:
    init-operations
  See Also:
    `getInitOperationQueue()`

### getTodoOperationQueue

    public OperationQueue getTodoOperationQueue()

  Gets the todo-operations as an `OperationQueue`. Important:
  - The return is limited to the current position.
  - The manually performed SubOperations will be delivered as SubOperations of the corresponding Operation

  Returns:
    todo-operations
  See Also:
    `getAllTodoOperationQueue()`

### getAllTodoOperationQueue

    public OperationQueue getAllTodoOperationQueue()

  Gets the todo-operations as an `OperationQueue`. Important:
  - The return is not limited to the current position, what means that all present todo-operations will be returned.
  - The manually performed SubOperations will be delivered as SubOperations of the corresponding Operation

  Returns:
    todo-operations
  See Also:
    `getTodoOperationQueue()`

### getInitOperations

    public java.util.Vector getInitOperations()

  Gets the init-operations as an `Vector`. Important:
  - The return is not limited to the current position, what means that all present init-operations will be returned.
  - The manually performed SubOperations will be delivered as extra-entries in the returned vector, and not as SubOperations of the corresponding operation.

  Returns:
    init-operations
  See Also:
    `getInitOperationQueue()`, `getAllInitOperationQueue()`

### getTodoOperations

    public java.util.Vector getTodoOperations()

  Gets the todo-operations as an `Vector`. Important:
  - The return is not limited to the current position, what means that all present todo-operations will be returned.
  - The manually performed SubOperations will be delivered as extra-entries in the returned vector, and not as SubOperations of the corresponding operation.

  Returns:
    todo-operations
  See Also:
    `getTodoOperationQueue()`, `getAllTodoOperationQueue()`

### addOperations

    public void addOperations(java.util.Vector v)

  Adds all operations of the Vector to the recorder.

  Parameters:
    `v` - vector of operations

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### canUndo

    public boolean canUndo()

  Check if an undo is possible

  Returns:
    Returns true, if possible, false, otherwise

### getCurrentOperationNr

    public int getCurrentOperationNr()

  Gets the number of the current operation, counted from 0.

  Returns:
    Operation-Number

### getCurrentSubOperationNr

    public int getCurrentSubOperationNr()

  Gets the number of the current suboperation, counted from 0, inside the current Operation.

  Returns:
    SubOperation-Number

### getEntry

    public java.lang.Object getEntry(int offset)

  Gets the entry at the specified offset

  Parameters:
    `offset` -
  Returns:
    entry at the specified offset

### addEntry

    public void addEntry(java.lang.Object o)

  Adds an entry to the end

  Parameters:
    `o` - The new entry

### getOperationCount

    public int getOperationCount()

  Returns the number of operations executed

  Returns:
    operation-count

### getOffset

    public int getOffset(int opnr,
                         int subopnr)

  Gets the overall-offset (internal) of the subopnr'th suboperation inside the opnr'th operation. opnr must be a value started at 0, but subopnr can be value started at -1. A value of -1 for subopnr indicates that the offset of the template-position of the opnr'th operation will be returned.

  Parameters:
    `opnr` - Operation-Number
    `subopnr` - SubOperation-Number inside Operation-Number
  Returns:
    the offset for the specified position or -1 if that position not exists

### getSubOperation

    public SubOperation getSubOperation(int opnr,
                                        int subopnr)

  Gets the present subopnr'th suboperation of the opnr'th operation.

  Parameters:
    `opnr` - Operation-Number
    `subopnr` - SubOperation-Number
  Returns:
    Present SubOperation at the specified position or null if that position not exists
  See Also:
    `getCorrectSubOperation(int,int)`

### getCorrectSubOperation

    public SubOperation getCorrectSubOperation(int opnr,
                                               int subopnr)

  Gets the correct subopnr'th suboperation of the opnr'th operation. The returned SubOperation may be equal to a call to getSubOperation(opnr,subopnr).

  Parameters:
    `opnr` - Operation-Number
    `subopnr` - SubOperation-Number
  Returns:
    Correct SubOperation at the specified position or null if that position not exists
  See Also:
    `getSubOperation(int,int)`

### getOperation

    public Operation getOperation(int opnr)

  Gets the opnr'th operation.

  Parameters:
    `opnr` - Operation-Number
  Returns:
    Operation at the specified position or null if that position not exists

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