Skip to content

Commit

Permalink
Merge pull request #2 from BMWxi/patch-1
Browse files Browse the repository at this point in the history
Update SimbaExt_HashMap.pas
  • Loading branch information
slackydev committed Aug 12, 2015
2 parents 3c6e2cb + 4e9cfe8 commit 37416bb
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ObjMode/SimbaExt_HashMap.pas
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,21 @@ function THashMap.Get(Key: Variant; var Value: Int32): Boolean;
Result := False;
end;

function THashMap.Get(Key: Variant; var Value: Boolean): Boolean; overload;
var
h,i,l: Int32;
begin
if FLen = 0 then RaiseException('THashMap: Not yet initalized');
h := Self.Hash(Key);
l := High(Self.FTable[h]);
for i:=0 to l do
if CompareVarKeys(self.FTable[h][i].Key, Key) then
begin
Value := Self.FTable[h][i].Value;
Exit(True);
end;
Result := False;
end;

function THashMap.Get(Key: Variant; var Value: Double): Boolean; overload;
var
Expand Down Expand Up @@ -381,6 +396,20 @@ function THashMap.Get(Key: Variant): Variant; overload;
RaiseException('THashMap: Key "'+Key+'" was not found');
end;

function THashMap.Get(Key: Boolean): Variant; overload;
var
h,i,l: Int32;
begin
if FLen = 0 then RaiseException('THashMap: Not yet initalized');
h := Self.Hash(Key);
l := High(Self.FTable[h]);
for i:=0 to l do
if CompareVarKeys(self.FTable[h][i].Key, Key) then
Exit(Self.FTable[h][i].Value);

RaiseException(String('THashMap: Key '+ToString(Key)+' was not found'));
end;

function THashMap.Get(Key: Int32): Variant; overload;
var
h,i,l: Int32;
Expand Down

0 comments on commit 37416bb

Please sign in to comment.