Example #1
2
        public static void report(StringWriter output, IList<Machine> machines, Robot robot)
        {
            output.Write("<h1>FACTORY REPORT</h1>\n");

            IEnumerator<Machine> line = machines.GetEnumerator();
            while (line.MoveNext())
            {
                Machine machine = line.Current;
                output.Write("<h2>" + machine.Name() + "</h2>\n");
                output.Write("<ul>\n");
                output.Write("<li>location = " + machine.Location() + "</li>\n");

                if (machine.Bin() != null)
                    output.Write("<li>bin containing " + machine.Bin() + "</li>\n");
                else
                    output.Write("<li>no bin</li>\n");

                output.Write("</ul>\n");
            }

            output.Write("<h2>Robot</h2>\n<ul>\n");
            if (robot.Location() != null)
                output.Write("<li>location = " + robot.Location().Name() + "</li>\n");

            if (robot.Bin() != null)
                output.Write("<li>bin containing " + robot.Bin() + "</li>\n");

            output.Write("</ul>\n");
        }
 /// <summary>
 /// Simplify a collection of <c>TaggedLineString</c>s.
 /// </summary>
 /// <param name="taggedLines">The collection of lines to simplify.</param>
 public virtual void Simplify(IList taggedLines)
 {
     for (IEnumerator i = taggedLines.GetEnumerator(); i.MoveNext(); )
         _inputIndex.Add((TaggedLineString)i.Current);
     for (IEnumerator i = taggedLines.GetEnumerator(); i.MoveNext(); )
     {
         TaggedLineStringSimplifier tlss
                       = new TaggedLineStringSimplifier(_inputIndex, _outputIndex);
         tlss.DistanceTolerance = _distanceTolerance;
         tlss.Simplify((TaggedLineString)i.Current);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="edges"></param>
 /// <param name="si"></param>
 /// <param name="testAllSegments"></param>
 public override void ComputeIntersections(IList edges, SegmentIntersector si, bool testAllSegments)
 {
     for (IEnumerator i0 = edges.GetEnumerator(); i0.MoveNext(); )
     {
         Edge edge0 = (Edge)i0.Current;
         for (IEnumerator i1 = edges.GetEnumerator(); i1.MoveNext(); )
         {
             Edge edge1 = (Edge)i1.Current;
             if (testAllSegments || edge0 != edge1)
                 ComputeIntersects(edge0, edge1, si);
         }
     }
 }
 protected override void PerformOperations(IList<IAccount> selectedAccs)
 {
     // Decides about to perform a write or read operation.
       int res = rnd.Next(100);
       if (res < UpdatesTax) {
     WriteOperations(selectedAccs.GetEnumerator());
     nrOfWriteIterations++;
       }
       else {
     int totalBal = ReadOperations(selectedAccs.GetEnumerator());
     int avgBal = totalBal / selectedAccs.Count;
     if (avgBal > maxAvgBalance) maxAvgBalance = avgBal;
     nrOfReadIterations++;
       }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dirEdgeList"></param>
        public void FindEdge(IList dirEdgeList)
        {
            /*
             * Check all forward DirectedEdges only.  This is still general,
             * because each edge has a forward DirectedEdge.
             */
            for (IEnumerator i = dirEdgeList.GetEnumerator(); i.MoveNext(); )
            {
                DirectedEdge de = (DirectedEdge) i.Current;
                if (!de.IsForward) continue;
                CheckForRightmostCoordinate(de);
            }

            /*
             * If the rightmost point is a node, we need to identify which of
             * the incident edges is rightmost.
             */
            Assert.IsTrue(minIndex != 0 || minCoord.Equals(minDe.Coordinate), "inconsistency in rightmost processing");
            if (minIndex == 0)
                 FindRightmostEdgeAtNode();
            else FindRightmostEdgeAtVertex();

            /*
             * now check that the extreme side is the R side.
             * If not, use the sym instead.
             */
            orientedDe = minDe;
            Positions rightmostSide = GetRightmostSide(minDe, minIndex);
            if (rightmostSide == Positions.Left)
                orientedDe = minDe.Sym;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SmallBlockTableWriter"/> class.
        /// </summary>
        /// <param name="documents">a IList of POIFSDocument instances</param>
        /// <param name="root">the Filesystem's root property</param>
        public SmallBlockTableWriter(POIFSBigBlockSize bigBlockSize, IList documents,
                                     RootProperty root)
        {
            _sbat = new BlockAllocationTableWriter(bigBlockSize);
            _small_blocks = new ArrayList();
            _root         = root;
            IEnumerator iter = documents.GetEnumerator();

            while (iter.MoveNext())
            {
                POIFSDocument   doc    = ( POIFSDocument ) iter.Current;
                BlockWritable[] blocks = doc.SmallBlocks;

                if (blocks.Length != 0)
                {
                    doc.StartBlock=_sbat.AllocateSpace(blocks.Length);
                    for (int j = 0; j < blocks.Length; j++)
                    {
                        _small_blocks.Add(blocks[ j ]);
                    }
                } else {
            	    doc.StartBlock=POIFSConstants.END_OF_CHAIN;
                }
            }
            _sbat.SimpleCreateBlocks();
            _root.Size=_small_blocks.Count;
            _big_block_count = SmallDocumentBlock.Fill(bigBlockSize, _small_blocks);
        }
Example #7
1
		private void StoreAll(IList expected)
		{
			for (IEnumerator objIter = expected.GetEnumerator(); objIter.MoveNext(); )
			{
				object obj = objIter.Current;
			}
		}
Example #8
1
        public static IList<CommandArgument> Load(IList<string> arguments)
        {
            var ret = new List<CommandArgument>();

            var enumerator = arguments.GetEnumerator();
            if (!enumerator.MoveNext())
                return ret;

            while (true)
            {
                if (enumerator.Current.StartsWith("-"))
                {
                    var argument = enumerator.Current.Substring(1);
                    bool hasNext = enumerator.MoveNext();
                    string value = hasNext && !enumerator.Current.StartsWith("-") ? enumerator.Current : null;

                    ret.Add(new CommandArgument { Argument = argument, Value = value });

                    if (hasNext && enumerator.Current.StartsWith("-")) //Skip movenext
                        continue;
                }
                else
                {
                    ret.Add(new CommandArgument { Value = enumerator.Current });
                }

                if (!enumerator.MoveNext())
                    break;
            }

            return ret;
        }
Example #9
1
 public ListEnumerator(IList list, int offset)
 {
     this.original = list;
     this.enumerator = list.GetEnumerator();
     this.offset = offset;
     this.AdjustOffset();
 }
Example #10
1
 /// <summary>
 /// Returns a List containing the parent Edge (possibly null) for each of the given
 /// DirectedEdges.
 /// </summary>
 /// <param name="dirEdges"></param>
 /// <returns></returns>
 public static IList ToEdges(IList dirEdges)
 {
     IList edges = new ArrayList();
     for (IEnumerator i = dirEdges.GetEnumerator(); i.MoveNext(); ) 
         edges.Add(((DirectedEdge) i.Current).parentEdge);            
     return edges;
 }
Example #11
1
        /// <summary>
        /// Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
        /// The innermost enclosing ring is the <i>smallest</i> enclosing ring.
        /// The algorithm used depends on the fact that:
        /// ring A contains ring B iff envelope(ring A) contains envelope(ring B).
        /// This routine is only safe to use if the chosen point of the hole
        /// is known to be properly contained in a shell
        /// (which is guaranteed to be the case if the hole does not touch its shell).
        /// </summary>
        /// <param name="shellList"></param>
        /// <param name="testEr"></param>
        /// <returns>Containing EdgeRing, if there is one, OR
        /// null if no containing EdgeRing is found.</returns>
        public static EdgeRing FindEdgeRingContaining(EdgeRing testEr, IList shellList)
        {
            ILinearRing teString = testEr.Ring;
            IEnvelope testEnv = teString.EnvelopeInternal;

            EdgeRing minShell = null;
            IEnvelope minEnv = null;
            for (IEnumerator it = shellList.GetEnumerator(); it.MoveNext(); )
            {
                EdgeRing tryShell = (EdgeRing) it.Current;
                ILinearRing tryRing = tryShell.Ring;
                IEnvelope tryEnv = tryRing.EnvelopeInternal;
                if (minShell != null)
                    minEnv = minShell.Ring.EnvelopeInternal;
                bool isContained = false;
                // the hole envelope cannot equal the shell envelope
                if (tryEnv.Equals(testEnv)) continue;

                // ICoordinate testPt = PointNotInList(teString.Coordinates, tryRing.Coordinates);
                ICoordinate testPt = CoordinateArrays.PointNotInList(teString.Coordinates, tryRing.Coordinates);
                if (tryEnv.Contains(testEnv) && CGAlgorithms.IsPointInRing(testPt, tryRing.Coordinates))
                    isContained = true;
                // check if this new containing ring is smaller than the current minimum ring
                if (isContained)
                {
                    if (minShell == null || minEnv.Contains(tryEnv))
                        minShell = tryShell;
                }
            }
            return minShell;
        }
Example #12
1
 public NumericRange(IList<double> values)
 {
     double num3;
     double num4;
     double current;
     Func<double, double> selector = null;
     double num = 0.0;
     double num2 = 0.0;
     goto Label_016A;
     Label_00F1:
     using (IEnumerator<double> enumerator = values.GetEnumerator())
     {
         goto Label_011B;
     Label_00FB:
         if ((((uint) current) - ((uint) num)) > uint.MaxValue)
         {
             goto Label_0142;
         }
         num4 += current * current;
     Label_011B:
         if (!enumerator.MoveNext())
         {
             goto Label_0157;
         }
         current = enumerator.Current;
         num = Math.Max(num, current);
         num2 = Math.Min(num2, current);
     Label_0142:
         num3 += current;
         goto Label_00FB;
     }
     Label_0157:
     this._xdc8f3f8857bee4c6 = values.Count;
     this._x628ea9b89457a2a9 = num;
     this._xd12d1dba8a023d95 = num2;
     this._x0eb49ee242305597 = num3 / ((double) this._xdc8f3f8857bee4c6);
     this._xcce91100698a4514 = Math.Sqrt(num4 / ((double) this._xdc8f3f8857bee4c6));
     if (((((uint) num2) & 0) != 0) || ((((uint) num2) + ((uint) current)) >= 0))
     {
         if (selector == null)
         {
             selector = new Func<double, double>(this, (IntPtr) this.xf29670e286f5562f);
         }
         double num6 = values.Sum<double>(selector);
         this._x8db8a12c7e795fea = Math.Sqrt(num6 / ((double) this._xdc8f3f8857bee4c6));
         if ((((uint) current) + ((uint) num4)) > uint.MaxValue)
         {
             goto Label_00F1;
         }
         if ((((uint) num6) - ((uint) current)) <= uint.MaxValue)
         {
             return;
         }
     }
     Label_016A:
     num3 = 0.0;
     num4 = 0.0;
     goto Label_00F1;
 }
 public PredictiveMaintenanceTelemetry(IConfigurationProvider config, ILogger logger, string deviceId, IList<ExpandoObject> dataset)
 {
     _config = config;
     _logger = logger;
     _deviceId = deviceId;
     _active = false;
     _data = dataset.GetEnumerator();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="lineList"></param>
 /// <param name="leftLoc"></param>
 /// <param name="rightLoc"></param>
 private void AddCurves(IList lineList, Locations leftLoc, Locations rightLoc)
 {
     for (IEnumerator i = lineList.GetEnumerator(); i.MoveNext(); )
     {
         ICoordinate[] coords = (ICoordinate[]) i.Current;
         AddCurve(coords, leftLoc, rightLoc);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="edges"></param>
 /// <param name="edgeSet"></param>
 private void Add(IList edges, object edgeSet)
 {
     for (IEnumerator i = edges.GetEnumerator(); i.MoveNext(); ) 
     {
         Edge edge = (Edge) i.Current;
         Add(edge, edgeSet);
     }
 }
Example #16
1
 /// <summary> 
 /// For nodes in the Collection, link the DirectedEdges at the node that are in the result.
 /// This allows clients to link only a subset of nodes in the graph, for
 /// efficiency (because they know that only a subset is of interest).
 /// </summary>
 /// <param name="nodes"></param>
 public static void LinkResultDirectedEdges(IList nodes)
 {
     for (IEnumerator nodeit = nodes.GetEnumerator(); nodeit.MoveNext(); ) 
     {
         Node node = (Node) nodeit.Current;
         ((DirectedEdgeStar) node.Edges).LinkResultDirectedEdges();
     }
 }
Example #17
1
 /// <summary>
 /// Add a collection of geometries to be polygonized.
 /// May be called multiple times.
 /// Any dimension of Geometry may be added;
 /// the constituent linework will be extracted and used.
 /// </summary>
 /// <param name="geomList">A list of <c>Geometry</c>s with linework to be polygonized.</param>
 public virtual void Add(IList geomList)
 {
     for (IEnumerator i = geomList.GetEnumerator(); i.MoveNext(); ) 
     {
         Geometry geometry = (Geometry) i.Current;
         Add(geometry);
     }
 }
		private void WriteIds(ByteArrayBuffer buffer, IList ids)
		{
			buffer.WriteInt(ids.Count);
			for (IEnumerator idIter = ids.GetEnumerator(); idIter.MoveNext(); )
			{
				int id = ((int)idIter.Current);
				buffer.WriteInt(id);
			}
		}
Example #19
1
 private void Apply(IList toFree)
 {
     for (var slotIter = toFree.GetEnumerator(); slotIter.MoveNext();)
     {
         var slot = ((Slot) slotIter.Current);
         _freespaceManager.Free(slot);
     }
     toFree.Clear();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="edges"></param>
 private void Add(IList edges)
 {
     for (IEnumerator i = edges.GetEnumerator(); i.MoveNext(); ) 
     {
         Edge edge = (Edge) i.Current;
         // edge is its own group
         Add(edge, edge);
     }
 }
Example #21
0
        public async Task LoadAsync()
        {
            questions = await LanguageQuestion.LoadAsync();
            JoinAllAnswers();

            Debug.WriteLine(questions.Count);
            enumerator = questions.GetEnumerator();
            enumerator.MoveNext(); // TODO: Assert.
        }
Example #22
0
		public TestRunner (IList tests, string working_dir, Driver driver)
		{
			this.driver = driver;
			this.tests = tests;
			this.working_dir = working_dir;

			tests_enumerator = tests.GetEnumerator ();
			tests_lock = new object ();
		}
Example #23
0
 /// <summary>
 /// Adds a collection of Geometries to be processed. May be called multiple times.
 /// Any dimension of Geometry may be added; the constituent linework will be
 /// extracted.
 /// </summary>
 /// <param name="geometries"></param>
 public void Add(IList geometries)
 {
     IEnumerator i = geometries.GetEnumerator();
     while (i.MoveNext())
     {
         IGeometry geometry = (IGeometry) i.Current;
         Add(geometry);
     }
 }
Example #24
0
 public static IList<int> AddList(IList<int> list1, IList<int> list2)
 {
     IList<int> temp = NewList();
     IEnumerator<int> iter1 = list1.GetEnumerator();
     IEnumerator<int> iter2 = list2.GetEnumerator();
     while(iter1.MoveNext() != false){
       iter2.MoveNext();
       temp.Add(iter1.Current + iter2.Current);
     }
     return temp;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="seq"></param>
 /// <param name="lines"></param>
 /// <returns></returns>
 public bool HasIntersectionWithLineStrings(IList<Coordinate> seq, IList lines)
 {
     for (IEnumerator i = lines.GetEnumerator(); i.MoveNext(); )
     {
         LineString line = (LineString)i.Current;
         HasIntersection(seq, line.Coordinates);
         if (_hasIntersection)
             break;
     }
     return _hasIntersection;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="seq"></param>
 /// <param name="lines"></param>
 /// <returns></returns>
 public bool HasIntersectionWithLineStrings(ICoordinateSequence seq, IList lines)
 {
     for (IEnumerator i = lines.GetEnumerator(); i.MoveNext(); ) 
     {
         ILineString line = (ILineString) i.Current;
         HasIntersection(seq, line.CoordinateSequence);
         if (hasIntersection)
             break;
     }
     return hasIntersection;
 }
Example #27
0
            public FieldAndTermEnumAnonymousInnerClassHelper(List<Term> terms)
            {
                if (!terms.Any())
                {
                    throw new ArgumentException("no terms provided");
                }

                this.terms = terms;
                terms.Sort();
                iter = terms.GetEnumerator();
            }
Example #28
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="edges"></param>
 /// <returns></returns>
 private static IList ToSegmentStrings(IList edges)
 {
     // convert Edges to SegmentStrings
     IList segStrings = new ArrayList();
     for (IEnumerator i = edges.GetEnumerator(); i.MoveNext(); )
     {
         Edge e = (Edge)i.Current;
         segStrings.Add(new SegmentString(e.Coordinates, e));
     }
     return segStrings;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="edges0"></param>
 /// <param name="edges1"></param>
 /// <param name="si"></param>
 public override void ComputeIntersections(IList edges0, IList edges1, SegmentIntersector si)
 {
     for (IEnumerator i0 = edges0.GetEnumerator(); i0.MoveNext(); )
     {
         Edge edge0 = (Edge)i0.Current;
         for (IEnumerator i1 = edges1.GetEnumerator(); i1.MoveNext(); )
         {
             Edge edge1 = (Edge)i1.Current;
             ComputeIntersects(edge0, edge1, si);
         }
     }
 }
 public AssemblyBundle(IList assemblyList)
 {
     this.assemblies = new ArrayList();
     IEnumerator iAssemblies = assemblyList.GetEnumerator();
     while (iAssemblies.MoveNext()) {
         AssemblyDefinition dfn = AssemblyFactory.GetAssembly((String)iAssemblies.Current);
         IAssembly assembly = new CompleteAssembly(dfn);
         //Console.WriteLine("ASSEMBLY: " + assembly.getAssemblyName() + "  " + dfn.GetType());
         this.assemblies.Add(assembly);
     }
     this.buildRelationships();
 }