Cattle.Tape

g Cattle.Tape Cattle.Tape GObject.Object GObject.Object GObject.Object->Cattle.Tape

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

decrease_current_value ()

decrease_current_value_by (value)

get_current_value ()

increase_current_value ()

increase_current_value_by (value)

is_at_beginning ()

is_at_end ()

move_left ()

move_left_by (steps)

move_right ()

move_right_by (steps)

pop_bookmark ()

push_bookmark ()

set_current_value (value)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

current-value

r/w

Get/set current value

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Cattle.Tape(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Cattle.TapeClass

Opaque data structure representing a memory tape. It should never be accessed directly.

classmethod new()[source]
Returns:

a new Cattle.Tape

Return type:

Cattle.Tape

Create and initialize a new memory tape.

decrease_current_value()[source]

Decrease the value in the current cell by one.

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:

int

Get the value of the current cell. See Cattle.Tape.set_current_value().

increase_current_value()[source]

Increase the value in the current cell by one.

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]
Returns:

True if the current cell is the first one, False otherwise

Return type:

bool

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]
Returns:

True if the current cell is the last one, False otherwise

Return type:

bool

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]
Returns:

False if the bookmarks stack is empty, True otherwise

Return type:

bool

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 to GObject.G_MAXINT8.

Property Details

Cattle.Tape.props.current_value
Name:

current-value

Type:

Default Value:

0

Flags:

READABLE, WRITABLE

Value of the current cell.

Changes to this property are not notified.