Beispiel #1
0
  /**
   * This util method will be used to return an instance of Face for the specified value.
   *
   * <p>A null will be return if the specified input is not a valid face value.
   *
   * @param value
   * @return
   */
  public static Face getFace(String value) {

    for (Face face : Face.values()) {

      // ignore case
      if (face.getSymbol().equalsIgnoreCase(value)) {
        return face;
      }
    }

    return null;
  }
Beispiel #2
0
 static {
   for (Suit suit : Suit.values())
     for (Face face : Face.values()) theDeck.add(new Card(face, suit));
 }
Beispiel #3
0
 /**
  * Returns a Face according to the specified ID
  *
  * @param id id of face
  * @return face
  */
 public static Face fromId(final int id) {
   for (Face e : Face.values()) if (e.id == id) return e;
   return null;
 }