FileDocCategorySizeDatePackage
LocalVariableInfo.javaAPI DocJava SE 5 API6059Fri Aug 26 14:55:26 BST 2005com.sun.org.apache.bcel.internal.verifier.statics

LocalVariableInfo

public class LocalVariableInfo extends Object
A utility class holding the information about the name and the type of a local variable in a given slot (== index). This information often changes in course of byte code offsets.
version
$Id: LocalVariableInfo.java,v 1.1.1.1 2001/10/29 20:00:34 jvanzyl Exp $
author
Enver Haase

Fields Summary
private Hashtable
types
The types database. KEY: String representing the offset integer.
private Hashtable
names
The names database. KEY: String representing the offset integer.
Constructors Summary
Methods Summary
public voidadd(java.lang.String name, int startpc, int length, com.sun.org.apache.bcel.internal.generic.Type t)
Adds some information about this local variable (slot).

throws
LocalVariableInfoInconsistentException if the new information conflicts with already gathered information.

		for (int i=startpc; i<=startpc+length; i++){ // incl/incl-notation!
			add(i,name,t);
		}
	
private voidadd(int offset, java.lang.String name, com.sun.org.apache.bcel.internal.generic.Type t)
Adds information about name and type for a given offset.

throws
LocalVariableInfoInconsistentException if the new information conflicts with already gathered information.

		if (getName(offset) != null){
			if (! getName(offset).equals(name)){
				throw new LocalVariableInfoInconsistentException("At bytecode offset '"+offset+"' a local variable has two different names: '"+getName(offset)+"' and '"+name+"'.");
			}
		}
		if (getType(offset) != null){
			if (! getType(offset).equals(t)){
				throw new LocalVariableInfoInconsistentException("At bytecode offset '"+offset+"' a local variable has two different types: '"+getType(offset)+"' and '"+t+"'.");
			}
		}
		setName(offset, name);
		setType(offset, t);
	
public java.lang.StringgetName(int offset)
Returns the name of the local variable that uses this local variable slot at the given bytecode offset. Care for legal bytecode offsets yourself, otherwise the return value might be wrong. May return 'null' if nothing is known about the type of this local variable slot at the given bytecode offset.

		return (String) (names.get(Integer.toString(offset)));
	
public com.sun.org.apache.bcel.internal.generic.TypegetType(int offset)
Returns the type of the local variable that uses this local variable slot at the given bytecode offset. Care for legal bytecode offsets yourself, otherwise the return value might be wrong. May return 'null' if nothing is known about the type of this local variable slot at the given bytecode offset.

		return (Type) types.get(Integer.toString(offset));
	
private voidsetName(int offset, java.lang.String name)
Adds a name of a local variable and a certain slot to our 'names' (Hashtable) database.


	                	 
	     
		names.put( ((Integer.toString(offset))), name);
	
private voidsetType(int offset, com.sun.org.apache.bcel.internal.generic.Type t)
Adds a type of a local variable and a certain slot to our 'types' (Hashtable) database.

		types.put( ((Integer.toString(offset))), t);