com.partnersoft.maps.model
Class MemoryFindItemIndex
java.lang.Object
com.partnersoft.maps.model.MemoryFindItemIndex
- All Implemented Interfaces:
- FindItemIndex
public class MemoryFindItemIndex
- extends java.lang.Object
- implements FindItemIndex
A space-optimized mapping of string name to a data ID, used to implement find
items. Names may be non-unique, but must be sorted, and comparisons and
sorting are all done case-insensitively. It is designed to be read-only and
not modifiable, so it can't change size etc.
- Author:
- Paul Reavis Copyright 2005 Partner Software, Inc.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MemoryFindItemIndex
public MemoryFindItemIndex(RoverSet roverSet)
MemoryFindItemIndex
public MemoryFindItemIndex(RoverSet roverSet,
java.lang.String[] names,
int[] ids)
MemoryFindItemIndex
public MemoryFindItemIndex(RoverSet roverSet,
java.util.List nameList,
java.util.List idList)
find
public int find(java.lang.String name)
- Specified by:
find in interface FindItemIndex
findAll
public int[] findAll(java.lang.String name)
- Specified by:
findAll in interface FindItemIndex
setContents
public void setContents(java.lang.String[] names,
int[] ids)
setContents
public void setContents(MemoryFindItemIndex nother)
setContents
public void setContents(java.util.List nameList,
java.util.List idList)
getSize
public int getSize()
- Specified by:
getSize in interface FindItemIndex
getNameAt
public java.lang.String getNameAt(int index)
- Specified by:
getNameAt in interface FindItemIndex
getIDAt
public int getIDAt(int index)
- Specified by:
getIDAt in interface FindItemIndex
indexOf
public int indexOf(java.lang.String name)
- Specified by:
indexOf in interface FindItemIndex
closestIndexTo
public int closestIndexTo(java.lang.String name)
- Specified by:
closestIndexTo in interface FindItemIndex
indexRangeFor
public int[] indexRangeFor(java.lang.String name)
- Description copied from interface:
FindItemIndex
- If the find item has duplicates, you might want to know what the range
is. This returns the first and last entries with the same name. They will
match if there's only one, and they'll both be -1 if there's no match.
- Specified by:
indexRangeFor in interface FindItemIndex
sort
public void sort()
getRoverSet
public RoverSet getRoverSet()
- Specified by:
getRoverSet in interface FindItemIndex
listNames
public java.util.List<java.lang.String> listNames()
- Specified by:
listNames in interface FindItemIndex
listIds
public java.util.List<java.lang.Integer> listIds()
- Specified by:
listIds in interface FindItemIndex
listDataItems
public java.util.List<MapDataItem> listDataItems()
- Specified by:
listDataItems in interface FindItemIndex