-
Notifications
You must be signed in to change notification settings - Fork 13
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
Spatial_Engine: Add HasMergeablePropertiesWith method #1630
Conversation
not sure when it would be used, but no reason not to add it
Initial comment: if CI/CD is scraping project names from PR titles, then there is a typo in there 🐒 |
return false; | ||
|
||
// look for a specific comparing method | ||
object result = Reflection.Compute.RunExtensionMethod(element, "IsEqualProperties", new object[] { other }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wont this lead to stack overflow given that the method is called the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you'd think so, but the test file runs and passes that part, but I'll change it to be on the safe side 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is a typo in one of the method names - see code comment. Besides, not sure if Is would be my first choice for prefix here. What about HasEqualProperties
?
/**** Private Methods ****/ | ||
/******************************************/ | ||
|
||
private static bool IIIsEqualProperties(this IElement element, IElement other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
III?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid stack overflow as I have methods calling this method and this method should not call it self or the previous ones
See:
#1630 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, makes sense, but looks weird. Maybe it could be done somehow neater (can't come up with anything nice myself though 🐒)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think a different name is the way to go without repeting the code or just going with input: (IElement
, IElement
)
some suggestions if it's the double I which is disturbing
IsEqualPropertiesDispatcher
IsEqualPropertiesProgram
IsEqualPropertiesMeat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsEqualPropertiesInterface
?
Yes, I'm open for other names. An other suggestion is |
Even better! Possibly we could have 2 methods, one checking whether the properties are equal and the other checking if they can be merged. Something for Diffing_Engine, @alelom? Dropping one more idea: |
Dismissing my change request and turning into comments.
I like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think the code generally looks fine now. File needs to be renamed HaveMergebleProperties
though.
/azp run BHoM_Engine.CheckCompliance |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The file name is now incorrect.
- Shouldn't it be
mergeable
instead ofmergeble
? - I am not convinced by the use of
have
here. The method is applied to thethis
argument only not to all the inputs together (i.e.x.HasMergeableProperties(y)
, not(x&y).HaveMergeableProperties()
). I would be fine withx.HasMergeablePropertiesWith(y)
though.
Yes, fixed
Yes, fixed
Maybe, will hold off on action as it sounds like there should be some discussion and am unsure myself |
Yes - I like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on the side of the code.
Probably good to have another approval from someone involved in teh Spatial toolkit itself
/azp run BHoM_Engine.CheckInstaller |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now all looks fine!
Issues addressed by this PR
Closes #1629
This adds a method which compares the properties of
IElement
s, atm only does base comparison and returns false for objects of equal type which do not have a method specified.Test files
https://burohappold.sharepoint.com/:f:/s/BHoM/EgIee2Xt7DJFu--Isb6FWAkBZot7MPpF8YhyOAKcKy9r8Q?e=sIuvRw
Changelog
Additional comments
Feels like I'm using the Interface method in the exact opposite manner compared to how they're usually used, but I think it's still how we'd want it(?)
does not overlap with #1623