aboutsummaryrefslogtreecommitdiff
path: root/RayRoom/Structures/ShiftArray.cs
diff options
context:
space:
mode:
Diffstat (limited to 'RayRoom/Structures/ShiftArray.cs')
-rw-r--r--RayRoom/Structures/ShiftArray.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/RayRoom/Structures/ShiftArray.cs b/RayRoom/Structures/ShiftArray.cs
new file mode 100644
index 0000000..c837aa8
--- /dev/null
+++ b/RayRoom/Structures/ShiftArray.cs
@@ -0,0 +1,26 @@
+namespace RayRoom.Structures
+{
+ public class ShiftArray<T>
+ {
+ public T this[int index]
+ {
+ get
+ {
+ return items[(index + Offset) % items.Length];
+ }
+ set
+ {
+ items[(index + Offset) % items.Length] = value;
+ }
+ }
+
+ public int Offset { get; set; }
+
+ private T[] items;
+
+ public ShiftArray(int capacity)
+ {
+ items = new T[capacity];
+ }
+ }
+}