예제 #1
0
        /// <summary>
        /// Iterates through each element in the object
        /// </summary>
        /// <param name="cb">must return true to continue iteration</param>
        /// <returns></returns>
        public jQuery each(EachCallback cb)
        {
            for (int i = 0; i < this.length; i++)
            {
                if (cb(i, this.eq(i)) == false)
                {
                    break;
                }
            }

            return(this);
        }
예제 #2
0
        public void Each(EachCallback callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            LinkedListNode <T> node = m_list.First;

            while (node != null)
            {
                LinkedListNode <T> next = node.Next;
                callback(node.Value);
                node = next;
            }
        }
예제 #3
0
        private void NodeEachSub( BloodNode node, Object obj, EachCallback func, int indentLevel )
        {
            var currentNode = node;

            while( true ) {
                var is_last_child = currentNode.childNode == null;
                var is_last_brother = currentNode.nextBrother == null;

                if( func( currentNode.blood_num, obj, indentLevel, is_last_brother, is_last_child ) == EachStatus.BREAK ) {
                    throw new EachBreakException();
                }

                // 子血統があるなら、再帰で子血統ノードを解析する
                if( currentNode.childNode != null ) {
                    var childNode = currentNode.childNode;
                    this.NodeEachSub( childNode, obj, func, indentLevel + 1 );
                }

                // もう兄弟ノードがないなら抜ける
                if( currentNode.nextBrother == null ) {
                    break;
                }

                // 次の兄弟ノード
                currentNode = currentNode.nextBrother;
            }
        }
예제 #4
0
 public jQuerySE each(EachCallback cb)
 {
     return(base.each(cb) as jQuerySE);
 }
예제 #5
0
 /// <summary>
 /// ノードをループで回す
 /// </summary>
 /// <param name="func"></param>
 /// <param name="obj"></param>
 public void NodeEach( EachCallback func, Object obj )
 {
     try {
         this.NodeEachSub( this.tree_, obj, func, 0 );
     } catch( EachBreakException ) {
         // pass
     }
 }