Returns a new or updated mapping if a fact matches a rule cause or consequence,
return false otherwise.
@param fact
@param ruleFact
@param mapping
@returns {*}
966542
function(fact, ruleFact, mapping, constants, rule) {
        var localMapping = {};
    
        // Checks and update localMapping if matches     
        if (!this.factElemMatches(fact.predicate, ruleFact.predicate, mapping, localMapping)) {
            return false;
        }        
        if (!this.factElemMatches(fact.object, ruleFact.object, mapping, localMapping)) {
            return false;
        }
        if (!this.factElemMatches(fact.subject, ruleFact.subject, mapping, localMapping)) {
            return false;
        }
        
        emitter.emit('rule-fired', rule.name);        

        // If an already existing uri has been mapped...
        for (var key in localMapping) {
            if(constants.indexOf(localMapping[key]) !== -1) {
                return false;
            }
        }

        // Merges local and global mapping
        for (var mapKey in mapping) {
            if (mapKey == '__facts__') {
                localMapping[mapKey] = Utils.uniques(mapping[mapKey], [fact]);
            } else {
                for (key in localMapping) {
                    if (mapping[mapKey] == localMapping[key]) {
                        if (mapKey != key) {
                            return false;
                        }
                    }
                }
                localMapping[mapKey] = mapping[mapKey];
            }
        }

        // The new mapping is updated
        return localMapping;    
    }
385529
private function includeFact(Fact $fact, Date $min_date, Date $max_date): bool
    {
        $fact_date = $fact->date();

        return $fact_date->isOK() && Date::compare($min_date, $fact_date) <= 0 && Date::compare($fact_date, $max_date) <= 0;
    }
981283
public FactPattern getLHSParentFactPatternForBinding(final String var) {
        if (this.lhs == null) {
            return null;
        }
        for (int i = 0; i < this.lhs.length; i++) {
            IPattern pat = this.lhs[i];
            if (pat instanceof FromCompositeFactPattern) {
                pat = ((FromCompositeFactPattern) pat).getFactPattern();
            }
            if (pat instanceof FactPattern) {
                final FactPattern p = (FactPattern) pat;
                if (p.getBoundName() != null && var.equals(p.getBoundName())) {
                    return p;
                }
                for (int j = 0; j < p.getFieldConstraints().length; j++) {
                    FieldConstraint fc = p.getFieldConstraints()[j];
                    List<String> fieldBindings = getFieldBinding(fc);
                    if (fieldBindings.contains(var)) {
                        return p;
                    }
                }
            }
        }
        return null;
    }
1007119
public static Rule conditionsRule(final Set<Condition> conditions, String key, String value) {
        HashMap<String, String> results = new HashMap<>();
        results.put(key, value);
        return conditionsRule(conditions, results);
    }
744459
function InvalidValidationRuleParameter(ruleParameter, reason) {
  var defaultMessage = sprintf('%s is not a valid rule parameter.', ruleParameter);
  this.message = reason ? sprintf('%s. %s', defaultMessage, reason) : defaultMessage;
  this.name = 'InvalidValidationRuleParameter';

  Error.captureStackTrace(this, InvalidValidationRuleParameter);
}
38460
public boolean assertFact(final Object behaviorContext,
                              final InternalFactHandle factHandle,
                              final PropagationContext pctx,
                              final InternalWorkingMemory workingMemory) {
        boolean result = true;
        for ( int i = 0; i < behaviors.length; i++ ) {
            result = result && behaviors[i].assertFact( ((Object[]) behaviorContext)[i],
                                                        factHandle,
                                                        pctx,
                                                        workingMemory );
        }
        return result;
    }
355315
public long factMatching(long n) {
    return match(n)
        .when(caseLong(0)).get(() -> 1L)
        .when(caseLong(any())).get(i -> i * factMatching(i - 1))
        .getMatch();
  }
