class NumberPoolHub extends AnyRef
A master object that manages NumberPool
s when they are applied to a single NumberSource
.
It catalogs the numbers and ensures the pool contents are unique to each other.
All globally unique numbers are sorted into user-defined groups called pools.
Pools are intended to pre-allocate certain numbers to certain tasks.
Two default pools also exist - "generic," for all numbers not formally placed into a pool, and a hidden restricted pool.
The former can accept a variety of numbers on the source not known at initialization time loaded into it.
The latter can only be set by the NumberSource
and can not be affected once this object is created.
- Source
- NumberPoolHub.scala
- Alphabetic
- By Inheritance
- NumberPoolHub
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new NumberPoolHub(source: NumberSource)
- source
the number source object
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def AddPool(name: String, pool: List[Int]): NumberPool
Create a new number pool with the given label and the given numbers.
Creating number pools is a task that should only be performed at whatever counts as the initialization stage.Create a new number pool with the given label and the given numbers.
Creating number pools is a task that should only be performed at whatever counts as the initialization stage. Nothing technically blocks it being done during runtime; however, stability is best served by doing it only once and while nothing else risk affecting the numbers. Unlike "live" functionality which often returns asSuccess
orFailure
, this is considered a critical operation. As thus,Exceptions
are permitted since a fault of the pool's creation will disrupt normal operations.- name
the name of the pool
- pool
the
List
of numbers that will belong to the pool- returns
the newly-created number pool
- Exceptions thrown
IllegalArgumentException
if the pool's name is already defined; if the pool is (already) empty; if the pool contains numbers the source does not; if the pool contains numbers from already existing pools
- def GetPool(name: String): Option[NumberPool]
Get the number pool known by this name.
Get the number pool known by this name. It will not return correctly for any number that is in the "restricted" pool.
- name
the name of the pool
- returns
a reference to the number pool, or
None
- def Numbers: List[Int]
- def Pools: HashMap[String, NumberPool]
na
na
- returns
na
- def RemovePool(name: String): List[Int]
Remove an existing number pool with the given label from the list of number pools.
Removing number pools is a task that should only be performed at whatever counts as the termination stage.Remove an existing number pool with the given label from the list of number pools.
Removing number pools is a task that should only be performed at whatever counts as the termination stage. All the same reasoning applies as withAddPool
above. Although an easy operation would move all the assigned numbers in the removing pool to the "generic" pool, doing so is ill-advised both for the reasoning above and because that creates unreliability.- name
the name of the pool
- returns
the
List
of numbers that belonged to the pool
- Exceptions thrown
IllegalArgumentException
if the pool doesn't exist or is not removed (removable)
- def WhichPool(obj: IdentifiableEntity): Option[String]
Reference a specific number's pool.
WhichPool(IdentifiableEntity)
does require the object to be registered to be found.Reference a specific number's pool.
WhichPool(IdentifiableEntity)
does require the object to be registered to be found. It checks that the object is registered, and that it is registered to the local source object.- obj
an object
- returns
the name of the number pool to which this item belongs
- def WhichPool(number: Int): Option[String]
Reference a specific number's pool.
WhichPool(Int)
does not require the number to be registered at the time it is used.Reference a specific number's pool.
WhichPool(Int)
does not require the number to be registered at the time it is used. It does not return anything for an unregistered unpooled number - a number that would be part of the "generic" nonstandard pool. It only reports "generic" if that number is registered. It will not return correctly for any number that is in the "restricted" pool.- number
a number
- returns
the name of the number pool to which this item belongs
- def apply(number: Int): Option[IdentifiableEntity]
Given a globally unique identifier, return any object registered to it.
Use:
Forval obj = new NumberPoolHub(...)
useobj(number)
.Given a globally unique identifier, return any object registered to it.
Use:
Forval obj = new NumberPoolHub(...)
useobj(number)
.- number
the unique number to attempt to retrieve from the
source
- returns
the object that is assigned to the number
- def apply(number: PlanetSideGUID): Option[IdentifiableEntity]
Given a globally unique identifier, return any object registered to it.
Use:
Forval obj = new NumberPoolHub(...)
useobj(number)
.Given a globally unique identifier, return any object registered to it.
Use:
Forval obj = new NumberPoolHub(...)
useobj(number)
.- number
the unique number to attempt to retrieve from the
source
- returns
the object that is assigned to the number
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isRegistered(number: Int): Boolean
Determines if the number is registered.
Two conditions are necessary to determine this condition for numbers.Determines if the number is registered.
Two conditions are necessary to determine this condition for numbers. (1) A registered number is known to thesource
. (2) A register number is known asLeased
to thesource
.- number
the number previously assigned(?)
- returns
true
, if the number is registered;false
, otherwise
- See also
isRegistered(IdentifiableEntity)
- def isRegistered(obj: IdentifiableEntity): Boolean
Determines if the object is registered.
Three conditions are necessary to determine this condition for objects.Determines if the object is registered.
Three conditions are necessary to determine this condition for objects. (1) A registered object has a globally unique identifier. (2) A registered object is known to thesource
by that identifier. (3) The registered object can be found attached to that entry from the source.- obj
an object
- returns
true
, if the number is registered;false
, otherwise
- See also
isRegistered(Int)
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def register(name: String): Try[LoanedKey]
Register a number selected automatically from the named pool.
Register a number selected automatically from the named pool.
- name
the local pool name
- returns
the monitor for a number
- def register(number: Int): Try[LoanedKey]
Register a specific number.
Register a specific number.
- number
the number whose assignment is requested
- returns
the monitor for a number
- def register(obj: IdentifiableEntity, name: String): Try[Int]
Register an object to a specific number pool.
Register an object to a specific number pool.
- obj
an object being registered
- name
the local pool name
- returns
the number the was given to the object
- def register(obj: IdentifiableEntity, number: Int): Try[Int]
Register an object to a specific number if it is available.
Register an object to a specific number if it is available.
- obj
an object being registered
- number
the number whose assignment is requested
- returns
the number the was given to the object
- def register(obj: IdentifiableEntity): Try[Int]
Register an object to any available selection (of the "generic" number pool).
Register an object to any available selection (of the "generic" number pool).
- obj
an object being registered
- returns
the number the was given to the object
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unregister(number: Int): Try[Option[IdentifiableEntity]]
Unregister a specific number.
Unregister a specific number.
- number
the number previously assigned(?)
- returns
the object, if any, previous associated with the number
- def unregister(obj: IdentifiableEntity): Try[Int]
Unregister a specific object.
Unregister a specific object.
- obj
an object being unregistered
- returns
the number previously associated with the object
- def unregister_GetMonitorFromObject(obj: IdentifiableEntity, msg: String = "can not find this object"): Try[Int]
Unregister a specific object by actually finding the object itself, if it exists.
Unregister a specific object by actually finding the object itself, if it exists.
- obj
an object being unregistered
- msg
custom error message; has a vague default
- returns
the number associated with this object
- def unregister_GetPoolFromObject(obj: IdentifiableEntity): Try[NumberPool]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()