Class Atom

java.lang.Object
com.iizix.prop.Atom
All Implemented Interfaces:
Cloneable, Comparable<Atom>
Direct Known Subclasses:
GeneratedAtom

public class Atom extends Object implements Cloneable, Comparable<Atom>
The Atom object instance is used to access the name string for e.g. properties. A name string that has been placed in an atom table is called an atom name.

The name string is subject to the following name string rules:

  • cannot be empty,
  • code point for each character must be space or greater, i.e. no control characters,
  • reserved characters: single- and double-quote, colon (:), forward and backslash (/\), curly brackets ({}) used in expressions, wild card characters (?*^), enumeration separators (,;).

The string itself is implemented as a weak reference, enabling the editor to keep a weak hash map with weak references.

Author:
Christopher Mindus
  • Field Details

    • RESERVED_CHARS

      public static final String RESERVED_CHARS
      Reserved characters in Atom names.
      See Also:
    • SYSTEM

      public static final Atom SYSTEM
    • SERVER

      public static final Atom SERVER
    • CLIENT

      public static final Atom CLIENT
    • EVENT

      public static final Atom EVENT
    • ENV

      public static final Atom ENV
    • ERROR

      public static final Atom ERROR
    • INDEX

      public static final Atom INDEX
    • APPS

      public static final Atom APPS
    • FILENAME

      public static final Atom FILENAME
    • ROOT

      public static final Atom ROOT
    • ICON

      public static final Atom ICON
    • BINDINGS

      public static final Atom BINDINGS
    • PORT

      public static final Atom PORT
    • BIND

      public static final Atom BIND
    • RESOLVE

      public static final Atom RESOLVE
    • HOST

      public static final Atom HOST
    • SSL

      public static final Atom SSL
    • PROXYHOST

      public static final Atom PROXYHOST
    • PROXYPORT

      public static final Atom PROXYPORT
    • PROXYTYPE

      public static final Atom PROXYTYPE
    • WEBSOCKET

      public static final Atom WEBSOCKET
    • USER

      public static final Atom USER
    • EXTENDS

      public static final Atom EXTENDS
    • STYLES

      public static final Atom STYLES
    • CLIENT_STYLES

      public static final Atom CLIENT_STYLES
    • SETTINGS

      public static final Atom SETTINGS
    • ROWS

      public static final Atom ROWS
    • RAW

      public static final Atom RAW
    • NULL

      public static final Atom NULL
    • ACTORS

      public static final Atom ACTORS
    • PATTERN

      public static final Atom PATTERN
    • FOCUS

      public static final Atom FOCUS
    • TRANSACTION

      public static final Atom TRANSACTION
    • CONNECTORS

      public static final Atom CONNECTORS
    • TYPE

      public static final Atom TYPE
    • COMPONENTS

      public static final Atom COMPONENTS
    • COMPONENT

      public static final Atom COMPONENT
    • UI_CONTAINER

      public static final Atom UI_CONTAINER
    • UI_COMPONENT

      public static final Atom UI_COMPONENT
    • UI_PREVIEW

      public static final Atom UI_PREVIEW
    • VISIBLE

      public static final Atom VISIBLE
    • ENABLED

      public static final Atom ENABLED
    • READONLY

      public static final Atom READONLY
    • SELECTED

      public static final Atom SELECTED
    • SELECTOR

      public static final Atom SELECTOR
    • LAYOUT

      public static final Atom LAYOUT
    • LAYOUT_MANAGER

      public static final Atom LAYOUT_MANAGER
    • TEXT

      public static final Atom TEXT
    • CHARUPDATE

      public static final Atom CHARUPDATE
    • DATA_CONTAINER

      public static final Atom DATA_CONTAINER
    • PANEL

      public static final Atom PANEL
    • HSCROLL

      public static final Atom HSCROLL
    • VSCROLL

      public static final Atom VSCROLL
    • TITLE

      public static final Atom TITLE
    • TOOLTIP

      public static final Atom TOOLTIP
    • MESSAGE

      public static final Atom MESSAGE
    • TOASTER

      public static final Atom TOASTER
    • BADGE

      public static final Atom BADGE
    • PLUGINS

      public static final Atom PLUGINS
    • CLASS

      public static final Atom CLASS
    • INPUT

      public static final Atom INPUT
    • BODY

      public static final Atom BODY
    • OUTPUT

      public static final Atom OUTPUT
    • JAVA

      public static final Atom JAVA
    • TIMESTAMP

      public static final Atom TIMESTAMP
    • WIDTH

      public static final Atom WIDTH
    • HEIGHT

      public static final Atom HEIGHT
    • FIELDS

      public static final Atom FIELDS
    • CID

      public static final Atom CID
    • ID

      public static final Atom ID
    • IDS

      public static final Atom IDS
    • ACTION

      public static final Atom ACTION
    • ACTIONS

      public static final Atom ACTIONS
    • ALIGN

      public static final Atom ALIGN
    • RTL

      public static final Atom RTL
    • LOCATION

      public static final Atom LOCATION
    • DELAY

      public static final Atom DELAY
    • DERIVES

      public static final Atom DERIVES
    • VSFIELD

      public static final Atom VSFIELD
    • VSTABLE

      public static final Atom VSTABLE
    • VSCOLUMN

      public static final Atom VSCOLUMN
    • QNAME

      public static final Atom QNAME
    • NAME

      public static final Atom NAME
    • ENCODING

      public static final Atom ENCODING
    • REFERENCE

      public static final Atom REFERENCE
    • VIRTUALSPACE

      public static final Atom VIRTUALSPACE
    • PARTICIPANTS

      public static final Atom PARTICIPANTS
    • PRIMARY

      public static final Atom PRIMARY
    • VALUE

      public static final Atom VALUE
    • MSG

      public static final Atom MSG
    • MCAT

      public static final Atom MCAT
    • DESCR

      public static final Atom DESCR
    • DEFAULT

      public static final Atom DEFAULT
    • GEO

      public static final Atom GEO
    • ZONES

      public static final Atom ZONES
    • LANG

      public static final Atom LANG
    • THEMES

      public static final Atom THEMES
    • DEVICE

      public static final Atom DEVICE
    • URI

      public static final Atom URI
    • URI_PARAMS

      public static final Atom URI_PARAMS
    • METHOD

      public static final Atom METHOD
    • OVERRIDE_METHOD

      public static final Atom OVERRIDE_METHOD
    • READ_TIMEOUT

      public static final Atom READ_TIMEOUT
    • IGNORE

      public static final Atom IGNORE
    • DOC

      public static final Atom DOC
    • CACHE

      public static final Atom CACHE
    • STYLE

      public static final Atom STYLE
    • WEIGHT

      public static final Atom WEIGHT
    • RANGE

      public static final Atom RANGE
    • CONTEXT_MENU

      public static final Atom CONTEXT_MENU
    • CONTEXT_MENU_REF

      public static final Atom CONTEXT_MENU_REF
    • DESIGNER

      public static final Atom DESIGNER
    • MODULE_APP

      public static final Atom MODULE_APP
    • PWA

      public static final Atom PWA
    • PUSH

      public static final Atom PUSH
    • ON_VS_CREATE

      public static final String ON_VS_CREATE
      See Also:
    • ON_VS_DESTROY

      public static final String ON_VS_DESTROY
      See Also:
    • ON_VS_ACTION

      public static final String ON_VS_ACTION
      See Also:
    • ON_VS_CHANGE

      public static final String ON_VS_CHANGE
      See Also:
    • ON_VS_FOCUS

      public static final String ON_VS_FOCUS
      See Also:
    • ON_VS_STATE

      public static final String ON_VS_STATE
      See Also:
    • ON_UI_CONNECT

      public static final String ON_UI_CONNECT
      See Also:
    • ON_UI_CREATE

      public static final String ON_UI_CREATE
      See Also:
    • ON_UI_DESTROY

      public static final String ON_UI_DESTROY
      See Also:
    • ON_UI_ACTION

      public static final String ON_UI_ACTION
      See Also:
    • ON_UI_BACK

      public static final String ON_UI_BACK
      See Also:
    • ON_UI_TEXT_CHANGE

      public static final String ON_UI_TEXT_CHANGE
      See Also:
    • ON_UI_VALUE_CHANGE

      public static final String ON_UI_VALUE_CHANGE
      See Also:
    • ON_UI_FOCUS

      public static final String ON_UI_FOCUS
      See Also:
    • ON_UI_SELECTION

      public static final String ON_UI_SELECTION
      See Also:
    • ATOM_ON_VS_CREATE

      public static final Atom ATOM_ON_VS_CREATE
    • ATOM_ON_VS_DESTROY

      public static final Atom ATOM_ON_VS_DESTROY
    • ATOM_ON_VS_ACTION

      public static final Atom ATOM_ON_VS_ACTION
    • ATOM_ON_VS_CHANGE

      public static final Atom ATOM_ON_VS_CHANGE
    • ATOM_ON_VS_FOCUS

      public static final Atom ATOM_ON_VS_FOCUS
    • ATOM_ON_VS_STATE

      public static final Atom ATOM_ON_VS_STATE
    • ATOM_ON_UI_CONNECT

      public static final Atom ATOM_ON_UI_CONNECT
    • ATOM_ON_UI_CREATE

      public static final Atom ATOM_ON_UI_CREATE
    • ATOM_ON_UI_DESTROY

      public static final Atom ATOM_ON_UI_DESTROY
    • ATOM_ON_UI_ACTION

      public static final Atom ATOM_ON_UI_ACTION
    • ATOM_ON_UI_BACK

      public static final Atom ATOM_ON_UI_BACK
    • ATOM_ON_UI_TEXT_CHANGE

      public static final Atom ATOM_ON_UI_TEXT_CHANGE
    • ATOM_ON_UI_VALUE_CHANGE

      public static final Atom ATOM_ON_UI_VALUE_CHANGE
    • ATOM_ON_UI_FOCUS

      public static final Atom ATOM_ON_UI_FOCUS
    • ATOM_ON_UI_SELECTION

      public static final Atom ATOM_ON_UI_SELECTION
    • VSFIELD_NAME

      public static final String VSFIELD_NAME
      See Also:
  • Constructor Details

    • Atom

      protected Atom(String name, int internalValue)
      This method is ONLY intended to be used by GAtom!
      Throws:
      IllegalArgumentException - If not internal...
  • Method Details

    • get

      public static Atom get(String name)
      Gets an existing or creates a new atom with the specified name.
      Parameters:
      name - The atom name, following the rules.
      Throws:
      NullPointerException - If the name is null.
      IllegalArgumentException - If the name is invalid.
    • find

      public static Atom find(String name)
      Finds an atom that has been created previously by name, and that is still in use by some non-garbage-collected object.
      Parameters:
      name - The name.
      Returns:
      The Atom for the name, or null if not found.
    • isValidName

      public static boolean isValidName(String name)
      Validates the atom name (apart of the leading '$' sign that should not be used unless for system defines).
      Parameters:
      name - The atom name to verify.
      Returns:
      true for success, false for invalid name.
    • isValidName

      public static boolean isValidName(String name, boolean allowLeadingDollar)
      Validates the atom name.
      Parameters:
      name - The atom name to verify.
      allowLeadingDollar - Flag indicating leading dollar is allowed or not.
      Returns:
      true for success, false for invalid name.
    • validateName

      public static String validateName(String name)
      Validates the atom name (apart of the leading '$' sign that should not be used unless for system defines).
      Parameters:
      name - The atom name to verify.
      Returns:
      The error message in English such as "cannot be empty" or "cannot contain...", or null for successful validation.
    • validateName

      public static String validateName(String name, boolean allowLeadingDollar)
      Validates the atom name (apart of the leading '$' sign that should not be used unless for system defines).
      Parameters:
      name - The atom name to verify.
      allowLeadingDollar - Flag indicating leading dollar is allowed or not.
      Returns:
      The error message in English such as "cannot be empty" or "cannot contain...", or null for successful validation.
    • createValidName

      public static String createValidName(String string, boolean isLeadingDollarAllowed)
      Creates a valid name from a string. Only valid characters are used. If the name becomes empty, it will be returned as empty to be used for e.g. unique name creation, even if it is not allowed.
      Parameters:
      string - The suggested name.
      isLeadingDollarAllowed - Leading '$' is allowed depending on flag.
    • isInside

      public static boolean isInside(Atom atom, Atom[] atoms)
      Checks if an Atom is present in an array of Atoms.
      Parameters:
      atom - The atom to find.
      atoms - The atom array.
      Returns:
      true if atom found in the atoms table.
    • equals

      public boolean equals(Object atom)
      Checks if an atom equals to another.
      Overrides:
      equals in class Object
      Parameters:
      atom - the atom to compare...
      Returns:
      true if the atom is equal to this object instance by reference ("==").
    • compareTo

      public int compareTo(Atom atom)
      Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      Specified by:
      compareTo in interface Comparable<Atom>
      Parameters:
      atom - The object to be compared.
      Returns:
      A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The comparison is done with a Collator with the Default Locale.
      Throws:
      NullPointerException - if the specified object is null.
      ClassCastException - if the specified object's type prevents it from being compared to this object.
    • getAtomName

      public String getAtomName()
      Gets the atom name.
      Returns:
      the name of the atom.
    • toString

      public String toString()
      Converts the atom to a string in the format of atom[name].
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Gets the hash code of the Atom, i.e. the hash code of the Atom Name.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code of the Atom Name.
    • clone

      public Atom clone()
      Clones this atom.

      Atoms do not need cloning, and this method returns the same Atom object as the name is invariable.

      Overrides:
      clone in class Object
      Returns:
      A "clone" of the atom, i.e. the same "this" Atom object.