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

[Add] QueryReferencedThings() and QueryReferencedThingsDeep() methods to the abstract Thing class #143

Merged
merged 5 commits into from
Oct 23, 2020

Conversation

samatstariongroup
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the CDP4-SDK code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

Added 2 methods on Thing class to enable future work on querying referenced things:

  • public virtual IEnumerable QueryReferencedThings()
  • public IEnumerable QueryReferencedThingsDeep()

{
var temp = new List<Thing>();

foreach (var thing in this.QueryReferencedThings())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For QueryReferencedThingsDeep, I was thinking of returning the list of objects referenced from the full containment [sub]tree, not a tree of referenced things: so iterating through this.ContainerList, not the referenced things.

For the full tree of things "connected" to the current thing, we would indeed interate through both contained and referenced things.

@samatstariongroup samatstariongroup changed the title [WIP] QueryReferencedThings() and QueryReferencedThingsDeep() methods to the abstract Thing class [Add] QueryReferencedThings() and QueryReferencedThingsDeep() methods to the abstract Thing class Oct 22, 2020
/// this does not include the contained <see cref="Thing"/>s, the contained <see cref="Thing"/>s
/// are exposed via the <see cref="ContainerLists"/> method
/// </remarks>
/// <returns></returns>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing doc

@samatstariongroup
Copy link
Member Author

just added the code-generated QueryReferencedThing method. I am not sure the requested method to query all so-called connected things actually makes sense. So, i propose we leave it like this. @cozminvelciu If you still feel you need it, feel free to add it on the hand-coded Thing class

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

25.0% 25.0% Coverage
0.0% 0.0% Duplication

yield return thing;
}

foreach (var thing in this.BaseQuantityKind.Select(x => x))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that for some things (most don't have this) that are iterated there's an additional .Select(x =>x). Does this serve any purpose? It seems to me like it's adding [execution] complexity for nothing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is required to handle ordereditemlist

/// Queries the referenced <see cref="Thing"/>s of the current <see cref="ValueGroup"/>
/// </summary>
/// <remarks>
/// this does not include the contained <see cref="Thing"/>s, the contained <see cref="Thing"/>s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: this might be better to start with a capital "T".

/// </summary>
/// <remarks>
/// this does not include the contained <see cref="Thing"/>s, the contained <see cref="Thing"/>s
/// are exposed via the <see cref="ContainerLists"/> method
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: ContainerLists is actually a property.

@samatstariongroup samatstariongroup merged commit c5d6db1 into development Oct 23, 2020
@samatstariongroup samatstariongroup deleted the GH142-referenced-and-connected-things branch October 23, 2020 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generated convenience method for directly referenced and connected things
3 participants