private List<XEventClassifier> fetchClassifiers(XLogArray array) { List<XEventClassifier> classifiers = new ArrayList<>(); classifiers.addAll(array.get(0).getClassifiers()); for (int i = 1; i < array.size(); i++) { classifiers.retainAll(array.get(i).getClassifiers()); } return classifiers; }
@Override public void doWork() throws OperatorException { AlignmentAnalyzerParametersImpl params; try { params = parseParameters(); } catch (IOException e) { throw new OperatorException(e.getMessage()); } PluginContext context = ProMPluginContextManager.instance() .getFutureResultAwareContext(AlignmentAPNAnalyzerPlugin.class); XSEventStream stream = getStreamPort().getData(XSEventStreamIOObject.class).getArtifact(); XLogArray arr = new XLogArray(); for (InputPort i : referenceLogsPort.getManagedPorts()) { try { arr.add(i.getData(XLogIOObject.class).getArtifact()); } catch (UserError e) { } } // TODO: use meta-data to process classifiers! List<XEventClassifier> classifiers = fetchClassifiers(arr); params.setClassifier(classifiers.get(0)); List<XSEventStreamToAcceptingPetriNetReader> algos = new ArrayList<XSEventStreamToAcceptingPetriNetReader>(); for (InputPort i : getAlgorithmsPort().getManagedPorts()) { try { algos.add( (XSEventStreamToAcceptingPetriNetReader) i.getData(XSEventStreamToAcceptingPetriNetReaderIOObject.class).getArtifact()); } catch (UserError e) { } } XSStreamAnalyzer< XSEvent, Map<XSReader<XSEvent, AcceptingPetriNet>, Map<Long, Iterable<Iterable<Double>>>>, AcceptingPetriNet> analyzer = AlignmentAPNAnalyzerPlugin.run( context, stream, arr, params, algos.toArray(new XSEventStreamToAcceptingPetriNetReader[algos.size()])); getAnalyzerPort() .deliver( new XSStreamAnalyzerIOObject< XSEvent, Map<XSReader<XSEvent, AcceptingPetriNet>, Map<Long, Iterable<Iterable<Double>>>>, AcceptingPetriNet>(analyzer, context)); }