private void weighItems(List<? extends PlaidItem> items){
  if (items == null || items.isEmpty())   return;
  PlaidItemSorting.PlaidItemGroupWeigher weigher=null;
switch (items.get(0).dataSource) {
case SourceManager.SOURCE_DRIBBBLE_USER_SHOTS:
case SourceManager.SOURCE_DRIBBBLE_USER_LIKES:
case SourceManager.SOURCE_PRODUCT_HUNT:
case PlayerShotsDataManager.SOURCE_PLAYER_SHOTS:
case PlayerShotsDataManager.SOURCE_TEAM_SHOTS:
    if (naturalOrderWeigher == null) {
      naturalOrderWeigher=new PlaidItemSorting.NaturalOrderWeigher();
    }
  weigher=naturalOrderWeigher;
break;
default :
if (items.get(0) instanceof Shot) {
if (shotWeigher == null) shotWeigher=new ShotWeigher();
weigher=shotWeigher;
}
 else if (items.get(0) instanceof Story) {
if (storyWeigher == null) storyWeigher=new StoryWeigher();
weigher=storyWeigher;
}
 else if (items.get(0) instanceof Post) {
if (postWeigher == null) postWeigher=new PostWeigher();
weigher=postWeigher;
}
}
weigher.weigh(items);
}

private void weighItems ( List < ? extends PlaidItem > items ) { if ( items == null || items . isEmpty ( ) ) return ; PlaidItemSorting . PlaidItemGroupWeigher weigher = null ; switch ( items . get ( 0 ) . dataSource ) { case SourceManager . SOURCE_DRIBBBLE_USER_SHOTS : case SourceManager . SOURCE_DRIBBBLE_USER_LIKES : case SourceManager . SOURCE_PRODUCT_HUNT : case PlayerShotsDataManager . SOURCE_PLAYER_SHOTS : case PlayerShotsDataManager . SOURCE_TEAM_SHOTS : if ( naturalOrderWeigher == null ) { naturalOrderWeigher = new PlaidItemSorting . NaturalOrderWeigher ( ) ; } weigher = naturalOrderWeigher ; break ; default : if ( items . get ( 0 ) instanceof Shot ) { if ( shotWeigher == null ) shotWeigher = new ShotWeigher ( ) ; weigher = shotWeigher ; } else if ( items . get ( 0 ) instanceof Story ) { if ( storyWeigher == null ) storyWeigher = new StoryWeigher ( ) ; weigher = storyWeigher ; } else if ( items . get ( 0 ) instanceof Post ) { if ( postWeigher == null ) postWeigher = new PostWeigher ( ) ; weigher = postWeigher ; } } weigher . weigh ( items ) ; }
calculate a ' weight ' [ 0 , 1 ] for each data type for sorting . each data type / source has a different metric for weighing it e . g . dribbble uses likes etc . but some sources should keep the order returned by the api . weights are ' scoped ' to the page they belong to and lower weights are sorted earlier in the grid ( i . e . in ascending weight ) .
