public long getOrphanValue() { if ( orphans == 0 ) { return orphanOverride; } final RenderNode lastValue = orphanSize.getLastValue(); if ( lastValue == null ) { return orphanOverride; } return Math.max( orphanOverride, lastValue.getCachedY2() ); }
private long getWidowValue() { if ( widows == 0 ) { return widowOverride; } final RenderNode box = widowSize.getLastValue(); if ( box == null ) { return widowOverride; } final long y2 = box.getCachedY2() - box.getCachedHeight(); return Math.min( widowOverride, y2 ); }
public void testReplace() { final RingBuffer<Integer> tc = new RingBuffer<Integer>( 3 ); tc.add( 10 ); tc.add( 20 ); tc.add( 30 ); assertEquals( 30, (int) tc.getLastValue() ); assertEquals( 10, (int) tc.getFirstValue() ); tc.replaceLastAdded( 40 ); assertEquals( 40, (int) tc.getLastValue() ); assertEquals( 10, (int) tc.getFirstValue() ); tc.add( 50 ); assertEquals( 50, (int) tc.getLastValue() ); assertEquals( 20, (int) tc.getFirstValue() ); }
public void testReplaceFirst() { final RingBuffer<Integer> tc = new RingBuffer<Integer>( 3 ); tc.replaceLastAdded( 10 ); assertEquals( 10, (int) tc.getFirstValue() ); assertEquals( 10, (int) tc.getLastValue() ); tc.add( 10 ); tc.add( 20 ); tc.add( 30 ); tc.add( 40 ); assertEquals( 40, (int) tc.getLastValue() ); assertEquals( 20, (int) tc.getFirstValue() ); }
public void testAdding2() { final RingBuffer<Integer> tc = new RingBuffer<Integer>( 3 ); tc.add( 10 ); tc.add( 20 ); tc.add( 30 ); assertEquals( 30, (int) tc.getLastValue() ); assertEquals( 10, (int) tc.getFirstValue() ); }
public void testAdding() { final RingBuffer<Integer> tc = new RingBuffer<Integer>( 3 ); tc.add( 10 ); tc.add( 20 ); tc.add( 30 ); tc.add( 40 ); assertEquals( 40, (int) tc.getLastValue() ); assertEquals( 20, (int) tc.getFirstValue() ); }