Examples of LongRange


Examples of org.apache.commons.lang.math.LongRange

  public void setFinishRange(long begin, long end) {
    if (begin > end) {
      throw new IllegalArgumentException("begin > end in range (begin, " +
          "end): (" + begin + ", " + end + ")");
    }
    this.finish = new LongRange(begin, end);
  }
View Full Code Here

Examples of org.apache.commons.lang.math.LongRange

   
    Date included = DATE_FORMATTER.parse("04.04.2012 19:00:00:000");
    Date excluded_before = DATE_FORMATTER.parse("04.04.2012 15:59:59:999");
    Date excluded_after = DATE_FORMATTER.parse("04.04.2012 19:15:00:001");
   
    LongRange timeRange = new LongRange(startTime.getTime(), endTime.getTime());
    calendar.addTimeRange(timeRange);
   
    Assert.assertEquals(true, calendar.isTimeIncluded(included.getTime()));
    Assert.assertEquals(false, calendar.isTimeIncluded(excluded_before.getTime()));
    Assert.assertEquals(false, calendar.isTimeIncluded(excluded_after.getTime()));
View Full Code Here

Examples of org.apache.commons.lang.math.LongRange

    Date endTime = DATE_FORMATTER.parse("04.04.2012 19:15:00:000");
   
    Date included = DATE_FORMATTER.parse("04.04.2012 17:23:21:000");
    Date expected = DATE_FORMATTER.parse("04.04.2012 19:15:00:001");
   
    LongRange timeRange = new LongRange(startTime.getTime(), endTime.getTime());
    calendar.addTimeRange(timeRange);
   
    Assert.assertEquals(expected.getTime(), calendar.getNextIncludedTime(included.getTime()));
  }
View Full Code Here

Examples of org.apache.commons.lang.math.LongRange

  @Test
  public void testAddRemoveExcludedDate() throws ParseException {
    Date startTime = DATE_FORMATTER.parse("04.04.2012 16:00:00:000");
    Date endTime = DATE_FORMATTER.parse("04.04.2012 19:15:00:000");
   
    LongRange timeRange_1 = new LongRange(startTime.getTime(), endTime.getTime());
    LongRange timeRange_2 = new LongRange(startTime.getTime(), endTime.getTime());
   
    calendar.addTimeRange(timeRange_2);
    calendar.addTimeRange(timeRange_1);
   
    Assert.assertEquals(2, calendar.getExcludedRanges().size());
View Full Code Here

Examples of org.apache.commons.lang.math.LongRange

        if (!calendarCache.containsKey(eventTitle)) {
          calendarCache.put(eventTitle, new TimeRangeCalendar());
        }
        TimeRangeCalendar timeRangeCalendar = calendarCache.get(eventTitle);
          for (When when : event.getTimes()) {
            timeRangeCalendar.addTimeRange(new LongRange(when.getStartTime().getValue(), when.getEndTime().getValue()));
          }
      }
    }
   
    // add all calendars to the Scheduler an rebase all existing Triggers
View Full Code Here

Examples of org.apache.commons.lang.math.LongRange

     */
    public long getNextIncludedTime(long timeStamp) {
       long nextIncludedTime = timeStamp + ONE_MILLI;
       
        while (isTimeIncluded(nextIncludedTime)) {
          LongRange timeRange = findTimeRange(timeStamp);
            if (nextIncludedTime >= timeRange.getMinimumLong() &&
                nextIncludedTime <= timeRange.getMaximumLong()) {
               
                nextIncludedTime = timeRange.getMaximumLong() + ONE_MILLI;
            } else if ((getBaseCalendar() != null) && (!getBaseCalendar().isTimeIncluded(nextIncludedTime))){
                nextIncludedTime = getBaseCalendar().getNextIncludedTime(nextIncludedTime);
            } else {
                nextIncludedTime++;
            }
View Full Code Here

Examples of org.apache.lucene.facet.range.LongRange

      fail("should not have succeeded to execute a request over a category which wasn't indexed as SortedSetDVField");
    } catch (IllegalArgumentException e) {
      // expected
    }

    RangeAccumulator ra = new RangeAccumulator(new RangeFacetRequest<LongRange>("f", new LongRange("grr", 0, true, 1, true)));
    FacetsCollector fc = FacetsCollector.create(ra);
    searcher.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> facetResults = fc.getFacetResults();
    assertNotNull(facetResults);
    assertEquals("incorrect label returned for RangeAccumulator", new CategoryPath("f"), facetResults.get(0).getFacetResultNode().label);
View Full Code Here

Examples of org.apache.lucene.facet.range.LongRange

  /** User runs a query and counts facets. */
  public List<FacetResult> search() throws IOException {

    RangeFacetRequest<LongRange> rangeFacetRequest = new RangeFacetRequest<LongRange>("timestamp",
                                     new LongRange("Past hour", nowSec-3600, true, nowSec, true),
                                     new LongRange("Past six hours", nowSec-6*3600, true, nowSec, true),
                                     new LongRange("Past day", nowSec-24*3600, true, nowSec, true));
    // Aggregatses the facet counts
    FacetsCollector fc = FacetsCollector.create(new RangeAccumulator(rangeFacetRequest));

    // MatchAllDocsQuery is for "browsing" (counts facets
    // for all non-deleted docs in the index); normally
View Full Code Here

Examples of org.apache.lucene.facet.range.LongRange

      fail("should not have succeeded to execute a request over a category which wasn't indexed as SortedSetDVField");
    } catch (IllegalArgumentException e) {
      // expected
    }

    RangeAccumulator ra = new RangeAccumulator(new RangeFacetRequest<LongRange>("f", new LongRange("grr", 0, true, 1, true)));
    FacetsCollector fc = FacetsCollector.create(ra);
    searcher.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> facetResults = fc.getFacetResults();
    assertNotNull(facetResults);
    assertEquals("incorrect label returned for RangeAccumulator", new CategoryPath("f"), facetResults.get(0).getFacetResultNode().label);
View Full Code Here

Examples of org.apache.lucene.facet.range.LongRange

      fail("should not have succeeded to execute a request over a category which wasn't indexed as SortedSetDVField");
    } catch (IllegalArgumentException e) {
      // expected
    }

    fsp = new FacetSearchParams(new RangeFacetRequest<LongRange>("f", new LongRange("grr", 0, true, 1, true)));
    RangeAccumulator ra = new RangeAccumulator(fsp, indexReader);
    FacetsCollector fc = FacetsCollector.create(ra);
    searcher.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> facetResults = fc.getFacetResults();
    assertNotNull(facetResults);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.