@Override public void sum(Vector v) throws IncompatibleVectorSizesException { if (v.getSize() != adaptee.size()) { throw new IncompatibleVectorSizesException(); } for (int i = 0; i < adaptee.size(); i++) { setElement(i, getElement(i) * v.getElement(i)); } }
public boolean equals(Object obj) { if (obj instanceof Vector) { if (((Vector) obj).getSize() != adaptee.size()) { return false; } for (int i = 0; i < adaptee.size(); i++) { if (!(((Vector) obj).getElement(i) == getElement(i))) return false; } } return true; }
@Override public void mult(double a) { for (int i = 0; i < adaptee.size(); i++) { setElement(i, getElement(i) * a); } }
public String toString() { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < adaptee.size(); i++) { stringBuilder.append(getElement(i)); stringBuilder.append(" "); } return stringBuilder.toString().trim(); }