Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

TreeNode.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (c) 2003, Cornell University
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009     - Redistributions of source code must retain the above copyright notice,
00010         this list of conditions and the following disclaimer.
00011     - Redistributions in binary form must reproduce the above copyright
00012         notice, this list of conditions and the following disclaimer in the
00013         documentation and/or other materials provided with the distribution.
00014     - Neither the name of Cornell University nor the names of its
00015         contributors may be used to endorse or promote products derived from
00016         this software without specific prior written permission.
00017 
00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00022 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
00028 THE POSSIBILITY OF SUCH DAMAGE.
00029 
00030 */
00031 
00032 
00033 /////////////////////////////////////////////////////////////////////
00034 ///
00035 /// TreeNode.h
00036 ///
00037 /// A class for representing nodes in the
00038 /// search tree
00039 ///
00040 /////////////////////////////////////////////////////////////////////
00041 
00042 #ifndef TREENODE_H
00043 #define TREENODE_H
00044 
00045 #include "Bitmap.h"
00046 #include "BaseBitmap.h"
00047 
00048 
00049 /////////////////////////////////////////////////////////////////////
00050 /// @ingroup AlgorithmicComponents
00051 /// Node structure for each node of the search tree
00052 /////////////////////////////////////////////////////////////////////
00053 class TreeNode {
00054 public:
00055 
00056     // Constructors
00057     TreeNode():
00058             Name(NULL),
00059             Trans(NULL),
00060             Depth(0),            
00061             tBegin(-1),
00062             tEnd(0),
00063             Prefix(0)
00064         {}
00065         
00066     TreeNode(
00067         BaseBitmap *NAME,
00068         Bitmap *TRANS,
00069         int DEPTH,
00070         int COMP_ID,
00071         int PREFIX,
00072         int TBEGIN,
00073         int TEND):
00074             Name(NAME),
00075             Trans(TRANS),
00076             Depth(DEPTH),
00077             compID(COMP_ID),
00078             tBegin(TBEGIN),
00079             tEnd(TEND),
00080             Prefix(PREFIX)
00081         {}
00082 
00083     void setTreeNode(
00084         BaseBitmap *NAME,
00085         Bitmap *TRANS,
00086         int DEPTH,
00087         int COMP_ID,
00088         int PREFIX,
00089         int TBEGIN,
00090         int TEND)           
00091         {
00092             Name = NAME;
00093             Trans = TRANS;
00094             Depth = DEPTH;
00095             compID = COMP_ID;
00096             tBegin = TBEGIN;
00097             tEnd = TEND;
00098             Prefix = PREFIX;
00099             
00100         }
00101 
00102     ~TreeNode();
00103 
00104     BaseBitmap *Name;        ///< Bitmap representing the head of the node   
00105     Bitmap *Trans;           ///< Bitmap storing the list of transactions
00106 
00107     int Depth;               ///< Depth of the node in the search tree
00108     int compID;              ///< compression operation id
00109                              
00110     int tBegin;              ///< where tail begins
00111     int tEnd;                ///< where tail ends
00112 
00113     int rBegin;              ///< where the relevant itemsets in MFI begin
00114     int rEnd;                ///< where the relevant itemsets in MFI end
00115     int Prefix;              ///< last element of head (like a prefix tree)
00116 };
00117 
00118 
00119 /////////////////////////////////////////////////////////////////////
00120 /// Destructor.  Remove node from memory, but do NOT free up the associated
00121 ///     bitmaps, since they can be reused.
00122 /////////////////////////////////////////////////////////////////////
00123 TreeNode::~TreeNode() {
00124     Trans = NULL;
00125     Name = NULL;
00126 }
00127 
00128 #endif

Generated on Thu Dec 4 15:22:06 2003 for MAFIA by doxygen1.2.18