public abstract class GeneralProgramState extends Object implements ProgramState
| Modifier and Type | Field and Description |
|---|---|
protected HeapConfiguration |
heap
The heap configuration that determines the shape of the heap and the assignment of
program variables underlying this program state.
|
protected int |
programCounter
The program location corresponding to this program state.
|
INVALID_STATE_SPACE_ID| Modifier | Constructor and Description |
|---|---|
protected |
GeneralProgramState(GeneralProgramState state)
Creates a shallow copy of a program state.
|
protected |
GeneralProgramState(HeapConfiguration heap)
Initializes a state with the initial program location 0.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAP(String ap)
Adds an atomic proposition.
|
abstract GeneralProgramState |
clone() |
void |
flagAsContinueState() |
Set<String> |
getAPs() |
GeneralConcreteValue |
getConstant(String constantName)
Gets the requested constant
|
StateSpace |
getContainingStateSpace() |
HeapConfiguration |
getHeap() |
protected abstract SelectorLabel |
getNewSelector(SelectorLabel oldSelectorLabel) |
int |
getProgramCounter() |
GeneralConcreteValue |
getSelectorTarget(ConcreteValue from,
SelectorLabel selectorLabel)
Gets the target of the given selector starting at a given object on the heap.
|
protected abstract int |
getSelectorTargetOf(int sourceNode,
SelectorLabel selectorLabel) |
int |
getStateSpaceId() |
GeneralConcreteValue |
getUndefined()
Gets an undefined value.
|
GeneralConcreteValue |
getVariableTarget(String variableName)
Gets the target of the variable in the current scopes.
|
int |
hashCode() |
GeneralConcreteValue |
insertNewElement(Type type)
Adds a new element on the heap to the executable and returns it.
|
boolean |
isContinueState()
determines whether this state is just about to be continued (partial state space)
This is a necessary information to merge duplicate applications of previously known contracts
|
boolean |
isFromTopLevelStateSpace()
determines whether this state is part of the top level statespace
(and not of the state space of a method call)
|
ProgramState |
prepareHeap()
Adds all required constants if not yet present,
converts variables from the semantics format to the
format used inside the heap, etc.
|
GeneralConcreteValue |
removeIntermediate(String name)
Intermediates are internally equal to variables.
|
protected abstract void |
removeSelector(int sourceNode,
SelectorLabel selectorLabel) |
void |
removeVariable(String variableName)
Removes the variable (in the current scopes) from the executable.
|
boolean |
satisfiesAP(String ap)
Checks whether this object satisfies an atomic proposition.
|
void |
setContainingStateSpace(StateSpace containingStateSpace) |
void |
setIntermediate(String name,
ConcreteValue value)
Intermediates are internally equal to variables.
|
void |
setProgramCounter(int pc) |
void |
setSelector(ConcreteValue from,
SelectorLabel selectorLabel,
ConcreteValue to)
(Re)sets the given selector starting at the given object on the heap to a (new) target.
|
void |
setStateSpaceId(int id) |
void |
setVariable(String variableName,
ConcreteValue value)
Sets the variable of the given name to the given value.
|
ProgramState |
shallowCopyWithUpdateHeap(HeapConfiguration newHeap)
Creates a shallow copy in which the underlying heap is set to newHeap without creating a copy first.
|
int |
size() |
String |
toString()
Creates a human readable string representation for debugging purposes.
|
void |
unflagContinueState() |
equals, finalize, getClass, notify, notifyAll, wait, wait, waitshallowCopy, shallowCopyUpdatePCprotected HeapConfiguration heap
protected int programCounter
protected GeneralProgramState(HeapConfiguration heap)
heap - The initial heap configuration.protected GeneralProgramState(GeneralProgramState state)
state - The state that should be copied.public abstract GeneralProgramState clone()
clone in interface ProgramStateclone in class Objectpublic String toString()
public int hashCode()
public int size()
size in interface ProgramStatesize in interface Statepublic int getProgramCounter()
getProgramCounter in interface ProgramStatepublic void setProgramCounter(int pc)
setProgramCounter in interface ProgramStatepc - The program location assigned to this state.public HeapConfiguration getHeap()
getHeap in interface ProgramStatepublic ProgramState prepareHeap()
ProgramStateprepareHeap in interface ProgramStatepublic GeneralConcreteValue getVariableTarget(String variableName)
ProgramStategetVariableTarget in interface ProgramStatevariableName - The name of the requested variablepublic void removeVariable(String variableName)
ProgramStateremoveVariable in interface ProgramStatevariableName - The name of the variable to remove.public void setVariable(String variableName, ConcreteValue value)
ProgramStatesetVariable in interface ProgramStatevariableName - the name of the variablevalue - the value (i.e. node) to which the variable should be setpublic GeneralConcreteValue getConstant(String constantName)
ProgramStategetConstant in interface ProgramStateconstantName - The name of the requested constant.public GeneralConcreteValue removeIntermediate(String name)
removeIntermediate in interface ProgramStatename - The name of the intermediatepublic void setIntermediate(String name, ConcreteValue value)
setIntermediate in interface ProgramStatename - The name of the intermediate .value - The ConcreteValue that will should be referenced by the intermediate.public GeneralConcreteValue insertNewElement(Type type)
ProgramStateinsertNewElement in interface ProgramStatetype - The type of the new element.public GeneralConcreteValue getSelectorTarget(ConcreteValue from, SelectorLabel selectorLabel)
ProgramStategetSelectorTarget in interface ProgramStatefrom - The element on the heap whose selectors should be considered.selectorLabel - The label of the selector.protected abstract int getSelectorTargetOf(int sourceNode,
SelectorLabel selectorLabel)
public void setSelector(ConcreteValue from, SelectorLabel selectorLabel, ConcreteValue to)
ProgramStatesetSelector in interface ProgramStatefrom - The element on the heap whose selectors should be considered.selectorLabel - The label of the selector.to - The element on the heap that should be the target of the selector.protected abstract void removeSelector(int sourceNode,
SelectorLabel selectorLabel)
protected abstract SelectorLabel getNewSelector(SelectorLabel oldSelectorLabel)
public GeneralConcreteValue getUndefined()
ProgramStategetUndefined in interface ProgramStatepublic ProgramState shallowCopyWithUpdateHeap(HeapConfiguration newHeap)
ProgramStateshallowCopyWithUpdateHeap in interface ProgramStatenewHeap - The heap underlying the copy.public boolean satisfiesAP(String ap)
LabelledProgramStatesatisfiesAP in interface LabelledProgramStatepublic void addAP(String ap)
LabelledProgramStateaddAP in interface LabelledProgramStateap - The atomic proposition to add.public Set<String> getAPs()
getAPs in interface LabelledProgramStatepublic int getStateSpaceId()
getStateSpaceId in interface Statepublic void setStateSpaceId(int id)
setStateSpaceId in interface Statepublic boolean isFromTopLevelStateSpace()
ProgramStateisFromTopLevelStateSpace in interface ProgramStatepublic StateSpace getContainingStateSpace()
getContainingStateSpace in interface ProgramStatepublic void setContainingStateSpace(StateSpace containingStateSpace)
setContainingStateSpace in interface ProgramStatepublic boolean isContinueState()
ProgramStateisContinueState in interface ProgramStatepublic void flagAsContinueState()
flagAsContinueState in interface ProgramStatepublic void unflagContinueState()
unflagContinueState in interface ProgramStateCopyright © 2019. All rights reserved.