Skip to content

Commit

Permalink
3/6/2024 - home
Browse files Browse the repository at this point in the history
  • Loading branch information
Yair-vilner committed Jun 3, 2024
1 parent 9e90e56 commit f81ff9a
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 8 deletions.
4 changes: 2 additions & 2 deletions oop1.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31515.178
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "oop1", "oop1\oop1.csproj", "{CE767026-B94B-4E52-8AEC-EFEC138BF643}"
EndProject
Expand Down
26 changes: 23 additions & 3 deletions oop1/ContinerOf16Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace oop1
{
public partial class MyColletion<T>
{
[Serializable]
protected internal class ContinerOf16Items<T1>
{
public T1 this[int index]
Expand Down Expand Up @@ -178,15 +179,34 @@ public ContinerOf16Items(T1 item0, T1 item1, T1 item2, T1 item3, T1 item4, T1 it
public ContinerOf16Items() { }

#if DEBUG
#region tests
static bool isTestsPassed = testIndexer();
internal static bool testIndexer()
{
var testContiner = new ContinerOf16Items<int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ContinerOf16Items<int> testContiner = new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
for (int i = 0; i < 16; i++)
if (!(testContiner[i] == i))
return false;
for (int i = 0; i < 16; i++)
testContiner[i] = 16;
}
testContiner[i] = 16 - i;
return testContiner.item0 == 16 - 0 &&
testContiner.item1 == 16 - 1 &&
testContiner.item2 == 16 - 2 &&
testContiner.item3 == 16 - 3 &&
testContiner.item4 == 16 - 4 &&
testContiner.item5 == 16 - 5 &&
testContiner.item6 == 16 - 6 &&
testContiner.item7 == 16 - 7 &&
testContiner.item8 == 16 - 8 &&
testContiner.item9 == 16 - 9 &&
testContiner.item10 == 16 - 10 &&
testContiner.item11 == 16 - 11 &&
testContiner.item12 == 16 - 12 &&
testContiner.item13 == 16 - 13 &&
testContiner.item14 == 16 - 14 &&
testContiner.item15 == 16 - 15;
}
#endregion
#endif
}
}
Expand Down
136 changes: 133 additions & 3 deletions oop1/MyColletion.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,151 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;

namespace oop1
{
[Serializable]
public partial class MyColletion<T> : IList<T>, IList, ICollection<T>, ICollection, IEnumerable<T>, IEnumerable
{
public T this[int index]
{
get
{

int level1 = index % 16;
index /= 16;
int level2 = index % 16;
index /= 16;
int level3 = index % 16;
index /= 16;
int level4 = index % 16;
index /= 16;
int level5 = index % 16;
index /= 16;
int level6 = index % 16;
index /= 16;
int level7 = index % 16;
index /= 16;
int level8 = index % 16;
index /= 16;
return internalStorage[level8][level7][level6][level5][level4][level3][level2][level1];
}
set
{

int level1 = index % 16;
index /= 16;
int level2 = index % 16;
index /= 16;
int level3 = index % 16;
index /= 16;
int level4 = index % 16;
index /= 16;
int level5 = index % 16;
index /= 16;
int level6 = index % 16;
index /= 16;
int level7 = index % 16;
index /= 16;
int level8 = index % 16;
index /= 16;
internalStorage[level8][level7][level6][level5][level4][level3][level2][level1] = value;
}
}
private ContinerOf16Items<ContinerOf16Items<ContinerOf16Items<ContinerOf16Items<ContinerOf16Items<ContinerOf16Items<ContinerOf16Items<ContinerOf16Items<T>>>>>>>> internalStorage;



public int Count => throw new NotImplementedException();

public bool IsReadOnly => throw new NotImplementedException();

bool IList.IsFixedSize => throw new NotImplementedException();

bool ICollection.IsSynchronized => throw new NotImplementedException();

object ICollection.SyncRoot => throw new NotImplementedException();

object IList.this[int index] { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

public MyColletion() { }

public int IndexOf(T item)
{
throw new NotImplementedException();
}

public void Insert(int index, T item)
{
throw new NotImplementedException();
}

public void RemoveAt(int index)
{
throw new NotImplementedException();
}

public void Add(T item)
{
throw new NotImplementedException();
}

public void Clear()
{
throw new NotImplementedException();
}

public bool Contains(T item)
{
throw new NotImplementedException();
}

public void CopyTo(T[] array, int arrayIndex)
{
throw new NotImplementedException();
}

public bool Remove(T item)
{
throw new NotImplementedException();
}

public IEnumerator<T> GetEnumerator()
{
throw new NotImplementedException();
}

IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}

int IList.Add(object value)
{
throw new NotImplementedException();
}

bool IList.Contains(object value)
{
throw new NotImplementedException();
}

int IList.IndexOf(object value)
{
throw new NotImplementedException();
}

void IList.Insert(int index, object value)
{
throw new NotImplementedException();
}

void IList.Remove(object value)
{
throw new NotImplementedException();
}

void ICollection.CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
}
}
23 changes: 23 additions & 0 deletions oop1Tests/oop1Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\oop1\oop1.csproj" />
</ItemGroup>

</Project>

0 comments on commit f81ff9a

Please sign in to comment.