예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
 public void AddForbiddenSlotConstraint(ForbiddenSlotConstraint constraint)
 {
     incomingConnections.ForEach(x => x.AddForbiddenSlotConstraint(constraint));
     outgoingConnections.ForEach(x => x.AddForbiddenSlotConstraint(constraint));
 }
예제 #6
0
 public void AddForbiddenSlotConstraint(ForbiddenSlotConstraint constraint)
 {
     incomingConnections.ForEach(x => x.AddForbiddenSlotConstraint(constraint));
     outgoingConnections.ForEach(x => x.AddForbiddenSlotConstraint(constraint));
 }