package list.dl; import list.dl.algo.IAlgoLeft; import list.dl.algo.IAlgoRight; /** * Models a node in a doubly-linked list. Represents the state of the owner list. * @author DXN * @version 3.2 * @since 10/17/00 */ abstract class ANode { /** * Returns the first element of the owner left (or right) list. * @param owner the DLList that holds this ANode. */ abstract Object getFirst(DLList owner); abstract DLList getLeftRest(DLList owner); abstract DLList getRightRest(DLList owner); /** * Replaces the first element of the owner left (or right) list with the given data element. * @param dat the element that is to replace the first element on the left (or right) of the owner list. * @param owner the DLList that holds this ANode. */ abstract void setFirst(Object dat, DLList owner); /** * Replaces the left list with the given list. * @param dllist the new tail that is to replace the current one. * @param owner the DLList that holds this ANode. */ abstract void setLeftRest(DLList dllist, DLList owner); /** * Replaces the right list with the given list. * @param dllist the new tail that is to replace the current one. * @param owner the DLList that holds this ANode. */ abstract void setRightRest(DLList dllist, DLList owner); /** * Sets the left owner link. */ abstract void setLeftOwner (DLList dllist); /** * Sets the right owner link. */ abstract void setRightOwner (DLList dllist); /** * Inserts a data element to the left front of the owner list. * @param dat the element to be inserted to the left front of the owner. * @param owner the DLList that holds this ANode. */ abstract void insertLeftFront(Object dat, DLList owner); /** * Inserts a data element to the right front of the owner list. * @param dat the element to be inserted to the right front of the owner. * @param owner the DLList that holds this ANode. */ abstract void insertRightFront(Object dat, DLList owner); /** * Removes and returns the first element on the left of the owner DLList. * @param owner the DLList that holds this ANode. */ abstract Object remLeftFront(DLList owner); /** * Removes and returns the first element on the right of the owner DLList. * @param owner the DLList that holds this ANode. */ abstract Object remRightFront(DLList owner); /** * @param algo * @param input * @param owner */ abstract Object executeLeft(IAlgoLeft algo, Object input, DLList owner); /** * @param algo * @param inputParam * @param owner */ abstract Object executeRight(IAlgoRight algo, Object input, DLList owner); }