<gh_stars>0
from .. import States
from pydesim import INF


class Fixed:
    def __init__(self, membrane, duration):
        self.membrane = membrane
        self.duration = duration

    def int_transition(self):
        if self.membrane.state is States.FIRING:
            self.membrane.potential = self.membrane.hyperpolarized_V
            self.membrane.hold_in(States.ABS_REF, self.duration)
        else:
            self.membrane.resume()

    def ext_transition(self):
        if self.membrane.state is States.ABS_REF:
            self.membrane.resume()
        else: self.membrane.resume()

from .. import States
from pydesim import INF


class Fixed:
    def __init__(self, membrane, duration):
        self.membrane = membrane
        self.duration = duration

    def int_transition(self):
        if self.membrane.state is States.FIRING:
            self.membrane.potential = self.membrane.hyperpolarized_V
            self.membrane.hold_in(States.ABS_REF, self.duration)
        else:
            self.membrane.resume()

    def ext_transition(self):
        if self.membrane.state is States.ABS_REF:
            self.membrane.resume()
        else: self.membrane.resume()