blob: 21867a4e8292b24515bcdd71bcc41fbf64d01b7b (
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
51
52
53
|
package hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse
import java.util.List
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
import java.util.LinkedList
import org.eclipse.emf.ecore.EObject
import java.util.Map
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.viatra.dse.base.ThreadContext
import java.util.TreeMap
import java.util.SortedMap
class SolutionStoreWithCopy {
long runtime = 0
List<PartialInterpretation> solutions = new LinkedList
//public List<SortedMap<String,Integer>> additionalMatches = new LinkedList
List<Map<EObject,EObject>> copyTraces = new LinkedList
long sartTime = System.nanoTime
List<Long> solutionTimes = new LinkedList
/*def newSolution(ThreadContext context, SortedMap<String,Integer> additonalMatch) {
additionalMatches+= additonalMatch
newSolution(context)
}*/
def Map<EObject,EObject> newSolution(ThreadContext context) {
//print(System.nanoTime-initTime + ";")
val copyStart = System.nanoTime
val solution = context.model as PartialInterpretation
val copier = new EcoreUtil.Copier
val solutionCopy = copier.copy(solution) as PartialInterpretation
copier.copyReferences
solutions.add(solutionCopy)
copyTraces.add(copier)
runtime += System.nanoTime - copyStart
solutionTimes.add(System.nanoTime-sartTime)
return copier
}
def getSumRuntime() {
return runtime
}
def getAllRuntimes() {
return solutionTimes
}
def getSolutions() {
solutions
}
def getCopyTraces() {
return copyTraces
}
}
|