Example #1
0
 public virtual LinkedCriterion AddCriterion(CriterionType type, Criterion criterion)
 {
     var priority = LinkedCriteria.Count() + 1;
     var linkedCriterion = new LinkedCriterion(Guid.NewGuid(), this, type, criterion, priority);
     ((IList<LinkedCriterion>)LinkedCriteria).Add(linkedCriterion);
     return linkedCriterion;
 }
 public LinkCriterionToScenario(Guid projectId, Guid scenarioId, Guid criterionId, CriterionType type)
 {
     ProjectId = projectId;
     ScenarioId = scenarioId;
     CriterionId = criterionId;
     Type = type;
 }
Example #3
0
        private List <dtoCriterionOption> CreateOptions(CriterionType type, lm.Comol.Core.Dss.Domain.Templates.dtoItemMethodSettings settings = null, lm.Comol.Core.Dss.Domain.Templates.dtoSelectMethod method = null)
        {
            List <dtoCriterionOption> options = new List <dtoCriterionOption>();

            switch (type)
            {
            case CriterionType.StringRange:
                for (Int32 i = 1; i <= 5; i++)
                {
                    dtoCriterionOption opt = new dtoCriterionOption();
                    opt.DisplayOrder = i;
                    opt.Id           = i;
                    opt.Value        = (Decimal)(i * (0.5));
                    opt.Name         = i.ToString();
                    opt.UseDss       = (settings != null);
                    options.Add(opt);
                }
                break;

            case CriterionType.RatingScale:
                if (method != null && method.RatingSets.Any())
                {
                    long displayOrder = 1;
                    options = method.RatingSets.FirstOrDefault().Values.Select(v => new dtoCriterionOption()
                    {
                        DisplayOrder  = displayOrder++,
                        DoubleValue   = v.Value,
                        FuzzyValue    = v.FuzzyValue,
                        IsFuzzy       = v.IsFuzzy,
                        IdRatingSet   = v.IdRatingSet,
                        IdRatingValue = v.Id,
                        Name          = v.Name,
                        UseDss        = true,
                        Id            = displayOrder
                    }).ToList();
                }
                break;

            case CriterionType.RatingScaleFuzzy:
                if (method != null && method.RatingSets.Any())
                {
                    long displayOrder = 1;
                    options = method.RatingSets.FirstOrDefault().Values.Select(v => new dtoCriterionOption()
                    {
                        DisplayOrder  = displayOrder++,
                        DoubleValue   = v.Value,
                        FuzzyValue    = v.FuzzyValue,
                        IsFuzzy       = v.IsFuzzy,
                        IdRatingSet   = v.IdRatingSet,
                        IdRatingValue = v.Id,
                        Name          = v.Name,
                        UseDss        = true,
                        Id            = displayOrder
                    }).ToList();
                }
                break;
            }

            return(options);
        }
Example #4
0
        /// <summary>
        /// Checks whether <paramref name="firstValue"/> of the criterion is better than <paramref name="secondValue"/>
        /// of the same criterion with regard to the type of this criterion
        /// </summary>
        /// <param name="firstValue">First criterion value</param>
        /// <param name="secondValue">Second criterion value</param>
        /// <param name="criterionType">Type of this criterion</param>
        /// <returns>True if criterion is minimizing and <paramref name="firstValue"/> is lesser than <paramref name="secondValue"/> OR
        /// if criterion is maximizing and <paramref name="firstValue"/> is greater than <paramref name="secondValue"/></returns>
        public static bool IsFirstValueBetter(double firstValue, double secondValue, CriterionType criterionType)
        {
            switch (criterionType)
            {
            case CriterionType.Minimizing:
                if (firstValue < secondValue)
                {
                    return(true);
                }

                break;

            case CriterionType.Maximizing:
                if (firstValue > secondValue)
                {
                    return(true);
                }

                break;

            default:
                throw new ArgumentException("Invalid criterion type");
            }

            return(false);
        }
