1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package net.sf.magicproject.modifier;
23
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.OutputStream;
27
28 /***
29 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
30 */
31 public enum ModifierType {
32
33 /***
34 * Simple modifier section
35 */
36 REGISTER_MODIFIER,
37
38 /***
39 * Id card modifier
40 */
41 IDCARD_MODIFIER,
42
43 /***
44 * property modifier
45 */
46 PROPERTY_MODIFIER,
47
48 /***
49 * register-indirection modifier
50 */
51 REGISTER_INDIRECTION,
52
53 /***
54 * Color modifier
55 */
56 COLOR_MODIFIER,
57
58 /***
59 * A static modifier
60 */
61 STATIC_MODIFIER,
62
63 /***
64 * Controller modifier
65 */
66 CONTROLLER_MODIFIER,
67
68 /***
69 * Playable zone modifier
70 */
71 PLAYABLE_ZONE_MODIFIER,
72
73 /***
74 * Ability modifier
75 */
76 ABILITY_MODIFIER,
77
78 /***
79 * Object modifier
80 */
81 OBJECT_MODIFIER,
82
83 /***
84 * Additionnal cost modifier
85 */
86 ADDITIONAL_COST_MODIFIER;
87
88 /***
89 * Write this enum to the given outputstream.
90 *
91 * @param out
92 * the stream ths enum would be written.
93 * @throws IOException
94 * If some other I/O error occurs
95 */
96 public void serialize(OutputStream out) throws IOException {
97 out.write(ordinal());
98 }
99
100 /***
101 * Read and return the enum from the given inputstream.
102 *
103 * @param input
104 * the stream containing the enum to read.
105 * @return the enum from the given inputstream.
106 * @throws IOException
107 * If some other I/O error occurs
108 */
109 public static ModifierType deserialize(InputStream input) throws IOException {
110 return values()[input.read()];
111 }
112
113 /***
114 * The internal layer : high priority means proceeded first.
115 */
116 public static final int INTERNAL_LAYER = 0;
117
118 /***
119 * normal modifier priority.
120 */
121 public static final int NORMAL_LAYER = 1;
122
123 /***
124 * The global layer :low priority means proceeded last.
125 */
126 public static final int GLOBAL_LAYER = 2;
127 }