Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
 *  $Id: Interface.php 7490 2010-03-29 19:53:27Z jwage $
4
 *
5
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16
 *
17
 * This software consists of voluntary contributions made by many individuals
18
 * and is licensed under the LGPL. For more information, see
19
 * <http://www.doctrine-project.org>.
20
 */
21
 
22
/**
23
 * Doctrine_Node_Interface
24
 *
25
 * @package     Doctrine
26
 * @subpackage  Node
27
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
28
 * @link        www.doctrine-project.org
29
 * @since       1.0
30
 * @version     $Revision: 7490 $
31
 * @author      Joe Simms <joe.simms@websites4.com>
32
 */
33
interface Doctrine_Node_Interface {
34
 
35
    /**
36
     * test if node has previous sibling
37
     *
38
     * @return bool
39
     */
40
    public function hasPrevSibling();
41
 
42
    /**
43
     * test if node has next sibling
44
     *
45
     * @return bool
46
     */
47
    public function hasNextSibling();
48
 
49
    /**
50
     * test if node has children
51
     *
52
     * @return bool
53
     */
54
    public function hasChildren();
55
 
56
    /**
57
     * test if node has parent
58
     *
59
     * @return bool
60
     */
61
    public function hasParent();
62
 
63
    /**
64
     * gets record of prev sibling or empty record
65
     *
66
     * @return Doctrine_Record
67
     */
68
    public function getPrevSibling();
69
 
70
    /**
71
     * gets record of next sibling or empty record
72
     *
73
     * @return Doctrine_Record
74
     */
75
    public function getNextSibling();
76
 
77
    /**
78
     * gets siblings for node
79
     *
80
     * @return array                            array of sibling Doctrine_Record objects
81
     */
82
    public function getSiblings($includeNode = false);
83
 
84
    /**
85
     * gets record of first child or empty record
86
     *
87
     * @return Doctrine_Record
88
     */
89
    public function getFirstChild();
90
 
91
    /**
92
     * gets record of last child or empty record
93
     *
94
     * @return Doctrine_Record
95
     */
96
    public function getLastChild();
97
 
98
    /**
99
     * gets children for node (direct descendants only)
100
     *
101
     * @return array                            array of sibling Doctrine_Record objects
102
     */
103
    public function getChildren();
104
 
105
    /**
106
     * gets descendants for node (direct descendants only)
107
     *
108
     * @return Iterator                         iterator to traverse descendants from node
109
     */
110
    public function getDescendants();
111
 
112
    /**
113
     * gets record of parent or empty record
114
     *
115
     * @return Doctrine_Record
116
     */
117
    public function getParent();
118
 
119
    /**
120
     * gets ancestors for node
121
     *
122
     * @return Doctrine_Collection
123
     */
124
    public function getAncestors();
125
 
126
    /**
127
     * gets path to node from root, uses record::toString() method to get node names
128
     *
129
     * @param string $seperator                 path seperator
130
     * @param bool $includeNode                 whether or not to include node at end of path
131
     * @return string                           string representation of path
132
     */
133
    public function getPath($seperator = ' > ', $includeNode = false);
134
 
135
    /**
136
     * gets level (depth) of node in the tree
137
     *
138
     * @return int
139
     */
140
    public function getLevel();
141
 
142
    /**
143
     * gets number of children (direct descendants)
144
     *
145
     * @return int
146
     */
147
    public function getNumberChildren();
148
 
149
    /**
150
     * gets number of descendants (children and their children)
151
     *
152
     * @return int
153
     */
154
    public function getNumberDescendants();
155
 
156
    /**
157
     * inserts node as parent of dest record
158
     *
159
     * @return bool
160
     */
161
    public function insertAsParentOf(Doctrine_Record $dest);
162
 
163
    /**
164
     * inserts node as previous sibling of dest record
165
     *
166
     * @return bool
167
     */
168
    public function insertAsPrevSiblingOf(Doctrine_Record $dest);
169
 
170
    /**
171
     * inserts node as next sibling of dest record
172
     *
173
     * @return bool
174
     */
175
    public function insertAsNextSiblingOf(Doctrine_Record $dest);
176
 
177
    /**
178
     * inserts node as first child of dest record
179
     *
180
     * @return bool
181
     */
182
    public function insertAsFirstChildOf(Doctrine_Record $dest);
183
 
184
    /**
185
     * inserts node as first child of dest record
186
     *
187
     * @return bool
188
     */
189
    public function insertAsLastChildOf(Doctrine_Record $dest);
190
 
191
    /**
192
     * moves node as prev sibling of dest record
193
     *
194
     */
195
    public function moveAsPrevSiblingOf(Doctrine_Record $dest);
196
 
197
    /**
198
     * moves node as next sibling of dest record
199
     *
200
     */
201
    public function moveAsNextSiblingOf(Doctrine_Record $dest);
202
 
203
    /**
204
     * moves node as first child of dest record
205
     *
206
     */
207
    public function moveAsFirstChildOf(Doctrine_Record $dest);
208
 
209
    /**
210
     * moves node as last child of dest record
211
     *
212
     */
213
    public function moveAsLastChildOf(Doctrine_Record $dest);
214
 
215
    /**
216
     * adds node as last child of record
217
     *
218
     */
219
    public function addChild(Doctrine_Record $record);
220
 
221
    /**
222
     * determines if node is leaf
223
     *
224
     * @return bool
225
     */
226
    public function isLeaf();
227
 
228
    /**
229
     * determines if node is root
230
     *
231
     * @return bool
232
     */
233
    public function isRoot();
234
 
235
    /**
236
     * determines if node is equal to subject node
237
     *
238
     * @return bool
239
     */
240
    public function isEqualTo(Doctrine_Record $subj);
241
 
242
    /**
243
     * determines if node is child of subject node
244
     *
245
     * @return bool
246
     */
247
    public function isDescendantOf(Doctrine_Record $subj);
248
 
249
    /**
250
     * determines if node is child of or sibling to subject node
251
     *
252
     * @return bool
253
     */
254
    public function isDescendantOfOrEqualTo(Doctrine_Record $subj);
255
 
256
    /**
257
     * determines if node is valid
258
     *
259
     * @return bool
260
     */
261
    public function isValidNode();
262
 
263
    /**
264
     * deletes node and it's descendants
265
     *
266
     */
267
    public function delete();
268
}