예제 #1
0
            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));
                }
            }
예제 #2
0
            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));
            }