+ All Categories

refman

Date post: 15-Apr-2017
Category:
Upload: amrita-singh
View: 57 times
Download: 0 times
Share this document with a friend
21
List Project Generated by Doxygen 1.8.9.1 Tue Jul 28 2015 10:28:30
Transcript
Page 1: refman

List Project

Generated by Doxygen 1.8.9.1

Tue Jul 28 2015 10:28:30

Page 2: refman
Page 3: refman

Contents

1 Main Page 1

2 Class Index 3

2.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 Class Documentation 5

3.1 IntegerListArray Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.2.1 IntegerListArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.3.1 getElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.3.2 getLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.1.3.3 pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.1.3.4 popEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.1.3.5 push . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.1.3.6 pushEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.2 IntegerListLinked Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.2.1 IntegerListLinked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.2.2 ∼IntegerListLinked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.3.1 getElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.3.2 getLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.3.3 pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.3.4 popEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.3.5 push . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.3.6 pushEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3 IntegerListSorted Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Page 4: refman

iv CONTENTS

3.3.2.1 IntegerListSorted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.3.1 getElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.3.2 getLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3.3.3 insert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3.3.4 remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3.3.5 valueCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3.3.6 valueIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.4 IntegerListVector Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.4.1 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.4.1.1 IntegerListVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.4.2 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.2.1 getElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.2.2 getLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.2.3 pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.2.4 popEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.2.5 push . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4.2.6 pushEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5 List< T > Class Template Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5.1 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5.1.1 List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5.1.2 ∼List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5.2 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5.2.1 getElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.5.2.2 getLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.5.2.3 pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.5.2.4 popEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.5.2.5 push . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.5.2.6 pushEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.6 Node< T > Class Template Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.6.1 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.6.1.1 Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.6.1.2 Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.6.1.3 ∼Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Index 17

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 5: refman

Chapter 1

Main Page

Amrita Singh

Cs340, Summer 2015

7/28/2015

IntegerListArray.h

This file contains the header of a new class called IntegerListArray. The methods of the class are contained in a filecalled "IntegerListArray.cpp". This file creates a new class if it was not already defined. The purpose of this file is tocreate two private data fields: length and list. It also contains the methods to add (push), or remove (pop), a valueto the front or the back of the array. It also allows the user to get the length of the array, as well as look at the valuein the nth element of the array.

IntegerListArray.cpp

This file contains all the methods for the header file "IntegerListArray.h". The purpose of this file is to set the lengthand list when a variable of IntegerList is first created. It also contains the methods to add, "push," or remove, "pop,"a value to the front or the back of the array. It also allows the user to get the length of the array, as well as look atthe value in the nth element of the array.

IntegerListVector.h

This file contains the header of a new class called IntegerListVector. The methods of the class are contained in afile called "IntegerListVector.cpp". This file creates the new class if it was not already defined. The purpose of thisfile is to create two private data fields: length and list. It also contains the methods to add (push), or remove, (pop),a value to the front or the back of the array. It also allows the user to get the length of the array, as well as look atthe value in the nth element of the array.

IntegerListVector.cpp

This file contains all the methods for the header file "IntegerListVector.h". The purpose of this file is to set the lengthand list when a variable of IntegerListVector is first created. It also contains the methods to add (push), or remove(pop), a value to the front or the back of the vector. It also allows the user to get the length of the vector, as well aslook at the value in the nth element of the vector.

Page 6: refman

2 Main Page

IntegerListLinked.h

This file contains the header of a new class called IntegerListLinked. The methods of the class are contained ina file called "IntegerListLinked.cpp". This file creates the new class if it was not already defined. The purpose ofthis file is to create two private data fields: length and head. It also contains the methods to add (push), or remove(pop), a value to the front or the back of the linked list. It also allows the user to get the length of the linked list, aswell as look at the value in the nth Node of the linked list.

IntegerListLinked.cpp

This file contains all the methods for the header file "IntegerList.h". The purpose of this file is to set the length andlist when a variable of IntegerList is first created. It also contains the methods to add, "push," or remove, "pop," avalue to the front or the back of the array. It also allows the user to get the length of the array, as well as look at thevalue in the nth element of the array.

IntegerListSorted.h

This file contains the header of a new class called IntegerListSorted. The methods of the class are contained in afile called "IntegerListSorted.cpp". This file creates the new class if it was not already defined. The purpose of thisfile is to create two private data fields: length and head. It also contains the methods to insert or remove a value atthe nth Node in the sorted linked list. It also has methods that tells you how many times a specific value is presentin the sorted linked list, as well as telling you at what Node you would find a particular value. It also allows the userto get the length of the sorted linked list, as well as look at the value in the nth Node of the linked list.

