forked from algorithm-visualizer/tracers.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray1d.py
23 lines (16 loc) · 744 Bytes
/
array1d.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from . import chart
from .array2d import Array2DTracer
from algorithm_visualizer.types import Serializable, SerializableSequence, UNDEFINED
class Array1DTracer(Array2DTracer):
def set(self, array1d: SerializableSequence[Serializable] = UNDEFINED):
self.command("set", array1d)
def patch(self, x: int, v: Serializable = UNDEFINED):
self.command("patch", x, v)
def depatch(self, x: int):
self.command("depatch", x)
def select(self, sx: int, ex: int = UNDEFINED):
self.command("select", sx, ex)
def deselect(self, sx: int, ex: int = UNDEFINED):
self.command("deselect", sx, ex)
def chart(self, chartTracer: "chart.ChartTracer"):
self.command("chart", chartTracer.key)