Package swim.store.db

Class SpatialDataModel<S>

  • All Implemented Interfaces:
    Iterable<swim.spatial.SpatialMap.Entry<swim.structure.Value,​S,​swim.structure.Value>>, swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>, swim.db.QTreeDelegate, swim.db.TreeDelegate, swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>, swim.store.DataBinding, swim.store.SpatialDataBinding<S>

    public class SpatialDataModel<S>
    extends Object
    implements swim.store.SpatialDataBinding<S>, swim.db.QTreeDelegate
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface swim.spatial.SpatialMap

        swim.spatial.SpatialMap.Entry<K extends Object,​S extends Object,​V extends Object>, swim.spatial.SpatialMap.SimpleEntry<K extends Object,​S extends Object,​V extends Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected swim.store.SpatialDataContext<S> dataContext  
      protected swim.structure.Value name  
      protected swim.store.StoreBinding storeBinding  
      protected swim.db.QTreeMap<S> tree  
    • Constructor Summary

      Constructors 
      Constructor Description
      SpatialDataModel​(swim.structure.Value name, swim.db.QTreeMap<S> tree)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      void close()  
      boolean containsKey​(Object key)  
      boolean containsKey​(swim.structure.Value key, S shape)  
      boolean containsValue​(Object value)  
      swim.db.Database database()  
      swim.store.SpatialDataContext<S> dataContext()  
      long dataSize()  
      swim.structure.Value get​(Object key)  
      swim.structure.Value get​(swim.structure.Value key, S shape)  
      boolean isEmpty()  
      boolean isResident()  
      swim.store.SpatialDataBinding<S> isResident​(boolean isResident)  
      boolean isTransient()  
      swim.store.SpatialDataBinding<S> isTransient​(boolean isTransient)  
      Iterator<swim.spatial.SpatialMap.Entry<swim.structure.Value,​S,​swim.structure.Value>> iterator()  
      Iterator<swim.spatial.SpatialMap.Entry<swim.structure.Value,​S,​swim.structure.Value>> iterator​(S shape)  
      <K2> swim.api.data.SpatialData<K2,​S,​swim.structure.Value> keyClass​(Class<K2> keyClass)  
      swim.structure.Form<swim.structure.Value> keyForm()  
      <K2> swim.api.data.SpatialData<K2,​S,​swim.structure.Value> keyForm​(swim.structure.Form<K2> keyForm)  
      Iterator<swim.structure.Value> keyIterator()  
      long leafCount()  
      swim.structure.Value move​(swim.structure.Value key, S oldShape, S newShape, swim.structure.Value newValue)  
      swim.structure.Value name()  
      swim.structure.Value put​(swim.structure.Value key, S shape, swim.structure.Value newValue)  
      void qtreeDidMove​(swim.db.QTree newTree, swim.db.QTree oldTree, swim.structure.Value key, long newX, long newY, swim.structure.Value newValue, long oldX, long oldY, swim.structure.Value oldValue)  
      void qtreeDidRemove​(swim.db.QTree newTree, swim.db.QTree oldTree, swim.structure.Value key, long x, long y, swim.structure.Value oldValue)  
      void qtreeDidUpdate​(swim.db.QTree newTree, swim.db.QTree oldTree, swim.structure.Value key, long x, long y, swim.structure.Value newValue, swim.structure.Value oldValue)  
      swim.structure.Value remove​(swim.structure.Value key, S shape)  
      void setDataContext​(swim.store.SpatialDataContext<S> dataContext)  
      void setStoreBinding​(swim.store.StoreBinding storeBinding)  
      swim.math.Z2Form<S> shapeForm()  
      int size()  
      swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value> snapshot()  
      swim.db.Store store()  
      swim.store.StoreBinding storeBinding()  
      swim.db.QTreeMap<S> tree()  
      void treeDidChange​(swim.db.Tree newTree, swim.db.Tree oldTree)  
      void treeDidClear​(swim.db.Tree newTree, swim.db.Tree oldTree)  
      void treeDidCommit​(swim.db.Tree newTree, swim.db.Tree oldTree)  
      void treeDidLoadPage​(swim.db.Page page)  
      swim.structure.Value treeName()  
      <T> T unwrapData​(Class<T> dataClass)  
      <V2> swim.api.data.SpatialData<swim.structure.Value,​S,​V2> valueClass​(Class<V2> valueClass)  
      swim.structure.Form<swim.structure.Value> valueForm()  
      <V2> swim.api.data.SpatialData<swim.structure.Value,​S,​V2> valueForm​(swim.structure.Form<V2> valueForm)  
      Iterator<swim.structure.Value> valueIterator()  
    • Field Detail

      • name

        protected final swim.structure.Value name
      • tree

        protected final swim.db.QTreeMap<S> tree
      • dataContext

        protected swim.store.SpatialDataContext<S> dataContext
      • storeBinding

        protected swim.store.StoreBinding storeBinding
    • Constructor Detail

      • SpatialDataModel

        public SpatialDataModel​(swim.structure.Value name,
                                swim.db.QTreeMap<S> tree)
    • Method Detail

      • dataContext

        public swim.store.SpatialDataContext<S> dataContext()
        Specified by:
        dataContext in interface swim.store.DataBinding
        Specified by:
        dataContext in interface swim.store.SpatialDataBinding<S>
      • setDataContext

        public void setDataContext​(swim.store.SpatialDataContext<S> dataContext)
        Specified by:
        setDataContext in interface swim.store.SpatialDataBinding<S>
      • storeBinding

        public swim.store.StoreBinding storeBinding()
        Specified by:
        storeBinding in interface swim.store.DataBinding
      • setStoreBinding

        public void setStoreBinding​(swim.store.StoreBinding storeBinding)
        Specified by:
        setStoreBinding in interface swim.store.DataBinding
      • unwrapData

        public <T> T unwrapData​(Class<T> dataClass)
        Specified by:
        unwrapData in interface swim.store.DataBinding
      • tree

        public final swim.db.QTreeMap<S> tree()
      • database

        public final swim.db.Database database()
      • store

        public final swim.db.Store store()
      • treeName

        public final swim.structure.Value treeName()
      • name

        public final swim.structure.Value name()
        Specified by:
        name in interface swim.store.DataBinding
        Specified by:
        name in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • keyForm

        public swim.structure.Form<swim.structure.Value> keyForm()
        Specified by:
        keyForm in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • keyForm

        public <K2> swim.api.data.SpatialData<K2,​S,​swim.structure.Value> keyForm​(swim.structure.Form<K2> keyForm)
        Specified by:
        keyForm in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • keyClass

        public <K2> swim.api.data.SpatialData<K2,​S,​swim.structure.Value> keyClass​(Class<K2> keyClass)
        Specified by:
        keyClass in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • dataSize

        public long dataSize()
        Specified by:
        dataSize in interface swim.store.DataBinding
      • leafCount

        public long leafCount()
      • shapeForm

        public final swim.math.Z2Form<S> shapeForm()
        Specified by:
        shapeForm in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • valueForm

        public swim.structure.Form<swim.structure.Value> valueForm()
        Specified by:
        valueForm in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • valueForm

        public <V2> swim.api.data.SpatialData<swim.structure.Value,​S,​V2> valueForm​(swim.structure.Form<V2> valueForm)
        Specified by:
        valueForm in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • valueClass

        public <V2> swim.api.data.SpatialData<swim.structure.Value,​S,​V2> valueClass​(Class<V2> valueClass)
        Specified by:
        valueClass in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • isResident

        public boolean isResident()
        Specified by:
        isResident in interface swim.store.DataBinding
        Specified by:
        isResident in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • isResident

        public swim.store.SpatialDataBinding<S> isResident​(boolean isResident)
        Specified by:
        isResident in interface swim.store.DataBinding
        Specified by:
        isResident in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
        Specified by:
        isResident in interface swim.store.SpatialDataBinding<S>
      • isTransient

        public boolean isTransient()
        Specified by:
        isTransient in interface swim.store.DataBinding
        Specified by:
        isTransient in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • isTransient

        public swim.store.SpatialDataBinding<S> isTransient​(boolean isTransient)
        Specified by:
        isTransient in interface swim.store.DataBinding
        Specified by:
        isTransient in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
        Specified by:
        isTransient in interface swim.store.SpatialDataBinding<S>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • size

        public int size()
        Specified by:
        size in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • containsKey

        public boolean containsKey​(swim.structure.Value key,
                                   S shape)
        Specified by:
        containsKey in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • containsKey

        public boolean containsKey​(Object key)
        Specified by:
        containsKey in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • containsValue

        public boolean containsValue​(Object value)
        Specified by:
        containsValue in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • get

        public swim.structure.Value get​(swim.structure.Value key,
                                        S shape)
        Specified by:
        get in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • get

        public swim.structure.Value get​(Object key)
        Specified by:
        get in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • put

        public swim.structure.Value put​(swim.structure.Value key,
                                        S shape,
                                        swim.structure.Value newValue)
        Specified by:
        put in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • move

        public swim.structure.Value move​(swim.structure.Value key,
                                         S oldShape,
                                         S newShape,
                                         swim.structure.Value newValue)
        Specified by:
        move in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • remove

        public swim.structure.Value remove​(swim.structure.Value key,
                                           S shape)
        Specified by:
        remove in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • clear

        public void clear()
        Specified by:
        clear in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • iterator

        public Iterator<swim.spatial.SpatialMap.Entry<swim.structure.Value,​S,​swim.structure.Value>> iterator​(S shape)
        Specified by:
        iterator in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • iterator

        public Iterator<swim.spatial.SpatialMap.Entry<swim.structure.Value,​S,​swim.structure.Value>> iterator()
        Specified by:
        iterator in interface Iterable<S>
      • keyIterator

        public Iterator<swim.structure.Value> keyIterator()
        Specified by:
        keyIterator in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • valueIterator

        public Iterator<swim.structure.Value> valueIterator()
        Specified by:
        valueIterator in interface swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value>
      • snapshot

        public swim.spatial.SpatialMap<swim.structure.Value,​S,​swim.structure.Value> snapshot()
        Specified by:
        snapshot in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • close

        public void close()
        Specified by:
        close in interface swim.store.DataBinding
        Specified by:
        close in interface swim.api.data.SpatialData<swim.structure.Value,​S,​swim.structure.Value>
      • treeDidLoadPage

        public void treeDidLoadPage​(swim.db.Page page)
        Specified by:
        treeDidLoadPage in interface swim.db.TreeDelegate
      • treeDidChange

        public void treeDidChange​(swim.db.Tree newTree,
                                  swim.db.Tree oldTree)
        Specified by:
        treeDidChange in interface swim.db.TreeDelegate
      • treeDidCommit

        public void treeDidCommit​(swim.db.Tree newTree,
                                  swim.db.Tree oldTree)
        Specified by:
        treeDidCommit in interface swim.db.TreeDelegate
      • treeDidClear

        public void treeDidClear​(swim.db.Tree newTree,
                                 swim.db.Tree oldTree)
        Specified by:
        treeDidClear in interface swim.db.TreeDelegate
      • qtreeDidUpdate

        public void qtreeDidUpdate​(swim.db.QTree newTree,
                                   swim.db.QTree oldTree,
                                   swim.structure.Value key,
                                   long x,
                                   long y,
                                   swim.structure.Value newValue,
                                   swim.structure.Value oldValue)
        Specified by:
        qtreeDidUpdate in interface swim.db.QTreeDelegate
      • qtreeDidMove

        public void qtreeDidMove​(swim.db.QTree newTree,
                                 swim.db.QTree oldTree,
                                 swim.structure.Value key,
                                 long newX,
                                 long newY,
                                 swim.structure.Value newValue,
                                 long oldX,
                                 long oldY,
                                 swim.structure.Value oldValue)
        Specified by:
        qtreeDidMove in interface swim.db.QTreeDelegate
      • qtreeDidRemove

        public void qtreeDidRemove​(swim.db.QTree newTree,
                                   swim.db.QTree oldTree,
                                   swim.structure.Value key,
                                   long x,
                                   long y,
                                   swim.structure.Value oldValue)
        Specified by:
        qtreeDidRemove in interface swim.db.QTreeDelegate