manueldidonna / pokemon-save-editor-android

A work-in-progress pokémon save editor for Android
GNU General Public License v3.0
0 stars 0 forks source link

Introduce Storage System #22

Closed manueldidonna closed 4 years ago

manueldidonna commented 4 years ago

Replace StorageCollection with StorageSystem

/**
 * A collection of [Storage] with a fixed capacity given by [storageIndices] size.
 */
interface StorageSystem {
    /**
     * Indices of the [Storage] containted in the system.
     */
    val storageIndices: IntRange

    /**
     * Return a [Storage] instance.
     *
     * Should throw an [IllegalStateException] if [index] isn't contained in [storageIndices]
     */
    operator fun get(index: Int): Storage

    /**
     * Replaces the storage at the specified [index] with the specified [storage].
     *
     * Should throw an [IllegalStateException] if [index] isn't contained in [storageIndices]
     */
    operator fun set(index: Int, storage: Storage)
}