Class SequentialDatabase

  • All Implemented Interfaces:
    java.io.Serializable, Database, RevisionHandler

    public class SequentialDatabase
    extends java.lang.Object
    implements Database, java.io.Serializable, RevisionHandler

    SequentialDatabase.java
    Authors: Rainer Holzmann, Zhanna Melnikova-Albrecht, Matthias Schubert
    Date: Aug 20, 2004
    Time: 1:23:38 PM
    $ Revision 1.4 $

    Version:
    $Revision: 1.4 $
    Author:
    Matthias Schubert (schubert@dbs.ifi.lmu.de), Zhanna Melnikova-Albrecht (melnikov@cip.ifi.lmu.de), Rainer Holzmann (holzmann@cip.ifi.lmu.de)
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SequentialDatabase​(Instances instances)
      Constructs a new sequential database and holds the original instances
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(DataObject dataObject_Query)
      Tests if the database contains the dataObject_Query
      java.util.List coreDistance​(int minPoints, double epsilon, DataObject dataObject)
      Calculates the coreDistance for the specified DataObject.
      java.util.Iterator dataObjectIterator()
      Returns an iterator over all the dataObjects in the database
      java.util.List epsilonRangeQuery​(double epsilon, DataObject queryDataObject)
      Performs an epsilon range query for this dataObject
      double[] getAttributeMaxValues()
      Returns the array of maximum-values for each attribute
      double[] getAttributeMinValues()
      Returns the array of minimum-values for each attribute
      DataObject getDataObject​(java.lang.String key)
      Select a dataObject from the database
      Instances getInstances()
      Returns the original instances delivered from WEKA
      java.lang.String getRevision()
      Returns the revision string.
      void insert​(DataObject dataObject)
      Inserts a new dataObject into the database
      java.util.List k_nextNeighbourQuery​(int k, double epsilon, DataObject dataObject)
      Emits the k next-neighbours and performs an epsilon-range-query at the parallel.
      java.util.Iterator keyIterator()
      Returns an iterator over all the keys
      void setMinMaxValues()
      Sets the minimum and maximum values for each attribute in different arrays by walking through every DataObject of the database
      int size()
      Returns the size of the database (the number of dataObjects in the database)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SequentialDatabase

        public SequentialDatabase​(Instances instances)
        Constructs a new sequential database and holds the original instances
        Parameters:
        instances -
    • Method Detail

      • getDataObject

        public DataObject getDataObject​(java.lang.String key)
        Select a dataObject from the database
        Specified by:
        getDataObject in interface Database
        Parameters:
        key - The key that is associated with the dataObject
        Returns:
        dataObject
      • setMinMaxValues

        public void setMinMaxValues()
        Sets the minimum and maximum values for each attribute in different arrays by walking through every DataObject of the database
        Specified by:
        setMinMaxValues in interface Database
      • getAttributeMinValues

        public double[] getAttributeMinValues()
        Returns the array of minimum-values for each attribute
        Specified by:
        getAttributeMinValues in interface Database
        Returns:
        attributeMinValues
      • getAttributeMaxValues

        public double[] getAttributeMaxValues()
        Returns the array of maximum-values for each attribute
        Specified by:
        getAttributeMaxValues in interface Database
        Returns:
        attributeMaxValues
      • epsilonRangeQuery

        public java.util.List epsilonRangeQuery​(double epsilon,
                                                DataObject queryDataObject)
        Performs an epsilon range query for this dataObject
        Specified by:
        epsilonRangeQuery in interface Database
        Parameters:
        epsilon - Specifies the range for the query
        queryDataObject - The dataObject that is used as query-object for epsilon range query
        Returns:
        List with all the DataObjects that are within the specified range
      • k_nextNeighbourQuery

        public java.util.List k_nextNeighbourQuery​(int k,
                                                   double epsilon,
                                                   DataObject dataObject)
        Emits the k next-neighbours and performs an epsilon-range-query at the parallel. The returned list contains two elements: At index=0 --> list with all k next-neighbours; At index=1 --> list with all dataObjects within epsilon;
        Specified by:
        k_nextNeighbourQuery in interface Database
        Parameters:
        k - number of next neighbours
        epsilon - Specifies the range for the query
        dataObject - the start object
        Returns:
        list with the k-next neighbours (PriorityQueueElements) and a list with candidates from the epsilon-range-query (EpsilonRange_ListElements)
      • coreDistance

        public java.util.List coreDistance​(int minPoints,
                                           double epsilon,
                                           DataObject dataObject)
        Calculates the coreDistance for the specified DataObject. The returned list contains three elements: At index=0 --> list with all k next-neighbours; At index=1 --> list with all dataObjects within epsilon; At index=2 --> coreDistance as Double-value
        Specified by:
        coreDistance in interface Database
        Parameters:
        minPoints - minPoints-many neighbours within epsilon must be found to have a non-undefined coreDistance
        epsilon - Specifies the range for the query
        dataObject - Calculate coreDistance for this dataObject
        Returns:
        list with the k-next neighbours (PriorityQueueElements) and a list with candidates from the epsilon-range-query (EpsilonRange_ListElements) and the double-value for the calculated coreDistance
      • size

        public int size()
        Returns the size of the database (the number of dataObjects in the database)
        Specified by:
        size in interface Database
        Returns:
        size
      • keyIterator

        public java.util.Iterator keyIterator()
        Returns an iterator over all the keys
        Specified by:
        keyIterator in interface Database
        Returns:
        iterator
      • dataObjectIterator

        public java.util.Iterator dataObjectIterator()
        Returns an iterator over all the dataObjects in the database
        Specified by:
        dataObjectIterator in interface Database
        Returns:
        iterator
      • contains

        public boolean contains​(DataObject dataObject_Query)
        Tests if the database contains the dataObject_Query
        Specified by:
        contains in interface Database
        Parameters:
        dataObject_Query - The query-object
        Returns:
        true if the database contains dataObject_Query, else false
      • insert

        public void insert​(DataObject dataObject)
        Inserts a new dataObject into the database
        Specified by:
        insert in interface Database
        Parameters:
        dataObject -
      • getInstances

        public Instances getInstances()
        Returns the original instances delivered from WEKA
        Specified by:
        getInstances in interface Database
        Returns:
        instances
      • getRevision

        public java.lang.String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface RevisionHandler
        Returns:
        the revision