r83175 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83174‎ | r83175 | r83176 >
Date:22:09, 3 March 2011
Author:fde
Status:deferred
Tags:
Comment:
Add function UUID to process element class and process edge class
Modified paths:
  • /trunk/extensions/SemanticResultFormats/GraphViz/SRF_Process.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Process.php
@@ -401,6 +401,8 @@
402402 protected $m_showRedLinks = false; // check and highlight red links?
403403 protected $m_redLinkColor = 'red'; // red link font color
404404 protected $m_showCompound = true; // highlight compound nodes (=subprocesses)
 405+
 406+ public $m_useHtmlNodes = true; // Set to false if you do not want to use HTML table nodes
405407
406408 // instance variables
407409 protected $m_nodes = array(); // list of all nodes
@@ -671,7 +673,19 @@
672674 // TODO I18N
673675 private $m_id = 'no_id';
674676 private $m_label = 'unlabeled';
675 -
 677+ private $m_uid;
 678+
 679+ public function getUUID(){
 680+ if (!isset($this->m_uid)){
 681+ $this->m_uid = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
 682+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
 683+ mt_rand(0, 0x0fff) | 0x4000,
 684+ mt_rand(0, 0x3fff) | 0x8000,
 685+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
 686+ }
 687+
 688+ return $this->m_uid;
 689+ }
676690 public function getId() {
677691 return $this->m_id;
678692 }
@@ -920,9 +934,15 @@
921935 //
922936 // render node itself
923937 //
924 - $res =
925 - '"' . $this->getId() . '" [shape=plaintext,label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">' . $compound . '</TD><TD BORDER="0" WIDTH="80%"></TD><TD ALIGN="RIGHT" BORDER="0" WIDTH="20px"' . $status . '></TD><TD ALIGN="RIGHT" BORDER="0" WIDTH="20px"' . $discussion . '></TD></TR><TR><TD COLSPAN="4" PORT="port1" HREF="[[' . $this->getId() . ']]" TOOLTIP="' . $this->getLabel() .'"><FONT' . $high .'>' . $this->getLabel() . '</FONT></TD> </TR></TABLE>>];
926 - ';
 938+ if ($this->m_process->m_useHtmlNodes){
 939+ $res =
 940+ '"' . $this->getId() . '" [shape=plaintext,label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">' . $compound . '</TD><TD BORDER="0" WIDTH="80%"></TD><TD ALIGN="RIGHT" BORDER="0" WIDTH="20px"' . $status . '></TD><TD ALIGN="RIGHT" BORDER="0" WIDTH="20px"' . $discussion . '></TD></TR><TR><TD COLSPAN="4" PORT="port1" HREF="[[' . $this->getId() . ']]" TOOLTIP="' . $this->getLabel() .'"><FONT' . $high .'>' . $this->getLabel() . '</FONT></TD> </TR></TABLE>>];
 941+ ';
 942+ } else {
 943+ $res =
 944+ '"' . $this->getId() . '"[label="' . $this->getLabel() . '",shape=rect, height=1.5, URL="[[' . $this->getId() . ']]"];
 945+ ';
 946+ }
927947
928948 //
929949 // render outgoing node
@@ -986,6 +1006,7 @@
9871007 abstract class ProcessEdge{
9881008
9891009 private $m_id;
 1010+ private $m_uid;
9901011
9911012 public function getId(){
9921013 if (!isset($this->m_id)){
@@ -995,6 +1016,18 @@
9961017 return $this->m_id;
9971018 }
9981019
 1020+ public function getUUID(){
 1021+ if (!isset($this->m_uid)){
 1022+ $this->m_uid = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
 1023+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
 1024+ mt_rand(0, 0x0fff) | 0x4000,
 1025+ mt_rand(0, 0x3fff) | 0x8000,
 1026+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
 1027+ }
 1028+
 1029+ return $this->m_uid;
 1030+ }
 1031+
9991032 abstract public function getSucc();
10001033 abstract public function getPred();
10011034

Status & tagging log