1 package cz.cuni.amis.pogamut.usar2004.agent.module.sensor; 2 3 import cz.cuni.amis.pogamut.usar2004.agent.USAR2004Bot; 4 import cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.SensorType; 5 import java.util.Map; 6 import java.util.Set; 7 8 /** 9 * Sensor message representative for Touch sensor. 10 * 11 * @author vejmanm 12 */ 13 public class SensorTouch extends SuperSensor 14 { 15 //public static final String type="Touch"; 16 public static final SensorType type = SensorType.TOUCH_SENSOR; 17 18 /** 19 * Ctor. Sensor type describes particular subject about which we want to 20 * know about. It is used to distinguish incoming message from the server. 21 */ 22 public SensorTouch() 23 { 24 super(type); 25 } 26 27 /** 28 * String is the sensor name. Boolean indicates whether the sensor is 29 * touching something. Value ‘True’ means the sensor is touching something. 30 * 31 * @param Name String representation of touch sensor name. 32 * @return Returns Boolean value matching <B>Name</B>. 33 */ 34 public boolean getTouchByName(String Name) 35 { 36 return lastMessage.getTouches().get(Name); 37 } 38 39 /** 40 * String is the sensor name. Boolean indicates whether the sensor is 41 * touching something. Value ‘True’ means the sensor is touching something. 42 * 43 * @return Returns KeySet of Touch Map. 44 */ 45 public Set<String> getTouchNames() 46 { 47 return lastMessage.getTouches().keySet(); 48 } 49 50 /** 51 * Returns size of touch map. 52 * 53 * @return Returns size of touch map. 54 */ 55 public int getTouchesSize() 56 { 57 return lastMessage.getTouches().size(); 58 } 59 60 /** 61 * String is the sensor name. Boolean indicates whether the sensor is 62 * touching something. Value ‘True’ means the sensor is touching something. 63 * 64 * @return Returns map of touch names and values. 65 */ 66 private Map<String, Boolean> getTouches() 67 { 68 return lastMessage.getTouches(); 69 } 70 }