public List < Integer > grouper ( List < Object > values ) { if ( GrouperType . global . equals ( groupType ) ) { // send to task which taskId is 0 return JStormUtils . mk_list ( outTasks . get ( 0 ) ) ; } else if ( GrouperType . fields . equals ( groupType ) ) { // field grouping return fieldsGrouper . grouper ( values ) ; } else if ( GrouperType . all . equals ( groupType ) ) { // send to every task return outTasks ; } else if ( GrouperType . shuffle . equals ( groupType ) ) { // random, but the random is different from none return shuffer . grouper ( values ) ; } else if ( GrouperType . none . equals ( groupType ) ) { int rnd = Math . abs ( random . nextInt ( ) % outTasks . size ( ) ) ; return JStormUtils . mk_list ( outTasks . get ( rnd ) ) ; } else if ( GrouperType . custom_obj . equals ( groupType ) ) { return customGrouper . grouper ( values ) ; } else if ( GrouperType . custom_serialized . equals ( groupType ) ) { return customGrouper . grouper ( values ) ; } else { LOG . warn ( "Unsupported group type" ) ; } return new ArrayList <> ( ) ; }
get which task should tuple be sent to