Skip to content

Commit

Permalink
[api]: Remove unnecessary JvmStatic annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Oct 26, 2024
1 parent 30c4780 commit d8290c0
Show file tree
Hide file tree
Showing 199 changed files with 425 additions and 518 deletions.
4 changes: 2 additions & 2 deletions api/src/main/kotlin/nebulosa/api/Nebulosa.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class Nebulosa : Runnable, AutoCloseable {

companion object {

@JvmStatic internal val LOG = loggerFor<Nebulosa>()
internal val LOG = loggerFor<Nebulosa>()

@JvmStatic private val OBJECT_MAPPER = jsonMapper {
private val OBJECT_MAPPER = jsonMapper {
addModule(JavaTimeModule())
addModule(PathModule())
addModule(DeviceModule())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ data class DARVJob(

companion object {

@JvmStatic private val LOG = loggerFor<DARVJob>()
@JvmStatic private val CAPTURE_SAVE_PATH = Files.createTempDirectory("darv-")
private val LOG = loggerFor<DARVJob>()
private val CAPTURE_SAVE_PATH = Files.createTempDirectory("darv-")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ data class TPPAJob(

const val MAX_ATTEMPTS = 30

@JvmStatic private val MIN_EXPOSURE_TIME = Duration.ofSeconds(1L)
@JvmStatic private val SETTLE_TIME = Duration.ofSeconds(5)
@JvmStatic private val CAPTURE_SAVE_PATH = Files.createTempDirectory("tppa-")
@JvmStatic private val LOG = loggerFor<TPPAJob>()
private val MIN_EXPOSURE_TIME = Duration.ofSeconds(1L)
private val SETTLE_TIME = Duration.ofSeconds(5)
private val CAPTURE_SAVE_PATH = Files.createTempDirectory("tppa-")
private val LOG = loggerFor<TPPAJob>()
}
}
1 change: 0 additions & 1 deletion api/src/main/kotlin/nebulosa/api/atlas/BodyPosition.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ data class BodyPosition(

companion object {

@JvmStatic
fun of(element: HorizonsElement): BodyPosition {
val lightTime = element.asDouble(HorizonsQuantity.ONE_WAY_LIGHT_TIME)
var distance = lightTime * (SPEED_OF_LIGHT * 0.06) // km
Expand Down
5 changes: 2 additions & 3 deletions api/src/main/kotlin/nebulosa/api/atlas/CloseApproach.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ data class CloseApproach(

companion object {

@JvmStatic val EMPTY = CloseApproach()
val EMPTY = CloseApproach()

@JvmStatic private val DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-LLL-dd HH:mm", Locale.ENGLISH)
private val DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-LLL-dd HH:mm", Locale.ENGLISH)

@JvmStatic
fun of(body: SmallBodyIdentified): List<CloseApproach> {
val data = ArrayList<CloseApproach>(body.count)

Expand Down
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/atlas/IERSUpdateTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ class IERSUpdateTask(
const val IERSA_UPDATED_AT_KEY = "IERSA.UPDATED_AT"
const val IERSB_UPDATED_AT_KEY = "IERSB.UPDATED_AT"

@JvmStatic private val LOG = loggerFor<IERSUpdateTask>()
private val LOG = loggerFor<IERSUpdateTask>()
}
}
6 changes: 3 additions & 3 deletions api/src/main/kotlin/nebulosa/api/atlas/LibWCSDownloadTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ class LibWCSDownloadTask(
const val LINUX_AARCH_64 = "linux-aarch64"
const val WIN_32_X86_64 = "win32-x86-64"

@JvmStatic private val LOG = loggerFor<LibWCSDownloadTask>()
private val LOG = loggerFor<LibWCSDownloadTask>()

@JvmStatic private val LIBRARY_URLS = mapOf(
private val LIBRARY_URLS = mapOf(
LINUX_X86_64 to "https://raw.githubusercontent.com/tiagohm/nebulosa.data/main/libs/wcs/$LINUX_X86_64/libwcs.so",
LINUX_AARCH_64 to "https://raw.githubusercontent.com/tiagohm/nebulosa.data/main/libs/wcs/$LINUX_AARCH_64/libwcs.so",
WIN_32_X86_64 to "https://raw.githubusercontent.com/tiagohm/nebulosa.data/main/libs/wcs/$WIN_32_X86_64/libwcs.dll",
)

@JvmStatic private val LIBRARY_CHECKSUM = mapOf(
private val LIBRARY_CHECKSUM = mapOf(
LINUX_X86_64 to "ca74289426e9536eb8a38b6fe866d3bb8478400424f6652f7d9db007fee342f4",
LINUX_AARCH_64 to "8a5d14a22dcb9656b32519167a98ad2489cfd9262a4336ac3717a2eb3bf7354e",
WIN_32_X86_64 to "65ee5696485a1b2bdc5248a581bb43c947615f95051dd7efca669da475b775ab",
Expand Down
3 changes: 1 addition & 2 deletions api/src/main/kotlin/nebulosa/api/atlas/MinorPlanet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ data class MinorPlanet(

companion object {

@JvmStatic val EMPTY = MinorPlanet()
val EMPTY = MinorPlanet()

@JvmStatic
fun of(body: SmallBody): MinorPlanet {
if (body.orbit != null) {
val items = arrayListOf<OrbitalPhysicalParameter>()
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/atlas/MoonPhase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ data class MoonPhase(

companion object {

@JvmStatic val EMPTY = MoonPhase()
val EMPTY = MoonPhase()
}
}
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/atlas/MoonPhaseFinder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MoonPhaseFinder(private val horizonsService: HorizonsService) {

companion object {

@JvmStatic private val QUANTITIES = arrayOf(HorizonsQuantity.OBSERVER_ECLIPTIC_LONGITUDE)
private val QUANTITIES = arrayOf(HorizonsQuantity.OBSERVER_ECLIPTIC_LONGITUDE)

private fun HorizonsElement.eclipticLongitude(): Double {
return this[HorizonsQuantity.OBSERVER_ECLIPTIC_LONGITUDE]!!.toDouble().deg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ enum class SatelliteGroupType(

companion object {

@JvmStatic
fun codeOf(entries: List<SatelliteGroupType>): Long {
return entries.fold(0L) { a, b -> a or (1L shl b.ordinal) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ class SatelliteUpdateTask(
const val UPDATE_INTERVAL = 1000L * 60 * 60 * 24 * 2 // 2 days in ms
const val UPDATED_AT_KEY = "SATELLITES.UPDATED_AT"

@JvmStatic private val LOG = loggerFor<SatelliteUpdateTask>()
private val LOG = loggerFor<SatelliteUpdateTask>()
}
}
9 changes: 2 additions & 7 deletions api/src/main/kotlin/nebulosa/api/atlas/SkyAtlasService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -280,34 +280,29 @@ class SkyAtlasService(
private const val SUN = "10"
private const val MOON = "301"

@JvmStatic private val FAST_MOON = VSOP87E.EARTH + ELPMPP02
@JvmStatic private val MOON_PHASE_DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:00")
private val FAST_MOON = VSOP87E.EARTH + ELPMPP02
private val MOON_PHASE_DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:00")

@JvmStatic
private fun GeographicCoordinate.geographicPosition() = when (this) {
is GeographicPosition -> this
else -> Geoid.IERS2010.lonLat(this)
}

@JvmStatic
private fun GeographicCoordinate.offsetInSeconds() = when (this) {
is TimeZonedInSeconds -> offsetInSeconds
else -> 0
}

@JvmStatic
private fun GeographicCoordinate.offsetInMinutes() = when (this) {
is Location -> offsetInMinutes
else -> offsetInSeconds() / 60
}

@JvmStatic
private fun List<HorizonsElement>.withLocationAndDateTime(location: GeographicCoordinate, dateTime: LocalDateTime): HorizonsElement? {
val offsetInMinutes = location.offsetInMinutes().toLong()
return let { HorizonsElement.of(it, dateTime.minusMinutes(offsetInMinutes)) }
}

@JvmStatic
private fun BufferedImage.removeBackground(): BufferedImage {
val output = BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ class SkyAtlasUpdateTask(
const val DATA_URL = "https://raw.githubusercontent.com/tiagohm/nebulosa.data/main/simbad/simbad.%02d.dat"
const val MAX_DATA_COUNT = 100

@JvmStatic private val LOG = loggerFor<SkyAtlasUpdateTask>()
private val LOG = loggerFor<SkyAtlasUpdateTask>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ class BodyEphemerisProvider(private val executor: ExecutorService) : CachedEphem

companion object {

@JvmStatic private val LOG = loggerFor<BodyEphemerisProvider>()
private val LOG = loggerFor<BodyEphemerisProvider>()

private const val SUN_ILLUMINATED = 100.0
@JvmStatic private val SUN_ELONGATION = 0.0 to true
private val SUN_ELONGATION = 0.0 to true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract class CachedEphemerisProvider<T : Any> : EphemerisProvider<T> {

companion object {

@JvmStatic private val LOG = loggerFor<CachedEphemerisProvider<*>>()
@JvmStatic private val NOON = LocalTime.of(12, 0, 0, 0)
private val LOG = loggerFor<CachedEphemerisProvider<*>>()
private val NOON = LocalTime.of(12, 0, 0, 0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class HorizonsEphemerisProvider(private val horizonsService: HorizonsService) :

companion object {

@JvmStatic private val LOG = loggerFor<HorizonsEphemerisProvider>()
private val LOG = loggerFor<HorizonsEphemerisProvider>()

@JvmStatic private val QUANTITIES = arrayOf(
private val QUANTITIES = arrayOf(
HorizonsQuantity.ASTROMETRIC_RA, HorizonsQuantity.ASTROMETRIC_DEC,
HorizonsQuantity.APPARENT_RA, HorizonsQuantity.APPARENT_DEC,
HorizonsQuantity.APPARENT_AZ, HorizonsQuantity.APPARENT_ALT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AutoFocusEventChartSerializer : StdSerializer<AutoFocusEvent.Chart>(AutoFo
}
}

@JvmStatic
private fun TrendLineFitting.Curve?.serialize(gen: JsonGenerator, points: DoubleArray) {
serializeAsFittedCurve(gen, "trendLine") {
it.left.serialize(gen, "left", points)
Expand All @@ -60,7 +59,6 @@ class AutoFocusEventChartSerializer : StdSerializer<AutoFocusEvent.Chart>(AutoFo
}
}

@JvmStatic
private fun TrendLine.serialize(gen: JsonGenerator, fieldName: String, points: DoubleArray) {
gen.writeObjectFieldStart(fieldName)
gen.writeNumberField("slope", slope)
Expand All @@ -74,7 +72,6 @@ class AutoFocusEventChartSerializer : StdSerializer<AutoFocusEvent.Chart>(AutoFo
gen.writeEndObject()
}

@JvmStatic
private fun QuadraticFitting.Curve?.serialize(gen: JsonGenerator, points: DoubleArray) {
serializeAsFittedCurve(gen, "parabolic") {
if (it.rSquared.isRSquaredValid()) {
Expand All @@ -83,7 +80,6 @@ class AutoFocusEventChartSerializer : StdSerializer<AutoFocusEvent.Chart>(AutoFo
}
}

@JvmStatic
private fun HyperbolicFitting.Curve?.serialize(gen: JsonGenerator, points: DoubleArray) {
serializeAsFittedCurve(gen, "hyperbolic") {
gen.writeNumberField("a", it.a)
Expand All @@ -96,7 +92,6 @@ class AutoFocusEventChartSerializer : StdSerializer<AutoFocusEvent.Chart>(AutoFo
}
}

@JvmStatic
private fun Curve.makePoints(gen: JsonGenerator, points: DoubleArray) {
gen.writeArrayFieldStart("points")

Expand Down
6 changes: 3 additions & 3 deletions api/src/main/kotlin/nebulosa/api/autofocus/AutoFocusJob.kt
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ data class AutoFocusJob(

companion object {

@JvmStatic private val MIN_EXPOSURE_TIME = Duration.ofSeconds(1L)
@JvmStatic private val CAPTURE_SAVE_PATH = Files.createTempDirectory("af-")
@JvmStatic private val LOG = loggerFor<AutoFocusJob>()
private val MIN_EXPOSURE_TIME = Duration.ofSeconds(1L)
private val CAPTURE_SAVE_PATH = Files.createTempDirectory("af-")
private val LOG = loggerFor<AutoFocusJob>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CalibrationFrameService(private val calibrationFrameRepository: Calibratio
if (darkImage != null || biasImage != null || flatImage != null) {
var transformedImage = if (createNew) image.clone() else image

// If not using dark frames.
// If not using dark frames.
if (biasImage != null) {
// Subtract Master Bias from Flat Frames.
if (flatImage != null) {
Expand Down Expand Up @@ -205,6 +205,6 @@ class CalibrationFrameService(private val calibrationFrameRepository: Calibratio

companion object {

@JvmStatic private val LOG = loggerFor<CalibrationFrameService>()
private val LOG = loggerFor<CalibrationFrameService>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ data class CameraCaptureJob(

companion object {

@JvmStatic private val LOG = loggerFor<CameraCaptureJob>()
private val LOG = loggerFor<CameraCaptureJob>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data class CameraCaptureNamingFormat(

companion object {

@JvmStatic val EMPTY = CameraCaptureNamingFormat()
@JvmStatic val DEFAULT = CameraCaptureNamingFormat(LIGHT_FORMAT, DARK_FORMAT, FLAT_FORMAT, BIAS_FORMAT)
val EMPTY = CameraCaptureNamingFormat()
val DEFAULT = CameraCaptureNamingFormat(LIGHT_FORMAT, DARK_FORMAT, FLAT_FORMAT, BIAS_FORMAT)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ data class CameraCaptureNamingFormatter(

companion object {

@JvmStatic private val REGEX = Regex("\\[(\\w+)(?::(\\w+))*]")
@JvmStatic private val ILLEGAL_CHARS_REGEX = Regex("[/\\\\:*?\"<>|]+")
@JvmStatic private val RA_FORMAT = AngleFormatter.HMS.newBuilder().secondsDecimalPlaces(0).build()
@JvmStatic private val DEC_FORMAT = AngleFormatter.SIGNED_DMS.newBuilder().secondsDecimalPlaces(0).separators("d", "m", "s").build()
private val REGEX = Regex("\\[(\\w+)(?::(\\w+))*]")
private val ILLEGAL_CHARS_REGEX = Regex("[/\\\\:*?\"<>|]+")
private val RA_FORMAT = AngleFormatter.HMS.newBuilder().secondsDecimalPlaces(0).build()
private val DEC_FORMAT = AngleFormatter.SIGNED_DMS.newBuilder().secondsDecimalPlaces(0).separators("d", "m", "s").build()

const val FLAT_FORMAT = "[camera]_[type]_[filter]_[width]_[height]_[bin]"
const val DARK_FORMAT = "[camera]_[type]_[width]_[height]_[exp]_[bin]_[gain]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum class CameraCaptureNamingType(private vararg val alias: String) {

companion object {

@JvmStatic
fun find(text: String): CameraCaptureNamingType? {
return entries.firstOrNull { it.name.equals(text, true) }
?: entries.firstOrNull { e -> e.alias.isNotEmpty() && e.alias.any { it.equals(text, true) } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ data class CameraExposureTask(

companion object {

@JvmStatic private val LOG = loggerFor<CameraExposureTask>()
private val LOG = loggerFor<CameraExposureTask>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ data class CameraLiveStackingManager(

companion object {

@JvmStatic private val LOG = loggerFor<CameraLiveStackingManager>()
private val LOG = loggerFor<CameraLiveStackingManager>()

private inline val Path.isCalibrationFrame
get() = exists() && isRegularFile() && (isFits() || isXisf())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class CameraSerializer : DeviceSerializer<Camera>(Camera::class.java), KoinCompo

companion object {

@JvmStatic
private fun JsonGenerator.writeMainOrGuideHead(camera: Camera, fieldName: String) {
writeObjectFieldStart(fieldName)
writeStringField("type", camera.type.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ data class CameraStartCaptureRequest(

const val MAX_EXPOSURE_AMOUNT = 10000

@JvmStatic val EMPTY = CameraStartCaptureRequest()
val EMPTY = CameraStartCaptureRequest()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class ConfirmationService(private val messageService: MessageService) {

companion object {

@JvmStatic private val LOG = loggerFor<ConfirmationService>()
private val LOG = loggerFor<ConfirmationService>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,6 @@ class ConnectionService(

companion object {

@JvmStatic private val LOG = loggerFor<ConnectionService>()
private val LOG = loggerFor<ConnectionService>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class DurationDeserializer(private val unit: ChronoUnit? = null) : StdDeserializ

companion object {

@JvmStatic private val DESERIALIZERS = mutableMapOf<ChronoUnit, DurationDeserializer>()
private val DESERIALIZERS = mutableMapOf<ChronoUnit, DurationDeserializer>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class DurationSerializer(private val unit: ChronoUnit? = null) : StdSerializer<D

companion object {

@JvmStatic private val SERIALIZERS = mutableMapOf<ChronoUnit, DurationSerializer>()
private val SERIALIZERS = mutableMapOf<ChronoUnit, DurationSerializer>()
}
}
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/core/FileLocker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ data class FileLocker(private val appDir: Path) {

companion object {

@JvmStatic private val LOG = loggerFor<FileLocker>()
private val LOG = loggerFor<FileLocker>()
}
}
2 changes: 1 addition & 1 deletion api/src/main/kotlin/nebulosa/api/devices/DeviceEventHub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ abstract class DeviceEventHub<D : Device, E : DeviceEvent<D>>(deviceType: Device

const val SEND_UPDATE_INTERVAL = 60000 // 1 min.

@JvmStatic private val LOG = loggerFor<DeviceEventHub<*, *>>()
private val LOG = loggerFor<DeviceEventHub<*, *>>()
}
}
Loading

0 comments on commit d8290c0

Please sign in to comment.