Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nodename/Ultimate-Enum
The ultimate enum for AS3
https://github.com/nodename/Ultimate-Enum
Last synced: 2 months ago
JSON representation
The ultimate enum for AS3
- Host: GitHub
- URL: https://github.com/nodename/Ultimate-Enum
- Owner: nodename
- Created: 2010-10-02T05:55:43.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-10-14T03:00:34.000Z (over 14 years ago)
- Last Synced: 2024-08-04T05:06:04.527Z (6 months ago)
- Language: ActionScript
- Homepage: http://nodename.com/blog/2010/10/13/the-arrogant-enum/
- Size: 250 KB
- Stars: 23
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
- awesome-actionscript-sorted - Ultimate-Enum - The ultimate enum for AS3 (Unsorted / Other API)
README
Goals
-----finite:
closed: programmer may neither add nor remove values at run time
generic: an enumerated type should not be required to extend any particular base class,
nor should its constructor be required to have any particular parameter typesextensible: ability to define a derived enumerated type each of whose values IS-A parent enumerated type
orderable: programmer should be able to specify an ordering on the set if desired. There shall
be no implicit ordering based on the order of declaration.iterable: programmer should be able to iterate over the values of the type
or over the union of the values of more than one type (derived or not),
in the order (if any) that the programmer has specifiedcomparable: comparison operators > >= < <= should work by comparing the ordering of the enumerated values
non-exclusive: programmer should be able to declare other public static members of the class that are not
included in the set of enumerated values, for example a default value referring to one of the enumerated
valuesserializable: ability to write an enum value to a stream and read back the identical value object
Implementation
--------------The enumerated type corresponding to an enumClass consists of the static consts of the enumClass
that are of type enumClass and are tagged with [Enum]. The Enum tag allows an optional integer parameter named "ordinal".The class must be registered with the call Enumeration.registerClass(classObject) before any of the enum operations are used. Typically, the class itself will call Enumeration.registerClass() as a static initializer, with itself as argument; for example a class MyEnum should call Enumeration.registerClass(MyEnum). See the example enum classes in the examples folder under src_test.
You can download the compiled swc to link into your projects, or build from source. If you build from source, be sure to use the compiler flag keep-as3-metadata+=Enum in your library (or main program, if you build Ultimate Enum directly into it) to preserve the [Enum] tags in your enumerated classes.