Class InventoryWithTimestamp<T extends RfidTag>

  • Type Parameters:
    T - RfidTag instance

    public class InventoryWithTimestamp<T extends RfidTag>
    extends java.lang.Object
    Implementation for a periodic inventory check.
    Add the tags with addTag(RfidTag) or addTags(List), then check the inventory for losted tags with checkInventory()
    Author:
    man
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Long addTag​(T tag)  
      java.util.List<T> addTags​(java.util.List<T> inventory)
      update the current inventory
      java.util.List<T> checkInventory()
      check the current inventory for tags there are no longer found
      java.util.List<T> clear()
      Remove all tags from the inventory
      java.lang.String getIdentifier()  
      java.util.List<T> getInventory()
      Return the current inventory
      long getKeepTime()  
      java.lang.Long removeTag​(java.lang.String tagEid)
      Remove a tag from this list
      java.util.List<java.lang.String> removeTags​(java.util.List<java.lang.String> tags)  
      void setKeepTime​(java.lang.Long keepTime)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InventoryWithTimestamp

        public InventoryWithTimestamp​(java.lang.String identifier)
        Parameters:
        identifier - inventory identifier
      • InventoryWithTimestamp

        public InventoryWithTimestamp​(java.lang.String identifier,
                                      java.lang.Long tagKeepTime)
        Parameters:
        identifier - inventory identifier
        tagKeepTime - the tag keep time (to disable automatic removing tags, set keep time to -1)
    • Method Detail

      • addTag

        public java.lang.Long addTag​(T tag)
        Parameters:
        tag - the tag to add
        Returns:
        the tag last timestamp or null if the tag was not in inventory
      • addTags

        public java.util.List<T> addTags​(java.util.List<T> inventory)
        update the current inventory
        Parameters:
        inventory - List with the founded tag ids
        Returns:
        a List with all tags, who are new in the inventory
      • checkInventory

        public java.util.List<T> checkInventory()
        check the current inventory for tags there are no longer found
        Returns:
        a list with removed tags
      • getInventory

        public java.util.List<T> getInventory()
        Return the current inventory
        Returns:
        the current inventory
      • getKeepTime

        public long getKeepTime()
        Returns:
        the keepTime
      • setKeepTime

        public void setKeepTime​(java.lang.Long keepTime)
        Parameters:
        keepTime - the keepTime to set
      • removeTag

        public java.lang.Long removeTag​(java.lang.String tagEid)
        Remove a tag from this list
        Parameters:
        tagEid - tag eid to remove
        Returns:
        the last tag timestamp
      • removeTags

        public java.util.List<java.lang.String> removeTags​(java.util.List<java.lang.String> tags)
        Parameters:
        tags - List of tags
        Returns:
        a List with removed tags
      • clear

        public java.util.List<T> clear()
        Remove all tags from the inventory
        Returns:
        List with removed tags
      • getIdentifier

        public java.lang.String getIdentifier()
        Returns:
        the identifier