Added TIntegerList and TPoints to common types

This commit is contained in:
Stefan Müller 2024-08-28 22:54:34 +02:00
parent 75aab50d42
commit b5576c66f1
4 changed files with 11 additions and 10 deletions

View File

@ -22,7 +22,7 @@ unit UCommon;
interface interface
uses uses
Classes, SysUtils; Classes, SysUtils, Generics.Collections;
type type
PPoint = ^TPoint; PPoint = ^TPoint;
@ -39,6 +39,10 @@ const
CDirectionLeftUp: TPoint = (X: -1; Y: -1); CDirectionLeftUp: TPoint = (X: -1; Y: -1);
CPCardinalDirections: array[0..3] of PPoint = (@CDirectionRight, @CDirectionDown, @CDirectionLeft, @CDirectionUp); CPCardinalDirections: array[0..3] of PPoint = (@CDirectionRight, @CDirectionDown, @CDirectionLeft, @CDirectionUp);
type
TIntegerList = specialize TList<Integer>;
TPoints = specialize TList<TPoint>;
implementation implementation
end. end.

View File

@ -22,7 +22,7 @@ unit UCosmicExpansion;
interface interface
uses uses
Classes, SysUtils, Generics.Collections, Math, USolver; Classes, SysUtils, Generics.Collections, Math, USolver, UCommon;
const const
CGalaxyChar = '#'; CGalaxyChar = '#';
@ -36,8 +36,8 @@ type
TCosmicExpansion = class(TSolver) TCosmicExpansion = class(TSolver)
private private
FExpansionFactor: Integer; FExpansionFactor: Integer;
FColumnExpansion, FRowExpansion: specialize TList<Integer>; FColumnExpansion, FRowExpansion: TIntegerList;
FGalaxies: specialize TList<TPoint>; FGalaxies: TPoints;
procedure InitColumnExpansion(const ASize: Integer); procedure InitColumnExpansion(const ASize: Integer);
public public
constructor Create(const AExpansionFactor: Integer = 999999); constructor Create(const AExpansionFactor: Integer = 999999);
@ -67,9 +67,9 @@ end;
constructor TCosmicExpansion.Create(const AExpansionFactor: Integer); constructor TCosmicExpansion.Create(const AExpansionFactor: Integer);
begin begin
FExpansionFactor := AExpansionFactor; FExpansionFactor := AExpansionFactor;
FColumnExpansion := specialize TList<Integer>.Create; FColumnExpansion := TIntegerList.Create;
FRowExpansion := specialize TList<Integer>.Create; FRowExpansion := TIntegerList.Create;
FGalaxies := specialize TList<TPoint>.Create; FGalaxies := TPoints.Create;
end; end;
destructor TCosmicExpansion.Destroy; destructor TCosmicExpansion.Destroy;

View File

@ -25,8 +25,6 @@ uses
Classes, SysUtils, Generics.Collections, USolver, UCommon; Classes, SysUtils, Generics.Collections, USolver, UCommon;
type type
TPoints = specialize TList<TPoint>;
TCrossing = class; TCrossing = class;
{ TPath } { TPath }

View File

@ -25,7 +25,6 @@ uses
Classes, SysUtils, Generics.Collections, USolver, UCommon; Classes, SysUtils, Generics.Collections, USolver, UCommon;
type type
TPoints = specialize TList<TPoint>;
{ TStepCounter } { TStepCounter }