namespace Einstein.MSBRE { using System; /// /// Attribute-Value-House triplet. Used as an internal fact type for /// candidate decisions. /// public class AVH { /// /// Attribute-Value pair. /// private AV attributeValue; /// /// House position. /// public int House; /// /// Constructor. /// /// Attribute-Value pair. /// House position. public AVH(AV attrValue, int house) { attributeValue = attrValue; House = house; } /// /// Helper method that returns the attribute value. Although not strictly /// necessary for this puzzle, the attribute name is passed in and tested, /// and an empty string is passed back if the attribute name does not /// match the attribute nae of the pair. This would prevent incorrect /// selection of this fact in situations where two distinct AV pairs have /// the same string value (NB, this situation does not arise in the /// Einstein puzzle). /// /// Name of attribute. /// Vaue of attribute. public string ValueOf(string attrName) { if (attrName == attributeValue.Attribute) return attributeValue.Value; return String.Empty; } /// /// Attribute name. /// public string Attribute { get { return attributeValue.Attribute; } } /// /// Attribute value. /// public string Value { get { return attributeValue.Value; } } } }