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

  23.02.05 ola     initial version
  08.06.06 ola     nodeIterator added
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTGraph_H)
#define __FTGraph_H

#include <FT/FTObject.h>
#include <FT/FTId.h>
#include <FT/FTNode.h>
#include <FT/FTObjectToIdMapper.h>
#include <FT/FTService.h>

/*!
 * @protocol FTGraph
 * @abstract Instances of this protocol represent graphs
 */
@protocol FTGraph <FTObject>

/*!
 * @method createNodeWithId
 * @abstract create a node of a certain node id
 */
- (id <FTNode>) createNodeWithId: (id <FTId>) aNodeId;


/*!
 * @method graphId
 * @result the identifier of this graph
 */
- (id <FTId>) graphId;


/*!
 * @method close
 * @abstract Call this method if you do not need this instance any more
 * @discussion After this method release may also be called
 */
- (void) close;


/*!
 * @method nodeIterator
 * @result iterator over <b>all</b> nodes of the graph
 */
- (id <ECIterator>) nodeIterator;


/*!
 * @method nodeWithId
 * @result return the node corresponding to the given identifier
 */
- (id <FTNode>) nodeWithId: (id <FTId>) aNodeId;


/*!
 * @method objectToIdMapper
 * @result mapper for this graph
 */
- (id <FTObjectToIdMapper>) objectToIdMapper;


/*!
 * @method removeNode
 * @abstract removes the specified node from the graph
 * @discussion A node can only be removed if it contains no incoming and no 
 *   outgoing links
 * @param nodeToRemove node to remove
 * @result self
 * @throws ECIllegalStateException if the node contains incoming/outgoing
 *   references
 */
- removeNode: (id <FTNode>) nodeToRemove;


/*!
 * @method serviceWithId
 * @abstract Fetch a service for the specified id
 * @param aServiceId id of the service
 * @result the specified service or nil if not existent
 */
- (id <FTService>) serviceWithId: (NSString *) aServiceId;
@end
#endif
