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

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

public class SensorsContainerQueued
extends HashMap<String,Map<String,Queue<SuperSensor>>>

Container of sensor message representatives. Note that this is equvalent with SensorsContainer. The difference is that the Queued version does not throw out records until it is requiered to do so. It lines them up to lists. This is needed when we want the best quality readings and regular ticks are not enough to keep up with the speed of sensor messages being recieved.

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
SensorsContainerQueued()
           
 
Method Summary
 List<MessageDescriptor> getNonEmptyDescription()
          For each type of sensor it adds all individuals to the returnee List as a couple (Type, Name)
 List<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.
 boolean isReady(SensorType type)
          Iterates through local hashmap and seeks for the specified sensor type.
 
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

SensorsContainerQueued

public SensorsContainerQueued()
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 List<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.

isReady

public boolean isReady(SensorType type)
Iterates through local hashmap and seeks for the specified sensor type. If found and is not empty returns true. False otherwise.

Parameters:
type - SensorType is the type of sensor we want to be able to work with.
Returns:
Returns true if map of specified sensor type is not null nor empty. False otherwise.


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