@Test public void testRepulseFlatJoin() throws Exception { FRRepulsionFunction jf = new FRRepulsionFunction(1); LVertex v1 = getDummyVertex(1, 1); LVertex v2 = getDummyVertex(2, 3); Vector vec12join = jf.join(v1, v2).getValue().copy(); v1 = getDummyVertex(1, 1); v2 = getDummyVertex(2, 3); List<Force> collectorList = new ArrayList<>(); ListCollector<Force> collector = new ListCollector<>(collectorList); jf.join(v1, v2, collector); Vector vec12 = collectorList.get(0).getValue().copy(); Vector vec21 = collectorList.get(1).getValue().copy(); v1 = getDummyVertex(1, 1); v2 = getDummyVertex(2, 3); v1.setSubVertices(generateSubVertices(1)); v2.setSubVertices(generateSubVertices(2)); Vector vec12joinf6 = jf.join(v1, v2).getValue().copy(); Assert.assertEquals(vec12join, vec12); Assert.assertEquals(vec12, vec21.mul(-1)); Assert.assertNotEquals(collectorList.get(0).getId(), collectorList.get(1).getId()); Assert.assertEquals(vec12join.mul(6), vec12joinf6); }
@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);  }