Class Atom

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<Atom>
    Direct Known Subclasses:
    GeneratedAtom

    public class Atom
    extends java.lang.Object
    implements java.lang.Cloneable, java.lang.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 Detail

      • RESERVED_CHARS

        public static final java.lang.String RESERVED_CHARS
        Reserved characters in Atom names.
        See Also:
        Constant Field Values
      • 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
      • HEADER

        public static final Atom HEADER
      • 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
      • POPUP

        public static final Atom POPUP
      • 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
      • 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
    • Constructor Detail

      • Atom

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

      • get

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

        public static Atom find​(java.lang.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​(java.lang.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​(java.lang.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 java.lang.String validateName​(java.lang.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 java.lang.String validateName​(java.lang.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 java.lang.String createValidName​(java.lang.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​(java.lang.Object atom)
        Checks if an atom equals to another.
        Overrides:
        equals in class java.lang.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 java.lang.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:
        java.lang.NullPointerException - if the specified object is null.
        java.lang.ClassCastException - if the specified object's type prevents it from being compared to this object.
      • getAtomName

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

        public java.lang.String toString()
        Converts the atom to a string in the format of atom[name].
        Overrides:
        toString in class java.lang.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 java.lang.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 java.lang.Object
        Returns:
        A "clone" of the atom, i.e. the same "this" Atom object.