/** * Return the matrix item at the specified index. Note that this method * creates a new <code>Double</code> instance every time it is called. * * @param itemIndex item index. * * @return The matrix item at the specified index. * * @see #get(int, int) */ public Number getItem(int itemIndex) { int i = getItemRow(itemIndex); int j = getItemColumn(itemIndex); Number n = new Double(get(i, j)); return n; }
/** * Return the matrix item at the specified index. Note that this method * creates a new {@code double} instance every time it is called. * * @param itemIndex item index. * * @return The matrix item at the specified index. * * @see #get(int, int) */ public Number getItem(int itemIndex) { int i = getItemRow(itemIndex); int j = getItemColumn(itemIndex); Number n = new Double(get(i, j)); return n; }
/** * Tests this object instance for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MatrixSeries)) { return false; } MatrixSeries that = (MatrixSeries) obj; if (!(getRowCount() == that.getRowCount())) { return false; } if (!(getColumnsCount() == that.getColumnsCount())) { return false; } for (int r = 0; r < getRowCount(); r++) { for (int c = 0; c < getColumnsCount(); c++) { if (get(r, c) != that.get(r, c)) { return false; } } } return super.equals(obj); }