Пример #1
0
        public void CompareTo()
        {
            var tp1 = new TimePoint(100);
            var tp2 = new TimePoint(100);
            var tp3 = new TimePoint(200);

            Assert.True(tp1.CompareTo(tp1) == 0);
            Assert.True(tp1.CompareTo(tp2) == 0);
            Assert.True(tp1.CompareTo(tp3) == -1);
            Assert.True(tp3.CompareTo(tp1) == 1);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("WeakerAccess") public void validateTimePoints(com.alphatica.genotick.data.MainAppData data)
        public virtual void validateTimePoints(MainAppData data)
        {
            TimePoint first = data.FirstTimePoint;
            TimePoint last  = data.LastTimePoint;

            if (startTimePoint.CompareTo(first) < 0)
            {
                startTimePoint = first;
            }
            if (endTimePoint.CompareTo(last) > 0)
            {
                endTimePoint = last;
            }
        }
Пример #3
0
        private void fillFirstNumberAsTimePoint(int lineNumber, Number[] line)
        {
            TimePoint timePoint = new TimePoint(line[0].longValue());

            // Arrays start indexing from 0, but humans count text lines starting from 1.
            // New timePoint will be assigned to index = lineNumber -1, so
            // we have to check what happened two lines ago!
            if (lineNumber >= 2 && timePoint.CompareTo(timePoints[lineNumber - 2]) <= 0)
            {
                throw new DataException("Time (first number) is equal or less than previous. Line: " + lineNumber);
            }
            timePoints[lineNumber - 1] = timePoint;
        }