All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jline.console.history.History Maven / Gradle / Ivy

/*
 * Copyright (c) 2002-2012, the original author or authors.
 *
 * This software is distributable under the BSD license. See the terms of the
 * BSD license in the documentation provided with this software.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */
package scala.tools.jline.console.history;

import java.util.Iterator;
import java.util.ListIterator;

/**
 * Console history.
 *
 * @author Marc Prud'hommeaux
 * @author Jason Dillon
 * @since 2.3
 */
public interface History
    extends Iterable
{
    int size();

    boolean isEmpty();

    int index();

    void clear();

    CharSequence get(int index);

    void add(CharSequence line);

    /**
     * Set the history item at the given index to the given CharSequence.
     *
     * @param index the index of the history offset
     * @param item the new item
     * @since 2.7
     */
    void set(int index, CharSequence item);

    /**
     * Remove the history element at the given index.
     *
     * @param i the index of the element to remove
     * @return the removed element
     * @since 2.7
     */
    CharSequence remove(int i);

    /**
     * Remove the first element from history.
     *
     * @return the removed element
     * @since 2.7
     */
    CharSequence removeFirst();

    /**
     * Remove the last element from history
     *
     * @return the removed element
     * @since 2.7
     */
    CharSequence removeLast();

    void replace(CharSequence item);

    //
    // Entries
    //
    
    interface Entry
    {
        int index();

        CharSequence value();
    }

    ListIterator entries(int index);

    ListIterator entries();

    Iterator iterator();

    //
    // Navigation
    //

    CharSequence current();

    boolean previous();

    boolean next();

    boolean moveToFirst();

    boolean moveToLast();

    boolean moveTo(int index);

    void moveToEnd();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy