Ejemplo n.º 1
0
        public void IteratorAdapter_original_exception_should_be_preserved()
        {
            var    iteratorAdapter = new IteratorAdapter <object>(new ThrowExceptioEnumerator <object>());
            Action action          = () => iteratorAdapter.Next();

            action.ShouldThrow <AggregateException>()
            .And.StackTrace
            .Contains("at Akka.Streams.Tests.Util.IteratorAdapterSpec.ThrowExceptioEnumerator`1.MoveNext()");
        }
Ejemplo n.º 2
0
        public int Size()
        {
            int size = 0;

            for (IIterator i = new IteratorAdapter(this.subSets.GetEnumerator()); i.HasNext(); size += ((ActorSet)i
                                                                                                        .Next()).Size())
            {
            }
            return(size);
        }
Ejemplo n.º 3
0
 public AStarFinder Contains(AStarFinder element)
 {
     for (IIterator it = new IteratorAdapter(queue.GetEnumerator()); it.HasNext();)
     {
         AStarFinder af = (AStarFinder)it.Next();
         if (af.Equals(element))
         {
             return(af);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
        private IList TestLoop1(IEnumerator e)
        {
            IList           result = new ArrayList();
            IteratorAdapter it     = new IteratorAdapter(e);

            while (it.HasNext())
            {
                object item = it.Next();
                result.Add(item);
            }
            return(result);
        }
Ejemplo n.º 5
0
        private IList <string> TestLoop1Generic(IEnumerator <string> e)
        {
            IList <string>           result = new List <string>();
            IteratorAdapter <string> it     = new IteratorAdapter <string>(e);

            while (it.HasNext())
            {
                string item = it.Next();
                result.Add(item);
            }
            return(result);
        }
Ejemplo n.º 6
0
        public override string ToString()
        {
            ICollection <string> set = this.attributes.Keys;
            string str1 = "<" + this.name;

            for (IIterator it = new IteratorAdapter(set.GetEnumerator()); it.HasNext();)
            {
                string str2 = (string)it.Next();
                str1 = str1 + " " + str2 + " = \"" + GetAttribute(str2).GetValue()
                       + "\"";
            }
            str1 = str1 + ">";
            str1 = str1 + GetContents();
            str1 = str1 + "</" + this.name + ">";
            return(str1);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 删除指定集合中的所有角色
 /// </summary>
 ///
 /// <param name="obj"></param>
 public void RemoveObjects(IList obj)
 {
     if (isClose)
     {
         return;
     }
     lock (obj)
     {
         IIterator iter = new IteratorAdapter(obj.GetEnumerator());
         while (iter.HasNext())
         {
             Actor actor = (Actor)iter.Next();
             this.RemoveObject(actor);
         }
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates events for the provided sample.
        /// </summary>
        /// <param name="sample">The sample the sample for which training <see cref="T:Event"/>s are be created.</param>
        /// <returns>The events enumerator.</returns>
        protected override IEnumerator <Event> CreateEvents(SentenceSample sample)
        {
            var events = new List <Event>();

            foreach (var sentenceSpan in sample.Sentences)
            {
                var sentenceString = sentenceSpan.GetCoveredText(sample.Document);

                for (var it = new IteratorAdapter <int>(scanner.GetPositions(sentenceString)); it.HasNext();)
                {
                    int    candidate = it.Next();
                    string type      = SentenceDetectorME.NO_SPLIT;
                    if (!it.HasNext())
                    {
                        type = SentenceDetectorME.SPLIT;
                    }
                    events.Add(new Event(type, cg.GetContext(sample.Document, sentenceSpan.Start + candidate)));
                }
            }

            return(events.GetEnumerator());
        }
Ejemplo n.º 9
0
            public void Draw(GLEx g, int x, int y)
            {
                LColor oldColor = g.GetColor();

                g.SetColor(color);
                switch (style)
                {
                case 0:
                    float alpha = 0.0f;
                    int   nx    = x + width / 2 - (int)r * 4,
                          ny    = y + height / 2 - (int)r * 4;
                    g.Translate(nx, ny);
                    for (IIterator it = new IteratorAdapter(list.GetEnumerator()); it.HasNext();)
                    {
                        RectBox s = (RectBox)it.Next();
                        alpha = alpha + 0.1f;
                        g.SetAlpha(alpha);
                        g.FillOval(s.x, s.y, s.width, s.height);
                    }
                    g.SetAlpha(1.0F);
                    g.Translate(-nx, -ny);
                    break;

                case 1:
                    g.SetLineWidth(10);
                    g.Translate(x, y);
                    g.SetColor(Fill);
                    g.DrawOval(0, 0, width, height);
                    int sa = angle % 360;
                    g.FillArc(x + (width - paintWidth) / 2, y
                              + (height - paintHeight) / 2, paintWidth, paintHeight,
                              sa, sa + ANGLE_STEP);
                    g.Translate(-x, -y);
                    g.ResetLineWidth();
                    break;
                }
                g.SetColor(oldColor);
            }