hylar/core/Logics/Logics.js
function(rs, fs) {
        var restriction = [];

        for (var i = 0; i < rs.length; i++) {
            var rule = rs[i], matches = false;

            for (var j = 0; j < rule.causes.length; j++) {
                var cause = rule.causes[j];

                for (var k = 0; k < fs.length; k++) {
                    var fact = fs[k];

                    if (this.causeMatchesFact(cause, fact)) {
                        matches = true;
                        break;
                    }
                }

                if (matches) {
                    restriction.push(rule);
                    break;
                }
            }
        }

        return restriction;
    }
function(rs, fs) {
        var restriction = [];

        for (var i = 0; i < rs.length; i++) {
            var rule = rs[i], matches = false;

            for (var j = 0; j < rule.causes.length; j++) {
                var cause = rule.causes[j];

                for (var k = 0; k < fs.length; k++) {
                    var fact = fs[k];

                    if (this.causeMatchesFact(cause, fact)) {
                        matches = true;
                        break;
                    }
                }

                if (matches) {
                    restriction.push(rule);
                    break;
                }
            }
        }

        return restriction;
    }
function ( rs , fs ) { var restriction = [ ] ; for ( var i = 0 ; i < rs . length ; i ++ ) { var rule = rs [ i ] , matches = false ; for ( var j = 0 ; j < rule . causes . length ; j ++ ) { var cause = rule . causes [ j ] ; for ( var k = 0 ; k < fs . length ; k ++ ) { var fact = fs [ k ] ; if ( this . causeMatchesFact ( cause , fact ) ) { matches = true ; break ; } } if ( matches ) { restriction . push ( rule ) ; break ; } } } return restriction ; }
Returns a restricted rule set,
in which at least one fact from the fact set
matches all rules.
@param rs
@param fs
@returns {Array}
Returns a restricted rule set in which at least one fact from the fact set matches all rules .