/*!
  @header FTOrderedReferenceSet
  @abstract Module of FT
 
  @availability OS X, GNUstep
  @copyright 2004, 2005, 2006 Free Software Foundation, Inc.
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  02.09.05 ola     initial version
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTOrderedReferenceSet_H)
#define __FTOrderedReferenceSet_H

#include <Foundation/Foundation.h>
#include <Encore/Encore.h>
#include <FT/FTObject.h>
#include <FT/FTId.h>
#include <FT/FTReference.h>

/*!
 * @protocol FTOrderedReferenceSet
 * @abstract Used to store reference in an ordered set
 */
@protocol FTOrderedReferenceSet <FTObject, NSCoding>

/*!
 * @method allReferences
 * @result all references in order
 */
- (id <ECIterator>) allReferences;


/*!
 * @method countReferences
 * @result returns the number of references in this set
 */
- (unsigned) countReferences;


/*!
 * @method createAndAppendReferenceToNode
 * @abstract creates a reference and appends it to the existing set
 * @param aNodeId identifier of the node to point to
 * @param anEdgeId identifier for the underlying edge
 * @result self
 * @throws ECIllegalArgumentException if the given reference already exists in
 *   this set.
 */
- createAndAppendReferenceToNode: (id <FTId>) aNodeId
  withEdgeId: (id <FTId>) anEdgeId;


/*!
 * @method referencesByNodeId
 * @param aNodeId node id to look for
 * @result all references having the specified node id
 */
- (id <ECIterator>) referencesByNodeId: (id <FTId>) aNodeId;


/*!
 * @method referenceByEdgeId
 * @param anEdgeId identifier for the edge
 * @result the reference corresponding to the given edge id or nil
 */
- (id <FTReference>) referenceByEdgeId: (id <FTId>) anEdgeId;


/*!
 * @method removeReference
 * @abstract removes a reference from the set
 * @discussion After a successful call the reference is no longer valid.
 * @param toRemove reference to remove.
 * @result self
 */
- removeReference: (id <FTReference>) toRemove;
@end
#endif
