Class ModelScope

    • Constructor Detail

      • ModelScope

        public ModelScope()
    • Method Detail

      • getAllScopedObjectNames

        public static java.util.Set<java.lang.String> getAllScopedObjectNames​(NamedObj container)
        Return a list of object names in scope for variables in the given container.
        Parameters:
        container - The container of this scope.
        Returns:
        a list of object names in scope for variables in the given container.
      • getAllScopedVariableNames

        public static java.util.Set<java.lang.String> 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.
        Parameters:
        exclude - The variable to exclude from the scope.
        container - The container of this scope.
        Returns:
        A list of variable names in scope for variables in the given container.
      • getScopedAttribute

        public static Attribute getScopedAttribute​(Attribute exclude,
                                                   NamedObj container,
                                                   java.lang.String name)
        Get the attribute 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 attribute contained in a scope extending attribute inside any of those containers.
        Parameters:
        exclude - An attribute to exclude from the search.
        container - The container to search upwards from.
        name - The attribute name to search for.
        Returns:
        The attribute with the given name or null if the attribute does not exist.
      • getScopedObject

        public static NamedObj getScopedObject​(NamedObj container,
                                               java.lang.String name)
        Get the NamedObj 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. If the specified container is lazy (implements LazyComposite), then references to its contained entities or relations will not resolve, so such references are disallowed.
        Parameters:
        container - The container to search upwards from.
        name - The object name to search for.
        Returns:
        The NamedObj with the given name or null if the NamedObj does not exist.
      • 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.
        Parameters:
        exclude - A variable to exclude from the search.
        container - The container to search upwards from.
        name - The variable name to search for.
        Returns:
        The variable with the given name or null if the variable does not exist.
      • preferenceValue

        public static Token preferenceValue​(NamedObj context,
                                            java.lang.String preferenceName)
        Check to see whether a preference of the specified name is defined in the specified context, and if it is, return its value. Note that if there is an error in the expression for the preference, then this method will return null and report the error to standard out. This is done because we assume the error will normally be caught before this method is called.
        Parameters:
        context - The context for the preference.
        preferenceName - The name of the preference.
        Returns:
        The value of the preference, or null if it is not set.