IntegerListSorted.cpp

This file contains the implementation of a new class called IntegerListSorted. The header of the class is containedin a file called "IntegerListSorted.h". This file creates the new class if it was not already defined. The purpose of thisfile is to create two private data fields: length and head. It also contains the methods to insert or remove a value atthe nth Node in the sorted linked list. It also has methods that tells you how many times a specific value is presentin the sorted linked list, as well as telling you at what Node you would find a particular value. It also allows the userto get the length of the sorted linked list, as well as look at the value in the nth Node of the linked list.

List.h

List class is a Template container class that holds each element inside of a linked list of nodes that starts at theNode "head". It keeps track of its own length in a integer called length. The client will be able to push a T value tothe front or end of the list using push(T value) and pushEnd(T value) respectively. The client will also be able to popfrom the front and end of the list as well. Node∗ head and int length are private data members, but the client canaccess the size of the list buy using the int getLength() function. The client can also "peek" at any element usingan index in the T getElement(int element) function to see if a value is stored inside of the IntegerListVector. Thisclass has a Node<T> which is included from the Node.h header file where the node class is also implemented asa template class.

List.hxx

This file contains all the methods for the header file "List.h". The purpose of this file is to set the length and list whena variable of List is first created. It also contains the methods to add, "push," or remove, "pop," a T value to the frontor the back of the Template List. It also allows the user to get the length of the list, as well as look at the value in thenth element of the list.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 7: refman

Chapter 2

Class Index

2.1 Class List

Here are the classes, structs, unions and interfaces with brief descriptions:

IntegerListArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5IntegerListLinked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7IntegerListSorted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9IntegerListVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11List< T > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Node< T > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Page 8: refman

4 Class Index

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 9: refman

Chapter 3

Class Documentation

3.1 IntegerListArray Class Reference

#include <IntegerListArray.h>

Public Member Functions

• IntegerListArray ()• void push (int value)• int pop ()• void pushEnd (int value)• int popEnd ()• int getLength ()• int getElement (int element)

3.1.1 Detailed Description

This file contains the header of a new class called IntegerListArray. The methods of the class are contained in a filecalled "IntegerListArray.cpp". This file creates a new class if it was not already defined. The purpose of this file is tocreate two private data fields: length and list. It also contains the methods to add (push), or remove (pop), a valueto the front or the back of the array. It also allows the user to get the length of the array, as well as look at the valuein the nth element of the array.

3.1.2 Constructor & Destructor Documentation

3.1.2.1 IntegerListArray::IntegerListArray ( )

This is the IntegerList() constructor. The constructor sets the length and list to 0 when an variable of IntegerList isfirst created.

3.1.3 Member Function Documentation

3.1.3.1 int IntegerListArray::getElement ( int element )

Returns the length of the element to the user.

This function returns the value that is in the nth element of the array. Before the value is returned, the value ischecked to see that it is valid. The user cannot manipulate the the value in the array.

Page 10: refman

6 Class Documentation

Parameters

element This is the nth element in the array that the user wants to see.

Returns

The value that is in the nth element in the array to the user.

3.1.3.2 int IntegerListArray::getLength ( )

Pops the last element of the array & returns the value to the user so that they know what element was removed.

This function returns the length of the array to the user. The user is not able to manipulate the length.

3.1.3.3 int IntegerListArray::pop ( )

Pushes a value onto the front of the array

This function stores the value of the 0th element. It then makes a new array & copies all of the elements of the oldarray into the new one. Once this is done, the old list is deleted and the element that was popped will be returned.

Returns

The 0th element of the old array is returned to the user. This lets the user know what element has beenremoved from the array.

3.1.3.4 int IntegerListArray::popEnd ( )

Pushes a value onto the end of the array

This function stores the value of the last element. It then makes a new array & copies all of the elements of the oldarray into the new one. Once this is done, the old list is deleted and the element that was popped will be returned.

Returns

The last element of the old array is returned to the user. This lets the user know what element has beenremoved from the array.

3.1.3.5 void IntegerListArray::push ( int value )

The default constructor

This function creates a new array. The 0th element is the value given. Then the old list is copied into the new list.Once everything is copied, the old list is deleted.

Parameters

value It is an integer that is passed into the function. This is the value that will be inserted into the0th element of the new array.

