-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
10 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
package trufflestg.frame | ||
|
||
import com.oracle.truffle.api.frame.FrameSlotTypeException | ||
|
||
class SimpleDataFrame(vararg val data: Any?) { | ||
fun getValue(slot: Slot) = data[slot] | ||
fun getSize() = data.size | ||
@Throws(FrameSlotTypeException::class) | ||
fun getDouble(slot: Slot) = data[slot] as? Double ?: throw FrameSlotTypeException() | ||
fun isDouble(slot: Slot) = data[slot] is Double | ||
@Throws(FrameSlotTypeException::class) | ||
fun getFloat(slot: Slot) = data[slot] as? Float ?: throw FrameSlotTypeException() | ||
fun isFloat(slot: Slot) = data[slot] is Float | ||
@Throws(FrameSlotTypeException::class) | ||
fun getInteger(slot: Slot) = data[slot] as? Int ?: throw FrameSlotTypeException() | ||
fun isInteger(slot: Slot) = data[slot] is Int | ||
@Throws(FrameSlotTypeException::class) | ||
fun getLong(slot: Slot) = data[slot] as? Long ?: throw FrameSlotTypeException() | ||
@Throws(FrameSlotTypeException::class) | ||
fun getObject(slot: Slot) = data[slot]?.takeIf(Companion::isSimpleObject) ?: throw FrameSlotTypeException() | ||
fun isObject(slot: Slot) = data[slot].let { it != null && isSimpleObject(it) } | ||
companion object { | ||
private fun isSimpleObject(it: Any): Boolean = it !is Double && it !is Long && it !is Float && it !is Int | ||
} | ||
} | ||
class SimpleDataFrame(vararg val data: Any?) : DataFrame { | ||
override fun getValue(slot: Slot) = data[slot] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters