001package org.unix4j.unix;
002
003import org.unix4j.command.CommandInterface;
004
005import org.unix4j.unix.find.FindFactory;
006import org.unix4j.unix.find.FindOption;
007import org.unix4j.unix.find.FindOptions;
008import org.unix4j.unix.find.FindOptionSets;
009
010/**
011 * Non-instantiable module with inner types making up the <b>find</b> command.
012 * <p>
013 * <b>NAME</b>
014 * <p>
015 * find - search for files in a directory hierarchy 
016 * <p>
017 * <b>SYNOPSIS</b>
018 * <p>
019 * <table>
020 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <args>}</td></tr>
021 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <path>}</td></tr>
022 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <path> <name>}</td></tr>
023 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <size>}</td></tr>
024 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <path> <size>}</td></tr>
025 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <size> <name>}</td></tr>
026 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find <path> <size> <name>}</td></tr>
027 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <name>}</td></tr>
028 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <path> <name>}</td></tr>
029 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <size>}</td></tr>
030 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <path> <size>}</td></tr>
031 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <time>}</td></tr>
032 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <path> <time>}</td></tr>
033 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <size> <name>}</td></tr>
034 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <path> <size> <name>}</td></tr>
035 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <time> <name>}</td></tr>
036 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <path> <time> <name>}</td></tr>
037 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <size> <time> <name>}</td></tr>
038 * <tr><td width="10px"></td><td nowrap="nowrap">{@code find [-dflxrinocamz] <path> <size> <time> <name>}</td></tr>
039 * </table>
040 * <p>
041 * See {@link Interface} for the corresponding command signature methods.
042 * <p>
043 * <b>DESCRIPTION</b>
044 * <p>
045 * <p>Find searches the directory tree by evaluating different file matching expressions. The names of the matching files found in or below the working directory or the directories specified by the {@code paths} operand are written to the standard output.</p>
046 * 
047 * <p>
048 * <b>Options</b>
049 * <p>
050 * The following options are supported:
051 * <p>
052 * <table>
053 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -d}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeDirectory}</td><td>&nbsp;</td><td>Consider only directories</td></tr>
054 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -f}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeFile}</td><td>&nbsp;</td><td>Consider only regular files</td></tr>
055 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -l}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeSymlink}</td><td>&nbsp;</td><td>Consider only symbolic links</td></tr>
056 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -x}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeOther}</td><td>&nbsp;</td><td>Consider only files that are neither of directory (d), 
057                        regular file (f) or symlink (l).</td></tr>
058 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -r}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --regex}</td><td>&nbsp;</td><td>Use full regular expression syntax for the patterns specified by the
059                        name operand
060<p>
061                        (This option is ignored if no name operand is specified).</td></tr>
062 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -i}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --ignoreCase}</td><td>&nbsp;</td><td>Use case insensitive matching when applying the file name pattern
063                        specified by the name operand
064<p>
065                        (This option is ignored if no name operand is specified).</td></tr>
066 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -n}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeNewer}</td><td>&nbsp;</td><td>Consider only files that have been created, modified or accessed
067                        after or at the time specified by the time operand (the default)
068                        <p>
069                        (This option is ignored if no time operand is specified).</td></tr>
070 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -o}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeOlder}</td><td>&nbsp;</td><td>Consider only files that have been created, modified or accessed
071                        before or at the time specified by the time operand
072                        <p>
073                        (This option is ignored if no time operand is specified).</td></tr>
074 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -c}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeCreate}</td><td>&nbsp;</td><td>The time operand refers to the creation time of the file
075                        <p>
076                        (This option is ignored if no time operand is specified).</td></tr>
077 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -a}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeAccess}</td><td>&nbsp;</td><td>The time operand refers to the last access time of the file
078                        <p>
079                        (This option is ignored if no time operand is specified).</td></tr>
080 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -m}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeModified}</td><td>&nbsp;</td><td>The time operand refers to the last modification time of the file
081                        (the default)
082                        <p>
083                        (This option is ignored if no time operand is specified).</td></tr>
084 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -z}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --print0}</td><td>&nbsp;</td><td>Print the full file name on the standard output, followed by a null 
085                        character (instead of the newline character used by default). This
086                        allows file names that contain newlines or other types of white 
087                        space to be correctly interpreted by programs that process the find 
088                        output. This option corresponds to the --delimiter0 option of xargs.</td></tr>
089 * </table>
090 * <p>
091 * <b>OPERANDS</b>
092 * <p>
093 * The following operands are supported:
094 * <p>
095 * <table>
096 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code <path>}</td><td>&nbsp;:&nbsp;</td><td nowrap="nowrap">{@code String}</td><td>&nbsp;</td><td>Starting point for the search in the directory hierarchy;
097            wildcards * and ? are supported; relative paths are resolved on the
098            basis of the current working directory.</td></tr>
099 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code <name>}</td><td>&nbsp;:&nbsp;</td><td nowrap="nowrap">{@code String}</td><td>&nbsp;</td><td>Name pattern to match the file name after removing the path with the
100                        leading directories; wildcards * and ? are supported, or full 
101                        regular expressions if either of the options {@code -regex (-r)} or
102                        {@code -iregex (-i)} is specified.</td></tr>
103 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code <size>}</td><td>&nbsp;:&nbsp;</td><td nowrap="nowrap">{@code long}</td><td>&nbsp;</td><td>Consider only files using at least {@code size} bytes if {@code size}
104                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
105                        or negative.</td></tr>
106 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code <time>}</td><td>&nbsp;:&nbsp;</td><td nowrap="nowrap">{@code java.util.Date}</td><td>&nbsp;</td><td>Consider only files that have been created, modified or accessed
107                        before or after the specified {@code time} operand; consider the
108                        {@code -time...} options for details of the comparison.</td></tr>
109 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code <args>}</td><td>&nbsp;:&nbsp;</td><td nowrap="nowrap">{@code String...}</td><td>&nbsp;</td><td>String arguments defining the options and operands for the command. 
110                        Options can be specified by acronym (with a leading dash "-") or by 
111                        long name (with two leading dashes "--"). Operands other than the
112                        default "--path" operand have to be prefixed with the operand name
113                        (e.g. "--name" for subsequent path operand values).</td></tr>
114 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code <options>}</td><td>&nbsp;:&nbsp;</td><td nowrap="nowrap">{@code FindOptions}</td><td>&nbsp;</td><td>Options for the file search.</td></tr>
115 * </table>
116 */
117public final class Find {
118        /**
119         * The "find" command name.
120         */
121        public static final String NAME = "find";
122
123        /**
124         * Interface defining all method signatures for the "find" command.
125         * 
126         * @param <R>
127         *            the generic return type for all command signature methods
128         *            to support different implementor types; the methods of a 
129         *            command factory for instance returns a command instance; 
130         *            command builders can also implement this interface, but their
131         *            methods return the builder itself enabling for chained method
132         *            invocation to create joined commands
133         */
134        public static interface Interface<R> extends CommandInterface<R> {
135                /**
136                 * Finds all files matching the search criteria specified by the given
137                        arguments and writes the file names to the standard output. 
138                        <p>
139                        Options can be specified by acronym (with a leading dash "-") or by 
140                        long name (with two leading dashes "--"). Operands other than the 
141                        default "--name" operand have to be prefixed with the operand name. 
142                        <p>
143                        The files names written to the output are relative paths referring
144                        to the working directory (or -- if provided -- relative to the path 
145                        given after the {@code "--path"} operand name).
146                 *
147                 * @param args String arguments defining the options and operands for the command. 
148                        Options can be specified by acronym (with a leading dash "-") or by 
149                        long name (with two leading dashes "--"). Operands other than the
150                        default "--path" operand have to be prefixed with the operand name
151                        (e.g. "--name" for subsequent path operand values).
152                 * @return the generic type {@code <R>} defined by the implementing class;
153                 *         the command itself returns no value and writes its result to the
154                 *         standard output; see class level parameter comments for more 
155                 *         details
156                 */
157                R find(String... args);
158                /**
159                 * Finds all files in or below the directory specified by {@code path}
160            and writes the file names to the standard output.
161<p>
162            The files names written to the output are paths relative to the
163            specified {@code path} operand.
164                 *
165                 * @param path Starting point for the search in the directory hierarchy;
166            wildcards * and ? are supported; relative paths are resolved on the
167            basis of the current working directory.
168                 * @return the generic type {@code <R>} defined by the implementing class;
169                 *         the command itself returns no value and writes its result to the
170                 *         standard output; see class level parameter comments for more 
171                 *         details
172                 */
173                R find(String path);
174                /**
175                 * Finds all files matching the specified {@code name} in or below the 
176                        directory specified by {@code path} and writes the file names to
177                        the standard output. 
178                        <p>
179                        The files names written to the output are paths relative to the
180                        specified {@code path} operand.
181                 *
182                 * @param path Starting point for the search in the directory hierarchy;
183            wildcards * and ? are supported; relative paths are resolved on the
184            basis of the current working directory.
185                 * @param name Name pattern to match the file name after removing the path with the
186                        leading directories; wildcards * and ? are supported, or full 
187                        regular expressions if either of the options {@code -regex (-r)} or
188                        {@code -iregex (-i)} is specified.
189                 * @return the generic type {@code <R>} defined by the implementing class;
190                 *         the command itself returns no value and writes its result to the
191                 *         standard output; see class level parameter comments for more 
192                 *         details
193                 */
194                R find(String path, String name);
195                /**
196                 * Finds all files matching the specified file {@code size} in or below 
197                        the user's current working directory and writes the file names to 
198                        the standard output. Matching files use at least {@code size} bytes
199                        on disk if {@code size} is positive, or at most {@code abs(size)} 
200                        bytes if {@code size} is zero or negative. 
201                        <p>
202                        The files names written to the output are relative paths referring
203                        to the working directory.
204                 *
205                 * @param size Consider only files using at least {@code size} bytes if {@code size}
206                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
207                        or negative.
208                 * @return the generic type {@code <R>} defined by the implementing class;
209                 *         the command itself returns no value and writes its result to the
210                 *         standard output; see class level parameter comments for more 
211                 *         details
212                 */
213                R find(long size);
214                /**
215                 * Finds all files matching the specified file {@code size} in or below
216                        the directory specified by {@code path} and writes the file names
217                        to the standard output. Matching files use at least {@code size} 
218                        bytes on disk if {@code size} is positive, or at most 
219                        {@code abs(size)} bytes if {@code size} is zero or negative. 
220<p>
221                        The files names written to the output are paths relative to the
222                        specified {@code path} operand.
223                 *
224                 * @param path Starting point for the search in the directory hierarchy;
225            wildcards * and ? are supported; relative paths are resolved on the
226            basis of the current working directory.
227                 * @param size Consider only files using at least {@code size} bytes if {@code size}
228                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
229                        or negative.
230                 * @return the generic type {@code <R>} defined by the implementing class;
231                 *         the command itself returns no value and writes its result to the
232                 *         standard output; see class level parameter comments for more 
233                 *         details
234                 */
235                R find(String path, long size);
236                /**
237                 * Finds all files matching the specified file {@code name} and 
238                        {@code size} in or below the user's current working directory and
239                        writes the file names to the standard output. Matching files use 
240                        at least {@code size} bytes on disk if {@code size} is positive, 
241                        or at most {@code abs(size)} bytes if {@code size} is zero or 
242                        negative. 
243<p>
244                        The files names written to the output are relative paths referring
245                        to the working directory.
246                 *
247                 * @param size Consider only files using at least {@code size} bytes if {@code size}
248                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
249                        or negative.
250                 * @param name Name pattern to match the file name after removing the path with the
251                        leading directories; wildcards * and ? are supported, or full 
252                        regular expressions if either of the options {@code -regex (-r)} or
253                        {@code -iregex (-i)} is specified.
254                 * @return the generic type {@code <R>} defined by the implementing class;
255                 *         the command itself returns no value and writes its result to the
256                 *         standard output; see class level parameter comments for more 
257                 *         details
258                 */
259                R find(long size, String name);
260                /**
261                 * Finds all files matching the specified file {@code name} and 
262                        {@code size} in or below the directory specified by {@code path} 
263                        and writes the file names to the standard output. Matching files 
264                        use at least {@code size} bytes on disk if {@code size} is positive, 
265                        or at most {@code abs(size)} bytes if {@code size} is zero or 
266                        negative. 
267<p>
268                        The files names written to the output are paths relative to the
269                        specified {@code path} operand.
270                 *
271                 * @param path Starting point for the search in the directory hierarchy;
272            wildcards * and ? are supported; relative paths are resolved on the
273            basis of the current working directory.
274                 * @param size Consider only files using at least {@code size} bytes if {@code size}
275                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
276                        or negative.
277                 * @param name Name pattern to match the file name after removing the path with the
278                        leading directories; wildcards * and ? are supported, or full 
279                        regular expressions if either of the options {@code -regex (-r)} or
280                        {@code -iregex (-i)} is specified.
281                 * @return the generic type {@code <R>} defined by the implementing class;
282                 *         the command itself returns no value and writes its result to the
283                 *         standard output; see class level parameter comments for more 
284                 *         details
285                 */
286                R find(String path, long size, String name);
287                /**
288                 * Finds all files matching the specified {@code name} in or below the 
289                        user's current working directory and writes the file names to the
290                        standard output.
291                         <p>
292                        The files names written to the output are relative paths referring
293                        to the working directory.
294                 *
295                 * @param options Options for the file search.
296                 * @param name Name pattern to match the file name after removing the path with the
297                        leading directories; wildcards * and ? are supported, or full 
298                        regular expressions if either of the options {@code -regex (-r)} or
299                        {@code -iregex (-i)} is specified.
300                 * @return the generic type {@code <R>} defined by the implementing class;
301                 *         the command itself returns no value and writes its result to the
302                 *         standard output; see class level parameter comments for more 
303                 *         details
304                 */
305                R find(FindOptions options, String name);
306                /**
307                 * Finds all files matching the specified {@code name} in or below the 
308                        directory specified by {@code path} and writes the file names to
309                        the standard output. 
310<p>
311                        The files names written to the output are paths relative to the
312                        specified {@code path} operand.
313                 *
314                 * @param options Options for the file search.
315                 * @param path Starting point for the search in the directory hierarchy;
316            wildcards * and ? are supported; relative paths are resolved on the
317            basis of the current working directory.
318                 * @param name Name pattern to match the file name after removing the path with the
319                        leading directories; wildcards * and ? are supported, or full 
320                        regular expressions if either of the options {@code -regex (-r)} or
321                        {@code -iregex (-i)} is specified.
322                 * @return the generic type {@code <R>} defined by the implementing class;
323                 *         the command itself returns no value and writes its result to the
324                 *         standard output; see class level parameter comments for more 
325                 *         details
326                 */
327                R find(FindOptions options, String path, String name);
328                /**
329                 * Finds all files matching the specified file {@code size} in or below 
330                        the user's current working directory and writes the file names to 
331                        the standard output. Matching files use at least {@code size} bytes
332                        on disk if {@code size} is positive, or at most {@code abs(size)} 
333                        bytes if {@code size} is zero or negative. 
334<p>
335                        The files names written to the output are relative paths referring
336                        to the working directory.
337                 *
338                 * @param options Options for the file search.
339                 * @param size Consider only files using at least {@code size} bytes if {@code size}
340                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
341                        or negative.
342                 * @return the generic type {@code <R>} defined by the implementing class;
343                 *         the command itself returns no value and writes its result to the
344                 *         standard output; see class level parameter comments for more 
345                 *         details
346                 */
347                R find(FindOptions options, long size);
348                /**
349                 * Finds all files matching the specified file {@code size} in or below
350                        the directory specified by {@code path} and writes the file names
351                        to the standard output. Matching files use at least {@code size} 
352                        bytes on disk if {@code size} is positive, or at most 
353                        {@code abs(size)} bytes if {@code size} is zero or negative. 
354<p>
355                        The files names written to the output are paths relative to the
356                        specified {@code path} operand.
357                 *
358                 * @param options Options for the file search.
359                 * @param path Starting point for the search in the directory hierarchy;
360            wildcards * and ? are supported; relative paths are resolved on the
361            basis of the current working directory.
362                 * @param size Consider only files using at least {@code size} bytes if {@code size}
363                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
364                        or negative.
365                 * @return the generic type {@code <R>} defined by the implementing class;
366                 *         the command itself returns no value and writes its result to the
367                 *         standard output; see class level parameter comments for more 
368                 *         details
369                 */
370                R find(FindOptions options, String path, long size);
371                /**
372                 * Finds all files that have been created, modified or accessed before 
373                        or after the specified {@code time} (depending on the given 
374                        {@code -time...} options). The names of the matching files found in 
375                        or below the user's current working directory are written to the 
376                        standard output. 
377<p>
378                        The files names written to the output are relative paths referring
379                        to the working directory.
380                 *
381                 * @param options Options for the file search.
382                 * @param time Consider only files that have been created, modified or accessed
383                        before or after the specified {@code time} operand; consider the
384                        {@code -time...} options for details of the comparison.
385                 * @return the generic type {@code <R>} defined by the implementing class;
386                 *         the command itself returns no value and writes its result to the
387                 *         standard output; see class level parameter comments for more 
388                 *         details
389                 */
390                R find(FindOptions options, java.util.Date time);
391                /**
392                 * Finds all files that have been created, modified or accessed before 
393                        or after the specified {@code time} (depending on the given 
394                        {@code -time...} options). The names of the matching files found in 
395                        or below the directory specified by {@code path} are written to
396                        the standard output. 
397<p>
398                        The files names written to the output are paths relative to the
399                        specified {@code path} operand.
400                 *
401                 * @param options Options for the file search.
402                 * @param path Starting point for the search in the directory hierarchy;
403            wildcards * and ? are supported; relative paths are resolved on the
404            basis of the current working directory.
405                 * @param time Consider only files that have been created, modified or accessed
406                        before or after the specified {@code time} operand; consider the
407                        {@code -time...} options for details of the comparison.
408                 * @return the generic type {@code <R>} defined by the implementing class;
409                 *         the command itself returns no value and writes its result to the
410                 *         standard output; see class level parameter comments for more 
411                 *         details
412                 */
413                R find(FindOptions options, String path, java.util.Date time);
414                /**
415                 * Finds all files matching the specified file {@code name} and 
416                        {@code size} in or below the user's current working directory and
417                        writes the file names to the standard output. Matching files use 
418                        at least {@code size} bytes on disk if {@code size} is positive, or 
419                        at most {@code abs(size)} bytes if {@code size} is zero or negative. 
420<p>
421                        The files names written to the output are relative paths referring
422                        to the working directory.
423                 *
424                 * @param options Options for the file search.
425                 * @param size Consider only files using at least {@code size} bytes if {@code size}
426                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
427                        or negative.
428                 * @param name Name pattern to match the file name after removing the path with the
429                        leading directories; wildcards * and ? are supported, or full 
430                        regular expressions if either of the options {@code -regex (-r)} or
431                        {@code -iregex (-i)} is specified.
432                 * @return the generic type {@code <R>} defined by the implementing class;
433                 *         the command itself returns no value and writes its result to the
434                 *         standard output; see class level parameter comments for more 
435                 *         details
436                 */
437                R find(FindOptions options, long size, String name);
438                /**
439                 * Finds all files matching the specified file {@code name} and 
440                        {@code size} in or below the directory specified by {@code path} 
441                        and writes the file names to the standard output. Matching files 
442                        use at least {@code size} bytes on disk if {@code size} is positive, 
443                        or at most {@code abs(size)} bytes if {@code size} is zero or 
444                        negative.
445<p>
446                        The files names written to the output are paths relative to the
447                        specified {@code path} operand.
448                 *
449                 * @param options Options for the file search.
450                 * @param path Starting point for the search in the directory hierarchy;
451            wildcards * and ? are supported; relative paths are resolved on the
452            basis of the current working directory.
453                 * @param size Consider only files using at least {@code size} bytes if {@code size}
454                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
455                        or negative.
456                 * @param name Name pattern to match the file name after removing the path with the
457                        leading directories; wildcards * and ? are supported, or full 
458                        regular expressions if either of the options {@code -regex (-r)} or
459                        {@code -iregex (-i)} is specified.
460                 * @return the generic type {@code <R>} defined by the implementing class;
461                 *         the command itself returns no value and writes its result to the
462                 *         standard output; see class level parameter comments for more 
463                 *         details
464                 */
465                R find(FindOptions options, String path, long size, String name);
466                /**
467                 * Finds all files matching the given {@code name} that have been 
468                        created, modified or accessed before or after the specified
469                        {@code time} (depending on the given {@code -time...} options). The
470                        names of the matching files found in or below the user's current 
471                        working directory are written to the standard output. 
472<p>
473                        The files names written to the output are relative paths referring
474                        to the working directory.
475                 *
476                 * @param options Options for the file search.
477                 * @param time Consider only files that have been created, modified or accessed
478                        before or after the specified {@code time} operand; consider the
479                        {@code -time...} options for details of the comparison.
480                 * @param name Name pattern to match the file name after removing the path with the
481                        leading directories; wildcards * and ? are supported, or full 
482                        regular expressions if either of the options {@code -regex (-r)} or
483                        {@code -iregex (-i)} is specified.
484                 * @return the generic type {@code <R>} defined by the implementing class;
485                 *         the command itself returns no value and writes its result to the
486                 *         standard output; see class level parameter comments for more 
487                 *         details
488                 */
489                R find(FindOptions options, java.util.Date time, String name);
490                /**
491                 * Finds all files matching the given {@code name} that have been 
492                        created, modified or accessed before or after the specified
493                        {@code time} (depending on the given {@code -time...} options). The 
494                        names of the matching files found in or below the directory 
495                        specified by {@code path} are written to the standard output. 
496<p>
497                        The files names written to the output are paths relative to the
498                        specified {@code path} operand.
499                 *
500                 * @param options Options for the file search.
501                 * @param path Starting point for the search in the directory hierarchy;
502            wildcards * and ? are supported; relative paths are resolved on the
503            basis of the current working directory.
504                 * @param time Consider only files that have been created, modified or accessed
505                        before or after the specified {@code time} operand; consider the
506                        {@code -time...} options for details of the comparison.
507                 * @param name Name pattern to match the file name after removing the path with the
508                        leading directories; wildcards * and ? are supported, or full 
509                        regular expressions if either of the options {@code -regex (-r)} or
510                        {@code -iregex (-i)} is specified.
511                 * @return the generic type {@code <R>} defined by the implementing class;
512                 *         the command itself returns no value and writes its result to the
513                 *         standard output; see class level parameter comments for more 
514                 *         details
515                 */
516                R find(FindOptions options, String path, java.util.Date time, String name);
517                /**
518                 * Finds all files matching the given {@code name} and {@code size} and
519                        have been created, modified or accessed before or after the specified
520                        {@code time} (depending on the given {@code -time...} options). 
521                        <p>
522                        Matching files use at least {@code size} bytes on disk if 
523                        {@code size} is positive, or at most {@code abs(size)} bytes if 
524                        {@code size} is zero or negative. The names of the matching files 
525                        found in or below the user's current working directory are written 
526                        to the standard output.
527<p>
528                        The files names written to the output are relative paths referring
529                        to the working directory.
530                 *
531                 * @param options Options for the file search.
532                 * @param size Consider only files using at least {@code size} bytes if {@code size}
533                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
534                        or negative.
535                 * @param time Consider only files that have been created, modified or accessed
536                        before or after the specified {@code time} operand; consider the
537                        {@code -time...} options for details of the comparison.
538                 * @param name Name pattern to match the file name after removing the path with the
539                        leading directories; wildcards * and ? are supported, or full 
540                        regular expressions if either of the options {@code -regex (-r)} or
541                        {@code -iregex (-i)} is specified.
542                 * @return the generic type {@code <R>} defined by the implementing class;
543                 *         the command itself returns no value and writes its result to the
544                 *         standard output; see class level parameter comments for more 
545                 *         details
546                 */
547                R find(FindOptions options, long size, java.util.Date time, String name);
548                /**
549                 * Finds all files matching the given {@code name} and {@code size} and
550                        have been created, modified or accessed before or after the specified
551                        {@code time} (depending on the given {@code -time...} options). 
552                        <p>
553                        Matching files use at least {@code size} bytes on disk if 
554                        {@code size} is positive, or at most {@code abs(size)} bytes if 
555                        {@code size} is zero or negative. The names of the matching files 
556                        found in or below the directory specified by {@code path} are 
557                        written to the standard output. 
558<p>
559                        The files names written to the output are paths relative to the
560                        specified {@code path} operand.
561                 *
562                 * @param options Options for the file search.
563                 * @param path Starting point for the search in the directory hierarchy;
564            wildcards * and ? are supported; relative paths are resolved on the
565            basis of the current working directory.
566                 * @param size Consider only files using at least {@code size} bytes if {@code size}
567                        is positive, or at most {@code abs(size)} bytes if {@code size} is zero
568                        or negative.
569                 * @param time Consider only files that have been created, modified or accessed
570                        before or after the specified {@code time} operand; consider the
571                        {@code -time...} options for details of the comparison.
572                 * @param name Name pattern to match the file name after removing the path with the
573                        leading directories; wildcards * and ? are supported, or full 
574                        regular expressions if either of the options {@code -regex (-r)} or
575                        {@code -iregex (-i)} is specified.
576                 * @return the generic type {@code <R>} defined by the implementing class;
577                 *         the command itself returns no value and writes its result to the
578                 *         standard output; see class level parameter comments for more 
579                 *         details
580                 */
581                R find(FindOptions options, String path, long size, java.util.Date time, String name);
582        }
583
584        /**
585         * Options for the "find" command: {@link FindOption#typeDirectory d}, {@link FindOption#typeFile f}, {@link FindOption#typeSymlink l}, {@link FindOption#typeOther x}, {@link FindOption#regex r}, {@link FindOption#ignoreCase i}, {@link FindOption#timeNewer n}, {@link FindOption#timeOlder o}, {@link FindOption#timeCreate c}, {@link FindOption#timeAccess a}, {@link FindOption#timeModified m}, {@link FindOption#print0 z}.
586         * <p> 
587 * <table>
588 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -d}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeDirectory}</td><td>&nbsp;</td><td>Consider only directories</td></tr>
589 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -f}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeFile}</td><td>&nbsp;</td><td>Consider only regular files</td></tr>
590 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -l}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeSymlink}</td><td>&nbsp;</td><td>Consider only symbolic links</td></tr>
591 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -x}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --typeOther}</td><td>&nbsp;</td><td>Consider only files that are neither of directory (d), 
592                        regular file (f) or symlink (l).</td></tr>
593 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -r}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --regex}</td><td>&nbsp;</td><td>Use full regular expression syntax for the patterns specified by the
594                        name operand
595<p>
596                        (This option is ignored if no name operand is specified).</td></tr>
597 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -i}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --ignoreCase}</td><td>&nbsp;</td><td>Use case insensitive matching when applying the file name pattern
598                        specified by the name operand
599<p>
600                        (This option is ignored if no name operand is specified).</td></tr>
601 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -n}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeNewer}</td><td>&nbsp;</td><td>Consider only files that have been created, modified or accessed
602                        after or at the time specified by the time operand (the default)
603                        <p>
604                        (This option is ignored if no time operand is specified).</td></tr>
605 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -o}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeOlder}</td><td>&nbsp;</td><td>Consider only files that have been created, modified or accessed
606                        before or at the time specified by the time operand
607                        <p>
608                        (This option is ignored if no time operand is specified).</td></tr>
609 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -c}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeCreate}</td><td>&nbsp;</td><td>The time operand refers to the creation time of the file
610                        <p>
611                        (This option is ignored if no time operand is specified).</td></tr>
612 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -a}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeAccess}</td><td>&nbsp;</td><td>The time operand refers to the last access time of the file
613                        <p>
614                        (This option is ignored if no time operand is specified).</td></tr>
615 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -m}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --timeModified}</td><td>&nbsp;</td><td>The time operand refers to the last modification time of the file
616                        (the default)
617                        <p>
618                        (This option is ignored if no time operand is specified).</td></tr>
619 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -z}</td><td>&nbsp;&nbsp;</td><td nowrap="nowrap">{@code --print0}</td><td>&nbsp;</td><td>Print the full file name on the standard output, followed by a null 
620                        character (instead of the newline character used by default). This
621                        allows file names that contain newlines or other types of white 
622                        space to be correctly interpreted by programs that process the find 
623                        output. This option corresponds to the --delimiter0 option of xargs.</td></tr>
624 * </table>
625         */
626        public static final FindOptionSets Options = FindOptionSets.INSTANCE;
627
628        /**
629         * Singleton {@link FindFactory factory} instance for the "find" command.
630         */
631        public static final FindFactory Factory = FindFactory.INSTANCE;
632
633        // no instances
634        private Find() {
635                super();
636        }
637}