Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jbr/#165 fix comaprasion in about table in jbr #24

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/main/kotlin/org/jetbrains/bio/genome/TrackAbout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TrackAboutStringColumnType(
override fun valueClass() = String::class.java

override fun comparator() = Comparator<String> { o1, o2 ->
o1.compareTo(o2)
o1.lowercase().compareTo(o2.lowercase())
}

infix fun to(path: Path?) = TrackAboutMetricValue(this, path?.toString() ?: "n/a")
Expand All @@ -55,6 +55,21 @@ class TrackAboutLongColumnType(
infix fun to(value: Int) = TrackAboutMetricValue(this, value.toLong())
}

class TrackAboutIntegerColumnType(
override val name: String
) : TrackAboutColumnType<Int> {
override fun valueClass() = Int::class.java

override fun render(value: Any?) = when (value) {
is Int -> value.toLong().formatLongNumber()
else -> super.render(value)
}

override fun comparator() = Comparator<Int> { o1, o2 ->
o1.compareTo(o2)
}
}

open class TrackAboutDoubleColumnType(
override val name: String
) : TrackAboutColumnType<Double> {
Expand Down