@Override void buildString(StringBuilder result) { expander.buildString(result); result.append("; filter:"); for (Filter filter : filters) { result.append(" "); result.append(filter); } }
/** * Creates a new {@link RelationshipExpander} which is set to expand relationships with multiple * types and directions. * * @param type1 a {@link RelationshipType} to expand. * @param dir1 a {@link Direction} to expand. * @param type2 another {@link RelationshipType} to expand. * @param dir2 another {@link Direction} to expand. * @param more additional pairs or type/direction to expand. * @return a new {@link RelationshipExpander}. * @deprecated See {@link org.neo4j.graphdb.PathExpanders#forTypesAndDirections} */ @Deprecated public static Expander expanderForTypes( RelationshipType type1, Direction dir1, RelationshipType type2, Direction dir2, Object... more) { return StandardExpander.create(type1, dir1, type2, dir2, more); }
/** * Creates a new {@link PathExpander} which is set to expand relationships with multiple types and * directions. * * @param type1 a {@link RelationshipType} to expand. * @param dir1 a {@link Direction} to expand. * @param type2 another {@link RelationshipType} to expand. * @param dir2 another {@link Direction} to expand. * @param more additional pairs or type/direction to expand. * @return a new {@link PathExpander}. * @deprecated See {@link org.neo4j.graphdb.PathExpanders#forTypesAndDirections} */ @Deprecated @SuppressWarnings("unchecked") public static <STATE> PathExpander<STATE> pathExpanderForTypes( RelationshipType type1, Direction dir1, RelationshipType type2, Direction dir2, Object... more) { return StandardExpander.create(type1, dir1, type2, dir2, more); }
@Override Iterator<Relationship> doExpand(final Path path, BranchState state) { return new FilteringIterator<Relationship>( expander.doExpand(path, state), new Predicate<Relationship>() { public boolean accept(Relationship item) { Path extendedPath = extend(path, item); for (Filter filter : filters) { if (filter.exclude(extendedPath)) { return false; } } return true; } }); }
@Override public StandardExpander reverse() { return new FilteringExpander(expander.reversed(), filters); }
@Override public StandardExpander remove(RelationshipType type) { return new FilteringExpander(expander.remove(type), filters); }
@Override public StandardExpander add(RelationshipType type, Direction direction) { return new FilteringExpander(expander.add(type, direction), filters); }
public boolean isEmpty() { return !expander.doExpand(path, state).hasNext(); }
/** * Creates a new {@link PathExpander} which is set to expand relationships with {@code type} in * any direction. * * @param type the {@link RelationshipType} to expand. * @return a new {@link PathExpander}. * @deprecated See {@link org.neo4j.graphdb.PathExpanders#forType} */ @Deprecated @SuppressWarnings("unchecked") public static <STATE> PathExpander<STATE> pathExpanderForTypes(RelationshipType type) { return StandardExpander.create(type, Direction.BOTH); }
public StandardExpansion<T> filterNodes(Predicate<? super Node> filter) { return createNew(expander.addNodeFilter(filter)); }
/** * Returns a {@link RelationshipExpander} wrapped as an {@link Expander}. * * @param expander {@link RelationshipExpander} to wrap. * @return a {@link RelationshipExpander} wrapped as an {@link Expander}. */ public static Expander expander(RelationshipExpander expander) { if (expander instanceof Expander) { return (Expander) expander; } return StandardExpander.wrap(expander); }
public static Expander expander(PathExpander expander) { if (expander instanceof Expander) { return (Expander) expander; } return StandardExpander.wrap(expander); }
/** * Returns a {@link PathExpander} which expands relationships of all types in the given {@code * direction}. * * @return a path expander which expands all relationships in the given {@code direction}. * @deprecated See {@link org.neo4j.graphdb.PathExpanders#forDirection} */ @Deprecated @SuppressWarnings("unchecked") public static <STATE> PathExpander<STATE> pathExpanderForAllTypes(Direction direction) { return StandardExpander.create(direction); }
/** * Returns a {@link RelationshipExpander} which expands relationships of all types in the given * {@code direction}. * * @return a relationship expander which expands all relationships in the given {@code direction}. * @deprecated See {@link org.neo4j.graphdb.PathExpanders#forDirection} */ @Deprecated public static Expander expanderForAllTypes(Direction direction) { return StandardExpander.create(direction); }
public StandardExpansion<T> including(RelationshipType type, Direction direction) { return createNew(expander.add(type, direction)); }
public StandardExpansion<T> filterRelationships(Predicate<? super Relationship> filter) { return createNew(expander.addRelationshipFilter(filter)); }
public StandardExpansion<T> excluding(RelationshipType type) { return createNew(expander.remove(type)); }
/** * Creates a new {@link RelationshipExpander} which is set to expand relationships with {@code * type} in any direction. * * @param type the {@link RelationshipType} to expand. * @return a new {@link RelationshipExpander}. * @deprecated See {@link org.neo4j.graphdb.PathExpanders#forType} */ @Deprecated public static Expander expanderForTypes(RelationshipType type) { return StandardExpander.create(type, Direction.BOTH); }