public PersonCategory(int age, PermittedGender gender)
        {
            switch (age)
            {
            case { } myage when myage <= 18:
                AgeRange = AgeRange.Child;
                break;

            case { } myage when myage > 18 && myage <= 25:
                AgeRange = AgeRange.Student;
                break;

            case { } myage when myage > 25 && myage < 65:
                AgeRange = AgeRange.Adult;
                break;

            case { } myage when myage >= 65:
                AgeRange = AgeRange.Retiree;
                break;

            default: throw new LPGException("Nothing found: Age: " + age + " Gender: " + gender);
            }

            Gender = gender;
        }
 public CalcSubAffordanceDto([NotNull] string name, int id, [NotNull] string locName, StrGuid locGuid,
                             [NotNull][ItemNotNull] List <CalcDesireDto> satisfactionvalues,
                             int miniumAge, int maximumAge, int delaytimesteps, PermittedGender permittedGender,
                             [NotNull] string affCategory,
                             bool isInterruptable, bool isInterrupting,
                             [ItemNotNull][NotNull] List <CalcAffordanceVariableOpDto> variableOps, int weight, [NotNull] string sourceTrait,
                             StrGuid guid)
 {
     Name               = name;
     ID                 = id;
     LocName            = locName;
     LocGuid            = locGuid;
     Satisfactionvalues = satisfactionvalues;
     MiniumAge          = miniumAge;
     MaximumAge         = maximumAge;
     Delaytimesteps     = delaytimesteps;
     PermittedGender    = permittedGender;
     AffCategory        = affCategory;
     IsInterruptable    = isInterruptable;
     IsInterrupting     = isInterrupting;
     VariableOps        = variableOps;
     Weight             = weight;
     SourceTrait        = sourceTrait;
     Guid               = guid;
 }
Exemple #3
0
        public void AddReference([NotNull] string tagName, PermittedGender gender, int minage, int maxAge,
                                 double referenceValue)
        {
            var re = new ReferenceEntry(tagName, gender, minage, maxAge, referenceValue);

            _referenceEntries.Add(re);
        }
 public SettlementPersonInformation([NotNull] string name, int age, PermittedGender gender, [NotNull] string personTag)
 {
     Name      = name;
     Age       = age;
     Gender    = gender;
     PersonTag = personTag;
 }
Exemple #5
0
 public ReferenceEntry([NotNull] string tag, PermittedGender gender, int minAge, int maxAge,
                       double referenceValue)
 {
     Tag            = tag;
     Gender         = gender;
     MinAge         = minAge;
     MaxAge         = maxAge;
     ReferenceValue = referenceValue;
 }
Exemple #6
0
 public Person([NotNull] string name, int age, [CanBeNull] int?pID, int sickDays, int averageSicknessDuration, PermittedGender gender,
               [NotNull] string connectionString, [NotNull] string description, StrGuid guid) : base(name, TableName, connectionString, guid)
 {
     _age      = age;
     ID        = pID;
     _sickDays = sickDays;
     _averageSicknessDuration = averageSicknessDuration;
     _gender         = gender;
     TypeDescription = "Person";
     _description    = description;
 }
 public JsonDto(JsonReference desire, decimal decayTime, HealthStatus sicknessdesire, decimal threshold, decimal weight, int minAge, int maxAge, PermittedGender gender, StrGuid guid)
 {
     Desire         = desire;
     DecayTime      = decayTime;
     Sicknessdesire = sicknessdesire;
     Threshold      = threshold;
     Weight         = weight;
     MinAge         = minAge;
     MaxAge         = maxAge;
     Gender         = gender;
     Guid           = guid;
 }
Exemple #8
0
 public AffordanceTagReference([NotNull] string name, int taggingSetID, [CanBeNull] AffordanceTag tag,
                               [NotNull] string connectionString,
                               [CanBeNull] int?pID, PermittedGender gender, int minAge, int maxAge, double percentage, StrGuid guid)
     : base(name, pID, TableName, connectionString, guid)
 {
     _taggingSetID   = taggingSetID;
     _tag            = tag;
     _gender         = gender;
     _minAge         = minAge;
     _maxAge         = maxAge;
     _percentage     = percentage;
     TypeDescription = "Affordance Tag Reference";
 }
