-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/beamline/mappers/DirectlyFollowsRelation.java
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/beamline/mappers/InfiniteSizeDirectlyFollowsMapper.java
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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); | ||
} | ||
} | ||
|
||
} |