예제 #1
0
    def focus(self):
        """The module associated with the current focus.

        The Python equivalent of the CLIPS get-focus function.

        """
        return Module(self._env, lib.EnvGetFocus(self._env))
예제 #2
0
파일: agenda.py 프로젝트: noxdafox/clipspy
    def focus(self, module: Module):
        """The module associated with the current focus.

        Equivalent to the CLIPS (get-focus) function.

        """
        return lib.Focus(module._ptr())
예제 #3
0
    def module(self) -> Module:
        """The module in which the DefinedInstances is defined.

        Python equivalent of the CLIPS (definstances-module) command.

        """
        name = ffi.string(lib.DefinstancesModule(self._ptr())).decode()

        return Module(self._env, name)
예제 #4
0
    def module(self) -> Module:
        """The module in which the Class is defined.

        Equivalent to the CLIPS (defclass-module) function.

        """
        name = ffi.string(lib.DefclassModule(self._ptr())).decode()

        return Module(self._env, name)
예제 #5
0
파일: agenda.py 프로젝트: noxdafox/clipspy
    def focus(self) -> Module:
        """The module associated with the current focus.

        Equivalent to the CLIPS (get-focus) function.

        """
        name = ffi.string(lib.DefmoduleName(lib.GetFocus(self._env))).decode()

        return Module(self._env, name)
예제 #6
0
    def module(self) -> Module:
        """The module in which the Generic is defined.

        Equivalent to the CLIPS (defgeneric-module) generics.

        """
        name = ffi.string(lib.DefgenericModule(self._ptr())).decode()

        return Module(self._env, name)
예제 #7
0
    def module(self):
        """The module in which the Rule is defined.

        Python equivalent of the CLIPS defrule-module command.

        """
        modname = ffi.string(lib.EnvDefruleModule(self._env, self._rule))
        defmodule = lib.EnvFindDefmodule(self._env, modname)

        return Module(self._env, defmodule)
예제 #8
0
    def module(self):
        """The module in which the Function is defined.

        Python equivalent of the CLIPS deffunction-module command.

        """
        modname = ffi.string(lib.EnvDeffunctionModule(self._env, self._fnc))
        defmodule = lib.EnvFindDefmodule(self._env, modname)

        return Module(self._env, defmodule)
예제 #9
0
    def module(self):
        """The module in which the Class is defined.

        Python equivalent of the CLIPS defglobal-module command.

        """
        modname = ffi.string(lib.EnvDefclassModule(self._env, self._cls))
        defmodule = lib.EnvFindDefmodule(self._env, modname)

        return Module(self._env, defmodule)
예제 #10
0
파일: agenda.py 프로젝트: noxdafox/clipspy
    def reorder(self, module: Module = None):
        """Reorder the Activations in the Agenda.

        If no Module is specified, the agendas of all modules are reordered.

        To be called after changing the conflict resolution strategy.

        """
        if module is not None:
            lib.ReorderAgenda(module._ptr())
        else:
            lib.ReorderAllAgendas(self._env)
예제 #11
0
파일: agenda.py 프로젝트: noxdafox/clipspy
    def refresh(self, module: Module = None):
        """Recompute the salience values of the Activations on the Agenda
        and then reorder the agenda.

        Equivalent to the CLIPS (refresh-agenda) function.

        If no Module is specified, the agendas of all modules are refreshed.

        """
        if module is not None:
            lib.RefreshAgenda(module._ptr())
        else:
            lib.RefreshAllAgendas(self._env)
예제 #12
0
    def module(self):
        modname = ffi.string(lib.EnvDefgenericModule(self._env, self._gnc))
        defmodule = lib.EnvFindDefmodule(self._env, modname)

        return Module(self._env, defmodule)