215 **r e t u r n** setFuser ( bbaTab , theRefereeFunction ) ;
216 } 217 218 **p u b l i c b o o l e an** setFuser ( ArrayList <sB> bbaIn , 219 RefereeFunctionDefault <Prop> aRefereeFunction ) { 220 **i n t** i ;
221 theRefereeFunction=aRefereeFunction ;
222 fuserSources=bbaIn ; 223 BBASources . clear **( ) ;**
224 f o r ( i=0;i<fuserSources . size ( ) ; i++) BBASources . add ( fuserSources . get ( i **) ) ;**
225 226 f o r ( i=0;i<bbaIn . size ( ) ; i**++) {** 227 i f ( ! bbaIn . get ( i ) . setTables_sampler ( ) ) **r e t u r n f a l s e** ;
228 }
229 answeredAttribute**=new** ArrayList <Assignment <Prop **>>() ;** 230 f o r ( i=0;i<bbaIn . size ( ) ; i++) answeredAttribute . add ( n u l l ) ;
231 **r e t u r n t r u e** ; 232 }
233 234 **p u b l i c** Assignment <Prop> makeFusedSample **( ) {**
235 Assignment <Prop> assignment = new Assignment <Prop **>() ;**
236 Assignment <Prop> assignmentFromSource ; 237 ArrayList <Assignment <Prop>> fusedAssignment ;
238 **i n t** i ;
239 **d oub l e** cumul **= 0 . ;**
240 **d oub l e** x=rng . nextDouble **( ) ;** 241 assignment . value **= 1 . ;**
242 f o r ( i=0;i<fuserSources . size ( ) ; i**++) {**
243 sB aSource=fuserSources . get ( i ) ;
244 assignmentFromSource=aSource . mappedAttribute . get ( aSource .←֓
drawTable_sampler **( ) ) ;**
245 answeredAttribute . set ( i , assignmentFromSource ) ;
246 }
247 fusedAssignment=theRefereeFunction . refereeFunction ( answeredAttribute , ←֓
BBASources ) ;
248 f o r ( i=0;i<fusedAssignment . size ( ) ; i**++) {**
249 cumul+=fusedAssignment . get ( i ) . value ; 250 i f ( cumul>x ) {
251 assignment . attribute=fusedAssignment . get ( i ) . attribute ;
252 **r e t u r n** assignment ;
253 } 254 }
255 **r e t u r n n u l l** ;
256 }
257 258 **p u b l i c b o o l e an** setMixer ( d oub l e [ ] weights , ArrayList <sB> bbaIn ) {
259 i f ( weights . length != bbaIn . size ( ) ) **r e t u r n f a l s e** ;
260 mixerSources=bbaIn ;
261 **r e t u r n** setTables_mixer ( weights ) ;
262 } 263 264 **p u b l i c** sB makeMixedChoice **( ) {**
265 i f ( c u m u l a t i v e D ist ri bu tio n_ Mix er==n u l l ) **r e t u r n n u l l** ;
266 **i n t** choice = drawTable_mixer **( ) ;** 267 **r e t u r n** mixerSources . get ( choice ) ;
268 }
269 }