public Variadic deepCopy() { Variadic result; result = new Variadic(type); result.valueInt = valueInt; result.valueVector2Float = valueVector2Float; result.valueFloat = valueFloat; result.valueBool = valueBool; if( type == EnumType.ARRAY ) { result.valueArray = new List<Variadic>(); foreach( Variadic iterationValue in valueArray ) { result.valueArray.Add(iterationValue.deepCopy()); } } if( valueTree != null ) { result.valueTree = valueTree.deepCopy(); } return result; }
public Variadic deepCopy() { Variadic result; result = new Variadic(type); result.valueInt = valueInt; result.valueVector2Float = valueVector2Float; result.valueFloat = valueFloat; result.valueBool = valueBool; if (type == EnumType.ARRAY) { result.valueArray = new List <Variadic>(); foreach (Variadic iterationValue in valueArray) { result.valueArray.Add(iterationValue.deepCopy()); } } if (valueTree != null) { result.valueTree = valueTree.deepCopy(); } return(result); }
public static bool isEqual(Variadic a, Variadic b, double epsilon) { System.Diagnostics.Debug.Assert(a.type == b.type); switch( a.type ) { case EnumType.BOOL: return a.valueBool == b.valueBool; case EnumType.FLOAT: return System.Math.Abs(a.valueFloat - b.valueFloat) < epsilon; case EnumType.INT: return a.valueInt == b.valueInt; default: throw new Exception("isEqual is not applicable to lists, vectors, etc."); } }
public static bool isEqual(Variadic a, Variadic b, double epsilon) { System.Diagnostics.Debug.Assert(a.type == b.type); switch (a.type) { case EnumType.BOOL: return(a.valueBool == b.valueBool); case EnumType.FLOAT: return(System.Math.Abs(a.valueFloat - b.valueFloat) < epsilon); case EnumType.INT: return(a.valueInt == b.valueInt); default: throw new Exception("isEqual is not applicable to lists, vectors, etc."); } }