2012-06-25 13:03:14 +00:00
|
|
|
<?php
|
|
|
|
trait Node {
|
2012-07-02 16:55:13 +00:00
|
|
|
/*---------------------------
|
|
|
|
This trait provides basic functionality common to nodes.
|
|
|
|
|
|
|
|
Every node has an id, and InDeX and a parent.
|
|
|
|
---------------------------*/
|
|
|
|
|
2012-07-01 18:04:01 +00:00
|
|
|
protected $idx;
|
2012-06-25 13:03:14 +00:00
|
|
|
protected $id;
|
|
|
|
protected $parent;
|
|
|
|
|
|
|
|
final function getID() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
2012-07-01 18:04:01 +00:00
|
|
|
final function getIdx() {
|
|
|
|
return $this->idx;
|
|
|
|
}
|
|
|
|
|
2012-06-25 13:03:14 +00:00
|
|
|
final function getParent() {
|
|
|
|
return $this->parent;
|
|
|
|
}
|
|
|
|
|
2012-07-01 18:04:01 +00:00
|
|
|
final function setIdx($i) {
|
|
|
|
$this->idx = $i;
|
|
|
|
}
|
|
|
|
|
|
|
|
final function setID($id) {
|
2012-06-25 13:03:14 +00:00
|
|
|
$this->id = $id;
|
|
|
|
}
|
|
|
|
|
2012-07-01 18:04:01 +00:00
|
|
|
final function setParent($p) {
|
2012-06-25 13:03:14 +00:00
|
|
|
$this->parent = $p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|