in scala
class Enumeration

abstract class Enumeration
extends java.lang.Object
with 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 with 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 => System.out.println(d) }
  }
  
param:
initial the initial integer value associated with the first element
param:
names the sequence of element names of the enumeration
author:
Matthias Zenger
version:
1.0, 10/02/04

Constructor Summary
def this

def this ( initial : scala.Int , names : scala.<repeated> )

def this ( names : scala.<repeated> )



Class Summary
protected class Val

abstract class Value



Def Summary
final protected def Value ( i : scala.Int ) : Value

final protected def Value ( i : scala.Int , name : java.lang.String ) : Value

final protected def Value ( name : java.lang.String ) : Value

final protected def Value : Value

final def apply ( x : scala.Int ) : Value
Returns the enumeration value for the given id.
final def elements : Iterator
Returns all values of this enumeration.
def exists ( p : Function1 ) : scala.Boolean

def filter ( p : Function1 ) : Iterator

def flatMap [ b ] ( f : Function1 ) : Iterator

def forall ( p : Function1 ) : scala.Boolean

def foreach ( f : Function1 ) : scala.Unit

def map [ b ] ( f : Function1 ) : Iterator

final def maxId : scala.Int

def name : java.lang.String

override def toString : java.lang.String



Constructor Detail
def this

def this ( initial : scala.Int , names : scala.<repeated> )

def this ( names : scala.<repeated> )

Def Detail
final protected def Value ( i : scala.Int ) : Value

final protected def Value ( i : scala.Int , name : java.lang.String ) : Value

final protected def Value ( name : java.lang.String ) : Value

final protected def Value : Value

final def apply ( x : scala.Int ) : Value
Returns the enumeration value for the given id.

final def elements : Iterator
Returns all values of this enumeration.

def exists ( p : Function1 ) : scala.Boolean

def filter ( p : Function1 ) : Iterator

def flatMap [ b ]( f : Function1 ) : Iterator

def forall ( p : Function1 ) : scala.Boolean

def foreach ( f : Function1 ) : scala.Unit

def map [ b ]( f : Function1 ) : Iterator

final def maxId : scala.Int

def name : java.lang.String

override def toString : java.lang.String