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