road.java

来自「Java的框架」· Java 代码 · 共 141 行

JAVA
141
字号
package mcaps.apps.prrm.roaddefect.model;

import mcap.core.base.model.BaseObject;
import mcap.core.user.model.Role;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * The <code>Road</code> represents the road object of a road defect.
 * @author jov
 * @date 10-Nov-2005
 * @version 1.0.1.0
 */
public class Road extends BaseObject implements Comparable {
	
	private static final long serialVersionUID = 1841834463135243286L;
	
	private Integer id;
//	private String coordinates;
	private String name;
	private String bbox;
	
	/**
	 * Returns the id.
	 * @return int
	 */
	public Integer getId () {
		return id;
	}

	/**
	 * Sets the id.
	 * @param id The id to set.
	 */
	public void setId (Integer id) {
		this.id = id;
	}

	/**
	 * Returns the bbox.
	 * @return String
	 */
	public String getBbox () {
		return bbox;
	}
	
	/**
	 * Sets the bbox.
	 * @param bbox The bbox to set.
	 */
	public void setBbox (String bbox) {
		this.bbox = bbox;
	}

//	/**
//	 * Returns the coordinates.
//	 * @return String
//	 */
//	public String getCoordinates () {
//		return coordinates;
//	}
//	
//	/**
//	 * Sets the coordinates.
//	 * @param coordinates The coordinates to set.
//	 */
//	public void setCoordinates (String coordinates) {
//		this.coordinates = coordinates;
//	}
	
	/**
	 * Returns the road name.
	 * @return String
	 */
	public String getName () {
		return name;
	}
	
	/**
	 * Sets the road name.
	 * @param roadName The road name to set.
	 */
	public void setName (String name) {
		this.name = name;
	}

	/**
	 * @see java.lang.Comparable#compareTo(Object)
	 */
	public int compareTo(Object object) {
		Road myClass = (Road) object;
		return new CompareToBuilder().append(this.bbox, myClass.bbox).append(
				this.name, myClass.name).append(this.id, myClass.id)
//				.append(this.coordinates, myClass.coordinates)
				.toComparison();
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof Road)) {
			return false;
		}
		
		final Road road = (Road) object;

	    if (id != null ? !id.equals(road.id) : road.id != null) 
	    	return false;

	    return true;
	    
	}



	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return (id != null ? id.hashCode() : 0);
	}



	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("id",
				this.id).append("name", this.name).append("bbox", this.bbox)
//				.append("coordinates",this.coordinates)
				.toString();
	}
	
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?