JML

org.multijava.util.classfile
Class UniverseByteConstants

java.lang.Object
  extended byorg.multijava.util.classfile.UniverseByteConstants

public class UniverseByteConstants
extends Object

This class contains static helper functions that work on the byte constants used to represent universe annotations in attributes.

Author:
AHS

Constructor Summary
UniverseByteConstants()
           
 
Method Summary
static byte buildConstant(CUniverse univ)
          Build byte constant from a given universe.
static byte buildConstant(CUniverse univ, CUniverse base_univ)
          Build byte constant from a pair of universes (array type).
static boolean isArray(byte byteConstant)
          Returns if a given byte constant represents an array type.
static CUniverse toBaseUniverse(byte byteConstant)
          Returns an instance of the universe represented by a a given byte constant.
static CUniverse toUniverse(byte byteConstant)
          Returns an instance of the universe represented by a given byte constant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniverseByteConstants

public UniverseByteConstants()
Method Detail

isArray

public static boolean isArray(byte byteConstant)
Returns if a given byte constant represents an array type.

Parameters:
byteConstant - a byte constant representing a universe annotation

buildConstant

public static byte buildConstant(CUniverse univ)
Build byte constant from a given universe.

Parameters:
univ - the universe

buildConstant

public static byte buildConstant(CUniverse univ,
                                 CUniverse base_univ)
Build byte constant from a pair of universes (array type). The hi bit is set to 1 to signify an array annotation.

Parameters:
univ - the universe of the array itself
base_univ - the universe of the array elements

toUniverse

public static CUniverse toUniverse(byte byteConstant)
Returns an instance of the universe represented by a given byte constant. For array annotations, this returns the universe of the array object itself, not of the array elements. The universe is stored in the low 2 bits of the byte constant.

Parameters:
byteConstant - a byte constant representing a universe annotation

toBaseUniverse

public static CUniverse toBaseUniverse(byte byteConstant)
Returns an instance of the universe represented by a a given byte constant. This is for array annotations only, and returns the universe of the array elements. The universe of the array elements is stored in bits [3,2] of the byte constant.

Parameters:
byteConstant - a byte constant representing a universe annotation

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.