⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node.java

📁 2004年robotcup世界冠军源代码
💻 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 + -