00001 00002 00003 00004 00005 00006 00007 00008 00009 #include "FCSStackStorage.h" 00010 #include "FCIndirectState.h" 00011 #include "AVLTree.h" 00012 #include "GLIBTree.h" 00013 #include "RedBlackTree.h" 00014 #include "AVLRedBlackTree.h" 00015 #include "SearchAlgorithms.h" 00016 #include "FCHelpingAlgorithms.h" 00017 #include "HashAlgorithms.h" 00018 00019 AFCSGenericStackStorage::~AFCSGenericStackStorage() 00020 { 00021 } 00022 00023 FCTreeStackStorage::FCTreeStackStorage() 00024 { 00025 m_Tree = NULL; 00026 } 00027 00028 FCTreeStackStorage::~FCTreeStackStorage() 00029 { 00030 if (m_Tree != NULL) 00031 { 00032 m_Tree->DeleteTree(); 00033 delete m_Tree; 00034 } 00035 } 00036 00037 FCSIndirectCard* FCTreeStackStorage::Insert(FCSIndirectCard* Card) 00038 { 00039 bool DummyIsInsert; 00040 return m_Tree->Search(Card, &DummyIsInsert); 00041 } 00042 00043 FCAVLTreeStackStorage::FCAVLTreeStackStorage(ACompareNodesAlgorithm<FCSIndirectCard, void>* Compare) 00044 { 00045 m_Tree = new AVLTree<FCSIndirectCard, void>(Compare, DELETE_TREE_ITEM_ARRAY); 00046 } 00047 00048 FCAVLTreeStackStorage::~FCAVLTreeStackStorage() 00049 { 00050 } 00051 00052 FCAVLRedBlackTreeStackStorage::FCAVLRedBlackTreeStackStorage(ACompareNodesAlgorithm<FCSIndirectCard, void>* Compare) 00053 { 00054 m_Tree = new AVLRedBlackTree<FCSIndirectCard, void>(Compare, DELETE_TREE_ITEM_ARRAY); 00055 } 00056 00057 FCAVLRedBlackTreeStackStorage::~FCAVLRedBlackTreeStackStorage() 00058 { 00059 } 00060 00061 FCRedBlackTreeStackStorage::FCRedBlackTreeStackStorage(ACompareNodesAlgorithm<FCSIndirectCard, void>* Compare) 00062 { 00063 m_Tree = new RedBlackTree<FCSIndirectCard, void>(Compare, DELETE_TREE_ITEM_ARRAY); 00064 } 00065 00066 FCRedBlackTreeStackStorage::~FCRedBlackTreeStackStorage() 00067 { 00068 } 00069 00070 FCGLIBTreeStackStorage::FCGLIBTreeStackStorage(ACompareNodesAlgorithm<FCSIndirectCard, void>* Compare) 00071 { 00072 m_Tree = new GLIBTree<FCSIndirectCard, void>(Compare, DELETE_TREE_ITEM_ARRAY); 00073 } 00074 00075 FCGLIBTreeStackStorage::~FCGLIBTreeStackStorage() 00076 { 00077 } 00078 00079 FCHashStackStorage::FCHashStackStorage() 00080 { 00081 m_Hash = NULL; 00082 } 00083 00084 FCHashStackStorage::~FCHashStackStorage() 00085 { 00086 if (m_Hash != NULL) 00087 { 00088 m_Hash->DeleteItems(); 00089 delete m_Hash; 00090 } 00091 } 00092 00093 FCSIndirectCard* FCHashStackStorage::Insert(FCSIndirectCard* Card) 00094 { 00095 return m_Hash->Insert(Card, true); 00096 } 00097 00098 FCGLIBHashStackStorage::FCGLIBHashStackStorage(int SizeWanted, ACompareNodesAlgorithm<FCSIndirectCard, void>* Compare, 00099 AHashAlgorithm<FCSIndirectCard>* Hash) 00100 { 00101 m_Hash = new GLIBHash<FCSIndirectCard, void>(SizeWanted, Compare, Hash, DELETE_HASH_ITEM_ARRAY); 00102 } 00103 00104 FCGLIBHashStackStorage::~FCGLIBHashStackStorage() 00105 { 00106 } 00107 00108 FCInternalHashStackStorage::FCInternalHashStackStorage(int SizeWanted, ACompareNodesAlgorithm<FCSIndirectCard, void>* Compare, 00109 AHashAlgorithm<FCSIndirectCard>* Hash) 00110 { 00111 m_Hash = new FCInternalHash<FCSIndirectCard, void>(SizeWanted, Compare, Hash, DELETE_HASH_ITEM_ARRAY); 00112 } 00113 00114 FCInternalHashStackStorage::~FCInternalHashStackStorage() 00115 { 00116 } 00117