本帖最后由 wqqjs1 于 2010-7-7 16:35 编辑 8 T1 _) m, f" Q, m. s
5 `, _+ y1 U1 `: S
下面的程序如何修改可以实现?1 R/ t" n+ j/ h7 _/ r4 J+ Y
C:\Documents and Settings\in_qq_wang\桌面\未命名.JPG
1 D) c3 V- f( x7 Q! M6 {treenode item = parnode(1);
4 b7 r- R4 l# p. c3 b t: Y9 Htreenode current = ownerobject(c);
) b6 K$ w1 h- d. H- P/**Conditional Port*/& T. E. E3 Y$ e7 ^8 ]' Q: W
/** \nIf some condition is true (equal to 1), send to a given port. Otherwise, send to a different port.*/6 c: A7 r( U% T2 Y( ]) ^
/** \nCondition: */
' M6 u: b) c2 L7 _& G: X# ]/ wint condition = /**/1/**/;/** \nPort if Condition is true: *// t9 p& Z. K2 x+ _3 r. Q
int port1 = /**/1/**/;/** \nPort if Condition is false: */$ B+ A. I5 F3 _9 w% O2 I+ m
int port2 = /**/2/**/;
0 a8 `: X9 d1 O) n( S- |. Zif (condition): O0 M' B' V2 p k1 ]: G
return port1;
" Y8 i0 @% {2 E6 T& L
! H2 L$ g0 s% W$ L- f( M! h5 zreturn port2; |