/** * Check if the queue Does contain a given object * * @param mixed $datum * @return bool */ public function contains(KObjectHandlable $object) { $result = false; if ($handle = $object->getHandle()) { $result = $this->_object_list->offsetExists($handle); } return $result; }
/** * Checks if the set contains a specific object * * @param object The object to look for. * @return bool Returns TRUE if the object is in the set, FALSE otherwise. */ public function contains(KObjectHandlable $object) { return $this->_object_set->offsetExists($object->getHandle()); }
/** * Removes a row from the rowset * * The row will be removed based on it's identity_column if set or otherwise by * it's object handle. * * @param KDatabaseRowInterface $row * @return \KDatabaseRowsetAbstract * @throws InvalidArgumentException if the object doesn't implement KDatabaseRowInterface */ public function extract(KObjectHandlable $row) { if (!$row instanceof KDatabaseRowInterface) { throw new InvalidArgumentException('Row needs to implement KDatabaseRowInterface'); } if (isset($this->_identity_column)) { $handle = $row->{$this->_identity_column}; } else { $handle = $row->getHandle(); } if ($this->_object_set->offsetExists($handle)) { $this->_object_set->offsetUnset($handle); } return $this; }
/** * Get the priority of an object in the queue * * @param object A KObject instance * @return integer The command priority */ public function getPriority(KObjectHandlable $object) { if ($handle = $object->getHandle()) { $result = null; if ($this->_priority->offsetExist($handle)) { $result = $this->_priority->offsetGet($handle); } } return $result; }
/** * Removes an object from the set * * Required by interface ArrayAccess * * @param KObjectHandlable $object * @return KObjectSet * @throws \InvalidArgumentException if the object doesn't implement the KObjectHandlable interface */ public function offsetUnset($object) { if (!$object instanceof KObjectHandlable) { throw new InvalidArgumentException('Object needs to implement KObjectHandlable'); } unset($this->_data[$object->getHandle()]); return $this; }
/** * Returns the object from the set * * Required by interface ArrayAccess * * @param KObjectHandlable $object * @return KObjectHandlable * @throws InvalidArgumentException if the object doesn't implement KObjectHandlable */ public function offsetGet($object) { if (!$object instanceof KObjectHandlable) { throw new InvalidArgumentException('Object needs to implement KObjectHandlable'); } return $this->_object_set->offsetGet($object->getHandle()); }