// 
// Decompiled by Procyon v0.6.0
// 

package org.jline.reader;

import java.util.Iterator;
import java.util.ListIterator;
import java.time.Instant;
import java.nio.file.Path;
import java.io.IOException;

public interface History extends Iterable<Entry>
{
    void attach(final LineReader p0);
    
    void load() throws IOException;
    
    void save() throws IOException;
    
    void write(final Path p0, final boolean p1) throws IOException;
    
    void append(final Path p0, final boolean p1) throws IOException;
    
    void read(final Path p0, final boolean p1) throws IOException;
    
    void purge() throws IOException;
    
    int size();
    
    default boolean isEmpty() {
        return this.size() == 0;
    }
    
    int index();
    
    int first();
    
    int last();
    
    String get(final int p0);
    
    default void add(final String line) {
        this.add(Instant.now(), line);
    }
    
    void add(final Instant p0, final String p1);
    
    default boolean isPersistable(final Entry entry) {
        return true;
    }
    
    ListIterator<Entry> iterator(final int p0);
    
    default ListIterator<Entry> iterator() {
        return this.iterator(this.first());
    }
    
    default Iterator<Entry> reverseIterator() {
        return this.reverseIterator(this.last());
    }
    
    default Iterator<Entry> reverseIterator(final int index) {
        return new Iterator<Entry>() {
            private final ListIterator<Entry> it = History.this.iterator(index + 1);
            
            @Override
            public boolean hasNext() {
                return this.it.hasPrevious();
            }
            
            @Override
            public Entry next() {
                return this.it.previous();
            }
            
            @Override
            public void remove() {
                this.it.remove();
                History.this.resetIndex();
            }
        };
    }
    
    String current();
    
    boolean previous();
    
    boolean next();
    
    boolean moveToFirst();
    
    boolean moveToLast();
    
    boolean moveTo(final int p0);
    
    void moveToEnd();
    
    void resetIndex();
    
    public interface Entry
    {
        int index();
        
        Instant time();
        
        String line();
    }
}
