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

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

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

Direction.values介绍

暂无

代码示例

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

private static Map<Direction, Collection<RelationshipType>> temporaryTypeMap()
{
  Map<Direction, Collection<RelationshipType>> map = new EnumMap<>( Direction.class );
  for ( Direction direction : Direction.values() )
  {
    map.put( direction, new ArrayList<>() );
  }
  return map;
}

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

@Override
public StandardExpander remove( RelationshipType type )
{
  Map<Direction, Collection<RelationshipType>> tempMap = temporaryTypeMapFrom( typesMap );
  for ( Direction direction : Direction.values() )
  {
    tempMap.get( direction ).remove( type );
  }
  return createNew( toTypeMap( tempMap ) );
}

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

private static Map<Direction, Collection<RelationshipType>> temporaryTypeMapFrom( Map<Direction,
    RelationshipType[]> typeMap )
{
  Map<Direction, Collection<RelationshipType>> map = new EnumMap<>( Direction.class );
  for ( Direction direction : Direction.values() )
  {
    ArrayList<RelationshipType> types = new ArrayList<>();
    map.put( direction, types );
    RelationshipType[] existing = typeMap.get( direction );
    if ( existing != null )
    {
      types.addAll( asList( existing ) );
    }
  }
  return map;
}

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

private void verifyRelationships( String message, Node root,
      boolean[] loop, Relationship... relationships )
  {
    for ( Direction dir : Direction.values() )
    {
      Set<Relationship> expected = new HashSet<>();
      for ( int i = 0; i < relationships.length; i++ )
      {
        if ( relationships[i] != null
            && (dir != Direction.INCOMING || loop[i]) )
        {
          expected.add( relationships[i] );
        }
      }

      for ( Relationship rel : root.getRelationships( dir ) )
      {
        assertTrue( message + ": unexpected relationship: " + rel,
            expected.remove( rel ) );
      }
      assertTrue( message + ": expected relationships not seen "
              + expected,
          expected.isEmpty() );
    }
  }
}

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

for ( int typeId = 0, relationshipId = 0; typeId < typeCount; typeId++ )
  for ( Direction direction : Direction.values() )

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

private void assertDegrees( Node node )
{
  for ( RelationshipType type : node.getRelationshipTypes() )
  {
    for ( Direction direction : Direction.values() )
    {
      long degree = node.getDegree( type, direction );
      long actualDegree = count( node.getRelationships( type, direction ) );
      assertEquals( actualDegree, degree );
    }
  }
}

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

NodeRelationshipCache cache = new NodeRelationshipCache( NumberArrayFactory.HEAP, denseNodeThreshold );
cache.setNodeCount( numberOfNodes + 1 );
Direction[] directions = Direction.values();
for ( int i = 0; i < numberOfNodes; i++ )

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

public static Direction parseDirection(String direction) {
  if (null == direction) {
    return Direction.BOTH;
  }
  try {
    return Direction.valueOf(direction.toUpperCase());
  } catch (Exception e) {
    throw new RuntimeException(format("Cannot convert value '%s' to Direction. Legal values are '%s'",
        direction, Arrays.toString(Direction.values())));
  }
}

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

@Test
public void canAddLoopRelationship()
{
  Node node = getGraphDb().createNode();
  node.createRelationshipTo( node, TEST );
  newTransaction();
  for ( Direction dir : Direction.values() )
  {
    int count = 0;
    for ( Relationship rel : node.getRelationships( dir ) )
    {
      count++;
      assertEquals( "start node", node, rel.getStartNode() );
      assertEquals( "end node", node, rel.getEndNode() );
      assertEquals( "other node", node, rel.getOtherNode( node ) );
    }
    assertEquals( dir.name() + " relationship count", 1, count );
  }
}

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

for ( Direction direction : Direction.values() )

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

private static Map<Direction, Collection<RelationshipType>> temporaryTypeMap()
{
  Map<Direction, Collection<RelationshipType>> map = new EnumMap<>( Direction.class );
  for ( Direction direction : Direction.values() )
  {
    map.put( direction, new ArrayList<>() );
  }
  return map;
}

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

private static Map<Direction, Collection<RelationshipType>> temporaryTypeMapFrom( Map<Direction,
    RelationshipType[]> typeMap )
{
  Map<Direction, Collection<RelationshipType>> map = new EnumMap<>( Direction.class );
  for ( Direction direction : Direction.values() )
  {
    ArrayList<RelationshipType> types = new ArrayList<>();
    map.put( direction, types );
    RelationshipType[] existing = typeMap.get( direction );
    if ( existing != null )
    {
      types.addAll( asList( existing ) );
    }
  }
  return map;
}

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

@Override
public StandardExpander remove( RelationshipType type )
{
  Map<Direction, Collection<RelationshipType>> tempMap = temporaryTypeMapFrom( typesMap );
  for ( Direction direction : Direction.values() )
  {
    tempMap.get( direction ).remove( type );
  }
  return createNew( toTypeMap( tempMap ) );
}

相关文章