trait NumberSource extends AnyRef
A NumberSource
is considered a master "pool" of numbers from which all numbers are available to be drawn.
The numbers are considered to be exclusive.
The following are guidelines for implementing classes.
The numbers allocated to this source are from zero up through positive integers.
When a number is drawn from the pool, it is flagged internally and can not be selected for drawing again until the flag is removed.
Some flagging states are allowed to restrict that number for the whole lifespan of the source.
This internal flagging is maintained by a "monitor" that should not directly get exposed.
Use the provided indirect referencing containers - SecureKey
and LoanedKey
.
The purpose of a NumberSource
is to help facilitate globally unique identifiers (GUID, pl. GUIDs).
- Source
- NumberSource.scala
- Alphabetic
- By Inheritance
- NumberSource
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def clear(): List[IdentifiableEntity]
Reset all number
Monitor
s so that their underlying number is not longer treated as assigned.Reset all number
Monitor
s so that their underlying number is not longer treated as assigned. Perform some level of housecleaning to ensure that all dependencies are resolved in some manner.- returns
a
List
of assignments maintained by all the currently-used numberMonitors
- abstract def countAvailable: Int
The count of numbers that can still be drawn.
The count of numbers that can still be drawn.
- returns
the count
- abstract def countDangling: Int
The count of numbers that can not be drawn but have not yet been assigned to an entity.
The count of numbers that can not be drawn but have not yet been assigned to an entity. Could only ever be a non-zero count if the number of used keys is a non-zero count.
- returns
the count
- abstract def countUsed: Int
The count of numbers that can not be drawn.
The count of numbers that can not be drawn.
- returns
the count
- abstract def get(obj: IdentifiableEntity): Option[SecureKey]
Produce an un-modifiable wrapper for the
Monitor
for this entity, if the entity is discovered being represented in this source.Produce an un-modifiable wrapper for the
Monitor
for this entity, if the entity is discovered being represented in this source.- obj
the entity
- returns
the wrapped
Monitor
- abstract def get(number: Int): Option[SecureKey]
Produce an un-modifiable wrapper for the
Monitor
for this number.Produce an un-modifiable wrapper for the
Monitor
for this number.- number
the number
- returns
the wrapped
Monitor
- abstract def getAvailable(number: Int): Option[LoanedKey]
Produce a modifiable wrapper for the
Monitor
for this number, only if the number has not been used.Produce a modifiable wrapper for the
Monitor
for this number, only if the number has not been used. TheMonitor
should be updated before being wrapped, if necessary.- number
the number
- returns
the wrapped
Monitor
, orNone
- abstract def max: Int
The maximum number that can be produced by this source.
The maximum number that can be produced by this source.
- returns
the max
- abstract def returnNumber(number: Int): Option[IdentifiableEntity]
Consume the number of a
Monitor
and release that number from its previous assignment/use.Consume the number of a
Monitor
and release that number from its previous assignment/use.- number
the number
- returns
any object previously using this number
- abstract def size: Int
The count of numbers allocated to this source.
The count of numbers allocated to this source.
- returns
the count
- abstract def test(number: Int): Boolean
Is this number a member of this number source?
Is this number a member of this number source?
- number
the number
- returns
true
, if it is a member;false
, otherwise
Concrete 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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def count(policy: AvailabilityPolicy): Int
Select the type of count desired based on the allocation policy of the key.
Select the type of count desired based on the allocation policy of the key.
- policy
the allocation policy
- returns
the number of keys belonging to this policy
- 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
- 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 returnNumber(monitor: LoanedKey): Option[IdentifiableEntity]
Consume a wrapped
Monitor
and release its number from its previous assignment/use.Consume a wrapped
Monitor
and release its number from its previous assignment/use.- monitor
the
Monitor
- returns
any object previously using this
Monitor
- def returnNumber(monitor: SecureKey): Option[IdentifiableEntity]
Consume a wrapped
Monitor
and release its number from its previous assignment/use.Consume a wrapped
Monitor
and release its number from its previous assignment/use.- monitor
the
Monitor
- returns
any object previously using this
Monitor
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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()