Beispiel #1
0
 public ExpressionContext(Parse.Expression expression, Type.BaseType type, Characteristic characteristics, Action<MethodContext> emitGet)
 {
     Expression = expression;
     Type = type;
     Characteristics = characteristics;
     EmitGet = emitGet;
 }
 public override string ToPresentation(JobMode jobMode, Characteristic characteristic)
 {
     // TODO: DO NOT hardcode Characteristic suffix
     var id = characteristic.Id;
     var type = characteristic.DeclaringType.FullName;
     var value = SourceCodeHelper.ToSourceCode(characteristic[jobMode]);
     return $"{type}.{id}Characteristic[job] = {value}";
 }
Beispiel #3
0
 public Effect(Characteristic target, int amount, EffectType type, int duration, DurationType durType)
 {
     Target = target;
     Amount = amount;
     Type = type;
     Duration = duration;
     DurType = durType;
 }
Beispiel #4
0
	// Use this for initialization
	void Awake () {
		 
		Xp = 0;
		Level = 1;
		MaxXp = 100;
		PlayerCharacteristic = GetComponent<Characteristic> ();
		//MaxHealth = PlayerCharacteristic.MaxHealth;
		Health = PlayerCharacteristic.MaxHealth; //set the full life at the beginning
	}
 public static bool CheckForSuccess(Characteristic requirement, Characteristic result)
 {
     switch (requirement.Type)
     {
         case CharacteristicType.InputOutputCompliance:
             return (bool)requirement.Value == (bool)result.Value;
         default:
             return false;
     }
 }
            public override string ToPresentation(JobMode jobMode, Characteristic characteristic)
            {
                if (!jobMode.HasValue(characteristic))
                    return "Default";

                var value = characteristic[jobMode];
                return (value as IFormattable)?.ToString(null, HostEnvironmentInfo.MainCultureInfo)
                    ?? value?.ToString() 
                    ?? "";
            }
        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chains">
        /// The chains.
        /// </param>
        /// <param name="calculators">
        /// The calculators.
        /// </param>
        /// <param name="links">
        /// The links.
        /// </param>
        /// <param name="characteristicTypeLinkIds">
        /// The characteristic type link ids.
        /// </param>
        /// <returns>
        /// The <see cref="T:double[][]"/>.
        /// </returns>
        public static double[][] Calculate(Chain[][] chains, IFullCalculator[] calculators, Link[] links, int[] characteristicTypeLinkIds)
        {
            var newCharacteristics = new List<Characteristic>();
            var characteristics = new double[chains.Length][];
            var sequenceIds = chains.SelectMany(c => c).Select(c => c.Id).Distinct();

            Dictionary<long, Dictionary<int, double>> dbCharacteristics;
            using (var db = new LibiadaWebEntities())
            {
                dbCharacteristics = db.Characteristic
                                              .Where(c => characteristicTypeLinkIds.Contains(c.CharacteristicTypeLinkId) && sequenceIds.Contains(c.SequenceId))
                                              .ToArray()
                                              .GroupBy(c => c.SequenceId)
                                              .ToDictionary(c => c.Key, c => c.ToDictionary(ct => ct.CharacteristicTypeLinkId, ct => ct.Value));
            }

            for (int i = 0; i < chains.Length; i++)
            {
                characteristics[i] = new double[calculators.Length];

                for (int j = 0; j < calculators.Length; j++)
                {
                    long sequenceId = chains[i][j].Id;
                    chains[i][j].FillIntervalManagers();

                    Dictionary<int, double> sequenceDbCharacteristics;
                    if (!dbCharacteristics.TryGetValue(sequenceId, out sequenceDbCharacteristics))
                    {
                        sequenceDbCharacteristics = new Dictionary<int, double>();
                    }

                    if (!sequenceDbCharacteristics.TryGetValue(characteristicTypeLinkIds[j], out characteristics[i][j]))
                    {
                        characteristics[i][j] = calculators[j].Calculate(chains[i][j], links[j]);
                        var currentCharacteristic = new Characteristic
                        {
                            SequenceId = sequenceId,
                            CharacteristicTypeLinkId = characteristicTypeLinkIds[j],
                            Value = characteristics[i][j]
                        };

                        newCharacteristics.Add(currentCharacteristic);
                    }
                }
            }

            // trying to save calculated characteristics to database
            using (var db = new LibiadaWebEntities())
            {
                var characteristicRepository = new CharacteristicRepository(db);
                characteristicRepository.TrySaveCharacteristicsToDatabase(newCharacteristics);
            }

            return characteristics;
        }
        public CharacteristicColumn(Characteristic characteristic)
        {
            this.characteristic = characteristic;
            Id = "Job." + characteristic.Id;
            ColumnName = characteristic.Id;

            // The 'Id' characteristic is a special case:
            // here we just print 'Job'
            if (characteristic.Id == "Id")
                ColumnName = "Job";
        }
Beispiel #9
0
	// Use this for initialization
	void Awake () {
	

		Content = GetComponentsInChildren<Item>();
		PlayerManager = GameObject.Find ("Player").GetComponent<PlayerManager> ();
		characterScript = GameObject.Find ("Player").transform.Find ("Equipement").GetComponent<Character> ();
		characteristicScript = GameObject.Find ("Player").GetComponent<Characteristic> ();
		
		TotalPages = Mathf.Ceil(Content.Length / 10.0f) ; //we write 10 item per page




	}
        public DatabaseDetailsViewModel(ISqlQueryExecutor queryExecutor,
                                        string databaseConnectionString, string databaseName, IDatabaseDetailsWindow view)
        {
            _queryExecutor = queryExecutor;
            _databaseConnectionString = databaseConnectionString;
            WindowCaption = string.Format("Database {0} tables details", databaseName);
            _numValues = DEFAULT_NUM_VALUES_TO_SHOW;
            _characteristicToDisplay = Characteristic.DataSize;
            ItemsToShow = new ObservableCollection<TableInfoViewItem>();
            Refresh = new RelayCommand(RefreshClicked);
            ProgressVisible = false;
            ProgressValue = 0;

            view.Loaded += (sender, args) => RefreshClicked();

            _queryExecutor.TableLoadProgressChanged += queryExecutor_TableLoadProgressChanged;
        }
 private static string ValidateToolchain(Job job, Characteristic characteristic) =>
 job.Infrastructure.Toolchain is InProcessToolchain
         ? null
         : $"should be instance of {nameof(InProcessToolchain)}.";
Beispiel #12
0
	private string[] SlotName; //the names of the différents slots (Head, chest etc)


	
	void Awake () {
		CharacterContener = GameObject.Find ("Player").transform.Find ("Equipement").gameObject;
		Var = new int[6] {Health,Magic,Strength,Armor,Agility,Wisdom};
		Characteristic = GameObject.Find ("Player").GetComponent<Characteristic> ();
		SlotName = new string[6] {"Health","Magic","Strength","Defense","Agility","Wisdom"};
	}
 protected static Characteristic <TC> CreateCharacteristic <TC>(string memberName) => Characteristic.Create <T, TC>(memberName);
