mapss.dif.mdsdf
Class MDSDFEdgeWeight

java.lang.Object
  extended by mapss.dif.DIFEdgeWeight
      extended by mapss.dif.mdsdf.MDSDFEdgeWeight
All Implemented Interfaces:
java.lang.Cloneable

public class MDSDFEdgeWeight
extends DIFEdgeWeight

Information associated with an MDSDF edge. MDSDFEdgeWeights are objects associated with Edges that represent MDSDF edges in MDSDFGraphs. This class caches frequently-used data associated with MDSDF edges.

The type of production rate, consumption rate, and delay is in int[], and can support one- to multi-dimensional representation. The dimensionality of an edge is the maximum dimensionality of production rate and consumption rate. A zero delay is {0}.

Version:
$Id: MDSDFEdgeWeight.java 1687 2007-05-08 01:38:09Z jerryhsu $
Author:
Chia-Jui Hsu

Constructor Summary
MDSDFEdgeWeight()
          Construct an edge weight for a homogeneous, zero-delay, one-dimensional edge.
MDSDFEdgeWeight(int[] productionRate, int[] consumptionRate, int[] delay)
          Construct an edge weight for a specified token production rate, token consumption rate, and delay.
MDSDFEdgeWeight(java.lang.Object sourcePort, java.lang.Object sinkPort, int[] productionRate, int[] consumptionRate, int[] delay)
          Construct an edge weight for a specified source port, sink port, token production rate, token consumption rate, and delay.
 
Method Summary
 int getDimensionality()
          Calculate the dimensionality of a MDSDF edge, i.e., the maximum dimensionality of production and consumption rates.
 int[] getMDSDFConsumptionRate()
          Get the MDSDF consumption rate.
 int getMDSDFConsumptionRate(int dimension)
          Get the consumption rate at dimension dimension.
 int[] getMDSDFDelay()
          Get the MDSDF delay.
 int getMDSDFDelay(int dimension)
          Get the delay value at dimension dimension.
 int[] getMDSDFProductionRate()
          Get the MDSDF production rate.
 int getMDSDFProductionRate(int dimension)
          Get the production rate at dimension dimension.
 int[] getMinIndexSpaceSize()
          Get the minimum index space size of this edge in int[].
 void setConsumptionRate(java.lang.Object consumptionRate)
          Override DIFEdgeWeight.setConsumptionRate(Object) to check the type of consumptionRates, and call #setMDSDFConsumptionRates(int[]) to set the MDSDF consumption rates.
 void setDelay(java.lang.Object delay)
          Override DIFEdgeWeight.setDelay(Object) to check the type of delay, and call setMDSDFDelay(int[]) to set the MDSDF delay.
 void setMDSDFConsumptionRate(int[] consumptionRate)
          Set the MDSDF consumption rate.
 void setMDSDFConsumptionRate(int dimension, int consumptionRate)
          Set the consumption rate at dimension dimension.
 void setMDSDFDelay(int[] delay)
          Set the delay of the associated MDSDF edge.
 void setMDSDFProductionRate(int[] productionRate)
          Set the MDSDF production rate.
 void setMDSDFProductionRate(int dimension, int productionRate)
          Set the production rate at dimension dimension.
 void setProductionRate(java.lang.Object productionRate)
          Override DIFEdgeWeight.setProductionRate(Object) to check the type of productionRate, and call setMDSDFProductionRate(int[]) to set the MDSDF production rate.
 java.lang.String toString()
          Return a string representation of the edge weight.
 
Methods inherited from class mapss.dif.DIFEdgeWeight
_getConsumptionRate, _getDelay, _getProductionRate, _setConsumptionRate, _setDelay, _setProductionRate, clone, getConsumptionRate, getDelay, getProductionRate, getSinkPort, getSourcePort, setSinkPort, setSourcePort
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MDSDFEdgeWeight

public MDSDFEdgeWeight()
Construct an edge weight for a homogeneous, zero-delay, one-dimensional edge. Production and consumption values are set to [1].


MDSDFEdgeWeight

public MDSDFEdgeWeight(int[] productionRate,
                       int[] consumptionRate,
                       int[] delay)
Construct an edge weight for a specified token production rate, token consumption rate, and delay.

Parameters:
productionRate - The int[] production rate.
consumptionRate - The int[] consumption rate.
delay - The delay.

MDSDFEdgeWeight

public MDSDFEdgeWeight(java.lang.Object sourcePort,
                       java.lang.Object sinkPort,
                       int[] productionRate,
                       int[] consumptionRate,
                       int[] delay)
Construct an edge weight for a specified source port, sink port, token production rate, token consumption rate, and delay. The source port and sink port are ports that correspond to this edge.

Parameters:
sourcePort - The source port.
sinkPort - The sink port.
productionRate - The int[] production rate.
consumptionRate - The int[] consumption rate.
delay - The delay.
Method Detail

