@Test public void testGetSourceAreaReturnsSameAreaAsCachedProvider() { RenderImage image = createMock(RenderImage.class); AreaProvider areaProvider = createMock(AreaProvider.class); expect(areaProvider.getSourceArea(image)).andReturn(new Box(1, 2, 3, 4)).anyTimes(); replay(areaProvider); CachedAreaProvider cachedAreaProvider = new CachedAreaProvider(areaProvider); assertEquals(cachedAreaProvider.getSourceArea(image), areaProvider.getSourceArea(image)); verify(areaProvider); }
@Nullable @Override public Box getSourceArea(@Nonnull RenderImage renderImage) { if (renderImage != m_lastProcessedImage) { m_lastProcessedImage = renderImage; m_cachedArea = m_cachedProvider.getSourceArea(renderImage); } return m_cachedArea; }
CachedAreaProvider implements AreaProvider { @Nullable @Override public Box getSourceArea(@Nonnull RenderImage renderImage) { if (renderImage != m_lastProcessedImage) { m_lastProcessedImage = renderImage; m_cachedArea = m_cachedProvider.getSourceArea(renderImage); } return m_cachedArea; } }
CachedAreaProvider implements AreaProvider { @Nullable @Override public Box getSourceArea(@Nonnull RenderImage renderImage) { if (renderImage != m_lastProcessedImage) { m_lastProcessedImage = renderImage; m_cachedArea = m_cachedProvider.getSourceArea(renderImage); } return m_cachedArea; } CachedAreaProvider(AreaProvider cachedProvider); }
CachedAreaProvider implements AreaProvider { @Nullable @Override public Box getSourceArea(@Nonnull RenderImage renderImage) { if (renderImage != m_lastProcessedImage) { m_lastProcessedImage = renderImage; m_cachedArea = m_cachedProvider.getSourceArea(renderImage); } return m_cachedArea; } CachedAreaProvider(AreaProvider cachedProvider); @Override void setParameters(String parameters); @Nullable @Override Box getSourceArea(@Nonnull RenderImage renderImage); @Nonnull @Override Size getNativeSize(@Nonnull NiftyImage image); }
CachedAreaProvider implements AreaProvider { @Nullable @Override public Box getSourceArea(@Nonnull RenderImage renderImage) { if (renderImage != m_lastProcessedImage) { m_lastProcessedImage = renderImage; m_cachedArea = m_cachedProvider.getSourceArea(renderImage); } return m_cachedArea; } CachedAreaProvider(AreaProvider cachedProvider); @Override void setParameters(String parameters); @Nullable @Override Box getSourceArea(@Nonnull RenderImage renderImage); @Nonnull @Override Size getNativeSize(@Nonnull NiftyImage image);  }