| | |
| | | package net.jacekk.bridge.android; |
| | | |
| | | /** |
| | | * Created by jacek on 18.01.15. |
| | | */ |
| | | import net.jacekk.bridge.BridgeInputException; |
| | | import net.jacekk.bridge.R; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class BridgeInputExceptionMapper { |
| | | public static final Map<BridgeInputException.Error, Integer> errorMap; |
| | | |
| | | static { |
| | | errorMap = new HashMap<>(); |
| | | errorMap.put(BridgeInputException.Error.CONTRACT_LEVEL_INVALID, R.string.invalid_level); |
| | | errorMap.put(BridgeInputException.Error.CONTRACT_SUIT_INVALID, R.string.invalid_color); |
| | | errorMap.put(BridgeInputException.Error.CONTRACT_DOUBLE_INVALID, R.string.invalid_contract); |
| | | errorMap.put(BridgeInputException.Error.PC_INVALID, R.string.invalid_pc); |
| | | errorMap.put(BridgeInputException.Error.TRICKS_INVALID, R.string.invalid_tricks); |
| | | errorMap.put(BridgeInputException.Error.PASSES_INVALID, R.string.invalid_passes); |
| | | } |
| | | |
| | | public static int map(BridgeInputException e) { |
| | | return errorMap.get(e.getError()); |
| | | } |
| | | } |