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

public interface SpatialMap<DS extends BoundedShape<?>,T,Q>
  • Field Details

    • EMPTY_MAP

      static final SpatialMap<?,?,?> EMPTY_MAP
  • Method Details

    • emptyMap

      static <DS extends BoundedShape<?>, T, Q> SpatialMap<DS,T,Q> emptyMap()
    • put

      T put(DS shape, T value)
      Put an entry into the map

      Note 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> {
       	&#64;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, then DBTreeDataRecord.setRecordValue(Object) and DBTreeDataRecord.getRecordValue() should be implemented as field accessors.

      Parameters:
      shape - the shape of the entry
      value - the value for the entry
      Returns:
      the value as stored in the map
    • remove

      boolean remove(DS shape, T value)
      Remove an entry from the map

      Removes 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 remove
      value - the value of the entry to remove
      Returns:
      true if the map was modified
    • remove

      boolean remove(Map.Entry<DS,T> entry)
      Remove an entry from the map

      This 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 map

      Note 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

      SpatialMap<DS,T,Q> reduce(Q query)
    • firstEntry

      Map.Entry<DS,T> firstEntry()
    • firstKey

      DS firstKey()
    • firstValue

      T firstValue()
    • clear

      void clear()