Examples of NumericRange


Examples of mil.nga.giat.geowave.index.sfc.data.NumericRange

    // full extent and the middle one being full extent
    endCal.setTimeInMillis(time + (TemporalBinningStrategy.MILLIS_PER_DAY * 2));
    final TemporalBinningStrategy binStrategy = new TemporalBinningStrategy(
        Unit.DAY);

    BinRange[] ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        endCal.getTimeInMillis()));
    Assert.assertEquals(
        3,
        ranges.length);

    Assert.assertTrue(!ranges[0].isFullExtent());

    Assert.assertTrue(ranges[1].isFullExtent());

    Assert.assertTrue(!ranges[2].isFullExtent());

    final Calendar startCalOnEpoch = Calendar.getInstance();

    startCalOnEpoch.setTimeInMillis(time);
    binStrategy.setToEpoch(startCalOnEpoch);

    ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCalOnEpoch.getTimeInMillis(),
        endCal.getTimeInMillis()));
    Assert.assertEquals(
        3,
        ranges.length);
    // now the first element should be full extent
    Assert.assertTrue(ranges[0].isFullExtent());

    Assert.assertTrue(ranges[1].isFullExtent());

    Assert.assertTrue(!ranges[2].isFullExtent());

    final Calendar endCalOnMax = Calendar.getInstance();
    // theoretically should get 3 bins back the first and last not having
    // full extent and the middle one being full extent
    endCalOnMax.setTimeInMillis(time + (TemporalBinningStrategy.MILLIS_PER_DAY * 3));
    binStrategy.setToEpoch(endCalOnMax);
    endCalOnMax.add(
        Calendar.MILLISECOND,
        -1);
    ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        endCalOnMax.getTimeInMillis()));
    Assert.assertEquals(
        3,
        ranges.length);
View Full Code Here

