ptolemy.moml.unit
Class Bindings

java.lang.Object
  extended by ptolemy.moml.unit.Bindings

public class Bindings
extends java.lang.Object

Represents a set of bindings. Each binding is a (variable, Unit) pair where variable is a String. If the value of Unit is null, then the binding for the variable exists but its value is null. Since null is an allowable value the Hashtable class is not adequate.

Since:
Ptolemy II 8.0
Version:
$Id: Bindings.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Rowland R Johnson
Accepted Rating:
Red (rowland)
Proposed Rating:
Red (rowland)

Field Summary
(package private)  java.util.LinkedHashSet _keys
           
(package private)  java.util.Hashtable _VarLabel2Unit
           
 
Constructor Summary
Bindings()
          Construct Bindings with no members.
Bindings(java.util.Vector nodes)
          Create bindings for a set of nodes in a CompositeEntity.
 
Method Summary
 boolean bindingExists(java.lang.String vLabel)
          Return true if the binding exists.
 Unit get(java.lang.String vLabel)
          Get the value for a variable.
 java.lang.String humanReadableForm()
          A human readable form (more or less) of the bindings.
 void put(java.lang.String varLabel, Unit U)
          Create a binding for a variable and Unit.
 java.lang.String[] variableLabels()
          Create an array of Strings that contains all of the variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_VarLabel2Unit

java.util.Hashtable _VarLabel2Unit

_keys

java.util.LinkedHashSet _keys
Constructor Detail

Bindings

public Bindings()
Construct Bindings with no members.


Bindings

public Bindings(java.util.Vector nodes)
Create bindings for a set of nodes in a CompositeEntity. The set of nodes can be a subset of the nodes in the CompositeEntity. Each port on each node yields a binding.

Parameters:
nodes - The set of nodes(ComponentEntities).
Method Detail

bindingExists

public boolean bindingExists(java.lang.String vLabel)
Return true if the binding exists.

Parameters:
vLabel - A String that represents the variable.
Returns:
True if there exists a binding for the variable.

get

public Unit get(java.lang.String vLabel)
Get the value for a variable.

Parameters:
vLabel - A String that represents the variable.
Returns:
The value for the variable.

humanReadableForm

public java.lang.String humanReadableForm()
A human readable form (more or less) of the bindings.


put

public void put(java.lang.String varLabel,
                Unit U)
Create a binding for a variable and Unit. If a binding already exists for the variable, then update the Unit

Parameters:
varLabel - A String that represents the variable.
U - The Unit.

variableLabels

public java.lang.String[] variableLabels()
Create an array of Strings that contains all of the variables.

Returns:
An array of Strings containing the variables.