package rac; /** * The policy produces queue (FIFO) behavior in a a RACont. * @author S. Wong */ public class QueuePolicy extends ARACPolicy { /** * The RACont will dispatch its store(data) method through this method to * perform the data store operation. * @param data The data to be stored in the RACont. * @param stopNode The RACStopNode that is the head/tail of this internal * doubly-linked circular data list of the RACont. */ public void store(Object data, RACStopNode stopNode) { stopNode.insertPrevious(data); } /** * The RACont will dispatch its retrieve() method through this method to * perform the data retrieval operation. * @param stopNode The RACStopNode that is the head/tail of this internal * doubly-linked circular data list of the RACont. * @return The data value found. */ public Object retrieve(RACStopNode stopNode) { return stopNode.getNext().removeNode(); } }