Source for file GroupsFromNodesIterator.class.php

Documentation is available at GroupsFromNodesIterator.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/agent/AgentIterator.php");
  4. require_once(HARMONI."oki2/shared/HarmoniIterator.class.php");
  5.  
  6. /**
  7. * AgentIterator provides access to these objects sequentially, one at a time.
  8. * The purpose of all Iterators is to to offer a way for OSID methods to
  9. * return multiple values of a common type and not use an array. Returning an
  10. * array may not be appropriate if the number of values returned is large or
  11. * is fetched remotely. Iterators do not allow access to values by index,
  12. * rather you must access values in sequence. Similarly, there is no way to go
  13. * backwards through the sequence unless you place the values in a data
  14. * structure, such as an array, that allows for access by index.
  15. *
  16. * <p>
  17. * OSID Version: 2.0
  18. * </p>
  19. *
  20. * @package harmoni.osid_v2.agent
  21. *
  22. * @copyright Copyright &copy; 2005, Middlebury College
  23. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  24. *
  25. * @version $Id: GroupsFromNodesIterator.class.php,v 1.3 2007/09/04 20:25:36 adamfranco Exp $
  26. */
  27. class GroupsFromNodesIterator
  28. extends HarmoniAgentIterator
  29. // implements AgentIterator
  30.  
  31. {
  32. /**
  33. * @var object $_nodeIterator;
  34. * @access private
  35. * @since 8/30/05
  36. */
  37. var $_nodeIterator;
  38. /**
  39. * Constructor
  40. *
  41. * @param object TraversalInfoIterator $traversalInfoIterator
  42. * @return object
  43. * @access public
  44. * @since 8/30/05
  45. */
  46. function GroupsFromNodesIterator ( $nodeIterator ) {
  47. $this->_nodeIterator =$nodeIterator;
  48. }
  49. /**
  50. * Return true if there is an additional Agent ; false otherwise.
  51. *
  52. * @return boolean
  53. *
  54. * @throws object AgentException An exception with one of the
  55. * following messages defined in org.osid.agent.AgentException may
  56. * be thrown: {@link }
  57. * org.osid.agent.AgentException#OPERATION_FAILED
  58. * OPERATION_FAILED}, {@link }
  59. * org.osid.agent.AgentException#PERMISSION_DENIED
  60. * PERMISSION_DENIED}, {@link }
  61. * org.osid.agent.AgentException#CONFIGURATION_ERROR
  62. * CONFIGURATION_ERROR}, {@link }
  63. * org.osid.agent.AgentException#UNIMPLEMENTED UNIMPLEMENTED}
  64. *
  65. * @access public
  66. */
  67. function hasNext () {
  68. return $this->_nodeIterator->hasNext();
  69. }
  70.  
  71. /**
  72. * Return the next Agent.
  73. *
  74. * @return object Agent
  75. *
  76. * @throws object AgentException An exception with one of the
  77. * following messages defined in org.osid.agent.AgentException may
  78. * be thrown: {@link }
  79. * org.osid.agent.AgentException#OPERATION_FAILED
  80. * OPERATION_FAILED}, {@link }
  81. * org.osid.agent.AgentException#PERMISSION_DENIED
  82. * PERMISSION_DENIED}, {@link }
  83. * org.osid.agent.AgentException#CONFIGURATION_ERROR
  84. * CONFIGURATION_ERROR}, {@link }
  85. * org.osid.agent.AgentException#UNIMPLEMENTED UNIMPLEMENTED},
  86. * {@link org.osid.agent.AgentException#NO_MORE_ITERATOR_ELEMENTS}
  87. * NO_MORE_ITERATOR_ELEMENTS}
  88. *
  89. * @access public
  90. */
  91. function next () {
  92. $node =$this->_nodeIterator->next();
  93. $agentManager = Services::getService('Agent');
  94. $group =$agentManager->getGroup($node->getId());
  95. return $group;
  96. }
  97. /**
  98. * Gives the number of items in the iterator
  99. *
  100. * @return integer
  101. * @access public
  102. * @since 8/31/05
  103. */
  104. function count () {
  105. return $this->_nodeIterator->count();
  106. }
  107.  
  108. }
  109.  
  110. ?>

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