kiwi.util
Class TaggedObject

java.lang.Object
  |
  +--kiwi.util.TaggedObject

public class TaggedObject
extends Object

An object-id or object-tag pair. Sometimes it is useful to assign a tag or numeric ID to an object for purposes of identification. Most commonly the identifier is a unique integer, but in some circumstances it is more appropriate to use another object as an identifier. This class allows an object to be associated with either an integer or an arbitrary object.

Version:
1.0 (11/98)
Author:
Mark Lindner, PING Software Group

Constructor Summary
TaggedObject(Object obj, int id)
          Construct a new TaggedObject for the given user object and numerical ID.
TaggedObject(Object obj, Object tag)
          Construct a new TaggedObject for the given user object and identifier object.
 
Method Summary
 int getID()
          Get the numerical ID.
 Object getObject()
          Get the user object.
 Object getTag()
          Get the identifier object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaggedObject

public TaggedObject(Object obj,
                    Object tag)
Construct a new TaggedObject for the given user object and identifier object.
Parameters:
obj - The user object.
tag - The identifier object.

TaggedObject

public TaggedObject(Object obj,
                    int id)
Construct a new TaggedObject for the given user object and numerical ID.
Parameters:
obj - The user object.
id - The numerical ID.
Method Detail

getObject

public final Object getObject()
Get the user object.
Returns:
The user object.

getID

public final int getID()
Get the numerical ID.
Returns:
The numerical ID, or -1 if there is no numerical ID for this object.

getTag

public final Object getTag()
Get the identifier object.
Returns:
The identifier object, or null if there is no identifier object for this object.