Exemple #9
0
        public double LookupReferenceValue([NotNull] string tagName, PermittedGender gender, int age)
        {
            var re =
                _referenceEntries.FirstOrDefault(
                    x => x.Tag == tagName && x.Gender == gender && age >= x.MinAge && age <= x.MaxAge);

            if (re != null)
            {
                return(re.ReferenceValue);
            }

            return(0);
        }
 public SubAffordance([NotNull] string pName, [CanBeNull] int?id, PermittedGender permittedGender, [NotNull] string connectionString,
                      bool isInterruptable, bool isInterrupting, int maximumAge, int minimumAge, StrGuid guid) : base(pName, TableName,
                                                                                                                      connectionString, guid)
 {
     ID = id;
     _subAffordanceDesires     = new ObservableCollection <SubAffordanceDesire>();
     _subAffordanceVariableOps = new ObservableCollection <SubAffordanceVariableOp>();
     TypeDescription           = "SubAffordance";
     _permittedGender          = permittedGender;
     _isInterruptable          = isInterruptable;
     _isInterrupting           = isInterrupting;
     _maximumAge = maximumAge;
     _minimumAge = minimumAge;
 }
Exemple #11
0
 public TemplatePerson([NotNull] string pName, [CanBeNull] int?id, [NotNull]  string description, [NotNull] string connectionString, int age,
                       int averageSicknessDuration, PermittedGender gender, int sickDays,
                       [CanBeNull] ModularHousehold baseHousehold, [CanBeNull] Person basePerson, StrGuid guid) : base(pName, TableName,
                                                                                                                       connectionString, guid)
 {
     ID = id;
     TypeDescription          = "Household Template";
     _description             = description;
     _age                     = age;
     _averageSicknessDuration = averageSicknessDuration;
     _gender                  = gender;
     _sickDays                = sickDays;
     _baseHousehold           = baseHousehold;
     _basePerson              = basePerson;
 }
 public CalcPersonDto([NotNull] string name, StrGuid guid, int age, PermittedGender gender,
                      [NotNull] HouseholdKey householdKey, [ItemNotNull][NotNull] List <DateSpan> sicknessSpans, [NotNull][ItemNotNull] List <DateSpan> vacationSpans, int id,
                      [NotNull] string traitTag, [NotNull] string householdName)
 {
     Name          = name;
     Guid          = guid;
     Age           = age;
     Gender        = gender;
     HouseholdKey  = householdKey;
     SicknessSpans = sicknessSpans;
     VacationSpans = vacationSpans;
     ID            = id;
     TraitTag      = traitTag;
     HouseholdName = householdName;
 }
 public HHTDesire([CanBeNull] int?pID, [CanBeNull] int?householdTraitID, decimal decayTime, [CanBeNull] Desire desire,
                  HealthStatus sicknessdesire,
                  decimal threshold, decimal weight, [NotNull] string connectionString, [NotNull] string name, int minAge, int maxAge,
                  PermittedGender gender, StrGuid guid) : base(name, TableName, connectionString, guid)
 {
     ID                = pID;
     _decayTime        = decayTime;
     _householdTraitID = householdTraitID;
     _desire           = desire;
     SicknessDesire    = sicknessdesire;
     Threshold         = threshold;
     Weight            = weight;
     MinAge            = minAge;
     MaxAge            = maxAge;
     Gender            = gender;
     TypeDescription   = "Household Trait Desire";
 }
