001 package listFW.visitor; 002 003 import listFW.*; 004 005 /** 006 * Copies an IList<T> using the an IListFactory<T> supplied as an input parameter 007 * @author Mathias Ricken - Copyright 2008 - All rights reserved. 008 */ 009 public class CopyList3<T> implements IListAlgo<T,IList<T>, IListFactory<T>> { 010 011 public IMTList<T> emptyCase(IMTList<? extends T> host, IListFactory<T> ... fac) { 012 return fac[0].makeEmptyList(); 013 } 014 public INEList<T> nonEmptyCase(INEList<? extends T> host, IListFactory<T> ... fac) { 015 return fac[0].makeNEList( host.getFirst(), host.getRest().execute(this, fac)); 016 } 017 }