mbeckerle commented on code in PR #1158:
URL: https://github.com/apache/daffodil/pull/1158#discussion_r1488179699


##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/NodeInfo.scala:
##########
@@ -198,58 +199,39 @@ object NodeInfo extends Enum {
     }
 
     def isError: Boolean = false
-    def primType = this
+
+    private lazy val optPrimType_ = Some(this)
+    override def optPrimType: Option[PrimType] = optPrimType_
 
     def fromXMLString(s: String): DataValuePrimitive
 
     override def toString = name
   }
 
-  private def getTypeNode(name: String) = {
-    val namelc = name.toLowerCase()
-    allTypes.find(stn => stn.lcaseName == namelc)
-  }
-
-  /**
-   * For Java API use, we have a very restricted trait api.PrimitiveType
-   * mixed into PrimTypeNode, so that we can hand PrimTypeNode as result
-   * from methods callable from Java without exposing all of PrimType's
-   * implementation.
-   * @param name lookup key, case insensitive
-   * @return an api.PrimitiveType, or null if there is no type with that name.
-   */
-  def primitiveTypeFromName(name: String): PrimitiveType = {
-    allDFDLTypesLookupTable.get(name)
-  }
-
-  def isXDerivedFromY(nameX: String, nameY: String): Boolean = {
-    if (nameX == nameY) true
-    else {
-      getTypeNode(nameX) match {
-        case Some(stn) => {
-          stn.doesParentListContain(nameY)
-        }
-        case None => false
-      }
-    }
-  }
-
   sealed trait Kind extends EnumValueType with PrimTypeView {
 
     def name: String = Misc.getNameFromClass(this)
 
     def parents: Seq[Kind]
     def children: Seq[Kind]
 
-    final lazy val isHead: Boolean = parents.isEmpty
-    final lazy val lcaseName = name.toLowerCase()
+    /**
+     * The prim type corresponding to this type.
+     * So if this Kind is derived from a PrimType kind, then
+     * this kind should return that prim type object.
+     *
+     * @return None if there is no corresponding prim type.
+     */
+    def optPrimType: Option[PrimType] = None
 
-    final lazy val selfAndAllParents: Set[Kind] = parents.flatMap {
+    private final lazy val lcaseName = name.toLowerCase()

Review Comment:
   I will drop this method and associated.
   
   Note that this graph of NodeInfo TypeNode objects is basically a tiny static 
data structure. There are fewer than 30 such objects. Everything else just 
points at these objects or uses their types (called Kinds)  to represent a DFDL 
type or other static characteristic of data or an argument/result of an 
expression. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to