Package ptolemy.data.unit
Class UnitCategory
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.data.unit.UnitCategory
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class UnitCategory extends Attribute
A property that specifies the category of a base unit. For example, in the International System of Units, the base unit meter has the category length.- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Xiaojun Liu
- See Also:
BaseUnit
- Pt.AcceptedRating:
- Red (liuxj)
- Pt.ProposedRating:
- Red (liuxj)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description UnitCategory()
Construct a unit category in the default workspace with an empty string as its name.UnitCategory(NamedObj container, java.lang.String name)
Construct a unit category property with the given name contained by the specified entity.UnitCategory(Workspace workspace)
Construct an attribute in the specified workspace with an empty string as a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseUnit
getBaseUnit()
Return the base unit.void
setContainer(NamedObj container)
Set the container and register this object in to the system wide unit system by callingUnitUtilities.registerUnitCategory(String)
.-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Constructor Detail
-
UnitCategory
public UnitCategory()
Construct a unit category in the default workspace with an empty string as its name. The object is added to the directory of the workspace. Increment the version number of the workspace.
-
UnitCategory
public UnitCategory(Workspace workspace)
Construct an attribute in the specified workspace with an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. The object is added to the directory of the workspace. Increment the version number of the workspace.- Parameters:
workspace
- The workspace that will list the attribute.
-
UnitCategory
public UnitCategory(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a unit category property with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.This constructor adds the created object to the system wide UnitSystem by calling
UnitUtilities.registerUnitCategory(String)
- Parameters:
container
- The container.name
- The name of this attribute.- Throws:
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
-
getBaseUnit
public BaseUnit getBaseUnit()
Return the base unit.- Returns:
- The base unit.
-
setContainer
public void setContainer(NamedObj container) throws IllegalActionException, NameDuplicationException
Set the container and register this object in to the system wide unit system by callingUnitUtilities.registerUnitCategory(String)
.- Overrides:
setContainer
in classAttribute
- Parameters:
container
- The container to attach this attribute to. The type of the container must be an instances of BaseUnit.- Throws:
IllegalActionException
- If Attribute.setContainer() throws it.NameDuplicationException
- If Attribute.setContainer() throws it.- See Also:
Attribute.getContainer()
-
-