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

📄 building.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 java.util.*;import yab.agent.DisasterSpace;import yab.io.object.*;import yab.io.ProtocolConstants;public class Building extends PointObject implements ProtocolConstants {    public Building(int id, BaseBuilding object, DisasterSpace world)    { super(id, object, world); }    public Building(int id, DisasterSpace world)    { super(id, new BaseBuilding(id), world); }    private BaseBuilding obj() { return (BaseBuilding) object; }    public int floors()             { return obj().floors(); }    public int fieryness()          { return obj().fieryness(); }    public int buildingCode()       { return obj().buildingCode(); }    public int buildingAreaGround() { return obj().buildingAreaGround(); }    public int buildingAreaTotal()  { return obj().buildingAreaTotal(); }    private MotionlessObject m_entrance = null;    public boolean isBurnedDownTimeSet = false;    public boolean isPutOutAndExtinguish = false;//saeed 85-2-3   public MotionlessObject entrance() {		if (m_entrance == null)		//m_entrance = (MotionlessObject) world.get(obj().entrance());			m_entrance = (MotionlessObject) entrances().get(0);		return m_entrance;	}    public Collection neighborhood() {        return entrances();    }    public boolean isUnburned() { return fieryness() == 0; }    public boolean isBurning() { return 1 <= fieryness() && fieryness() <= 3; }    public boolean isPutOut() { return 5 <= fieryness() && fieryness() <= 7; }    public boolean isBurned() { return fieryness() > 7 ; }    /** CAUTION: This method is implemented assuming that the agent     *  can perceive all fires in the disaster space regardless of how     *  far them are.     */    public int burningTime() { return world.time() - m_ignitedTime ; }    private int m_ignitedTime = Integer.MAX_VALUE;    public void setProperty(int time,int type, int[] value) {        boolean wasUnburned = fieryness() == 0;        super.setProperty(time,type, value);        if (wasUnburned  &&  fieryness() != 0)            m_ignitedTime = world.time();    }    private boolean isFull = false;    private boolean isChecking = false;    private int timeOut;    public void setFull() {      isFull = true;    }    public void setUnFull() {      isFull = false;    }    public boolean isFull() {      return isFull;    }    public boolean check() {      if (!isChecking) {        isChecking = true;        timeOut = 1;      } else {        if (timeOut == 1) {          timeOut--;        } else {          setFull();        }      }      return isFull();    }    public int brokenness()   { return obj().brokenness(); }    public boolean ignition()   { return obj().ignition(); }    //Ashkan added    private ArrayList m_entrances = null;    public ArrayList entrances()    {        if (m_entrances == null) {            int[] es = obj().entrances();            m_entrances = new ArrayList(es.length);            for (int i = 0; i < es.length; i++)                m_entrances.add(world.get(es[i]));        }        return m_entrances;    }    private int m_fireStart = -1;    public void setFireStart(int value) {        m_fireStart = value;    }    public int getFireStart() {        return m_fireStart;    }    public void setFieryness(int value)    {        this.object.setProperty(time(), PROPERTY_FIERYNESS, new int[]{value});    }    private int m_threshold;    public void setThreshold(int value) {		m_threshold = value;	}	public int getThreshold() {		return m_threshold;	}    public ArrayList connectedBuildings = new ArrayList();    public ArrayList neighbourBuildings = new ArrayList();    public Report emptyBuildingReport = new Report();    public int[] buildingApexes()   { return obj().buildingApexes(); }    public ArrayList inDangerNeighbors()    {        if(fieryness() == 4 || fieryness() == 0)        {            return null;        }        ArrayList ret = new ArrayList();        for(int i=0;i<connectedBuildings.size();++i)        {            Building b = (Building)connectedBuildings.get(i);            if(b.fieryness() == 0)            {                if(!(b instanceof Refuge) && !(b instanceof AmbulanceCenter) &&                !(b instanceof PoliceOffice) && !(b instanceof FireStation))                {                    ret.add(b);                }            }            else if(b.fieryness() >= 4 && b.fieryness() <= 7)            {                ret.add(b);            }        }        return ret;    }    public ArrayList burnedNeighbors()    {        ArrayList ret = new ArrayList();        for(int i=0;i<connectedBuildings.size();++i)        {            Building b = (Building)connectedBuildings.get(i);            if(b.fieryness() > 0)                ret.add(b);        }        return ret;    }    public int counter = 0;    public float[] connectionValues;    //Ashkan added    //added by saeed from here goes down    public int selectTime;    public boolean isTimeSet = false;    private int m_totalDistanceToVictims;    public int timeOfPutout = 0;    public int extraExtinguishTime = 0;    public int extraExtinguishTime2 = 0;    public boolean isPutoutTimeSet = false;    public void setTotalDistanceToVictims(int distance)    {        m_totalDistanceToVictims = distance;    }    public int getTotalDistanceToVictims()    {        return m_totalDistanceToVictims;    }    private int m_hearedEmptyTime = 0;    public int hearedEmptyTime(){        return m_hearedEmptyTime;    }    public void setEmtpyTime(int time){        m_hearedEmptyTime = time;    }}

⌨️ 快捷键说明

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