Class Scope

  • All Implemented Interfaces:
    java.util.Map
    Direct Known Subclasses:
    ForeachScope

    public class Scope
    extends java.util.AbstractMap
    This handles context scoping and metadata for directives.
    Version:
    $Id$
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Scope.Info
      Class to encapsulate and provide access to info about the current scope for debugging.
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      Scope​(java.lang.Object owner, java.lang.Object previous)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set entrySet()  
      java.lang.Object get​(java.lang.Object key)  
      protected int getDepth()
      Returns the number of control arguments of this type that are stacked up.
      Scope.Info getInfo()
      Returns info about the current scope for debugging purposes.
      Scope getParent()
      Returns the parent control reference overridden by the placement of this instance in the context.
      java.lang.Object getReplaced()
      Returns the user's context reference overridden by the placement of this instance in the context.
      private java.util.Map getStorage()  
      Scope getTopmost()
      Returns the topmost parent control reference, retrieved by simple recursion on getParent().
      java.lang.Object put​(java.lang.Object key, java.lang.Object value)  
      protected void stop()
      Allows #stop to easily trigger the proper StopCommand for this scope.
      • Methods inherited from class java.util.AbstractMap

        clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • storage

        private java.util.Map storage
      • replaced

        private java.lang.Object replaced
      • parent

        private Scope parent
      • owner

        protected final java.lang.Object owner
    • Constructor Detail

      • Scope

        public Scope​(java.lang.Object owner,
                     java.lang.Object previous)
    • Method Detail

      • getStorage

        private java.util.Map getStorage()
      • entrySet

        public java.util.Set entrySet()
        Specified by:
        entrySet in interface java.util.Map
        Specified by:
        entrySet in class java.util.AbstractMap
      • get

        public java.lang.Object get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map
        Overrides:
        get in class java.util.AbstractMap
      • put

        public java.lang.Object put​(java.lang.Object key,
                                    java.lang.Object value)
        Specified by:
        put in interface java.util.Map
        Overrides:
        put in class java.util.AbstractMap
      • stop

        protected void stop()
        Allows #stop to easily trigger the proper StopCommand for this scope.
      • getDepth

        protected int getDepth()
        Returns the number of control arguments of this type that are stacked up. This is the distance between this instance and the topmost instance, plus one. This value will never be negative or zero.
      • getTopmost

        public Scope getTopmost()
        Returns the topmost parent control reference, retrieved by simple recursion on getParent().
      • getParent

        public Scope getParent()
        Returns the parent control reference overridden by the placement of this instance in the context.
      • getReplaced

        public java.lang.Object getReplaced()
        Returns the user's context reference overridden by the placement of this instance in the context. If there was none (as is hoped), then this will return null. This never returns parent controls; those are returned by getParent().
      • getInfo

        public Scope.Info getInfo()
        Returns info about the current scope for debugging purposes.