public void MarkSetDataUsedForUpdates(QueryMatchID queryMatchId, HashSet <int> data) { var module = ModuleLoaderCore.instance.GetModule <QueryPipelinesModule>(); if (module == null) { return; } var setPipe = module.GroupPipeline; if (!setPipe.Data.MatchIdToIndex.TryGetValue(queryMatchId, out var setIndex)) { return; } if (SetDataUsedByQueryMatches.ContainsKey(queryMatchId)) { Debug.LogErrorFormat( "Query '{0}' is already using set data. If you wish to mark new data as used, " + "first call UnmarkSetDataUsedForUpdates with this query ID.", queryMatchId); return; } // duplicate input into owned buffer: { var newBuffer = Pools.DataIdHashSets.Get(); newBuffer.Clear(); foreach (var i in data) { newBuffer.Add(i); } data = newBuffer; } SetDataUsedByQueryMatches[queryMatchId] = data; var queryId = queryMatchId.queryID; if (SetDataUsedByQueries.TryGetValue(queryId, out var dataUsedByQuery)) { dataUsedByQuery.Add(data); } else { dataUsedByQuery = new PreviousSetMatches(data.Count); dataUsedByQuery.Add(data); SetDataUsedByQueries[queryId] = dataUsedByQuery; } var memberIndices = setPipe.Data.MemberIndices[setIndex]; var memberData = setPipe.MemberData; foreach (var mi in memberIndices) { var assignedId = memberData.BestMatchDataIds[mi]; var exclusivity = memberData.Exclusivities[mi]; ReserveDataForQueryMatch(assignedId, queryMatchId, exclusivity); } }
public void CheckPrevious(List <int[]> usedCombos, KeyValuePair <int, float>[] hypothesis, bool expected) { var record = new PreviousSetMatches(usedCombos[0].Length, usedCombos.Count); foreach (var combination in usedCombos) { record.Add(combination); } Assert.AreEqual(expected, record.AssignmentPreviouslyUsed(hypothesis)); }
public void Add(List <int[]> usedCombos) { var record = new PreviousSetMatches(usedCombos[0].Length, usedCombos.Count); foreach (var combination in usedCombos) { record.Add(combination); } Assert.AreEqual(usedCombos.Count, record.Count); }