/*******************************************************************************
* Gisgraphy Project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
* Copyright 2008 Gisgraphy project
* David Masclet <davidmasclet@gisgraphy.com>
*
*
*******************************************************************************/
package com.gisgraphy.importer.dto;
import com.vividsolutions.jts.geom.Point;
/**
* Represents a house number with an associated street in the Karlsruhe schema.
*
* @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a>
*/
public class InterpolationMember implements Comparable<InterpolationMember>{
/**
* id of the node
*/
private String id;
/**
* the ordered sequence of nodes
*/
private int sequenceId;
/**
* the gis location of the member (middle point or location )
*/
private Point location;
/**
* the number of the house. It is a string because of latin that is can have bis ter or a letter (3c)
*/
private String houseNumber;
/**
* the name of the street
*/
private String streetname;
public InterpolationMember(String id, int sequenceId, Point location, String houseNumber, String streetname) {
super();
this.id = id;
this.sequenceId = sequenceId;
this.location = location;
this.houseNumber = houseNumber;
this.streetname = streetname;
}
public InterpolationMember() {
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the sequenceId
*/
public int getSequenceId() {
return sequenceId;
}
/**
* @param sequenceId the sequenceId to set
*/
public void setSequenceId(int sequenceId) {
this.sequenceId = sequenceId;
}
/**
* @return the location
*/
public Point getLocation() {
return location;
}
/**
* @param location the location to set
*/
public void setLocation(Point location) {
this.location = location;
}
/**
* @return the streetname
*/
public String getStreetname() {
return streetname;
}
/**
* @param streetname the streetname to set
*/
public void setStreetname(String streetname) {
this.streetname = streetname;
}
/**
* @return the houseNumber
*/
public String getHouseNumber() {
return houseNumber;
}
/**
* @param houseNumber the houseNumber to set
*/
public void setHouseNumber(String houseNumber) {
this.houseNumber = houseNumber;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((houseNumber == null) ? 0 : houseNumber.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + sequenceId;
result = prime * result + ((streetname == null) ? 0 : streetname.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
InterpolationMember other = (InterpolationMember) obj;
if (houseNumber == null) {
if (other.houseNumber != null)
return false;
} else if (!houseNumber.equals(other.houseNumber))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (location == null) {
if (other.location != null)
return false;
} else if (!location.equals(other.location))
return false;
if (sequenceId != other.sequenceId)
return false;
if (streetname == null) {
if (other.streetname != null)
return false;
} else if (!streetname.equals(other.streetname))
return false;
return true;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("InterpolationMember [");
if (id != null) {
builder.append("id=");
builder.append(id);
builder.append(", ");
}
builder.append("sequenceId=");
builder.append(sequenceId);
builder.append(", ");
if (location != null) {
builder.append("location=");
builder.append(location);
builder.append(", ");
}
if (houseNumber != null) {
builder.append("houseNumber=");
builder.append(houseNumber);
builder.append(", ");
}
if (streetname != null) {
builder.append("streetname=");
builder.append(streetname);
}
builder.append("]");
return builder.toString();
}
public int compareTo(InterpolationMember o) {
return sequenceId - o.sequenceId;
}
}