home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IILNSEQ.H
< prev
next >
Wrap
Text File
|
1993-09-22
|
5KB
|
136 lines
/*******************************************************************************
* *
* COPYRIGHT: *
* IBM C/C++ Tools Version 2.01 - Collection Class Library *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IILNSEQ_H
#define _IILNSEQ_H
#include <iglobals.h>
#include <icursor.h>
class ILinkedSequenceImpl
{
public:
class Node
{
protected:
friend class ILinkedSequenceImpl;
Node* ivNext;
Node* ivPrevious;
};
class Operations
{
virtual Node* newNode (void const* node) const = 0;
virtual void deleteNode (void* node) const = 0;
virtual IBoolean constantFunctionIteration
(void *function,
void* env,
void const* node) = 0;
virtual IBoolean functionIteration (void *function,
void* env,
void* node) = 0;
virtual IBoolean constantIteratorIteration
(void* iterator,
void const* node) = 0;
virtual IBoolean iteratorIteration (void* iterator,
void* node) = 0;
virtual long functionComparison (void *compareFunction,
void const* node1,
void const* node2) = 0;
friend class ILinkedSequenceImpl;
};
private :
Node *ivFirst;
Node *ivLast;
INumber ivNumberOfElements;
Operations *ivOps;
public :
ILinkedSequenceImpl (Operations*);
ILinkedSequenceImpl (ILinkedSequenceImpl const&,
Operations*);
~ILinkedSequenceImpl ();
void addAllFrom (ILinkedSequenceImpl const&);
void removeAt (Node*);
INumber removeAll (void* predicate,
void* environment);
void removeAll ();
INumber numberOfElements () const;
IBoolean isEmpty () const;
IBoolean isFull () const;
IBoolean setToFirst (Node*&) const;
IBoolean setToNext (Node*&) const;
IBoolean allElementsDo (void* function, void* env);
IBoolean allElementsDo (void* function, void* env) const;
IBoolean allElementsDo (void* iterator);
IBoolean allElementsDo (void* iterator) const;
void removeFirst ();
void removeLast ();
void removeAtPosition (IPosition);
IBoolean setToLast (Node*&) const;
IBoolean setToPrevious (Node*&) const;
void setToPosition (IPosition, Node*&) const;
IBoolean isFirst (Node const*) const;
IBoolean isLast (Node const*) const;
long compare (ILinkedSequenceImpl const&,
void* comparisonFunction) const;
Node* addAsFirst (Node*);
Node* addAsLast (Node*);
Node* addAsNext (Node*, Node*);
Node* addAsPrevious (Node*, Node*);
Node* addAtPosition (IPosition, Node*);
void sort (void* comparisonFunction);
IBoolean checkNode (Node const*) const;
IBoolean isConsistent () const;
};
#endif