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

📄 rcrobject.java

📁 2004年robotcup世界冠军源代码
💻 JAVA
字号:
// Copyright (C) 2002 Takeshi Morimoto <morimoto@takopen.cs.uec.ac.jp>// All rights reserved.// Edited By Omid Aghazadehpackage yab.agent.object;import yab.agent.*;import yab.io.*;import yab.io.object.*;public abstract class RCRObject {  protected final BaseRCRObject object;  public final DisasterSpace world;  public final int id;  //saeed 85-2-3  public RCRObject(int id, BaseRCRObject object,                   DisasterSpace world) {    this.id = id;    this.object = object;    this.world = world;  }  public void setProperty(int time, PropertyElement[] properties) {    for (int i = 0; i < properties.length; i++)      setProperty(time, properties[i].type, properties[i].value);  }  public void setProperty(int time, int type, int[] value) {    object.setProperty(time, type, value);  }  public int hashCode() {    return object.hashCode();  }  private int m_time;  public int time() {    return m_time;  }  public void setTime(int time) {    m_time = time;  }  private int m_hearTime = 0;  public int hearTime(){      return m_hearTime;  }  public void setHearTime(int time)  {      m_hearTime = time;  }  public String toString() {    return Util.classBaseName(this) + "(ID:" + id + ")";  }  public static RCRObject produce(int type, int id, DisasterSpace ds) {    switch (type) {      case ProtocolConstants.TYPE_WORLD:        return new World(id, ds);      case ProtocolConstants.TYPE_RIVER:        return new River(id, ds);      case ProtocolConstants.TYPE_RIVER_NODE:        return new RiverNode(id, ds);      case ProtocolConstants.TYPE_ROAD:        return new Road(id, ds);      case ProtocolConstants.TYPE_NODE:        return new Node(id, ds);      case ProtocolConstants.TYPE_BUILDING:        return new Building(id, ds);      case ProtocolConstants.TYPE_AMBULANCE_CENTER:        return new AmbulanceCenter(id, ds);      case ProtocolConstants.TYPE_FIRE_STATION:        return new FireStation(id, ds);      case ProtocolConstants.TYPE_POLICE_OFFICE:        return new PoliceOffice(id, ds);      case ProtocolConstants.TYPE_REFUGE:        return new Refuge(id, ds);      case ProtocolConstants.TYPE_CIVILIAN:        return new Civilian(id, ds);      case ProtocolConstants.TYPE_AMBULANCE_TEAM:        return new AmbulanceTeam(id, ds);      case ProtocolConstants.TYPE_FIRE_BRIGADE:        return new FireBrigade(id, ds);      case ProtocolConstants.TYPE_POLICE_FORCE:        return new PoliceForce(id, ds);      case ProtocolConstants.TYPE_CAR:        return new Car(id, ds);      default:        throw new Error("illeagle object type" + type);    }  }  public static int getType(RCRObject obj) {    String type = yab.agent.Util.classBaseName(obj.getClass());    if (type == "World")      return ProtocolConstants.TYPE_WORLD;    else if (type == "River")      return ProtocolConstants.TYPE_RIVER;    else if (type == "Car")      return ProtocolConstants.TYPE_CAR;    else if (type == "PoliceForce")      return ProtocolConstants.TYPE_POLICE_FORCE;    else if (type == "FireBrigade")      return ProtocolConstants.TYPE_FIRE_BRIGADE;    else if (type == "Civilian")      return ProtocolConstants.TYPE_CIVILIAN;    else if (type == "FireStation")      return ProtocolConstants.TYPE_FIRE_STATION;    else if (type == "Building")      return ProtocolConstants.TYPE_BUILDING;    else if (type == "Node")      return ProtocolConstants.TYPE_NODE;    else if (type == "Road")      return ProtocolConstants.TYPE_ROAD;    else if (type == "Refuge")      return ProtocolConstants.TYPE_REFUGE;    else if (type == "RiverNode")      return ProtocolConstants.TYPE_RIVER_NODE;    else      throw new Error("illeagle object " + type);  }  public boolean isVisible() {    return (time() == world.time());  }  /*      public boolean equals(Object obj){        return getClass() == obj.getClass() && obj instanceof RCRObject && ((RCRObject)obj).id == id;      }   */}

⌨️ 快捷键说明

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