コード例 #1
0
ファイル: IdGraph.java プロジェクト: kdoore/blueprints
  public Edge addEdge(
      final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
    if (uniqueIds && null != id && null != getEdge(id)) {
      throw new IllegalArgumentException("Edge with given id already exists: " + id);
    }

    verifyNativeElement(outVertex);
    verifyNativeElement(inVertex);

    Edge base =
        baseGraph.addEdge(
            null,
            ((IdVertex) outVertex).getBaseVertex(),
            ((IdVertex) inVertex).getBaseVertex(),
            label);

    Object v = null == id ? edgeIdFactory.createId() : id;

    if (null == v) {
      base.removeProperty(ID);
    } else {
      base.setProperty(ID, v);
    }

    return new IdEdge(base);
  }
コード例 #2
0
ファイル: IdGraph.java プロジェクト: kdoore/blueprints
  public Vertex addVertex(final Object id) {
    if (uniqueIds && null != id && null != getVertex(id)) {
      throw new IllegalArgumentException("Vertex with given id already exists: '" + id + "'");
    }

    final Vertex base = baseGraph.addVertex(null);

    Object v = null == id ? vertexIdFactory.createId() : id;

    if (null == v) {
      base.removeProperty(ID);
    } else {
      base.setProperty(ID, v);
    }

    return new IdVertex(base);
  }
コード例 #3
0
 /** Helper für "buildCharElement". Setzt in einem CharElement alle notwendigen Felder */
 private void createCharElement(CharElement charElement) {
   charElement.setId(IdFactory.getInstance().getId(charElement.getClass(), null));
   charElement.setName("Unbenannt");
   charElement.setAnzeigen(true);
 }