Public Member Functions | Private Attributes | Friends | List of all members
ListIterator< T > Class Template Reference

#include <iterator.h>

Public Member Functions

 ListIterator ()
 
bool hasNext () const
 
bool hasPrevious () const
 
T & next () throw ( NoSuchObject )
 
T & previous () throw ( NoSuchObject )
 
void set (const T &) const throw ( NoSuchObject )
 
void printInternal () const
 

Private Attributes

Node< T > * current
 
bool before
 

Friends

class List< T >
 

Detailed Description

template<typename T>
class ListIterator< T >

Implements a bidirectional iterator for List.

Author
Mark Maloof
Version
1.2, 4/10/17

Constructor & Destructor Documentation

template<typename T >
ListIterator< T >::ListIterator ( )

Default constructor.

Member Function Documentation

template<typename T >
bool ListIterator< T >::hasNext ( ) const

Returns true if this iterator has a next object.

Returns
true if this iterator has a next object; false otherwise.
template<typename T >
bool ListIterator< T >::hasPrevious ( ) const

Returns true if this iterator has a previous object.

Returns
true if this iterator has a previous object; false otherwise.
template<typename T >
T & ListIterator< T >::next ( )
throw (NoSuchObject
)

Returns a reference to the next object in this iterator.

Returns
a reference to the next object
Exceptions
NoSuchObjectif no such object exists in this iterator
template<typename T >
T & ListIterator< T >::previous ( )
throw (NoSuchObject
)

Returns a reference to the previous object in this iterator.

Returns
a reference to the previous object
Exceptions
NoSuchObjectif no such object exists in this iterator
template<typename T >
void ListIterator< T >::printInternal ( ) const

A utility method that prints the internal state of this iterator.

template<typename T >
void ListIterator< T >::set ( const T &  object) const
throw (NoSuchObject
)

Sets the object last returned by this iterator to the specified object.

Parameters
objectthe object to be set
Exceptions
NoSuchObjectif no such object exists

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