Timeline (Neo4j Apoc 1.1 API)
Keywords: org.neo4j.index.timeline.Timeline class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.index.timeline
Class Timeline

    java.lang.Object
      org.neo4j.index.timeline.Timeline

All Implemented Interfaces:
  TimelineIndex

    public class Timeline

extends Object
implements TimelineIndex

An implementation of `TimelineIndex` on top of Neo4j, using `BTree` for indexing. Note: this implementation is not thread-safe (yet). Nodes added to a timeline will get a `Relationship` created to it so if you delete such a node later on you'll have to remove it from the timeline first (or in the same transaction at least).

Constructor Summary
`Timeline(String name, Node underlyingNode, boolean indexed, GraphDatabaseService graphDb)` Creates/loads a timeline.
`Timeline(String name, Node underlyingNode, GraphDatabaseService graphDb)` Creates/loads an indexed timeline.

Method Summary
`void` | `addNode(Node nodeToAdd, long timestamp)` Adds a node to this timeline with the given `timestamp`.
`void` | `delete()` Deletes this timeline.
`Iterable<Node>` | `getAllNodes()` Returns all added nodes in this timeline ordered by increasing timestamp.
`Iterable<Node>` | `getAllNodes(Long afterTimestampOrNull, Long beforeTimestampOrNull)` Convenience method which you can use `TimelineIndex.getAllNodes()`, `TimelineIndex.getAllNodesAfter(long)`, `TimelineIndex.getAllNodesBefore(long)` and `TimelineIndex.getAllNodesBetween(long, long)` in a single method.
`Iterable<Node>` | `getAllNodesAfter(long timestamp)` Returns all the nodes after (exclusive) `timestamp` ordered by increasing timestamp.
`Iterable<Node>` | `getAllNodesBefore(long timestamp)` Returns all the nodes before (exclusive) `timestamp` ordered by increasing timestamp.
`Iterable<Node>` | `getAllNodesBetween(long startTime, long endTime)` Returns all the nodes after (exclusive) `afterTimestamp` and before (exclusive) `beforeTimestamp` ordered by increasing timestamp.
`Node` | `getFirstNode()` Returns the first node in the timeline, that is the node with the lowest timestamp or `null` if there's no nodes in the timeline.
`Node` | `getLastNode()` Returns the last node in the timeline, that is the node with the highest timestamp or `null` if there's no nodes in the timeline.
`Iterable<Node>` | `getNodes(long timestamp)` Returns nodes which were added with the given `timestamp`.
`long` | `getTimestampForNode(Node node)` Will return the timestamp for `node` if it has been added to this timeline.
`Node` | `getUnderlyingNode()` Returns the underlying node representing this timeline.
`void` | `removeNode(Node nodeToRemove)` Removes a node from the timeline.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Timeline

    public Timeline(String name,
                    Node underlyingNode,
                    boolean indexed,
                    GraphDatabaseService graphDb)

  Creates/loads a timeline. The `underlyingNode` can either be a new (just created) node or a node that already represents a previously timeline.

  Parameters:
    `name` - The unique name of the timeline or `null` if timeline already exist
    `underlyingNode` - The underlying node representing the timeline
    `indexed` - Set to `true` if this timeline is indexed
    `graphDb` - the `GraphDatabaseService`

### Timeline

    public Timeline(String name,
                    Node underlyingNode,
                    GraphDatabaseService graphDb)

  Creates/loads an indexed timeline. The `underlyingNode` can either be a new (just created) node or a node that already represents a previously timeline.

  Parameters:
    `name` - The unique name of the timeline or `null` if timeline already exist
    `underlyingNode` - The underlying node representing the timeline
    `graphDb` - The `GraphDatabaseService`.

Method Detail

### getUnderlyingNode

    public Node getUnderlyingNode()

  Returns the underlying node representing this timeline.

  Returns:
    The underlying node representing this timeline

### getLastNode

    public Node getLastNode()

  Description copied from interface: `TimelineIndex`
  Returns the last node in the timeline, that is the node with the highest timestamp or `null` if there's no nodes in the timeline.

  Specified by:
    `getLastNode` in interface `TimelineIndex`
  Returns:
    the last node in the timeline or `null` if timeline is empty.

### getFirstNode

    public Node getFirstNode()

  Description copied from interface: `TimelineIndex`
  Returns the first node in the timeline, that is the node with the lowest timestamp or `null` if there's no nodes in the timeline.

  Specified by:
    `getFirstNode` in interface `TimelineIndex`
  Returns:
    the first node in the timeline or `null` if timeline is empty.