Beispiel #14
0
 public BaseNode(IDriverContext driverContext, Characteristic characteristic, HomeKitDriver driver) : base(driverContext)
 {
     Characteristic = characteristic;
     Driver         = driver;
 }
 public override string ToPresentation(JobMode jobMode, Characteristic characteristic)
 {
     return jobMode.HasValue(characteristic)
         ? FolderNameHelper.ToFolderName(characteristic[jobMode])
         : "Default";
 }
Beispiel #16
0
    public static void PlantChar(int plant, int chart)
    {
        Characteristic [] PlantCharter = new Characteristic[6];

        switch(plant){
        case 1: // 수력
            if(chart==1){
                PlantCharter[plant-1].constructExpenses++;
                waterCost -= waterCost/10;
            }
            else if(chart==2){
                PlantCharter[plant-1].output++;
                waterpowerMoney += waterpowerMoney/10;
            }
            else if(chart==3){
                PlantCharter[plant-1].environment++;
            }
            break;
        case 2: // 화력
            if(chart==1){
                PlantCharter[plant-1].constructExpenses++;
                fireCost -= fireCost/10;
            }
            else if(chart==2){
                PlantCharter[plant-1].output++;
                thermalpowerMoney += thermalpowerMoney/10;
            }
            else if(chart==3){
                PlantCharter[plant-1].environment++;
            }
            break;
        case 3: // 원자력
            if(chart==1){
                PlantCharter[plant-1].constructExpenses++;
                nuclearCost -= nuclearCost/10;
            }
            else if(chart==2){
                PlantCharter[plant-1].output++;
                nuclearpowerMoney += nuclearpowerMoney/10;
            }
            else if(chart==3){
                PlantCharter[plant-1].environment++;
            }
            break;
        case 4: // 태양광
            if(chart==1){
                PlantCharter[plant-1].constructExpenses++;
                sunCost -=sunCost/10;
            }
            else if(chart==2){
                PlantCharter[plant-1].output++;
                solarpowerMoney += solarpowerMoney/10;
            }
            else if(chart==3){
                PlantCharter[plant-1].environment++;
            }
            break;
        case 5: // 풍력
            if(chart==1){
                PlantCharter[plant-1].constructExpenses++;
                windCost -= windCost/10;
            }
            else if(chart==2){
                PlantCharter[plant-1].output++;
                windpowerMoney += windpowerMoney/10;
            }
            else if(chart==3){
                PlantCharter[plant-1].environment++;
            }
            break;
        case 6: // 중력
            if(chart==1){
                PlantCharter[plant-1].constructExpenses++;
                gravityCost -= gravityCost/10;
            }
            else if(chart==2){
                PlantCharter[plant-1].output++;
                gravitypowerMoney += gravitypowerMoney/10;
            }
            else if(chart==3){
                PlantCharter[plant-1].environment++;
            }
            break;
        }
    }
Beispiel #17
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as EvidenceFocus;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (UrlElement != null)
            {
                dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (VersionElement != null)
            {
                dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.PublicationStatus>)StatusElement.DeepCopy();
            }
            if (UseContext != null)
            {
                dest.UseContext = new List <Hl7.Fhir.Model.UsageContext>(UseContext.DeepCopy());
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            if (Copyright != null)
            {
                dest.Copyright = (Hl7.Fhir.Model.Markdown)Copyright.DeepCopy();
            }
            if (CiteAs != null)
            {
                dest.CiteAs = (Hl7.Fhir.Model.ResourceReference)CiteAs.DeepCopy();
            }
            if (Characteristic != null)
            {
                dest.Characteristic = new List <Hl7.Fhir.Model.EvidenceFocus.CharacteristicComponent>(Characteristic.DeepCopy());
            }
            if (RelatedArtifact != null)
            {
                dest.RelatedArtifact = new List <Hl7.Fhir.Model.RelatedArtifact>(RelatedArtifact.DeepCopy());
            }
            return(dest);
        }
Beispiel #18
0
 public void ReCalculating(Characteristic ch, int profBonus)
 {
     MainCharacteristic = ch;
     ProfBonus          = profBonus;
     Bonus = CalculateBonus(Prof);
 }
Beispiel #19
0
 public Skill(Characteristic mainCharacteristic, string skillName, Proficiency prof) :
     this(mainCharacteristic, skillName, 0, prof)
 {
 }
        /// <summary>
        /// The calculate characteristic.
        /// </summary>
        /// <param name="matterId">
        /// The matter id.
        /// </param>
        /// <param name="characteristicTypeLinkId">
        /// The characteristic type and link id.
        /// </param>
        /// <param name="notationId">
        /// The notation id.
        /// </param>
        /// <param name="featureIds">
        /// The feature ids.
        /// </param>
        /// <returns>
        /// The <see cref="List{Double}"/>.
        /// </returns>
        private List<double> CalculateCharacteristic(long matterId, int characteristicTypeLinkId, int notationId, int[] featureIds)
        {
            var characteristics = new List<double>();
            var newCharacteristics = new List<Characteristic>();
            var parentSequenceId = db.CommonSequence.Single(c => c.MatterId == matterId && c.NotationId == notationId).Id;

            Subsequence[] subsequences = subsequenceExtractor.GetSubsequences(parentSequenceId, featureIds);

            var sequences = subsequenceExtractor.ExtractChains(subsequences, parentSequenceId);

            string className = characteristicTypeLinkRepository.GetCharacteristicType(characteristicTypeLinkId).ClassName;
            IFullCalculator calculator = CalculatorsFactory.CreateFullCalculator(className);
            var link = characteristicTypeLinkRepository.GetLibiadaLink(characteristicTypeLinkId);

            for (int j = 0; j < sequences.Length; j++)
            {
                long subsequenceId = subsequences[j].Id;

                if (!db.Characteristic.Any(c => c.SequenceId == subsequenceId && c.CharacteristicTypeLinkId == characteristicTypeLinkId))
                {
                    double value = calculator.Calculate(sequences[j], link);
                    var currentCharacteristic = new Characteristic
                    {
                        SequenceId = subsequenceId,
                        CharacteristicTypeLinkId = characteristicTypeLinkId,
                        Value = value
                    };
                    newCharacteristics.Add(currentCharacteristic);
                }
            }

            db.Characteristic.AddRange(newCharacteristics);
            db.SaveChanges();

            for (int d = 0; d < sequences.Length; d++)
            {
                long subsequenceId = subsequences[d].Id;
                double characteristic = db.Characteristic.Single(c => c.SequenceId == subsequenceId && c.CharacteristicTypeLinkId == characteristicTypeLinkId).Value;

                characteristics.Add(characteristic);
            }

            return characteristics;
        }
