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

salvo.jesus.graph.WeightedEdgeImpl Maven / Gradle / Ivy

Go to download

This is a modified version of the OpenJGraph library (https://sourceforge.net/projects/openjgraph/), used in the JInsect library.

The newest version!
package salvo.jesus.graph;

/**
 * Represents a weighted edge in a graph.
 *
 * @author		Jesus M. Salvo Jr.
 */
public class WeightedEdgeImpl extends EdgeImpl implements WeightedEdge{
  /**
   * The weight of the edge. The implementation of the WeightedEdge interface
   * is delegated to this object.
   */
  WeightedEdgeWeakImpl  weightOfEdge;

  /**
    * Creates an WeightedEdgeImpl object.
    *
    * @see		Vertex
    */
  public WeightedEdgeImpl( Vertex a, Vertex b, double weight ) {
    super( a, b );
    this.weightOfEdge = new WeightedEdgeWeakImpl( weight );
  }

  /**
   * Returns the weight of the edge.
   */
  public double getWeight() {
    return this.weightOfEdge.getWeight();
  }

  /**
   * Sets the weight of the edge.
   *
   * @param   weight    The new weight of the edge
   */
  public void setWeight( double weight ) {
    this.weightOfEdge.setWeight( weight );
  }

  public String toString(){
    return this.labelDelegator.getLabel();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy