org.neo4j.graphdb.Direction.equals()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.neo4j.graphdb.Direction.equals()方法的一些代码示例,展示了Direction.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Direction.equals()方法的具体详情如下:
包路径:org.neo4j.graphdb.Direction
类名称:Direction
方法名:equals

Direction.equals介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

@Override
  public String relationshipRepresentation( T path, Node from, Relationship relationship )
  {
    Direction direction = relationship.getEndNode().equals( from ) ? Direction.INCOMING : Direction.OUTGOING;
    StringBuilder builder = new StringBuilder();
    if ( direction.equals( Direction.INCOMING ) )
    {
      builder.append( "<" );
    }
    builder.append( "-[" + (relId ? relationship.getId() : "") );
    String representation = representation( relationship );
    if ( relId && !representation.equals( "" ) )
    {
      builder.append( "," );
    }
    builder.append( representation );
    builder.append( "]-" );
    if ( direction.equals( Direction.OUTGOING ) )
    {
      builder.append( ">" );
    }
    return builder.toString();
  }
};

代码示例来源:origin: neo4j/neo4j

if ( relationDirection.equals( Direction.BOTH )
  || relationDirection.equals( Direction.OUTGOING ) )
if ( relationDirection.equals( Direction.BOTH )
  || relationDirection.equals( Direction.INCOMING ) )

代码示例来源:origin: com.graphaware.neo4j/common

/**
 * Do the two directions match?
 *
 * @param direction1 one
 * @param direction2 two
 * @return true iff at least one of the directions is {@link org.neo4j.graphdb.Direction#BOTH} or they are equal.
 */
public static boolean matches(Direction direction1, Direction direction2) {
  return BOTH.equals(direction1) || BOTH.equals(direction2) || direction1.equals(direction2);
}

代码示例来源:origin: com.graphaware/neo4j-utils

/**
 * Do the two directions match?
 *
 * @param direction1 one
 * @param direction2 two
 * @return true iff at least one of the directions is {@link Direction#BOTH} or they are equal.
 */
public static boolean matches(Direction direction1, Direction direction2) {
  return BOTH.equals(direction1) || BOTH.equals(direction2) || direction1.equals(direction2);
}

代码示例来源:origin: com.graphaware/neo4j-tx-event-api

private boolean directionMatches(BatchRelationship batchRelationship) {
  if (Direction.BOTH.equals(direction)) {
    return true;
  }
  if (Direction.INCOMING.equals(direction) && nodeId == batchRelationship.getEndNode()) {
    return true;
  }
  if (Direction.OUTGOING.equals(direction) && nodeId == batchRelationship.getStartNode()) {
    return true;
  }
  return false;
}

代码示例来源:origin: neo4j-contrib/graph-collections

@Override
public Node getStartNode()
{
  return direction.equals(Direction.OUTGOING) ? indexedNode : keyValueRelationship.getEndNode();
}

代码示例来源:origin: org.neo4j/neo4j-graph-collections

@Override
public Node getEndNode()
{
  return direction.equals(Direction.OUTGOING) ? keyValueRelationship.getEndNode() : indexedNode;
}

代码示例来源:origin: org.neo4j/neo4j-graph-collections

@Override
public Node getStartNode()
{
  return direction.equals(Direction.OUTGOING) ? indexedNode : keyValueRelationship.getEndNode();
}

代码示例来源:origin: neo4j-contrib/graph-collections

@Override
public Node getEndNode()
{
  return direction.equals(Direction.OUTGOING) ? keyValueRelationship.getEndNode() : indexedNode;
}

代码示例来源:origin: org.neo4j/neo4j-graphdb-api

@Override
  public String relationshipRepresentation( T path, Node from, Relationship relationship )
  {
    Direction direction = relationship.getEndNode().equals( from ) ? Direction.INCOMING : Direction.OUTGOING;
    StringBuilder builder = new StringBuilder();
    if ( direction.equals( Direction.INCOMING ) )
    {
      builder.append( "<" );
    }
    builder.append( "-[" + (relId ? relationship.getId() : "") );
    String representation = representation( relationship );
    if ( relId && !representation.equals( "" ) )
    {
      builder.append( "," );
    }
    builder.append( representation );
    builder.append( "]-" );
    if ( direction.equals( Direction.OUTGOING ) )
    {
      builder.append( ">" );
    }
    return builder.toString();
  }
};