3.1.3.6 void IntegerListArray::pushEnd ( int value )

Pops the 0th element & returns that value to the user so that they know what element was removed.

This function creates a new array. The value to be added to the end of the array is given. The old list is copied intothe new list. Once everything is copied, the given value is added, and the old list is deleted.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 11: refman

3.2 IntegerListLinked Class Reference 7

Parameters

value It is an integer that is passed into the function. This is the value that will be inserted into thelast element of the new array.

The documentation for this class was generated from the following files:

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListArray.h• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListArray.cpp

3.2 IntegerListLinked Class Reference

#include <IntegerListLinked.h>

Public Member Functions

• IntegerListLinked ()• void push (int value)• int pop ()• void pushEnd (int value)• int popEnd ()• int getLength ()• int getElement (int element)• ∼IntegerListLinked ()

3.2.1 Detailed Description

This file contains the header of a new class called IntegerListLinked. The methods of the class are contained ina file called "IntegerListLinked.cpp". This file creates the new class if it was not already defined. The purpose ofthis file is to create two private data fields: length and head. It also contains the methods to add (push), or remove(pop), a value to the front or the back of the linked list. It also allows the user to get the length of the linked list, aswell as look at the value in the nth Node of the linked list.

3.2.2 Constructor & Destructor Documentation

3.2.2.1 IntegerListLinked::IntegerListLinked ( )

This is the IntegerList() constructor. The constructor sets the length and list to NULL when an variable of IntegerListis first created.

3.2.2.2 IntegerListLinked::∼IntegerListLinked ( )

This is the IntegerListLinked destructor. This destructor frees up any memory that was allocated via new.

3.2.3 Member Function Documentation

3.2.3.1 int IntegerListLinked::getElement ( int element )

public int getElement(int element) returns the data that was in the value of the nth Node in the linked list.

This function returns the value that is in the nth Node of the linked list. Before the value is returned, the value ischecked to see that it is valid. The user cannot manipulate the the value in the Node.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 12: refman

8 Class Documentation

Parameters

element This is the nth Node in the linked list that the user wants to see.

Returns

The value that is in the nth Node in the linked list to the user.

3.2.3.2 int IntegerListLinked::getLength ( )

public int getLength() returns the length of the linked list to the user.

This function returns the length of the linked list to the user. The user is not able to manipulate the length.

Parameters

length This returns the length of the linked list to the user.

3.2.3.3 int IntegerListLinked::pop ( )

public int pop() removes the first Node in the linked list, and returns the value in that Node to the user.

This function stores the value of the first Node. It then has the pointer (head) point to the 2nd pointer, which willbecome the new first Node in the linked list.

Returns

The first Node in the linked list is returned to the user. This lets the user know what value in the Node hasbeen removed from the linked list.

3.2.3.4 int IntegerListLinked::popEnd ( )

public int popEnd() removes the last Node in the linked list, and returns the value in that Node to the user.

The purpose of this function is to remove the last Node in the linked list. This is done by traversing through thelinked list. Once the second to last Node is reached, the next Node's value is saved in itemPopped. Afterwards, the2nd to last Node's next points to NULL. Thus making that Node the new last Node in the linked list.

Returns

The last Node in the linked list is returned to the user. This lets the user know what element has been removedfrom the array.

3.2.3.5 void IntegerListLinked::push ( int value )

public void push(int value) takes a parameter that will be inserted into the front of the linked list

This function adds a new Node into the front of the linked list. If the length is 0, it sets head, (the pointer), to thenew Node. If there are 1 or more Nodes, it adds the newNode to the beginning of the linked list.

Parameters

value It is an integer that is passed into the function. This is the value that will be inserted into thefront of the linked list.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 13: refman

3.3 IntegerListSorted Class Reference 9

3.2.3.6 void IntegerListLinked::pushEnd ( int value )

public void pushEnd(int value) takes a parameter that will be inserted to the end of the linked list.

This function adds a Node to the end of the linked list. This is done by creating a new Node, and having that Node(cPtr) traverse through the linked list. Once cPtr has found the last Node in the linked list, newNode is added.

Parameters

value It is an integer that is passed into the function. This is the value that will be inserted into thelast Node of the linked list.

The documentation for this class was generated from the following files:

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListLinked.h• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListLinked.cpp

3.3 IntegerListSorted Class Reference

#include <IntegerListSorted.h>

Public Member Functions

