Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Dec 13, 2024
1 parent 34435a8 commit 0571d6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fun <T : Edge<Node>> Node.printGraph(
private fun Edge<Node>.label(): String {
val builder = StringBuilder()
builder.append("\"")
builder.append(this.labels)
builder.append(this.labels.joinToString(","))

if (this is Dataflow) {
var granularity = this.granularity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ import org.neo4j.ogm.annotation.*

/** This property edge describes a parent/child relationship in the Abstract Syntax Tree (AST). */
@RelationshipEntity
open class AstEdge<T : Node>(start: Node, end: T, override var labels: Set<String> = setOf("AST")) :
Edge<T>(start, end) {
open class AstEdge<T : Node>(start: Node, end: T) : Edge<T>(start, end) {
init {
end.astParent = start
}

override var labels: Set<String> = setOf("AST")
}

/** Creates an [AstEdges] container starting from this node. */
Expand All @@ -53,11 +54,11 @@ fun <NodeType : Node> Node.astEdgesOf(
* container).
*/
fun <NodeType : Node> Node.astOptionalEdgeOf(
onChanged: ((old: AstEdge<NodeType>?, new: AstEdge<NodeType>?) -> Unit)? = null
onChanged: ((old: AstEdge<NodeType>?, new: AstEdge<NodeType>?) -> Unit)? = null,
): EdgeSingletonList<NodeType, NodeType?, AstEdge<NodeType>> {
return EdgeSingletonList(
thisRef = this,
init = { start, end -> AstEdge(start, end) },
init = ::AstEdge,
outgoing = true,
onChanged = onChanged,
of = null
Expand All @@ -73,7 +74,7 @@ fun <NodeType : Node> Node.astEdgeOf(
): EdgeSingletonList<NodeType, NodeType, AstEdge<NodeType>> {
return EdgeSingletonList(
thisRef = this,
init = { start, end -> AstEdge(start, end) },
init = ::AstEdge,
outgoing = true,
onChanged = onChanged,
of = of
Expand All @@ -88,7 +89,7 @@ open class AstEdges<NodeType : Node, PropertyEdgeType : AstEdge<NodeType>>(
@Suppress("UNCHECKED_CAST")
init: (start: Node, end: NodeType) -> PropertyEdgeType = { start, end ->
AstEdge(start, end) as PropertyEdgeType
},
}
) :
EdgeList<NodeType, PropertyEdgeType>(
thisRef = thisRef,
Expand Down

0 comments on commit 0571d6e

Please sign in to comment.