代码示例来源:origin: com.graphaware.neo4j/common

default boolean isOutgoing() {
  if (pointOfView() == null) {
    throw new IllegalStateException("Relationship expression contains a direction, but no information is available as to which node is looking.");
  }
  return OUTGOING.equals(DirectionUtils.resolveDirection(this, pointOfView(), OUTGOING));
}

代码示例来源:origin: com.graphaware.neo4j/common

default boolean isIncoming() {
    if (pointOfView() == null) {
      throw new IllegalStateException("Relationship expression contains a direction, but no information is available as to which node is looking.");
    }
    return INCOMING.equals(DirectionUtils.resolveDirection(this, pointOfView(), OUTGOING));
  }
}

代码示例来源:origin: maxdemarzi/graph_processing

public DegreeArrayStorageParallelSPI(GraphDatabaseService db, ExecutorService pool, Direction direction) {
  this.pool = pool;
  this.db = (GraphDatabaseAPI)db;
  this.nodeCount = new NodeCounter().getNodeCount(db);
  this.direction = direction;
  if (!direction.equals(Direction.BOTH)) {
    directionName = direction.name().toLowerCase() + "_";
  }
}

代码示例来源:origin: com.graphaware.neo4j/timetree

/**
 * {@inheritDoc}
 */
@Override
public boolean attachEvent(Node event, RelationshipType relationshipType, Direction direction, TimeInstant timeInstant) {
  if (!INCOMING.equals(direction) && !OUTGOING.equals(direction)) {
    throw new IllegalArgumentException("Direction must be INCOMING or OUTGOING!");
  }
  Node instant = timeTree.getOrCreateInstant(timeInstant);
  for (Relationship existing : event.getRelationships(DirectionUtils.reverse(direction), relationshipType)) {
    if (existing.getEndNode().getId() == instant.getId()) {
      return false;
    }
  }
  if (INCOMING.equals(direction)) {
    event.createRelationshipTo(instant, relationshipType);
    return true;
  }
  if (OUTGOING.equals(direction)) {
    instant.createRelationshipTo(event, relationshipType);
    return true;
  }
  throw new IllegalStateException("This must never happen - it is a bug");
}

代码示例来源:origin: org.neo4j/neo4j-graph-algo

if ( relationDirection.equals( Direction.BOTH )
  || relationDirection.equals( Direction.OUTGOING ) )
if ( relationDirection.equals( Direction.BOTH )
  || relationDirection.equals( Direction.INCOMING ) )

代码示例来源:origin: com.graphaware.neo4j/common

/**
 * Create a relationship if one doesn't already exist. Do nothing if one does exist.
 *
 * @param node1     first node.
 * @param node2     second node.
 * @param type      relationship type.
 * @param direction relationship direction from first node's point of view (can be BOTH).
 * @return the new or the existing relationship.
 */
public static Relationship createRelationshipIfNotExists(Node node1, Node node2, RelationshipType type, Direction direction) {
  Relationship existing = getSingleRelationshipOrNull(node1, node2, type, direction);
  if (existing == null) {
    if (Direction.INCOMING.equals(direction)) {
      return node2.createRelationshipTo(node1, type);
    }
    return node1.createRelationshipTo(node2, type);
  }
  return existing;
}

代码示例来源:origin: com.graphaware.neo4j/timetree

/**
 * Create a new instance of this {@link TimeTreeConfiguration} with different direction.
 *
 * @param direction of the new instance.
 * @return new instance.
 */
public TimeTreeConfiguration withDirection(final Direction direction) {
  if (!Direction.INCOMING.equals(direction) && !Direction.OUTGOING.equals(direction)) {
    throw new IllegalArgumentException("Direction must be INCOMING or OUTGOING!");
  }
  return new TimeTreeConfiguration(getInclusionPolicies().with(IncludeRelationships.all().with(relationshipType)), initializeUntil(), getTimestampProperty(), getCustomTimeTreeRootProperty(), getResolution(), getTimeZone(), getRelationshipType(), direction, isAutoAttach());
}

相关文章