Exemple #14
0
 public CalcAffordanceDto([NotNull] string name, int id, [NotNull] CalcProfileDto personProfile, [NotNull] string calcLocationName,
                          StrGuid calcLocationGuid, bool randomEffect,
                          [ItemNotNull][NotNull] List <CalcDesireDto> satisfactionvalues, int miniumAge, int maximumAge,
                          PermittedGender permittedGender,
                          bool needsLight, double timeStandardDeviation, byte colorR, byte colorG, byte colorB, [NotNull] string affCategory,
                          bool isInterruptable, bool isInterrupting, [ItemNotNull][NotNull] List <CalcAffordanceVariableOpDto> variableOps,
                          [ItemNotNull][NotNull] List <VariableRequirementDto> variableRequirements,
                          ActionAfterInterruption actionAfterInterruption, [NotNull] string timeLimitName, int weight,
                          bool requireAllDesires, [NotNull] string srcTrait,
                          StrGuid guid, [NotNull] AvailabilityDataReferenceDto isBusyArray,
                          [NotNull] HouseholdKey householdKey, BodilyActivityLevel bodilyActivityLevel)
 {
     Name                    = name;
     ID                      = id;
     PersonProfile           = personProfile;
     CalcLocationName        = calcLocationName;
     CalcLocationGuid        = calcLocationGuid;
     RandomEffect            = randomEffect;
     Satisfactionvalues      = satisfactionvalues;
     MiniumAge               = miniumAge;
     MaximumAge              = maximumAge;
     PermittedGender         = permittedGender;
     NeedsLight              = needsLight;
     TimeStandardDeviation   = timeStandardDeviation;
     ColorR                  = colorR;
     ColorG                  = colorG;
     ColorB                  = colorB;
     AffCategory             = affCategory;
     IsInterruptable         = isInterruptable;
     IsInterrupting          = isInterrupting;
     VariableOps             = variableOps;
     VariableRequirements    = variableRequirements;
     ActionAfterInterruption = actionAfterInterruption;
     TimeLimitName           = timeLimitName;
     Weight                  = weight;
     RequireAllDesires       = requireAllDesires;
     SrcTrait                = srcTrait;
     Guid                    = guid;
     IsBusyArray             = isBusyArray;
     HouseholdKey            = householdKey;
     BodilyActivityLevel     = bodilyActivityLevel;
 }
Exemple #15
0
        protected CalcAffordanceBase([NotNull] string pName, [NotNull] CalcLocation loc,
                                     [NotNull][ItemNotNull] List <CalcDesire> satisfactionvalues,
                                     int miniumAge, int maximumAge, PermittedGender permittedGender, bool needsLight,
                                     bool randomEffect,
                                     [NotNull] string pAffCategory, bool isInterruptable, bool isInterrupting,
                                     ActionAfterInterruption actionAfterInterruption, int weight,
                                     bool requireAllAffordances,
                                     CalcAffordanceType calcAffordanceType,
                                     StrGuid guid,
                                     [ItemNotNull][NotNull] BitArray isBusyArray,
                                     BodilyActivityLevel bodilyActivityLevel, [NotNull] CalcRepo calcRepo,
                                     [CanBeNull] CalcSite site = null) : base(pName, guid)
        {
            CalcAffordanceType  = calcAffordanceType;
            BodilyActivityLevel = bodilyActivityLevel;
            CalcRepo            = calcRepo;
            Site               = site;
            ParentLocation     = loc;
            Satisfactionvalues = satisfactionvalues;
            _isBusyArray       = new BitArray(calcRepo.CalcParameters.InternalTimesteps);
            //copy to make sure that it is a separate instance
            for (var i = 0; i < isBusyArray.Length; i++)
            {
                _isBusyArray[i] = isBusyArray[i];
            }
            Weight = weight;
            RequireAllAffordances    = requireAllAffordances;
            MiniumAge                = miniumAge;
            MaximumAge               = maximumAge;
            PermittedGender          = permittedGender;
            NeedsLight               = needsLight;
            RandomEffect             = randomEffect;
            AffCategory              = pAffCategory;
            IsInterruptable          = isInterruptable;
            IsInterrupting           = isInterrupting;
            _actionAfterInterruption = actionAfterInterruption;
            CalcAffordanceSerial     = _calcAffordanceBaseSerialTracker;
#pragma warning disable S3010 // Static fields should not be updated in constructors
            _calcAffordanceBaseSerialTracker++;
#pragma warning restore S3010 // Static fields should not be updated in constructors
        }
 public CalcSubAffordance([NotNull] string pName, [NotNull] CalcLocation loc, [NotNull][ItemNotNull] List <CalcDesire> satisfactionvalues,
                          int miniumAge, int maximumAge, int delaytimesteps, PermittedGender permittedGender, [NotNull] string pAffCategory,
                          bool isInterruptable, bool isInterrupting, [NotNull] CalcAffordance parentAffordance,
                          [NotNull][ItemNotNull] List <CalcAffordanceVariableOp> variableOps, int weight,
                          [NotNull] string sourceTrait,
                          StrGuid guid, [ItemNotNull][NotNull] BitArray isBusy,
                          [NotNull] CalcVariableRepository repository, BodilyActivityLevel bodilyActivityLevel, [NotNull] CalcRepo calcRepo)
     : base(
         pName, loc, satisfactionvalues, miniumAge, maximumAge, permittedGender, false, false, pAffCategory,
         isInterruptable, isInterrupting, ActionAfterInterruption.GoBackToOld, weight, false,
         CalcAffordanceType.Subaffordance, guid, isBusy, bodilyActivityLevel, calcRepo)
 {
     Delaytimesteps   = delaytimesteps;
     _variableOps     = variableOps;
     _repository      = repository;
     SubAffordances   = new List <CalcSubAffordance>();
     Energyprofiles   = new List <CalcAffordance.DeviceEnergyProfileTuple>();
     AffordanceColor  = LPGColors.Black;
     SourceTrait      = sourceTrait;
     TimeLimitName    = null;
     ParentAffordance = parentAffordance;
 }
