Changeset 383 for cpp/frams


Ignore:
Timestamp:
05/22/15 04:20:22 (9 years ago)
Author:
sz
Message:

Added more examples in Vector and Dictionary documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/vm/classes/collectionobj.cpp

    r375 r383  
    1717{"Vector",1,13,"Vector","Vector is 1-dimensional array, indexed by integer value (starting from 0). "
    1818 "Multidimensional arrays can be simulated by putting other Vector objects into the Vector.\n"
    19  "Example:\nvar v=Vector.new();\nv.add(123); v.add(\"string\");",},
     19 "Examples:\n"
     20 "var v1=Vector.new(); v1.add(123); v1.add(\"string\");\n"
     21 "var v2=[123,\"string\"];// short way of doing the same (square brackets create a vector)\n"
     22 "var v3=[[1,2,3],[4,5],[6]];// simulate a 2d array\n"
     23 "for(var element in v3) Simulator.print(element);//Vector supports enumeration"
     24},
    2025{"clear",0,PARAM_NOSTATIC,"clear data","p()",PROCEDURE(p_clear),},
    2126{"size",0,PARAM_READONLY | PARAM_NOSTATIC,"element count","d",GETONLY(size),},
    2227{"remove",0,PARAM_NOSTATIC,"remove at position","p(d position)",PROCEDURE(p_remove),},
    23 {"get",0,PARAM_NOSTATIC,"get value at position","p x(d position)",PROCEDURE(p_get),},
    24 {"set",0,PARAM_NOSTATIC,"set value at position","p(d position,x value)",PROCEDURE(p_set),},
     28{"get",0,PARAM_NOSTATIC,"get value at position","p x(d position)",PROCEDURE(p_get),"object[position] can be always used instead of object.get(position)"},
     29{"set",0,PARAM_NOSTATIC,"set value at position","p(d position,x value)",PROCEDURE(p_set),"object[position]=value can be always used instead of object.set(position,value)"},
    2530{"add",0,PARAM_NOSTATIC,"append at the end","p(x value)",PROCEDURE(p_add),},
    2631{"find",0,PARAM_NOSTATIC,"find","p d(x value)",PROCEDURE(p_find),"returns the element index or -1 if not found"},
     
    4146 "(\"key\" is the first argument in get/set/remove functions). Integer \"key\" can be "
    4247 "used to enumerate all elements (the sequence of elements is not preserved).\n"
    43  "Example:\nvar d=Dictionary.new(); d.set(\"name\",\"John\"); d.set(\"age\",44);\n"
     48 "Examples:\nvar d1=Dictionary.new(); d1.set(\"name\",\"John\"); d1.set(\"age\",44);\n"
     49 "var d2=Dictionary.new(); d2[\"name\"]=\"John\"; d2[\"age\"]=44; //shorthand notation, equivalent to the line above\n"
    4450 "var i;\nfor(i=0;i<d.size;i++) Simulator.print(d.getKey(i)+\" is \"+d.get(i));",},
    4551{"clear",0,PARAM_NOSTATIC,"clear data","p()",PROCEDURE(p_clear),},
    4652{"size",0,PARAM_NOSTATIC | PARAM_READONLY,"element count","d",GETONLY(size),},
    4753{"remove",0,PARAM_NOSTATIC,"remove named or indexed element","p(x key)",PROCEDURE(p_remove),},
    48 {"get",0,PARAM_NOSTATIC,"get named or indexed element","p x(x key)",PROCEDURE(p_get),},
     54{"get",0,PARAM_NOSTATIC,"get named or indexed element","p x(x key)",PROCEDURE(p_get),"object[position] can be always used instead of object.get(position)"},
    4955{"getKey",0,PARAM_NOSTATIC,"get a key of the indexed element","p s(d index)",PROCEDURE(p_getKey),},
    50 {"set",0,PARAM_NOSTATIC,"set named or indexed element","p(x key,x value)",PROCEDURE(p_set),},
     56{"set",0,PARAM_NOSTATIC,"set named or indexed element","p(x key,x value)",PROCEDURE(p_set),"object[key]=value can be always used instead of object.set(key,value)"},
    5157{"find",0,PARAM_NOSTATIC,"find","p s(x value)",PROCEDURE(p_find),"returns the element key or null if not found"},
    5258{"new",0,0,"create new Dictionary","p oDictionary()",STATICPROCEDURE(p_new),},
Note: See TracChangeset for help on using the changeset viewer.