OnlyConstraint

class glotaran.model.clp_constraint.OnlyConstraint(*, interval: tuple[float, float] | list[tuple[float, float]] | None = None, target: str, type: str = 'only')[source]

Bases: ZeroConstraint

Constraints the target to 0 outside the given interval.

Method generated by attrs for class OnlyConstraint.

Attributes Summary

type

target

interval

Methods Summary

applies

Check if the constraint applies on this index.

get_item_type

Get the type string.

get_item_type_class

Get the type for a type string.

get_item_types

Get all type strings.

has_interval

Check if intervals are defined.

Methods Documentation

applies(index: float | None) bool[source]

Check if the constraint applies on this index.

Parameters:

index (float) – The index.

Return type:

bool

classmethod get_item_type() str

Get the type string.

Return type:

str

classmethod get_item_type_class(item_type: str) Type

Get the type for a type string.

Parameters:

item_type (str) – The type string.

Return type:

Type

classmethod get_item_types() list[str]

Get all type strings.

Return type:

list[str]

has_interval() bool

Check if intervals are defined.

Return type:

bool

interval: tuple[float, float] | list[tuple[float, float]] | None
target: str
type: str