private protected AttributeLimitsBuilderBase(TLabel labelValue, LabelBuilderBase <TLabel, TAttributeArg, TAttributeKind> labelBuilder, IOrdering defaultOrdering) { _labelValue = labelValue; _labelBuilder = labelBuilder; _defaultOrdering = defaultOrdering; _attributesLimits = new List <IAttributeLimits <TAttributeKind> >(); }
public IPagedList <Story> GetStoriesWithText(string text, string language, Pagination pagination, IOrdering <Story> orderBy) { if (pagination == null || string.IsNullOrEmpty(language)) { return(null); } return(this.storyRepository.GetWithText(text, language, pagination, orderBy ?? new StoryOrderByDate())); }
public void AddOrdering(IOrdering ordering) { if (ordering == null) { throw new ArgumentNullException(nameof(ordering)); } if (!CanAddOrdering(ordering)) { throw new ArgumentException("Duplicate!", nameof(ordering)); } _orderings.Add(ordering); }
public IColorEffect GetColorEffect(string propertyName, IOrdering ordering) { IColorEffect baseEffect = (IColorEffect) this[propertyName]; IColorEffect effect = ColorEffects.GetEffect(baseEffect.Name, baseEffect.Colors); effect.Ordering = ordering; ImageEffect imageEffect = effect as ImageEffect; if (imageEffect != null) { imageEffect.Width = ((ImageEffect) baseEffect).Width; imageEffect.ImageName = ((ImageEffect) baseEffect).ImageName; } return effect; }
private bool CanAddOrdering(IOrdering ordering) { if (ordering == null) { throw new ArgumentNullException(nameof(ordering)); } if (_orderings.Contains(ordering)) { return(false); } return(true); }
public IAttributeLimitsBuilder <TAttributeArg, TLabel> Attribute(TAttributeArg attribute, double min, double max, IOrdering ordering) { var attr = MapAttribute(attribute); var finalOrdering = OrderingBase.Coalesce(ordering, GetAttributeDefaultOrdering(attr)); return(AddAttributeProperty(attr, min, max, finalOrdering)); }
private TypedDatasetBuilder(PropertyInfo labelProperty, IOrdering defaultOrdering, IAttributeNumberGenerator attributeNumberGenerator) : base(attributeNumberGenerator, new TypedLabelBuilder <TEntity, TAttribute, TLabel>(labelProperty, OrderingBase.Coalesce(defaultOrdering))) { _labelProperty = labelProperty; }
public TypedDatasetBuilder(Expression <Func <TEntity, TLabel> > label, IOrdering defaultOrdering) : this(label, defaultOrdering, new EquidistantAttributeNumberGenerator()) { }
public GridSortFactory(IOrdering ordering) { Ordering = ordering; }
public DynamicLabelBuilder(IOrdering defaultOrdering) : base(defaultOrdering) { }
internal AttributeDefaultOrdering(TAttributeKind attribute, IOrdering defaultOrdering) { this.Attribute = attribute; this.DefaultOrdering = defaultOrdering; }
public DynamicDatasetBuilder(IOrdering defaultOrdering) : this(defaultOrdering, new EquidistantAttributeNumberGenerator()) { }
internal AttributeLimits(TAttributeKind attribute, Limits limits, IOrdering ordering) { this.Attribute = attribute; this.Limits = limits; this.Ordering = ordering; }
public static IOrdering Coalesce(IOrdering ordering, IOrdering nullResult) { return(IsNull(ordering) ? nullResult : ordering); }
public static IOrdering Coalesce(IOrdering ordering) { return(Coalesce(ordering, OrderingFactory.None)); }
public static bool IsNull(IOrdering ordering) { return(ordering == null || (ordering is OrderingBase ord && ord == NullOrdering.Instance)); }
public OrderingComparer(IOrdering <A> ordering) { Ordering = ordering; }
internal TypedAttributeLimitsBuilder(TLabel labelValue, LabelBuilderBase <TLabel, Expression <Func <TEntity, TAttribute> >, PropertyInfo> labelBuilder, IOrdering defaultOrdering) : base(labelValue, labelBuilder, defaultOrdering) { }
protected IAttributeLimitsBuilder <TAttributeArg, TLabel> AddAttributeProperty(TAttributeKind attribute, double min, double max, IOrdering ordering) { _attributesLimits.Add(new AttributeLimits <TAttributeKind>(attribute, new Limits(min, max), ordering)); return(this); }
/// <inheritdoc /> public virtual async Task <IEnumerable <TEntity> > GetManyAsync <TEntity>(Expression <Func <TEntity, bool> > where, IPagination pagination, IOrdering ordering, CancellationToken cancellationToken = default) where TEntity : class, IEntity { if (where == null) { throw new ArgumentNullException(nameof(where)); } if (pagination == null) { throw new ArgumentNullException(nameof(pagination)); } if (ordering == null) { throw new ArgumentNullException(nameof(ordering)); } var indent = this.Context.Options.QueryIncludeDepth; return(await this.GetEntitySet <TEntity>() .IncludeAnnotations(indent) .Where(where) .Limit(pagination) .Order(ordering) .ToArrayAsync(cancellationToken)); }
internal DynamicAttributeLimitsBuilder(string labelValue, LabelBuilderBase <string, string, string> labelBuilder, IOrdering defaultOrdering) : base(labelValue, labelBuilder, defaultOrdering) { }
/// <summary> /// Adds order by clause to the <see cref="IQueryable{T}"/> based on the passed <paramref name="ordering"/> /// </summary> /// <typeparam name="T">The type used in the <see cref="IQueryable{T}"/>.</typeparam> /// <param name="source">The <see cref="IQueryable{T}"/>.</param> /// <param name="ordering">The <see cref="IOrdering"/>.</param> /// <returns>The <see cref="IQueryable{T}"/>.</returns> public static IQueryable <T> Order <T>(this IQueryable <T> source, IOrdering ordering) where T : class { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (ordering == null) { throw new ArgumentNullException(nameof(ordering)); } var parameter = Expression.Parameter(typeof(T)); var property = Expression.Property(parameter, ordering.By); if (property.Type == typeof(Guid)) { var expression = Expression.Lambda <Func <T, Guid> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(TimeSpan)) { var expression = Expression.Lambda <Func <T, TimeSpan> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(DateTime)) { var expression = Expression.Lambda <Func <T, DateTime> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(DateTimeOffset)) { var expression = Expression.Lambda <Func <T, DateTimeOffset> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } if (property.Type == typeof(byte)) { var expression = Expression.Lambda <Func <T, byte> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(int)) { var expression = Expression.Lambda <Func <T, int> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(long)) { var expression = Expression.Lambda <Func <T, long> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(float)) { var expression = Expression.Lambda <Func <T, float> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(double)) { var expression = Expression.Lambda <Func <T, double> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(decimal)) { var expression = Expression.Lambda <Func <T, decimal> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else if (property.Type == typeof(bool)) { var expression = Expression.Lambda <Func <T, bool> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } else { var expression = Expression.Lambda <Func <T, dynamic> >(property, parameter); return(ordering.Direction == OrderingDirection.Asc ? source.OrderBy(expression) : source.OrderByDescending(expression)); } }
public DynamicDatasetBuilder(IOrdering defaultOrdering, IAttributeNumberGenerator attributeNumberGenerator) : base(attributeNumberGenerator, new DynamicLabelBuilder(OrderingBase.Coalesce(defaultOrdering))) { }
public Query(ISpecification <TEntity> specification, Pagination pagination, IOrdering <TEntity> orderBy) { this.Pagination = pagination; this.OrderBy = orderBy; this.Specification = specification; }
private protected override AttributeLimitsBuilderBase <string, string, string> CreateAttributeLimitsBuilder(string labelValue, LabelBuilderBase <string, string, string> labelBuilder, IOrdering defaultOrdering) { return(new DynamicAttributeLimitsBuilder(labelValue, labelBuilder, defaultOrdering)); }
public ClientService(IOrdering ordering, IBilling billing) { _ordering = ordering; _billing = billing; }
public static IQueryable <T> OrderBy <T>(this IQueryable <T> query, IOrdering <T> orderBy) { return(orderBy.OrderingBy(query)); }
/// <inheritdoc /> public virtual async Task <TEntity> GetFirstAsync <TEntity>(Expression <Func <TEntity, bool> > where, IOrdering ordering, CancellationToken cancellationToken = default) where TEntity : class, IEntity { if (where == null) { throw new ArgumentNullException(nameof(where)); } if (ordering == null) { throw new ArgumentNullException(nameof(ordering)); } var indent = this.Context.Options.QueryIncludeDepth; return(await this.GetEntitySet <TEntity>() .IncludeAnnotations(indent) .Where(where) .FirstOrDefaultAsync(cancellationToken)); }
public IAttributeDefaultOrderingBuilder <TLabel, TAttributeArg, TAttributeKind> Attribute(TAttributeArg attribute, IOrdering defaultOrdering) { if (!OrderingBase.IsNull(defaultOrdering)) { var attr = MapAttribute(attribute); _attributesDefaultOrderings.Add(new AttributeDefaultOrdering <TAttributeKind>(attr, defaultOrdering)); } return(this); }
private Pattern GenPattern(IOrdering ordering) { Pattern pattern = _patternGen.GenSweep(new List<string> {"All"}); pattern.EffectProperties[PropertyDefinition.RepeatCount.Name] = 1; pattern.EffectProperties[PropertyDefinition.Easing.Name] = Easings.Linear; pattern.EffectProperties[PropertyDefinition.Ordering.Name] = ordering; pattern.EffectProperties[PropertyDefinition.RepeatCount.Name] = 1000; return pattern; }
public TypedDatasetBuilder(Expression <Func <TEntity, TLabel> > label, IOrdering defaultOrdering, IAttributeNumberGenerator attributeNumberGenerator) : this(Extensions.GetPropertyInfo(label), defaultOrdering, attributeNumberGenerator) { }
private void HandleGestureUpdate(GesturePosition[] gesturePositions, int lastBodyIndex) { lock (_taskLock) { if (_currentTask != null) { return; } _currentTask = Task.Factory.StartNew(() => { try { GesturePosition gesturePosition = gesturePositions[_bodyIndex]; IOrdering ordering = null; if (gesturePosition.IsTracked) { ordering = GetOrdering(Scene, gesturePosition.Head); } lock (_gestureLock) { if (ordering != null) _ordering = ordering; if (!_tracked && gesturePosition.IsTracked) _restart = true; _tracked = gesturePosition.IsTracked; _isLast = _bodyIndex == lastBodyIndex; } } finally { lock (_taskLock) { _currentTask = null; } } }); } }
public KinectPatternStart(IActivatable lightProvider, Scene scene, KinectPlugin kinectPlugin, int bodyIndex) : base(lightProvider, scene, 0, 0, GetBasePattern(), bodyIndex+1) { _ordering = GetOrdering(scene, new Vector3D()); _bodyIndex = bodyIndex; _plugin = kinectPlugin; _patternGen = new PatternGenerator(scene); _patternGen.AvailableOrderings = new List<string>{SpatialOrderingTypes.Expand}; _patternGen.Params.PatternLengthMin = .5; _patternGen.Params.PatternLengthMax = 1; _patternGen.Params.ColorsMin = 2; kinectPlugin.GestureUpdateHandler += HandleGestureUpdate; }
/// <inheritdoc /> public virtual async Task <IEnumerable <TEntity> > GetManyAsync <TEntity>(Expression <Func <TEntity, bool> > where, IOrdering ordering, IPagination pagination, CancellationToken cancellationToken = default) where TEntity : class, IEntity { if (where == null) { throw new ArgumentNullException(nameof(where)); } if (ordering == null) { throw new ArgumentNullException(nameof(ordering)); } if (pagination == null) { throw new ArgumentNullException(nameof(pagination)); } return(await this.GetManyAsync(where, pagination, ordering, cancellationToken)); }