mauda.operation
Class Operation

java.lang.Object
  extended by mauda.operation.SimpleOperation
      extended by mauda.operation.Operation
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class Operation
extends SimpleOperation
implements java.lang.Comparable

Storage of a base operation (e.g. FibHeap -> decrease-key) with at most 2 parameters.

Author:
Markus Krebs

Field Summary
static int SORT_BY_NAME
          Identify that a sorting-algorithm should compare operations by its IDs
static int SORT_BY_RATING
          Identify that a sorting-algorithm should compare operations by its ratings.
 
Fields inherited from class mauda.operation.SimpleOperation
NULL
 
Constructor Summary
Operation()
          Creates a Operation
Operation(java.lang.String id)
          Creates a operation from the delivered ID
Operation(java.lang.String id, int param1, int param2, int rating)
          Creates a operation from the delivered parameters
 
Method Summary
 void add(SubOperation so)
          Adds a SubOperation to the SubOperationQueue
 java.lang.Object clone()
           
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 void execute(java.lang.Object o)
          Executes an operation on the data-structure.
 int getRating()
          Gets the rating
 SubOperationQueue getSubOperationQueue()
           
 boolean isExecuted()
          Gets the execute-state
 void load(java.lang.String opString)
          Loads this operation from a string-representation
 java.lang.String out()
          Creates a string-representation of this operation, that can be used in GUIs.
 java.lang.String save()
          Creates a string-representation of this operation for saving- purposes.
 void setEffect(int effect)
          Sets an effect of an operation, if one exists.
 void setExecution(boolean execute)
          Sets if the operation should completely executed on the data-structure.
 void setRating(int r)
          Sets the rating
static void setSort(int mode)
          Sets the sorting-mode
 void setSubOperationQueue(SubOperationQueue so)
          Sets the SubOperations that have to performed to execute this operation
 java.lang.String toString()
           
 
Methods inherited from class mauda.operation.SimpleOperation
compare, getID, getParameter1, getParameter2
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SORT_BY_RATING

public static final int SORT_BY_RATING
Identify that a sorting-algorithm should compare operations by its ratings.

See Also:
compareTo(Object), Constant Field Values

SORT_BY_NAME

public static final int SORT_BY_NAME
Identify that a sorting-algorithm should compare operations by its IDs

See Also:
compareTo(Object), Constant Field Values
Constructor Detail

Operation

public Operation()
Creates a Operation


Operation

public Operation(java.lang.String id)
Creates a operation from the delivered ID

Parameters:
id - operation-ID

Operation

public Operation(java.lang.String id,
                 int param1,
                 int param2,
                 int rating)
Creates a operation from the delivered parameters

Parameters:
id - operation-ID
param1 - 1st Parameter
param2 - 2nd Parameter
rating - Rating of the operation
Method Detail

setExecution

public void setExecution(boolean execute)
Sets if the operation should completely executed on the data-structure. If not, the data-structure stays unchanged, but in the SubOperationQueue of this operation there are now the correct suboperations to perform this operation.

Parameters:
execute -

isExecuted

public boolean isExecuted()
Gets the execute-state

Returns:
true if operation executed, false otherwise
See Also:
setExecution(boolean)

setEffect

public void setEffect(int effect)
Sets an effect of an operation, if one exists. E.g. for delete-min there is entered whats the minimum is, because that information is not stored in the parameters.

Parameters:
effect -

setSort

public static void setSort(int mode)
Sets the sorting-mode

Parameters:
mode - sorting-mode
See Also:
SORT_BY_RATING, SORT_BY_NAME

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getRating

public int getRating()
Gets the rating

Returns:
rating

setRating

public void setRating(int r)
Sets the rating

Parameters:
r - rating

getSubOperationQueue

public SubOperationQueue getSubOperationQueue()

setSubOperationQueue

public void setSubOperationQueue(SubOperationQueue so)
Sets the SubOperations that have to performed to execute this operation

Parameters:
so - suboperations

add

public void add(SubOperation so)
Adds a SubOperation to the SubOperationQueue

Parameters:
so - SubOperation

equals

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

execute

public void execute(java.lang.Object o)
Description copied from class: SimpleOperation
Executes an operation on the data-structure.

Overrides:
execute in class SimpleOperation
Parameters:
o - data-structure

clone

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

save

public java.lang.String save()
Description copied from class: SimpleOperation
Creates a string-representation of this operation for saving- purposes.

Overrides:
save in class SimpleOperation
Returns:
string-representation

load

public void load(java.lang.String opString)
Description copied from class: SimpleOperation
Loads this operation from a string-representation

Overrides:
load in class SimpleOperation
Parameters:
opString - string-representation

toString

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

out

public java.lang.String out()
Description copied from class: SimpleOperation
Creates a string-representation of this operation, that can be used in GUIs. E.g.: In feedback-messages

Overrides:
out in class SimpleOperation
Returns:
string-representation