Exemple #1
0
    def accept_SelectRelatedNode(self, node):
        handle = self.accept(node.handle).fget()
        if node.cardinality == 'many':
            chain = xtuml.navigate_many(handle)
        else:
            chain = xtuml.navigate_one(handle)

        for step in self.accept(node.navigation_chain):
            chain = step(chain)

        self.symtab.install_symbol(node.variable_name, chain())
 def accept_SelectRelatedNode(self, node):
     handle = self.accept(node.handle).fget()
     if node.cardinality == 'many':
         chain = xtuml.navigate_many(handle)
     else:
         chain = xtuml.navigate_one(handle)
         
     for step in self.accept(node.navigation_chain):
         chain = step(chain)
     
     self.symtab.install_symbol(node.variable_name, chain())
 def test_sort(self):
     act_blk = self.m.new('ACT_BLK')
     
     prev = None
     for idx in range(10):
         inst = self.m.new('ACT_SMT', LineNumber=idx)
         self.assertTrue(xtuml.relate(inst, act_blk, 602))
         xtuml.relate(prev, inst, 661, 'precedes')
         prev = inst
         
     inst_set = xtuml.navigate_many(act_blk).ACT_SMT[602]()
     inst_set = xtuml.sort_reflexive(inst_set, 661, 'succeeds')
     self.assertEqual(len(inst_set), 10)
     for idx, inst in enumerate(inst_set):
         self.assertEqual(inst.LineNumber, idx)
     
     inst_set = xtuml.navigate_many(act_blk).ACT_SMT[602]()
     inst_set = xtuml.sort_reflexive(inst_set, 661, 'precedes')
     self.assertEqual(len(inst_set), 10)
     for idx, inst in enumerate(inst_set):
         self.assertEqual(inst.LineNumber, 9 - idx)
Exemple #4
0
    def test_sort(self):
        act_blk = self.m.new('ACT_BLK')

        prev = None
        for idx in range(10):
            inst = self.m.new('ACT_SMT', LineNumber=idx)
            self.assertTrue(xtuml.relate(inst, act_blk, 602))
            xtuml.relate(prev, inst, 661, 'precedes')
            prev = inst

        inst_set = xtuml.navigate_many(act_blk).ACT_SMT[602]()
        inst_set = xtuml.sort_reflexive(inst_set, 661, 'succeeds')
        self.assertEqual(len(inst_set), 10)
        for idx, inst in enumerate(inst_set):
            self.assertEqual(inst.LineNumber, idx)

        inst_set = xtuml.navigate_many(act_blk).ACT_SMT[602]()
        inst_set = xtuml.sort_reflexive(inst_set, 661, 'precedes')
        self.assertEqual(len(inst_set), 10)
        for idx, inst in enumerate(inst_set):
            self.assertEqual(inst.LineNumber, 9 - idx)
Exemple #5
0
    def accept_SelectRelatedWhereNode(self, node):
        def where(selected):
            self.symtab.enter_block()
            self.symtab.install_symbol('selected', selected)
            value = self.accept(node.where_clause)
            self.symtab.leave_block()
            return value.fget()

        handle = self.accept(node.handle).fget()
        if node.cardinality == 'many':
            chain = xtuml.navigate_many(handle)
        else:
            chain = xtuml.navigate_one(handle)

        for step in self.accept(node.navigation_chain):
            chain = step(chain)

        self.symtab.install_symbol(node.variable_name, chain(where))
 def accept_SelectRelatedWhereNode(self, node):
     def where(selected):
         self.symtab.enter_block()
         self.symtab.install_symbol('selected', selected)
         value = self.accept(node.where_clause)
         self.symtab.leave_block()
         return value.fget()
     
     handle = self.accept(node.handle).fget()
     if node.cardinality == 'many':
         chain = xtuml.navigate_many(handle)
     else:
         chain = xtuml.navigate_one(handle)
         
     for step in self.accept(node.navigation_chain):
         chain = step(chain)
     
     self.symtab.install_symbol(node.variable_name, chain(where))
 def testNavigateNone(self):
     self.assertIsNone(xtuml.navigate_one(None)())
     self.assertEqual(len(xtuml.navigate_many(None)()), 0)
 def testNavMany(self):
     m = self.metamodel
     s_dt = m.select_many('S_DT')
     pe_pe = xtuml.navigate_many(s_dt).PE_PE[8001](lambda inst: True)
     self.assertEqual(len(s_dt), len(pe_pe))
Exemple #9
0
 def chain(self, inst):
     return xtuml.navigate_many(inst)
Exemple #10
0
 def test_navigate_many_where(self):
     m = self.metamodel
     s_cdt = m.select_many('S_CDT')
     c_dt = xtuml.navigate_many(s_cdt).S_DT[17](where(Name='integer'))
     self.assertEqual(1, len(c_dt))
Exemple #11
0
 def chain(self, inst):
     return xtuml.navigate_many(inst)