Examples of mil.nga.giat.geowave.index.sfc.data.NumericRange

    endCal.setTimeInMillis(time);
    endCal.set(
        Calendar.MONTH,
        0);// make sure its a month after one with 31 days
    binStrategy.setToEpoch(endCal);
    final BinRange[] ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis() - 1,
        endCal.getTimeInMillis()));

    Assert.assertEquals(
        2,
View Full Code Here

Examples of mil.nga.giat.geowave.index.sfc.data.NumericRange

  @Test
  public void testStartAndEndEqual() {
    final long time = 123987564019283L;
    final TemporalBinningStrategy binStrategy = new TemporalBinningStrategy(
        Unit.YEAR);
    final BinRange[] ranges = binStrategy.getNormalizedRanges(new NumericRange(
        time,
        time));

    Assert.assertEquals(
        1,
View Full Code Here

Examples of mil.nga.giat.geowave.index.sfc.data.NumericRange

        1);
    // test the day boundaries first - going from feb28 to march 1 should
    // give 2 bins
    TemporalBinningStrategy binStrategy = new TemporalBinningStrategy(
        Unit.DAY);
    BinRange[] ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        endCal.getTimeInMillis()));

    Assert.assertEquals(
        2,
        ranges.length);

    // now test the month boundaries - adding a day to feb28 for the end
    // time should give 2 bins
    binStrategy = new TemporalBinningStrategy(
        Unit.MONTH);
    ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        startCal.getTimeInMillis() + (TemporalBinningStrategy.MILLIS_PER_DAY)));

    Assert.assertEquals(
        2,
View Full Code Here

Examples of mil.nga.giat.geowave.index.sfc.data.NumericRange

        1);
    // test the day boundaries first - going from feb28 to march 1 should
    // give 3 bins
    TemporalBinningStrategy binStrategy = new TemporalBinningStrategy(
        Unit.DAY);
    BinRange[] ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        endCal.getTimeInMillis()));

    Assert.assertEquals(
        3,
        ranges.length);

    // now test the month boundaries - adding a day to feb28 for the end
    // time should give 1 bin, adding 2 days should give 2 bins
    binStrategy = new TemporalBinningStrategy(
        Unit.MONTH);
    ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        startCal.getTimeInMillis() + (TemporalBinningStrategy.MILLIS_PER_DAY)));

    Assert.assertEquals(
        1,
        ranges.length);
    // add 2 days and now we should end up with 2 bins
    ranges = binStrategy.getNormalizedRanges(new NumericRange(
        startCal.getTimeInMillis(),
        startCal.getTimeInMillis() + (TemporalBinningStrategy.MILLIS_PER_DAY * 2)));

    Assert.assertEquals(
        2,
 
View Full Code Here

Examples of org.apache.james.mailbox.SearchQuery.NumericRange

     * @throws UnsupportedSearchException
     */
    private Query createUidQuery(SearchQuery.UidCriterion crit) throws UnsupportedSearchException {
        NumericRange[] ranges = crit.getOperator().getRange();
        if (ranges.length == 1) {
            NumericRange range = ranges[0];
            return NumericRangeQuery.newLongRange(UID_FIELD, range.getLowValue(), range.getHighValue(), true, true);
        } else {
            BooleanQuery rangesQuery = new BooleanQuery();
            for (int i = 0; i < ranges.length; i++) {
                NumericRange range = ranges[i];
                rangesQuery.add(NumericRangeQuery.newLongRange(UID_FIELD, range.getLowValue(), range.getHighValue(), true, true), BooleanClause.Occur.SHOULD);
            }       
            return rangesQuery;
        }
    }
View Full Code Here

Examples of org.apache.james.mailbox.SearchQuery.NumericRange

           
            List<MessageRange> ranges = MessageRange.toRanges(new ArrayList<Long>(uids));
            NumericRange[] nRanges = new NumericRange[ranges.size()];
            for (int i = 0; i < ranges.size(); i++) {
                MessageRange range = ranges.get(i);
                nRanges[i] = new NumericRange(range.getUidFrom(), range.getUidTo());
            }
            return createUidQuery((UidCriterion) SearchQuery.uid(nRanges));
        } catch (IOException e) {
            throw new MailboxException("Unable to search mailbox " + mailbox, e);
        } finally {
View Full Code Here

Examples of org.apache.james.mailbox.SearchQuery.NumericRange

        if (crits.size() == && crits.get(0) instanceof UidCriterion) {
            final List<Long> uids = new ArrayList<Long>();
            UidCriterion uidCrit = (UidCriterion) crits.get(0);
            NumericRange[] ranges = uidCrit.getOperator().getRange();
            for (int i = 0; i < ranges.length; i++) {
                NumericRange r = ranges[i];
                mapper.findInMailbox(mailbox, MessageRange.range(r.getLowValue(), r.getHighValue()), FetchType.Metadata, new MessageCallback<Id>() {

                    public void onMessages(List<Message<Id>> list) throws MailboxException {
                        for (int i = 0; i < list.size(); i++) {
                            long uid = list.get(i).getUid();
                            if (uids.contains(uid) == false) {
View Full Code Here

Examples of org.apache.james.mailbox.SearchQuery.NumericRange

        final NumericRange[] ranges = operator.getRange();
        final long uid = message.getUid();
        final int length = ranges.length;
        boolean result = false;
        for (int i = 0; i < length; i++) {
            final NumericRange numericRange = ranges[i];
            if (numericRange.isIn(uid)) {
                result = true;
                break;
            }
        }
        return result;
View Full Code Here

Examples of org.apache.james.mailbox.SearchQuery.NumericRange

        final NumericRange[] ranges = operator.getRange();
        final long uid = message.getUid();
        final int length = ranges.length;
        boolean result = false;
        for (int i = 0; i < length; i++) {
            final NumericRange numericRange = ranges[i];
            if (numericRange.isIn(uid)) {
                result = true;
                break;
            }
        }
        return result;
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.