public boolean isValid( final ReportElement e, final DataRow dataRow ) { if ( changeTracker != e.getChangeTracker() || styleChangeTracker != e.getStyle().getChangeTracker() || styleModificationCounter != e.getStyle().getModificationCount() ) { return false; } for ( final Map.Entry<String, Object> entry : seenFields.entrySet() ) { final String field = entry.getKey(); final Object oldValue = entry.getValue(); final Object currentValue = dataRow.get( field ); if ( ObjectUtilities.equal( oldValue, currentValue ) == false ) { return false; } } return true; }
public boolean isValid( final ReportElement e, final DataRow dataRow ) { if ( changeTracker != e.getChangeTracker() || styleChangeTracker != e.getStyle().getChangeTracker() || styleModificationCounter != e.getStyle().getModificationCount() ) { return false; } for ( final Map.Entry<String, Object> entry : fieldsAndValues.entrySet() ) { final String field = entry.getKey(); final Object oldValue = entry.getValue(); final Object currentValue = dataRow.get( field ); if ( ObjectUtilities.equal( oldValue, currentValue ) == false ) { return false; } } return true; } }
private NeedEvalResult( final boolean needToRun, final ReportElement e, final HashMap<String, Object> fieldsAndValues ) { this.needToRun = needToRun; this.changeTracker = e.getChangeTracker(); this.fieldsAndValues = fieldsAndValues; this.styleChangeTracker = e.getStyle().getChangeTracker(); this.styleModificationCounter = e.getStyle().getModificationCount(); }
private ElementMetaDataEvaluationResult( final ReportElement e, final HashMap<String, Object> seenFields ) { this.seenFields = seenFields; changeTracker = e.getChangeTracker(); styleChangeTracker = e.getStyle().getChangeTracker(); styleModificationCounter = e.getStyle().getModificationCount(); }
public void addInherited( final ElementStyleSheet sourceStyleSheet ) { super.addInherited( sourceStyleSheet ); setChangeTrackerHash( getChangeTrackerHash() * 31 + sourceStyleSheet.getChangeTrackerHash() ); setModificationCount( getModificationCount() * 31 + sourceStyleSheet.getModificationCount() ); }
public StyleResolverCacheEntry( final StyleResolverCacheEntry parentEntry, final ReportElement e ) { if ( parentEntry == null ) { this.elementChangeTracker = e.getChangeTracker(); this.styleChangeHash = e.getStyle().getChangeTrackerHash(); this.styleModificationCount = e.getStyle().getModificationCount(); } else { this.elementChangeTracker = parentEntry.getElementChangeTracker() * 31 + e.getChangeTracker(); this.styleChangeHash = parentEntry.getStyleChangeHash() * 31 + e.getStyle().getChangeTrackerHash(); this.styleModificationCount = parentEntry.getStyleModificationCount() * 31 + e.getStyle().getModificationCount(); } }
public void addDefault( final ElementStyleSheet sourceStyleSheet ) { super.addDefault( sourceStyleSheet ); setChangeTrackerHash( getChangeTrackerHash() * 31 + sourceStyleSheet.getChangeTrackerHash() ); setModificationCount( getModificationCount() * 31 + sourceStyleSheet.getModificationCount() ); }
public void addAll( final ElementStyleSheet sourceStyleSheet ) { super.addAll( sourceStyleSheet ); setChangeTrackerHash( getChangeTrackerHash() * 31 + sourceStyleSheet.getChangeTrackerHash() ); setModificationCount( getModificationCount() * 31 + sourceStyleSheet.getModificationCount() ); }
@Test public void copyFrom_OnChangedSheet() { List<StyleKey> keys = StyleKey.getDefinedStyleKeysList(); ElementStyleSheet sheet = new ElementStyleSheet(); setEverySecondKey( sheet, keys ); ElementStyleSheet another = new ElementStyleSheet(); another.copyFrom( sheet ); assertEquals( sheet.getModificationCount(), another.getModificationCount() ); assertEquals( sheet.getChangeTrackerHash(), another.getChangeTrackerHash() ); assertEverySecondKey( another, keys ); for ( int i = 0; i < keys.size(); i += 2 ) { StyleKey key = keys.get( i ); assertTrue( another.isLocalKey( key ) ); } }
@Test public void clearsCorrectly() { List<StyleKey> keys = StyleKey.getDefinedStyleKeysList(); ElementStyleSheet sheet = new ElementStyleSheet(); setEverySecondKey( sheet, keys ); sheet.clear(); assertEquals( 0, sheet.getModificationCount() ); assertEquals( 0, sheet.getChangeTrackerHash() ); for ( int i = 0; i < keys.size(); i += 2 ) { StyleKey key = keys.get( i ); Object property = sheet.getStyleProperty( key ); assertNull( property ); } }
@Test public void copyFrom_OnIntactSheet_SameAsClearing() { List<StyleKey> keys = StyleKey.getDefinedStyleKeysList(); ElementStyleSheet sheet = new ElementStyleSheet(); setEverySecondKey( sheet, keys ); sheet.copyFrom( new ElementStyleSheet() ); assertEquals( 0, sheet.getModificationCount() ); assertEquals( 0, sheet.getChangeTrackerHash() ); for ( int i = 0; i < keys.size(); i += 2 ) { StyleKey key = keys.get( i ); Object property = sheet.getStyleProperty( key ); assertNull( property ); } }