ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/brains/SkipList.cpp
Revision: 1492
Committed: Fri Sep 24 16:27:58 2004 UTC (19 years, 9 months ago) by tim
File size: 840 byte(s)
Log Message:
change the #include in source files

File Contents

# User Rev Content
1 gezelter 1490 #include <iostream>
2     #include <stdlib.h>
3    
4 tim 1492 #include "brains/SkipList.hpp"
5 gezelter 1490
6     SkipList* SkipList::_instance = 0;
7    
8     SkipList* SkipList::Instance() {
9     if (_instance == 0) {
10     _instance = new SkipList;
11     }
12     return _instance;
13     }
14    
15     SkipList::SkipList(){
16     }
17    
18     SkipList::~SkipList() {
19     delete _instance;
20     }
21    
22     void SkipList::addAtom(int i) {
23    
24     if (!hasAtom(i))
25     skipSet.insert(i);
26    
27     }
28    
29    
30     void SkipList::printMe( void ){
31    
32     set<int>::iterator i;
33     int index;
34    
35     index = 0;
36     for(i = skipSet.begin(); i != skipSet.end(); ++i) {
37    
38     std::cerr << "SkipList[" << index << "] i: " << *i << "\n";
39     index++;
40     }
41     }
42    
43     int SkipList::hasAtom(int i) {
44    
45     set<int>::iterator position;
46    
47     position = skipSet.find(i);
48    
49     if (position != skipSet.end())
50     return 1;
51     else
52     return 0;
53    
54     }
55    
56     int SkipList::getSize() {
57     return skipSet.size();
58     }