Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: client/samples/total/src/Functions.dart

Issue 8966029: Report errors and warnings for hiding elements, issue 572. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Functions implemented: 5 // Functions implemented:
6 // 6 //
7 // ABS ACOS ACOSH AND ASIN ASINH ATAN ATAN2 ATANH COLUMNS COMBIN CONCATENATE COS COSH COUNTA DATE 7 // ABS ACOS ACOSH AND ASIN ASINH ATAN ATAN2 ATANH COLUMNS COMBIN CONCATENATE COS COSH COUNTA DATE
8 // DAY DEGREES EVEN EXP FACT FACTDOUBLE FALSE GCD HLOOKUP HOUR IF INT LARGE LCM LEN LN LOG 8 // DAY DEGREES EVEN EXP FACT FACTDOUBLE FALSE GCD HLOOKUP HOUR IF INT LARGE LCM LEN LN LOG
9 // LOG10 MATCH MAX MID MIN MINUTE MOD MONTH MULTINOMIAL NOT NOW ODD OFFSET OR PI POWER 9 // LOG10 MATCH MAX MID MIN MINUTE MOD MONTH MULTINOMIAL NOT NOW ODD OFFSET OR PI POWER
10 // PRODUCT QUOTIENT RADIANS RAND RANDBETWEEN RIGHT ROUND SECOND SERIESSUM SIGN 10 // PRODUCT QUOTIENT RADIANS RAND RANDBETWEEN RIGHT ROUND SECOND SERIESSUM SIGN
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 sb.add(stack[top + i].asString(location)); 594 sb.add(stack[top + i].asString(location));
595 } 595 }
596 stack[top] = new StringValue(sb.toString()); 596 stack[top] = new StringValue(sb.toString());
597 }); 597 });
598 _newFunc("COUNT", -1, void _(CellLocation location, List<Value> stack, int t op, int nargs) { 598 _newFunc("COUNT", -1, void _(CellLocation location, List<Value> stack, int t op, int nargs) {
599 int count = 0; 599 int count = 0;
600 for (int i = 0; i < nargs; i++) { 600 for (int i = 0; i < nargs; i++) {
601 Value value = stack[top + i]; 601 Value value = stack[top + i];
602 if (value.datatype == Value.TYPE_CELLREF || value.datatype == Value.TY PE_RANGE) { 602 if (value.datatype == Value.TYPE_CELLREF || value.datatype == Value.TY PE_RANGE) {
603 count += _countCellsInRange(value.asRangeToken().getCellRange(locati on), 603 count += _countCellsInRange(value.asRangeToken().getCellRange(locati on),
604 int _(Cell cell) { return cell.isNumeric() ? 1 : 0; }); 604 int __(Cell cell) { return cell.isNumeric() ? 1 : 0; });
605 } else if (value.datatype == Value.TYPE_DOUBLE) { 605 } else if (value.datatype == Value.TYPE_DOUBLE) {
606 count++; 606 count++;
607 } 607 }
608 } 608 }
609 stack[top] = new DoubleValue(count.toDouble()); 609 stack[top] = new DoubleValue(count.toDouble());
610 }); 610 });
611 _newFunc("COUNTA", -1, void _(CellLocation location, List<Value> stack, int top, int nargs) { 611 _newFunc("COUNTA", -1, void _(CellLocation location, List<Value> stack, int top, int nargs) {
612 int count = 0; 612 int count = 0;
613 for (int i = 0; i < nargs; i++) { 613 for (int i = 0; i < nargs; i++) {
614 Value value = stack[top + i]; 614 Value value = stack[top + i];
615 if (value.datatype == Value.TYPE_CELLREF || value.datatype == Value.TY PE_RANGE) { 615 if (value.datatype == Value.TYPE_CELLREF || value.datatype == Value.TY PE_RANGE) {
616 count += _countCellsInRange(value.asRangeToken().getCellRange(locati on), 616 count += _countCellsInRange(value.asRangeToken().getCellRange(locati on),
617 int _(Cell cell) { return cell.isEmpty() ? 0 : 1; }); 617 int __(Cell cell) { return cell.isEmpty() ? 0 : 1; });
618 } else { 618 } else {
619 count++; 619 count++;
620 } 620 }
621 } 621 }
622 stack[top] = new DoubleValue(count.toDouble()); 622 stack[top] = new DoubleValue(count.toDouble());
623 }); 623 });
624 _newFunc("GCD", -2, void _(CellLocation location, List<Value> stack, int top , int nargs) { 624 _newFunc("GCD", -2, void _(CellLocation location, List<Value> stack, int top , int nargs) {
625 for (int i = 0; i < nargs; i++) { 625 for (int i = 0; i < nargs; i++) {
626 if (stack[top + i].asDouble(location) < 0.0) { 626 if (stack[top + i].asDouble(location) < 0.0) {
627 throw new NumberException(); 627 throw new NumberException();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 } 725 }
726 726
727 // The range must be 1xN or Nx1 727 // The range must be 1xN or Nx1
728 if (range.rows > 1 && range.columns > 1) { 728 if (range.rows > 1 && range.columns > 1) {
729 throw new NumberException(); 729 throw new NumberException();
730 } 730 }
731 731
732 int index = 1; 732 int index = 1;
733 double bestValue = matchType == 1 ? -1.0e100 : 1.0e100; 733 double bestValue = matchType == 1 ? -1.0e100 : 1.0e100;
734 int bestIndex = -1; 734 int bestIndex = -1;
735 range.forEach(_(CellLocation loc) { 735 range.forEach(__(CellLocation loc) {
736 Cell cell = loc.getCell(); 736 Cell cell = loc.getCell();
737 if (cell != null) { 737 if (cell != null) {
738 double d = cell.getDoubleValue(); 738 double d = cell.getDoubleValue();
739 if (d == value) { 739 if (d == value) {
740 bestIndex = index; 740 bestIndex = index;
741 return; 741 return;
742 } else if (matchType == 1 && d < value && d > bestValue) { 742 } else if (matchType == 1 && d < value && d > bestValue) {
743 bestValue = d; 743 bestValue = d;
744 bestIndex = index; 744 bestIndex = index;
745 } else if (matchType == -1 && d > value && d < bestValue) { 745 } else if (matchType == -1 && d > value && d < bestValue) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 Cell resultCell = range.spreadsheet.getCell(horizontal ? 974 Cell resultCell = range.spreadsheet.getCell(horizontal ?
975 new RowCol(outRowCol, bestIndex) : new RowCol(bestIndex, outRowCol)); 975 new RowCol(outRowCol, bestIndex) : new RowCol(bestIndex, outRowCol));
976 stack[top] = new DoubleValue(resultCell == null ? 0.0 : resultCell.getDoub leValue()); 976 stack[top] = new DoubleValue(resultCell == null ? 0.0 : resultCell.getDoub leValue());
977 } 977 }
978 } 978 }
979 979
980 void _newFunc(String name, int nargs, NumericFunction f) { 980 void _newFunc(String name, int nargs, NumericFunction f) {
981 _functions[name] = new SpreadsheetFunction(name, nargs, f); 981 _functions[name] = new SpreadsheetFunction(name, nargs, f);
982 } 982 }
983 } 983 }
OLDNEW
« no previous file with comments | « client/samples/total/src/DateTimeUtils.dart ('k') | client/samples/total/src/InnerMenuView.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698