@Test public void addsNoFilterWhenTheFacetIsNotPresent() { GraphTraversal<Vertex, Vertex> traversal = makeGraph( new YearSpan("too_soon", 1800, 1850), new YearSpan("too_late", 2000, 2050), new YearSpan("just_right", 1900, 1950) ); List<FacetValue> facetValues = Lists.newArrayList(); instance.filter(traversal, facetValues); assertThat(traversal.toList(), containsInAnyOrder( likeVertex().withTimId("too_soon"), likeVertex().withTimId("too_late"), likeVertex().withTimId("just_right") )); }
@Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { final Optional<DateRangeFacetValue> facetOrEmpty = FacetParsingHelp.getValue(facetName, facets); facetOrEmpty.ifPresent(facet -> { long begin; long end; if (facet.getUpperLimit() >= facet.getLowerLimit()) { begin = facet.getLowerLimit(); end = facet.getUpperLimit(); } else { end = facet.getLowerLimit(); begin = facet.getUpperLimit(); } graphTraversal .has(beginYear) .has(endYear) .filter(filterYear(year -> { return year <= end; }, beginYear)) .filter(filterYear(year -> { return year >= begin; }, endYear)); }); }
DutchCaribbeanArchiveAndArchiverPeriodFacetDescription implements FacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { final Optional<DateRangeFacetValue> facetOrEmpty = FacetParsingHelp.getValue(facetName, facets); facetOrEmpty.ifPresent(facet -> { long begin; long end; if (facet.getUpperLimit() >= facet.getLowerLimit()) { begin = facet.getLowerLimit(); end = facet.getUpperLimit(); } else { end = facet.getLowerLimit(); begin = facet.getUpperLimit(); } graphTraversal .has(beginYear) .has(endYear) .filter(filterYear(year -> { return year <= end; }, beginYear)) .filter(filterYear(year -> { return year >= begin; }, endYear)); }); } }
DutchCaribbeanArchiveAndArchiverPeriodFacetDescription implements FacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { final Optional<DateRangeFacetValue> facetOrEmpty = FacetParsingHelp.getValue(facetName, facets); facetOrEmpty.ifPresent(facet -> { long begin; long end; if (facet.getUpperLimit() >= facet.getLowerLimit()) { begin = facet.getLowerLimit(); end = facet.getUpperLimit(); } else { end = facet.getLowerLimit(); begin = facet.getUpperLimit(); } graphTraversal .has(beginYear) .has(endYear) .filter(filterYear(year -> { return year <= end; }, beginYear)) .filter(filterYear(year -> { return year >= begin; }, endYear)); }); } DutchCaribbeanArchiveAndArchiverPeriodFacetDescription(String facetName, String beginYear, String endYear);   DutchCaribbeanArchiveAndArchiverPeriodFacetDescription(String facetName, String beginYear, String endYear,
                                                         FacetGetter facetGetter); }
DutchCaribbeanArchiveAndArchiverPeriodFacetDescription implements FacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { final Optional<DateRangeFacetValue> facetOrEmpty = FacetParsingHelp.getValue(facetName, facets); facetOrEmpty.ifPresent(facet -> { long begin; long end; if (facet.getUpperLimit() >= facet.getLowerLimit()) { begin = facet.getLowerLimit(); end = facet.getUpperLimit(); } else { end = facet.getLowerLimit(); begin = facet.getUpperLimit(); } graphTraversal .has(beginYear) .has(endYear) .filter(filterYear(year -> { return year <= end; }, beginYear)) .filter(filterYear(year -> { return year >= begin; }, endYear)); }); } DutchCaribbeanArchiveAndArchiverPeriodFacetDescription(String facetName, String beginYear, String endYear);   DutchCaribbeanArchiveAndArchiverPeriodFacetDescription(String facetName, String beginYear, String endYear,
                                                         FacetGetter facetGetter); @Override String getName(); @Override Facet getFacet(Map<String, Set<Vertex>> values); @Override void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets); @Override List<String> getValues(Vertex vertex); }
DutchCaribbeanArchiveAndArchiverPeriodFacetDescription implements FacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { final Optional<DateRangeFacetValue> facetOrEmpty = FacetParsingHelp.getValue(facetName, facets); facetOrEmpty.ifPresent(facet -> { long begin; long end; if (facet.getUpperLimit() >= facet.getLowerLimit()) { begin = facet.getLowerLimit(); end = facet.getUpperLimit(); } else { end = facet.getLowerLimit(); begin = facet.getUpperLimit(); } graphTraversal .has(beginYear) .has(endYear) .filter(filterYear(year -> { return year <= end; }, beginYear)) .filter(filterYear(year -> { return year >= begin; }, endYear)); }); } DutchCaribbeanArchiveAndArchiverPeriodFacetDescription(String facetName, String beginYear, String endYear);   DutchCaribbeanArchiveAndArchiverPeriodFacetDescription(String facetName, String beginYear, String endYear,
                                                         FacetGetter facetGetter); @Override String getName(); @Override Facet getFacet(Map<String, Set<Vertex>> values); @Override void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets); @Override List<String> getValues(Vertex vertex);  }