home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / henkyaku1.0.exe / henkyaku / Program / Kernel / Util / AbstractHashTable.tonyu next >
Text File  |  2004-08-19  |  1KB  |  76 lines

  1. extends Object;
  2.  
  3. native _n_get;
  4. function get(k) {
  5.    return _n_get (_body,k);
  6. }
  7.  
  8. native _n_put;
  9. function put(k,v) {
  10.    if (v==null)    return _n_put (_body,k,0);
  11.    return _n_put (_body,k,v);
  12. }
  13.  
  14. /*
  15. native _n_keyAt;
  16. function keyAt(i) {
  17.    return _n_keyAt (_body,i);
  18. }
  19.  
  20. native _n_valueAt;
  21. function valueAt(i) {
  22.    return _n_valueAt (_body,i);
  23. }*/
  24.  
  25. native _n_startFind;
  26. function iterator() {
  27.    _n_startFind (_body);
  28.    return this;
  29. }
  30.  
  31. native _n_hasNext;
  32. function hasNext() {
  33.    return _n_hasNext(_body);
  34. }
  35.  
  36. native _n_nextKey;
  37. function nextKey() {
  38.    return _n_nextKey(_body);
  39. }
  40.  
  41. function next() {
  42.    return get(nextKey());
  43. }
  44. function nextValue() {
  45.    return get(nextKey());
  46. }
  47.  
  48. native _n_remove;
  49. function remove(k) {
  50.    return _n_remove (_body,k);
  51.    //return k;
  52. }
  53.  
  54. native _n_size;
  55. function size() {
  56.    return _n_size (_body);
  57. }
  58.  
  59. native _n_destroy;
  60. destructor destroy() {
  61.    _n_destroy(_body);
  62. }
  63.  
  64. constructor LightHashTable() {
  65. }
  66.  
  67. function gc_mark() {
  68.     var it,k;
  69.     it=iterator();  
  70.     while(it.hasNext()) {
  71.        k=it.nextKey();
  72.        native_gc_mark(k);
  73.        native_gc_mark(get(k));
  74.     }
  75. }
  76.