Exemple #17
0
        public CalcAffordance([NotNull] string pName,
                              [NotNull] CalcProfile personProfile,
                              [NotNull] CalcLocation loc,
                              bool randomEffect,
                              [NotNull][ItemNotNull] List <CalcDesire> satisfactionvalues,
                              int miniumAge,
                              int maximumAge,
                              PermittedGender permittedGender,
                              bool needsLight,
                              double timeStandardDeviation,
                              ColorRGB affordanceColor,
                              [NotNull] string pAffCategory,
                              bool isInterruptable,
                              bool isInterrupting,
                              [NotNull][ItemNotNull] List <CalcAffordanceVariableOp> variableOps,
                              [NotNull][ItemNotNull] List <VariableRequirement> variableRequirements,
                              ActionAfterInterruption actionAfterInterruption,
                              [NotNull] string timeLimitName,
                              int weight,
                              bool requireAllDesires,
                              [NotNull] string srcTrait,
                              StrGuid guid,
                              [NotNull] CalcVariableRepository variableRepository,
                              [NotNull][ItemNotNull] List <DeviceEnergyProfileTuple> energyprofiles,
                              [ItemNotNull][NotNull] BitArray isBusy, BodilyActivityLevel bodilyActivityLevel,
                              [NotNull] CalcRepo calcRepo) : base(pName,
                                                                  loc,
                                                                  satisfactionvalues,
                                                                  miniumAge,
                                                                  maximumAge,
                                                                  permittedGender,
                                                                  needsLight,
                                                                  randomEffect,
                                                                  pAffCategory,
                                                                  isInterruptable,
                                                                  isInterrupting,
                                                                  actionAfterInterruption,
                                                                  weight,
                                                                  requireAllDesires,
                                                                  CalcAffordanceType.Affordance,
                                                                  guid,
                                                                  isBusy, bodilyActivityLevel, calcRepo)
        {
            _variableOps          = variableOps;
            _variableRequirements = variableRequirements;
            _variableRepository   = variableRepository;
            Energyprofiles        = energyprofiles;
            SourceTrait           = srcTrait;
            if (personProfile == null)
            {
#pragma warning disable IDE0016 // Use 'throw' expression
                throw new DataIntegrityException("The affordance " + Name + " has no person profile!");
#pragma warning restore IDE0016 // Use 'throw' expression
            }

            _timeStandardDeviation = timeStandardDeviation;
            SubAffordances         = new List <CalcSubAffordance>();
            _personProfile         = personProfile;
            AffordanceColor        = affordanceColor;
            TimeLimitName          = timeLimitName;
        }
Exemple #18
0
 private static string GetRefStatisticDescription(PermittedGender gender, int minAge, int maxAge) =>
 gender + " between " + minAge + " and " + maxAge;