PosCap implements Comparable<PosCap>, Serializable { public int ordinal() { return (capitalized ? PartOfSpeech.values().length : 0) + partOfSpeech.ordinal(); } private  PosCap(PartOfSpeech partOfSpeech, boolean capitalized); static PosCap getCapitalized(PartOfSpeech partOfSpeech); static PosCap getNotCapitalized(PartOfSpeech partOfSpeech); static PosCap create(PartOfSpeech partOfSpeech, boolean capitalized); static int cardinality(); static PosCap createFromOrdinal(int ordinal); PartOfSpeech getPartOfSpeech(); boolean isCapitalized(); int ordinal(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(PosCap o); @Override String toString();  }
@Test public void testOrdinal() { PosCap posCap = PosCap.create(PartOfSpeech.BOS, true); int ordinal = posCap.ordinal(); PosCap fromOrdinal = PosCap.createFromOrdinal(ordinal); assertEquals(fromOrdinal, posCap); }