Node: provide generic helpers

This commit is contained in:
Thomas Gelf 2015-10-06 08:59:22 +02:00
parent 1220fc4ae5
commit 675b74ada9
2 changed files with 17 additions and 17 deletions

View file

@ -205,16 +205,6 @@ class BpNode extends Node
$this->state = $this->sortStateTostate($sort_state);
}
public function countChildren()
{
return count($this->getChildren());
}
public function hasChildren()
{
return $this->countChildren() > 0;
}
public function setDisplay($display)
{
$this->display = (int) $display;

View file

@ -242,21 +242,31 @@ abstract class Node
return $this->bp->isEditMode();
}
public function hasChildren()
public function hasChildren($filter = null)
{
return false;
}
public function countChildren()
{
return 0;
}
public function getChildren()
public function getChildren($filter = null)
{
return array();
}
public function countChildren($filter = null)
{
return count($this->getChildren($filter));
}
public function hasChildren($filter = null)
{
return $this->countChildren($filter) > 0;
}
public function isEmpty()
{
return $this->countChildren() === 0;
}
public function hasAlias()
{
return false;