public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval numberVE) {final String number;if (numberVE instanceof RefEval) {RefEval re = (RefEval) numberVE;number = OperandResolver.coerceValueToString(re.getInnerValueEval(re.getFirstSheetIndex()));} else {number = OperandResolver.coerceValueToString(numberVE);}if (number.length() > 10) {return ErrorEval.NUM_ERROR;}String unsigned;boolean isPositive;if (number.length() < 10) {unsigned = number;isPositive = true;} else {unsigned = number.substring(1);isPositive = number.startsWith("0");}String value;try {if (isPositive) {int sum = getDecimalValue(unsigned);value = String.valueOf(sum);} else {String inverted = toggleBits(unsigned);int sum = getDecimalValue(inverted);sum++;value = "-" + sum;}} catch (NumberFormatException e) {return ErrorEval.NUM_ERROR;}return new NumberEval(Long.parseLong(value));}

public ValueEval evaluate ( int srcRowIndex , int srcColumnIndex , ValueEval numberVE ) { final String number ; if ( numberVE instanceof RefEval ) { RefEval re = ( RefEval ) numberVE ; number = OperandResolver . coerceValueToString ( re . getInnerValueEval ( re . getFirstSheetIndex ( ) ) ) ; } else { number = OperandResolver . coerceValueToString ( numberVE ) ; } if ( number . length ( ) > 10 ) { return ErrorEval . NUM_ERROR ; } String unsigned ; boolean isPositive ; if ( number . length ( ) < 10 ) { unsigned = number ; isPositive = true ; } else { unsigned = number . substring ( 1 ) ; isPositive = number . startsWith ( "0" ) ; } String value ; try { if ( isPositive ) { int sum = getDecimalValue ( unsigned ) ; value = String . valueOf ( sum ) ; } else { String inverted = toggleBits ( unsigned ) ; int sum = getDecimalValue ( inverted ) ; sum ++ ; value = "-" + sum ; } } catch ( NumberFormatException e ) { return ErrorEval . NUM_ERROR ; } return new NumberEval ( Long . parseLong ( value ) ) ; }
public override ValueEval Evaluate(int srcRowIndex, int srcColumnIndex, ValueEval numberVE){String number;if (numberVE is RefEval){RefEval re = (RefEval)numberVE;number = OperandResolver.CoerceValueToString(re.GetInnerValueEval(re.FirstSheetIndex));}else{number = OperandResolver.CoerceValueToString(numberVE);}if (number.Length > 10){return ErrorEval.NUM_ERROR;}String unsigned;bool isPositive;if (number.Length < 10){unsigned = number;isPositive = true;}else{unsigned = number.Substring(1);isPositive = number.StartsWith("0");}String value;try{if (isPositive){int sum = getDecimalValue(unsigned);value = sum.ToString();}else{String inverted = toggleBits(unsigned);int sum = getDecimalValue(inverted);sum++;value = "-" + sum.ToString();}}catch (FormatException){return ErrorEval.NUM_ERROR;}return new NumberEval(long.Parse(value));}
