/// <summary> /// Remove the building block as used in the simulation /// </summary> public virtual void RemoveUsedBuildingBlock(UsedBuildingBlock usedBuildingBlock) { if (usedBuildingBlock == null) { return; } RemoveUsedBuildingBlock(usedBuildingBlock.TemplateId); }
/// <summary> /// Update the version and structural version from the given building block, only if the building block is not loaded /// </summary> public virtual void UpdateVersionFrom(UsedBuildingBlock usedBuildingBlock) { if (usedBuildingBlock.BuildingBlock != null) { return; } Version = usedBuildingBlock.Version; StructureVersion = usedBuildingBlock.StructureVersion; }
/// <summary> /// Add a building block as being used by the simulation /// </summary> public virtual void AddUsedBuildingBlock(UsedBuildingBlock usedBuildingBlock) { if (usedBuildingBlock == null) { return; } var existingUsedBuildingBlock = UsedBuildingBlockByTemplateId(usedBuildingBlock.TemplateId); if (existingUsedBuildingBlock != null) { usedBuildingBlock.UpdateVersionFrom(existingUsedBuildingBlock); _usedBuildingBlocks.Remove(usedBuildingBlock.TemplateId); } _usedBuildingBlocks.Add(usedBuildingBlock); }
/// <summary> /// Return true if the simulation uses the given building block otherwise false. /// </summary> public virtual bool UsesBuildingBlock(UsedBuildingBlock usedBuildingBlock) { return(UsesBuildingBlock(usedBuildingBlock.TemplateId)); }