Package com.metratec.lib.inventory
Class InventoryWithTimestamp
- java.lang.Object
-
- com.metratec.lib.inventory.InventoryWithTimestamp
-
public class InventoryWithTimestamp extends Object
Implementation for a periodic inventory check.
Add the tags withaddTag(String, long)
oraddTags(List, long)
, then check the inventory for losted tags withcheckInventory()
- Author:
- man
-
-
Constructor Summary
Constructors Constructor Description InventoryWithTimestamp(String identifier)
InventoryWithTimestamp(String identifier, Long tagKeepTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
addTag(String tag, long timestamp)
List<String>
addTags(List<String> inventory, long timestamp)
update the current inventoryList<String>
checkInventory()
check the current inventory for tags there are no longer foundList<String>
clear()
Remove all tags from the inventoryString
getIdentifier()
List<String>
getInventory()
Return the current inventorylong
getKeepTime()
Long
removeTag(String tagEid)
Remove a tag from this listList<String>
removeTags(List<String> tags)
void
setKeepTime(Long keepTime)
-
-
-
Constructor Detail
-
InventoryWithTimestamp
public InventoryWithTimestamp(String identifier)
- Parameters:
identifier
- inventory identifier
-
-
Method Detail
-
addTag
public Long addTag(String tag, long timestamp)
- Parameters:
tag
- the tag to addtimestamp
- the tag found timestamp- Returns:
- the tag last timestamp or
null
if the tag was not in inventory
-
addTags
public List<String> addTags(List<String> inventory, long timestamp)
update the current inventory
-
checkInventory
public List<String> checkInventory()
check the current inventory for tags there are no longer found- Returns:
- a list with removed tags
-
getInventory
public List<String> getInventory()
Return the current inventory- Returns:
- the current inventory
-
getKeepTime
public long getKeepTime()
- Returns:
- the keepTime
-
setKeepTime
public void setKeepTime(Long keepTime)
- Parameters:
keepTime
- the keepTime to set
-
removeTag
public Long removeTag(String tagEid)
Remove a tag from this list- Parameters:
tagEid
- tag eid to remove- Returns:
- the last tag timestamp
-
clear
public List<String> clear()
Remove all tags from the inventory- Returns:
List
with removed tags
-
getIdentifier
public String getIdentifier()
- Returns:
- the identifier
-
-