From 37309d2817d146a8f01a11242b0470f708301583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Thu, 23 May 2024 22:07:58 +0200 Subject: [PATCH] Moved TBigIntPolynomial.IsEqualTo within the class --- UPolynomial.pas | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/UPolynomial.pas b/UPolynomial.pas index 9a4374f..aa3467d 100644 --- a/UPolynomial.pas +++ b/UPolynomial.pas @@ -38,8 +38,8 @@ type property Degree: Integer read GetDegree; property Coefficient[const AIndex: Integer]: TBigInt read GetCoefficient; function CalcValueAt(const AX: Int64): TBigInt; - function IsEqualTo(const AOther: TBigIntPolynomial): Boolean; function ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial; + function IsEqualTo(const AOther: TBigIntPolynomial): Boolean; function ToString: string; class function Create(const ACoefficients: array of TBigInt): TBigIntPolynomial; static; end; @@ -72,24 +72,6 @@ begin Result := Result * AX + FCoefficients[i]; end; -function TBigIntPolynomial.IsEqualTo(const AOther: TBigIntPolynomial): Boolean; -var - i: Integer; -begin - if Length(FCoefficients) = Length(AOther.FCoefficients) then - begin - Result := True; - for i := 0 to Length(FCoefficients) - 1 do - if FCoefficients[i] <> AOther.FCoefficients[i] then - begin - Result := False; - Break; - end; - end - else - Result := False; -end; - function TBigIntPolynomial.ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial; var len, i: Integer; @@ -110,6 +92,24 @@ begin SetLength(Result.FCoefficients, 0); end; +function TBigIntPolynomial.IsEqualTo(const AOther: TBigIntPolynomial): Boolean; +var + i: Integer; +begin + if Length(FCoefficients) = Length(AOther.FCoefficients) then + begin + Result := True; + for i := 0 to Length(FCoefficients) - 1 do + if FCoefficients[i] <> AOther.FCoefficients[i] then + begin + Result := False; + Break; + end; + end + else + Result := False; +end; + function TBigIntPolynomial.ToString: string; var i: Integer;