示例#1
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,signature=version,names='talker',container=5,ordinal=ordinal)

        self.add_mode2(4,'mode([],role(when,[singular,numeric]),option(using,[instance(~server)]))', self.__mode, self.__query, self.__cancel_mode, self.__attach_mode)
        self.add_mode2(7,'mode([],role(when,[singular,numeric]),role(called,[singular,numeric]),option(using,[instance(~server)]))', self.__cmode, self.__cquery, self.__cancel_mode, self.__attach_mode)
        self.add_verb2(1,'cancel([],None,role(None,[ideal([~server,event])]))', self.__cancel_verb)
        self.add_verb2(8,'cancel([],None,role(None,[singular,numeric]),role(called,[singular,numeric]))', self.__cancel_verb_called)
        self.add_verb2(5,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]))', self.__color_verb)
        self.add_verb2(6,'colour([],None,role(None,[singular,numeric]),role(to,[singular,numeric]),role(from,[singular,numeric]))', self.__all_color_verb)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*',0))
        self.__size = 0

        self[1] = bundles.Output(1,False, names='light output',protocols='revconnect')
        self.light_output = bundles.Splitter(self.domain,self[1])
        self.light_convertor = piw.lightconvertor(self.light_output.cookie())
        self.light_aggregator = piw.aggregator(self.light_convertor.cookie(),self.domain)
        self.controller = piw.controller(self.light_aggregator.get_output(1),utils.pack_str(1))

        self.activation_input = bundles.VectorInput(self.controller.cookie(), self.domain,signals=(1,))

        self[2] = atom.Atom(domain=domain.BoundedFloat(0,1), policy=self.activation_input.local_policy(1,False),names='activation input')
        self[3] = atom.Atom(creator=self.__create,wrecker=self.__wreck)
        self[4] = PhraseBrowser(self.__eventbykey,self.__keylist)
示例#2
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='scheduler',
                             container=6,
                             protocols='scheduler',
                             ordinal=ordinal)

        c = dict(c=schedproxy.get_constraints())

        self.add_verb2(
            1,
            'do([],None,role(None,[abstract]),role(at,%(c)s),option(until,%(c)s),option(every,%(c)s),option(called,[numeric]))'
            % c, lambda s, t, a, u, e, c: self.__do_verb(
                s, t, tsm(a), tsm(u), tsm(e), c))
        self.add_verb2(
            2,
            'do([],None,role(None,[abstract]),role(until,%(c)s),option(every,%(c)s),option(called,[numeric]))'
            % c,
            lambda s, t, u, e, c: self.__do_verb(s, t, {}, tsm(u), tsm(e), c))
        self.add_verb2(
            3,
            'do([],None,role(None,[abstract]),role(every,%(c)s),option(called,[numeric]))'
            % c, lambda s, t, e, c: self.__do_verb(s, t, {}, {}, tsm(e), c))
        self.add_verb2(4, 'cancel([],None,role(None,[numeric]))',
                       self.__verb_cancel)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.scheduler = piw.scheduler(4)
        self.input = bundles.ScalarInput(self.scheduler.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5))
        self.finder = talker.TalkerFinder()

        self[2] = atom.Atom(names='inputs')
        self[2][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(1, False),
                               names='running input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(2, False),
                               names='song time input')
        self[2][3] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(3, False),
                               names='bar beat input')
        self[2][4] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(4, False),
                               names='song beat input')
        self[2][5] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(5, False),
                               names='bar input')

        self[3] = collection.Collection(creator=self.__create,
                                        wrecker=self.__wreck,
                                        names='event',
                                        inst_creator=self.__create_inst,
                                        inst_wrecker=self.__wreck_inst,
                                        protocols='hidden-connection explicit')

        self[4] = atom.Atom(names='controller')

        self[4][1] = bundles.Output(1,
                                    False,
                                    names='light output',
                                    protocols='revconnect')
        self.light_output = bundles.Splitter(self.domain, self[4][1])
        self.controller = piw.controller2(self.light_output.cookie(),
                                          utils.pack_str(1, 2))
        self.light_aggregator = piw.aggregator(
            self.controller.converter_cookie(), self.domain)

        self.activation_input = bundles.VectorInput(
            self.controller.event_cookie(), self.domain, signals=(1, ))
        self.controller_input = bundles.VectorInput(
            self.controller.controller_cookie(), self.domain, signals=(1, ))

        self[4][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.controller_input.vector_policy(
                                   1, False),
                               names='controller input',
                               protocols='nostage')
        self[4][3] = atom.Atom(domain=domain.Aniso(),
                               policy=self.activation_input.vector_policy(
                                   1, False),
                               names='key input',
                               protocols='nostage')

        self[5] = EventBrowser(self.__eventlist)
        self[6] = atom.Atom(domain=domain.String(), names='identifier')
