Skip to content

Commit

Permalink
Equals Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ow1e committed Jun 13, 2024
1 parent 658f0ed commit eb4f93a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = 'com.github.ow1e'
version = '0.1.2'
version = '0.1.3'

repositories {
mavenCentral()
Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/coralis/led/animations/Flash.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@ class Flash(private val periodLength: Int, private val color: Triple<Int, Int, I
override fun toString(): String {
return "FLASH rgbf(${color.first}, ${color.second}, ${color.third}, $periodLength)"
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false

other as Flash

if (periodLength != other.periodLength) return false
if (color != other.color) return false

return true
}
}
12 changes: 12 additions & 0 deletions src/main/kotlin/coralis/led/animations/Pulse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,16 @@ class Pulse(
override fun toString(): String {
return "SOLID cs($color, $speed)"
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false

other as Pulse

if (color != other.color) return false
if (speed != other.speed) return false

return true
}
}
12 changes: 12 additions & 0 deletions src/main/kotlin/coralis/led/animations/Rainbow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,16 @@ class Rainbow(
override fun toString(): String {
return "RAINBOW bh($brightness, $hueChange)"
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false

other as Rainbow

if (brightness != other.brightness) return false
if (hueChange != other.hueChange) return false

return true
}
}
11 changes: 11 additions & 0 deletions src/main/kotlin/coralis/led/animations/Solid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,15 @@ class Solid(private val color: Triple<Int, Int, Int> = Triple(255, 255, 255)) :
override fun toString(): String {
return "SOLID rgb(${color.first}, ${color.second}, ${color.third})"
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false

other as Solid

if (color != other.color) return false

return true
}
}

0 comments on commit eb4f93a

Please sign in to comment.