Esempio n. 1
0
        public Criteria <Track> GetTrackCriteria(PropertyName propertyName, CriteriaType criteriaType, string valueString)
        {
            switch (propertyName)
            {
            case PropertyName.Lyrics:
                return(new LyricsCriteria(valueString, criteriaType));

            case PropertyName.TrackTitle:
                return(new TrackTitleCriteria(valueString, criteriaType));

            case PropertyName.Tags:
                return(new TagsCriteria(valueString, criteriaType));

            case PropertyName.Duration:
                return(new DurationCriteria(valueString, criteriaType));

            case PropertyName.DateAdded:
                return(new DateAddedCriteria(valueString, criteriaType));

            case PropertyName.DateModified:
                return(new DateModifiedCriteria(valueString, criteriaType));

            case PropertyName.TrackNo:
                return(new TrackNoCriteria(valueString, criteriaType));

            case PropertyName.TrackYear:
                return(new TrackYearCriteria(valueString, criteriaType));

            case PropertyName.Instrumental:
                return(new InstrumentalCriteria(criteriaType));

            default:
                throw new InvalidOperationException();
            }
        }
Esempio n. 2
0
        public void Refresh(CriteriaType criteriaType, TCriteria criteria)
        {
            Busy = true;
            Guid refreshGuid = Guid.NewGuid();

            _refreshGuid = refreshGuid;
            PaginationService.GetItems(criteriaType, PageSize, criteria, items => {
                if (_refreshGuid != refreshGuid)
                {
                    return;
                }
                _dispatcher.Invoke(() => {
                    CriteriaType = criteriaType;
                    if (criteriaType == CriteriaType.DownFromInfinity && items.Any())
                    {
                        Criteria = _getCriteriaFunc(items.First());
                    }
                    else if (criteriaType == CriteriaType.UpFromInfinity && items.Any())
                    {
                        Criteria = _getCriteriaFunc(items.Last());
                    }
                    else
                    {
                        Criteria = criteria;
                    }
                    UpdateItems(items);
                    Busy = false;
                });
            });
        }
Esempio n. 3
0
        public Criteria <Album> GetAlbumCriteria(PropertyName propertyName, CriteriaType criteriaType, string valueString)
        {
            switch (propertyName)
            {
            case PropertyName.DiscCount:
                return(new DiscCountCriteria(valueString, criteriaType));

            case PropertyName.AlbumArtist:
                return(new AlbumArtistCriteria(valueString, criteriaType));

            case PropertyName.AlbumTitle:
                return(new AlbumTitleCriteria(valueString, criteriaType));

            case PropertyName.AlbumTrackCount:
                return(new AlbumTrackCountCriteria(valueString, criteriaType));

            case PropertyName.ReleaseType:
                return(new ReleaseTypeCriteria(valueString, criteriaType));

            case PropertyName.ReleaseYear:
                return(new ReleaseYearCriteria(valueString, criteriaType));

            default:
                throw new InvalidOperationException();
            }
        }
Esempio n. 4
0
        void Add(CriteriaType type, CriteriaMode mode, string name, object value)
        {
            Criteria c = new Criteria(type, name, value);

            c.Mode = mode;
            Criterias.Add(c);
        }
Esempio n. 5
0
 internal ConditionCriteria(string fieldName, string fieldType, string value, CriteriaType criteriaType)
     : base(fieldName, criteriaType)
 {
     _fieldType = fieldType;
     _value = value;
     _valueAttributes = new Dictionary<string, string>();
 }
 public PagedUseCaseRequestCriteria(CriteriaType typeOfCriteria, int quantityOfRecordsPerPage, int pageRequested)
 {
     IsPaged                  = true;
     TypeOfCriteria           = typeOfCriteria;
     QuantityOfRecordsPerPage = quantityOfRecordsPerPage;
     PageRequested            = pageRequested;
 }
Esempio n. 7
0
 /// <summary>
 /// full constructor
 /// </summary>
 /// <param name="type"></param>
 /// <param name="maxCount"></param>
 /// <param name="epsilon"></param>
 public TermCriteria(CriteriaType type, int maxCount, double epsilon)
     : this()
 {
     Type = type;
     MaxCount = maxCount;
     Epsilon = epsilon;
 }
Esempio n. 8
0
 /// <summary>
 /// full constructor
 /// </summary>
 /// <param name="type"></param>
 /// <param name="maxCount"></param>
 /// <param name="epsilon"></param>
 public TermCriteria(CriteriaType type, int maxCount, double epsilon)
     : this()
 {
     Type     = type;
     MaxCount = maxCount;
     Epsilon  = epsilon;
 }
Esempio n. 9
0
        /// <summary>
        /// Applies a criteria to the <paramref name="list"/> of
        /// fuzzy items using the given <paramref name="predicate"/>.
        /// </summary>
        /// <typeparam name="TItem">The type of item to test.</typeparam>
        /// <param name="list">The list of <see cref="IFuzzyItem{T}"/> instances that represent a single test case in a fuzzy search.</param>
        /// <param name="predicate">The condition that will be used to test the target item.</param>
        /// <param name="criteriaType">The <see cref="CriteriaType"/> to associate with the predicate.</param>
        public static void AddCriteria <TItem>(this IList <IFuzzyItem <TItem> > list, Func <TItem, bool> predicate,
                                               CriteriaType criteriaType)
        {
            const int defaultWeight = 1;

            list.AddCriteria(predicate, criteriaType, defaultWeight);
        }
Esempio n. 10
0
 public Tuple <DateTime, double?[]>[] GetPage(int[] trendTagIds, CriteriaType criteriaType,
                                              DateTime criteria, int maxCount)
 {
     using (ITrendsRepository repository = _repositoryFactory.Create()) {
         return(repository.GetPage(trendTagIds, criteriaType, criteria, maxCount));
     }
 }
Esempio n. 11
0
 public Alarm[] GetHistoryAlarms(CriteriaType criteriaType, AlarmSampleId criteria, int maxCount)
 {
     using (var connection = _connectionFactory.Create())
     {
         return(_repository.GetHistoryAlarms(connection, criteriaType, criteria, maxCount));
     }
 }
Esempio n. 12
0
            public void GetItems(CriteriaType criteriaType, int maxCount, DateTime criteria, Action <IEnumerable <Notification> > callback)
            {
                IEnumerable <Notification> items;

                switch (criteriaType)
                {
                case CriteriaType.UpFromInfinity:
                    items = _pHmi.Reporter.Notifications.Take(maxCount).Reverse();
                    break;

                case CriteriaType.UpFrom:
                    items = _pHmi.Reporter.Notifications.SkipWhile(n => n.StartTime <= criteria).Take(maxCount).Reverse();
                    break;

                case CriteriaType.UpFromOrEqual:
                    items = _pHmi.Reporter.Notifications.SkipWhile(n => n.StartTime < criteria).Take(maxCount).Reverse();
                    break;

                case CriteriaType.DownFromOrEqual:
                    items = _pHmi.Reporter.Notifications.Reverse().SkipWhile(n => n.StartTime > criteria).Take(maxCount);
                    break;

                case CriteriaType.DownFrom:
                    items = _pHmi.Reporter.Notifications.Reverse().SkipWhile(n => n.StartTime >= criteria).Take(maxCount);
                    break;

                case CriteriaType.DownFromInfinity:
                    items = _pHmi.Reporter.Notifications.Reverse().Take(maxCount);
                    break;

                default:
                    throw new NotSupportedException("CriteriaType " + criteriaType);
                }
                callback(items);
            }
Esempio n. 13
0
        public Criteria <Artist> GetArtistCriteria(PropertyName propertyName, CriteriaType criteriaType, string valueString)
        {
            switch (propertyName)
            {
            case PropertyName.Artist:
                return(new ArtistCriteria(valueString, criteriaType));

            case PropertyName.City:
                return(new CityCriteria(valueString, criteriaType));

            case PropertyName.State:
                return(new StateCriteria(valueString, criteriaType));

            case PropertyName.Country:
                return(new CountryCriteria(valueString, criteriaType));

            case PropertyName.Grouping:
                return(new GroupingCriteria(valueString, criteriaType));

            case PropertyName.Genre:
                return(new GenreCriteria(valueString, criteriaType));

            default:
                throw new InvalidOperationException();
            }
        }
