public synchronized void addRR ( Record r ) { if ( rrs . size ( ) == 0 ) { safeAddRR ( r ) ; return ; } Record first = first ( ) ; if ( ! r . sameRRset ( first ) ) throw new IllegalArgumentException ( "record does not match " + "rrset" ) ; if ( r . getTTL ( ) != first . getTTL ( ) ) { if ( r . getTTL ( ) > first . getTTL ( ) ) { r = r . cloneRecord ( ) ; r . setTTL ( first . getTTL ( ) ) ; } else { for ( int i = 0 ; i < rrs . size ( ) ; i ++ ) { Record tmp = ( Record ) rrs . get ( i ) ; tmp = tmp . cloneRecord ( ) ; tmp . setTTL ( r . getTTL ( ) ) ; rrs . set ( i , tmp ) ; } } } if ( ! rrs . contains ( r ) ) safeAddRR ( r ) ; }
Adds a Record to an RRset