public bool evaluate(Object block, Block blockType) { BlockHandler handler = BlockHandlerRegistry.GetBlockHandler(blockType); Primitive value = comparisonValue.GetValue(); PropertySupplier prop = property ?? handler.GetDefaultProperty(value.GetPrimitiveType()); if (direction.HasValue) { return(comparator.compare(handler.GetPropertyValue(block, prop, direction.Value), value)); } else { return(comparator.compare(handler.GetPropertyValue(block, prop), value)); } }
public Primitive GetValue() { List <Object> blocks = entityProvider.GetEntities(); if (aggregationType == PropertyAggregate.COUNT) { return(new NumberPrimitive(blocks.Count)); } BlockHandler handler = BlockHandlerRegistry.GetBlockHandler(entityProvider.GetBlockType()); PropertySupplier p = property ?? handler.GetDefaultProperty(Return.NUMERIC); List <Primitive> propertyValues = blocks.Select(b => { return(direction.HasValue ? handler.GetPropertyValue(b, p, direction.Value) : handler.GetPropertyValue(b, p)); }).ToList(); return(Aggregate(propertyValues, aggregationType)); }