# Methods

`-close`
  Call this method if you do not need this instance any more
`-createDatabaseGraphDirectory`
  Creates the (sub) directory for a new graph
`-createNodeWithId:`
  create a node of a certain node id
`-databasesMounted`
`-encodeWithCoder:`
  Encodes the receiver using encoder
`-graphId`
`-idToRecnoDBConfig`
`-init`
  May not be called directly.
`-initAfterDecodeForServer`
  this method may directly be called after deserialization of this object
`-initAfterDecodeForServer:graphManager:`
  this method may directly be called after deserialization of this object
`-initForServer`
  initializes the receiver
`-initForServer:graphManager:withId:`
  initializes the receiver
`-initWithCoder:`
  Initializes a newly allocated instance from data in decoder
`-insertNodeToDatabase:`
  inserts a node to the database
`-internalStateChanged:`
  Updates the persistent state of the given node
`-mountDatabases`
  Opens all databases
`-nameOfIdToRecnoDatabase`
`-nameOfkeyToGraphInfoDatabase`
`-nameOfNodesDatabase`
  Name of database mapping a record number to a node's data
`-nameOfObjectToIdMapperDatabase`
`-nodeAtRecordNumber:`
  fetch the node at the specified record number
`-nodeDBConfig`
`-nodeIterator`
`-nodeWithId:`
`-objectToIdMapper`
`-performAction`
  Called by the transaction controll in order to run the transaction
`-recordNumberOfNode:`
`-recordNumberOfNodeId:`
`-remove`
  Removes the complete graph. Does not check wether the graph (or one of its elements) is still in use. (TODO)
`-removeNode:`
  removes the specified node from the graph
`-removeNodeFromDatabase:`
  removes the specified node from the database
`-removeNodeFromIdToRecnoDB:`
  removed the specified node from the database idToRecnoDB and returns the record number (value) of the deleted entry.
`-removeNodeWithRecordNumber:`
`-serviceWithId`
  Fetch a service for the specified id and node
`-serviceWithId:`
  Fetch a service for the specified id
`-serviceWithId:forNode:`
  Fetch a service for the specified id and node
`-setupDatabases`
  Initializes the graph database
`-unmountDatabases`
  closes all databases used for this graph
`-updateNode:`
  removes the existing node data from the database(s) and adds the current data of the given node to the database(s)

### close

Call this method if you do not need this instance any more

>     - (void) close;

##### Discussion

After this method release may also be called

### createDatabaseGraphDirectory

Creates the (sub) directory for a new graph

>     - (NSString *) createDatabaseGraphDirectory;

method result
  name of created directory excluding the base directory path

### createNodeWithId:

create a node of a certain node id

>     - (id <FTNode>) createNodeWithId: (id <FTId>) aNodeId;

### databasesMounted

>     - (BOOL) databasesMounted;

method result
  YES if all databases are mounted.

### encodeWithCoder:

Encodes the receiver using encoder

>     - (void) encodeWithCoder: (NSCoder *) coder;

### graphId

>     - (id <FTId>) graphId;

method result
  the identifier of this graph

### idToRecnoDBConfig

>     - (BDBDatabaseConfig *) idToRecnoDBConfig;

method result
  database configuration for the database "idToNode"

### init

May not be called directly.

>     - init;

method result
  self

### initAfterDecodeForServer

this method may directly be called after deserialization of this object

See Also:

> initAfterDecodeForServer:graphManager:

>     - initAfterDecodeForServer: (FTServerImpl *) theServer graphManager: (FTGraphManagerImpl *) theGraphManager;

##### Parameter Descriptions

> `theServer`
>   reference to underlying server
> `theGraphManager`
>   graph manager to use

method result
  self

### initAfterDecodeForServer:graphManager:

this method may directly be called after deserialization of this object

See Also:

> initAfterDecodeForServer

>     - initAfterDecodeForServer: (FTServerImpl *) theServer graphManager: (FTGraphManagerImpl *) theGraphManager;

##### Parameter Descriptions

> `theServer`
>   reference to underlying server
> `theGraphManager`
>   graph manager to use

### initForServer

initializes the receiver

See Also:

> initForServer:graphManager:withId:

>     - initForServer: (FTServerImpl *) theServer graphManager: (FTGraphManagerImpl *) theGraphManager withId: (id <FTId>) anId;

##### Parameter Descriptions

> `theServer`
>   reference to the underlying server
> `anId`
>   id of this graph

method result
  self

### initForServer:graphManager:withId:

initializes the receiver

See Also:

> initForServer

>     - initForServer: (FTServerImpl *) theServer graphManager: (FTGraphManagerImpl *) theGraphManager withId: (id <FTId>) anId;

##### Parameter Descriptions

> `theServer`
>   reference to the underlying server
> `anId`
>   id of this graph

### initWithCoder:

Initializes a newly allocated instance from data in decoder

>     - initWithCoder: (NSCoder *) coder;

### insertNodeToDatabase:

inserts a node to the database

>     - insertNodeToDatabase: (FTNodeImpl *) node;

##### Parameter Descriptions

> `node`
>   to insert

method result
  self

##### Discussion

the caller has to make sure that the node is not already to be found in the database.

### internalStateChanged:

Updates the persistent state of the given node

>     - internalStateChanged: (FTNodeImpl *) nodeToUpdate;

##### Parameter Descriptions

> `nodeToUpdate`
>   node to update in the database

method result
  self

### mountDatabases

Opens all databases

>     - mountDatabases;

method result
  self

### nameOfIdToRecnoDatabase

>     - (NSString *) nameOfIdToRecnoDatabase;

method result
  return the fully qualified name of the database idToNode

##### Discussion

`` must be set before

### nameOfkeyToGraphInfoDatabase

>     - (NSString *) nameOfkeyToGraphInfoDatabase;

method result
  name of the database used to store generic information related to a graph, such as the identifiers of all nodes

### nameOfNodesDatabase

Name of database mapping a record number to a node's data

>     - (NSString *) nameOfNodesDatabase;

### nameOfObjectToIdMapperDatabase

>     - (NSString *) nameOfObjectToIdMapperDatabase;

method result
  return the fully qualified name of the database objectToIdMapper

##### Discussion

`` must be set before

### nodeAtRecordNumber:

fetch the node at the specified record number

>     - (FTNodeImpl *) nodeAtRecordNumber: (BDBDatabaseRecordNumber *) recno;

##### Parameter Descriptions

> `recno`
>   record number related to database nodeDB

method result
  fetched node or nil if not existent

### nodeDBConfig

>     - (BDBDatabaseConfig *) nodeDBConfig;

method result
  database configuration for the node database

### nodeIterator

>     - (id <ECIterator>) nodeIterator;

method result
  iterator over all nodes of the graph

### nodeWithId:

>     - (id <FTNode>) nodeWithId: (id <FTId>) aNodeId;

method result
  return the node corresponding to the given identifier

### objectToIdMapper

>     - (id <FTObjectToIdMapper>) objectToIdMapper;

method result
  mapper for this graph

### performAction

Called by the transaction controll in order to run the transaction

>     - (BOOL) performAction;

method result
  return information about the success of this operation

### recordNumberOfNode:

>     - recordNumberOfNode: (FTNodeImpl *) node;

method result
  returns the record number of a given node.

### recordNumberOfNodeId:

>     - recordNumberOfNodeId: (id <FTId>) nodeId;

method result
  returns the record number of a given node id.

### remove

Removes the complete graph. Does not check wether the graph (or one of its elements) is still in use. (TODO)

>     - (BOOL) remove;

method result
  YES if successful, NO otherwise

### removeNode:

removes the specified node from the graph

>     - removeNode: (id <FTNode>) nodeToRemove;

##### Parameter Descriptions

> `nodeToRemove`
>   node to remove

method result
  self

##### Discussion

A node can only be removed if it contains no incoming and no outgoing links

### removeNodeFromDatabase:

removes the specified node from the database

>     - removeNodeFromDatabase: (FTNodeImpl *) node;

##### Parameter Descriptions

> `node`
>   to remove

method result
  self

##### Discussion

Removes the node from both BDB databases: idToRecnoDB and nodeDB

### removeNodeFromIdToRecnoDB:

removed the specified node from the database idToRecnoDB and returns the record number (value) of the deleted entry.

>     - removeNodeFromIdToRecnoDB: (FTNodeImpl *) node;

##### Parameter Descriptions

> `node`
>   to remove. The node will only be removed from the database, not from memory.

method result
  the value (record number) of the entry being deleted ir nil if entry could not be found

### removeNodeWithRecordNumber:

>     - (BOOL) removeNodeWithRecordNumber: (id) recordNumber;

##### Parameter Descriptions

> `recordNumber`
>   specifies the entry to delete. the record number can be determined for a given node via method recordNumberOfNode.

method result
  YES if the node has successfully been removed

### serviceWithId

Fetch a service for the specified id and node

See Also:

> serviceWithId:forNode:

>     - (id <FTService>) serviceWithId: (NSString *) aServiceId forNode: (FTNodeImpl *) aNode;

##### Parameter Descriptions

> `aServiceId`
>   id of the service
> `aNode`
>   particular node for which the service has to been offered

method result
  the specified service or nil if not existent

### serviceWithId:

Fetch a service for the specified id

>     - (id <FTService>) serviceWithId: (NSString *) aServiceId;

##### Parameter Descriptions

> `aServiceId`
>   id of the service

method result
  the specified service or nil if not existent

### serviceWithId:forNode:

Fetch a service for the specified id and node

See Also:

> serviceWithId

>     - (id <FTService>) serviceWithId: (NSString *) aServiceId forNode: (FTNodeImpl *) aNode;

##### Parameter Descriptions

> `aServiceId`
>   id of the service
> `aNode`
>   particular node for which the service has to been offered

### setupDatabases

Initializes the graph database

>     - setupDatabases;

method result
  self

##### Discussion

Has to be called when creating a graph. It creates the underlying directory and files

### unmountDatabases

closes all databases used for this graph

>     - unmountDatabases;

method result
  self

### updateNode:

removes the existing node data from the database(s) and adds the current data of the given node to the database(s)

>     - updateNode: (FTNodeImpl *) node;

##### Parameter Descriptions

> `node`
>   node to update

method result
  self

(Last Updated August 27, 2006)