org.nak.cleaner
Class Simulator

java.lang.Object
  extended by org.nak.cleaner.Simulator

public class Simulator
extends java.lang.Object

Simulator class Ver2.00

Author:
h-nakagawa Ver2.00-API of Virtual Robot is only provided through the simulator interface (for displaying Exceptions on Simulator GUI by catching them)

Field Summary
 boolean isLoadAmountConsidered
           
 
Constructor Summary
Simulator()
          The constructor.
 
Method Summary
 boolean chargeBattery()
          Charges battery.
 void checkBatteryWithInterval()
          現在のロボットのバッテリー残量を返す(時間差:ICSE実験用)
 boolean existsDust()
          Checks whether there are any dust items at the robot position.
 java.awt.Point find(java.lang.String targetType)
           
 int getBattery()
          Gets the current battery level.
 java.awt.Point getCurrentPoint()
          Returns the current robot's position.
 FieldMap getFieldMap()
           
 int getLoadAmount()
          Gets the current load amount of the robot.
 Obstacle getObstacle()
           
 VirtualRobot getRobot()
           
static Simulator getSimulator()
           
 int getVisibleBattery()
          現在のバッテリー(外部表示) (for EXP2) checkBatteryWithInterval()を実行しないと更新されない
 boolean isBatteryChecked()
           
 boolean isCameraBroken()
          Checks whether the camera module of the robot is broken.
 boolean isFinished()
          Returns whether dust items remain in the field.
 boolean isLocatedOnDustBin()
          Checks whether there are any dust bins at the robot position.
 boolean isLocatedOnStation()
          Checks whether there are any battery stations at the robot position.
 java.lang.Boolean isReady()
          Returns whether simulator can be executed.
 int moveNext(Direction d)
           
 boolean pickUp()
           
 void resetBatteryCheck()
          ロボットのバッテリーチェックフラグをリセットする バッテリーチェックが完了したことを示す
 void setFieldMap(java.lang.String mapName)
          Sets a map on simulator.
 void setObstacle(Obstacle or)
           
 boolean sweep()
           
 boolean unloadDust()
          Unloads dust items into the dust bin
 Appearance watchObject()
          Gets appearance of the object that the robot is located in the same place.
 boolean wipe()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isLoadAmountConsidered

public boolean isLoadAmountConsidered
Constructor Detail

Simulator

public Simulator()
The constructor.

Method Detail

getSimulator

public static Simulator getSimulator()

setFieldMap

public void setFieldMap(java.lang.String mapName)
Sets a map on simulator.

Parameters:
mapName - Name of the map

getFieldMap

public FieldMap getFieldMap()

isReady

public java.lang.Boolean isReady()
Returns whether simulator can be executed. (for GUI)

Returns:

isFinished

public boolean isFinished()
Returns whether dust items remain in the field. (for checking termination condition)

Returns:
Returns true if there are no dust items in the field.

getRobot

public VirtualRobot getRobot()

getObstacle

public Obstacle getObstacle()

setObstacle

public void setObstacle(Obstacle or)

find

public java.awt.Point find(java.lang.String targetType)

moveNext

public int moveNext(Direction d)

pickUp

public boolean pickUp()

sweep

public boolean sweep()

wipe

public boolean wipe()

chargeBattery

public boolean chargeBattery()
Charges battery.

Returns:
returns true when the robot succeeded charging, otherwise returns false. (Charge is failed when robot is not in the same point of the station.)

unloadDust

public boolean unloadDust()
Unloads dust items into the dust bin

Returns:
returns true when the robot succeeded unloading, otherwise returns false. (Unload is failed when robot is not in the same point of the dust bin.)

existsDust

public boolean existsDust()
Checks whether there are any dust items at the robot position.

Returns:
returns true if there is a dust item at the robot's position.

isLocatedOnStation

public boolean isLocatedOnStation()
Checks whether there are any battery stations at the robot position.

Returns:
returns true if there is a battery station at the robot's position.

isLocatedOnDustBin

public boolean isLocatedOnDustBin()
Checks whether there are any dust bins at the robot position.

Returns:
returns true if there is a dust bin at the robot's position.

getCurrentPoint

public java.awt.Point getCurrentPoint()
Returns the current robot's position.

Returns:
Point where the robot is located.

watchObject

public Appearance watchObject()
Gets appearance of the object that the robot is located in the same place.

Returns:
Appearance of the object

checkBatteryWithInterval

public void checkBatteryWithInterval()
現在のロボットのバッテリー残量を返す(時間差:ICSE実験用)


isBatteryChecked

public boolean isBatteryChecked()

resetBatteryCheck

public void resetBatteryCheck()
ロボットのバッテリーチェックフラグをリセットする バッテリーチェックが完了したことを示す


getVisibleBattery

public int getVisibleBattery()
現在のバッテリー(外部表示) (for EXP2) checkBatteryWithInterval()を実行しないと更新されない

Returns:

getBattery

public int getBattery()
Gets the current battery level. (素直にチェックできる場合<->ICSE論文実験2用)

Returns:
current battery level (integer type).

getLoadAmount

public int getLoadAmount()
Gets the current load amount of the robot.

Returns:
current load amount (integer type).

isCameraBroken

public boolean isCameraBroken()
Checks whether the camera module of the robot is broken.

Returns:
returns true if the camera module of the robot is broken.