/[suikacvs]/messaging/manakai/lib/Message/Util/ManakaiNode.dis
Suika

Contents of /messaging/manakai/lib/Message/Util/ManakaiNode.dis

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (hide annotations) (download)
Thu Sep 29 09:14:58 2005 UTC (19 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.24: +108 -58 lines
++ manakai/lib/Message/Markup/ChangeLog	29 Sep 2005 08:55:27 -0000
2005-09-29  Wakaba  <wakaba@suika.fam.cx>

	* SuikaWikiConfig21.dis (parse): Calls "orphanate"
	method for to be removed nodes.

++ manakai/lib/Message/Util/ChangeLog	29 Sep 2005 09:01:25 -0000
        * PerlCode.dis (perlLiteral): Sorts output by hash key.

	* ManakaiNode.dis (new): Sets "mn:groveReferenceCounter"
	property.
	(getNewReference): Increments "mn:groveReferenceCounter"
	property.
	(ManakaiDOM:ManakaiDOMNodeObject, ManakaiNodeStem): Don't
	check "defined" to allow "undef" value in "while" condition.
	(mn:isGroveReferenced): New code.
	(changeTreeID): New "groveRC" parameter added.
	(importTree, changeTreeID): Updates "mn:groveReferenceCounter"
	properties.
	(destroy): Uses "mn:isGroveReferenced" instead of "isExternallyReferred".
	(mn:groveReferenceCounter): New property.

2005-09-28  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/DIS/ChangeLog	29 Sep 2005 09:03:12 -0000
2005-09-28  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plGeneratePerlModule): Sorts constant
	function declarations by name.

