Esempio n. 1
0
        //Creates a collection of attributes that contain only Credibility
        public static Attribs AttributesWithCredibility(int credibilityValue)
        {
            Attribs at = new Attribs();

            at[Attribs.Credibility] = credibilityValue;
            return(at);
        }
Esempio n. 2
0
        //Sums the distances of attributes that are present in the 'comparedAttributes' collection
        //If one of the dictionaries does not contain the given attribute, no penalty is added (distance is 0).
        public static int Distance(Attribs coll1, Attribs coll2, List <Attrib> comparedAttributes)
        {
            int distance = 0;

            foreach (var attribute in comparedAttributes)
            {
                if (coll1.Values.ContainsKey(attribute) && coll2.Values.ContainsKey(attribute))
                {
                    distance += Math.Abs(coll1.Values[attribute] - coll2.Values[attribute]);
                }
            }
            return(distance);
        }
Esempio n. 3
0
 public static int AttribsDifference(Attribs a, Attribs b, Attrib attributeName)
 {
     return(a.Values[attributeName] - b.Values[attributeName]);
 }
Esempio n. 4
0
        public void SetValue(Attrib attrib, int value)
        {
            Attribs states = AllStates[attrib.Category];

            states[attrib] = value;
        }
Esempio n. 5
0
        public int GetValue(Attrib attrib)
        {
            Attribs states = AllStates[attrib.Category];

            return(states[attrib]);
        }