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 * Abstract base class for entries in a linked list. Takes care for handling 021 * predecessor and successor, but not storage of the element itself. 022 * 023 * @author Malte Isberner <malte.isberner@gmail.com> 024 * 025 * @param <E> element class. 026 * @param <T> linked list entry class. 027 */ 028public abstract class BasicLinkedListEntry<E, T extends BasicLinkedListEntry<E,T>> 029 implements LinkedListEntry<E,T> { 030 // predecessor and successor 031 private T prev, next; 032 033 /* 034 * (non-Javadoc) 035 * @see de.ls5.collections.LinkedListEntry#getPrev() 036 */ 037 @Override 038 public T getPrev() { 039 return prev; 040 } 041 042 /* 043 * (non-Javadoc) 044 * @see de.ls5.collections.LinkedListEntry#getNext() 045 */ 046 @Override 047 public T getNext() { 048 return next; 049 } 050 051 /* 052 * (non-Javadoc) 053 * @see de.ls5.collections.LinkedListEntry#setPrev(de.ls5.collections.LinkedListEntry) 054 */ 055 @Override 056 public void setPrev(T prev) { 057 this.prev = prev; 058 } 059 060 /* 061 * (non-Javadoc) 062 * @see de.ls5.collections.LinkedListEntry#setNext(de.ls5.collections.LinkedListEntry) 063 */ 064 @Override 065 public void setNext(T next) { 066 this.next = next; 067 } 068}