/** * Regular constructor. The domain is cloned or instanciated if null. * The domain iterator is assigned to the index of value in Domain, * or to -42 if the Domain has not been initialized. * @see Domain.IsInitialized() */ public Variable(string name, string fullName, Domain domain, int value) { Name = name; FullName = fullName; Domain = domain == null ? new Domain() : (Domain)domain.Clone(); // if value is not in domain, domain.IndexOf( value ) returns -1 IndexDomain = Domain.IsInitialized() ? Domain.IndexOf(value) : -42; }
/** * Set the current value. */ public void SetValue(int value) { IndexDomain = Domain.IndexOf(value); }