Esempio n. 14
0
        public LogItem[] GetItems(
            NpgsqlConnection connection, CriteriaType criteriaType, DateTime criteria, int maxCount, bool includeBytes)
        {
            IWhereOp whereOp;
            bool     asc;

            switch (criteriaType)
            {
            case CriteriaType.DownFromInfinity:
                whereOp = null;
                asc     = false;
                break;

            case CriteriaType.DownFrom:
                whereOp = new Lt(DbStr.Time, criteria.Ticks);
                asc     = false;
                break;

            case CriteriaType.DownFromOrEqual:
                whereOp = new Le(DbStr.Time, criteria.Ticks);
                asc     = false;
                break;

            case CriteriaType.UpFromInfinity:
                whereOp = null;
                asc     = true;
                break;

            case CriteriaType.UpFrom:
                whereOp = new Gt(DbStr.Time, criteria.Ticks);
                asc     = true;
                break;

            case CriteriaType.UpFromOrEqual:
                whereOp = new Ge(DbStr.Time, criteria.Ticks);
                asc     = true;
                break;

            default:
                throw new NotSupportedException("CriteriaType " + criteriaType);
            }
            var columns = includeBytes ? _columns : _columnsWithoutBytes;
            var query   = _npgQueryHelper.Select(
                _tableName, columns, whereOp, new[] { DbStr.Time }, asc, Math.Min(maxCount, MaxItemsToRetrieve));
            var alarms = _npgHelper.ExecuteReader(connection, query, reader =>
            {
                var i = new LogItem
                {
                    Time = reader.GetDateTimeFormTicks(0),
                    Text = reader.GetNullableString(1)
                };
                if (includeBytes)
                {
                    i.Bytes = reader.GetByteArray(2);
                }
                return(i);
            });

            return(asc ? alarms.Reverse().ToArray() : alarms);
        }
Esempio n. 15
0
 public Criteria()
 {
     criterias = new List <Criteria>();
     mode      = CriteriaMode.And;
     //type = CriteriaType.Equals;
     type = CriteriaType.None;
 }
Esempio n. 16
0
        public void UpdateCriteria(CriteriaType type, ulong miscValue1 = 0, ulong miscValue2 = 0, ulong miscValue3 = 0, WorldObject refe = null)
        {
            m_achievementSys.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
            m_questObjectiveCriteriaMgr.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);

            // Update only individual achievement criteria here, otherwise we may get multiple updates
            // from a single boss kill
            if (CriteriaManager.IsGroupCriteriaType(type))
            {
                return;
            }

            Scenario scenario = GetScenario();

            if (scenario != null)
            {
                scenario.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
            }

            Guild guild = Global.GuildMgr.GetGuildById(GetGuildId());

            if (guild)
            {
                guild.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
            }
        }
        public void Parse(Expression expression, CriteriaType criteriaType)
        {
            _criteriaList.Clear();
            _criteriaTypeQueue.Clear();
            _criteriaTypeQueue.Enqueue(criteriaType);

            Visit(expression);
        }
 public void CheckAllQuestObjectiveCriteria(Player referencePlayer)
 {
     // suppress sending packets
     for (CriteriaType i = 0; i < CriteriaType.Count; ++i)
     {
         UpdateCriteria(i, 0, 0, 0, null, referencePlayer);
     }
 }
Esempio n. 19
0
 public Criteria(CriteriaType criteriaType, params ICondition[] conditions)
 {
     this.CriteriaType = criteriaType;
     foreach (ICondition condition in conditions)
     {
         this.Conditions.Add(condition);
     }
 }
Esempio n. 20
0
 public override void GetItems(CriteriaType criteriaType, DateTime criteria, int maxCount, bool includeBytes, Action <LogItem[]> callback)
 {
     lock (_parametersForGet)
     {
         _parametersForGet.Add(new Tuple <CriteriaType, DateTime, int, bool, Action <LogItem[]> >(
                                   criteriaType, criteria, maxCount, includeBytes, callback));
     }
 }
        public Approach CreateApproach(Guid id, string name, CriteriaType criteria)
        {
            Name     nameVo     = new Name(name);
            Criteria criteriaVo = new Criteria(criteria);
            Approach approach   = new Approach(id, nameVo, criteriaVo);

            return(approach);
        }
Esempio n. 22
0
 public override void GetCurrent(CriteriaType criteriaType, AlarmSampleId criteria, int maxCount,
                                 Action <Alarm[]> callback)
 {
     lock (_currentQueries) {
         _currentQueries.Add(new Tuple <CriteriaType, AlarmSampleId, int, Action <Alarm[]> >(
                                 criteriaType, criteria, maxCount, callback));
     }
 }
Esempio n. 23
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     CriteriaType = CriteriaType.DownFromInfinity;
     Criteria     = new AlarmSampleId(DateTime.UtcNow, RandomGenerator.GetRandomInt32());
     MaxCount     = RandomGenerator.GetRandomInt32();
     AlarmsRunTarget.GetHistoryAlarms(CriteriaType, Criteria, MaxCount);
 }
Esempio n. 24
0
 public override void GetItems(CriteriaType criteriaType, DateTime criteria, int maxCount, bool includeBytes, Action<LogItem[]> callback)
 {
     lock (_parametersForGet)
     {
         _parametersForGet.Add(new Tuple<CriteriaType, DateTime, int, bool, Action<LogItem[]>>(
             criteriaType, criteria, maxCount, includeBytes, callback));
     }
 }
