📄 node.java
字号:
// Copyright (C) 2002 Takeshi Morimoto <morimoto@takopen.cs.uec.ac.jp>// All rights reserved.package yab.agent.object;import yab.agent.DisasterSpace;import yab.io.object.*;import java.util.*;import MRL.Utilities.Partitioning.Path;public class Node extends Vertex implements MRL.Utilities.ConstantConditions { public Node(int id, DisasterSpace world) { super(id, new BaseNode(id), world); } private BaseNode obj() { return (BaseNode) object; } /** * @return whether it is possible to move from this Node to the * specified road */ public boolean isMovableTo(Road road) { return (this == road.head() && road.passableLinesToTail() >= 1 || this == road.tail() && road.passableLinesToHead() >= 1); } private List connectedRoads = null; public List getConnectedRoads(){ if(connectedRoads == null){ connectedRoads=new ArrayList(); connectedRoads.addAll(ROAD_C.extract(neighborhood())); } return connectedRoads; } private List connectedBuildings=null ; public List getConnectedBuildings() { if (connectedBuildings == null) { connectedBuildings = new ArrayList(); connectedBuildings.addAll(BUILDING_C.extract(neighborhood())); } return connectedBuildings; } private List connectedPaths = null; public List getConnectedPaths(){ if(connectedPaths == null){ connectedPaths = new ArrayList(); Path path = world.getContainingPath(this); if(path != null ){ connectedPaths.add(path); }else{ for(Iterator it = getConnectedRoads().iterator();it.hasNext();){ path = world.getContainingPath((Road)it.next()); connectedPaths.add(path); } } } return connectedPaths; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -