1 package cz.cuni.amis.pogamut.usar2004.agent.module.sensor; 2 3 import cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.SensorType; 4 import java.util.Map; 5 import java.util.Set; 6 7 /** 8 * Sensor message representative for Range sensor. 9 * 10 * @author vejmanm 11 */ 12 public class SensorRange extends SuperSensor 13 { 14 //public static final String type="Sonar"; 15 public static final SensorType type = SensorType.RANGE_SENSOR; 16 17 /** 18 * Ctor. Sensor type describes particular subject about which we want to 19 * know about. It is used to distinguish incoming message from the server. 20 */ 21 public SensorRange() 22 { 23 super(type); 24 } 25 26 /** 27 * Map indexed by string is used to collect data of range sensor. ‘Dtring’ 28 * is the sensor name, ‘Double’ is the range value in meters. 29 * 30 * @param Name String representation of Range Name. 31 * @return Returns range from range sensor(Sonar) matching input 32 * <b>Name</b>. 33 */ 34 public double getRangeByName(String Name) 35 { 36 return lastMessage.getRangeRanges().get(Name); 37 } 38 39 /** 40 * Map indexed by string is used to collect data of range sensor. ‘Dtring’ 41 * is the sensor name, ‘Double’ is the range value in meters. 42 * 43 * @return Returns Keyset of the map representing names of range ranges. 44 */ 45 public Set<String> getRangeNames() 46 { 47 return lastMessage.getRangeRanges().keySet(); 48 } 49 50 /** 51 * Returns size of Ranges. 52 * 53 * @return Returns size of Ranges. 54 */ 55 public int getSize() 56 { 57 return lastMessage.getRangeRanges().size(); 58 } 59 60 /** 61 * Map indexed by string is used to collect data of range sensor. ‘Dtring’ 62 * is the sensor name, ‘Double’ is the range value in meters. 63 * 64 * @return Returns Map of ranges from range sensor(Sonar). 65 */ 66 public Map<String, Double> getRanges() 67 { 68 return lastMessage.getRangeRanges(); 69 } 70 }