/*!
  @header FTOrderedEdgeSet
  @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

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

#if !defined(__FTOrderedEdgeSet_H)
#define __FTOrderedEdgeSet_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTEdgeImpl.h>


/*!
 * @typedef ft_edge_type_t
 * @abstract Type of edge returned e.g. by FTOrderEdgeSetImpl#edgeType
 */
typedef enum {
  FT_EDGE_NOT_IN_SET = 0,
  FT_EDGE_IS_INCOMING = 1,
  FT_EDGE_IS_OUTGOING = 2
} ft_edge_type_t;


/*!
 * @protocol FTOrderedEdgeSet
 * @abstract Classes implementing this protocol manage a set of 
 *   FTEdgeImpl instances.
 * @discussion The edges are stored in the order they are added to the set.
 *   Modifications to the set, like e.g. the deletion of an edge, directly
 *   have an impact on the order
 */
@protocol FTOrderedEdgeSet <FTObject, NSCoding>

/*!
 * @method appendEdge
 * @abstract appends an edge to the set of edges.
 * @param toAdd edge to add. Its edge identifier must be unique.
 * @throws ECIllegalArgumentException if edge identifier is not unique
 * @result index of array where the edge has been added to
 */
- appendEdge: (FTEdgeImpl *) toAdd;


/*!
 * @method edgeType
 * @abstract Checks whether a given node is with the set and if so, it 
 * determines the type of this node (incoming or outgoing)
 * @result FT_EDGE_NOT_IN_SET, FT_EDGE_IS_INCOMING or FT_EDGE_IS_OUTGOING
 * @throws ECIllegalStateException if there is an inconsistent state within the
 *   current state of the implementation
 */
- (ft_edge_type_t) edgeType: (id <FTEdge>) toLookFor;


/*!
 * @method edgesWithSourceNodeId
 * @abstract all edges having the specified node as source node
 * @result iterator of all edges having the specified node as source node
 */
- (id <ECIterator>) edgesWithSourceNodeId: (id <FTId>) aNodeId;


/*!
 * @method edgesWithTargetNodeId
 * @abstract all edges having the specified node as target node
 * @result iterator of all edges having the specified node as target node
 */

- (id <ECIterator>) edgesWithTargetNodeId: (id <FTId>) aNodeId;


/*!
 * @method removeEdge
 * @abstract Removes the given ot from the set. Ignores the call if the 
 *   edge is not within the set
 * @result self
 */
- removeEdge: (id <FTEdge>) toRemove;


/*!
 * @method removeEdges
 * @abstract Searches the given iterator and removes all nodes which are to 
 * be found in this set. Ignores all edges not to be found in this set.
 * @param toRemove iteration of edges to be removed
 * @result self
 */
- removeEdges: (id <ECIterator>) toRemove;

@end
#endif
