@@ -8,7 +8,7 @@ uses | |||
// test cases | |||
uutlAlgorithmTests, uutlEnumeratorTests, uutlHashSetTests, uutlLinqTests, | |||
uutlListTest, uutlMapTests, uutlQueueTests, uutlStackTests, | |||
uutlListTest, uutlMapTests, uutlQueueTests, uutlStackTests, uutlObservableListTests, | |||
// test misc | |||
uTestHelper, | |||
@@ -16,7 +16,7 @@ uses | |||
// units unter test | |||
uutlAlgorithm, uutlArrayContainer, uutlCommon, uutlComparer, uutlEnumerator, | |||
uutlFilter, uutlGenerics, uutlInterfaces, uutlLinq, uutlListBase, uutlLogger, | |||
uutlStreamHelper, uutlSyncObjs, uutlTypes, uutlXmlHelper, uutlObservable, uutlObservableListTests; | |||
uutlStreamHelper, uutlSyncObjs, uutlTypes, uutlXmlHelper, uutlObservable; | |||
{$R *.res} | |||
@@ -8,42 +8,45 @@ | |||
<Unit0> | |||
<Filename Value="tests.lpr"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<CursorPos X="23" Y="10"/> | |||
<UsageCount Value="70"/> | |||
<IsVisibleTab Value="True"/> | |||
<EditorIndex Value="8"/> | |||
<CursorPos X="87" Y="18"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit0> | |||
<Unit1> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="1"/> | |||
<CursorPos X="26" Y="504"/> | |||
<UsageCount Value="70"/> | |||
<TopLine Value="310"/> | |||
<CursorPos X="65" Y="333"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit1> | |||
<Unit2> | |||
<Filename Value="..\uutlArrayContainer.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="96"/> | |||
<CursorPos X="50" Y="115"/> | |||
<UsageCount Value="70"/> | |||
<EditorIndex Value="6"/> | |||
<CursorPos X="11" Y="13"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit2> | |||
<Unit3> | |||
<Filename Value="..\uutlCommon.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="351"/> | |||
<CursorPos X="12" Y="356"/> | |||
<UsageCount Value="70"/> | |||
<EditorIndex Value="9"/> | |||
<TopLine Value="44"/> | |||
<CursorPos X="3" Y="59"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit3> | |||
<Unit4> | |||
<Filename Value="..\uutlListBase.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="85"/> | |||
<CursorPos Y="104"/> | |||
<UsageCount Value="70"/> | |||
<EditorIndex Value="1"/> | |||
<TopLine Value="41"/> | |||
<CursorPos X="14" Y="54"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit4> | |||
<Unit5> | |||
<Filename Value="uutlListTest.pas"/> | |||
@@ -52,35 +55,39 @@ | |||
<WindowIndex Value="1"/> | |||
<TopLine Value="357"/> | |||
<CursorPos X="7" Y="376"/> | |||
<UsageCount Value="70"/> | |||
<UsageCount Value="72"/> | |||
</Unit5> | |||
<Unit6> | |||
<Filename Value="uutlQueueTests.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<UsageCount Value="70"/> | |||
<EditorIndex Value="7"/> | |||
<TopLine Value="250"/> | |||
<CursorPos X="49" Y="260"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit6> | |||
<Unit7> | |||
<Filename Value="uutlStackTests.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<CursorPos X="3" Y="9"/> | |||
<UsageCount Value="70"/> | |||
<EditorIndex Value="2"/> | |||
<TopLine Value="246"/> | |||
<CursorPos X="24" Y="263"/> | |||
<UsageCount Value="72"/> | |||
<Loaded Value="True"/> | |||
</Unit7> | |||
<Unit8> | |||
<Filename Value="uTestHelper.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<CursorPos X="3" Y="12"/> | |||
<UsageCount Value="70"/> | |||
<UsageCount Value="72"/> | |||
</Unit8> | |||
<Unit9> | |||
<Filename Value="..\uutlComparer.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="4"/> | |||
<EditorIndex Value="-1"/> | |||
<CursorPos X="90" Y="6"/> | |||
<UsageCount Value="60"/> | |||
<Loaded Value="True"/> | |||
<UsageCount Value="62"/> | |||
</Unit9> | |||
<Unit10> | |||
<Filename Value="..\uutlAlgorithm.pas"/> | |||
@@ -88,14 +95,14 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="115"/> | |||
<CursorPos Y="132"/> | |||
<UsageCount Value="70"/> | |||
<UsageCount Value="72"/> | |||
</Unit10> | |||
<Unit11> | |||
<Filename Value="uutlHashSetTests.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<CursorPos X="32" Y="13"/> | |||
<UsageCount Value="70"/> | |||
<UsageCount Value="72"/> | |||
</Unit11> | |||
<Unit12> | |||
<Filename Value="uutlAlgorithmTests.pas"/> | |||
@@ -103,7 +110,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="72"/> | |||
<CursorPos X="43" Y="87"/> | |||
<UsageCount Value="69"/> | |||
<UsageCount Value="71"/> | |||
</Unit12> | |||
<Unit13> | |||
<Filename Value="uutlMapTests.pas"/> | |||
@@ -111,67 +118,66 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="206"/> | |||
<CursorPos X="66" Y="221"/> | |||
<UsageCount Value="68"/> | |||
<UsageCount Value="70"/> | |||
</Unit13> | |||
<Unit14> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="6"/> | |||
<CursorPos X="3" Y="10"/> | |||
<UsageCount Value="67"/> | |||
<EditorIndex Value="3"/> | |||
<TopLine Value="118"/> | |||
<CursorPos X="18" Y="127"/> | |||
<UsageCount Value="69"/> | |||
<Loaded Value="True"/> | |||
</Unit14> | |||
<Unit15> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<TopLine Value="69"/> | |||
<CursorPos X="3" Y="64"/> | |||
<UsageCount Value="67"/> | |||
<EditorIndex Value="4"/> | |||
<TopLine Value="49"/> | |||
<CursorPos X="8" Y="66"/> | |||
<UsageCount Value="69"/> | |||
<Loaded Value="True"/> | |||
</Unit15> | |||
<Unit16> | |||
<Filename Value="..\uutlFilter.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="5"/> | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="17"/> | |||
<CursorPos X="13" Y="159"/> | |||
<UsageCount Value="63"/> | |||
<Loaded Value="True"/> | |||
<UsageCount Value="65"/> | |||
</Unit16> | |||
<Unit17> | |||
<Filename Value="..\uutlInterfaces.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="3"/> | |||
<TopLine Value="68"/> | |||
<CursorPos X="47" Y="72"/> | |||
<UsageCount Value="63"/> | |||
<EditorIndex Value="10"/> | |||
<TopLine Value="22"/> | |||
<CursorPos X="11" Y="37"/> | |||
<UsageCount Value="65"/> | |||
<Loaded Value="True"/> | |||
</Unit17> | |||
<Unit18> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<IsVisibleTab Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<WindowIndex Value="1"/> | |||
<TopLine Value="31"/> | |||
<CursorPos X="3" Y="52"/> | |||
<UsageCount Value="54"/> | |||
<Loaded Value="True"/> | |||
<UsageCount Value="56"/> | |||
</Unit18> | |||
<Unit19> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<IsVisibleTab Value="True"/> | |||
<EditorIndex Value="2"/> | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="252"/> | |||
<CursorPos X="70" Y="270"/> | |||
<UsageCount Value="54"/> | |||
<Loaded Value="True"/> | |||
<CursorPos X="30" Y="264"/> | |||
<UsageCount Value="56"/> | |||
</Unit19> | |||
<Unit20> | |||
<Filename Value="..\uutlTypes.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="7"/> | |||
<UsageCount Value="54"/> | |||
<EditorIndex Value="11"/> | |||
<UsageCount Value="56"/> | |||
<Loaded Value="True"/> | |||
</Unit20> | |||
<Unit21> | |||
@@ -180,7 +186,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="241"/> | |||
<CursorPos X="20" Y="263"/> | |||
<UsageCount Value="48"/> | |||
<UsageCount Value="50"/> | |||
</Unit21> | |||
<Unit22> | |||
<Filename Value="..\uutlLogger.pas"/> | |||
@@ -188,7 +194,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="419"/> | |||
<CursorPos X="55" Y="434"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit22> | |||
<Unit23> | |||
<Filename Value="..\uutlXmlHelper.pas"/> | |||
@@ -196,7 +202,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="188"/> | |||
<CursorPos X="26" Y="203"/> | |||
<UsageCount Value="47"/> | |||
<UsageCount Value="49"/> | |||
</Unit23> | |||
<Unit24> | |||
<Filename Value="..\uutlStreamHelper.pas"/> | |||
@@ -204,7 +210,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="216"/> | |||
<CursorPos X="10" Y="241"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit24> | |||
<Unit25> | |||
<Filename Value="..\uutlCompression.pas"/> | |||
@@ -213,7 +219,7 @@ | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="-1"/> | |||
<CursorPos X="-1" Y="-1"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit25> | |||
<Unit26> | |||
<Filename Value="..\uutlEmbeddedProfiler.pas"/> | |||
@@ -222,7 +228,7 @@ | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="-1"/> | |||
<CursorPos X="-1" Y="-1"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit26> | |||
<Unit27> | |||
<Filename Value="..\uutlKeyCodes.pas"/> | |||
@@ -231,7 +237,7 @@ | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="-1"/> | |||
<CursorPos X="-1" Y="-1"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit27> | |||
<Unit28> | |||
<Filename Value="..\uutlMCF.pas"/> | |||
@@ -240,7 +246,7 @@ | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="-1"/> | |||
<CursorPos X="-1" Y="-1"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit28> | |||
<Unit29> | |||
<Filename Value="..\uutlSScanf.pas"/> | |||
@@ -249,7 +255,7 @@ | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="-1"/> | |||
<CursorPos X="-1" Y="-1"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit29> | |||
<Unit30> | |||
<Filename Value="..\uutlThreads.pas"/> | |||
@@ -258,14 +264,14 @@ | |||
<WindowIndex Value="-1"/> | |||
<TopLine Value="-1"/> | |||
<CursorPos X="-1" Y="-1"/> | |||
<UsageCount Value="46"/> | |||
<UsageCount Value="48"/> | |||
</Unit30> | |||
<Unit31> | |||
<Filename Value="..\uutlEvent.pas"/> | |||
<IsPartOfProject Value="True"/> | |||
<EditorIndex Value="-1"/> | |||
<CursorPos X="54" Y="9"/> | |||
<UsageCount Value="45"/> | |||
<UsageCount Value="47"/> | |||
</Unit31> | |||
<Unit32> | |||
<Filename Value="..\uutlEventManager.pas"/> | |||
@@ -273,7 +279,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="246"/> | |||
<CursorPos X="39" Y="264"/> | |||
<UsageCount Value="45"/> | |||
<UsageCount Value="47"/> | |||
</Unit32> | |||
<Unit33> | |||
<Filename Value="..\uutlObservable.pas"/> | |||
@@ -281,7 +287,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="134"/> | |||
<CursorPos X="13" Y="147"/> | |||
<UsageCount Value="45"/> | |||
<UsageCount Value="47"/> | |||
</Unit33> | |||
<Unit34> | |||
<Filename Value="uutlObservableListTests.pas"/> | |||
@@ -289,7 +295,7 @@ | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="24"/> | |||
<CursorPos X="76" Y="130"/> | |||
<UsageCount Value="37"/> | |||
<UsageCount Value="39"/> | |||
</Unit34> | |||
<Unit35> | |||
<Filename Value="..\uutlExceptions.pas"/> | |||
@@ -344,10 +350,11 @@ | |||
</Unit41> | |||
<Unit42> | |||
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\objpas\objpas.pp"/> | |||
<EditorIndex Value="-1"/> | |||
<TopLine Value="63"/> | |||
<CursorPos X="16" Y="78"/> | |||
<UsageCount Value="11"/> | |||
<EditorIndex Value="5"/> | |||
<TopLine Value="64"/> | |||
<CursorPos X="19" Y="79"/> | |||
<UsageCount Value="12"/> | |||
<Loaded Value="True"/> | |||
</Unit42> | |||
<Unit43> | |||
<Filename Value="G:\Eigene Datein\Projekte\_Active Projekte\TotoStarRedesign\utils\uutlAlgorithm.pas"/> | |||
@@ -478,131 +485,131 @@ | |||
</OtherDefines> | |||
<JumpHistory Count="30" HistoryIndex="29"> | |||
<Position1> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="784" Column="21" TopLine="773"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="1120" Column="38" TopLine="1109"/> | |||
</Position1> | |||
<Position2> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="139" Column="35" TopLine="120"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="315" Column="46" TopLine="299"/> | |||
</Position2> | |||
<Position3> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="159" Column="46" TopLine="143"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="491" TopLine="483"/> | |||
</Position3> | |||
<Position4> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="832" Column="39" TopLine="810"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="1278" Column="26" TopLine="1265"/> | |||
</Position4> | |||
<Position5> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="838" Column="20" TopLine="811"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="333" Column="23" TopLine="310"/> | |||
</Position5> | |||
<Position6> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<Caret Line="432" Column="38" TopLine="402"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="411" Column="22" TopLine="398"/> | |||
</Position6> | |||
<Position7> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="829" Column="57" TopLine="813"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="1333" Column="64" TopLine="1330"/> | |||
</Position7> | |||
<Position8> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="915" Column="28" TopLine="899"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="1339" Column="3" TopLine="1336"/> | |||
</Position8> | |||
<Position9> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="299" Column="42" TopLine="292"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="1578" TopLine="1549"/> | |||
</Position9> | |||
<Position10> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="914" Column="32" TopLine="899"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="328" Column="33" TopLine="306"/> | |||
</Position10> | |||
<Position11> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="935" Column="28" TopLine="920"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="1115" Column="36" TopLine="1100"/> | |||
</Position11> | |||
<Position12> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="305" Column="64" TopLine="284"/> | |||
<Filename Value="..\uutlGenerics.pas"/> | |||
<Caret Line="333" Column="65" TopLine="310"/> | |||
</Position12> | |||
<Position13> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<Caret Line="413" Column="15" TopLine="401"/> | |||
<Filename Value="..\uutlInterfaces.pas"/> | |||
<Caret Line="12" Column="41"/> | |||
</Position13> | |||
<Position14> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="689" Column="8" TopLine="669"/> | |||
<Filename Value="..\uutlInterfaces.pas"/> | |||
<Caret Line="64" Column="124" TopLine="34"/> | |||
</Position14> | |||
<Position15> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="821" Column="61" TopLine="808"/> | |||
<Filename Value="..\uutlInterfaces.pas"/> | |||
<Caret Line="38" Column="5" TopLine="32"/> | |||
</Position15> | |||
<Position16> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="947" TopLine="873"/> | |||
<Filename Value="..\uutlInterfaces.pas"/> | |||
<Caret Line="11" Column="10"/> | |||
</Position16> | |||
<Position17> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="12" Column="11"/> | |||
<Caret Line="10" Column="14"/> | |||
</Position17> | |||
<Position18> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret Line="64" Column="3" TopLine="69"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="485" Column="3" TopLine="500"/> | |||
</Position18> | |||
<Position19> | |||
<Filename Value="..\uutlInterfaces.pas"/> | |||
<Caret Line="89" Column="15" TopLine="69"/> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret Line="16" Column="45"/> | |||
</Position19> | |||
<Position20> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<Caret Line="10" Column="25"/> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret Line="80" Column="32" TopLine="65"/> | |||
</Position20> | |||
<Position21> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="63" Column="24" TopLine="51"/> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret TopLine="63"/> | |||
</Position21> | |||
<Position22> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<Caret Line="242" Column="34" TopLine="227"/> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret Line="80" Column="32" TopLine="65"/> | |||
</Position22> | |||
<Position23> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<Caret Line="432" Column="9" TopLine="405"/> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret Line="67" Column="3" TopLine="52"/> | |||
</Position23> | |||
<Position24> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="265" Column="51" TopLine="256"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="107" Column="11" TopLine="92"/> | |||
</Position24> | |||
<Position25> | |||
<Filename Value="..\uutlLinq.pas"/> | |||
<Caret Line="395" Column="36" TopLine="381"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="64" Column="11" TopLine="49"/> | |||
</Position25> | |||
<Position26> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="59" Column="12" TopLine="121"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="21" Column="35" TopLine="3"/> | |||
</Position26> | |||
<Position27> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="269" Column="34" TopLine="258"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="13" Column="3" TopLine="4"/> | |||
</Position27> | |||
<Position28> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="852" TopLine="824"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="162" TopLine="146"/> | |||
</Position28> | |||
<Position29> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="27" Column="38" TopLine="12"/> | |||
<Filename Value="uutlEnumeratorTests.pas"/> | |||
<Caret Line="66" Column="8" TopLine="49"/> | |||
</Position29> | |||
<Position30> | |||
<Filename Value="uutlLinqTests.pas"/> | |||
<Caret Line="82" Column="49" TopLine="67"/> | |||
<Filename Value="..\uutlEnumerator.pas"/> | |||
<Caret Line="127" Column="18" TopLine="118"/> | |||
</Position30> | |||
</JumpHistory> | |||
</ProjectSession> | |||
<Debugging> | |||
<Watches Count="1"> | |||
<Item1> | |||
<Expression Value="(aArray+2)^"/> | |||
<Expression Value="fCount"/> | |||
</Item1> | |||
</Watches> | |||
</Debugging> | |||
@@ -13,7 +13,7 @@ uses | |||
type | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
IIntEnumerator = specialize {$IFDEF UTL_ENUMERATORS}IutlEnumerator{$ELSE}IEnumerator{$ENDIF}<Integer>; | |||
IIntEnumerator = specialize IutlEnumerator<Integer>; | |||
TutlEnumeratorTests = class(TTestCase) | |||
protected | |||
fEnumerator: IIntEnumerator; | |||
@@ -60,8 +60,10 @@ type | |||
implementation | |||
{$IF DEFINED(UTL_ENUMERATORS) AND DEFINED(UTL_ADVANCED_ENUMERATORS)} | |||
uses | |||
uutlFilter, uutlComparer; | |||
{$ENDIF} | |||
type | |||
TIntArrayEnumerator = specialize TutlArrayEnumerator<Integer>; | |||
@@ -35,6 +35,7 @@ type | |||
procedure Meth_EnqueueDequeue100_ObjectOwned_WithoutFree; | |||
procedure Meth_EnqueueDequeue100_ObjectNotOwned_WithFree; | |||
procedure Meth_EnqueueDequeue100_ObjectNotOwned_WithoutFree; | |||
procedure Enumerate; | |||
procedure Dtor_FreesAllItems; | |||
end; | |||
@@ -249,6 +250,30 @@ begin | |||
end; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlQueueTests.Enumerate; | |||
var | |||
e: TIntQueue.IutlEnumerator; | |||
begin | |||
e := fIntQueue.GetUtlEnumerator; | |||
fIntQueue.Enqueue(1); | |||
fIntQueue.Enqueue(2); | |||
fIntQueue.Enqueue(3); | |||
fIntQueue.Enqueue(4); | |||
fIntQueue.Enqueue(5); | |||
fIntQueue.Dequeue; | |||
fIntQueue.Dequeue; | |||
fIntQueue[1] := 9; | |||
e.Reset; | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(3, e.GetCurrent); | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(9, e.GetCurrent); | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(5, e.GetCurrent); | |||
AssertFalse (e.MoveNext); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlQueueTests.Dtor_FreesAllItems; | |||
begin | |||
@@ -35,6 +35,7 @@ type | |||
procedure Meth_PushPop100_ObjectOwnedByStack_WithoutFree; | |||
procedure Meth_PushPop100_ObjectNotOwned_WithFree; | |||
procedure Meth_PushPop100_ObjectNotOwned_WithoutFree; | |||
procedure Enumerate; | |||
procedure Dtor_FreesAllItems; | |||
end; | |||
@@ -249,6 +250,32 @@ begin | |||
end; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlStackTests.Enumerate; | |||
var | |||
e: TIntStack.IutlEnumerator; | |||
begin | |||
e := fIntStack.GetUtlEnumerator; | |||
fIntStack.Push(1); | |||
fIntStack.Push(2); | |||
fIntStack.Push(3); | |||
fIntStack.Push(4); | |||
fIntStack.Push(5); | |||
fIntStack[2] := 9; | |||
e.Reset; | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(1, e.GetCurrent); | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(2, e.GetCurrent); | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(9, e.GetCurrent); | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(4, e.GetCurrent); | |||
AssertTrue (e.MoveNext); | |||
AssertEquals(5, e.GetCurrent); | |||
AssertFalse (e.MoveNext); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlStackTests.Dtor_FreesAllItems; | |||
begin | |||
@@ -6,17 +6,18 @@ interface | |||
uses | |||
Classes, SysUtils, | |||
uutlInterfaces, uutlTypes | |||
uutlTypes, uutlInterfaces | |||
{$IFDEF UTL_ADVANCED_ENUMERATORS} | |||
, uutlAlgorithm | |||
{$ENDIF}; | |||
{$ENDIF} | |||
; | |||
type | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
generic TutlEnumerator<T> = class( | |||
TInterfacedObject | |||
, specialize IEnumerator<T> | |||
{$IFDEF UTL_ENUMERATORS}, specialize IutlEnumerator<T>{$ENDIF}) | |||
, specialize IutlEnumerator<T>) | |||
public type | |||
{$IFDEF UTL_ENUMERATORS} | |||
@@ -6,34 +6,57 @@ interface | |||
uses | |||
Classes, SysUtils, typinfo, | |||
uutlCommon, uutlArrayContainer, uutlListBase, uutlComparer, uutlAlgorithm, uutlInterfaces; | |||
uutlCommon, uutlArrayContainer, uutlListBase, uutlComparer, uutlAlgorithm, uutlInterfaces, | |||
uutlEnumerator; | |||
type | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
generic TutlQueue<T> = class( | |||
specialize TutlArrayContainer<T> | |||
, specialize IEnumerable<T> | |||
{$IFDEF UTL_ENUMERATORS} | |||
, specialize IutlEnumerable<T> | |||
{$ENDIF}) | |||
, specialize IutlReadOnlyArray<T>) | |||
private type | |||
TEnumerator = class( | |||
specialize TutlEnumerator<T> | |||
, specialize IEnumerator<T> | |||
, specialize IutlEnumerator<T>) | |||
strict private | |||
fOwner: TutlQueue; | |||
fCurrent: Integer; | |||
public { IEnumerator } | |||
function GetCurrent: T; override; | |||
function MoveNext: Boolean; override; | |||
procedure Reset; override; | |||
public | |||
constructor Create(const aOwner: TutlQueue); | |||
end; | |||
public type | |||
IEnumerator = specialize IEnumerator<T>; | |||
IutlEnumerator = specialize IutlEnumerator<T>; | |||
strict private | |||
fCount: Integer; | |||
fReadPos: Integer; | |||
fWritePos: Integer; | |||
function GetItem(const aIndex: Integer): T; | |||
procedure SetItem(const aIndex: Integer; aItem: T); | |||
protected | |||
function GetCount: Integer; override; | |||
procedure SetCount(const aValue: Integer); override; | |||
procedure SetCapacity(const aValue: integer); override; | |||
public { IEnumerable } | |||
function GetEnumerator: specialize IEnumerator<T>; | |||
function GetEnumerator: IEnumerator; | |||
{$IFDEF UTL_ENUMERATORS} | |||
public { IutlEnumerable } | |||
function GetUtlEnumerator: specialize IutlEnumerator<T>; | |||
{$ENDIF} | |||
function GetUtlEnumerator: IutlEnumerator; | |||
public | |||
property Count: Integer read GetCount; | |||
@@ -42,6 +65,7 @@ type | |||
property CanExpand; | |||
property CanShrink; | |||
property OwnsItems; | |||
property Items[const aIndex: Integer]: T read GetItem write SetItem; default; | |||
procedure Enqueue(constref aItem: T); | |||
function Dequeue: T; | |||
@@ -58,24 +82,43 @@ type | |||
generic TutlStack<T> = class( | |||
specialize TutlArrayContainer<T> | |||
, specialize IEnumerable<T> | |||
{$IFDEF UTL_ENUMERATORS} | |||
, specialize IutlEnumerable<T> | |||
{$ENDIF}) | |||
, specialize IutlReadOnlyArray<T>) | |||
private type | |||
TEnumerator = class( | |||
specialize TutlMemoryEnumerator<T> | |||
, specialize IEnumerator<T> | |||
, specialize IutlEnumerator<T>) | |||
private | |||
fOwner: TutlStack; | |||
public { IEnumerator } | |||
procedure Reset; override; | |||
public | |||
constructor Create(const aOwner: TutlStack); reintroduce; | |||
end; | |||
public type | |||
IEnumerator = specialize IEnumerator<T>; | |||
IutlEnumerator = specialize IutlEnumerator<T>; | |||
strict private | |||
fCount: Integer; | |||
function GetItem(const aIndex: Integer): T; | |||
procedure SetItem(const aIndex: Integer; aValue: T); | |||
protected | |||
function GetCount: Integer; override; | |||
procedure SetCount(const aValue: Integer); override; | |||
public { IEnumerable } | |||
function GetEnumerator: specialize IEnumerator<T>; | |||
function GetEnumerator: IEnumerator; | |||
{$IFDEF UTL_ENUMERATORS} | |||
public { IUtlEnumerable } | |||
function GetUtlEnumerator: specialize IutlEnumerator<T>; | |||
{$ENDIF} | |||
public { IutlEnumerable } | |||
function GetUtlEnumerator: IutlEnumerator; | |||
public | |||
property Count: Integer read GetCount; | |||
@@ -84,6 +127,7 @@ type | |||
property CanExpand; | |||
property CanShrink; | |||
property OwnsItems; | |||
property Items[const aIndex: Integer]: T read GetItem write SetItem; default; | |||
procedure Push(constref aItem: T); | |||
function Pop: T; | |||
@@ -202,9 +246,7 @@ type | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
generic TutlCustomMap<TKey, TValue> = class( | |||
TutlInterfaceNoRefCount | |||
{$IFDEF UTL_ENUMERATORS} | |||
, specialize IutlEnumerable<TValue> | |||
{$ENDIF}) | |||
, specialize IutlEnumerable<TValue>) | |||
public type | |||
//////////////////////////////////////////////////////////////////////////////////////////////// | |||
@@ -213,6 +255,14 @@ type | |||
Value: TValue; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////// | |||
IValueEnumerator = specialize IEnumerator<TValue>; | |||
IutlValueEnumerator = specialize IutlEnumerator<TValue>; | |||
IKeyEnumerator = specialize IEnumerator<TKey>; | |||
IutlKeyEnumerator = specialize IutlEnumerator<TKey>; | |||
IKeyValuePairEnumerator = specialize IEnumerator<TKeyValuePair>; | |||
IutlKeyValuePairEnumerator = specialize IutlEnumerator<TKeyValuePair>; | |||
//////////////////////////////////////////////////////////////////////////////////////////////// | |||
THashSet = class( | |||
specialize TutlCustomHashSet<TKeyValuePair>) | |||
@@ -247,24 +297,56 @@ type | |||
destructor Destroy; override; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////// | |||
TKeyEnumerator = class( | |||
specialize TutlEnumerator<TKey> | |||
, IKeyEnumerator | |||
, IutlKeyEnumerator) | |||
strict private | |||
fEnumerator: IutlKeyValuePairEnumerator; | |||
public { IEnumerator } | |||
function GetCurrent: TKey; override; | |||
function MoveNext: Boolean; override; | |||
procedure Reset; override; | |||
public | |||
constructor Create(aEnumerator: IutlKeyValuePairEnumerator); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////// | |||
TValueEnumerator = class( | |||
specialize TutlEnumerator<TValue> | |||
, IValueEnumerator | |||
, IutlValueEnumerator) | |||
strict private | |||
fEnumerator: IutlKeyValuePairEnumerator; | |||
public { IEnumerator } | |||
function GetCurrent: TValue; override; | |||
function MoveNext: Boolean; override; | |||
procedure Reset; override; | |||
public | |||
constructor Create(aEnumerator: IutlKeyValuePairEnumerator); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////// | |||
TKeyCollection = class( | |||
TutlInterfaceNoRefCount | |||
, specialize IutlReadOnlyArray<TKey> | |||
{$IFDEF UTL_ENUMERATORS} | |||
, specialize IutlEnumerable<TKey> | |||
{$ENDIF}) | |||
, specialize IutlEnumerable<TKey>) | |||
strict private | |||
fHashSet: THashSet; | |||
public { IEnumerable } | |||
function GetEnumerator: specialize IEnumerator<TKey>; | |||
function GetEnumerator: IKeyEnumerator; | |||
{$IFDEF UTL_ENUMERATORS} | |||
public { IutlEnumerable } | |||
function GetUtlEnumerator: specialize IutlEnumerator<TKey>; | |||
{$ENDIF} | |||
function GetUtlEnumerator: IutlKeyEnumerator; | |||
public { IutlReadOnlyArray } | |||
function GetCount: Integer; | |||
@@ -281,20 +363,16 @@ type | |||
TKeyValuePairCollection = class( | |||
TutlInterfaceNoRefCount | |||
, specialize IutlReadOnlyArray<TKeyValuePair> | |||
{$IFDEF UTL_ENUMERATORS} | |||
, specialize IutlEnumerable<TKeyValuePair> | |||
{$ENDIF}) | |||
, specialize IutlEnumerable<TKeyValuePair>) | |||
strict private | |||
fHashSet: THashSet; | |||
public { IEnumerable } | |||
function GetEnumerator: specialize IEnumerator<TKeyValuePair>; | |||
function GetEnumerator: IKeyValuePairEnumerator; | |||
{$IFDEF UTL_ENUMERATORS} | |||
public { IutlEnumerable } | |||
function GetUtlEnumerator: specialize IutlEnumerator<TKeyValuePair>; | |||
{$ENDIF} | |||
function GetUtlEnumerator: IutlKeyValuePairEnumerator; | |||
public { IutlReadOnlyArray } | |||
function GetCount: Integer; | |||
@@ -330,12 +408,10 @@ type | |||
procedure SetCanExpand (const aValue: Boolean); inline; | |||
public { IEnumerable } | |||
function GetEnumerator: specialize IEnumerator<TValue>; | |||
function GetEnumerator: IValueEnumerator; | |||
{$IFDEF UTL_ENUMERATORS} | |||
public { IutlEnumerable } | |||
function GetUtlEnumerator: specialize IutlEnumerator<TValue>; | |||
{$ENDIF} | |||
function GetUtlEnumerator: IutlValueEnumerator; | |||
public | |||
property Values [aKey: TKey]: TValue read GetValue write SetValue; default; | |||
@@ -412,8 +488,64 @@ type | |||
implementation | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlQueue.TEnumerator///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlQueue.TEnumerator.GetCurrent: T; | |||
begin | |||
result := fOwner[fCurrent]; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlQueue.TEnumerator.MoveNext: Boolean; | |||
begin | |||
inc(fCurrent); | |||
result := (fCurrent < fOwner.Count); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlQueue.TEnumerator.Reset; | |||
begin | |||
fCurrent := -1; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
constructor TutlQueue.TEnumerator.Create(const aOwner: TutlQueue); | |||
begin | |||
if not Assigned(aOwner) then | |||
raise EArgumentNilException.Create('aOwner'); | |||
inherited Create; | |||
fOwner := aOwner; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlQueue///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlQueue.GetItem(const aIndex: Integer): T; | |||
var | |||
i: Integer; | |||
begin | |||
if (aIndex < 0) or (aIndex >= fCount) then | |||
raise EOutOfRangeException.Create(aIndex, 0, fCount-1); | |||
i := fReadPos + aIndex; | |||
if (i >= Capacity) then | |||
i := i - Capacity; | |||
result := GetInternalItem(i)^; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlQueue.SetItem(const aIndex: Integer; aItem: T); | |||
var | |||
i: Integer; | |||
begin | |||
if (aIndex < 0) or (aIndex >= fCount) then | |||
raise EOutOfRangeException.Create(aIndex, 0, fCount-1); | |||
i := fReadPos + aIndex; | |||
if (i >= Capacity) then | |||
i := i - Capacity; | |||
GetInternalItem(i)^ := aItem; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlQueue.GetCount: Integer; | |||
begin | |||
@@ -457,20 +589,16 @@ begin | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlQueue.GetEnumerator: specialize IEnumerator<T>; | |||
function TutlQueue.GetEnumerator: IEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TEnumerator.Create(self); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
{$IFDEF UTL_ENUMERATORS} | |||
function TutlQueue.GetUtlEnumerator: specialize IutlEnumerator<T>; | |||
function TutlQueue.GetUtlEnumerator: IutlEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TEnumerator.Create(self); | |||
end; | |||
{$ENDIF} | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlQueue.Enqueue(constref aItem: T); | |||
@@ -547,8 +675,46 @@ begin | |||
inherited Destroy; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlStack.TEnumerator///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlStack.TEnumerator.Reset; | |||
begin | |||
First := 0; | |||
Last := fOwner.Count-1; | |||
if (Last >= First) | |||
then Memory := fOwner.GetInternalItem(0) | |||
else Memory := nil; | |||
inherited Reset; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
constructor TutlStack.TEnumerator.Create(const aOwner: TutlStack); | |||
begin | |||
if not Assigned(aOwner) then | |||
raise EArgumentNilException.Create('aOwner'); | |||
inherited Create(nil, 0); | |||
fOwner := aOwner; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlStack///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlStack.GetItem(const aIndex: Integer): T; | |||
begin | |||
if (aIndex < 0) or (aIndex >= fCount) then | |||
raise EOutOfRangeException.Create(aIndex, 0, fCount-1); | |||
result := GetInternalItem(aIndex)^; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlStack.SetItem(const aIndex: Integer; aValue: T); | |||
begin | |||
if (aIndex < 0) or (aIndex >= fCount) then | |||
raise EOutOfRangeException.Create(aIndex, 0, fCount-1); | |||
GetInternalItem(aIndex)^ := aValue; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlStack.GetCount: Integer; | |||
begin | |||
@@ -562,20 +728,16 @@ begin | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlStack.GetEnumerator: specialize IEnumerator<T>; | |||
function TutlStack.GetEnumerator: IEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TEnumerator.Create(self); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
{$IFDEF UTL_ENUMERATORS} | |||
function TutlStack.GetUtlEnumerator: specialize IutlEnumerator<T>; | |||
function TutlStack.GetUtlEnumerator: IutlEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TEnumerator.Create(self); | |||
end; | |||
{$ENDIF} | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlStack.Push(constref aItem: T); | |||
@@ -945,23 +1107,77 @@ begin | |||
inherited Destroy; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlCustomMap.TKeyEnumerator////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TKeyEnumerator.GetCurrent: TKey; | |||
begin | |||
result := fEnumerator.GetCurrent.Key; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TKeyEnumerator.MoveNext: Boolean; | |||
begin | |||
result := fEnumerator.MoveNext; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlCustomMap.TKeyEnumerator.Reset; | |||
begin | |||
fEnumerator.Reset; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
constructor TutlCustomMap.TKeyEnumerator.Create(aEnumerator: IutlKeyValuePairEnumerator); | |||
begin | |||
if not Assigned(aEnumerator) then | |||
raise EArgumentNilException.Create('aEnumerator'); | |||
inherited Create; | |||
fEnumerator := aEnumerator; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlCustomMap.TValueEnumerator//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TValueEnumerator.GetCurrent: TValue; | |||
begin | |||
result := fEnumerator.GetCurrent.Value; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TValueEnumerator.MoveNext: Boolean; | |||
begin | |||
result := fEnumerator.MoveNext; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlCustomMap.TValueEnumerator.Reset; | |||
begin | |||
fEnumerator.Reset; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
constructor TutlCustomMap.TValueEnumerator.Create(aEnumerator: IutlKeyValuePairEnumerator); | |||
begin | |||
if not Assigned(aEnumerator) then | |||
raise EArgumentNilException.Create('aEnumerator'); | |||
inherited Create; | |||
fEnumerator := aEnumerator; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlCustomMap.TKeyCollection////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TKeyCollection.GetEnumerator: specialize IEnumerator<TKey>; | |||
function TutlCustomMap.TKeyCollection.GetEnumerator: IKeyEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TKeyEnumerator.Create(fHashSet.GetUtlEnumerator); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
{$IFDEF UTL_ENUMERATORS} | |||
function TutlCustomMap.TKeyCollection.GetUtlEnumerator: specialize IutlEnumerator<TKey>; | |||
function TutlCustomMap.TKeyCollection.GetUtlEnumerator: IutlKeyEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TKeyEnumerator.Create(fHashSet.GetUtlEnumerator); | |||
end; | |||
{$ENDIF} | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TKeyCollection.GetCount: Integer; | |||
@@ -985,20 +1201,16 @@ end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlCustomMap.TKeyValuePairCollection///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TKeyValuePairCollection.GetEnumerator: specialize IEnumerator<TKeyValuePair>; | |||
function TutlCustomMap.TKeyValuePairCollection.GetEnumerator: IKeyValuePairEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := fHashSet.GetEnumerator; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
{$IFDEF UTL_ENUMERATORS} | |||
function TutlCustomMap.TKeyValuePairCollection.GetUtlEnumerator: specialize IutlEnumerator<TKeyValuePair>; | |||
function TutlCustomMap.TKeyValuePairCollection.GetUtlEnumerator: IutlKeyValuePairEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := fHashSet.GetUtlEnumerator; | |||
end; | |||
{$ENDIF} | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.TKeyValuePairCollection.GetCount: Integer; | |||
@@ -1116,20 +1328,16 @@ begin | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlCustomMap.GetEnumerator: specialize IEnumerator<TValue>; | |||
function TutlCustomMap.GetEnumerator: IValueEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TValueEnumerator.Create(fHashSetRef.GetUtlEnumerator); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
{$IFDEF UTL_ENUMERATORS} | |||
function TutlCustomMap.GetUtlEnumerator: specialize IutlEnumerator<TValue>; | |||
function TutlCustomMap.GetUtlEnumerator: IutlValueEnumerator; | |||
begin | |||
result := nil; // TODO | |||
raise ENotSupportedException.Create('not yet supported'); | |||
result := TValueEnumerator.Create(fHashSetRef.GetUtlEnumerator); | |||
end; | |||
{$ENDIF} | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlCustomMap.Add(constref aKey: TKey; constref aValue: TValue); | |||
@@ -5,8 +5,10 @@ unit uutlInterfaces; | |||
interface | |||
uses | |||
Classes, SysUtils, | |||
uutlTypes; | |||
Classes, SysUtils | |||
{$IFDEF UTL_ENUMERATORS} | |||
, uutlTypes | |||
{$ENDIF}; | |||
type | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
@@ -35,6 +37,7 @@ type | |||
generic IutlEnumerator<T> = interface(specialize IEnumerator<T>) | |||
// TODO: Aggregate, Join | |||
{$IFDEF UTL_ENUMERATORS} | |||
function GetEnumerator: specialize IutlEnumerator<T>; | |||
// the following functions will execute the query | |||
@@ -62,6 +65,7 @@ type | |||
// generic function Aggregate<S> (constref aSeed: S; aAggregator: specialize IutlAggregator<T, S>): S; | |||
// generic function Zip<S> (aEnumerator: specialize IutlEnumerator<S>): specialize IutlEnumerator<specialize Pair<T, S>>; | |||
{$ENDIF} | |||
{$ENDIF} | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
@@ -6,15 +6,34 @@ interface | |||
uses | |||
Classes, SysUtils, | |||
uutlArrayContainer | |||
{$IFDEF UTL_ADVANCED_ENUMERATORS}, uutlInterfaces{$ENDIF}; | |||
uutlArrayContainer, uutlInterfaces, uutlEnumerator; | |||
type | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
generic TutlListBase<T> = class( | |||
specialize TutlArrayContainer<T> | |||
, specialize IEnumerable<T> | |||
{$IFDEF UTL_ADVANCED_ENUMERATORS}, specialize IutlEnumerable<T>{$ENDIF}) | |||
, specialize IutlEnumerable<T>) | |||
private type | |||
TEnumerator = class( | |||
specialize TutlMemoryEnumerator<T> | |||
, specialize IEnumerator<T> | |||
, specialize IutlEnumerator<T>) | |||
private | |||
fOwner: TutlListBase; | |||
public { IEnumerator } | |||
procedure Reset; override; | |||
public | |||
constructor Create(const aOwner: TutlListBase); reintroduce; | |||
end; | |||
public type | |||
IEnumerator = specialize IEnumerator<T>; | |||
IutlEnumerator = specialize IutlEnumerator<T>; | |||
strict private | |||
fCount: Integer; | |||
@@ -29,12 +48,10 @@ type | |||
procedure DeleteIntern(const aIndex: Integer; const aFreeItem: Boolean); virtual; | |||
public { IEnumerable } | |||
function GetEnumerator: specialize IEnumerator<T>; | |||
function GetEnumerator: IEnumerator; | |||
{$IFDEF UTL_ADVANCED_ENUMERATORS} | |||
public { IutlEnumerable } | |||
function GetUtlEnumerator: specialize IutlEnumerator<T>; | |||
{$ENDIF} | |||
function GetUtlEnumerator: IutlEnumerator; | |||
public | |||
property Count; | |||
@@ -54,7 +71,28 @@ type | |||
implementation | |||
uses | |||
uutlEnumerator, uutlCommon; | |||
uutlCommon; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlListBase.TEnumerator////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlListBase.TEnumerator.Reset; | |||
begin | |||
First := 0; | |||
Last := fOwner.Count-1; | |||
if (Last >= First) | |||
then Memory := fOwner.GetInternalItem(0) | |||
else Memory := nil; | |||
inherited Reset; | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
constructor TutlListBase.TEnumerator.Create(const aOwner: TutlListBase); | |||
begin | |||
if not Assigned(aOwner) then | |||
raise EArgumentNilException.Create('aOwner'); | |||
inherited Create(nil, 0); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
//TutlListBase////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
@@ -125,18 +163,16 @@ begin | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
function TutlListBase.GetEnumerator: specialize IEnumerator<T>; | |||
function TutlListBase.GetEnumerator: IEnumerator; | |||
begin | |||
result := specialize TutlMemoryEnumerator<T>.Create(GetInternalItem(0), Count); | |||
result := TEnumerator.Create(self); | |||
end; | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
{$IFDEF UTL_ADVANCED_ENUMERATORS} | |||
function TutlListBase.GetUtlEnumerator: specialize IutlEnumerator<T>; | |||
begin | |||
result := specialize TutlMemoryEnumerator<T>.Create(GetInternalItem(0), Count); | |||
result := TEnumerator.Create(self); | |||
end; | |||
{$ENDIF} | |||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
procedure TutlListBase.Clear; | |||