<< array/SLArray2D.sleela SLeeLa two-dimensional array library. Definition: Helpers over int[][] and double[][] (SLEELA.syntax section 46): creation of rectangular grids, row and column counts, copy, fill, transpose, sum and text. Requires #sleela 3.1 in the using program (it uses a.length and new T[a][b]). >> #sleela 3.1 material; class SLArray2D { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Full descriptive record for a library-family class: identity, legality (metaNationalSchedule), fiduciary (copyright, trademark, corporation) and jurisdictional scope (metaOrigin). Values are faithful to the real origin of the subject where publicly known; unknown values are stated as none. >> String metaVersion = "1.0.0"; int metaId = 8607; String metaAuthor = "Max Rupplin"; String metaDate = "2026-11-12"; String metaCopyright = "MEARVK LLC"; String metaTrademark = "none"; String metaCorporation = "MEARVK LLC"; String metaOrigin = "International"; String metaBirthDate = "2026-11-12"; int metaScienceRating = 7; String metaNationalSchedule = "The Java Language Specification, Java SE 28 Edition (JLS 10, Arrays)"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } < Rectangular int grid rows by cols, every element 0. Needs syntax 3.1 (new T[a][b]). > static int[][] create(int rows, int cols) { return new int[rows][cols]; } static double[][] createDouble(int rows, int cols) { return new double[rows][cols]; } static int rows(int[][] a) { return a.length; } < Length of row r (rows of a jagged array may differ). > static int cols(int[][] a, int r) { return a[r].length; } < True when every row has the length of row 0. > static boolean isRectangular(int[][] a) { if (a.length == 0) { return true; } int w = a[0].length; for (int i = 1; i < a.length; i++) { if (a[i].length != w) { return false; } } return true; } static void fill(int[][] a, int v) { for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { a[i][j] = v; } } } < Deep copy: new rows holding the same values. > static int[][] copy(int[][] a) { int[][] r = new int[a.length][]; for (int i = 0; i < a.length; i++) { r[i] = new int[a[i].length]; for (int j = 0; j < a[i].length; j++) { r[i][j] = a[i][j]; } } return r; } < Transpose of a rectangular grid. > static int[][] transpose(int[][] a) { if (a.length == 0) { return new int[0][0]; } int h = a.length; int w = a[0].length; int[][] r = new int[w][h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { r[j][i] = a[i][j]; } } return r; } static int sumOf(int[][] a) { int s = 0; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { s = s + a[i][j]; } } return s; } < Text like [[1, 2], [3, 4]]. > static String toText(int[][] a) { String s = "["; for (int i = 0; i < a.length; i++) { if (i > 0) { s = s + ", "; } s = s + SLIntArray.toText(a[i]); } return s + "]"; } }