Esempio n. 1
0
 @Override
 void buildString(StringBuilder result) {
   expander.buildString(result);
   result.append("; filter:");
   for (Filter filter : filters) {
     result.append(" ");
     result.append(filter);
   }
 }
Esempio n. 2
0
 /**
  * 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);
 }
Esempio n. 3
0
 /**
  * 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);
 }
Esempio n. 4
0
 @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;
         }
       });
 }
Esempio n. 5
0
 @Override
 public StandardExpander reverse() {
   return new FilteringExpander(expander.reversed(), filters);
 }
Esempio n. 6
0
 @Override
 public StandardExpander remove(RelationshipType type) {
   return new FilteringExpander(expander.remove(type), filters);
 }
Esempio n. 7
0
 @Override
 public StandardExpander add(RelationshipType type, Direction direction) {
   return new FilteringExpander(expander.add(type, direction), filters);
 }
Esempio n. 8
0
 public boolean isEmpty() {
   return !expander.doExpand(path, state).hasNext();
 }
Esempio n. 9
0
 /**
  * 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);
 }
Esempio n. 10
0
 public StandardExpansion<T> filterNodes(Predicate<? super Node> filter) {
   return createNew(expander.addNodeFilter(filter));
 }
Esempio n. 11
0
 /**
  * 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);
 }
Esempio n. 12
0
 public static Expander expander(PathExpander expander) {
   if (expander instanceof Expander) {
     return (Expander) expander;
   }
   return StandardExpander.wrap(expander);
 }
Esempio n. 13
0
 /**
  * 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);
 }
Esempio n. 14
0
 /**
  * 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);
 }
Esempio n. 15
0
 public StandardExpansion<T> including(RelationshipType type, Direction direction) {
   return createNew(expander.add(type, direction));
 }
Esempio n. 16
0
 public StandardExpansion<T> filterRelationships(Predicate<? super Relationship> filter) {
   return createNew(expander.addRelationshipFilter(filter));
 }
Esempio n. 17
0
 public StandardExpansion<T> excluding(RelationshipType type) {
   return createNew(expander.remove(type));
 }
Esempio n. 18
0
 /**
  * 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);
 }