|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.AbstractSettableAttribute
ptolemy.moml.unit.UnitAttribute
public class UnitAttribute
This class is used to implement the Unit Attribute. A UnitsAttribute is either a UnitExpr, or a vector of UnitConstraints.
Red (rowland) |
Red (rowland) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable |
---|
Settable.Visibility |
Field Summary | |
---|---|
private static int |
_CONSTRAINTS
|
private static int |
_EXPRESSION
|
private int |
_type
|
private UnitConstraints |
_unitConstraints
|
private UnitExpr |
_unitExpr
|
private java.util.List |
_valueListeners
|
(package private) Settable.Visibility |
_visibility
|
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.kernel.util.Settable |
---|
EXPERT, FULL, NONE, NOT_EDITABLE |
Constructor Summary | |
---|---|
UnitAttribute()
Construct a UnitsAttribute with no specific name, or container. |
|
UnitAttribute(NamedObj container,
java.lang.String name)
Construct a UnitsAttribute with the specified name, and container. |
Method Summary | |
---|---|
protected void |
_propagateValue(NamedObj destination)
Propagate the value of this object to the specified object. |
void |
addValueListener(ValueListener listener)
Add a listener to be notified when the value of this attribute changes. |
void |
exportMoML(java.io.Writer output,
int depth,
java.lang.String name)
Write a MoML description of the UnitsAttribute. |
java.lang.String |
getExpression()
Get the descriptive form of this attribute. |
UnitConstraints |
getUnitConstraints()
Get the UnitConstraints. |
UnitExpr |
getUnitExpr()
Get the Unit Expression. |
Settable.Visibility |
getVisibility()
Get the visibility of this attribute, as set by setVisibility(). |
void |
removeValueListener(ValueListener listener)
Remove a listener from the list of listeners that is notified when the value of this attribute changes. |
void |
setExpression(java.lang.String expression)
Set the expression. |
void |
setUnitConstraints(UnitConstraints constraints)
Set the UnitConstraints. |
void |
setUnitExpr(UnitExpr expr)
Set the Unit Expression. |
void |
setVisibility(Settable.Visibility visibility)
Set the visibility of this attribute. |
java.util.Collection |
validate()
Check the validity of the expression set in setExpression(). |
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute |
---|
getDefaultExpression, getValueAsString |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.kernel.util.Settable |
---|
getDisplayName |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getFullName, getName, getName, setName |
Field Detail |
---|
Settable.Visibility _visibility
private java.util.List _valueListeners
private UnitExpr _unitExpr
private UnitConstraints _unitConstraints
private int _type
private static final int _EXPRESSION
private static final int _CONSTRAINTS
Constructor Detail |
---|
public UnitAttribute() throws IllegalActionException, NameDuplicationException
IllegalActionException
- If the attribute is not of an
acceptable class for the container, or if the name contains a period.
NameDuplicationException
- If the name coincides with
an attribute already in the container.public UnitAttribute(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Containername
- Name
IllegalActionException
- If the attribute is not of an
acceptable class for the container, or if the name contains a period.
NameDuplicationException
- If the name coincides with
an attribute already in the container.Method Detail |
---|
public void addValueListener(ValueListener listener)
listener
- The listener to add.Settable.removeValueListener(ValueListener)
public void exportMoML(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
exportMoML
in interface MoMLExportable
exportMoML
in class NamedObj
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name to use instead of the current name.
java.io.IOException
- If an I/O error occurs.NamedObj.exportMoML(Writer, int, String)
public java.lang.String getExpression()
Settable.getExpression()
public UnitConstraints getUnitConstraints()
public UnitExpr getUnitExpr()
public Settable.Visibility getVisibility()
Settable.getVisibility()
public void removeValueListener(ValueListener listener)
listener
- The listener to remove.Settable.addValueListener(ValueListener)
public void setExpression(java.lang.String expression) throws IllegalActionException
setExpression
in interface Settable
setExpression
in class AbstractSettableAttribute
expression
- A String that is the descriptive form of either a Unit
or a UnitEquation.
IllegalActionException
- If the expression is invalid
(not thrown in this base class).Settable.setExpression(java.lang.String)
public void setUnitConstraints(UnitConstraints constraints)
constraints
- The UnitConstraints.public void setUnitExpr(UnitExpr expr)
expr
- A UnitExpr.public void setVisibility(Settable.Visibility visibility)
visibility
- The visibility of this attribute.Settable.setVisibility(Settable.Visibility)
public java.util.Collection validate() throws IllegalActionException
Settable
IllegalActionException
- If the expression is not valid, or
its value is not acceptable to the container or the listeners.protected void _propagateValue(NamedObj destination) throws IllegalActionException
_propagateValue
in class NamedObj
destination
- Object to which to propagate the
value.
IllegalActionException
- If the value cannot
be propagated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |