Package jazzparser :: Package formalisms :: Package music_halfspan :: Package semantics :: Class List
[hide private]
[frames] | no frames]

Class List

source code

                           object --+    
                                    |    
base.semantics.lambdacalc.LogicalForm --+
                                        |
                           object --+   |
                                    |   |
     base.semantics.temporal.Temporal --+
                                        |
                                       List

The Path or List data structure. Primarily this is a list of enharmonic coordinates or logical forms. In the written semantics, this is shown as a list, but it is subject to certain reductions, such as when a predicate (like leftonto) is applied to it.

The items are implemented simply as a Python list, which should make list processing much more efficient than if we used a linked list implementation that corresponds better to the theoretical definition of the semantics.

Instance Methods [hide private]
 
__init__(self, items=[], *args, **kwargs)
Builds a basic logical form object.
source code
 
__str__(self)
str(x)
source code
 
format_result(self) source code
 
__eq__(self, other)
This should be overridden by subclasses.
source code
 
get_start_time(self) source code
 
set_time(self, time)
Should be overridden by subclasses.
source code
 
append(self, point)
Appends the point to the path.
source code
 
prepend(self, point)
Prepends the point to the start of the path.
source code
 
extend(self, points)
Appends all points in the given list to the points of the path.
source code
 
__len__(self) source code
 
__getitem__(self, i) source code
 
__setitem__(self, i, val) source code
 
pop(self, i)
Removes and returns the ith point from the path
source code
 
insert(self, i, point)
Inserts a point at the given position on the path
source code
 
shift_block(self, shift)
Moves all the points on the path to another block, given relative to their old one shift.
source code
 
copy(self)
This should be overridden by subclasses.
source code
 
to_list(self)
Implemented for backward-compatibility with older formalisms.
source code
 
alpha_convert(self, src, trg)
This should be overridden by subclasses.
source code
 
beta_reduce(self, *args, **kwargs)
This should be overridden by subclasses.
source code
 
substitute(self, src, trg)
This should be overridden by subclasses.
source code
 
replace_immediate_constituent(self, old_lf, new_lf)
This should be overridden by subclasses.
source code
 
get_variables(self)
This should be overridden by subclasses.
source code
 
get_bound_variables(self)
This should be overridden by subclasses.
source code
 
get_children(self)
This should be overridden by subclasses.
source code
 
alpha_equivalent(self, other, substitution)
This should be overridden by subclasses.
source code

Inherited from base.semantics.lambdacalc.LogicalForm: __ne__, __repr__, get_ancestor_bound_variables, get_instances, get_unbound_variables, replace_in_parent

Inherited from base.semantics.temporal.Temporal: get_literal_time_list, get_path_times, get_time_list, set_all_times, simultaneous

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from base.semantics.temporal.Temporal: timed_object

Properties [hide private]

Inherited from base.semantics.temporal.Temporal: duration, time

Inherited from object: __class__

Method Details [hide private]

__init__(self, items=[], *args, **kwargs)
(Constructor)

source code 

Builds a basic logical form object.

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.__eq__
(inherited documentation)

set_time(self, time)

source code 

Should be overridden by subclasses.

Sets the start time of this logical form. This is different to just setting the time property: using set_time() may pass the time property down to its children if that is appropriate for the semantic type.

It is also distinct from set_all_times(), which recursively sets the time on all children.

This must be provided by all subclasses.

Overrides: base.semantics.temporal.Temporal.set_time
(inherited documentation)

prepend(self, point)

source code 

Prepends the point to the start of the path.

Same as insert(0, point).

shift_block(self, shift)

source code 

Moves all the points on the path to another block, given relative to their old one shift.

Parameters:
  • shift (2-tuple of ints) - block shift to apply to each point on the path.

copy(self)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.copy
(inherited documentation)

to_list(self)

source code 

Implemented for backward-compatibility with older formalisms. Just returns list(path).

alpha_convert(self, src, trg)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.alpha_convert
(inherited documentation)

beta_reduce(self, *args, **kwargs)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.beta_reduce
(inherited documentation)

substitute(self, src, trg)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.substitute
(inherited documentation)

replace_immediate_constituent(self, old_lf, new_lf)

source code 

This should be overridden by subclasses. It should replace the LogicalForm old_lf with new_lf if it appears as an immediate constituent of this LogicalForm.

Overrides: base.semantics.lambdacalc.LogicalForm.replace_immediate_constituent
(inherited documentation)

get_variables(self)

source code 

This should be overridden by subclasses.

This method returns a list of all the variables used in this LF. This includes bound and unbound variables. (Only unbound variables need to be alpha-converted to avoid accidental binding, but we will convert bound variables too for readability.)

Note that this only contains one instance of each variable, not every occurrence.

Overrides: base.semantics.lambdacalc.LogicalForm.get_variables
(inherited documentation)

get_bound_variables(self)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.get_bound_variables
(inherited documentation)

get_children(self)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.get_children
(inherited documentation)

alpha_equivalent(self, other, substitution)

source code 

This should be overridden by subclasses.

Overrides: base.semantics.lambdacalc.LogicalForm.alpha_equivalent
(inherited documentation)