Class Timeline<Timestamp extends java.lang.Comparable<Timestamp>>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.matchers.util.timeline.Timeline<Timestamp>
-
- Direct Known Subclasses:
CompactTimeline
,SingletonTimeline
public abstract class Timeline<Timestamp extends java.lang.Comparable<Timestamp>> extends java.lang.Object
A timeline describes the life cycle of a piece of data (typically a tuple in a relation) as a sequence of moments. Even moments represent appearances, odd moments represent disappearances. A timeline is immutable, once created, it is not possible to extend it with further moments.- Since:
- 2.4
-
-
Constructor Summary
Constructors Constructor Description Timeline()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Iterable<Signed<Timestamp>>
asChangeSequence()
abstract Signed<Timestamp>
getSigned(int index)
abstract Timestamp
getUnsigned(int index)
abstract boolean
isEmpty()
abstract boolean
isPresentAtInfinity()
Timeline<Timestamp>
mergeAdditive(Diff<Timestamp> diff)
Merges this timeline with the given timestamp diff.Timeline<Timestamp>
mergeMultiplicative(Timeline<Timestamp> that)
abstract int
size()
java.lang.String
toString()
-
-
-
Method Detail
-
isPresentAtInfinity
public abstract boolean isPresentAtInfinity()
-
isEmpty
public abstract boolean isEmpty()
-
size
public abstract int size()
-
getUnsigned
public abstract Timestamp getUnsigned(int index)
-
mergeAdditive
public Timeline<Timestamp> mergeAdditive(Diff<Timestamp> diff)
Merges this timeline with the given timestamp diff. The expectation is that the resulting timeline starts with an insertion. The logic is similar to a merge sort; we iterate side-by-side over the timeline and the diff. During the merge, cancellation can happen if at the same timestamp we observe different signs at the corresponding timeline and diff elements.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-