Skip to content

kiwi.lang.KObject

Nikos Siatras edited this page Oct 9, 2022 · 9 revisions

KObject is the building block of Kiwi. Every User Defined Type (UDT) must inherit KObject in order to work properly with collections and other Kiwi's features. In the following example we create a Student User Defined Type (UDT) in which we inherit KObject using the extends keyword.

#include once "kiwi\kiwi.bi"

' In this example we will create an ArrayList that holds Students
Type Student extends KObject ' Always inherit from KObject for all UDTs
	firstName as String
	lastName As String
	grade as Double
End Type

KObject exists in kiwi\lang\KObject.bi file

KObject.wait()

sub KObject.wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

KObject.wait(LongInt)

sub KObject.wait(timeoutMillis as LongInt)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

Parameters:
@param timeoutMillis is the maximum time to wait, in milliseconds

KObject.notify()

sub KObject.notify()

Wakes up a single thread that is waiting on this object's monitor. If any threads are waiting on this object, one of them is chosen to be awakened. The choice is arbitrary and occurs at the discretion of the implementation. A thread waits on an object's monitor by calling one of the wait methods.

KObject.toString()

function KObject.toString() as String

Returns a string representation of this KObject.

KObject.getUniqueID()

function KObject.getUniqueID() as UInteger

Returns a unique UInteger ID of this KObject