• IntegerListSorted ()• void insert (int value)• void remove (int index)• int valueCount (int value)• int valueIndex (int value)• int getElement (int element)• int getLength ()

3.3.1 Detailed Description

This file contains the header of a new class called IntegerListSorted. The methods of the class are contained in afile called "IntegerListSorted.cpp". This file creates the new class if it was not already defined. The purpose of thisfile is to create two private data fields: length and head. It also contains the methods to insert or remove a value atthe nth Node in the sorted linked list. It also has methods that tells you how many times a specific value is presentin the sorted linked list, as well as telling you at what Node you would find a particular value. It also allows the userto get the length of the sorted linked list, as well as look at the value in the nth Node of the linked list.

3.3.2 Constructor & Destructor Documentation

3.3.2.1 IntegerListSorted::IntegerListSorted ( )

This is the IntegerList() constructor. The constructor sets the list to 0 and the pointers, list & endPtr, to NULL whenan instance of IntegerList is first created.

3.3.3 Member Function Documentation

3.3.3.1 int IntegerListSorted::getElement ( int element )

public int getElement(int element) returns the data that was in the value of the nth Node in the sorted linked list.

This function returns the value that is in the nth Node of the linked list. Before the value is returned, the value ischecked to see that it is valid. The user cannot manipulate the the value in the Node.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 14: refman

10 Class Documentation

Parameters

element This is the nth Node in the linked list that the user wants to see.

Returns

The value that is in the nth Node in the linked list to the user.

3.3.3.2 int IntegerListSorted::getLength ( )

public int getLength() returns the length of the sorted list to the user.

This function returns the length of the array to the user. The user is not able to manipulate the length.

Parameters

length This returns the length of the array to the user.

3.3.3.3 void IntegerListSorted::insert ( int value )

public void insert(int value) takes an int parameter that will be inserted correctly into an ascending sorted list.

This function adds a Node to the linked list. The list is already sorted in ascending order. So the Node is addedafter the Node with the lower element & before the Node with a higher element. If there is an element with the sameelement value, the new Node is added after the Node with the same Node.

Parameters

value This is the value the new Node will hold in element.

If length is 1, compare the element in list to newNode. If the data in newNode is < the data in first, then newNode'snext will point to first, & first will point to newNode.

3.3.3.4 int IntegerListSorted::remove ( int index )

public void remove(int index) takes an int parameter that will remove the Node that is at the nth (index) Node.

This function stores the value of the Node the user wants to remove. It then has the pointer point to the Node that'sgoing to be removed's next. There will be two cases: 1) the user wants to remove the 1st pointer. In this case, oncethe value is saved off, head will now point to NULL. 2) There are 1+ Nodes in the list. Once the desired Node isfound, via traversing, the value of that Node is saved off. That Node's previous Node will point to the Node that willbe deleted successor.

Returns

The first Node of sorted linked list is returned to the user. This lets the user know what element has beenremoved from the sorted linked list.

3.3.3.5 int IntegerListSorted::valueCount ( int value )

public void int valueCount(int value) takes a parameter, int value, and returns the number of occurences of this valuethat are currently present in the sorted list.

The purpose of this function is to return the amount of times a specific value made an appearance in the sortedlinked list. This will be done by having a counter that is initialized at 0, just in case that value is NOT in the sortedlinked list. A temporary Node will traverse through the sorted linked list and look at each Node's value. If there is amatch, the counter will increase by 1. Once the Node has gone through the whole list, the result will be returned tothe user.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 15: refman

3.4 IntegerListVector Class Reference 11

Parameters

int value is the value we are looking for occurences in our sorted list.

Returns

int The amount of occurences of the int value that was passed in by the client.

3.3.3.6 int IntegerListSorted::valueIndex ( int value )

public void valueIndex(int value) takes a parameter, int value, and returns the index of the first occurence of theNode's value.

The purpose of this function is to return the index of the int value in the sorted list. If there are multiples, the firstoccurence of that value will be returned. The variable index will be initialized to 0. A temporary pointer will traversethrough the list until it finds a Node that has a matching value. Once that value is found, the index is returned tothe user, and the function ends. However, if there is no such value in the index, a message will be sent to the userletting them know and the value 0 will be returned.

Parameters

int value is the value we are looking to get the index of.

Returns

int the index of the value we were looking for.

The documentation for this class was generated from the following files:

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListSorted.h

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListSorted.cpp

3.4 IntegerListVector Class Reference

Public Member Functions

• IntegerListVector ()

• void push (int value)

• int pop ()

• void pushEnd (int value)

