au.com.zip.cs
Interface IDMap

All Known Implementing Classes:
AbstractIDMap, SkipListIDMap

public interface IDMap

A mapping from unique long ids to HasIDs.

Author:
Cameron Simpson <cs@zip.com.au> 24jul2003

Method Summary
 void add(HasID o)
          Store the supplied object in the IDMap.
 HasID byID(long id)
          Return the object stored with the specified id, if present.
 HasID get(int index)
          Return the object at the specified location.
 Iterator getIDIterator()
          Return an Iterator that hands out each id in the map as a Long.
 boolean isComplete()
          Return a flag indicating that this map is complete.
 Iterator iterator()
          Return an Iterator that hands out each object from the IDMap.
 void removeID(long id)
          Remove the object with the specified id.
 void setComplete(boolean c)
          Set the completeness status of this map.
 

Method Detail

isComplete

boolean isComplete()
Return a flag indicating that this map is complete. A complete map has a mapping for every id in the data set it's supporting. FOr some operations it may be more efficient for other data set code to traverse this map when it is complete than to use other methods such as database access. This flag starts false and is controlled entirely at the whim of the other data set code since naturally the IDMap has no idea if it is a complete map or not.

Returns:
the completeness status

setComplete

void setComplete(boolean c)
Set the completeness status of this map.

Parameters:
c - the new status

byID

HasID byID(long id)
Return the object stored with the specified id, if present.

Parameters:
id - the id
Returns:
the object, or null if not present

get

HasID get(int index)
Return the object at the specified location. This may be very inefficient for some implementations of IDMap.

Parameters:
index - the location of the object, counting from 0
Returns:
the object, or null if not found

add

void add(HasID o)
Store the supplied object in the IDMap.

Parameters:
o - the object to store

removeID

void removeID(long id)
Remove the object with the specified id.

Parameters:
id - the id

iterator

Iterator iterator()
Return an Iterator that hands out each object from the IDMap.

Returns:
the Iterator

getIDIterator

Iterator getIDIterator()
Return an Iterator that hands out each id in the map as a Long.

Returns:
the Iterator