1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.formalisms.process;
11
12 import java.io.DataInput;
13 import java.io.IOException;
14
15 import nl.tudelft.simulation.dsol.interpreter.Operation;
16 import nl.tudelft.simulation.dsol.interpreter.operations.InterpreterFactory;
17 import nl.tudelft.simulation.dsol.interpreter.operations.reflection.INVOKEINTERFACE;
18 import nl.tudelft.simulation.dsol.interpreter.operations.reflection.INVOKESPECIAL;
19 import nl.tudelft.simulation.dsol.interpreter.operations.reflection.INVOKESTATIC;
20 import nl.tudelft.simulation.dsol.interpreter.operations.reflection.INVOKEVIRTUAL;
21
22 /***
23 * A InterpreterFactory <br>
24 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
25 * University of Technology </a>, the Netherlands. <br>
26 * See for project information <a
27 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
28 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
29 * License (GPL) </a>, no warranty <br>
30 *
31 * @version 1.0 Jan 14, 2004 <br>
32 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
33 * Jacobs </a>
34 */
35 public class ProcessFactory extends InterpreterFactory
36 {
37 /***
38 * constructs a new InterpreterFactory
39 */
40 public ProcessFactory()
41 {
42 super();
43 }
44
45 /***
46 * reads a sequence of bytes and returns the appropriate bytecode
47 * operations.
48 *
49 * @param operand the operatand (short value)
50 * @param dataInput the dataInput to read from
51 * @param startBytePostion the position in the current block of bytecode.
52 * @return the assemnbly Operation
53 * @throws IOException on IO exception
54 */
55 public Operation readOperation(final int operand,
56 final DataInput dataInput, final int startBytePostion)
57 throws IOException
58 {
59 switch (operand)
60 {
61 case INVOKEINTERFACE.OP :
62 return new PROCESSINVOKEINTERFACE(dataInput);
63 case INVOKESPECIAL.OP :
64 return new PROCESSINVOKESPECIAL(dataInput);
65 case INVOKESTATIC.OP :
66 return new PROCESSINVOKESTATIC(dataInput);
67 case INVOKEVIRTUAL.OP :
68 return new PROCESSINVOKEVIRTUAL(dataInput);
69 default :
70 return super
71 .readOperation(operand, dataInput, startBytePostion);
72 }
73 }
74 }