hylar/core/Logics/Solver.js
function(rs, facts, doTagging, resolvedImplicitFactSet) {
        var deferred = q.defer(), promises = [], cons = [], filteredFacts;
        for (var key in rs) {            
            if (doTagging) {
                promises.push(this.evaluateThroughRestrictionWithTagging(rs[key], facts, resolvedImplicitFactSet));
            } else {
                promises.push(this.evaluateThroughRestriction(rs[key], facts));
            }
        }
        try {                    
            q.all(promises).then(function (consTab) {                
                for (var i = 0; i < consTab.length; i++) {
                    cons = cons.concat(consTab[i]);
                }
                deferred.resolve({cons: cons});
            });
        } catch(e) {
            deferred.reject(e);
        }
        return deferred.promise;
    }
function(rs, facts, doTagging, resolvedImplicitFactSet) {
        var deferred = q.defer(), promises = [], cons = [], filteredFacts;
        for (var key in rs) {            
            if (doTagging) {
                promises.push(this.evaluateThroughRestrictionWithTagging(rs[key], facts, resolvedImplicitFactSet));
            } else {
                promises.push(this.evaluateThroughRestriction(rs[key], facts));
            }
        }
        try {                    
            q.all(promises).then(function (consTab) {                
                for (var i = 0; i < consTab.length; i++) {
                    cons = cons.concat(consTab[i]);
                }
                deferred.resolve({cons: cons});
            });
        } catch(e) {
            deferred.reject(e);
        }
        return deferred.promise;
    }
function ( rs , facts , doTagging , resolvedImplicitFactSet ) { var deferred = q . defer ( ) , promises = [ ] , cons = [ ] , filteredFacts ; for ( var key in rs ) { if ( doTagging ) { promises . push ( this . evaluateThroughRestrictionWithTagging ( rs [ key ] , facts , resolvedImplicitFactSet ) ) ; } else { promises . push ( this . evaluateThroughRestriction ( rs [ key ] , facts ) ) ; } } try { q . all ( promises ) . then ( function ( consTab ) { for ( var i = 0 ; i < consTab . length ; i ++ ) { cons = cons . concat ( consTab [ i ] ) ; } deferred . resolve ( { cons : cons } ) ; } ) ; } catch ( e ) { deferred . reject ( e ) ; } return deferred . promise ; }
Evaluates a set of rules over a set of facts.
@param rs
@param facts
@returns Array of the evaluation.
Evaluates a set of rules over a set of facts .