Exemplo n.º 1
0
 /// <summary>
 /// Allows you to clone ApiInfo
 /// </summary>
 /// <returns>A clone of <seealso cref="ApiInfo"/></returns>
 public ApiInfo Clone()
 {
     return(new ApiInfo(Links.Clone(),
                        Etag != null ? new string(Etag.ToCharArray()) : null,
                        RateLimit?.Clone(),
                        FairUsageLimit?.Clone()));
 }
Exemplo n.º 2
0
    public override void Execute()
    {
        Results = new Hashtable();
        Nodes   = (Hashtable)GlobalVariables.Graphnodes[1];
        Links   = (Hashtable)GlobalVariables.Graphlinks[1];
        Hashtable NodesCopy = (Hashtable)Nodes.Clone();
        Hashtable LinksCopy = (Hashtable)Links.Clone();

        bestClusters = getClustering(NodesCopy, LinksCopy);
        Results.Clear();

        int Clustercount = 1;

        foreach (List <Node> cluster in bestClusters)
        {
            foreach (Node node in cluster)
            {
                if (!Results.Contains(node.Id))
                {
                    Results.Add(node.Id, "Cluster " + Clustercount);
                }
            }
            Clustercount++;
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// Allows you to clone ApiInfo
 /// </summary>
 /// <returns>A clone of <seealso cref="ApiInfo"/></returns>
 public ApiInfo Clone()
 {
     return(new ApiInfo(Links.Clone(),
                        OauthScopes.Clone(),
                        AcceptedOauthScopes.Clone(),
                        Etag != null ? new string(Etag.ToCharArray()) : null,
                        RateLimit != null ? RateLimit.Clone() : null));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Allows you to clone ApiInfo
        /// </summary>
        /// <returns>A clone of <seealso cref="ApiInfo"/></returns>
        public ApiInfo Clone()
        {
            // Seem to have to do this to pass a whole bunch of tests (for example Octokit.Tests.Clients.EventsClientTests.DeserializesCommitCommentEventCorrectly)
            // I believe this has something to do with the Mocking framework.
            if (Links == null || OauthScopes == null || RateLimit == null || Etag == null)
            {
                return(null);
            }

            return(new ApiInfo(Links.Clone(),
                               OauthScopes.Clone(),
                               AcceptedOauthScopes.Clone(),
                               new string(Etag.ToCharArray()),
                               RateLimit.Clone()));
        }
Exemplo n.º 5
0
    //List<Color> colors=new List<Color>();
    public override void Execute()
    {
        Nodes = (Hashtable)GlobalVariables.Graphnodes[1];
        Links = (Hashtable)GlobalVariables.Graphlinks[1];
        //Debug.Log(Links.Count);
        //Initialization

        /*foreach (DictionaryEntry NodeEntry in Nodes) {
         *  Node node =(Node) NodeEntry.Value;
         *  ((Vertice)RenderedNodes[node.Id]).Color = Color.white;
         * }
         * foreach (DictionaryEntry linkEntry in Links)
         * {
         *
         *  Link link = (Link)linkEntry.Value;
         *  ((Edge)RenderedLinks[link.Id]).Color = Color.gray;
         * }*/


        NibbleClustering    NC           = new NibbleClustering();
        Hashtable           NodesCopy    = (Hashtable)Nodes.Clone();
        Hashtable           LinksCopy    = (Hashtable)Links.Clone();
        List <List <Node> > bestClusters = NC.getClustering(NodesCopy, LinksCopy);

        Debug.Log("There are in total " + bestClusters.Count + " clusters.");
        //visualization
        int colorIndex = 0;

        foreach (List <Node> bestCluster in bestClusters)
        {
            //random bright color
            Color color = new Color(
                colorIndex * 2.7f / (bestCluster.Count + 1) + 0.3f,
                UnityEngine.Random.Range(0.3f, 3f),
                UnityEngine.Random.Range(0.3f, 3f)
                );
            colorIndex++;
            if (bestCluster.Count <= 2)
            {
                Debug.Log("There are Clusters with 2 or less nodes, We won't color them");
                Debug.Log("The Nodes are:");
                foreach (Node node in bestCluster)
                {
                    Debug.Log(node.Id);
                }
            }
            foreach (DictionaryEntry linkEntry in Links)
            {
                Link link = (Link)linkEntry.Value;
                if (link != null)
                {
                    if (bestCluster.Contains(link.SourceNode) && bestCluster.Contains(link.TargetNode))
                    {
                        ((Vertice)RenderedNodes[link.SourceNode.Id]).Color = color;
                        ((Vertice)RenderedNodes[link.TargetNode.Id]).Color = color;
                        ((Edge)RenderedLinks[link.Id]).Color = color;
                    }
                }
            }
        }
    }