public void AddChild(FmlNode l) { if (l == null) { return; } if (ChildList.Count > ChildCount) { for (int i = 0, imax = ChildList.Count; i < imax; ++i) { if (ChildList[i] == null) { ChildList[i] = l; break; } } } else { ChildList.Add(l); } l.AddBranch(this); ++ChildCount; SetDirty(); }
public FmlRound(BaseValueType t, FmlNode v, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero) : base(t, 1) { Value = v; Digit = digit; Mode = mode; }
// difference = minuend - subtrahend public FmlRand(BaseValueType t, int seed, FmlNode minValue, FmlNode maxValue, bool manualRand = false) : base(t, 2) { _rand = new Random(seed); Seed = seed; MinValue = minValue; MaxValue = maxValue; ManualRand = manualRand; }
public sealed override bool FindInDescendant(FmlNode l) { for (int i = 0, imax = ChildList.Count; i < imax; ++i) { if (ChildList[i] == null) { continue; } if (ChildList[i] == l) { return(true); } if (ChildList[i].FindInDescendant(l)) { return(true); } } return(false); }
public int ReplaceAllChild(FmlNode from, FmlNode to) { if (from == to) { return(0); } int count = 0; for (int i = 0, imax = ChildList.Count; i < imax; ++i) { if (ChildList[i] == from) { ChildList[i] = to; ++count; } } if (count > 0) { if (from == null) { to.AddBranch(this, count); ChildCount += count; } else if (to == null) { from.RemoveBranch(this, count); ChildCount -= count; RemoveNullTail(); } else { to.AddBranch(this, count); from.RemoveBranch(this, count); } SetDirty(); } return(count); }
public bool ReplaceChild(FmlNode from, FmlNode to) { if (from == to) { return(false); } for (int i = 0, imax = ChildList.Count; i < imax; ++i) { if (ChildList[i] == from) { ChildList[i] = to; if (from == null) { to.AddBranch(this); ++ChildCount; } else if (to == null) { from.RemoveBranch(this); --ChildCount; RemoveNullTail(); } else { to.AddBranch(this); from.RemoveBranch(this); } SetDirty(); return(true); } } return(false); }
public static FmlMod Mod(FmlNode dividend, FmlNode divisor) { return(Mod(GetProperTypeByParams(dividend, divisor), dividend, divisor)); }
public static FmlToInt32 ToInt32(FmlNode arg) { return(new FmlToInt32(arg)); }
public FmlAbs(BaseValueType t, FmlNode v) : base(t, 1) { Value = v; }
public static FmlRand Rand(BaseValueType t, int seed, FmlNode minValue, FmlNode maxValue, bool manualRand = false) { return(new FmlRand(t, seed, minValue, maxValue, manualRand)); }
public virtual bool FindInDescendant(FmlNode l) { return(false); }
public static FmlRound Round(BaseValueType t, FmlNode arg, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero) { return(new FmlRound(t, arg, digit, mode)); }
public static FmlRand Rand(int seed, FmlNode minValue, FmlNode maxValue, bool manualRand = false) { return(Rand(GetProperTypeByParams(minValue, maxValue), seed, minValue, maxValue, manualRand)); }
// equivalent to ReplaceAllChild(l, null) public int RemoveAllChild(FmlNode l) { return(ReplaceAllChild(l, null)); }
public static FmlToInt64 ToInt64(FmlNode arg) { return(new FmlToInt64(arg)); }
public static FmlLog Log(BaseValueType t, FmlNode value, FmlNode newBase) { return(new FmlLog(t, value, newBase)); }
// difference = minuend - subtrahend public FmlPow(BaseValueType t, FmlNode x, FmlNode y) : base(t, 2) { X = x; Y = y; }
public static FmlLog Log(FmlNode value, FmlNode newBase) { return(Log(BaseValueType.Double, value, newBase)); }
public static FmlDiv Div(FmlNode dividend, FmlNode divisor) { return(Div(GetProperTypeByParams(dividend, divisor), dividend, divisor)); }
public static FmlSub Sub(BaseValueType t, FmlNode minuend, FmlNode subtrahend) { return(new FmlSub(t, minuend, subtrahend)); }
public static FmlSub Sub(FmlNode minuend, FmlNode subtrahend) { return(Sub(GetProperTypeByParams(minuend, subtrahend), minuend, subtrahend)); }
public static FmlToDouble ToDouble(FmlNode arg) { return(new FmlToDouble(arg)); }
// equivalent to ReplaceChild(l, null) public bool RemoveChild(FmlNode l) { return(ReplaceChild(l, null)); }
public static FmlMod Mod(BaseValueType t, FmlNode dividend, FmlNode divisor) { return(new FmlMod(t, dividend, divisor)); }
public FmlFloor(BaseValueType t, FmlNode v) : base(t, 1) { Value = v; }
public static FmlSqrt Sqrt(BaseValueType t, FmlNode arg) { return(new FmlSqrt(t, arg)); }
public static FmlPow Pow(FmlNode x, FmlNode y) { return(Pow(BaseValueType.Double, x, y)); }
public static FmlRound Round(FmlNode arg, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero) { return(Round(arg.BaseType, arg, digit, mode)); }
public FmlLog10(BaseValueType t, FmlNode v) : base(t, 1) { Value = v; }
public static FmlPow Pow(BaseValueType t, FmlNode x, FmlNode y) { return(new FmlPow(t, x, y)); }