package de.ugoe.cs.autoquest.usageprofiles; import java.util.LinkedList; import java.util.List; /** *
* Implements a round-trip buffered memory of a specified length that can be used to remember the * recent history. Every event that happend longer ago than the length of the memory is forgotten, * hence the memory is incomplete. *
* * @author Steffen Herbold * @version 1.0 * * @param* Maximum length of the memory. *
*/ private int length; /** ** Internal storage of the history. *
*/ private List* Constructor. Creates a new IncompleteMemory. *
* * @param length * number of recent events that are remembered * @throws IllegalArgumentException * This exception is thrown if the length is smaller than 1 */ public IncompleteMemory(int length) { if (length < 1) { throw new IllegalArgumentException("Length of IncompleteMemory must be at least 1."); } this.length = length; history = new LinkedList* Returns the current length of the memory. This can be less than {@link #length}, if the * overall history is less than {@link #length}. *
* * @return length of the current memory */ public int getLength() { return history.size(); } }