View Javadoc

1   /*
2    * Created on Sep 6, 2004 
3    * 
4    *   Magic-Project is a turn based strategy simulator
5    *   Copyright (C) 2003-2007 Fabrice Daugan
6    *
7    *   This program is free software; you can redistribute it and/or modify it 
8    * under the terms of the GNU General Public License as published by the Free 
9    * Software Foundation; either version 2 of the License, or (at your option) any
10   * later version.
11   *
12   *   This program is distributed in the hope that it will be useful, but WITHOUT 
13   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
15   * details.
16   *
17   *   You should have received a copy of the GNU General Public License along  
18   * with this program; if not, write to the Free Software Foundation, Inc., 
19   * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 }