soot.jimple.toolkits.scalar
Class LocalCreation

java.lang.Object
  extended by soot.jimple.toolkits.scalar.LocalCreation

public class LocalCreation
extends Object

provides an easy interface to handle new var-names. New names are automaticly added to the chain, and the provided locals are guaranteed to have a unique name.


Field Summary
static String DEFAULT_PREFIX
          if no prefix is given, this one's used
 
Constructor Summary
LocalCreation(Chain locals)
          all actions are done on the given locals-chain.
LocalCreation(Chain locals, String prefix)
          whenever newLocal(type) will be called, the given prefix is used.
 
Method Summary
 Local newLocal(String prefix, Type type)
          returns a new local with the given prefix and the given type.
the returned local will automaticly added to the locals-chain.
 Local newLocal(Type type)
          returns a new local with the prefix given to the constructor (or the default-prefix if none has been given) and the given type.
The returned local will automaticly added to the locals-chain.
The local will be of the form: prefixX (where the last X is a number, so the localname is unique).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PREFIX

public static final String DEFAULT_PREFIX
if no prefix is given, this one's used

See Also:
Constant Field Values
Constructor Detail

LocalCreation

public LocalCreation(Chain locals)
all actions are done on the given locals-chain. as prefix the DEFAULT-PREFIX will be used.

Parameters:
chain - the locals-chain of a Jimple-body

LocalCreation

public LocalCreation(Chain locals,
                     String prefix)
whenever newLocal(type) will be called, the given prefix is used.

Parameters:
Chain - the locals-chain of a Jimple-body
String - prefix overrides the DEFAULT-PREFIX
Method Detail

newLocal

public Local newLocal(Type type)
returns a new local with the prefix given to the constructor (or the default-prefix if none has been given) and the given type.
The returned local will automaticly added to the locals-chain.
The local will be of the form: prefixX (where the last X is a number, so the localname is unique).

Parameters:
type - the Type of the new local.
Returns:
a new local with a unique name and the given type.

newLocal

public Local newLocal(String prefix,
                      Type type)
returns a new local with the given prefix and the given type.
the returned local will automaticly added to the locals-chain. The local will be of the form: prefixX (where the last X is a number, so the localname is unique).

Parameters:
prefix - the prefix for the now local.
type - the Type of the now local.
Returns:
a local with the given prefix and the given type.