diff options
Diffstat (limited to 'Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java')
-rw-r--r-- | Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java b/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java index 51ace4b8..f9041e87 100644 --- a/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java +++ b/Domains/crossingScenario/src/crossingScenario/run/QueryDebug.java | |||
@@ -23,11 +23,16 @@ import crossingScenario.Lane; | |||
23 | 23 | ||
24 | public class QueryDebug { | 24 | public class QueryDebug { |
25 | public static void main(String[] args) throws FileNotFoundException { | 25 | public static void main(String[] args) throws FileNotFoundException { |
26 | checkPrevLanes("outputs/models/1.xmi", "outputs/simplePrevLane.tgf"); | 26 | // checkPrevLanes("outputs/models/1.xmi", "outputs/simplePrevLane.tgf"); |
27 | // testOnInstance(); | 27 | testOnInstance(); |
28 | // miniRETest("21/2"); | 28 | // miniRETest("21/2"); |
29 | } | 29 | } |
30 | 30 | ||
31 | private static Double rndbl(Double in, int places) { | ||
32 | double scale = Math.pow(10, places); | ||
33 | return Math.round(in * scale) / scale; | ||
34 | } | ||
35 | |||
31 | public static void checkPrevLanes(String pathSrc, String pathTgt) throws FileNotFoundException { | 36 | public static void checkPrevLanes(String pathSrc, String pathTgt) throws FileNotFoundException { |
32 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); | 37 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put("*", new XMIResourceFactoryImpl()); |
33 | EPackage.Registry.INSTANCE.put(CrossingScenarioPackage.eNS_URI, CrossingScenarioPackage.eINSTANCE); | 38 | EPackage.Registry.INSTANCE.put(CrossingScenarioPackage.eNS_URI, CrossingScenarioPackage.eINSTANCE); |
@@ -39,7 +44,7 @@ public class QueryDebug { | |||
39 | CrossingScenario cs = ((CrossingScenario) res.getContents().get(0)); | 44 | CrossingScenario cs = ((CrossingScenario) res.getContents().get(0)); |
40 | 45 | ||
41 | for (Actor o : cs.getActors()) { | 46 | for (Actor o : cs.getActors()) { |
42 | String nodeName = "(" + o.getXPos()+","+o.getYPos() + ")"; | 47 | String nodeName = "A(" + rndbl(o.getXPos(), 1)+","+rndbl(o.getYPos(), 1) + ")"; |
43 | printer.println(o.hashCode() + " " + nodeName); | 48 | printer.println(o.hashCode() + " " + nodeName); |
44 | } | 49 | } |
45 | 50 | ||
@@ -48,7 +53,7 @@ public class QueryDebug { | |||
48 | if (cs.getHorizontal_head().equals(o) || cs.getVertical_head().equals(o)) { | 53 | if (cs.getHorizontal_head().equals(o) || cs.getVertical_head().equals(o)) { |
49 | prefix = "HEAD"; | 54 | prefix = "HEAD"; |
50 | } | 55 | } |
51 | String nodeName = prefix + "(" + o.getReferenceCoord() + ")" + | 56 | String nodeName = prefix + "L(" + rndbl(o.getReferenceCoord(), 3) + ")" + |
52 | o.eClass().getName().substring(5, 9); | 57 | o.eClass().getName().substring(5, 9); |
53 | printer.println(o.hashCode() + " " + nodeName); | 58 | printer.println(o.hashCode() + " " + nodeName); |
54 | } | 59 | } |
@@ -57,7 +62,7 @@ public class QueryDebug { | |||
57 | if (o.getPrevLane() != null){ | 62 | if (o.getPrevLane() != null){ |
58 | int curName = o.hashCode(); | 63 | int curName = o.hashCode(); |
59 | int curPrev = o.getPrevLane().hashCode(); | 64 | int curPrev = o.getPrevLane().hashCode(); |
60 | double edgeLabel = o.getPrevLane().getNumWidth(); | 65 | double edgeLabel = rndbl(o.getPrevLane().getNumWidth(), 1); |
61 | printer.println(curName + " " + curPrev + " " + edgeLabel); | 66 | printer.println(curName + " " + curPrev + " " + edgeLabel); |
62 | } | 67 | } |
63 | } | 68 | } |
@@ -82,14 +87,14 @@ public class QueryDebug { | |||
82 | 87 | ||
83 | // ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); | 88 | // ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); |
84 | // // Access pattern matcher | 89 | // // Access pattern matcher |
85 | // CrossingScenarioQueries.instance().prepare(engine); | 90 | // Queries.instance().prepare(engine); |
86 | // | 91 | // |
87 | // Define_referenceCoord_laneWithPrevHasCorrectRefCoord.Matcher matcher = Define_referenceCoord_laneWithPrevHasCorrectRefCoord.Matcher.on(engine); | 92 | // X.Matcher matcher = X.Matcher.on(engine); |
88 | // // Get and iterate over all matches | 93 | // // Get and iterate over all matches |
89 | // System.out.println("MATCHES:"); | 94 | // System.out.println("MATCHES:"); |
90 | // for (Define_referenceCoord_laneWithPrevHasCorrectRefCoord.Match match : matcher.getAllMatches()) { | 95 | // for (X.Match match : matcher.getAllMatches()) { |
91 | // // Print all the matches to the standard output | 96 | // // Print all the matches to the standard output |
92 | // System.out.println(match.getL()); | 97 | // System.out.println(match.getP()); |
93 | // } | 98 | // } |
94 | } | 99 | } |
95 | 100 | ||