Unnamed: 0
int64 0
6.7k
| func
stringlengths 12
89.6k
| target
bool 2
classes | project
stringlengths 45
151
|
|---|---|---|---|
6,100
|
public interface PathFinder<P extends Path>
{
/**
* Tries to find a single path between {@code start} and {@code end}
* nodes. If a path is found a {@link Path} is returned with that path
* information, else {@code null} is returned. If more than one path is
* found, the implementation can decide itself upon which of those to return.
*
* @param start the start {@link Node} which defines the start of the path.
* @param end the end {@link Node} which defines the end of the path.
* @return a single {@link Path} between {@code start} and {@code end},
* or {@code null} if no path was found.
*/
P findSinglePath( Node start, Node end );
/**
* Tries to find all paths between {@code start} and {@code end} nodes.
* A collection of {@link Path}s is returned with all the found paths.
* If no paths are found an empty collection is returned.
*
* @param start the start {@link Node} which defines the start of the path.
* @param end the end {@link Node} which defines the end of the path.
* @return all {@link Path}s between {@code start} and {@code end}.
*/
Iterable<P> findAllPaths( Node start, Node end );
TraversalMetadata metadata();
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_PathFinder.java
|
6,101
|
public interface WeightedPath extends Path
{
/**
* Returns the weight of the path.
*
* @return the weight of the path.
*/
double weight();
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_WeightedPath.java
|
6,102
|
enum Rels implements RelationshipType
{
contains
}
| false
|
community_graph-algo_src_test_java_org_neo4j_graphalgo_impl_ancestor_AncestorTestCase.java
|
6,103
|
public interface CostDivider<CostType>
{
/**
* @return c / d
*/
CostType divideCost( CostType c, Double d );
/**
* @return d / c
*/
CostType divideByCost( Double d, CostType c );
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_centrality_CostDivider.java
|
6,104
|
public interface EigenvectorCentrality
{
/**
* This can be used to retrieve the result for every node. Might return null
* if the node is not contained in the node set initially given, or doesn't
* receive a result because no relationship points to it.
* @param node
* The node for which we would like the value.
* @return the centrality value for the given node.
*/
public Double getCentrality( Node node );
/**
* This resets the calculation if we for some reason would like to redo it.
*/
public void reset();
/**
* Internal calculate method that will do the calculation. This can however
* be called externally to manually trigger the calculation.
*/
public void calculate();
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_centrality_EigenvectorCentrality.java
|
6,105
|
private static interface HitDecider
{
boolean isHit( int depth );
boolean canVisitRelationship( Collection<Long> rels, Relationship rel );
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_path_ShortestPath.java
|
6,106
|
public interface DijkstraPriorityQueue<CostType>
{
/**
* Used to insert a new value into the queue.
* @param node
* @param value
*/
public void insertValue( Node node, CostType value );
/**
* Used to update a value in the queue (or insert it).
* @param node
* @param newValue
*/
public void decreaseValue( Node node, CostType newValue );
/**
* Retrieve and remove the node with the most optimal value.
*/
public Node extractMin();
/**
* Retrieve without removing the node with the most optimal value.
*/
public Node peek();
/**
* @return True if the queue is empty.
*/
public boolean isEmpty();
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_shortestpath_DijkstraPriorityQueue.java
|
6,107
|
public interface SingleSourceShortestPath<CostType>
{
/**
* This resets the calculation if we for some reason would like to redo it.
*/
public void reset();
/**
* This sets the start node. The found paths will start in this node.
* @param node
* The start node.
*/
public void setStartNode( Node node );
/**
* A call to this will run the algorithm to find a single shortest path, if
* not already done, and return it as an alternating list of
* Node/Relationship.
* @return The path as an alternating list of Node/Relationship.
*/
public List<PropertyContainer> getPath( Node targetNode );
/**
* A call to this will run the algorithm, if not already done, and return
* the found path to the target node if found as a list of nodes.
* @return The path as a list of nodes.
*/
public List<Node> getPathAsNodes( Node targetNode );
/**
* A call to this will run the algorithm to find a single shortest path, if
* not already done, and return it as a list of Relationships.
* @return The path as a list of Relationships.
*/
public List<Relationship> getPathAsRelationships( Node targetNode );
/**
* A call to this will run the algorithm to find all shortest paths, if not
* already done, and return them as alternating lists of Node/Relationship.
* @return A list of the paths as alternating lists of Node/Relationship.
*/
public List<List<PropertyContainer>> getPaths( Node targetNode );
/**
* A call to this will run the algorithm to find all shortest paths, if not
* already done, and return them as lists of nodes.
* @return A list of the paths as lists of nodes.
*/
public List<List<Node>> getPathsAsNodes( Node targetNode );
/**
* A call to this will run the algorithm to find all shortest paths, if not
* already done, and return them as lists of relationships.
* @return A list of the paths as lists of relationships.
*/
public List<List<Relationship>> getPathsAsRelationships( Node targetNode );
/**
* A call to this will run the algorithm, if not already done, and return
* the cost for the shortest paths between the start node and the target
* node.
* @return The total weight of the shortest path(s).
*/
public CostType getCost( Node targetNode );
/**
* @param node
* @return The nodes previous to the argument node in all found shortest
* paths or null if there are no such nodes.
*/
public List<Node> getPredecessorNodes( Node node );
/**
* This can be used to retrieve the entire data structure representing the
* predecessors for every node.
* @return
*/
public Map<Node,List<Relationship>> getPredecessors();
/**
* This can be used to retrieve the Direction in which relationships should
* be in the shortest path(s).
* @return The direction.
*/
public Direction getDirection();
/**
* This can be used to retrieve the types of relationships that are
* traversed.
* @return The relationship type(s).
*/
public RelationshipType[] getRelationshipTypes();
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_shortestpath_SingleSourceShortestPath.java
|
6,108
|
public interface SingleSourceSingleSinkShortestPath<CostType>
{
/**
* This resets the calculation if we for some reason would like to redo it.
*/
public void reset();
/**
* This sets the start node. The found paths will start in this node.
* @param node
* The start node.
*/
public void setStartNode( Node node );
/**
* This sets the end node. The found paths will end in this node.
* @param node
* The end node.
*/
public void setEndNode( Node node );
/**
* A call to this will run the algorithm to find a single shortest path, if
* not already done, and return it as an alternating list of
* Node/Relationship.
* @return The path as an alternating list of Node/Relationship.
*/
public List<PropertyContainer> getPath();
/**
* A call to this will run the algorithm to find a single shortest path, if
* not already done, and return it as a list of nodes.
* @return The path as a list of nodes.
*/
public List<Node> getPathAsNodes();
/**
* A call to this will run the algorithm to find a single shortest path, if
* not already done, and return it as a list of Relationships.
* @return The path as a list of Relationships.
*/
public List<Relationship> getPathAsRelationships();
/**
* A call to this will run the algorithm to find all shortest paths, if not
* already done, and return them as alternating lists of Node/Relationship.
* @return A list of the paths as alternating lists of Node/Relationship.
*/
public List<List<PropertyContainer>> getPaths();
/**
* A call to this will run the algorithm to find all shortest paths, if not
* already done, and return them as lists of nodes.
* @return A list of the paths as lists of nodes.
*/
public List<List<Node>> getPathsAsNodes();
/**
* A call to this will run the algorithm to find all shortest paths, if not
* already done, and return them as lists of relationships.
* @return A list of the paths as lists of relationships.
*/
public List<List<Relationship>> getPathsAsRelationships();
/**
* A call to this will run the algorithm to find the cost for the shortest
* paths between the start node and the end node, if not calculated before.
* This will usually find a single shortest path.
* @return The total weight of the shortest path(s).
*/
public CostType getCost();
/**
* This can be used to retrieve the Direction in which relationships should
* be in the shortest path(s).
* @return The direction.
*/
public Direction getDirection();
/**
* This can be used to retrieve the types of relationships that are
* traversed.
* @return The relationship type(s).
*/
public RelationshipType[] getRelationshipTypes();
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_shortestpath_SingleSourceSingleSinkShortestPath.java
|
6,109
|
public interface Converter<T, S>
{
T convert( S source );
}
| false
|
community_graph-algo_src_main_java_org_neo4j_graphalgo_impl_util_PriorityMap.java
|
6,110
|
public static enum RelationshipTypes implements RelationshipType
{
CONNECTION;
}
| false
|
community_graph-algo_src_test_java_org_neo4j_graphalgo_path_GeoDataGenerator.java
|
6,111
|
private enum RelTypes implements RelationshipType
{
SomeRelType
}
| false
|
community_graph-algo_src_test_java_org_neo4j_graphalgo_path_PathExplosionIT.java
|
6,112
|
private interface PathFinderTester
{
void test( PathFinder<Path> finder );
}
| false
|
community_graph-algo_src_test_java_org_neo4j_graphalgo_path_TestShortestPath.java
|
6,113
|
enum RelTypes implements RelationshipType {
ASD
}
| false
|
community_kernel_src_test_java_org_neo4j_graphdb_CreateAndDeleteNodesIT.java
|
6,114
|
public interface DependencyResolver
{
/**
* Tries to resolve a dependency that matches a given class. No specific
* {@link SelectionStrategy} is used, so the first encountered matching dependency will be returned.
*
* @param type the type of {@link Class} that the returned instance must implement.
* @return the resolved dependency for the given type.
* @throws IllegalArgumentException if no matching dependency was found.
*/
<T> T resolveDependency( Class<T> type ) throws IllegalArgumentException;
/**
* Tries to resolve a dependency that matches a given class. All candidates are fed to the
* {@code selector} which ultimately becomes responsible for making the choice between all available candidates.
*
* @param type the type of {@link Class} that the returned instance must implement.
* @param selector {@link SelectionStrategy} which will make the choice of which one to return among
* matching candidates.
* @return the resolved dependency for the given type.
* @throws IllegalArgumentException if no matching dependency was found.
*/
<T> T resolveDependency( Class<T> type, SelectionStrategy selector ) throws IllegalArgumentException;
/**
* Responsible for making the choice between available candidates.
*/
interface SelectionStrategy
{
/**
* Given a set of candidates, select an appropriate one. Even if there are candidates this
* method may throw {@link IllegalArgumentException} if there was no suitable candidate.
*
* @param type the type of items.
* @param candidates candidates up for selection, where one should be picked. There might
* also be no suitable candidate, in which case an exception should be thrown.
* @return a suitable candidate among all available.
* @throws IllegalArgumentException if no suitable candidate was found.
*/
<T> T select( Class<T> type, Iterable<T> candidates ) throws IllegalArgumentException;
}
/**
* Adapter for {@link DependencyResolver} which will select the first available candidate by default
* for {@link #resolveDependency(Class)}.
*/
abstract class Adapter implements DependencyResolver
{
@SuppressWarnings( "rawtypes" )
private static final SelectionStrategy FIRST = new SelectionStrategy()
{
@Override
public <T> T select( Class<T> type, Iterable<T> candidates ) throws IllegalArgumentException
{
Iterator<T> iterator = candidates.iterator();
if ( !iterator.hasNext() )
throw new IllegalArgumentException( "Could not resolve dependency of type:" + type.getName() );
return iterator.next();
}
};
@Override
public <T> T resolveDependency( Class<T> type ) throws IllegalArgumentException
{
return resolveDependency( type, FIRST );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_DependencyResolver.java
|
6,115
|
interface SelectionStrategy
{
/**
* Given a set of candidates, select an appropriate one. Even if there are candidates this
* method may throw {@link IllegalArgumentException} if there was no suitable candidate.
*
* @param type the type of items.
* @param candidates candidates up for selection, where one should be picked. There might
* also be no suitable candidate, in which case an exception should be thrown.
* @return a suitable candidate among all available.
* @throws IllegalArgumentException if no suitable candidate was found.
*/
<T> T select( Class<T> type, Iterable<T> candidates ) throws IllegalArgumentException;
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_DependencyResolver.java
|
6,116
|
public enum Direction
{
/**
* Defines outgoing relationships.
*/
OUTGOING,
/**
* Defines incoming relationships.
*/
INCOMING,
/**
* Defines both incoming and outgoing relationships.
*/
BOTH;
/**
* Reverses the direction returning {@link #INCOMING} if this equals
* {@link #OUTGOING}, {@link #OUTGOING} if this equals {@link #INCOMING} or
* {@link #BOTH} if this equals {@link #BOTH}.
*
* @return The reversed direction.
*/
public Direction reverse()
{
switch ( this )
{
case OUTGOING:
return INCOMING;
case INCOMING:
return OUTGOING;
case BOTH:
return BOTH;
default:
throw new IllegalStateException( "Unknown Direction "
+ "enum: " + this );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Direction.java
|
6,117
|
public interface Expander extends RelationshipExpander
{
// Expansion<Relationship> expand( Node start );
Expander reversed();
/**
* Add a {@link RelationshipType} to the {@link Expander}.
*
* @param type relationship type
* @return new instance
*/
Expander add( RelationshipType type );
/**
* Add a {@link RelationshipType} with a {@link Direction} to the
* {@link Expander}.
*
* @param type relationship type
* @param direction expanding direction
* @return new instance
*/
Expander add( RelationshipType type, Direction direction );
/**
* Remove a {@link RelationshipType} from the {@link Expander}.
*
* @param type relationship type
* @return new instance
*/
Expander remove( RelationshipType type );
/**
* Add a {@link Node} filter.
*
* @param filter filter to use
* @return new instance
*/
Expander addNodeFilter( Predicate<? super Node> filter );
/**
* Add a {@link Relationship} filter.
*
* @param filter filter to use
* @return new instance
* @deprecated because of typo, use {@link Expander#addRelationshipFilter(Predicate)} instead
*/
Expander addRelationsipFilter( Predicate<? super Relationship> filter );
/**
* Add a {@link Relationship} filter.
*
* @param filter filter to use
* @return new instance
*/
Expander addRelationshipFilter( Predicate<? super Relationship> filter );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Expander.java
|
6,118
|
public interface GraphDatabaseService
{
/**
* Creates a new node.
*
* @return the created node.
*/
Node createNode();
/**
* Creates a new node and adds the provided labels to it.
*
* @param labels {@link Label labels} to add to the created node.
* @return the created node.
*/
Node createNode( Label... labels );
/**
* Looks up a node by id. Please note: Neo4j reuses its internal ids when
* nodes and relationships are deleted, which means it's bad practice to
* refer to them this way. Instead, use application generated ids.
*
* @param id the id of the node
* @return the node with id <code>id</code> if found
* @throws NotFoundException if not found
*/
Node getNodeById( long id );
/**
* Looks up a relationship by id. Please note: Neo4j reuses its internal ids
* when nodes and relationships are deleted, which means it's bad practice
* to refer to them this way. Instead, use application generated ids.
*
* @param id the id of the relationship
* @return the relationship with id <code>id</code> if found
* @throws NotFoundException if not found
*/
Relationship getRelationshipById( long id );
/**
* Returns all nodes in the graph.
*
* @return all nodes in the graph.
* @deprecated this operation can be found in {@link GlobalGraphOperations} instead.
*/
@Deprecated
Iterable<Node> getAllNodes();
/**
* Returns all nodes having the label, and the wanted property value.
* If an online index is found, it will be used to look up the requested
* nodes.
* <p/>
* If no indexes exist for the label/property combination, the database will
* scan all labeled nodes looking for the property value.
* <p/>
* Note that equality for values do not follow the rules of Java. This means that the number 42 is equals to all
* other 42 numbers, indifferently of if they are encoded as Integer, Long, Float, Short, Byte or Double.
* <p/>
* Same rules follow Character and String - the Character 'A' is equal to the String 'A'.
* <p/>
* Finally - arrays also follow these rules. An int[] {1,2,3} is equal to a double[] {1.0, 2.0, 3.0}
* <p/>
* Please ensure that the returned {@link ResourceIterable} is closed correctly and as soon as possible
* inside your transaction to avoid potential blocking of write operations.
*
* @param label consider nodes with this label
* @param key required property key
* @param value required property value
* @return an iterable containing all matching nodes. See { @link ResourceIterable } for responsibilities.
*/
ResourceIterable<Node> findNodesByLabelAndProperty( Label label, String key, Object value );
/**
* Returns all relationship types currently in the underlying store.
* Relationship types are added to the underlying store the first time they
* are used in a successfully commited {@link Node#createRelationshipTo
* node.createRelationshipTo(...)}. Note that this method is guaranteed to
* return all known relationship types, but it does not guarantee that it
* won't return <i>more</i> than that (e.g. it can return "historic"
* relationship types that no longer have any relationships in the node
* space).
*
* @return all relationship types in the underlying store
* @deprecated this operation can be found in {@link GlobalGraphOperations} instead.
*/
@Deprecated
Iterable<RelationshipType> getRelationshipTypes();
/**
* Use this method to check if the database is in a usable state. If the database is currently not in a usable
* state,
* you can provide a timeout to wait for it to become so. If the database has been shutdown this immediately
* returns false.
*/
boolean isAvailable( long timeout );
/**
* Shuts down Neo4j. After this method has been invoked, it's invalid to
* invoke any methods in the Neo4j API and all references to this instance
* of GraphDatabaseService should be discarded.
*/
void shutdown();
/**
* Starts a new {@link Transaction transaction} and associates it with the current thread.
* <p/>
* <em>All database operations must be wrapped in a transaction.</em>
* <p/>
* If you attempt to access the graph outside of a transaction, those operations will throw
* {@link NotInTransactionException}.
* <p/>
* Please ensure that any returned {@link ResourceIterable} is closed correctly and as soon as possible
* inside your transaction to avoid potential blocking of write operations.
*
* @return a new transaction instance
*/
Transaction beginTx();
/**
* Registers {@code handler} as a handler for transaction events which
* are generated from different places in the lifecycle of each
* transaction. To guarantee that the handler gets all events properly
* it shouldn't be registered when the application is running (i.e. in the
* middle of one or more transactions). If the specified handler instance
* has already been registered this method will do nothing.
*
* @param <T> the type of state object used in the handler, see more
* documentation about it at {@link TransactionEventHandler}.
* @param handler the handler to receive events about different states
* in transaction lifecycles.
* @return the handler passed in as the argument.
*/
<T> TransactionEventHandler<T> registerTransactionEventHandler( TransactionEventHandler<T> handler );
/**
* Unregisters {@code handler} from the list of transaction event handlers.
* If {@code handler} hasn't been registered with
* {@link #registerTransactionEventHandler(TransactionEventHandler)} prior
* to calling this method an {@link IllegalStateException} will be thrown.
* After a successful call to this method the {@code handler} will no
* longer receive any transaction events.
*
* @param <T> the type of state object used in the handler, see more
* documentation about it at {@link TransactionEventHandler}.
* @param handler the handler to receive events about different states
* in transaction lifecycles.
* @return the handler passed in as the argument.
* @throws IllegalStateException if {@code handler} wasn't registered prior
* to calling this method.
*/
<T> TransactionEventHandler<T> unregisterTransactionEventHandler( TransactionEventHandler<T> handler );
/**
* Registers {@code handler} as a handler for kernel events which
* are generated from different places in the lifecycle of the kernel.
* To guarantee proper behavior the handler should be registered right
* after the graph database has been started. If the specified handler
* instance has already been registered this method will do nothing.
*
* @param handler the handler to receive events about different states
* in the kernel lifecycle.
* @return the handler passed in as the argument.
*/
KernelEventHandler registerKernelEventHandler( KernelEventHandler handler );
/**
* Unregisters {@code handler} from the list of kernel event handlers.
* If {@code handler} hasn't been registered with
* {@link #registerKernelEventHandler(KernelEventHandler)} prior to calling
* this method an {@link IllegalStateException} will be thrown.
* After a successful call to this method the {@code handler} will no
* longer receive any kernel events.
*
* @param handler the handler to receive events about different states
* in the kernel lifecycle.
* @return the handler passed in as the argument.
* @throws IllegalStateException if {@code handler} wasn't registered prior
* to calling this method.
*/
KernelEventHandler unregisterKernelEventHandler( KernelEventHandler handler );
/**
* Returns the {@link Schema schema manager} where all things related to schema,
* for example constraints and indexing on {@link Label labels}.
*
* @return the {@link Schema schema manager} for this database.
*/
Schema schema();
/**
* Returns the {@link IndexManager} paired with this graph database service
* and is the entry point for managing indexes coupled with this database.
*
* @return the {@link IndexManager} for this database.
*/
IndexManager index();
/**
* Factory method for unidirectional traversal descriptions
*/
TraversalDescription traversalDescription();
/**
* Factory method for bidirectional traversal descriptions
*/
BidirectionalTraversalDescription bidirectionalTraversalDescription();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_GraphDatabaseService.java
|
6,119
|
public interface Label
{
/**
* Returns the name of the label. The name uniquely identifies a
* label, i.e. two different Label instances with different object identifiers
* (and possibly even different classes) are semantically equivalent if they
* have {@link String#equals(Object) equal} names.
*
* @return the name of the label
*/
String name();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Label.java
|
6,120
|
private static enum Labels implements Label
{
First,
Second,
Third
}
| false
|
community_kernel_src_test_java_org_neo4j_graphdb_LabelScanStoreIT.java
|
6,121
|
private enum Labels implements Label
{
MY_LABEL,
MY_OTHER_LABEL
}
| false
|
community_kernel_src_test_java_org_neo4j_graphdb_LabelsAcceptanceTest.java
|
6,122
|
public interface Lock
{
/**
* Releases this lock before the transaction finishes. It is an optional
* operation and if not called, this lock will be released when the owning
* transaction finishes.
*
* @throws IllegalStateException if this lock has already been released.
*/
void release();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Lock.java
|
6,123
|
private static enum Labels implements Label
{
First,
Second,
Third;
}
| false
|
community_lucene-index_src_test_java_org_neo4j_graphdb_LuceneLabelScanStoreChaosIT.java
|
6,124
|
public interface Node extends PropertyContainer
{
/**
* Returns the unique id of this node. Ids are garbage collected over time
* so they are only guaranteed to be unique during a specific time span: if
* the node is deleted, it's likely that a new node at some point will get
* the old id. <b>Note</b>: this makes node ids brittle as public APIs.
*
* @return the id of this node
*/
long getId();
/**
* Deletes this node if it has no relationships attached to it. If
* <code>delete()</code> is invoked on a node with relationships, an
* unchecked exception will be raised when the transaction is committing.
* Invoking any methods on this node after <code>delete()</code> has
* returned is invalid and will lead to unspecified behavior.
*/
void delete();
// Relationships
/**
* Returns all the relationships attached to this node. If no relationships
* are attached to this node, an empty iterable will be returned.
*
* @return all relationships attached to this node
*/
Iterable<Relationship> getRelationships();
/**
* Returns <code>true</code> if there are any relationships attached to this
* node, <code>false</code> otherwise.
*
* @return <code>true</code> if there are any relationships attached to this
* node, <code>false</code> otherwise
*/
boolean hasRelationship();
/**
* Returns all the relationships of any of the types in <code>types</code>
* that are attached to this node, regardless of direction. If no
* relationships of the given types are attached to this node, an empty
* iterable will be returned.
*
* @param types the given relationship type(s)
* @return all relationships of the given type(s) that are attached to this
* node
*/
Iterable<Relationship> getRelationships( RelationshipType... types );
/**
* Returns all the relationships of any of the types in <code>types</code>
* that are attached to this node and have the given <code>direction</code>.
* If no relationships of the given types are attached to this node, an empty
* iterable will be returned.
*
* @param types the given relationship type(s)
* @param direction the direction of the relationships to return.
* @return all relationships of the given type(s) that are attached to this
* node
*/
Iterable<Relationship> getRelationships( Direction direction, RelationshipType... types );
/**
* Returns <code>true</code> if there are any relationships of any of the
* types in <code>types</code> attached to this node (regardless of
* direction), <code>false</code> otherwise.
*
* @param types the given relationship type(s)
* @return <code>true</code> if there are any relationships of any of the
* types in <code>types</code> attached to this node,
* <code>false</code> otherwise
*/
boolean hasRelationship( RelationshipType... types );
/**
* Returns <code>true</code> if there are any relationships of any of the
* types in <code>types</code> attached to this node (for the given
* <code>direction</code>), <code>false</code> otherwise.
*
* @param types the given relationship type(s)
* @param direction the direction to check relationships for
* @return <code>true</code> if there are any relationships of any of the
* types in <code>types</code> attached to this node,
* <code>false</code> otherwise
*/
boolean hasRelationship( Direction direction, RelationshipType... types );
/**
* Returns all {@link Direction#OUTGOING OUTGOING} or
* {@link Direction#INCOMING INCOMING} relationships from this node. If
* there are no relationships with the given direction attached to this
* node, an empty iterable will be returned. If {@link Direction#BOTH BOTH}
* is passed in as a direction, relationships of both directions are
* returned (effectively turning this into <code>getRelationships()</code>).
*
* @param dir the given direction, where <code>Direction.OUTGOING</code>
* means all relationships that have this node as
* {@link Relationship#getStartNode() start node} and <code>
* Direction.INCOMING</code>
* means all relationships that have this node as
* {@link Relationship#getEndNode() end node}
* @return all relationships with the given direction that are attached to
* this node
*/
Iterable<Relationship> getRelationships( Direction dir );
/**
* Returns <code>true</code> if there are any relationships in the given
* direction attached to this node, <code>false</code> otherwise. If
* {@link Direction#BOTH BOTH} is passed in as a direction, relationships of
* both directions are matched (effectively turning this into
* <code>hasRelationships()</code>).
*
* @param dir the given direction, where <code>Direction.OUTGOING</code>
* means all relationships that have this node as
* {@link Relationship#getStartNode() start node} and <code>
* Direction.INCOMING</code>
* means all relationships that have this node as
* {@link Relationship#getEndNode() end node}
* @return <code>true</code> if there are any relationships in the given
* direction attached to this node, <code>false</code> otherwise
*/
boolean hasRelationship( Direction dir );
/**
* Returns all relationships with the given type and direction that are
* attached to this node. If there are no matching relationships, an empty
* iterable will be returned.
*
* @param type the given type
* @param dir the given direction, where <code>Direction.OUTGOING</code>
* means all relationships that have this node as
* {@link Relationship#getStartNode() start node} and <code>
* Direction.INCOMING</code>
* means all relationships that have this node as
* {@link Relationship#getEndNode() end node}
* @return all relationships attached to this node that match the given type
* and direction
*/
Iterable<Relationship> getRelationships( RelationshipType type, Direction dir );
/**
* Returns <code>true</code> if there are any relationships of the given
* relationship type and direction attached to this node, <code>false</code>
* otherwise.
*
* @param type the given type
* @param dir the given direction, where <code>Direction.OUTGOING</code>
* means all relationships that have this node as
* {@link Relationship#getStartNode() start node} and <code>
* Direction.INCOMING</code>
* means all relationships that have this node as
* {@link Relationship#getEndNode() end node}
* @return <code>true</code> if there are any relationships of the given
* relationship type and direction attached to this node,
* <code>false</code> otherwise
*/
boolean hasRelationship( RelationshipType type, Direction dir );
/**
* Returns the only relationship of a given type and direction that is
* attached to this node, or <code>null</code>. This is a convenience method
* that is used in the commonly occuring situation where a node has exactly
* zero or one relationships of a given type and direction to another node.
* Typically this invariant is maintained by the rest of the code: if at any
* time more than one such relationships exist, it is a fatal error that
* should generate an unchecked exception. This method reflects that
* semantics and returns either:
* <p>
* <ol>
* <li><code>null</code> if there are zero relationships of the given type
* and direction,</li>
* <li>the relationship if there's exactly one, or
* <li>throws an unchecked exception in all other cases.</li>
* </ol>
* <p>
* This method should be used only in situations with an invariant as
* described above. In those situations, a "state-checking" method (e.g.
* <code>hasSingleRelationship(...)</code>) is not required, because this
* method behaves correctly "out of the box."
*
* @param type the type of the wanted relationship
* @param dir the direction of the wanted relationship (where
* <code>Direction.OUTGOING</code> means a relationship that has
* this node as {@link Relationship#getStartNode() start node}
* and <code>
* Direction.INCOMING</code> means a relationship that has
* this node as {@link Relationship#getEndNode() end node}) or
* {@link Direction#BOTH} if direction is irrelevant
* @return the single relationship matching the given type and direction if
* exactly one such relationship exists, or <code>null</code> if
* exactly zero such relationships exists
* @throws RuntimeException if more than one relationship matches the given
* type and direction
*/
Relationship getSingleRelationship( RelationshipType type, Direction dir );
/**
* Creates a relationship between this node and another node. The
* relationship is of type <code>type</code>. It starts at this node and
* ends at <code>otherNode</code>.
* <p>
* A relationship is equally well traversed in both directions so there's no
* need to create another relationship in the opposite direction (in regards
* to traversal or performance).
*
* @param otherNode the end node of the new relationship
* @param type the type of the new relationship
* @return the newly created relationship
*/
Relationship createRelationshipTo( Node otherNode, RelationshipType type );
/**
* Instantiates a traverser that will start at this node and traverse
* according to the given order and evaluators along the specified
* relationship type and direction. If the traverser should traverse more
* than one <code>RelationshipType</code>/<code>Direction</code> pair, use
* one of the overloaded variants of this method. The created traverser will
* iterate over each node that can be reached from this node by the spanning
* tree formed by the given relationship types (with direction) exactly
* once. For more information about traversal, see the {@link Traverser}
* documentation.
*
*
* @param traversalOrder the traversal order
* @param stopEvaluator an evaluator instructing the new traverser about
* when to stop traversing, either a predefined evaluator such as
* {@link StopEvaluator#END_OF_GRAPH} or a custom-written
* evaluator
* @param returnableEvaluator an evaluator instructing the new traverser
* about whether a specific node should be returned from the
* traversal, either a predefined evaluator such as
* {@link ReturnableEvaluator#ALL} or a customer-written
* evaluator
* @param relationshipType the relationship type that the traverser will
* traverse along
* @param direction the direction in which the relationships of type
* <code>relationshipType</code> will be traversed
* @return a new traverser, configured as above
* @deprecated because of an unnatural and too tight coupling with
* {@link Node}. Also because of the introduction of a new
* traversal framework. The new way of doing traversals is by
* creating a new {@link TraversalDescription} from
* {@link Traversal#traversal()}, add rules and behaviors to it
* and then calling
* {@link TraversalDescription#traverse(Node...)}
*/
@Deprecated
Traverser traverse( Traverser.Order traversalOrder,
StopEvaluator stopEvaluator,
ReturnableEvaluator returnableEvaluator,
RelationshipType relationshipType, Direction direction );
/**
* Instantiates a traverser that will start at this node and traverse
* according to the given order and evaluators along the two specified
* relationship type and direction pairs. If the traverser should traverse
* more than two <code>RelationshipType</code>/<code>Direction</code> pairs,
* use the overloaded
* {@link #traverse(Traverser.Order, StopEvaluator, ReturnableEvaluator, Object...)
* varargs variant} of this method. The created traverser will iterate over
* each node that can be reached from this node by the spanning tree formed
* by the given relationship types (with direction) exactly once. For more
* information about traversal, see the {@link Traverser} documentation.
*
* @param traversalOrder the traversal order
* @param stopEvaluator an evaluator instructing the new traverser about
* when to stop traversing, either a predefined evaluator such as
* {@link StopEvaluator#END_OF_GRAPH} or a custom-written
* evaluator
* @param returnableEvaluator an evaluator instructing the new traverser
* about whether a specific node should be returned from the
* traversal, either a predefined evaluator such as
* {@link ReturnableEvaluator#ALL} or a customer-written
* evaluator
* @param firstRelationshipType the first of the two relationship types that
* the traverser will traverse along
* @param firstDirection the direction in which the first relationship type
* will be traversed
* @param secondRelationshipType the second of the two relationship types
* that the traverser will traverse along
* @param secondDirection the direction that the second relationship type
* will be traversed
* @return a new traverser, configured as above
* @deprecated because of an unnatural and too tight coupling with
* {@link Node}. Also because of the introduction of a new traversal
* framework. The new way of doing traversals is by creating a
* new {@link TraversalDescription} from
* {@link Traversal#traversal()}, add rules and
* behaviors to it and then calling
* {@link TraversalDescription#traverse(Node...)}
*/
@Deprecated
Traverser traverse( Traverser.Order traversalOrder,
StopEvaluator stopEvaluator,
ReturnableEvaluator returnableEvaluator,
RelationshipType firstRelationshipType, Direction firstDirection,
RelationshipType secondRelationshipType, Direction secondDirection );
/**
* Instantiates a traverser that will start at this node and traverse
* according to the given order and evaluators along the specified
* relationship type and direction pairs. Unlike the overloaded variants of
* this method, the relationship types and directions are passed in as a
* "varargs" variable-length argument which means that an arbitrary set of
* relationship type and direction pairs can be specified. The
* variable-length argument list should be every other relationship type and
* direction, starting with relationship type, e.g:
* <p>
* <code>node.traverse( BREADTH_FIRST, stopEval, returnableEval,
* MyRels.REL1, Direction.OUTGOING, MyRels.REL2, Direction.OUTGOING,
* MyRels.REL3, Direction.BOTH, MyRels.REL4, Direction.INCOMING );</code>
* <p>
* Unfortunately, the compiler cannot enforce this so an unchecked exception
* is raised if the variable-length argument has a different constitution.
* <p>
* The created traverser will iterate over each node that can be reached
* from this node by the spanning tree formed by the given relationship
* types (with direction) exactly once. For more information about
* traversal, see the {@link Traverser} documentation.
*
* @param traversalOrder the traversal order
* @param stopEvaluator an evaluator instructing the new traverser about
* when to stop traversing, either a predefined evaluator such as
* {@link StopEvaluator#END_OF_GRAPH} or a custom-written
* evaluator
* @param returnableEvaluator an evaluator instructing the new traverser
* about whether a specific node should be returned from the
* traversal, either a predefined evaluator such as
* {@link ReturnableEvaluator#ALL} or a customer-written
* evaluator
* @param relationshipTypesAndDirections a variable-length list of
* relationship types and their directions, where the first
* argument is a relationship type, the second argument the first
* type's direction, the third a relationship type, the fourth
* its direction, etc
* @return a new traverser, configured as above
* @throws RuntimeException if the variable-length relationship type /
* direction list is not as described above
* @deprecated because of an unnatural and too tight coupling with
* {@link Node}. Also because of the introduction of a new traversal
* framework. The new way of doing traversals is by creating a
* new {@link TraversalDescription} from
* {@link Traversal#traversal()}, add rules and
* behaviors to it and then calling
* {@link TraversalDescription#traverse(Node...)}
*/
@Deprecated
Traverser traverse( Traverser.Order traversalOrder,
StopEvaluator stopEvaluator,
ReturnableEvaluator returnableEvaluator,
Object... relationshipTypesAndDirections );
/**
* Adds a {@link Label} to this node. If this node doesn't already have
* this label it will be added. If it already has the label, nothing will happen.
*
* @param label the label to add to this node.
*/
void addLabel( Label label );
/**
* Removes a {@link Label} from this node. If this node doesn't have this label,
* nothing will happen.
*
* @param label the label to remove from this node.
*/
void removeLabel( Label label );
/**
* Checks whether or not this node has the given label.
*
* @param label the label to check for.
* @return {@code true} if this node has the given label, otherwise {@code false}.
*/
boolean hasLabel( Label label );
/**
* Lists all labels attached to this node. If this node has no
* labels an empty {@link Iterable} will be returned.
*
* @return all labels attached to this node.
*/
Iterable<Label> getLabels();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Node.java
|
6,125
|
public interface Path extends Iterable<PropertyContainer>
{
/**
* Returns the start node of this path. It's also the first node returned
* from the {@link #nodes()} iterable.
* @return the start node.
*/
Node startNode();
/**
* Returns the end node of this path. It's also the last node returned
* from {@link #nodes()} iterable. If the {@link #length()} of this path
* is 0 the end node returned by this method is the same as the start node.
*
* If a path is emitted from a traverser the end node is the current node
* where the traverser is at the moment.
*
* @return the end node.
*/
Node endNode();
/**
* Returns the last {@link Relationship} in this path.
*
* @return the last {@link Relationship} in this path, or <code>null</code>
* if this path contains no {@link Relationship}s.
*/
Relationship lastRelationship();
/**
* Returns all the relationships in between the nodes which this path
* consists of. For a path with {@link #length()} 0 this will be an
* empty {@link Iterable}.
* @return the relationships in this path.
*/
Iterable<Relationship> relationships();
/**
* Returns all the relationships in between the nodes which this path
* consists of in reverse order, i.e. starting from the {@link #lastRelationship()}
* going backwards towards the first relationship in the path.
* For a path with {@link #length()} 0 this will be an empty {@link Iterable}.
* @return the relationships in this path in reverse order.
*/
Iterable<Relationship> reverseRelationships();
/**
* Returns all the nodes in this path starting from the start node going
* forward towards the end node. The first node is the same as
* {@link #startNode()} and the last node is the same as {@link #endNode()}.
* In between those nodes there can be an arbitrary number of nodes. The
* shortest path possible is just one node, where also the the start node is
* the same as the end node.
*
* @return the nodes in this path.
*/
Iterable<Node> nodes();
/**
* Returns all the nodes in this path in reversed order, i.e. starting from the
* end node going backwards instead of from the start node going forwards.
* The first node is the same as {@link #endNode()} and the last node is the
* same as {@link #startNode()}. In between those nodes there can be an arbitrary
* number of nodes. The shortest path possible is just one node, where also the
* the start node is the same as the end node.
*
* @return the nodes in this path starting from the end node going backwards
* towards the start node.
*/
Iterable<Node> reverseNodes();
/**
* Returns the length of this path. That is the number of relationships
* (which is the same as the number of nodes minus one). The shortest path
* possible is of length 0.
*
* @return the length (i.e. the number of relationships) in the path.
*/
int length();
/**
* Returns a natural string representation of this path.
*
* The string representation shows the nodes with relationships
* (and their directions) in between them.
*
* @return A string representation of the path.
*/
@Override
String toString();
/**
* Iterates through both the {@link Node}s and {@link Relationship}s of this
* path in order. Interleaving {@link Node}s with {@link Relationship}s,
* starting and ending with a {@link Node} (the {@link #startNode()} and
* {@link #endNode()} respectively).
*
* @see Iterable#iterator()
*/
Iterator<PropertyContainer> iterator();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Path.java
|
6,126
|
public interface PathExpander<STATE>
{
/**
* Returns relationships for a {@link Path}, most commonly from the
* {@link Path#endNode()}.
*
* @param path the path to expand (most commonly the end node).
* @param state the state of this branch in the current traversal.
* {@link BranchState#getState()} returns the state and
* {@link BranchState#setState(Object)} optionally sets the state for
* the children of this branch. If state isn't altered the children
* of this path will see the state of the parent.
* @return the relationships to return for the {@code path}.
*/
Iterable<Relationship> expand( Path path, BranchState<STATE> state );
/**
* Returns a new instance with the exact expansion logic, but reversed.
* TODO example
* @return a reversed {@link PathExpander}.
*/
PathExpander<STATE> reverse();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_PathExpander.java
|
6,127
|
public interface PropertyContainer
{
/**
* Get the {@link GraphDatabaseService} that this {@link Node} or
* {@link Relationship} belongs to.
*
* @return The GraphDatabase this Node or Relationship belongs to.
*/
GraphDatabaseService getGraphDatabase();
/**
* Returns <code>true</code> if this property container has a property
* accessible through the given key, <code>false</code> otherwise. If key is
* <code>null</code>, this method returns <code>false</code>.
*
* @param key the property key
* @return <code>true</code> if this property container has a property
* accessible through the given key, <code>false</code> otherwise
*/
boolean hasProperty( String key );
/**
* Returns the property value associated with the given key. The value is of
* one of the valid property types, i.e. a Java primitive, a {@link String
* String} or an array of any of the valid types.
* <p>
* If there's no property associated with <code>key</code> an unchecked
* exception is raised. The idiomatic way to avoid an exception for an
* unknown key and instead get <code>null</code> back is to use a default
* value: {@link #getProperty(String, Object) Object valueOrNull =
* nodeOrRel.getProperty( key, null )}
*
* @param key the property key
* @return the property value associated with the given key
* @throws NotFoundException if there's no property associated with
* <code>key</code>
*/
Object getProperty( String key );
/**
* Returns the property value associated with the given key, or a default
* value. The value is of one of the valid property types, i.e. a Java
* primitive, a {@link String String} or an array of any of the valid types.
*
* @param key the property key
* @param defaultValue the default value that will be returned if no
* property value was associated with the given key
* @return the property value associated with the given key
*/
Object getProperty( String key, Object defaultValue );
/**
* Sets the property value for the given key to <code>value</code>. The
* property value must be one of the valid property types, i.e:
* <ul>
* <li><code>boolean</code> or <code>boolean[]</code></li>
* <li><code>byte</code> or <code>byte[]</code></li>
* <li><code>short</code> or <code>short[]</code></li>
* <li><code>int</code> or <code>int[]</code></li>
* <li><code>long</code> or <code>long[]</code></li>
* <li><code>float</code> or <code>float[]</code></li>
* <li><code>double</code> or <code>double[]</code></li>
* <li><code>char</code> or <code>char[]</code></li>
* <li><code>java.lang.String</code> or <code>String[]</code></li>
* </ul>
* <p>
* This means that <code>null</code> is not an accepted property value.
*
* @param key the key with which the new property value will be associated
* @param value the new property value, of one of the valid property types
* @throws IllegalArgumentException if <code>value</code> is of an
* unsupported type (including <code>null</code>)
*/
void setProperty( String key, Object value );
/**
* Removes the property associated with the given key and returns the old
* value. If there's no property associated with the key, <code>null</code>
* will be returned.
*
* @param key the property key
* @return the property value that used to be associated with the given key
*/
Object removeProperty( String key );
/**
* Returns all existing property keys, or an empty iterable if this property
* container has no properties.
*
* @return all property keys on this property container
*/
// TODO: figure out concurrency semantics
Iterable<String> getPropertyKeys();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_PropertyContainer.java
|
6,128
|
public interface Relationship extends PropertyContainer
{
/**
* Returns the unique id of this relationship. Ids are garbage collected
* over time so they are only guaranteed to be unique during a specific time
* span: if the relationship is deleted, it's likely that a new relationship
* at some point will get the old id. This makes relationship ids brittle as
* public APIs.
*
* @return the id of this node
*/
long getId();
/**
* Deletes this relationship. Invoking any methods on this relationship
* after <code>delete()</code> has returned is invalid and will lead to
* unspecified behavior.
*/
void delete();
// Node accessors
/**
* Returns the start node of this relationship. For a definition of how
* start node relates to {@link Direction directions} as arguments to the
* {@link Node#getRelationships() relationship accessors} in Node, see the
* class documentation of Relationship.
*
* @return the start node of this relationship
*/
Node getStartNode();
/**
* Returns the end node of this relationship. For a definition of how end
* node relates to {@link Direction directions} as arguments to the
* {@link Node#getRelationships() relationship accessors} in Node, see the
* class documentation of Relationship.
*
* @return the end node of this relationship
*/
Node getEndNode();
/**
* A convenience operation that, given a node that is attached to this
* relationship, returns the other node. For example if <code>node</code> is
* a start node, the end node will be returned, and vice versa. This is a
* very convenient operation when you're manually traversing the graph
* by invoking one of the {@link Node#getRelationships() getRelationships()}
* operations on a node. For example, to get the node "at the other end" of
* a relationship, use the following:
* <p>
* <code>
* Node endNode = node.getSingleRelationship( MyRels.REL_TYPE ).getOtherNode( node );
* </code>
* <p>
* This operation will throw a runtime exception if <code>node</code> is
* neither this relationship's start node nor its end node.
*
* @param node the start or end node of this relationship
* @return the other node
* @throws RuntimeException if the given node is neither the start nor end
* node of this relationship
*/
Node getOtherNode( Node node );
/**
* Returns the two nodes that are attached to this relationship. The first
* element in the array will be the start node, the second element the end
* node.
*
* @return the two nodes that are attached to this relationship
*/
Node[] getNodes();
/**
* Returns the type of this relationship. A relationship's type is an
* immutable attribute that is specified at Relationship
* {@link Node#createRelationshipTo creation}. Remember that relationship
* types are semantically equivalent if their
* {@link RelationshipType#name() names} are {@link Object#equals(Object)
* equal}. This is NOT the same as checking for identity equality using the
* == operator. If you want to know whether this relationship is of a
* certain type, use the {@link #isType(RelationshipType) isType()}
* operation.
*
* @return the type of this relationship
*/
RelationshipType getType();
/**
* Indicates whether this relationship is of the type <code>type</code>.
* This is a convenience method that checks for equality using the contract
* specified by RelationshipType, i.e. by checking for equal
* {@link RelationshipType#name() names}.
*
* @param type the type to check
* @return <code>true</code> if this relationship is of the type
* <code>type</code>, <code>false</code> otherwise or if
* <code>null</code>
*/
boolean isType( RelationshipType type );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Relationship.java
|
6,129
|
public interface RelationshipExpander
{
/**
* Returns relationships for a {@link Node}.
*
* @param node the node to expand.
* @return the relationships to return for the {@code node}.
*/
Iterable<Relationship> expand( Node node );
/**
* Returns a new instance with the exact expansion logic, but reversed.
* For example if this expander is set to expand:
* <ul>
* <li>KNOWS : OUTGOING</li>
* <li>LIVES : INCOMING</li>
* </ul>
* Then the reversed expander will be set to expand:
* <ul>
* <li>KNOWS : INCOMING</li>
* <li>LIVES : OUTGOING</li>
* </ul>
*
* @return a reversed {@link RelationshipExpander}.
*/
RelationshipExpander reversed();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_RelationshipExpander.java
|
6,130
|
public interface RelationshipType
{
/**
* Returns the name of the relationship type. The name uniquely identifies a
* relationship type, i.e. two different RelationshipType instances with
* different object identifiers (and possibly even different classes) are
* semantically equivalent if they have {@link String#equals(Object) equal}
* names.
*
* @return the name of the relationship type
*/
String name();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_RelationshipType.java
|
6,131
|
public interface Resource extends AutoCloseable
{
@Override
public void close();
/**
* Empty resource that doesn't {@link #close() close} anything.
*/
public static final Resource EMPTY = new Resource()
{
@Override
public void close()
{ // Nothing to close
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Resource.java
|
6,132
|
public interface ResourceIterable<T> extends Iterable<T>
{
/**
* Returns an {@link ResourceIterator iterator} with associated resources that may be managed.
*/
@Override
ResourceIterator<T> iterator();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_ResourceIterable.java
|
6,133
|
public interface ResourceIterator<T> extends Iterator<T>, Resource
{
/**
* Close the iterator early, freeing associated resources
*
* It is an error to use the iterator after this has been called.
*/
@Override
void close();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_ResourceIterator.java
|
6,134
|
public interface ReturnableEvaluator
{
/**
* A returnable evaluator that returns all nodes encountered.
*/
ReturnableEvaluator ALL = new ReturnableEvaluator()
{
public boolean isReturnableNode( final TraversalPosition currentPosition )
{
return true;
}
};
/**
* A returnable evaluator that returns all nodes except the start node.
*/
ReturnableEvaluator ALL_BUT_START_NODE = new ReturnableEvaluator()
{
public boolean isReturnableNode( final TraversalPosition currentPosition )
{
return currentPosition.notStartNode();
}
};
/**
* Method invoked by traverser to see if the current position is a
* returnable node.
*
* @param currentPos the traversal position
* @return True if current position is a returnable node
*/
boolean isReturnableNode( TraversalPosition currentPos );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_ReturnableEvaluator.java
|
6,135
|
private enum Labels implements Label
{
MY_LABEL,
MY_OTHER_LABEL
}
| false
|
community_kernel_src_test_java_org_neo4j_graphdb_SchemaAcceptanceTest.java
|
6,136
|
public interface StopEvaluator
{
/**
* Traverse until the end of the graph. This evaluator returns
* <code>false</code> all the time.
*/
StopEvaluator END_OF_GRAPH = new StopEvaluator()
{
public boolean isStopNode( final TraversalPosition currentPosition )
{
return false;
}
};
/**
* Traverses to depth 1.
*/
StopEvaluator DEPTH_ONE = new StopEvaluator()
{
public boolean isStopNode( final TraversalPosition currentPosition )
{
return currentPosition.depth() >= 1;
}
};
/**
* Method invoked by traverser to see if current position is a stop node.
*
* @param currentPos the traversal position
* @return True if current position is a stop node
*/
boolean isStopNode( TraversalPosition currentPos );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_StopEvaluator.java
|
6,137
|
public interface Transaction extends AutoCloseable
{
/**
* Marks this transaction as failed, which means that it will
* unconditionally be rolled back when {@link #close()} is called. Once
* this method has been invoked, it doesn't matter if
* {@link #success()} is invoked afterwards -- the transaction will still be
* rolled back.
*/
void failure();
/**
* Marks this transaction as successful, which means that it will be
* committed upon invocation of {@link #close()} unless {@link #failure()}
* has or will be invoked before then.
*/
void success();
/**
* Commits or marks this transaction for rollback, depending on whether
* {@link #success()} or {@link #failure()} has been previously invoked.
*
* All {@link ResourceIterable ResourceIterables} that where returned from operations executed inside this
* transaction will be automatically closed by this method.
*
* Preferably this method will not be used, instead a {@link Transaction} should participate in a
* try-with-resource statement so that {@link #close()} is automatically called instead.
*
* Invoking {@link #close()} (which is unnecessary when in try-with-resource statement) or this method
* has the exact same effect.
*
* @deprecated due to implementing {@link AutoCloseable}, where {@link #close()} is called automatically
* when used in try-with-resource statements.
*/
@Deprecated
void finish();
/**
* Commits or marks this transaction for rollback, depending on whether
* {@link #success()} or {@link #failure()} has been previously invoked.
*
* All {@link ResourceIterable ResourceIterables} that where returned from operations executed inside this
* transaction will be automatically closed by this method.
*
* This method comes from {@link AutoCloseable} so that a {@link Transaction} can participate
* in try-with-resource statements. It will not throw any declared exception.
*
* Invoking this method (which is unnecessary when in try-with-resource statement) or {@link #finish()}
* has the exact same effect.
*/
@Override
void close();
/**
* Acquires a write lock for {@code entity} for this transaction.
* The lock (returned from this method) can be released manually, but
* if not it's released automatically when the transaction finishes.
* @param entity the entity to acquire a lock for. If another transaction
* currently holds a write lock to that entity this call will wait until
* it's released.
*
* @return a {@link Lock} which optionally can be used to release this
* lock earlier than when the transaction finishes. If not released
* (with {@link Lock#release()} it's going to be released with the
* transaction finishes.
*/
Lock acquireWriteLock( PropertyContainer entity );
/**
* Acquires a read lock for {@code entity} for this transaction.
* The lock (returned from this method) can be released manually, but
* if not it's released automatically when the transaction finishes.
* @param entity the entity to acquire a lock for. If another transaction
* currently hold a write lock to that entity this call will wait until
* it's released.
*
* @return a {@link Lock} which optionally can be used to release this
* lock earlier than when the transaction finishes. If not released
* (with {@link Lock#release()} it's going to be released with the
* transaction finishes.
*/
Lock acquireReadLock( PropertyContainer entity );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Transaction.java
|
6,138
|
public interface TraversalPosition
{
/**
* Returns the current node.
*
* @return The current node
*/
Node currentNode();
/**
* Returns the previous node.
*
* If this TraversalPosition represents the start node <code>null</code> is
* returned.
*
* @return The previous node, or <code>null</code>
*/
Node previousNode();
/**
* Return the last relationship traversed.
*
* If this TraversalPosition represents the start node <code>null</code> is
* returned.
*
* @return The last relationship traversed, or <code>null</code>.
*/
Relationship lastRelationshipTraversed();
/**
* Returns the current traversal depth.
*
* The traversal depth is the length of the path taken to reach the current
* traversal position. This is not necessarily the length of shortest path
* from the start node to the node at the current position. When traversing
* {@link Traverser.Order#BREADTH_FIRST breadth first} the depth is the
* length of the shortest path from the start node to the node at the
* current position, but when traversing {@link Traverser.Order#DEPTH_FIRST
* depth first} there might exist shorter paths from the start node to the
* node at this position.
*
* @return The current traversal depth
*/
int depth();
/**
* Returns the number of nodes returned by the traverser so far.
*
* @return The number of returned nodes.
*/
int returnedNodesCount();
/**
* Returns <code>true</code> if the current position is anywhere except on
* the start node, <code>false</code> if it is on the start node. This is
* useful because code in {@link StopEvaluator the}
* {@link ReturnableEvaluator evaluators} usually have to treat the edge
* case of the start node separately and using this method makes that code a
* lot cleaner. This allows for much cleaner code where <code>null</code>
* checks can be avoided for return values from
* {@link #lastRelationshipTraversed()} and {@link #previousNode()}, such as
* in this example:
*
* <pre>
* <code>
* public boolean {@link StopEvaluator#isStopNode(TraversalPosition) isStopNode}( TraversalPosition currentPos )
* {
* // Stop at nodes reached through a SOME_RELATIONSHIP.
* return currentPos.notStartNode()
* && currentPos.{@link #lastRelationshipTraversed() lastRelationshipTraversed}().{@link Relationship#isType(RelationshipType) isType}(
* {@link RelationshipType MyRelationshipTypes.SOME_RELATIONSHIP} );
* }
* </code>
* </pre>
*
* @return <code>true</code> if the this TraversalPosition is not at the
* start node, <code>false</code> if it is.
*/
boolean notStartNode();
/**
* Returns <code>true</code> if the current position is the start node,
* <code>false</code> otherwise. This is useful because code in
* {@link StopEvaluator the} {@link ReturnableEvaluator evaluators} usually
* have to treat the edge case of the start node separately and using this
* method makes that code a lot cleaner. This allows for much cleaner code
* where <code>null</code> checks can be avoided for return values from
* {@link #lastRelationshipTraversed()} and {@link #previousNode()}, such as
* in this example:
*
* <pre>
* <code>
* public boolean {@link ReturnableEvaluator#isReturnableNode(TraversalPosition) isReturnableNode}( TraversalPosition currentPos )
* {
* // The start node, and nodes reached through SOME_RELATIONSHIP
* // are returnable.
* return currentPos.isStartNode()
* || currentPos.{@link #lastRelationshipTraversed() lastRelationshipTraversed}().{@link Relationship#isType(RelationshipType) isType}(
* {@link RelationshipType MyRelationshipTypes.SOME_RELATIONSHIP} );
* }
* </code>
* </pre>
*
* @return <code>true</code> if the this TraversalPosition is at the start
* node, <code>false</code> if it is not.
*/
boolean isStartNode();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_TraversalPosition.java
|
6,139
|
public interface Traverser extends Iterable<Node>
{
/**
* Defines a traversal order as used by the traversal framework.
* <p>
* Nodes can be traversed either {@link #BREADTH_FIRST breadth first} or
* {@link #DEPTH_FIRST depth first}. A depth first traversal is often more
* likely to find one matching node before a breadth first traversal. A
* breadth first traversal will always find the closest matching nodes
* first, which means that {@link TraversalPosition#depth()} will return the
* length of the shortest path from the start node to the node at that
* position, which is not guaranteed for depth first traversals.
* <p>
* A breadth first traversal usually needs to store more state about where
* the traversal should go next than a depth first traversal does. Depth
* first traversals are thus more memory efficient.
*/
static enum Order
{
/**
* Sets a depth first traversal meaning the traverser will go as deep as
* possible (increasing depth for each traversal) before traversing next
* relationship on same depth.
*/
DEPTH_FIRST,
/**
* Sets a breadth first traversal meaning the traverser will traverse
* all relationships on the current depth before going deeper.
*/
BREADTH_FIRST
}
/**
* Returns the current traversal position, that is where the traversal is at
* the moment. It contains information such as which node we're at, which
* the last traversed relationship was (if any) and at which depth the
* current position is (relative to the starting node). You can use it in
* your traverser for-loop like this:
*
* <pre>
* <code>
* Traverser traverser = node.{@link Node#traverse traverse}( ... );
* for ( {@link Node Node} node : traverser )
* {
* {@link TraversalPosition TraversalPosition} currentPosition = traverser.currentPosition();
* // Get "current position" information right here.
* }
* </code>
* </pre>
*
* @return The current traversal position
*/
TraversalPosition currentPosition();
/**
* Returns a collection of all nodes for this traversal. It traverses
* through the graph (according to given filters and evaluators) and
* collects those encountered nodes along the way. When this method has
* returned, this traverser will be at the end of its traversal, such that a
* call to {@code hasNext()} for the {@link #iterator()} will return {@code
* false}.
*
* @return A collection of all nodes for this this traversal.
*/
Collection<Node> getAllNodes();
// Doc: especially remove() thing
/**
* Returns an {@link Iterator} representing the traversal of the graph. The
* iteration is completely lazy in that it will only traverse one step (to
* the next "hit") for every call to {@code hasNext()}/{@code next()}.
*
* Consecutive calls to this method will return the same instance.
*
* @return An iterator for this traverser
*/
// TODO completely resolve issues regarding this (Iterable/Iterator ...)
// Doc: does it create a new iterator or reuse the existing one? This is
// very important! It must be re-use, how else would currentPosition()
// make sense?
Iterator<Node> iterator();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Traverser.java
|
6,140
|
static enum Order
{
/**
* Sets a depth first traversal meaning the traverser will go as deep as
* possible (increasing depth for each traversal) before traversing next
* relationship on same depth.
*/
DEPTH_FIRST,
/**
* Sets a breadth first traversal meaning the traverser will traverse
* all relationships on the current depth before going deeper.
*/
BREADTH_FIRST
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_Traverser.java
|
6,141
|
public interface Setting<T>
extends Function<Function<String, String>, T>
{
/**
* Get the name of the setting. This typically corresponds to a key in a properties file, or similar.
*
* @return the name
*/
String name();
/**
* Get the default value of this setting, as a string.
*
* @return the default value
*/
String getDefaultValue();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_config_Setting.java
|
6,142
|
public enum ErrorState
{
/**
* The Graph Database failed since the storage media where the graph
* database data is stored is full and cannot be written to.
*/
STORAGE_MEDIA_FULL,
/**
* Not more transactions can be started or committed during this session
* and the database needs to be shut down, possible for maintenance before
* it can be started again.
*/
TX_MANAGER_NOT_OK,
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_event_ErrorState.java
|
6,143
|
public interface KernelEventHandler
{
/**
* This method is invoked during the shutdown process of a Neo4j Graph
* Database. It is invoked while the {@link GraphDatabaseService} is still
* in an operating state, after the processing of this event has terminated
* the Neo4j Graph Database will terminate. This event can be used to shut
* down other services that depend on the {@link GraphDatabaseService}.
*/
void beforeShutdown();
/**
* This is invoked when the Neo4j Graph Database enters a state from which
* it cannot continue.
*
* @param error an object describing the state that the
* {@link GraphDatabaseService} failed to recover from.
*/
void kernelPanic( ErrorState error );
/**
* Returns the resource associated with this event handler, or {@code null}
* if no specific resource is associated with this handler or if it isn't
* desirable to expose it. It can be used to aid in the decision process
* of in which order to execute the handlers, see
* {@link #orderComparedTo(KernelEventHandler)}.
*
* @return the resource associated to this event handler, or {@code null}.
*/
Object getResource();
/**
* Gives a hint about when to execute this event handler, compared to other
* handlers. If this handler must be executed before {@code other} then
* {@link ExecutionOrder#BEFORE} should be returned. If this handler must be
* executed after {@code other} then {@link ExecutionOrder#AFTER} should be
* returned. If it doesn't matter {@link ExecutionOrder#DOESNT_MATTER}
* should be returned.
*
* @param other the other event handler to compare to.
* @return the execution order compared to {@code other}.
*/
ExecutionOrder orderComparedTo( KernelEventHandler other );
/**
* Represents the order of execution between two event handlers, if one
* handler should be executed {@link ExecutionOrder#BEFORE},
* {@link ExecutionOrder#AFTER} another handler, or if it
* {@link ExecutionOrder#DOESNT_MATTER}.
*
* @author mattias
*
*/
enum ExecutionOrder
{
/**
* Says that the event handler must be executed before the compared
* event handler.
*/
BEFORE,
/**
* Says that the event handler must be executed after the compared
* event handler.
*/
AFTER,
/**
* Says that it doesn't matter in which order the event handler is
* executed in comparison to another event handler.
*/
DOESNT_MATTER
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_event_KernelEventHandler.java
|
6,144
|
enum ExecutionOrder
{
/**
* Says that the event handler must be executed before the compared
* event handler.
*/
BEFORE,
/**
* Says that the event handler must be executed after the compared
* event handler.
*/
AFTER,
/**
* Says that it doesn't matter in which order the event handler is
* executed in comparison to another event handler.
*/
DOESNT_MATTER
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_event_KernelEventHandler.java
|
6,145
|
public interface PropertyEntry<T extends PropertyContainer>
{
/**
* Get the entity that this property was modified on. The entity is either a
* {@link Node} or a {@link Relationship}, depending on the generic type of
* this instance.
*
* @return the {@link Node} or {@link Relationship} that the property was
* modified on.
*/
T entity();
/**
* Get the key of the modified property.
*
* @return the key of the modified property.
*/
String key();
/**
* Get the value of the modified property as it was before the transaction
* (which modified it) started. If this {@link PropertyEntry} was returned
* from {@link TransactionData#assignedNodeProperties()} or
* {@link TransactionData#assignedRelationshipProperties()}, the value
* returned from this method is the value that was set for {@code key} on
* {@code entity} before the transaction started, or {@code null} if such a
* property wasn't set.
*
* If this {@link PropertyEntry} was returned from
* {@link TransactionData#removedNodeProperties()} or
* {@link TransactionData#removedRelationshipProperties()} the value
* returned from this method is the value that was stored at this property
* before the transaction started.
*
* @return The value of the property as it was before the transaction
* started.
*/
Object previouslyCommitedValue();
/**
* Get the value of the modified property. If this {@link PropertyEntry}
* was returned from {@link TransactionData#assignedNodeProperties()} or
* {@link TransactionData#assignedRelationshipProperties()}, the value
* returned from this method is the value that will be assigned to the
* property after the transaction is committed. If this
* {@link PropertyEntry} was returned from
* {@link TransactionData#removedNodeProperties()} or
* {@link TransactionData#removedRelationshipProperties()} an
* {@link IllegalStateException} will be thrown.
*
* @return The value of the modified property.
* @throws IllegalStateException if this method is called where this
* instance represents a removed property.
*/
Object value();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_event_PropertyEntry.java
|
6,146
|
public interface TransactionData
{
/**
* Get the nodes that were created during the transaction.
*
* @return all nodes that were created during the transaction.
*/
Iterable<Node> createdNodes();
/**
* Get the nodes that were deleted during the transaction.
*
* @return all nodes that were deleted during the transaction.
*/
Iterable<Node> deletedNodes();
/**
* Returns whether or not {@code node} is deleted in this transaction.
* @param node the {@link Node} to check whether or not it is deleted
* in this transaction.
* @return whether or not {@code node} is deleted in this transaction.
*/
boolean isDeleted( Node node );
/**
* Get the properties that had a value assigned or overwritten on a node
* during the transaction. All the properties of nodes created
* during the transaction will be returned by this method as well. Only the
* values that are present at the end of the transaction will be returned,
* whereas all previously assigned values of properties that have been
* assigned multiple times during the transaction will not be returned.
*
* @return all properties that have been assigned on nodes.
*/
Iterable<PropertyEntry<Node>> assignedNodeProperties();
/**
* Get the properties that had a value removed from a node during the
* transaction. Values are considered to be removed if the value is
* overwritten by calling {@link Node#setProperty(String, Object)} with a
* property that has a previous value, or if the property is explicitly
* removed by calling {@link Node#removeProperty(String)}. Only the values
* that were present before the transaction are returned by this method, all
* previous values of properties that have been assigned multiple times
* during the transaction will not be returned. This is also true for
* properties that had no value before the transaction, was assigned during
* the transaction, and then removed during the same transaction. Deleting
* a node will cause all its currently assigned properties to be added to
* this list as well.
*
* @return all properties that have been removed from nodes.
*/
Iterable<PropertyEntry<Node>> removedNodeProperties();
/**
* Get the relationships that were created during the transaction.
*
* @return all relationships that were created during the transaction.
*/
Iterable<Relationship> createdRelationships();
/**
* Get the relationships that were deleted during the transaction.
*
* @return all relationships that were deleted during the transaction.
*/
Iterable<Relationship> deletedRelationships();
/**
* Returns whether or not {@code relationship} is deleted in this
* transaction.
*
* @param relationship the {@link Relationship} to check whether or not it
* is deleted in this transaction.
* @return whether or not {@code relationship} is deleted in this
* transaction.
*/
boolean isDeleted( Relationship relationship );
/**
* Get the properties that had a value assigned on a relationship during the
* transaction. If the property had a value on that relationship before the
* transaction started the previous value will be returned by
* {@link #removedRelationshipProperties()}. All the properties of
* relationships created during the transaction will be returned by this
* method as well. Only the values that are present at the end of the
* transaction will be returned by this method, all previously assigned
* values of properties that have been assigned multiple times during the
* transaction will not be returned.
*
* @return all properties that have been assigned on relationships.
*/
Iterable<PropertyEntry<Relationship>> assignedRelationshipProperties();
/**
* Get the properties that had a value removed from a relationship during
* the transaction. Values are considered to be removed if the value is
* overwritten by calling {@link Relationship#setProperty(String, Object)}
* with a property that has a previous value, or if the property is
* explicitly removed by calling {@link Relationship#removeProperty(String)}
* . Only the values that were present before the transaction are returned
* by this method, all previous values of properties that have been assigned
* multiple times during the transaction will not be returned. This is also
* true for properties that had no value before the transaction, was
* assigned during the transaction, and then removed during the same
* transaction. Deleting a relationship will cause all its currently
* assigned properties to be added to this list as well.
*
* @return all properties that have been removed from relationships.
*/
Iterable<PropertyEntry<Relationship>> removedRelationshipProperties();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_event_TransactionData.java
|
6,147
|
public interface TransactionEventHandler<T>
{
/**
* Invoked when a transaction is about to be committed.
*
* If this method throws an exception the transaction will be rolled back
* and a {@link TransactionFailureException} will be thrown from
* {@link Transaction#close()}.
*
* The transaction is still open when this method is invoked, making it
* possible to perform mutating operations in this method. This is however
* highly discouraged. Changes made in this method are not guaranteed to be
* visible by this or other {@link TransactionEventHandler}s.
*
* @param data the changes that will be committed in this transaction.
* @return a state object (or <code>null</code>) that will be passed on to
* {@link #afterCommit(TransactionData, Object)} or
* {@link #afterRollback(TransactionData, Object)} of this object.
* @throws Exception to indicate that the transaction should be rolled back.
*/
T beforeCommit( TransactionData data ) throws Exception;
/**
* Invoked after the transaction has been committed successfully.
*
* @param data the changes that were committed in this transaction.
* @param state the object returned by
* {@link #beforeCommit(TransactionData)}.
*/
void afterCommit( TransactionData data, T state );
/**
* Invoked after the transaction has been rolled back if committing the
* transaction failed for some reason.
*
* @param data the changes that were committed in this transaction.
* @param state the object returned by
* {@link #beforeCommit(TransactionData)}.
*/
// TODO: should this method take a parameter describing WHY the tx failed?
void afterRollback( TransactionData data, T state );
/**
* Adapter for a {@link TransactionEventHandler}
*
* @param <T> the type of object communicated from a successful
* {@link #beforeCommit(TransactionData)} to {@link #afterCommit(TransactionData, Object)}.
*/
class Adapter<T> implements TransactionEventHandler<T>
{
@Override
public T beforeCommit( TransactionData data ) throws Exception
{
return null;
}
@Override
public void afterCommit( TransactionData data, T state )
{
}
@Override
public void afterRollback( TransactionData data, T state )
{
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_event_TransactionEventHandler.java
|
6,148
|
@Retention( RetentionPolicy.RUNTIME )
@Target( {ElementType.TYPE, ElementType.FIELD} )
public @interface Description
{
String value();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_factory_Description.java
|
6,149
|
public interface DatabaseCreator
{
GraphDatabaseService newDatabase( Map<String, String> config );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_factory_GraphDatabaseBuilder.java
|
6,150
|
public interface AutoIndexer<T extends PropertyContainer>
{
/**
* Sets the AutoIndexer as enabled or not. Enabled means that appropriately
* configured properties are auto indexed and hits can be returned, disabled
* means that no index additions happen but the index can be queried.
*
* @param enabled True to enable this auto indexer, false to disable it.
*/
void setEnabled( boolean enabled );
/**
* Returns true iff this auto indexer is enabled, false otherwise. For a
* cursory definition of enabled indexer, look at
* <code>setAutoIndexingEnabled(boolean)</code>
*
* @return true iff this auto indexer is enabled
*
* @see #setEnabled(boolean)
*/
boolean isEnabled();
/**
* Returns the auto index used by the auto indexer. This should be able
* to be released safely (read only) to the outside world.
*
* @return A read only index
*/
ReadableIndex<T> getAutoIndex();
/**
* Start auto indexing a property. This could lead to an
* IllegalStateException in case there are already ignored properties.
* Adding an already auto indexed property is a no-op.
*
* @param propName The property name to start auto indexing.
*/
void startAutoIndexingProperty( String propName );
/**
* Removes the argument from the set of auto indexed properties. If
* the property was not already monitored, nothing happens
*
* @param propName The property name to stop auto indexing.
*/
void stopAutoIndexingProperty( String propName );
/**
* Returns the set of property names that are currently monitored for auto
* indexing. If this auto indexer is set to ignore properties, the result
* is the empty set.
*
* @return An immutable set of the auto indexed property names, possibly
* empty.
*/
Set<String> getAutoIndexedProperties();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_AutoIndexer.java
|
6,151
|
public interface Index<T extends PropertyContainer> extends ReadableIndex<T>
{
/**
* Adds a key/value pair for {@code entity} to the index. If that key/value
* pair for the entity is already in the index it's up to the
* implementation to make it so that such an operation is idempotent.
*
* @param entity the entity (i.e {@link Node} or {@link Relationship})
* to associate the key/value pair with.
* @param key the key in the key/value pair to associate with the entity.
* @param value the value in the key/value pair to associate with the
* entity.
*/
void add( T entity, String key, Object value );
/**
* Removes a key/value pair for {@code entity} from the index. If that
* key/value pair isn't associated with {@code entity} in this index this
* operation doesn't do anything.
*
* @param entity the entity (i.e {@link Node} or {@link Relationship})
* to dissociate the key/value pair from.
* @param key the key in the key/value pair to dissociate from the entity.
* @param value the value in the key/value pair to dissociate from the
* entity.
*/
void remove( T entity, String key, Object value );
/**
* Removes key/value pairs for {@code entity} where key is {@code key}
* from the index.
*
* Implementations can choose to not implement this method and should
* in that case throw {@link UnsupportedOperationException}.
*
* @param entity the entity ({@link Node} or {@link Relationship}) to
* remove the this index.
*/
void remove( T entity, String key );
/**
* Removes an entity from the index and all its key/value pairs which
* has been previously associated using
* {@link #add(PropertyContainer, String, Object)}.
*
* Implementations can choose to not implement this method and should
* in that case throw {@link UnsupportedOperationException}.
*
* @param entity the entity ({@link Node} or {@link Relationship}) to
* remove the this index.
*/
void remove( T entity );
/**
* Clears the index and deletes the configuration associated with it. After
* this it's invalid to call any other method on this index. However if the
* transaction which the delete operation was called in gets rolled back
* it again becomes ok to use this index.
*/
void delete();
/**
* Add the entity to this index for the given key/value pair if this particular
* key/value pair doesn't already exist.
*
* This ensures that only one entity will be associated with the key/value pair
* even if multiple transactions are trying to add it at the same time. One of those
* transactions will win and add it while the others will block, waiting for the
* winning transaction to finish. If the winning transaction was successful these
* other transactions will return the associated entity instead of adding it.
* If it wasn't successful the waiting transactions will begin a new race to add it.
*
* @param entity the entity (i.e {@link Node} or {@link Relationship})
* to associate the key/value pair with.
* @param key the key in the key/value pair to associate with the entity.
* @param value the value in the key/value pair to associate with the
* entity.
* @return the previously indexed entity, or {@code null} if no entity was
* indexed before (and the specified entity was added to the index).
*/
T putIfAbsent( T entity, String key, Object value );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_Index.java
|
6,152
|
public interface IndexHits<T> extends ResourceIterator<T>, ResourceIterable<T>
{
/**
* Returns the size of this iterable, in most scenarios this value is accurate
* while in some scenarios near-accurate.
*
* There's no cost in calling this method. It's considered near-accurate if this
* {@link IndexHits} object has been returned when inside a {@link Transaction}
* which has index modifications, of a certain nature. Also entities
* ({@link Node}s/{@link Relationship}s) which have been deleted from the graph,
* but are still in the index will also affect the accuracy of the returned size.
*
* @return the near-accurate size if this iterable.
*/
int size();
/**
* Closes the underlying search result. This method should be called
* whenever you've got what you wanted from the result and won't use it
* anymore. It's necessary to call it so that underlying indexes can dispose
* of allocated resources for this search result.
*
* You can however skip to call this method if you loop through the whole
* result, then close() will be called automatically. Even if you loop
* through the entire result and then call this method it will silently
* ignore any consecutive call (for convenience).
*/
void close();
/**
* Returns the first and only item from the result iterator, or {@code null}
* if there was none. If there were more than one item in the result a
* {@link NoSuchElementException} will be thrown. This method must be called
* first in the iteration and will grab the first item from the iteration,
* so the result is considered broken after this call.
*
* @return the first and only item, or {@code null} if none.
*/
T getSingle();
/**
* Returns the score of the most recently fetched item from this iterator
* (from {@link #next()}). The range of the returned values is up to the
* {@link Index} implementation to dictate.
* @return the score of the most recently fetched item from this iterator.
*/
float currentScore();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_IndexHits.java
|
6,153
|
public interface IndexImplementation
{
/**
* Returns the name of the XA data source coupled with this index provider.
* @return the name of the XA data source coupled with this index provider.
*/
String getDataSourceName();
/**
* Returns an {@link Index} for {@link Node}s for the name
* {@code indexName} with the given {@code config}. The {@code config}
* {@link Map} can contain any provider-implementation-specific data that
* can control how an index behaves.
*
* @param indexName the name of the index.
* @param config a {@link Map} of configuration parameters to use with the
* index. Parameters can be anything and are implementation-specific. This
* map represents how the configuration looks right now, they might be modified
* later using {@link IndexManager#setConfiguration(Index, String, String)}
* or {@link IndexManager#removeConfiguration(Index, String)}.
* @return the {@link Index} corresponding to the {@code indexName} and
* {@code config}.
*/
Index<Node> nodeIndex( String indexName, Map<String, String> config );
/**
* Returns an {@link Index} for {@link Relationship}s for the name
* {@code indexName} with the given {@code config}. The {@code config}
* {@link Map} can contain any provider-implementation-specific data that
* can control how an index behaves.
*
* @param indexName the name of the index.
* @param config a {@link Map} of configuration parameters to use with the
* index. Parameters can be anything and are implementation-specific. This
* map represents how the configuration looks right now, they might be modified
* later using {@link IndexManager#setConfiguration(Index, String, String)}
* or {@link IndexManager#removeConfiguration(Index, String)}.
* @return the {@link Index} corresponding to the {@code indexName} and
* {@code config}. The return index is a {@link RelationshipIndex} with
* additional query methods for efficiently filtering hits with respect to
* start/end node of the relationships.
*/
RelationshipIndex relationshipIndex( String indexName,
Map<String, String> config );
/**
* Fills in default configuration parameters for indexes provided from this
* index provider.
* @param config the configuration map to complete with defaults.
* @return a {@link Map} filled with decent defaults for an index from
* this index provider.
*/
Map<String, String> fillInDefaults( Map<String, String> config );
boolean configMatches( Map<String, String> storedConfig, Map<String, String> config );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_IndexImplementation.java
|
6,154
|
public interface IndexManager
{
/**
* The configuration key to use for specifying which provider an index
* will have, i.e. which implementation will be used to back that index.
*/
String PROVIDER = "provider";
/**
* Returns whether or not there exists a node index with the name
* {@code indexName}. Indexes are created when needed in calls to
* {@link #forNodes(String)} and {@link #forNodes(String, Map)}.
* @param indexName the name of the index to check.
* @return whether or not there exists a node index with the name
* {@code indexName}.
*/
boolean existsForNodes( String indexName );
/**
* Returns an {@link Index} for {@link Node}s with the name {@code indexName}.
* If such an index doesn't exist it will be created with default configuration.
* Indexes created with {@link #forNodes(String, Map)} can be returned by this
* method also, so that you don't have to supply and match its configuration
* for consecutive accesses.
*
* This is the prefered way of accessing indexes, whether they were created with
* {@link #forNodes(String)} or {@link #forNodes(String, Map)}.
*
* @param indexName the name of the node index.
* @return the {@link Index} corresponding to the {@code indexName}.
*/
Index<Node> forNodes( String indexName );
/**
* Returns an {@link Index} for {@link Node}s with the name {@code indexName}.
* If the index exists it will be returned if the provider and customConfiguration
* matches, else an {@link IllegalArgumentException} will be thrown.
* If the index doesn't exist it will be created with the given
* provider (given in the configuration map).
*
* @param indexName the name of the index to create.
* @param customConfiguration configuration for the index being created.
* Use the <bold>provider</bold> key to control which index implementation,
* i.e. the {@link IndexImplementation} to use for this index if it's created. The
* value represents the service name corresponding to the {@link IndexImplementation}.
* Other options can f.ex. say that the index will be a fulltext index and that it
* should be case insensitive. The parameters given here (except "provider") are
* only interpreted by the implementation represented by the provider.
*/
Index<Node> forNodes( String indexName, Map<String, String> customConfiguration );
/**
* Returns the names of all existing {@link Node} indexes.
* Those names can then be used to get to the actual {@link Index}
* instances.
*
* @return the names of all existing {@link Node} indexes.
*/
String[] nodeIndexNames();
/**
* Returns whether or not there exists a relationship index with the name
* {@code indexName}. Indexes are created when needed in calls to
* {@link #forRelationships(String)} and {@link #forRelationships(String, Map)}.
* @param indexName the name of the index to check.
* @return whether or not there exists a relationship index with the name
* {@code indexName}.
*/
boolean existsForRelationships( String indexName );
/**
* Returns an {@link Index} for {@link Relationship}s with the name {@code indexName}.
* If such an index doesn't exist it will be created with default configuration.
* Indexes created with {@link #forRelationships(String, Map)} can be returned by this
* method also, so that you don't have to supply and match its configuration
* for consecutive accesses.
*
* This is the prefered way of accessing indexes, whether they were created with
* {@link #forRelationships(String)} or {@link #forRelationships(String, Map)}.
*
* @param indexName the name of the node index.
* @return the {@link Index} corresponding to the {@code indexName}.
*/
RelationshipIndex forRelationships( String indexName );
/**
* Returns an {@link Index} for {@link Relationship}s with the name {@code indexName}.
* If the index exists it will be returned if the provider and customConfiguration
* matches, else an {@link IllegalArgumentException} will be thrown.
* If the index doesn't exist it will be created with the given
* provider (given in the configuration map).
*
* @param indexName the name of the index to create.
* @param customConfiguration configuration for the index being created.
* Use the <bold>provider</bold> key to control which index implementation,
* i.e. the {@link IndexImplementation} to use for this index if it's created. The
* value represents the service name corresponding to the {@link IndexImplementation}.
* Other options can f.ex. say that the index will be a fulltext index and that it
* should be case insensitive. The parameters given here (except "provider") are
* only interpreted by the implementation represented by the provider.
*/
RelationshipIndex forRelationships( String indexName,
Map<String, String> customConfiguration );
/**
* Returns the names of all existing {@link Relationship} indexes.
* Those names can then be used to get to the actual {@link Index}
* instances.
*
* @return the names of all existing {@link Relationship} indexes.
*/
String[] relationshipIndexNames();
/**
* Returns the configuration for {@code index}. Configuration can be
* set when creating an index, with f.ex {@link #forNodes(String, Map)}
* or with {@link #setConfiguration(Index, String, String)} or
* {@link #removeConfiguration(Index, String)}.
*
* @return configuration for the {@code index}.
*/
Map<String, String> getConfiguration( Index<? extends PropertyContainer> index );
/**
* EXPERT: Sets a configuration parameter for an index. If a configuration
* parameter with the given {@code key} it will be overwritten.
*
* WARNING: Overwriting parameters which controls the storage format of index
* data may lead to existing index data being unusable.
*
* The key "provider" is a reserved parameter and cannot be overwritten,
* if key is "provider" then an {@link IllegalArgumentException} will be thrown.
*
* @param index the index to set a configuration parameter for.
* @param key the configuration parameter key.
* @param value the new value of the configuration parameter.
* @return the overwritten value if any.
*/
String setConfiguration( Index<? extends PropertyContainer> index, String key, String value );
/**
* EXPERT: Removes a configuration parameter from an index. If there's no
* value for the given {@code key} nothing will happen and {@code null}
* will be returned.
*
* WARNING: Removing parameters which controls the storage format of index
* data may lead to existing index data being unusable.
*
* The key "provider" is a reserved parameter and cannot be removed,
* if key is "provider" then an {@link IllegalArgumentException} will be thrown.
*
* @param index the index to remove a configuration parameter from.
* @param key the configuration parameter key.
* @return the removed value if any.
*/
String removeConfiguration( Index<? extends PropertyContainer> index, String key );
AutoIndexer<Node> getNodeAutoIndexer();
RelationshipAutoIndexer getRelationshipAutoIndexer();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_IndexManager.java
|
6,155
|
public interface IndexProviders
{
void registerIndexProvider( String name, IndexImplementation indexImplementation );
boolean unregisterIndexProvider( String name );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_IndexProviders.java
|
6,156
|
public interface ReadableIndex<T extends PropertyContainer>
{
/**
* @return the name of the index, i.e. the name this index was
* created with.
*/
String getName();
/**
* @return the type of entities are managed by this index.
*/
Class<T> getEntityType();
/**
* Returns exact matches from this index, given the key/value pair. Matches
* will be for key/value pairs just as they were added by the
* {@link Index#add(PropertyContainer, String, Object)} method.
*
* @param key the key in the key/value pair to match.
* @param value the value in the key/value pair to match.
* @return the result wrapped in an {@link IndexHits} object. If the entire
* result set isn't looped through, {@link IndexHits#close()} must
* be called before disposing of the result.
*/
IndexHits<T> get( String key, Object value );
/**
* Returns matches from this index based on the supplied {@code key} and
* query object, which can be a query string or an implementation-specific
* query object.
*
* @param key the key in this query.
* @param queryOrQueryObject the query for the {@code key} to match.
* @return the result wrapped in an {@link IndexHits} object. If the entire
* result set isn't looped through, {@link IndexHits#close()} must be
* called before disposing of the result.
*/
IndexHits<T> query( String key, Object queryOrQueryObject );
/**
* Returns matches from this index based on the supplied query object,
* which can be a query string or an implementation-specific query object.
*
* @param queryOrQueryObject the query to match.
* @return the result wrapped in an {@link IndexHits} object. If the entire
* result set isn't looped through, {@link IndexHits#close()} must be
* called before disposing of the result.
*/
IndexHits<T> query( Object queryOrQueryObject );
/**
* A ReadableIndex is possible to support mutating operations as well. This
* method returns true iff such operations are supported by the
* implementation.
*
* @return true iff mutating operations are supported.
*/
boolean isWriteable();
/**
* Get the {@link GraphDatabaseService graph database} that owns this index.
* @return the {@link GraphDatabaseService graph database} that owns this index.
*/
GraphDatabaseService getGraphDatabase();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_ReadableIndex.java
|
6,157
|
public interface ReadableRelationshipIndex extends ReadableIndex<Relationship>
{
/**
* Returns exact matches from this index, given the key/value pair. Matches
* will be for key/value pairs just as they were added by the
* {@link Index#add(org.neo4j.graphdb.PropertyContainer, String, Object)} method.
*
* @param key the key in the key/value pair to match.
* @param valueOrNull the value in the key/value pair to match.
* @param startNodeOrNull filter so that only {@link Relationship}s with
* that given start node will be returned.
* @param endNodeOrNull filter so that only {@link Relationship}s with that
* given end node will be returned.
* @return the result wrapped in an {@link IndexHits} object. If the entire
* result set isn't looped through, {@link IndexHits#close()} must
* be called before disposing of the result.
*/
IndexHits<Relationship> get( String key, Object valueOrNull, Node startNodeOrNull,
Node endNodeOrNull );
/**
* Returns matches from this index based on the supplied {@code key} and
* query object, which can be a query string or an implementation-specific
* query object.
*
* @param key the key in this query.
* @param queryOrQueryObjectOrNull the query for the {@code key} to match.
* @param startNodeOrNull filter so that only {@link Relationship}s with
* that given start node will be returned.
* @param endNodeOrNull filter so that only {@link Relationship}s with that
* given end node will be returned.
* @return the result wrapped in an {@link IndexHits} object. If the entire
* result set isn't looped through, {@link IndexHits#close()} must
* be called before disposing of the result.
*/
IndexHits<Relationship> query( String key, Object queryOrQueryObjectOrNull,
Node startNodeOrNull, Node endNodeOrNull );
/**
* Returns matches from this index based on the supplied query object, which
* can be a query string or an implementation-specific query object.
*
* @param queryOrQueryObjectOrNull the query to match.
* @param startNodeOrNull filter so that only {@link Relationship}s with
* that given start node will be returned.
* @param endNodeOrNull filter so that only {@link Relationship}s with that
* given end node will be returned.
* @return the result wrapped in an {@link IndexHits} object. If the entire
* result set isn't looped through, {@link IndexHits#close()} must
* be called before disposing of the result.
*/
IndexHits<Relationship> query( Object queryOrQueryObjectOrNull, Node startNodeOrNull,
Node endNodeOrNull );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_ReadableRelationshipIndex.java
|
6,158
|
public interface RelationshipAutoIndexer extends AutoIndexer<Relationship>
{
ReadableRelationshipIndex getAutoIndex();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_RelationshipAutoIndexer.java
|
6,159
|
public interface RelationshipIndex extends ReadableRelationshipIndex,
Index<Relationship>
{
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_index_RelationshipIndex.java
|
6,160
|
public interface FileSystemGuard
{
public enum OperationType
{
WRITE, READ;
}
/**
* Called back on file channel operations. Expect this to change as it is used more.
* @param operationType The type of operation performed.
* @param onFile The filename on which the operation happened
* @param bytesWrittenTotal The total bytes written in this channel so far.
* @param bytesWrittenThisCall The number of bytes written during this call.
* @param channelPosition The current position of the file channel
* @throws IOException If the implementation chooses so.
*/
void checkOperation( OperationType operationType, File onFile,
int bytesWrittenTotal, int bytesWrittenThisCall, long channelPosition ) throws IOException;
}
| false
|
community_kernel_src_test_java_org_neo4j_graphdb_mockfs_FileSystemGuard.java
|
6,161
|
public enum OperationType
{
WRITE, READ;
}
| false
|
community_kernel_src_test_java_org_neo4j_graphdb_mockfs_FileSystemGuard.java
|
6,162
|
public interface ConstraintCreator
{
/**
* Imposes a uniqueness constraint for the given property, such that
* there can be at most one node, having the given label, for any set value of that property key.
*
* @return a {@link ConstraintCreator} instance to be used for further interaction.
*/
ConstraintCreator assertPropertyIsUnique( String propertyKey );
/**
* Creates a constraint with the details specified by the other methods in this interface.
*
* @return the created {@link ConstraintDefinition constraint}.
* @throws ConstraintViolationException if creating this constraint would violate any
* existing constraints.
*/
ConstraintDefinition create() throws ConstraintViolationException;
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_ConstraintCreator.java
|
6,163
|
public interface ConstraintDefinition
{
/**
* @return the {@link Label} this constraint is associated with.
*/
Label getLabel();
/**
* @return the property keys this constraint is about.
*/
Iterable<String> getPropertyKeys();
/**
* Drops this constraint.
*/
void drop();
/**
* @return the {@link ConstraintType} of constraint.
*/
ConstraintType getConstraintType();
/**
* @param type a constraint type
* @return true if this constraint definition's type is equal to the provided type
*/
boolean isConstraintType( ConstraintType type );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_ConstraintDefinition.java
|
6,164
|
public enum ConstraintType
{
UNIQUENESS,
;
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_ConstraintType.java
|
6,165
|
public interface IndexCreator
{
/**
* Includes the given {@code propertyKey} in this index, such that {@link Node nodes} with
* the assigned {@link Label label} and this property key will have its values indexed.
*
* NOTE: currently only a single property key per index is supported.
*
* @param propertyKey the property key to include in this index to be created.
* @return an {@link IndexCreator} instance to be used for further interaction.
*/
IndexCreator on( String propertyKey );
/**
* Creates an index with the details specified by the other methods in this interface.
*
* @return the created {@link IndexDefinition index}.
* @throws ConstraintViolationException if creating this index would violate one or more constraints.
*/
IndexDefinition create() throws ConstraintViolationException;
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_IndexCreator.java
|
6,166
|
public interface IndexDefinition
{
/**
* @return the {@link Label label} this index definition is associated with.
*/
Label getLabel();
/**
* @return the property keys this index was created on.
*/
Iterable<String> getPropertyKeys();
/**
* Drops this index. {@link Schema#getIndexes(Label)} will no longer include this index
* and any related background jobs and files will be stopped and removed.
*/
void drop();
/**
* @return {@code true} if this index is created as a side effect of the creation of a uniqueness constraint.
*/
boolean isConstraintIndex();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_IndexDefinition.java
|
6,167
|
public interface Schema
{
/**
* The states that an index can be in. This mostly relates to tracking the background
* population of an index, to tell when it is done populating and is online serving
* requests.
*/
public static enum IndexState
{
ONLINE,
POPULATING,
FAILED
}
/**
* Returns an {@link IndexCreator} where details about the index to create can be
* specified. When all details have been entered {@link IndexCreator#create() create}
* must be called for it to actually be created.
*
* Creating an index enables indexing for nodes with the specified label. The index will
* have the details supplied to the {@link IndexCreator returned index creator}.
* All existing and all future nodes matching the index definition will be indexed,
* speeding up future operations.
*
* @param label {@link Label label} on nodes to be indexed
*
* @return an {@link IndexCreator} capable of providing details for, as well as creating
* an index for the given {@link Label label}.
*/
IndexCreator indexFor( Label label );
/**
* @param label the {@link Label} to get {@link IndexDefinition indexes} for.
* @return all {@link IndexDefinition indexes} attached to the given {@link Label label}.
*/
Iterable<IndexDefinition> getIndexes( Label label );
/**
* @return all {@link IndexDefinition indexes} in this database.
*/
Iterable<IndexDefinition> getIndexes();
/**
* Poll the database for the state of a given index. This can be used to track in which
* state the creation of the index is, for example if it's still
* {@link IndexState#POPULATING populating} in the background, or has come
* {@link IndexState#ONLINE online}.
*
* @param index the index that we want to poll state for
* @return the current {@link IndexState} of the index
*/
IndexState getIndexState( IndexDefinition index );
/**
* If {@link #getIndexState(IndexDefinition)} return {@link IndexState#FAILED} this method will
* return the failure description.
* @param index the {@link IndexDescriptor} to get failure from.
* @return the failure description.
* @throws IllegalStateException if the {@code index} isn't in a {@link IndexState#FAILED} state.
*/
String getIndexFailure( IndexDefinition index );
/**
* Returns a {@link ConstraintCreator} where details about the constraint can be
* specified. When all details have been entered {@link ConstraintCreator#create()}
* must be called for it to actually be created.
*
* Creating a constraint will have the transaction creating it block on commit until
* all existing data has been verified for compliance. If any existing data doesn't
* comply with the constraint the transaction will not be able to commit, but
* fail in {@link Transaction#close()}.
*
* @param label the label this constraint is for.
* @return a {@link ConstraintCreator} capable of providing details for, as well as creating
* a constraint for the given {@link Label label}.
*/
ConstraintCreator constraintFor( Label label );
/**
* @param label the label to get constraints for.
* @return all constraints for the given label.
*/
Iterable<ConstraintDefinition> getConstraints( Label label );
/**
* @return all constraints
*/
Iterable<ConstraintDefinition> getConstraints();
/**
* Wait until an index comes online
*
* @param index the index that we want to wait for
* @param duration duration to wait for the index to come online
* @param unit TimeUnit of duration
* @throws IllegalStateException if the index did not enter the ONLINE state
* within the given duration or if the index entered the FAILED
* state
*/
void awaitIndexOnline( IndexDefinition index, long duration, TimeUnit unit );
/**
* Wait until all indices comes online
*
* @param duration duration to wait for all indexes to come online
* @param unit TimeUnit of duration
* @throws IllegalStateException if some index did not enter the ONLINE
* state within the given duration or if the index entered the
* FAILED state
*/
void awaitIndexesOnline( long duration, TimeUnit unit );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_Schema.java
|
6,168
|
public static enum IndexState
{
ONLINE,
POPULATING,
FAILED
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_schema_Schema.java
|
6,169
|
public interface BidirectionalTraversalDescription
{
/**
* Sets the start side {@link TraversalDescription} of this bidirectional
* traversal. The point of a bidirectional traversal is that the start
* and end side will meet (or collide) in the middle somewhere and
* generate paths evaluated and returned by this traversal.
* @param startSideDescription the {@link TraversalDescription} to use
* for the start side traversal.
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription startSide( TraversalDescription startSideDescription );
/**
* Sets the end side {@link TraversalDescription} of this bidirectional
* traversal. The point of a bidirectional traversal is that the start
* and end side will meet (or collide) in the middle somewhere and
* generate paths evaluated and returned by this traversal.
* @param endSideDescription the {@link TraversalDescription} to use
* for the end side traversal.
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription endSide( TraversalDescription endSideDescription );
/**
* Sets both the start side and end side of this bidirectional traversal,
* the {@link #startSide(TraversalDescription) start side} is assigned the
* {@code sideDescription} and the {@link #endSide(TraversalDescription) end side}
* is assigned the same description, although
* {@link TraversalDescription#reverse() reversed}. This will replace any
* traversal description previously set by {@link #startSide(TraversalDescription)}
* or {@link #endSide(TraversalDescription)}.
*
* @param sideDescription the {@link TraversalDescription} to use for both sides
* of the bidirectional traversal. The end side will have it
* {@link TraversalDescription#reverse() reversed}
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription mirroredSides( TraversalDescription sideDescription );
/**
* Sets the collision policy to use during this traversal. Branch collisions
* happen between {@link TraversalBranch}es where start and end branches
* meet and {@link Path}s are generated from it.
*
* @param collisionDetection the {@link BranchCollisionPolicy} to use during
* this traversal.
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription collisionPolicy( BranchCollisionPolicy collisionDetection );
/**
* @deprecated Please use {@link #collisionPolicy(BranchCollisionPolicy)}
*/
BidirectionalTraversalDescription collisionPolicy( org.neo4j.kernel.impl.traversal.BranchCollisionPolicy collisionDetection );
/**
* Sets the {@link Evaluator} to use for branch collisions. The outcome
* returned from the evaluator affects the colliding branches.
* @param collisionEvaluator the {@link Evaluator} to use for evaluating
* branch collisions.
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription collisionEvaluator( Evaluator collisionEvaluator );
/**
* Sets the {@link PathEvaluator} to use for branch collisions. The outcome
* returned from the evaluator affects the colliding branches.
* @param collisionEvaluator the {@link PathEvaluator} to use for evaluating
* branch collisions.
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription collisionEvaluator( PathEvaluator collisionEvaluator );
/**
* In a bidirectional traversal the traverser alternates which side
* (start or end) to move further for each step. This sets the
* {@link SideSelectorPolicy} to use.
*
* @param sideSelector the {@link SideSelectorPolicy} to use for this
* traversal.
* @param maxDepth optional max depth parameter to the side selector.
* Why is max depth a concern of the {@link SideSelector}? Because it has
* got knowledge of both the sides of the traversal at any given point.
* @return a new traversal description with the new modifications.
*/
BidirectionalTraversalDescription sideSelector( SideSelectorPolicy sideSelector, int maxDepth );
/**
* Traverse between a given {@code start} and {@code end} node with all
* applied rules and behavior in this traversal description.
* A {@link Traverser} is returned which is used to step through the
* graph and getting results back. The traversal is not guaranteed to
* start before the Traverser is used.
*
* @param start {@link Node} to use as starting point for the start
* side in this traversal.
* @param end {@link Node} to use as starting point for the end
* side in this traversal.
* @return a {@link Traverser} used to step through the graph and to get
* results from.
*/
Traverser traverse( Node start, Node end );
/**
* Traverse between a set of {@code start} and {@code end} nodes with all
* applied rules and behavior in this traversal description.
* A {@link Traverser} is returned which is used to step through the
* graph and getting results back. The traversal is not guaranteed to
* start before the Traverser is used.
*
* @param start set of nodes to use as starting points for the start
* side in this traversal.
* @param end set of nodes to use as starting points for the end
* side in this traversal.
* @return a {@link Traverser} used to step through the graph and to get
* results from.
*/
Traverser traverse( Iterable<Node> start, Iterable<Node> end );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BidirectionalTraversalDescription.java
|
6,170
|
public interface BidirectionalUniquenessFilter extends UniquenessFilter {
/**
* Checks {@link Path} alone to see if it follows the uniqueness contract
* provided by this {@link UniquenessFilter}.
*
* @param path the {@link Path} to examine.
* @return {@code true} if the {@code path} fulfills the uniqueness contract,
* otherwise {@code false}.
*/
boolean checkFull(Path path);
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BidirectionalUniquenessFilter.java
|
6,171
|
public interface BranchCollisionDetector
{
/**
* Evaluate the given {@code branch} coming from either the start side or the
* end side. Which side the branch represents is controlled by the {@code direction}
* argument, {@link Direction#OUTGOING} means the start side and {@link Direction#INCOMING}
* means the end side. Returns an {@link Iterable} of new unique {@link Path}s if
* this branch resulted in a collision with other previously registered branches,
* or {@code null} if this branch didn't result in any collision.
*
* @param branch the {@link TraversalBranch} to check for collision with other
* previously registered branches.
* @param direction {@link Direction#OUTGOING} if this branch represents a branch
* from the start side of this bidirectional traversal, or {@link Direction#INCOMING}
* for the end side.
* @return new paths formed if this branch collided with other branches,
* or {@code null} if no collision occured.
*/
Iterable<Path> evaluate( TraversalBranch branch, Direction direction );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchCollisionDetector.java
|
6,172
|
public enum BranchCollisionPolicies implements BranchCollisionPolicy
{
STANDARD
{
@Override
public BranchCollisionDetector create( Evaluator evaluator )
{
return new StandardBranchCollisionDetector( evaluator );
}
},
SHORTEST_PATH
{
@Override
public BranchCollisionDetector create( Evaluator evaluator )
{
return new ShortestPathsBranchCollisionDetector( evaluator );
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchCollisionPolicies.java
|
6,173
|
public interface BranchCollisionPolicy
{
BranchCollisionDetector create( Evaluator evaluator );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchCollisionPolicy.java
|
6,174
|
public enum BranchOrderingPolicies implements BranchOrderingPolicy
{
PREORDER_DEPTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return new PreorderDepthFirstSelector( startSource, expander );
}
},
POSTORDER_DEPTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return new PostorderDepthFirstSelector( startSource, expander );
}
},
PREORDER_BREADTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return new PreorderBreadthFirstSelector( startSource, expander );
}
},
POSTORDER_BREADTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return new PostorderBreadthFirstSelector( startSource, expander );
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchOrderingPolicies.java
|
6,175
|
public interface BranchOrderingPolicy
{
/**
* Instantiates a {@link BranchSelector} with {@code startBranch} as the
* first branch to base a decision on "where to go next".
*
* @param startBranch the {@link TraversalBranch} to start from.
* @param expander {@link PathExpander} to use for expanding the branch.
* @return a new {@link BranchSelector} used to decide "where to go next" in
* the traversal.
*/
BranchSelector create( TraversalBranch startBranch, PathExpander expander );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchOrderingPolicy.java
|
6,176
|
public interface BranchSelector
{
/**
* Decides the next position ("where to go from here") from the current
* position, based on the {@code rules}. Since {@link TraversalBranch}
* has the {@link TraversalBranch#endNode()} of the position and the
* {@link TraversalBranch#lastRelationship()} to how it got there as well as
* {@link TraversalBranch#position()}, decisions
* can be based on the current expansion source and the given rules.
*
* @return the next position based on the current position and the
* {@code rules} of the traversal.
*/
TraversalBranch next( TraversalContext metadata );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchSelector.java
|
6,177
|
public interface BranchState<STATE>
{
/**
* @return the associated state for a {@link TraversalBranch}.
*/
STATE getState();
/**
* Sets the {@link TraversalBranch} state for upcoming children of that
* branch.
* @param state the {@link TraversalBranch} state to set for upcoming
* children.
*/
void setState( STATE state );
/**
* Instance representing no state, usage resulting in
* {@link IllegalStateException} being thrown.
*/
BranchState NO_STATE = new BranchState()
{
@Override
public Object getState()
{
throw new IllegalStateException( "Branch state disabled, pass in an initial state to enable it" );
}
@Override
public void setState( Object state )
{
throw new IllegalStateException( "Branch state disabled, pass in an initial state to enable it" );
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_BranchState.java
|
6,178
|
public enum Evaluation
{
INCLUDE_AND_CONTINUE( true, true ),
INCLUDE_AND_PRUNE( true, false ),
EXCLUDE_AND_CONTINUE( false, true ),
EXCLUDE_AND_PRUNE( false, false );
private final boolean includes;
private final boolean continues;
private Evaluation( boolean includes, boolean continues )
{
this.includes = includes;
this.continues = continues;
}
/**
* @return whether or not the {@link TraversalBranch} this outcome was
* generated for should be included in the traversal result.
*/
public boolean includes()
{
return this.includes;
}
/**
* @return whether or not the traversal should continue down the
* {@link TraversalBranch} this outcome was generator for.
*/
public boolean continues()
{
return continues;
}
/**
* Returns an {@link Evaluation} for the given {@code includes} and
* {@code continues}.
*
* @param includes whether or not to include the {@link TraversalBranch}
* in the traversal result.
* @param continues whether or not to continue down the
* {@link TraversalBranch}.
* @return an {@link Evaluation} representing {@code includes}
* and {@code continues}.
*/
public static Evaluation of( boolean includes, boolean continues )
{
return includes?(continues?INCLUDE_AND_CONTINUE:INCLUDE_AND_PRUNE):
(continues?EXCLUDE_AND_CONTINUE:EXCLUDE_AND_PRUNE);
}
/**
* Returns an {@link Evaluation} for the given {@code includes}, meaning
* whether or not to include a {@link TraversalBranch} in the traversal
* result or not. The returned evaluation will always return true
* for {@link Evaluation#continues()}.
*
* @param includes whether or not to include a {@link TraversalBranch}
* in the traversal result.
* @return an {@link Evaluation} representing whether or not to include
* a {@link TraversalBranch} in the traversal result.
*/
public static Evaluation ofIncludes( boolean includes )
{
return includes?INCLUDE_AND_CONTINUE:EXCLUDE_AND_CONTINUE;
}
/**
* Returns an {@link Evaluation} for the given {@code continues}, meaning
* whether or not to continue further down a {@link TraversalBranch} in the
* traversal. The returned evaluation will always return true for
* {@link Evaluation#includes()}.
*
* @param continues whether or not to continue further down a
* {@link TraversalBranch} in the traversal.
* @return an {@link Evaluation} representing whether or not to continue
* further down a {@link TraversalBranch} in the traversal.
*/
public static Evaluation ofContinues( boolean continues )
{
return continues?INCLUDE_AND_CONTINUE:INCLUDE_AND_PRUNE;
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_Evaluation.java
|
6,179
|
public interface Evaluator
{
/**
* Evaluates a {@link Path} and returns an {@link Evaluation} containing
* information about whether or not to include it in the traversal result,
* i.e return it from the {@link Traverser}. And also whether or not to
* continue traversing down that {@code path} or if it instead should be
* pruned so that the traverser won't continue down that branch represented
* by {@code path}.
*
* @param path the {@link Path} to evaluate.
* @return an {@link Evaluation} containing information about whether or not
* to return it from the {@link Traverser} and whether or not to continue
* down that path.
*/
Evaluation evaluate( Path path );
/**
* Exposes an {@link Evaluator} as a {@link PathEvaluator}.
* @param <STATE> the type of state passed into the evaluator.
*/
class AsPathEvaluator<STATE> implements PathEvaluator<STATE>
{
private final Evaluator evaluator;
public AsPathEvaluator( Evaluator evaluator )
{
this.evaluator = evaluator;
}
@Override
public Evaluation evaluate( Path path, BranchState<STATE> state )
{
return evaluator.evaluate( path );
}
@Override
public Evaluation evaluate( Path path )
{
return evaluator.evaluate( path );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_Evaluator.java
|
6,180
|
public interface InitialBranchState<STATE> extends InitialStateFactory<STATE>
{
@SuppressWarnings( "rawtypes" )
InitialBranchState NO_STATE = new InitialBranchState()
{
@Override
public Object initialState( Path path )
{
return null;
}
public InitialBranchState reverse()
{
return this;
}
};
/**
* Creates a version of this state factory which produces reversed initial state,
* used in bidirectional traversals.
* @return an instance which produces reversed initial state.
*/
InitialBranchState<STATE> reverse();
abstract class Adapter<STATE> implements InitialBranchState<STATE>
{
@Override
public InitialBranchState<STATE> reverse()
{
return this;
}
}
/**
* Branch state evaluator for an initial state.
*/
class State<STATE> extends Adapter<STATE>
{
private final STATE initialState;
private final STATE reversedInitialState;
public State( STATE initialState, STATE reversedInitialState )
{
this.initialState = initialState;
this.reversedInitialState = reversedInitialState;
}
@Override
public InitialBranchState<STATE> reverse()
{
return new State<STATE>( reversedInitialState, initialState );
}
@Override
public STATE initialState( Path path )
{
return initialState;
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_InitialBranchState.java
|
6,181
|
public interface InitialStateFactory<STATE>
{
/**
* An {@link InitialStateFactory} which returns {@code null} as state.
*/
@SuppressWarnings( "rawtypes" )
InitialStateFactory NO_STATE = new InitialStateFactory()
{
@Override
public Object initialState( Path path )
{
return null;
}
};
/**
* Returns an initial state for a {@link Path}. All paths entering this method
* are start paths(es) of a traversal. State is passed down along traversal
* branches as the traversal progresses and can be changed at any point by a
* {@link PathExpander} to becomes the new state from that point in that branch
* and downwards.
*
* @param path the start branch to return the initial state for.
* @return an initial state for the traversal branch.
*/
STATE initialState( Path path );
/**
* Wraps an {@link InitialStateFactory} in a {@link InitialBranchState}
*/
class AsInitialBranchState<STATE> implements InitialBranchState<STATE>
{
private final InitialStateFactory<STATE> factory;
public AsInitialBranchState( InitialStateFactory<STATE> factory )
{
this.factory = factory;
}
@Override
public InitialBranchState<STATE> reverse()
{
return this;
}
@Override
public STATE initialState( Path path )
{
return factory.initialState( path );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_InitialStateFactory.java
|
6,182
|
public interface PathEvaluator<STATE> extends Evaluator
{
/**
* Evaluates a {@link Path} and returns an {@link Evaluation} containing
* information about whether or not to include it in the traversal result,
* i.e return it from the {@link Traverser}. And also whether or not to
* continue traversing down that {@code path} or if it instead should be
* pruned so that the traverser won't continue down that branch represented
* by {@code path}.
*
* @param path the {@link Path} to evaluate.
* @param state the state of this branch in the current traversal.
* @return an {@link Evaluation} containing information about whether or not
* to return it from the {@link Traverser} and whether or not to continue
* down that path.
*/
Evaluation evaluate( Path path, BranchState<STATE> state );
/**
* Adapter for {@link PathEvaluator}.
* @param <STATE>
*/
abstract class Adapter<STATE> implements PathEvaluator<STATE>
{
@Override
@SuppressWarnings("unchecked")
public Evaluation evaluate( Path path )
{
return evaluate( path, BranchState.NO_STATE );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_PathEvaluator.java
|
6,183
|
enum PrimitiveTypeFetcher
{
NODE
{
@Override
long getId( Path source )
{
return source.endNode().getId();
}
@Override
boolean idEquals( Path source, long idToCompare )
{
return getId( source ) == idToCompare;
}
@Override
boolean containsDuplicates( Path source )
{
Set<Node> nodes = new HashSet<Node>();
for ( Node node : source.reverseNodes() )
if ( !nodes.add( node ) )
return true;
return false;
}
},
RELATIONSHIP
{
@Override
long getId( Path source )
{
return source.lastRelationship().getId();
}
@Override
boolean idEquals( Path source, long idToCompare )
{
Relationship relationship = source.lastRelationship();
return relationship != null && relationship.getId() == idToCompare;
}
@Override
boolean containsDuplicates( Path source )
{
Set<Relationship> relationships = new HashSet<Relationship>();
for ( Relationship relationship : source.reverseRelationships() )
if ( !relationships.add( relationship ) )
return true;
return false;
}
};
abstract long getId( Path path );
abstract boolean idEquals( Path path, long idToCompare );
abstract boolean containsDuplicates( Path path );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_PrimitiveTypeFetcher.java
|
6,184
|
public interface PruneEvaluator
{
/**
* Default {@link PruneEvaluator}, does not prune any parts of the
* traversal.
*/
PruneEvaluator NONE = new PruneEvaluator()
{
public boolean pruneAfter( Path position )
{
return false;
}
};
/**
* Decides whether or not to prune after {@code position}. If {@code true}
* is returned the position won't be expanded and traversals won't be made
* beyond that position.
*
* @param position the {@link Path position} to decide whether or not to
* prune after.
* @return whether or not to prune after {@code position}.
*/
boolean pruneAfter( Path position );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_PruneEvaluator.java
|
6,185
|
public interface SideSelector extends BranchSelector
{
/**
* @return the side to traverse next on, {@link Direction#OUTGOING} for start side
* and {@link Direction#INCOMING} for end side.
*/
Direction currentSide();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_SideSelector.java
|
6,186
|
public enum SideSelectorPolicies implements SideSelectorPolicy
{
LEVEL
{
@Override
public SideSelector create( BranchSelector start, BranchSelector end, int maxDepth )
{
return new LevelSelectorOrderer( start, end, false, maxDepth );
}
},
LEVEL_STOP_DESCENT_ON_RESULT
{
@Override
public SideSelector create( BranchSelector start, BranchSelector end, int maxDepth )
{
return new LevelSelectorOrderer( start, end, true, maxDepth );
}
},
ALTERNATING
{
@Override
public SideSelector create( BranchSelector start, BranchSelector end, int maxDepth )
{
return new AlternatingSelectorOrderer( start, end );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_SideSelectorPolicies.java
|
6,187
|
public interface SideSelectorPolicy
{
/**
* Creates a new {@link SideSelector} given the {@code start}/{@code end}
* {@link BranchSelector}s and an optional {@code maxDepth}.
*
* @param start the start side {@link BranchSelector} of this
* bidirectional traversal.
* @param end the end side {@link BranchSelector} of this
* bidirectional traversal.
* @param maxDepth an optional max depth the combined traversal depth must
* be kept within. Optional in the sense that only some implementations
* honors it.
* @return a new {@link SideSelector} for {@code start} and {@code end}
* {@link BranchSelector}s.
*/
SideSelector create( BranchSelector start, BranchSelector end, int maxDepth );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_SideSelectorPolicy.java
|
6,188
|
public interface TraversalBranch extends Path
{
/**
* The parent expansion source which created this {@link TraversalBranch}.
* @return the parent of this expansion source.
*/
TraversalBranch parent();
/**
* Returns the next expansion source from the expanded relationships
* from the current node.
*
* @return the next expansion source from this expansion source.
*/
TraversalBranch next( PathExpander expander, TraversalContext metadata );
/**
* Returns the number of relationships this expansion source has expanded.
* In this count isn't included the relationship which led to coming here
* (since that could also be traversed, although skipped, when expanding
* this source).
*
* @return the number of relationships this expansion source has expanded.
*/
int expanded();
/**
* Explicitly tell this branch to be pruned so that consecutive calls to
* {@link #next(PathExpander, TraversalContext)} is guaranteed to return
* {@code null}.
*/
void prune();
/**
* @return whether or not the traversal should continue further along this
* branch.
*/
boolean continues();
/**
* @return whether or not this branch (the {@link Path} representation of
* this branch at least) should be included in the result of this
* traversal, i.e. returned as one of the {@link Path}s from f.ex.
* {@link TraversalDescription#traverse(org.neo4j.graphdb.Node...)}
*/
boolean includes();
/**
* Can change evaluation outcome in a negative direction. For example
* to force pruning.
* @param eval the {@link Evaluation} to AND with the current evaluation.
*/
void evaluation( Evaluation eval );
/**
* Initializes this {@link TraversalBranch}, the relationship iterator,
* {@link Evaluation} etc.
*
* @param expander {@link RelationshipExpander} to use for getting relationships.
* @param metadata {@link TraversalContext} to update on progress.
*/
void initialize( PathExpander expander, TraversalContext metadata );
/**
* Returns the state associated with this branch.
*
* Why is this of type {@link Object}? The state object type only exists when
* specifying the expander in the {@link TraversalDescription}, not anywhere
* else. So in the internals of the traversal the state type is unknown and ignored.
*
* @return the state assocuated with this branch.
*/
Object state();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_TraversalBranch.java
|
6,189
|
public interface TraversalContext extends TraversalMetadata
{
/**
* Reports that one more relationship has been traversed in this
* traversal.
*/
void relationshipTraversed();
/**
* Reports that one more relationship has been traversed, albeit
* a relationship that hasn't provided any benefit to the traversal.
*/
void unnecessaryRelationshipTraversed();
/**
* Used for start branches to check adherence to the traversal uniqueness.
*
* @param branch the {@link TraversalBranch} to check for uniqueness.
* @return {@code true} if the branch is considered unique and is
* allowed to progress in this traversal.
*/
boolean isUniqueFirst( TraversalBranch branch );
/**
* Used for all except branches to check adherence to the traversal
* uniqueness.
*
* @param branch the {@link TraversalBranch} to check for uniqueness.
* @return {@code true} if the branch is considered unique and is
* allowed to progress in this traversal.
*/
boolean isUnique( TraversalBranch branch );
/**
* Evaluates a {@link TraversalBranch} whether or not to include it in the
* result and whether or not to continue further down this branch or not.
*
* @param branch the {@link TraversalBranch} to evaluate.
* @param state the {@link BranchState} for the branch.
* @return an {@link Evaluation} of the branch in this traversal.
*/
@SuppressWarnings( "rawtypes" )
Evaluation evaluate( TraversalBranch branch, BranchState state );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_TraversalContext.java
|
6,190
|
public interface TraversalDescription
{
/**
* Sets the {@link UniquenessFactory} for creating the
* {@link UniquenessFilter} to use.
*
* @param uniqueness the {@link UniquenessFactory} the creator
* of the desired {@link UniquenessFilter} to use.
* @return a new traversal description with the new modifications.
*/
TraversalDescription uniqueness( UniquenessFactory uniqueness );
/**
* Sets the {@link UniquenessFactory} for creating the
* {@link UniquenessFilter} to use. It also accepts an extra parameter
* which is mandatory for certain uniqueness's, f.ex
* {@link Uniqueness#NODE_RECENT}.
*
* @param uniqueness the {@link UniquenessFactory} the creator
* of the desired {@link UniquenessFilter} to use.
* @return a new traversal description with the new modifications.
*/
TraversalDescription uniqueness( UniquenessFactory uniqueness, Object parameter );
/**
* Adds {@code evaluator} to the list of evaluators which will control the
* behavior of the traversal. Each {@link Evaluator} can decide whether or
* not to include a position in the traverser result, i.e. return it from
* the {@link Traverser} iterator and also whether to continue down that
* path or to prune, so that the traverser won't continue further down that
* path.
*
* Multiple {@link Evaluator}s can be added. For a path to be included in
* the result, all evaluators must agree to include it, i.e. returning
* either {@link Evaluation#INCLUDE_AND_CONTINUE} or
* {@link Evaluation#INCLUDE_AND_PRUNE}. For making the traversal continue
* down that path all evaluators must agree to continue from that path, i.e.
* returning either {@link Evaluation#INCLUDE_AND_CONTINUE} or
* {@link Evaluation#EXCLUDE_AND_CONTINUE}.
*
* @param evaluator
* @return a new traversal description with the new modifications.
*/
TraversalDescription evaluator( Evaluator evaluator );
/**
* Adds {@code evaluator} to the list of evaluators which will control the
* behavior of the traversal. Each {@link PathEvaluator} can decide whether or
* not to include a position in the traverser result, i.e. return it from
* the {@link Traverser} iterator and also whether to continue down that
* path or to prune, so that the traverser won't continue further down that
* path.
*
* Multiple {@link PathEvaluator}s can be added. For a path to be included in
* the result, all evaluators must agree to include it, i.e. returning
* either {@link Evaluation#INCLUDE_AND_CONTINUE} or
* {@link Evaluation#INCLUDE_AND_PRUNE}. For making the traversal continue
* down that path all evaluators must agree to continue from that path, i.e.
* returning either {@link Evaluation#INCLUDE_AND_CONTINUE} or
* {@link Evaluation#EXCLUDE_AND_CONTINUE}.
*
* @param evaluator
* @return a new traversal description with the new modifications.
*/
TraversalDescription evaluator( PathEvaluator evaluator );
/**
* Sets the {@link BranchOrderingPolicy} to use. A {@link BranchSelector}
* is the basic decisions in the traversal of "where to go next".
* Examples of default implementations are "breadth first" and
* "depth first", which can be set with convenience methods
* {@link #breadthFirst()} and {@link #depthFirst()}.
*
* @param selector the factory which creates the {@link BranchSelector}
* to use with the traversal.
* @return a new traversal description with the new modifications.
*/
TraversalDescription order( BranchOrderingPolicy selector );
/**
* A convenience method for {@link #order(BranchOrderingPolicy)}
* where a "preorder depth first" selector is used. Positions which are
* deeper than the current position will be returned before positions on
* the same depth. See http://en.wikipedia.org/wiki/Depth-first_search
* @return a new traversal description with the new modifications.
*/
TraversalDescription depthFirst();
/**
* A convenience method for {@link #order(BranchOrderingPolicy)}
* where a "preorder breadth first" selector is used. All positions with
* the same depth will be returned before advancing to the next depth.
* See http://en.wikipedia.org/wiki/Breadth-first_search
* @return a new traversal description with the new modifications.
*/
TraversalDescription breadthFirst();
/**
* Adds {@code type} to the list of relationship types to traverse.
* There's no priority or order in which types to traverse.
*
* @param type the {@link RelationshipType} to add to the list of types
* to traverse.
* @return a new traversal description with the new modifications.
*/
TraversalDescription relationships( RelationshipType type );
/**
* Adds {@code type} to the list of relationship types to traverse in
* the given {@code direction}. There's no priority or order in which
* types to traverse.
*
* @param type the {@link RelationshipType} to add to the list of types
* to traverse.
* @param direction the {@link Direction} to traverse this type of
* relationship in.
* @return a new traversal description with the new modifications.
*/
TraversalDescription relationships( RelationshipType type,
Direction direction );
/**
* Sets the {@link PathExpander} as the expander of relationships,
* discarding all previous calls to
* {@link #relationships(RelationshipType)} and
* {@link #relationships(RelationshipType, Direction)} or any other expand method.
*
* @param expander the {@link PathExpander} to use.
* @return a new traversal description with the new modifications.
*/
TraversalDescription expand( PathExpander<?> expander );
/**
* Sets the {@link PathExpander} as the expander of relationships,
* discarding all previous calls to
* {@link #relationships(RelationshipType)} and
* {@link #relationships(RelationshipType, Direction)} or any other expand method.
* The supplied {@link InitialStateFactory} will provide the initial traversal branches
* with state values which flows down throughout the traversal and can be changed
* for child branches by the {@link PathExpander} at any level.
*
* @param expander the {@link PathExpander} to use.
* @param initialState factory for supplying the initial traversal branches with
* state values potentially used by the {@link PathExpander}.
* @return a new traversal description with the new modifications.
*
* @deprecated Because InitialStateFactory is deprecated
*/
<STATE> TraversalDescription expand( PathExpander<STATE> expander, InitialStateFactory<STATE> initialState );
/**
* Sets the {@link PathExpander} as the expander of relationships,
* discarding all previous calls to
* {@link #relationships(RelationshipType)} and
* {@link #relationships(RelationshipType, Direction)} or any other expand method.
* The supplied {@link InitialBranchState} will provide the initial traversal branches
* with state values which flows down throughout the traversal and can be changed
* for child branches by the {@link PathExpander} at any level.
*
* @param expander the {@link PathExpander} to use.
* @param initialState factory for supplying the initial traversal branches with
* state values potentially used by the {@link PathExpander}.
* @return a new traversal description with the new modifications.
*/
<STATE> TraversalDescription expand( PathExpander<STATE> expander, InitialBranchState<STATE> initialState );
/**
* Sets the {@link RelationshipExpander} as the expander of relationships,
* discarding all previous calls to
* {@link #relationships(RelationshipType)} and
* {@link #relationships(RelationshipType, Direction)} or any other expand method.
*
* @param expander the {@link RelationshipExpander} to use.
* @return a new traversal description with the new modifications.
*
* @deprecated Because RelationshipExpander is deprecated
*/
TraversalDescription expand( RelationshipExpander expander );
/**
* @param comparator the {@link Comparator} to use for sorting the paths.
* @return the paths from this traversal sorted according to {@code comparator}.
*/
TraversalDescription sort( Comparator<? super Path> comparator );
/**
* Creates an identical {@link TraversalDescription}, although reversed in
* how it traverses the graph.
*
* @return a new traversal description with the new modifications.
*/
TraversalDescription reverse();
/**
* Traverse from a single start node based on all the rules and behavior
* in this description. A {@link Traverser} is returned which is
* used to step through the graph and getting results back. The traversal
* is not guaranteed to start before the Traverser is used.
*
* @param startNode {@link Node} to start traversing from.
* @return a {@link Traverser} used to step through the graph and to get
* results from.
*/
Traverser traverse( Node startNode );
/**
* Traverse from a set of start nodes based on all the rules and behavior
* in this description. A {@link Traverser} is returned which is
* used to step through the graph and getting results back. The traversal
* is not guaranteed to start before the Traverser is used.
*
* @param startNodes {@link Node}s to start traversing from.
* @return a {@link Traverser} used to step through the graph and to get
* results from.
*/
Traverser traverse( Node... startNodes );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_TraversalDescription.java
|
6,191
|
public interface TraversalMetadata
{
/**
* @return number of paths returned up to this point in the traversal.
*/
int getNumberOfPathsReturned();
/**
* @return number of relationships traversed up to this point in the traversal.
* Some relationships in this counter might be unnecessarily traversed relationships,
* but at the same time it gives an accurate measure of how many relationships are
* requested from the underlying graph. Useful for comparing and first-level debugging
* of queries.
*/
int getNumberOfRelationshipsTraversed();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_TraversalMetadata.java
|
6,192
|
public interface Traverser extends ResourceIterable<Path>
{
/**
* Represents the traversal in the form of {@link Node}s. This is a
* convenient way to iterate over {@link Path}s and get the
* {@link Path#endNode()} for each position.
*
* @return the traversal in the form of {@link Node} objects.
*/
ResourceIterable<Node> nodes();
/**
* Represents the traversal in the form of {@link Relationship}s. This is a
* convenient way to iterate over {@link Path}s and get the
* {@link Path#lastRelationship()} for each position.
*
* @return the traversal in the form of {@link Relationship} objects.
*/
ResourceIterable<Relationship> relationships();
/**
* Represents the traversal in the form of {@link Path}s.
* When a traversal is done and haven't been fully iterated through,
* it should be {@link ResourceIterator#close() closed}.
*
* @return the traversal in the form of {@link Path} objects.
*/
@Override
ResourceIterator<Path> iterator();
/**
* @return the {@link TraversalMetadata} from the last traversal performed,
* or being performed by this traverser.
*/
TraversalMetadata metadata();
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_Traverser.java
|
6,193
|
public enum Uniqueness implements UniquenessFactory
{
/**
* A node cannot be traversed more than once. This is what the legacy
* traversal framework does.
*/
NODE_GLOBAL
{
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return new GloballyUnique( PrimitiveTypeFetcher.NODE );
}
},
/**
* For each returned node there's a unique path from the start node to it.
*/
NODE_PATH
{
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return new PathUnique( PrimitiveTypeFetcher.NODE );
}
},
/**
* This is like {@link Uniqueness#NODE_GLOBAL}, but only guarantees
* uniqueness among the most recent visited nodes, with a configurable
* count. Traversing a huge graph is quite memory intensive in that it keeps
* track of <i>all</i> the nodes it has visited. For huge graphs a traverser
* can hog all the memory in the JVM, causing {@link OutOfMemoryError}.
* Together with this {@link Uniqueness} you can supply a count, which is
* the number of most recent visited nodes. This can cause a node to be
* visited more than once, but scales infinitely.
*/
NODE_RECENT
{
public UniquenessFilter create( Object optionalParameter )
{
acceptIntegerOrNull( optionalParameter );
return new RecentlyUnique( PrimitiveTypeFetcher.NODE, optionalParameter );
}
},
/**
* Entities on the same level are guaranteed to be unique.
*/
NODE_LEVEL
{
@Override
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return new LevelUnique( PrimitiveTypeFetcher.NODE );
}
},
/**
* A relationship cannot be traversed more than once, whereas nodes can.
*/
RELATIONSHIP_GLOBAL
{
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return new GloballyUnique( PrimitiveTypeFetcher.RELATIONSHIP );
}
},
/**
* For each returned node there's a (relationship wise) unique path from the
* start node to it.
*/
RELATIONSHIP_PATH
{
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return new PathUnique( PrimitiveTypeFetcher.RELATIONSHIP );
}
},
/**
* Same as for {@link Uniqueness#NODE_RECENT}, but for relationships.
*/
RELATIONSHIP_RECENT
{
public UniquenessFilter create( Object optionalParameter )
{
acceptIntegerOrNull( optionalParameter );
return new RecentlyUnique( PrimitiveTypeFetcher.RELATIONSHIP, optionalParameter );
}
},
/**
* Entities on the same level are guaranteed to be unique.
*/
RELATIONSHIP_LEVEL
{
@Override
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return new LevelUnique( PrimitiveTypeFetcher.RELATIONSHIP );
}
},
/**
* No restriction (the user will have to manage it).
*/
NONE
{
public UniquenessFilter create( Object optionalParameter )
{
acceptNull( optionalParameter );
return notUniqueInstance;
}
};
private static final UniquenessFilter notUniqueInstance = new NotUnique();
private static void acceptNull( Object optionalParameter )
{
if ( optionalParameter != null )
{
throw new IllegalArgumentException( "Only accepts null parameter, was " +
optionalParameter );
}
}
private static void acceptIntegerOrNull( Object parameter )
{
if ( parameter == null )
{
return;
}
boolean isDecimalNumber = parameter instanceof Number
&& !( parameter instanceof Float || parameter instanceof Double );
if ( !isDecimalNumber )
{
throw new IllegalArgumentException( "Doesn't accept non-decimal values"
+ ", like '" + parameter + "'" );
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_Uniqueness.java
|
6,194
|
public interface UniquenessFactory
{
/**
* Creates a new {@link UniquenessFilter} optionally with a parameter
* to it, otherwise null if no parameter should be handed to it.
*
* @param optionalParameter an optional parameter to control the behavior
* of the returned {@link UniquenessFilter}. It's up to each filter implementation
* to decide what values are OK and what they mean and the caller of this
* method need to know that and pass in the correct parameter type.
* @return a new {@link UniquenessFilter} of the type that this factory creates.
*/
UniquenessFilter create( Object optionalParameter );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_UniquenessFactory.java
|
6,195
|
public interface UniquenessFilter
{
/**
* The check whether or not to expand the first branch is a separate
* method because it may contain checks which would be unnecessary for
* all other checks. So it's purely an optimization.
*
* @param branch the first branch to check, i.e. the branch representing
* the start node in the traversal.
* @return whether or not {@code branch} is unique, and hence can be
* visited in this traversal.
*/
boolean checkFirst( TraversalBranch branch );
/**
* Checks whether or not {@code branch} is unique, and hence can be
* visited in this traversal.
*
* @param branch the {@link TraversalBranch} to check for uniqueness.
* @return whether or not {@code branch} is unique, and hence can be
* visited in this traversal.
*/
boolean check( TraversalBranch branch );
}
| false
|
community_kernel_src_main_java_org_neo4j_graphdb_traversal_UniquenessFilter.java
|
6,196
|
@Deprecated
public interface ValueMatcher
{
/**
* Tries to match {@code value} to see if it matches an expected value.
* {@code value} is {@code null} if the property wasn't found on the
* {@link Node} or {@link Relationship} it came from.
*
* The value can be of type array, where {@link ArrayPropertyUtil} can be of
* help.
*
* @param value the value from a {@link Node} or {@link Relationship} to
* match against an expected value.
* @return {@code true} if the value matches, else {@code false}.
*/
boolean matches( Object value );
}
| false
|
community_graph-matching_src_main_java_org_neo4j_graphmatching_ValueMatcher.java
|
6,197
|
@Deprecated
public interface FilterExpression
{
/**
* Matches a value from a {@code valueGetter} and returns whether or not
* there was a match.
* @param valueGetter the getter which fetches the value to match.
* @return whether or not the value from {@code valueGetter} matches
* the criterias found in this expression.
*/
boolean matches( FilterValueGetter valueGetter );
}
| false
|
community_graph-matching_src_main_java_org_neo4j_graphmatching_filter_FilterExpression.java
|
6,198
|
@Deprecated
public interface FilterValueGetter
{
/**
* Returns an array of values.
* @param label the {@link PatternNode} label.
* @return an array of values.
*/
Object[] getValues( String label );
}
| false
|
community_graph-matching_src_main_java_org_neo4j_graphmatching_filter_FilterValueGetter.java
|
6,199
|
interface ClusterAction
{
public Iterable<ClusterAction> perform( ClusterState state ) throws Exception;
}
| false
|
enterprise_ha_src_test_java_org_neo4j_ha_correctness_ClusterAction.java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.