|
|
@ -22,8 +22,6 @@ public class CheckSparseVector { |
|
|
|
otherVector1.setElement(9, 112.79); |
|
|
|
otherVector1.setElement(10, -212.79); |
|
|
|
otherVector1.setElement(12, 12); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
SparseVector otherVector2 = new SparseVector(5); |
|
|
@ -62,19 +60,19 @@ public class CheckSparseVector { |
|
|
|
} |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
SparseVector otherVector5 = new SparseVector(20); // ein leerer other. Vektor mit Länge 10 |
|
|
|
SparseVector otherVector5 = new SparseVector(20); // ein leerer other. Vektor mit Länge 20 |
|
|
|
System.out.println("der Wert des otherVector5 an der Position 0 ist: "+ otherVector5.getElement(0)); // 0.0 |
|
|
|
System.out.println("der Wert des otherVector5 an der Position 5 ist: "+ otherVector5.getElement(5)); // 0.0 |
|
|
|
System.out.println("der Wert des otherVector5 an der Position 17 ist: "+ otherVector5.getElement(17));// 0.0 |
|
|
|
System.out.println("der Wert des otherVector5 an der Position 19 ist: " + otherVector5.getElement(19));// 0.0 |
|
|
|
System.out.println("die Länge des otherVector5 ist: " + otherVector5.getLength()); // 20 |
|
|
|
try{ |
|
|
|
System.out.println(otherVector4.getElement(20)); |
|
|
|
System.out.println(otherVector5.getElement(20)); |
|
|
|
} catch(Exception e){ |
|
|
|
System.out.println(e); |
|
|
|
} |
|
|
|
try{ |
|
|
|
System.out.println(otherVector4.getElement(-1)); |
|
|
|
System.out.println(otherVector5.getElement(-1)); |
|
|
|
} catch(Exception e){ |
|
|
|
System.out.println(e); |
|
|
|
} |
|
|
@ -96,6 +94,8 @@ public class CheckSparseVector { |
|
|
|
} catch(Exception e){ |
|
|
|
System.out.println(e); |
|
|
|
} |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
// testen equal(), wenn die beiden Vektoren identisch sind → should be true, not anymore :) |
|
|
|
System.out.println(controlVector.equals(otherVector1)); |
|
|
|
System.out.println("\n"); |
|
|
@ -103,14 +103,14 @@ public class CheckSparseVector { |
|
|
|
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 |
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
controlVector.removeElement(7); |
|
|
|
System.out.println("der Wert des controlVector an der Position 7 ist: "+ controlVector.getElement(7)); // 0.0 |
|
|
|
|
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
controlVector.setElement(5, 100); |
|
|
|
System.out.println("der Wert des controlVector an der Position 5 ist: "+ controlVector.getElement(5)); //100.0 |
|
|
|
|
|
|
|
System.out.println("\n"); |
|
|
|
|
|
|
|
// testen equals(other) --> nicht identisch |
|
|
|