コード例 #1
1
  Object invoke(String methodName, Object... parameters)
      throws IllegalAccessException, InvocationTargetException {
    String mid = methodId(methodName, parameters.length);
    List<Method> methods = methodCache.get(mid);
    Method method = null;

    if (methods == null) {
      throw new IllegalAccessException("No method " + mid); // NOI18N
    }
    if (methods.size() == 1) {
      method = methods.get(0);
    } else {
      Class[] parClasses = new Class[parameters.length];

      for (int i = 0; i < parameters.length; i++) {
        Class cl = parameters[i].getClass();
        if (primitiveTypes.containsKey(cl)) {
          cl = primitiveTypes.get(cl);
        }
        parClasses[i] = cl;
      }
      for (Method m : methods) {
        if (Arrays.deepEquals(m.getParameterTypes(), parClasses)) {
          method = m;
          break;
        }
      }
    }
    if (method == null) {
      throw new IllegalArgumentException(
          instance + " " + methodName + " " + Arrays.toString(parameters));
    }
    return method.invoke(instance, parameters);
  }
コード例 #2
0
  /**
   * Provides a static, single instance of the application context. This method can be called
   * repeatedly.
   *
   * <p>If the configuration requested differs from one used previously, then the previously-created
   * context is shut down.
   *
   * @return Returns an application context for the given configuration
   */
  public static synchronized ApplicationContext getApplicationContext(
      String[] configLocations, String[] classLocations) throws IOException {
    if (configLocations == null) {
      throw new IllegalArgumentException("configLocations argument is mandatory.");
    }
    if (usedConfiguration != null
        && Arrays.deepEquals(configLocations, usedConfiguration)
        && classLocations != null
        && Arrays.deepEquals(classLocations, usedClassLocations)) {
      // The configuration was used to create the current context
      return instance;
    }
    // The config has changed so close the current context (if any)
    closeApplicationContext();

    if (useLazyLoading || noAutoStart) {
      instance = new VariableFeatureClassPathXmlApplicationContext(configLocations);
    } else {
      instance = new ClassPathXmlApplicationContext(configLocations, false);
    }

    if (classLocations != null) {
      ClassLoader classLoader = buildClassLoader(classLocations);
      instance.setClassLoader(classLoader);
    }

    instance.refresh();

    usedConfiguration = configLocations;
    usedClassLocations = classLocations;

    return instance;
  }
コード例 #3
0
  @Override
  public boolean equals(final Object o) {
    if (o == this) {
      return true;
    }
    if (o == null) {
      return false;
    }

    if (o instanceof ImmutableOffsetMap) {
      final ImmutableOffsetMap<?, ?> om = (ImmutableOffsetMap<?, ?>) o;
      if (newKeys.isEmpty()
          && offsets == om.offsets()
          && Arrays.deepEquals(objects, om.objects())) {
        return true;
      }
    } else if (o instanceof MutableOffsetMap) {
      final MutableOffsetMap<?, ?> om = (MutableOffsetMap<?, ?>) o;
      if (offsets == om.offsets
          && Arrays.deepEquals(objects, om.objects)
          && newKeys.equals(om.newKeys)) {
        return true;
      }
    } else if (o instanceof Map) {
      final Map<?, ?> om = (Map<?, ?>) o;

      // Size and key sets have to match
      if (size() != om.size() || !keySet().equals(om.keySet())) {
        return false;
      }

      try {
        // Ensure all newKeys are present. Note newKeys is guaranteed to
        // not contain null value.
        for (Entry<K, V> e : newKeys.entrySet()) {
          if (!e.getValue().equals(om.get(e.getKey()))) {
            return false;
          }
        }

        // Ensure all objects are present
        for (Entry<K, Integer> e : offsets.entrySet()) {
          final Object obj = objects[e.getValue()];
          if (!NO_VALUE.equals(obj)) {
            final V v = objectToValue(e.getKey(), obj);
            if (!v.equals(om.get(e.getKey()))) {
              return false;
            }
          }
        }
      } catch (ClassCastException e) {
        // Can be thrown by om.get() and indicate we have incompatible key types
        return false;
      }

      return true;
    }

    return false;
  }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;

    final A a = (A) o;

    if (a7 != a.a7) return false;
    if (a8 != a.a8) return false;
    if (a9 != a.a9) return false;
    if (a10 != a.a10) return false;
    if (Float.compare(a.a11, a11) != 0) return false;
    if (Double.compare(a.a12, a12) != 0) return false;
    // Probably incorrect - comparing Object[] arrays with Arrays.equals
    if (!Arrays.equals(a1, a.a1)) return false;
    if (!Arrays.deepEquals(a2, a.a2)) return false;
    // Probably incorrect - comparing Object[] arrays with Arrays.equals
    if (!Arrays.equals(a3, a.a3)) return false;
    if (!Arrays.deepEquals(a4, a.a4)) return false;
    if (!Arrays.equals(a5, a.a5)) return false;
    if (!Arrays.deepEquals(a6, a.a6)) return false;
    if (!a13.equals(a.a13)) return false;
    if (!a14.equals(a.a14)) return false;

    return true;
  }
