Interface SpatialMap<DS extends BoundedShape<?>,T,Q>
- All Known Subinterfaces:
DBTraceDataSettingsOperations,TraceAddressSnapRangePropertyMap<T>,TraceAddressSnapRangePropertyMapOperations<T>,TraceAddressSnapRangePropertyMapSpace<T>
- All Known Implementing Classes:
Abstract2DRStarTree.AsSpatialMap,AbstractConstraintsTreeSpatialMap,AbstractDBTracePropertyMap,AbstractDBTracePropertyMap.DBTraceIntPropertyMap,AbstractDBTracePropertyMap.DBTraceLongPropertyMap,AbstractDBTracePropertyMap.DBTracePropertyMapSpace,AbstractDBTracePropertyMap.DBTraceSaveablePropertyMap,AbstractDBTracePropertyMap.DBTraceStringPropertyMap,AbstractDBTracePropertyMap.DBTraceVoidPropertyMap,AbstractHyperRStarTree.AsSpatialMap,DBTraceAddressSnapRangePropertyMap,DBTraceAddressSnapRangePropertyMapSpace,DBTraceCommentAdapter,DBTraceDataSettingsAdapter,DBTraceDataSettingsAdapter.DBTraceDataSettingsSpace,DBTraceObjectValueRStarTree.DBTraceObjectValueMap,SpatialMap.EmptySpatialMap
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classSpatialMap.EmptySpatialMap<DS extends BoundedShape<?>,T, Q> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()static <DS extends BoundedShape<?>,T, Q>
SpatialMap<DS, T, Q> emptyMap()entries()firstKey()booleanisEmpty()keys()Put an entry into the mapSpatialMap<DS, T, Q> booleanRemove an entry from the mapbooleanRemove an entry from the mapintsize()Get or compute the size of this mapvalues()
-
Field Details
-
EMPTY_MAP
-
-
Method Details
-
emptyMap
-
put
Put an entry into the mapNote that the map may copy, and possibly modify, the given value. The value returned is the value actually stored by the map. This may be useful when the map's values are identical to its records. This allows the creation of a "blank" entry with a given shape. The entry is then populated by the user.
class MyDBDataRecord extends DBTreeDataRecord<MyShape, MyNodeShape, MyDBDataRecord> { @Override protected void setValue(MyDBDataRecord value) { // Do nothing: value ought to be null. Map will create and return "blank" record } protected MyDBDataRecord getValue() { return this; // The record is the value } } MyDBDataRecord rec = map.put(MyShape.create(args), null); rec.setSomething(6); rec.setAnother("My user data");This practice is preferred when the values are not simple, and/or when the shape is a property of the value. In other cases, e.g., when the value is an enum or a
Color, thenDBTreeDataRecord.setRecordValue(Object)andDBTreeDataRecord.getRecordValue()should be implemented as field accessors.- Parameters:
shape- the shape of the entryvalue- the value for the entry- Returns:
- the value as stored in the map
-
remove
Remove an entry from the mapRemoves a single matching entry, if found, from the map. If you have a reference to an entry obtained from this map, use
remove(Entry)instead. Otherwise, this is the preferred method.- Parameters:
shape- the shape of the entry to removevalue- the value of the entry to remove- Returns:
- true if the map was modified
-
remove
Remove an entry from the mapThis method is preferred only when the given entry comes directly from this map. This spares the implementation from having to search for a matching entry. If the entry does not come from this map, it will behave like
remove(BoundedShape, Object).- Parameters:
entry- the entry to remove- Returns:
- true if the map was modified
-
size
int size()Get or compute the size of this mapNote that this may not necessarily be a quick operation, esp., if this map is the result of
reduce(Object). In the worst case, all elements in the reduced map will be visited.- Returns:
- the number of data entries in the map
-
isEmpty
boolean isEmpty() -
entries
Collection<Map.Entry<DS,T>> entries() -
orderedEntries
Collection<Map.Entry<DS,T>> orderedEntries() -
keys
Collection<DS> keys() -
orderedKeys
Collection<DS> orderedKeys() -
values
Collection<T> values() -
orderedValues
Collection<T> orderedValues() -
reduce
-
firstEntry
-
firstKey
DS firstKey() -
firstValue
T firstValue() -
clear
void clear()
-