override fun compareTo()

in src/commonMain/kotlin/org/intellij/markdown/parser/TreeBuilder.kt [97:118]


        override fun compareTo(other: MyEvent): Int {
            if (position != other.position) {
                return position - other.position
            }
            if (isStart() == other.isStart()) {
                val positionDiff = info.range.first + info.range.last - (other.info.range.first + other.info.range.last)
                if (positionDiff != 0) {
                    if (isEmpty() || other.isEmpty()) {
                        return positionDiff
                    }
                    return -positionDiff
                }

                val timeDiff = timeClosed - other.timeClosed
                return if (isStart()) {
                    -timeDiff
                } else {
                    timeDiff
                }
            }
            return if (isStart()) 1 else -1
        }