dk.brics.string.external
Class MethodResolution

java.lang.Object
  extended by dk.brics.string.external.MethodResolution

public class MethodResolution
extends Object

A description of a non-application method. Describes which strings may be returned, and which arguments might be modified.


Constructor Summary
MethodResolution(int numArguments)
          Creates a method resolution for a completely corrupting method call with the specified number of arguments.
MethodResolution(int numArguments, Automaton returnedAutomaton)
          Creates a method resolution for a completely corrupting method call with the specified number of arguments.
 
Method Summary
 List<Boolean> getCorruptedArguments()
          Returns a list of booleans, where index i indicates whether argument i might be changed as a result of calling the method.
 int getReturnedArgument()
          Returns the index of an argument being returned, or -1 if the method does not return one of its arguments.
 Automaton getReturnedAutomaton()
          Returns the automaton accepting all possible return values of the method, or null if the method returns something corrupt.
 boolean isArgumentCorrupted(int i)
          Returns whether argument i might be modified as a result of invoking the method.
 boolean isReturnCorrupt()
          Returns whether the return value is considered corrupt.
 void setArgumentCorrupted(int i, boolean b)
          Sets whether argument i might be modified as a result of invoking the method.
 void setReturnCorrupt()
          Sets the method to return something corrupt.
 void setReturnedArgument(int returnedArgument)
          Sets the index of an argument being returned, or -1 if the method does not return one of its arguments.
 void setReturnedAutomaton(Automaton returnValue)
          Sets the automaton accepting all possible return values of the method, or null if the method returns something corrupt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodResolution

public MethodResolution(int numArguments)
Creates a method resolution for a completely corrupting method call with the specified number of arguments.

Precision can be increasing using setReturnedAutomaton(Automaton) and setArgumentCorrupted(int, boolean).

Parameters:
numArguments - number of arguments to the method

MethodResolution

public MethodResolution(int numArguments,
                        Automaton returnedAutomaton)
Creates a method resolution for a completely corrupting method call with the specified number of arguments.

Precision can be increasing using setReturnedAutomaton(Automaton) and setArgumentCorrupted(int, boolean).

Parameters:
numArguments - number of arguments to the method
returnedAutomaton - see setReturnedAutomaton(Automaton)
Method Detail

getCorruptedArguments

public List<Boolean> getCorruptedArguments()
Returns a list of booleans, where index i indicates whether argument i might be changed as a result of calling the method.

Returns:
a mutable list of booleans backed by this object; null is never returned.

getReturnedArgument

public int getReturnedArgument()
Returns the index of an argument being returned, or -1 if the method does not return one of its arguments. If the argument is mutable, it must never be modified in the external code (not before nor after the method returns).

Returns:
an argument index, or -1.

getReturnedAutomaton

public Automaton getReturnedAutomaton()
Returns the automaton accepting all possible return values of the method, or null if the method returns something corrupt.

If a mutable string-type is returned by the method, it is corrupt unless the object is "forgotten" by the external code, so it does not get modified outside the application again. If this is not the case, this method must return null.

Returns:
an automaton denoting the possible return values, or null is something corrupt is returned.

isArgumentCorrupted

public boolean isArgumentCorrupted(int i)
Returns whether argument i might be modified as a result of invoking the method. Convenient alternative to using getCorruptedArguments().

Parameters:
i - the argument number
Returns:
true if the specified argument might be modified

isReturnCorrupt

public boolean isReturnCorrupt()
Returns whether the return value is considered corrupt.

Returns:
whether return value is corrupt

setArgumentCorrupted

public void setArgumentCorrupted(int i,
                                 boolean b)
Sets whether argument i might be modified as a result of invoking the method. Convenient alternative to using getCorruptedArguments().

Parameters:
i - the argument number
b - true if the specified argument might be modified

setReturnCorrupt

public void setReturnCorrupt()
Sets the method to return something corrupt. Sets the returned argument index to -1, and the returned automaton to null.


setReturnedArgument

public void setReturnedArgument(int returnedArgument)
Sets the index of an argument being returned, or -1 if the method does not return one of its arguments. If the argument is mutable, it must never be modified in the external code (not before nor after the method returns).

Automatically sets the returned automaton to null.

Parameters:
returnedArgument - an argument index, or -1.

setReturnedAutomaton

public void setReturnedAutomaton(Automaton returnValue)
Sets the automaton accepting all possible return values of the method, or null if the method returns something corrupt.

If a mutable string-type is returned by the method, it is corrupt unless the object is "forgotten" by the external code, so it does not get modified outside the application again. If this is not the case, this method must return null.

Automatically sets the returned argument index to -1.

Parameters:
returnValue - an automaton denoting the possible return values, or null is something corrupt is returned or an argument is returned.


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.