001 package rac;
002 import lrs.*;
003
004 /**
005 * FIFO RAC
006 * @author Mathias Ricken - Copyright 2008 - All rights reserved.
007 */
008 public class LRSQueueFactory<T> extends ALRSRACFactory<T> {
009 /**
010 * Create a ``first-in, first-out'' (FIFO) container.
011 */
012 public IRAContainer<T> makeRAC() {
013 return new LRSRAContainer<T>(new IAlgo<T,LRStruct<T>,T>() {
014 public LRStruct<T> emptyCase(LRStruct<T> host, T... input) {
015 return host.insertFront(input[0]);
016 }
017
018 public LRStruct<T> nonEmptyCase(LRStruct<T> host, T... input) {
019 return host.getRest().execute(this, input);
020 }
021 });
022
023 }
024 }