当前位置: 首页>>代码示例>>PHP>>正文


PHP Node::getId方法代码示例

本文整理汇总了PHP中Node::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::getId方法的具体用法?PHP Node::getId怎么用?PHP Node::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node的用法示例。


在下文中一共展示了Node::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderNode

 /**
  * @param Node $node
  * @return string
  */
 protected function renderNode(Node $node)
 {
     $this->setRelations($node->getId(), $node->getAttachedClasses());
     $result = $node->getId();
     # Remember that we might not always have a text to work with.
     if (!is_null($node->getText())) {
         # The style variable already contains a nice template, making our life easier.
         $result .= sprintf($node->getStyle(), $node->getText());
     }
     return $result;
 }
开发者ID:bound1ess,项目名称:mermaid-php,代码行数:15,代码来源:Printer.php

示例2: computeTree

 /**
  * Compute the tree with a backtrace stack.
  *
  * @access  protected
  * @param   array      $array    Backtrace stack.
  * @return  void
  */
 protected function computeTree(array $array = array())
 {
     $node = null;
     $child = null;
     $currentNode = $this->_tree;
     foreach ($array as $i => $trace) {
         $node = new Node($trace);
         if (true === $currentNode->childExists($node->getId())) {
             $currentNode = $currentNode->getChild($node->getId());
         } else {
             $child = new \Hoa\Tree($node);
             $currentNode->insert($child);
             $currentNode = $child;
         }
     }
     return;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:24,代码来源:Backtrace.php

示例3: remove

 /**
  * remove indexed node
  *
  * @throws \Neo4j\Exception\HttpException
  *
  * @param \Neo4j\Node $node
  * @param string $key
  * @param string $value
  *
  * @return void
  */
 public function remove(Node $node, $key, $value)
 {
     $this->_uri = $this->_db->getBaseUri() . 'index/node/' . $key . '/' . $value . '/' . $node->getId();
     list($response, $http_code) = Request::delete($this->_uri);
     if ($http_code != 204) {
         throw new \Neo4j\Exception\HttpException($http_code);
     }
 }
开发者ID:nightchiller,项目名称:pneo4j,代码行数:19,代码来源:Index.php

示例4: convertNode

 /**
  * @param Node $node
  * @return ListNode
  */
 protected function convertNode(Node $node)
 {
     if ($node instanceof ListNode) {
         return $node;
     }
     $listNode = new ListNode($node->getId(), $node->getX(), $node->getY(), 0);
     $listNode->setData($node->getData());
     return $listNode;
 }
开发者ID:tvswe,项目名称:astar,代码行数:13,代码来源:ClosedList.php

示例5: findPath

 /**
  * @param Node $start
  * @param Node $end
  * @param callable $getSuccessors
  * @return Path
  */
 public static function findPath(Node $start, Node $end, callable $getSuccessors)
 {
     self::$openList = new OpenList();
     self::$closedList = new ClosedList();
     self::$openList->add($start);
     $current = null;
     do {
         /** @var ListNode $current */
         $current = self::$openList->removeMin();
         if ($current->getId() === $end->getId()) {
             return new Path($current);
         }
         self::$closedList->add($current);
         self::expandNode($current, $end, $getSuccessors);
     } while (!self::$openList->isEmpty());
     return null;
 }
开发者ID:tvswe,项目名称:astar,代码行数:23,代码来源:Astar.php

示例6: addNode

 /**
  * Create a new node and its children
  * 
  * @param object Hierarchy $newHierarchy
  * @param object Node $oldNode
  * @param optional object Id $parentId 
  * @return void
  * @access protected
  * @since 4/17/08
  */
 protected function addNode(Hierarchy $newHierarchy, Node $oldNode, Id $parentId = null)
 {
     // If it has already been created, get it and try to set its parent
     try {
         $newNode = $newHierarchy->getNode($oldNode->getId());
         if (!is_null($parentId)) {
             try {
                 $newNode->addParent($parentId);
             } catch (Exception $e) {
                 // Do nothing if the child already exists
                 if ($e->getMessage() != "A child with the given id already exists!") {
                     throw $e;
                 }
             }
         }
     } catch (UnknownIdException $e) {
         if (is_null($parentId)) {
             $newNode = $newHierarchy->createRootNode($oldNode->getId(), $oldNode->getType(), $oldNode->getDisplayName(), $oldNode->getDescription());
         } else {
             $newNode = $newHierarchy->createNode($oldNode->getId(), $parentId, $oldNode->getType(), $oldNode->getDisplayName(), $oldNode->getDescription());
         }
         $this->nodeStatus->updateStatistics();
     }
     $oldChildren = $oldNode->getChildren();
     while ($oldChildren->hasNext()) {
         $oldChild = $oldChildren->next();
         $this->addNode($newHierarchy, $oldChild, $newNode->getId());
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:39,代码来源:migration.php

示例7: nodeToFile

 /**
  * Convert an alfresco node to a File object
  *
  * @param Node  $node
  */
 private function nodeToFile($node)
 {
     if (!$this->getConnection()) {
         return null;
     }
     if ($node == null) {
         throw new Exception("Cannot convert null node to File");
     }
     $fileObject = new File();
     $fileObject->id = $node->getId();
     $fileObject->path = $node->getPrimaryParent()->__toString();
     $fileObject->filename = $node->cm_name;
     $fileObject->title = $node->cm_title;
     $fileObject->description = $node->cm_description;
     $fileObject->created = $node->cm_created;
     $fileObject->updated = $node->cm_modified;
     $props = $node->getProperties();
     $fileObject->isprivate = ifset($props, '{simplecrm.model}isPrivate', "false") == "true" ? 1 : 0;
     return $fileObject;
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:25,代码来源:AlfrescoFileService.php

示例8: setEndNode

 public function setEndNode(Node $object)
 {
     $this->_data['end'] = $object->getId();
     return $this;
 }
开发者ID:astroanu,项目名称:phpmongograph,代码行数:5,代码来源:Connection.php

示例9: removeNode

 /**
  * @param Node $node
  * @return $this
  * @throws \Exception
  */
 public function removeNode($node)
 {
     // For reorder old node branch
     $dataReorderOld = [$this->_orderField => new \Zend_Db_Expr($this->_conn->quoteIdentifier($this->_orderField) . '-1')];
     $conditionReorderOld = $this->_conn->quoteIdentifier($this->_parentField) . '=' . $node->getData($this->_parentField) . ' AND ' . $this->_conn->quoteIdentifier($this->_orderField) . '>' . $node->getData($this->_orderField);
     $this->_conn->beginTransaction();
     try {
         $condition = $this->_conn->quoteInto("{$this->_idField}=?", $node->getId());
         $this->_conn->delete($this->_table, $condition);
         // Update old node branch
         $this->_conn->update($this->_table, $dataReorderOld, $conditionReorderOld);
         $this->_conn->commit();
     } catch (\Exception $e) {
         $this->_conn->rollBack();
         throw new \Exception('Can\'t remove tree node');
     }
     parent::removeNode($node);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Db.php

示例10: getOtherNode

 /**
  * @param Node $node
  * @return Node
  */
 public function getOtherNode(Node $node)
 {
     return $this->_node1->getId() == $node->getId() ? $this->getStartNode() : $this->getEndNode();
 }
开发者ID:nightchiller,项目名称:pneo4j,代码行数:8,代码来源:Relationship.php

示例11: __construct

 public function __construct($studentId, $courseId, $em, $student)
 {
     $this->nodes = array();
     $this->edges = array();
     $lessons = array();
     $csSkill = array();
     $cognitiveState = $em->getRepository('sociaLecompsSuperBundle:Student')->getCognitiveState($studentId);
     for ($i = 0; $i < count($cognitiveState); $i++) {
         $csSkill[$i] = $cognitiveState[$i]->getSkill()->getId();
     }
     $course = $em->getRepository('sociaLecompsSuperBundle:Course')->find($courseId);
     if ($course != null) {
         $lessons = $em->getRepository('sociaLecompsSuperBundle:Lesson')->getLessons($course);
     }
     foreach ($lessons as $lesson) {
         $rk = $lesson->getRequiredSkills();
         if (count($rk) == 0) {
             $basic = $em->getRepository('sociaLecompsSuperBundle:Skill')->findBy(array('name' => 'basic knowledge'));
             $node = new Node($basic[0], $lesson);
             $this->nodes[$node->getId()] = $node;
             $node->setInCS();
             $node->setDistance(0);
             $currentNode = $this->nodes[$node->getId()];
             $currentNode->addOut($lesson->getId());
         } else {
             foreach ($rk as $skill) {
                 /*
                  * verifico se il nodo è già esistente nel grafo
                  * se lo è devo solo aggiornare gli archi
                  * se non lo è creo il nodo e poi aggiungo l'arco
                  */
                 if (array_key_exists($skill->getId(), $this->nodes)) {
                     $currentNode = $this->nodes[$skill->getId()];
                     $currentNode->addOut($lesson->getId());
                 } else {
                     $node = new Node($skill, $lesson);
                     $this->nodes[$node->getId()] = $node;
                     if (in_array($node->getId(), $csSkill)) {
                         $cs = $em->getRepository('sociaLecompsSuperBundle:CognitiveState')->findBy(array('skill' => $node->getId(), 'student' => $studentId));
                         $node->setInCS();
                         $node->setDistance(0);
                         $node->setCertanty($cs[0]->getCertainty());
                     }
                     $currentNode = $this->nodes[$skill->getId()];
                     $currentNode->addOut($lesson->getId());
                 }
             }
         }
         $ak = $lesson->getAcquiredSkills();
         foreach ($ak as $skill) {
             if (array_key_exists($skill->getId(), $this->nodes)) {
                 $currentNode = $this->nodes[$skill->getId()];
                 $currentNode->addIn($lesson->getId());
             } else {
                 $node = new Node($skill, $lesson);
                 $this->nodes[$node->getId()] = $node;
                 if (in_array($node->getId(), $csSkill)) {
                     $cs = $em->getRepository('sociaLecompsSuperBundle:CognitiveState')->findBy(array('skill' => $node->getId(), 'student' => $studentId));
                     $node->setInCS();
                     $node->setDistance(0);
                     $node->setCertanty($cs[0]->getCertainty());
                 }
                 $currentNode = $this->nodes[$skill->getId()];
                 $currentNode->addIn($lesson->getId());
             }
         }
         $edge = new Edge($lesson);
         //crea l'arco che rappresenta la lc
         $this->edges[$edge->getId()] = $edge;
         //inserisce l'arco nell'array degli archi del grafo
     }
     //Inizializza le distanze stimate di ogni nodo con il peso minimo degli archi entranti
     foreach ($this->nodes as $node) {
         foreach ($node->getIn() as $e) {
             $edge = $this->edges[$e];
             if ($edge->getWeight() < $node->getDistance()) {
                 $node->setDistance($edge->getWeight());
             }
         }
     }
 }
开发者ID:esseara,项目名称:lecomps,代码行数:81,代码来源:Graph.php

示例12: loadNode

 /**
  * Load the given node with data from the server
  *
  * @param Node $node
  * @return boolean
  */
 public function loadNode(Node $node)
 {
     $cached = $this->getEntityCache()->getCachedEntity($node->getId(), 'node');
     if ($cached) {
         $node->setProperties($cached->getProperties());
         return true;
     }
     return $this->runCommand(new Command\GetNode($this, $node));
 }
开发者ID:BobLuo,项目名称:Neo4j,代码行数:15,代码来源:Client.php

示例13: getTheId

 /**
  * @test
  */
 public function getTheId()
 {
     $node = new Node(array('id' => 16));
     $this->assertEquals(16, $node->getId());
 }
开发者ID:bluem,项目名称:tree,代码行数:8,代码来源:NodeTest.php

示例14: addChild

 /**
  * @param Node $node
  *
  * @return $this
  */
 public function addChild(Node $node)
 {
     $this->childs[$node->getId()] = $node;
     return $this;
 }
开发者ID:krlv,项目名称:graph2sql,代码行数:10,代码来源:Edges.php

示例15: insert

 public function insert(Node $node, $priority)
 {
     $this->queue[$node->getId()] = $priority;
     $this->map[$node->getId()] = $node;
     asort($this->queue);
 }
开发者ID:letournel,项目名称:path-finder,代码行数:6,代码来源:NodePriorityQueueMin.php


注:本文中的Node::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。