Пример #1
0
    def get_condition(self, condition_index: int = None, display_index: int = None) -> Condition:
        if not exclusive_if(condition_index is not None, display_index is not None):
            raise ValueError(f"Please identify a condition using either condition_index or display_index.")

        if condition_index is None:
            condition_index = self.condition_order[display_index]

        return self.conditions[condition_index]
Пример #2
0
    def get_effect(self, effect_index: int = None, display_index: int = None) -> Effect:
        if not exclusive_if(effect_index is not None, display_index is not None):
            raise ValueError(f"Please identify an effect using either effect_index or display_index.")

        if effect_index is None:
            effect_index = self.effect_order[display_index]

        return self.effects[effect_index]
 def get_variable(self,
                  variable_id: int = None,
                  variable_name: str = None) -> Variable:
     if not exclusive_if(variable_id is not None, variable_name
                         is not None):
         raise ValueError(
             "Select a variable using either the variable_id or variable_name parameters."
         )
     for variable in self.variables:
         if variable.variable_id == variable_id or variable.name == variable_name:
             return variable
Пример #4
0
    def remove_effect(self, effect_index: int = None, display_index: int = None, effect: Effect = None) -> None:
        if not exclusive_if(effect_index is not None, display_index is not None, effect is not None):
            raise ValueError(f"Please identify an effect using either effect_index, display_index or effect.")

        if effect is not None:
            effect_index = self.effects.index(effect)

        if effect_index is None:
            effect_index = self.effect_order[display_index]
        else:
            display_index = self.effect_order.index(effect_index)

        del self.effects[effect_index]
        del self.effect_order[display_index]

        self.effect_order = [x - 1 if x > effect_index else x for x in self.effect_order]
Пример #5
0
    def remove_condition(self, condition_index: int = None, display_index: int = None, condition: Condition = None) \
            -> None:
        if not exclusive_if(condition_index is not None, display_index is not None, condition is not None):
            raise ValueError(f"Please identify a condition using either condition_index, display_index or condition.")

        if condition is not None:
            condition_index = self.conditions.index(condition)

        if condition_index is None:
            condition_index = self.condition_order[display_index]
        else:
            display_index = self.condition_order.index(condition_index)

        del self.conditions[condition_index]
        del self.condition_order[display_index]

        self.condition_order = [x - 1 if x > condition_index else x for x in self.condition_order]