예제 #1
0
 def to_AST(self):
     mask = Mask.from_keylen(len(self.lhs) - 1)
     keyvars = self.lhs[:-1]
     var = self.lhs[-1]
     sm = L.SMLookup(L.ln(self.rel),
                     mask.make_node().s, L.tuplify(keyvars), None)
     return L.Enumerator(L.sn(var), L.Set((sm, )))
예제 #2
0
파일: clause.py 프로젝트: IncOQ/incoq
 def to_AST(self):
     mask = Mask.from_keylen(len(self.lhs) - 1)
     keyvars = self.lhs[:-1]
     var = self.lhs[-1]
     sm = L.SMLookup(L.ln(self.rel), mask.make_node().s,
                     L.tuplify(keyvars), None)
     return L.Enumerator(L.sn(var), L.Set((sm,)))
예제 #3
0
파일: aggr.py 프로젝트: IncOQ/incoq
 def __init__(self, aggr, spec, name, demname, uset_lru, half_demand):
     self.params = params = tuple(spec.params)
     """Aggregate parameters (same as operand parameters).
     Also same as aggregate demand parameters.
     """
     
     self.aggrmask = Mask.from_keylen(len(params))
     """Aggregate result retrieval mask."""
     
     self.oper_deltamask = spec.relmask.make_delta_mask()
     """Mask for doing delta test upon change to aggregate operand."""
     
     assert not (spec.has_oper_demand and not self.has_demand), \
         'Can\'t have non-demand-driven aggregate over demand-driven ' \
         'operand'
     
     assert not (half_demand and not self.has_demand), \
         'Can\'t use half-demand strategy when not using demand at all'
예제 #4
0
파일: aggr.py 프로젝트: dcharkes/incoq
    def __init__(self, aggr, spec, name, demname, uset_lru, half_demand):
        self.params = params = tuple(spec.params)
        """Aggregate parameters (same as operand parameters).
        Also same as aggregate demand parameters.
        """

        self.aggrmask = Mask.from_keylen(len(params))
        """Aggregate result retrieval mask."""

        self.oper_deltamask = spec.relmask.make_delta_mask()
        """Mask for doing delta test upon change to aggregate operand."""

        assert not (spec.has_oper_demand and not self.has_demand), \
            'Can\'t have non-demand-driven aggregate over demand-driven ' \
            'operand'

        assert not (half_demand and not self.has_demand), \
            'Can\'t use half-demand strategy when not using demand at all'
예제 #5
0
    def from_AST(cls, node, factory):
        """Construct from an Enumerator node of form
        
            var in {<rel>.smlookup(<mask>, <key vars>)}
        
        """
        checktype(node, L.Enumerator)

        var = L.get_name(node.target)
        sm = L.get_singletonset(node.iter)
        checktype(sm, L.SMLookup)
        rel = L.get_name(sm.target)
        mask = Mask(sm.mask)
        keyvars = L.get_vartuple(sm.key)
        # Ensure the mask is consistent with how it's used.
        if mask != Mask.from_keylen(len(keyvars)):
            raise TypeError

        lhs = keyvars + (var, )
        return cls(lhs, rel)
예제 #6
0
파일: clause.py 프로젝트: IncOQ/incoq
 def from_AST(cls, node, factory):
     """Construct from an Enumerator node of form
     
         var in {<rel>.smlookup(<mask>, <key vars>)}
     
     """
     checktype(node, L.Enumerator)
     
     var = L.get_name(node.target)
     sm = L.get_singletonset(node.iter)
     checktype(sm, L.SMLookup)
     rel = L.get_name(sm.target)
     mask = Mask(sm.mask)
     keyvars = L.get_vartuple(sm.key)
     # Ensure the mask is consistent with how it's used.
     if mask != Mask.from_keylen(len(keyvars)):
         raise TypeError
     
     lhs = keyvars + (var,)
     return cls(lhs, rel)