Exemple #1
0
 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);
     }));
 }
Exemple #2
0
 public EdgeActor(NodeActor <TNode, TEdge> nodeA, NodeActor <TNode, TEdge> nodeB)
 {
     NodeA = nodeA;
     NodeB = nodeB;
 }
Exemple #3
0
 public void RemoveNode(NodeActor <TNode, TEdge> node)
 {
     this.SendMessage(GraphOperation.RemoveNode, node);
 }
Exemple #4
0
 public void Adjacent(NodeActor <TNode, TEdge> nodeA, IActor sender)
 {
     this.SendMessage(GraphOperation.Adjacent, nodeA, sender);
 }
Exemple #5
0
 public void AddEdge(NodeActor <TNode, TEdge> node)
 {
     this.SendMessage(GraphOperation.AddEdge, node);
 }