IndexedObject.kt
TLDR
The IndexedObject.kt
file contains a Kotlin sealed class IndexedObject
with its subclasses IndexedClass
, IndexedInstance
, IndexedObjectArray
, and IndexedPrimitiveArray
. These classes represent different types of indexed objects in the Shark library.
Classes
IndexedObject
IndexedObject
is a sealed class that serves as the base class for different types of indexed objects in the Shark library. It has two abstract properties: position
and recordSize
.
IndexedClass
IndexedClass
is a subclass of IndexedObject
that represents an indexed class object. It contains additional properties such as superclassId
, instanceSize
, and fieldsIndex
.
IndexedInstance
IndexedInstance
is a subclass of IndexedObject
that represents an indexed instance object. It contains the classId
property to identify the class of the instance.
IndexedObjectArray
IndexedObjectArray
is a subclass of IndexedObject
that represents an indexed object array. It contains the arrayClassId
property to identify the class of the array.
IndexedPrimitiveArray
IndexedPrimitiveArray
is a subclass of IndexedObject
that represents an indexed primitive array. It contains the primitiveType
property to identify the type of the elements in the array.
package shark.internal
import shark.PrimitiveType
internal sealed class IndexedObject {
abstract val position: Long
abstract val recordSize: Long
class IndexedClass(
override val position: Long,
val superclassId: Long,
val instanceSize: Int,
override val recordSize: Long,
val fieldsIndex: Int
) : IndexedObject()
class IndexedInstance(
override val position: Long,
val classId: Long,
override val recordSize: Long
) : IndexedObject()
class IndexedObjectArray(
override val position: Long,
val arrayClassId: Long,
override val recordSize: Long
) : IndexedObject()
class IndexedPrimitiveArray(
override val position: Long,
primitiveType: PrimitiveType,
override val recordSize: Long
) : IndexedObject() {
private val primitiveTypeOrdinal: Byte = primitiveType.ordinal.toByte()
val primitiveType: PrimitiveType
get() = PrimitiveType.values()[primitiveTypeOrdinal.toInt()]
}
}