Esempio n. 25
0
 public Criteria(CriteriaType criteria)
 {
     if (criteria == CriteriaType.UNDEFINED)
     {
         throw new ArgumentException("criteria");
     }
     this.Value = criteria;
 }
Esempio n. 26
0
 public User[] GetUsers(Identity identity, CriteriaType criteriaType, string name, int count)
 {
     if (NotValid())
     {
         return(null);
     }
     return(_project.UsersRunner.GetUsers(identity, criteriaType, name, count));
 }
 public ApproachCreated(
     Guid approachId,
     string name,
     CriteriaType criteria)
 {
     this.ApproachId = approachId;
     this.Name       = name;
     this.Criteria   = criteria;
 }
 public ApproachDetailsDto(
     Guid id,
     string name,
     CriteriaType criteria)
 {
     this.Id       = id;
     this.Name     = name;
     this.Criteria = criteria;
 }
Esempio n. 29
0
        public static string ToDisplayString(this CriteriaType criteriaType)
        {
            if (_criteriaTypeStringMatrix.ContainsKey(criteriaType))
            {
                return(_criteriaTypeStringMatrix[criteriaType]);
            }

            return(string.Empty);
        }
Esempio n. 30
0
        public AllocationParameters(float[] allocationResource,
                                    float[][] allocationData,
                                    CriteriaType criteriaType,
                                    Func <float, float, float> totalFunc = null,
                                    bool isLeadingZerosIncluded          = false)
        {
            if (isLeadingZerosIncluded)
            {
                _allocationResource = allocationResource;
                _allocationData     = allocationData;
            }
            else
            {
                _allocationResource = addLeadingZeros(allocationResource);
                _allocationData     = addLeadingZerosToData(allocationData);
            }
            int dataCount = 0;

            _resourceCount = _allocationResource.Length;
            for (int i = 0; i < _allocationData.Length; i++)
            {
                dataCount += _allocationData[i].Length - 1;
            }
            if (dataCount < _resourceCount - 1)
            {
                _resourceCount = dataCount + 1;
            }
            _totalFunc = totalFunc;
            if (_totalFunc == null)
            {
                _totalFunc = (curResource, curData) => curData;
            }
            switch (criteriaType)
            {
            case CriteriaType.Min:
                _criterialSelect = (oldOne, newOne) =>
                {
                    if (oldOne > newOne || oldOne == 0)
                    {
                        return(true);
                    }
                    return(false);
                };
                break;

            case CriteriaType.Max:
                _criterialSelect = (oldOne, newOne) =>
                {
                    if (oldOne < newOne)
                    {
                        return(true);
                    }
                    return(false);
                };
                break;
            }
        }
