Skip to content

Commit

Permalink
Reorganisation
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Dec 17, 2024
1 parent 923eba8 commit f1bd9ef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
package de.fraunhofer.aisec.cpg.graph

import de.fraunhofer.aisec.cpg.graph.concepts.OverlaySingleEdge
import de.fraunhofer.aisec.cpg.graph.edges.overlay.OverlaySingleEdge
import de.fraunhofer.aisec.cpg.graph.edges.unwrapping
import org.neo4j.ogm.annotation.Relationship

Expand All @@ -45,3 +45,4 @@ abstract class OverlayNode() : Node() {
)
var underlyingNode by unwrapping(OverlayNode::underlyingNodeEdge)
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@
*/
package de.fraunhofer.aisec.cpg.graph.concepts

import de.fraunhofer.aisec.cpg.graph.Node
import de.fraunhofer.aisec.cpg.graph.OverlayNode
import de.fraunhofer.aisec.cpg.graph.edges.Edge
import de.fraunhofer.aisec.cpg.graph.edges.collections.EdgeSingletonList
import de.fraunhofer.aisec.cpg.graph.edges.collections.MirroredEdgeCollection
import kotlin.reflect.KProperty

/**
* Represents a new concept added to the CPG. This is intended for modelling "concepts" like
Expand All @@ -41,21 +36,3 @@ abstract class Concept<T : Operation>() : OverlayNode() {
/** All [Operation]s belonging to this concept. */
val ops: Set<T> = setOf()
}

class OverlayEdge(start: Node, end: Node) : Edge<Node>(start, end) {
override var labels: Set<String> = setOf("OVERLAY")
}

class OverlaySingleEdge(
thisRef: Node,
of: Node?,
override var mirrorProperty: KProperty<MutableCollection<OverlayEdge>>,
outgoing: Boolean = true,
) :
EdgeSingletonList<Node, Node?, OverlayEdge>(
thisRef = thisRef,
init = ::OverlayEdge,
outgoing = outgoing,
of = of,
),
MirroredEdgeCollection<Node, OverlayEdge>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package de.fraunhofer.aisec.cpg.graph.edges.overlay

import de.fraunhofer.aisec.cpg.graph.Node
import de.fraunhofer.aisec.cpg.graph.edges.Edge
import de.fraunhofer.aisec.cpg.graph.edges.collections.EdgeSingletonList
import de.fraunhofer.aisec.cpg.graph.edges.collections.MirroredEdgeCollection
import kotlin.reflect.KProperty


class OverlayEdge(start: Node, end: Node) : Edge<Node>(start, end) {
override var labels: Set<String> = setOf("OVERLAY")
}

class OverlaySingleEdge(
thisRef: Node,
of: Node?,
override var mirrorProperty: KProperty<MutableCollection<OverlayEdge>>,
outgoing: Boolean = true,
) :
EdgeSingletonList<Node, Node?, OverlayEdge>(
thisRef = thisRef,
init = ::OverlayEdge,
outgoing = outgoing,
of = of,
),
MirroredEdgeCollection<Node, OverlayEdge>
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Neo4JTest {

val connect = Connect(concept = nw)
connect.underlyingNode = connectCall
connect.name = Name("connect")

assertEquals(connect, connectCall?.overlayNode)

Expand Down

0 comments on commit f1bd9ef

Please sign in to comment.