Examples of JavaArray2D


Examples of org.timepedia.chronoscope.client.util.JavaArray2D

  }

  public void testIllegalConstructorCalls() {
    // null constructor arg
    try {
      new JavaArray2D((double[])null); // 1D array constructor
      fail("Expected IllegalArgumentException");
    }
    catch (IllegalArgumentException e) {}

    // null constructor arg
    try {
      new JavaArray2D((double[][])null); // 2D array constructor
      fail("Expected IllegalArgumentException");
    }
    catch (IllegalArgumentException e) {}

    // a[][] with 0 rows
    try {
      new JavaArray2D(new double[0][1]);
      fail("Expected IllegalArgumentException");
    }
    catch (IllegalArgumentException e) {}

    // a[][] with 1 or more null rows
    try {
      // 2nd row is null
      new JavaArray2D(new double[][] {{1, 2}, null});
      fail("Expected IllegalArgumentException");
    }
    catch (IllegalArgumentException e) {}
  }
View Full Code Here

Examples of org.timepedia.chronoscope.client.util.JavaArray2D

  public void testGet() {
    double[][] data = new double[][] { {10, 20, 30, 40}, {100, 200}, {300}};

    // Access every legal element in the data[][] array and verify
    // that Array2D.get(row,col) returns the corresponding value.
    JavaArray2D a = new JavaArray2D(data);
    for (int i = 0; i < data.length; i++) {
      double[] row = data[i];
      for (int j = 0; j < row.length; j++) {
        assertEquals(row[j], a.get(i, j));
      }
    }

    try {
      a.get(-1, -1);
      fail();
    } catch (AssertionError e) {
      // expected
    }

    try {
      a.get(0, data[0].length);
      fail();
    } catch (AssertionError e) {
      // expected
    }

    try {
      a.get(data.length, 0);
      fail();
    } catch (AssertionError e) {
      // expected
    }
View Full Code Here

Examples of org.timepedia.chronoscope.client.util.JavaArray2D

    DatasetRequest request = createDatasetRequestFromJson(json);
    return compFactory.getDatasetFactory().createMutable(request);
  }

  public static Array2D createArray2D(double[][] a) {
    return new JavaArray2D(a);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.