source: src/main/java/genius/core/session/InvalidActionError.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 1.5 KB
Line 
1package genius.core.session;
2
3import java.util.List;
4
5import genius.core.actions.Action;
6import genius.core.parties.NegotiationParty;
7
8/**
9 * Error that will be thrown when an action that is not valid for the given
10 * round. At this moment (September 2014) The
11 * {@link genius.core.session.SessionManager} detects these invalid actions and
12 * throws this error.
13 */
14@SuppressWarnings("serial")
15public class InvalidActionError extends ActionException {
16 /**
17 * Holds the party that did an invalid action
18 */
19 private final NegotiationParty instigator;
20 private List<Class<? extends Action>> allowed;
21 private Action found;
22
23 /**
24 * Initializes a new instance of the {@link InvalidActionError} class.
25 *
26 * @param instigator
27 * The party that did an invalid action.
28 * @param allowed
29 * the list of allowed actions
30 * @param found
31 * the actual taken action
32 */
33 public InvalidActionError(NegotiationParty instigator,
34 List<Class<? extends Action>> allowed, Action found) {
35 this.instigator = instigator;
36 this.allowed = allowed;
37 this.found = found;
38 }
39
40 /**
41 * Gets the party that did an invalid action
42 *
43 * @return The party that did an invalid action.
44 */
45 @SuppressWarnings("UnusedDeclaration")
46 // might be used in future
47 public NegotiationParty getInstigator() {
48 return instigator;
49 }
50
51 public String toString() {
52 return "Invalid action by " + instigator + ". Expected one from "
53 + allowed + " but actual action was " + found;
54 }
55}
Note: See TracBrowser for help on using the repository browser.