java/copy-image-resizer/src/cz/frantovo/copyImageResizer/RecursiveOptions.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 16 Nov 2014 23:47:28 +0100
changeset 5 5019e3e93a4e
parent 4 java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIOptions.java@f3b4caf1d05d
child 6 b329573c76d7
permissions -rw-r--r--
recursive resizer classes
franta-hg@3
     1
/**
franta-hg@3
     2
 * copy-image-resizer
franta-hg@3
     3
 * Copyright © 2014 František Kučera (frantovo.cz)
franta-hg@3
     4
 *
franta-hg@3
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@3
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@3
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@3
     8
 * (at your option) any later version.
franta-hg@3
     9
 *
franta-hg@3
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@3
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@3
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@3
    13
 * GNU General Public License for more details.
franta-hg@3
    14
 *
franta-hg@3
    15
 * You should have received a copy of the GNU General Public License
franta-hg@3
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@3
    17
 */
franta-hg@5
    18
package cz.frantovo.copyImageResizer;
franta-hg@3
    19
franta-hg@3
    20
import java.io.File;
franta-hg@3
    21
import java.util.ArrayList;
franta-hg@3
    22
import java.util.Collection;
franta-hg@3
    23
franta-hg@3
    24
/**
franta-hg@5
    25
 * 
franta-hg@3
    26
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@3
    27
 */
franta-hg@5
    28
public class RecursiveOptions {
franta-hg@3
    29
franta-hg@3
    30
	/**
franta-hg@3
    31
	 * Source directory
franta-hg@3
    32
	 */
franta-hg@3
    33
	private File input;
franta-hg@3
    34
	/**
franta-hg@3
    35
	 * Output directory
franta-hg@3
    36
	 */
franta-hg@3
    37
	private File output;
franta-hg@3
    38
	/**
franta-hg@3
    39
	 * Image resolutions to create
franta-hg@3
    40
	 */
franta-hg@3
    41
	private final Collection<SizeSpecification> sizes = new ArrayList<>();
franta-hg@3
    42
franta-hg@3
    43
	public File getSourceDir() {
franta-hg@3
    44
		return input;
franta-hg@3
    45
	}
franta-hg@3
    46
franta-hg@3
    47
	public void setInput(File input) {
franta-hg@3
    48
		this.input = input;
franta-hg@3
    49
	}
franta-hg@3
    50
franta-hg@3
    51
	public File getDestinationDir() {
franta-hg@3
    52
		return output;
franta-hg@3
    53
	}
franta-hg@3
    54
franta-hg@3
    55
	public void setOutput(File output) {
franta-hg@3
    56
		this.output = output;
franta-hg@3
    57
	}
franta-hg@3
    58
franta-hg@3
    59
	public Collection<SizeSpecification> getSizes() {
franta-hg@3
    60
		return sizes;
franta-hg@3
    61
	}
franta-hg@3
    62
franta-hg@3
    63
	public void addSize(SizeSpecification size) {
franta-hg@3
    64
		sizes.add(size);
franta-hg@3
    65
	}
franta-hg@3
    66
franta-hg@3
    67
	public static class SizeSpecification {
franta-hg@3
    68
franta-hg@3
    69
		private final int width;
franta-hg@3
    70
		private final int height;
franta-hg@3
    71
		private final String directory;
franta-hg@3
    72
franta-hg@3
    73
		public SizeSpecification(int width, int height, String directory) {
franta-hg@3
    74
			this.width = width;
franta-hg@3
    75
			this.height = height;
franta-hg@3
    76
			this.directory = directory;
franta-hg@3
    77
		}
franta-hg@3
    78
franta-hg@3
    79
		public int getWidth() {
franta-hg@3
    80
			return width;
franta-hg@3
    81
		}
franta-hg@3
    82
franta-hg@3
    83
		public int getHeight() {
franta-hg@3
    84
			return height;
franta-hg@3
    85
		}
franta-hg@3
    86
franta-hg@3
    87
		public String getDirectory() {
franta-hg@3
    88
			return directory;
franta-hg@3
    89
		}
franta-hg@3
    90
	}
franta-hg@3
    91
}