コード例 #5
0
 @Override
 public boolean deepEqual(IAObject obj) {
   if (!(obj instanceof ARecordType)) {
     return false;
   }
   ARecordType rt = (ARecordType) obj;
   return (isOpen == rt.isOpen)
       && Arrays.deepEquals(fieldNames, rt.fieldNames)
       && Arrays.deepEquals(fieldTypes, rt.fieldTypes);
 }
  public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments)
      throws Throwable {
    if (_methodName28.equals(name) && Arrays.deepEquals(_methodParameterTypes28, parameterTypes)) {
      return TableFromAnotherDataSourceServiceUtil.getBeanIdentifier();
    }

    if (_methodName29.equals(name) && Arrays.deepEquals(_methodParameterTypes29, parameterTypes)) {
      TableFromAnotherDataSourceServiceUtil.setBeanIdentifier((java.lang.String) arguments[0]);
    }

    throw new UnsupportedOperationException();
  }
コード例 #7
0
  public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments)
      throws Throwable {
    if (_methodName22.equals(name) && Arrays.deepEquals(_methodParameterTypes22, parameterTypes)) {
      return CalEventAttendeeServiceUtil.getBeanIdentifier();
    }

    if (_methodName23.equals(name) && Arrays.deepEquals(_methodParameterTypes23, parameterTypes)) {
      CalEventAttendeeServiceUtil.setBeanIdentifier((java.lang.String) arguments[0]);
    }

    throw new UnsupportedOperationException();
  }
コード例 #8
0
  public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments)
      throws Throwable {
    if (_methodName92.equals(name) && Arrays.deepEquals(_methodParameterTypes92, parameterTypes)) {
      return UserAssignmentServiceUtil.getBeanIdentifier();
    }

    if (_methodName93.equals(name) && Arrays.deepEquals(_methodParameterTypes93, parameterTypes)) {
      UserAssignmentServiceUtil.setBeanIdentifier((java.lang.String) arguments[0]);

      return null;
    }

    throw new UnsupportedOperationException();
  }
  public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments)
      throws Throwable {
    if (_methodName18.equals(name) && Arrays.deepEquals(_methodParameterTypes18, parameterTypes)) {
      return GlobalInformationServiceUtil.getBeanIdentifier();
    }

    if (_methodName19.equals(name) && Arrays.deepEquals(_methodParameterTypes19, parameterTypes)) {
      GlobalInformationServiceUtil.setBeanIdentifier((java.lang.String) arguments[0]);

      return null;
    }

    throw new UnsupportedOperationException();
  }
