<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RailNet.Clients.Ecos.Basic
{
    public class BasicClient : IBasicClient
    {
        private readonly INachrichtenDispo _dispo;

        public BasicClient(INachrichtenDispo dispo)
        {
            _dispo = dispo;
            _dispo.IncomingEvents.Subscribe(RaiseEventReceived);
        }

        /// <summary>
        /// Liefert den Abschnitt einer Liste von Objekten die zum Objekt mit bestimmter ID gehoeren.
        /// </summary>
        /// <param name="id">ID des Objektes</param>
        /// <param name="min">Range von</param>
        /// <param name="max">Range bis</param>
        /// <param name="args">Parameter</param>
        /// <returns></returns>
        public Task<BasicResponse> QueryObjects(int id, int min = 0, int max = 0, params string[] args)
        {
            var b = new StringBuilder("queryObjects(");
            b.Append(id);
            foreach (var arg in args)
            {
                b.Append(", ");
                b.Append(arg);
            }

            if (max > 0 && max >= min)
            {
                b.Append(string.Format(", nr[{0},{1}]", min, max));
            }

            b.Append(')');

            return _dispo.SendCommandAsync(b.ToString());
        }

        /// <summary>
        /// Liefert Liste von Objekten die zum Objekt mit der ID gehoeren.
        /// </summary>
        /// <param name="id">ID des Objektes</param>
        /// <param name="args">Parameter</param>
        public async Task<BasicResponse> QueryObjects(int id, params string[] args)
        {
            return await QueryObjects(id, 0, 0, args);
        }

        /// <summary>
        /// Liefert die groesse der Liste der zu der ID gehoerigen Objekte.
        /// </summary>
        /// <param name="id">ID des Objektes</param>
        public Task<BasicResponse> QueryObjectsSize(int id)
        {
            return _dispo.SendCommandAsync("queryObjects(" + id + ", size)");
        }

        /// <summary>
        /// Setzt mehrere Eigenschaften eines Objektes<commit_msg>Ein Falsch benutztes async/await entfernt.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RailNet.Clients.Ecos.Basic
{
    public class BasicClient : IBasicClient
    {
        private readonly INachrichtenDispo _dispo;

        public BasicClient(INachrichtenDispo dispo)
        {
            _dispo = dispo;
            _dispo.IncomingEvents.Subscribe(RaiseEventReceived);
        }

        /// <summary>
        /// Liefert den Abschnitt einer Liste von Objekten die zum Objekt mit bestimmter ID gehoeren.
        /// </summary>
        /// <param name="id">ID des Objektes</param>
        /// <param name="min">Range von</param>
        /// <param name="max">Range bis</param>
        /// <param name="args">Parameter</param>
        /// <returns></returns>
        public Task<BasicResponse> QueryObjects(int id, int min = 0, int max = 0, params string[] args)
        {
            var b = new StringBuilder("queryObjects(");
            b.Append(id);
            foreach (var arg in args)
            {
                b.Append(", ");
                b.Append(arg);
            }

            if (max > 0 && max >= min)
            {
                b.Append(string.Format(", nr[{0},{1}]", min, max));
            }

            b.Append(')');

            return _dispo.SendCommandAsync(b.ToString());
        }

        /// <summary>
        /// Liefert Liste von Objekten die zum Objekt mit der ID gehoeren.
        /// </summary>
        /// <param name="id">ID des Objektes</param>
        /// <param name="args">Parameter</param>
        public Task<BasicResponse> QueryObjects(int id, params string[] args)
        {
            return QueryObjects(id, 0, 0, args);
        }

        /// <summary>
        /// Liefert die groesse der Liste der zu der ID gehoerigen Objekte.
        /// </summary>
        /// <param name="id">ID des Objektes</param>
        public Task<BasicResponse> QueryObjectsSize(int id)
        {
            return _dispo.SendCommandAsync("queryObjects(" + id + ", size)");
        }

        /// <summary>
        /// Setzt mehrere Eigenschaften eines Objektes
{'fraction_non_alphanumeric': 0.1312, 'fraction_numerical': 0.0032, 'mean_word_length': 1.7961661341853035, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3511785', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1240, 'n_words': 313}