< Summary

Class:DCL.ECSRuntime.Utils
Assembly:DCL.ECSRuntime.ComponentsGroup
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/ECSRuntime/ComponentsGroup/Utils.cs
Covered lines:18
Uncovered lines:11
Coverable lines:29
Total lines:87
Line coverage:62% (18 of 29)
Covered branches:0
Total branches:0
Covered methods:4
Total methods:4
Method coverage:100% (4 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TryGetComponentData[T](...)0%3.843054.55%
TryGetDataIndex[T1](...)0%3.473062.5%
TryGetDataIndex[T1, T2](...)0%3.143075%
TryGetDataIndex[T1, T2, T3](...)0%3.473062.5%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/ECSRuntime/ComponentsGroup/Utils.cs

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.Models;
 3using System;
 4using System.Collections.Generic;
 5using UnityEngine;
 6
 7namespace DCL.ECSRuntime
 8{
 9    internal static class Utils
 10    {
 11        public static bool TryGetComponentData<T>(
 12            IParcelScene scene,
 13            long entityId,
 14            IECSComponent groupComponent,
 15            IECSComponent updatedComponent,
 16            out ECSComponentData<T> data)
 17        {
 19218            if (groupComponent != updatedComponent)
 19            {
 11320                data = default(ECSComponentData<T>);
 11321                return false;
 22            }
 23
 24            try
 25            {
 7926                if (((ECSComponent<T>)updatedComponent).TryGet(scene, entityId, out data))
 27                {
 7928                    return true;
 29                }
 030            }
 31            catch (Exception e)
 32            {
 33#if UNITY_EDITOR
 034                Debug.LogException(e);
 35#endif
 036            }
 37
 038            data = default(ECSComponentData<T>);
 039            return false;
 7940        }
 41
 42        public static bool TryGetDataIndex<T1>(List<ECSComponentsGroupData<T1>> list, IDCLEntity entity, out int index)
 43        {
 244            for (int i = 0; i < list.Count; i++)
 45            {
 146                if (list[i].entity == entity)
 47                {
 148                    index = i;
 149                    return true;
 50                }
 51            }
 52
 053            index = -1;
 054            return false;
 55        }
 56
 57        public static bool TryGetDataIndex<T1, T2>(List<ECSComponentsGroupData<T1, T2>> list, IDCLEntity entity, out int
 58        {
 21059            for (int i = 0; i < list.Count; i++)
 60            {
 10561                if (list[i].entity == entity)
 62                {
 6763                    index = i;
 6764                    return true;
 65                }
 66            }
 67
 068            index = -1;
 069            return false;
 70        }
 71
 72        public static bool TryGetDataIndex<T1, T2, T3>(List<ECSComponentsGroupData<T1, T2, T3>> list, IDCLEntity entity,
 73        {
 3874            for (int i = 0; i < list.Count; i++)
 75            {
 1976                if (list[i].entity == entity)
 77                {
 1978                    index = i;
 1979                    return true;
 80                }
 81            }
 82
 083            index = -1;
 084            return false;
 85        }
 86    }
 87}