private void PumpkinCheck() { if (_hasCloves && _hasNutmeg && _hasCinnamon) { _value = NullaBoolValue.PumpkinSpice; } }
/// <summary> /// Assign a boring bool value to NullaBool, whatever you want. /// </summary> /// <param name="assignment"></param> public void Assign(bool assignment) { if (HasPumpkinSpice) { throw new NullaBoolException(this); } _value = assignment ? NullaBoolValue.True : NullaBoolValue.False; }
/// <summary> /// You think nullable bool makes this class obsolete? Well, you may be right. But maybe not. /// </summary> /// <param name="set">a nullable bool which is okay I guess</param> public NullaBool(bool?set) { if (!set.HasValue) { _value = NullaBoolValue.Null; } else if (set.Value) { _value = NullaBoolValue.True; } else { _value = NullaBoolValue.False; } }
/// <summary> /// See if you can make your NullaBool null /// </summary> public void MakeNull() { if (HasPumpkinSpice) { throw new NullaBoolException(this); } if (IsNull || IsSuperNull) { _value = NullaBoolValue.SuperNull; } else { _value = NullaBoolValue.Null; } }
/// <summary> /// A slightly more interesting constructor, accepts a plain vanilla bool /// </summary> /// <param name="set">the boolness</param> public NullaBool(bool set) { _value = set ? NullaBoolValue.True : NullaBoolValue.False; }
/// <summary> /// The boring, default constructor /// </summary> public NullaBool() { _value = NullaBoolValue.Null; }