コード例 #10
0
  public Object invokeMethod(String name, String[] parameterTypes, Object[] arguments)
      throws Throwable {
    if (_methodName246.equals(name)
        && Arrays.deepEquals(_methodParameterTypes246, parameterTypes)) {
      return ContestTeamMemberServiceUtil.getBeanIdentifier();
    }

    if (_methodName247.equals(name)
        && Arrays.deepEquals(_methodParameterTypes247, parameterTypes)) {
      ContestTeamMemberServiceUtil.setBeanIdentifier((java.lang.String) arguments[0]);

      return null;
    }

    throw new UnsupportedOperationException();
  }
  public void readModel(int n, int k, double[][] points, int[] weight, DistanceMeasure measure)
      throws OperatorException {
    if (modelInput.isConnected()) {
      KNNCollectionModel input;
      input = modelInput.getData(KNNCollectionModel.class);
      knnCollection = input.get();
      newCollection = false;
      if (k > knnCollection.getK()
          || !Arrays.deepEquals(knnCollection.getPoints(), points)
          || !measure.getClass().toString().equals(input.measure.getClass().toString())) {
        if (k > knnCollection.getK()) {
          this.logNote("Model at input port can not be used (k too small).");
        } else {
          this.logNote("Model at input port can not be used (Model andExampleSet not matching).");
        }
        knnCollection = new KNNCollection(n, k, points, weight);
        newCollection = true;

      } else {
        this.logNote(" Model at input port used for speeding up the operator.");
      }
      if (k < knnCollection.getK()) {
        knnCollection = KNNCollection.clone(knnCollection);
        knnCollection.shrink(knnCollection.getK() - k);
      }
    } else {
      knnCollection = new KNNCollection(n, k, points, weight);
      newCollection = true;
    }
  }
  /**
   * Check whether the indicated pattern is valid according to the mirror method.
   *
   * @param squares The pattern to investigate.
   * @return True if the pattern is valid according to this approach.
   */
  public static boolean validByMirroring(int[][] squares) {
    int[][] original = squares;
    int[][] originalRight90 = rotateRight(original);
    int[][] originalRight180 = rotateRight(originalRight90); // = horizontally mirrored
    int[][] originalRight270 = rotateRight(originalRight180); // = left 90

    int[][] mirrored = mirrorVertically(original);
    int[][] mirroredRight90 = rotateRight(mirrored);
    int[][] mirroredRight180 = rotateRight(mirroredRight90); // = horizontally mirrored
    int[][] mirroredRight270 = rotateRight(mirroredRight180); // = left 90

    int[][][] patterns = {
      original,
      originalRight90,
      originalRight180,
      originalRight270,
      mirrored,
      mirroredRight90,
      mirroredRight180,
      mirroredRight270
    };

    for (int i = 0; i < patterns.length; i++) {
      for (int j = i; j < patterns.length; j++) {
        if (j > i && Arrays.deepEquals(patterns[i], patterns[j])) {
          return false;
        }
      }
    }
    return true;
  }
