001package ball.game.card.poker;
002/*-
003 * ##########################################################################
004 * Game Applications and Utilities
005 * $Id: Poker.html 5431 2020-02-12 19:03:17Z ball $
006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/hcf-dev/blog/2019-10-29-java-enums-as-predicates/src/main/resources/javadoc/src-html/ball/game/card/poker/Poker.html $
007 * %%
008 * Copyright (C) 2010 - 2020 Allen D. Ball
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the "License");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 *
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 *
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an "AS IS" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * ##########################################################################
022 */
023import ball.game.card.Card;
024import java.util.function.Predicate;
025
026import static ball.game.card.Card.Rank.JACK;
027import static ball.game.card.Card.Rank.KING;
028import static ball.game.card.Card.Suit.HEARTS;
029import static ball.game.card.Card.Suit.SPADES;
030import static ball.game.card.Card.Suit.DIAMONDS;
031
032/**
033 * Poker-specific static fields and methods.
034 *
035 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
036 * @version $Revision: 5431 $
037 */
038public abstract class Poker {
039    private Poker() { }
040
041    /**
042     * {@link Predicate} to test for one-eyed
043     * {@link ball.game.card.Card.Rank#JACK JACK}
044     */
045    public Predicate<Card> ONE_EYED_JACK = JACK.and(SPADES.or(HEARTS));
046
047    /**
048     * {@link Predicate} to test for one-eyed
049     * {@link ball.game.card.Card.Rank#KING KING}
050     */
051    public Predicate<Card> ONE_EYED_KING = KING.and(DIAMONDS);
052
053    /**
054     * {@link Predicate} to test for "suicide"
055     * {@link ball.game.card.Card.Rank#KING KING}
056     */
057    public Predicate<Card> SUICIDE_KING = KING.and(HEARTS);
058}