src/filter_tree/filter_tree.c
/* Applies a single filter to a single result.
 * Compares given values, tests if values maintain desired relation (op) */
Applies a single filter to a single result.
Compares given values, tests if values maintain desired relation (op)
Applies a single filter to a single result . Compares given values tests if values maintain desired relation ( op )
int _applyFilter(SIValue *aVal, SIValue *bVal, AST_Operator op) {
	int disjointOrNull = 0;
	int rel = SIValue_Compare(*aVal, *bVal, &disjointOrNull);
	if(disjointOrNull == COMPARED_NULL) return false;
	if(disjointOrNull == DISJOINT) {
		return (op == OP_NEQUAL);
	}
	switch(op) {
	case OP_EQUAL:
		return rel == 0;
	case OP_NEQUAL:
		return rel != 0;
	case OP_GT:
		return rel > 0;
	case OP_GE:
		return rel >= 0;
	case OP_LT:
		return rel < 0;
	case OP_LE:
		return rel <= 0;
	default:
		assert(0);
	}
	return 0;
}
int _applyFilter ( SIValue * aVal , SIValue * bVal , AST_Operator op ) { int disjointOrNull = 0 ; int rel = SIValue_Compare ( * aVal , * bVal , & disjointOrNull ) ; if ( disjointOrNull == COMPARED_NULL ) return false ; if ( disjointOrNull == DISJOINT ) { return ( op == OP_NEQUAL ) ; } switch ( op ) { case OP_EQUAL : return rel == 0 ; case OP_NEQUAL : return rel != 0 ; case OP_GT : return rel > 0 ; case OP_GE : return rel >= 0 ; case OP_LT : return rel < 0 ; case OP_LE : return rel <= 0 ; default : assert ( 0 ) ; } return 0 ; }
Applies a single filter to a single result.
Applies a single filter to a single result .
// If there was null comparison, return false. /* Values are of disjoint types */ /* The filter passes if we're testing for inequality, and fails otherwise. */ /* Op should be enforced by AST. */ /* We shouldn't reach this point. */