Source for file HarmoniTraversalInfo.class.php

Documentation is available at HarmoniTraversalInfo.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/hierarchy/TraversalInfo.php");
  4.  
  5. /**
  6. * TraversalInfo contains a Node unique Id, a Node displayName, and a Node
  7. * Level. The level of the Node represented by the node unique Id is in
  8. * relation to the startId of the Hierarchy traverse method call. Children
  9. * Nodes are represented by positive levels, parent Nodes by negative levels.
  10. * For example, a traverse of a Hierarchy has level -1 for parents of the Node
  11. * represented by startId, and a level -2 for grandparents. Similarly, the
  12. * children of the Node would have level 1, and grandchildren would have level
  13. * 2.
  14. *
  15. * <p>
  16. * OSID Version: 2.0
  17. *
  18. * @package harmoni.osid_v2.hierarchy
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: HarmoniTraversalInfo.class.php,v 1.9 2007/09/04 20:25:41 adamfranco Exp $
  24. */
  25.  
  26. class HarmoniTraversalInfo
  27. extends TraversalInfo
  28. {
  29. /**
  30. * @var object Id $_id The id for this Node.
  31. */
  32. var $_id;
  33. /**
  34. * @var string $_displayName The display name for this Node.
  35. */
  36. var $_displayName;
  37.  
  38. /**
  39. * @var integer $_depth The depth for this Node.
  40. */
  41. var $_depth;
  42. /**
  43. * Constructor.
  44. *
  45. * @param object ID $id The Id of this Node.
  46. * @param string $displayName The displayName of the Node.
  47. * @param integer $depth The depth of the Node.
  48. * @access public
  49. */
  50. function HarmoniTraversalInfo($id, $displayName, $depth) {
  51. // Check the arguments
  52. ArgumentValidator::validate($id, ExtendsValidatorRule::getRule("Id"));
  53. ArgumentValidator::validate($displayName, StringValidatorRule::getRule());
  54. ArgumentValidator::validate($depth, IntegerValidatorRule::getRule());
  55. // set the private variables
  56. $this->_id =$id;
  57. $this->_displayName = $displayName;
  58. $this->_depth = $depth;
  59. }
  60.  
  61. /**
  62. * Get the unique Id for this Node.
  63. *
  64. * @return object Id
  65. *
  66. * @throws object HierarchyException An exception with one of
  67. * the following messages defined in
  68. * org.osid.hierarchy.HierarchyException may be thrown: {@link }
  69. * org.osid.hierarchy.HierarchyException#OPERATION_FAILED
  70. * OPERATION_FAILED}, {@link }
  71. * org.osid.hierarchy.HierarchyException#PERMISSION_DENIED
  72. * PERMISSION_DENIED}, {@link }
  73. * org.osid.hierarchy.HierarchyException#CONFIGURATION_ERROR
  74. * CONFIGURATION_ERROR}, {@link }
  75. * org.osid.hierarchy.HierarchyException#UNIMPLEMENTED
  76. * UNIMPLEMENTED}
  77. *
  78. * @access public
  79. */
  80. function getNodeId () {
  81. return $this->_id;
  82. }
  83.  
  84. /**
  85. * Get the display name for this Node.
  86. *
  87. * @return string
  88. *
  89. * @throws object HierarchyException An exception with one of
  90. * the following messages defined in
  91. * org.osid.hierarchy.HierarchyException may be thrown: {@link }
  92. * org.osid.hierarchy.HierarchyException#OPERATION_FAILED
  93. * OPERATION_FAILED}, {@link }
  94. * org.osid.hierarchy.HierarchyException#PERMISSION_DENIED
  95. * PERMISSION_DENIED}, {@link }
  96. * org.osid.hierarchy.HierarchyException#CONFIGURATION_ERROR
  97. * CONFIGURATION_ERROR}, {@link }
  98. * org.osid.hierarchy.HierarchyException#UNIMPLEMENTED
  99. * UNIMPLEMENTED}
  100. *
  101. * @access public
  102. */
  103. function getDisplayName () {
  104. return $this->_displayName;
  105. }
  106.  
  107. /**
  108. * Get the level of this Node in relation to the startId of the Hierarchy
  109. * traversal method call. Descendants are assigned increasingly positive
  110. * levels; ancestors increasingly negative levels.
  111. *
  112. * @return int
  113. *
  114. * @throws object HierarchyException An exception with one of
  115. * the following messages defined in
  116. * org.osid.hierarchy.HierarchyException may be thrown: {@link }
  117. * org.osid.hierarchy.HierarchyException#OPERATION_FAILED
  118. * OPERATION_FAILED}, {@link }
  119. * org.osid.hierarchy.HierarchyException#PERMISSION_DENIED
  120. * PERMISSION_DENIED}, {@link }
  121. * org.osid.hierarchy.HierarchyException#CONFIGURATION_ERROR
  122. * CONFIGURATION_ERROR}, {@link }
  123. * org.osid.hierarchy.HierarchyException#UNIMPLEMENTED
  124. * UNIMPLEMENTED}
  125. *
  126. * @access public
  127. */
  128. function getLevel () {
  129. return $this->_depth;
  130. }
  131.  
  132. }
  133.  
  134. ?>

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