View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  
24  package com.gisgraphy.importer.dto;
25  
26  import com.vividsolutions.jts.geom.Point;
27  
28  /**
29   * Represents a house number as a simple node in the Karlsruhe schema.
30   * 
31   * @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a>
32   */
33  public class NodeHouseNumber {
34  	
35  	
36  	
37  	
38  
39  	public NodeHouseNumber() {
40  		super();
41  	}
42  
43  	public NodeHouseNumber(String nodeId, Point location, String houseNumber, String name, String streetName) {
44  		super();
45  		this.nodeId = nodeId;
46  		this.location = location;
47  		this.houseNumber = houseNumber;
48  		this.name = name;
49  		this.streetName = streetName;
50  	}
51  
52  	/**
53  	 * the id ow the way
54  	 */
55  	private String nodeId;
56  	/**
57  	 * the gis location of the member (middle point or location )
58  	 */
59  	private Point location;
60  	
61  	/**
62  	 * the number of the house. It is a string because of latin that is can have bis ter or a letter (3c)
63  	 */
64  	private String houseNumber;
65  	
66  	/**
67  	 *  the name of the house or the amenity
68  	 */
69  	private String name;
70  	
71  	/**
72  	 *  the name of the street associated to the way, not to the node
73  	 */
74  	private String streetName;
75  
76  
77  	/**
78  	 * @return the nodeId
79  	 */
80  	public String getNodeId() {
81  		return nodeId;
82  	}
83  
84  	/**
85  	 * @param nodeId the nodeId to set
86  	 */
87  	public void setNodeId(String nodeId) {
88  		this.nodeId = nodeId;
89  	}
90  
91  	/**
92  	 * @return the location
93  	 */
94  	public Point getLocation() {
95  		return location;
96  	}
97  
98  	/**
99  	 * @param location the location to set
100 	 */
101 	public void setLocation(Point location) {
102 		this.location = location;
103 	}
104 
105 	/**
106 	 * @return the houseNumber
107 	 */
108 	public String getHouseNumber() {
109 		return houseNumber;
110 	}
111 
112 	/**
113 	 * @param houseNumber the houseNumber to set
114 	 */
115 	public void setHouseNumber(String houseNumber) {
116 		this.houseNumber = houseNumber;
117 	}
118 
119 	/**
120 	 * @return the name
121 	 */
122 	public String getName() {
123 		return name;
124 	}
125 
126 	/**
127 	 * @param name the name to set
128 	 */
129 	public void setName(String name) {
130 		this.name = name;
131 	}
132 
133 	/**
134 	 * @return the streetName
135 	 */
136 	public String getStreetName() {
137 		return streetName;
138 	}
139 
140 	/**
141 	 * @param streetName the streetName to set
142 	 */
143 	public void setStreetName(String streetName) {
144 		this.streetName = streetName;
145 	}
146 	
147 	/* (non-Javadoc)
148 	 * @see java.lang.Object#hashCode()
149 	 */
150 	@Override
151 	public int hashCode() {
152 		final int prime = 31;
153 		int result = 1;
154 		result = prime * result + ((houseNumber == null) ? 0 : houseNumber.hashCode());
155 		result = prime * result + ((location == null) ? 0 : location.hashCode());
156 		result = prime * result + ((name == null) ? 0 : name.hashCode());
157 		result = prime * result + ((nodeId == null) ? 0 : nodeId.hashCode());
158 		result = prime * result + ((streetName == null) ? 0 : streetName.hashCode());
159 		return result;
160 	}
161 
162 	/* (non-Javadoc)
163 	 * @see java.lang.Object#equals(java.lang.Object)
164 	 */
165 	@Override
166 	public boolean equals(Object obj) {
167 		if (this == obj)
168 			return true;
169 		if (obj == null)
170 			return false;
171 		if (getClass() != obj.getClass())
172 			return false;
173 		NodeHouseNumber other = (NodeHouseNumber) obj;
174 		if (houseNumber == null) {
175 			if (other.houseNumber != null)
176 				return false;
177 		} else if (!houseNumber.equals(other.houseNumber))
178 			return false;
179 		if (location == null) {
180 			if (other.location != null)
181 				return false;
182 		} else if (!location.equals(other.location))
183 			return false;
184 		if (name == null) {
185 			if (other.name != null)
186 				return false;
187 		} else if (!name.equals(other.name))
188 			return false;
189 		if (nodeId == null) {
190 			if (other.nodeId != null)
191 				return false;
192 		} else if (!nodeId.equals(other.nodeId))
193 			return false;
194 		if (streetName == null) {
195 			if (other.streetName != null)
196 				return false;
197 		} else if (!streetName.equals(other.streetName))
198 			return false;
199 		return true;
200 	}
201 
202 }