Esempio n. 31
0
 protected override string CriteriaTypeStringParse(TypeMapInfo typeMapInfo, CriteriaType criteriaType)
 {
     return(criteriaType switch
     {
         CriteriaType.None => string.Empty,
         CriteriaType.SingleId => $"WHERE \"{typeMapInfo.IdColumnName}\" = @Id",
         CriteriaType.MultiId => $"WHERE \"{typeMapInfo.IdColumnName}\" = ANY(@Ids)",
         _ => throw new ArgumentOutOfRangeException(nameof(criteriaType), criteriaType, null)
     });
Esempio n. 32
0
        private Mock <ICriteria <object> > GetMockCriteria(bool predicateResult, CriteriaType criteriaType, int weight)
        {
            var criteria = new Mock <ICriteria <object> >();

            criteria.Expect(c => c.Predicate).Returns(predicate => predicateResult);
            criteria.Expect(c => c.Type).Returns(criteriaType);
            criteria.Expect(c => c.Weight).Returns(weight);
            return(criteria);
        }
Esempio n. 33
0
 public ApproachEsaBuilt(
     Guid approachId,
     Guid esaId,
     CriteriaType criteria)
 {
     this.ApproachId = approachId;
     this.EsaId      = esaId;
     this.Criteria   = criteria;
 }
Esempio n. 34
0
 public User[] GetUsers(Identity identity, CriteriaType criteriaType, string name, int count)
 {
     if (!IsUserViewer(identity))
         return new User[0];
     using (var connection = _connectionFactory.Create())
     {
         return _repository.Get(connection, criteriaType, name, count);
     }
 }
Esempio n. 35
0
 internal override void GetPage(
     int trendTagId, CriteriaType criteriaType, DateTime criteria, int maxCount, Action <Tuple <DateTime, double>[]> callback)
 {
     lock (_pageQueries)
     {
         _pageQueries.Add(new Tuple <int, Tuple <CriteriaType, DateTime, int>, Action <Tuple <DateTime, double>[]> >(
                              trendTagId, new Tuple <CriteriaType, DateTime, int>(criteriaType, criteria, maxCount), callback));
     }
 }
Esempio n. 36
0
 public static int Update(int DeptID, int CriteriaID, int UserId, int NotificationRuleId, CriteriaType ctype, string CriteriaName, CriteriaState cstate)
 {
     SqlParameter _pRVAL = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
     _pRVAL.Direction = ParameterDirection.ReturnValue;
     SqlParameter _pCriteriaId = new SqlParameter("@Id", SqlDbType.Int);
     _pCriteriaId.Direction = ParameterDirection.InputOutput;
     if (CriteriaID != 0) _pCriteriaId.Value = CriteriaID;
     else _pCriteriaId.Value = DBNull.Value;
     SqlParameter _pUserId = new SqlParameter("@UserId", SqlDbType.Int);
     if (UserId != 0) _pUserId.Value = UserId;
     else _pUserId.Value = DBNull.Value;
     SqlParameter _pNotificationRuleId = new SqlParameter("@NotificationRuleId", SqlDbType.Int);
     if (NotificationRuleId != 0) _pNotificationRuleId.Value = NotificationRuleId;
     else _pNotificationRuleId.Value = DBNull.Value;
     SqlParameter _pBitLimitToAssignedTkts = new SqlParameter("@btLimitToAssignedTkts", SqlDbType.Bit);
     SqlParameter _pBitDisabledReports = new SqlParameter("@btDisabledReports", SqlDbType.Bit);
     SqlParameter _pBitNoFilter = new SqlParameter("@btNoFilter", SqlDbType.Bit);
     switch (cstate)
     {
         case CriteriaState.DisabledReports:
             _pBitDisabledReports.Value = true;
             _pBitLimitToAssignedTkts.Value = false;
             _pBitNoFilter.Value = true;
             break;
         case CriteriaState.FilterEnabled:
             _pBitDisabledReports.Value = false;
             _pBitLimitToAssignedTkts.Value = false;
             _pBitNoFilter.Value = false;
             break;
         case CriteriaState.LimitToAssignedTickets:
             _pBitDisabledReports.Value = false;
             _pBitLimitToAssignedTkts.Value = true;
             _pBitNoFilter.Value = false;
             break;
         case CriteriaState.NoFilter:
             _pBitDisabledReports.Value = false;
             _pBitLimitToAssignedTkts.Value = false;
             _pBitNoFilter.Value = true;
             break;
     }
     UpdateData("sp_UpdateTicketCriteria", new SqlParameter[] { _pRVAL, new SqlParameter("@DId", DeptID), _pCriteriaId, _pUserId, _pNotificationRuleId, new SqlParameter("@CriteriaType", (byte)ctype), new SqlParameter("@CriteriaName", CriteriaName), _pBitLimitToAssignedTkts, _pBitDisabledReports, _pBitNoFilter });
     if ((int)_pRVAL.Value < 0) return (int)_pRVAL.Value;
     else return (int)_pCriteriaId.Value;
 }
Esempio n. 37
0
 public User[] Get(NpgsqlConnection connection, CriteriaType criteriaType, string name, int count)
 {
     IWhereOp whereOp;
     bool asc;
     switch (criteriaType)
     {
         case CriteriaType.DownFromInfinity:
             whereOp = null;
             asc = true;
             break;
         case CriteriaType.DownFrom:
             whereOp = new Gt(DbStr.Name, name);
             asc = true;
             break;
         case CriteriaType.DownFromOrEqual:
             whereOp = new Ge(DbStr.Name, name);
             asc = true;
             break;
         case CriteriaType.UpFromInfinity:
             whereOp = null;
             asc = false;
             break;
         case CriteriaType.UpFrom:
             whereOp = new Lt(DbStr.Name, name);
             asc = false;
             break;
         case CriteriaType.UpFromOrEqual:
             whereOp = new Le(DbStr.Name, name);
             asc = false;
             break;
         default:
             throw new NotSupportedException("CriteriaType " + criteriaType);
     }
     var limit = Math.Min(count, MaxUsersToRetrieve);
     var query = _npgQueryHelper.Select(
         DbStr.Users, _userColumns, whereOp, new[] { DbStr.Name }, asc, limit);
     var users = _npgHelper.ExecuteReader(connection, query, GetUser);
     return asc ? users : users.Reverse().ToArray();
 }
Esempio n. 38
0
 private Mock<ICriteria<object>> GetMockCriteria(bool predicateResult, CriteriaType criteriaType, int weight)
 {
     var criteria = new Mock<ICriteria<object>>();
     criteria.Expect(c => c.Predicate).Returns(predicate => predicateResult);
     criteria.Expect(c => c.Type).Returns(criteriaType);
     criteria.Expect(c => c.Weight).Returns(weight);
     return criteria;
 }
Esempio n. 39
0
 public override void GetHistory(CriteriaType criteriaType, AlarmSampleId criteria, int maxCount, Action<Alarm[]> callback)
 {
     lock (_historyQueries)
     {
         _historyQueries.Add(new Tuple<CriteriaType, AlarmSampleId, int, Action<Alarm[]>>(
             criteriaType, criteria, maxCount, callback));
     }
 }
Esempio n. 40
0
 ///<summary> Reset all Counters </summary>
 public void Reset () 
 {
   iterationCounter = 0;
   functionEvaluationCounter = 0;
   gradientEvaluationCounter = 0;
   hessianEvaluationCounter = 0;
   stationaryPointIterationsCounter = 0;
   stationaryGradientIterationsCounter = 0;
   stationaryHessianIterationsCounter = 0;
   this.endCriteria = CriteriaType.None;
 }
Esempio n. 41
0
 public void GetUsers(CriteriaType criteriaType, string name, int count, Action<User[]> callback)
 {
     _usersRunTarget.GetUsers(_identity, criteriaType, name, count, callback);
 }
Esempio n. 42
0
 ///<summary>Check if objective function value is less than the function epsilon</summary>
 ///<remarks>
 /// If the objective function value is less than the function epsilon and only positive optimization
 /// is allowed then the ending criteria is set to <c>CriteriaType.FunctionEpsilon</c> and the 
 /// function returns true;
 ///</remarks>
 public bool CheckFunctionEpsilon(double f) 
 {
   bool test = (f < minFunctionEpsilon);
   if (test)
     endCriteria = CriteriaType.FunctionEpsilon;
   return test;
 }
Esempio n. 43
0
 public User[] GetUsers(Identity identity, CriteriaType criteriaType, string name, int count)
 {
     if (NotValid())
         return null;
     return _project.UsersRunner.GetUsers(identity, criteriaType, name, count);
 }
Esempio n. 44
0
 /// <summary>
 
 /// </summary>
 
 
 public Criteria(CriteriaType type, params Expression[] expressions)
 {
     _expressions.AddRange(expressions);
     _type = type;
 }
 public CriteriaRequester(CriteriaType cType, String ID)
 {
     this.CritType = cType;
     this.ID = ID;
 }
Esempio n. 46
0
        /// <summary>
        /// すべて指定して初期化
        /// </summary>
        /// <param name="type">終了条件</param>
        /// <param name="maxIter">反復数の最大値</param>
        /// <param name="epsilon">目標精度</param>
#else
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="type">a combination of CriteriaType flags</param>
        /// <param name="maxIter">maximum number of iterations</param>
        /// <param name="epsilon">accuracy to achieve</param>
#endif
        public CvTermCriteria(CriteriaType type, int maxIter, double epsilon)
        {
            this.Type = type;
            this.MaxIter = maxIter;
            this.Epsilon = epsilon;
        }
Esempio n. 47
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     CriteriaType = CriteriaType.DownFromInfinity;
     Criteria = new AlarmSampleId(DateTime.UtcNow, RandomGenerator.GetRandomInt32());
     MaxCount = RandomGenerator.GetRandomInt32();
     AlarmsRunTarget.GetHistoryAlarms(CriteriaType, Criteria, MaxCount);
 }
Esempio n. 48
0
 public Alarm[] GetHistoryAlarms(NpgsqlConnection connection, CriteriaType criteriaType, AlarmSampleId criteria, int maxCount)
 {
     return GetAlarms(connection, null, criteriaType, criteria, maxCount);
 }
Esempio n. 49
0
 public Alarm[] GetCurrentAlarms(NpgsqlConnection connection, CriteriaType criteriaType, AlarmSampleId criteria, int maxCount)
 {
     var whereOp = new Or(new IsNull(DbStr.EndTime), new IsNull(DbStr.AcknowledgeTime));
     return GetAlarms(connection, whereOp, criteriaType, criteria, maxCount);
 }
Esempio n. 50
0
 private Alarm[] GetAlarms(
     NpgsqlConnection connection, IWhereOp alarmsWhereOp, CriteriaType criteriaType, AlarmSampleId criteria, int maxCount)
 {
     IWhereOp whereOp;
     bool asc;
     switch (criteriaType)
     {
         case CriteriaType.DownFromInfinity:
             whereOp = null;
             asc = false;
             break;
         case CriteriaType.DownFrom:
             whereOp = new Or(
                 new And(new Eq(DbStr.StartTime, criteria.StartTime.Ticks), new Lt(DbStr.AlarmId, criteria.AlarmId)),
                 new Lt(DbStr.StartTime, criteria.StartTime.Ticks));
             asc = false;
             break;
         case CriteriaType.DownFromOrEqual:
             whereOp = new Or(
                 new And(new Eq(DbStr.StartTime, criteria.StartTime.Ticks), new Le(DbStr.AlarmId, criteria.AlarmId)),
                 new Lt(DbStr.StartTime, criteria.StartTime.Ticks));
             asc = false;
             break;
         case CriteriaType.UpFromInfinity:
             whereOp = null;
             asc = true;
             break;
         case CriteriaType.UpFrom:
             whereOp = new Or(
                 new And(new Eq(DbStr.StartTime, criteria.StartTime.Ticks), new Gt(DbStr.AlarmId, criteria.AlarmId)),
                 new Gt(DbStr.StartTime, criteria.StartTime.Ticks));
             asc = true;
             break;
         case CriteriaType.UpFromOrEqual:
             whereOp = new Or(
                 new And(new Eq(DbStr.StartTime, criteria.StartTime.Ticks), new Ge(DbStr.AlarmId, criteria.AlarmId)),
                 new Gt(DbStr.StartTime, criteria.StartTime.Ticks));
             asc = true;
             break;
         default:
             throw new NotSupportedException("CriteriaType " + criteriaType);
     }
     if (alarmsWhereOp != null)
     {
         whereOp = whereOp == null ? alarmsWhereOp : new And(whereOp, alarmsWhereOp);
     }
     var query = _npgQueryHelper.Select(
         _tableName, _columns, whereOp, new[] { DbStr.StartTime, DbStr.AlarmId }, asc, Math.Min(maxCount, MaxAlarmsToRetrieve));
     var alarms = _npgHelper.ExecuteReader(connection, query, reader =>
         new Alarm(reader.GetDateTimeFormTicks(0), reader.GetInt32(1))
             {
                 EndTime = reader.GetNullableDateTimeFormTicks(2),
                 AcknowledgeTime = reader.GetNullableDateTimeFormTicks(3),
                 UserId = reader.GetNullableInt64(4)
             });
     return asc ? alarms.Reverse().ToArray() : alarms;
 }
