Package org.apache.ace.range

Examples of org.apache.ace.range.Range


            throws IOException {
        Long high = m_fileToID.get(new File(new File(m_dir,
                targetIDToFilename(targetID)), String.valueOf(logID))
                .getAbsolutePath());
        if (high != null) {
            Range r = new Range(1, high);
            return new LogDescriptor(targetID, logID, new SortedRangeSet(
                    r.toRepresentation()));
        }
        List<LogEvent> events = get(new LogDescriptor(targetID, logID,
                SortedRangeSet.FULL_SET));

        long[] idsArray = new long[events.size()];
View Full Code Here


    long high = 1;
    if (cursor.hasNext()) {
      DBObject row = cursor.next();
      high = (Long) row.get("id");
      return new LogDescriptor(targetID, logID, new SortedRangeSet(
          new Range(1, high).toRepresentation()));
    } else {
      return new LogDescriptor(targetID, logID, SortedRangeSet.FULL_SET);
    }
  }
View Full Code Here

import org.testng.annotations.Test;

public class SortedRangeSetTest {
    @Test(groups = { UNIT })
    public void manipulateSimpleRanges() {
        Range r1 = new Range("5");
        assert r1.getLow() == 5 : "Lowest value should be 5";
        assert r1.getHigh() == 5 : "Highest value should be 5";
        assert r1.contains(5) : "Range should contain 5";
        assert !r1.contains(4) : "Range should not contain 4";
        assert !r1.contains(6) : "Range should not contain 6";
        assert "5".equals(r1.toRepresentation()) : "Representation should be 5";
        Range r2 = new Range("2-6");
        assert r2.getLow() == 2 : "Lowest value should be 2";
        assert r2.getHigh() == 6 : "Highest value should be 6";
        assert r2.contains(6) : "Range should contain 6";
        assert !r2.contains(7) : "Range should not contain 7";
        assert !r2.contains(0) : "Range should not contain 0";
        assert "2-6".equals(r2.toRepresentation()) : "Representation should be 2-6";
        Range r3 = new Range(5);
        assert r3.getLow() == 5 : "Lowest value should be 5";
        assert r3.getHigh() == 5 : "Highest value should be 5";
        Range r4 = new Range(6,8);
        assert r4.getLow() == 6 : "Lowest value should be 6";
        assert r4.getHigh() == 8 : "Highest value should be 8";
        Range r5 = new Range(5);
        r5.setLow(8);
        assert r5.getHigh() == 8 : "Highest value should be 8";
        r5.setHigh(2);
        assert r5.getLow() == 2 : "Lowest value should be 2";
    }
View Full Code Here

        long high = 1;
        if (cursor.hasNext()) {
            DBObject row = cursor.next();
            high = (Long) row.get("id");
            return new Descriptor(targetID, logID, new SortedRangeSet(
                new Range(1, high).toRepresentation()));
        }
        else {
            return new Descriptor(targetID, logID, SortedRangeSet.FULL_SET);
        }
    }
View Full Code Here

    }

    public Descriptor getDescriptor(String targetID, long logID) throws IOException {
        Long high = m_fileToID.get(new File(new File(m_dir, targetIDToFilename(targetID)), String.valueOf(logID)).getAbsolutePath());
        if (high != null) {
            Range r = new Range(1, high);
            return new Descriptor(targetID, logID, new SortedRangeSet(r.toRepresentation()));
        }
        List<Event> events = get(new Descriptor(targetID, logID, SortedRangeSet.FULL_SET));

        long[] idsArray = new long[events.size()];
        int i = 0;
View Full Code Here

            throws IOException {
        Long high = m_fileToID.get(new File(new File(m_dir,
                gatewayIDToFilename(gatewayID)), String.valueOf(logID))
                .getAbsolutePath());
        if (high != null) {
            Range r = new Range(1, high);
            return new LogDescriptor(gatewayID, logID, new SortedRangeSet(
                    r.toRepresentation()));
        }
        List<LogEvent> events = get(new LogDescriptor(gatewayID, logID,
                SortedRangeSet.FULL_SET));

        long[] idsArray = new long[events.size()];
View Full Code Here

TOP

Related Classes of org.apache.ace.range.Range

Copyright © 2018 www.massapicom. 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.