Beispiel #21
0
 public Strenght(int? power, int? toughness)
 {
     _power = new Characteristic<int?>(power);
       _toughness = new Characteristic<int?>(toughness);
 }
        /// <summary>
        /// Calculates subsequences characteristics.
        /// </summary>
        /// <param name="characteristicTypeLinkIds">
        /// The characteristic type link ids.
        /// </param>
        /// <param name="featureIds">
        /// The features ids.
        /// </param>
        /// <param name="parentSequenceId">
        /// The parent sequence id.
        /// </param>
        /// <param name="calculators">
        /// The calculators.
        /// </param>
        /// <param name="links">
        /// The links.
        /// </param>
        /// <param name="attributeValues">
        /// Nonredundant array of all attributes.
        /// </param>
        /// <param name="filters">
        /// Textual search filters for subsequences products.
        /// </param>
        /// <returns>
        /// The <see cref="T:SubsequenceData[]"/>.
        /// </returns>
        public static SubsequenceData[] CalculateSubsequencesCharacteristics(
            int[] characteristicTypeLinkIds,
            int[] featureIds,
            long parentSequenceId,
            IFullCalculator[] calculators,
            Link[] links,
            List<AttributeValue> attributeValues,
            string[] filters = null)
        {
            // creating local context to avoid memory overflow due to possibly big cache of characteristics
            using (var context = new LibiadaWebEntities())
            {
                var subsequenceExtractor = new SubsequenceExtractor(context);
                var sequenceAttributeRepository = new SequenceAttributeRepository(context);
                var attributeRepository = new AttributeRepository();
                var newCharacteristics = new List<Characteristic>();

                // extracting data from database
                var dbSubsequences = filters == null ? subsequenceExtractor.GetSubsequences(parentSequenceId, featureIds) : subsequenceExtractor.GetSubsequences(parentSequenceId, featureIds, filters);
                var subsequenceIds = dbSubsequences.Select(s => s.Id).ToArray();
                var dbSubsequencesAttributes = sequenceAttributeRepository.GetAttributes(subsequenceIds);

                var dbCharacteristics = context.Characteristic.Where(c => characteristicTypeLinkIds.Contains(c.CharacteristicTypeLinkId) && subsequenceIds.Contains(c.SequenceId))
                        .ToArray()
                        .GroupBy(c => c.SequenceId)
                        .ToDictionary(c => c.Key, c => c.ToDictionary(ct => ct.CharacteristicTypeLinkId, ct => ct.Value));

                // converting to libiada sequences
                var sequences = subsequenceExtractor.ExtractChains(dbSubsequences, parentSequenceId);
                var subsequenceData = new SubsequenceData[sequences.Length];

                // cycle through subsequences
                for (int i = 0; i < sequences.Length; i++)
                {
                    var values = new double[characteristicTypeLinkIds.Length];
                    Dictionary<int, double> sequenceDbCharacteristics;
                    if (!dbCharacteristics.TryGetValue(dbSubsequences[i].Id, out sequenceDbCharacteristics))
                    {
                        sequenceDbCharacteristics = new Dictionary<int, double>();
                    }

                    // cycle through characteristics and notations
                    for (int j = 0; j < characteristicTypeLinkIds.Length; j++)
                    {
                        int characteristicTypeLinkId = characteristicTypeLinkIds[j];
                        if (!sequenceDbCharacteristics.TryGetValue(characteristicTypeLinkId, out values[j]))
                        {
                            values[j] = calculators[j].Calculate(sequences[i], links[j]);
                            var currentCharacteristic = new Characteristic
                            {
                                SequenceId = dbSubsequences[i].Id,
                                CharacteristicTypeLinkId = characteristicTypeLinkId,
                                Value = values[j]
                            };

                            newCharacteristics.Add(currentCharacteristic);
                        }
                    }

                    AttributeValue[] attributes;
                    if (!dbSubsequencesAttributes.TryGetValue(dbSubsequences[i].Id, out attributes))
                    {
                        attributes = new AttributeValue[0];
                    }

                    var attributeIndexes = new int[attributes.Length];
                    for (int j = 0; j < attributes.Length; j++)
                    {
                        if (!attributeValues.Contains(attributes[j]))
                        {
                            attributeValues.Add(attributes[j]);
                        }

                        attributeIndexes[j] = attributeValues.IndexOf(attributes[j]);
                    }

                    subsequenceData[i] = new SubsequenceData(dbSubsequences[i], values, attributeIndexes);
                }

                // trying to save calculated characteristics to database
                var characteristicRepository = new CharacteristicRepository(context);
                characteristicRepository.TrySaveCharacteristicsToDatabase(newCharacteristics);

                return subsequenceData;
            }
        }
 protected bool ShouldRunAuto(RunMode runMode, Characteristic<int> iterationCount) => !runMode.HasValue(iterationCount);
 private static ICharacteristic <T> Create <T>(string id) => Characteristic <T> .Create("Run", id);
        private BeatmapCharacteristicObject CreateCharacteristic(Characteristic characteristic)
        {
            if (characteristic == Characteristic.Standard)
            {
                throw new Exception("Tried to create standard beatmap characteristic which means it's missing.  Assets are broken.");
            }

            BeatmapCharacteristicObject standardCharacteristic = GetCharacteristicAsset(Characteristic.Standard);

            if (standardCharacteristic == null)
            {
                Log.LogErr($"Unable to locate the standard beatmap characteristic while verifying characteristics!");
                throw new Exception("Could not locate standard beatmap characteristic!");
            }
            int count = _assetsFile.Manager.MassFindAssets <BeatmapCharacteristicObject>(x => true, false).Count();

            try
            {
                string characteristicName = $"LEVEL_{characteristic.ToString().ToUpper()}";
                string hintText           = $"{characteristicName}_HINT";
                string assetName          = MiscUtils.GetCharacteristicAssetName(characteristic);
                var    lightshowAsset     = (BeatmapCharacteristicObject)standardCharacteristic.ObjectInfo.Clone(standardCharacteristic.ObjectInfo.ParentFile);

                lightshowAsset.Name               = assetName;
                lightshowAsset.SerializedName     = characteristic.ToString();
                lightshowAsset.SortingOrder       = count;
                lightshowAsset.CompoundIdPartName = characteristic.ToString();
                //todo: text translation stuff
                //lightshowAsset.CharacteristicName = characteristicName;
                //lightshowAsset.HintText = hintText;
                var allChar = _assetsFile.Manager.MassFirstOrDefaultAsset <BeatmapCharacteristicCollectionObject>(x => true);
                if (allChar == null)
                {
                    throw new Exception("Unable to find AllBeatmapCharacteristics object!");
                }
                if (!allChar.Object.BeatmapCharacteristics.Any(x => x.Object.Name == lightshowAsset.Name))
                {
                    allChar.Object.BeatmapCharacteristics.Add(lightshowAsset.PtrFrom(allChar.Object));
                }
                try
                {
                    byte[] lightshowIcon = _config.EmbeddedResourcesFileProvider.Read($"{characteristic}.png");
                    if (lightshowIcon == null || lightshowIcon.Length < 1)
                    {
                        throw new Exception($"{characteristic}.png read was null or empty!");
                    }
                    var clonedSprite = (SpriteObject)standardCharacteristic.Icon.Object.ObjectInfo.Clone(standardCharacteristic.ObjectInfo.ParentFile);
                    var newTexture   = new Texture2DObject(standardCharacteristic.ObjectInfo.ParentFile)
                    {
                        Name = assetName
                    };
                    clonedSprite.RenderData.AtlasRectOffset.X = -1;
                    clonedSprite.RenderData.AtlasRectOffset.Y = -1;
                    clonedSprite.RenderData.TextureRect.X     = 0;
                    clonedSprite.RenderData.TextureRect.Y     = 0;
                    clonedSprite.RenderData.Texture           = newTexture.PtrFrom(clonedSprite);
                    clonedSprite.Name = assetName + "Icon";
                    ImageUtils.Instance.AssignImageToTexture(lightshowIcon, newTexture, 128, 128, Int32.MaxValue, TextureConversionFormat.Auto);
                    lightshowAsset.Icon = clonedSprite.PtrFrom(lightshowAsset);
                    standardCharacteristic.ObjectInfo.ParentFile.AddObject(clonedSprite);
                    standardCharacteristic.ObjectInfo.ParentFile.AddObject(newTexture);
                    standardCharacteristic.ObjectInfo.ParentFile.AddObject(lightshowAsset);
                }
                catch (Exception ex)
                {
                    Log.LogErr($"Failed to load {characteristic}'s png icon!", ex);
                    throw;
                }
                return(lightshowAsset);
            }
            catch (Exception ex)
            {
                Log.LogErr($"Exception trying to create {characteristic} characteristic!", ex);
                throw new Exception($"Error trying to create characteristic {characteristic}!", ex);
            }
        }
 protected static Characteristic <TC> CreateIgnoreOnApplyharacteristic <TC>(string memberName) => Characteristic.CreateIgnoreOnApply <T, TC>(memberName);
        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chains">
        /// The chains.
        /// </param>
        /// <param name="calculator">
        /// The calculator.
        /// </param>
        /// <param name="link">
        /// The link.
        /// </param>
        /// <param name="characteristicTypeLinkId">
        /// The characteristic type link id.
        /// </param>
        /// <returns>
        /// The <see cref="T:double[]"/>.
        /// </returns>
        public static double[] Calculate(Chain[] chains, IFullCalculator calculator, Link link, int characteristicTypeLinkId)
        {
            var newCharacteristics = new List<Characteristic>();
            var characteristics = new double[chains.Length];
            var sequenceIds = chains.Select(c => c.Id);

            Dictionary<long, double> dbCharacteristics;
            using (var db = new LibiadaWebEntities())
            {
                dbCharacteristics = db.Characteristic
                                              .Where(c => characteristicTypeLinkId == c.CharacteristicTypeLinkId && sequenceIds.Contains(c.SequenceId))
                                              .ToArray()
                                              .GroupBy(c => c.SequenceId)
                                              .ToDictionary(c => c.Key, c => c.Single().Value);
            }

            for (int i = 0; i < chains.Length; i++)
            {
                chains[i].FillIntervalManagers();

                long sequenceId = chains[i].Id;

                if (!dbCharacteristics.TryGetValue(sequenceId, out characteristics[i]))
                {
                    characteristics[i] = calculator.Calculate(chains[i], link);
                    var currentCharacteristic = new Characteristic
                    {
                        SequenceId = sequenceId,
                        CharacteristicTypeLinkId = characteristicTypeLinkId,
                        Value = characteristics[i]
                    };

                    newCharacteristics.Add(currentCharacteristic);
                }
            }

            // trying to save calculated characteristics to database
            using (var db = new LibiadaWebEntities())
            {
                var characteristicRepository = new CharacteristicRepository(db);
                characteristicRepository.TrySaveCharacteristicsToDatabase(newCharacteristics);
            }

            return characteristics;
        }
 public async void CheckMyCharacteristic(Characteristic characteristic)
 {
     await characteristic.StartUpdatesAsync();
 }
