public function writeRouteItem(AssessmentTestSeeker $seeker, RouteItem $routeItem)
    {
        try {
            $this->writeTinyInt($routeItem->getOccurence());
            $this->writeShort($seeker->seekPosition($routeItem->getAssessmentItemRef()));
            $this->writeShort($seeker->seekPosition($routeItem->getTestPart()));

            $assessmentSections = $routeItem->getAssessmentSections();
            $this->writeTinyInt(count($assessmentSections));

            foreach ($assessmentSections as $assessmentSection) {
                $this->writeShort($seeker->seekPosition($assessmentSection));
            }

            $branchRules = $routeItem->getBranchRules();
            $this->writeTinyInt(count($branchRules));

            foreach ($branchRules as $branchRule) {
                $this->writeShort($seeker->seekPosition($branchRule));
            }

            $preConditions = $routeItem->getPreConditions();
            $this->writeTinyInt(count($preConditions));

            foreach ($preConditions as $preCondition) {
                $this->writeShort($seeker->seekPosition($preCondition));
            }

        } catch (BinaryStreamAccessException $e) {
            $msg = "An error occured while writing a route item.";
            throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::ROUTE_ITEM, $e);
        } catch (OutOfBoundsException $e) {
            $msg = "A QTI Component position was not found in the assessmentTest tree structure.";
            throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::ROUTE_ITEM, $e);
        }
    }
public function writeRouteItem(AssessmentTestSeeker $seeker, RouteItem $routeItem)
    {
        try {
            $this->writeTinyInt($routeItem->getOccurence());
            $this->writeShort($seeker->seekPosition($routeItem->getAssessmentItemRef()));
            $this->writeShort($seeker->seekPosition($routeItem->getTestPart()));

            $assessmentSections = $routeItem->getAssessmentSections();
            $this->writeTinyInt(count($assessmentSections));

            foreach ($assessmentSections as $assessmentSection) {
                $this->writeShort($seeker->seekPosition($assessmentSection));
            }

            $branchRules = $routeItem->getBranchRules();
            $this->writeTinyInt(count($branchRules));

            foreach ($branchRules as $branchRule) {
                $this->writeShort($seeker->seekPosition($branchRule));
            }

            $preConditions = $routeItem->getPreConditions();
            $this->writeTinyInt(count($preConditions));

            foreach ($preConditions as $preCondition) {
                $this->writeShort($seeker->seekPosition($preCondition));
            }

        } catch (BinaryStreamAccessException $e) {
            $msg = "An error occured while writing a route item.";
            throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::ROUTE_ITEM, $e);
        } catch (OutOfBoundsException $e) {
            $msg = "A QTI Component position was not found in the assessmentTest tree structure.";
            throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::ROUTE_ITEM, $e);
        }
    }
public function writeRouteItem ( AssessmentTestSeeker $ seeker , RouteItem $ routeItem ) { try { $ this -> writeTinyInt ( $ routeItem -> getOccurence ( ) ) ; $ this -> writeShort ( $ seeker -> seekPosition ( $ routeItem -> getAssessmentItemRef ( ) ) ) ; $ this -> writeShort ( $ seeker -> seekPosition ( $ routeItem -> getTestPart ( ) ) ) ; $ assessmentSections = $ routeItem -> getAssessmentSections ( ) ; $ this -> writeTinyInt ( count ( $ assessmentSections ) ) ; foreach ( $ assessmentSections as $ assessmentSection ) { $ this -> writeShort ( $ seeker -> seekPosition ( $ assessmentSection ) ) ; } $ branchRules = $ routeItem -> getBranchRules ( ) ; $ this -> writeTinyInt ( count ( $ branchRules ) ) ; foreach ( $ branchRules as $ branchRule ) { $ this -> writeShort ( $ seeker -> seekPosition ( $ branchRule ) ) ; } $ preConditions = $ routeItem -> getPreConditions ( ) ; $ this -> writeTinyInt ( count ( $ preConditions ) ) ; foreach ( $ preConditions as $ preCondition ) { $ this -> writeShort ( $ seeker -> seekPosition ( $ preCondition ) ) ; } } catch ( BinaryStreamAccessException $ e ) { $ msg = "An error occured while writing a route item." ; throw new QtiBinaryStreamAccessException ( $ msg , $ this , QtiBinaryStreamAccessException :: ROUTE_ITEM , $ e ) ; } catch ( OutOfBoundsException $ e ) { $ msg = "A QTI Component position was not found in the assessmentTest tree structure." ; throw new QtiBinaryStreamAccessException ( $ msg , $ this , QtiBinaryStreamAccessException :: ROUTE_ITEM , $ e ) ; } }
Write a route item in the current binary stream.

@param \qtism\runtime\storage\common\AssessmentTestSeeker $seeker An AssessmentTestSeeker object in order to know tree position for involved QTI Components.
@param \qtism\runtime\tests\RouteItem $routeItem A RouteItem object.
@throws \qtism\runtime\storage\binary\QtiBinaryStreamAccessException
Write a route item in the current binary stream .