All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.coner.crispyfish.query.RegistrationsQuery.kt Maven / Gradle / Ivy

There is a newer version: 0.5.7
Show newest version
package tech.coner.crispyfish.query

import tech.coner.crispyfish.filetype.ecf.EventControlFile
import tech.coner.crispyfish.filetype.registration.RegistrationFileException
import tech.coner.crispyfish.model.ClassDefinition
import tech.coner.crispyfish.model.Registration

class RegistrationsQuery(
        private val eventControlFile: EventControlFile,
        private val categories: List,
        private val handicaps: List
) {

    fun query(): List {
        val registrationFile = eventControlFile.registrationFile()
        val reader = registrationFile.columnReader()
        val mapper = registrationFile.mapper()
        val registrations = mutableListOf()
        for (i in reader.registrationLines.indices) {
            try {
                registrations += mapper.toRegistration(
                        categories = categories,
                        handicaps = handicaps,
                        reader = reader,
                        index = i
                )
            } catch (rfe: RegistrationFileException) {
                rfe.printStackTrace()
                continue
            }
        }
        return registrations
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy