jersey.repackaged.com.google.common.collect.Lists Java Examples

The following examples show how to use jersey.repackaged.com.google.common.collect.Lists. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CharacteristicsCriteriaScorer.java    From ServiceCutter with Apache License 2.0 6 votes vote down vote up
@Override
public Map<EntityPair, Double> getScores(final Set<CouplingInstance> instances) {
	Map<EntityPair, Double> resultPerCC = new HashMap<>();
	// compare all characteristics with each other
	List<CouplingInstance> characteristics = Lists.newArrayList(instances);

	for (int i = 0; i < characteristics.size() - 1; i++) {
		for (int j = i + 1; j < characteristics.size(); j++) {
			// for all nanoentities in two different characteristics,
			// calculate the distance
			CouplingInstance characteristicI = characteristics.get(i);
			CouplingInstance characteristicJ = characteristics.get(j);
			for (Nanoentity nanoentityFromI : characteristicI.getAllNanoentities()) {
				for (Nanoentity nanoentityFromJ : characteristicJ.getAllNanoentities()) {
					int distance = Math.abs(characteristicI.getCharacteristic().getWeight() - characteristicJ.getCharacteristic().getWeight());
					if (distance != 0) {
						resultPerCC.put(new EntityPair(nanoentityFromI, nanoentityFromJ), distance * -1d);
					}

				}
			}
		}
	}
	return resultPerCC;
}
 
Example #2
Source File: GraphApiTest.java    From SciGraph with Apache License 2.0 5 votes vote down vote up
@Test
public void getReachableNodes_areReturned() {
  Graph graph = graphApi.getReachableNodes(b,
      Lists.newArrayList(OwlRelationships.RDFS_SUBCLASS_OF.name()), Sets.newHashSet());
  assertThat(size(graph.getVertices()), is(1));
  assertThat(size(graph.getEdges()), is(0));
  graph = graphApi.getReachableNodes(c,
      Lists.newArrayList(OwlRelationships.OWL_EQUIVALENT_CLASS.name(),
          OwlRelationships.RDFS_SUBCLASS_OF.name()),
      Sets.newHashSet());
  assertThat(size(graph.getVertices()), is(1));
  assertThat(size(graph.getEdges()), is(0));
}
 
Example #3
Source File: GraphApiTest.java    From SciGraph with Apache License 2.0 5 votes vote down vote up
@Test
public void getReachableNodes_nothingReturnedForFakeLabel() {
  Graph graph = graphApi.getReachableNodes(c,
      Lists.newArrayList(OwlRelationships.OWL_EQUIVALENT_CLASS.name(),
          OwlRelationships.RDFS_SUBCLASS_OF.name()),
      Sets.newHashSet("fakeLabel"));
  assertThat(size(graph.getVertices()), is(0));
  assertThat(size(graph.getEdges()), is(0));
}
 
Example #4
Source File: ListSlicerTest.java    From rest-schemagen with Apache License 2.0 4 votes vote down vote up
@Test
public void testSubList() {
    List<Integer> actual = ListSlicer.withInterval(1, DEFAULT_LIMIT).create(3, 2).createSliceOf(list).members;
    assertThat(actual).isEqualTo(Lists.newArrayList(4,5));
}
 
Example #5
Source File: ListSlicerTest.java    From rest-schemagen with Apache License 2.0 4 votes vote down vote up
@Test
public void testSubList_CheckMinLimit() {
    List<Integer> actual = ListSlicer.withInterval(3, 100).create(3, 2).createSliceOf(list).members;
    assertThat(actual).isEqualTo(Lists.newArrayList(4, 5, 6));
}
 
Example #6
Source File: ListSlicerTest.java    From rest-schemagen with Apache License 2.0 4 votes vote down vote up
@Test
public void testSubList_CheckMaxLimit() {
    List<Integer> actual = ListSlicer.withInterval(1, 3).create(3, 5).createSliceOf(list).members;
    assertThat(actual).isEqualTo(Lists.newArrayList(4, 5, 6));
}
 
Example #7
Source File: ListSlicerTest.java    From rest-schemagen with Apache License 2.0 4 votes vote down vote up
@Test
public void testSubList_CheckDefaultLimit() {
    List<Integer> actual = ListSlicer.withInterval(1, 3).create(3, null).createSliceOf(list).members;
    assertThat(actual).isEqualTo(Lists.newArrayList(4, 5, 6));
}
 
Example #8
Source File: ListSlicerTest.java    From rest-schemagen with Apache License 2.0 4 votes vote down vote up
@Test
public void testSubList_CheckDefaultOffset() {
    List<Integer> actual = ListSlicer.withDefaultInterval().create(null, 5).createSliceOf(list).members;
    assertThat(actual).isEqualTo(Lists.newArrayList(1, 2, 3, 4, 5));
}
 
Example #9
Source File: GraphApiTest.java    From SciGraph with Apache License 2.0 4 votes vote down vote up
@Test
public void getReachableNodes_traverseAllRels() {
  Graph graph = graphApi.getReachableNodes(c, Lists.newArrayList(), Sets.newHashSet());
  assertThat(size(graph.getVertices()), is(1));
  assertThat(size(graph.getEdges()), is(0));
}
 
Example #10
Source File: GraphApiTest.java    From SciGraph with Apache License 2.0 4 votes vote down vote up
@Test
public void getReachableNodes_fetchesAll() {
  Graph graph = graphApi.getReachableNodes(c, Lists.newArrayList("*"), Sets.newHashSet());
  assertThat(size(graph.getVertices()), is(2));
  assertThat(size(graph.getEdges()), is(0));
}
 
Example #11
Source File: GraphApiTest.java    From SciGraph with Apache License 2.0 4 votes vote down vote up
@Test
public void getReachableNodes_filtersCorrectly() {
  Graph graph = graphApi.getReachableNodes(c, Lists.newArrayList("*"), Sets.newHashSet("alabel"));
  assertThat(size(graph.getVertices()), is(1));
  assertThat(size(graph.getEdges()), is(0));
}