All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.stapi.graphoperations.graphbuilder.specific.removal.RemovalEdgeBuilder Maven / Gradle / Ivy

There is a newer version: 0.3.2
Show newest version
package ai.stapi.graphoperations.graphbuilder.specific.removal;

import ai.stapi.graphoperations.graphbuilder.exception.GraphBuilderException;
import ai.stapi.graph.graphElementForRemoval.EdgeForRemoval;
import ai.stapi.identity.UniqueIdentifier;

public class RemovalEdgeBuilder implements GraphElementForRemovalBuilder {

  private UniqueIdentifier id;
  private String type;

  @Override
  public RemovalEdgeBuilder setId(UniqueIdentifier id) {
    this.id = id;
    return this;
  }

  public RemovalEdgeBuilder setId(String id) {
    this.id = new UniqueIdentifier(id);
    return this;
  }

  @Override
  public RemovalEdgeBuilder setType(String type) {
    this.type = type;
    return this;
  }

  @Override
  public boolean isComplete() {
    return this.id != null && this.type != null;
  }

  @Override
  public EdgeForRemoval build() {
    if (!this.isComplete()) {
      throw GraphBuilderException.becauseNodeIsMissingIdOrType();
    }
    return new EdgeForRemoval(this.id, this.type);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy