quilt_knit.swatch.course_wise_merging.Course_Seam_Connection module

Module containing the Course_Seam_Connection class.

class Course_Seam_Connection(_exit_instruction, _entrance_instruction)[source]

Bases: Seam_Connection

A Class representing the effects of connecting an exit and entrance instruction between two swatches.

Parameters:
property exit_instruction: Course_Boundary_Instruction

Returns: Course_Boundary_Instruction: The instruction that exits a course boundary.

property entrance_instruction: Course_Boundary_Instruction

Returns: Course_Boundary_Instruction: The instruction that enters a course boundary.

property left_instruction: Course_Boundary_Instruction

Returns: Course_Boundary_Instruction: The instruction on the left swatch of the seam connection.

property right_instruction: Course_Boundary_Instruction

Returns: Course_Boundary_Instruction: The instruction on the right swatch of the seam connection.

property leftward_connection: bool

Returns: bool: True if the connection moves from the right to left swatch, False otherwise.

property rightward_connection: bool

Returns: bool: True if the connection moves from the left to right swatch, False otherwise.

property xfer_connection: bool

Returns: bool: True if this is a connection between transfer carriage passes. False otherwise.

__str__()[source]
Returns:

A string representation of the Course_Seam_Connection.

Return type:

str

__repr__()[source]
Returns:

A string representation of the Course_Seam_Connection.

Return type:

str

property different_carriers: int

Returns: int: The number of carriers that differ between the entrance and exit instructions. Differences include different positions in the carrier set and different lengths of carrier sets.

property shared_carriers: set[int]

Returns: set[int]: The set of carrier ids that are shared between the linked instructions.

property entrance_carrier_ids: set[int]

Returns: set[int]: The set of carrier ids involved in the entrance instruction.

property exit_carrier_ids: set[int]

Returns: set[int]: The set of carrier ids involved in the exit instruction.

__lt__(other)[source]
Parameters:

other (Course_Seam_Connection) – The other connection to compare with.

Returns:

True if this connection has fewer different carriers between instructions that the other connection.

Return type:

bool

__contains__(item)
Parameters:

item (Swatch_Boundary_Instruction) – The instruction to find in the connection.

Returns:

True if the given item is one of the boundary instructions involved in the connection. False, otherwise.

Return type:

bool

__eq__(other)
Parameters:

other (Course_Seam_Connection) – The other connection to compare to.

Returns:

True if both connections connect the same entrance-exit pairs.

Return type:

bool

__hash__()
Returns:

Hash of the tuple of the exit and entrance instruction.

Return type:

int

__init__(_exit_instruction, _entrance_instruction)
Parameters:
property seam_entrance: Swatch_Boundary_Instruction

Returns: Swatch_Boundary_Instruction: The instruction that enters the merging swatch

property seam_exit: Swatch_Boundary_Instruction

Returns: Swatch_Boundary_Instruction: The instruction that exits the merging swatch.

static sort_connections(connections)
Parameters:

connections (set[Seam_Connection]) – The list of connections to sort.

Returns:

The sorted list of connections.

Return type:

List[Seam_Connection]