1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024663: Removing unused "generic" classes. Part 4

In scope of this issue next unused generic class will be removed:

- TCollection_AVLBaseNode
- TCollection_AVLIterator
- TCollection_AVLList
- TCollection_AVLNode
- TCollection_AVLSearchTree

- PCollection_ATInOrderIterator
- PCollection_ATPostOrderIterator
- PCollection_ATPreOrderIterator
- PCollection_AVLIterator
- PCollection_AVLNode
- PCollection_AdjacentVerticesIterator
- PCollection_BackEdgesIterator
- PCollection_BreadthFirstIterator
- PCollection_DepthFirstIterator
- PCollection_DoubleMapIterator
- PCollection_DoubleMapNode
- PCollection_Edge
- PCollection_EdgesIterator
- PCollection_FrontEdgesIterator
- PCollection_HAVLSearchTree
- PCollection_HArbitraryTree
- PCollection_HDirectedGraph
- PCollection_HDoubleMap
- PCollection_HQueue
- PCollection_HSet
- PCollection_HStack
- PCollection_LeavesIterator
- PCollection_QueueIterator
- PCollection_RootsIterator
- PCollection_SetIterator
- PCollection_StackIterator
- PCollection_Vertex
- PCollection_VerticesIterator
- PCollection_HDataMap
- PCollection_HIndexedDataMap
- PCollection_IndexedDataMapNode
- PCollection_MapIterator
- PCollection_MapNode
This commit is contained in:
dln
2014-02-20 09:28:46 +04:00
committed by abv
parent d5c3f40613
commit 62684c43f6
59 changed files with 0 additions and 9394 deletions

View File

@@ -1,4 +1,3 @@
TCollection_Compare.gxx
TCollection_AVLNode.hxx
TCollection_CMPLRS.edl
TCollection_WOKSteps.edl

View File

@@ -130,10 +130,6 @@ is
class CompareOfReal;
class AVLBaseNode;
pointer AVLBaseNodePtr to AVLBaseNode from TCollection;
generic class AVLSearchTree,AVLNode,AVLList,AVLIterator;
NextPrimeForMap(I : Integer) returns Integer;
---Purpose: Returns a prime number greater than <I> suitable

View File

@@ -1,49 +0,0 @@
-- Created on: 1998-01-21
-- Created by: Kernel
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class AVLBaseNode from TCollection
inherits TShared from MMgt
uses AVLBaseNodePtr from TCollection,
Side from TCollection
is
Create(L,R : AVLBaseNodePtr from TCollection) returns mutable AVLBaseNode from TCollection;
---C++: inline
SetChild(me : mutable; theNode : AVLBaseNodePtr from TCollection; theSide : Side from TCollection);
---C++: inline
Height(myclass; ANode : AVLBaseNodePtr from TCollection) returns Integer;
RecursiveExtent(myclass; ANode : AVLBaseNodePtr from TCollection) returns Integer;
RecursiveTotalExtent(myclass; ANode : AVLBaseNodePtr from TCollection) returns Integer;
Right(me) returns AVLBaseNodePtr from TCollection;
---C++: inline
---C++: return &
Left(me) returns AVLBaseNodePtr from TCollection;
---C++: inline
---C++: return &
Count(me) returns Integer;
---C++: inline
---C++: return &
fields
myLeft : AVLBaseNodePtr from TCollection is protected;
myRight : AVLBaseNodePtr from TCollection is protected;
myCount : Integer from Standard is protected;
end;

View File

@@ -1,41 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_AVLBaseNode.ixx>
Standard_Integer TCollection_AVLBaseNode::Height(const TCollection_AVLBaseNodePtr& ANode)
// Length of the longest child
{
if (!ANode) return 0;
else return (1 + Max(Height(ANode->myLeft),Height(ANode->myRight)));
}
Standard_Integer TCollection_AVLBaseNode::RecursiveExtent(const TCollection_AVLBaseNodePtr & ANode)
// Number of different items in the current tree
{
if ( ! ANode ) return 0;
else return (1 + RecursiveExtent(ANode->myLeft)
+ RecursiveExtent(ANode->myRight) );
}
Standard_Integer TCollection_AVLBaseNode::RecursiveTotalExtent(const TCollection_AVLBaseNodePtr& ANode)
{
// Number of different items in the current tree according to
// the multiplicity
if ( ! ANode ) return 0;
else return ( RecursiveTotalExtent(ANode->myLeft) + RecursiveTotalExtent(ANode->myRight) + ANode->myCount);
}

View File

@@ -1,41 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline TCollection_AVLBaseNode::TCollection_AVLBaseNode(const TCollection_AVLBaseNodePtr& L, const TCollection_AVLBaseNodePtr& R)
: myLeft(L),myRight(R),myCount(1)
{
}
inline void TCollection_AVLBaseNode::SetChild(const TCollection_AVLBaseNodePtr& theNode, const TCollection_Side theSide)
// According to the side changes a child by another
{
if (theSide == TCollection_Left) {myLeft = theNode;}
else {myRight = theNode;}
}
inline TCollection_AVLBaseNodePtr& TCollection_AVLBaseNode::Right() const
{
return (TCollection_AVLBaseNodePtr&)myRight;
}
inline TCollection_AVLBaseNodePtr& TCollection_AVLBaseNode::Left() const
{
return (TCollection_AVLBaseNodePtr&)myLeft;
}
inline Standard_Integer& TCollection_AVLBaseNode::Count() const
{
return (Standard_Integer&)myCount;
}

