Daily arc lint --take KTFMT

Reviewed By: adamjernst

Differential Revision: D41833756

fbshipit-source-id: 0ecc95aff3bdadadb0769dec55d27fb84fe50e95
This commit is contained in:
generatedunixname89002005325672
2022-12-12 07:51:03 -08:00
committed by Facebook GitHub Bot
parent 41c17ddd56
commit 0f089ea2db
7 changed files with 35 additions and 13 deletions
@@ -21,7 +21,7 @@ package com.facebook.react.common.mapbuffer
* Limitations:
* - Keys are usually sized as 2 bytes, with each buffer supporting up to 65536 entries as a result.
* - O(log(N)) random key access for native buffers due to selected structure. Faster access can be
* achieved by retrieving [MapBuffer.Entry] with [entryAt] on known offsets.
* achieved by retrieving [MapBuffer.Entry] with [entryAt] on known offsets.
*/
interface MapBuffer : Iterable<MapBuffer.Entry> {
companion object {
@@ -46,12 +46,14 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Number of elements inserted into current MapBuffer.
*
* @return number of elements in the [MapBuffer]
*/
val count: Int
/**
* Checks whether entry for given key exists in MapBuffer.
*
* @param key key to lookup the entry
* @return whether entry for the given key exists in the MapBuffer.
*/
@@ -60,6 +62,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides offset of the key to use for [entryAt], for cases when offset is not statically known
* but can be cached.
*
* @param key key to lookup offset for
* @return offset for the given key to be used for entry access, -1 if key wasn't found.
*/
@@ -67,14 +70,16 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed access to a MapBuffer without additional lookups for provided offset.
*
* @param offset offset of entry in the MapBuffer structure. Can be looked up for known keys with
* [getKeyOffset].
* [getKeyOffset].
* @return parsed entry for structured access for given offset
*/
fun entryAt(offset: Int): MapBuffer.Entry
/**
* Provides parsed [DataType] annotation associated with the given key.
*
* @param key key to lookup type for
* @return data type of the given key.
* @throws IllegalArgumentException if the key doesn't exist
@@ -83,6 +88,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [Boolean] value if the entry for given key exists with [DataType.BOOL] type
*
* @param key key to lookup [Boolean] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -92,6 +98,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [Int] value if the entry for given key exists with [DataType.INT] type
*
* @param key key to lookup [Int] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -101,6 +108,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [Double] value if the entry for given key exists with [DataType.DOUBLE] type
*
* @param key key to lookup [Double] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -110,6 +118,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [String] value if the entry for given key exists with [DataType.STRING] type
*
* @param key key to lookup [String] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -119,6 +128,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [MapBuffer] value if the entry for given key exists with [DataType.MAP] type
*
* @param key key to lookup [MapBuffer] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -129,6 +139,7 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Provides parsed [List<MapBuffer>] value if the entry for given key exists with [DataType.MAP]
* type
*
* @param key key to lookup [List<MapBuffer>] value for
* @return value associated with the requested key
* @throws IllegalArgumentException if the key doesn't exist
@@ -149,30 +160,35 @@ interface MapBuffer : Iterable<MapBuffer.Entry> {
/**
* Entry value represented as [Boolean]
*
* @throws IllegalStateException if the data type doesn't match [DataType.BOOL]
*/
val booleanValue: Boolean
/**
* Entry value represented as [Int]
*
* @throws IllegalStateException if the data type doesn't match [DataType.INT]
*/
val intValue: Int
/**
* Entry value represented as [Double]
*
* @throws IllegalStateException if the data type doesn't match [DataType.DOUBLE]
*/
val doubleValue: Double
/**
* Entry value represented as [String]
*
* @throws IllegalStateException if the data type doesn't match [DataType.STRING]
*/
val stringValue: String
/**
* Entry value represented as [MapBuffer]
*
* @throws IllegalStateException if the data type doesn't match [DataType.MAP]
*/
val mapBufferValue: MapBuffer
@@ -66,7 +66,7 @@ class ReadableMapBuffer : MapBuffer {
/**
* @param key Key to search for
* @return the "bucket index" for a key or -1 if not found. It uses a binary search algorithm
* (log(n))
* (log(n))
*/
private fun getBucketIndexForKey(intKey: Int): Int {
if (intKey !in KEY_RANGE) {
@@ -30,6 +30,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a boolean value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -38,6 +39,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds an int value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -46,6 +48,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a double value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -54,6 +57,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a string value for given key to the MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -62,6 +66,7 @@ class WritableMapBuffer : MapBuffer {
/**
* Adds a [MapBuffer] value for given key to the current MapBuffer.
*
* @param key entry key
* @param value entry value
* @throws IllegalArgumentException if key is out of [UShort] range
@@ -20,7 +20,7 @@ import com.facebook.react.ReactRootView
*
* @param fabricEnabled Whether Fabric should be enabled for the RootView of this Activity.
* @param concurrentRootEnabled Whether ConcurrentRoot (aka React 18) should be enabled for the
* RootView of this Activity.
* RootView of this Activity.
*/
open class DefaultReactActivityDelegate(
activity: ReactActivity,