public void AddForbiddenSlotConstraint(ForbiddenSlotConstraint constraint) { if (currCapacity < maxCapacity / constraint.modulo) throw new ApplicationException("more constraint cannot be applied to this device"); if (forbiddenSlotConstraints.Any(x => x.index == constraint.index && x.modulo == constraint.modulo)) throw new ApplicationException("this constraint alearedy exists in current device"); currCapacity -= maxCapacity / constraint.modulo; forbiddenSlotConstraints.Add(constraint); }
public void AddForbiddenSlotConstraint(ForbiddenSlotConstraint constraint) { if (currCapacity < maxCapacity / constraint.modulo) { throw new ApplicationException("more constraint cannot be applied to this device"); } if (forbiddenSlotConstraints.Any(x => x.index == constraint.index && x.modulo == constraint.modulo)) { throw new ApplicationException("this constraint alearedy exists in current device"); } currCapacity -= maxCapacity / constraint.modulo; forbiddenSlotConstraints.Add(constraint); }
private void ApplyConstraint(ForbiddenSlotConstraint constraint) { if (slots == null) { throw new ApplicationException("Cannot apply constraint when slots are not created"); } if (slots.Count == 0) { throw new ApplicationException("Cannot apply constraint when slots are empty"); } if (slots.Count < constraint.index) { throw new ApplicationException("Slots number cannot be smaller than constraint index"); } if (slots.Count < constraint.modulo) { throw new ApplicationException("Slots number cannot be smaller than constraint modulo"); } for (int i = constraint.index; i < slots.Count; i += constraint.modulo) { slots[i].Forbid(constraint.name); } }
private void ApplyConstraint(ForbiddenSlotConstraint constraint) { if (slots == null) throw new ApplicationException("Cannot apply constraint when slots are not created"); if (slots.Count == 0) throw new ApplicationException("Cannot apply constraint when slots are empty"); if (slots.Count < constraint.index) throw new ApplicationException("Slots number cannot be smaller than constraint index"); if (slots.Count < constraint.modulo) throw new ApplicationException("Slots number cannot be smaller than constraint modulo"); for (int i = constraint.index; i < slots.Count; i += constraint.modulo) { slots[i].Forbid(constraint.name); } }
public void AddForbiddenSlotConstraint(ForbiddenSlotConstraint constraint) { incomingConnections.ForEach(x => x.AddForbiddenSlotConstraint(constraint)); outgoingConnections.ForEach(x => x.AddForbiddenSlotConstraint(constraint)); }