Class NameContext


  • class NameContext
    extends java.lang.Object
    A NameContext enables detection of strings which differ only in case.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  NameContext.Name  
    • Constructor Summary

      Constructors 
      Constructor Description
      NameContext​(boolean allowCollisions)
      Construct a context.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String add​(java.lang.String name)
      Add a name to this context.
      void assertPut​(java.lang.String name)
      Add a name to this context.
      void clear()
      Remove all entries.
      static NameContext forName​(java.lang.String name, boolean allowCollisions, BatchEnvironment env)
      Get a context for the given name.
      java.lang.String get​(java.lang.String name)
      Get a name from the context.
      void put​(java.lang.String name)
      Add a name to this context..
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • table

        private java.util.Hashtable<java.lang.String,​NameContext.Name> table
      • allowCollisions

        private final boolean allowCollisions
    • Constructor Detail

      • NameContext

        public NameContext​(boolean allowCollisions)
        Construct a context.
        Parameters:
        allowCollisions - true if case-sensitive name collisions are allowed, false if not.
    • Method Detail

      • forName

        public static NameContext forName​(java.lang.String name,
                                          boolean allowCollisions,
                                          BatchEnvironment env)
        Get a context for the given name. Name may be null, in which case this method will return the default context.
      • assertPut

        public void assertPut​(java.lang.String name)
                       throws java.lang.Exception
        Add a name to this context. If constructed with allowCollisions false and a collision occurs, this method will throw an exception in which the message contains the string: "name" and "collision".
        Throws:
        java.lang.Exception
      • put

        public void put​(java.lang.String name)
        Add a name to this context..
      • add

        private java.lang.String add​(java.lang.String name)
        Add a name to this context. If constructed with allowCollisions false and a collision occurs, this method will return a message string, otherwise returns null.
      • get

        public java.lang.String get​(java.lang.String name)
        Get a name from the context. If it has collisions, the name will be converted as specified in section 5.2.7.
      • clear

        public void clear()
        Remove all entries.