@Test public void testOrdering() { WeightedVector v1 = new WeightedVector(new DenseVector(new double[]{1, 2, 3}), 5.41, 31); WeightedVector v2 = new WeightedVector(new DenseVector(new double[]{1, 2, 3}), 5.00, 31); WeightedVector v3 = new WeightedVector(new DenseVector(new double[]{1, 3, 3}), 5.00, 31); WeightedVector v4 = v1.clone(); WeightedVectorComparator comparator = new WeightedVectorComparator(); assertTrue(comparator.compare(v1, v2) > 0); assertTrue(comparator.compare(v3, v1) < 0); assertTrue(comparator.compare(v3, v2) > 0); assertEquals(0, comparator.compare(v4, v1)); assertEquals(0, comparator.compare(v1, v1)); }
@Override public WeightedVector clone() { WeightedVector v = (WeightedVector)super.clone(); v.weight = weight; v.index = index; return v; }
WeightedVector extends DelegatingVector { @Override public WeightedVector clone() { WeightedVector v = (WeightedVector)super.clone(); v.weight = weight; v.index = index; return v; } }
WeightedVector extends DelegatingVector { @Override public WeightedVector clone() { WeightedVector v = (WeightedVector)super.clone(); v.weight = weight; v.index = index; return v; } protected  WeightedVector(double weight, int index);  WeightedVector(Vector v, double weight, int index);  WeightedVector(Vector v, Vector projection, int index); }
WeightedVector extends DelegatingVector { @Override public WeightedVector clone() { WeightedVector v = (WeightedVector)super.clone(); v.weight = weight; v.index = index; return v; } protected  WeightedVector(double weight, int index);  WeightedVector(Vector v, double weight, int index);  WeightedVector(Vector v, Vector projection, int index); static WeightedVector project(Vector v, Vector projection); static WeightedVector project(Vector v, Vector projection, int index); double getWeight(); int getIndex(); void setWeight(double newWeight); void setIndex(int index); @Override Vector like(); @Override String toString(); @Override WeightedVector clone(); }
WeightedVector extends DelegatingVector { @Override public WeightedVector clone() { WeightedVector v = (WeightedVector)super.clone(); v.weight = weight; v.index = index; return v; } protected  WeightedVector(double weight, int index);  WeightedVector(Vector v, double weight, int index);  WeightedVector(Vector v, Vector projection, int index); static WeightedVector project(Vector v, Vector projection); static WeightedVector project(Vector v, Vector projection, int index); double getWeight(); int getIndex(); void setWeight(double newWeight); void setIndex(int index); @Override Vector like(); @Override String toString(); @Override WeightedVector clone();  }