"""
Implementation of an OmniGraph node that clamps a double value
"""


class OgnClampDouble:
    @staticmethod
    def compute(db):
        if db.inputs.num < db.inputs.min:
            db.outputs.out = db.inputs.min
        elif db.inputs.num > db.inputs.max:
            db.outputs.out = db.inputs.max
        else:
            db.outputs.out = db.inputs.num

        return True
