[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kstars/kstars/htmesh
From:       Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date:       2011-02-20 18:03:06
Message-ID: 20110220180306.1DCADAC8CA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1221835 by khudyakov:

Remove dead code in SkipList

 M  +1 -91     SkipList.cpp  
 M  +0 -22     SkipList.h  


--- trunk/KDE/kdeedu/kstars/kstars/htmesh/SkipList.cpp #1221834:1221835
@@ -10,7 +10,7 @@
 */
 
 #include <iostream> // cout
-#include <iomanip> // setw()
+#include <iomanip> // setw
 #include <stdlib.h> // rand(), drand48()
 
 
@@ -156,29 +156,7 @@
     return((Key) KEY_MAX);
 }
 
-Value SkipList::searchAlt(const Key searchKey)
-{
-  int i;
-  SkipListElement* element;
-  SkipListElement* nextElement;
 
-  element = myHeader;
-  for(i=myHeader->getLevel(); i>=0; i--) {
-    nextElement = element->getElement(i);
-    while( (nextElement != NIL) && (nextElement->getKey() < searchKey) ) {
-      element=nextElement;
-      nextElement = element->getElement(i);
-    }
-  }
-
-  element=element->getElement(0); // key is < searchKey
-
-  // if key exists return value else ERROR
-  if( (element != NIL) && (element->getKey() == searchKey) )
-    return(element->getValue());
-  else
-    return(SKIPLIST_NOT_FOUND);
-}
 Key SkipList::findMIN(const Key searchKey) const
   // smallest greater than searchKey.. almost completely, but not
   // quite entirely unlike a search ...
@@ -208,57 +186,6 @@
     return((Key) KEY_MAX);
 }
 
-Value SkipList::search(const Key searchKey, const int iterator_flag)
-{
-  int i;
-  SkipListElement* element;
-  SkipListElement* nextElement;
-
-  element = myHeader;
-  for(i=myHeader->getLevel(); i>=0; i--) {
-    nextElement = element->getElement(i);
-    while( (nextElement != NIL) && (nextElement->getKey() < searchKey) ) {
-      element=nextElement;
-      nextElement = element->getElement(i);
-    }
-  }
-
-  element=element->getElement(0); // key is < searchKey
-
-  // if key exists return value else ERROR
-  if( (element != NIL) && (element->getKey() == searchKey) ) {
-    if (iterator_flag > 0){
-      iter = element;
-    }
-    return(element->getValue());
-  }
-  else
-    return(SKIPLIST_NOT_FOUND);
-}
-Value SkipList::search(const Key searchKey)
-{
-  int i;
-  SkipListElement* element;
-  SkipListElement* nextElement;
-
-  element = myHeader;
-  for(i=myHeader->getLevel(); i>=0; i--) {
-    nextElement = element->getElement(i);
-    while( (nextElement != NIL) && (nextElement->getKey() < searchKey) ) {
-      element=nextElement;
-      nextElement = element->getElement(i);
-    }
-  }
-
-  element=element->getElement(0); // key is < searchKey
-
-  // if key exists return value else ERROR
-  if( (element != NIL) && (element->getKey() == searchKey) )
-    return(element->getValue());
-  else
-    return(SKIPLIST_NOT_FOUND);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 void SkipList::freeRange(const Key loKey, const Key hiKey)
 {
@@ -335,23 +262,6 @@
   }
 }
 
-////////////////////////////////////////////////////////////////////////////////
-void SkipList::freeAll()
-{
-  /* Very similar to free, but frees all */
-
-  SkipListElement* element;
-  SkipListElement* nextElement;
-
-  element = myHeader;
-  element=element->getElement(0);
-  while( (element != NIL)  ) {
-    nextElement = element->getElement(0);
-    free(element->getKey());
-    element = nextElement;
-  }
-}
-
 //// STATISTICS on skiplist
 void SkipList::stat()
 {
--- trunk/KDE/kdeedu/kstars/kstars/htmesh/SkipList.h #1221834:1221835
@@ -21,12 +21,6 @@
 
     /// insert new element
     void insert(const Key searchKey, const Value value);
-    /// search element with key
-    Value searchAlt(const Key searchKey); 
-    /// search element with key
-    Value search(const Key searchKey, const int iterator_flag); 
-    /// search element with key
-    Value search(const Key searchKey); 
     /// search element with key NGT searchKey
     Key findMAX(const Key searchKey) const; 
     /// search element with key NLT searchKey
@@ -51,28 +45,12 @@
             return (Value) -1;
     }
 
-    Key getNthKey(const int n){
-        int n_now = n-1;
-        iter = myHeader->getElement(0);
-        while(n_now > 0){
-            if (iter == NIL) 
-                break;
-            iter = iter->getElement(0);
-            n_now--;
-        }
-        return getkey();
-    }
-
     /// free element with key
     void free(const Key searchKey); 
     void freeRange(const Key loKey, const Key hiKey);
-    void freeAll();
 
     /// statistics;
     void stat(); 
-    long getLength() {
-        return myLength;
-    }
 
 private:
     float myProbability;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic