GraphMine

graphmine-core / io.github.sof3.graphmine.feature / FeatureGraph

FeatureGraph

class FeatureGraph

The Feature Graph is the main registry of features in the server. It is an undirected multi-graph that allows FeatureEdges (the features themselves) to handle interaction events (FeatureEvent) between FeatureNodes (the objects of features, e.g. entities, blocks, or abstract concepts like commands), or self-loop edges that handle events on a single object (e.g. player join).

Constructors

<init> FeatureGraph()
The Feature Graph is the main registry of features in the server. It is an undirected multi-graph that allows FeatureEdges (the features themselves) to handle interaction events (FeatureEvent) between FeatureNodes (the objects of features, e.g. entities, blocks, or abstract concepts like commands), or self-loop edges that handle events on a single object (e.g. player join).

Properties

edges val edges: MutableMap<FeatureNode<*, *>, MutableMap<FeatureNode<*, *>, MutableSet<FeatureEdge<*, *, *, *>>>>
the features registered on this server

Functions

addEdge fun addEdge(edge: FeatureEdge<out FeatureNode<*, *>, out FeatureNode<*, *>, out FeatureNodeInstance<*, *>, out FeatureNodeInstance<*, *>>): Unit
Registers a FeatureEdge
addNode fun addNode(node: FeatureNode<*, *>): Unit
Registers a FeatureNode so that edges can be added upon it
dispatch fun <Inst1 : FeatureNodeInstance<Inst1, *>, Inst2 : FeatureNodeInstance<Inst2, *>> dispatch(inst1: Inst1, inst2: Inst2, event: FeatureEvent): Unit
Dispatch a single-node eventfun <Inst : FeatureNodeInstance<Inst, *>> dispatch(inst: Inst, event: FeatureEvent): Unit
Dispatch a two-node event

Extension Functions

handle fun <Node : FeatureNode<Node, Inst>, Inst : FeatureNodeInstance<Inst, Node>, Ev : FeatureEvent> FeatureGraph.handle(node: Node, fn: (inst: Inst, event: Ev) -> Unit): Unit
A convenient wrapper for FeatureGraph.addEdge and SingleFeatureEdge construction (for one node)fun <Node1 : FeatureNode<Node1, Inst1>, Inst1 : FeatureNodeInstance<Inst1, Node1>, Node2 : FeatureNode<Node2, Inst2>, Inst2 : FeatureNodeInstance<Inst2, Node2>, Ev : FeatureEvent> FeatureGraph.handle(node1: Node1, node2: Node2, fn: (inst1: Inst1, inst2: Inst2, event: Ev) -> Unit): Unit
A convenient wrapper for FeatureGraph.addEdge and FeatureEdge construction (for two nodes)