# PSF-LoginServer - master - net.psforever.objects.guid.source.NumberSource
PSF - LoginServer - master - net.psforever.objects.guid.source.NumberSource
Keywords: PSF LoginServer master net.psforever.objects.guid.source.NumberSource

PSF-LoginServer - master < Back


# Packages

-  package root
  Definition Classes
    root
-  package net
  Definition Classes
    root
-  package psforever
  Definition Classes
    net
-  package objects
  Definition Classes
    psforever
-  package guid
  Definition Classes
    objects
-  package source
  Definition Classes
    guid
- MaxNumberSource
- NumberSource
- SpecificNumberSource

t

net.psforever.objects.guid.source

# NumberSource

###

#### 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

Linear Supertypes
AnyRef, Any
Known Subclasses
MaxNumberSource, SpecificNumberSource

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. NumberSource
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Abstract Value Members

1.  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. This is the only way to free `Monitors` that are marked as `Restricted`.

   returns

     a `List` of assignments maintained by all the currently-used number `Monitors`

2.  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

3.  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

4.  abstract def finalizeRestrictions: List[Int]

   Numbers from this source may not longer be marked as `Restricted`.

   Numbers from this source may not longer be marked as `Restricted`.

   returns

     the `List` of all numbers that have been restricted

5.  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`

6.  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`

7.  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. The `Monitor` should be updated before being wrapped, if necessary.

   number

     the number

   returns

     the wrapped `Monitor`, or `None`

8.  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

9.  abstract def restrictNumber(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. This wrapped `Monitor` can only be assigned once and the number may not be `returnNumber`ed to this source.

   number

     the number

   returns

     the wrapped `Monitor`

10.  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

11.  abstract def size: Int

    The count of numbers allocated to this source.

    The count of numbers allocated to this source.

    returns

      the count

12.  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

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##: Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.CloneNotSupportedException]) @native()
6.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
7.  def equals(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef → Any
8.  def finalize(): Unit
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.Throwable])
9.  final def getClass(): Class[_ <: AnyRef]
   Definition Classes
     AnyRef → Any
   Annotations
     @native()
10.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
11.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
12.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
13.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
14.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
15.  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`

16.  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`

17.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
18.  def toString(): String
    Definition Classes
      AnyRef → Any
19.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
20.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
21.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()

### Inherited from AnyRef

### Inherited from Any

### Ungrouped