| OLD | NEW |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 // Reusable sliding-window view of a list of nodes. The window is represented | 5 // Reusable sliding-window view of a list of nodes. The window is represented |
| 6 // as a cyclic buffer so that sliding by N, where N is less than the buffer | 6 // as a cyclic buffer so that sliding by N, where N is less than the buffer |
| 7 // length, can be implemented as shifting the buffer offset by N and populating | 7 // length, can be implemented as shifting the buffer offset by N and populating |
| 8 // N items. | 8 // N items. |
| 9 node SlidingWindow { | 9 node SlidingWindow { |
| 10 // Cyclic buffer for the sliding window of nodes. | 10 // Cyclic buffer for the sliding window of nodes. |
| 11 List<Node> window; | 11 List<Node> window; |
| 12 | 12 |
| 13 // Offset of the window start from the original list. | 13 // Offset of the window start from the original list. |
| 14 int32 startOffset; | 14 int32 startOffset; |
| 15 | 15 |
| 16 // Offset of the first sliding-window item in the window. | 16 // Offset of the first sliding-window item in the window. |
| 17 uint16 windowOffset; | 17 uint16 windowOffset; |
| 18 | 18 |
| 19 // Number of items known to be in the list. | 19 // Number of items known to be in the list. |
| 20 int32 minimumCount; | 20 int32 minimumCount; |
| 21 | 21 |
| 22 // Number of items in the list. A negative value denotes an unknown size. | 22 // Number of items in the list. A negative value denotes an unknown size. |
| 23 int32 maximumCount; | 23 int32 maximumCount; |
| 24 | 24 |
| 25 // Event to update the sliding-window display range. | 25 // Event to update the sliding-window display range. |
| 26 void display(int32 start, int32 end); | 26 void display(int32 start, int32 end); |
| 27 | 27 |
| 28 // Event to toggle an item in the window. | 28 // Event to toggle an item in the window. |
| 29 void toggle(int32 index); | 29 void toggle(int32 index); |
| 30 } | 30 } |
| OLD | NEW |