// Path: src/main/java/org/neo4j/index/lucene/ValueContext.java
// public static ValueContext numeric(Number value)
// {
//     return new ValueContext(value).indexNumeric();
// }


import static org.apache.lucene.search.NumericRangeQuery.newLongRange;
import static org.neo4j.index.lucene.ValueContext.numeric;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.index.Index;
import org.neo4j.graphdb.index.IndexHits;
import org.neo4j.graphdb.index.IndexManager;
import java.util.Map;
import static java.lang.Long.MAX_VALUE;
        long end = endTimestampOrNull != null ? endTimestampOrNull : MAX_VALUE;
        return new QueryContext( newLongRange( FIELD, start, end, true, true ) );
    }
    
    private QueryContext sort( QueryContext query, boolean reversed )
    {
        return query.sort( new Sort( new SortField( FIELD, SortField.Type.LONG, reversed ) ) );
    }
    
    @Override
    public T getLast()
    {
        return getSingle( true );
    }

    @Override
    public T getFirst()
    {
        return getSingle( false );
    }

    @Override
    public void remove( T entity, long timestamp )
    {
        index.remove( entity, FIELD, timestamp );
    }

    @Override
    public void add( T entity, long timestamp )
    {
// Path: src/main/java/org/neo4j/index/lucene/ValueContext.java
// public static ValueContext numeric(Number value)
// {
//     return new ValueContext(value).indexNumeric();
// }


// Path: src/main/java/org/neo4j/index/lucene/LuceneTimeline.java
import static org.apache.lucene.search.NumericRangeQuery.newLongRange;
import static org.neo4j.index.lucene.ValueContext.numeric;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.index.Index;
import org.neo4j.graphdb.index.IndexHits;
import org.neo4j.graphdb.index.IndexManager;
import java.util.Map;
import static java.lang.Long.MAX_VALUE;

        long end = endTimestampOrNull != null ? endTimestampOrNull : MAX_VALUE;
        return new QueryContext( newLongRange( FIELD, start, end, true, true ) );
    }
    
    private QueryContext sort( QueryContext query, boolean reversed )
    {
        return query.sort( new Sort( new SortField( FIELD, SortField.Type.LONG, reversed ) ) );
    }
    
    @Override
    public T getLast()
    {
        return getSingle( true );
    }

    @Override
    public T getFirst()
    {
        return getSingle( false );
    }

    @Override
    public void remove( T entity, long timestamp )
    {
        index.remove( entity, FIELD, timestamp );
    }

    @Override
    public void add( T entity, long timestamp )
    {
        index.add( entity, FIELD, numeric( timestamp ) );