@Test public void testRepulseJoinFunction() throws Exception { JoinFunction<LVertex, LVertex, Force> jf = new FRRepulsionFunction(1, 20); LVertex v1 = getDummyVertex(1, 1); LVertex v2 = getDummyVertex(2, 3); LVertex v3 = getDummyVertex(7, 5); LVertex v4 = getDummyVertex(1, 1); LVertex v5 = getDummyVertex(30, 30); Vector vec12 = jf.join(v1, v2).getValue().copy(); Vector vec13 = jf.join(v1, v3).getValue().copy(); Vector vec14 = jf.join(v1, v4).getValue().copy(); Vector vec11 = jf.join(v1, v1).getValue().copy(); Vector vec15 = jf.join(v1, v5).getValue().copy(); Assert.assertTrue(vec12.getX() < 0 && vec12.getY() < 0); Assert.assertTrue(vec12.magnitude() > vec13.magnitude()); Assert.assertTrue(vec14.magnitude() > 0); Assert.assertTrue(vec11.magnitude() == 0); Assert.assertTrue(vec15.magnitude() == 0); }
@Override public Force join(LVertex first, LVertex second) { Vector force = calculateForce(first, second); firstForce.set(first.getId(), force); return firstForce; }
FRRepulsionFunction implements JoinFunction<LVertex, LVertex, Force>,
  CrossFunction<LVertex, LVertex, Force>, FlatJoinFunction<LVertex, LVertex, Force> { @Override public Force join(LVertex first, LVertex second) { Vector force = calculateForce(first, second); firstForce.set(first.getId(), force); return firstForce; } }
FRRepulsionFunction implements JoinFunction<LVertex, LVertex, Force>,
  CrossFunction<LVertex, LVertex, Force>, FlatJoinFunction<LVertex, LVertex, Force> { @Override public Force join(LVertex first, LVertex second) { Vector force = calculateForce(first, second); firstForce.set(first.getId(), force); return firstForce; } FRRepulsionFunction(double k);  FRRepulsionFunction(double k, double maxDistance); }
FRRepulsionFunction implements JoinFunction<LVertex, LVertex, Force>,
  CrossFunction<LVertex, LVertex, Force>, FlatJoinFunction<LVertex, LVertex, Force> { @Override public Force join(LVertex first, LVertex second) { Vector force = calculateForce(first, second); firstForce.set(first.getId(), force); return firstForce; } FRRepulsionFunction(double k);  FRRepulsionFunction(double k, double maxDistance); @Override Force join(LVertex first, LVertex second); @Override Force cross(LVertex vertex, LVertex vertex2); @Override void join(LVertex first, LVertex second, Collector<Force> collector); }
FRRepulsionFunction implements JoinFunction<LVertex, LVertex, Force>,
  CrossFunction<LVertex, LVertex, Force>, FlatJoinFunction<LVertex, LVertex, Force> { @Override public Force join(LVertex first, LVertex second) { Vector force = calculateForce(first, second); firstForce.set(first.getId(), force); return firstForce; } FRRepulsionFunction(double k);  FRRepulsionFunction(double k, double maxDistance); @Override Force join(LVertex first, LVertex second); @Override Force cross(LVertex vertex, LVertex vertex2); @Override void join(LVertex first, LVertex second, Collector<Force> collector);  }