Class AbstractContainer

    • Constructor Detail

      • AbstractContainer

        protected AbstractContainer()
        Initializes the container.
    • Method Detail

      • checkDefaultConstructor

        protected void checkDefaultConstructor()
        Checks whether a default constructor is available - necessary for generating HTML help.
      • globalInfo

        public String globalInfo()
        Returns a short info on the container, namely the value names.
        Specified by:
        globalInfo in interface GlobalInfoSupporter
        Returns:
        the info
      • addHelp

        public void addHelp​(String name,
                            String desc)
        Stores the help for the given name if valid name.
        Specified by:
        addHelp in interface Container
        Parameters:
        name - the name to store the help under
        desc - the help description
        See Also:
        isValidName(String)
      • addHelp

        public void addHelp​(String name,
                            String desc,
                            Class type)
        Stores the help for the given name if valid name.
        Specified by:
        addHelp in interface Container
        Parameters:
        name - the name to store the help under
        desc - the help description
        type - the type of the data
        See Also:
        isValidName(String)
      • addHelp

        public void addHelp​(String name,
                            String desc,
                            Class[] types)
        Stores the help for the given name if valid name.
        Specified by:
        addHelp in interface Container
        Parameters:
        name - the name to store the help under
        desc - the help description
        types - the types of the data
        See Also:
        isValidName(String)
      • initHelp

        protected void initHelp()
        Initializes the help strings.
        Default implementation does nothing.
      • names

        public abstract Iterator<String> names()
        Returns all value names that can be used (theoretically).
        Specified by:
        names in interface Container
        Returns:
        iterator over all possible value names
      • stored

        public Iterator<String> stored()
        Returns all available stored value names.
        Specified by:
        stored in interface Container
        Returns:
        enumeration over all stored value names
      • hasValue

        public boolean hasValue​(String name)
        Checks whether a given value is non-null.
        Specified by:
        hasValue in interface Container
        Parameters:
        name - the name of the value to check
        Returns:
        true if the value is non-null
      • getValue

        public Object getValue​(String name)
        Returns the value associated with the given name.
        Specified by:
        getValue in interface Container
        Parameters:
        name - the name of the value
        Returns:
        the associated value or null if not available
      • getValue

        public <T> T getValue​(String name,
                              Class<T> cls)
        Returns the value associated with the given name.
        Specified by:
        getValue in interface Container
        Parameters:
        name - the name of the value
        cls - for casting
        Returns:
        the associated value or null if not available
      • hasHelp

        public boolean hasHelp​(String name)
        Checks whether a given help is non-null.
        Specified by:
        hasHelp in interface Container
        Parameters:
        name - the name of the help item to check
        Returns:
        true if the help is non-null
      • getHelp

        public String getHelp​(String name)
        Returns the help associated with the given name.
        Specified by:
        getHelp in interface Container
        Parameters:
        name - the name of the help item
        Returns:
        the associated help or null if not available
      • isValidName

        protected boolean isValidName​(String name)
        Checks whether the name of the object is valid.
        Parameters:
        name - the name to check
        Returns:
        true if valid
        See Also:
        names()
      • store

        protected boolean store​(String name,
                                Object value)
        Stores the value under the name.
        Parameters:
        name - the name of the value
        value - the value to store
        Returns:
        true if successfully stored, i.e., value is not null
      • setValue

        public boolean setValue​(String name,
                                Object value)
        Sets the named value.
        Specified by:
        setValue in interface Container
        Parameters:
        name - the name of the value
        value - the value to store in the container
        Returns:
        true if the name was recognized and the value was stored successfully, false otherwise
      • isValid

        public abstract boolean isValid()
        Checks whether the setup of the container is valid.
        Specified by:
        isValid in interface Container
        Returns:
        true if all the necessary values are available
      • addAdditionalName

        public boolean addAdditionalName​(String name)
        Adds the specified name as valid name for a value.
        Specified by:
        addAdditionalName in interface Container
        Parameters:
        name - the name to add
        Returns:
        true if the additional names list changed
      • removeAdditionalName

        public boolean removeAdditionalName​(String name)
        Removes the additional name again.
        Specified by:
        removeAdditionalName in interface Container
        Parameters:
        name - the name to remove
        Returns:
        true if the name was present and got removed
      • toString

        public String toString()
        Returns a short description of the stored data.
        Specified by:
        toString in interface Container
        Overrides:
        toString in class Object
        Returns:
        short description