ptolemy.data.expr
Class ModelScope

java.lang.Object
  extended byptolemy.data.expr.ModelScope
All Implemented Interfaces:
ParserScope
Direct Known Subclasses:
DataUtilities.ActorCodeGenerationScope, Variable.VariableScope

public abstract class ModelScope
extends java.lang.Object
implements ParserScope

An abstract class that is useful for implementing expression language scopes for Ptolemy models.

Since:
Ptolemy II 2.1
Version:
$Id: ModelScope.java,v 1.19 2004/04/13 05:12:12 cxh Exp $
Author:
Xiaojun Liu, Steve Neuendorffer
See Also:
PtParser
Accepted Rating:
Red (liuxj)
Proposed Rating:
Red (liuxj)

Constructor Summary
ModelScope()
           
 
Method Summary
static java.util.Set getAllScopedVariableNames(Variable exclude, NamedObj container)
          Return a list of variable names in scope for variables in the given container.
static Variable getScopedVariable(Variable exclude, NamedObj container, java.lang.String name)
          Get the variable with the given name in the scope of the given container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ptolemy.data.expr.ParserScope
get, getType, getTypeTerm, identifierSet
 

Constructor Detail

ModelScope

public ModelScope()
Method Detail

getAllScopedVariableNames

public static java.util.Set getAllScopedVariableNames(Variable exclude,
                                                      NamedObj container)
Return a list of variable names in scope for variables in the given container. Exclude the given variable from being considered in scope.


getScopedVariable

public static Variable getScopedVariable(Variable exclude,
                                         NamedObj container,
                                         java.lang.String name)
Get the variable with the given name in the scope of the given container. If the name contains the "::" scoping specifier, then an attribute more deeply in the hierarchy is searched for. The scope of the object includes any container of the given object, and any variable contained in a scope extending attribute inside any of those containers. If no variable exists with the given name, then return null.

Parameters:
exclude - A variable to exclude from the search.
container - The container to search upwards from.
name - The variable name to search for.