-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6: added selection dialog for FindMode.
- Loading branch information
Showing
1 changed file
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package org.processmining.implicitplaceidentification.algorithms.plugins; | ||
|
||
import org.deckfour.uitopia.api.event.TaskListener; | ||
import org.processmining.implicitplaceidentification.algorithms.FindMode; | ||
import org.processmining.implicitplaceidentification.algorithms.StructureBasedImplicitPlaceFinder; | ||
import org.processmining.implicitplaceidentification.algorithms.util.PetriNetCopier; | ||
|
@@ -8,6 +9,8 @@ | |
import org.processmining.contexts.uitopia.annotations.UITopiaVariant; | ||
import org.processmining.framework.plugin.annotations.Plugin; | ||
import org.processmining.framework.plugin.annotations.PluginVariant; | ||
import org.processmining.implicitplaceidentification.dialogs.VariantSelectionDialog; | ||
import org.processmining.implicitplaceidentification.parameters.IPFinderParams; | ||
import org.processmining.models.graphbased.directed.petrinet.Petrinet; | ||
import org.processmining.models.semantics.petrinet.Marking; | ||
import org.processmining.plugins.petrinet.finalmarkingprovider.MarkingEditorPanel; | ||
|
@@ -25,21 +28,19 @@ public class ILPBasedImplicitPlaceColorerPlugin { | |
@PluginVariant(variantLabel = "IP-Finder: ILP-based, apn", requiredParameterLabels = {2}) | ||
@UITopiaVariant(affiliation = "PADS Student", author = "Tobias Wirtz", email = "[email protected]") | ||
public Petrinet colorAcceptingPetrinet(UIPluginContext context, AcceptingPetriNet acceptingPN) { | ||
Petrinet net = acceptingPN.getNet(); | ||
Marking initialMarking = acceptingPN.getInitialMarking(); | ||
|
||
StructureBasedImplicitPlaceFinder ipFinder = new StructureBasedImplicitPlaceFinder(acceptingPN.getNet(), | ||
acceptingPN.getInitialMarking(), FindMode.FIND_ALL_POTENTIAL_IPS); | ||
|
||
PetriNetCopier copier = new PetriNetCopier(acceptingPN.getNet(), acceptingPN.getNet().getLabel() + " with " + | ||
"colored IPs"); | ||
return copier.colorPlaces(ipFinder.find()).getDeepCopy(); | ||
return color(context, net, initialMarking); | ||
} | ||
|
||
@PluginVariant(variantLabel = "IP-Finder: ILP-based", requiredParameterLabels = {0, 1}) | ||
@UITopiaVariant(affiliation = "PADS Student", author = "Tobias Wirtz", email = "[email protected]") | ||
public Petrinet color(UIPluginContext context, Petrinet net, Marking initialMarking) { | ||
FindMode findmode = chooseFindmode(context); | ||
|
||
StructureBasedImplicitPlaceFinder ipFinder = new StructureBasedImplicitPlaceFinder(net, initialMarking, | ||
FindMode.FIND_ALL_POTENTIAL_IPS); | ||
findmode); | ||
|
||
PetriNetCopier copier = new PetriNetCopier(net, net.getLabel() + " with colored IPs"); | ||
return copier.colorPlaces(ipFinder.find()).getDeepCopy(); | ||
|
@@ -66,4 +67,20 @@ private static Marking chooseInitialMarking(UIPluginContext context, Petrinet ne | |
return initialMarking; | ||
} | ||
|
||
|
||
private static FindMode chooseFindmode(UIPluginContext context) { | ||
// Get the default parameters. | ||
IPFinderParams parameters = new IPFinderParams(false, FindMode.FIND_ALL_POTENTIAL_IPS); | ||
// Get a dialog for this parameters. | ||
VariantSelectionDialog dialog = new VariantSelectionDialog(context, parameters); | ||
// Show the dialog. User can now change the parameters. | ||
TaskListener.InteractionResult result = context.showWizard("Variant Selection", true, true, dialog); | ||
// User has close the dialog. | ||
if (result == TaskListener.InteractionResult.FINISHED) { | ||
// Apply the algorithm depending on whether a connection already exists. | ||
return parameters.getFindMode(); | ||
} | ||
// Dialog got canceled. | ||
return null; | ||
} | ||
} |