示例#1
0
        public static ValuesMap ParseInput(string path)
        {
            var output = new ValuesMap();

            string[] lines = System.IO.File.ReadAllLines(path);

            // read first line
            var values = lines[0].Split(' ');

            output.rows       = int.Parse(values[0]);
            output.columns    = int.Parse(values[1]);
            output.vihicules  = int.Parse(values[2]);
            output.ridesCount = int.Parse(values[3]);
            output.bonus      = int.Parse(values[4]);
            output.steps      = int.Parse(values[5]);

            for (int index = 1; index < lines.Length; index++)
            {
                var line = lines[index].Split(' ');
                output.AddRide(new Ride
                {
                    Start     = new Point(int.Parse(line[0]), int.Parse(line[1])),
                    End       = new Point(int.Parse(line[2]), int.Parse(line[3])),
                    startTick = int.Parse(line[4]),
                    EndTick   = int.Parse(line[5]),
                    Id        = index - 1
                });
            }

            return(output);
        }
示例#2
0
        private void Put(int count, ValuesMap actualMap, MutableLongObjectMap <Value> expectedMap)
        {
            for (int i = 0; i < count * 2; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long key = rnd.nextLong(count);
                long key = _rnd.nextLong(count);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value value = rnd.randomValues().nextValue();
                Value value = _rnd.randomValues().nextValue();
                actualMap.Put(key, value);
                expectedMap.put(key, value);
            }
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void randomizedWithSharedValuesContainer()
        internal virtual void RandomizedWithSharedValuesContainer()
        {
            const int maps = 13;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int COUNT = 10000 + rnd.nextInt(1000);
            int count = 10000 + _rnd.Next(1000);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final AppendOnlyValuesContainer valuesContainer = new AppendOnlyValuesContainer(new TestMemoryAllocator());
            AppendOnlyValuesContainer valuesContainer = new AppendOnlyValuesContainer(new TestMemoryAllocator());

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<ValuesMap> actualMaps = new java.util.ArrayList<>();
            IList <ValuesMap> actualMaps = new List <ValuesMap>();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.eclipse.collections.api.map.primitive.MutableLongObjectMap<org.neo4j.values.storable.Value>> expectedMaps = new java.util.ArrayList<>();
            IList <MutableLongObjectMap <Value> > expectedMaps = new List <MutableLongObjectMap <Value> >();

            for (int i = 0; i < maps; i++)
            {
                actualMaps.Add(NewMap(valuesContainer));
                expectedMaps.Add(new LongObjectHashMap <>());
            }

            for (int i = 0; i < maps; i++)
            {
                Put(count, actualMaps[i], expectedMaps[i]);
            }

            for (int i = 0; i < maps; i++)
            {
                Remove(count, actualMaps[i], expectedMaps[i]);
            }

            for (int i = 0; i < maps; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableLongObjectMap<org.neo4j.values.storable.Value> expected = expectedMaps.get(i);
                MutableLongObjectMap <Value> expected = expectedMaps[i];
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ValuesMap actual = actualMaps.get(i);
                ValuesMap actual = actualMaps[i];
                expected.forEachKeyValue((k, v) => assertEquals(v, actual.Get(k)));
            }
        }
示例#4
0
        private static void DoMap(ValuesMap map, string outputFileName)
        {
            var aBoard = new Board(map);

            Console.WriteLine("starting");
            aBoard.Start();
            Console.WriteLine(aBoard.handled.Count);
            Console.WriteLine("finishing up");
            var result = new List <string>();

            foreach (var item in aBoard.handled)
            {
                var str = $"{item.Value.Count}";
                foreach (var rides in item.Value)
                {
                    str += $" {rides.Id}";
                }
                result.Add(str);
            }
            File.WriteAllLines($"./{outputFileName}.txt", result.ToArray());
            Console.WriteLine("done");
        }