示例#3
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='scheduler',
                             container=6,
                             protocols='scheduler',
                             ordinal=ordinal)

        c = dict(c=schedproxy.get_constraints())

        self.add_mode2(
            1,
            'mode([],role(at,%(c)s),option(until,%(c)s),option(every,%(c)s))' %
            c, lambda t, a, u, e: self.__mode(t, tsm(a), tsm(u), tsm(e)),
            lambda a, u, e: self.__query(tsm(a), tsm(u), tsm(e)),
            self.__mode_cancel)
        self.add_mode2(2,
                       'mode([],role(until,%(c)s), option(every,%(c)s))' % c,
                       lambda t, u, e: self.__mode(t, {}, tsm(u), tsm(e)),
                       lambda u, e: self.__query({}, tsm(u), tsm(e)),
                       self.__mode_cancel)
        self.add_mode2(3, 'mode([],role(every,%(c)s))' % c,
                       lambda t, e: self.__mode(t, {}, {}, tsm(e)),
                       lambda e: self.__query({}, {}, tsm(e)),
                       self.__mode_cancel)

        self.add_verb2(4,
                       'cancel([],None,role(None,[ideal([~server,event])]))',
                       self.__verb_cancel)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.scheduler = piw.scheduler(4)
        self.input = bundles.ScalarInput(self.scheduler.cookie(),
                                         self.domain,
                                         signals=(1, 2, 3, 4, 5))

        self[2] = atom.Atom()
        self[2][1] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(1, False),
                               names='running input')
        self[2][2] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(2, False),
                               names='song time input')
        self[2][3] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(3, False),
                               names='bar beat input')
        self[2][4] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(4, False),
                               names='song beat input')
        self[2][5] = atom.Atom(domain=domain.Aniso(),
                               policy=self.input.policy(5, False),
                               names='bar input')

        self[3] = atom.Null(creator=self.__create, wrecker=self.__wreck)

        self[4] = atom.Atom(names='controller')
        self[4][1] = bundles.Output(1,
                                    False,
                                    names='light output',
                                    protocols='revconnect')
        self.control_output = bundles.Splitter(self.domain, self[4][1])
        self.light_convertor = piw.lightconvertor(self.control_output.cookie())
        self.controller = piw.controller(self.light_convertor.cookie(),
                                         utils.pack_str(1))
        self.control_input = bundles.VectorInput(self.controller.cookie(),
                                                 self.domain,
                                                 signals=(1, ))

        self[4][2] = atom.Atom(domain=domain.BoundedFloat(0, 1),
                               policy=self.control_input.local_policy(
                                   1, False),
                               names='activation input')

        self[5] = EventBrowser(self.__eventlist)
示例#4
0
    def __init__(self, address, ordinal):
        agent.Agent.__init__(self,
                             signature=version,
                             names='talker',
                             ordinal=ordinal,
                             protocols='talker')

        self.add_verb2(
            2,
            'do([],None,role(None,[abstract]),role(when,[numeric]),option(called,[numeric]))',
            self.__do_verb)
        self.add_verb2(
            8, 'cancel([],None,role(None,[numeric]),option(called,[numeric]))',
            self.__cancel_verb)
        self.add_verb2(
            5, 'colour([],None,role(None,[numeric]),role(to,[numeric]))',
            self.__color_verb)
        self.add_verb2(
            6,
            'colour([],None,role(None,[numeric]),role(to,[numeric]),role(from,[numeric]))',
            self.__all_color_verb)
        self.add_verb2(9, 'do([re],None,role(None,[numeric]))',
                       self.__redo_k_verb)
        self.add_verb2(10, 'do([re],None)', self.__redo_all_verb)

        self.domain = piw.clockdomain_ctl()
        self.domain.set_source(piw.makestring('*', 0))
        self.__size = 0
        self.finder = talker.TalkerFinder()

        self[1] = bundles.Output(1,
                                 False,
                                 names='light output',
                                 protocols='revconnect')

        self.light_output = bundles.Splitter(self.domain, self[1])
        self.light_convertor = piw.lightconvertor(False,
                                                  self.light_output.cookie())
        self.light_aggregator = piw.aggregator(self.light_convertor.cookie(),
                                               self.domain)
        self.controller = piw.controller(self.light_aggregator.get_output(1),
                                         utils.pack_str(1, 2))

        self.activation_input = bundles.VectorInput(
            self.controller.event_cookie(), self.domain, signals=(1, 2))

        self[3] = collection.Collection(creator=self.__create,
                                        wrecker=self.__wreck,
                                        names='key',
                                        inst_creator=self.__create_inst,
                                        inst_wrecker=self.__wreck_inst,
                                        protocols='hidden-connection explicit')
        self[4] = PhraseBrowser(self.__eventlist, self.__keylist)

        self[5] = atom.Atom(
            domain=domain.Aniso(),
            policy=self.activation_input.merge_nodefault_policy(2, False),
            names='controller input')
        self[6] = atom.Atom(domain=domain.Aniso(),
                            policy=self.activation_input.vector_policy(
                                1, False),
                            names='key input')