|
| 1 | +/** |
| 2 | + * MIT License |
| 3 | + * <p> |
| 4 | + * Copyright (c) 2017 James |
| 5 | + * <p> |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * <p> |
| 13 | + * The above copyright notice and this permission notice shall be included in all |
| 14 | + * copies or substantial portions of the Software. |
| 15 | + * <p> |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | + * SOFTWARE. |
| 23 | + */ |
| 24 | +package me.zbl.chain; |
| 25 | + |
| 26 | +/** |
| 27 | + * 请求 |
| 28 | + */ |
| 29 | +public class Request { |
| 30 | + |
| 31 | + private boolean isHandled; |
| 32 | + private final String description; |
| 33 | + private final RequestType type; |
| 34 | + |
| 35 | + protected Request(String description, RequestType type) { |
| 36 | + this.description = description; |
| 37 | + this.type = type; |
| 38 | + } |
| 39 | + |
| 40 | + public boolean isHandled() { |
| 41 | + return isHandled; |
| 42 | + } |
| 43 | + |
| 44 | + public void setHandled(boolean handled) { |
| 45 | + isHandled = handled; |
| 46 | + } |
| 47 | + |
| 48 | + public String getDescription() { |
| 49 | + return description; |
| 50 | + } |
| 51 | + |
| 52 | + public RequestType getType() { |
| 53 | + return type; |
| 54 | + } |
| 55 | + |
| 56 | + public void markRequest() { |
| 57 | + setHandled(true); |
| 58 | + } |
| 59 | + |
| 60 | + @Override |
| 61 | + public String toString() { |
| 62 | + return getDescription(); |
| 63 | + } |
| 64 | + |
| 65 | + public enum RequestType { |
| 66 | + // 射击 |
| 67 | + SHOOTING, |
| 68 | + // 航行 |
| 69 | + SAILING, |
| 70 | + // 待命 |
| 71 | + AWAIT_ORDERS |
| 72 | + } |
| 73 | +} |
0 commit comments