예제 #1
0
        public async Task Build()
        {
            var data = await _dtoStore.GetAllData();

            var dataSplitByLine = data.Split('\n');

            bool valuesParsed = ParseValues.ParseFromStringToInt(dataSplitByLine[0].Split()[0], out int count);

            if (!valuesParsed)
            {
                throw new Exception("Count Values is wrong");
            }
            for (int i = 1; i <= count; i++)
            {
                var properties = dataSplitByLine[i].Split();

                valuesParsed = ParseValues.ParseFromStringToInt(properties[0], out int value);
                valuesParsed = ParseValues.ParseFromStringToInt(properties[1], out int weight) && valuesParsed;

                if (valuesParsed)
                {
                    var item = new Domain.Entities.ItemEntity.Item(value, weight);
                    _itemRepository.AddItem(item);
                }
            }
        }
        public async Task Build()
        {
            var data = await _dtoStore.GetAllData();

            var lines      = data.Split('\n');
            var properties = lines[0].Split();

            var parseSuccessful = ParseValues.ParseFromStringToInt(properties[0], out int numNodes);

            CreateNodes(parseSuccessful, numNodes);

            parseSuccessful = ParseValues.ParseFromStringToInt(properties[1], out int numEdges);
            CreateArcs(parseSuccessful, numEdges, lines);
        }
예제 #3
0
        public async Task Build()
        {
            var data = await _dtoStore.GetAllData();

            var lines      = data.Split('\n');
            var properties = lines[0].Split();

            var parseSuccessful = ParseValues.ParseFromStringToInt(properties[0], out int numNodes);

            if (!parseSuccessful)
            {
                throw new Exception("Bad Data");
            }

            CreateNodes(numNodes, lines);
            //CreateArcs();
        }