コード例 #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        public SolveInfoWrap(SolveInfo settings, UserSolveInfo userSettings)
        {
            Debug.Assert(settings != null);
            Debug.Assert(userSettings != null);

            if (userSettings.SolverSettingsInfo == null)
                userSettings.SolverSettingsInfo = new UserSolverSettingsInfo();

            // restrictions
            _InitRestrictions(settings, userSettings);

            // parameters
            _InitAttrParameters(settings, userSettings);

            // services
            _InitServices(settings);

            _settings = settings;
            _userSettings = userSettings;
        }
コード例 #2
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        private void _InitRestrictions(SolveInfo settings,
            UserSolveInfo userSettings)
        {
            // user restrictions
            if (userSettings.SolverSettingsInfo.RestrictionsInfo == null)
                userSettings.SolverSettingsInfo.RestrictionsInfo = new UserRestrictionsInfo();

            if (userSettings.SolverSettingsInfo.RestrictionsInfo.Restrictions == null)
                userSettings.SolverSettingsInfo.RestrictionsInfo.Restrictions = new List<RestrictionInfo>();

            _userRestrictions = userSettings.SolverSettingsInfo.RestrictionsInfo.Restrictions;

            // default (read-only) restrictions
            if (settings.SolverSettingsInfo != null &&
                settings.SolverSettingsInfo.RestrictionsInfo != null &&
                settings.SolverSettingsInfo.RestrictionsInfo.Restrictions != null)
            {
                _defaultRestrictions = new List<RestrictionInfo>(
                    settings.SolverSettingsInfo.RestrictionsInfo.Restrictions);
            }

            if (_defaultRestrictions == null)
                _defaultRestrictions = new List<RestrictionInfo>();

            // fill merged names list
            _AddRestrictionNames(_defaultRestrictions);
            _AddRestrictionNames(_userRestrictions);
        }
コード例 #3
0
        private void _InitAttrParameters(SolveInfo settings,
            UserSolveInfo userSettings)
        {
            // user parameters
            if (userSettings.SolverSettingsInfo.AttributeParamsInfo == null)
                userSettings.SolverSettingsInfo.AttributeParamsInfo = new UserRouteAttrsInfo();

            if (userSettings.SolverSettingsInfo.AttributeParamsInfo.AttributeParams == null)
                userSettings.SolverSettingsInfo.AttributeParamsInfo.AttributeParams = new List<RouteAttrInfo>();

            _userParams = userSettings.SolverSettingsInfo.AttributeParamsInfo.AttributeParams;

            // default (read-only) parameters
            if (settings.SolverSettingsInfo != null &&
                settings.SolverSettingsInfo.AttributeParamsInfo != null &&
                settings.SolverSettingsInfo.AttributeParamsInfo.AttributeParams != null)
            {
                _defaultParams = new List<RouteAttrInfo>(
                    settings.SolverSettingsInfo.AttributeParamsInfo.AttributeParams);
            }

            if (_defaultParams == null)
                _defaultParams = new List<RouteAttrInfo>();

            // fill merged list
            _mergedParams = new List<RouteAttrInfo>(_userParams);
            foreach (RouteAttrInfo defParam in _defaultParams)
            {
                if (!String.IsNullOrEmpty(defParam.AttrName) &&
                    !String.IsNullOrEmpty(defParam.ParamName))
                {
                    RouteAttrInfo param = _FindAttrParameter(defParam.AttrName,
                        defParam.ParamName,
                        _mergedParams);

                    if (param == null)
                        _mergedParams.Add(defParam);
                }
            }
        }