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

ConstantDouble.java

00001 package de.fub.bytecode.classfile;
00002 
00003 import  de.fub.bytecode.Constants;
00004 import  java.io.*;
00005 
00006 /** 
00007  * This class is derived from the abstract 
00008  * <A HREF="de.fub.bytecode.classfile.Constant.html">Constant</A> class 
00009  * and represents a reference to a Double object.
00010  *
00011  * @version $Id: ConstantDouble.java,v 1.1.1.1 2002/01/24 03:44:00 pserver Exp $
00012  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00013  * @see     Constant
00014  */
00015 public final class ConstantDouble extends Constant {
00016   private double bytes;
00017 
00018   /** 
00019    * @param bytes Data
00020    */
00021   public ConstantDouble(double bytes) {    
00022     super(CONSTANT_Double);
00023     this.bytes = bytes;
00024   }  
00025   /**
00026    * Initialize from another object.
00027    */
00028   public ConstantDouble(ConstantDouble c) {
00029     this(c.getBytes());
00030   }  
00031   /** 
00032    * Initialize instance from file data.
00033    *
00034    * @param file Input stream
00035    * @throw IOException
00036    */
00037   ConstantDouble(DataInputStream file) throws IOException
00038   {    
00039     this(file.readDouble());
00040   }  
00041   /**
00042    * Called by objects that are traversing the nodes of the tree implicitely
00043    * defined by the contents of a Java class. I.e., the hierarchy of methods,
00044    * fields, attributes, etc. spawns a tree of objects.
00045    *
00046    * @param v Visitor object
00047    */
00048   public void accept(Visitor v) {
00049     v.visitConstantDouble(this);
00050   }  
00051   /**
00052    * Dump constant double to file stream in binary format.
00053    *
00054    * @param file Output file stream
00055    * @throw IOException
00056    */ 
00057   public final void dump(DataOutputStream file) throws IOException
00058   {
00059     file.writeByte(tag);
00060     file.writeDouble(bytes);
00061   }  
00062   /**
00063    * @return data, i.e. 8 bytes.
00064    */  
00065   public final double getBytes() { return bytes; }  
00066   /**
00067    * @param bytes.
00068    */
00069   public final void setBytes(double bytes) {
00070     this.bytes = bytes;
00071   }  
00072   /**
00073    * @return String representation.
00074    */
00075   public final String toString()
00076   {
00077     return super.toString() + "(bytes = " + bytes + ")";
00078   }  
00079 }

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