public int Allocate(SlotCategory slotCategory) { this.slotCategory = SlotCategoryFactory.GetSlotCategory(slotCategory); int resourceId = this.slotCategory.resourceId; this.slotCategory.MarkBusy(); return(resourceId); }
public void Deallocate(SlotCategory slotCategory, int resourceId) { switch (slotCategory) { case SlotCategory.TimeSlot: MarkTimeSlotFree(resourceId); break; case SlotCategory.SpaceSlot: MarkSpaceSlotFree(resourceId); break; default: Console.WriteLine("ERROR: attempted to free invalid resource"); break; } }
public int Allocate(SlotCategory slotCategory) { int resourceId; switch (slotCategory) { case SlotCategory.TimeSlot: resourceId = FindFreeTimeSlot(); MarkTimeSlotBusy(resourceId); break; case SlotCategory.SpaceSlot: resourceId = FindFreeSpaceSlot(); MarkSpaceSlotBusy(resourceId); break; default: Console.WriteLine("ERROR: Attempted to allocate invalid resource"); resourceId = INVALID_RESOURCE_ID; break; } return(resourceId); }
public void Deallocate(SlotCategory slotCategory, int resourceId) { this.slotCategory = SlotCategoryFactory.GetSlotCategory(slotCategory); this.slotCategory.resourceId = resourceId; this.slotCategory.MarkFree(); }
public void Deallocate(SlotCategory slotCategory, int resourceId) { slotCategory.MarkSlotFree(resourceId); }
//public enum SlotCategory //{ // TimeSlot, // SpaceSlot //} //private static readonly int INVALID_RESOURCE_ID = -1; public int Allocate(SlotCategory slotCategory) { return(slotCategory.FindFreeSlot()); }