X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2FSpreadsheetMatrix.java;fp=bundles%2Forg.simantics.spreadsheet%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2FSpreadsheetMatrix.java;h=b6896d5ec78f48eaba2984aa59a20b610132f05a;hb=c07a3818f0024e932a27eb85cbfd3f2291475a65;hp=0000000000000000000000000000000000000000;hpb=6c99e980d250fb9201aba93be7dcb1f55564dccd;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/SpreadsheetMatrix.java b/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/SpreadsheetMatrix.java new file mode 100644 index 000000000..b6896d5ec --- /dev/null +++ b/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/SpreadsheetMatrix.java @@ -0,0 +1,128 @@ +package org.simantics.spreadsheet; + +import java.io.Serializable; + +import org.simantics.spreadsheet.solver.formula.FormulaError2; + +public class SpreadsheetMatrix implements Serializable { + + private static final long serialVersionUID = 5729700370527844640L; + + private int w; + private int h; + public Object[] values; + + public SpreadsheetMatrix(int w, int h) { + this.w = w; + this.h = h; + this.values = new Object[w*h]; + } + + public Object get(int row, int column) { + return values[w*row+column]; + } + + public void set(int row, int column, Object value) { + values[w*row+column] = value; + } + + public int getWidth() { + return w; + } + + public int getHeight() { + return h; + } + + public double sum() { + double result = 0; + for(int i=0;i