private Index Subtract(Index that) { DepthIndex thatIndex = GetDepthFromIndex(that); if (!HasSameUnitAs(thatIndex)) { throw new ArgumentException("Cannot subtract depths with different types"); } return(new DepthIndex(Value - thatIndex.Value, Uom)); }
public override int CompareTo(Index that) { DepthIndex thatDepthIndex = GetDepthFromIndex(that); if (!HasSameUnitAs(thatDepthIndex)) { throw new ArgumentException("Cannot compare depths with different unit types"); } var isEqual = Math.Abs(Value - thatDepthIndex.Value) < Epsilon; return(isEqual ? 0 : Value.CompareTo(thatDepthIndex.Value)); }
public Row(string commaSeparated) { var row = commaSeparated.Split(","); if (DateTimeIndex.TryParseISODate(row.First(), out var witsmlDateTime)) { Index = witsmlDateTime; } else { Index = new DepthIndex(double.Parse(row.First(), CultureInfo.InvariantCulture)); } Values = row[1..].Select(CurveValue.From);
public Point(string commaSeparated) { var values = commaSeparated.Split(","); if (DateTimeIndex.TryParseISODate(values.First(), out var witsmlDateTime)) { Index = witsmlDateTime; } else { Index = new DepthIndex(double.Parse(values.First(), CultureInfo.InvariantCulture)); } Value = CurveValue.From(values[1]); }
private bool HasSameUnitAs(DepthIndex that) => Uom.Equals(that.Uom);