Exemple #1
0
        /// <summary>
        ///   Recycles a Fallen-8 instance.
        /// </summary>
        /// <param name='instance'> Fallen-8 instance. </param>
        public void RecycleFallen8(Fallen8 instance)
        {
            instance.TabulaRasa();

            if (_instances.Count < _maxValue)
            {
                _instances.Enqueue(instance);
            }
        }
        public void CreateGraph(int nodeCount, int edgeCount)
        {
            _f8.TabulaRasa();
            var creationDate = DateHelper.ConvertDateTime(DateTime.Now);
            var vertexIDs    = new List <Int32> ();
            var prng         = new Random();

            if (nodeCount < _numberOfToBeTestedVertices)
            {
                _numberOfToBeTestedVertices = nodeCount;
            }

            _toBeBenchenVertices = new List <VertexModel> (_numberOfToBeTestedVertices);

            for (var i = 0; i < nodeCount; i++)
            {
                vertexIDs.Add(_f8.CreateVertex(creationDate).Id);
            }

            if (edgeCount != 0)
            {
                foreach (var aVertexId in vertexIDs)
                {
                    var targetVertices = new HashSet <Int32> ();

                    do
                    {
                        targetVertices.Add(vertexIDs [prng.Next(0, vertexIDs.Count)]);
                    } while (targetVertices.Count < edgeCount);

                    foreach (var aTargetVertex in targetVertices)
                    {
                        _f8.CreateEdge(aVertexId, 0, aTargetVertex, creationDate);
                    }
                }

                _toBeBenchenVertices.AddRange(PickInterestingIDs(vertexIDs, prng)
                                              .Select(aId => {
                    VertexModel v = null;

                    _f8.TryGetVertex(out v, aId);

                    return(v);
                }));
            }
        }
Exemple #3
0
 public void TabulaRasa()
 {
     _fallen8.TabulaRasa();
 }
Exemple #4
0
        /// <summary>
        ///   Recycles a Fallen-8 instance.
        /// </summary>
        /// <param name='instance'> Fallen-8 instance. </param>
        public void RecycleFallen8(Fallen8 instance)
        {
            instance.TabulaRasa();

            if (_instances.Count < _maxValue)
            {
                _instances.Enqueue(instance);
            }
        }