public function __construct(\stdClass $sd = NULL, aohs\AssetOperationHandlerService $service = NULL, $data_definition_id = NULL, $data2 = NULL, $data3 = NULL)
 {
     // a data definition block will have a data definition id in the sd object
     // a page will need to pass into the data definition id
     if (isset($sd)) {
         // store the data
         if (isset($sd->definitionId)) {
             $this->definition_id = $sd->definitionId;
             $this->type = a\DataDefinitionBlock::TYPE;
         } else {
             if (isset($data_definition_id)) {
                 $this->definition_id = $data_definition_id;
                 $this->type = a\Page::TYPE;
             }
         }
         if (isset($sd->definitionPath)) {
             $this->definition_path = $sd->definitionPath;
         }
         // initialize the arrays
         $this->children = array();
         $this->node_map = array();
         // store the data definition
         $this->data_definition = new a\DataDefinition($service, $service->createId(a\DataDefinition::TYPE, $this->definition_id));
         // turn structuredDataNode into an array
         if (isset($sd->structuredDataNodes->structuredDataNode) && !is_array($sd->structuredDataNodes->structuredDataNode)) {
             $child_nodes = array($sd->structuredDataNodes->structuredDataNode);
         } elseif (isset($sd->structuredDataNodes->structuredDataNode)) {
             $child_nodes = $sd->structuredDataNodes->structuredDataNode;
             if (self::DEBUG) {
                 u\DebugUtility::out("Number of nodes in std: " . count($child_nodes));
             }
         }
         // convert stdClass to objects
         StructuredDataNode::processStructuredDataNodes('', $this->children, $child_nodes, $this->data_definition);
     }
     $this->node_map = $this->getIdentifierNodeMap();
     $this->identifiers = array_keys($this->node_map);
     $this->host_asset = $data2;
     if (self::DEBUG) {
         u\DebugUtility::out("First node ID: " . $first_node_id);
     }
 }
 public function createNInstancesForMultipleField($number, $identifier)
 {
     $number = intval($number);
     if (!$number > 0) {
         throw new e\UnacceptableValueException(S_SPAN . "The value {$number} is not a number." . E_SPAN);
     }
     if (!$this->hasNode($identifier)) {
         throw new e\NodeException(S_SPAN . "The node {$identifier} does not exist." . E_SPAN);
     }
     $num_of_instances = $this->getNumberOfSiblings($identifier);
     if ($num_of_instances < $number) {
         while ($this->getNumberOfSiblings($identifier) != $number) {
             $this->appendSibling($identifier);
         }
     } else {
         if ($num_of_instances > $number) {
             while ($this->getNumberOfSiblings($identifier) != $number) {
                 $this->removeLastSibling($identifier);
             }
         }
     }
     // update map and identifiers
     StructuredDataNode::processStructuredDataNodes('', $this->children, $this->toStdClass()->structuredDataNodes->structuredDataNode, $this->data_definition);
     $this->node_map = $this->getIdentifierNodeMap();
     $this->identifiers = array_keys($this->node_map);
     return $this;
 }