getDimensionality

public int getDimensionality()
Calculate the dimensionality of a MDSDF edge, i.e., the maximum dimensionality of production and consumption rates.

Returns:
The dimensionality of a MDSDF edge.

getMDSDFConsumptionRate

public int[] getMDSDFConsumptionRate()
Get the MDSDF consumption rate.

Returns:
The MDSDF consumption rate in int[].

getMDSDFConsumptionRate

public int getMDSDFConsumptionRate(int dimension)
Get the consumption rate at dimension dimension.

Parameters:
dimension - The dimension.
Returns:
The consumption rate at dimension dimension.

getMDSDFProductionRate

public int[] getMDSDFProductionRate()
Get the MDSDF production rate.

Returns:
The MDSDF production rate in int[].

getMDSDFProductionRate

public int getMDSDFProductionRate(int dimension)
Get the production rate at dimension dimension.

Parameters:
dimension - The dimension.
Returns:
The production rate at dimension dimension..

getMDSDFDelay

public int[] getMDSDFDelay()
Get the MDSDF delay.

Returns:
The delay in int[].

getMDSDFDelay

public int getMDSDFDelay(int dimension)
Get the delay value at dimension dimension.

Parameters:
dimension - The dimension.
Returns:
The delay at dimension dimension.

getMinIndexSpaceSize

public int[] getMinIndexSpaceSize()
Get the minimum index space size of this edge in int[]. The minimum index space size is regardless of multi-dimensional repetition vectors. The minimum index space size of en edge e is computed as prd(e,i) * cns(e,i) / gcd ( prd(e,i), cns(e,i) ), where i is the dimension.

Returns:
The minimum index space size of this edge in int[].

setConsumptionRate

public void setConsumptionRate(java.lang.Object consumptionRate)
Override DIFEdgeWeight.setConsumptionRate(Object) to check the type of consumptionRates, and call #setMDSDFConsumptionRates(int[]) to set the MDSDF consumption rates.

Overrides:
setConsumptionRate in class DIFEdgeWeight
Parameters:
consumptionRate - The consumption rate in int[].
Throws:
mocgraph.GraphWeightException - If consumptionRates is not instanceof int[].

setDelay

public void setDelay(java.lang.Object delay)
Override DIFEdgeWeight.setDelay(Object) to check the type of delay, and call setMDSDFDelay(int[]) to set the MDSDF delay.

Overrides:
setDelay in class DIFEdgeWeight
Parameters:
delay - The delay in int[].
Throws:
mocgraph.GraphWeightException - If delay is not instanceof int[].

setMDSDFConsumptionRate

public void setMDSDFConsumptionRate(int[] consumptionRate)
Set the MDSDF consumption rate.

Parameters:
consumptionRate - The MDSDF consumption rate in int[].
Throws:
mocgraph.GraphWeightException - If consumption rate in any dimension is not positive.

setMDSDFConsumptionRate

public void setMDSDFConsumptionRate(int dimension,
                                    int consumptionRate)
Set the consumption rate at dimension dimension.

Parameters:
dimension - The dimension.
consumptionRate - The new consumption rate.
Throws:
mocgraph.GraphWeightException - If consumptionRate is not positive.

setMDSDFProductionRate

public void setMDSDFProductionRate(int[] productionRate)
Set the MDSDF production rate.

Parameters:
productionRate - The MDSDF production rate in int[].
Throws:
mocgraph.GraphWeightException - If production rate in any dimension is not positive.

setMDSDFProductionRate

public void setMDSDFProductionRate(int dimension,
                                   int productionRate)
Set the production rate at dimension dimension.

Parameters:
dimension - The dimension.
productionRate - The new token production rate.
Throws:
mocgraph.GraphWeightException - If productionRate is not positive.

setMDSDFDelay

public void setMDSDFDelay(int[] delay)
Set the delay of the associated MDSDF edge.

Parameters:
delay - The MDSDF delay in int[].
Throws:
mocgraph.GraphWeightException - If delay in any dimension is negative.

setProductionRate

public void setProductionRate(java.lang.Object productionRate)
Override DIFEdgeWeight.setProductionRate(Object) to check the type of productionRate, and call setMDSDFProductionRate(int[]) to set the MDSDF production rate.

Overrides:
setProductionRate in class DIFEdgeWeight
Parameters:
productionRate - The MDSDF production rate in int[].
Throws:
mocgraph.GraphWeightException - If productionRate is not instanceof int[].

toString

public java.lang.String toString()
Return a string representation of the edge weight. This string representation is in the following form:

[productionRate1 productionRate2 ...] [consumptionRate1 consumptionRate2 ...] delay

Overrides:
toString in class DIFEdgeWeight
Returns:
the string representation of the edge weight.