Skip to content

Commit

Permalink
Refactor model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
BilledTrain380 committed Aug 9, 2018
1 parent 9c11e16 commit b6b9770
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ data class Competitor(
val absent: Boolean,
val address: String,
val town: Town,
val clazz: Clazz,
val clazz: Group,
val results: List<Result>
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ import java.util.*
data class Discipline @JvmOverloads constructor(
val name: String,
val unit: String,
val discipline: Optional<String> = Optional.empty()
val distance: Optional<String> = Optional.empty()
)
23 changes: 6 additions & 17 deletions src/main/kotlin/ch/schulealtendorf/sporttagpsa/model/Gender.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,12 @@
package ch.schulealtendorf.sporttagpsa.model

/**
* Data class representing a gender.
* Enum representing a gender.
*
* @author nmaerchy
* @since 1.0.0
* @since 2.0.0
*/
data class Gender(
val value: Boolean = true
) {

companion object {
fun male() = Gender(true)
fun female() = Gender(false)
}

fun isMale() = value

fun isFemale() = !value

override fun toString() = if(value) "Knaben" else "Mädchen"
}
enum class Gender {
MALE,
FEMALE
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
package ch.schulealtendorf.sporttagpsa.model

/**
* Data class representing the class or category of a participant.
* Data class representing the group of a participant.
*
* @author nmaerchy
* @since 2.0.0
*/
data class Clazz(
data class Group(
val name: String,
val coach: Coach
)
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ data class Participant @JvmOverloads constructor(
val absent: Boolean,
val address: String,
val town: Town,
val clazz: Clazz,
val clazz: Group,
val sport: Optional<String> = Optional.empty()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2018 by Nicolas Märchy
*
* This file is part of Sporttag PSA.
*
* Sporttag PSA is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sporttag PSA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sporttag PSA. If not, see <http://www.gnu.org/licenses/>.
*
* Diese Datei ist Teil von Sporttag PSA.
*
* Sporttag PSA ist Freie Software: Sie können es unter den Bedingungen
* der GNU General Public License, wie von der Free Software Foundation,
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
* veröffentlichten Version, weiterverbreiten und/oder modifizieren.
*
* Sporttag PSA wird in der Hoffnung, dass es nützlich sein wird, aber
* OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
* Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
* Siehe die GNU General Public License für weitere Details.
*
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*
*
*/

package ch.schulealtendorf.sporttagpsa.model

/**
* @author nmaerchy <billedtrain380@gmail.com>
* @since 2.0.0
*/
enum class ParticipationStatus {
OPEN,
CLOSE,
RESET
}
2 changes: 0 additions & 2 deletions src/main/kotlin/ch/schulealtendorf/sporttagpsa/model/Sport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

package ch.schulealtendorf.sporttagpsa.model

@Deprecated("Sport is no longer an object but a string itself which acts as its ID")
data class Sport(
val id: Int,
val name: String
)

0 comments on commit b6b9770

Please sign in to comment.