001package ball.game.card.trick.bridge; 002/*- 003 * ########################################################################## 004 * Game Applications and Utilities 005 * $Id: Position.java 5285 2020-02-05 04:23:21Z ball $ 006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/ball-game/trunk/src/main/java/ball/game/card/trick/bridge/Position.java $ 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 */ 023 024/** 025 * Bridge position {@link Enum} type. 026 * 027 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball} 028 * @version $Revision: 5285 $ 029 */ 030public enum Position { 031 SOUTH, WEST, NORTH, EAST; 032 033 /** 034 * Method to determine the {@link Position} to the left of the argument 035 * {@link Position}. 036 * 037 * @param right The right {@link Position}. 038 * 039 * @return The {@link Position} to the left. 040 */ 041 public static Position leftOf(Position right) { 042 Position left = null; 043 044 switch (right) { 045 case SOUTH: 046 default: 047 left = WEST; 048 break; 049 050 case WEST: 051 left = NORTH; 052 break; 053 054 case NORTH: 055 left = EAST; 056 break; 057 058 case EAST: 059 left = SOUTH; 060 break; 061 } 062 063 return left; 064 } 065}