View File

@@ -1,105 +0,0 @@
// Created on: 1991-05-23
// Created by: Jean-Pierre TIRAULT
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Transient implementation
#include <Standard_Address.hxx>
// Global variable
static Standard_Address LastNode;
// Global variable
void TCollection_AVLIterator::InOrderTraversal (const Standard_Address A) {
if (A) {
InOrderTraversal (((TCollection_AVLNode*)A)->Left());
TCollection_AVLList* S = new TCollection_AVLList;
S->Value() = ((TCollection_AVLNode*)A)->Value();
if (!FirstNode) {
FirstNode = (Standard_Address*)S;
LastNode = FirstNode;
}
else {
((TCollection_AVLList*)LastNode)->Next() = S;
LastNode = (Standard_Address)S;
}
InOrderTraversal (((TCollection_AVLNode*)A)->Right());
}
}
//-----------------------------------------------------------------------------
TCollection_AVLIterator::
TCollection_AVLIterator ( const TCollection_AVLSearchTree& aTree)
{
LastNode = FirstNode = NULL;
Standard_Address Root = (Standard_Address) aTree.GetRoot(); // Current node = root of tree
if (!Root) {
HasMore = Standard_False;
}
else {
HasMore = Standard_True;
InOrderTraversal(Root);
}
}
//-----------------------------------------------------------------------------
TCollection_AVLIterator::TCollection_AVLIterator ( const TCollection_AVLSearchTree& aTree, const Item& anItem)
{
LastNode = FirstNode = NULL;
Standard_Address Root;
if (aTree.Find(anItem,Root)) {
HasMore = Standard_True;
InOrderTraversal(Root);
}
else {
HasMore = Standard_False;
}
}
//-----------------------------------------------------------------------------
void TCollection_AVLIterator::Clear ()
{
LastNode = NULL ;
TCollection_AVLList* S = (TCollection_AVLList*)FirstNode;
TCollection_AVLList* P;
while (S) { // Memory management
P = S;
S = (TCollection_AVLList*)S->Next();
delete P;
}
FirstNode = NULL ;
HasMore = Standard_False;
}
//-----------------------------------------------------------------------------
const Item& TCollection_AVLIterator::Value () const
{
Standard_NoSuchObject_Raise_if(!HasMore,"TCollection_AVLIterator - No more object");
return ((TCollection_AVLList*)FirstNode)->Value();
}
//-----------------------------------------------------------------------------
void TCollection_AVLIterator::Next ()
{
Standard_NoSuchObject_Raise_if(!HasMore,"TCollection_AVLIterator - No more object");
TCollection_AVLList* S = (TCollection_AVLList*)FirstNode;
FirstNode = ((TCollection_AVLList*)FirstNode)->Next();
HasMore = (FirstNode != NULL);
delete S;
}

View File

@@ -1,19 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_NoSuchObject.hxx>
inline Standard_Boolean TCollection_AVLIterator::More () const {
return HasMore;
}

View File

@@ -1,13 +0,0 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

View File

@@ -1,29 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline TCollection_AVLList::TCollection_AVLList()
: myNext(0L)
{
}
inline Item & TCollection_AVLList::Value() const
{
return (Item&)myValue;
}
inline Standard_Address & TCollection_AVLList::Next() const
{
return (Standard_Address&)myNext;
}

View File

@@ -1,40 +0,0 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
void TCollection_AVLNode::RecursiveCopy (const TCollection_AVLBaseNodePtr& ANode,const TCollection_AVLBaseNodePtr& copy)
{
if (ANode) {
((TCollection_AVLNode*)copy)->Value() = ((TCollection_AVLNode*)ANode)->Value();
if (ANode->Left()) {
copy->Left() = new TCollection_AVLNode(((TCollection_AVLNode*)copy)->Value(),(TCollection_AVLBaseNodePtr)0L,(TCollection_AVLBaseNodePtr)0L);
TCollection_AVLNode::RecursiveCopy(ANode->Left(),copy->Left());
}
if (ANode->Right()) {
copy->Right() = new TCollection_AVLNode(((TCollection_AVLNode*)copy)->Value(),(TCollection_AVLBaseNodePtr)0L,(TCollection_AVLBaseNodePtr)0L);
TCollection_AVLNode::RecursiveCopy(ANode->Right(),copy->Right());
}
}
}
// ----------------------------------------------------------------------
TCollection_AVLBaseNodePtr TCollection_AVLNode::Copy(const TCollection_AVLBaseNodePtr& ANode)
{
TCollection_AVLNode *copy = NULL;
if (ANode) {
copy = new TCollection_AVLNode(((TCollection_AVLNode*)ANode)->Value(),(TCollection_AVLBaseNodePtr)0L,(TCollection_AVLBaseNodePtr)0L);
TCollection_AVLNode::RecursiveCopy (ANode,copy);
}
return copy;
}

View File

@@ -1,30 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// ----------------------------------------------------------------------
// Internal C++ class that provides tool to manipulate a tree node.
// ----------------------------------------------------------------------
//void ShallowDump(const Item&, Standard_OStream& );
class AVLNode{
public :
Item Value;
AVLNode* Left ;
AVLNode* Right;
Standard_Integer Count;
friend class AVLList; // For iterator
};

