Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0881f77a authored by Hai Zhang's avatar Hai Zhang
Browse files

Add kdoc for immutable data structure classes.

In addition to the existing Immutable.md.

Bug: 285432076
Test: presubmit
Change-Id: I77529bb4782db6cbe7b8a8f96890a78661aa9fc0
parent 4a12d7bd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.server.permission.access.immutable

/**
 * Immutable list with index-based access.
 */
sealed class IndexedList<T>(
    internal val list: ArrayList<T>
) : Immutable<MutableIndexedList<T>> {
@@ -34,6 +37,9 @@ sealed class IndexedList<T>(
    override fun toString(): String = list.toString()
}

/**
 * Mutable list with index-based access.
 */
class MutableIndexedList<T>(
    list: ArrayList<T> = ArrayList()
) : IndexedList<T>(list) {
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.server.permission.access.immutable

/**
 * Immutable set with index-based access, implemented using a list.
 */
sealed class IndexedListSet<T>(
    internal val list: ArrayList<T>
) : Immutable<MutableIndexedListSet<T>> {
@@ -36,6 +39,9 @@ sealed class IndexedListSet<T>(
    override fun toString(): String = list.toString()
}

/**
 * Mutable set with index-based access, implemented using a list.
 */
class MutableIndexedListSet<T>(
    list: ArrayList<T> = ArrayList()
) : IndexedListSet<T>(list) {
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ package com.android.server.permission.access.immutable

import android.util.ArrayMap

/**
 * Immutable map with index-based access.
 */
sealed class IndexedMap<K, V>(
    internal val map: ArrayMap<K, V>
) : Immutable<MutableIndexedMap<K, V>> {
@@ -42,6 +45,9 @@ sealed class IndexedMap<K, V>(
    override fun toString(): String = map.toString()
}

/**
 * Mutable map with index-based access.
 */
class MutableIndexedMap<K, V>(
    map: ArrayMap<K, V> = ArrayMap()
) : IndexedMap<K, V>(map) {
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,11 @@ package com.android.server.permission.access.immutable

import android.util.ArrayMap

/**
 * Immutable map with index-based access and mutable data structure values.
 *
 * @see MutableReference
 */
sealed class IndexedReferenceMap<K, I : Immutable<M>, M : I>(
    internal val map: ArrayMap<K, MutableReference<I, M>>
) : Immutable<MutableIndexedReferenceMap<K, I, M>> {
@@ -42,6 +47,11 @@ sealed class IndexedReferenceMap<K, I : Immutable<M>, M : I>(
    override fun toString(): String = map.toString()
}

/**
 * Mutable map with index-based access and mutable data structure values.
 *
 * @see MutableReference
 */
class MutableIndexedReferenceMap<K, I : Immutable<M>, M : I>(
    map: ArrayMap<K, MutableReference<I, M>> = ArrayMap()
) : IndexedReferenceMap<K, I, M>(map) {
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ package com.android.server.permission.access.immutable

import android.util.ArraySet

/**
 * Immutable set with index-based access.
 */
sealed class IndexedSet<T>(
    internal val set: ArraySet<T>
) : Immutable<MutableIndexedSet<T>> {
@@ -37,6 +40,9 @@ sealed class IndexedSet<T>(
    override fun toString(): String = set.toString()
}

/**
 * Mutable set with index-based access.
 */
class MutableIndexedSet<T>(
    set: ArraySet<T> = ArraySet()
) : IndexedSet<T>(set) {
Loading