001/* Copyright (C) 2013 TU Dortmund
002 * This file is part of AutomataLib, http://www.automatalib.net/.
003 * 
004 * AutomataLib is free software; you can redistribute it and/or
005 * modify it under the terms of the GNU Lesser General Public
006 * License version 3.0 as published by the Free Software Foundation.
007 * 
008 * AutomataLib is distributed in the hope that it will be useful,
009 * but WITHOUT ANY WARRANTY; without even the implied warranty of
010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
011 * Lesser General Public License for more details.
012 * 
013 * You should have received a copy of the GNU Lesser General Public
014 * License along with AutomataLib; if not, see
015 * http://www.gnu.de/documents/lgpl.en.html.
016 */
017package net.automatalib.commons.smartcollections;
018
019/**
020 * Basic interface for entries in a linked list.
021 * 
022 * @author Malte Isberner <malte.isberner@gmail.com>
023 *
024 * @param <E> element class.
025 * @param <T> linked list entry class.
026 */
027public interface LinkedListEntry<E, T extends LinkedListEntry<E,T>> 
028                extends ElementReference {
029        /**
030         * Retrieves the element stored at this position in the list.
031         * @return the element.
032         */
033        public E getElement();
034        
035        /**
036         * Retrieves the previous entry in the list, or <code>null</code> if
037         * this is the first entry.
038         * @return the previous entry or <code>null</code>.
039         */
040        public T getPrev();
041        
042        /**
043         * Retrieves the next entry in the list, or <code>null</code> if
044         * this is the last entry.
045         * @return the next entry or <code>null</code>.
046         */
047        public T getNext();
048        
049        /**
050         * Sets the predecessor of this entry.
051         * @param prev the new predecessor.
052         */
053        public void setPrev(T prev);
054        
055        /**
056         * Sets the successor of this entry.
057         * @param next the new successor.
058         */
059        public void setNext(T next);
060}