Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.alien.enterpriseRFID.tags
Class TagTable

    java.lang.Object
      java.util.Dictionary
          java.util.Hashtable
              com.alien.enterpriseRFID.tags.TagTable

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Map, java.io.Serializable

public class TagTable
extends java.util.Hashtable

TagTable stores tags as they appear and removes out of date tags. It a provides host-level implementation of persistence time, similar to what the reader does with its taglist. Tags that are in a TagTable and haven't been seen for more that the TagTable's persistence time can be removed from the TagTable.

You retrieve the list of tags in a TagTable through its `getTagList()` method, which returns an array of `Tag`s.

Version:
  1.2 Feb 2004
Author:
  David Krull
See Also:
  Serialized Form

Field Summary
`static int` | `FOREVER` Setting persistTime to FOREVER means the tags in this TagTable never become inactive.

Constructor Summary
`TagTable()` Constructs an empty TagTable, combining tag/antenna data.
`TagTable(boolean antennaCombine)` Constructs an empty TagTable.

Method Summary
`boolean` | `addTag(Tag tag)` Adds a Tag to this TagTable.
`void` | `clearTagList()` Clears all of the tags from this TagTable.
`int` | `getPersistTime()` Returns this TagTable's persistence time.
`Tag[]` | `getTagList()` Returns the list of tags in this TagTable, as an array of Tag objects.
`TagTableListener` | `getTagTableListener()` Returns the `TagTableListener` that has been registered with this TagTable to receive notifications when the tag list changes.
`boolean` | `removeOldTags()` Removes Tags from this TagTable whose TimeToLive has reached zero.
`boolean` | `removeTag(Tag tag)` Removes a Tag from this TagTable.
`void` | `setPersistTime(int persistTime)` Specifies the persistence time for tags in this TagTable.
`void` | `setTagTableListener(TagTableListener tagTableListener)` Registers a `TagTableListener` with this TagTable to be notified when the tag list changes.

Methods inherited from class java.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### FOREVER

    public static final int FOREVER

  Setting persistTime to FOREVER means the tags in this TagTable never become inactive.

  See Also:
    Constant Field Values

Constructor Detail

### TagTable

    public TagTable(boolean antennaCombine)

  Constructs an empty TagTable. The `antennaCombine` flag determines if the same tagID observed on different antennas should be combined into one entry (adding the readCounts).

  The default behavior (using the constructor without arguments) is to combine this antenna data.

### TagTable

    public TagTable()

  Constructs an empty TagTable, combining tag/antenna data. If the same tagID is observed on different antennas, it is combined into one entry (adding the readCounts). In order to keep these ID/antenna entries separate, use the alternate constructor, `TagTable(boolean)`, which gives control over this feature.

Method Detail

### getPersistTime

    public int getPersistTime()

  Returns this TagTable's persistence time. This is completely independent of the reader's PersistTime attribute. Inactive tags (those that haven't been read for an amount of time equal to the persistence time) can be removed from the TagTable with the `removeOldTags()` method.

  Returns:
    the persistence time for tags in this TagTable
  See Also:
    `setPersistTime(int)`

### setPersistTime

    public void setPersistTime(int persistTime)

  Specifies the persistence time for tags in this TagTable. This is completely independent of the reader's PersistTime attribute. Inactive tags (those that haven't been read for an amount of time equal to the persistence time) can be removed from the TagTable with the `removeOldTags()` method.

  Parameters:
    `persistTime` - the persistence time for tags in this TagTable
  See Also:
    `getPersistTime()`

### clearTagList

    public void clearTagList()

  Clears all of the tags from this TagTable.

### addTag

    public boolean addTag(Tag tag)

  Adds a Tag to this TagTable. If the Tag already exists in the TagTable, then its renew times (RenewTime and HostRenewTime) are updated, as well as the RenewCount and Antenna. Any registered `TagTableListener` is also notified.

  This method returns `true` if the added Tag is new, and `false` if it is an existing tag being renewed.

  Parameters:
    `tag` - the Tag to be added to this TagTable
  Returns:
    true if new tag, false if renewed

### removeTag

    public boolean removeTag(Tag tag)

  Removes a Tag from this TagTable. Returns `false` if the Tag is null or doesn't exist in this TagTable, and `true` otherwise.

  Parameters:
    `tag` - the Tag to remove from this TagTable
  Returns:
    boolean true if tag removed, false if not

### removeOldTags

    public boolean removeOldTags()

  Removes Tags from this TagTable whose TimeToLive has reached zero. The TimeToLive is calculated based on the current time, the time since the tag was last seen, and the persistence time. A tagRemoved message will be sent to a registered TagTableListener when tags are removed from the tag list.

  This method returns `true` if tags were removed from this TagTable, and `false` otherwise.

  Returns:
    true if tags removed, false if not

### getTagList

    public Tag[] getTagList()

  Returns the list of tags in this TagTable, as an array of Tag objects. If the TagTable is empty, the returned array will be null.

  Returns:
    this TagTable's tag list as an array of Tags

### getTagTableListener

    public TagTableListener getTagTableListener()

  Returns the `TagTableListener` that has been registered with this TagTable to receive notifications when the tag list changes.

  Returns:
    the TagTableListener registered with this TagTable
  See Also:
    `setTagTableListener(TagTableListener)`

### setTagTableListener

    public void setTagTableListener(TagTableListener tagTableListener)

  Registers a `TagTableListener` with this TagTable to be notified when the tag list changes.

  Parameters:
    `tagTableListener` - the TagTableListener to be registered by this TagTable
  See Also:
    `getTagTableListener()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD