|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LocationVo.java | 100% | 100% | 100% | 100% |
|
1 | /* $Id: LocationVo.java,v 1.4 2006/10/20 20:23:01 m31 Exp $ | |
2 | * | |
3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
4 | * | |
5 | * Copyright 2000-2006, Michael Meyling <mime@qedeq.org>. | |
6 | * | |
7 | * "Hilbert II" is free software; you can redistribute | |
8 | * it and/or modify it under the terms of the GNU General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2 of the License, or (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | */ | |
17 | ||
18 | package org.qedeq.kernel.dto.module; | |
19 | ||
20 | import org.qedeq.kernel.base.module.Location; | |
21 | import org.qedeq.kernel.utility.EqualsUtility; | |
22 | ||
23 | ||
24 | /** | |
25 | * Describes the "physical" directory location for a module. | |
26 | * This is a full or relative URL like: | |
27 | * <code>http://www.qedeq.org/principia/0_01_06/</code> or <code>.</code> | |
28 | * or <code>file:///qedeq/</code> | |
29 | * | |
30 | * @version $Revision: 1.4 $ | |
31 | * @author Michael Meyling | |
32 | */ | |
33 | public final class LocationVo implements Location { | |
34 | ||
35 | /** URL to "physical" directory location of module. */ | |
36 | private String location; | |
37 | ||
38 | ||
39 | /** | |
40 | * Constructs a location description for a module. The <code>location</code> | |
41 | * parameter contains an URL that points to a directory. | |
42 | * This is a full or relative URL like: | |
43 | * <code>http://www.qedeq.org/principia/0_01_06/</code> or <code>.</code> | |
44 | * or <code>file:///qedeq/</code> | |
45 | * Here it is not tested that it is a formal correct URL. | |
46 | * | |
47 | * @param location URL directory location. | |
48 | */ | |
49 | 74 | public LocationVo(final String location) { |
50 | 74 | this.location = location; |
51 | } | |
52 | ||
53 | /** | |
54 | * Constructs an empty location description for a module. | |
55 | */ | |
56 | 227 | public LocationVo() { |
57 | // nothing to do | |
58 | } | |
59 | ||
60 | /** | |
61 | * Set URL to "physical" directory location of module. The <code>location</code> | |
62 | * parameter contains an URL that points to a directory. | |
63 | * This is a full or relative URL like: | |
64 | * <code>http://www.qedeq.org/principia/0_01_06/</code> or <code>.</code> | |
65 | * or <code>file:///qedeq/</code> | |
66 | * Here it is not tested that it is a formal correct URL. | |
67 | * | |
68 | * @param location URL directory location. | |
69 | */ | |
70 | 219 | public final void setLocation(final String location) { |
71 | 219 | this.location = location; |
72 | } | |
73 | ||
74 | 1827 | public final String getLocation() { |
75 | 1827 | return location; |
76 | } | |
77 | ||
78 | 365 | public boolean equals(final Object obj) { |
79 | 365 | if (!(obj instanceof LocationVo)) { |
80 | 4 | return false; |
81 | } | |
82 | 361 | final LocationVo other = (LocationVo) obj; |
83 | 361 | return EqualsUtility.equals(getLocation(), other.getLocation()); |
84 | } | |
85 | ||
86 | 314 | public int hashCode() { |
87 | 314 | return (getLocation() != null ? getLocation().hashCode() : 0); |
88 | } | |
89 | ||
90 | 209 | public String toString() { |
91 | 209 | if (getLocation() == null) { |
92 | 12 | return ""; |
93 | } | |
94 | 197 | return getLocation(); |
95 | } | |
96 | ||
97 | } |
|