Package edu.claflin.finder.logic.comp

# Class EdgeWeightComparator

java.lang.Object
edu.claflin.finder.logic.comp.EdgeWeightComparator

All Implemented Interfaces:
  `Comparator<Edge>`

public class EdgeWeightComparator extends Object implements Comparator<Edge>
A simple edge weight comparator in which the edge data is considered a numeric value and used as the comparison benchmark.

Version:
  3.0 February 4, 2016
Author:
  Charles Allen Schultz II

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `private final boolean`
  `ascending`
  Indicates if the comparator should sort elements in ascending order.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EdgeWeightComparator(boolean ascending)`
  Constructs an EdgeWeightComparator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compare(Edge e1, Edge e2)`
  Compares the edges based on the D data held by the edge.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.Comparator

  `equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- ## Field Details

  - ### ascending

    private final boolean ascending
    Indicates if the comparator should sort elements in ascending order.

- ## Constructor Details

  - ### EdgeWeightComparator

    public EdgeWeightComparator(boolean ascending)
    Constructs an EdgeWeightComparator.
    Parameters:
      `ascending` - boolean indicating if edges should be sorted in ascending order.

- ## Method Details

  - ### compare

    public int compare(Edge e1, Edge e2)
    Compares the edges based on the D data held by the edge. Assumes the data is a numeric value.
    Specified by:
      `compare` in interface `Comparator<Edge>`
    Parameters:
      `e1` - the first edge to compare.
      `e2` - the second edge to compare.
    Returns:
      -1, 0, or 1 if the first edge is ordered before, the same as, or after the second.