Class HarmoniHierarchy

Description

Hierarchy is a structure composed of nodes arranged in root, parent, and

child form. The Hierarchy can be traversed in several ways to determine the arrangement of nodes. A Hierarchy can allow multiple parents. A Hierarchy can allow recursion. The implementation is responsible for ensuring that the integrity of the Hierarchy is always maintained.

<p> OSID Version: 2.0 </p>

  • version: $Id: HarmoniHierarchy.class.php,v 1.22 2007/09/17 16:44:35 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright &copy; 2005, Middlebury College

Located in /harmoni/core/oki2/hierarchy/HarmoniHierarchy.class.php (line 30)

Hierarchy
   |
   --HarmoniHierarchy
Variable Summary
string $_description
string $_displayName
object _id $_id
Method Summary
HarmoniHierarchy HarmoniHierarchy (object ID $id, string $displayName, string $description, boolean $cache, ref 4)
void addNodeType (mixed $type, object Type $type )
boolean allowsRecursion ()
void clearCache ()
object Node createNode (object Id $nodeId, object Id $parentId, object Type $type, string $displayName, mixed $description, string $description )
object Node createRootNode (object Id $nodeId, object Type $nodeType, string $displayName, mixed $description, string $description )
void deleteNode (mixed $nodeId, object Id $nodeId )
object NodeIterator getAllNodes ()
string getDescription ()
string getDisplayName ()
object Id getId ()
object Node getNode (mixed $nodeId, object Id $nodeId )
object NodeIterator getNodesByType (object Type $nodeType)
object TypeIterator getNodeTypes ()
object NodeIterator getRootNodes ()
boolean nodeExists (mixed $nodeId, object Id $nodeId )
void removeNodeType (mixed $type, object Type $type )
object TraversalInfoIterator traverse (object Id $startId, int $mode, int $direction, mixed $levels, int $levels )
void updateDescription (mixed $description, string $description )
void updateDisplayName (mixed $displayName, string $displayName )
Variables
string $_description (line 54)

The description of this hierarchy.

  • var: _description
  • access: private
string $_displayName (line 46)

The display name of this hierarchy.

  • var: _displayName
  • access: private
object _id $_id (line 38)

The Id of this hierarchy.

  • access: private
Methods
Constructor HarmoniHierarchy (line 68)

Constructor.

  • access: public
HarmoniHierarchy HarmoniHierarchy (object ID $id, string $displayName, string $description, boolean $cache, ref 4)
  • object ID $id: The Id of this Hierarchy.
  • string $displayName: The displayName of the Hierarchy.
  • string $description: The description of the Hierarchy.
  • ref 4: object cache This is the HierarchyCache object. Must be the same one that all other nodes in the Hierarchy are using.
  • boolean $cache: allowsMultipleParents This is true if the hierarchy will allow multiple parents.
addNodeType (line 396)

Add a NodeType to this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, ALREADY_ADDED
void addNodeType (mixed $type, object Type $type )
  • object Type $type

Redefinition of:
Hierarchy::addNodeType()
Add a NodeType to this Hierarchy.
allowsMultipleParents (line 648)

Returns true if multiple parents are allowed; false otherwise.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
boolean allowsMultipleParents ()

Redefinition of:
Hierarchy::allowsMultipleParents()
Returns true if multiple parents are allowed; false otherwise.
allowsRecursion (line 671)

Returns true if recursion allowed; false otherwise.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
boolean allowsRecursion ()

Redefinition of:
Hierarchy::allowsRecursion()
Returns true if recursion allowed; false otherwise.
clearCache (line 731)

Clears the cache.

WARNING: NOT IN OSID

  • access: public
void clearCache ()
createNode (line 328)

Create a Node. The Node is created with the specified unique Id and initially has only the specified parent.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, UNKNOWN_PARENT_NODE, ATTEMPTED_RECURSION
object Node createNode (object Id $nodeId, object Id $parentId, object Type $type, string $displayName, mixed $description, string $description )
  • object Id $nodeId
  • object Id $parentId
  • object Type $type
  • string $displayName
  • string $description

Redefinition of:
Hierarchy::createNode()
Create a Node. The Node is created with the specified unique Id and initially has only the specified parent.
createRootNode (line 285)

Create a root Node. The Node is created with the specified unique Id, and, unlike Nodes created with createNode, initially has no parents or children.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTEDNULL_ARGUMENT, SINGLE_PARENT_HIERARCHY
object Node createRootNode (object Id $nodeId, object Type $nodeType, string $displayName, mixed $description, string $description )
  • object Id $nodeId
  • object Type $nodeType
  • string $displayName
  • string $description

Redefinition of:
Hierarchy::createRootNode()
Create a root Node. The Node is created with the specified unique Id, and, unlike Nodes created with createNode, initially has no parents or children.
deleteNode (line 365)

Delete a Node by Id. Only leaf Nodes can be deleted.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, NODE_TYPE_NOT_FOUND, INCONSISTENT_STATE
void deleteNode (mixed $nodeId, object Id $nodeId )
  • object Id $nodeId

Redefinition of:
Hierarchy::deleteNode()
Delete a Node by Id. Only leaf Nodes can be deleted.
getAllNodes (line 449)

Get all the Nodes in this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
object NodeIterator getAllNodes ()

Redefinition of:
Hierarchy::getAllNodes()
Get all the Nodes in this Hierarchy.
getDescription (line 199)

Get the description for this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
string getDescription ()

Redefinition of:
Hierarchy::getDescription()
Get the description for this Hierarchy.
getDisplayName (line 125)

Get the display name for this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
string getDisplayName ()

Redefinition of:
Hierarchy::getDisplayName()
Get the display name for this Hierarchy.
getId (line 102)

Get the unique Id for this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
object Id getId ()

Redefinition of:
Hierarchy::getId()
Get the unique Id for this Hierarchy.
getNode (line 511)

Get a Node by unique Id.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, NODE_TYPE_NOT_FOUND
object Node getNode (mixed $nodeId, object Id $nodeId )
  • object Id $nodeId

Redefinition of:
Hierarchy::getNode()
Get a Node by unique Id.
getNodesByType (line 617)

Get the Nodes of the specified Type in this Hierarchy.

WARNING: NOT IN OSID - This method is not in the OSIDs as of version 2.0.

  • return: Iterators return a set, one at a time. The Iterator's hasNext method returns true if there are additional objects available; false otherwise. The Iterator's next method returns the next object. The order of the objects returned by the Iterator is not guaranteed.
  • todo: Replace JavaDoc with PHPDoc
  • throws: HierarchyException if there is a general failure.
object NodeIterator getNodesByType (object Type $nodeType)
  • object Type $nodeType
getNodeTypes (line 561)

Get all NodeTypes used in this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
object TypeIterator getNodeTypes ()

Redefinition of:
Hierarchy::getNodeTypes()
Get all NodeTypes used in this Hierarchy.
getRootNodes (line 477)

Get the root Nodes in this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
object NodeIterator getRootNodes ()

Redefinition of:
Hierarchy::getRootNodes()
Get the root Nodes in this Hierarchy.
nodeExists (line 533)

Answer TRUE if the a node exists with the given Id

WARNING: NOT in OSID

  • access: public
boolean nodeExists (mixed $nodeId, object Id $nodeId )
  • object Id $nodeId
removeNodeType (line 426)

Remove a NodeType from this Hierarchy. Note that no Nodes can have this NodeType.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT, NODE_TYPE_IN_USE, NODE_TYPE_NOT_FOUND
void removeNodeType (mixed $type, object Type $type )
  • object Type $type

Redefinition of:
Hierarchy::removeNodeType()
Remove a NodeType from this Hierarchy. Note that no Nodes can have this NodeType.
traverse (line 705)

Traverse a Hierarchy returning information about each Node encountered.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NODE_TYPE_NOT_FOUND, UNKNOWN_TRAVERSAL_MODE, UNKNOWN_TRAVERSAL_DIRECTION
object TraversalInfoIterator traverse (object Id $startId, int $mode, int $direction, mixed $levels, int $levels )
  • object Id $startId
  • int $mode
  • int $direction
  • int $levels

Redefinition of:
Hierarchy::traverse()
Traverse a Hierarchy returning information about each Node encountered.
updateDescription (line 224)

Update the description for this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED, NULL_ARGUMENT
void updateDescription (mixed $description, string $description )
  • string $description

Redefinition of:
Hierarchy::updateDescription()
Update the description for this Hierarchy.
updateDisplayName (line 148)

Update the display name for this Hierarchy.

  • access: public
  • throws: object HierarchyException An exception with one of the following messages defined in org.osid.hierarchy.HierarchyException may be thrown: OPERATION_FAILED, PERMISSION_DENIED, CONFIGURATION_ERROR, UNIMPLEMENTED
void updateDisplayName (mixed $displayName, string $displayName )
  • string $displayName

Redefinition of:
Hierarchy::updateDisplayName()
Update the display name for this Hierarchy.

Inherited Methods

Inherited From Hierarchy

Hierarchy::addNodeType()
Hierarchy::allowsMultipleParents()
Hierarchy::allowsRecursion()
Hierarchy::createNode()
Hierarchy::createRootNode()
Hierarchy::deleteNode()
Hierarchy::getAllNodes()
Hierarchy::getDescription()
Hierarchy::getDisplayName()
Hierarchy::getId()
Hierarchy::getNode()
Hierarchy::getNodeTypes()
Hierarchy::getRootNodes()
Hierarchy::removeNodeType()
Hierarchy::traverse()
Hierarchy::TRAVERSE_DIRECTION_DOWN()
Hierarchy::TRAVERSE_DIRECTION_UP()
Hierarchy::TRAVERSE_LEVELS_ALL()
Hierarchy::TRAVERSE_MODE_BREADTH_FIRST()
Hierarchy::TRAVERSE_MODE_DEPTH_FIRST()
Hierarchy::updateDescription()
Hierarchy::updateDisplayName()

Documentation generated on Wed, 19 Sep 2007 10:24:01 -0400 by phpDocumentor 1.3.0RC3