Cattle.Tape¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Get/set current value |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Cattle.Tape(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Opaque data structure representing a memory tape. It should never be accessed directly.
- classmethod new()[source]¶
- Returns:
a new
Cattle.Tape
- Return type:
Create and initialize a new memory tape.
- decrease_current_value_by(value)[source]¶
- Parameters:
value (
int
) – decrease amount
Decrease the value in the current cell by value.
Decreasing the value this way is much faster than calling
Cattle.Tape.decrease_current_value
() multiple times.
- get_current_value()[source]¶
- Returns:
the value of the current cell
- Return type:
Get the value of the current cell. See
Cattle.Tape.set_current_value
().
- increase_current_value_by(value)[source]¶
- Parameters:
value (
int
) – increase amount
Increase the value in the current cell by value.
Increasing the value this way is much faster than calling
Cattle.Tape.increase_current_value
() multiple times.
- is_at_beginning()[source]¶
-
Check if the current cell is the first one of self.
Since the tape grows automatically as more cells are needed, it is possible to move left from the first cell.
- is_at_end()[source]¶
-
Check if the current cell is the last one of self.
Since the tape grows automatically as more cells are needed, it is possible to move right from the last cell.
- move_left()[source]¶
Move self one cell to the left.
If there are no memory cells on the left of the current one, one will be created on the fly.
- move_left_by(steps)[source]¶
- Parameters:
steps (
int
) – number of steps
Move self steps cells to the left.
Moving this way is much faster than calling
Cattle.Tape.move_left
() multiple times.
- move_right()[source]¶
Move self one cell to the right.
If there are no memory cells on the right of the current one, one will be created on the fly.
- move_right_by(steps)[source]¶
- Parameters:
steps (
int
) – number of steps
Move self steps cells to the right.
Moving this way is much faster than calling
Cattle.Tape.move_right
() multiple times.
- pop_bookmark()[source]¶
-
Restore the previously-saved tape position. See
Cattle.Tape.push_bookmark
().
- push_bookmark()[source]¶
Create a bookmark to the current tape position and save it on the bookmark stack.
- set_current_value(value)[source]¶
- Parameters:
value (
int
) – the current cell’s new value
Set the value of the current cell.
Accepted values range from
GObject.G_MININT8
toGObject.G_MAXINT8
.