Beispiel #29
0
 public Skill(Characteristic mainCharacteristic, string skillName, int profBonus) :
     this(mainCharacteristic, skillName, profBonus, Proficiency.NotProficient)
 {
 }
 public abstract string ToPresentation(JobMode jobMode, Characteristic characteristic);
Beispiel #31
0
 public Skill(Characteristic mainCharacteristic, string skillName) :
     this(mainCharacteristic, skillName, 0, Proficiency.NotProficient)
 {
 }
Beispiel #32
0
 public Characteristic Put(Characteristic request)
 {
     return(Patch(request));
 }
Beispiel #33
0
        Model.Request InternalMap(Model.Request request,
                                  Code customerCode             = null,
                                  Code groupCode                = null,
                                  RequestLineItem lineItem      = null,
                                  Characteristic lineItemChar   = null,
                                  HalalTeam halalTeam           = null,
                                  Premise premise               = null,
                                  Characteristic characteristic = null,
                                  Attachment attachment         = null,
                                  RFA rfa       = null,
                                  Log log       = null,
                                  Review review = null,
                                  ReviewLineItem reviewLineItem = null)
        {
            if (!_cache.TryGetValue(request.ID, out Model.Request result))
            {
                _cache[request.ID] = request;
                result             = request;
            }

            if ((customerCode?.ID ?? 0) > 0)
            {
                result.CustomerCode = customerCode;
            }

            if ((groupCode?.ID ?? 0) > 0)
            {
                result.GroupCode = groupCode;
            }

            RequestLineItem outLineItem = null;

            if ((lineItem?.ID ?? 0L) != 0L &&
                !_lineItemCache.TryGetValue(lineItem.ID, out outLineItem))
            {
                if (result.LineItems == null)
                {
                    result.LineItems = new List <RequestLineItem>();
                }
                result.LineItems.Add(lineItem);

                _lineItemCache[lineItem.ID] = lineItem;
                outLineItem = lineItem;
            }

            if (outLineItem != null &&
                (lineItemChar?.ID ?? 0L) != 0L &&
                !_lineItemCharCache.ContainsKey(lineItemChar.ID))
            {
                if (outLineItem.Characteristics == null)
                {
                    outLineItem.Characteristics = new List <Characteristic>();
                }

                _lineItemCharCache[lineItemChar.ID] = lineItemChar;
                outLineItem.Characteristics.Add(lineItemChar);
            }

            if ((halalTeam?.ID ?? 0L) != 0L &&
                !_halalCache.ContainsKey(halalTeam.ID))
            {
                _halalCache[halalTeam.ID] = halalTeam;

                if (result.Teams == null)
                {
                    result.Teams = new List <HalalTeam>();
                }
                result.Teams.Add(halalTeam);
            }

            if ((premise?.ID ?? 0L) != 0L &&
                result.Premises?.FirstOrDefault(e => e.ID == premise.ID) == null)
            {
                if (result.Premises == null)
                {
                    result.Premises = new List <Premise>();
                }

                result.Premises.Add(premise);
            }

            if ((characteristic?.ID ?? 0L) != 0L &&
                !_characteristicsCache.ContainsKey(characteristic.ID))
            {
                _characteristicsCache[characteristic.ID] = characteristic;

                if (result.Characteristics == null)
                {
                    result.Characteristics = new List <Characteristic>();
                }
                result.Characteristics.Add(characteristic);
            }

            if ((attachment?.ID ?? 0L) != 0L &&
                !_attachmentCache.ContainsKey(attachment.ID))
            {
                _attachmentCache[attachment.ID] = attachment;

                if (result.Attachments == null)
                {
                    result.Attachments = new List <Attachment>();
                }
                result.Attachments.Add(attachment);
            }

            if ((rfa?.ID ?? 0L) != 0L &&
                !_rfaCache.ContainsKey(rfa.ID))
            {
                _rfaCache[rfa.ID] = rfa;

                if (result.RFAs == null)
                {
                    result.RFAs = new List <RFA>();
                }
                result.RFAs.Add(rfa);
            }

            if ((log?.ID ?? 0L) != 0L &&
                !_logCache.ContainsKey(log.ID))
            {
                _logCache[log.ID] = log;

                if (result.Logs == null)
                {
                    result.Logs = new List <Log>();
                }
                result.Logs.Add(log);
            }


            Review outReview = null;

            if ((review?.ID ?? 0L) != 0L &&
                !_reviewCache.TryGetValue(review.ID, out outReview))
            {
                if (result.Reviews == null)
                {
                    result.Reviews = new List <Review>();
                }
                result.Reviews.Add(review);

                _reviewCache[review.ID] = review;
                outReview = review;
            }

            if (outReview != null &&
                (reviewLineItem?.ID ?? 0L) != 0L &&
                !_reviewLineItemCache.ContainsKey(reviewLineItem.ID))
            {
                _reviewLineItemCache[reviewLineItem.ID] = reviewLineItem;

                if (outReview.LineItems == null)
                {
                    outReview.LineItems = new List <ReviewLineItem>();
                }
                outReview.LineItems.Add(reviewLineItem);
            }

            return(result);
        }
 public CharacterFighter(int id, byte teams, bool isAlive, int health, int healthMax, Cell cell, short pa, short pm, Characteristic stats, Dictionary <int, Spell> spells) : base(id, teams, isAlive, health, healthMax, cell, pa, pm)
 {
     Stats  = stats;
     Spells = spells;
 }