Example #5
0
 public Criterion(Guid criterionId, CriterionType criterionType, string name, int priority, IEnumerable<Step> steps)
 {
     CriterionId = criterionId;
     CriterionType = criterionType;
     Name = name;
     Priority = priority;
     Steps = new ReadOnlyCollection<Step>(steps.ToList());
 }
 public LinkedCriterionMomento(Guid criterionId, Guid scenarioId, decimal priority, CriterionType type, bool deleted)
 {
     CriterionId = criterionId;
     ScenarioId = scenarioId;
     Priority = priority;
     Type = type;
     Deleted = deleted;
 }
Example #7
0
 public Criterion( CriterionType type, Rank fromRank, Rank toRank, Condition condition ) {
     if( fromRank == null ) throw new ArgumentNullException( "fromRank" );
     if( toRank == null ) throw new ArgumentNullException( "toRank" );
     if( condition == null ) throw new ArgumentNullException( "condition" );
     Type = type;
     FromRank = fromRank;
     ToRank = toRank;
     Condition = condition;
 }
Example #8
0
 public UtilityFunction(
     TId criterionId,
     double criterionMinValue,
     double criterionMaxValue,
     CriterionType criterionType)
 {
     _criterionId   = criterionId;
     _criterionType = criterionType;
     InitFixedPoints(criterionMinValue, criterionMaxValue);
 }
Example #9
0
 public CriterionLinked(Guid userId, Guid projectId, Guid storyId, Guid scenarioId, Guid criterionId, string criterionName, CriterionType type)
 {
     UserId = userId;
     ProjectId = projectId;
     StoryId = storyId;
     ScenarioId = scenarioId;
     CriterionId = criterionId;
     CriterionName = criterionName;
     Type = type;
 }
Example #10
0
 public LinkedCriterion(Guid linkedCriterionId, Scenario scenario, CriterionType type, Criterion criterion,
     int priority)
 {
     Id = linkedCriterionId;
     StepResults = new List<StepRunResult>();
     Scenario = scenario;
     Type = type;
     Criterion = criterion;
     Priority = priority;
 }
Example #11
0
 public CriterionCreated(Guid userId, Guid projectId, Guid scenarioId, Guid criterionId, string criterionName, CriterionType type, ScenarioRunsIn runsIn)
 {
     UserId = userId;
     ProjectId = projectId;
     ScenarioId = scenarioId;            
     CriterionId = criterionId;
     CriterionName = criterionName;
     Type = type;
     RunsIn = runsIn;
 }
 /// <summary>
 /// Initializes new instance of <see cref="PromotableCriterion"/>
 /// </summary>
 /// <param name="id">Promotable criterion identifier</param>
 /// <param name="name">Promotable criterion name</param>
 /// <param name="variableIdentifier">Promotable criterion variable identifier</param>
 /// <param name="criterionType">Promotable criterion type</param>
 /// <remarks>New instance is in non-promoted state; ConstraintRelation is Equal, Value is 0.0</remarks>
 public PromotableCriterion(
     TId id,
     string name,
     string variableIdentifier,
     CriterionType criterionType)
     : base(id, name, variableIdentifier, criterionType)
 {
     ConstraintRelation = Relation.Equal;
     Value      = 0.0;
     IsPromoted = false;
 }
Example #13
0
 public Criterion(
     TId id,
     string name,
     string variableIdentifier,
     CriterionType type,
     string expression = "") : base(id, name, variableIdentifier)
 {
     Type       = type;
     Weight     = 1;
     Expression = expression;
 }
Example #14
0
        private void DeleteCriterion(CriterionType c, dynamic mark)
        {
            if (mark.Criteria == null)
            {
                return;
            }
            List <CriterionType> criteria = new List <CriterionType>(mark.Criteria);

            criteria.Remove(c);
            mark.Criteria = criteria.ToArray();
        }
