Package com.metratec.lib.inventory
Class InventoryWithTimestamp<T extends RfidTag>
- java.lang.Object
-
- com.metratec.lib.inventory.InventoryWithTimestamp<T>
-
- Type Parameters:
T
-RfidTag
instance
public class InventoryWithTimestamp<T extends RfidTag> extends java.lang.Object
Implementation for a periodic inventory check.
Add the tags withaddTag(RfidTag)
oraddTags(List)
, then check the inventory for losted tags withcheckInventory()
- Author:
- man
-
-
Constructor Summary
Constructors Constructor Description InventoryWithTimestamp(java.lang.String identifier)
InventoryWithTimestamp(java.lang.String identifier, java.lang.Long tagKeepTime)
-
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 inventoryjava.util.List<T>
checkInventory()
check the current inventory for tags there are no longer foundjava.util.List<T>
clear()
Remove all tags from the inventoryjava.lang.String
getIdentifier()
java.util.List<T>
getInventory()
Return the current inventorylong
getKeepTime()
java.lang.Long
removeTag(java.lang.String tagEid)
Remove a tag from this listjava.util.List<java.lang.String>
removeTags(java.util.List<java.lang.String> tags)
void
setKeepTime(java.lang.Long keepTime)
-
-
-
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 identifiertagKeepTime
- 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
-
-