Beispiel #35
0
        private void ParseHealthXML(string xmlString)
        {
            HealthData xml      = new HealthData(xmlString);
            string     rootName = xml.RootName();

            switch (rootName)
            {
            case "quantity":
                List <QuantitySample> qSamples = xml.ParseQuantitySamples();
                if (this.receivedQuantitySamplesHandlers.ContainsKey(xml.datatype))
                {
                    this.receivedQuantitySamplesHandlers[xml.datatype](qSamples);
                    this.receivedQuantitySamplesHandlers[xml.datatype] = null;
                }
                break;

            case "category":
                List <CategorySample> catSamples = xml.ParseCategorySamples();
                if (this.receivedCategorySamplesHandlers.ContainsKey(xml.datatype))
                {
                    this.receivedCategorySamplesHandlers[xml.datatype](catSamples);
                    this.receivedCategorySamplesHandlers[xml.datatype] = null;
                }
                break;

            case "characteristic":
                Characteristic c = xml.ParseCharacteristic();
                if (this.receivedCharacteristicHandlers.ContainsKey(xml.datatype))
                {
                    this.receivedCharacteristicHandlers[xml.datatype](c);
                    this.receivedCharacteristicHandlers[xml.datatype] = null;
                }
                break;

            case "correlation":
                List <CorrelationSample> corSamples = xml.ParseCorrelationSamples();
                if (this.receivedCorrelationSamplesHandlers.ContainsKey(xml.datatype))
                {
                    this.receivedCorrelationSamplesHandlers[xml.datatype](corSamples);
                    this.receivedCorrelationSamplesHandlers[xml.datatype] = null;
                }
                break;

            case "workout":
                List <WorkoutSample> wSamples = xml.ParseWorkoutSamples();
                if (this.receivedWorkoutSamplesHandlers.ContainsKey(xml.workoutType))
                {
                    this.receivedWorkoutSamplesHandlers[xml.workoutType](wSamples);
                    this.receivedWorkoutSamplesHandlers[xml.workoutType] = null;
                }
                break;

            case "count":
                double count = xml.ParseTotal();
                if (this.receivedQuantityHandlers.ContainsKey(xml.datatype))
                {
                    this.receivedQuantityHandlers[xml.datatype](count);
                    this.receivedQuantityHandlers[xml.datatype] = null;
                }
                break;

            case "pedometer":
                List <PedometerData> qData = xml.ParsePedometerData();
                if (this.receivedPedometerDataHandler != null)
                {
                    this.receivedPedometerDataHandler(qData);
                    // this.receivedPedometerDataHandler = null;
                }
                break;

            case "write":
                if (this.wroteSampleHandlers.ContainsKey(xml.datatype))
                {
                    this.wroteSampleHandlers[xml.datatype](true, null);
                    this.wroteSampleHandlers[xml.datatype] = null;
                }
                break;

            default:
                Debug.LogError("error; unrecognized root node:" + rootName);
                break;
            }
        }
 public CharacteristicModel(Characteristic characteristic)
 {
     Uid  = characteristic.Uid;
     Name = characteristic.Name;
     NomenclaturesKind = characteristic.NomenclaturesKind;
 }