• int popEnd ()

• int getLength ()

• int getElement (int element)

3.4.1 Constructor & Destructor Documentation

3.4.1.1 IntegerListVector::IntegerListVector ( )

This file contains all the methods for the header file "IntegerListVector.h". The purpose of this file is to set the lengthand list when a variable of IntegerListVector is first created. It also contains the methods to add (push), or remove(pop), a value to the front or the back of the vector. It also allows the user to get the length of the vector, as wellas look at the value in the nth element of the vector.This is the IntegerListVector() constructor. The constructor setsthe length and list to 0 when an variable of IntegerList is first created.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 16: refman

12 Class Documentation

3.4.2 Member Function Documentation

3.4.2.1 int IntegerListVector::getElement ( int element )

Returns the length of the vector to the user

This function returns the value that is in the nth element of the vector. Before the value is returned, the value ischecked to see that it is valid. The user cannot manipulate the the value in the vector.

Parameters

element This is the nth element in the vector that the user wants to see.

Returns

The value that is in the nth element in the vector to the user.

3.4.2.2 int IntegerListVector::getLength ( )

Pops the last element of the vector & returns the value to the user so that they know what element was removed.

This function returns the length of the vector to the user. The user is not able to manipulate the length.

Parameters

length This returns the length of the array to the user.

3.4.2.3 int IntegerListVector::pop ( )

Pushes a value onto the front of the vector

This function looks at the first element in the vector and saves that value into itemPopped. It then removes the firstelement, as well as decrease the length by 1. The value in itemPopped is returned.

Returns

The first element of the vector is returned to the user. This lets the user know what element has been removedfrom the vector.

3.4.2.4 int IntegerListVector::popEnd ( )

Pushes a value onto the end of the vector

This function stores the value of the last element into itemPopped. It then removes that element, and it updateslength. Then it returns the value to the user.

Returns

The last element of the vector is returned to the user. This lets the user know what element has been removedfrom the vector.

3.4.2.5 void IntegerListVector::push ( int value )

The default constructor

In this function, the value that is going to be entered into the vector is given. The length is updated, and the value isinserted into the beginning of the vector.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 17: refman

3.5 List< T > Class Template Reference 13

Parameters

value It is an integer that is passed into the function. This is the value that will be inserted into thebeginning of the vector.

3.4.2.6 void IntegerListVector::pushEnd ( int value )

Pops the element at the beginning of the vector & returns that value to the user so that they know what element wasremoved.

This function increases the length of the vector by 1. It then adds the given value to the end of vector.

Parameters

value It is an integer that is passed into the function. This is the value that will be inserted into thelast element of the new vector.

The documentation for this class was generated from the following files:

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListVector.h• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/IntegerListVector.cpp

3.5 List< T > Class Template Reference

Public Member Functions

• List ()• void push (T value)• T pop ()• void pushEnd (T value)• T popEnd ()• int getLength ()• T getElement (int element)• ∼List ()

3.5.1 Constructor & Destructor Documentation

3.5.1.1 template<class T > List< T >::List ( )

This file contains all the methods for the header file "IntegerList.h". The purpose of this file is to set the length andlist when a variable of IntegerList is first created. It also contains the methods to add, "push," or remove, "pop," avalue to the front or the back of the array. It also allows the user to get the length of the array, as well as look at thevalue in the nth element of the array.This is the constructor. The constructor initializes the length to 0 and has listpoint to NULL when an instance of the class is first created.

3.5.1.2 template<class T > List< T >::∼List ( )

This is the List<T> destructor. This destructor frees up any memory that was allocated via new.

3.5.2 Member Function Documentation

3.5.2.1 template<class T > T List< T >::getElement ( int element )

public int getElement(int element) returns the data that was in the value of the nth Node in the linked list.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 18: refman

14 Class Documentation

This function returns the value that is in the nth Node of the linked list. Before the value is returned, the value ischecked to see that it is valid. The user cannot manipulate the the value in the Node.

Parameters

element This is the nth Node in the linked list that the user wants to see.

Returns

The value that is in the nth Node in the linked list to the user.

3.5.2.2 template<class T > int List< T >::getLength ( )

public int getLength() returns the length of the linked list to the user.

This function returns the length of the linked list to the user. The user is not able to manipulate the length.

Parameters

length This returns the length of the linked list to the user.

3.5.2.3 template<class T > T List< T >::pop ( )

public int pop() removes the first Node in the linked list, and returns the value in that Node to the user.

