Exemplo n.º 1
0
 public Packet(PacketGenerator gen)
 {
     content_id = gen.next_content_id;
     gen.next_content_id++;
     copy_id = 0;
     gen.next_copy_id[content_id] = 1;
 }
Exemplo n.º 2
0
        public static Packet copy(Packet packet, PacketGenerator gen)
        {
            var p = new Packet()
            {
                content_id       = packet.content_id,
                generationTime   = packet.generationTime,
                startRelay       = packet.startRelay,
                sink             = packet.sink,
                result           = Result.None,
                copy_id          = gen.next_copy_id[packet.content_id],
                hopsIds          = packet.hopsIds.ToList(),
                receivedTimes    = packet.receivedTimes.ToList(),
                right_jump_index = packet.right_jump_index
            };

            gen.next_copy_id[p.content_id]++;
            return(p);
        }