de.unisaarland.cs.st.jerify.verifier.typestate
Class StateChangeTransition

java.lang.Object
  extended by de.unisaarland.cs.st.jerify.verifier.typestate.StateChangeTransition
All Implemented Interfaces:
StateChanges

public class StateChangeTransition
extends java.lang.Object
implements StateChanges

Encapsulates the typestate transitions (e.g. open->close)

Author:
Daniel Wand (typestate@ewand.de)

Constructor Summary
StateChangeTransition()
          Create a new empty Transition Class
StateChangeTransition(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> stateChanges)
          Create a initialised Transition Class
 
Method Summary
 void addTransition(Pair<java.lang.String,java.util.Set<java.lang.String>> transition)
          Add a new Transition to the current
 void addTransition(java.lang.String from, java.util.Set<java.lang.String> to)
          Add a new Transition form one to many states
 State applyChanges(java.util.Set<java.lang.String> stateSet)
          Apply the changes encapsulated to the States passed
 boolean containsStateChangeFor(java.lang.String state)
          Test if the StateChanges handle a specific state
 boolean isEmpty()
          Test if there are any changes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateChangeTransition

public StateChangeTransition()
Create a new empty Transition Class


StateChangeTransition

public StateChangeTransition(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> stateChanges)
Create a initialised Transition Class

Parameters:
stateChanges - the transitions
Method Detail

addTransition

public void addTransition(Pair<java.lang.String,java.util.Set<java.lang.String>> transition)
Add a new Transition to the current

Parameters:
transition - the transition to add

addTransition

public void addTransition(java.lang.String from,
                          java.util.Set<java.lang.String> to)
Add a new Transition form one to many states

Parameters:
from - the start state
to - the to states

isEmpty

public boolean isEmpty()
Test if there are any changes

Specified by:
isEmpty in interface StateChanges
Returns:
true if there are changes, false otherwise

containsStateChangeFor

public boolean containsStateChangeFor(java.lang.String state)
Test if the StateChanges handle a specific state

Specified by:
containsStateChangeFor in interface StateChanges
Parameters:
State - the state
Returns:
true if it handle the state, false otherwise

applyChanges

public State applyChanges(java.util.Set<java.lang.String> stateSet)
Apply the changes encapsulated to the States passed

Specified by:
applyChanges in interface StateChanges
Parameters:
stateSet - the State to change
Returns:
the new State