You are here

public function EasyRdf_Container::seek in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Container.php \EasyRdf_Container::seek()

Seek to a specific position in the container

The first item is postion 1

Parameters

integer $position The position in the container to seek to:

Throws

OutOfBoundsException

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Container.php, line 70

Class

EasyRdf_Container
Sub-class of EasyRdf_Resource that represents an RDF container (rdf:Alt, rdf:Bag and rdf:Seq)

Code

public function seek($position) {
  if (is_int($position) and $position > 0) {
    if ($this
      ->hasProperty('rdf:_' . $position)) {
      $this->position = $position;
    }
    else {
      throw new OutOfBoundsException("Unable to seek to position {$position} in the container");
    }
  }
  else {
    throw new InvalidArgumentException("Container position must be a positive integer");
  }
}