|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.domains.sdf.kernel.SDFUtilities
This class factors code out of the SDF domain, for use in different schedulers, so that they can be implemented in a consistent fashion. This interface contains static methods that are often useful from outside of an SDFDirector, and so are provided here in an interface that can be imported.
| Red (neuendor) |
| Red (neuendor) |
| Nested Class Summary | |
static class |
SDFUtilities.NamedObjComparator
A comparator for named objects. |
| Constructor Summary | |
SDFUtilities()
|
|
| Method Summary | |
protected static int |
_getRate(ptolemy.actor.IOPort port)
Return the number of tokens that will be produced or consumed on the given port. |
static int |
_getRateVariableValue(ptolemy.kernel.Port port,
java.lang.String name,
int defaultValue)
Get the integer value stored in the Variable with the specified name. |
protected static void |
_setIfNotDefined(ptolemy.kernel.Port port,
java.lang.String name,
int value)
If a variable with the given name does not exist, then create a variable with the given name and set the value of that variable to the specified value. |
protected static void |
_setOrCreate(ptolemy.kernel.util.NamedObj container,
java.lang.String name,
int value)
If the specified container does not contain a variable with the specified name, then create such a variable and set its value to the specified integer. |
protected static void |
_setOrCreate(ptolemy.kernel.util.NamedObj container,
java.lang.String name,
java.lang.String expression)
If the specified container does not contain a variable with the specified name, then create such a variable and set its expression to the specified string. |
protected static void |
_setRate(ptolemy.kernel.Port port,
java.lang.String name,
int rate)
Set the rate variable with the specified name to the specified value. |
static ptolemy.data.expr.Variable |
getRateVariable(ptolemy.kernel.Port port,
java.lang.String name)
Get the Variable with the specified name in the given port, or with the specified name preceded by an underscore. |
static int |
getTokenConsumptionRate(ptolemy.actor.IOPort port)
Get the number of tokens that are consumed on the given port. |
static int |
getTokenInitProduction(ptolemy.actor.IOPort port)
Get the number of tokens that are produced on the given port during initialization. |
static int |
getTokenProductionRate(ptolemy.actor.IOPort port)
Get the number of tokens that are produced on the given port. |
static void |
setExpressionIfNotDefined(ptolemy.kernel.Port port,
java.lang.String name,
java.lang.String value)
If a variable with the given name does not exist, then create a variable with the given name and set the value of that variable to the specified value. |
static void |
setTokenConsumptionRate(ptolemy.actor.IOPort port,
int rate)
Set the tokenConsumptionRate parameter of the given port to the given rate. |
static void |
setTokenInitProduction(ptolemy.actor.IOPort port,
int rate)
Set the tokenInitProduction parameter of the given port to the given rate. |
static void |
setTokenProductionRate(ptolemy.actor.IOPort port,
int rate)
Set the tokenProductionRate parameter of the given port to the given rate. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SDFUtilities()
| Method Detail |
public static ptolemy.data.expr.Variable getRateVariable(ptolemy.kernel.Port port,
java.lang.String name)
throws ptolemy.kernel.util.IllegalActionException
port - The port.name - The name of the variable.
ptolemy.kernel.util.IllegalActionException
public static int getTokenConsumptionRate(ptolemy.actor.IOPort port)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the tokenConsumptionRate
parameter has an invalid expression.
public static int getTokenInitProduction(ptolemy.actor.IOPort port)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the tokenInitProduction
parameter has an invalid expression.
public static int getTokenProductionRate(ptolemy.actor.IOPort port)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the tokenProductionRate
parameter has an invalid expression.
public static void setTokenConsumptionRate(ptolemy.actor.IOPort port,
int rate)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the rate is negative.
public static void setTokenInitProduction(ptolemy.actor.IOPort port,
int rate)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the rate is negative.
public static void setTokenProductionRate(ptolemy.actor.IOPort port,
int rate)
throws ptolemy.kernel.util.IllegalActionException
ptolemy.kernel.util.IllegalActionException - If the rate is negative.
protected static int _getRate(ptolemy.actor.IOPort port)
throws ptolemy.actor.sched.NotSchedulableException,
ptolemy.kernel.util.IllegalActionException
ptolemy.actor.sched.NotSchedulableException - If the port is both an input and
an output, or is neither an input nor an output.
ptolemy.kernel.util.IllegalActionException - If a rate does not contain a
valid expression.
public static int _getRateVariableValue(ptolemy.kernel.Port port,
java.lang.String name,
int defaultValue)
throws ptolemy.kernel.util.IllegalActionException
port - The port.name - The name of the variable.defaultValue - The default value of the variable.
ptolemy.kernel.util.IllegalActionException
protected static void _setIfNotDefined(ptolemy.kernel.Port port,
java.lang.String name,
int value)
throws ptolemy.kernel.util.IllegalActionException
port - The port.name - Name of the variable.value - The value.
ptolemy.kernel.util.IllegalActionException
public static void setExpressionIfNotDefined(ptolemy.kernel.Port port,
java.lang.String name,
java.lang.String value)
throws ptolemy.kernel.util.IllegalActionException
port - The port.name - Name of the variable.value - The value.
ptolemy.kernel.util.IllegalActionException
protected static void _setOrCreate(ptolemy.kernel.util.NamedObj container,
java.lang.String name,
int value)
throws ptolemy.kernel.util.IllegalActionException
container - The container.name - Name of the variable.value - The value.
If - the variable exists and its value cannot be set.
ptolemy.kernel.util.IllegalActionException
protected static void _setOrCreate(ptolemy.kernel.util.NamedObj container,
java.lang.String name,
java.lang.String expression)
throws ptolemy.kernel.util.IllegalActionException
container - The container.name - Name of the variable.expression - The expression.
If - the variable exists and its value cannot be set.
ptolemy.kernel.util.IllegalActionException
protected static void _setRate(ptolemy.kernel.Port port,
java.lang.String name,
int rate)
throws ptolemy.kernel.util.IllegalActionException
port - The port.name - The variable name.rate - The rate value.
ptolemy.kernel.util.IllegalActionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||