Esempio n. 51
0
 protected internal Criteria(string fieldName, CriteriaType criteriaType)
     : this()
 {
     _fieldName = fieldName;
     _criteriaType = criteriaType;
 }
Esempio n. 52
0
 private void MockGetItemsCallback(CriteriaType criteriaType, int maxCount, int criteria, Action<IEnumerable<Item>> callback)
 {
     GetItemsCallback = callback;
 }
Esempio n. 53
0
 ///<summary>Check if the norm of the hessian is less than the hessian epsilon</summary>
 ///<remarks>
 /// If the norm of the hessian is less than the gradient epsilon then the ending criteria is set
 /// to <c>CriteriaType.HessianEpsilon</c> and the function returns true;
 ///</remarks>
 public bool CheckHessianEpsilon (double normDiff) 
 {
   bool test = (normDiff < minHessianEpsilon);
   if (test)
     endCriteria = CriteriaType.HessianEpsilon;
   return test;
 }
Esempio n. 54
0
 public override void GetPage(CriteriaType criteriaType, DateTime criteria, int maxCount, Action<Tuple<DateTime, double>[]> callback)
 {
     _category.GetPage(_id, criteriaType, criteria, maxCount, callback);
 }
Esempio n. 55
0
 ///<summary>Check if the norm of the gradient is less than the gradient epsilon</summary>
 ///<remarks>
 /// If the norm of the gradient is less than the gradient epsilon then the ending criteria is set
 /// to <c>CriteriaType.GradientEpsilon</c> and the function returns true;
 ///</remarks>
 public bool CheckGradientEpsilon (double normDiff) 
 {
   bool test = (normDiff < minGradientEpsilon);
   if (test)
     endCriteria = CriteriaType.GradientEpsilon;
   return test;
 }
Esempio n. 56
0
 public Tuple<DateTime, double?[]>[] GetPage(int[] trendTagIds, CriteriaType criteriaType, DateTime criteria, int maxCount)
 {
     using (var repository = _repositoryFactory.Create())
     {
         return repository.GetPage(trendTagIds, criteriaType, criteria, maxCount);
     }
 }
