/// <summary> /// Squares the root if the value being square rooted is equal to zero. /// If the value is equal to zero. Process the operation and call the /// equals method to keep performing operations. /// </summary> /// <param name="passedVar">The passed variable.</param> public void SquareRoot(double passedVar) { if (CurrentValue.CompareTo(passedVar) == 0) { CurrentValue = Math.Sqrt(CurrentValue); } else { Operand2 = Math.Sqrt(passedVar); Equals(); } }
/// <summary> /// Converts the CurrentValue to a negative number if the number is /// equal to zero. If the number is equal to zero make it (number 0) equal /// to the second operand and call the Equals method to keep performing operations. /// </summary> /// <param name="passedVar">The passed variable.</param> public void ToNegativeNumber(double passedVar) { if (CurrentValue.CompareTo(passedVar) == 0) { CurrentValue = CurrentValue * -1; } else { Operand2 = passedVar * -1; Equals(); } }
/// <summary> /// Converts the CurrentValue to its reciprocal. If the current value is /// equal to zero. Take the passedVar and divide it by one to get the inverse of it. /// If it is not equal to zero, process the operation and call the Equals method to /// keep performing operations. /// </summary> /// <param name="passedVar">The passed variable.</param> public void ToReciprocal(double passedVar) { if (CurrentValue.CompareTo(passedVar) == 0) { CurrentValue = 1 / CurrentValue; } else { Operand2 = 1 / CurrentValue; Equals(); } }
protected override void Reevaluate() { if (_reevaluate != null) { _reevaluate(this); } if (CurrentMin.CompareTo(CurrentValue) > 0) { CurrentValue = CurrentMin; } if (CurrentValue.CompareTo(CurrentMax) > 0) { CurrentValue = CurrentMax; } }
public override int CompareTo(UstNode other) { PinValueAssigned = false; if (other == null) { return((int)NodeType); } if (other.NodeType == NodeType.PatternVarRef) { return(VarId.CompareTo(((PatternVarRef)other).VarId)); } if (PatternVar.Values[PatternVarIndex] == null) { return(-1); } int result; if (PatternVar.PinValue == null) { result = CurrentValue.CompareTo(other); if (result == 0) { PatternVar.PinValue = (Token)other; PinValueAssigned = true; } return(result); } else { result = PatternVar.PinValue.CompareTo(other); } return(result); }