Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 public FmlRound(BaseValueType t, FmlNode v, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero)
     : base(t, 1)
 {
     Value = v;
     Digit = digit;
     Mode  = mode;
 }
Esempio n. 3
0
 // 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;
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 public static FmlMod Mod(FmlNode dividend, FmlNode divisor)
 {
     return(Mod(GetProperTypeByParams(dividend, divisor), dividend, divisor));
 }
Esempio n. 8
0
 public static FmlToInt32 ToInt32(FmlNode arg)
 {
     return(new FmlToInt32(arg));
 }
Esempio n. 9
0
 public FmlAbs(BaseValueType t, FmlNode v)
     : base(t, 1)
 {
     Value = v;
 }
Esempio n. 10
0
 public static FmlRand Rand(BaseValueType t, int seed, FmlNode minValue, FmlNode maxValue, bool manualRand = false)
 {
     return(new FmlRand(t, seed, minValue, maxValue, manualRand));
 }
Esempio n. 11
0
 public virtual bool FindInDescendant(FmlNode l)
 {
     return(false);
 }
Esempio n. 12
0
 public static FmlRound Round(BaseValueType t, FmlNode arg, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero)
 {
     return(new FmlRound(t, arg, digit, mode));
 }
Esempio n. 13
0
 public static FmlRand Rand(int seed, FmlNode minValue, FmlNode maxValue, bool manualRand = false)
 {
     return(Rand(GetProperTypeByParams(minValue, maxValue), seed, minValue, maxValue, manualRand));
 }
Esempio n. 14
0
 // equivalent to ReplaceAllChild(l, null)
 public int RemoveAllChild(FmlNode l)
 {
     return(ReplaceAllChild(l, null));
 }
Esempio n. 15
0
 public static FmlToInt64 ToInt64(FmlNode arg)
 {
     return(new FmlToInt64(arg));
 }
Esempio n. 16
0
 public static FmlLog Log(BaseValueType t, FmlNode value, FmlNode newBase)
 {
     return(new FmlLog(t, value, newBase));
 }
Esempio n. 17
0
 // difference = minuend - subtrahend
 public FmlPow(BaseValueType t, FmlNode x, FmlNode y)
     : base(t, 2)
 {
     X = x;
     Y = y;
 }
Esempio n. 18
0
 public static FmlLog Log(FmlNode value, FmlNode newBase)
 {
     return(Log(BaseValueType.Double, value, newBase));
 }
Esempio n. 19
0
 public static FmlDiv Div(FmlNode dividend, FmlNode divisor)
 {
     return(Div(GetProperTypeByParams(dividend, divisor), dividend, divisor));
 }
Esempio n. 20
0
 public static FmlSub Sub(BaseValueType t, FmlNode minuend, FmlNode subtrahend)
 {
     return(new FmlSub(t, minuend, subtrahend));
 }
Esempio n. 21
0
 public static FmlSub Sub(FmlNode minuend, FmlNode subtrahend)
 {
     return(Sub(GetProperTypeByParams(minuend, subtrahend), minuend, subtrahend));
 }
Esempio n. 22
0
 public static FmlToDouble ToDouble(FmlNode arg)
 {
     return(new FmlToDouble(arg));
 }
Esempio n. 23
0
 // equivalent to ReplaceChild(l, null)
 public bool RemoveChild(FmlNode l)
 {
     return(ReplaceChild(l, null));
 }
Esempio n. 24
0
 public static FmlMod Mod(BaseValueType t, FmlNode dividend, FmlNode divisor)
 {
     return(new FmlMod(t, dividend, divisor));
 }
Esempio n. 25
0
 public FmlFloor(BaseValueType t, FmlNode v)
     : base(t, 1)
 {
     Value = v;
 }
Esempio n. 26
0
 public static FmlSqrt Sqrt(BaseValueType t, FmlNode arg)
 {
     return(new FmlSqrt(t, arg));
 }
Esempio n. 27
0
 public static FmlPow Pow(FmlNode x, FmlNode y)
 {
     return(Pow(BaseValueType.Double, x, y));
 }
Esempio n. 28
0
 public static FmlRound Round(FmlNode arg, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero)
 {
     return(Round(arg.BaseType, arg, digit, mode));
 }
Esempio n. 29
0
 public FmlLog10(BaseValueType t, FmlNode v)
     : base(t, 1)
 {
     Value = v;
 }
Esempio n. 30
0
 public static FmlPow Pow(BaseValueType t, FmlNode x, FmlNode y)
 {
     return(new FmlPow(t, x, y));
 }