Esempio n. 57
0
 ///<summary>Check if hessian function changed by less than the hessian epsilon</summary>
 ///<remarks>
 /// If the change in hessian function is less than the hessian epsilon then a possible stationary
 /// point has been found.  If the number of repeated iterations at this possible stationary point is
 /// greater than the maximum iterations at a station point then the ending criteria is set to
 /// <c>CriteriaType.StationaryPoint</c> and the function returns true;
 ///</remarks>
 public bool CheckStationaryHessian(double gold, double gnew) 
 {
   bool test = (System.Math.Abs(gold - gnew) < minHessianEpsilon);
   if (test) 
     stationaryHessianIterationsCounter++;
   else if (stationaryHessianIterationsCounter != 0)
     stationaryPointIterationsCounter = 0;
   if (stationaryHessianIterationsCounter > maxStationaryHessianIterations)
     endCriteria = CriteriaType.StationaryHessian;
   
   return (test && (stationaryHessianIterationsCounter > maxStationaryHessianIterations));
 }
Esempio n. 58
0
 /// <summary>
 /// conversion from CvTermCriteria
 /// </summary>
 /// <param name="criteria"></param>
 public TermCriteria(CvTermCriteria criteria)
 {
     Type = criteria.Type;
     MaxCount = criteria.MaxIter;
     Epsilon = criteria.Epsilon;
 }
Esempio n. 59
0
 public LogItem[] GetItems(
     NpgsqlConnection connection, CriteriaType criteriaType, DateTime criteria, int maxCount, bool includeBytes)
 {
     IWhereOp whereOp;
     bool asc;
     switch (criteriaType)
     {
         case CriteriaType.DownFromInfinity:
             whereOp = null;
             asc = false;
             break;
         case CriteriaType.DownFrom:
             whereOp = new Lt(DbStr.Time, criteria.Ticks);
             asc = false;
             break;
         case CriteriaType.DownFromOrEqual:
             whereOp = new Le(DbStr.Time, criteria.Ticks);
             asc = false;
             break;
         case CriteriaType.UpFromInfinity:
             whereOp = null;
             asc = true;
             break;
         case CriteriaType.UpFrom:
             whereOp = new Gt(DbStr.Time, criteria.Ticks);
             asc = true;
             break;
         case CriteriaType.UpFromOrEqual:
             whereOp = new Ge(DbStr.Time, criteria.Ticks);
             asc = true;
             break;
         default:
             throw new NotSupportedException("CriteriaType " + criteriaType);
     }
     var columns = includeBytes ? _columns : _columnsWithoutBytes;
     var query = _npgQueryHelper.Select(
         _tableName, columns, whereOp, new[] { DbStr.Time }, asc, Math.Min(maxCount, MaxItemsToRetrieve));
     var alarms = _npgHelper.ExecuteReader(connection, query, reader =>
         {
             var i = new LogItem
                 {
                     Time = reader.GetDateTimeFormTicks(0),
                     Text = reader.GetNullableString(1)
                 };
             if (includeBytes)
             {
                 i.Bytes = reader.GetByteArray(2);
             }
             return i;
         });
     return asc ? alarms.Reverse().ToArray() : alarms;
 }
Esempio n. 60
0
 public TicketCriteria(int DeptID, int TicketCriteriaID)
 {
     m_DeptID = DeptID;
     if (TicketCriteriaID == 0) return;
     DataRow _row = SelectOne(DeptID, TicketCriteriaID);
     if (_row == null) return;
     m_ID = TicketCriteriaID;
     m_UserID = _row.IsNull("UserId") ? 0 : (int)_row["UserId"];
     m_NotificationRuleID = _row.IsNull("NotificationRuleId") ? 0 : (int)_row["NotificationRuleId"];
     m_Name = _row["CriteriaName"].ToString();
     m_CriteriaType = (CriteriaType)((byte)_row["CriteriaType"]);
     if (!(bool)_row["btNoFilter"]) m_CriteriaState = CriteriaState.FilterEnabled;
     else if ((bool)_row["btDisabledReports"]) m_CriteriaState = CriteriaState.DisabledReports;
     else if ((bool)_row["btLimitToAssignedTkts"]) m_CriteriaState = CriteriaState.LimitToAssignedTickets;
     DataTable _dt=SelectCriteriaDataByType(DeptID, FilterType.CommonFilter, TicketCriteriaID);
     foreach (DataRow _r in _dt.Rows) m_FilterTypeStates[(int)_r["ID"]]=(bool)_r["State"];
 }