|
|
@ -94,11 +94,11 @@ public class CheckSparseVector { |
|
|
|
} |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
// testen equal(), wenn die beiden Vektoren identisch sind → should be true, not |
|
|
|
// anymore :) |
|
|
|
// testen equal(), wenn die beiden Vektoren identisch sind → should be true, not anymore :) |
|
|
|
System.out.println(controlVector.equals(otherVector1)); |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
// Testen: Remove Element |
|
|
|
controlVector.removeElement(5); |
|
|
|
System.out.println("der Wert des controlVector an der Position 5 ist: " + controlVector.getElement(5)); // 0.0 |
|
|
|
System.out.println("Die Länge nach remove ist: " + controlVector.getLength()); // 10 |
|
|
@ -113,8 +113,7 @@ public class CheckSparseVector { |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
// testen equals(other) --> nicht identisch |
|
|
|
System.out.println(controlVector.equals(otherVector1)); // should be false, weil der Wert an Index 5 zu 100 gesetzt |
|
|
|
// wurde |
|
|
|
System.out.println(controlVector.equals(otherVector1)); // should be false, weil der Wert an Index 5 zu 100 gesetzt wurde |
|
|
|
System.out.println(controlVector.equals(otherVector2)); // should be false |
|
|
|
System.out.println(controlVector.equals(otherVector3)); // should be false |
|
|
|
System.out.println(controlVector.equals(otherVector4)); // should be false |
|
|
@ -122,25 +121,18 @@ public class CheckSparseVector { |
|
|
|
|
|
|
|
otherVector1.setElement(5, 100); |
|
|
|
System.out.println("der Wert des otherVector1 an der Position 5 ist: " + otherVector1.getElement(5)); // 100.0 |
|
|
|
System.out.println(otherVector1.equals(controlVector));// should be true, weil der Wert an Index 5 von this und |
|
|
|
// other Vektor gleich 100 |
|
|
|
System.out.println(otherVector1.equals(controlVector));// should be true, weil der Wert an Index 5 von this und other Vektor gleich 100 |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
// testen add() |
|
|
|
controlVector.add(otherVector1); |
|
|
|
|
|
|
|
System.out.println("die Länge des controlVector ist: " + controlVector.getLength()); // 10 |
|
|
|
System.out.println("der Wert des controlVector an der Position 0 ist: " + controlVector.getElement(0)); // 10 + 10 = |
|
|
|
// 20 |
|
|
|
System.out.println("der Wert des controlVector an der Position 5 ist: " + controlVector.getElement(5)); // 100 + 100 |
|
|
|
// = 200 |
|
|
|
System.out.println("der Wert des controlVector an der Position 0 ist: " + controlVector.getElement(0)); // 10 + 10 = 20 |
|
|
|
System.out.println("der Wert des controlVector an der Position 5 ist: " + controlVector.getElement(5)); // 100 + 100 = 200 |
|
|
|
System.out.println("der Wert des controlVector an der Position 6 ist: " + controlVector.getElement(6)); // 0.0 |
|
|
|
System.out.println("der Wert des controlVector an der Position 8 ist: " + controlVector.getElement(8)); // 65.01 + |
|
|
|
// 65.01 = |
|
|
|
// 130.02 |
|
|
|
System.out.println("der Wert des controlVector an der Position 9 ist: " + controlVector.getElement(9)); // 112.79 + |
|
|
|
// 112.79 = |
|
|
|
// 225.58 |
|
|
|
System.out.println("der Wert des controlVector an der Position 8 ist: " + controlVector.getElement(8)); // 65.01 + 65.01 = 130.02 |
|
|
|
System.out.println("der Wert des controlVector an der Position 9 ist: " + controlVector.getElement(9)); // 112.79 + 112.79 = 225.58 |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
controlVector.add(otherVector2); |
|
|
|