ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Tree-M/MT/MTnode.h
Revision: 1.1
Committed: Sun May 6 00:45:52 2001 UTC (23 years, 1 month ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 /*********************************************************************
2     * *
3     * Copyright (c) 1997,1998, 1999 *
4     * Multimedia DB Group and DEIS - CSITE-CNR, *
5     * University of Bologna, Bologna, ITALY. *
6     * *
7     * All Rights Reserved. *
8     * *
9     * Permission to use, copy, and distribute this software and its *
10     * documentation for NON-COMMERCIAL purposes and without fee is *
11     * hereby granted provided that this copyright notice appears in *
12     * all copies. *
13     * *
14     * THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE *
15     * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING *
16     * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, *
17     * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR *
18     * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A *
19     * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS *
20     * DERIVATIVES. *
21     * *
22     *********************************************************************/
23    
24     #ifndef MTNODE_H
25     #define MTNODE_H
26    
27     #include "MTentry.h"
28    
29     class MTquery;
30    
31     class MTnode : public GiSTnode {
32     // long wasted_space[100]; // only for debug purposes
33     public:
34     // constructors, destructors, etc.
35     MTnode(): GiSTnode(), obj(NULL) { };
36    
37     MTnode(const MTnode& node): GiSTnode(node), obj(node.obj) { };
38    
39     GiSTobjid IsA() const { return MTNODE_CLASS; }
40    
41     GiSTobject *Copy() const { return new MTnode(*this); }
42    
43     GiSTobject *NCopy(); // copy the node invalidating its entries (useful in Split)
44    
45     void Print(ostream& os) const;
46    
47     // search methods
48     GiSTpage SearchMinPenalty(const GiSTentry& entry) const; // overload of virtual method
49     GiSTlist<MTentry *> RangeSearch(const MTquery& query); // range search optimized for distance computations
50    
51     // insertion and deletion
52     void InsertBefore(const GiSTentry& entry, int index); // overload of virtual method in order to insert the entry in the right place
53    
54     // two of the basic GiST methods
55     GiSTnode *PickSplit();
56     GiSTentry* Union() const;
57    
58     // support functions for methods above
59     MTnode *PromotePart(); // object promotion
60     MTnode *PromoteVote(); // object confirmed promotion
61     int *PickCandidates(); // pick a sample of children objects
62     void Split(MTnode *node, int *leftvec, int *rightvec, int *leftdeletes, int *rightdeletes); // perform the split between the parents
63    
64     // used (in split and) in deletion
65     int IsUnderFull(const GiSTstore &store) const;
66    
67     // required support methods
68     GiSTentry *CreateEntry() const { return new MTentry; }
69     int FixedLength() const { return sizeofEntry(); }
70    
71     void InvalidateEntry(BOOL isNew); // invalidate the distance from its parent
72     void InvalidateEntries(); // invalidate the distance of its children
73     void Order(); // order the children with respect to the distance from their parent
74     void mMRadius(MTentry *e) const; // compute the min & MAX radii for this node storing them in e
75     MTentry *Entry() const; // retrieve the entry representing this node
76     double distance(int i) const; // useful to avoid computation of known distances
77    
78     Object *obj; // object copied from the node's entry, useful for Union()
79     };
80    
81     #endif