/// <summary> /// Hash the boids and store them in the dictionary of lists /// </summary> private void StoreHashedBoidsSingleThread() { for (int i = 0; i < boidsList.Count; i++) { Boid b = boidsList[i]; boidsDict.Add(b); } }
internal CaseOutput SolveWithAssumptionOfValidity() { for (int i = 0; i < input.N; i++) { var block = new Block(input.Texts[i]); if (block.Start == block.End) { uniformBlockIndexes.Add(block.Start, block); } else { startBlockIndexes.Add(block.Start, block); endBlockIndexes.Add(block.End, block); } blocks.Add(block); } var foundReduction = true; while (foundReduction) { foundReduction = Reduce(); } var answer = SolveUnreducible(); if (answer.CheckValidity()) { return(new CaseOutput(answer.Text)); } else { return(CaseOutput.Impossible); } }
public EntityTable(Document document, SerializableEntityTable entityTable) { Document = document; _EntityTable = entityTable; Name = _EntityTable.Name; PropertyLists = new DictionaryOfLists <int, Property>(); foreach (var p in _EntityTable.Properties) { PropertyLists.Add(p.EntityIndex, new Property(Document, p)); } NumericColumns = LinqArray.LinqArray.ToLookup(_EntityTable.NumericColumns, c => c.Name, c => c); // We access our indices using simplified names "Element" rather than what gets serialized "Rvt.Element:Element" IndexColumns = LinqArray.LinqArray.ToLookup(_EntityTable.IndexColumns, c => c.Name.SimplifiedName(), c => c); StringColumns = LinqArray.LinqArray.ToLookup(_EntityTable.StringColumns, c => c.Name, c => c); NumRows = Columns.FirstOrDefault()?.NumElements() ?? 0; if (!Columns.All(x => x.NumElements() == NumRows)) { Debug.Fail("All columns in an entity table must be the same length"); } }
/// <summary> /// Builds the categorisation dictionary where dataflow <see cref="IMaintainableRefObject"/> are keys and lists of /// <see cref="ICategorisationMutableObject"/> /// the value. /// </summary> /// <param name="categorisations"> /// The categorisations. /// </param> /// <param name="itemScheme"> /// The Category Scheme /// </param> /// <returns> /// The categorisation dictionary /// </returns> private static IDictionaryOfLists<string, ICategorisationMutableObject> BuildCategorisationMap( IEnumerable<ICategorisationMutableObject> categorisations, IMaintainableMutableObject itemScheme) { var categorisationMap = new DictionaryOfLists<string, ICategorisationMutableObject>(StringComparer.Ordinal); var categorySchemeRef = new MaintainableRefObjectImpl( itemScheme.AgencyId, itemScheme.Id, itemScheme.Version); foreach (ICategorisationMutableObject categorisation in categorisations) { IStructureReference structureReference = categorisation.StructureReference; switch (structureReference.MaintainableStructureEnumType.EnumType) { case SdmxStructureEnumType.Dataflow: IStructureReference categoryRef = categorisation.CategoryReference; if (categorySchemeRef.Equals(categoryRef.MaintainableReference)) { IList<ICategorisationMutableObject> categoryDataflows; string categoryId = categoryRef.ChildReference.GetLastId(); if (!categorisationMap.TryGetValue(categoryId, out categoryDataflows)) { categoryDataflows = new List<ICategorisationMutableObject>(); categorisationMap.Add(categoryId, categoryDataflows); } categoryDataflows.Add(categorisation); } break; } } return categorisationMap; }
/// <summary> /// Builds the categorisation dictionary where dataflow <see cref="IMaintainableRefObject"/> are keys and lists of /// <see cref="ICategorisationMutableObject"/> /// the value. /// </summary> /// <param name="categorisations"> /// The categorisations. /// </param> /// <returns> /// The categorisation dictionary /// </returns> private static IDictionaryOfLists<IMaintainableRefObject, ICategorisationMutableObject> BuildCategorisationMap( IEnumerable<ICategorisationMutableObject> categorisations) { var categorisationMap = new DictionaryOfLists<IMaintainableRefObject, ICategorisationMutableObject>(); foreach (ICategorisationMutableObject categorisation in categorisations) { IStructureReference structureReference = categorisation.StructureReference; switch (structureReference.MaintainableStructureEnumType.EnumType) { case SdmxStructureEnumType.Dataflow: IList<ICategorisationMutableObject> dataflowCategories; IMaintainableRefObject dataflowReference = structureReference.MaintainableReference; if (!categorisationMap.TryGetValue(dataflowReference, out dataflowCategories)) { dataflowCategories = new List<ICategorisationMutableObject>(); categorisationMap.Add(dataflowReference, dataflowCategories); } dataflowCategories.Add(categorisation); break; } } return categorisationMap; }