public FBucket Add(FBucket bucket, FOperation fOperation) { if (bucket == null) { throw new Exception($"Bucket {bucket.Name} does not exits"); } bucket = bucket.AddOperation(fOperation); return(bucket); }
internal FBucket RemoveOperations(FBucket bucket, List <FOperation> operationsToRemove) { foreach (var operation in operationsToRemove) { DecreaseBucketSize(operation.RequiredCapability.Id, operation.Operation.Duration); bucket = bucket.RemoveOperation(operation); } return(bucket); }
public (FBucket, List <FOperation>) RemoveNotSatisfiedOperations(FBucket bucket, Agent agent) { List <FOperation> notSatisfiedOperations = new List <FOperation>(); var bucketOperations = bucket.Operations.ToList(); foreach (var operation in bucketOperations) { agent.DebugMessage(msg: $"In RemoveNotSatisfiedOperations check the operation {operation.Key} {operation.Operation.Name} in {bucket.Name} has" + $"| Satisfied: {operation.StartConditions.Satisfied} " + $"| ArticleProvided: {operation.StartConditions.ArticlesProvided} " + $"| PreCondition: {operation.StartConditions.PreCondition} ", CustomLogger.JOB, LogLevel.Warn); if (!operation.StartConditions.Satisfied) { agent.DebugMessage(msg: $"Operation {operation.Key} in {operation.Operation.Name} in {bucket.Name} will be removed because it is not satisfied!", CustomLogger.JOB, LogLevel.Warn); notSatisfiedOperations.Add(operation); bucket = bucket.RemoveOperation(operation); } } return(bucket, notSatisfiedOperations); }
public void Replace(FBucket bucket) { _jobConfirmations.Single(x => x.Job.Key == bucket.Key).Job = bucket; }
public bool HasLaterForwardStart(FBucket bucket, FOperation operation) { return(operation.ForwardStart >= bucket.ForwardStart); }
public bool HasCapacityLeft(FBucket bucket, FOperation operation) { return(bucket.BackwardStart - bucket.ForwardStart > ((IJob)bucket).Duration + operation.Operation.Duration); }
private bool ExceedMaxBucketSize(FBucket bucket, FOperation operation) { return(((IJob)bucket).Duration + operation.Operation.Duration <= bucket.MaxBucketSize); //GetBucketSize(bucket.RequiredCapability.Id); }