public class TransitionSystem extends AbstractGraph<TransitionSystem,Arc,State> implements IGraph<TransitionSystem,Arc,State>
| Constructor and Description |
|---|
TransitionSystem()
Creates a new TransitionSystem with no name (e.g.
|
TransitionSystem(java.lang.String name)
Creates a new TransitionSystem with the given name.
|
TransitionSystem(TransitionSystem ts)
Copy-Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsState(java.lang.String sourceId)
Returns true if this TS contains a state with the given id.
|
Arc |
createArc(Arc arc)
Creates an arc with the same source node, target node and label as the given arc and copies the extensions
from the arc marked as to copy to the new arc.
|
Arc |
createArc(State source,
State target,
java.lang.String label)
Creates an arc from one state (source) to another state (target) with the label.
|
Arc |
createArc(java.lang.String sourceId,
java.lang.String targetId,
java.lang.String label)
Creates an arc with an id for the source node, an id for the target node and a label.
|
State |
createState()
Creates a new state with an auto-generated id.
|
State |
createState(State state)
Creates a new state in this TransitionSystem by copying the id from another state and copying the extensions
from the state marked as to copy to the new state.
|
State |
createState(java.lang.String id)
Creates a new state with the given id
|
State[] |
createStates(int count)
Creates #count new states in this TransitionSystem with a auto generated ids.
|
State[] |
createStates(State... stateList)
Creates a few new states in this TransitionSystem by copying the id from the given states and copying the
extensions from the states marked as to copy to the new state.
|
State[] |
createStates(java.lang.String... idList)
Creates a few new states in this TransitionSystem by the given ids.
|
java.util.Set<java.lang.String> |
getAlphabet()
Gets a view of the alphabet of the TransitionSystem as an unmodifiableSortedSet.
|
java.util.Set<Event> |
getAlphabetEvents()
Gets a view of the alphabet of the TransitionSystem as an unmodifiableSortedSet.
|
Arc |
getArc(State source,
State target,
java.lang.String label)
Gets the arc with the source, target and label from this TransitionSystem.
|
Arc |
getArc(java.lang.String sourceId,
java.lang.String targetId,
java.lang.String label)
Gets the arc with the sourceId, targetId and label from this TransitionSystem.
|
java.util.Set<Arc> |
getEdges()
Retrieves a view of the current edge set of the graph.
|
Event |
getEvent(java.lang.String label)
Get the
Event instance that corresponds to the given label. |
State |
getInitialState()
Returns the initial state of this TransitionSystem.
|
java.lang.String |
getName()
Retrieves the name of this graph or "" if not set.
|
State |
getNode(java.lang.String id)
Retrieves the node with the given id.
|
java.util.Set<State> |
getNodes()
Retrieves a view of the current node set of the graph.
|
java.util.Set<Arc> |
getPostsetEdges(State node)
Retrieves a view of all edges beginning in the given node.
|
java.util.Set<Arc> |
getPostsetEdges(java.lang.String id)
Retrieves a view of all edges beginning in the node with the given id.
|
java.util.Set<Arc> |
getPostsetEdgesByLabel(State node,
java.lang.String label)
Returns the set of arcs that start in the given node and have the
given label.
|
java.util.Set<State> |
getPostsetNodes(State node)
Retrieves a view of all nodes which have an incoming edge from the given node.
|
java.util.Set<State> |
getPostsetNodes(java.lang.String id)
Retrieves a view of all nodes which have an incoming edge from the node with the given id.
|
java.util.Set<State> |
getPostsetNodesByLabel(State node,
java.lang.String label)
Returns the set of states that is reached by arcs from the given node
with the given label.
|
java.util.Set<Arc> |
getPresetEdges(State node)
Retrieves a view of all edges targeting the given node.
|
java.util.Set<Arc> |
getPresetEdges(java.lang.String id)
Retrieves a view of all edges targeting the node with the given id.
|
java.util.Set<Arc> |
getPresetEdgesByLabel(State node,
java.lang.String label)
Returns the set of arcs that end in the given node and have the
given label.
|
java.util.Set<State> |
getPresetNodes(State node)
Retrieves a view of all nodes which have an outgoing edge to the given node
|
java.util.Set<State> |
getPresetNodes(java.lang.String id)
Retrieves a view of all nodes which have an outgoing edge to the node identified by the id.
|
java.util.Set<State> |
getPresetNodesByLabel(State node,
java.lang.String label)
Returns the set of states from which the given node can be reached
with the given label.
|
void |
removeArc(Arc a)
Removes the given arc from this TransitionSystem by searching an arc with the same source, target and label
as the given arc.
|
void |
removeArc(java.lang.String sourceId,
java.lang.String targetId,
java.lang.String label)
Removes the arc with the sourceId, targetI and label from this TransitionSystem if exists.
|
void |
removeState(State state)
Removes the given state from the TransitionSystem by searching a node with the same id as the given state.
|
void |
removeState(java.lang.String id)
Removes the state with the id from the TransitionSystem.
|
void |
setInitialState(State state)
Sets the initial state of the TransitionSystem.
|
void |
setInitialState(java.lang.String id)
Sets the initial state of the TransitionSystem.
|
void |
setName(java.lang.String name) |
addListener, invokeListeners, removeListenercopyExtensions, getCopyExtensions, getExtension, getExtensions, getExtensionsWithoutProperty, getExtensionsWithProperty, getWriteToFileExtensions, hasExtension, putExtension, putExtension, removeExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, removeListenergetExtension, putExtension, removeExtensionpublic TransitionSystem()
public TransitionSystem(java.lang.String name)
name - the name of the transitionsystem as String.public TransitionSystem(TransitionSystem ts)
ts - the transition system that gets copied.public void setInitialState(State state)
state - the state which should get inital.java.lang.IllegalArgumentException - on passing an empty state.NoSuchNodeException - thrown if the state does not exist in this TransitionSystem.public void setInitialState(java.lang.String id)
id - the id of the state which should get initial.java.lang.IllegalArgumentException - on passing an empty id.NoSuchNodeException - if the state with the id does not exist in this TransitionSystem.public State getInitialState()
StructureException - if the initial state is not set.public Event getEvent(java.lang.String label)
Event instance that corresponds to the given label.label - The label whose event should be looked upNoSuchEventException - If no event with the given label exists.java.lang.NullPointerException - If the given label is null.public Arc createArc(java.lang.String sourceId, java.lang.String targetId, java.lang.String label)
sourceId - the id of the source state.targetId - the id of the target state.label - the label this arc will receive.ArcExistsException - if a arc with this sourceId, targetId and label already exists in this
TransitionSystem.NoSuchNodeException - if one of the nodes does not exist in this TransitionSystem.java.lang.IllegalArgumentException - upon passing a null element.public Arc createArc(State source, State target, java.lang.String label)
source - the source state.target - the target state.label - the label this arc will receive.ArcExistsException - if a arc with this source, target and label already exists in this
TransitionSystem.NoSuchNodeException - if one of the nodes does not exist in this TransitionSystem.java.lang.IllegalArgumentException - upon passing a null element.public Arc createArc(Arc arc)
arc - the arc to copy.ArcExistsException - if a arc with the same source node, target node and label as the given arc
already exists in this TransitionSystem.NoSuchNodeException - if one of the nodes (target node or source node of the given arc) does not
exist.java.lang.IllegalArgumentException - upon passing a null element.public State createState(java.lang.String id)
id - the id of the state.NodeExistsException - if the state with this id already exists in this TransitionSystem.java.lang.IllegalArgumentException - upon passing a null element.public State createState()
public State createState(State state)
state - the state to get the id and extensions.java.lang.IllegalArgumentException - if the passed state is null.NodeExistsException - if the given state in this TransitionSystem already exists.public State[] createStates(State... stateList)
stateList - a list of states to get the id and extensions of those states.java.lang.IllegalArgumentException - if the passed array of states is null.NodeExistsException - if one state of the given list in this TransitionSystem already exists.public State[] createStates(java.lang.String... idList)
idList - a list of idsjava.lang.IllegalArgumentException - if the passed array of ids is null.NodeExistsException - if one id of the list in this TransitionSystem already exists.public State[] createStates(int count)
count - how many states should be created.public void removeArc(java.lang.String sourceId,
java.lang.String targetId,
java.lang.String label)
sourceId - the source state id.targetId - the target state id.label - the label of the arc which want to be removed.java.lang.IllegalArgumentException - on passing null to any argument.NoSuchNodeException - if the node does not exist in this TransitionSystem.NoSuchEdgeException - if there is no arc with given sourceId, targetId and label in this
TransitionSystem.public void removeArc(Arc a)
a - the arc which want to be removed.StructureException - if the arc does not belong to the TransitionSystem. That mean it was not
created by this TransitionSystem.java.lang.IllegalArgumentException - on passing null to any argument.NoSuchNodeException - if the node does not exist in this TransitionSystem.NoSuchEdgeException - if there is no arc such as the given arc in this TransitionSystem.public void removeState(java.lang.String id)
id - the id of the state which should be removed.NoSuchNodeException - if there is no state with the given id in this TransitionSystem.java.lang.IllegalArgumentException - on passing null to any argument.public void removeState(State state)
state - the state to remove.StructureException - if the state does not belong to the TransitionSystem. That mean was not
created by this TransitionSystem.java.lang.IllegalArgumentException - on passing null to any argument.NoSuchNodeException - if the state is not in this TransitionSystem.public Arc getArc(java.lang.String sourceId, java.lang.String targetId, java.lang.String label)
sourceId - the source state id of this arc.targetId - the target state id of this arc.label - the label of the arc.java.lang.IllegalArgumentException - on passing null to any argument.NoSuchNodeException - if some of the nodes given by there id's does not exist in this
TransitionSystem.NoSuchEdgeException - if the arc given by the id's of source an target node and the label does not
exist in this TransitionSystem.public Arc getArc(State source, State target, java.lang.String label)
source - the source state of the arc.target - the target state of the arc.label - the label of the arc.java.lang.IllegalArgumentException - on passing null to any argument.NoSuchNodeException - if the node does not exist.NoSuchEdgeException - if the arc given by the id's of source an target node and the label does not
exist in this TransitionSystem.StructureException - if the state source or target don't belong to this TransitionSystem. That
mean has not been created by this TransitionSystem.public java.util.Set<Event> getAlphabetEvents()
public java.util.Set<java.lang.String> getAlphabet()
public void setName(java.lang.String name)
public java.lang.String getName()
IGraphgetName in interface IGraph<TransitionSystem,Arc,State>public State getNode(java.lang.String id)
getNode in interface IGraph<TransitionSystem,Arc,State>id - The id of the node as a String.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the id exists in this transitionsystem.public java.util.Set<Arc> getEdges()
IGraphgetEdges in interface IGraph<TransitionSystem,Arc,State>public java.util.Set<State> getNodes()
IGraphgetNodes in interface IGraph<TransitionSystem,Arc,State>public java.util.Set<State> getPresetNodes(java.lang.String id)
getPresetNodes in interface IGraph<TransitionSystem,Arc,State>id - the id of a node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.public java.util.Set<State> getPostsetNodes(java.lang.String id)
getPostsetNodes in interface IGraph<TransitionSystem,Arc,State>id - The id of a node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.public java.util.Set<Arc> getPresetEdges(java.lang.String id)
getPresetEdges in interface IGraph<TransitionSystem,Arc,State>id - The id of a node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.public java.util.Set<Arc> getPostsetEdges(java.lang.String id)
getPostsetEdges in interface IGraph<TransitionSystem,Arc,State>id - The id of a node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.public java.util.Set<Arc> getPostsetEdges(State node)
getPostsetEdges in interface IGraph<TransitionSystem,Arc,State>node - The node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.StructureException - thrown if the given node does not belong to this graph.public java.util.Set<State> getPostsetNodes(State node)
getPostsetNodes in interface IGraph<TransitionSystem,Arc,State>node - The node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.StructureException - thrown if the given node does not belong to this graph.public java.util.Set<Arc> getPresetEdges(State node)
getPresetEdges in interface IGraph<TransitionSystem,Arc,State>node - The node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.StructureException - thrown if the given node does not belong to this graph.public java.util.Set<State> getPresetNodes(State node)
getPresetNodes in interface IGraph<TransitionSystem,Arc,State>node - the node.java.lang.IllegalArgumentException - thrown if null is passed to the method.NoSuchNodeException - thrown if no node with the given id exists in this graph.StructureException - thrown if the given node does not belong to this graph.public java.util.Set<State> getPresetNodesByLabel(State node, java.lang.String label)
node - the target nodelabel - the label to look forpublic java.util.Set<Arc> getPresetEdgesByLabel(State node, java.lang.String label)
node - the target node of all arcs in the resultlabel - the label of all arcs in the resultpublic java.util.Set<State> getPostsetNodesByLabel(State node, java.lang.String label)
node - the source nodelabel - the label to look forpublic java.util.Set<Arc> getPostsetEdgesByLabel(State node, java.lang.String label)
node - the source node of all arcs in the resultlabel - the label of all arcs in the resultpublic boolean containsState(java.lang.String sourceId)
sourceId - the state's id