public RRset [ ] getSectionRRsets ( int section ) { if ( sections [ section ] == null ) return emptyRRsetArray ; List sets = new LinkedList ( ) ; Record [ ] recs = getSectionArray ( section ) ; Set hash = new HashSet ( ) ; for ( int i = 0 ; i < recs . length ; i ++ ) { Name name = recs [ i ] . getName ( ) ; boolean newset = true ; if ( hash . contains ( name ) ) { for ( int j = sets . size ( ) - 1 ; j >= 0 ; j -- ) { RRset set = ( RRset ) sets . get ( j ) ; if ( set . getType ( ) == recs [ i ] . getRRsetType ( ) && set . getDClass ( ) == recs [ i ] . getDClass ( ) && set . getName ( ) . equals ( name ) ) { set . addRR ( recs [ i ] ) ; newset = false ; break ; } } } if ( newset ) { RRset set = new RRset ( recs [ i ] ) ; sets . add ( set ) ; hash . add ( name ) ; } } return ( RRset [ ] ) sets . toArray ( new RRset [ sets . size ( ) ] ) ; }
Returns an array containing all records in the given section grouped into RRsets .