Class AtomGenerator


  • public class AtomGenerator
    extends java.lang.Object
    This class is an atom generator to use with a specific property container. It creates atoms with a specified name or if no name exists, i.e. an empty name is used, a unique name for that atom will be generated within the VirtualSpace of the property container, once all properties are added.

    Call the method getAtom(name) with a "name" that may be an empty string. A "temporary" atom will then be created with a temporary name.

    When all properties are added, call the method generateUniqueNames to assign new unique names to the atoms that had a temporary name. No change to the atom instance is required, and the atom index will not change.

    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      AtomGenerator​(PropCnr container)
      Creates an atom generator using the atom manager and a property container.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidgenerateUniqueNames()
      Called once all properties are set for a container.
      AtomgetAtom​(java.lang.String name)
      Creates a new atom using the atom manager using the specified name.
      AtomgetAtom​(java.lang.String base, java.lang.String name)
      Creates a new atom using the atom manager using the specified name if this name is not empty, otherwise a temporary unique name is assigned.
      • Methods inherited from class java.lang.Object

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

      • AtomGenerator

        public AtomGenerator​(PropCnr container)
        Creates an atom generator using the atom manager and a property container.
        Parameters:
        container - The property container.
    • Method Detail

      • getAtom

        public Atom getAtom​(java.lang.String name)
        Creates a new atom using the atom manager using the specified name. This call doesn't support an empty string, it will throw an InternalError.
        Parameters:
        name - The requested name.
        Returns:
        An atom, temporary or normal.
      • getAtom

        public Atom getAtom​(java.lang.String base,
                            java.lang.String name)
        Creates a new atom using the atom manager using the specified name if this name is not empty, otherwise a temporary unique name is assigned.
        Parameters:
        base - The base name to use for the temporary name.
        name - The requested name (or null or empty string when a generated name should be used).
        Returns:
        An atom, temporary or normal.
      • generateUniqueNames

        public void generateUniqueNames()
        Called once all properties are set for a container. This will assign new names to the atoms that are temporary.