Skip to content

Commit 97bf190

Browse files
Merge pull request #585 from ErikSchierboom/custom-set-generator
custom-set: Add generator
2 parents 360893c + 2fd0c31 commit 97bf190

File tree

5 files changed

+248
-263
lines changed

5 files changed

+248
-263
lines changed

exercises/custom-set/.meta/hints.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
## Hints
2-
This exercise requires you to implements a type-specific method for determining equality of instances.
3-
For more information, see [this page]
4-
(https://docs.microsoft.com/en-us/dotnet/core/api/System.IEquatable-1) .
2+
3+
This exercise requires you to create custom equality comparison logic.
4+
For more information, see [this page](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals?view=netcore-2.0#System_Object_Equals_System_Object_).

exercises/custom-set/CustomSet.cs

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,49 @@
11
using System;
2-
using System.Collections;
3-
using System.Collections.Generic;
42

5-
public class CustomSet<T> : IEnumerable<T>, IEquatable<IEnumerable<T>>
3+
public class CustomSet
64
{
7-
public CustomSet()
8-
{
9-
}
10-
11-
public CustomSet(T value)
12-
{
13-
}
14-
15-
public CustomSet(IEnumerable<T> values)
16-
{
17-
}
18-
19-
public CustomSet<T> Insert(T value)
20-
{
21-
throw new NotImplementedException("You need to implement this function.");
22-
}
23-
24-
public bool IsEmpty()
5+
public CustomSet(params int[] values)
256
{
267
throw new NotImplementedException("You need to implement this function.");
278
}
289

29-
public bool Contains(T value)
10+
public CustomSet Insert(int value)
3011
{
3112
throw new NotImplementedException("You need to implement this function.");
3213
}
3314

34-
public bool IsSubsetOf(CustomSet<T> right)
15+
public bool Empty()
3516
{
3617
throw new NotImplementedException("You need to implement this function.");
3718
}
3819

39-
public bool IsDisjointFrom(CustomSet<T> right)
20+
public bool Contains(int value)
4021
{
4122
throw new NotImplementedException("You need to implement this function.");
4223
}
4324

44-
public CustomSet<T> Intersection(CustomSet<T> right)
25+
public bool Subset(CustomSet right)
4526
{
4627
throw new NotImplementedException("You need to implement this function.");
4728
}
4829

49-
public CustomSet<T> Difference(CustomSet<T> right)
30+
public bool Disjoint(CustomSet right)
5031
{
5132
throw new NotImplementedException("You need to implement this function.");
5233
}
5334

54-
public CustomSet<T> Union(CustomSet<T> right)
35+
public CustomSet Intersection(CustomSet right)
5536
{
5637
throw new NotImplementedException("You need to implement this function.");
5738
}
5839

59-
public IEnumerator<T> GetEnumerator()
40+
public CustomSet Difference(CustomSet right)
6041
{
6142
throw new NotImplementedException("You need to implement this function.");
6243
}
6344

64-
IEnumerator IEnumerable.GetEnumerator()
45+
public CustomSet Union(CustomSet right)
6546
{
6647
throw new NotImplementedException("You need to implement this function.");
6748
}
68-
69-
public override bool Equals(object obj)
70-
{
71-
throw new NotImplementedException("You need to implement this function.");
72-
}
73-
74-
public override int GetHashCode()
75-
{
76-
throw new NotImplementedException();
77-
}
78-
79-
public bool Equals(IEnumerable<T> other)
80-
{
81-
throw new NotImplementedException("You need to implement this function.");
82-
}
83-
84-
public int GetHashCode(IEnumerable<T> obj)
85-
{
86-
throw new NotImplementedException();
87-
}
8849
}

0 commit comments

Comments
 (0)