/*! @header FTNodeImpl @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
  -------------------------------------------------------------------------
  Modification history

  31.03.05 ola     initial version
  11.08.05 ola     simpler architecture through usage of FTOrderEdgeSet
  16.08.06 ola     incoming and outgoing edges added
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  
*/ #if !defined(__FTNodeImpl_H) #define __FTNodeImpl_H #include #include #include #include #include #include #include #include @class FTGraphImpl; /*! * @class FTNodeImpl * @abstract Implementation of the protocol {@link FTNode} * @discussion At present the handling of relations from one node * to another is kept simple: Each node contains the underlying references * to nodes to which it links (outgoing nodes) and which point to * it (incoming nodes). This (internal) representation may change in * future since it may not be efficient enough wrt. to searching paths */ @interface FTNodeImpl : FTObject { @private /** * Reference to the graph this node belongs to */ FTGraphImpl *graph; /** * Id of this node */ id nodeId; NSLock *lock; /** * Set of all outgoing references */ id outgoingReferences; /** * Set of all incoming references */ id incomingReferences; } /*! * @method init * @result self */ - init; /*! * @method initWithCode * @abstract initializer called by deserialization process * @param decoder to use * @result self */ - (id) initWithCoder:(NSCoder *) decoder; /*! * @method initWithNodeId * @abstract initializes this instance * @param anId id for this node * @param aGraph graph to which this node belongs to * @result self */ - initWithNodeId: (id ) anId forGraph: (FTGraphImpl *) aGraph; - (void) dealloc; /*! * @method addOutgoingReferenceToNodeId * @abstract add a reference to the specified node * @param aSourceNodeId id of source node * @param anEdgeId id of underlying edge * @throws ECIllegalArgumentException if the given reference already exists in * this set. * @result self */ - addIncomingReferenceFromNodeId: (id ) aSourceNodeId withEdgeId: (id ) anEdgeId; /*! * @method addOutgoingReferenceToNodeId * @abstract add a reference to the specified node * @param aTargetNodeId id of target node * @param anEdgeId id of underlying edge * @throws ECIllegalArgumentException if the given reference already exists in * this set. * @result self */ - addOutgoingReferenceToNodeId: (id ) aTargetNodeId withEdgeId: (id ) anEdgeId; /*! * @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 ) createAndAppendEdgeWithId: (id ) edgeId withTargetNode: (id ) targetNode; /*! * @method description * @result information about the state of this object */ - (NSString *) description; /*! * @method encodeWithCoder * @abstract Is being called in order to serialize this instance * @param encoder object to be used for serialization */ - (void) encodeWithCoder: (NSCoder *) encoder; /*! * @method incomingEdges * @abstract Get all edges pointing to self * @result iterator of instances of type FTEdge or an empty iterator */ - (id ) incomingEdges; /*! * @method incomingNodes * @abstract access to all nodes refering the receiver of this message * @result iterator over instances which implement the protocol FTNode */ - (id ) incomingNodes; /*! * @method internalStateChanged * @abstract Informs graph instance to update the persistent data * representing this node * @result self */ - internalStateChanged; /*! * @method nodeId * @result return the id of this node. */ - (id ) nodeId; /*! * @method outgoingEdges * @abstract Get all outgoing edges * @result iterator of instances of type FTEdge or an empty iterator */ - (id ) outgoingEdges; /*! * @method outgoingNodes * @abstract access to all nodes referred by the receiver of this message * @result iterator over instances which implement the protocol FTNode */ - (id ) outgoingNodes; /*! * @method referencesToNodeIterator * @abstract returns an iterator over all targets nodes of the references * which are contained in the given reference set * @param references containing all references to examine * @result iterator over all targets nodes of the references */ - (id ) referencesToNodeIterator: (id ) references; /*! * @method removeIncomingReferencePointingFrom * @abstract removes the specified reference from the set of incoming * references * @param sourceNode node pointing to the receiver * @param edgeId id for the underlying edge * @result self */ - removeIncomingReferencePointingFrom: (FTNodeImpl *) sourceNode withEdgeId: (id ) edgeId; /*! * @method removeOutgoingReferencePointingTo * @abstract removes the specified reference from the set of outgoing * references * @param targetNode node pointing the receiver is pointing to * @param edgeId id for the underlying edge * @result self */ - removeIncomingReferencePointingFrom: (FTNodeImpl *) targetNode withEdgeId: (id ) edgeId; /*! * @method removeOutgoingNodeWithId * @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 ) aNodeId; /*! * @method removeFromReferenceSet * @abstract removes the specified reference from the set * @param references set to be modified * @param aNode node of the reference to be removed * @param anEdgeId edgeId of the reference to be removed * @result self */ - removeFromReferenceSet: (id ) references node: (FTNodeImpl *) aNode withEdgeId: (id ) anEdgeId; /*! * @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 ) serviceWithId: (NSString *) aServiceId; /*! * @method writeLock * @abstract Set / unset write lock * @param enable YES enables the lock * @result self */ - writeLock: (BOOL) enable; @end #endif