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

LCONST.java

00001 package de.fub.bytecode.generic;
00002 
00003 /** 
00004  * LCONST - Push 0 or 1, other values cause an exception
00005  *
00006  * <PRE>Stack: ... -&gt; ..., <i></PRE>
00007  *
00008  * @version $Id: LCONST.java,v 1.1.1.1 2002/01/24 03:41:41 pserver Exp $
00009  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00010  */
00011 public class LCONST extends Instruction
00012   implements ConstantPushInstruction, TypedInstruction {
00013   private long value;
00014 
00015   /**
00016    * Empty constructor needed for the Class.newInstance() statement in
00017    * Instruction.readInstruction(). Not to be used otherwise.
00018    */
00019   LCONST() {}  
00020   public LCONST(long l) {
00021     super(de.fub.bytecode.Constants.LCONST_0, (short)1);
00022 
00023     if(l == 0)
00024       tag = de.fub.bytecode.Constants.LCONST_0;
00025     else if(l == 1)
00026       tag = de.fub.bytecode.Constants.LCONST_1;
00027     else
00028       throw new ClassGenException("LCONST can be used only for 0 and 1: " + l);
00029 
00030     value = l;
00031   }  
00032   /**
00033    * Call corresponding visitor method(s). The order is:
00034    * Call visitor methods of implemented interfaces first, then
00035    * call methods according to the class hierarchy in descending order,
00036    * i.e., the most specific visitXXX() call comes last.
00037    *
00038    * @param v Visitor object
00039    */
00040   public void accept(Visitor v) {
00041     v.visitPushInstruction(this);
00042     v.visitStackProducer(this);
00043     v.visitTypedInstruction(this);
00044     v.visitConstantPushInstruction(this);
00045     v.visitLCONST(this);
00046   }  
00047   /** @return Type.LONG
00048    */
00049   public Type getType(ConstantPoolGen cp) {
00050     return Type.LONG;
00051   }  
00052   public Number getValue() { return new Long(value); }  
00053 }

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