1281879
@Override
    public boolean validate(Field f) throws RuleValidationException
    {

        boolean checkvalidation = true;
        for (Annotation annotate : f.getDeclaredAnnotations())
        {
            RelationType eruleType = getRuleType(annotate.annotationType().getSimpleName());

            if (eruleType != null)
            {

                switch (eruleType)
                {
                case MANY_TO_MANY:
                    checkvalidation = validateManyToMany(f, annotate);
                    break;
                case MANY_TO_ONE:
                    checkvalidation = validateManyToOne(f, annotate);
                    break;
                case ONE_TO_MANY:
                    checkvalidation = validateOneToMany(f, annotate);
                    break;
                case ONE_TO_ONE:
                    checkvalidation = validateOneToOne(f, annotate);
                    break;

                }

            }
        }

        return checkvalidation;
    }
1326152
function ( e ) {
            var truthMap = getOrNull( this._spec(), 'truthMap' )
              , checked  = e.target.checked ? 'true' : 'false'
              , value    = truthMap ? truthMap[ checked ] : checked;

            var res = { 
                id:    this._conf().fieldID,
                meta:  this._meta(),
                value: {}
            };

            res.value[ res.id ] = value;
            this.handleEvent( 'change' )( e );
            this._conf().onChange( res );
        }
424144
function() {
        var factConj = '';
        for(var key in this.causes) {
            factConj += ' ^ ' + this.causes[key].toString().substring(1).replace(/,/g, '');
        }
        for(var key in this.operatorCauses) {
            factConj += ' ^ ' + this.operatorCauses[key].toString().substring(1).replace(/,/g, '');
        }
        return factConj.substr(3) + ' -> ' + this.consequences.toString().substring(1).replace(/,/g, '');
    }
55459
public void exclude(RuleProxyField ruleProxyField, String key,
            RuleContext ruleContext)
    {
        if (key.equals(ruleProxyField.getValue())) // this does not match when it should
        {
            String message = m_messageSourceAccessor.getMessage("nz.co.senanque.rules.invalid.exclude",
                    new Object[]
                    { ruleProxyField.getPropertyMetadata().getLabelName(), key });
            throw new InferenceException(message);
        }
        s_log.debug("Excluding {} for {}", key, ruleProxyField.getProxyField().getFieldName());
        if (!isExcluded(ruleProxyField.getProxyField(),key)) // only do this if not already excluded
        {
            Exclude exclude = new Exclude(ruleProxyField.getProxyField(), key,ruleContext);
            m_excludes.add(exclude);
            s_log.debug("{}excluding: {} {}",new Object[]{m_indenter,ruleProxyField,key});
        }        
    }
812987
function booleanFalse(validatedObject, errorText) {
  if (!_.isBoolean(validatedObject) || validatedObject) {
    throw new ValidationError(errorText || 'Validated object is not False');
  }
  return validatedObject;
}
116154
public static Boolean assertFalse(Boolean value, String message) {
        if (Boolean.valueOf(value))
            throw new IllegalArgumentException(message);
        return value;
    }
325677
function (fact, cb) {
            //fact = this.workingMemory.getFact(fact);
            if ("function" === typeof cb) {
                cb.call(fact, fact);
            }
            this.rootNode.modifyFact(this.workingMemory.modifyFact(fact));
            this.emit("modify", fact);
            return fact;
        }
1023426
public IAgendaStatsData getStatsForRule( String ruleName ) {
        AgendaStatsData data = this.agendaStats.getRuleStats( ruleName );
        return ( data == null ) ? null : data;
    }
431998
public void checkMismatchedValidatorAnnotation(Field field, Map<String, Class<?>> genericMap) {
        doCheckMismatchedValidatorAnnotation(field, genericMap);
    }
158737
public void assertEqualMappedBy(Function<? super E, ?> expectedMapper, Function<? super A, ?> actualMapper) {
		if (!isEqualMappedBy(expectedMapper, actualMapper)) {
			throwAssertionError();
		}
	}