abstract const class sys::Enum

sys::Obj
  sys::Enum

Source

Enum is the base class for enum classes defined using the enum keyword. An enum models a fixed range of discrete values. Each value has an Int ordinal and a Str name.

Every enum class implicitly has the following slots auto-generated by the compiler:

See Enums for details.

compare

virtual override Int compare(Obj obj)

Source

Compare based on ordinal value.

doFromStr

protected const static Enum? doFromStr(Type t, Str name, Bool checked)

Source

Protected fromStr implementation - for compiler use only. A public static fromStr method is always auto-generated by the compiler for each enum.

equals

virtual override Bool equals(Obj? obj)

Source

Enums are only equal if same instance using ===.

make

new make(Int ordinal, Str name)

Source

Protected constructor - for compiler use only.

name

Str name()

Source

Get the programatic name for this enum.

ordinal

Int ordinal()

Source

Return ordinal value which is a zero based index into values.

toStr

virtual override Str toStr()

Source

Always returns name().