com.tinkerpop.blueprints.Direction.equals()方法的使用及代码示例

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

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

Direction.equals介绍

暂无

代码示例

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public Direction opposite() {
    if (this.equals(OUT))
      return IN;
    else if (this.equals(IN))
      return OUT;
    else
      return BOTH;
  }
}

代码示例来源:origin: thinkaurelius/faunus

public long getVertexId(final Direction direction) {
  if (OUT.equals(direction)) {
    return this.outVertex;
  } else if (IN.equals(direction)) {
    return this.inVertex;
  } else {
    throw ExceptionFactory.bothIsNotSupported();
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public Vertex getVertex(final Direction direction) throws IllegalArgumentException {
  if (direction.equals(Direction.IN))
    return this.inVertex;
  else if (direction.equals(Direction.OUT))
    return this.outVertex;
  else
    throw ExceptionFactory.bothIsNotSupported();
}

代码示例来源:origin: thinkaurelius/faunus

public Set<String> getEdgeLabels(final Direction direction) {
  if (direction.equals(Direction.OUT))
    return this.outEdges.keySet();
  else if (direction.equals(Direction.IN))
    return this.inEdges.keySet();
  else {
    final Set<String> labels = new HashSet<String>();
    labels.addAll(this.outEdges.keySet());
    labels.addAll(this.inEdges.keySet());
    return labels;
  }
}

代码示例来源:origin: JHUAPL/AccumuloGraph

@Override
public Vertex getVertex(Direction direction) throws IllegalArgumentException {
 if (!Direction.IN.equals(direction) && !Direction.OUT.equals(direction)) {
  throw new IllegalArgumentException("Invalid direction: "+direction);
 }
 // The vertex information needs to be loaded.
 if (inVertex == null || outVertex == null || label == null) {
  log.debug("Loading information for edge: "+this);
  globals.getEdgeWrapper().loadEndpointsAndLabel(this);
 }
 return Direction.IN.equals(direction) ? inVertex : outVertex;
}

代码示例来源:origin: thinkaurelius/faunus

@Override
public void setup(final Mapper.Context context) throws IOException, InterruptedException {
  this.direction = context.getConfiguration().getEnum(FAUNUS_GRAPH_INPUT_EDGE_COPY_DIRECTION, Direction.OUT);
  if (this.direction.equals(Direction.BOTH))
    throw new InterruptedException(ExceptionFactory.bothIsNotSupported().getMessage());
}

代码示例来源:origin: thinkaurelius/faunus

public void addEdges(final Direction direction, final FaunusVertex vertex) {
  if (direction.equals(OUT) || direction.equals(BOTH)) {
    for (final String label : vertex.getEdgeLabels(OUT)) {
      this.addEdges(OUT, label, (List) vertex.getEdges(OUT, label));
    }
  }
  if (direction.equals(IN) || direction.equals(BOTH)) {
    for (final String label : vertex.getEdgeLabels(IN)) {
      this.addEdges(IN, label, (List) vertex.getEdges(IN, label));
    }
  }
}

代码示例来源:origin: thinkaurelius/faunus

public Vertex getVertex(final Direction direction) {
  if (OUT.equals(direction)) {
    return new FaunusVertex(this.outVertex);
  } else if (IN.equals(direction)) {
    return new FaunusVertex(this.inVertex);
  } else {
    throw ExceptionFactory.bothIsNotSupported();
  }
}

代码示例来源:origin: thinkaurelius/faunus

public void writeCompressed(final DataOutput out, final Direction idToWrite) throws IOException {
  super.write(out);
  if (idToWrite.equals(Direction.IN))
    WritableUtils.writeVLong(out, this.inVertex);
  else if (idToWrite.equals(Direction.OUT))
    WritableUtils.writeVLong(out, this.outVertex);
  else
    throw ExceptionFactory.bothIsNotSupported();
}

代码示例来源:origin: thinkaurelius/faunus

public void readFieldsCompressed(final DataInput in, final Direction idToRead) throws IOException {
  super.readFields(in);
  if (idToRead.equals(Direction.IN))
    this.inVertex = WritableUtils.readVLong(in);
  else if (idToRead.equals(Direction.OUT))
    this.outVertex = WritableUtils.readVLong(in);
  else
    throw ExceptionFactory.bothIsNotSupported();
  this.label = null;
}

代码示例来源:origin: thinkaurelius/faunus

@Override
public void setup(final Reduce.Context context) throws IOException, InterruptedException {
  this.direction = context.getConfiguration().getEnum(FAUNUS_GRAPH_INPUT_EDGE_COPY_DIRECTION, Direction.OUT);
  if (this.direction.equals(Direction.BOTH))
    throw new InterruptedException(ExceptionFactory.bothIsNotSupported().getMessage());
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-sparksee-graph

@Override
public Vertex getVertex(final Direction direction) {
  if (direction.equals(Direction.BOTH)) {
    throw ExceptionFactory.bothIsNotSupported();
  }
  
  graph.autoStartTransaction(false);
  setEdges();
  long vertexId = (direction.equals(Direction.OUT)) ? out : in;
  return new SparkseeVertex(graph, vertexId);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-sail-graph

public Iterable<Edge> getEdges(final Direction direction, final String... labels) {
  if (direction.equals(Direction.OUT)) {
    return this.getOutEdges(labels);
  } else if (direction.equals(Direction.IN))
    return this.getInEdges(labels);
  else {
    return new MultiIterable<Edge>(Arrays.asList(this.getInEdges(labels), this.getOutEdges(labels)));
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-sparksee-graph

public CloseableIterable<Vertex> getVertices(final Direction direction, final String... labels) {
  graph.autoStartTransaction(false);
  if (direction.equals(Direction.OUT)) {
    return this.getIterable(Vertex.class, SPARKSEE_OUT, labels);
  } else if (direction.equals(Direction.IN)) {
    return this.getIterable(Vertex.class, SPARKSEE_IN, labels);
  } else {
    return new MultiIterable<Vertex>(new ArrayList<Iterable<Vertex>>(
        Arrays.asList(this.getIterable(Vertex.class, SPARKSEE_IN, labels),
               this.getIterable(Vertex.class, SPARKSEE_OUT, labels))));
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-sparksee-graph

public CloseableIterable<Edge> getEdges(final Direction direction, final String... labels) {
  graph.autoStartTransaction(false);
  if (direction.equals(Direction.OUT)) {
    return this.getIterable(Edge.class, SPARKSEE_OUT, labels);
  } else if (direction.equals(Direction.IN)) {
    return this.getIterable(Edge.class, SPARKSEE_IN, labels);
  } else {
    return new MultiIterable<Edge>(new ArrayList<Iterable<Edge>>(
        Arrays.asList(this.getIterable(Edge.class, SPARKSEE_IN, labels), 
               this.getIterable(Edge.class, SPARKSEE_OUT, labels))));
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public Iterable<Edge> getEdges(final Direction direction, final String... labels) {
  if (direction.equals(Direction.OUT)) {
    return this.getOutEdges(labels);
  } else if (direction.equals(Direction.IN))
    return this.getInEdges(labels);
  else {
    return new MultiIterable<Edge>(Arrays.asList(this.getInEdges(labels), this.getOutEdges(labels)));
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-rexster-graph

public Iterable<Edge> getEdges(final Direction direction, final String... labels) {
  if (direction.equals(Direction.OUT)) {
    return this.getOutEdges(labels);
  } else if (direction.equals(Direction.IN))
    return this.getInEdges(labels);
  else {
    return new MultiIterable<Edge>(Arrays.asList(this.getInEdges(labels), this.getOutEdges(labels)));
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-sail-graph

public Vertex getVertex(final Direction direction) {
  if (direction.equals(Direction.OUT))
    return new SailVertex(this.rawEdge.getSubject(), this.graph);
  else if (direction.equals(Direction.IN))
    return new SailVertex(this.rawEdge.getObject(), this.graph);
  else
    throw ExceptionFactory.bothIsNotSupported();
}

代码示例来源:origin: thinkaurelius/faunus

@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
  this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
  if (!this.direction.equals(BOTH))
    this.direction = this.direction.opposite();
  this.labels = context.getConfiguration().getStrings(LABELS);
  this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-neo4j2-graph

public Vertex getVertex(final Direction direction) {
  this.graph.autoStartTransaction(false);
  if (direction.equals(Direction.OUT))
    return new Neo4j2Vertex(((Relationship) this.rawElement).getStartNode(), this.graph);
  else if (direction.equals(Direction.IN))
    return new Neo4j2Vertex(((Relationship) this.rawElement).getEndNode(), this.graph);
  else
    throw ExceptionFactory.bothIsNotSupported();
}

相关文章