blob: dee31f6793c51091dba6ee28e7829c32a3d3afdd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.aggregators
import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.Interval
import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalAggregationMode
import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.interval.IntervalAggregationOperator
import org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.AggregatorType
import org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.BoundAggregator
import org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.IAggregatorFactory
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
@AggregatorType(parameterTypes=#[Interval], returnTypes=#[Interval])
abstract class IntervalAggregatorFactory implements IAggregatorFactory {
val IntervalAggregationMode mode
@FinalFieldsConstructor
protected new() {
}
override getAggregatorLogic(Class<?> domainClass) {
if (domainClass == Interval) {
new BoundAggregator(new IntervalAggregationOperator(mode), Interval, Interval)
} else {
throw new IllegalArgumentException("Unknown domain class: " + domainClass)
}
}
}
class intervalSum extends IntervalAggregatorFactory {
new() {
super(IntervalAggregationMode.SUM)
}
}
class intervalMin extends IntervalAggregatorFactory {
new() {
super(IntervalAggregationMode.MIN)
}
}
class intervalMax extends IntervalAggregatorFactory {
new() {
super(IntervalAggregationMode.MAX)
}
}
class intervalJoin extends IntervalAggregatorFactory {
new() {
super(IntervalAggregationMode.JOIN)
}
}
|