Exemplo n.º 1
0
 public static ClusterStatsResponse Read(Dictionary<byte, object> par)
 {
     var res = new ClusterStatsResponse();
     res.clusterId = (int) par[(byte) DiscussionParamKey.ClusterId];
     res.clusterTextTitle = (string) par[(byte) DiscussionParamKey.ClusterCaption];
     res.points = (int[]) par[(byte) DiscussionParamKey.ArrayOfInts];
     res.topicId = (int) par[(byte) DiscussionParamKey.ChangedTopicId];
     res.initialOwnerId = (int) par[(byte) DiscussionParamKey.InitialShapeOwnerId];
     res.clusterShId = (int) par[(byte) DiscussionParamKey.ShapeId];
     return res;
 }
Exemplo n.º 2
0
        public static ClusterStatsResponse Read(Dictionary <byte, object> par)
        {
            var res = new ClusterStatsResponse();

            res.clusterId        = (int)par[(byte)DiscussionParamKey.ClusterId];
            res.clusterTextTitle = (string)par[(byte)DiscussionParamKey.ClusterCaption];
            res.points           = (int[])par[(byte)DiscussionParamKey.ArrayOfInts];
            res.topicId          = (int)par[(byte)DiscussionParamKey.ChangedTopicId];
            res.initialOwnerId   = (int)par[(byte)DiscussionParamKey.InitialShapeOwnerId];
            res.clusterShId      = (int)par[(byte)DiscussionParamKey.ShapeId];
            return(res);
        }
Exemplo n.º 3
0
        private void clusterStatsResponse(ClusterStatsResponse resp, bool ok)
        {
            if (!ok)
            {
                ++_clusterReportsGenerated;
                if (ClustersAndLinksDone())
                    finalizeReport();
                return;
            }

            //generate list of ArgPoints
            var argPoints = new ArgPoint[resp.points.Length];
            for (int i = 0; i < resp.points.Length; i++)
            {
                var pointId = resp.points[i];
                argPoints[i] = _ctx.ArgPoint.FirstOrDefault(ap0 => ap0.Id == pointId);
            }

            var topic = _ctx.Topic.FirstOrDefault(t0 => t0.Id == resp.topicId);
            var initialOwner = _ctx.Person.FirstOrDefault(p0 => p0.Id == resp.initialOwnerId);
            var report = new ClusterReport(topic, resp.clusterId, resp.clusterShId, resp.clusterTextTitle, argPoints,
                                           initialOwner);
            _clusterReports.Add(report);

            ++_clusterReportsGenerated;
            if (ClustersAndLinksDone())
                finalizeReport();
        }
Exemplo n.º 4
0
        //returns list of badge IDs, not ArgPoint IDs!  Custer text is also undefined   
        //if returns false, cluster was already removed 
        public bool ReportCluster(int clusterId, out ClusterStatsResponse clusterResp)
        {
            clusterResp = default(ClusterStatsResponse);

            if (!_clusters.ContainsKey(clusterId))
                return false;

            var cluster = _clusters[clusterId];

            clusterResp.clusterId = clusterId;

            var badges = cluster.GetClusterables();
            var badgesArr = new int[badges.Count()];
            int i = 0;
            foreach (var badge in badges)
            {
                badgesArr[i++] = badge.GetId();
            }

            clusterResp.points = badgesArr;
            return true;
        }