Example #15
0
        public CriterialConcession(
            Criterion criterion)
        {
            _criterionId   = criterion.Id;
            _criterionType = criterion.Type;

            _bestValue  = double.NaN;
            _worstValue = double.NaN;
            _concession = double.NaN;
            _isUsable   = false;
        }
        private async Task <IList <AdGroupCriterion> > GetAdGroupCriterionsByAdGroupIdAsync(
            long adGroupId,
            CriterionType criterionType)
        {
            var request = new GetAdGroupCriterionsByAdGroupIdRequest
            {
                AdGroupId           = adGroupId,
                CriterionTypeFilter = criterionType
            };

            return((await Service.CallAsync((s, r) => s.GetAdGroupCriterionsByAdGroupIdAsync(r), request)).AdGroupCriterions);
        }
        // Updates one or more ad group criterion.

        private async Task <UpdateAdGroupCriterionsResponse> UpdateAdGroupCriterionsAsync(
            IList <AdGroupCriterion> adGroupCriterions,
            CriterionType criterionType)
        {
            var request = new UpdateAdGroupCriterionsRequest
            {
                AdGroupCriterions = adGroupCriterions,
                CriterionType     = criterionType
            };

            return(await CampaignService.CallAsync((s, r) => s.UpdateAdGroupCriterionsAsync(r), request));
        }
        public static string GetCriterionTypeName(CriterionType type)
        {
            switch (type)
            {
            case CriterionType.Maximizing:
                return("Максимизируемый критерий");

            case CriterionType.Minimizing:
                return("Минимизируемый критерий");

            default:
                throw new ArgumentException("Criterion type " + type + " is not supported", "type");
            }
        }
        // Gets one or more ad group criterion.

        private async Task <GetAdGroupCriterionsByIdsResponse> GetAdGroupCriterionsByIdsAsync(
            long adGroupId,
            IList <long> adGroupCriterionIds,
            CriterionType criterionType)
        {
            var request = new GetAdGroupCriterionsByIdsRequest
            {
                AdGroupId           = adGroupId,
                CriterionType       = criterionType,
                AdGroupCriterionIds = adGroupCriterionIds
            };

            return(await CampaignService.CallAsync((s, r) => s.GetAdGroupCriterionsByIdsAsync(r), request));
        }
Example #20
0
        public Criterion(string name, object value, CriterionType type, CriterionModel model)
        {
            ThrowExceptionUtil.ArgumentNotNullOrEmpty("name", name);

            // 若是Enum, 转换成数字匹配
            if (value is Enum)
            {
                value = (int)value;
            }

            this.leftExpression = name;
            this.value          = value;
            this.criterionType  = type;
            this.criterionModel = model;
        }
Example #21
0
 private CriterialConcession(
     TId criterionId,
     CriterionType criterionType,
     double bestValue,
     double worstValue,
     double concession,
     bool isUsable)
 {
     _criterionId   = criterionId;
     _criterionType = criterionType;
     _bestValue     = bestValue;
     _worstValue    = worstValue;
     _concession    = concession;
     _isUsable      = isUsable;
 }
Example #22
0
 public Criterion(CriterionType type, Rank fromRank, Rank toRank, Condition condition)
 {
     if (fromRank == null)
     {
         throw new ArgumentNullException("fromRank");
     }
     if (toRank == null)
     {
         throw new ArgumentNullException("toRank");
     }
     if (condition == null)
     {
         throw new ArgumentNullException("condition");
     }
     Type      = type;
     FromRank  = fromRank;
     ToRank    = toRank;
     Condition = condition;
 }
Example #23
0
        public Criterion(CriterionType type)
        {
            this.type = type;
            if (type == CriterionType.Part || type == CriterionType.Module || type == CriterionType.MinResourceLevel || type == CriterionType.MinResourceCapacity || type == CriterionType.CrewMember)
            {
                paramsGUIFunction = ChecklistSystem.ParamsTextField;
                parameter         = 1;
                tempParam         = 1;
                parameterType     = typeof(int);
                hasParameter      = true;
            }

            /*else if (type == CriterionType.ContractRequirements)
             * {
             *  parameterType = typeof(Contracts.Contract);
             *  hasParameter = true;
             *  paramsGUIAction = Checklists.ParamsContractSelect;
             *  parameter = Contracts.ContractSystem.Instance.GetCurrentActiveContracts<Contracts.Contract>().DefaultIfEmpty(new Contracts.Contract()).First();
             *  tempParam = parameter;
             *
             * }*/
        }