View File

@@ -1,24 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline Item& TCollection_AVLNode::Value() const
{
return (Item&)myValue;
}
inline TCollection_AVLNode::TCollection_AVLNode(const Item& I,const TCollection_AVLBaseNodePtr& r,const TCollection_AVLBaseNodePtr& l)
: TCollection_AVLBaseNode(r,l)
{
myValue = I;
}

View File

@@ -1,412 +0,0 @@
-- Created on: 1991-05-21
-- Created by: Annick PANCHER
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Revised: Mireille MERCIEN
-- J.P. TIRAULT
-- Feb,19 1993
-- Adaptation of this persistent structure to a transient
-- structure.
-- J.P. TIRAULT -- R.BARRETO
-- Aug,11 1993
-- Update of method AVLSearchTree::Find. This method returns
-- a boolean status according to the method finds the Item or not.
-- Update of method AVLIterator::Value. This method returns an
-- Item.
generic class AVLSearchTree from TCollection (
Item as any;
Comparator as Compare(Item))
---Purpose: Defines a binary search tree, e.g. an ordered and
-- balanced binary tree. An AVLSearchTree is created
-- with a kind of Item and a Comparator. It's
-- composed with Nodes. One item is contained only by
-- one Node, and a 'count' stores the number of its
-- occurences.
-- The only public operations on an AVLSearchTree,
-- except reading ( the number of its Nodes, its Root
-- or the Node containing an item) are to insert or
-- remove an item, plus, of course, to find an item.
-- Then, it's possible to ask to a Node its value,
-- the number of occurences of this value, and its
-- right and left children. Other methods of Node are
-- private and called by the private methods of
-- AVLSearchTree which manage the Find method, and
-- Insert and Remove operations, always ensuring
-- order and balance.
-- 1. ORDER :
-- If the tree contains three elements A,B,C, which
-- are ordered, regarding to a comparator Comp, as
-- following:
-- A < B < C
-- Then TheRoot of the tree will contain B, with A as
-- LeftChild and C as RightChild.
-- Each element on the left of a node A are 'lower'
-- than A in respect with the used comparator, and
-- each element on its right are greater.
-- 2. BALANCE : The height of two children of a Node
-- will never have a difference of more than one
-- level. An AVLSearch Tree is ALWAYS balanced.
-- Keywords: binary tree, ordered, balanced
-- Warning: To use an AVLSearchTree, since it's ordered and
-- balanced each time an item is inserted or removed,
-- may be a bad choice if there are more changing
-- operations than searching requests, for
-- performances criterias. It can be judicious to
-- use it when there are many items to consult
-- frequently.
-- References: Classix, Reusable C++ Components( Empathy
-- incorporated, 1990).
-- Algorithms are attributed to
-- G.M.Adel'son-Vel'skii and E.M.Landis, 1962.
uses Side
raises NoSuchObject from Standard,
NoMoreObject from Standard
class AVLList from TCollection
inherits TShared from MMgt
is
Create returns mutable AVLList from TCollection;
---C++: inline
Value(me) returns Item;
---C++: inline
---C++: return &
Next(me) returns Address;
---C++: inline
---C++: return &
fields
myValue : Item;
myNext : Address from Standard;
end;
class AVLNode from TCollection
inherits AVLBaseNode from TCollection
uses AVLBaseNodePtr from TCollection
is
Create(I : Item; r,l : AVLBaseNodePtr from TCollection) returns AVLNode from TCollection;
---C++: inline
Copy(myclass; ANode : AVLBaseNodePtr from TCollection) returns AVLBaseNodePtr from TCollection;
RecursiveCopy(myclass; ANode,aCopy : AVLBaseNodePtr from TCollection);
Value(me) returns Item;
---C++: inline
---C++: return &
fields
myValue : Item;
friends class AVLList from TCollection
end;
class AVLIterator
raises NoMoreObject from Standard, NoSuchObject from Standard
is
---Purpose: This class provides to iterate on an AVLSearchTree.
-- The type of traversal is the in-order traversal.
-- Example : If the AVLTree is the following:
-- 5
-- 2 7
-- 1 3 6 8
--
-- The result is:
-- 1 2 3 5 6 7 8
--
-- During the exploration of the tree no updating of the
-- tree must be done.
--
Create( aTree: AVLSearchTree)
---Purpose: Creates an iterator on <aTree> from the root of the
-- AVLSearchtree.
returns AVLIterator;
Create( aTree: AVLSearchTree; theItem : Item)
---Purpose: Creates an iterator on <aTree> from the node that
-- contains the Item (It is not necessary the root of the tree).
returns AVLIterator;
More( me )
---Level: Public
---Purpose: Returns True if there is still an element to be read
---C++: inline
returns Boolean from Standard is static;
Next( me: in out) raises NoMoreObject from Standard;
---Level: Public
---Purpose: Goes to next element of <me>
Value( me)
returns Item
raises NoSuchObject from Standard;
---Level: Public
---C++: return const &
Clear (me: in out) is static ;
---Level: Public
---Purpose: Empties my structure, so that if next call on <me>,
-- it will raise an exception NoMoreObject
InOrderTraversal (me : in out ; A : Address) is static private;
---Level: Internal
---Purpose: Internal method.
fields
FirstNode : Address;
HasMore : Boolean;
end;
------------------------------ AVLSearchTree --------------------------------
is
Create( aComparator: Comparator)
---Purpose: creates an empty tree (root points to NULL)
returns AVLSearchTree;
IsEmpty( me)
---Level: Public
---Purpose: Returns true if the tree is empty.
---Category: Reading
---C++: inline
returns Boolean from Standard
is static;
Extent( me)
---Level: Public
---Purpose: Returns number of different items contained by <me>
---Category: Reading
returns Integer from Standard
is static;
TotalExtent( me)
---Level: Public
---Purpose: Returns total number of items (considers account
-- of each Node)
---Category: Reading
returns Integer from Standard
is static;
Find( me; theItem: Item)
---Level: Public
---Purpose: Returns the Node containing <theItem>
---Category: Reading
returns Boolean
is static;
Find( me; theItem: Item; theOrig: in out Item)
---Level: Public
---Purpose: Returns the Node containing <theItem>
---Category: Reading
returns Boolean
is static;
GetRoot( me)
returns Address
is static;
---Level: Public
---Purpose: Returns the Root of the tree <me>.
---Category: Reading
---C++: inline
GetComparator( me)
returns Comparator
is static;
---Level: Public
---Purpose: Returns the Comparator of the tree <me>.
---Category: Reading
---C++: inline
Insert( me : in out ; theItem: Item)
is static;
---Level: Public
---Purpose: Inserts <theItem> at the right place; if it's
-- already in <me>, only changes its <count>.
-- Before
-- me = ( i5( i3( i1)) -i7) and theItem = i2
-- After
-- me = ( i5( i2( i1 -i3)) -i7))
-- ( i means LeftChild, -i means RightChild)
---Category: Writing
InsertOnce(me : in out ; theItem: Item)
---Level: Public
---Purpose: Inserts <theItem> at the right place, but only if
-- it isn't already in <me>; Returns False if already there.
-- Before
-- me = ( i5( i3( i1)) -i7) and theItem = i3
-- After
-- me = ( i5( i3( i1)) -i7) and return False
---Category: Writing
returns Boolean from Standard
is static;
Remove( me : in out; theItem : Item)
---Level: Public
---Purpose: Removes from <me> the Node containing <theItem>,
-- if its count=1, or reduces its count if count>1;
-- in this aim, calls the recursive method
-- RecursiveRemove, with <forAll>=False;
-- Before
-- me = ( i5( i3( i1)) -i7) and theItem = i7
-- After
-- me = ( i3( i1 -i5)) if count(i7)=1
-- Or
-- me = ( i5( i3( i1)) -i7) if count(i7)>1
---Category: Writing
raises NoSuchObject from Standard
is static;
RemoveAll( me : in out; theItem: Item)
---Level: Public
---Purpose: removes from <me> the Node containing <theItem>;
-- in this aim, calls the recursive method
-- RecursiveRemove, with <forAll>=True;
-- Before
-- me = ( i5( i3( i1)) -i7) and theItem = i7
-- After
-- me = ( i3( i1 -i5))
---Category: Writing
raises NoSuchObject from Standard
is static;
Merge (me; another:AVLSearchTree)
---Level: Public
---Purpose: creates a third one from <me> and <another>
---Category: Writing
returns AVLSearchTree
is static;
SetRoot(me : in out ; theNode: Address)
---Level: Internal
is static private;
---C++: inline
RotateLeft( me ; theNode : in out Address)
---Level: Internal
---Purpose: Right child A of <theNode> becomes the parent, and
-- <theNode> becomes its left child; left child of A
-- becomes the right child of <theNode>. This
-- rotation will permit to balance <me> after a
-- pertubating action ( insert or remove) on it.
is static private;
RotateRight( me ; theNode : in out Address)
---Level: Internal
---Purpose: left child A of <theNode> becomes the parent, and
-- <theNode> becomes its right child; right child of
-- A becomes the left child of <theNode>. This
-- rotation will permit to balance <me> after a
-- pertubating action ( insert or remove) on it.
is static private;
LeftBalance( me; theNode : in out Address)
---Level: Internal
---Purpose: called after inserting or removing an item, if the
-- left branch of <theNode> is too long
is static private;
RightBalance( me ; theNode : in out Address)
---Level: Internal
---Purpose: Called after inserting or removing an item, if the
-- right branch of <theNode> is too long.
is static private;
InsertBalance( me ; theNode : in out Address;
theFather: Address;
theSide : Side)
---Level: Internal
---Purpose: Balances <me> after inserting an item.
returns Boolean from Standard
is static private;
RemoveBalance( me ; theNode : in out Address;
theFather: Address;
theSide : Side)
---Level: Internal
---Purpose: Balances <me> after removing an item.
returns Boolean from Standard
is static private;
RecursiveInsert( me ; theNode : in out Address;
theFather: Address;
theSide : Side;
theItem : Item;
forOnce : in out Boolean from Standard)
---Level: Internal
---Purpose: Recursive method to insert a new Node OR to find
-- the existing one containing <theItem> and increase
-- its count.
-- Returns True when a new Node has been created to
-- know it needs to be balanced, and then returns
-- False again.
returns Boolean from Standard
is static private;
Find ( me ; theItem : Item ; theNode : in out Address)
returns Boolean is static private;
---Level: Internal
---Purpose: Returns the Node associated to the Item.
RecursiveRemove( me ; theNode : in out Address;
theFather: Address;
theSide : Side;
theItem : Item;
forAll : Boolean from Standard)
---Level: Internal
---Purpose: Recursive method to find the Node containing
-- <theItem>. In case it's <theNode>, removes it if
-- <forAll> is True, or reduces its count if <forAll>
-- is False.
-- Returns True when theItem has been found
returns Boolean from Standard
is static private;
ShallowCopy(me) returns AVLSearchTree;
---Level: Advanced
---C++: function call
fields
TheRoot : Address from Standard;
TheComparator : Comparator;
friends
class AVLIterator from TCollection
end;