Beispiel #37
0
        private static void SetNewDevice(PhonesController phones_ctrl)
        {
            Console.WriteLine("Введите название смартфона: ");
            string smartName;

            while (true)
            {
                smartName = Console.ReadLine();
                if (string.IsNullOrEmpty(smartName))
                {
                    Console.WriteLine("Название не может быть пустым.");
                }
                else
                {
                    break;
                }
            }

            phones_ctrl.AddnSetCurrent(smartName);


            Console.WriteLine($"Введите модель {smartName}:");
            var modelName = Console.ReadLine();

            var model      = new Model(phones_ctrl.current_phone, modelName);
            var model_ctrl = new ModelsController(phones_ctrl.current_phone);

            model_ctrl.Add(model);

            if (!model_ctrl.newModel)
            {
                Console.WriteLine("Вы ввели существующую модель. Е - изменить характеристики моделя. Q - отменить действие.");

                while (true)
                {
                    var key = Console.ReadKey();
                    if (key.Key == ConsoleKey.E)
                    {
                        break;
                    }
                    else if (key.Key == ConsoleKey.Q)
                    {
                        return;
                    }
                    else
                    {
                        Console.WriteLine("Неправильный ввод.");
                    }
                }
            }
            Console.WriteLine("Введите параметры экрана [пример: 6.53\", 2340x1080 (19.5:9)]: ");
            var screen = Console.ReadLine();

            Console.WriteLine("Введите параметры камеры [пример: 4 модуля, fullHD 60 к/с, видео 4K]: ");
            var camera = Console.ReadLine();

            Console.WriteLine("Введите параметры памяти [пример: 64 ГБ, слот для карты microSD]: ");
            var memory = Console.ReadLine();

            Console.WriteLine("Введите параметры hardware [пример: 8 ядер(а), 2 ГГц, оперативка 6 ГБ]: ");
            var hardware = Console.ReadLine();

            Console.WriteLine("Введите параметры аккумулятора [пример: 4500 мАч]: ");
            var battery = Console.ReadLine();


            var characteristiscks    = new Characteristic(screen, camera, memory, hardware, battery);
            var characteristick_ctrl = new CharactersController(model.Name);

            characteristick_ctrl.Add(characteristiscks);
            Console.WriteLine("Новый смартфон добавлен. Нажмите Enter кнопку чтобы продолжить.");
            Console.ReadLine();
        }
        private async Task <Dictionary <string, Guid> > MapCharateristicsNamesAndCreateWhetherDoesNotExist(IEnumerable <string> characteristicsNames,
                                                                                                           string serviceDescription, Characteristic rootCharacteristic = null)
        {
            var characteristicMap = new Dictionary <string, Guid>();

            foreach (var characteristicName in characteristicsNames)
            {
                var characteristic = await _dbContext.CharacteristicContext.Entities
                                     .Include(c => c.CharacteristicAliases)
                                     .FirstOrDefaultAsync(c => c.Name.ToLower() == characteristicName.ToLower() ||
                                                          c.CharacteristicAliases.Any(a => a.Value.ToLower() == characteristicName.ToLower()));

                if (characteristic == null)
                {
                    if (rootCharacteristic == null)
                    {
                        rootCharacteristic = await _dbContext.CharacteristicContext.Entities.SingleAsync(o => o.Level == 0);
                    }
                    await _dbContext.ReloadEntityFromDb(rootCharacteristic);

                    var entity = new Characteristic
                    {
                        Name               = characteristicName,
                        Description        = serviceDescription,
                        OwnerId            = User.Identity.Name,
                        EntityType         = EntityType.File,
                        CharacteristicType = CharacteristicType.Number
                    };
                    characteristicMap[characteristicName] = await _dbContext.CharacteristicContext.CreateAsync(entity, rootCharacteristic.Id);
                }
                else
                {
                    characteristicMap[characteristicName] = characteristic.Id;
                }
            }
            return(characteristicMap);
        }
Beispiel #39
0
 public static extern ScanStatus PollCharacteristic(out Characteristic characteristic, bool block);
Beispiel #40
0
 /// <summary>
 /// Writes a given characteristic and its value to the connected remote device
 /// </summary>
 /// <param name="characteristic">The characteristic to write on the remote device</param>
 /// <returns>Returns <c>MLResult.Code.Ok</c> on success or an error on failure.</returns>
 public static MLResult WriteCharacteristic(Characteristic characteristic)
 {
     return(MLResult.Create(NativeBindings.WriteCharacteristic(characteristic)));
 }
Beispiel #41
0
        public static EstablishmmentById ToEstablishmmentById(this EstablishmmentModelData data)
        {
            var establishmment = EstablishmmentById.Create(
                data.Id.ToString(),
                data.Name,
                string.Join(", ", data.Address.Street, data.Address.Number, data.Address.State, data.Address.Coutry, data.Address.Zipcode),
                data.Email,
                data.Phone,
                data.TimeOpen,
                data.TimeClose);

            var desWifi = "";

            switch (data.Wifi)
            {
            case 0:
                desWifi = "não tem";
                break;

            case 1:
                desWifi = "fraco";
                break;

            case 2:
                desWifi = "médio";
                break;

            case 3:
                desWifi = "forte";
                break;

            default:
                desWifi = "";
                break;
            }

            var desNoise = "";

            switch (data.Noise)
            {
            case 0:
                desNoise = "não tem";
                break;

            case 1:
                desNoise = "pouco";
                break;

            case 2:
                desNoise = "médio";
                break;

            case 3:
                desNoise = "muito";
                break;

            default:
                desWifi = "";
                break;
            }

            var desPlug = "";

            switch (data.Plug)
            {
            case 0:
                desPlug = "não tem";
                break;

            case 1:
                desPlug = "pouco";
                break;

            case 2:
                desPlug = "alguns";
                break;

            case 3:
                desPlug = "vários";
                break;

            default:
                desWifi = "";
                break;
            }


            establishmment.SetCharacteristics(Characteristic.Create(data.Wifi, desWifi),
                                              Characteristic.Create(data.Noise, desNoise),
                                              Characteristic.Create(data.Plug, desPlug));
            data.Photos.ForEach(x => establishmment.AddPhoto(x.UrlPhoto));

            return(establishmment);
        }
Beispiel #42
0
 /// <summary>
 /// Enables or disables notifications/indications for a given characteristic
 /// </summary>
 /// <param name="characteristic">Characteristic to be notified of</param>
 /// <param name="enabled">Enabled state</param>
 /// <returns>Returns <c>MLResult.Code.Ok</c> on success or an error on failure.</returns>
 public static MLResult EnableCharacteristicNotification(Characteristic characteristic, bool enabled)
 {
     return(MLResult.Create(NativeBindings.EnableCharacteristicNotification(characteristic, enabled)));
 }
