Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BHoM_Adapter: replaceInMemory does not make use of Venn intersection #88

Closed
alelom opened this issue May 24, 2019 · 3 comments
Closed
Assignees
Labels
severity:medium Slows progress, but workaround is possible type:bug Error or unexpected behaviour

Comments

@alelom
Copy link
Member

alelom commented May 24, 2019

Issue description

The ReplaceInMemory method performs the Venn diagram intersection, applies the MapSpecialProperties() method to it, then discards it:

if (Config.MergeWithComparer)
{
VennDiagram<T> diagram = Engine.DataStructure.Create.VennDiagram(newObjects, multiTaggedObjects.Concat(nonTaggedObjects), Comparer<T>());
diagram.Intersection.ForEach(x => x.Item1.MapSpecialProperties(x.Item2, AdapterId));
newObjects = diagram.OnlySet1;
}

Proposed change

IEnumerable<T> objectsToCreate = null;

// Merge objects if required
if (Config.MergeWithComparer)
{
	VennDiagram<T> diagram = Engine.DataStructure.Create.VennDiagram(objectsToPush, multiTaggedObjects.Concat(nonTaggedObjects), Comparer<T>());
	diagram.Intersection.ForEach(x => x.Item1.MapSpecialProperties(x.Item2, AdapterId));

	objectsToCreate = diagram.OnlySet1.Concat(diagram.OnlySet2).Concat(diagram.Intersection.Select(x => x.Item1));
} else
	objectsToCreate = multiTaggedObjects.Concat(nonTaggedObjects).Concat(objectsToPush);
@alelom alelom added severity:medium Slows progress, but workaround is possible type:bug Error or unexpected behaviour labels May 24, 2019
@alelom alelom self-assigned this May 24, 2019
@alelom
Copy link
Member Author

alelom commented Jul 3, 2019

Now included in #106.

@alelom
Copy link
Member Author

alelom commented Sep 26, 2019

Realised with @adecler, using this table:
image

that we can remove the replaceInMemory, because all it actually does is to "delete a tag from the multitagged object, and delete object that only have that tag". Being it only used in the FileAdapter, we can:

  • remove the method
  • find appropriate solution for the fileAdapter
  • only have 1 "Replace" method instead of "ReplaceThroughAPI" and "ReplaceInMemory"

@alelom
Copy link
Member Author

alelom commented Jan 11, 2024

Issue no longer relevant after Adapter refactoring.

@alelom alelom closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity:medium Slows progress, but workaround is possible type:bug Error or unexpected behaviour
Projects
None yet
Development

No branches or pull requests

1 participant