|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.data.properties.PropertySolverBase
public abstract class PropertySolverBase
The base abstract class for a property solver.
The base class provides the core functionality for property resolution. It provides a method to create a PropertyHelper for any given model component. The model component can be an object of any Ptolemy class (e.g. ASTPtRootNode, Sink, Entity, and FSMActor). A model component, in turn, may have one or multiple property-able objects.
A PropertySolver is associated with strictly one use-case.
PropertySolvers with the same use-case are considered equivalent.
Subclasses need to associate the solver with an unique use-case by
providing implementation for getUseCaseName(),
getExtendedUseCaseName().
An use-case may have dependency with other use-cases. The dependencies
are declared when the solver is instantiated. The dependencies needs to
be kept non-circular to avoid non-deterministic resolution result.
Every PropertySolver is linked together by the SharedParameter called "sharedUtilitiesWrapper", which contains the shared utility object. This allows every PropertySolver to find other solvers in the model.
Subclasses needs to implement
resolveProperties()
to specify exactly how to perform the property resolution. For example,
one may gather all the constraints from the PropertyHelpers and feed them
into a constraint solver.
| Red (mankit) |
| Red (mankit) |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
|---|
NamedObj.ContainedObjectsIterator |
| Field Summary | |
|---|---|
protected java.util.List<java.lang.String> |
_dependentUseCases
The list that keeps track of the dependencies on other use-cases. |
private StringBufferExec |
_executeCommands
|
protected java.util.HashMap<java.lang.Object,PropertyHelper> |
_helperStore
The HashMap that caches components and their PropertyHelper objects. |
protected java.util.HashSet<java.lang.Object> |
_nonSettables
The set of property-able objects that have non-settable property. |
private static PtParser |
_parser
The expression parser. |
protected java.util.HashMap<java.lang.Object,Property> |
_resolvedProperties
The HashMap that caches property-able objects and their Property values. |
protected SharedUtilities |
_sharedUtilities
The utilities shared between all solvers. |
SharedParameter |
sharedUtilitiesWrapper
The shared parameter that links together every solver in the same model. |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
|---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Constructor Summary | |
|---|---|
PropertySolverBase(NamedObj container,
java.lang.String name)
Construct a PropertySolverBase with the specified container and name. |
|
| Method Summary | |
|---|---|
private void |
_compileHelperClasses()
|
private void |
_compileUserCode(Entity entity,
java.lang.String userCode)
|
protected PropertyHelper |
_getHelper(java.lang.Object component)
Return the PropertyHelper for the specified component. |
protected java.lang.String |
_getPackageName()
Return the package name that contains the class of this solver. |
protected NamedObj |
_toplevel()
|
void |
addDependentUseCase(java.lang.String userCaseName)
Add the given unique solver (user-case) identifier to the dependency list. |
void |
clearResolvedProperty(java.lang.Object object)
Clear the resolved property for the specified object. |
PropertySolver |
findSolver(java.lang.String identifier)
Find a solver that is associated with the specified label. |
java.util.List<PropertyHelper> |
getAllHelpers()
Return the list of all PropertyHelpers associated with this solver. |
java.util.Set |
getAllPropertyables()
Return the set of all property-able objects obtained from all PropertyHelper. |
static java.util.List<PropertySolver> |
getAllSolvers(SharedParameter sharedParameter)
Return the list of all solvers that are in the same model. |
Attribute |
getAttribute(ASTPtRootNode node)
Get the attribute that corresponds to the specified ASTPtRootNode. |
java.util.List<java.lang.String> |
getDependentSolvers()
Return the list of dependent solvers. |
abstract java.lang.String |
getExtendedUseCaseName()
Return the extended use-case name. |
PropertyHelper |
getHelper(java.lang.Object object)
Return the property helper for the specified component. |
static PtParser |
getParser()
Return the expression parser. |
ASTPtRootNode |
getParseTree(Attribute attribute)
Return the root ASTPtRootNode associated with the specified attribute. |
Property |
getProperty(java.lang.Object object)
Return the property value associated with the specified object. |
Property |
getResolvedProperty(java.lang.Object object)
Return the resolved property for the specified object. |
Property |
getResolvedProperty(java.lang.Object object,
boolean resolve)
Return the resolved property for the specified object. |
SharedUtilities |
getSharedUtilities()
Return the shared utility object. |
abstract java.lang.String |
getUseCaseName()
Return the use-case name. |
void |
markAsNonSettable(java.lang.Object object)
Mark the property of the specified object as non-settable. |
void |
reset()
Reset the solver. |
void |
resetAll()
Reset every solver in the model. |
abstract void |
resolveProperties()
Perform property resolution. |
void |
setResolvedProperty(java.lang.Object object,
Property property)
Set the resolved property of the specified object. |
| 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 |
| Field Detail |
|---|
public SharedParameter sharedUtilitiesWrapper
protected java.util.List<java.lang.String> _dependentUseCases
protected java.util.HashMap<java.lang.Object,PropertyHelper> _helperStore
protected java.util.HashSet<java.lang.Object> _nonSettables
protected java.util.HashMap<java.lang.Object,Property> _resolvedProperties
protected SharedUtilities _sharedUtilities
private StringBufferExec _executeCommands
private static PtParser _parser
| Constructor Detail |
|---|
public PropertySolverBase(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The specified container.name - The specified name.
IllegalActionException - If the PropertySolverBase is
not of an acceptable attribute for the container.
NameDuplicationException - If the name coincides with an
attribute already in the container.| Method Detail |
|---|
public void addDependentUseCase(java.lang.String userCaseName)
userCaseName - The specified user case name.public void clearResolvedProperty(java.lang.Object object)
object - The specified object.
public PropertySolver findSolver(java.lang.String identifier)
throws PropertyResolutionException
identifier - The specified label.
IllegalActionException - Thrown if no matched solver
is found.
PropertyResolutionException
public java.util.List<PropertyHelper> getAllHelpers()
throws IllegalActionException
IllegalActionException
public java.util.Set getAllPropertyables()
throws IllegalActionException
IllegalActionException - Thrown if
an error occurs when getting the helpers or the property-able
objects from them.public static java.util.List<PropertySolver> getAllSolvers(SharedParameter sharedParameter)
sharedParameter - The specified SharedParameter links
together the solvers.
public Attribute getAttribute(ASTPtRootNode node)
PropertyHelper.putAttribute(ASTPtRootNode, Attribute).
node - The specified ASTPtRootNode.
java.lang.AssertionError - Thrown if the specified node does not
have a corresponding attribute.public java.util.List<java.lang.String> getDependentSolvers()
public abstract java.lang.String getExtendedUseCaseName()
public PropertyHelper getHelper(java.lang.Object object)
throws IllegalActionException
object - The specified component.
IllegalActionException - Thrown if the helper cannot
be found or instantiated.public static PtParser getParser()
public ASTPtRootNode getParseTree(Attribute attribute)
throws IllegalActionException
attribute - The specified attribute.
IllegalActionExceptionpublic Property getProperty(java.lang.Object object)
object - The specified object.
public Property getResolvedProperty(java.lang.Object object)
object - The specified object
public Property getResolvedProperty(java.lang.Object object,
boolean resolve)
object - The specified object.resolve - Whether or not to force resolution.
public SharedUtilities getSharedUtilities()
public abstract java.lang.String getUseCaseName()
public void markAsNonSettable(java.lang.Object object)
object - The specified object.public void reset()
public void resetAll()
public abstract void resolveProperties()
throws KernelException
KernelException - Thrown if sub-class throws it.
public void setResolvedProperty(java.lang.Object object,
Property property)
getResolvedProperty(Object)).
object - The specified object.property - The specified property.
protected PropertyHelper _getHelper(java.lang.Object component)
throws IllegalActionException
component - The specified component.
IllegalActionException - Thrown if the PropertyHelper
cannot be instantiated.protected java.lang.String _getPackageName()
protected NamedObj _toplevel()
private void _compileHelperClasses()
throws IllegalActionException
IllegalActionException
private void _compileUserCode(Entity entity,
java.lang.String userCode)
throws IllegalActionException
entity - userCode -
IllegalActionException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||