Skip to content
Snippets Groups Projects
Commit c4f079c4 authored by Andrea Burattin's avatar Andrea Burattin
Browse files

Added first mapper

parent e2494442
No related branches found
No related tags found
No related merge requests found
package beamline.mappers;
import org.deckfour.xes.model.XEvent;
public class DirectlyFollowsRelation {
private String caseId;
public XEvent first;
public XEvent second;
public DirectlyFollowsRelation(String caseId, XEvent first, XEvent second) {
this.caseId = caseId;
this.first = first;
this.second = second;
}
public String getCaseId() {
return caseId;
}
public XEvent getFirst() {
return first;
}
public XEvent getSecond() {
return second;
}
}
package beamline.mappers;
import java.util.HashMap;
import java.util.Map;
import org.deckfour.xes.extension.std.XConceptExtension;
import org.deckfour.xes.model.XEvent;
import org.deckfour.xes.model.XTrace;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableSource;
import io.reactivex.rxjava3.functions.Function;
public class InfiniteSizeDirectlyFollowsMapper implements Function<XTrace, ObservableSource<DirectlyFollowsRelation>> {
private Map<String, XEvent> map = new HashMap<String, XEvent>();
@Override
public @NonNull ObservableSource<DirectlyFollowsRelation> apply(@NonNull XTrace t) throws Throwable {
String caseId = XConceptExtension.instance().extractName(t);
DirectlyFollowsRelation toRet = null;
if (map.containsKey(caseId)) {
toRet = new DirectlyFollowsRelation(caseId, map.get(caseId), t.get(0));
}
map.put(caseId, t.get(0));
if (toRet == null) {
return Observable.empty();
} else {
return Observable.just(toRet);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment