FindOverlap() public method

public FindOverlap ( Node node1, Node node2 ) : void
node1 Node
node2 Node
return void
Exemplo n.º 1
0
        public static void Run(RelayOverlapSimulator sim, Address addr1, Address addr2)
        {
            Console.WriteLine("Beginning");
            sim.Complete(false);

            SimpleTimer.RunSteps(1000000, false);
            StructuredNode node1 = (sim.Nodes[addr1] as NodeMapping).Node as StructuredNode;
            StructuredNode node2 = (sim.Nodes[addr2] as NodeMapping).Node as StructuredNode;

            sim.Complete(true);

            ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);

            mco.Start();
            node1.AddConnectionOverlord(mco);
            mco.Set(addr2);

            Connection con1 = node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2);

            while (con1 == null)
            {
                SimpleTimer.RunStep();
                con1 = node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2);
            }

            Console.WriteLine(addr1 + "<=>" + addr2 + ":");
            Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
            sim.FindOverlap(node1, node2);
            node1.Disconnect();
            node2.Disconnect();
            SimpleTimer.RunSteps(100000);
            Console.WriteLine("End");
        }
Exemplo n.º 2
0
        // Static Members

        public static void Simulator(RelayOverlapSimulator sim)
        {
            Address addr1 = null, addr2 = null;

            sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
            sim.Complete(false);
            SimpleTimer.RunSteps(1000000, false);

            StructuredNode node1 = (sim.Nodes[addr1] as NodeMapping).Node as StructuredNode;
            StructuredNode node2 = (sim.Nodes[addr2] as NodeMapping).Node as StructuredNode;

            ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);

            mco.Start();
            node1.AddConnectionOverlord(mco);
            mco.Set(addr2);
            SimpleTimer.RunSteps(100000, false);

            Console.WriteLine(addr1 + "<=>" + addr2 + ":");
            Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
            sim.PrintConnections(node1);
            Console.WriteLine();
            sim.PrintConnections(node2);

            Console.WriteLine("\nPhase 2 -- Disconnect...");
            sim.FindOverlap(node1, node2);
            sim.CloseOverlap(node1);
            sim.CloseOverlap(node2);

            SimpleTimer.RunSteps(100000, false);

            Console.WriteLine(addr1 + "<=>" + addr2 + ":");
            Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
            sim.PrintConnections(node1);
            Console.WriteLine();
            sim.PrintConnections(node2);

            sim.Disconnect();
        }
Exemplo n.º 3
0
    public static void Run(RelayOverlapSimulator sim, Address addr1, Address addr2)
    {
      Console.WriteLine("Beginning");
      sim.Complete(false);

      SimpleTimer.RunSteps(1000000, false);
      StructuredNode node1 = (sim.Nodes[addr1] as NodeMapping).Node as StructuredNode;
      StructuredNode node2 = (sim.Nodes[addr2] as NodeMapping).Node as StructuredNode;
      sim.Complete(true);

      ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);
      mco.Start();
      node1.AddConnectionOverlord(mco);
      mco.Set(addr2);

      Connection con1 = node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2);
      while(con1 == null) {
        SimpleTimer.RunStep();
        con1 = node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2);
      }

      Console.WriteLine(addr1 + "<=>" + addr2 + ":");
      Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
      sim.FindOverlap(node1, node2);
      node1.Disconnect();
      node2.Disconnect();
      SimpleTimer.RunSteps(100000);
      Console.WriteLine("End");
    }
Exemplo n.º 4
0
    // Static Members

    public static void Simulator(RelayOverlapSimulator sim)
    {
      Address addr1 = null, addr2 = null;
      sim.AddDisconnectedPair(out addr1, out addr2, sim.NCEnable);
      sim.Complete(false);
      SimpleTimer.RunSteps(1000000, false);

      StructuredNode node1 = (sim.Nodes[addr1] as NodeMapping).Node as StructuredNode;
      StructuredNode node2 = (sim.Nodes[addr2] as NodeMapping).Node as StructuredNode;

      ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node1);
      mco.Start();
      node1.AddConnectionOverlord(mco);
      mco.Set(addr2);
      SimpleTimer.RunSteps(100000, false);

      Console.WriteLine(addr1 + "<=>" + addr2 + ":");
      Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
      sim.PrintConnections(node1);
      Console.WriteLine();
      sim.PrintConnections(node2);

      Console.WriteLine("\nPhase 2 -- Disconnect...");
      sim.FindOverlap(node1, node2);
      sim.CloseOverlap(node1);
      sim.CloseOverlap(node2);

      SimpleTimer.RunSteps(100000, false);

      Console.WriteLine(addr1 + "<=>" + addr2 + ":");
      Console.WriteLine("\t" + node1.ConnectionTable.GetConnection(ConnectionType.Structured, addr2) + "\n");
      sim.PrintConnections(node1);
      Console.WriteLine();
      sim.PrintConnections(node2);

      sim.Disconnect();
    }