if ((operator.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE)
|| (operator.getOperatorType() == OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE)) {
if (transition.isActivated()) {
String XorName, ID;
Iterator<String> outArcs = outgoingArcs.keySet().iterator();
TransitionModel virtualTransition; // needed to build virtual Transitions.
AbstractPetriNetElementModel helpPlace;
/*
* In this while-loop, Virtual Transitions will be build which represent the Arcs in the OccurenceList. If a virtual Transition is
* chosen by the user, it will be identified by its ID as Arc and the depending Arc will be taken instead to be occured
*/
while (outArcs.hasNext()) {
ID = outArcs.next(); // get the Arc's ID
// Use a new CreationMap with the arcs id to create the virtual transition
CreationMap map = CreationMap.createMap();
map.setId(ID);
virtualTransition = new TransitionModel(map);
helpPlace = getPetriNet().getElementContainer().getElementById(
getPetriNet().getElementContainer().getArcById(ID).getTargetId());
XorName = transition.getNameValue() + " -> (" + helpPlace.getNameValue() + ")";
virtualTransition.setNameValue(XorName);
RemoteControl.addFollowingItem(virtualTransition);
tokenGameStats.numActiveTransitions++;
virtualTransition = null;
XorName = "";
}
setOutgoingArcsActive(transition.getId(), true);
}
} else
if ((operator.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE)
|| (operator.getOperatorType() == OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE)) {
if (transition.getNumIncomingActivePlaces() > 0) {
String XorName, ID;
Iterator<String> inArcs = incomingArcs.keySet().iterator();
TransitionModel virtualTransition; // needed to build virtual Transitions.
AbstractPetriNetElementModel helpPlace;
// ArcModel activeArc;
/*
* In this while-loop, Virtual Transitions will be build which represent the Arcs in the OccurenceList. If a virtual Transition
* is chosen by the user, it will be identified by its ID as Arc and the depending Arc will be taken instead to be occured
*/
setIncomingArcsActive(transition.getId(), true);
while (inArcs.hasNext()) {
ID = inArcs.next(); // Get Arcs ID
// List all activated Arcs in the occur List
if (getPetriNet().getElementContainer().getArcById(ID).isActivated()) {
// Use a new CreationMap with the arcs id to create the virtual transition
CreationMap map = CreationMap.createMap();
map.setId(ID);
virtualTransition = new TransitionModel(map);
helpPlace = getPetriNet().getElementContainer().getElementById(
getPetriNet().getElementContainer().getArcById(ID).getSourceId());
XorName = "(" + helpPlace.getNameValue() + ")-> " + transition.getNameValue();
virtualTransition.setNameValue(XorName);
RemoteControl.addFollowingItem(virtualTransition);
tokenGameStats.numActiveTransitions++;
virtualTransition = null;
XorName = "";
}
}
}
} else
if (operator.getOperatorType() == OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
// This is the XOR split-join combination type.
// Check whether the center place already contains (a) token(s)
if ((operator.getCenterPlace() != null)
&& (operator.getCenterPlace().getVirtualTokenCount() > 0)) {
String XorName, ID;
Iterator<String> outArcs = outgoingArcs.keySet().iterator();
TransitionModel virtualTransition; // needed to build virtual Transitions.
AbstractPetriNetElementModel helpPlace;
/*
* In this while-loop, Virtual Transitions will be build which represent the Arcs in the OccurenceList. If a virtual
* Transition is chosen by the user, it will be identified by its ID as Arc and the depending Arc will be taken instead to
* be occured
*/
while (outArcs.hasNext()) {
ID = outArcs.next(); // get the Arc's ID
// Use a new CreationMap with the arcs id to create the virtual transition
CreationMap map = CreationMap.createMap();
map.setId(ID);
virtualTransition = new TransitionModel(map);
virtualTransition.setId(ID); // set HelpTransition's ID to Arc's ID
helpPlace = getPetriNet().getElementContainer().getElementById(
getPetriNet().getElementContainer().getArcById(ID).getTargetId());
XorName = transition.getNameValue() + " -> (" + helpPlace.getNameValue() + ")";
virtualTransition.setNameValue(XorName);
RemoteControl.addFollowingItem(virtualTransition);
tokenGameStats.numActiveTransitions++;
virtualTransition = null;
XorName = "";
}
setOutgoingArcsActive(transition.getId(), true);
}
// There must at least be one token at the input side for
// the transition to be
// activated
if (transition.getNumIncomingActivePlaces() > 0) {
String XorName, ID;
Iterator<String> inArcs = incomingArcs.keySet().iterator();
TransitionModel virtualTransition; // needed to build virtual Transitions.
AbstractPetriNetElementModel helpPlace;
// ArcModel activeArc;
/*
* In this while-loop, Virtual Transitions will be build which represent the Arcs in the OccurenceList. If a virtual
* Transition is chosen by the user, it will be identified by its ID as Arc and the depending Arc will be taken instead to
* be occured
*/
setIncomingArcsActive(transition.getId(), true);
while (inArcs.hasNext()) {
ID = inArcs.next(); // Get Arcs ID
// List all activated Arcs in the occur List
if (getPetriNet().getElementContainer().getArcById(ID).isActivated()) {
// Use a new CreationMap with the arcs id to create the virtual transition
CreationMap map = CreationMap.createMap();
map.setId(ID);
virtualTransition = new TransitionModel(map);
helpPlace = getPetriNet().getElementContainer().getElementById(
getPetriNet().getElementContainer().getArcById(ID).getSourceId());
XorName = "(" + helpPlace.getNameValue() + ")-> "
+ transition.getNameValue();
virtualTransition.setNameValue(XorName);
RemoteControl.addFollowingItem(virtualTransition);
tokenGameStats.numActiveTransitions++;
virtualTransition = null;
XorName = "";
}