NPTLab
Class DTNHWMap

java.lang.Object
  extended by NPTLab.DTNHWMap

public class DTNHWMap
extends java.lang.Object

Class that contains a map to mantain the one to one realtionship between a DTNHost and his DTNHostWrapper implemented with a singleton pattern.

Author:
Andrea Campanella, NPTLab, Public university of Milan, 2014

Method Summary
 void add(DTNHost h, core.Coord destination, int day, double time)
          Adds to the map an entrance of Host and a DTNHostWrapper from the DTNHWMAP or a new one if it didn't exist.
static DTNHWMap getInstance()
          Returns the instance of the map.
 DTNHostWrapper returnDTNHostWrapper(DTNHost h)
          Returns the DTNHostWrapper for the given DTNHost h
 java.util.Map<DTNHost,DTNHostWrapper> returnMap()
          Returns the Map of the singleton instance of the DTNHWmap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DTNHWMap getInstance()
Returns the instance of the map. if the map doesn't exist the method creates it.

Returns:
Map

add

public void add(DTNHost h,
                core.Coord destination,
                int day,
                double time)
Adds to the map an entrance of Host and a DTNHostWrapper from the DTNHWMAP or a new one if it didn't exist. adds in both cases the destination, the day and the time specified.

Parameters:
h - DTNHost the moving host
destination - Coord the coordinates of the location where the host is going
day - int the day in which the user visited a specified location
time - double the time spent at a single location

returnMap

public java.util.Map<DTNHost,DTNHostWrapper> returnMap()
Returns the Map of the singleton instance of the DTNHWmap


returnDTNHostWrapper

public DTNHostWrapper returnDTNHostWrapper(DTNHost h)
Returns the DTNHostWrapper for the given DTNHost h

Returns:
DTNHostWrapper