package erac; import java.lang.*; import lrs.*; import lrs.visitor.*; import rac.*; /** * */ public class ERALRSFactory extends RALRSFactory implements IERACFactory { /** * */ public IRAContainer makeIntegerPriorityQueue() { return new RALRStruct(InsertInOrder.Singleton); } /** * */ public IRAContainer makeComparablePriorityQueue() { return new RALRStruct(new IAlgo() { /** * */ public Object emptyCase(LRStruct host, Object input) { return host.insertFront(input); } /** * */ public Object nonEmptyCase(LRStruct host, Object input) { int result = ((Comparable)input).compareTo(host.getFirst()); if (result < 0) { return host.insertFront(input); } else { return host.getRest().execute(this, input); } } }); } }