++ ArrayDataEngine.c ++ IteratorUtility.c ++ QueueUtility.c ++ StackUtility.c +- Makefile for PA05
171 lines
No EOL
5 KiB
C
171 lines
No EOL
5 KiB
C
// header files
|
|
#include "IteratorUtility.h"
|
|
|
|
/* Data Structures
|
|
typedef struct IteratorStruct
|
|
{
|
|
StateArrayType *iterData;
|
|
|
|
int currentIndex;
|
|
} IteratorType;
|
|
Data Structures */
|
|
|
|
// function implementation
|
|
|
|
/*
|
|
Name: clearIterator
|
|
Process: clears the StateDataType sub-structure, and then the IteratorType
|
|
Function input/parameters: pointer to IteratorType (IteratorType *)
|
|
Function output/parameters: none
|
|
Function output/returned: NULL
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: clearDataStructure, free
|
|
*/
|
|
IteratorType *clearIterator( IteratorType *iterator )
|
|
{
|
|
// return NULL
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
Name: createIterator
|
|
Process: initializes the IteratorType,
|
|
and then the StateDataType sub-structure
|
|
Function input/parameters: initial capacity (int)
|
|
Function output/parameters: none
|
|
Function output/returned: pointer to initialized IteratorType (IteratorType *)
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: malloc, createDataStructure
|
|
*/
|
|
IteratorType *createIterator( int initialCapacity )
|
|
{
|
|
// return IteratorType
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
Name: getFirst
|
|
Process: gets first value in iterator, returns true,
|
|
returns false otherwise
|
|
Function input/parameters: pointer to IteratorType (IteratorType *)
|
|
Function output/parameters: return value (StateDataType *)
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: getItemAtIndex
|
|
*/
|
|
bool getFirst( IteratorType *iterator, StateDataType *returned )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
Name: getLast
|
|
Process: gets last value in iterator, returns true,
|
|
returns false otherwise
|
|
Function input/parameters: pointer to IteratorType (IteratorType *)
|
|
Function output/parameters: return value (StateDataType *)
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: getItemAtIndex, getListSize
|
|
*/
|
|
bool getLast( IteratorType *iterator, StateDataType *returned )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
Name: getNext
|
|
Process: gets next value in iterator if available, returns true,
|
|
otherwise, sets return value to empty, returns false
|
|
Function input/parameters: pointer to IteratorType (IteratorType *)
|
|
Function output/parameters: return value (StateDataType *)
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: getItemAtIndex, getListSize
|
|
*/
|
|
bool getNext( IteratorType *iterator, StateDataType *returned )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
Name: getPrevious
|
|
Process: gets previous value in iterator if available, returns true,
|
|
otherwise, sets return value to empty, returns false
|
|
Function input/parameters: pointer to IteratorType (IteratorType *)
|
|
Function output/parameters: return value (StateDataType *)
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: getItemAtIndex
|
|
*/
|
|
bool getPrevious( IteratorType *iterator, StateDataType *returned )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
Name: insertAfterCurrentIndex
|
|
Process: inserts value immediately after currentIndex, if possible, returns true,
|
|
otherwise, returns false
|
|
Function input/parameters: pointer to IteratorType (IteratorType *),
|
|
value to be inserted (const StateDataType)
|
|
Function output/parameters: none
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: insertItemAtIndex, getListSize
|
|
*/
|
|
bool insertAfterCurrentIndex( IteratorType *iterator,
|
|
const StateDataType toBeInserted )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
Name: insertAtCurrentIndex
|
|
Process: inserts value at currentIndex, if possible, returns true
|
|
otherwise, returns false
|
|
Function input/parameters: pointer to IteratorType (IteratorType *),
|
|
value to be inserted (const StateDataType)
|
|
Function output/parameters: none
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: insertItemAtIndex
|
|
*/
|
|
bool insertAtCurrentIndex( IteratorType *iterator,
|
|
const StateDataType toBeInserted )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
Name: removeAtCurrentIndex
|
|
Process: removes value at current index if possible, returns true,
|
|
otherwise, sets return value to empty, returns false
|
|
Function input/parameters: pointer to IteratorType (IteratorType *),
|
|
value to be remove (StateDataType *)
|
|
Function output/parameters: pointer to updated IteratorType (IteratorType *),
|
|
pointer to item removed (StateDataType *)
|
|
Function output/returned: Boolean result of operation
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: removeItemAtIndex, getListSize
|
|
*/
|
|
bool removeAtCurrentIndex( IteratorType *iterator, StateDataType *removedItem )
|
|
{
|
|
// return false (TEMP)
|
|
return false;
|
|
} |