This function stores the value of the first Node. It then has the pointer (head) point to the 2nd pointer, which willbecome the new first Node in the linked list.

Returns

The first Node in the linked list is returned to the user. This lets the user know what value in the Node hasbeen removed from the linked list.

3.5.2.4 template<class T > T List< T >::popEnd ( )

public int popEnd() removes the last Node in the linked list, and returns the value in that Node to the user.

The purpose of this function is to remove the last Node in the linked list. This is done by traversing through thelinked list. Once the second to last Node is reached, the next Node's value is saved in itemPopped. Afterwards, the2nd to last Node's next points to NULL. Thus making that Node the new last Node in the linked list.

Returns

The last element of the old array is returned to the user. This lets the user know what element has beenremoved from the array.

3.5.2.5 template<class T > void List< T >::push ( T value )

public void push(int value) takes a parameter that will be inserted into the the linked list

This function adds a new Node into the front of the linked list. If the length is 0, it sets head, (the pointer), to thenew Node. If there are 1 or more Nodes, it adds the newNode to the beginning of the linked list. The length is alsoupdated in this function.

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 19: refman

3.6 Node< T > Class Template Reference 15

Parameters

value It is a T that is passed into the function. This is the value that will be inserted into the front ofthe linked list.

3.5.2.6 template<class T > void List< T >::pushEnd ( T value )

public void pushEnd(int value) takes a parameter that will be inserted to the end of the linked list.

This function adds a Node to the end of the linked list. This is done by creating a new Node, and having that Node(currNode) traverse through the linked list. Once currNode has found the last Node in the linked list, newNode isadded.

Parameters

value It is a T that is passed into the function. This is the value that will be inserted into the lastNode of the linked list.

The documentation for this class was generated from the following files:

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/List.h• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/List.hxx

3.6 Node< T > Class Template Reference

Public Member Functions

• Node ()• Node (T data)• ∼Node ()

Public Attributes

• T value• Node ∗ next

3.6.1 Constructor & Destructor Documentation

3.6.1.1 template<typename T > Node< T >::Node ( )

This is a template type default constructor. It sets the value of the Node to zero, and has the pointer point to NULL

3.6.1.2 template<typename T> Node< T >::Node ( T data )

This is a template type constructor. It sets value of the Node to the given data, and has next point to NULL.

3.6.1.3 template<typename T > Node< T >::∼Node ( )

This is the default Node destructor. It frees up the memory space for any memory that was allocated via the use ofthe new operator.

The documentation for this class was generated from the following file:

• C:/MinGW/msys/1.0/home/Amrita/SFSU/csc340/listProject/Node.h

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 20: refman

16 Class Documentation

Generated on Tue Jul 28 2015 10:28:30 for List Project by Doxygen

Page 21: refman

Index

∼IntegerListLinkedIntegerListLinked, 7

∼ListList, 13

∼NodeNode, 15

getElementIntegerListArray, 5IntegerListLinked, 7IntegerListSorted, 9IntegerListVector, 12List, 13

getLengthIntegerListArray, 6IntegerListLinked, 8IntegerListSorted, 10IntegerListVector, 12List, 14

insertIntegerListSorted, 10

IntegerListArray, 5getElement, 5getLength, 6IntegerListArray, 5pop, 6popEnd, 6push, 6pushEnd, 6

IntegerListLinked, 7∼IntegerListLinked, 7getElement, 7getLength, 8IntegerListLinked, 7pop, 8popEnd, 8push, 8pushEnd, 8

IntegerListSorted, 9getElement, 9getLength, 10insert, 10IntegerListSorted, 9remove, 10valueCount, 10valueIndex, 11

IntegerListVector, 11getElement, 12getLength, 12

IntegerListVector, 11pop, 12popEnd, 12push, 12pushEnd, 13

List∼List, 13getElement, 13getLength, 14List, 13pop, 14popEnd, 14push, 14pushEnd, 15

List< T >, 13

Node∼Node, 15Node, 15

Node< T >, 15

popIntegerListArray, 6IntegerListLinked, 8IntegerListVector, 12List, 14

popEndIntegerListArray, 6IntegerListLinked, 8IntegerListVector, 12List, 14

pushIntegerListArray, 6IntegerListLinked, 8IntegerListVector, 12List, 14

pushEndIntegerListArray, 6IntegerListLinked, 8IntegerListVector, 13List, 15

removeIntegerListSorted, 10

valueCountIntegerListSorted, 10

valueIndexIntegerListSorted, 11


Recommended