1 package cz.cuni.amis.pogamut.usar2004.agent.module.configuration; 2 3 import cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.ConfigType; 4 5 /** 6 * Configuration message representative for Effecters. 7 * 8 * @author vejmanm 9 */ 10 public class ConfigEffecter extends SuperConfiguration 11 { 12 public static final ConfigType type = ConfigType.EFFECTER; 13 14 /** 15 * Ctor. Configuration type describes particular subject about which we want 16 * to know about. It is used to distinguish incoming message from the 17 * server. 18 */ 19 public ConfigEffecter() 20 { 21 super(type); 22 } 23 24 /** 25 * For an effector, the configuration message can contain multiple OpCodes. 26 * Opcode value is the name of the opcode that the effecter implements. 27 * Refer to Section 8 of USARSim Manual v3.1.3 for a list of the opcodes. 28 * 29 * NOTE: An effecter can implement more than one opcode and the CONF message 30 * returns the configuration information for all effecters on the robotic 31 * platform. Therefore the segment with the name value pair indicates a new 32 * effecter and the opcode name value pair indicates the opcode the effecter 33 * specified in by name implements. 34 * 35 * @param index 36 * @return Returns Operation Code at given index. 37 */ 38 public String getOpcodeAt(int index) 39 { 40 if(index < getOpcodesLength()) 41 { 42 return lastMessage.getOpcodes().get(index); 43 } 44 return null; 45 } 46 47 /** 48 * It is value that indicates the upper bound for the value that is accepted 49 * by the effecter. 50 * 51 * @param index 52 * @return Returns Max value at given index. 53 */ 54 public double getMaxValueAt(int index) 55 { 56 if(index < getOpcodesLength()) 57 { 58 return lastMessage.getMaxVals().get(index); 59 } 60 return -1; 61 } 62 63 /** 64 * It is value that indicates the lower bound for the value that is accepted 65 * by the effecter. 66 * 67 * @param index 68 * @return Returns Minx value at given index. 69 */ 70 public double getMinValueAt(int index) 71 { 72 if(index < getOpcodesLength()) 73 { 74 return lastMessage.getMinVals().get(index); 75 } 76 return -1; 77 } 78 79 /** 80 * Returns length of Opcode list. 81 * 82 * @return Returns length of Opcode list. 83 */ 84 public int getOpcodesLength() 85 { 86 return lastMessage.getOpcodes().size(); 87 } 88 89 /** 90 * Returns lenght of Minimal values list. 91 * 92 * @return Returns lenght of Minimal values list. 93 */ 94 public int getMinValsLength() 95 { 96 return lastMessage.getMinVals().size(); 97 } 98 99 /** 100 * Returns lenght of Maximal values list. 101 * 102 * @return Returns lenght of Maximal values list. 103 */ 104 public int getMaxValsLength() 105 { 106 return lastMessage.getMaxVals().size(); 107 } 108 }