public static FmlArg Arg(BaseValueType t, float v) { FmlArg arg = new FmlArg(t); arg.SetSingle(v); return(arg); }
public static FmlArg Arg(BaseValueType t, long v) { FmlArg arg = new FmlArg(t); arg.SetInt64(v); return(arg); }
public static FmlArg Arg(BaseValueType t, double v) { FmlArg arg = new FmlArg(t); arg.SetDouble(v); return(arg); }
public static FmlArg Arg(BaseValueType t, int v) { FmlArg arg = new FmlArg(t); arg.SetInt32(v); return(arg); }
public UnionValue(BaseValueType type, double v) { Int32 = 0; Int64 = 0; Single = 0f; Double = 0.0; switch (type) { case BaseValueType.Double: Double = (double)v; break; case BaseValueType.Single: Single = (float)v; break; case BaseValueType.Int64: Int64 = (long)v; break; case BaseValueType.Int32: default: Int32 = (int)v; break; } }
public FmlRound(BaseValueType t, FmlNode v, int digit = 0, MidpointRounding mode = MidpointRounding.AwayFromZero) : base(t, 1) { Value = v; Digit = digit; Mode = mode; }
public static FmlMin Min(BaseValueType t, params FmlNode[] args) { FmlMin op = new FmlMin(t); AddChildrenToVariableBranch(op, args); return(op); }
// 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; }
// arity 必須大於 0 protected FmlArityOp(BaseValueType t, int arity) : base(t, arity) { // initial _childList for (int i = 0, imax = arity; i < imax; ++i) { ChildList.Add(null); } ChildCount = arity; }
public float GetSingle(BaseValueType type) { switch (type) { case BaseValueType.Double: return((float)Double); case BaseValueType.Single: return((float)Single); case BaseValueType.Int64: return((float)Int64); case BaseValueType.Int32: default: return((float)Int32); } }
public int GetInt32(BaseValueType type) { switch (type) { case BaseValueType.Double: return((int)Double); case BaseValueType.Single: return((int)Single); case BaseValueType.Int64: return((int)Int64); case BaseValueType.Int32: default: return((int)Int32); } }
public long GetInt64(BaseValueType type) { switch (type) { case BaseValueType.Double: return((long)Double); case BaseValueType.Single: return((long)Single); case BaseValueType.Int64: return((long)Int64); case BaseValueType.Int32: default: return((long)Int32); } }
public double GetDouble(BaseValueType type) { switch (type) { case BaseValueType.Double: return((double)Double); case BaseValueType.Single: return((double)Single); case BaseValueType.Int64: return((double)Int64); case BaseValueType.Int32: default: return((double)Int32); } }
public FmlPow(BaseValueType t) : this(t, null, null) { }
public FmlFloor(BaseValueType t, FmlNode v) : base(t, 1) { Value = v; }
public FmlFloor(BaseValueType t) : this(t, null) { }
// quotient = dividend - divisor public FmlDiv(BaseValueType t, FmlNode dividend, FmlNode divisor) : base(t, 2) { Dividend = dividend; Divisor = divisor; }
public FmlDiv(BaseValueType t) : this(t, null, null) { }
protected FmlVariableOp(BaseValueType t) : base(t, 20) { }
public FmlMod(BaseValueType t) : this(t, null, null) { }
public FmlSqrt(BaseValueType t) : this(t, null) { }
public FmlLog10(BaseValueType t) : this(t, null) { }
public FmlAbs(BaseValueType t, FmlNode v) : base(t, 1) { Value = v; }
public FmlAbs(BaseValueType t) : this(t, null) { }
// difference = minuend - subtrahend public FmlSub(BaseValueType t, FmlNode minuend, FmlNode subtrahend) : base(t, 2) { Minuend = minuend; Subtrahend = subtrahend; }
public FmlSub(BaseValueType t) : this(t, null, null) { }
public FmlAdd(BaseValueType t) : base(t) { }
// difference = minuend - subtrahend public FmlPow(BaseValueType t, FmlNode x, FmlNode y) : base(t, 2) { X = x; Y = y; }
public FmlLog10(BaseValueType t, FmlNode v) : base(t, 1) { Value = v; }
protected FmlOp(BaseValueType t, int childListCap) : base(t) { ChildList = new List <FmlNode>(childListCap); ChildCount = 0; }