1 wakaba 1.1 Module:
2     @QName:
3     Util:ManakaiNode
4     @FullName:
5     @@lang: en
6     @@@:
7     Manakai Generic Node Implementation
8     @Namespace:
9     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ManakaiNode#
10    
11     @Description:
12     @@lang:en
13     @@@:
14     The <Module::Util:ManakaiNode> module provides a basic
15     implementation for glaph (perhaps tree) structures.
16    
17 wakaba 1.18 @DISCore:author: DISCore|Wakaba
18 wakaba 1.1 @License:
19     license:Perl+MPL
20     @Date:
21     @@@:
22 wakaba 1.25 $Date: 2005/09/28 04:02:00 $
23 wakaba 1.1 @@ContentType:
24     dis:Date.RCS
25    
26     @Require:
27     @@Module:
28 wakaba 1.4 @@@QName:
29     DISlib:DISPerl
30 wakaba 1.1 @@@WithFor:
31     ManakaiDOM:all
32 wakaba 1.2 @@Module:
33 wakaba 1.16 @@@QName: Util|ManakaiNode
34 wakaba 1.2 @@@WithFor:
35     ManakaiDOM:Perl
36    
37     @DefaultFor:
38     ManakaiDOM:Perl
39 wakaba 1.1
40     Namespace:
41 wakaba 1.13 @DIS:
42     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
43 wakaba 1.1 @dis:
44     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
45     @dis2pm:
46     http://suika.fam.cx/~wakaba/archive/2004/11/8/dis2pm#
47 wakaba 1.4 @DISlib:
48     http://suika.fam.cx/~wakaba/archive/2004/dis/
49 wakaba 1.13 @doc:
50     http://suika.fam.cx/~wakaba/archive/2005/7/tutorial#
51 wakaba 1.1 @lang:
52     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
53     @license:
54     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
55     @ManakaiDOM:
56     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
57 wakaba 1.10 @mn:
58     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ManakaiNode#
59 wakaba 1.1 @Perl:
60     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#Perl--
61     @rdf:
62     http://www.w3.org/1999/02/22-rdf-syntax-ns#
63     @rdfs:
64     http://www.w3.org/2000/01/rdf-schema#
65     @TreeCore:\
66     @Util:
67     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
68    
69     ResourceDef:
70     @QName:
71     Util:
72     @rdf:type:
73     dis:ModuleGroup
74     @FullName:
75     @@lang:en
76     @@@:
77     The manakai support modules
78 wakaba 1.17 @DISPerl:packageName:
79 wakaba 1.14 Message::Util::
80 wakaba 1.17 @DISPerl:interfacePackageName:
81     Message::Util::IF::
82 wakaba 1.13
83 wakaba 1.1 ## -- Internal node object
84    
85     ClassDef:
86 wakaba 1.10 @resourceFor: ForFull
87     @resourceFor: ForCompact
88     @resourceFor:
89     ManakaiDOM:ForIF
90    
91     @QName:
92     @@@: NodeStem
93     @@ForCheck:
94     ManakaiDOM:ForIF
95    
96 wakaba 1.1 @QName:
97 wakaba 1.10 @@@:
98     ManakaiDOM:ManakaiDOMNodeObject
99     @@ForCheck: ForFull
100    
101     @QName:
102     @@@: ManakaiNodeStem
103     @@ForCheck: ForCompact
104    
105     @Implement:
106     @@@: NodeStem
107     @@ForCheck: ForFull
108    
109     @Implement:
110     @@@: NodeStem
111     @@ForCheck: ForCompact
112    
113 wakaba 1.1 @Description:
114     @@lang:en
115     @@@:
116     Internal (actual) node objects that is accessed via
117     <Class::ManakaiDOM:ManakaiDOMNodeReference> objects referring it.
118     @ImplNote:
119     @@lang:en
120     @@@:
121     No public interface should be defined for any class inheriting
122     this class - applications should access to nodes only via
123     <Class::ManakaiDOM:ManakaiDOMNodeReference> objects.
124     @ImplNote:
125 wakaba 1.13 @@ForCheck: ManakaiDOM|ForClass
126 wakaba 1.1 @@lang:en
127     @@@:
128 wakaba 1.13 A <Class::> object is a blessed hash
129 wakaba 1.1 reference. Each hash key and value pair is called as a
130     <DFN::property>. Currently, several core properties
131 wakaba 1.13 are defined as listed below. Applications of this class,
132     such as <Class::DOMCore:ManakaiDOMNode::ManakaiDOM:all>,
133     defines additional properties for their own purpose and scope.
134 wakaba 1.1 \
135 wakaba 1.13 {doc:fig:: <doc:caption::Core node properties>
136    
137     {doc:figBody::
138 wakaba 1.1 \
139     - <CODE::TreeCore:origin>::: An array reference, containing
140     hash key names of <DFN::origin>
141     properties for this node.
142     \
143 wakaba 1.3 - <CODE::TreeCore:subnode0>::: An array reference, containing
144     hash key names of <DFN::subnode>
145     properties for this node.
146     \
147 wakaba 1.1 - <CODE::TreeCore:subnode>::: An array reference, containing
148 wakaba 1.3 hash key names of <DFN::subnode> list
149 wakaba 1.1 properties for this node.
150     \
151     - <CODE::TreeCore:subnode2>::: An array reference, containing
152 wakaba 1.3 hash key names of <DFN::subnode> (two steps) list
153 wakaba 1.1 properties for this node.
154     \
155     - <CODE::TreeCore:irefnode>::: An array reference, containing
156     hash key names of <DFN::irefnode>
157     properties for this node.
158     \
159     - <CODE::TreeCore:anydata>::: An array reference, containing
160 wakaba 1.3 hash key names of <DFN::anydata> list
161     properties for this node.
162 wakaba 1.1 \
163     - <CODE::TreeCore:anydata2>::: An array reference, containing
164 wakaba 1.3 hash key names of <DFN::anydata> (two steps) list properties
165 wakaba 1.1 for this node.
166 wakaba 1.13 }
167 wakaba 1.1 }
168    
169     @IntMethod:
170     @@Name: new
171     @@Description:
172     @@@lang:en
173     @@@@:
174     Constructs a new instance of
175     <Class::ManakaiDOM:ManakaiDOMNodeObject> and returns it.
176 wakaba 1.22 @@Param:
177     @@@ForCheck: ForCompact
178     @@@Name: className
179     @@@Type: DISLang|String||ManakaiDOM|all
180     @@@enDesc:
181     The name of a class which is typically used as reference
182     to the node. The class <kwd:SHOULD> implement the
183     <IF::NodeRef> interface. The <QUOTE::dis> definition
184     for the class <kwd:SHOULD> play the role of <Q::mn|NodeRefRole
185     ||ManakaiDOM|all>.
186 wakaba 1.1 @@Return:
187 wakaba 1.10 @@@Type: NodeStem
188 wakaba 1.1 @@@Description:
189     @@@@lang:en
190     @@@@@:
191     The newly created <Class::ManakaiDOM:ManakaiDOMNodeObject> instance.
192 wakaba 1.7 @@@PerlDef:
193 wakaba 1.20 @@@@ForCheck: ForFull
194     @@@@@:
195 wakaba 1.1 $r = bless {
196     <Q::TreeCore:origin> => [],
197 wakaba 1.3 <Q::TreeCore:subnode0> => [],
198 wakaba 1.1 <Q::TreeCore:subnode> => [],
199     <Q::TreeCore:subnode2> => [],
200     <Q::TreeCore:irefnode> => [],
201     <Q::TreeCore:anydata> => [],
202     <Q::TreeCore:anydata2> => [],
203 wakaba 1.19 <H::mn:rc> => 0,
204     <H::mn:treeID> => <Code::ManakaiDOM:generateUniqueID>,
205     <H::mn:nodeID> => <Code::ManakaiDOM:generateUniqueID>,
206 wakaba 1.1 }, ref $self || $self;
207 wakaba 1.20 @@@PerlDef:
208     @@@@ForCheck: ForCompact
209     @@@@@:
210 wakaba 1.25 my $grc = 0;
211 wakaba 1.20 $r = bless {
212 wakaba 1.25 <H::mn:type> => $className,
213     <H::mn:groveReferenceCounter> => \$grc,
214     <H::mn:rc> => 0,
215 wakaba 1.20 <H::mn:treeID> => \ (<Code::ManakaiDOM:generateUniqueID>),
216     <H::mn:nodeID> => <Code::ManakaiDOM:generateUniqueID>,
217     }, ref $self || $self;
218 wakaba 1.10
219 wakaba 1.1 @IntMethod:
220     @@Name: newReference
221     @@Description:
222     @@@lang:en
223     @@@@:
224     Creates a new reference to this node and returns it.
225 wakaba 1.10 @@ForCheck: ForFull
226 wakaba 1.1 @@Param:
227     @@@Name: class
228     @@@Type:
229 wakaba 1.7 Perl:package-name::ManakaiDOM:all
230 wakaba 1.1 @@@Description:
231     @@@@lang:en
232     @@@@@:
233     A Perl class package name with which the newly created
234     reference is blessed. The <P::class> class must be a
235     subclass of <Class::ManakaiDOM:ManakaiDOM:ManakaiDOMNodeReference>.
236     @@Return:
237     @@@Type:
238     ManakaiDOM:ManakaiDOMNodeReference
239     @@@Description:
240     @@@@lang:en
241     @@@@@:
242     The newly created node reference.
243     @@@PerlDef:
244     $r = bless {
245 wakaba 1.19 <H::mn:node> => $self,
246 wakaba 1.7 }, ref $class ? ref $class : defined $class ? $class :
247 wakaba 1.1 <ClassName::ManakaiDOM:ManakaiDOMNodeReference>;
248 wakaba 1.19 $self->{<H::mn:rc>}++;
249 wakaba 1.6
250     @ResourceDef:
251     @@QName: getNewReference
252     @@rdf:type:
253     dis2pm:BlockCode
254 wakaba 1.20 @@ForCheck: ForCompact
255 wakaba 1.6 @@Description:
256     @@@lang:en
257     @@@@:
258     Creates a new node reference object.
259     @@ResourceDef:
260     @@@rdf:type:
261     DISPerl:CodeParameter
262     @@@Name: $object
263 wakaba 1.10 @@@Type: NodeStem
264 wakaba 1.6 @@@In:1
265     @@@enDesc:
266     A node object for which a reference is created.
267     @@@DISPerl:paramStyle: var
268     @@ResourceDef:
269     @@@rdf:type:
270     DISPerl:CodeParameter
271     @@@Name: $ref
272 wakaba 1.10 @@@Type: NodeRef
273 wakaba 1.6 @@@Out:1
274     @@@enDesc:
275     A node reference for <P::$object>. It may or may not
276     be same as <P::$object>.
277     @@@DISPerl:paramStyle: var
278     @@ResourceDef:
279     @@@rdf:type:
280     DISPerl:CodeParameter
281     @@@Name: $class
282     @@@Type:
283     Perl:package-name::ManakaiDOM:all
284     @@@enDesc:
285     A package name with which <P::$ref> is blessed.
286     @@@In:1
287     @@@DISPerl:paramStyle: any
288     @@PerlDef:
289 wakaba 1.19 $object->{<H::mn:rc>}++;
290 wakaba 1.25 ${$object->{<H::mn:groveReferenceCounter>}}++;
291 wakaba 1.6 $ref = bless {
292 wakaba 1.19 <H::mn:node> => $object,
293 wakaba 1.6 }, $class;
294    
295     @ResourceDef:
296     @@QName: getWeakReference
297     @@rdf:type:
298     dis2pm:BlockCode
299 wakaba 1.20 @@ForCheck: ForCompact
300 wakaba 1.6 @@Description:
301     @@@lang:en
302     @@@@:
303     Creates a new weak node reference object.
304     \
305     The weak node reference is actually a node reference
306     except that this code fragment does not increment
307     the reference count of the object. When all non-weak
308     references to the object are destructed, then
309     the object is destructed and any operation via
310     weak references will lead unexpected result.
311     \
312     {NOTE:: It is intended that internal code creates a weak reference
313     so that it gets access to public interface.
314     \
315     }
316     @@ResourceDef:
317     @@@rdf:type:
318     DISPerl:CodeParameter
319     @@@Name: $object
320 wakaba 1.10 @@@Type: NodeStem
321 wakaba 1.6 @@@In:1
322     @@@enDesc:
323     A node object for which a reference is created.
324     @@@DISPerl:paramStyle: var
325     @@ResourceDef:
326     @@@rdf:type:
327     DISPerl:CodeParameter
328     @@@Name: $ref
329 wakaba 1.10 @@@Type: NodeRef
330 wakaba 1.6 @@@Out:1
331     @@@enDesc:
332     A node reference for <P::$object>. It may or may not
333     be same as <P::$object>.
334     @@@DISPerl:paramStyle: var
335     @@ResourceDef:
336     @@@rdf:type:
337     DISPerl:CodeParameter
338     @@@Name: $class
339     @@@Type:
340     Perl:package-name::ManakaiDOM:all
341     @@@enDesc:
342     A package name with which <P::$ref> is blessed.
343     @@@In:1
344     @@@DISPerl:paramStyle: any
345     @@PerlDef:
346     $ref = bless {
347 wakaba 1.19 <H::mn:node> => $object,
348     <H::mn:isWeak> => true,
349 wakaba 1.8 }, $class;
350    
351     @ResourceDef:
352     @@QName: getWeakRef
353     @@rdf:type:
354     dis2pm:InlineCode
355 wakaba 1.10 @@ForCheck: ForFull
356 wakaba 1.8 @@Description:
357     @@@lang:en
358     @@@@:
359     Creates a new weak node reference object.
360     \
361     The weak node reference is actually a node reference
362     except that this code fragment does not increment
363     the reference count of the object. When all non-weak
364     references to the object are destructed, then
365     the object is destructed and any operation via
366     weak references will lead unexpected result.
367     \
368     {NOTE:: It is intended that internal code creates a weak reference
369     so that it gets access to public interface.
370     \
371     }
372     @@ResourceDef:
373     @@@rdf:type:
374     DISPerl:CodeParameter
375     @@@Name: $object
376 wakaba 1.10 @@@Type: NodeStem
377 wakaba 1.8 @@@In:1
378     @@@enDesc:
379     A node object for which a reference is created.
380     @@@DISPerl:paramStyle: var
381     @@ResourceDef:
382     @@@rdf:type:
383     DISPerl:CodeParameter
384     @@@Name: $class
385     @@@Type:
386     Perl:package-name::ManakaiDOM:all
387     @@@enDesc:
388     A package name with which <P::$ref> is blessed.
389     @@@In:1
390     @@@DISPerl:paramStyle: any
391     @@PerlDef:
392 wakaba 1.9 (bless {
393 wakaba 1.19 <H::mn:node> => $object,
394     <H::mn:isWeak> => true,
395 wakaba 1.9 }, $class)
396 wakaba 1.6
397 wakaba 1.1 @IntMethod:
398     @@Name: isExternallyReferred
399     @@Description:
400     @@@lang:en
401     @@@@:
402     Checks whether the tree containing this node has been referred
403     from the outside of the tree or not.
404     @@Return:
405     @@@Type:
406 wakaba 1.7 DISPerl:Boolean::ManakaiDOM:all
407 wakaba 1.1 @@@InCase:
408 wakaba 1.15 @@@@Value:
409     @@@@@@:1
410     @@@@@ContentType: DISCore|Boolean
411 wakaba 1.1 @@@@Description:
412     @@@@@lang:en
413     @@@@@@:
414     There is one or more nodes in the tree that has been
415     referred via <Class::ManakaiDOM:ManakaiDOMNodeReference> objects.
416     @@@InCase:
417 wakaba 1.15 @@@@Value:
418     @@@@@@:0
419     @@@@@ContentType: DISCore|Boolean
420 wakaba 1.1 @@@@Description:
421     @@@@@lang:en
422     @@@@@@: No external reference found.
423     @@@PerlDef:
424 wakaba 1.10 @@@@ForCheck: ForFull
425     @@@@@:
426 wakaba 1.19 if ($self->{<H::mn:rc>}) {
427 wakaba 1.1 $r = true;
428     } else {
429     my @node = ($self);
430     my %checked;
431 wakaba 1.25 NODES: while (@node) {
432     my $node = shift @node;
433     next NODES unless UNIVERSAL::isa ($node,
434     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>);
435 wakaba 1.19 if ($node->{<H::mn:rc>}) {
436 wakaba 1.1 $r = true;
437     last NODES;
438 wakaba 1.19 } elsif ($checked{$node->{<H::mn:nodeID>}}) {
439 wakaba 1.1 next NODES;
440     }
441     my @n;
442 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:subnode2>}}) {
443     if (ref $node->{$p} eq 'ARRAY') {
444     push @n, @{$node->{$p}};
445     } elsif (ref $node->{$p} eq 'HASH') {
446     push @n, values %{$node->{$p}};
447 wakaba 1.1 }
448     }
449 wakaba 1.3 for my $p (@n,
450     map {$node->{$_}} @{$node->{<Q::TreeCore:subnode>}}) {
451     if (ref $p eq 'ARRAY') {
452     push @node, @$p;
453     } elsif (ref $p eq 'HASH') {
454     push @node, values %$p;
455 wakaba 1.1 }
456     }
457 wakaba 1.6 for my $p (@{$node->{<Q::TreeCore:origin>}}) {
458     unshift @node, $node->{$p} if $node->{$p};
459     ## NOTE: Puts the top of the list,
460     ## since upper-level nodes are expected to be referred
461     ## more than lower-levels.
462     }
463     for my $p (@{$node->{<Q::TreeCore:subnode0>}}) {
464 wakaba 1.3 push @node, $node->{$p} if $node->{$p};
465 wakaba 1.1 }
466 wakaba 1.19 $checked{$node->{<H::mn:nodeID>}} = true;
467 wakaba 1.1 }
468     }
469 wakaba 1.10 @@@PerlDef:
470     @@@@ForCheck: ForCompact
471     @@@@@:
472 wakaba 1.19 if ($self->{<H::mn:rc>}) {
473 wakaba 1.10 $r = true;
474     } else {
475     my @node = ($self);
476     my %checked;
477 wakaba 1.25 NODES: while (@node) {
478     my $node = shift @node;
479     next NODES unless ref $node;
480 wakaba 1.19 if ($node->{<H::mn:rc>}) {
481 wakaba 1.10 $r = true;
482     last NODES;
483 wakaba 1.19 } elsif ($checked{$node->{<H::mn:nodeID>}}) {
484 wakaba 1.10 next NODES;
485     }
486     my @n;
487 wakaba 1.23 my $nt = $Message::Util::ManakaiNode::ManakaiNodeRef::Prop{
488     $node->{<H::mn:type>}
489     };
490 wakaba 1.25 for my $p (@{$nt->{<H::mn:subnode2>}}) {
491 wakaba 1.10 if (ref $node->{$p} eq 'ARRAY') {
492     push @n, @{$node->{$p}};
493     } elsif (ref $node->{$p} eq 'HASH') {
494     push @n, values %{$node->{$p}};
495     }
496     }
497     for my $p (@n,
498 wakaba 1.25 map {$node->{$_}} @{$nt->{<H::mn:subnode1>}}) {
499 wakaba 1.10 if (ref $p eq 'ARRAY') {
500     push @node, @$p;
501     } elsif (ref $p eq 'HASH') {
502     push @node, values %$p;
503     }
504     }
505 wakaba 1.25 for my $p (@{$nt->{<H::mn:origin0>}}) {
506 wakaba 1.10 unshift @node, $node->{$p} if $node->{$p};
507     ## NOTE: Puts the top of the list,
508     ## since upper-level nodes are expected to be referred
509     ## more than lower-levels.
510     }
511 wakaba 1.23 for my $p (@{$nt->{<H::mn:subnode0>}}) {
512 wakaba 1.10 push @node, $node->{$p} if $node->{$p};
513     }
514 wakaba 1.25 $checked{$node->{<H::mn:nodeID>}} = true;
515 wakaba 1.10 }
516     }
517 wakaba 1.1
518 wakaba 1.25 @ResourceDef:
519     @@QName: mn|isGroveReferenced
520     @@rdf:type: DISPerl|InlineCode
521     @@PerlDef:
522     (${$node->{<H::mn:groveReferenceCounter>}} > 0)
523     @@ForCheck: ForCompact
524    
525 wakaba 1.1 @IntMethod:
526     @@Name: destroy
527     @@Description:
528     @@@lang:en
529     @@@@:
530     Destructs the tree containing this node.
531     @@Return:
532     @@@PerlDef:
533 wakaba 1.10 @@@@ForCheck: ForFull
534     @@@@@:
535 wakaba 1.1 my @node = ($self);
536 wakaba 1.25 NODES: while (@node) {
537     my $node = shift @node;
538 wakaba 1.1 my @n;
539 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:subnode2>}}) {
540     if (ref $node->{$p} eq 'ARRAY') {
541     push @n, @{$node->{$p}};
542     } elsif (ref $node->{$p} eq 'HASH') {
543     push @n, values %{$node->{$p}};
544 wakaba 1.1 }
545     }
546 wakaba 1.3 for my $p (@n,
547     map {$node->{$_}} @{$node->{<Q::TreeCore:subnode>}}) {
548     if (ref $p eq 'ARRAY') {
549 wakaba 1.10 push @node, grep {UNIVERSAL::isa ($_,
550     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>)
551 wakaba 1.19 and defined $_->{<H::mn:nodeID>}} @$p;
552 wakaba 1.3 } elsif (ref $p eq 'HASH') {
553 wakaba 1.10 push @node, grep {UNIVERSAL::isa ($_,
554     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>)
555 wakaba 1.19 and defined $_->{<H::mn:nodeID>}}
556 wakaba 1.3 values %$p;
557 wakaba 1.1 }
558     }
559 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:origin>}},
560     \ @{$node->{<Q::TreeCore:subnode0>}}) {
561     push @node, $node->{$p}
562     if defined $node->{$p} and
563 wakaba 1.19 defined $node->{$p}->{<H::mn:nodeID>};
564 wakaba 1.1 }
565     %$node = ();
566     }
567 wakaba 1.10 @@@PerlDef:
568     @@@@ForCheck: ForCompact
569     @@@@@:
570     my @node = ($self);
571 wakaba 1.25 NODES: while (@node) {
572     my $node = shift @node;
573     next NODES unless ref $node and defined $node->{<H::mn:nodeID>};
574 wakaba 1.10 my @n;
575 wakaba 1.23 my $nt = $Message::Util::ManakaiNode::ManakaiNodeRef::Prop{
576     $node->{<H::mn:type>}
577     };
578 wakaba 1.25 for my $p (@{$nt->{<H::mn:subnode2>}||[]}) {
579 wakaba 1.10 if (ref $node->{$p} eq 'ARRAY') {
580     push @n, @{$node->{$p}};
581     } elsif (ref $node->{$p} eq 'HASH') {
582     push @n, values %{$node->{$p}};
583     }
584     }
585     for my $p (@n,
586 wakaba 1.25 map {$node->{$_}} @{$nt->{<H::mn:subnode1>}||[]}) {
587 wakaba 1.10 if (ref $p eq 'ARRAY') {
588     push @node, @$p;
589     } elsif (ref $p eq 'HASH') {
590     push @node, values %$p;
591     }
592     }
593 wakaba 1.25 for my $p (@{$nt->{<H::mn:origin0>}||[]},
594     \ @{$nt->{<H::mn:subnode0>}||[]}) {
595 wakaba 1.10 push @node, $node->{$p};
596     }
597     %$node = ();
598     }
599 wakaba 1.1 @@ImplNote:
600     @@@lang:en
601     @@@@:
602     This method is different from Perl <Perl::DESTROY> special
603     purpose method.
604     \
605     An <QUOTE::uninitialized> warning in this method might mean
606     some method puts an <Perl::undef> into a list of nodes.
607    
608     @IntMethod:
609     @@Name: importTree
610     @@Description:
611     @@@lang:en
612     @@@@:
613     Changes the tree identifier of the nodes belong to another tree
614     to be same as this node's tree identifier.
615     @@Param:
616     @@@Name: node
617     @@@Type:
618     ManakaiDOM:ManakaiDOMNodeObject
619     @@@Description:
620     @@@@lang:en
621     @@@@@:
622     Any node from the tree to change its identifier.
623     @@Return:
624     @@@PerlDef:
625 wakaba 1.10 @@@@ForCheck: ForFull
626     @@@@@:
627 wakaba 1.19 unless ($node->{<H::mn:treeID>} eq
628     $self->{<H::mn:treeID>}) {
629 wakaba 1.1 my @node = ($node);
630 wakaba 1.25 NODES: while (@node) {
631     my $node = shift @node;
632     next NODES unless UNIVERSAL::isa ($node,
633     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>);
634 wakaba 1.1 my @n;
635 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:subnode2>}}) {
636     if (ref $node->{$p} eq 'ARRAY') {
637     push @n, @{$node->{$p}};
638     } elsif (ref $node->{$p} eq 'HASH') {
639     push @n, values %{$node->{$p}};
640 wakaba 1.1 }
641     }
642 wakaba 1.3 for my $p (@n,
643     map {$node->{$_}} @{$node->{<Q::TreeCore:subnode>}}) {
644     if (ref $p eq 'ARRAY') {
645 wakaba 1.9 push @node, grep {UNIVERSAL::isa ($_,
646     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>)
647 wakaba 1.19 and $_->{<H::mn:treeID>} ne
648     $self->{<H::mn:treeID>}} @$p;
649 wakaba 1.3 } elsif (ref $p eq 'HASH') {
650 wakaba 1.9 push @node, grep {UNIVERSAL::isa ($_,
651     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>)
652 wakaba 1.19 and $_->{<H::mn:treeID>} ne
653     $self->{<H::mn:treeID>}}
654 wakaba 1.3 values %$p;
655 wakaba 1.1 }
656     }
657 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:origin>}},
658     \ @{$node->{<Q::TreeCore:subnode0>}}) {
659     push @node, $node->{$p}
660     if defined $node->{$p} and
661 wakaba 1.19 $node->{$p}->{<H::mn:treeID>} ne
662     $self->{<H::mn:treeID>};
663 wakaba 1.1 }
664 wakaba 1.19 $node->{<H::mn:treeID>} = $self->{<H::mn:treeID>};
665 wakaba 1.1 }
666     }
667 wakaba 1.10 @@@PerlDef:
668     @@@@ForCheck: ForCompact
669     @@@@@:
670     my @node = ($node);
671 wakaba 1.25 my $newgrc = $self->{<H::mn:groveReferenceCounter>};
672     my $newtid = $self->{<H::mn:treeID>};
673     NODES: while (@node) {
674     my $node = shift @node;
675     next NODES unless ref $node;
676     next NODES if ${$node->{<H::mn:treeID>}} eq $$newtid;
677 wakaba 1.10 my @n;
678 wakaba 1.23 my $nt = $Message::Util::ManakaiNode::ManakaiNodeRef::Prop{
679     $node->{<H::mn:type>}
680     };
681 wakaba 1.25 for my $p (@{$nt->{<H::mn:subnode2>}||[]}) {
682 wakaba 1.10 if (ref $node->{$p} eq 'ARRAY') {
683     push @n, @{$node->{$p}};
684     } elsif (ref $node->{$p} eq 'HASH') {
685     push @n, values %{$node->{$p}};
686     }
687     }
688     for my $p (@n,
689 wakaba 1.25 map {$node->{$_}} @{$nt->{<H::mn:subnode1>}||[]}) {
690 wakaba 1.10 if (ref $p eq 'ARRAY') {
691     push @node, @$p;
692     } elsif (ref $p eq 'HASH') {
693     push @node, values %$p;
694     }
695     }
696 wakaba 1.25 for my $p (@{$nt->{<H::mn:origin0>}||[]},
697     \ @{$nt->{<H::mn:subnode0>}||[]}) {
698 wakaba 1.10 push @node, $node->{$p};
699     }
700 wakaba 1.25
701     ${$node->{<H::mn:groveReferenceCounter>}} -= $node->{<H::mn:rc>};
702     $node->{<H::mn:treeID>} = $newtid;
703     $node->{<H::mn:groveReferenceCounter>} = $newgrc;
704     ${$node->{<H::mn:groveReferenceCounter>}} += $node->{<H::mn:rc>};
705 wakaba 1.10 }
706 wakaba 1.1
707     @IntMethod:
708     @@Name: changeTreeID
709     @@Description:
710     @@@lang:en
711     @@@@:
712     Changes tree identifier of all nodes traversable from this node.
713     @@Param:
714     @@@Name: treeID
715     @@@Type:
716 wakaba 1.7 DISPerl:String::ManakaiDOM:all
717 wakaba 1.1 @@@Description:
718     @@@@lang:en
719     @@@@@:
720     The new tree identifier.
721 wakaba 1.20 @@@InCase:
722 wakaba 1.21 @@@@Type: DISPerl|SCALAR||ManakaiDOM|all
723 wakaba 1.20 @@@@enDesc:
724     A reference to the new tree identifier.
725     The tree will reference the identifier as it.
726 wakaba 1.25 @@Param:
727     @@@ForCheck: ForCompact
728     @@@Name: groveRC
729     @@@Type: DISPerl|SCALAR||ManakaiDOM|all
730     @@@enDesc:
731     The new reference counter.
732 wakaba 1.1 @@Return:
733     @@@PerlDef:
734 wakaba 1.10 @@@@ForCheck: ForFull
735     @@@@@:
736 wakaba 1.19 unless ($self->{<H::mn:treeID>} eq $treeID) {
737 wakaba 1.1 my @node = ($self);
738 wakaba 1.25 NODES: while (@node) {
739     my $node = shift @node;
740     next NODES unless UNIVERSAL::isa ($node,
741 wakaba 1.9 <ClassName::ManakaiDOM:ManakaiDOMNodeObject>);
742 wakaba 1.1 my @n;
743 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:subnode2>}}) {
744     if (ref $node->{$p} eq 'ARRAY') {
745     push @n, @{$node->{$p}};
746     } elsif (ref $node->{$p} eq 'HASH') {
747     push @n, values %{$node->{$p}};
748 wakaba 1.1 }
749     }
750 wakaba 1.3 for my $p (@n,
751     map {$node->{$_}} @{$node->{<Q::TreeCore:subnode>}}) {
752     if (ref $p eq 'ARRAY') {
753 wakaba 1.9 push @node, grep {UNIVERSAL::isa ($_,
754     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>)
755 wakaba 1.5 and
756 wakaba 1.19 $_->{<H::mn:treeID>} ne $treeID} @$p;
757 wakaba 1.3 } elsif (ref $p eq 'HASH') {
758 wakaba 1.9 push @node, grep {UNIVERSAL::isa ($_,
759     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>)
760 wakaba 1.19 and $_->{<H::mn:treeID>} ne $treeID}
761 wakaba 1.3 values %$p;
762 wakaba 1.1 }
763     }
764 wakaba 1.3 for my $p (@{$node->{<Q::TreeCore:origin>}},
765     \ @{$node->{<Q::TreeCore:subnode0>}}) {
766     push @node, $node->{$p}
767     if defined $node->{$p} and
768 wakaba 1.19 $node->{$p}->{<H::mn:treeID>} ne $treeID;
769 wakaba 1.1 }
770 wakaba 1.19 $node->{<H::mn:treeID>} = $treeID;
771 wakaba 1.1 }
772     }
773     @@@PerlDef:
774 wakaba 1.10 @@@@ForCheck: ForCompact
775     @@@@@:
776 wakaba 1.20 my $tid = ref $treeID ? $treeID : \$treeID;
777 wakaba 1.10 my @node = ($self);
778 wakaba 1.25 NODES: while (@node) {
779     my $node = shift @node;
780     next NODES unless ref $node;
781     next NODES if ${$node->{<H::mn:treeID>}} eq $$tid;
782 wakaba 1.10 my @n;
783 wakaba 1.23 my $nt = $Message::Util::ManakaiNode::ManakaiNodeRef::Prop{
784     $node->{<H::mn:type>}
785     };
786 wakaba 1.25 for my $p (@{$nt->{<H::mn:subnode2>}||[]}) {
787 wakaba 1.10 if (ref $node->{$p} eq 'ARRAY') {
788     push @n, @{$node->{$p}};
789     } elsif (ref $node->{$p} eq 'HASH') {
790     push @n, values %{$node->{$p}};
791     }
792     }
793     for my $p (@n,
794 wakaba 1.25 map {$node->{$_}} @{$nt->{<H::mn:subnode1>}||[]}) {
795 wakaba 1.10 if (ref $p eq 'ARRAY') {
796     push @node, @$p;
797     } elsif (ref $p eq 'HASH') {
798     push @node, values %$p;
799     }
800     }
801 wakaba 1.25 for my $p (@{$nt->{<H::mn:origin0>}||[]},
802     \ @{$nt->{<H::mn:subnode0>}||[]}) {
803 wakaba 1.10 push @node, $node->{$p};
804     }
805 wakaba 1.25
806     ${$node->{<H::mn:groveReferenceCounter>}} -= $node->{<H::mn:rc>};
807 wakaba 1.20 $node->{<H::mn:treeID>} = $tid;
808 wakaba 1.25 $node->{<H::mn:groveReferenceCounter>} = $groveRC;
809     ${$node->{<H::mn:groveReferenceCounter>}} += $node->{<H::mn:rc>};
810 wakaba 1.1 }
811    
812     @IntMethod:
813     @@Name: isSameNode
814     @@Description:
815     @@@lang:en
816     @@@@:
817     Returns whether a node is the same as this node or not.
818     \
819     {NOTE:: The sameness is different from the equality;
820     two nodes are same iff they are same hash reference.
821     \
822     }
823     @@Operator:
824     @@@ContentType:
825     lang:Perl
826     @@@@: eq
827     @@Param:
828     @@@Name: node
829 wakaba 1.10 @@@Type: NodeStem
830 wakaba 1.1 @@@Description:
831     @@@@lang:en
832     @@@@@:
833     A node to compare with.
834     @@Return:
835     @@@Type:
836 wakaba 1.7 DISPerl:Boolean::ManakaiDOM:all
837 wakaba 1.1 @@@Description:
838     @@@@lang:en
839     @@@@@: Whether the two nodes are same or not.
840     @@@PerlDef:
841 wakaba 1.10 @@@@ForCheck: ForFull
842     @@@@@:
843 wakaba 1.1 if (ref $node and
844     UNIVERSAL::isa ($node,
845     <ClassName::ManakaiDOM:ManakaiDOMNodeObject>) and
846 wakaba 1.19 $node->{<H::mn:nodeID>} eq $self->{<H::mn:nodeID>}) {
847 wakaba 1.1 $r = true;
848     }
849 wakaba 1.10 @@@PerlDef:
850     @@@@ForCheck: ForCompact
851     @@@@@:
852     if (ref $node and
853 wakaba 1.23 UNIVERSAL::isa ($node, <ClassName::ManakaiNodeStem>) and
854 wakaba 1.19 $node->{<H::mn:nodeID>} eq $self->{<H::mn:nodeID>}) {
855 wakaba 1.10 $r = true;
856     }
857 wakaba 1.1 @IntMethod:
858     @@Name: orphanate
859     @@Description:
860     @@@lang:en
861     @@@@:
862     Notifies that this node (and its neibors if any) is no longer
863     part of the main tree. If the new tree containing this node
864     has been referred yet, then the tree is preserved except its
865     tree identifier has changed. Otherwise, i.e. the tree is
866     useless any more, then it is destructed.
867     \
868     {NOTE:: Interaction on deleting a relationship from multiply
869     organized <QUOTE::trees> (such as DOM tree and
870     styled displaying tree) is less studied. This
871     method might be modified or addition of another method(s)
872     might be required when style sheet, XBL, or other
873     technologies has been implemented.
874     \
875     }
876     @@Return:
877     @@@PerlDef:
878 wakaba 1.20 @@@@ForCheck: ForFull
879     @@@@@:
880     if ($self-><M::NodeStem.isExternallyReferred>) {
881     $self-><M::NodeStem.changeTreeID>
882     (<Code::ManakaiDOM:generateUniqueID>);
883     } else {
884     $self-><M::NodeStem.destroy>;
885     }
886     @@@PerlDef:
887     @@@@ForCheck: ForCompact
888     @@@@@:
889     if ($self-><M::NodeStem.isExternallyReferred>) {
890 wakaba 1.25 my $grc = 0;
891 wakaba 1.20 $self-><M::NodeStem.changeTreeID>
892 wakaba 1.25 (\(<Code::ManakaiDOM:generateUniqueID>), \$grc);
893 wakaba 1.20 } else {
894     $self-><M::NodeStem.destroy>;
895     }
896 wakaba 1.10 ##NodeStem
897 wakaba 1.1
898     ## -- Public node object
899    
900     ClassDef:
901 wakaba 1.10 @resourceFor: ForFull
902     @resourceFor: ForCompact
903     @resourceFor:
904     ManakaiDOM:ForIF
905    
906     @QName:
907     @@@: NodeRef
908     @@ForCheck:
909     ManakaiDOM:ForIF
910    
911 wakaba 1.1 @QName:
912 wakaba 1.10 @@@:
913     ManakaiDOM:ManakaiDOMNodeReference
914     @@ForCheck: ForFull
915    
916     @Implement:
917     @@@: NodeRef
918     @@ForCheck: ForFull
919    
920     @QName:
921     @@@: ManakaiNodeRef
922     @@ForCheck: ForCompact
923    
924     @Implement:
925     @@@: NodeRef
926     @@ForCheck: ForCompact
927    
928 wakaba 1.22 @DISLang:role:
929     @@@: mn|NodeRefRole
930     @@ForCheck: ForCompact
931    
932 wakaba 1.1 @Description:
933     @@lang:en
934     @@@:
935     References to the node object corresponding to it. From
936     applications' view, any node object is hidden and
937     <Class::ManakaiDOM:ManakaiDOMNodeReference> seems as if
938     the node itself.
939     @ImplNote:
940     @@lang:en
941     @@@:
942 wakaba 1.13 {P:: A <Class::ManakaiDOM:ManakaiDOMNodeReference> is a blessed hash
943 wakaba 1.1 reference; currently there is a hash key defined:
944     \
945     - <CODE::TreeCore:node>::: A node object
946     (<Class::ManakaiDOM:ManakaiDOMNodeObject>) to which
947     this is referring.
948 wakaba 1.13
949     - <CODE::TreeCore:isWeak>::: Whether the reference is <QUOTE::weak>
950     or not.
951     }
952    
953     @ResourceDef:
954     @@Name: free
955     @@rdf:type: DISLang|Method
956     @@enDesc:
957     Frees the grove referenced by this object. Once
958     this operation is done, results of operations to objects belonging
959     to the grove are unknown.
960     @@ForCheck: ForCompact
961     @@Return:
962     @@@PerlDef:
963 wakaba 1.19 $self->{<H::mn:node>}-><M::NodeStem.destroy>;
964 wakaba 1.1
965     @IntMethod:
966     @@Name: destroy
967     @@Description:
968     @@@lang:en
969     @@@@: Destroy this reference object.
970     @@Operator:
971     @@@ContentType:
972     lang:Perl
973     @@@@: DESTROY
974     @@Return:
975     @@@PerlDef:
976 wakaba 1.25 @@@@ForCheck: ForFull
977 wakaba 1.1 @@@@@:
978 wakaba 1.19 my $node = $self->{<H::mn:node>};
979 wakaba 1.1 if ($node) {
980 wakaba 1.19 CORE::delete $self->{<H::mn:node>};
981     unless ($self->{<H::mn:isWeak>}) {
982     $node->{<H::mn:rc>}--;
983 wakaba 1.10 unless ($node-><M::NodeStem.isExternallyReferred>) {
984     $node-><M::NodeStem.destroy>;
985 wakaba 1.6 }
986 wakaba 1.1 }
987     } else {
988     warn ref ($self) . q{->DESTROY: there is no associated }.
989     q{node object - you have a global variable or }.
990     qq{potential memory-leak detected\n};
991     }
992 wakaba 1.25 @@@PerlDef:
993     @@@@ForCheck: ForCompact
994     @@@@@:
995     my $node = $self->{<H::mn:node>};
996     if ($node) {
997     CORE::delete $self->{<H::mn:node>};
998     unless ($self->{<H::mn:isWeak>}) {
999     $node->{<H::mn:rc>}--;
1000     ${$node->{<H::mn:groveReferenceCounter>}}--;
1001     unless (<Code::isGroveReferenced:: $node = $node>) {
1002     $node-><M::NodeStem.destroy>;
1003     }
1004     }
1005     } else {
1006     warn ref ($self) . q{->DESTROY: there is no associated }.
1007     q{node object - you have a global variable or }.
1008     qq{potential memory-leak detected\n};
1009     }
1010 wakaba 1.1 @@@@ImplNote:
1011     @@@@@lang:en
1012     @@@@@@:
1013     {P::Warning during the global destruction might mean:
1014     \
1015     - there be a loop in the manakai internal implementation -
1016     it should be a bug.
1017     \
1018     - there be a loop created by application, e.g.
1019     event handler containing a reference to any node
1020     belonging to the same tree.
1021     \
1022     - there be a global variable that contains a node reference
1023     and it is not altered or <Perl::undef>ed until the global
1024     destruction.
1025     \
1026     - or other unknown bad situation.
1027     \
1028     }
1029     @@ImplNote:
1030     @@@lang:en
1031     @@@@:
1032     Don't override this method unintentionally - for example,
1033     inheritting <PerlModule::Tie::Array> would hide this method
1034     from that class, since that module defines its own
1035     destructor.
1036 wakaba 1.10 ##NodeRef
1037 wakaba 1.22
1038     ResourceDef:
1039     @QName: mn|NodeRefRole
1040     @rdf:type: DISLang|Role
1041     @For: =ManakaiDOM|all
1042     @enDesc:
1043     The <QUOTE::dis> definition for a class which plays the role
1044     of <Q::mn|NodeRefRole> provides a set of <QUOTE::dis> properties such
1045     as <Q::mn|subnode0> which identify the set of object internal
1046     property names (or hash key names) used to construct groves.
1047    
1048     PropDef:
1049     @QName: mn|type
1050     @mn:stemName: t
1051    
1052     PropDef:
1053     @QName: mn|noderef
1054     @dataType: DISCore|QName
1055     @multipleProperties: DISCore|UnorderedList
1056    
1057     PropDef:
1058     @QName: mn|subnode0
1059     @enDesc:
1060     A property of type <Q::mn|subnode0> takes a value of
1061     reference to another node (<Q::mn|NodeStem||ManakaiDOM|Perl>)
1062     in the same grove. The referenced node is considered
1063     to make a part of the node and just one <Q::mn|origin0>
1064     property of the referenced node <kwd:MUST> have a reference
1065     to the node. That is, these properties shows
1066     a origin-subnode-relationship.
1067     @dataType: DISCore|QName
1068     @multipleProperties: DISCore|UnorderedList
1069 wakaba 1.23 @mn:stemName: s0
1070 wakaba 1.22
1071     PropDef:
1072     @QName: mn|subnode1
1073     @enDesc:
1074     A property of type <Q::mn|subnode1> is similar to <Q::mn|subnode0>
1075     properties, but its value is an array or hash reference whose
1076     values are references to subnodes.
1077     @rdfs:subPropertyOf: mn|noderef
1078     @dataType: DISCore|QName
1079     @multipleProperties: DISCore|UnorderedList
1080 wakaba 1.23 @mn:stemName: s
1081 wakaba 1.22
1082     PropDef:
1083     @QName: mn|subnode2
1084     @enDesc:
1085     A property of type <Q::mn|subnode2> is similar to <Q::mn|subnode1>
1086     properties, but its value is an array or hash reference whose
1087     values are array or hash references whose values are
1088     references to subnodes.
1089     @rdfs:subPropertyOf: mn|noderef
1090     @dataType: DISCore|QName
1091     @multipleProperties: DISCore|UnorderedList
1092 wakaba 1.23 @mn:stemName: s2
1093 wakaba 1.22
1094     PropDef:
1095     @QName: mn|origin0
1096     @rdfs:subPropertyOf: mn|noderef
1097     @dataType: DISCore|QName
1098     @multipleProperties: DISCore|UnorderedList
1099 wakaba 1.23 @mn:stemName: o
1100 wakaba 1.22
1101     PropDef:
1102     @QName: mn|irefnode0
1103     @rdfs:subPropertyOf: mn|noderef
1104     @dataType: DISCore|QName
1105     @multipleProperties: DISCore|UnorderedList
1106 wakaba 1.23 @mn:stemName: i
1107 wakaba 1.22
1108     PropDef:
1109     @QName: mn|anydata1
1110     @rdfs:subPropertyOf: mn|noderef
1111     @dataType: DISCore|QName
1112     @multipleProperties: DISCore|UnorderedList
1113 wakaba 1.23 @mn:stemName: a1
1114 wakaba 1.22
1115     PropDef:
1116     @QName: mn|anydata2
1117     @rdfs:subPropertyOf: mn|noderef
1118     @dataType: DISCore|QName
1119     @multipleProperties: DISCore|UnorderedList
1120 wakaba 1.23 @mn:stemName: a2
1121 wakaba 1.6
1122     PropDef:
1123 wakaba 1.19 @QName: mn|nodeID
1124     @enDesc:
1125     The globally unique identifier of the node.
1126     @mn:stemName: nid
1127    
1128     PropDef:
1129     @QName: mn|treeID
1130     @enDesc:
1131     The globally unique identifier of the grove to which the
1132     node belongs.
1133     @mn:stemName: tid
1134    
1135     PropDef:
1136     @QName: mn|rc
1137     @enDesc:
1138     The number of the reference that points the node.
1139     @mn:stemName: rc
1140    
1141     PropDef:
1142 wakaba 1.25 @QName: mn|groveReferenceCounter
1143     @enDesc:
1144     A reference to the number of references that reference
1145     a node in the grove.
1146     @mn:stemName: grc
1147    
1148     PropDef:
1149 wakaba 1.19 @QName: mn|node
1150     @mn:refName: node
1151     @rdfs:domain: mn|NodeRef||ManakaiDOM|Perl
1152     @rdfs:range: mn|NodeStem||ManakaiDOM|Perl
1153    
1154     PropDef:
1155     @QName: mn|isWeak
1156 wakaba 1.6 @enDesc:
1157     Whether a reference is weak or not.
1158 wakaba 1.19 @rdfs:domain: mn|NodeRef||ManakaiDOM|Perl
1159 wakaba 1.16 @Type: DISPerl|Boolean
1160 wakaba 1.19 @mn:refName: w
1161    
1162     PropDef:
1163     @QName: mn|stemName
1164     @enDesc:
1165     The key name of the property when it is used in <Class::ManakaiNodeStem
1166     ::ManakaiDOM:Perl>.
1167     @dataType: DISCore|String
1168     @multipleProperties: DISCore|Single
1169     @rdfs:domain: rdfs|Property
1170     @rdfs:subPropertyOf: DISPerl|propHashKey
1171    
1172     PropDef:
1173     @QName: mn|refName
1174     @enDesc:
1175     The key name of the property when it is used in <Class::ManakaiNodeRef
1176     ::ManakaiDOM:Perl>.
1177     @dataType: DISCore|String
1178     @multipleProperties: DISCore|Single
1179     @rdfs:domain: rdfs|Property
1180     @rdfs:subPropertyOf: DISPerl|propHashKey
1181 wakaba 1.6
1182     ElementTypeBinding:
1183     @Name:PropDef
1184     @ElementType:
1185     dis:ResourceDef
1186     @ShadowContent:
1187     @@rdf:type:
1188     rdf:Property
1189 wakaba 1.16 @@For: =ManakaiDOM|all
1190 wakaba 1.6
1191     ElementTypeBinding:
1192     @Name:enDesc
1193     @ElementType:
1194     dis:Description
1195     @ShadowContent:
1196     @@lang:en
1197 wakaba 1.1
1198     ## -- Frequently used code fragments
1199    
1200     ResourceDef:
1201     @QName:
1202     ManakaiDOM:generateUniqueID
1203     @rdf:type:
1204     dis2pm:InlineCode
1205     @Description:
1206     @@lang:en
1207     @@@:
1208     Generates a global-unique opaque string.
1209     \
1210     {NOTE:: A URI reference is generated by this code.
1211     \
1212     }
1213 wakaba 1.16
1214     @For: =ManakaiDOM|Perl
1215    
1216 wakaba 1.1 @PerlDef:
1217     (
1218 wakaba 1.24 sprintf 'tag:suika.fam.cx,2005-09:%x:%x%s',
1219 wakaba 1.1 time, $$,
1220     ['A'..'Z', 'a'..'z', '0'..'9']->[rand 62] .
1221     ['A'..'Z', 'a'..'z', '0'..'9']->[rand 62] .
1222     ['A'..'Z', 'a'..'z', '0'..'9']->[rand 62] .
1223     ['A'..'Z', 'a'..'z', '0'..'9']->[rand 62] .
1224     ['A'..'Z', 'a'..'z', '0'..'9']->[rand 62]
1225     )
1226     ##ManakaiDOM:generateUniqueID
1227    
1228     ## -- lang:dis vocabulary
1229    
1230     TreeElementType:
1231     @QName:
1232     dis:GetProp
1233     @dataType:
1234     dis:TypeQName
1235     @rdfs:range:
1236     rdf:Property
1237     @Description:
1238     @@lang:en
1239     @@@:
1240     Gets the non-nodal value of a <Class::ManakaiDOM:ManakaiDOMNodeReference>
1241     property (actualy <Class::ManakaiDOM:ManakaiDOMNodeObject> property).
1242    
1243     TreeElementType:
1244     @QName:
1245     dis:SetProp
1246     @dataType:
1247     dis:TypeQName
1248     @rdfs:range:
1249     rdf:Property
1250     @Description:
1251     @@lang:en
1252     @@@:
1253     Sets the non-nodal value of a <Class::ManakaiDOM:ManakaiDOMNodeReference>
1254     property (actualy <Class::ManakaiDOM:ManakaiDOMNodeObject> property).
1255    
1256     ## -- Syntax sugar
1257    
1258     ElementTypeBinding:
1259     @Name: TreeElementType
1260     @ElementType:
1261     dis:ResourceDef
1262     @ShadowContent:
1263     @@rdf:type:
1264     DISLang:TreeElementType
1265 wakaba 1.16 @@For: =ManakaiDOM|all
1266 wakaba 1.1
1267     ElementTypeBinding:
1268     @Name: ClassDef
1269     @ElementType:
1270     dis:ResourceDef
1271     @ShadowContent:
1272     @@rdf:type:
1273     @@@@:
1274 wakaba 1.10 dis:MultipleResource
1275     @@@ForCheck:
1276     !ForFull !ForCompact !ManakaiDOM:ForIF
1277     @@rdf:type:
1278 wakaba 1.25 @@@@: DISLang|Interface
1279     @@@ForCheck: ManakaiDOM|ForIF
1280 wakaba 1.10 @@rdf:type:
1281 wakaba 1.25 @@@@: DISLang|Class
1282 wakaba 1.10 @@@ForCheck: ForFull
1283     @@rdf:type:
1284 wakaba 1.25 @@@@: DISLang|Class
1285 wakaba 1.10 @@@ForCheck: ForCompact
1286 wakaba 1.25 @@ForCheck: ManakaiDOM|Perl
1287 wakaba 1.10
1288     ForDef:
1289     @QName:
1290     mn:ForFull
1291 wakaba 1.25 @ISA: ManakaiDOM|ForClass
1292 wakaba 1.10
1293     ForDef:
1294     @QName:
1295     mn:ForCompact
1296 wakaba 1.25 @ISA: ManakaiDOM|ForClass
1297 wakaba 1.1
1298     ElementTypeBinding:
1299     @Name: IntMethod
1300     @ElementType:
1301     dis:ResourceDef
1302     @ShadowContent:
1303     @@rdf:type:
1304     DISLang:Method
1305     @@ManakaiDOM:isForInternal:1
1306    
1307     ElementTypeBinding:
1308     @Name: Return
1309     @ElementType:
1310     dis:ResourceDef
1311     @ShadowContent:
1312     @@rdf:type:
1313     DISLang:MethodReturn
1314    
1315     ElementTypeBinding:
1316     @Name: Param
1317     @ElementType:
1318     dis:ResourceDef
1319     @ShadowContent:
1320     @@rdf:type:
1321     DISLang:MethodParameter
1322    
1323     ElementTypeBinding:
1324     @Name: PerlDef
1325     @ElementType:
1326     dis:Def
1327     @ShadowContent:
1328     @@ContentType:
1329     lang:Perl
1330    
1331     ElementTypeBinding:
1332     @Name: InCase
1333     @ElementType:
1334     dis:ResourceDef
1335     @ShadowContent:
1336     @@rdf:type:
1337     ManakaiDOM:InCase

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24