Class MemoryDictionary

  • All Implemented Interfaces:
    Dictionary, WritableDictionary


    public class MemoryDictionary
    extends java.lang.Object
    implements WritableDictionary
    A dictionary that keeps the values and names in hash maps in the memory. The dictionary has to be filled using the methods addAttributeType and addVendor.
    • Constructor Summary

      Constructors 
      Constructor Description
      MemoryDictionary​()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAttributeType​(AttributeType attributeType)
      Adds an AttributeType object to the cache.
      void addVendor​(int vendorId, java.lang.String vendorName)
      Adds the given vendor to the cache.
      AttributeType getAttributeTypeByCode​(int typeCode)
      Returns the AttributeType for the vendor -1 from the cache.
      AttributeType getAttributeTypeByCode​(int vendorCode, int typeCode)
      Returns the specified AttributeType object.
      AttributeType getAttributeTypeByName​(java.lang.String typeName)
      Retrieves the attribute type with the given name.
      int getVendorId​(java.lang.String vendorName)
      Searches the vendor with the given name and returns its code.
      java.lang.String getVendorName​(int vendorId)
      Retrieves the name of the vendor with the given code from the cache.
      • Methods inherited from class java.lang.Object

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

      • MemoryDictionary

        public MemoryDictionary​()
    • Method Detail

      • getAttributeTypeByName

        public AttributeType getAttributeTypeByName​(java.lang.String typeName)
        Retrieves the attribute type with the given name.
        Specified by:
        getAttributeTypeByName in interface Dictionary
        Parameters:
        typeName - name of the attribute type
        Returns:
        AttributeType or null
      • getVendorId

        public int getVendorId​(java.lang.String vendorName)
        Searches the vendor with the given name and returns its code. This method is seldomly used.
        Specified by:
        getVendorId in interface Dictionary
        Parameters:
        vendorName - vendor name
        Returns:
        vendor code or -1
      • getVendorName

        public java.lang.String getVendorName​(int vendorId)
        Retrieves the name of the vendor with the given code from the cache.
        Specified by:
        getVendorName in interface Dictionary
        Parameters:
        vendorId - vendor number
        Returns:
        vendor name or null
      • addVendor

        public void addVendor​(int vendorId,
                              java.lang.String vendorName)
        Adds the given vendor to the cache.
        Specified by:
        addVendor in interface WritableDictionary
        Parameters:
        vendorId - vendor ID
        vendorName - name of the vendor
        Throws:
        java.lang.IllegalArgumentException - empty vendor name, invalid vendor ID
      • addAttributeType

        public void addAttributeType​(AttributeType attributeType)
        Adds an AttributeType object to the cache.
        Specified by:
        addAttributeType in interface WritableDictionary
        Parameters:
        attributeType - AttributeType object
        Throws:
        java.lang.IllegalArgumentException - duplicate attribute name/type code