org.neo4j.index.lucene
Class LuceneTimeline<T extends PropertyContainer>

java.lang.Object
  extended by org.neo4j.index.lucene.LuceneTimeline<T>
All Implemented Interfaces:
TimelineIndex<T>

public class LuceneTimeline<T extends PropertyContainer>
extends Object
implements TimelineIndex<T>


Constructor Summary
LuceneTimeline(GraphDatabaseService db, Index<T> index)
           
 
Method Summary
 void add(T entity, long timestamp)
          Adds an entity to this timeline with the given timestamp.
 IndexHits<T> getBetween(Long startTimestampOrNull, Long endTimestampOrNull)
          Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date with lowest first.
 IndexHits<T> getBetween(Long startTimestampOrNull, Long endTimestampOrNull, boolean reversed)
          Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date.
 T getFirst()
           
 T getLast()
           
 void remove(T entity, long timestamp)
          Removes an entity from the timeline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneTimeline

public LuceneTimeline(GraphDatabaseService db,
                      Index<T> index)
Method Detail

getLast

public T getLast()
Specified by:
getLast in interface TimelineIndex<T extends PropertyContainer>
Returns:
the last entity in the timeline, that is the entity with the highest timestamp or null if the timeline is empty.

getFirst

public T getFirst()
Specified by:
getFirst in interface TimelineIndex<T extends PropertyContainer>
Returns:
the first entity in the timeline, that is the entity with the lowest timestamp or null if the timeline is empty.

remove

public void remove(T entity,
                   long timestamp)
Description copied from interface: TimelineIndex
Removes an entity from the timeline. The timestamp should be the same as when it was added.

Specified by:
remove in interface TimelineIndex<T extends PropertyContainer>
Parameters:
entity - the entity to remove from this timeline.
timestamp - the timestamp this entity was added with.

add

public void add(T entity,
                long timestamp)
Description copied from interface: TimelineIndex
Adds an entity to this timeline with the given timestamp.

Specified by:
add in interface TimelineIndex<T extends PropertyContainer>
Parameters:
entity - the entity to add to this timeline.
timestamp - the timestamp to use.

getBetween

public IndexHits<T> getBetween(Long startTimestampOrNull,
                               Long endTimestampOrNull)
Description copied from interface: TimelineIndex
Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date with lowest first.

Specified by:
getBetween in interface TimelineIndex<T extends PropertyContainer>
Parameters:
startTimestampOrNull - the start timestamp, entities with greater timestamp value will be returned (exclusive). Will be ignored if null.
endTimestampOrNull - the end timestamp, entities with lesser timestamp value will be returned (exclude). Will be ignored if null.
Returns:
all entities within the given boundaries in this timeline, ordered by timestamp.

getBetween

public IndexHits<T> getBetween(Long startTimestampOrNull,
                               Long endTimestampOrNull,
                               boolean reversed)
Description copied from interface: TimelineIndex
Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date. If reversed is true the order of the result is reversed.

Specified by:
getBetween in interface TimelineIndex<T extends PropertyContainer>
Parameters:
startTimestampOrNull - the start timestamp, entities with greater timestamp value will be returned (exclusive). Will be ignored if null.
endTimestampOrNull - the end timestamp, entities with lesser timestamp
reversed - reverses the result order if true. value will be returned (exclude). Will be ignored if null.
Returns:
all entities within the given boundaries in this timeline, ordered by timestamp.


Copyright © 2011 The Neo4j Graph Database Project. All Rights Reserved.