Example #24
0
        public void Play()
        {
            IAI p1 = new EasyAI();
            IAI p2 = new EasyAI();

            CriterionType height = new CriterionType()
            {
                Name = ""
            };
            CriterionType weight = new CriterionType()
            {
                Name = ""
            };
            CriterionType kind = new CriterionType()
            {
                Name = ""
            };
            CriterionType color = new CriterionType()
            {
                Name = ""
            };
            CriterionType sexe = new CriterionType()
            {
                Name = ""
            };
            CriterionType dead = new CriterionType()
            {
                Name = ""
            };
            CriterionType hero = new CriterionType()
            {
                Name = ""
            };
            CriterionType vilain = new CriterionType()
            {
                Name = ""
            };
        }
Example #25
0
        /// <summary>
        /// Reads a collection of <see cref="Criterion"/> from XML.
        /// </summary>
        /// <param name="model"><see cref="Model"/> instance to be read from XML.</param>
        /// <param name="criteriaCollectionElement"><see cref="XElement"/> to read a collection from.</param>
        private static void ReadCriteria(Model model, XElement criteriaCollectionElement)
        {
            IEnumerable <XElement> criterionElements = criteriaCollectionElement.Descendants(Elements.Criterion);

            foreach (XElement criterionElement in criterionElements)
            {
                TId           id   = TId.Parse(criterionElement.Attribute(Attributes.Id).Value);
                string        name = criterionElement.Attribute(Attributes.Name).Value;
                string        variableIdentifier = criterionElement.Attribute(Attributes.VariableIdentifier).Value;
                CriterionType criterionType      = EnumExtensions.Parse <CriterionType>(criterionElement.Attribute(Attributes.Type).Value);
                int           weight             = Convert.ToInt32(criterionElement.Attribute(Attributes.Weight).Value);
                string        expression         = criterionElement.Attribute(Attributes.Expression).Value;

                Criterion criterion = new Criterion(id, name, variableIdentifier, criterionType, expression)
                {
                    Weight = weight
                };

                ReadPropertyCollection(criterion.Properties, ReadCollectionElement(Elements.Properties, criterionElement, false));

                model.Criteria.Add(criterion);
            }
        }
        private static void ReadPromotableCriteria(ModelDraft modelDraft, XElement promotableCriterionCollectionElement)
        {
            IEnumerable <XElement> promotableCriterionElements = promotableCriterionCollectionElement.Descendants(Elements.PromotableCriterion);

            foreach (XElement promotableCriterionElement in promotableCriterionElements)
            {
                TId           id   = TId.Parse(promotableCriterionElement.Attribute(Attributes.Id).Value);
                string        name = promotableCriterionElement.Attribute(Attributes.Name).Value;
                string        variableIdentifier = promotableCriterionElement.Attribute(Attributes.VariableIdentifier).Value;
                bool          isPromoted         = Convert.ToBoolean(promotableCriterionElement.Attribute(Attributes.IsPromoted).Value);
                CriterionType criterionType      = EnumExtensions.Parse <CriterionType>(promotableCriterionElement.Attribute(Attributes.Type).Value);
                Relation      constraintRelation = EnumExtensions.Parse <Relation>(promotableCriterionElement.Attribute(Attributes.Relation).Value);
                double        value = ConvertExtensions.ToDoubleInvariant(promotableCriterionElement.Attribute(Attributes.Value).Value);

                PromotableCriterion promotableCriterion = new PromotableCriterion(id, name, variableIdentifier, criterionType)
                {
                    ConstraintRelation = constraintRelation,
                    IsPromoted         = isPromoted,
                    Value = value
                };

                modelDraft.PromotableCriteria.Add(promotableCriterion);
            }
        }
 public Result(CriterionType type, List<float> rating)
     : this(type)
 {
     ratingerg=0;
     resultType = ResultType.fail;
     passed = false;
     Rating = rating;
    
 }
 public Result(CriterionType type, int count)
     : this(type)
 {
     resultType = ResultType.fail;
     passed = false;
     ratingerg = 0;
     if (type == CriterionType.rating)
     {
         for (int i = 0; i < 5; i++)
         {
             Rating.Add(0);
         }
         //System.Console.WriteLine("rating");
     }
     else { 
     for (int i = 0; i < count; i++)
     {
         Rating.Add(0);
     }
     }
 }
 public Result(CriterionType type)
 {
     this.ratingerg = 0;
     Type = type;
     Rating = new List<float>();
     passed = false;
     resultType = ResultType.fail;
     
 }
