Exemple #1
0
celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *result) {
	switch (filter->operand) {
		case AND: {
			array_list_pt filters = (array_list_pt) filter->value;
			unsigned int i;
			for (i = 0; i < arrayList_size(filters); i++) {
				filter_pt sfilter = (filter_pt) arrayList_get(filters, i);
				bool mresult;
				filter_match(sfilter, properties, &mresult);
				if (!mresult) {
					*result = 0;
					return CELIX_SUCCESS;
				}
			}
			*result = 1;
			return CELIX_SUCCESS;
		}
		case OR: {
			array_list_pt filters = (array_list_pt) filter->value;
			unsigned int i;
			for (i = 0; i < arrayList_size(filters); i++) {
				filter_pt sfilter = (filter_pt) arrayList_get(filters, i);
				bool mresult;
				filter_match(sfilter, properties, &mresult);
				if (mresult) {
					*result = 1;
					return CELIX_SUCCESS;
				}
			}
			*result = 0;
			return CELIX_SUCCESS;
		}
		case NOT: {
			filter_pt sfilter = (filter_pt) filter->value;
			bool mresult;
			filter_match(sfilter, properties, &mresult);
			*result = !mresult;
			return CELIX_SUCCESS;
		}
		case SUBSTRING :
		case EQUAL :
		case GREATER :
        case GREATEREQUAL :
		case LESS :
        case LESSEQUAL :
		case APPROX : {
			char * value = (properties == NULL) ? NULL: (char*)properties_get(properties, filter->attribute);

			return filter_compare(filter->operand, value, filter->value, result);
		}
		case PRESENT: {
			char * value = (properties == NULL) ? NULL: (char*)properties_get(properties, filter->attribute);
			*result = value != NULL;
			return CELIX_SUCCESS;
		}
	}
	*result = 0;
	return CELIX_SUCCESS;
}
Exemple #2
0
static unsigned composite_compare(void *a, void *b, size_t key_size)
{
    CompositeHashKey *ak = a;
    CompositeHashKey *bk = b;
    if (ak->bitmap_count != bk->bitmap_count)
        return 0;
    for (size_t i = 0; i < ak->bitmap_count; ++i) {
        if (ak->bitmaps[i].image != bk->bitmaps[i].image ||
            ak->bitmaps[i].x != bk->bitmaps[i].x ||
            ak->bitmaps[i].y != bk->bitmaps[i].y)
            return 0;
    }
    return filter_compare(&ak->filter, &bk->filter, key_size);
}
  void back_edge(edge& e, vertex& src) const
  {
    // "Randomize" the start of the search through target edges so that all
    // incident edge threads don't access the same sequence.
    int eid = get(eid_map, e);
    int start = eid;
    edge_iterator tg_edges = edges(targetG);

    for (int i = 0; i < tgsize; ++i)
    {
      int j = start++ % tgsize;
      if (filter_compare(e, tg_edges[j], g, targetG))
      {
        edge_mask[eid] = 1;
        break;
      }
    }
  }