private Vector3[] buildPointsWithData(int pointIndex, TaskGraphData taskData) { List <Vector3> pointList = new List <Vector3>(); foreach (string taskName in taskData.tasks.Keys) { if (!allKnownTaskNames.Contains(taskName)) { //Building knowledge about all the tasks to graph allKnownTaskNames.Add(taskName); } } foreach (string taskName in allKnownTaskNames) { int value = 0; if (taskData.tasks.ContainsKey(taskName)) { value = taskData.tasks[taskName]; } //Debug.Log(taskData.remappedIndex + " : " + taskName + " <- " + value); pointList.Add(new Vector3(taskData.remappedIndex, value, 0)); } return(pointList.ToArray()); }
private void treatData(UpdateStatus status) { if (initAsked) { if (status.timeStep > 10) { Debug.Log("Ejecting T" + status.timeStep); return; } else { initAsked = false; } } //Debug.Log("TGD recieved: " + status.timeStep); //Retrieving correct data to update TaskGraphData graphData; if (data.Count == 0) { //Receiving first data graphData = new TaskGraphData(status.timeStep, nextIndex++); } else if (data[data.Count - 1].timestep == status.timeStep) { //Receiving additionnal data for current timestep graphData = data[data.Count - 1]; } else if (data[data.Count - 1].timestep < status.timeStep) { graphData = new TaskGraphData(status.timeStep, nextIndex++); data[data.Count - 1].ready = true; fillTheGaps(data[data.Count - 1]); } else { Debug.Log("Ignored TS " + status.timeStep + ". Last is " + data[data.Count - 1].timestep + "."); return; } //TREAT DATA for (int i = 0; i < status.ids.Count; ++i) { string refinedTaskName = getTaskGroup(status.taskNames[i]); if (!graphData.tasks.ContainsKey(refinedTaskName)) { graphData.tasks[refinedTaskName] = 0; } graphData.tasks[refinedTaskName]++; } data.Add(graphData); }
private void fillTheGaps(TaskGraphData tgd) { foreach (string taskName in allKnownTaskNames) { if (!tgd.tasks.ContainsKey(taskName)) { tgd.tasks[taskName] = 0; } } }