2012-06-25 13:03:14 +00:00
|
|
|
<?php
|
2012-07-08 16:11:25 +00:00
|
|
|
abstract class Node {
|
2012-07-02 16:55:13 +00:00
|
|
|
/*---------------------------
|
2012-07-08 16:11:25 +00:00
|
|
|
This class provides basic functionality common to nodes.
|
2012-07-02 16:55:13 +00:00
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
Every node has an id and a parent.
|
2012-07-02 16:55:13 +00:00
|
|
|
---------------------------*/
|
|
|
|
|
2012-06-25 13:03:14 +00:00
|
|
|
protected $id;
|
|
|
|
protected $parent;
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
function Node() {
|
2012-08-20 13:52:35 +00:00
|
|
|
// dummy constructor
|
2012-06-25 13:03:14 +00:00
|
|
|
}
|
|
|
|
|
2012-07-08 16:11:25 +00:00
|
|
|
final function getID() {
|
|
|
|
return $this->id;
|
2012-07-01 18:04:01 +00:00
|
|
|
}
|
|
|
|
|
2012-06-25 13:03:14 +00:00
|
|
|
final function getParent() {
|
|
|
|
return $this->parent;
|
|
|
|
}
|
|
|
|
|
2012-07-01 18:04:01 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|