mbeckerle commented on a change in pull request #228: Incremental progress on 
Daffodil 1444 schema compiler space/speed issue.
URL: https://github.com/apache/incubator-daffodil/pull/228#discussion_r291751451
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/Root.scala
 ##########
 @@ -45,4 +47,111 @@ final class Root(defXML: Node, parentArg: SchemaDocument,
   override lazy val referencedElement = globalElementDecl
 
   lazy val rootParseUnparsePolicy = defaultParseUnparsePolicy
+
+  /**
+   * For any given global schema component, tells us what schema components 
contain
+   * references to it, and if that reference is from a sequence or choice, the 
index of
+   * the group member within that sequence/choice.
+   *
+   * This is intended to be used when compilation needs to understand
+   * the context where an object is referenced. This allows the various 
referencing contexts
+   * to be known, without making copies of schema components for each such 
context.
+   */
+  lazy val refMap: Map[SchemaComponentFactory, Seq[(String, Seq[RefSpec])]] = {
+    val refEntries: Seq[(SchemaComponentFactory, Seq[RefSpec])] =
+      refTargets.groupBy { _.to }.toSeq
+    val m: Seq[(SchemaComponentFactory, Seq[(String, Seq[RefSpec])])] = 
refEntries.map {
+      case (to, seq) => (to, seq.groupBy { _.from.sscd }.toSeq)
+    }
+    m.toMap
+  }
+
+  lazy val refPairsMap: Map[SchemaComponentFactory, Seq[String]] = {
+    refMap.toSeq.map {
+      case (to, seq: Seq[(String, _)]) => (to, seq.map { case (sscd, _) => 
sscd }.toSeq)
+    }.toMap
+  }
+
+  //  lazy val refMapLexicalPairs = refMap.toSeq.map{
 
 Review comment:
   delete

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to