Class AtomGenerator

java.lang.Object
com.iizix.editor.AtomGenerator

public class AtomGenerator extends 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 Details

    • AtomGenerator

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

    • getAtom

      public Atom getAtom(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(String base, 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.