コード例 #1
0
ファイル: SimpleSentenceForm.py プロジェクト: hobson/ggpy
 def create_0(cls, function_):
     """ generated source for method create_0 """
     name = function_.__name__
     arity = function_.arity()
     tupleSize = 0
     functions = Maps.newHashMap()
     i = 0
     while i < arity:
         if isinstance(term, (GdlFunction, )):
             functions.put(i, functionForm)
             tupleSize += functionForm.getTupleSize()
         else:
             tupleSize += 1
         i += 1
     return SimpleSentenceForm(name, arity, ImmutableMap.copyOf(functions), tupleSize)
コード例 #2
0
 def create(cls, formModel, domains):
     """ generated source for method create """
     return ImmutableSentenceDomainModel(ImmutableSentenceFormModel.copyOf(formModel), ImmutableMap.copyOf(domains))
コード例 #3
0
ファイル: VariableConstrainer.py プロジェクト: hobson/ggpy
 def create(cls, original, replacementsByOriginalTupleIndex, replacement):
     """ generated source for method create """
     return cls.Ambiguity(original, ImmutableMap.copyOf(replacementsByOriginalTupleIndex), replacement)
コード例 #4
0
ファイル: AssignmentFunction.py プロジェクト: hobson/ggpy
 def create(cls, conjunct, functionInfo, rightmostVar, varOrder, preassignment):
     """ generated source for method create """
     # We have to set up the things mentioned above...
     internalFunctions = ArrayList()
     # We can traverse the conjunct for the list of variables/constants...
     terms = ArrayList()
     gatherVars(conjunct.getBody(), terms)
     # Note that we assume here that the var of interest only
     # appears once in the relation...
     varIndex = terms.indexOf(rightmostVar)
     if varIndex == -1:
         print "conjunct is: " + conjunct
         print "terms are: " + terms
         print "righmostVar is: " + rightmostVar
     terms.remove(rightmostVar)
     function_ = functionInfo.getValueMap(varIndex)
     # Set up inputs and such, using terms
     querySize = len(terms)
     isInputConstant = ArrayList(len(terms))
     queryConstants = Maps.newHashMap()
     queryInputIndices = ArrayList(len(terms))
     i = 0
     while i < len(terms):
         if isinstance(term, (GdlConstant, )):
             isInputConstant.add(True)
             queryConstants.put(i, term)
             queryInputIndices.add(-1)
         elif isinstance(term, (GdlVariable, )):
             # Is it in the head assignment?
             if preassignment.containsKey(term):
                 isInputConstant.add(True)
                 queryConstants.put(i, preassignment.get(term))
                 queryInputIndices.add(-1)
             else:
                 isInputConstant.add(False)
                 # 						queryConstants.add(null);
                 # What value do we put here?
                 # We want to grab some value out of the
                 # input tuple, which uses functional ordering
                 # Index of the relevant variable, by the
                 # assignment's ordering
                 queryInputIndices.add(varOrder.indexOf(term))
         i += 1
     return AssignmentFunction(ImmutableList.copyOf(internalFunctions), querySize, ImmutableList.copyOf(isInputConstant), ImmutableMap.copyOf(queryConstants), ImmutableList.copyOf(queryInputIndices), ImmutableMap.copyOf(function_))
コード例 #5
0
ファイル: SentenceDomainModels.py プロジェクト: hobson/ggpy
 def combineDomains(cls, varDomainsByVar):
     """ generated source for method combineDomains """
     return ImmutableMap.copyOf(Maps.transformValues(varDomainsByVar.asMap(), Function()))
コード例 #6
0
 def create(cls, varsToAssign, tuplesBySource, headAssignment, indicesToChangeWhenNull, distincts, varsToChangePerDistinct, valuesToCompute, sourceDefiningSlot, valuesToIterate, varsChosenBySource, putDontCheckBySource, empty, allDone):
     """ generated source for method create """
     if empty:
         return cls.EMPTY_ITERATION_PLAN
     return AssignmentIterationPlan(ImmutableList.copyOf(varsToAssign), ImmutableList.copyOf(tuplesBySource), ImmutableMap.copyOf(headAssignment), ImmutableList.copyOf(indicesToChangeWhenNull), ImmutableList.copyOf(distincts), fromNullableList(varsToChangePerDistinct), fromNullableList(valuesToCompute), ImmutableList.copyOf(sourceDefiningSlot), ImmutableList.copyOf(valuesToIterate), ImmutableList.copyOf(varsChosenBySource), ImmutableList.copyOf(putDontCheckBySource), empty, allDone)