-- =============================================================================================================== -- AllocatorTwoTray in tray allocation for a sortation system -- By José Antonio Esparza and Kim Bjerge - spring 2010 -- (strategy pattern) -- ===============================================================================================================
class AllocatorTwoTray issubclassof AllocatorStrategy
-- Allocates trays if empty at induction offset and offset + 1 public AllocateTray: nat ==> setof Tray
AllocateTray (icid) == let posTray = InductionOffset(trayAllocator.trayAtCardReader, icid),
posTrayNext = if (posTray - 1) = 0 then TrayAllocator`NumOfTrays else posTray - 1 in if trayAllocator.sorterRing(posTray).IsTrayEmpty() and-- Tray at induction
trayAllocator.sorterRing(posTrayNext).IsTrayEmpty() -- Tray at induction-1 thenreturn {trayAllocator.sorterRing(posTray), trayAllocator.sorterRing(posTrayNext)} -- Return the set of 2 empty trays elsereturn {} pre icid insetinds trayAllocator.inductionGroup;
-- Returns true if higher priority inductions in induction group public InductionsWithHigherPriority: InductionController ==> bool
InductionsWithHigherPriority(ic) == returnexists i insetelems trayAllocator.inductionGroup(1,...,len trayAllocator.inductionGroup)
& i.GetId() <> ic.GetId() and i.GetPriority() > ic.GetPriority() -- Waiting with items of same size (two tray items) -- and i.GetSizeOfWaitingItem() = ic.GetSizeOfWaitingItem() -- Looking at induction infront this ic causes starvation of the first induction in group -- return exists i in set elems inductionGroup(ic.GetId()+1,...,len inductionGroup) & i.GetPriority() > ic.GetPriority() pre ic insetelems trayAllocator.inductionGroup;
end AllocatorTwoTray
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.