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

ArrayInstruction.java

00001 package de.fub.bytecode.generic;
00002 
00003 /**
00004  * Super class for instructions dealing with array access such as IALOAD.
00005  *
00006  * @version $Id: ArrayInstruction.java,v 1.1.1.1 2002/01/24 03:41:38 pserver Exp $
00007  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00008  */
00009 public abstract class ArrayInstruction extends Instruction
00010   implements ExceptionThrower, TypedInstruction {
00011   /**
00012    * Empty constructor needed for the Class.newInstance() statement in
00013    * Instruction.readInstruction(). Not to be used otherwise.
00014    */
00015   ArrayInstruction() {}  
00016   /**
00017    * @param tag opcode of instruction
00018    */
00019   protected ArrayInstruction(short tag) {
00020     super(tag, (short)1);
00021   }  
00022   public Class[] getExceptions() {
00023     return de.fub.bytecode.ExceptionConstants.EXCS_ARRAY_EXCEPTION;
00024   }  
00025   /** @return type associated with the instruction
00026    */
00027   public Type getType(ConstantPoolGen cp) {
00028     switch(tag) {
00029     case de.fub.bytecode.Constants.IALOAD: case de.fub.bytecode.Constants.IASTORE: 
00030       return Type.INT;
00031     case de.fub.bytecode.Constants.CALOAD: case de.fub.bytecode.Constants.CASTORE: 
00032       return Type.CHAR;
00033     case de.fub.bytecode.Constants.BALOAD: case de.fub.bytecode.Constants.BASTORE: 
00034       return Type.BYTE;
00035     case de.fub.bytecode.Constants.LALOAD: case de.fub.bytecode.Constants.LASTORE: 
00036       return Type.LONG;
00037     case de.fub.bytecode.Constants.DALOAD: case de.fub.bytecode.Constants.DASTORE: 
00038       return Type.DOUBLE;
00039     case de.fub.bytecode.Constants.FALOAD: case de.fub.bytecode.Constants.FASTORE: 
00040       return Type.FLOAT;
00041     case de.fub.bytecode.Constants.AALOAD: case de.fub.bytecode.Constants.AASTORE:
00042       return Type.OBJECT;
00043 
00044     default: throw new ClassGenException("Oops: unknown case in switch" + tag);
00045     }
00046   }  
00047 }

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