|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsleep.bridges.KeyValuePair
public class KeyValuePair
Arguments passed to functions with the form key => expression are available via
the KeyValuePair object. The following is the implementation of the built-in function
&hash(key => "value", key2 => 3, ...):
class hash implements Function
{
public Scalar evaluate(String n, ScriptInstance si, Stack arguments)
{
Scalar value = SleepUtils.getHashScalar();
while (!arguments.isEmpty())
{
KeyValuePair kvp = BridgeUtilities.getKeyValuePair(arguments);
Scalar blah = value.getHash().getAt(kvp.getKey());
blah.setValue(kvp.getValue());
}
return value;
}
}
BridgeUtilities| Field Summary | |
|---|---|
protected Scalar |
key
the key scalar |
protected Scalar |
value
the value scalar |
| Constructor Summary | |
|---|---|
KeyValuePair(Scalar _key,
Scalar _value)
Instantiates a key/value pair |
|
| Method Summary | |
|---|---|
Scalar |
getKey()
Obtain the key portion of this pair |
Scalar |
getValue()
Obtain the value portion of this pair |
java.lang.String |
toString()
Return a string representation of this key/value pair |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Scalar key
protected Scalar value
| Constructor Detail |
|---|
public KeyValuePair(Scalar _key,
Scalar _value)
| Method Detail |
|---|
public Scalar getKey()
public Scalar getValue()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||