1 /* 2 * Copyright (c) 2002-2012, the original author or authors. 3 * 4 * This software is distributable under the BSD license. See the terms of the 5 * BSD license in the documentation provided with this software. 6 * 7 * http://www.opensource.org/licenses/bsd-license.php 8 */ 9 package jline.console.history; 10 11 import java.util.Iterator; 12 import java.util.LinkedList; 13 import java.util.ListIterator; 14 import java.util.NoSuchElementException; 15 16 import static jline.internal.Preconditions.checkNotNull; 17 18 /** 19 * Non-persistent {@link History}. 20 * 21 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a> 22 * @author <a href="mailto:jason@planet57.com">Jason Dillon</a> 23 * @since 2.3 24 */ 25 public class MemoryHistory 26 implements History 27 { 28 public static final int DEFAULT_MAX_SIZE = 500; 29 30 private final LinkedList<CharSequence> items = new LinkedList<CharSequence>(); 31 32 private int maxSize = DEFAULT_MAX_SIZE; 33 34 private boolean ignoreDuplicates = true; 35 36 private boolean autoTrim = false; | 1 /* 2 * Copyright (c) 2002-2012, the original author or authors. 3 * 4 * This software is distributable under the BSD license. See the terms of the 5 * BSD license in the documentation provided with this software. 6 * 7 * http://www.opensource.org/licenses/bsd-license.php 8 */ 9 package jdk.internal.jline.console.history; 10 11 import java.util.Iterator; 12 import java.util.LinkedList; 13 import java.util.ListIterator; 14 import java.util.NoSuchElementException; 15 16 import static jdk.internal.jline.internal.Preconditions.checkNotNull; 17 18 /** 19 * Non-persistent {@link History}. 20 * 21 * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a> 22 * @author <a href="mailto:jason@planet57.com">Jason Dillon</a> 23 * @since 2.3 24 */ 25 public class MemoryHistory 26 implements History 27 { 28 public static final int DEFAULT_MAX_SIZE = 500; 29 30 private final LinkedList<CharSequence> items = new LinkedList<CharSequence>(); 31 32 private int maxSize = DEFAULT_MAX_SIZE; 33 34 private boolean ignoreDuplicates = true; 35 36 private boolean autoTrim = false; |