/* заполнение вектора из другого объекта этого класса */ public void FillFromVector(Vector inputVector) { if (this.GetSize() > inputVector.GetSize()) { for (int i = 0; i < this.GetSize(); i++) { this.SetValue(i, inputVector.GetValue(i)); } } else { for (int i = 0; i < this.GetSize(); i++) { this.SetValue(i, inputVector.GetValue(i)); } } }
/* сложение векторов поэлементно */ public void Add(Vector summandVector) { if (summandVector.GetSize() == this.GetSize()) { for (int i = 0; i < this.GetSize(); i++) { this.SetValue(i, this.GetValue(i) + summandVector.GetValue(i)); } } }
/* сравнение векторов */ public boolean Equal(Vector inputVector) { if (inputVector.GetSize() != this.GetSize()) { return false; } else { for (int i = 0; i < this.GetSize(); i++) { if (inputVector.GetValue(i) != this.GetValue(i)) { return false; } } } return true; }