public static List <DocumentProjectInfo> ReadProjectManyInfos(string fileName) { List <DocumentProjectInfo> infos = new List <DocumentProjectInfo>(); var br = new BinaryReader(File.OpenRead(fileName)); while (!FileOperations.IsEndOfFile(br)) { var info = new DocumentProjectInfo(); info.Read(br); infos.Add(info); } br.Close(); return(infos); }
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); }