Пример #1
0
 public void Read(BinaryReader br)
 {
     TupleCount               = br.ReadInt32();
     DocumentID               = br.ReadInt32();
     DocumentParentID         = br.ReadInt32();
     DocumentProjectTupleList = new SupportClass.EquatableList <DocumentProjectTuple>();
     for (int i = 0; i < TupleCount; i++)
     {
         var tuple = new DocumentProjectTuple();
         tuple.Read(br);
         DocumentProjectTupleList.Add(tuple);
     }
 }
Пример #2
0
        public static List <DocumentProjectInfo> GetCopiedProjectManyInfos(List <DocumentProjectInfo> infos, int copyFactor, int largestTopicID)
        {
            List <DocumentProjectInfo> infos2 = new List <DocumentProjectInfo>();
            int offset = 0;

            for (int iFactor = 0; iFactor < copyFactor; iFactor++)
            {
                foreach (var info in infos)
                {
                    var tupleList2 = new List <DocumentProjectTuple>();
                    foreach (var tuple in info.DocumentProjectTupleList)
                    {
                        DocumentProjectTuple tuple2;
                        if (tuple.ProjectNodeID >= 0)
                        {
                            tuple2 = new DocumentProjectTuple(tuple.ProjectNodeID + offset,
                                                              tuple.ProjectNodeParentID + offset, tuple.CosineSimilarity);
                        }
                        else if (tuple.ProjectNodeID == -1)
                        {
                            tuple2 = new DocumentProjectTuple(tuple.ProjectNodeID, tuple.ProjectNodeParentID + offset, tuple.CosineSimilarity);
                        }
                        else if (tuple.ProjectNodeID == -2)
                        {
                            tuple2 = new DocumentProjectTuple(tuple.ProjectNodeID, tuple.ProjectNodeParentID, tuple.CosineSimilarity);
                        }
                        else
                        {
                            throw new ArgumentException();
                        }
                        tupleList2.Add(tuple2);
                    }
                    var info2 = new DocumentProjectInfo(info.TupleCount, info.DocumentID + offset, info.DocumentParentID + offset, tupleList2);
                    infos2.Add(info2);
                }

                offset += largestTopicID + 100;
            }
            return(infos2);
        }