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
Conversation
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.
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(); |
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.
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); |
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.
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.)
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.
added the break and removed the duplicated lines...
dcm4che/dcm4chee-arc-light#830