Class OrderedSet

Description

The OrderedSet provides an easy way to manage a group of Ids.

This set is not persistant. Please see the TempOrderedSet and the PersistentOrderedSet for persisting sets.

  • author: Adam Franco
  • version: $Id: OrderedSet.class.php,v 1.20 2007/09/04 20:25:49 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/sets/OrderedSet.class.php (line 28)

SObject
   |
   --OrderedSet
Direct descendents
Class Description
PersistentOrderedSet The Set provides an implementation of the set interface that stores the sets of ids in a database. Note: Nothing should be implied in the order that the ids are returned.
Basket A Basket is a session-persistant ordered collection of Asset Ids. Items can be added and removed from it, as well as its contents viewed.
Variable Summary
int $_i
array $_items
object Id $_setId
Method Summary
OrderedSet OrderedSet (object Id $setId)
void addItem (object Id $id)
object Id atPosition (integer $position)
integer count ()
object Id getId ()
integer getPosition (object Id $id)
boolean hasNext ()
void initializeWithData (string $data)
boolean isInSet (object Id $id)
void moveDown (object Id $id)
void moveToBeginning (object Id $id)
void moveToEnd (object Id $id)
void moveToPosition (object Id $id, integer $position)
void moveUp (object Id $id)
object id next ()
void removeAllItems ()
void removeItem (object Id $id)
void reset ()
string toDataString ()
Variables
int $_i = -1 (line 36)
  • var: The current posititon.
  • access: private
array $_items (line 48)
  • var: The items in this set.
  • access: private
object Id $_setId (line 42)
  • var: The Id of this set.
  • access: private
Methods
Constructor OrderedSet (line 54)

Constructor.

OrderedSet OrderedSet (object Id $setId)
  • object Id $setId: The Id of this set.
addItem (line 123)

Add a new Id to the set.

  • access: public
void addItem (object Id $id)
  • object Id $id: The Id to add.

Redefined in descendants as:
atPosition (line 181)

Answer the id at the position specified, false if position is out of bounds.

  • since: 1/30/06
  • access: public
object Id atPosition (integer $position)
  • integer $position
count (line 196)

Return the number of ids in the set.

  • access: public
integer count ()
getId (line 70)

Answer the id of this set

  • since: 8/5/05
  • access: public
object Id getId ()
getPosition (line 167)

Return the current position of the id in the set.

  • access: public
integer getPosition (object Id $id)
  • object Id $id: The Id of the item to move.
hasNext (line 79)

Return TRUE if there are additional Ids; FALSE otherwise.

  • access: public
boolean hasNext ()
initializeWithData (line 300)

Initialize from a data-string

  • since: 1/30/06
  • access: public
void initializeWithData (string $data)
  • string $data
isInSet (line 89)

Return TRUE if the given Id is in the set

  • access: public
boolean isInSet (object Id $id)
  • object Id $id: The Id to check.
moveDown (line 258)

Move the specified id toward the end of the set.

  • access: public
void moveDown (object Id $id)
  • object Id $id: The Id of the item to move.

Redefined in descendants as:
moveToBeginning (line 276)

Move the specifiedId to the beginning of the set

  • since: 1/30/06
  • access: public
void moveToBeginning (object Id $id)
  • object Id $id: The Id of the item to move.
moveToEnd (line 288)

Move the specifiedId to the end of the set

  • since: 1/30/06
  • access: public
void moveToEnd (object Id $id)
  • object Id $id: The Id of the item to move.
moveToPosition (line 207)

Move the specified id to the specified position in the set.

  • access: public
void moveToPosition (object Id $id, integer $position)
  • object Id $id: The Id of the item to move.
  • integer $position: The new position of the specified id.

Redefined in descendants as:
moveUp (line 242)

Move the specified id toward the begining of the set.

  • access: public
void moveUp (object Id $id)
  • object Id $id: The Id of the item to move.

Redefined in descendants as:
next (line 98)

Return the next id

  • access: public
object id next ()
removeAllItems (line 155)

Remove all Items from the set.

  • access: public
void removeAllItems ()

Redefined in descendants as:
removeItem (line 137)

Remove an Id from the set.

  • access: public
void removeItem (object Id $id)
  • object Id $id: The Id to remove.

Redefined in descendants as:
reset (line 113)

Reset the internal pointer to the begining of the set.

  • access: public
void reset ()
toDataString (line 317)

Answer a data string for storage

  • since: 1/30/06
  • access: public
string toDataString ()

Inherited Methods

Inherited From SObject

SObject::asA()
SObject::asString()
SObject::copy()
SObject::copySameFrom()
SObject::copyTwoLevel()
SObject::deepCopy()
SObject::isEqual()
SObject::isEqualTo()
SObject::isNotEqualTo()
SObject::isNotReferenceTo()
SObject::isReferenceTo()
SObject::newFrom()
SObject::postCopy()
SObject::printableString()
SObject::shallowCopy()
SObject::_deepCopyArray()

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