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

Support Range Matching by Attributes.matches(Attributes keys,..) #125

Merged
merged 2 commits into from Jun 30, 2017

Conversation

gunterze
Copy link
Member

@gunterze gunterze added this to the 3.3.9 milestone Jun 30, 2017
@gunterze gunterze self-assigned this Jun 30, 2017
@gunterze gunterze requested a review from hczedik June 30, 2017 13:18
Copy link
Member

@hczedik hczedik left a comment

Choose a reason for hiding this comment

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

Would be good to also add a unit test for this new behavior.

@@ -2943,9 +2943,19 @@ private boolean matches(String privateCreator, int tag, VR vr,

boolean ignoreCase = ignorePNCase && vr == VR.PN;
for (String keyVal : keyVals) {
DateRange dateRange = null;
if (vr == VR.PN)
keyVal = new PersonName(keyVals[0]).toString();
Copy link
Member

Choose a reason for hiding this comment

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

I think this if is now handled in the switch below, so the if can be removed.

case DA:
case DT:
case TM:
dateRange = toDateRange(keyVal, vr);
Copy link
Member

Choose a reason for hiding this comment

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

I'd also add a break here for safety reasons (should someone in the future add additional cases the break could be forgotten), and maybe even //$FALL-THROUGH$ comments to the DA and DT cases, to clearly mark the intention.
This is what both Oracle and Google recommend in their code guidelines:
https://google.github.io/styleguide/javaguide.html#s4.8.4-switch
http://www.oracle.com/technetwork/java/codeconventions-150003.pdf

(Personally I would have just used an if / else if construct in this case, and not a switch at all.)

Copy link
Member Author

@gunterze gunterze Jun 30, 2017

Choose a reason for hiding this comment

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

added the break and removed the duplicated lines...

@hczedik hczedik merged commit 00dcd92 into master Jun 30, 2017
@hczedik hczedik deleted the dcm4chee-arc-light#830 branch June 30, 2017 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants