abstract class NumberSelector extends AnyRef
The base class for all different sorts of number selection policies.
The Arrays called out as method parameters is always an Array of indexes for some other list.
The indices in the Array are always the complete range of 0 to n numbers.
It is recommended to initialize the Array with the rule array(number) = number.
When they need to be flagged as "invalid" in some way, use some consistent system of negative numbers.
(Recommendation: unless doing something fancy, just use -1.)
- Source
- NumberSelector.scala
- Alphabetic
- By Inheritance
- NumberSelector
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new NumberSelector()
Abstract Value Members
- abstract def Get(ary: Array[Int]): Int
Accept a provided
pooland select the next number.
The main requirement for valid implementation of aGetselector is atomicity.Accept a provided
pooland select the next number.
The main requirement for valid implementation of aGetselector is atomicity. WhileGetcould be written to run again for every failure, this should not be anticipated. A success means a "success." A failure means that no "success" would be possible no matter how many times it might be run under the current conditions. The aforementioned conditions may change depending on the nature of the specific selector; but, the previous requirement should not be violated.
Getis under no obligation to not modify its parameterArray. In fact, it should do this by default to provide additional feedback of its process. Pass a copy if data mutation is a concern.- ary
the
ArrayofIntnumbers from which to draw a new number- returns
an
Intnumber
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
- def Format(ary: Array[Int]): Unit
Accept the indexing pool from which numbers are selected and returned.
Accept the indexing pool from which numbers are selected and returned. Correct its format to suit the current
NumberSelectoralgorithms.
Moving all of the invalid negative-ones (-1) to the left of the current valid indices works for most selectors. TheselectionIndexis set to the first valid number available from the left. Theretindex is set to index zero.- ary
the
ArrayofIntnumbers
- def Return(number: Int, ary: Array[Int]): Boolean
Give a number back to a specific collection following the principles of this selector.
By default, a simple policy for returning numbers has been provided.Give a number back to a specific collection following the principles of this selector.
By default, a simple policy for returning numbers has been provided. This will not be sufficient for all selection actions that can be implemented sooverridewhere necessary.
returnNumberis under no obligation to leave its parameterArrayunmodified. In fact, it should modify it by default to provide additional feedback of its process. Pass a copy if data mutation is a concern.- number
the number to be returned
- ary
the
ArrayofIntnumbers to which the number is to be returned- returns
true, if this return was successful;false, otherwise
- def ReturnIndex: Int
- def SelectionIndex: Int
- 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
- 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()
- var ret: Int
The index for the selector when performing a number return action, then modified for the "next" index.
The index for the selector when performing a number return action, then modified for the "next" index.
- Attributes
- protected
- var selectionIndex: Int
The index for the selector when performing a number selection action, then modified to the "next" index.
The index for the selector when performing a number selection action, then modified to the "next" index.
- Attributes
- protected
- 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()