001package org.unix4j.unix.sort;
002
003import org.unix4j.unix.Sort;
004
005/**
006 * Factory for the {@link Sort sort} command returning 
007 * a new command instance from every signature method.
008 */
009public final class SortFactory implements Sort.Interface<SortCommand> {
010        
011        /**
012         * The singleton instance of this factory.
013         */
014        public static final SortFactory INSTANCE = new SortFactory();
015
016        /**
017         * Private, only used to create singleton instance.
018         */
019        private SortFactory() {
020                super();
021        }
022
023        @Override
024        public SortCommand sort() {
025                final SortArguments sortArgs = new SortArguments();
026                return new SortCommand(sortArgs);
027        }
028
029        @Override
030        public SortCommand sort(String... args) {
031                final SortArguments sortArgs = new SortArguments(args);
032                return new SortCommand(sortArgs);
033        }
034
035        @Override
036        public SortCommand sort(java.io.File... files) {
037                final SortArguments sortArgs = new SortArguments();
038                sortArgs.setFiles(files);
039                return new SortCommand(sortArgs);
040        }
041
042        @Override
043        public SortCommand sort(org.unix4j.io.Input... inputs) {
044                final SortArguments sortArgs = new SortArguments();
045                sortArgs.setInputs(inputs);
046                return new SortCommand(sortArgs);
047        }
048
049        @Override
050        public SortCommand sort(java.util.Comparator<? super org.unix4j.line.Line> comparator) {
051                final SortArguments sortArgs = new SortArguments();
052                sortArgs.setComparator(comparator);
053                return new SortCommand(sortArgs);
054        }
055
056        @Override
057        public SortCommand sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) {
058                final SortArguments sortArgs = new SortArguments();
059                sortArgs.setComparator(comparator);
060                sortArgs.setFiles(files);
061                return new SortCommand(sortArgs);
062        }
063
064        @Override
065        public SortCommand sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) {
066                final SortArguments sortArgs = new SortArguments();
067                sortArgs.setComparator(comparator);
068                sortArgs.setPaths(paths);
069                return new SortCommand(sortArgs);
070        }
071
072        @Override
073        public SortCommand sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, org.unix4j.io.Input... inputs) {
074                final SortArguments sortArgs = new SortArguments();
075                sortArgs.setComparator(comparator);
076                sortArgs.setInputs(inputs);
077                return new SortCommand(sortArgs);
078        }
079
080        @Override
081        public SortCommand sort(SortOptions options) {
082                final SortArguments sortArgs = new SortArguments(options);
083                return new SortCommand(sortArgs);
084        }
085
086        @Override
087        public SortCommand sort(SortOptions options, java.io.File... files) {
088                final SortArguments sortArgs = new SortArguments(options);
089                sortArgs.setFiles(files);
090                return new SortCommand(sortArgs);
091        }
092
093        @Override
094        public SortCommand sort(SortOptions options, String... paths) {
095                final SortArguments sortArgs = new SortArguments(options);
096                sortArgs.setPaths(paths);
097                return new SortCommand(sortArgs);
098        }
099
100        @Override
101        public SortCommand sort(SortOptions options, org.unix4j.io.Input... inputs) {
102                final SortArguments sortArgs = new SortArguments(options);
103                sortArgs.setInputs(inputs);
104                return new SortCommand(sortArgs);
105        }
106
107        @Override
108        public SortCommand sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator) {
109                final SortArguments sortArgs = new SortArguments(options);
110                sortArgs.setComparator(comparator);
111                return new SortCommand(sortArgs);
112        }
113
114        @Override
115        public SortCommand sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) {
116                final SortArguments sortArgs = new SortArguments(options);
117                sortArgs.setComparator(comparator);
118                sortArgs.setFiles(files);
119                return new SortCommand(sortArgs);
120        }
121
122        @Override
123        public SortCommand sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) {
124                final SortArguments sortArgs = new SortArguments(options);
125                sortArgs.setComparator(comparator);
126                sortArgs.setPaths(paths);
127                return new SortCommand(sortArgs);
128        }
129
130        @Override
131        public SortCommand sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, org.unix4j.io.Input... inputs) {
132                final SortArguments sortArgs = new SortArguments(options);
133                sortArgs.setComparator(comparator);
134                sortArgs.setInputs(inputs);
135                return new SortCommand(sortArgs);
136        }
137}