| Pnuts | Description / corresponding Java code | Conditions |
|---|---|---|
target :: x ( ... ) | Call the function x in the package target |
There is a package called "target" |
Static method call
target.x(...); |
target is a java.lang.Class object. | |
target :: x | Reference to the variable x in the package target |
There is a package called "target". |
Reference to a static variable
target.x; |
target is a java.lang.Class object. | |
target . x ( ... ) | Call the instance method x of target object |
target is not a java.lang.Class object. |
Call the instance method of the Class object
target.class.x(...); |
target is a java.lang.Class object. | |
Call the static method x of targetClass object
targetClass . x (...); |
target is a java.lang.Class object that represents targetClass.
java.lang.Class does not have the field x (or Bean Property x)
targetClass has a static method x.
| |
obj.invoke("name",
new Object[]{args},
context)
|
target is a pnuts.lang.AbstractData object. | |
target . x target . x = value |
target.get("x".intern())
target.set("x".intern(), value)
| target is a pnuts.lang.Context object. |
target.get("x", context)
target.set("x", value, context)
| target is a pnuts.lang.Property object or a pnuts.lang.AbstractData object. | |
target.get("x")
target.set("x", value)
| target is a java.util.Map object. | |
target.getXxx() target.setXxx(value) | target is an object that has the JavaBeans property 'xxx'. | |
Access to a static variable
targetClass.xxx targetClass.xxx = value |
None of above condition was satisfied
target is a java.lang.Class object that represents targetClass class
targetClass has a static variable 'xxx'
|
|
target [x] target [x] = value |
Dereference of an array, or assignment of an element.
target[x]; target[x] = value; |
target is an array. |
indexed.get(x) indexed.set(x, value) |
target is a pnuts.lang.Indexed object or a java.util.List object. | |
map.get(key) map.put(key, value) |
target is a java.util.Map object. | |
target ( ... ) |
Call the function target |
target is a pnuts.lang.PnutsFunction object. |
Create an instance |
target is a java.lang.Class object. | |
for (i : x) expression foreach i (x) expression |
while (x.hasNext()){
Object i = x.next();
expression
}
|
x is a java.util.Iterator object. |
while (x.hasMoreElements()){
Object i = x.nextElement();
expression
}
|
x is a java.util.Enumerator object. | |
for (Iterator it = x.iterator();
it.hasNext(); )
{
Object i = x.next();
expression
}
|
x is a java.util.Collection object. | |
target < object target == object |
target.compareTo(object) < 0 target.compareTo(object) == 0 |
target is a java.lang.Comparable object or a java.lang.String object. |
[1,2] |
new Object[]{
new Integer(1),
new Integer(2)
}
|
|
(int[])[1,2] |
new int[]{1, 2}
|
|
n1 + n2 n1 - n2 n1 * n2 n1 / n2 |
n1.add(n2) n1.subtract(n2) n1.multiply(n2) n1.divide(n2) |
Either n1 or n2 a pnuts.lang.Numeric object. |
<decimal><unit> e.g. 1.2cm |
factory.make(<decimal>, <unit>) |
A factory object associated with <unit> is registered. Context.registerQuantityFactory( <unit>, QuantityFactory) |