Beispiel #43
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Group;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (TypeElement != null)
                {
                    dest.TypeElement = (Code <Hl7.Fhir.Model.Group.GroupType>)TypeElement.DeepCopy();
                }
                if (ActualElement != null)
                {
                    dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopy();
                }
                if (Code != null)
                {
                    dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
                }
                if (NameElement != null)
                {
                    dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
                }
                if (QuantityElement != null)
                {
                    dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)QuantityElement.DeepCopy();
                }
                if (Characteristic != null)
                {
                    dest.Characteristic = new List <Hl7.Fhir.Model.Group.CharacteristicComponent>(Characteristic.DeepCopy());
                }
                if (Member != null)
                {
                    dest.Member = new List <Hl7.Fhir.Model.Group.MemberComponent>(Member.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Beispiel #44
0
 public CharacterViewModel(Characteristic stats, Account account)
 {
     Characteristics              = stats;
     _account                     = account;
     _account.AccountStateUpdate += HandleRefresh;
 }
        // ReSharper restore HeapView.DelegateAllocation

        private static string DontValidate(Job job, Characteristic characteristic) => null;
Beispiel #46
0
        /// <summary>
        /// (Decision-value,{1,2,3,4}),{(1,0.5),(2,0.667),(3,1)}
        /// </summary>
        //public Dictionary<KeyValuePair<string, List<int>>, Dictionary<int, float>> Probabilities { get; set; }
        //    = new Dictionary<KeyValuePair<string, List<int>>, Dictionary<int, float>>();

        //List<Probabilities> Probabilities { get; set; } = new List<Probabilities>();

        public static List <Probabilities <int> > ComputeConditionalProbability(Data data, Characteristic characteristic)
        {
            List <Probabilities <int> > conditionalProb = new List <Probabilities <int> >();

            foreach (var decision in data.Decisions)
            {
                Dictionary <int, float> tempProbs = new Dictionary <int, float>();
                foreach (var characteristicValues in characteristic.CharacteristicSets.Where(t => decision.Value.Contains(t.Key)))
                {
                    //if()
                    tempProbs.Add(characteristicValues.Key, FindProbability(characteristicValues.Value, decision.Value));
                }
                Probabilities <int> tempProbabilities = new Probabilities <int>
                {
                    Decision        = decision.Key,
                    DecisionSet     = decision.Value,
                    ConditionalProb = tempProbs
                };
                conditionalProb.Add(tempProbabilities);
            }

            return(conditionalProb);
        }
Beispiel #47
0
        internal CharacteristicReturn <Characteristic> Put(byte[] v, HapSession session, HomeKitServer server)
        {
            var json = Encoding.UTF8.GetString(v);

            _logger.LogTrace($"Read {json}");

            var characteristics   = JsonConvert.DeserializeObject <CharacteristicReturn <SentCharacteristic> >(json);
            var all               = server.GetAccessories();
            var retCharactersitcs = new List <Characteristic>();


            foreach (var sendCharacteristic in characteristics.Characteristics)
            {
                var accessoryId      = sendCharacteristic.AccessoryNumber;
                var characteristicId = sendCharacteristic.Id;

                var accessory = all.SingleOrDefault(a => a.Id == accessoryId);

                if (accessory == null)
                {
                    _logger.LogError($"Could not find accessory with id {accessoryId}");
                    continue;
                }

                Characteristic characteristic = null;
                foreach (var service in accessory.Services)
                {
                    var c = service.Characteristics.SingleOrDefault(a => a.Id == characteristicId);

                    if (c != null)
                    {
                        characteristic = c;
                        break;
                    }
                }

                if (characteristic == null)
                {
                    _logger.LogError($"Could not find characterstic with id {characteristicId}");
                    continue;
                }

                if (sendCharacteristic.EventBasedNotification.HasValue && sendCharacteristic.EventBasedNotification.Value)
                {
                    server.RegisterNotifications(characteristic, session);
                }
                else
                {
                    server.RegisterNotifications(characteristic, session);
                }

                if (sendCharacteristic.Value != null)
                {
                    characteristic.Value = sendCharacteristic.Value;

                    server.NotifyValueChanged(characteristic);
                }

                characteristic.AccessoryId = accessoryId;
                retCharactersitcs.Add(characteristic);
            }

            return(new CharacteristicReturn <Characteristic>
            {
                Characteristics = new List <Characteristic>()
            });
        }
Beispiel #48
0
 public StateNode(IDriverContext driverContext, Characteristic characteristic, HomeKitDriver driver) : base(driverContext, characteristic, driver)
 {
 }
 /// <summary>
 /// Reads the requested characteristic from the connected remote device
 /// </summary>
 /// <param name="characteristic">The characteristic to read from the remote device</param>
 /// <returns>Returns <c>MLResult.Code.Ok</c> on success or an error on failure.</returns>
 public static MLResult ReadCharacteristic(ref Characteristic characteristic)
 {
     return(MLResult.Create(NativeBindings.ReadCharacteristic(ref characteristic)));
 }
    public StatsCompiler(Vote[] votes)
    {
        //sanatize votes
        for(int i = 0;i<votes.Length;i++)
        {
            Vote v=null;
            if (votes[i] != null) v = votes[i];
            if (v == null || v.getPlayers() == null || v.getKilledVictims() == null || v.getSavedVictims() == null) //we got a bad vote
            {
                votes[i] = new Vote(new List<Victim>(), new List<Victim>(), -1, new PlayerClass[0]);
            }
        }
        //should be ok with abstains now....
		Debug.Log ("number of votes received by the StatsCompiler is "+votes.Where (x => x != null).Count());
        //Gender
        female = new Characteristic("female", "gender");
        male = new Characteristic("male", "gender");
        gender = new Characteristic[] { female, male };
        //Animal
        cat = new Characteristic("cat", "animal");
        dog = new Characteristic("dog", "animal");
        chupacabra = new  Characteristic("chupacabra", "animal");
        deer = new Characteristic("deer", "animal");
        spacecat = new Characteristic("space cat", "animal");
        animal = new Characteristic[] { cat, dog, chupacabra, deer, spacecat };
        //Race
        latinohispanic = new Characteristic ("latino/hispanic", "race");
        chinese = new Characteristic ("chinese", "race");
        filipino = new Characteristic("filipino", "race");
        indian = new Characteristic("indian", "race");
        vietnamese = new Characteristic("vietnamese", "race");
        korean = new Characteristic("korean", "race");
        japanese = new Characteristic("japanese" , "race");
        arab = new Characteristic("arab", "race");
        black = new Characteristic("black", "race");
        white = new Characteristic("white", "race");
        nativeamerican = new Characteristic("native american", "race");
        race = new Characteristic[] { latinohispanic, chinese, filipino, indian, vietnamese, korean, japanese, arab, black, white, nativeamerican };
        //Occupation
        author = new Characteristic("author", "occupation");
        actor = new  Characteristic("actor", "occupation");
        arsonist = new Characteristic("arsonist", "occupation");
        barista = new  Characteristic("barista", "occupation");
        commoncriminal = new Characteristic("common criminal", "occupation");
        crazycathoarder = new Characteristic("crazy cat-hoarder", "occupation");
        cattamer = new Characteristic("cat tamer", "occupation");
        doctor = new Characteristic("doctor", "occupation");
        dj = new Characteristic("DJ", "occupation");
        debtcollector = new  Characteristic("debt collector", "occupation");
        faithhealer = new Characteristic("faith healer", "occupation");
        fosterparent = new Characteristic("foster parent", "occupation");
        gardener = new Characteristic("gardener", "occupation");
        murder = new Characteristic("murderer", "occupation");
        miner = new Characteristic("miner", "occupation");
        musician = new Characteristic("musician", "occupation");
        refugee = new Characteristic("refugee", "occupation");
        roofer = new Characteristic("roofer", "occupation");
        plumber = new Characteristic("plumber", "occupation");
        pediatrician = new Characteristic("pediatrician", "occupation");
        politician = new Characteristic("politician", "occupation");
        pedophile = new Characteristic("pedophile", "occupation");
        professor = new Characteristic("professor", "occupation");
        policeofficer = new Characteristic("police officer", "occupation");
        playboybunny = new Characteristic("playboy bunny", "occupation");
        pimp = new Characteristic("pimp", "occupation");
        prostitute = new Characteristic("prostitute", "occupation");
        scientist = new Characteristic("scientist", "occupation");
        stuntman = new Characteristic("stuntman", "occupation");
        salesperson = new Characteristic("salesperson", "occupation");
        stalker = new Characteristic("stalker", "occupation");
        teacher = new Characteristic("teacher", "occupation");
        trolleydriver = new Characteristic("trolley driver", "occupation");
        tailor = new Characteristic("tailor", "occupation");
        taxevader = new Characteristic("taxevader", "occupation");
        preciousbaby = new Characteristic("precious baby", "occupation");
        child = new Characteristic("child", "occupation");
        angstyteenager = new Characteristic("angsty teenager", "occupation");
        occupation = new Characteristic[] {author, actor, arsonist, barista, commoncriminal, crazycathoarder, cattamer, doctor, dj, debtcollector, faithhealer,
            fosterparent, gardener, murder, miner, musician, refugee, roofer, plumber, pediatrician, politician, pedophile, professor, policeofficer,playboybunny,
            pimp, prostitute, scientist, stuntman, stalker, teacher, trolleydriver, tailor, taxevader, preciousbaby, child, angstyteenager  };
        //Age
        zero = new Characteristic("0-9", "age");
        ten = new Characteristic("10-19", "age");
        twenty = new Characteristic("20-29", "age");
        thirty = new Characteristic("30-39", "age");
        fourty = new Characteristic("40-49", "age");
        fifty = new Characteristic("50-59", "age");
        sixty = new Characteristic("60-69", "age");
        seventy = new Characteristic("70-79", "age");
        eighty = new Characteristic("80-89", "age");
        ninety = new Characteristic("90-100", "age");
        age = new Characteristic[] { zero, ten, twenty, thirty, fourty, fifty, sixty, seventy, eighty, ninety };
        //Affiliation 
        PETA = new Characteristic("PETA", "affiliation");
        AARP = new Characteristic("AARP", "affiliation");
        NAACP = new Characteristic("NAACP", "affiliation");
        ALG = new Characteristic("ALG", "affiliation");
        CI = new Characteristic("CI", "affiliation");
        EA = new Characteristic("EA", "affiliation");
        NAS = new Characteristic("NAS", "affiliation");
        FRAC = new Characteristic("FRAC", "affiliation");
        NAMBLA = new Characteristic("NAMBLA", "affiliation");
        affiliation = new Characteristic[] { PETA, AARP, NAACP, ALG, CI, EA, NAS, FRAC, NAMBLA };
        update = new List<Characteristic>();
        for (int i = 0; i < votes.Length; i++)
        {
        if (votes[i]!=null&&votes[i].getKilledVictims() != null && votes[i].getSavedVictims() != null) { 
            killedVictims = votes[i].getKilledVictims().ToArray();
            savedVictims = votes[i].getSavedVictims().ToArray();
            //Since killedVictims and savedVictims are the same size
            //will go through them simultanously to save time
            for (int j = 0; j < killedVictims.Length; j++)
            {
                //Gender
                for (int k = 0; k < gender.Length; k++)
                {
                    if (killedVictims[j].getGender() == gender[k].getType())
                    {
                        gender[k].setKilled();
                    }
                    if (savedVictims[k].getGender() == gender[k].getType())
                    {
                        gender[k].setSaved();
                    }
                }

                //Age
                if (savedVictims[j].getIntAge() < 10)
                {
                    zero.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 20)
                {
                    ten.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 30)
                {
                    twenty.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 40)
                {
                    thirty.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 50)
                {
                    fourty.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 60)
                {
                    fifty.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 70)
                {
                    sixty.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 80)
                {
                    seventy.setSaved();
                }
                else if (savedVictims[j].getIntAge() < 90)
                {
                    eighty.setSaved();
                }
                else
                {
                    ninety.setSaved();
                }
                if (killedVictims[j].getIntAge() < 10)
                {
                    zero.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 20)
                {
                    ten.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 30)
                {
                    twenty.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 40)
                {
                    thirty.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 50)
                {
                    fourty.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 60)
                {
                    fifty.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 70)
                {
                    sixty.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 80)
                {
                    seventy.setKilled();
                }
                else if (killedVictims[j].getIntAge() < 90)
                {
                    eighty.setKilled();
                }
                else
                {
                    ninety.setKilled();
                }

                //Killed Animal
                if (!killedVictims[j].isPerson())
                {
                    for (int k = 0; k < animal.Length; k++)
                    {
                        if (killedVictims[j].getSpecies() == animal[k].getType())
                        {
                            animal[k].setKilled();
                        }
                    }
                }
                else
                {
                    //Killed Race
                    for (int k = 0; k < race.Length; k++)
                    {
                        if (killedVictims[j].getRace() == race[k].getType())
                        {
                            race[k].setKilled();
                        }
                    }
                    //Killed Occupation
                    for (int k = 0; k < occupation.Length; k++)
                    {
                        if (killedVictims[j].getOccupation() == occupation[k].getType())
                        {
                            occupation[k].setKilled();
                        }
                    }
                }

                //Saved Animal
                if (!savedVictims[j].isPerson())
                {
                    for (int k = 0; k < animal.Length; k++)
                    {
                        if (savedVictims[j].getSpecies() == animal[k].getType())
                        {
                            animal[k].setSaved();
                        }
                    }
                }
                else
                {
                    //Saved Race
                    for (int k = 0; k < race.Length; k++)
                    {
                        if (savedVictims[j].getRace() == race[k].getType())
                        {
                            race[k].setSaved();
                        }
                    }
                    //Saved Occupation 
                    for (int k = 0; k < occupation.Length; k++)
                    {
                        if (savedVictims[j].getOccupation() == occupation[k].getType())
                        {
                            occupation[k].setSaved();
                        }
                    }
                }
            }
        }
        }
        for (int i =0; i<votes[0].getPlayers().Length; i++)
        {
			Debug.Log ("outer loop: "+i+" "+votes[0].ToString()+" "+votes[0].getPlayers().ToString()+" "+votes[0].getPlayers().Length);
            for (int j =0; j < affiliation.Length; j++)
			{
				Debug.Log ("inner loop: "+j+" "+affiliation[j].getType()+" "+votes[0].getPlayers()[i].ToString()+" "+votes[0].getPlayers()[i].getAffiliation());
                if(votes[0].getPlayers()[i].getAffiliation() == affiliation[j].getType())
                {
                    for (int k =0; k < votes[0].getPlayers()[i].getVotesForAffiliation().Length; k++)
                    {
                        if (votes[0].getPlayers()[i].getVotesForAffiliation()[k] == 0)
                        {
                            affiliation[j].setSaved();
                        }
                        else
                        {
                            affiliation[j].setKilled();
                        }
                    }
                }
            }
        }
        for(int i =0; i < age.Length; i++)
        {
            if (age[i].getChanged())
            {
                update.Add(age[i]);
            }
        }
        for (int i = 0; i < animal.Length; i++)
        {
            if (animal[i].getChanged())
            {
                update.Add(animal[i]);
            }
        }
        for (int i = 0; i < gender.Length; i++)
        {
            if (gender[i].getChanged())
            {
                update.Add(gender[i]);
            }
        }
        for (int i = 0; i < occupation.Length; i++)
        {
            if (occupation[i].getChanged())
            {
                update.Add(occupation[i]);
            }
        }
        for (int i = 0; i < affiliation.Length; i++)
        {
            if (affiliation[i].getChanged())
            {
                update.Add(affiliation[i]);
            }
        }
        for (int i = 0; i < race.Length; i++)
        {
            if (race[i].getChanged())
            {
                update.Add(race[i]);
            }
        }
    }