hylar/core/Logics/Solver.js
function(rule, facts) {
        var mappingList = this.getMappings(rule, facts),
            consequences = [], deferred = q.defer();

        try {
            this.checkOperators(rule, mappingList);
            
            for (var i = 0; i < mappingList.length; i++) {
                if (mappingList[i]) {
                    // Replace mappings on all consequences
                    for (var j = 0; j < rule.consequences.length; j++) {                        
                        consequences.push(this.substituteFactVariables(mappingList[i], rule.consequences[j], [], rule));
                        
                    }
                }
            }
            deferred.resolve(consequences);
        } catch(e) {
            deferred.reject(e);
        }

        return deferred.promise;
    }
function(rule, facts) {
        var mappingList = this.getMappings(rule, facts),
            consequences = [], deferred = q.defer();

        try {
            this.checkOperators(rule, mappingList);
            
            for (var i = 0; i < mappingList.length; i++) {
                if (mappingList[i]) {
                    // Replace mappings on all consequences
                    for (var j = 0; j < rule.consequences.length; j++) {                        
                        consequences.push(this.substituteFactVariables(mappingList[i], rule.consequences[j], [], rule));
                        
                    }
                }
            }
            deferred.resolve(consequences);
        } catch(e) {
            deferred.reject(e);
        }

        return deferred.promise;
    }
function ( rule , facts ) { var mappingList = this . getMappings ( rule , facts ) , consequences = [ ] , deferred = q . defer ( ) ; try { this . checkOperators ( rule , mappingList ) ; for ( var i = 0 ; i < mappingList . length ; i ++ ) { if ( mappingList [ i ] ) { // Replace mappings on all consequences for ( var j = 0 ; j < rule . consequences . length ; j ++ ) { consequences . push ( this . substituteFactVariables ( mappingList [ i ] , rule . consequences [ j ] , [ ] , rule ) ) ; } } } deferred . resolve ( consequences ) ; } catch ( e ) { deferred . reject ( e ) ; } return deferred . promise ; }
Evaluates a rule over a set of facts through
restriction of the rule's causes.
@param rule
@param facts
@returns {Array}
Evaluates a rule over a set of facts through restriction of the rule s causes .