Class Entry

    • Field Summary

      Fields 
      Modifier and Type Field Description
      ClusKernel data
      The actual entry data.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Entry​(int numberDimensions)
      Constructor for the entry.
        Entry​(int numberDimensions, ClusKernel cluster, long currentTime)
      Constructuctor that creates an Entry with an empty buffer and the data given by the Kernel.
      protected Entry​(int numberDimensions, ClusKernel cluster, long currentTime, Entry parentEntry, Node containerNode)
      extended constructor with containerNode and parentEntry
      protected Entry​(int numberDimensions, Node node, long currentTime, Entry parentEntry, Node containerNode)
      Constructor that creates an Entry that points to the given node.
      protected Entry​(Entry other)
      Copy constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(Entry other)
      Add the data cluster of another entry to the data cluster of this entry.
      protected void aggregateCluster​(ClusKernel otherData, long currentTime, double negLambda)
      Aggregate the given Kernel to the data cluster of this entry.
      protected void aggregateEntry​(Entry other, long currentTime, double negLambda)
      Aggregate the data in the Kernel of the other Entry.
      protected void aggregateToBuffer​(ClusKernel pointToInsert, long currentTime, double negLambda)
      Aggregate the given Kernel to the buffer cluster of this entry.
      protected double calcDistance​(ClusKernel cluster)
      Calculates the distance to the data in this entry.
      double calcDistance​(Entry other)
      Calculates the distance to the data in this entry of the data in the given entry.
      protected void clear()
      Clear the Entry.
      protected ClusKernel emptyBuffer​(long currentTime, double negLambda)
      Clear the buffer in this entry and return a copy.
      protected ClusKernel getBuffer()
      Getter for the buffer.
      Node getChild()
      Return the reference to the child of this Entry to navigate in the tree.
      protected ClusKernel getData()
      Getter for the data.
      Node getNode()  
      Entry getParentEntry()  
      long getTimestamp()
      Return the current timestamp.
      protected void initializeEntry​(Entry other, long currentTime)
      When this entry is empty, give it it's first values.
      protected boolean isEmpty()
      Check if this Entry is empty or not.
      protected boolean isIrrelevant​(double threshold)
      Returns true if this entry is irrelevant with respecto the given threshold.
      protected void makeOlder​(long currentTime, double negLambda)
      Ages this entrie's data AND buffer according to the given time and aging constant.
      protected void mergeWith​(Entry other)
      Merge this entry witht the given Entry.
      protected void overwriteOldEntry​(Entry newEntry)
      Overwrites the LS, SS and weightedN in the data cluster of this Entry to the values of the data cluster in the given Entry, but adds N and classCount of the cluster in the given Entry to the data cluster in this one.
      protected void recalculateData()
      This functions reads every entry in the child node and calculates the corresponding data Kernel.
      void setChild​(Node child)
      Setter for the child in this entry.
      void setNode​(Node node)  
      void setParentEntry​(Entry parent)  
      protected void shallowClear()
      Clear the data and the buffer Custer in this entry.
    • Field Detail

      • data

        public ClusKernel data
        The actual entry data.
    • Constructor Detail

      • Entry

        public Entry​(int numberDimensions)
        Constructor for the entry. To be used when we want to create an empty entry. Notice that the timestamp will be set to zero, since there is no reason to know when an empty entry was generated.
        Parameters:
        numberDimensions - The dimensionality of the data point in tree where this entry is used.
      • Entry

        protected Entry​(int numberDimensions,
                        Node node,
                        long currentTime,
                        Entry parentEntry,
                        Node containerNode)
        Constructor that creates an Entry that points to the given node. The values of data will be calculated for this.
        Parameters:
        numberDimensions - The dimensionality of the node.
        node - The node to which the new Entry should point.
        currentTime - The timestamp for the moment where this Entry was was generated.
        See Also:
        Node, data
      • Entry

        public Entry​(int numberDimensions,
                     ClusKernel cluster,
                     long currentTime)
        Constructuctor that creates an Entry with an empty buffer and the data given by the Kernel.
        Parameters:
        numberDimensions - The dimensionality of the information in the cluster.
        cluster - The cluster from which the information is to be extracted.
        currentTime - The timestamp for the moment where this Entry was was generated.
        See Also:
        ClusKernel, data
      • Entry

        protected Entry​(int numberDimensions,
                        ClusKernel cluster,
                        long currentTime,
                        Entry parentEntry,
                        Node containerNode)
        extended constructor with containerNode and parentEntry
        Parameters:
        numberDimensions -
        cluster -
        currentTime -
        parentEntry -
        containerNode -
      • Entry

        protected Entry​(Entry other)
        Copy constructor. Everythin is copied, including the child.
        Parameters:
        other -
    • Method Detail

      • getNode

        public Node getNode()
      • setNode

        public void setNode​(Node node)
      • clear

        protected void clear()
        Clear the Entry. All points in the buffer and in the data cluster are lost, the connection to the child is lost and the timestamp is set to the default value.
      • shallowClear

        protected void shallowClear()
        Clear the data and the buffer Custer in this entry. This function does not clear the child of this Entry.
        See Also:
        data, buffer, ClusKernel
      • calcDistance

        protected double calcDistance​(ClusKernel cluster)
        Calculates the distance to the data in this entry.
        Parameters:
        cluster - The Kernel cluster to which the distance is to be calculated.
        Returns:
        The distance to the data Kernel in this Entry
        See Also:
        ClusKernel, data
      • calcDistance

        public double calcDistance​(Entry other)
        Calculates the distance to the data in this entry of the data in the given entry.
        Parameters:
        other - The Entry to which the distance is to be calculated.
        Returns:
        The distance to the data Kernel in this Entry of the data Kernel in the other Entry.
        See Also:
        ClusKernel, data
      • initializeEntry

        protected void initializeEntry​(Entry other,
                                       long currentTime)
        When this entry is empty, give it it's first values. It makes sense to have this operation separated from the aggregation, because the aggregation first weights the values in data and Kernel, which makes no sense in an empty entry.
        Parameters:
        other - The entry with the information to be used to initialize this entry.
        currentTime - The time at which this is happening.
      • add

        public void add​(Entry other)
        Add the data cluster of another entry to the data cluster of this entry. By using this function the timestamp does not get updated, nor does this entry get older.
        Parameters:
        other - The entry of which the data cluster should be added to the local data cluster.
        See Also:
        data, ClusKernel.add(ClusKernel)
      • aggregateEntry

        protected void aggregateEntry​(Entry other,
                                      long currentTime,
                                      double negLambda)
        Aggregate the data in the Kernel of the other Entry.
        Parameters:
        other - The Entry to be aggregated.
        See Also:
        data, ClusKernel
      • aggregateCluster

        protected void aggregateCluster​(ClusKernel otherData,
                                        long currentTime,
                                        double negLambda)
        Aggregate the given Kernel to the data cluster of this entry.
        Parameters:
        otherData - The Entry to be aggregated.
        See Also:
        data, ClusKernel
      • aggregateToBuffer

        protected void aggregateToBuffer​(ClusKernel pointToInsert,
                                         long currentTime,
                                         double negLambda)
        Aggregate the given Kernel to the buffer cluster of this entry.
        Parameters:
        pointToInsert - The cluster to aggregate to the buffer.
        currentTime - The time at which the aggregation occurs.
        negLambda - A parameter needed to weight the current state of the buffer.
      • mergeWith

        protected void mergeWith​(Entry other)
        Merge this entry witht the given Entry. This adds the data cluster of the given Entry to the data cluster of this entry and sets the timestamp to the newest one of the the two entries.
        Parameters:
        other - The entry from which the data cluster is added.
        See Also:
        ClusKernel.add(ClusKernel)
      • getBuffer

        protected ClusKernel getBuffer()
        Getter for the buffer. It is the real object, that means side effects are possible!
        Returns:
        A reference to the buffer in this entry.
      • getChild

        public Node getChild()
        Return the reference to the child of this Entry to navigate in the tree.
        Returns:
        A reference to the child of this Entry
      • getData

        protected ClusKernel getData()
        Getter for the data. It is the real object, that means side effects are possible!
        Returns:
        A reference to the data Kernel in this entry.
        See Also:
        ClusKernel
      • getParentEntry

        public Entry getParentEntry()
      • setParentEntry

        public void setParentEntry​(Entry parent)
      • setChild

        public void setChild​(Node child)
        Setter for the child in this entry. Use to build the tree.
        Parameters:
        child - The Node that should be a child of this Entry
        See Also:
        Node
      • getTimestamp

        public long getTimestamp()
        Return the current timestamp.
        Returns:
        The current timestamp.
      • emptyBuffer

        protected ClusKernel emptyBuffer​(long currentTime,
                                         double negLambda)
        Clear the buffer in this entry and return a copy. No side effects are possible (given that the copy constructor of Kernel makes a deep copy).
        Returns:
        A copy of the buffer.
      • isEmpty

        protected boolean isEmpty()
        Check if this Entry is empty or not. An Entry is empty if the data Kernel is empty, since then the buffer has to be empty.
        Returns:
        true if the data cluster has no data points, false otherwise.
      • overwriteOldEntry

        protected void overwriteOldEntry​(Entry newEntry)
        Overwrites the LS, SS and weightedN in the data cluster of this Entry to the values of the data cluster in the given Entry, but adds N and classCount of the cluster in the given Entry to the data cluster in this one. This function is useful when the weight of an entry becomes to small, and we want to forget the information of the old points.
        Parameters:
        newEntry - The cluster that should overwrite the information.
      • recalculateData

        protected void recalculateData()
        This functions reads every entry in the child node and calculates the corresponding data Kernel. Timestamps are not changed.
        See Also:
        data, ClusKernel
      • isIrrelevant

        protected boolean isIrrelevant​(double threshold)
        Returns true if this entry is irrelevant with respecto the given threshold. This is done by comparing the weighted N of this Entry to the threshold, if it is smaller, than the entry is deemed to be irrelevant.
        Parameters:
        threshold - The threshold under which entries at leafs can be erased.
        Returns:
        True if this entry is deemed irrelevant, false otherwise.
      • makeOlder

        protected void makeOlder​(long currentTime,
                                 double negLambda)
        Ages this entrie's data AND buffer according to the given time and aging constant.
        Parameters:
        currentTime - the current time
        negLambda - the aging constant