Unit.java 2.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package eu.simstadt.nf4j;

/**
 * Units (Blattschnitte) divide regions into sections. For instance, the city of Stuttgart could have the units
 * "Stg-Mitte", "Stg-West", "Bad Cannstatt", "Heslach", etc.
 * 
 * @author Marcel Bruse
 *
 */
public class Unit {
	
	private static final String DEFAULT_EXTERIOR = "0";
	
	private static final String DEFAULT_FRAME = "0";
	
	private static final String DEFAULT_SELECT_MAP_SHEETS = "0";
	
	private static final String DEFAULT_SUBDIVISION = "4";
	
	/** The exterior attribute of the unit tag. */	
	private String exterior;
	
	/** The frame attribute of the unit tag. */
	private String frame;
	
	/** The select mapsheet attribute of the unit tag. */
	private String selectMapsheets;
	
	/** The subdivision attribute of the unit tag. */
	private String subdivision;
	
	/** The actual value of the unit tag. */
	private String value;

	public String getExterior() {
		return exterior;
	}

	public void setExterior(String exterior) {
		this.exterior = exterior;
	}

	public String getFrame() {
		return frame;
	}

	public void setFrame(String frame) {
		this.frame = frame;
	}

	public String getSelectMapsheets() {
		return selectMapsheets;
	}

	public void setSelectMapsheets(String selectMapsheets) {
		this.selectMapsheets = selectMapsheets;
	}

	public String getSubdivision() {
		return subdivision;
	}

	public void setSubdivision(String subdivision) {
		this.subdivision = subdivision;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	/**
	 * @return Returns true, if the unit is valid.
	 */
	public boolean isValid() {
		return !(exterior.isEmpty()
				|| frame.isEmpty()
				|| selectMapsheets.isEmpty()
				|| subdivision.isEmpty());
	}
	
	public static Unit getDefaultUnit() {
		Unit unit = new Unit();
		unit.setExterior(DEFAULT_EXTERIOR);
		unit.setFrame(DEFAULT_FRAME);
		unit.setSelectMapsheets(DEFAULT_SELECT_MAP_SHEETS);
		unit.setSubdivision(DEFAULT_SUBDIVISION);
		return unit;
	}
	
}