Exemplo n.º 1
0
        /// <summary> Iterates through the message tree to the next segment/group location (regardless
        /// of whether an instance of the segment exists).  If the end of the tree is
        /// reached, starts over at the root.  Only enters the first repetition of a
        /// repeating group -- explicit navigation (using the drill...() methods) is
        /// necessary to get to subsequent reps.
        /// </summary>
        /// <param name="segmentsOnly">if true, only stops at segments (not groups)
        /// </param>
        /// <param name="loop">if true, loops back to beginning when end of msg reached; if false,
        /// throws HL7Exception if end of msg reached
        /// </param>
        public virtual void  iterate(bool segmentsOnly, bool loop)
        {
            Structure start = null;

            if (this.currentChild == -1)
            {
                start = this.currentGroup;
            }
            else
            {
                start = (this.currentGroup.get_Renamed(this.childNames[this.currentChild]));
            }

            //using a non-existent direction and not allowing segment creation means that only
            //the first rep of anything is traversed.
            System.Collections.IEnumerator it = new MessageIterator(start, "doesn't exist", false);
            if (segmentsOnly)
            {
                FilterIterator.Predicate predicate = new AnonymousClassPredicate(this);
                it = new FilterIterator(it, predicate);
            }

            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            if (it.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                Structure next = (Structure)it.Current;
                drillHere(next);
            }
            else if (loop)
            {
                this.reset();
            }
            else
            {
                throw new HL7Exception("End of message reached while iterating without loop", HL7Exception.APPLICATION_INTERNAL_ERROR);
            }
        }
Exemplo n.º 2
0
        /// <summary> Iterates through the message tree to the next segment/group location (regardless
        /// of whether an instance of the segment exists).  If the end of the tree is
        /// reached, starts over at the root.  Only enters the first repetition of a
        /// repeating group -- explicit navigation (using the drill...() methods) is
        /// necessary to get to subsequent reps.
        /// </summary>
        /// <param name="segmentsOnly">if true, only stops at segments (not groups)
        /// </param>
        /// <param name="loop">if true, loops back to beginning when end of msg reached; if false,
        /// throws HL7Exception if end of msg reached
        /// </param>
        public virtual void iterate(bool segmentsOnly, bool loop)
        {
            Structure start = null;

            if (this.currentChild == - 1)
            {
                start = this.currentGroup;
            }
            else
            {
                start = (this.currentGroup.get_Renamed(this.childNames[this.currentChild]));
            }

            //using a non-existent direction and not allowing segment creation means that only
            //the first rep of anything is traversed.
            System.Collections.IEnumerator it = new MessageIterator(start, "doesn't exist", false);
            if (segmentsOnly)
            {
                FilterIterator.Predicate predicate = new AnonymousClassPredicate(this);
                it = new FilterIterator(it, predicate);
            }

            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            if (it.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                Structure next = (Structure) it.Current;
                drillHere(next);
            }
            else if (loop)
            {
                this.reset();
            }
            else
            {
                throw new HL7Exception("End of message reached while iterating without loop", HL7Exception.APPLICATION_INTERNAL_ERROR);
            }
        }
Exemplo n.º 3
0
 public FilterIterator(System.Collections.IEnumerator iter, FilterIterator.Predicate predicate)
 {
     this.iter = iter;
     this.predicate = predicate;
 }