mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-22 03:39:40 +02:00
IsEmpty function for Queue, to Delphi compatibility.
This commit is contained in:
parent
40f5549e77
commit
8df83483e4
@ -279,6 +279,7 @@ type
|
|||||||
private
|
private
|
||||||
FMaxGapLength: Integer;
|
FMaxGapLength: Integer;
|
||||||
FLow: SizeInt;
|
FLow: SizeInt;
|
||||||
|
function GetIsEmpty: Boolean;
|
||||||
protected
|
protected
|
||||||
function DoGetEnumerator: TEnumerator<T>; override;
|
function DoGetEnumerator: TEnumerator<T>; override;
|
||||||
public
|
public
|
||||||
@ -305,6 +306,8 @@ type
|
|||||||
function Peek: T;
|
function Peek: T;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure TrimExcess; override;
|
procedure TrimExcess; override;
|
||||||
|
|
||||||
|
property IsEmpty: Boolean read GetIsEmpty;
|
||||||
// Maximum gap (=amount of empty slots in array before first element)
|
// Maximum gap (=amount of empty slots in array before first element)
|
||||||
// before doing a rebase of the list. Defaults to 10.
|
// before doing a rebase of the list. Defaults to 10.
|
||||||
Property MaxGapLength : Integer Read FMaxGapLength Write FMaxGapLength;
|
Property MaxGapLength : Integer Read FMaxGapLength Write FMaxGapLength;
|
||||||
@ -1805,6 +1808,11 @@ begin
|
|||||||
Result := TEnumerator.Create(Self);
|
Result := TEnumerator.Create(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQueue<T>.GetIsEmpty: Boolean;
|
||||||
|
begin
|
||||||
|
Result := Count = 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQueue<T>.SetCapacity(AValue: SizeInt);
|
procedure TQueue<T>.SetCapacity(AValue: SizeInt);
|
||||||
begin
|
begin
|
||||||
if AValue < Count then
|
if AValue < Count then
|
||||||
|
Loading…
Reference in New Issue
Block a user