public void AddFinishedWork(long ID, ReduceResult work) { if(finishedWork.ContainsKey(ID)) { finishedWork.Remove(ID); } this.finishedWork.Add(ID, new TaskInfoFinished() { ID = ID, task = work }); }
public void Reduce(ReduceResult[] RR) { StringBuilder sb = new StringBuilder(); foreach (var item in RR) { sb.Append(item.Key); } this.concat = sb.ToString(); }
public void Reduce(ReduceResult[] RR) { double total = 0; foreach (var item in RR) { double key = 0; double.TryParse(item.Key.ToString(), out key); total += key; } this.Sum = total; }
public ReduceResult[] Distribute(object obj) { Console.WriteLine("distributing data................"); double[] pigDataArray = (double[])obj; PigData pigData = new PigData() { distanceToPig = pigDataArray[0], generations = (int)pigDataArray[1], maximumforce = pigDataArray[2], wallheight = pigDataArray[3] }; ReduceResult[] results = new ReduceResult[pigData.generations]; for (int i = 0; i < results.Length; i++) { results[i] = new ReduceResult("", obj); } Console.WriteLine("Broke apart the data."); return results; }
public void Reduce(ReduceResult[] RR) { double start = 0.0d; double.TryParse(RR[0].Key.ToString(), out start); Max = start; foreach (var item in RR) { double.TryParse(item.Key.ToString(), out start); if(start > Max) { Max = start; } } }
public void Reduce(ReduceResult[] RR) { double total = 0d; int count = 0; foreach(var item in RR) { double key = 0; double.TryParse(item.Key.ToString(), out key); total += key; count++; } this.Average = total / (double)count; }
public ReduceResult[] Distribute(object obj) { int amountToSplit = 5; ReduceResult[] arrayCount = new ReduceResult[amountToSplit]; for (int i = 0; i < amountToSplit; i++) { arrayCount[i] = new ReduceResult(); } return arrayCount; //string input = (string)obj; //string[] splitInput = input.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); //ReduceResult[] splitWork = new ReduceResult[splitInput.Length]; //for (int i = 0; i < splitWork.Length; i++) //{ // splitWork[i] = new ReduceResult(null, splitInput[i]); //} //return splitWork; }
public void AddCompletedWork(ReduceResult obj, int position) { lock (Work) { if(ValidWork(position)) { { piecesDone += 1; } Work[position] = obj; } } if(GetPercentDone() == 1) { this.Done = true; } }
public void Reduce(ReduceResult[] RR) { this.count = RR.Count(); }
public TaskInfoFinished(long ID, ReduceResult Result, byte[] WorkDll, string ReturnIP, int ReturnPort) : base(ID, WorkDll, ReturnIP, ReturnPort) { }
public void AddWork(ReduceResult[] Work) { this.Work = Work; //this.CompletedWork = new object[Work.Length]; endPostion = this.Work.Length; }