Opc.Ua.Server.StartEndAggregateCalculator.ComputeStartEnd C# (CSharp) Method

ComputeStartEnd() protected method

Calculate the Start and End aggregates for the timeslice.
protected ComputeStartEnd ( Opc.Ua.Server.TimeSlice slice, bool returnEnd ) : DataValue
slice Opc.Ua.Server.TimeSlice
returnEnd bool
return DataValue
        protected DataValue ComputeStartEnd(TimeSlice slice, bool returnEnd)
        {
            // get the values in the slice.
            List<DataValue> values = GetValues(slice);

            // check for empty slice.
            if (values == null || values.Count == 0)
            {
                return GetNoDataValue(slice);
            }

            // return start value.
            if (!returnEnd)
            {
                return values[0];
            }

            // return end value.
            else
            {
                return values[values.Count - 1];
            }
        }