//  The C++ Booch Components (Version 2.0)
//  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
//
//  BCOColU.h
//
//  This file contains the declaration of the unbounded ordered collection.

#ifndef BCOCOLU_H
#define BCOCOLU_H 1

#include "BCUnboun.h"
#include "BCOCol.h"

// Unbounded ordered collection

template<class Collection_Item, class Storage_Manager>
class BC_TUnboundedOrderedCollection : public BC_TOrderedCollection<Collection_Item> {
public:

  BC_TUnboundedOrderedCollection();
  BC_TUnboundedOrderedCollection
    (const BC_TUnboundedOrderedCollection<Collection_Item, Storage_Manager>&);
  virtual ~BC_TUnboundedOrderedCollection();

  virtual BC_TCollection<Collection_Item>& operator=(const BC_TCollection<Collection_Item>&);
  virtual BC_TCollection<Collection_Item>& 
    operator=(const BC_TUnboundedOrderedCollection<Collection_Item, Storage_Manager>&);
  virtual BC_Boolean operator==(const BC_TCollection<Collection_Item>&) const;
  virtual BC_Boolean
    operator==(const BC_TUnboundedOrderedCollection<Collection_Item, Storage_Manager>&) const;
  BC_Boolean
    operator!=(const BC_TUnboundedOrderedCollection<Collection_Item, Storage_Manager>&) const;
  virtual const Collection_Item& operator[](BC_Index) const;

  virtual void Clear();
  virtual void Insert(const Collection_Item&);
  virtual void Insert(const Collection_Item&, BC_Index before);
  virtual void Append(const Collection_Item&);
  virtual void Append(const Collection_Item&, BC_Index after);
  virtual void Remove(BC_Index at);
  virtual void Replace(BC_Index at, const Collection_Item&);

  virtual BC_Index Length() const;
  virtual BC_Boolean IsEmpty() const;
  virtual const Collection_Item& First() const;
  virtual const Collection_Item& Last() const;
  virtual BC_Extended_Index Location(const Collection_Item&) const;

  static void* operator new(size_t);
  static void operator delete(void*, size_t);

protected:

  BC_TUnbounded<Collection_Item, Storage_Manager> fRep;

  virtual void Purge();
  virtual void Add(const Collection_Item&);
  virtual BC_Index Cardinality() const;
  virtual const Collection_Item& Item(BC_Index) const;

};

#endif
