protected internal ArrayList MapTemporalValue(IEnumerable <ITemporalValueItem> valueList)
        {
            ArrayList changepoints = new ArrayList();

            foreach (var temporalValueItem in valueList)
            {
                ChangePointDate changePointDate = new ChangePointDate(
                    temporalValueItem.ChangePoint.Year, temporalValueItem.ChangePoint.Month, temporalValueItem.ChangePoint.Day);

                ChangePoint changePoint = null;

                if (temporalValueItem.Type == "currency")
                {
                    changePoint = string.IsNullOrEmpty(temporalValueItem.Value.ToString()) ?
                                  new ChangePoint(changePointDate, null) :
                                  new ChangePoint(changePointDate, new Oracle.Determinations.Masquerade.Lang.Double(temporalValueItem.Value.ToString()));
                }

                if (temporalValueItem.Type == "text")
                {
                    changePoint = string.IsNullOrEmpty(temporalValueItem.Value.ToString()) ?
                                  new ChangePoint(changePointDate, null) :
                                  new ChangePoint(changePointDate, temporalValueItem.Value.ToString());
                }

                if (changePoint != null)
                {
                    changepoints.Add(changePoint);
                }
            }

            return(changepoints);
        }
Exemplo n.º 2
0
    private void Start()
    {
        ChangePoint changePoint = base.gameObject.AddComponent <ChangePoint>();

        changePoint.triggerTimes = this.triggerTimes;
        UnityEngine.Object.Destroy(this);
    }
        private static IEnumerable <ChangePoint> FilterChanges(IEnumerable <ChangePoint> changesFiltered, DateTime fromValue)
        {
            ChangePoint previousChange     = null;
            int?        baseDoneStateCount = null;

            foreach (var change in changesFiltered)
            {
                if (change.Date >= fromValue)
                {
                    if (baseDoneStateCount == null)
                    {
                        if (previousChange == null)
                        {
                            baseDoneStateCount = 0;
                        }
                        else
                        {
                            baseDoneStateCount = previousChange.StateCounts[0];
                        }
                    }

                    change.StateCounts[0] -= baseDoneStateCount.Value;

                    yield return(change);
                }

                previousChange = change;
            }
        }
        public CumulativeFlowAnalysis(IEnumerable <AnalyzedIssue> stories, string[] states, DateTime?from = null)
        {
            States = states.Reverse().ToArray();
            var stateIxs = States.Select((x, i) => new { i, x }).ToDictionary(x => x.x, x => x.i);

            List <ChangePoint> changes = new List <ChangePoint>();

            int[] statesCounter       = new int[States.Length];
            var   statusChangesGroups =
                stories
                .SelectMany(issue =>
                            issue.SimplifiedStatusChanges
                            .Select(statusChange => new { IssueKey = issue.Key, statusChange.ChangeTime, statusChange.State })
                            )
                .Where(x => stateIxs.ContainsKey(x.State))
                .GroupBy(x => x.ChangeTime.Date)
                .OrderBy(x => x.Key);

            Dictionary <string, int> activeStates = new Dictionary <string, int>();

            foreach (var statusChangeGroup in statusChangesGroups)
            {
                foreach (var statusChange in statusChangeGroup)
                {
                    var currentStateIx = stateIxs[statusChange.State];
                    statesCounter[currentStateIx]++;

                    if (activeStates.TryGetValue(statusChange.IssueKey, out int previousStateIx))
                    {
                        statesCounter[previousStateIx]--;
                    }

                    activeStates[statusChange.IssueKey] = stateIxs[statusChange.State];
                }

                var cp = new ChangePoint()
                {
                    Date = statusChangeGroup.Key, StateCounts = statesCounter.ToArray()
                };

                changes.Add(cp);
            }

            IEnumerable <ChangePoint> changesFiltered = changes;

            if (from != null)
            {
                changesFiltered = FilterChanges(changesFiltered, from.Value);
            }

            Changes = changesFiltered.ToArray();
        }
Exemplo n.º 5
0
        public void RevealTile_Test()
        {
            // Arrange
            Board board = new Board(10);
            int   x     = 0;
            int   y     = 0;

            // Act
            ChangePoint result = board.RevealTile(x, y);
            int         exp    = -1;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(board.Tiles[board.GetIndex(x, y)].State > exp);
        }
Exemplo n.º 6
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "ChangePoint")
        {
            ChangePoint changePoint = collision.gameObject.GetComponent <ChangePoint>();

            if (changePoint.isEnd)
            {
                levelCreation.CalculateLevelTime();
                Destroy(gameObject);
                return;
            }

            IceCreamPart newIceCream = new IceCreamPart(changePoint.buttonId);
            levelCreation.level.levelParts.Add(newIceCream);
        }
    }
Exemplo n.º 7
0
 private float computeFPR(ChangePoint cp)
 {
     return((float)cp.FP / (cp.FP + cp.TN));
 }
Exemplo n.º 8
0
 private float computeTPR(ChangePoint cp)
 {
     return(computeRecall(cp));
 }
Exemplo n.º 9
0
 private float computeRecall(ChangePoint p)
 {
     return((float)p.TP / (p.TP + p.FN));
 }
Exemplo n.º 10
0
 private float computePrecision(ChangePoint p)
 {
     return((float)p.TP / (p.TP + p.FP));
 }
Exemplo n.º 11
0
 private float computeFPR(ChangePoint cp)
 {
     return((float)cp.FP / _negatives);
 }
Exemplo n.º 12
0
 private float computeRecall(ChangePoint p)
 {
     return((float)p.TP / _positives);
 }