public BehaviorGraph() : base() { fNodeCollection = new List <NodeActor <TNode, TEdge> >(); Become(new Behavior <GraphOperation, NodeActor <TNode, TEdge> >( (o, n) => o == GraphOperation.AddNode, (o, n) => fNodeCollection.Add(n))); AddBehavior(new Behavior <GraphOperation, NodeActor <TNode, TEdge> >( (o, n) => o == GraphOperation.RemoveNode, (o, n) => fNodeCollection.Remove(n))); AddBehavior(new Behavior <GraphOperation, IActor>( (o, a) => o == GraphOperation.PickUpNode, (o, a) => { NodeActor <TNode, TEdge> node = fNodeCollection.FirstOrDefault(); a.SendMessage(this, node); })); }
public EdgeActor(NodeActor <TNode, TEdge> nodeA, NodeActor <TNode, TEdge> nodeB) { NodeA = nodeA; NodeB = nodeB; }
public void RemoveNode(NodeActor <TNode, TEdge> node) { this.SendMessage(GraphOperation.RemoveNode, node); }
public void Adjacent(NodeActor <TNode, TEdge> nodeA, IActor sender) { this.SendMessage(GraphOperation.Adjacent, nodeA, sender); }
public void AddEdge(NodeActor <TNode, TEdge> node) { this.SendMessage(GraphOperation.AddEdge, node); }