< Summary - ReFlex - Library

Information
Class: ReFlex.Core.Common.Components.Interaction
Assembly: ReFlex.Core.Common
File(s): D:\a\reflex\reflex\library\src\Core\Common\Components\Interaction.cs
Line coverage
100%
Covered lines: 44
Uncovered lines: 0
Coverable lines: 44
Total lines: 129
Line coverage: 100%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_TouchId()100%11100%
get_TrackingState()100%11100%
get_Position()100%11100%
get_Type()100%11100%
get_ExtremumDescription()100%11100%
.ctor()100%11100%
get_Confidence()100%11100%
get_Time()100%11100%
.ctor(...)50%22100%
.ctor(...)100%11100%
.ctor(...)50%44100%
AsList()100%11100%
ToString()50%22100%

File(s)

D:\a\reflex\reflex\library\src\Core\Common\Components\Interaction.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using ReFlex.Core.Common.Util;
 4
 5namespace ReFlex.Core.Common.Components
 6{
 7    /// <summary>
 8    /// An interaction on an elastic display.
 9    /// </summary>
 10    public class Interaction
 11    {
 12        /// <summary>
 13        /// Id for tracking a touch point over time
 14        /// </summary>
 17990415        public int TouchId { get; set; } = -1;
 16
 17        /// <summary>
 18        /// Tracking status. Lost outputs retain the last measurement's timestamp but have decaying confidence;
 19        /// they are not new measurements. Ended contacts are omitted from subsequent frames.
 20        /// </summary>
 15233621        public InteractionTrackingState TrackingState { get; set; } = InteractionTrackingState.Tentative;
 22
 23        /// <summary>
 24        /// Gets the position.
 25        /// </summary>
 26        /// <value>
 27        /// The position.
 28        /// </value>
 25722629        public Point3 Position { get; set; } = new Point3();
 30
 31        /// <summary>
 32        /// Gets the type.
 33        /// </summary>
 34        /// <value>
 35        /// The type.
 36        /// </value>
 12868037        public InteractionType Type { get; set; }
 38
 39        /// <summary>
 40        /// description of extremum to distinguish interactions from extremums between two interactions.
 41        /// </summary>
 29438042        public ExtremumDescription ExtremumDescription { get; set; } = new ExtremumDescription
 5091643        {
 5091644            Type = ExtremumType.Undefined,
 5091645            NumFittingPoints = 0,
 5091646            PercentageFittingPoints = 0
 5091647        };
 48
 49        /// <summary>
 50        /// Gets or sets the confidence.
 51        /// </summary>
 52        /// <value>
 53        /// The confidence.
 54        /// </value>
 11251655        public float Confidence { get; set; }
 56
 57        /// <summary>
 58        /// Gets the time.
 59        /// </summary>
 60        /// <value>
 61        /// The time.
 62        /// </value>
 10095663        public long Time { get; set; }
 64
 65        /// <summary>
 66        /// Just for json serialization !
 67        /// </summary>
 12668        public Interaction()
 12669        {
 12670            Time = DateTime.Now.Ticks;
 12671        }
 72
 73        /// <summary>
 74        /// Initializes a new instance of the <see cref="Interaction"/> class.
 75        /// </summary>
 476        public Interaction(Point3 position, Interaction source) : this(source)
 477        {
 478            Position = position == null ? null : (Point3)position.Copy();
 479        }
 80
 81        /// <summary>
 82        /// Initializes a new instance of the <see cref="Interaction"/> struct.
 83        /// </summary>
 84        /// <param name="position">The position.</param>
 85        /// <param name="type">The type.</param>
 86        /// <param name="confidence">The confidence.</param>
 247687        public Interaction(Point3 position, InteractionType type, float confidence)
 247688        {
 247689            Position = position;
 247690            Type = type;
 247691            Confidence = confidence;
 247692            Time = DateTime.Now.Ticks;
 247693        }
 94
 95        /// <summary>
 96        /// Initializes a new instance of the <see cref="Interaction"/> class.
 97        /// </summary>
 98        /// <param name="source">The source.</param>
 4831499        public Interaction(Interaction source)
 48314100        {
 48314101            TouchId = source.TouchId;
 48314102            TrackingState = source.TrackingState;
 48314103            Position = source.Position == null ? null : (Point3)source.Position.Copy();
 48314104            Type = source.Type;
 48314105            ExtremumDescription = source.ExtremumDescription == null ? null : new ExtremumDescription
 48314106            {
 48314107                Type = source.ExtremumDescription.Type,
 48314108                NumFittingPoints = source.ExtremumDescription.NumFittingPoints,
 48314109                PercentageFittingPoints = source.ExtremumDescription.PercentageFittingPoints
 48314110            };
 48314111            Confidence = source.Confidence;
 48314112            Time = source.Time;
 48314113        }
 114
 115        /// <summary>
 116        /// Returns [this] as a list.
 117        /// </summary>
 118        /// <returns></returns>
 2119        public IList<Interaction> AsList() => new List<Interaction> { this };
 120
 121        /// <summary>
 122        /// Returns a <see cref="System.String" /> that represents this instance.
 123        /// </summary>
 124        /// <returns>
 125        /// A <see cref="System.String" /> that represents this instance.
 126        /// </returns>
 2127        public override string ToString() => $"TouchId: {TouchId}, Position: " + Position + ", Type: " + Type + " ,Confi
 128    }
 129}