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 getDependencyGraph(cls, sentenceForms, rulesByForm):
     """ generated source for method getDependencyGraph """
     dependencyGraph = HashMultimap.create()
     for entry in rulesByForm.entries():
         for bodyLiteral in rule.getBody():
             dependencyGraph.putAll(head, getSentenceFormsInBody(bodyLiteral, sentenceForms))
     return ImmutableSetMultimap.copyOf(dependencyGraph)
Ejemplo n.º 3
0
 def copyOf(cls, other):
     """ generated source for method copyOf """
     if isinstance(other, (ImmutableConstantChecker, )):
         return other
     model = other.getSentenceFormModel()
     sentencesByForm = HashMultimap.create()
     for form in other.getConstantSentenceForms():
         sentencesByForm.putAll(form, other.getTrueSentences(form))
     return ImmutableConstantChecker(ImmutableSentenceFormModel.copyOf(model), ImmutableSetMultimap.copyOf(sentencesByForm))
Ejemplo n.º 4
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()
Ejemplo n.º 5
0
 def create(cls, sentenceModel, sentencesByForm):
     """ generated source for method create """
     return ImmutableConstantChecker(ImmutableSentenceFormModel.copyOf(sentenceModel), ImmutableSetMultimap.copyOf(sentencesByForm))