Revision 5159,
677 bytes
checked in by niltonneto, 13 years ago
(diff) |
Ticket #2276 - Resincronizando as revisões deste ticket para o Trunk.
|
Rev | Line | |
---|
[5159] | 1 | /*********************** HASH PROTOTYPE **************************/ |
---|
| 2 | function Hash(data) { |
---|
| 3 | this.last_item = 0; |
---|
| 4 | this.data = data; |
---|
| 5 | } |
---|
| 6 | Hash.prototype.size = function(){ |
---|
| 7 | var _thisObject = this; |
---|
| 8 | var size = 0; |
---|
| 9 | for (var i in _thisObject.data) |
---|
| 10 | if(_thisObject.data[i] != null) |
---|
| 11 | size++; |
---|
| 12 | return size; |
---|
| 13 | } |
---|
| 14 | Hash.prototype.seek = function(direction){ |
---|
| 15 | var _thisObject = this; |
---|
| 16 | _thisObject.last_item = (direction == "previous" ? |
---|
| 17 | (_thisObject.last_item == 0 ? _thisObject.size() - 1 : _thisObject.last_item - 1) : |
---|
| 18 | (_thisObject.last_item == _thisObject.size() -1 ? 0 : _thisObject.last_item + 1)); |
---|
| 19 | return _thisObject.data[_thisObject.last_item]; |
---|
| 20 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.