org.vmguys.vmtools.utils
Class CostOps

java.lang.Object
  |
  +--org.vmguys.vmtools.utils.CostOps

public class CostOps
extends java.lang.Object

Contains a series of operations and a cost.


Constructor Summary
CostOps()
          Constructs a CostOps with zero cost and no operations.
CostOps(AbstractOperation op)
          Constructs a CostOps with the specified operation.
CostOps(int cost)
          Constructs a CostOps with the specified cost and no operations.
CostOps(java.util.List ops)
          Constructs a CotsOps with a list of operations.
 
Method Summary
 void add(AbstractOperation op)
          Adds another operation to the list.
 void add(CostOps other)
          Adds another CostOps to this one.
 void add(int n)
          Adds more cost to the operation.
 CostOps combine(CostOps other)
          Generates a new CostOps object which is the combination of this one and the one specified as a parameter.
 int getCost()
          Getter for property cost.
 java.util.List getOps()
          Getter for property ops.
 void setCost(int cost)
          Setter for property cost.
 void sortOperations()
          Sorts the operation list according to the number of the node the operation is being performed on.
 java.lang.String toString()
          Converts this CostOps to a String for display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CostOps

public CostOps()
Constructs a CostOps with zero cost and no operations.

CostOps

public CostOps(int cost)
Constructs a CostOps with the specified cost and no operations.

CostOps

public CostOps(AbstractOperation op)
Constructs a CostOps with the specified operation. The cost is derived from the operation.

CostOps

public CostOps(java.util.List ops)
Constructs a CotsOps with a list of operations. All the objects in the list must be concrete implementations of AbstractOperation. The cost is derived by summing the costs of the operations.
See Also:
AbstractOperation
Method Detail

add

public void add(CostOps other)
Adds another CostOps to this one. The cost of the other is added to the cost of this, and the operations of the other are appended to the operations of this.

add

public void add(AbstractOperation op)
Adds another operation to the list. The cost of the operation is added to the cost of this.

add

public void add(int n)
Adds more cost to the operation.

combine

public CostOps combine(CostOps other)
Generates a new CostOps object which is the combination of this one and the one specified as a parameter. This is different from add() because it returns a new object as the result.

getCost

public int getCost()
Getter for property cost.
Returns:
Value of property cost.

setCost

public void setCost(int cost)
Setter for property cost.
Parameters:
cost - New value of property cost.

getOps

public java.util.List getOps()
Getter for property ops.
Returns:
Value of property ops.

toString

public java.lang.String toString()
Converts this CostOps to a String for display.
Overrides:
toString in class java.lang.Object

sortOperations

public void sortOperations()
Sorts the operation list according to the number of the node the operation is being performed on.


Copyright © 2001 VM Systems, Inc. All Rights Reserved.