InterestData { public synchronized InterestData splitLeft(int count) { InterestData left = new InterestData(_name, _startTime, _stopTime); if( count > 0 ) transferLeft(left, count); return left; } InterestData(ContentName basename);  InterestData(ContentName basename, VersionNumber startTime);  InterestData(ContentName basename, VersionNumber startTime, VersionNumber stopTime); synchronized int size(); @Override synchronized boolean equals(Object obj); @Override synchronized int hashCode(); synchronized void setStartTime(VersionNumber startTime); synchronized void setStopTime(VersionNumber stopTime); synchronized boolean addExclude(VersionNumber version); synchronized Interest buildInterest(); Interest getLastInterest(); synchronized boolean contains(VersionNumber version); String toString(); String dumpContents(); synchronized InterestData splitLeft(int count); synchronized InterestData splitRight(int count); void transferLeft(InterestData left, int count); void transferRight(InterestData right, int count); synchronized VersionNumber getStartVersion(); synchronized VersionNumber getStopVersion(); synchronized long getWidth(); synchronized double getDensity(); synchronized boolean validate();  }
@Test public void testSplitLeft() throws Exception { Log.info(Log.FAC_TEST, "Started testSplitLeft"); ContentName basename = new ContentName(prefix, String.format("content_%016X", _rnd.nextLong())); VersionNumber starttime = new VersionNumber(); VersionNumber stoptime = null; int count = VersioningInterestManager.MAX_FILL; InterestData data = new InterestData(basename, starttime, VersionNumber.getMaximumVersion()); VersionNumber t = starttime; for(int i = 0; i < count; i++) { long walk = _rnd.nextInt(100000) * 1000000L + 1000000L; t = t.addAndReturn(walk); data.addExclude(t); stoptime = t.addAndReturn(100); data.setStopTime(stoptime); } InterestData left = data.splitLeft(data.size() - VersioningInterestManager.MIN_FILL); Assert.assertTrue(left.getStartVersion().equals(starttime)); Assert.assertTrue(data.getStopVersion().equals(stoptime)); Assert.assertEquals(VersioningInterestManager.MIN_FILL, data.size()); Assert.assertEquals(count - VersioningInterestManager.MIN_FILL, left.size()); Assert.assertTrue(left.getStopVersion().addAndReturn(1).equals(data.getStartVersion())); Assert.assertTrue(left.validate()); Assert.assertTrue(data.validate()); Log.info(Log.FAC_TEST, "Completed testSplitLeft"); }