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

  27.02.05 ola     initial version
  16.08.06 ola     incoming and outgoing edges added
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTNode_H)
#define __FTNode_H

#include <Foundation/Foundation.h>
#include <Encore/Encore.h>
#include <FT/FTObject.h>
#include <FT/FTEdge.h>
#include <FT/FTVersion.h>
#include <FT/FTService.h>


/*!
 * @protocol FTNode
 * @abstract Interface of all node instances within FT
 */
@protocol FTNode <FTObject>

/*!
 * @method countIncomingReferences
 * @result returns the number of incoming edges
 */
- (unsigned) countIncomingReferences;


/*!
 * @method countOutgoingReferences
 * @result returns the number of outgoing edges
 */

- (unsigned) countOutgoingReferences;


/*!
 * @method createAndAppendEdgeWithId
 * @abstract creates an edge which refers to the given node
 * @param edgeId id of the edge
 * @param targetNode node to which the edge refers
 * @result created edge instance
 */
- (id <FTEdge>) createAndAppendEdgeWithId: (id <FTId>) edgeId
  withTargetNode: (id <FTNode>) targetNode;
  

/*!
 * @method incomingEdges
 * @abstract Get all edges pointing to self
 * @result iterator of instances of type FTEdge or an empty iterator
 */
- (id <ECIterator>) incomingEdges;


/*! 
 * @method incomingNodes
 * @abstract access to all nodes refering the receiver of this message
 * @result iterator over instances which implement the protocol FTNode
 */
- (id <ECIterator>) incomingNodes;


/*!
 * @method nodeId
 * @result return the id of this node.
 */
- (id <FTId>) nodeId;


/*! 
 * @method outgoingNodes
 * @abstract access to all nodes referred by the receiver of this message
 * @result iterator over instances which implement the protocol FTNode
 */
- (id <ECIterator>) outgoingNodes;


/*!
 * @method outgoingEdges
 * @abstract Get all outgoing edges
 * @result iterator of instances of type FTEdge or an empty iterator
 */
- (id <ECIterator>) outgoingEdges;


/*!
 * @method removeAllOutgoingNodeWithId
 * @abstract removes all outgoing nodes with the specified id
 * @param nodeId identifier for the node
 * @result self
 * @throws ECIllegalArgumentException if the node with the given id could
 *   not be found
 */
- removeAllOutgoingNodesWithId: (id <FTId>) nodeId;


/*!
 * @method serviceWithId
 * @abstract retrieve the specified service
 * @param aServiceId identifier for the service
 * @result related service or nil, if not found or version cannot be found
 */
- (id <FTService>) serviceWithId: (NSString *) aServiceId;
@end
#endif
