public class Costs extends Object implements Comparable<Costs>, Cloneable
Costs are composed of two parts of cost contributors:
The quantifiable costs may frequently be unknown, which is represented by a -1
as a
value for the unknown components of the cost. In that case, all operations' costs are unknown and
hence it is not decidable which operation to favor during pruning. In that case, the heuristic
costs should contain a value to make sure that operators with different strategies are
comparable, even in the absence of estimates. The heuristic costs are hence the system's
mechanism of realizing pruning heuristics that favor some operations over others.
Modifier and Type | Field and Description |
---|---|
static double |
UNKNOWN |
Constructor and Description |
---|
Costs()
Default constructor.
|
Costs(double networkCost,
double diskCost)
Creates a new costs object using the given values for the network and storage cost.
|
Costs(double networkCost,
double diskCost,
double cpuCost)
Creates a new costs object using the given values for the network and storage cost.
|
Modifier and Type | Method and Description |
---|---|
void |
addCosts(Costs other)
Adds the given costs to these costs.
|
void |
addCpuCost(double cost)
Adds the given CPU cost to the current CPU cost for this Costs object.
|
void |
addDiskCost(double bytes)
Adds the costs for disk to the current disk costs for this Costs object.
|
void |
addHeuristicCpuCost(double cost)
Adds the given heuristic CPU cost to the current heuristic CPU cost for this Costs object.
|
void |
addHeuristicDiskCost(double cost)
Adds the heuristic costs for disk to the current heuristic disk costs for this Costs object.
|
void |
addHeuristicNetworkCost(double cost)
Adds the heuristic costs for network to the current heuristic network costs for this Costs
object.
|
void |
addNetworkCost(double bytes)
Adds the costs for network to the current network costs for this Costs object.
|
Costs |
clone() |
int |
compareTo(Costs o)
The order of comparison is: network first, then disk, then CPU.
|
void |
divideBy(int factor) |
boolean |
equals(Object obj) |
double |
getCpuCost()
Gets the cost for the CPU.
|
double |
getDiskCost()
Gets the costs for disk.
|
double |
getHeuristicCpuCost()
Gets the heuristic cost for the CPU.
|
double |
getHeuristicDiskCost()
Gets the heuristic costs for disk.
|
double |
getHeuristicNetworkCost()
Gets the heuristic network cost.
|
double |
getNetworkCost()
Gets the network cost.
|
int |
hashCode() |
void |
multiplyWith(int factor) |
void |
setCpuCost(double cost)
Sets the cost for the CPU.
|
void |
setDiskCost(double bytes)
Sets the costs for disk for this Costs object.
|
void |
setHeuristicCpuCost(double cost)
Sets the heuristic cost for the CPU.
|
void |
setHeuristicDiskCost(double cost)
Sets the heuristic costs for disk for this Costs object.
|
void |
setHeuristicNetworkCost(double cost)
Sets the heuristic network cost for this Costs object.
|
void |
setNetworkCost(double bytes)
Sets the network cost for this Costs object.
|
void |
subtractCosts(Costs other)
Subtracts the given costs from these costs.
|
String |
toString() |
public static final double UNKNOWN
public Costs()
public Costs(double networkCost, double diskCost)
networkCost
- The network cost, in bytes to be transferred.diskCost
- The cost for disk, in bytes to be written and read.public Costs(double networkCost, double diskCost, double cpuCost)
networkCost
- The network cost, in bytes to be transferred.diskCost
- The cost for disk, in bytes to be written and read.cpuCost
- The cost for CPU operations.public double getNetworkCost()
public void setNetworkCost(double bytes)
bytes
- The network cost to set, in bytes to be transferred.public void addNetworkCost(double bytes)
bytes
- The network cost to add, in bytes to be transferred.public double getDiskCost()
public void setDiskCost(double bytes)
bytes
- The disk cost to set, in bytes to be written and read.public void addDiskCost(double bytes)
bytes
- The disk cost to add, in bytes to be written and read.public double getCpuCost()
public void setCpuCost(double cost)
cost
- The CPU Cost.public void addCpuCost(double cost)
cost
- The CPU cost to add.public double getHeuristicNetworkCost()
public void setHeuristicNetworkCost(double cost)
cost
- The heuristic network cost to set, in bytes to be transferred.public void addHeuristicNetworkCost(double cost)
cost
- The heuristic network cost to add.public double getHeuristicDiskCost()
public void setHeuristicDiskCost(double cost)
cost
- The heuristic disk cost to set.public void addHeuristicDiskCost(double cost)
cost
- The heuristic disk cost to add.public double getHeuristicCpuCost()
public void setHeuristicCpuCost(double cost)
cost
- The heuristic CPU Cost.public void addHeuristicCpuCost(double cost)
cost
- The heuristic CPU cost to add.public void addCosts(Costs other)
other
- The costs to add.public void subtractCosts(Costs other)
other
- The costs to subtract.public void multiplyWith(int factor)
public void divideBy(int factor)
public int compareTo(Costs o)
compareTo
in interface Comparable<Costs>
Comparable.compareTo(java.lang.Object)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.