|
Scala 2.3.2
|
abstract
class
Enumeration
extends
java.lang.Object
with
scala.ScalaObject
The class Enumeration
provides the same functionality as the
enum
construct found in C-like languages like C++ or Java.
Here is an example:
object Main extends Application { object WeekDays extends Enumeration { val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value } def isWorkingDay(d: WeekDays.Value) = ! (d == WeekDays.Sat || d == WeekDays.Sun) WeekDays filter (isWorkingDay) foreach { d => Console.println(d) } }
initial -
the initial integer value associated with the first element
names -
the sequence of element names of the enumeration
Class Summary | |
protected
|
class
Val
|
abstract
|
class
Value
|
Constructor Summary | |
def
this
|
|
def
this
(initial: scala.Int, names: java.lang.String*)
|
|
def
this
(names: java.lang.String*)
|
Var Summary | |
protected
|
var
nextId
: scala.Int
|
protected
|
var
nextName
: scala.Iterator[java.lang.String]
|
Constructor Detail |
def
this
def
this
(initial: scala.Int, names: java.lang.String*)
def
this
(names: java.lang.String*)
Var Detail |
Def Detail |
final protected
def
Value
(i: scala.Int): Enumeration.this.Value
final protected
def
Value
(i: scala.Int, name: java.lang.String): Enumeration.this.Value
final protected
def
Value
(name: java.lang.String): Enumeration.this.Value
final protected
def
Value
: Enumeration.this.Value
final
def
apply
(x: scala.Int): Enumeration.this.Value
final
def
elements
: scala.Iterator[Enumeration.this.Value]
def
exists
(p: (Enumeration.this.Value) => scala.Boolean): scala.Boolean
def
filter
(p: (Enumeration.this.Value) => scala.Boolean): scala.Iterator[Enumeration.this.Value]
def
flatMap
[b](f: (Enumeration.this.Value) => scala.Iterator[b]): scala.Iterator[b]
def
forall
(p: (Enumeration.this.Value) => scala.Boolean): scala.Boolean
def
foreach
(f: (Enumeration.this.Value) => scala.Unit): scala.Unit
def
map
[b](f: (Enumeration.this.Value) => b): scala.Iterator[b]
final
def
maxId
: scala.Int
def
name
: java.lang.String
override
def
toString
: java.lang.String