Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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);
Ejemplo n.º 4
0
        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]);
        }
Ejemplo n.º 5
0
 private bool HasSameUnitAs(DepthIndex that) => Uom.Equals(that.Uom);