OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 | 983 |
984 hasNext: function() | 984 hasNext: function() |
985 { | 985 { |
986 return this._position < this._iterationOrder.length; | 986 return this._position < this._iterationOrder.length; |
987 }, | 987 }, |
988 | 988 |
989 get isEmpty() | 989 get isEmpty() |
990 { | 990 { |
991 if (this._iterationOrder) | 991 if (this._iterationOrder) |
992 return !this._iterationOrder.length; | 992 return !this._iterationOrder.length; |
| 993 if (this._unfilteredIterationOrder && !this._filter) |
| 994 return !this._unfilteredIterationOrder.length; |
993 var iterator = this._iterator; | 995 var iterator = this._iterator; |
994 if (!this._filter) { | 996 if (!this._unfilteredIterationOrder && !this._filter) { |
995 iterator.first(); | 997 iterator.first(); |
996 return !iterator.hasNext(); | 998 return !iterator.hasNext(); |
| 999 } else if (!this._unfilteredIterationOrder) { |
| 1000 for (iterator.first(); iterator.hasNext(); iterator.next()) |
| 1001 if (this._filter(iterator.item)) |
| 1002 return false; |
| 1003 } else { |
| 1004 var order = this._unfilteredIterationOrder.constructor === Array ? |
| 1005 this._unfilteredIterationOrder : this._unfilteredIterationOrder.
slice(0); |
| 1006 for (var i = 0, l = order.length; i < l; ++i) { |
| 1007 iterator.index = order[i]; |
| 1008 if (this._filter(iterator.item)) |
| 1009 return false; |
| 1010 } |
997 } | 1011 } |
998 for (iterator.first(); iterator.hasNext(); iterator.next()) | |
999 if (this._filter(iterator.item)) return false; | |
1000 return true; | 1012 return true; |
1001 }, | 1013 }, |
1002 | 1014 |
1003 get item() | 1015 get item() |
1004 { | 1016 { |
1005 this._iterator.index = this._iterationOrder[this._position]; | 1017 this._iterator.index = this._iterationOrder[this._position]; |
1006 return this._iterator.item; | 1018 return this._iterator.item; |
1007 }, | 1019 }, |
1008 | 1020 |
1009 get length() | 1021 get length() |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 pushBaseIds: function(baseIds) | 1427 pushBaseIds: function(baseIds) |
1416 { | 1428 { |
1417 this._baseIds = baseIds; | 1429 this._baseIds = baseIds; |
1418 }, | 1430 }, |
1419 | 1431 |
1420 pushBaseSelfSizes: function(baseSelfSizes) | 1432 pushBaseSelfSizes: function(baseSelfSizes) |
1421 { | 1433 { |
1422 this._baseSelfSizes = baseSelfSizes; | 1434 this._baseSelfSizes = baseSelfSizes; |
1423 } | 1435 } |
1424 }; | 1436 }; |
OLD | NEW |