function generar_arbol_descendientes_sobre_grafo($grafo) { if (is_null($this->siguiente_caso_true) || is_null($this->siguiente_caso_false)) { throw new Exception("Error al dibujar arbol, este choice node no tiene siguientes!."); } $nombre_partida = "{$this->name}\\n({$this->accion})"; if (!empty($this->siguiente_caso_true)) { $siguiente_caso_true = Workflow::obtener_nodo($this->siguiente_caso_true); $nombre_llegada_true = "{$siguiente_caso_true->name}\\n({$siguiente_caso_true->accion})"; } else { $nombre_llegada_true = 'Ejecución Terminada'; } if (!empty($this->siguiente_caso_false)) { $siguiente_caso_false = Workflow::obtener_nodo($this->siguiente_caso_false); $nombre_llegada_false = "{$siguiente_caso_false->name}\\n({$siguiente_caso_false->accion})"; } else { $nombre_llegada_false = 'Ejecución Terminada'; } $nombre_partida = "{$this->name}\\n({$this->accion})"; $grafo->agregar($nombre_partida, $nombre_llegada_true, "VERDADERO", '#9ac836', 'octagon', 'ne'); $grafo->agregar($nombre_partida, $nombre_llegada_false, "FALSO", '#ff9c00', 'octagon', 'se'); if (!$grafo->existe_nodo_salida($nombre_llegada_true)) { $siguiente_caso_true->generar_arbol_descendientes_sobre_grafo($grafo); } if (!$grafo->existe_nodo_salida($nombre_llegada_false)) { $siguiente_caso_false->generar_arbol_descendientes_sobre_grafo($grafo); } }
function generar_arbol_descendientes_sobre_grafo($grafo) { $nombre_llegada = 'Ejecución Terminada'; $nombre_partida = "{$this->name}\\n({$this->accion})"; if (!empty($this->siguiente)) { $siguiente = Workflow::obtener_nodo($this->siguiente); $nombre_llegada = "{$siguiente->name}\\n({$siguiente->accion})"; } $grafo->agregar($nombre_partida, $nombre_llegada); if (!$grafo->existe_nodo_salida($nombre_llegada)) { $siguiente->generar_arbol_descendientes_sobre_grafo($grafo); } }
public function obtener_nodo() { return Workflow::obtener_nodo($this->node_id); }
function obtener_nodo_inicial() { $id = $this->start_node_id; assert(!is_null($id)); return Workflow::obtener_nodo($id); }