Ejemplo n.º 1
0
 def copyOf(cls, other):
     """ generated source for method copyOf """
     if isinstance(other, (ImmutableSentenceDomainModel, )):
         return cls.copyOf((other).getFormModel())
     elif isinstance(other, (ImmutableSentenceFormModel, )):
         return other
     rulesByForm = ImmutableSetMultimap.builder()
     trueSentencesByForm = ImmutableSetMultimap.builder()
     for form in other.getSentenceForms():
         rulesByForm.putAll(form, other.getRules(form))
         trueSentencesByForm.putAll(form, other.getSentencesListedAsTrue(form))
     return ImmutableSentenceFormModel(ImmutableList.copyOf(other.getDescription()), ImmutableSet.copyOf(other.getSentenceForms()), ImmutableSet.copyOf(other.getConstantSentenceForms()), ImmutableSet.copyOf(other.getIndependentSentenceForms()), ImmutableSetMultimap.copyOf(other.getDependencyGraph()), rulesByForm.build(), trueSentencesByForm.build())
Ejemplo n.º 2
0
 def getRulesByForm(cls, gameRules, sentenceForms):
     """ generated source for method getRulesByForm """
     builder = ImmutableSetMultimap.builder()
     for gdl in gameRules:
         if isinstance(gdl, (GdlRule, )):
             for form in sentenceForms:
                 if form.matches(rule.getHead()):
                     builder.put(form, rule)
                     break
     return builder.build()