dk.brics.xact.analysis.soot
Class TranslatorUtil

java.lang.Object
  extended by dk.brics.xact.analysis.soot.TranslatorUtil

public class TranslatorUtil
extends Object

Utility methods used in flow graph construction.


Constructor Summary
TranslatorUtil(TranslatorContext con)
          Constructs a new translator utilities object for the given context.
 
Method Summary
 String expandQName(String qname)
          Expands a QName according to the current namespace declarations.
 Map<String,String> expandQNames(Map<String,String> qnames)
          Expands a QName map according to the current namespace declarations.
 Variable getAliasVar()
          Returns the global alias variable for non-application XML data.
 dk.brics.automaton.Automaton getAutomatonFromObjectExp(ValueBox b)
          Returns an automaton representing the possible string values of the given Soot expression.
 dk.brics.automaton.Automaton getAutomatonFromStringExp(ValueBox b)
          Returns an automaton representing the possible string values of the given Soot string expression.
 Origin getConstantOrigin(Value v)
          Returns the origin constant value for the given Soot value.
 String getConstantString(Value v)
          Returns the string constant value for the given Soot value.
 TranslatorContext getContext()
          Returns the context object.
 int getLineNumber(Stmt s)
          Gets a source line number for the given Soot statement.
 String getResourceString(String name)
          Retrieves a resource string using the current class loader.
 String getTypeAnnotation(SootMethod m)
          Returns the Type annotation for a method return, or null if not present.
 Variable getVar(Value v)
          Returns a flow graph variable for the given Soot value.
 Variable getVariableFromObjectExp(ValueBox b)
          Returns a flow graph variable representing the possible XML values of the given Soot expression.
 boolean isXMLType(Type t)
          Checks whether the given type is XML or related (i.e. can have a Type annotation).
 void setStatementBuilder(StatementBuilder stm)
          Sets the StatementBuilder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TranslatorUtil

public TranslatorUtil(TranslatorContext con)
Constructs a new translator utilities object for the given context.

Method Detail

expandQName

public String expandQName(String qname)
Expands a QName according to the current namespace declarations.


expandQNames

public Map<String,String> expandQNames(Map<String,String> qnames)
Expands a QName map according to the current namespace declarations.


getAliasVar

public Variable getAliasVar()
Returns the global alias variable for non-application XML data.


getAutomatonFromObjectExp

public dk.brics.automaton.Automaton getAutomatonFromObjectExp(ValueBox b)
Returns an automaton representing the possible string values of the given Soot expression. For every subclass of the declared class type of the expression, the string analysis is asked for possible values unless the subclass (or one of its ancestors) implements ToXMLable.


getAutomatonFromStringExp

public dk.brics.automaton.Automaton getAutomatonFromStringExp(ValueBox b)
Returns an automaton representing the possible string values of the given Soot string expression.


getConstantOrigin

public Origin getConstantOrigin(Value v)
Returns the origin constant value for the given Soot value.

Throws:
XMLAnalysisException - if the value does not appear to be a constant origin

getConstantString

public String getConstantString(Value v)
Returns the string constant value for the given Soot value.

Throws:
XMLAnalysisException - if the value does not appear to be a constant string

getContext

public TranslatorContext getContext()
Returns the context object.


getLineNumber

public int getLineNumber(Stmt s)
Gets a source line number for the given Soot statement.


getResourceString

public String getResourceString(String name)
Retrieves a resource string using the current class loader. Assumes UTF-8.


getTypeAnnotation

public String getTypeAnnotation(SootMethod m)
Returns the Type annotation for a method return, or null if not present.


getVar

public Variable getVar(Value v)
Returns a flow graph variable for the given Soot value. The value is a field, local, parameter or dummy (or an array of any dimension). Uses makeVariable(Value, String).


getVariableFromObjectExp

public Variable getVariableFromObjectExp(ValueBox b)
Returns a flow graph variable representing the possible XML values of the given Soot expression. For every subclass of the declared class type of the expression: if the subclass is an XML type, an assignment is added from the value to the new variable; if the subclass implements ToXMLable, an assignment is added from a call to toXML on the value to the new variable. Returns null is the input type is NullType.


isXMLType

public boolean isXMLType(Type t)
Checks whether the given type is XML or related (i.e. can have a Type annotation).


setStatementBuilder

public void setStatementBuilder(StatementBuilder stm)
Sets the StatementBuilder.



Copyright © 2005-2008 Aarhus University.