### addNode

    public void addNode(Node nodeToAdd,
                        long timestamp)

  Description copied from interface: `TimelineIndex`
  Adds a node to this timeline with the given `timestamp`.

  Specified by:
    `addNode` in interface `TimelineIndex`
  Parameters:
    `nodeToAdd` - the node to add to this timeline.
    `timestamp` - the timestamp to use

### getTimestampForNode

    public long getTimestampForNode(Node node)

  Description copied from interface: `TimelineIndex`
  Will return the timestamp for `node` if it has been added to this timeline. If `node` hasn't been added to this timeline a runtime exception will be thrown.

  Specified by:
    `getTimestampForNode` in interface `TimelineIndex`
  Parameters:
    `node` - the node to return the timestamp for.
  Returns:
    the timestamp for `node`.

### removeNode

    public void removeNode(Node nodeToRemove)

  Description copied from interface: `TimelineIndex`
  Removes a node from the timeline. It will throw an exception if `nodeToRemove` isn't added in this timeline.

  Specified by:
    `removeNode` in interface `TimelineIndex`
  Parameters:
    `nodeToRemove` - the node to remove from this timeline

### getAllNodes

    public Iterable<Node> getAllNodes(Long afterTimestampOrNull,
                                      Long beforeTimestampOrNull)

  Description copied from interface: `TimelineIndex`
  Convenience method which you can use `TimelineIndex.getAllNodes()`, `TimelineIndex.getAllNodesAfter(long)`, `TimelineIndex.getAllNodesBefore(long)` and `TimelineIndex.getAllNodesBetween(long, long)` in a single method.

  Specified by:
    `getAllNodes` in interface `TimelineIndex`
  Parameters:
    `afterTimestampOrNull` - the start timestamp, nodes with greater timestamp value will be returned. Will be ignored if `null`.
    `beforeTimestampOrNull` - the end timestamp, nodes with lesser timestamp value will be returned. Will be ignored if `null`.
  Returns:
    all nodes in this timeline ordered by timestamp. A range can be given with the `startTimestampOrNull` and/or `endTimestampOrNull` (where `null` means no restriction).

### getAllNodes

    public Iterable<Node> getAllNodes()

  Description copied from interface: `TimelineIndex`
  Returns all added nodes in this timeline ordered by increasing timestamp.

  Specified by:
    `getAllNodes` in interface `TimelineIndex`
  Returns:
    all the nodes in the timeline ordered by increasing timestamp.

### getNodes

    public Iterable<Node> getNodes(long timestamp)

  Description copied from interface: `TimelineIndex`
  Returns nodes which were added with the given `timestamp`.

  Specified by:
    `getNodes` in interface `TimelineIndex`
  Parameters:
    `timestamp` - the timestamp to get nodes for.
  Returns:
    nodes which were added with the given `timestamp`.

### getAllNodesAfter

    public Iterable<Node> getAllNodesAfter(long timestamp)

  Description copied from interface: `TimelineIndex`
  Returns all the nodes after (exclusive) `timestamp` ordered by increasing timestamp.

  Specified by:
    `getAllNodesAfter` in interface `TimelineIndex`
  Parameters:
    `timestamp` - the timestamp value, nodes with greater timestamp value will be returned.
  Returns:
    all nodes after (exclusive) `timestamp` ordered by increasing timestamp.

### getAllNodesBefore

    public Iterable<Node> getAllNodesBefore(long timestamp)

  Description copied from interface: `TimelineIndex`
  Returns all the nodes before (exclusive) `timestamp` ordered by increasing timestamp.

  Specified by:
    `getAllNodesBefore` in interface `TimelineIndex`
  Parameters:
    `timestamp` - the timestamp value, nodes with lesser timestamp value will be returned.
  Returns:
    all nodes before (exclusive) `timestamp` ordered by increasing timestamp.

### getAllNodesBetween

    public Iterable<Node> getAllNodesBetween(long startTime,
                                             long endTime)

  Description copied from interface: `TimelineIndex`
  Returns all the nodes after (exclusive) `afterTimestamp` and before (exclusive) `beforeTimestamp` ordered by increasing timestamp.

  Specified by:
    `getAllNodesBetween` in interface `TimelineIndex`
  Parameters:
    `startTime` - the start timestamp, nodes with greater timestamp value will be returned.
    `endTime` - the end timestamp, nodes with lesser timestamp value will be returned.
  Returns:
    all nodes between (exclusive) the specified timestamps ordered by increasing timestamp.

### delete

    public void delete()

  Description copied from interface: `TimelineIndex`
  Deletes this timeline. Nodes added to the timeline will not be deleted, they are just disconnected from this timeline.

  Specified by:
    `delete` in interface `TimelineIndex`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Neo4j. All Rights Reserved.