package list.dl.algo; import list.dl.DLList; /** * Counts the number of elements to the right the host. */ public class RightCount implements IAlgoRight { final public static RightCount Singleton = new RightCount(); private RightCount() { } /** * @param hostList * @param inputParam * @return */ public Object rightEndCase(DLList host, Object inputParam) { return new Integer (0); } /** * @param hostList * @param inputParam * @return */ public Object dataNodeCase(DLList host, Object inputParam) { Integer restCount = (Integer) host.getRightRest ().executeRight (this, null); return new Integer (1 + restCount.intValue ()); } }