// Get postset of the place
Set<AbstractPetriNetElementModel> postset = NetAlgorithms.getDirectlyConnectedNodes(highlightElement, NetAlgorithms.connectionTypeOUTBOUND);
// Get preset of the place
Set<AbstractPetriNetElementModel> preset = NetAlgorithms.getDirectlyConnectedNodes(highlightElement, NetAlgorithms.connectionTypeINBOUND);
OperatorTransitionModel tempOpTransModel;
// The correction is only done if 2 elements are in the postset and the preset,
// respectively. This corresponds to exact 1 Xor-Split operator in the postset
// or 1 Xor-Join operator in the preset.
if (postset.size() == 2) {
Iterator<AbstractPetriNetElementModel> postsetIter = postset.iterator();
AbstractPetriNetElementModel postsetCheck1, postsetCheck2;
postsetCheck1 = postsetIter.next();
postsetCheck2 = postsetIter.next();
// If both elements in the postset are of the type PetriNetModelElement.TRANS_OPERATOR_TYPE
// get the van der Aalst operator from the owning container and set it as highlightElement.
postsetCheck1 = (postsetCheck1.getRootOwningContainer().getOwningElement() != null)
? postsetCheck1.getRootOwningContainer().getOwningElement()
: postsetCheck1;
postsetCheck2 = (postsetCheck2.getRootOwningContainer().getOwningElement() != null)
? postsetCheck2.getRootOwningContainer().getOwningElement()
: postsetCheck2;
if (postsetCheck1.equals(postsetCheck2) && postsetCheck1.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
tempOpTransModel = (OperatorTransitionModel) postsetCheck1;
if (tempOpTransModel.getOperatorType() == OperatorTransitionModel.XOR_SPLIT_TYPE) {
// activate coloring of this element
highlightElement = tempOpTransModel;
}
}
}
// The correction is only done if 2 elements are in the postset and the preset,
// respectively. This corresponds to exact 1 Xor-Split operator in the postset
// or 1 Xor-Join operator in the preset.
else{
if (preset.size() == 2) {
Iterator<AbstractPetriNetElementModel> presetIter = preset.iterator();
AbstractPetriNetElementModel presetCheck1, presetCheck2;
presetCheck1 = presetIter.next();
presetCheck2 = presetIter.next();
// If both elements in the preset are of the type PetriNetModelElement.TRANS_OPERATOR_TYPE
// get the van der Aalst operator from the owning container and set it as highlightElement.
presetCheck1 = (presetCheck1.getRootOwningContainer().getOwningElement() != null)
? presetCheck1.getRootOwningContainer().getOwningElement()
: presetCheck1;
presetCheck2 = (presetCheck2.getRootOwningContainer().getOwningElement() != null)
? presetCheck2.getRootOwningContainer().getOwningElement()
: presetCheck2;
if (presetCheck1.equals(presetCheck2) && presetCheck1.getType() == AbstractPetriNetElementModel.TRANS_OPERATOR_TYPE) {
tempOpTransModel = (OperatorTransitionModel) presetCheck1;
if (tempOpTransModel.getOperatorType() == OperatorTransitionModel.XOR_JOIN_TYPE) {
// activate coloring of this element
highlightElement = tempOpTransModel;
}
}
}