Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ConversionInstruction.java

00001 package de.fub.bytecode.generic;
00002 
00003 import de.fub.bytecode.Constants;
00004 /**
00005  * Super class for the x2y family of instructions.
00006  *
00007  * @version $Id: ConversionInstruction.java,v 1.1.1.1 2002/01/24 03:41:38 pserver Exp $
00008  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00009  */
00010 public abstract class ConversionInstruction extends Instruction
00011   implements TypedInstruction, StackProducer, StackConsumer {
00012   /**
00013    * Empty constructor needed for the Class.newInstance() statement in
00014    * Instruction.readInstruction(). Not to be used otherwise.
00015    */
00016   ConversionInstruction() {}  
00017   /**
00018    * @param tag opcode of instruction
00019    */
00020   protected ConversionInstruction(short tag) {
00021     super(tag, (short)1);
00022   }  
00023   /** @return type associated with the instruction
00024    */
00025   public Type getType(ConstantPoolGen cp) {
00026     switch(tag) {
00027     case Constants.D2I: case Constants.F2I: case Constants.L2I:
00028       return Type.INT;   
00029     case Constants.D2F: case Constants.I2F: case Constants.L2F:
00030       return Type.FLOAT;
00031     case Constants.D2L: case Constants.F2L: case Constants.I2L:
00032       return Type.LONG;
00033     case Constants.F2D:  case Constants.I2D: case Constants.L2D:
00034         return Type.DOUBLE;
00035     case Constants.I2B:
00036       return Type.BYTE;
00037     case Constants.I2C:
00038       return Type.CHAR;
00039     case Constants.I2S:
00040       return Type.SHORT;
00041  
00042     default: // Never reached
00043       throw new ClassGenException("Unknown type " + tag);
00044     }
00045   }  
00046 }

Generated at Thu Feb 7 06:43:08 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001