Skip to contentPackage: C4BoardValidatorInfo
C4BoardValidatorInfo
Coverage
      1: package de.fhdw.gaming.ipspiel23.c4.domain.impl.validation;
2: 
3: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MIN_COLUMN_COUNT;
4: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MIN_ROW_COUNT;
5: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MAX_COLUMN_COUNT;
6: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MAX_ROW_COUNT;
7: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MAX_FIELD_COUNT;
8: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MIN_SOLUTION_SIZE;
9: import static de.fhdw.gaming.ipspiel23.c4.domain.impl.validation.C4BoardLimits.MAX_SOLUTION_SIZE;
10: 
11: /**
12:  * Provides info for the board validators.
13:  */
14: public enum C4BoardValidatorInfo {
15:     /**
16:      * Provides info for the row count validator.
17:      */
18:     ROW_COUNT {
19:         @Override
20:         public String toInfoString(final int playerCount) {
21:             return String.format("The row count must be greater than or equal to %d.\n"
22:                     + "The row count must not exceed %d.\n"
23:                     + "Row count * column count must not exceed %d.\n"
24:                     + "Row count * column count must be less than %d * solution size.", 
25:                     MIN_ROW_COUNT, 
26:                     MAX_ROW_COUNT,
27:                     MAX_FIELD_COUNT,
28:                     playerCount);
29:         }
30:     },
31:     /**
32:      * Provides info for the column count validator.
33:      */
34:     COLUMN_COUNT {
35:         @Override
36:         public String toInfoString(final int playerCount) {
37:             return String.format("The column count must be greater than or equal to %d.\n"
38:                     + "The column count must not exceed %d.\n"
39:                     + "Row count * column count must not exceed %d.\n"
40:                     + "Row count * column count must be less than %d * solution size.", 
41:                     MIN_COLUMN_COUNT, 
42:                     MAX_COLUMN_COUNT,
43:                     MAX_FIELD_COUNT,
44:                     playerCount);
45:         }
46:     },
47:     /**
48:      * Provides info for the solution size validator.
49:      */
50:     SOLUTION_SIZE {
51:         @Override
52:         public String toInfoString(final int playerCount) {
53:             return String.format("The solution size must be greater than or equal to %d.\n"
54:                     + "The solution size must not exceed %d.\n"
55:                     + "The solution size must not exceed the numbers of rows and columns on the board.\n"
56:                     + "%d * solution size must be greater than row count * column count.", 
57:                     MIN_SOLUTION_SIZE, 
58:                     MAX_SOLUTION_SIZE,
59:                     playerCount);
60:         }
61:     };
62:     /**
63:      * Provides info for the different board validators.
64:      * @param playerCount the number of players.
65:      */
66:     public abstract String toInfoString(int playerCount);
67: }