org.jbpt.petri.unfolding.AbstractPossibleExtensions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbpt-petri Show documentation
Show all versions of jbpt-petri Show documentation
The jBPT code library is a compendium of technologies that support research on design, execution, and evaluation of business processes.
The newest version!
package org.jbpt.petri.unfolding;
import java.util.Iterator;
import java.util.TreeSet;
import org.jbpt.petri.IFlow;
import org.jbpt.petri.IMarking;
import org.jbpt.petri.INode;
import org.jbpt.petri.IPlace;
import org.jbpt.petri.ITransition;
import org.jbpt.petri.unfolding.order.AbstractEventComparator;
import org.jbpt.petri.unfolding.order.IAdequateOrder;
public class AbstractPossibleExtensions, C extends ICondition, E extends IEvent, F extends IFlow, N extends INode, P extends IPlace, T extends ITransition, M extends IMarking>
extends TreeSet
implements IPossibleExtensions
{
private static final long serialVersionUID = -2255908039950562882L;
private IAdequateOrder order = null;
public AbstractPossibleExtensions(IAdequateOrder order) {
super(new AbstractEventComparator(order));
this.order = order;
}
@Override
public E getMinimal() {
if (order.isTotal())
return this.first();
Iterator i = this.iterator();
E min = i.next();
if (!i.hasNext()) return min;
ILocalConfiguration lcMin = min.getLocalConfiguration();
while (i.hasNext()) {
E e = i.next();
ILocalConfiguration lce = e.getLocalConfiguration();
if (this.order.isSmaller(lce,lcMin)) {
min = e;
lcMin = lce;
}
}
return min;
}
}