public int CompareTo(Fuzzy other) { var result = this < other ? -1 : this > other ? 1 : 0; return(result); }
public static Fuzzy operator *(Fuzzy left, Fuzzy right) { var res = new Fuzzy(Math.Min(Math.Max(left.Value * right.Value, 0.0), 1.0)); return(res); }
public static Func <TParameter, Fuzzy> Mult <TParameter>(this Func <TParameter, Fuzzy> first, Fuzzy second) => ctx => first(ctx) * second;
public bool Equals(Fuzzy other) { return(Math.Abs(Value - other.Value) < Epsilon); }
public static Func <TParameter, Fuzzy> Xor <TParameter>(this Func <TParameter, Fuzzy> first, Fuzzy second) => ctx => first(ctx) ^ second;
public static Fuzzy Mult(this Fuzzy first, Fuzzy second) => first * second;
public static Fuzzy Xor(this Fuzzy first, Fuzzy second) => first ^ second;
public static Func <TParameter, Fuzzy> Xor <TParameter>(this Fuzzy first, Func <TParameter, Fuzzy> second) => ctx => first ^ second(ctx);
public static Func <TParameter, Fuzzy> And <TParameter>(this Func <TParameter, Fuzzy> first, Func <TParameter, bool> second) => ctx => first(ctx) & Fuzzy.Create(second(ctx));
public static Fuzzy Or(this Fuzzy first, Fuzzy second) => first | second;
public static Fuzzy And(this Fuzzy first, Fuzzy second) => first & second;
public static Func <TParameter, Fuzzy> Not <TParameter>(Func <TParameter, bool> func) => ctx => Fuzzy.Create(!func(ctx));
public static Fuzzy Not(this Fuzzy value) => !value;
public static Func <TParameter, Fuzzy> Is <TParameter>(Func <TParameter, bool> f) => ctx => Fuzzy.Create(f(ctx));
public static Func <TParameter, Fuzzy> Is <TParameter>(Fuzzy val) => ctx => val;