All Downloads are FREE. Search and download functionalities are using the official Maven repository.

za.co.knowles.pokewhat.domain.lookup.ERank Maven / Gradle / Ivy

package za.co.knowles.pokewhat.domain.lookup;

import za.co.knowles.pokewhat.domain.Card;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public enum ERank {
    TWO(2, "2"), THREE(3, "3"), FOUR(4, "4"), FIVE(5, "5"),
    SIX(6, "6"), SEVEN(7, "7"), EIGHT(8, "8"), NINE(9, "9"), TEN(10, "10"),
    JACK(11, "J"), QUEEN(12, "Q"), KING(13, "K"), ACE(14, "A");

    public static final List FULL_DECK;

    static {
        ArrayList buildDeck = new ArrayList<>();
        for (ERank value : values()) {
            for (ESuit suit : ESuit.values()) {
                buildDeck.add(value.of(suit));
            }
        }

        FULL_DECK = Collections.unmodifiableList(buildDeck);
    }

    private final int numeric;
    private final String name;

    ERank(int numeric, String name) {
        this.numeric = numeric;
        this.name = name;
    }

    public Card of(ESuit suit) {
        return new Card(suit, this);
    }

    public int getNumeric() {
        return numeric;
    }

    @Override
    public String toString() {
        return name;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy