@@ -447,7 +447,13 @@ class CodeGen(schema: Schema) {
447
447
}.mkString(" " )
448
448
449
449
def abstractEdgeAccessors (nodeBaseType : NodeBaseType , direction : Direction .Value ) = {
450
- nodeBaseType.edges(direction).groupBy(_.viaEdge).map { case (edge, neighbors) =>
450
+ val edgeAndNeighbors = nodeBaseType
451
+ .edges(direction)
452
+ .groupBy(_.viaEdge)
453
+ .toSeq
454
+ .map { case (edge, neighors) => (edge, neighors.sortBy(_.neighbor.name)) }
455
+ .sortBy { case (edge, _) => edge.name }
456
+ edgeAndNeighbors.map { case (edge, neighbors) =>
451
457
val edgeAccessorName = neighborAccessorNameForEdge(edge, direction)
452
458
/** TODO bring this back, but not as direct accessors on the type, but via extension methods
453
459
* context: in complex schema hierarchies, type inheritance between base nodes
@@ -590,7 +596,7 @@ class CodeGen(schema: Schema) {
590
596
* assigning numbers here must follow the same way as in NodeLayoutInformation, i.e. starting at 0,
591
597
* first assign ids to the outEdges based on their order in the list, and then the same for inEdges */
592
598
var _currOffsetPos = - 1
593
- def nextOffsetPos : Int = { _currOffsetPos += 1 ; _currOffsetPos }
599
+ def nextOffsetPos () : Int = { _currOffsetPos += 1 ; _currOffsetPos }
594
600
595
601
case class AjacentNodeWithInheritanceStatus (adjacentNode : AdjacentNode , isInherited : Boolean )
596
602
@@ -614,12 +620,19 @@ class CodeGen(schema: Schema) {
614
620
}
615
621
616
622
def createNeighborInfos (neighborContexts : Seq [AjacentNodeWithInheritanceStatus ], direction : Direction .Value ): Seq [NeighborInfoForEdge ] = {
617
- neighborContexts.groupBy(_.adjacentNode.viaEdge).map { case (edge, neighborContexts) =>
618
- val neighborInfoForNodes = neighborContexts.map { case AjacentNodeWithInheritanceStatus (adjacentNode, isInherited) =>
619
- NeighborInfoForNode (adjacentNode.neighbor, edge, direction, adjacentNode.cardinality, isInherited, adjacentNode.customStepName, adjacentNode.customStepDoc)
623
+ neighborContexts
624
+ .groupBy(_.adjacentNode.viaEdge)
625
+ .toSeq
626
+ .sortBy { case (edge, _) => edge.name }
627
+ .map { case (edge, neighborContexts) =>
628
+ val neighborInfoForNodes =
629
+ neighborContexts
630
+ .sortBy(_.adjacentNode.neighbor.name)
631
+ .map { case AjacentNodeWithInheritanceStatus (adjacentNode, isInherited) =>
632
+ NeighborInfoForNode (adjacentNode.neighbor, edge, direction, adjacentNode.cardinality, isInherited, adjacentNode.customStepName, adjacentNode.customStepDoc)
633
+ }
634
+ NeighborInfoForEdge (edge, neighborInfoForNodes, nextOffsetPos())
620
635
}
621
- NeighborInfoForEdge (edge, neighborInfoForNodes, nextOffsetPos)
622
- }.toSeq
623
636
}
624
637
625
638
val neighborOutInfos = createNeighborInfos(adjacentNodesWithInheritanceStatus(_.outEdges), Direction .OUT )
@@ -931,7 +944,7 @@ class CodeGen(schema: Schema) {
931
944
932
945
val neighborAccessorDelegators = neighborInfos.map { case (neighborInfo, direction) =>
933
946
val edgeAccessorName = neighborAccessorNameForEdge(neighborInfo.edge, direction)
934
- val nodeDelegators = neighborInfo.nodeInfos.collect {
947
+ val nodeDelegators = neighborInfo.nodeInfos.sortBy(_.neighborNode.name). collect {
935
948
case neighborNodeInfo if ! neighborNodeInfo.isInherited =>
936
949
val accessorNameForNode = accessorName(neighborNodeInfo)
937
950
s """ /** ${neighborNodeInfo.customStepDoc.getOrElse(" " )}
0 commit comments