scala.Enumeration

class SetXX

[source: scala/Enumeration.scala]

abstract class SetXX
extends Set[Value]
A set that efficiently stores enumeration values as bits.
Author
Sean McDirmid
Examples
    object flags extends Enumeration {
      val Public = Value(5, "public");
      val Private = Value(4, "private");
      val Protected = Value(6, "protected");
      val Final = Value(7, "final");
    }
  
    class Entity {
      var flags0 : Int = ...;
      def flags = flags.Set32(flags0);
    } 
  
    val e : Entity = ...;
  
    if (e.flags.contains(flags.Private))
      e.flags0 = (e.flags | flags.Final).underlying; 
    
Direct Known Subclasses:
Enumeration.Set32, Enumeration.Set64

Type Summary
abstract type TSet <: SetXX
abstract type Underlying <: AnyVal
either Int or Long
Value Summary
abstract val underlying : Underlying
The integer that bit-encodes a set of enumeration values.
Method Summary
abstract def & (set : TSet) : TSet
Equivalent to * for bit sets. Returns a bit set that has all values that are both in this and set.
abstract def &~ (value : Value) : TSet
Equivalent to - for bit sets. Returns a bit set that has all values in this except for value.
def ** (set : TSet) : TSet
def + (value : Value) : TSet
Create a new set with an additional element.
def ++ (set : TSet) : TSet
def - (value : Value) : TSet
Remove a single element from a set.
def elements : Iterator[Value]
Creates a new iterator over all elements contained in this object.
def empty [B] : Set[B]
def size : Int
Returns the number of elements in this set.
override def stringPrefix : java.lang.String
Defines the prefix of this object's toString representation.
protected abstract def underlyingAsLong : Long
returns the underlying integer representation of this set as a long.
abstract def | (set : TSet) : TSet
Equivalent to ++ for bit sets. Returns a set that has all values in this and set.
abstract def | (value : Value) : TSet
Equivalent to + for bit sets. Returns a set that has all values in this with the addition of value.
Methods inherited from Set
+, ++, ++, incl, incl, -, --, --, excl, excl, intersect, **, map, flatMap, filter
Methods inherited from Set
contains (abstract), apply, isEmpty, subsetOf, *, equals, hashCode, toArray
Methods inherited from Collection
toString
Methods inherited from Iterable
concat, ++, partition, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toSeq, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, projection, hasDefiniteSize
Methods inherited from Function1
compose, andThen
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Type Details
abstract type Underlying <: AnyVal
either Int or Long

abstract type TSet <: SetXX

Value Details
abstract val underlying : Underlying
The integer that bit-encodes a set of enumeration values.

Method Details
protected abstract def underlyingAsLong : Long
returns the underlying integer representation of this set as a long.

abstract def |(set : TSet) : TSet
Equivalent to ++ for bit sets. Returns a set that has all values in this and set.

abstract def |(value : Value) : TSet
Equivalent to + for bit sets. Returns a set that has all values in this with the addition of value.

abstract def &(set : TSet) : TSet
Equivalent to * for bit sets. Returns a bit set that has all values that are both in this and set.

abstract def &~(value : Value) : TSet
Equivalent to - for bit sets. Returns a bit set that has all values in this except for value.

def -(value : Value) : TSet
Remove a single element from a set.
Parameters
elem - the element to be removed
Returns
a new set with the element removed.
Overrides
Set.-

def +(value : Value) : TSet
Create a new set with an additional element.
Overrides
Set.+

def ++(set : TSet) : TSet

def **(set : TSet) : TSet

def size : Int
Returns the number of elements in this set.
Returns
number of set elements.

override def stringPrefix : java.lang.String
Defines the prefix of this object's toString representation.

def elements : Iterator[Value]
Creates a new iterator over all elements contained in this object.
Returns
the new iterator

def empty[B] : Set[B]
Returns
an empty set of arbitrary element type
Overrides
Set.empty