Example #30
0
 public Criterion(string name, CriterionType type, string description = "")
 {
     Name        = name;
     Type        = type;
     Description = description;
 }
Example #31
0
 public Criterion(string name, object value, CriterionType type)
     : this(name, value, type, CriterionModel.Normal)
 {
 }
        private async Task<IList<AdGroupCriterion>> GetAdGroupCriterionsByIdsAsync(
            long adGroupId,
            IList<long> adGroupCriterionIds,
            CriterionType criterionType)
        {
            var request = new GetAdGroupCriterionsByIdsRequest
            {
                AdGroupId = adGroupId,
                CriterionType = criterionType,
                AdGroupCriterionIds = adGroupCriterionIds
            };

            return (await Service.CallAsync((s, r) => s.GetAdGroupCriterionsByIdsAsync(r), request)).AdGroupCriterions;
        }
Example #33
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string        critName = this.txtCriterionName.Text.Trim();
            string        critVariableIdentifier = this.txtCriterionVariableIdentifier.Text.Trim();
            CriterionType critType = CriterionTypeManager.ParseName(this.cmbCriterionType.Text);

#if DUMMY
            string critExpression = string.Empty;
#else
            string critExpression = this.txtCriterionExpression.Text.Trim();
#endif

            if (string.IsNullOrEmpty(critName))
            {
                MessageBoxHelper.ShowExclamation("Введите имя критерия оптимальности");
                return;
            }
            if (!string.IsNullOrEmpty(critVariableIdentifier))
            {
                if (!VariableIdentifierChecker.RegExCheck(critVariableIdentifier))
                {
                    MessageBoxHelper.ShowExclamation("Идентификатор переменной должен начинаться только с заглавной или строчной буквы \nлатинского алфавита и содержать заглавные и строчные буквы латинского алфавита,\n цифры и символ подчеркивания");
                    return;
                }
                if (VariableIdentifierChecker.IsInRestrictedList(critVariableIdentifier, Program.ApplicationSettings.RestrictedVariableIdentifiers))
                {
                    MessageBoxHelper.ShowExclamation("Идентификатор переменной совпадает с одним из запрещенных вариантов");
                    return;
                }
                if (this._criterionId == -1)
                {
                    // Если это новый критерий, то надо безусловно проверить
                    // идентификатор
                    if (this._model.CheckCriterionVariableIdentifier(critVariableIdentifier))
                    {
                        MessageBoxHelper.ShowExclamation("Критерий оптимальности с таким идентификатором переменной уже существует в модели");
                        return;
                    }
                }
                else
                {
                    // Если критерий редактируется, то если идентификатор
                    // не изменялся, то можно его не проверять
                    if (this._model.Criteria[this._criterionId].VariableIdentifier != critVariableIdentifier &&
                        this._model.CheckCriterionVariableIdentifier(critVariableIdentifier))
                    {
                        MessageBoxHelper.ShowExclamation("Критерий оптимальности с таким идентификатором переменной уже существует в модели");
                        return;
                    }
                }
            }

            if (this._criterionId == -1)
            {
                this._criterionId = this._model.Criteria.GetFreeConsequentId();
                Criterion criterion = new Criterion(
                    this._criterionId,
                    critName,
                    critVariableIdentifier,
                    critType,
                    critExpression);
                this._model.Criteria.Add(criterion);

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                Criterion criterion = this._model.Criteria[this._criterionId];
                criterion.Name = critName;
                criterion.VariableIdentifier = critVariableIdentifier;
                criterion.Type       = critType;
                criterion.Expression = critExpression;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
 public Recommendation(CriterionType typ)
 {
     this.type = typ;
     this.items = new List<Item>();
 }
Example #35
0
        public Criterion(ConfigNode node)
        {
            this.type = (CriterionType)Enum.Parse(typeof(CriterionType), node.GetValue("type"));
            if (type == CriterionType.Part || type == CriterionType.Module || type == CriterionType.MinResourceLevel || type == CriterionType.MinResourceCapacity || type == CriterionType.CrewMember)
            {
                paramsGUIFunction = ChecklistSystem.ParamsTextField;
                parameter         = 1;
                tempParam         = 1;
                parameterType     = typeof(int);
                hasParameter      = true;
            }

            if (node.HasValue("defaultParameter"))
            {
                int i;
                if (int.TryParse(node.GetValue("defaultParameter"), out i))
                {
                    this.parameter = i;
                    this.tempParam = this.parameter;
                }
            }
            if (node.HasValue("requiredMod"))
            {
                Log.Info("requiredMod found");
                reqModName = node.GetValue("requiredMod");
                Log.Info("reqModName: " + reqModName);
                if (!WernherChecker.hasMod(reqModName))
                {
                    Log.Info("required mod not found");
                    valid = false;
                    return;
                }
            }
            else
            {
                reqModName = null;
            }
            valid = true;

            switch (this.type)
            {
            case CriterionType.Module:
                this.modules         = node.GetValue("modules").Trim().Split(',').ToList <string>();
                this.measure         = "QTY";
                this.valuesFull      = string.Join(", ", this.modules.ToArray());
                this.valuesShortened = this.modules.First() + (this.modules.Count == 1 ? string.Empty : ",...");
                this.tooltip         = "How many of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel contain";
                break;

            case CriterionType.Part:
                this.parts           = node.GetValue("parts").Trim().Split(',').ToList <string>();
                this.measure         = "QTY";
                this.valuesFull      = string.Join(", ", this.parts.ToArray());
                this.valuesShortened = this.parts.First() + (this.parts.Count == 1 ? string.Empty : ",...");
                this.tooltip         = "How many of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel contain";
                break;

            case CriterionType.MinResourceLevel:
                this.resourceName    = node.GetValue("resourceName");
                this.measure         = "AMT";
                this.valuesFull      = this.resourceName;
                this.valuesShortened = this.resourceName;
                this.tooltip         = "How much of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel contain";
                break;

            case CriterionType.MinResourceCapacity:
                this.resourceName    = node.GetValue("resourceName");
                this.measure         = "CAPY";
                this.valuesFull      = this.resourceName;
                this.valuesShortened = this.resourceName;
                this.tooltip         = "How much of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel has capacity for";
                break;

            case CriterionType.CrewMember:
                this.experienceTrait = node.GetValue("experienceTrait");
                this.measure         = "LVL";
                this.valuesFull      = this.experienceTrait;
                this.valuesShortened = this.experienceTrait;
                this.tooltip         = "Minimum experience level of your <b><color=#90FF3E>" + this.valuesFull + "</color></b>";
                break;

            case CriterionType.ContractRequirements:
                break;
            }
        }
        private async Task<IList<AdGroupCriterion>> GetAdGroupCriterionsByAdGroupIdAsync(
            long adGroupId,
            CriterionType criterionType)
        {
            var request = new GetAdGroupCriterionsByAdGroupIdRequest
            {
                AdGroupId = adGroupId,
                CriterionTypeFilter = criterionType
            };

            return (await Service.CallAsync((s, r) => s.GetAdGroupCriterionsByAdGroupIdAsync(r), request)).AdGroupCriterions;
        }
        public Criterion(ConfigNode node)
        {
            this.type = (CriterionType)Enum.Parse(typeof(CriterionType), node.GetValue("type"));
            if (type == CriterionType.Part || type == CriterionType.Module || type == CriterionType.MinResourceLevel || type == CriterionType.MinResourceCapacity || type == CriterionType.CrewMember)
            {
                paramsGUIFunction = ChecklistSystem.ParamsTextField;
                parameter = 1;
                tempParam = 1;
                parameterType = typeof(int);
                hasParameter = true;
            }

            if (node.HasValue("defaultParameter"))
            {
                int i;
                if (int.TryParse(node.GetValue("defaultParameter"), out i))
                {
                    this.parameter = i;
                    this.tempParam = this.parameter;
                }
            }

            switch (this.type)
            {
                case CriterionType.Module:
                    this.modules = node.GetValue("modules").Trim().Split(',').ToList<string>();
                    this.measure = "QTY";
                    this.valuesFull = string.Join(", ", this.modules.ToArray());
                    this.valuesShortened = this.modules.First() + (this.modules.Count == 1 ? string.Empty : ",...");
                    this.tooltip = "How many of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel contain";
                    break;

                case CriterionType.Part:
                    this.parts = node.GetValue("parts").Trim().Split(',').ToList<string>();
                    this.measure = "QTY";
                    this.valuesFull = string.Join(", ", this.parts.ToArray());
                    this.valuesShortened = this.parts.First() + (this.parts.Count == 1 ? string.Empty : ",...");
                    this.tooltip = "How many of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel contain";
                    break;

                case CriterionType.MinResourceLevel:
                    this.resourceName = node.GetValue("resourceName");
                    this.measure = "AMT";
                    this.valuesFull = this.resourceName;
                    this.valuesShortened = this.resourceName;
                    this.tooltip = "How much of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel contain";
                    break;
                case CriterionType.MinResourceCapacity:
                    this.resourceName = node.GetValue("resourceName");
                    this.measure = "CAPY";
                    this.valuesFull = this.resourceName;
                    this.valuesShortened = this.resourceName;
                    this.tooltip = "How much of <b><color=#90FF3E>" + this.valuesFull + "</color></b> should your vessel has capacity for";
                    break;
                case CriterionType.CrewMember:
                    this.experienceTrait = node.GetValue("experienceTrait");
                    this.measure = "LVL";
                    this.valuesFull = this.experienceTrait;
                    this.valuesShortened = this.experienceTrait;
                    this.tooltip = "Minimum experience level of your <b><color=#90FF3E>" + this.valuesFull + "</color></b>";
                    break;
                case CriterionType.ContractRequirements:
                    break;
            }
        }
Example #38
0
 public NumericRangeCriterion(Decimal minValue, Decimal maxValue, CriterionType type)
 {
     DecimalMaxValue = maxValue;
     DecimalMinValue = minValue;
     Type            = type;
 }
        public Criterion(CriterionType type)
        {
            this.type = type;
            if (type == CriterionType.Part || type == CriterionType.Module || type == CriterionType.MinResourceLevel || type == CriterionType.MinResourceCapacity || type == CriterionType.CrewMember)
            {
                paramsGUIFunction = ChecklistSystem.ParamsTextField;
                parameter = 1;
                tempParam = 1;
                parameterType = typeof(int);
                hasParameter = true;
            }

            /*else if (type == CriterionType.ContractRequirements)
            {
                parameterType = typeof(Contracts.Contract);
                hasParameter = true;
                paramsGUIAction = Checklists.ParamsContractSelect;
                parameter = Contracts.ContractSystem.Instance.GetCurrentActiveContracts<Contracts.Contract>().DefaultIfEmpty(new Contracts.Contract()).First();
                tempParam = parameter;

            }*/
        }