junction.java

来自「Eclipse+repastS」· Java 代码 · 共 70 行

JAVA
70
字号
/*〤opyright 2008 Nick MallesonThis file is part of RepastCity.RepastCity is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.RepastCity 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 General Public License for more details.You should have received a copy of the GNU General Public License along with RepastCity.  If not, see <http://www.gnu.org/licenses/>. */package repastcity.citycontext;import java.util.ArrayList;import repastcity.ContextCreator;import com.vividsolutions.jts.geom.Coordinate;public class Junction {	private int ID;//	private String identifier;	private Coordinate coord;		private ArrayList<Road> roads = new ArrayList<Road>();	// The Roads connected to this Junction	public Junction() {		this.ID = ContextCreator.generateAgentID();//		this.description = "junction";	}		public Junction(Coordinate coord, Road road) {		this.ID = ContextCreator.generateAgentID();//		this.description = "junction";		this.coord = coord;	}		public String toString() {		return "Junction "+this.ID+" at: "+this.coord.toString(); 	}	public int getID() {		return ID;	}	public void setID(int id) {		this.ID = id;	}		public Coordinate getCoordinate() {		return this.coord;	}		public boolean equals(Junction j) {		if (this.coord.equals(j.getCoordinate()))			return true;		else			return false;	}	public ArrayList<Road> getRoads() {		return this.roads;	}	public void addRoad(Road road) {		this.roads.add(road);	}	}

⌨️ 快捷键说明

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