Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
Updated KDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
manami-project committed Jun 21, 2024
1 parent e9a7aa6 commit 5018aa5
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package io.github.manamiproject.modb.extension.score
sealed class RawScoreReturnValue

/**
* Indicates that no score has been found.
* Indicates that no raw score has been found.
* @since 1.0.0
*/
data object NoRawScore: RawScoreReturnValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.github.manamiproject.modb.core.extensions.neitherNullNorBlank
sealed class RawSynopsisReturnValue

/**
* Indicates that a synopsis was not found.
* Indicates that a raw synopsis was not found.
* @since 1.0.0
*/
data object NoRawSynopsis: RawSynopsisReturnValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import io.github.manamiproject.modb.extension.*
import java.net.URI

/**
* Retrieves scores.
* @since 1.0.0
* @property origin
* @property fileAccessor
* @property origin Defines the location where to find the score.
* @property fileAccessor Reads the [ExtensionData] file.
*/
public class DefaultScoreReader(
private val origin: Origin<*>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.github.manamiproject.modb.extension.score

import io.github.manamiproject.modb.core.extensions.EMPTY
import io.github.manamiproject.modb.extension.*
import java.net.URI
import java.time.Clock
import java.time.LocalDate
import java.time.format.DateTimeFormatter.ISO_LOCAL_DATE

/**
* Adds scores to [ExtensionData] files.
* @since 1.0.0
* @property directory
* @property fileAccessor
* @property clock
* @property directory Local directory on which the [ExtensionData] file is saved.
* @property fileAccessor Reads the [ExtensionData] file.
* @property clock Clock to determine lastUpdate.
*/
public class DefaultScoreWriter(
private val directory: LocalFileOrigin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import java.time.LocalDate
import java.time.format.DateTimeFormatter.ISO_LOCAL_DATE

/**
* Return for trying to retrieve a score.
* @since 1.0.0
*/
public sealed class ScoreReturnValue

/**
* Indicates that no score has been found.
* @since 1.0.0
*/
public data object ScoreNotFound: ScoreReturnValue()

/**
* Aggregated score across all available meta data providers.
* @since 1.0.0
* @param arithmeticMean
* @param arithmeticGeometricMean
* @param median
* @param lastUpdate
* @param arithmeticMean aithmetic mean
* @param arithmeticGeometricMean arithmetic-geometric-mean
* @param median median
* @param lastUpdate Date of creation.
*/
public data class Score(
val arithmeticMean: Double = 0.0,
Expand All @@ -35,6 +38,7 @@ public data class Score(
}

/**
* Last update as [LocalDate].
* @since 1.0.0
*/
val lastUpdatedAt: LocalDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import io.github.manamiproject.modb.core.models.Anime
import java.net.URI

/**
* Find score for an anime.
* @since 1.0.0
*/
public interface ScoreReader {

/**
* Find a score for an anime.
* @since 1.0.0
* @param sources
* @return
* @param sources List of [URI] identifying an anime as seen in the "sources" array in anime-offline-database.
* @return Either the [Score] or [ScoreNotFound] creating a score was not possible.
*/
public suspend fun findScore(sources: Collection<URI>): ScoreReturnValue

/**
* Find a score for an anime.
* @since 1.0.0
* @param anime
* @return
* @param anime Anime instance.
* @return Either the [Score] or [ScoreNotFound] creating a score was not possible.
*/
public suspend fun findScore(anime: Anime): ScoreReturnValue = findScore(anime.sources)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import io.github.manamiproject.modb.core.models.Anime
import java.net.URI

/**
* Adds a score to an extension data file.
* @since 1.0.0
*/
public interface ScoreWriter {

/**
* Adds a score to an extension data file.
* @since 1.0.0
* @param sources
* @param score
* @param sources List of [URI] identifying an anime as seen in the "sources" array in anime-offline-database.
* @param score [Score] to save.
*/
public suspend fun saveOrUpdateScore(sources: Collection<URI>, score: Score)

/**
* Adds a score to an extension data file.
* @since 1.0.0
* @param anime
* @param score
* @param anime Anime instance.
* @param score [Score] to save.
*/
public suspend fun saveOrUpdateScore(anime: Anime, score: Score): Unit = saveOrUpdateScore(anime.sources, score)
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.manamiproject.modb.extension.synopsis

import io.github.manamiproject.modb.extension.*
import io.github.manamiproject.modb.extension.DefaultFileAccessor
import java.net.URI

/**
* Retrieves synopsis.
* @since 1.0.0
* @property origin
* @property fileAccessor
* @property origin Defines the location where to find the score.
* @property fileAccessor Reads the [ExtensionData] file.
*/
public class DefaultSynopsisReader(
private val origin: Origin<*>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package io.github.manamiproject.modb.extension.synopsis

import io.github.manamiproject.modb.core.extensions.EMPTY
import io.github.manamiproject.modb.extension.*
import java.net.URI
import java.time.Clock
import java.time.LocalDate
import java.time.format.DateTimeFormatter.ISO_LOCAL_DATE

/**
* Adds synopsis to [ExtensionData] files.
* @since 1.0.0
* @property directory
* @property fileAccessor
* @property clock
* @property directory Local directory on which the [ExtensionData] file is saved.
* @property fileAccessor Reads the [ExtensionData] file.
* @property clock Clock to determine lastUpdate.
*/
public class DefaultSynopsisWriter(
private val directory: LocalFileOrigin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ import java.time.LocalDate
import java.time.format.DateTimeFormatter.ISO_LOCAL_DATE

/**
* Return for trying to retrieve a synopsis.
* @since 1.0.0
*/
public sealed class SynopsisReturnValue

/**
* Indicates that no synopsis has been found.
* @since 1.0.0
*/
public data object SynopsisNotFound: SynopsisReturnValue()

/**
* Synopsis created by an LLM.
* @since 1.0.0
* @property text
* @property author
* @property lastUpdate
* @property text Synopsis.
* @property author Author
* @property lastUpdate Date of creation.
*/
public data class Synopsis(
val text: String = EMPTY,
Expand All @@ -31,6 +34,7 @@ public data class Synopsis(
}

/**
* Last update as [LocalDate].
* @since 1.0.0
*/
val lastUpdatedAt: LocalDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import io.github.manamiproject.modb.core.models.Anime
import java.net.URI

/**
* Find a synopsis for an anime.
* @since 1.0.0
*/
public interface SynopsisReader {

/**
* Find a synopsis for an anime.
* @since 1.0.0
* @param sources
* @return
* @param sources List of [URI] identifying an anime as seen in the "sources" array in anime-offline-database.
* @return Either the [Synopsis] or [SynopsisNotFound] creating a score was not possible.
*/
public suspend fun findSynopsis(sources: Collection<URI>): SynopsisReturnValue

/**
* Find a synopsis for an anime.
* @since 1.0.0
* @param anime
* @return
* @param anime Anime instance.
* @return Either the [Synopsis] or [SynopsisNotFound] creating a score was not possible.
*/
public suspend fun findSynopsis(anime: Anime): SynopsisReturnValue = findSynopsis(anime.sources)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import io.github.manamiproject.modb.core.models.Anime
import java.net.URI

/**
* Adds a synopsis to an extension data file.
* @since 1.0.0
*/
public interface SynopsisWriter {

/**
* Adds a score to an extension data file.
* @since 1.0.0
* @param sources
* @param synopsis
* @param sources List of [URI] identifying an anime as seen in the "sources" array in anime-offline-database.
* @param synopsis [Synopsis] to save.
*/
public suspend fun saveOrUpdateSynopsis(sources: Collection<URI>, synopsis: Synopsis)

/**
* Adds a score to an extension data file.
* @since 1.0.0
* @param anime
* @param synopsis
* @param anime Anime instance.
* @param synopsis [Synopsis] to save.
*/
public suspend fun saveOrUpdateSynopsis(anime: Anime, synopsis: Synopsis): Unit = saveOrUpdateSynopsis(anime.sources, synopsis)
}

0 comments on commit 5018aa5

Please sign in to comment.