Exemplo n.º 1
0
  @Test()
  public void putAndGetPolynomialTest() throws NullPointerException, JavasciException {
    double[][][] a = {{{1, 2, 3}, {2}, {0, 0, 0, -4}}, {{-1, 0, 2}, {0, 2, 0, 0, 3}, {0}}};
    ScilabPolynomial aOriginal = new ScilabPolynomial(a, "X");
    sci.put("a", aOriginal);
    assertTrue(sci.exec("somme = sum(a);"));

    ScilabPolynomial aFromScilab = (ScilabPolynomial) sci.get("a");

    assertTrue(aFromScilab.equals(aOriginal));
  }
Exemplo n.º 2
0
 /** @see org.scilab.modules.types.ScilabType#equals(Object) */
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof ScilabPolynomial) {
     ScilabPolynomial sciPoly = ((ScilabPolynomial) obj);
     if (sciPoly.getPolyVarName().equals(getPolyVarName())) {
       if (this.isReal() && sciPoly.isReal()) {
         return Arrays.deepEquals(this.getRealPart(), sciPoly.getRealPart());
       } else {
         /* Complex */
         return Arrays.deepEquals(this.getRealPart(), sciPoly.getRealPart())
             && Arrays.deepEquals(this.getImaginaryPart(), sciPoly.getImaginaryPart());
       }
     } else {
       return false;
     }
   } else {
     return false;
   }
 }