setOrdinate method

void setOrdinate(
  1. int ordinateIndex,
  2. double value
)
override

Sets the ordinate for the given index to a given value.

The base implementation supported values for the index are {@link X}, {@link Y}, and {@link Z}.

@param ordinateIndex the ordinate index @param value the value to set @throws IllegalArgumentException if the index is not valid

Implementation

void setOrdinate(int ordinateIndex, double value) {
  switch (ordinateIndex) {
    case Coordinate.X:
      x = value;
      break;
    case Coordinate.Y:
      y = value;
      break;
    case Coordinate.Z:
      z = value;
      break;
    case Coordinate.M:
      m = value;
      break;
    default:
      throw new ArgumentError("Invalid ordinate index: $ordinateIndex");
  }
}