View File

@@ -1,579 +0,0 @@
// Created on: 1991-05-23
// Created by: Jean-Pierre TIRAULT
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Transient implementation
#define TCollection_AVLSearchTreeTrace 0
// K_TRACE_A_METHOD used also in Engine.cxx, Engine_Signature.cxx,
// Engine_Argument.cxx, Engine_MyClassCompareOfSignature.cxx and
// TCollection_AVLSearchTree.gxx (! pour Kernel)
#define K_TRACE_A_METHOD 0
#if K_TRACE_A_METHOD
extern K_Trace_a_Method ;
#endif
#include <Standard_NoSuchObject.hxx>
#include <Standard_Address.hxx>
#include <TCollection_Side.hxx>
#if TCollection_AVLSearchTreeTrace
#include <Engine_Signature.hxx>
#endif
//-----------------------------------------------------------------------------
// Create : creates an empty AVLSearchTCollection_AVLSearchTree
//-----------------------------------------------------------------------------
TCollection_AVLSearchTree::
TCollection_AVLSearchTree(const Comparator& AComparator) : TheRoot(NULL)
{
TheComparator = AComparator;
}
//----------------------------------------------------------------------------
Standard_Integer TCollection_AVLSearchTree::Extent () const
{
return TCollection_AVLNode::RecursiveExtent((TCollection_AVLNode*) TheRoot);
}
//----------------------------------------------------------------------------
Standard_Integer TCollection_AVLSearchTree::TotalExtent () const
{
return TCollection_AVLNode::RecursiveTotalExtent((TCollection_AVLNode*)TheRoot);
}
//----------------------------------------------------------------------------
// Find the Node where an item is located
//----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::Find(const Item& TheItem) const
{
TCollection_AVLNode* aNode = (TCollection_AVLNode*) TheRoot;
#if TCollection_AVLSearchTreeTrace
cout << " ++++++++++++++++++ SEARCH1 +++++++++++++++++++++++++++++" << endl ;
cout << "BEGINNING OF SEARCH OF " << TheItem->PForMapOfMethods()->Name()
<< " in " << hex << TheRoot << dec << endl ;
#endif
while (aNode) {
if ( TheComparator.IsLower(TheItem, aNode->Value()) ) {
aNode = (TCollection_AVLNode*)aNode->Left();
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsLower : Left : " << hex
<< aNode << dec << endl ;
#endif
}
else if ( TheComparator.IsGreater(TheItem, aNode->Value()) ) {
aNode = (TCollection_AVLNode*)aNode->Right();
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsGreater : Right : " << hex
<< aNode << dec << endl ;
#endif
}
else {
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsEqual : " << hex << aNode
<< dec << endl ;
#endif
break;
}
}
if ( aNode ) {
#if TCollection_AVLSearchTreeTrace
cout << "FOUND " << aNode->Value()->PForMapOfMethods()->Name() << endl ;
#endif
return Standard_True;
}
#if TCollection_AVLSearchTreeTrace
cout << " NOT FOUND" << endl ;
#endif
return Standard_False;
}
//----------------------------------------------------------------------------
// Find the Node where an item is located and returns the node associated
//----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::Find(const Item& TheItem,
Standard_Address& TheNode) const
{
TCollection_AVLNode* aNode = (TCollection_AVLNode*) TheRoot;
#if TCollection_AVLSearchTreeTrace
cout << " ++++++++++++++++++ SEARCH2 +++++++++++++++++++++++++++++" << endl ;
cout << "BEGINNING OF SEARCH OF " << TheItem->PForMapOfMethods()->Name()
<< " in " << hex << TheRoot << dec << endl ;
#endif
while (aNode) {
if ( TheComparator.IsLower(TheItem, aNode->Value()) ) {
aNode = (TCollection_AVLNode*)aNode->Left();
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsLower : Left : " << hex
<< aNode << dec << endl ;
#endif
}
else if ( TheComparator.IsGreater(TheItem, aNode->Value()) ) {
aNode = (TCollection_AVLNode*)aNode->Right();
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsGreater : Right : " << hex
<< aNode << dec << endl ;
#endif
}
else {
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsEqual : " << hex << aNode
<< dec << endl ;
#endif
break;
}
}
if ( aNode ) {
TheNode = (Standard_Address) aNode;
#if TCollection_AVLSearchTreeTrace
cout << "FOUND " << aNode->Value()->PForMapOfMethods()->Name() << endl ;
#endif
return Standard_True;
}
#if TCollection_AVLSearchTreeTrace
cout << " NOT FOUND" << endl ;
#endif
return Standard_False;
}
//----------------------------------------------------------------------------
// Find the Node where an item is located
//----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::Find(const Item& TheItem,
Item& TheOrig) const
{
TCollection_AVLNode* aNode = (TCollection_AVLNode*) TheRoot;
#if TCollection_AVLSearchTreeTrace
cout << " ++++++++++++++++++ SEARCH3 +++++++++++++++++++++++++++++" << endl ;
cout << "BEGINNING OF SEARCH OF " << TheItem->PForMapOfMethods()->Name()
<< " in " << hex << TheRoot << dec << endl ;
#endif
while (aNode) {
if ( TheComparator.IsLower(TheItem, aNode->Value()) ) {
aNode = (TCollection_AVLNode*)aNode->Left();
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsLower : Left : " << hex
<< aNode << dec << endl ;
#endif
}
else if ( TheComparator.IsGreater(TheItem, aNode->Value()) ) {
aNode = (TCollection_AVLNode*)aNode->Right();
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsGreater : Right : " << hex
<< aNode << dec << endl ;
#endif
}
else {
#if K_TRACE_A_METHOD
if ( K_Trace_a_Method )
cout << "TCollection_AVLSearchTree::Find IsEqual : " << hex << aNode
<< dec << endl ;
#endif
break;
}
}
if ( aNode ) {
TheOrig = aNode->Value();
#if TCollection_AVLSearchTreeTrace
cout << "FOUND " << aNode->Value()->PForMapOfMethods()->Name() << endl ;
#endif
return Standard_True;
}
#if TCollection_AVLSearchTreeTrace
cout << " NOT FOUND" << endl ;
#endif
return Standard_False;
}
//----------------------------------------------------------------------------
// RotateRight
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::RotateRight(Standard_Address& TheNode) const
{
// the left child becomes the parent...
TCollection_AVLNode* Temp = (TCollection_AVLNode*)((TCollection_AVLNode *)TheNode)->Left();
((TCollection_AVLNode *)TheNode)->Left() = Temp->Right();
Temp->Right() = (TCollection_AVLNode *)TheNode;
TheNode = (Standard_Address)Temp;
}
//-----------------------------------------------------------------------------
// RotateLeft
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::
RotateLeft(Standard_Address& TheNode) const
{
// the right child becomes the parent...
TCollection_AVLNode* Temp = (TCollection_AVLNode*)((TCollection_AVLNode *)TheNode)->Right();
((TCollection_AVLNode *)TheNode)->Right() = Temp->Left();
Temp->Left() = (TCollection_AVLNode *)TheNode;
TheNode = (Standard_Address)Temp;
}
//-----------------------------------------------------------------------------
// LeftBalance
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::LeftBalance(Standard_Address& Root) const
{
TCollection_AVLNode* TheNode = (TCollection_AVLNode*)((TCollection_AVLNode*)Root)->Left();
if( TCollection_AVLNode::Height(TheNode->Left()) >= TCollection_AVLNode::Height(TheNode->Right()) ) {
RotateRight(Root);
return;
}
Standard_Address Ptr = TheNode;
RotateLeft(Ptr);
TheNode = (TCollection_AVLNode*)Ptr;
((TCollection_AVLNode*)Root)->Left() = TheNode;
RotateRight(Root);
}
//----------------------------------------------------------------------------
// RightBalance
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::RightBalance(Standard_Address& Root) const
{
TCollection_AVLNode* TheNode = (TCollection_AVLNode*)((TCollection_AVLNode *)Root)->Right();
if( TCollection_AVLNode::Height(TheNode->Right()) >= TCollection_AVLNode::Height(TheNode->Left())) {
RotateLeft(Root);
return;
}
Standard_Address Ptr = TheNode;
RotateRight(Ptr);
TheNode = (TCollection_AVLNode*)Ptr;
((TCollection_AVLNode*)Root)->Right() = TheNode;
RotateLeft(Root);
}
//-----------------------------------------------------------------------------
// InsertBalance
//-----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::InsertBalance(Standard_Address& Child,
const Standard_Address Father,
const TCollection_Side theSide) const
{
// Balance after insertion
switch (TCollection_AVLNode::Height(((TCollection_AVLNode*)Child)->Left()) -
TCollection_AVLNode::Height(((TCollection_AVLNode*)Child)->Right())) {
case 2 : LeftBalance(Child);
if ( Father )
((TCollection_AVLNode*)Father)->SetChild((TCollection_AVLNode*)Child, theSide);
return Standard_False;
case -2 : RightBalance(Child);
if ( Father )
((TCollection_AVLNode*)Father)->SetChild((TCollection_AVLNode*)Child, theSide);
return Standard_False;
case 0 : return Standard_False;
default : return Standard_True;
}
}
//----------------------------------------------------------------------------
// RemoveBalance
//-----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::
RemoveBalance(Standard_Address& Child,
const Standard_Address Father,
const TCollection_Side theSide) const
{
// Balance after Remove
switch (TCollection_AVLNode::Height(((TCollection_AVLNode*)Child)->Left()) -
TCollection_AVLNode::Height(((TCollection_AVLNode*)Child)->Right())) {
case 2 : LeftBalance(Child);
if (Father)
((TCollection_AVLNode*)Father)->SetChild((TCollection_AVLNode*)Child, theSide);
return Standard_True;
case -2 : RightBalance(Child);
if ( Father )
((TCollection_AVLNode*)Father)->SetChild((TCollection_AVLNode*)Child, theSide);
return Standard_True;
default : return Standard_True;
}
}
//---------------------------------------------------------------------------
// RecursiveInsert
//-----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::
RecursiveInsert(
Standard_Address& Child,
const Standard_Address Father,
const TCollection_Side theSide,
const Item& theItem,
Standard_Boolean& forOnce) const
{
TCollection_AVLNode* Temp;
// DEC C++ need
Standard_Address MyTemp;
// end of DEC C++ need
Standard_Boolean Result = Standard_False;
Standard_Integer Number;
//-- Firstly find where the item should be insert
if(TheComparator.IsLower(theItem, ((TCollection_AVLNode*)Child)->Value() ) )
//---------------
//-- If the item is lower than the root go to left child
{
Temp = (TCollection_AVLNode*)((TCollection_AVLNode*)Child)->Left();
//-- If it's a leaf insert it
if ( ! Temp ) {
((TCollection_AVLNode*)Child)->Left() = new TCollection_AVLNode(theItem,(TCollection_AVLNode*)0L,(TCollection_AVLNode*)0L);
return Standard_True;
}
//-- else recursive insert...
MyTemp = (Standard_Address)Temp;
Result = RecursiveInsert( MyTemp, Child, TCollection_Left,
theItem, forOnce);
//-- and rebuild the tree, if no problem.
if(Result) return InsertBalance(Child, Father, theSide) ;
else return Standard_False;
}
else if (TheComparator.IsGreater(theItem, ((TCollection_AVLNode*)Child)->Value()))
//---------------
//-- If the item is greater than the root go to right child
{
Temp = (TCollection_AVLNode*)((TCollection_AVLNode*)Child)->Right();
//-- If it's a leaf insert it
if ( ! Temp ) {
((TCollection_AVLNode*)Child)->Right() = new TCollection_AVLNode(theItem,(TCollection_AVLNode*)0L,(TCollection_AVLNode*)0L);
return Standard_True;
}
//-- else recursive insert...
MyTemp = (Standard_Address)Temp;
Result = RecursiveInsert( MyTemp, Child, TCollection_Right,
theItem, forOnce);
//-- and rebuild the tree, if no problem.
if(Result) return InsertBalance(Child, Father, theSide);
else return Standard_False;
}
else
{
//--------------
//-- Item is already there; add 1 to its count
if (forOnce) {
forOnce = Standard_False;
}
else {
Number = ((TCollection_AVLNode*)Child)->Count();
((TCollection_AVLNode*)Child)->Count() = ++Number;
}
return Standard_False;
}
}
//-----------------------------------------------------------------------------
// RecursiveRemove
//-----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::RecursiveRemove(
Standard_Address& Child,
const Standard_Address Father,
const TCollection_Side theSide,
const Item& TheItem,
const Standard_Boolean ForAll) const
{
Standard_Boolean Result;
if ( ! Child ) Standard_NoSuchObject::Raise();// if Child points to something
TCollection_AVLNode* TheLeft = (TCollection_AVLNode*)((TCollection_AVLNode*)Child)->Left(); // left children
TCollection_AVLNode* TheRight = (TCollection_AVLNode*)((TCollection_AVLNode*)Child)->Right();// right children
// DEC C++ need
Standard_Address MyTheLeft;
Standard_Address MyTheRight;
//
if (TheComparator.IsLower(TheItem,((TCollection_AVLNode*)Child)->Value()))
{ // TheItem < Value
MyTheLeft = (Standard_Address)TheLeft;
Result = RecursiveRemove( MyTheLeft, // left child becomes root
Child , // child becomes father
TCollection_Left, // go to left
TheItem , // same Item
ForAll);
}
else if (TheComparator.IsGreater(TheItem,(((TCollection_AVLNode*)Child)->Value())))
{ // TheItem > Value
MyTheRight = (Standard_Address)TheRight;
Result = RecursiveRemove( MyTheRight,// right child becomes root
Child,// child becomes father
TCollection_Right,// go to right
TheItem ,// same Item
ForAll);
}
else
{
//-- The Item has been found
((TCollection_AVLNode*)Child)->Count()--;
//-- Is it necessary to remove it ?
if (!ForAll && ((TCollection_AVLNode*)Child)->Count() > 0) return Standard_True;
//-- In this case we must remove it and rebuild the subtree.
if ( TheLeft && TheRight )
{
//-- The subtree has 2 children
TCollection_AVLNode* T;
TCollection_AVLNode* Temp = TheRight; // From the right child go to
while ( Temp ) { // the left leaf
T = Temp;
Temp = (TCollection_AVLNode*)Temp->Left();
}
//-- We have the left leaf. Push it at the same level than the
//-- node we have removed.
((TCollection_AVLNode*)Child)->Value() = T->Value() ;
((TCollection_AVLNode*)Child)->Count() = T->Count() ;
//-- Now we must remove in the right subtree this value; because
//-- now it appears twice.
MyTheRight = (Standard_Address)TheRight;
Result = RecursiveRemove( MyTheRight, Child, TCollection_Right,
((TCollection_AVLNode*)Child)->Value(), ForAll);
}
else
{
//-- only one subtree exists (left OR right)
//-- First delete the node
delete ((TCollection_AVLNode*)Child);
//-- Secondly see what is the child not empty
if ( ! TheLeft ) { Child = (Standard_Address) TheRight; }
else { Child = (Standard_Address) TheLeft; }
//-- Thirdly update the father node
// "mip-avril-94 : if (Father is null) => Raise"
// ((TCollection_AVLNode*)Father)->SetChild((TCollection_AVLNode*)Child, theSide);
if ((TCollection_AVLNode*)Father != NULL)
((TCollection_AVLNode*)Father)->SetChild((TCollection_AVLNode*)Child, theSide);
return Standard_True;
}
}
//-- Result = Standard_True means we must reorder the tree.
if (Result) return RemoveBalance(Child, Father, theSide);
return Standard_False; // Child has not been found for now
}
//----------------------------------------------------------------------------
// Insert
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::Insert (const Item& theItem)
{
if ( ! TheRoot ) {
TheRoot = new TCollection_AVLNode(theItem,(TCollection_AVLNode*)0L,(TCollection_AVLNode*)0L);
return;
}
TCollection_AVLNode* Father = NULL;
Standard_Boolean forOnce = Standard_False;
RecursiveInsert( TheRoot, (Standard_Address)Father, TCollection_Left, theItem,
forOnce);
}
//-----------------------------------------------------------------------------
// InsertOnce
//-----------------------------------------------------------------------------
Standard_Boolean TCollection_AVLSearchTree::InsertOnce (const Item& theItem)
{
if ( ! TheRoot ) {
TheRoot = new TCollection_AVLNode(theItem,(TCollection_AVLNode*)0L,(TCollection_AVLNode*)0L);
return Standard_True;
}
TCollection_AVLNode* Father = NULL;
Standard_Boolean forOnce = Standard_True;
RecursiveInsert( TheRoot, (Standard_Address)Father, TCollection_Left, theItem,
forOnce);
//-- forOnce = Standard_False if the item was already in the tree
return forOnce;
}
//-----------------------------------------------------------------------------
// Remove
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::Remove (const Item& theItem)
{
TCollection_AVLNode* Father = NULL;
//-- remove ONLY ONE item of the tree
RecursiveRemove( TheRoot, (Standard_Address)Father, TCollection_Left, theItem,Standard_False);
}
//----------------------------------------------------------------------------
// RemoveAll
//-----------------------------------------------------------------------------
void TCollection_AVLSearchTree::RemoveAll (const Item& theItem)
{
TCollection_AVLNode* Father = NULL;
//-- Remove ALL item of the tree
RecursiveRemove( TheRoot, (Standard_Address)Father, TCollection_Left, theItem,Standard_True);
}
//----------------------------------------------------------------------------
// Merge
//-----------------------------------------------------------------------------
TCollection_AVLSearchTree TCollection_AVLSearchTree::Merge(const TCollection_AVLSearchTree& aTree) const
{
Item theItem;
// First, make a shallowcopy and push the result into a new tree
//
TCollection_AVLSearchTree newTree = ShallowCopy();
// for test-- newTree.ShallowDump(cout);
//
TCollection_AVLIterator Iter( aTree );
//-- Secondly, make an iterator on the second tree
//
while( Iter.More()) {
//-- Thirdly get back its value
// theItem = ((TCollection_AVLNode*)Iter.Value())->Value();
//
theItem = Iter.Value();
//-- and push them into the new tree.
//
newTree.Insert(theItem);
Iter.Next();
}
return newTree;
}
//----------------------------------------------------------------------------
// ShallowCopy
//-----------------------------------------------------------------------------
TCollection_AVLSearchTree TCollection_AVLSearchTree::ShallowCopy() const
{
// Construct a new tree
// with same comparator
//
TCollection_AVLSearchTree newtree (TheComparator);
// Copy an TCollection_AVLNode and put
// the result as root of new tree
//
newtree.SetRoot(TCollection_AVLNode::Copy((TCollection_AVLNode*)TheRoot)) ;
return newtree;
}

View File

@@ -1,53 +0,0 @@
// Created by: J.P. TIRAULT
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//-----------------------------------------------------------------------------
// inline methods for AVLSearchTree
//-----------------------------------------------------------------------------
#include <Standard_Address.hxx>
//-----------------------------------------------------------------------------
// IsEmpty : Is the current tree empty ?
//-----------------------------------------------------------------------------
inline Standard_Boolean TCollection_AVLSearchTree::IsEmpty () const
{
return TheRoot == NULL;
}
//-----------------------------------------------------------------------------
// GetRoot : Returns the root of the current tree
//-----------------------------------------------------------------------------
inline Standard_Address TCollection_AVLSearchTree::GetRoot () const
{
return TheRoot;
}
//-----------------------------------------------------------------------------
// GetComparator : Returns the Comparator of the current tree
//-----------------------------------------------------------------------------
inline Comparator TCollection_AVLSearchTree::GetComparator () const
{
return TheComparator;
}
// ---------------------------------------------------------------------------
// SetRoot : Replaces the root of the current tree
//-----------------------------------------------------------------------------
inline void TCollection_AVLSearchTree::SetRoot(const Standard_Address ANode)
{
TheRoot = ANode;
}