Class: OrdinalMagnitude

Environment: Siren
Superclass: Siren.MusicMagnitude
Category: Music-Models-Implementation
Instance variables: table
Class instance variables: Table

Instances of the OrdinalMagnitude classes are order-only magnitudes.
They use the instance or class instance tables for holding comparative relationships among instances (e.g., mag1 might know that it's > mag2).
The relation-setting (i.e., order assignment) messages are: ==, >>, <<, =<, and =>.
The query messages are: =?, > < <=, and >=.

Each subclass may decide whether instances or the class will hold the table of relationships.
The decision should be made on the basis of the expected number of magnitude instances and the sparseness of their relationships.

See the subclass' class examples.

Instance Variable:
table Symbol> instance rel. table

Class Instance Variable:
Table Symbol> class rel. table of all instances

accessing

hash
Answer a SmallInteger unique to the receiver. Essential. See
Object documentation whatIsAPrimitive.

table
Answer the receiver's loop-up table--its or the class'.

value
Signal an error.

value: theValue
Signal an error.

initialize-release

release
Release the receiver's table.

printing

printOn: aStream
Print the receiver as an ordinal magnitude.

converting

mostGeneral
Answer that it is an error to attempt coercion with ordinal magnitudes.

ordering

< anotherOMag
Answer whether the receiver is less than the argument.

<< anotherOMag
Specify that the receiver is less than the argument.

<= anotherOMag
Answer whether the receiver is less than or equal to the argument.

=< anotherOMag
Specify that the receiver is less than or equal to the argument.

== anotherOMag
Specify that the receiver is equal to the argument.

=> anotherOMag
Specify that the receiver is greater than or equal to the argument.

=? anotherOMag
Answer whether the receiver is equal to the argument.

> anotherOMag
Answer whether the receiver is greater than the argument.

>= anotherOMag
Answer whether the receiver is greater than or equal to the argument.

>> anotherOMag
Specify that the receiver is greater than the argument.

arithmetic

* aValue
Answer that it is an error to attempt arithmetic with ordinal magnitudes.

+ aValue
Answer that it is an error to attempt arithmetic with ordinal magnitudes.

- aValue
Answer that it is an error to attempt arithmetic with ordinal magnitudes.

/ aValue
Answer that it is an error to attempt arithmetic with ordinal magnitudes.

= aValue
Answer whether the receiver and the argument are equivalent.

MetaClass: OrdinalMagnitude class

Instance variables: Table

table access

table
Answer the class' instance look-up table.

values
Answer the sorted values.

instance creation

new
Answer a new instance and, if it's in use, add it to the table.

value: aValue
Answer an instance

class initialization

flush
Release the shared class table and all instances.

useTable
Set up a shared class table for all instances.