-
Notifications
You must be signed in to change notification settings - Fork 0
/
List.h
65 lines (51 loc) · 1.1 KB
/
List.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include"LinkedList.h"
// This is the implementation of the list adt
template<typename T>
class List
{
protected:
LinkedList<T> list;
public:
int getSize() const;
bool isEmpty() const;
bool insert(int newPosition, const T& newEntry);
bool remove(int position);
T getEntry(int position) const;
void setEntry(int position, const T& newEntry);
void Print(UI* ptr,char seperator = ',') const;
};
template<typename T>
bool List<T>::isEmpty() const
{
return list.isEmpty();
}
template<typename T>
int List<T>::getSize() const
{
return list.getSize();
}
template<typename T>
bool List<T>::insert(int newPosition, const T& newEntry)
{
return list.Insert(newEntry, newPosition);
}
template<typename T>
inline bool List<T>::remove(int position)
{
return list.removeIndex(position);
}
template<typename T>
T List<T>::getEntry(int position) const
{
return list[position];
}
template<typename T>
void List<T>::setEntry(int position, const T& newEntry)
{
list[position] = newEntry;
}
template<typename T>
void List<T>::Print(UI* ptr, char seperator) const {
list.Print(ptr, seperator);
}