avglvltree: changed count to SizeInt for big trees on 64bit systems

git-svn-id: trunk@36128 -
This commit is contained in:
mattias 2012-03-17 17:53:13 +00:00
parent c6e13a0f09
commit 0a38a4d2ea
2 changed files with 9 additions and 11 deletions

View File

@ -15,14 +15,12 @@
Author: Mattias Gaertner
Abstract:
The Tree is sorted ascending from left to right. That means Compare gives
positive values for comparing right with left.
The Tree is sorted ascending from left to right. That means
Compare(Node.Left,Node.Right) <= 0 for all nodes.
TAvgLvlTree is an Average Level binary Tree. This binary tree is always
balanced, so that inserting, deleting and finding a node is performed in
O(log(#Nodes)).
Tree is sorted ascending.
}
unit AvgLvlTree;
@ -74,7 +72,7 @@ type
TAvgLvlTree = class
protected
fRoot: TAvgLvlTreeNode;
FCount: integer;
FCount: SizeInt;
FNodeClass: TAvgLvlTreeNodeClass;
FOnCompare: TListSortCompare;
FOnObjectCompare: TObjectSortCompare;
@ -109,7 +107,7 @@ type
// search
property Root: TAvgLvlTreeNode read fRoot;
property Count: integer read FCount;
property Count: SizeInt read FCount;
function Compare(Data1, Data2: Pointer): integer;
function Find(Data: Pointer): TAvgLvlTreeNode;
function FindKey(Key: Pointer;
@ -1527,8 +1525,8 @@ begin
FRoot.ConsistencyCheck(Self);
RealCount:=FRoot.GetCount;
end;
if FCount<>RealCount then
E('FCount<>RealCount');
if Count<>RealCount then
E('Count<>RealCount');
end;
procedure TAvgLvlTree.FreeAndClear;

View File

@ -113,7 +113,7 @@ type
public
constructor Create(AIdType: TMapIdType; ADataSize: Cardinal);
procedure Clear;
function Count: Integer;
function Count: SizeInt;
function Delete(const AId): Boolean;
destructor Destroy; override;
end;
@ -246,7 +246,7 @@ begin
end;
end;
function TBaseMap.Count: Integer;
function TBaseMap.Count: SizeInt;
begin
Result := FTree.Count;
end;