From 06db422b6162359b6eebe3e65278c3b02ca22770 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Sat, 5 Dec 2020 22:30:38 +0300 Subject: [PATCH] seq.CountOf(x) --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 2 +- Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/CompilationSamples/PABCSystem.pas | 10 +++++++++- bin/Lib/PABCSystem.pas | 10 +++++++++- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 0aa102a17..40eb0c6e7 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "7"; public const string Build = "1"; - public const string Revision = "2760"; + public const string Revision = "2762"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 9abd75a08..d2e7d5efc 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=1 -%REVISION%=2760 +%REVISION%=2762 %MINOR%=7 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 99e98bb82..fe3daabad 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.7.1.2760 +3.7.1.2762 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index bd7cfdec3..866e55e9a 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.7.1.2760' +!define VERSION '3.7.1.2762' diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 265dfc9de..ec6b68545 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -9798,7 +9798,6 @@ begin end; - /// Возвращает отсортированную по возрастанию последовательность function Sorted(Self: sequence of T): sequence of T; extensionmethod; begin @@ -10314,6 +10313,15 @@ end; // ToDo Сделать AdjacentGroup с функцией сравнения +/// Возвращает количество элементов, равных указанному значению +function CountOf(Self: sequence of T; x: T): integer; extensionmethod; +begin + Result := 0; + foreach var y in Self do + if y = x then + Result += 1; +end; + // ----------------------------------------------------- //>> Методы расширения списков # Extension methods for List T // ----------------------------------------------------- diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 265dfc9de..ec6b68545 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -9798,7 +9798,6 @@ begin end; - /// Возвращает отсортированную по возрастанию последовательность function Sorted(Self: sequence of T): sequence of T; extensionmethod; begin @@ -10314,6 +10313,15 @@ end; // ToDo Сделать AdjacentGroup с функцией сравнения +/// Возвращает количество элементов, равных указанному значению +function CountOf(Self: sequence of T; x: T): integer; extensionmethod; +begin + Result := 0; + foreach var y in Self do + if y = x then + Result += 1; +end; + // ----------------------------------------------------- //>> Методы расширения списков # Extension methods for List T // -----------------------------------------------------