Commons IO
  1. Commons IO
  2. IO-87

Provide a convenience mehod in FileFilterUtils to create a Size Range filter

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3
    • Component/s: Filters
    • Labels:
      None

      Description

      Provide a convenience mehod in FileFilterUtils to create a Size Range filter - by combining two SizeFileFilter's (one >= minimum and the other <= maximum) with an AndFileFilter

        Activity

        Hide
        Niall Pemberton added a comment -

        I've committed this since its a minor change, but will leave the issue open for comments.

        Show
        Niall Pemberton added a comment - I've committed this since its a minor change, but will leave the issue open for comments.
        Hide
        Stephen Colebourne added a comment -

        The parameters need to specify whether they are inclusive or exclusive, for example
        @param minSizeInclusive
        @param maxSizeExclusive

        This then needs adding to release notes, and the call closing.

        Show
        Stephen Colebourne added a comment - The parameters need to specify whether they are inclusive or exclusive, for example @param minSizeInclusive @param maxSizeExclusive This then needs adding to release notes, and the call closing.
        Hide
        Niall Pemberton added a comment -

        IMO minimumSize and maximumSize indicate that both are "inclusive" and therefore its unecessary to rename the parameters. I agree that the javadoc could be clearer in the method description and will fix that. Something like

        /**

        • Returns a filter that accepts files whose size is <= minimum size
        • and >= maximum size.
          */

        Currently this method implementation adds 1 to the maximumSize specified to achieve the <= maximum - but I've just opened a bug (IO-89) relating to the inconsistency in SizeFileFilter (and AgeFileFilter) which it would be good to resolve before fixing this.

        Show
        Niall Pemberton added a comment - IMO minimumSize and maximumSize indicate that both are "inclusive" and therefore its unecessary to rename the parameters. I agree that the javadoc could be clearer in the method description and will fix that. Something like /** Returns a filter that accepts files whose size is <= minimum size and >= maximum size. */ Currently this method implementation adds 1 to the maximumSize specified to achieve the <= maximum - but I've just opened a bug ( IO-89 ) relating to the inconsistency in SizeFileFilter (and AgeFileFilter) which it would be good to resolve before fixing this.
        Hide
        Stephen Colebourne added a comment -

        Feel free to tink of me as a dimwit, but minSize and maxSize don't always mean inclusive in my brain. hats why I always like to spell it out very explicitly.

        I use the parameter names to do this, as then IDE autocompletes pick it up rapidly. I guess its just a coding standard I've got into, and it certainy doesnt harm.

        Show
        Stephen Colebourne added a comment - Feel free to tink of me as a dimwit, but minSize and maxSize don't always mean inclusive in my brain. hats why I always like to spell it out very explicitly. I use the parameter names to do this, as then IDE autocompletes pick it up rapidly. I guess its just a coding standard I've got into, and it certainy doesnt harm.
        Hide
        Niall Pemberton added a comment -

        OK I've changed the parameter names as requested. Also renamed the method and made the javadoc clearer. Thanks for the feedback.

        P.S. I don't think you're a dimwit - my impression of IO is that the quality is v.high and I put that down to the care and attention to detail people like youself have put into it

        Show
        Niall Pemberton added a comment - OK I've changed the parameter names as requested. Also renamed the method and made the javadoc clearer. Thanks for the feedback. P.S. I don't think you're a dimwit - my impression of IO is that the quality is v.high and I put that down to the care and attention to detail people like youself have put into it

          People

          • Assignee:
            Niall Pemberton
            Reporter:
            Niall Pemberton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development