本文整理汇总了Python中xtuml.one函数的典型用法代码示例。如果您正苦于以下问题:Python one函数的具体用法?Python one怎么用?Python one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: accept_ACT_IOP
def accept_ACT_IOP(self, inst):
self.accept(one(inst).SPR_PO[680].SPR_PEP[4503]())
self.accept(one(inst).SPR_RO[657].SPR_REP[4502]())
self.buf('(')
first_filter = lambda sel: one(sel).V_PAR[816, 'succeeds']() is None
self.accept(any(inst).V_PAR[679](first_filter))
self.buf(')')
示例2: check_link
def check_link(side):
r_rto = one(side).R_RTO[204]()
target_o_obj = one(r_rto).R_OIR[203].O_OBJ[201]()
if side.Mult:
cardinality = 'many'
else:
cardinality = 'one'
text = atleast_one_tmpl.substitute(From=target_o_obj.Key_Lett,
To=source_o_obj.Key_Lett,
Numb=r_rel.Numb,
Cardinality=cardinality,
Phrase=side.Txt_Phrs)
if not side.Cond:
if side.Mult:
cardinality = 'one'
else:
cardinality = 'one'
text += atleast_one_tmpl.substitute(From=source_o_obj.Key_Lett,
To=target_o_obj.Key_Lett,
Numb=r_rel.Numb,
Cardinality=cardinality,
Phrase=side.Txt_Phrs)
return text
示例3: mk_subsuper_association_check
def mk_subsuper_association_check(m, r_subsup):
r_rel = one(r_subsup).R_REL[206]()
r_rto = one(r_subsup).R_SUPER[212].R_RTO[204]()
target_o_obj = one(r_rto).R_OIR[203].O_OBJ[201]()
text = ''
loop_body = ''
for r_sub in many(r_subsup).R_SUB[213]():
r_rgo = one(r_sub).R_RGO[205]()
source_o_obj = one(r_rgo).R_OIR[203].O_OBJ[201]()
text += subtype_tmpl.substitute(From=source_o_obj.Key_Lett,
To=target_o_obj.Key_Lett,
Numb=r_rel.Numb,
Cardinality='one')
loop_body += supertype_body_tmpl.substitute(From=target_o_obj.Key_Lett,
To=source_o_obj.Key_Lett,
Numb=r_rel.Numb)
text += supertype_loop_tmpl.substitute(From=target_o_obj.Key_Lett,
Numb=r_rel.Numb,
Loop_Body=loop_body)
return text
示例4: accept_ACT_FIW
def accept_ACT_FIW(self, inst):
o_obj = one(inst).O_OBJ[676]()
self.buf('select ', inst.cardinality, ' ')
self.accept(one(inst).V_VAR[665]())
self.buf(' from instances of ', o_obj.Key_Lett)
self.buf(' where ')
self.accept(one(inst).V_VAL[610]())
示例5: accept_ACT_SGN
def accept_ACT_SGN(self, inst):
self.accept(one(inst).SPR_PS[663].SPR_PEP[4503]())
self.accept(one(inst).SPR_RS[660].SPR_REP[4502]())
self.buf('(')
first_filter = lambda sel: one(sel).V_PAR[816, 'succeeds']() is None
self.accept(any(inst).V_PAR[662](first_filter))
self.buf(')')
示例6: accept_ACT_SEL
def accept_ACT_SEL(self, inst):
self.buf('select ', inst.cardinality, ' ')
self.accept(one(inst).V_VAR[638]())
self.buf(' related by ')
self.accept(one(inst).V_VAL[613]())
self.accept(one(inst).ACT_LNK[637]())
self.accept(one(inst).ACT_SRW[664]())
示例7: accept_V_FNV
def accept_V_FNV(self, inst):
s_sync = one(inst).S_SYNC[827]()
self.buf('::', s_sync.Name)
self.buf('(')
first_filter = lambda sel: one(sel).V_PAR[816, 'succeeds']() is None
self.accept(any(inst).V_PAR[817](first_filter))
self.buf(')')
示例8: accept_V_PAR
def accept_V_PAR(self, inst):
if one(inst).V_PAR[816, 'succeeds']() is not None:
self.buf(', ')
self.buf(inst.Name, ': ')
self.accept(one(inst).V_VAL[800]())
self.accept(one(inst).V_PAR[816, 'precedes']())
示例9: parameters
def parameters(self, function_name):
s_sync = self.m.select_one('S_SYNC', where(Name=function_name))
first_filt = lambda sel: not one(sel).S_SPARM[54, 'precedes']()
s_sparm = one(s_sync).S_SPARM[24](first_filt)
while s_sparm:
yield s_sparm.Name
s_sparm = one(s_sparm).S_SPARM[54, 'succeeds']()
示例10: accept_ACT_FOR
def accept_ACT_FOR(self, inst):
self.buf('for each ')
self.accept(one(inst).V_VAR[614]())
self.buf(' in ')
self.accept(one(inst).V_VAR[652]())
self.accept(one(inst).ACT_BLK[605]())
self.buf('end for')
示例11: accept_V_MSV
def accept_V_MSV(self, inst):
self.accept(one(inst).SPR_PEP[841]())
self.accept(one(inst).SPR_REP[845]())
self.buf('(')
first_filter = lambda sel: one(sel).V_PAR[816, 'succeeds']() is None
self.accept(any(inst).V_PAR[842](first_filter))
self.buf(')')
示例12: test_for_each_loop
def test_for_each_loop(self):
'''
create object instance of A;
create object instance of A;
select many a_set from instances of A;
for each a in a_set
end for;
'''
act_for = self.metamodel.select_one('ACT_FOR')
self.assertTrue(act_for.is_implicit)
act_smt = one(act_for).ACT_SMT[603]()
self.assertIsNotNone(act_smt)
act_blk = one(act_for).ACT_BLK[605]()
self.assertIsNotNone(act_blk)
v_var = one(act_for).V_VAR[614]()
self.assertEqual(v_var.Name, 'a')
v_var = one(act_for).V_VAR[652]()
self.assertEqual(v_var.Name, 'a_set')
o_obj = one(act_for).O_OBJ[670]()
self.assertEqual(o_obj.Key_Lett, 'A')
示例13: mk_linked_association
def mk_linked_association(m, inst):
'''
Create pyxtuml associations from a linked association in BridgePoint.
'''
r_rel = one(inst).R_REL[206]()
r_rgo = one(inst).R_ASSR[211].R_RGO[205]()
source_o_obj = one(r_rgo).R_OIR[203].O_OBJ[201]()
def _mk_link(side1, side2):
r_rto = one(side1).R_RTO[204]()
target_o_obj = one(r_rto).R_OIR[203].O_OBJ[201]()
cardinality = mult_cond(side2.Mult, side2.Cond)
source_ids, target_ids = get_related_attributes(r_rgo, r_rto)
source = xtuml.AssociationLink(source_o_obj.Key_Lett, cardinality,
source_ids, side1.Txt_Phrs)
target = xtuml.AssociationLink(target_o_obj.Key_Lett, '1', target_ids,
side2.Txt_Phrs)
if side1.Obj_ID != side2.Obj_ID:
target.phrase = source.phrase = ''
m.define_association(r_rel.Numb, source, target)
r_aone = one(inst).R_AONE[209]()
r_aoth = one(inst).R_AOTH[210]()
if None in [r_rgo, r_aone, r_aoth]:
logger.info('Omitting unformalized association R%s' % (r_rel.Numb))
return
_mk_link(r_aone, r_aoth)
_mk_link(r_aoth, r_aone)
示例14: accept_V_BRV
def accept_V_BRV(self, inst):
s_brg = one(inst).S_BRG[828]()
s_ee = one(s_brg).S_EE[19]()
self.buf('bridge ', s_ee.Key_Lett, '::', s_brg.Name)
self.buf('(')
first_filter = lambda sel: one(sel).V_PAR[816, 'succeeds']() is None
self.accept(any(inst).V_PAR[810](first_filter))
self.buf(')')
示例15: accept_ACT_LNK
def accept_ACT_LNK(self, inst):
o_obj = one(inst).O_OBJ[678]()
r_rel = one(inst).R_REL[681]()
self.buf('->', o_obj.Key_Lett, '[R', str(r_rel.Numb))
if inst.Rel_Phrase:
self.buf('.', inst.Rel_Phrase)
self.buf(']')
self.accept(one(inst).ACT_LNK[604, 'precedes']())