コード例 #13
0
  /**
   * Tests the computation of DRQA line length histograms on a toy example that covers definite and
   * indefinite lines of length 1 and length >1.
   */
  public void testHistogramComputation() {

    DRQA.conditional_ww_limit = 10;
    DRQA drqa = new DRQA(trajectory, eps);

    // compare the computed histograms (diagonal, vertical, ...) against the correct histograms
    assertArrayEquals(new long[] {0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, drqa.l_hist);
    assertArrayEquals(new long[] {0, 18, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, drqa.v_hist);
    assertArrayEquals(new long[] {0, 0, 8, 3, 3, 3, 0, 5, 0, 0, 0, 0, 0, 0, 0}, drqa.w_hist);
    assertArrayEquals(new long[] {0, 5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, drqa.r_hist);
    assertArrayEquals(
        new long[] {0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, drqa.l_hist_indefinite);
    assertArrayEquals(
        new long[] {0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, drqa.v_hist_indefinite);
    assertArrayEquals(
        new long[] {0, 3, 6, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0}, drqa.w_hist_indefinite);
    assertArrayEquals(
        new long[] {0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, drqa.r_hist_indefinite);

    double[][] expectedCRT =
        new double[][] {
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 3, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 5, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
          new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
        };

    assertTrue(Arrays.deepEquals(expectedCRT, drqa.conditional_ww.toArray()));
  }
コード例 #14
0
ファイル: DefaultBoard.java プロジェクト: njacinto/Sudoku
 @Override
 public boolean equals(Object obj) {
   return obj != null
       && getClass() == obj.getClass()
       && this.number == ((DefaultBoard) obj).number
       && Arrays.deepEquals(this.board, ((DefaultBoard) obj).board);
 }
コード例 #15
0
  @Test(dataProvider = "onCommandLongTests")
  public void executeOnCommandLongTest(
      String cmdMessage, OnCommandLong command, String[][] expectedArgs) throws Exception {
    // Build the CommandEvent
    CommandEvent event =
        new CommandEvent(
            command,
            new MessageEvent(bot, null, null, cmdMessage),
            null,
            null,
            cmdMessage,
            "?testCommand",
            hook.getArgs(cmdMessage));

    // Execute and verify values
    String returned = hook.executeOnCommandLong(event);
    assertEquals(returned, "Success", "onCommandLong doesn't return expected value");

    log.debug("Current command: " + command.getName());
    logMultiArray(expectedArgs, "Expected args");
    logMultiArray(command.getArgs(), "Given args");

    assertTrue(
        Arrays.deepEquals(command.getArgs(), expectedArgs),
        "Command test " + command.getName() + " args don't equal");
  }
コード例 #16
0
  /** Instead of only testing onCommandLong, test feeding into onMessage */
  @Test(dataProvider = "onCommandLongTests")
  public void executeTest(String cmdMessage, OnCommandLong command, String[][] expectedArgs)
      throws Exception {
    // Remove the prefix
    cmdMessage = cmdMessage.substring(1);

    // Build the messageEvent
    final StringBuilder response = new StringBuilder();
    MessageEvent messageEvent =
        new MessageEvent(bot, channel, null, cmdMessage) {
          @Override
          public void respond(String commandResponse) {
            if (commandResponse != null) response.append(commandResponse);
          }
        };

    // Add our test listener
    controller.getHookManager().addHook(command);

    // Feed into onMessage
    log.trace("Sending message " + cmdMessage);
    hook.execute(messageEvent, channel, user, cmdMessage);

    // Verify the results
    assertEquals(
        response.toString(),
        "Success",
        "onCommandLong in test " + command.getName() + " doesn't return expected value");
    assertTrue(
        Arrays.deepEquals(command.getArgs(), expectedArgs),
        "Command test " + command.getName() + " args don't equal");

    // Remove it to cleanup
    controller.getHookManager().removeHook(command);
  }
コード例 #17
0
ファイル: JdtUtils.java プロジェクト: himanshu28/spring-ide
  /** @since 3.2.0 */
  public static IMethod getMethod(
      IType type, String methodName, String[] parameterTypes, boolean includeHierarchy) {
    int index = methodName.indexOf('(');
    if (index >= 0) {
      methodName = methodName.substring(0, index);
    }
    try {
      while (type != null) {
        for (IMethod method : Introspector.getMethods(type)) {
          if (method.getElementName().equals(methodName)
              && method.getParameterTypes().length == parameterTypes.length) {
            String[] methodParameterTypes = getParameterTypesAsStringArray(method);
            if (Arrays.deepEquals(parameterTypes, methodParameterTypes)) {
              return method;
            }
          }
        }
        if (!includeHierarchy) break;
        type = Introspector.getSuperType(type);
      }

      return Introspector.findMethod(
          type, methodName, parameterTypes.length, Public.YES, Static.DONT_CARE);
    } catch (JavaModelException e) {
    }
    return null;
  }
 @Test
 public void ConstructorWithComplexNumberParametersWorkCorrect() {
   ComplexMatrix2x2 matrix = (ComplexMatrix2x2) context.getBean("nonZeroMatrix2");
   ComplexNumber cN = ComplexMatrix2x2Util.getComplexNumber(1, 2);
   ComplexNumber[][] complexNumbers = new ComplexNumber[][] {{cN, cN}, {cN, cN}};
   assertTrue(Arrays.deepEquals(matrix.getMatrix(), complexNumbers));
 }
コード例 #19
0
 @Override
 public boolean equals(Object o) {
   if (o == this) return true;
   if (!(o instanceof ResultLogConfig)) return false;
   final ResultLogConfig other = (ResultLogConfig) o;
   return Arrays.deepEquals(toArray(), other.toArray());
 }
コード例 #20
0
ファイル: JPABase.java プロジェクト: novayoung/play
  /**
   * JPASupport instances a and b are equals if either <strong>a == b</strong> or a and b have same
   * </strong>{@link #key key} and class</strong>
   *
   * @param other
   * @return true if equality condition above is verified
   */
  @Override
  public boolean equals(Object other) {
    final Object key = this._key();

    if (other == null) {
      return false;
    }
    if (this == other) {
      return true;
    }
    if (key == null) {
      return false;
    }
    if (play.db.Model.class.isAssignableFrom(other.getClass()) && key.getClass().isArray()) {
      Object otherKey = ((play.db.Model) other)._key();
      if (otherKey.getClass().isArray()) {
        return Arrays.deepEquals((Object[]) key, (Object[]) otherKey);
      }
      return false;
    }

    if (!this.getClass().isAssignableFrom(other.getClass())) {
      return false;
    }

    return key.equals(((play.db.Model) other)._key());
  }
コード例 #21
0
ファイル: LineDocSource.java プロジェクト: PATRIC3/p3_solr
  private LineParser createDocDataLineReader(String line) {
    String[] header;
    String headIndicator = WriteLineDocTask.FIELDS_HEADER_INDICATOR + WriteLineDocTask.SEP;

    if (line.startsWith(headIndicator)) {
      header =
          line.substring(headIndicator.length()).split(Character.toString(WriteLineDocTask.SEP));
      skipHeaderLine = true; // mark to skip the header line when input file is reopened
    } else {
      header = WriteLineDocTask.DEFAULT_FIELDS;
    }

    // if a specific DocDataLineReader was configured, must respect it
    String docDataLineReaderClassName = getConfig().get("line.parser", null);
    if (docDataLineReaderClassName != null) {
      try {
        final Class<? extends LineParser> clazz =
            Class.forName(docDataLineReaderClassName).asSubclass(LineParser.class);
        Constructor<? extends LineParser> cnstr = clazz.getConstructor(String[].class);
        return cnstr.newInstance((Object) header);
      } catch (Exception e) {
        throw new RuntimeException("Failed to instantiate " + docDataLineReaderClassName, e);
      }
    }

    // if this the simple case,
    if (Arrays.deepEquals(header, WriteLineDocTask.DEFAULT_FIELDS)) {
      return new SimpleLineParser(header);
    }
    return new HeaderLineParser(header);
  }
コード例 #22
0
ファイル: testReadWrite.java プロジェクト: rfabbri/scilab
  //    @Test( expected = UnsupportedTypeException.class)
  @Test()
  public void ReadSparseTypeTest() throws NullPointerException, JavasciException {
    assertTrue(sci.exec("W=sparse([1,2;4,5;3,10],[1,2,3]);"));
    assertEquals(sci.getVariableType("W"), ScilabTypeEnum.sci_sparse);
    ScilabSparse aFromScilab = (ScilabSparse) sci.get("W");
    assertTrue(
        aFromScilab.toString().equals("sparse([1, 2 ; 3, 10 ; 4, 5], [1.0 ; 3.0 ; 2.0], [4, 10])"));
    assertTrue(sci.exec("AZE= " + aFromScilab.toString()));
    ScilabSparse aFromScilab2 = (ScilabSparse) sci.get("AZE");

    assertTrue(Arrays.deepEquals(aFromScilab.getFullRealPart(), aFromScilab2.getFullRealPart()));

    ScilabSparse mySparse =
        new ScilabSparse(
            100,
            100,
            5,
            new int[] {1, 1, 1, 1, 1},
            new int[] {1, 25, 50, 75, 99},
            new double[] {1.0, 2.0, 3.0, 4.0, 5.0});
    // sci.put with a sparse is not yet functionnal
    //        assertTrue(sci.put("mySparse", mySparse));
    //        String ref="mySparseRef = sparse([1, 2 ; 2, 26 ; 3, 51 ; 4, 76 ; 5, 100], [1.0 ; 2.0 ;
    // 3.0 ; 4.0 ; 5.0], [100, 100]);";
    //        sci.exec("isEqual=(mySparseRef==mySparse)");
    //        ScilabBoolean isEqual = (ScilabBoolean)sci.get("isEqual");
    //        System.out.println("isequal " +isEqual);

  }
コード例 #23
0
  @Test
  public void testOnlyOneWayMatrixMultiplication() {
    int[][] a = {{1, 2, 3, 4}, {5, 6, 7, 8}};

    int[][] b = {{1}, {-1}, {1}, {-1}};

    int[][] expected = {{-2}, {-2}};

    try {
      boolean equal = Arrays.deepEquals(expected, Matrix.multiply(a, b));
      assertTrue(equal);
    } catch (MatrixDimensionMismatchException e) {
      fail("The matrix multiplication should work for mismatched (but tennable) matrices.");
    }

    boolean thrown = false;
    try {
      Matrix.multiply(b, a);
      fail(
          "The matrix multiplication was successful. It should have thrown a dimension mismatch exception");
      ;
    } catch (MatrixDimensionMismatchException expectedException) {
      thrown = true;
    }
    assertTrue(thrown);
  }
コード例 #24
0
ファイル: Job.java プロジェクト: chouclee/h2o
    @Override
    protected void init() {
      if (validation != null && n_folds != 0)
        throw new UnsupportedOperationException(
            "Cannot specify a validation dataset and non-zero number of cross-validation folds.");
      if (n_folds < 0)
        throw new UnsupportedOperationException(
            "The number of cross-validation folds must be >= 0.");
      super.init();
      xval_models = new Key[n_folds];
      for (int i = 0; i < xval_models.length; ++i)
        xval_models[i] = Key.make(dest().toString() + "_xval" + i);

      int rIndex = 0;
      for (int i = 0; i < source.vecs().length; i++)
        if (source.vecs()[i] == response) {
          rIndex = i;
          break;
        }
      _responseName = source._names != null && rIndex >= 0 ? source._names[rIndex] : "response";

      _train = selectVecs(source);
      _names = new String[cols.length];
      for (int i = 0; i < cols.length; i++) _names[i] = source._names[cols[i]];

      // Compute source response domain
      if (classification) _sourceResponseDomain = getVectorDomain(response);
      // Is validation specified?
      if (validation != null) {
        // Extract a validation response
        int idx = validation.find(source.names()[rIndex]);
        if (idx == -1)
          throw new IllegalArgumentException(
              "Validation set does not have a response column called " + _responseName);
        _validResponse = validation.vecs()[idx];
        // Compute output confusion matrix domain for classification:
        // - if validation dataset is specified then CM domain is union of train and validation
        // response domains
        //   else it is only domain of response column.
        if (classification) {
          _validResponseDomain = getVectorDomain(_validResponse);
          if (_validResponseDomain != null) {
            _cmDomain = Utils.domainUnion(_sourceResponseDomain, _validResponseDomain);
            if (!Arrays.deepEquals(_sourceResponseDomain, _validResponseDomain)) {
              _fromModel2CM =
                  Model.getDomainMapping(
                      _cmDomain,
                      _sourceResponseDomain,
                      false); // transformation from model produced response ~> cmDomain
              _fromValid2CM =
                  Model.getDomainMapping(
                      _cmDomain,
                      _validResponseDomain,
                      false); // transformation from validation response domain ~> cmDomain
            }
          } else _cmDomain = _sourceResponseDomain;
        } /* end of if classification */
      } else if (classification) _cmDomain = _sourceResponseDomain;
    }
コード例 #25
0
  // Calcula si una matriz es AtinSimétrica. Es decir que coincidan su inversa con su transpuesta
  public static boolean esAntiSimetrica(int[][] m) {

    int[][] mi = Matriz.negativa(m);
    int[][] mt = Matriz.transponer(m);

    if (Arrays.deepEquals(mi, mt)) return true;
    else return false;
  }
コード例 #26
0
ファイル: ParameterSet.java プロジェクト: 87439247/voltdb
 /* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 @Override
 public boolean equals(Object obj) {
   if (!(obj instanceof ParameterSet)) {
     return false;
   }
   ParameterSet other = (ParameterSet) obj;
   return Arrays.deepEquals(m_params, other.m_params);
 }
コード例 #27
0
ファイル: ExampleGroup.java プロジェクト: dvberkel/Mammon
 @Override
 public boolean myEquals(ExampleElement obj) {
   if (obj == null || !(obj instanceof MultiplicationElement)) {
     return false;
   }
   MultiplicationElement other = (MultiplicationElement) obj;
   return Arrays.deepEquals(operands, other.operands);
 }
コード例 #28
0
ファイル: TableHelper.java プロジェクト: victori/voltdb
 @Override
 public boolean equals(Object obj) {
   if ((obj instanceof Tuple) == false) {
     return false;
   }
   Tuple other = (Tuple) obj;
   return Arrays.deepEquals(values, other.values);
 }
 @Test
 public void defaultConstructorShouldWorkCorrect() {
   ComplexMatrix2x2 matrix = (ComplexMatrix2x2) context.getBean("zeroMatrix");
   ComplexNumber complexNumber = ComplexMatrix2x2Util.getComplexNumber(0, 0);
   ComplexNumber[][] complexNumbers =
       new ComplexNumber[][] {{complexNumber, complexNumber}, {complexNumber, complexNumber}};
   assertTrue(Arrays.deepEquals(matrix.getMatrix(), complexNumbers));
 }
 @Test
 public void addShouldWorkCorrect() {
   ComplexMatrix2x2 matrix = (ComplexMatrix2x2) context.getBean("nonZeroMatrix3");
   ComplexNumber cN1 = ComplexMatrix2x2Util.getComplexNumber(10, 2);
   ComplexNumber cN2 = ComplexMatrix2x2Util.getComplexNumber(6, 8);
   ComplexNumber[][] complexNumbers = new ComplexNumber[][] {{cN1, cN1}, {cN2, cN2}};
   assertTrue(Arrays.deepEquals(matrix.add(matrix).getMatrix(), complexNumbers));
 }