Skip to content

Commit 3b39002

Browse files
committed
Working on solution for AList project.
1 parent 87ead1d commit 3b39002

4 files changed

Lines changed: 15 additions & 17 deletions

File tree

source/code/projects/AList/AList/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void Main(string[] args)
5959

6060
// 1. Removing a value that is present one time.
6161
Console.Write(
62-
"We removed an occurence of 10: "
62+
"We removed an occurrence of 10: "
6363
+ myList1.Remove(10)
6464
+ ".\n"
6565
);
@@ -73,7 +73,7 @@ static void Main(string[] args)
7373
myList1.Add(1);
7474
myList1.Add(1);
7575
Console.Write(
76-
"We removed an occurence of 1: "
76+
"We removed an occurrence of 1: "
7777
+ myList1.Remove(1)
7878
+ ".\n"
7979
);
@@ -85,7 +85,7 @@ static void Main(string[] args)
8585

8686
// 3. Removing a value that is not in the list.
8787
Console.Write(
88-
"We removed an occurence of 20: "
88+
"We removed an occurrence of 20: "
8989
+ myList1.Remove(20)
9090
+ ".\n"
9191
);

source/code/projects/CList_ICollection/CList_ICollection/CList.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private class Cell
3939
}
4040

4141
/* Done with Cell.*/
42-
42+
4343
public int Count
4444
{
4545
get
@@ -56,6 +56,7 @@ public int Count
5656
}
5757

5858
public bool isReadOnly = false;
59+
5960
// This attribute is not required by the interface,
6061
// but convenient to have.
6162
public bool IsReadOnly
@@ -64,7 +65,7 @@ public bool IsReadOnly
6465
set { isReadOnly = value; }
6566
// Note that set is not required by the interface
6667
}
67-
68+
6869
// Add is simply "AddF", slightly revisited
6970
// to account for IsReadOnly attribute.
7071
public void Add(T value)
@@ -77,12 +78,12 @@ public void Add(T value)
7778
}
7879
first = new Cell(value, first);
7980
}
80-
81+
8182
public void Clear()
8283
{
8384
first = null;
8485
}
85-
86+
8687
public bool Contains(T value)
8788
{
8889
bool found = false;
@@ -97,8 +98,8 @@ public bool Contains(T value)
9798
}
9899
return found;
99100
}
100-
101-
// Copies the elements of the ICollection to an Array, starting at a particular Array index.
101+
102+
// Copies the elements of the ICollection to an Array, starting at a particular Array index.
102103
public void CopyTo(T[] array, int arrayIndex)
103104
{
104105
if (array == null)
@@ -123,8 +124,8 @@ public void CopyTo(T[] array, int arrayIndex)
123124
cCell = cCell.Next;
124125
}
125126
}
126-
127-
public IEnumerator<T> GetEnumerator()
127+
128+
public IEnumerator<T> GetEnumerator()
128129
{
129130
Cell cCell = first;
130131
while (cCell != null)
@@ -140,7 +141,7 @@ IEnumerator IEnumerable.GetEnumerator()
140141
}
141142

142143
/* We are done realizing the ICollection class. */
143-
144+
144145
// Some additional methods.
145146

146147
// Empty

source/code/projects/FileDisplayerSolution/FileDisplayerSolution/FileDisplayer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public static void DisplayWinnerCSV(string exP)
199199
{
200200
StreamReader sw = new StreamReader(exP);
201201
sw.ReadLine(); // Skipping the first line
202-
202+
203203
string cLine = sw.ReadLine();
204204
string[] cLineSplit = cLine.Split(',');
205205
string winnerSoFar =

source/projects/alist.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,8 @@ Please, follow our [guideline on project submission](./projects/submission).
7979
In particular, make sure you write your name and the date in a delimited comment at the beginning of your file.
8080

8181

82-
<!--
83-
8482
## Solution
8583

86-
A possible solution is shared [in this archive](./code/projects/AList.zip).
84+
A possible solution is shared [in this archive](./code/projects/AList.zip). It does *not* implement a `ToString` method or a method to insert at a given index, but complete all the bonuses otherwise: in particular, the `Main` method exemplifies numerous tests.
8785

8886
Note that it does not use a "counter" to keep track of how many elements are in the list, but instead resize the array and create a new array of the appropriate size when needed: this is less efficient, since copying the array is linear in its size, but gives a more compact code.
89-
-->

0 commit comments

Comments
 (0)