public void DeleteRestorePoints(List <IAlgorithm> algorithms, HybridType hybridType) { var listOfResPointLists = new List <List <RestorePoint> >(); foreach (var algo in algorithms) { listOfResPointLists.Add(algo.DoSmthWithRestorePoint(restorePoints)); } foreach (var list in listOfResPointLists) { Int32 index = 0; Int32 tempSize = listOfResPointLists.Count; if (hybridType == HybridType.Maximum) { Int32 maxSize = -1; for (int count = 0; count < tempSize; count++) { if (listOfResPointLists[count].Count > maxSize) { index = count; } } restorePoints.Clear(); restorePoints = listOfResPointLists[index]; } else { Int32 minSize = Int32.MaxValue; for (int count = 0; count < tempSize; count++) { if (listOfResPointLists[count].Count < minSize) { index = count; } } restorePoints.Clear(); restorePoints = listOfResPointLists[index]; } } ////Что делать, если у нас есть IncrementaleRestorePoints? //List<RestorePoint> timeLimitFiles = new List<RestorePoint>(); //if (timeLimit) //{ // foreach (var restorePoint in restorePoints) // if (restorePoint.CreationTime >= LifeTime) // timeLimitFiles.Add(restorePoint); //} // //List<RestorePoint> quantityLimitFiles = new List<RestorePoint>(); //if (quantityLimit) //{ // if (MaxQuantityOfRestorePoints >= restorePoints.Count) // quantityLimitFiles = new List<RestorePoint>(restorePoints); // else // { // quantityLimitFiles = new List<RestorePoint>(); // // if (MaxQuantityOfRestorePoints <= 0) // throw new Exception("can not store less or equal than zero restore points."); // // int count = restorePoints.Count - MaxQuantityOfRestorePoints; // for (; count <= restorePoints.Count - 1; count++) // quantityLimitFiles.Add(restorePoints[count]); // } //} // //List<RestorePoint> backupSizeLimitFiles = new List<RestorePoint>(); //if (backupSizeLimit) //{ // long tempSum = 0; // foreach (var restorePoint in restorePoints) // if (restorePoint.Size < MaxBackupSize // && (tempSum + restorePoint.Size) < MaxBackupSize) // { // backupSizeLimitFiles.Add(restorePoint); // tempSum += restorePoint.Size; // } //} // //restorePoints.Clear(); // //if (quantityLimit // && quantityLimitFiles.Count >= timeLimitFiles.Count // && quantityLimitFiles.Count >= backupSizeLimitFiles.Count) // restorePoints = quantityLimitFiles; // //if (timeLimit // && timeLimitFiles.Count >= quantityLimitFiles.Count // && timeLimitFiles.Count >= backupSizeLimitFiles.Count) // restorePoints = timeLimitFiles; // //if (backupSizeLimit // && backupSizeLimitFiles.Count >= quantityLimitFiles.Count // && backupSizeLimitFiles.Count >= timeLimitFiles.Count) // restorePoints = backupSizeLimitFiles; }
public HybridCleanAlgorithm(List <ICleanAlgorithm> cleanAlgorithms, HybridType hybridType) { _cleanAlgorithms = cleanAlgorithms ?? throw new ArgumentNullException(nameof(cleanAlgorithms)); _hybridType = hybridType; }
public HybridCleanAlgorithm(List <ICleanAlgorithm> cleanAlgorithms, HybridType hybridType) { _cleanAlgorithms = cleanAlgorithms; _hybridType = hybridType; }