compareLocationValuesStatic static method

int compareLocationValuesStatic(
  1. int componentIndex0,
  2. int segmentIndex0,
  3. double segmentFraction0,
  4. int componentIndex1,
  5. int segmentIndex1,
  6. double segmentFraction1,
)

Compares two sets of location values for order.

@param componentIndex0 a component index @param segmentIndex0 a segment index @param segmentFraction0 a segment fraction @param componentIndex1 another component index @param segmentIndex1 another segment index @param segmentFraction1 another segment fraction @return a negative integer, zero, or a positive integer as the first set of location values is less than, equal to, or greater than the second set of locationValues

Implementation

static int compareLocationValuesStatic(
    int componentIndex0,
    int segmentIndex0,
    double segmentFraction0,
    int componentIndex1,
    int segmentIndex1,
    double segmentFraction1) {
  // compare component indices
  if (componentIndex0 < componentIndex1) return -1;
  if (componentIndex0 > componentIndex1) return 1;
  // compare segments
  if (segmentIndex0 < segmentIndex1) return -1;
  if (segmentIndex0 > segmentIndex1) return 1;
  // same segment, so compare segment fraction
  if (segmentFraction0 < segmentFraction1) return -1;
  if (segmentFraction0 > segmentFraction1) return 1;
  // same location
  return 0;
}