public override bool Equals(object obj) { if (obj is Unit) { return(OperationUtility.Equals(this, (obj as Unit))); } return(false); }
public override bool Equals(object obj) { if (obj is Dimension) { return(OperationUtility.Equals(this, obj as Dimension)); } return(false); }
public static Dimension operator /(Dimension dividend, Dimension divisor) { if (divisor == Dimension.None) { return(dividend); } return(OperationUtility.RearrangeDivision((x, y) => x * y, (x, y) => x / y, dividend, divisor) ?? OperationUtility.ReduceDivision(x => x.Multiply((a, b) => a * b, Dimension.None), (x, y) => x / y, (x, y) => x ^ y, dividend, divisor) ?? Div(dividend, divisor)); }
public static Unit operator /(Unit dividend, Unit divisor) { if (divisor == None) { return(dividend); } return(OperationUtility.RearrangeDivision((x, y) => x * y, (x, y) => x / y, dividend, divisor) ?? OperationUtility.ReduceDivision(x => x.Multiply((a, b) => a * b, None), (x, y) => x / y, (x, y) => x ^ y, dividend, divisor) ?? Divide(dividend, divisor)); }
public static Dimension operator *(Dimension d1, Dimension d2) { if (d1 == Dimension.None) // and if d2 == None, return d2 (=None) { return(d2); } if (d2 == Dimension.None) { return(d1); } // where to put OperationUtility.ReduceMultiplication return(OperationUtility.RearrangeMultiplication(x => x.Multiply((a, b) => a * b, Dimension.None), (x, y) => x / y, d1, d2) ?? OperationUtility.ReduceMultiplication(x => x.Multiply((a, b) => a * b, Dimension.None), (x, y) => x ^ y, d1, d2) ?? Mult(d1, d2)); }
public static Unit operator *(Unit u1, Unit u2) { if (u1 == None) // and if u2 == None, return u2 (=None) { return(u2); } if (u2 == None) { return(u1); } // where to put OperationUtility.ReduceMultiplication return(OperationUtility.RearrangeMultiplication(x => x.Multiply((a, b) => a * b, None), (x, y) => x / y, u1, u2) ?? OperationUtility.ReduceMultiplication(x => x.Multiply((a, b) => a * b, None), (x, y) => x ^ y, u1, u2) ?? Multiply(u1, u2)); }
public static Dimension operator ^(Dimension @base, int exponent) { if (exponent < 0) { return(1 / (@base ^ (-exponent))); } if (exponent == 0) { return(Dimension.None); } if (exponent == 1) { return(@base); } return(OperationUtility.ExpandPower(x => x.Multiply((a, b) => a * b, Dimension.None), (x, y) => x / y, (x, y) => x ^ y, @base, exponent) ?? Pow(@base, exponent)); }
public override bool Equals(object obj) => OperationUtility.Equals(this, obj as IDivisionOperation);
public static Dimension operator /(int dividend, Dimension divisor) { return(OperationUtility.RearrangeDivision((x, y) => x * y, (x, y) => x / y, Dimension.None, divisor) ?? Div(Dimension.None, divisor)); }
public override bool Equals(object obj) => OperationUtility.Equals(this, obj as IProductOperation);
public ProductUnit(Unit[] operands) { _operands = new ReadOnlyCollection<Unit>(OperationUtility.LinearizeMultiplication(operands).ToList()); }
public static Unit operator /(int dividend, Unit divisor) { return(OperationUtility.RearrangeDivision((x, y) => x * y, (x, y) => x / y, None, divisor) ?? Divide(None, divisor)); }
internal ProductDimension(params Dimension[] operands) { _operands = new ReadOnlyCollection <Dimension>(OperationUtility.LinearizeMultiplication(operands).ToList()); }