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