Package com.yahoo.slime
Class Slime
java.lang.Object
com.yahoo.slime.Slime
Top-level value class that contains one Value data object and a
symbol table (shared between all directly or indirectly contained
ObjectValue data objects).
- Author:
- havardpe
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Tests whether the two Inspectors are equal.get()
Get a Cursor connected to the top-level data object.int
Add a name to the symbol table; if the name is already in the symbol table just returns the id it already had.inspect
(int symbol) Return the symbol name associated with an id.int
Find the id associated with a symbol name; if the name was not in the symbol table returns the constant Integer.MAX_VALUE instead.setArray()
Create a new array value and make it the new top-level data object.setBool
(boolean bit) Create a new boolean value and make it the new top-level data object.setData
(byte[] data) Create a new data value and make it the new top-level data object.setDouble
(double d) Create a new double value and make it the new top-level data object.setLong
(long l) Create a new double value and make it the new top-level data object.setNix()
Create a new empty value and make it the new top-level data object.Create a new object value and make it the new top-level data object.setString
(byte[] utf8) Create a new string value and make it the new top-level data object.Create a new string value and make it the new top-level data object.int
symbols()
Returns a count of names in the symbol table.toString()
wrap
(int sym) Take the current top-level data object and make it a field in a new ObjectValue with the given symbol id as field id; the new ObjectValue will also become the new top-level data object.Take the current top-level data object and make it a field in a new ObjectValue with the given symbol name as field name; the new ObjectValue will also become the new top-level data object.
-
Constructor Details
-
Slime
public Slime()Construct an empty Slime with an empty top-level value.
-
-
Method Details
-
symbols
public int symbols()Returns a count of names in the symbol table. -
inspect
Return the symbol name associated with an id.- Parameters:
symbol
- the id, must be in range [0, symbols()-1]
-
insert
Add a name to the symbol table; if the name is already in the symbol table just returns the id it already had.- Parameters:
name
- the name to insert- Returns:
- the id now associated with the name
-
lookup
Find the id associated with a symbol name; if the name was not in the symbol table returns the constant Integer.MAX_VALUE instead. -
get
Get a Cursor connected to the top-level data object. -
setNix
Create a new empty value and make it the new top-level data object. -
setBool
Create a new boolean value and make it the new top-level data object.- Parameters:
bit
- the actual boolean value for the new value
-
setLong
Create a new double value and make it the new top-level data object.- Parameters:
l
- the actual long value for the new value
-
setDouble
Create a new double value and make it the new top-level data object.- Parameters:
d
- the actual double value for the new value
-
setString
Create a new string value and make it the new top-level data object.- Parameters:
str
- the actual string for the new value
-
setString
Create a new string value and make it the new top-level data object.- Parameters:
utf8
- the actual string (encoded as UTF-8 data) for the new value
-
setData
Create a new data value and make it the new top-level data object.- Parameters:
data
- the actual data to be put into the new value.
-
setArray
Create a new array value and make it the new top-level data object. -
setObject
Create a new object value and make it the new top-level data object. -
wrap
Take the current top-level data object and make it a field in a new ObjectValue with the given symbol id as field id; the new ObjectValue will also become the new top-level data object. -
wrap
Take the current top-level data object and make it a field in a new ObjectValue with the given symbol name as field name; the new ObjectValue will also become the new top-level data object. -
equalTo
Tests whether the two Inspectors are equal.Since equality of two Inspectors is subtle,
Object.equals(Object)
is not used.- Returns:
- true if they are equal.
-
toString
-