cz.cuni.amis.pogamut.usar2004.agent.module.datatypes
Class SensorsContainer

Package class diagram package SensorsContainer
java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,Map<String,SuperSensor>>
          extended by cz.cuni.amis.pogamut.usar2004.agent.module.datatypes.SensorsContainer
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Map<String,SuperSensor>>

public class SensorsContainer
extends HashMap<String,Map<String,SuperSensor>>

Container of sensor message representatives. Note that this is equvalent with SensorsContainerQueued. The difference is that the non queued version throws out records as soon as new comes along. It writes them over. This is needed when we do not care about precision - when we want to know what is happening right now!

Author:
vejmanm
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
SensorsContainer()
           
 
Method Summary
 List<MessageDescriptor> getNonEmptyDescription()
          For each type of sensor it adds all individuals to the returnee List as a couple (Type, Name)
 SuperSensor getSensorByTypeName(String type, String name)
          Gets sensor message representatives from local hashmap specified by type and by name.
 List<SuperSensor> getSensorsByClass(Class c)
          Adds every object that can be casted to initial class to the output list.
 List<SuperSensor> getSensorsBySensorType(SensorType type)
          Iterates through local hashmap values and seeks match.
 List<SuperSensor> getSensorsByType(String type)
          Gets sensor message representatives from local hashmap.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

SensorsContainer

public SensorsContainer()
Method Detail

getSensorsByType

public List<SuperSensor> getSensorsByType(String type)
Gets sensor message representatives from local hashmap. Returns null if none matches or this hash map is empty.

Parameters:
type - String representing the type of sensor to return.
Returns:
Returns List of specified type of Sensor module.

getSensorsBySensorType

public List<SuperSensor> getSensorsBySensorType(SensorType type)
Iterates through local hashmap values and seeks match. Returns null if this hash map is empty. Note, that if type = UNKNOWN_SENSOR it returns all unknown sensors.

Parameters:
type - SensorType representing the type of sensor to return.
Returns:
Returns List of all sensors that suit input SensorType.

getSensorsByClass

public List<SuperSensor> getSensorsByClass(Class c)
Adds every object that can be casted to initial class to the output list. Note that if feeded with SuperSensor class it will return all available submodules.

Parameters:
c - Class representing the type of which the return list should be.
Returns:
Returns a list of eligible objects, that can be casted to Class c.

getSensorByTypeName

public SuperSensor getSensorByTypeName(String type,
                                       String name)
Gets sensor message representatives from local hashmap specified by type and by name. Returns null if none matches or this hash map is empty.

Parameters:
type - String representing the type of sensor to return.
name - String representing the name of sensor to return.
Returns:
Returns List of specified type of Sensor module.

getNonEmptyDescription

public List<MessageDescriptor> getNonEmptyDescription()
For each type of sensor it adds all individuals to the returnee List as a couple (Type, Name)

Returns:
returns Map of couples (Type/Name) of non empty sensor representatives.


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.