001package org.unix4j.unix.find;
002
003import org.unix4j.unix.Find;
004
005/**
006 * Factory for the {@link Find find} command returning 
007 * a new command instance from every signature method.
008 */
009public final class FindFactory implements Find.Interface<FindCommand> {
010        
011        /**
012         * The singleton instance of this factory.
013         */
014        public static final FindFactory INSTANCE = new FindFactory();
015
016        /**
017         * Private, only used to create singleton instance.
018         */
019        private FindFactory() {
020                super();
021        }
022
023        @Override
024        public FindCommand find(String... args) {
025                final FindArguments findArgs = new FindArguments(args);
026                return new FindCommand(findArgs);
027        }
028
029        @Override
030        public FindCommand find(String path) {
031                final FindArguments findArgs = new FindArguments();
032                findArgs.setPath(path);
033                return new FindCommand(findArgs);
034        }
035
036        @Override
037        public FindCommand find(String path, String name) {
038                final FindArguments findArgs = new FindArguments();
039                findArgs.setPath(path);
040                findArgs.setName(name);
041                return new FindCommand(findArgs);
042        }
043
044        @Override
045        public FindCommand find(long size) {
046                final FindArguments findArgs = new FindArguments();
047                findArgs.setSize(size);
048                return new FindCommand(findArgs);
049        }
050
051        @Override
052        public FindCommand find(String path, long size) {
053                final FindArguments findArgs = new FindArguments();
054                findArgs.setPath(path);
055                findArgs.setSize(size);
056                return new FindCommand(findArgs);
057        }
058
059        @Override
060        public FindCommand find(long size, String name) {
061                final FindArguments findArgs = new FindArguments();
062                findArgs.setSize(size);
063                findArgs.setName(name);
064                return new FindCommand(findArgs);
065        }
066
067        @Override
068        public FindCommand find(String path, long size, String name) {
069                final FindArguments findArgs = new FindArguments();
070                findArgs.setPath(path);
071                findArgs.setSize(size);
072                findArgs.setName(name);
073                return new FindCommand(findArgs);
074        }
075
076        @Override
077        public FindCommand find(FindOptions options, String name) {
078                final FindArguments findArgs = new FindArguments(options);
079                findArgs.setName(name);
080                return new FindCommand(findArgs);
081        }
082
083        @Override
084        public FindCommand find(FindOptions options, String path, String name) {
085                final FindArguments findArgs = new FindArguments(options);
086                findArgs.setPath(path);
087                findArgs.setName(name);
088                return new FindCommand(findArgs);
089        }
090
091        @Override
092        public FindCommand find(FindOptions options, long size) {
093                final FindArguments findArgs = new FindArguments(options);
094                findArgs.setSize(size);
095                return new FindCommand(findArgs);
096        }
097
098        @Override
099        public FindCommand find(FindOptions options, String path, long size) {
100                final FindArguments findArgs = new FindArguments(options);
101                findArgs.setPath(path);
102                findArgs.setSize(size);
103                return new FindCommand(findArgs);
104        }
105
106        @Override
107        public FindCommand find(FindOptions options, java.util.Date time) {
108                final FindArguments findArgs = new FindArguments(options);
109                findArgs.setTime(time);
110                return new FindCommand(findArgs);
111        }
112
113        @Override
114        public FindCommand find(FindOptions options, String path, java.util.Date time) {
115                final FindArguments findArgs = new FindArguments(options);
116                findArgs.setPath(path);
117                findArgs.setTime(time);
118                return new FindCommand(findArgs);
119        }
120
121        @Override
122        public FindCommand find(FindOptions options, long size, String name) {
123                final FindArguments findArgs = new FindArguments(options);
124                findArgs.setSize(size);
125                findArgs.setName(name);
126                return new FindCommand(findArgs);
127        }
128
129        @Override
130        public FindCommand find(FindOptions options, String path, long size, String name) {
131                final FindArguments findArgs = new FindArguments(options);
132                findArgs.setPath(path);
133                findArgs.setSize(size);
134                findArgs.setName(name);
135                return new FindCommand(findArgs);
136        }
137
138        @Override
139        public FindCommand find(FindOptions options, java.util.Date time, String name) {
140                final FindArguments findArgs = new FindArguments(options);
141                findArgs.setTime(time);
142                findArgs.setName(name);
143                return new FindCommand(findArgs);
144        }
145
146        @Override
147        public FindCommand find(FindOptions options, String path, java.util.Date time, String name) {
148                final FindArguments findArgs = new FindArguments(options);
149                findArgs.setPath(path);
150                findArgs.setTime(time);
151                findArgs.setName(name);
152                return new FindCommand(findArgs);
153        }
154
155        @Override
156        public FindCommand find(FindOptions options, long size, java.util.Date time, String name) {
157                final FindArguments findArgs = new FindArguments(options);
158                findArgs.setSize(size);
159                findArgs.setTime(time);
160                findArgs.setName(name);
161                return new FindCommand(findArgs);
162        }
163
164        @Override
165        public FindCommand find(FindOptions options, String path, long size, java.util.Date time, String name) {
166                final FindArguments findArgs = new FindArguments(options);
167                findArgs.setPath(path);
168                findArgs.setSize(size);
169                findArgs.setTime(time);
170                findArgs.setName(name);
171                return new FindCommand(findArgs);
172        }
173}