EnumDiscriminator

An EnumDiscriminator discriminates any Enum objects. It discriminates objects by calling the ordinal() method on the enum values. Then it delegates to an IntegerDiscriminator to discriminate the ordinal values.

Example

Given the enum class...

public enum Suit
{
    CLUBS, DIAMONDS, SPADES, HEARTS;
}
            

... and the input...

  • {Suit.DIAMONDS, Suit.CLUBS, Suit.CLUBS, Suit.CLUBS, Suit.SPADES, Suit.HEARTS, Suit.SPADES, Suit.DIAMONDS}

... an EnumDiscriminator returns the following equivalence classes:

  • {Suit.HEARTS}
  • {Suit.DIAMONDS, Suit.DIAMONDS}
  • {Suit.CLUBS, Suit.CLUBS, Suit.CLUBS}
  • {Suit.SPADES, Suit.SPADES}