Input:
  DiameterMessage createS6aMessage(DiameterHeader diameterHeader, DiameterAvp[] avps, int _commandCode, ApplicationId appId) throws InternalException {
    boolean creatingRequest = diameterHeader == null;
    Message msg = null;
    if (!creatingRequest) {
      Message raw = createMessage(diameterHeader, avps, 0, appId);
      raw.setProxiable(diameterHeader.isProxiable());
      raw.setRequest(false);
      raw.getAvps().removeAvp(Avp.AUTH_APPLICATION_ID);
      msg = raw;
    }
    else {
      Message raw = createMessage(diameterHeader, avps, _commandCode, appId);
      raw.setProxiable(true);
      raw.setRequest(true);
      msg = raw;
    }
    if (msg.getAvps().getAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID) == null) {
      try {
        DiameterAvp avpVendorId = this.baseAvpFactory.createAvp(Avp.VENDOR_ID, _S6A_VENDOR);
        DiameterAvp avpAuthApplicationId = this.baseAvpFactory.createAvp(Avp.AUTH_APPLICATION_ID, _S6A_AUTH_APP_ID);
        DiameterAvp vendorSpecific = this.baseAvpFactory.createAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID, new DiameterAvp[]{avpVendorId, avpAuthApplicationId});
        msg.getAvps().addAvp(vendorSpecific.getCode(), vendorSpecific.byteArrayValue());
      }
      catch (NoSuchAvpException nsae) {
        logger.error("Failed to create AVPs", nsae);
      }
    }
    int commandCode = creatingRequest ? _commandCode : diameterHeader.getCommandCode();
    DiameterMessage diamMessage = null;
    switch (commandCode) {
      case UpdateLocationRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new UpdateLocationRequestImpl(msg) : new UpdateLocationAnswerImpl(msg);
        break;
      case AuthenticationInformationRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new AuthenticationInformationRequestImpl(msg) : new AuthenticationInformationAnswerImpl(msg);
        break;
      case CancelLocationRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new CancelLocationRequestImpl(msg) : new CancelLocationAnswerImpl(msg);
        break;
      case InsertSubscriberDataRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new InsertSubscriberDataRequestImpl(msg) : new InsertSubscriberDataAnswerImpl(msg);
        break;
      case DeleteSubscriberDataRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new DeleteSubscriberDataRequestImpl(msg) : new DeleteSubscriberDataAnswerImpl(msg);
        break;
      case PurgeUERequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new PurgeUERequestImpl(msg) : new PurgeUEAnswerImpl(msg);
        break;
      case ResetRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new ResetRequestImpl(msg) : new ResetAnswerImpl(msg);
        break;
      case NotifyRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new NotifyRequestImpl(msg) : new NotifyAnswerImpl(msg);
        break;
      default:
        diamMessage = new ExtensionDiameterMessageImpl(msg);
    }
    if (!diamMessage.hasSessionId() && session != null) {
      diamMessage.setSessionId(session.getSessionId());
    }
    return diamMessage;
  }

Output:
  DiameterMessage createS6aMessage(DiameterHeader diameterHeader, DiameterAvp[] avps, int _commandCode, ApplicationId appId) throws InternalException {
    boolean creatingRequest = diameterHeader == null;
    Message msg = null;
    if (!creatingRequest) {
      Message raw = createMessage(diameterHeader, avps, 0, appId);
      raw.setProxiable(diameterHeader.isProxiable());
      raw.setRequest(false);
      raw.setReTransmitted(false);
      raw.getAvps().removeAvp(Avp.AUTH_APPLICATION_ID);
      msg = raw;
    }
    else {
      Message raw = createMessage(diameterHeader, avps, _commandCode, appId);
      raw.setProxiable(true);
      raw.setRequest(true);
      msg = raw;
    }
    if (msg.getAvps().getAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID) == null) {
      try {
        DiameterAvp avpVendorId = this.baseAvpFactory.createAvp(Avp.VENDOR_ID, _S6A_VENDOR);
        DiameterAvp avpAuthApplicationId = this.baseAvpFactory.createAvp(Avp.AUTH_APPLICATION_ID, _S6A_AUTH_APP_ID);
        DiameterAvp vendorSpecific = this.baseAvpFactory.createAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID, new DiameterAvp[]{avpVendorId, avpAuthApplicationId});
        msg.getAvps().addAvp(vendorSpecific.getCode(), vendorSpecific.byteArrayValue());
      }
      catch (NoSuchAvpException nsae) {
        logger.error("Failed to create AVPs", nsae);
      }
    }
    int commandCode = creatingRequest ? _commandCode : diameterHeader.getCommandCode();
    DiameterMessage diamMessage = null;
    switch (commandCode) {
      case UpdateLocationRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new UpdateLocationRequestImpl(msg) : new UpdateLocationAnswerImpl(msg);
        break;
      case AuthenticationInformationRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new AuthenticationInformationRequestImpl(msg) : new AuthenticationInformationAnswerImpl(msg);
        break;
      case CancelLocationRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new CancelLocationRequestImpl(msg) : new CancelLocationAnswerImpl(msg);
        break;
      case InsertSubscriberDataRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new InsertSubscriberDataRequestImpl(msg) : new InsertSubscriberDataAnswerImpl(msg);
        break;
      case DeleteSubscriberDataRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new DeleteSubscriberDataRequestImpl(msg) : new DeleteSubscriberDataAnswerImpl(msg);
        break;
      case PurgeUERequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new PurgeUERequestImpl(msg) : new PurgeUEAnswerImpl(msg);
        break;
      case ResetRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new ResetRequestImpl(msg) : new ResetAnswerImpl(msg);
        break;
      case NotifyRequest.COMMAND_CODE:
        diamMessage = creatingRequest ? new NotifyRequestImpl(msg) : new NotifyAnswerImpl(msg);
        break;
      default:
        diamMessage = new ExtensionDiameterMessageImpl(msg);
    }
    if (!diamMessage.hasSessionId() && session != null) {
      diamMessage.setSessionId(session.getSessionId());
    }
    return diamMessage;
  }


Input:
    public List<Badge> checkNewBadge(User user)
    {
        ArrayList<Badge> list= new ArrayList<Badge>();
        List<Integer> oldBadges = user.getBadges();
        List<Integer> newBadges = new ArrayList<Integer>();
        newBadges.addAll(oldBadges);
        List<Drink> myDrinks = DaoFactory.getInstance().getDrinkDao().findDrinksByIdUser(user.getIdUser(), null);
        if(!oldBadges.contains(BadgeEnum.DRINK_NUM_100.getIdBadge()))
        {
            log.info("verifica numero bevute complessive");
            int countDrinksByUsername = myDrinks.size();
            if (!oldBadges.contains(BadgeEnum.DRINK_NUM_1.getIdBadge()) && countDrinksByUsername == BadgeEnum.DRINK_NUM_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NUM_5.getIdBadge())  && countDrinksByUsername == BadgeEnum.DRINK_NUM_5.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NUM_10.getIdBadge())  && countDrinksByUsername == BadgeEnum.DRINK_NUM_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_10);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NUM_50.getIdBadge())  && countDrinksByUsername == BadgeEnum.DRINK_NUM_50.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_50);
            } else if ( countDrinksByUsername == BadgeEnum.DRINK_NUM_100.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_100);
            }
        }
         if(!oldBadges.contains(BadgeEnum.DRINKER_PUB_25.getIdBadge()))
         {
             log.info("verifica numero bevute in pub: ");
             int count=0;
             for(Drink d: myDrinks)
             {
                 log.info("-- in pub: "+d.getIdPlace());
                 Location l=DaoFactory.getInstance().getLocationDao().findByIdLocation(d.getIdPlace());
                 if(l.getCategories().contains(LocationCategoryDao.ID_PUB))
                 {
                     count++;
                 }
             }
             if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_1.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_3.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_5.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_10.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_10);
            } else if (count == BadgeEnum.DRINKER_PUB_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_25.getIdBadge()))
         {
             log.info("verifica numero bevute in pzzeria");
             int count=0;
             for(Drink d: myDrinks)
             {
                 Location l=DaoFactory.getInstance().getLocationDao().findByIdLocation(d.getIdPlace());
                 if(l.getCategories().contains(LocationCategoryDao.ID_PIZZA))
                 {
                     count++;
                 }
             }
             if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_1.getIdBadge())  && count == BadgeEnum.DRINKER_PIZZA_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_3.getIdBadge()) && count == BadgeEnum.DRINKER_PIZZA_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_5.getIdBadge()) && count == BadgeEnum.DRINKER_PIZZA_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_10.getIdBadge()) && count == BadgeEnum.DRINKER_PIZZA_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_10);
            } else if (count == BadgeEnum.DRINKER_PIZZA_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_RISTO_25.getIdBadge()))
         {
             log.info("verifica numero bevute in ristorante");
             String name="Restaurant";
             int count=0;
             count = countDrinkWithLocationCategoryNameLike(myDrinks, name);
             if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_1.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_3.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_5.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_10.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_10);
            } else if (count == BadgeEnum.DRINKER_RISTO_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_BAR_25.getIdBadge()))
         {
             log.info("verifica numero bevute in bar");
             String name="Bar";
             int count=0;
             count = countDrinkWithLocationCategoryNameLike(myDrinks, name);
             if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_1.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_3.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_5.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_10.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_10);
            } else if (count == BadgeEnum.DRINKER_BAR_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_25);
            }
         }
          if(!oldBadges.contains(BadgeEnum.DRINKER_HOME_25.getIdBadge()))
         {
             log.info("verifica numero bevute a casa");
             int count=0;
             for(Drink d: myDrinks)
             {
                 Location l=DaoFactory.getInstance().getLocationDao().findByIdLocation(d.getIdPlace());
                 if(l.getCategories().contains(LocationCategoryDao.ID_HOME))
                 {
                     count++;
                 }
             }
             if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_1.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_3.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_5.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_10.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_10);
            } else if ( count == BadgeEnum.DRINKER_HOME_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_SPORT_25.getIdBadge()))
         {
             log.info("verifica numero bevute in stadio");
             String name="Stadium";
             int count=0;
             count = countDrinkWithLocationCategoryNameLike(myDrinks, name);
             if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_1.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_3.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_5.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_10.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_10);
            } else if (count == BadgeEnum.DRINKER_SPORT_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_25);
            }
         }
         Calendar now = Calendar.getInstance();
         int h=now.get(Calendar.HOUR_OF_DAY);
         int m=now.get(Calendar.MINUTE);
         if(h>20 || h<6)
         {
             log.info("verifica numero bevute nella notte");
             Date startLimit=null;
             Date endLimit=null;
             if(h>20)
             {
             Calendar today20 = Calendar.getInstance();
             today20.set(Calendar.HOUR_OF_DAY, 20);
             today20.set(Calendar.MINUTE, 0);
             today20.set(Calendar.MILLISECOND, 0);
             Calendar today6 =Calendar.getInstance();
             today6.set(Calendar.HOUR_OF_DAY, 6);
             today6.set(Calendar.MINUTE, 0);
             today6.set(Calendar.MILLISECOND, 0);
             today6.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH)+1);
             startLimit=today20.getTime();
             endLimit=today6.getTime();
             }
             else if(h<6)
             {
             Calendar today20 = Calendar.getInstance();
             today20.set(Calendar.HOUR_OF_DAY, 20);
             today20.set(Calendar.MINUTE, 0);
             today20.set(Calendar.MILLISECOND, 0);
             Calendar today6 =Calendar.getInstance();
             today6.set(Calendar.HOUR_OF_DAY, 6);
             today6.set(Calendar.MINUTE, 0);
             today6.set(Calendar.MILLISECOND, 0);
             today20.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH)-1);
             startLimit=today20.getTime();
             endLimit=today6.getTime();
             }
             else
             {
                 log.error("vicolo cieco PUPPA!!");
             }
             int count=0;
             for(Drink d : myDrinks)
             {
                 if(d.getInsertedOn().after(startLimit) && d.getInsertedOn().before(endLimit))
                 {
                     count++;
                 }
             }
             log.info("numero bevute di "+user.getUsername()+":"+count);
              if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_2.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_2.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_2);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_3.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_4.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_4.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_4);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_5.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_5);
            } else if (count == BadgeEnum.DRINK_NIGHT_10.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_10);
            }
         }
        user.setBadges(newBadges);
        user.setCounterBadges(newBadges.size());
        DaoFactory.getInstance().getUserDao().updateUser(user);
        return list;
    }

Output:
    public List<Badge> checkNewBadge(User user)
    {
        ArrayList<Badge> list= new ArrayList<Badge>();
        List<Integer> oldBadges = user.getBadges();
        List<Integer> newBadges = new ArrayList<Integer>();
        newBadges.addAll(oldBadges);
        List<Drink> myDrinks = DaoFactory.getInstance().getDrinkDao().findDrinksByIdUser(user.getIdUser(), null);
        if(!oldBadges.contains(BadgeEnum.DRINK_NUM_100.getIdBadge()))
        {
            log.info("verifica numero bevute complessive");
            int countDrinksByUsername = myDrinks.size();
            if (!oldBadges.contains(BadgeEnum.DRINK_NUM_1.getIdBadge()) && countDrinksByUsername == BadgeEnum.DRINK_NUM_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NUM_5.getIdBadge())  && countDrinksByUsername == BadgeEnum.DRINK_NUM_5.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NUM_10.getIdBadge())  && countDrinksByUsername == BadgeEnum.DRINK_NUM_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_10);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NUM_50.getIdBadge())  && countDrinksByUsername == BadgeEnum.DRINK_NUM_50.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_50);
            } else if ( countDrinksByUsername == BadgeEnum.DRINK_NUM_100.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NUM_100);
            }
        }
         if(!oldBadges.contains(BadgeEnum.DRINKER_PUB_25.getIdBadge()))
         {
             log.info("verifica numero bevute in pub: ");
             int count=0;
             for(Drink d: myDrinks)
             {
                 log.info("-- in pub: "+d.getIdPlace());
                 Location l=DaoFactory.getInstance().getLocationDao().findByIdLocation(d.getIdPlace());
                 if(l.getCategories().contains(LocationCategoryDao.ID_PUB))
                 {
                     count++;
                 }
             }
             if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_1.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_3.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_5.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PUB_10.getIdBadge())  && count == BadgeEnum.DRINKER_PUB_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_10);
            } else if (count == BadgeEnum.DRINKER_PUB_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PUB_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_25.getIdBadge()))
         {
             log.info("verifica numero bevute in pzzeria");
             int count=0;
             for(Drink d: myDrinks)
             {
                 Location l=DaoFactory.getInstance().getLocationDao().findByIdLocation(d.getIdPlace());
                 if(l.getCategories().contains(LocationCategoryDao.ID_PIZZA))
                 {
                     count++;
                 }
             }
             if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_1.getIdBadge())  && count == BadgeEnum.DRINKER_PIZZA_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_3.getIdBadge()) && count == BadgeEnum.DRINKER_PIZZA_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_5.getIdBadge()) && count == BadgeEnum.DRINKER_PIZZA_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_PIZZA_10.getIdBadge()) && count == BadgeEnum.DRINKER_PIZZA_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_10);
            } else if (count == BadgeEnum.DRINKER_PIZZA_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_PIZZA_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_RISTO_25.getIdBadge()))
         {
             log.info("verifica numero bevute in ristorante");
             String name="Restaurant";
             int count=0;
             count = countDrinkWithLocationCategoryNameLike(myDrinks, name);
             if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_1.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_3.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_5.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_RISTO_10.getIdBadge()) && count == BadgeEnum.DRINKER_RISTO_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_10);
            } else if (count == BadgeEnum.DRINKER_RISTO_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_RISTO_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_BAR_25.getIdBadge()))
         {
             log.info("verifica numero bevute in bar");
             String name="Bar";
             int count=0;
             count = countDrinkWithLocationCategoryNameLike(myDrinks, name);
             if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_1.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_3.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_5.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_BAR_10.getIdBadge()) && count == BadgeEnum.DRINKER_BAR_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_10);
            } else if (count == BadgeEnum.DRINKER_BAR_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_BAR_25);
            }
         }
          if(!oldBadges.contains(BadgeEnum.DRINKER_HOME_25.getIdBadge()))
         {
             log.info("verifica numero bevute a casa");
             int count=0;
             for(Drink d: myDrinks)
             {
                 Location l=DaoFactory.getInstance().getLocationDao().findByIdLocation(d.getIdPlace());
                 if(l.getCategories().contains(LocationCategoryDao.ID_HOME))
                 {
                     count++;
                 }
             }
             if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_1.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_3.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_5.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_HOME_10.getIdBadge()) && count == BadgeEnum.DRINKER_HOME_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_10);
            } else if ( count == BadgeEnum.DRINKER_HOME_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_HOME_25);
            }
         }
         if(!oldBadges.contains(BadgeEnum.DRINKER_SPORT_25.getIdBadge()))
         {
             log.info("verifica numero bevute in stadio");
             String name="Stadium";
             int count=0;
             count = countDrinkWithLocationCategoryNameLike(myDrinks, name);
             if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_1.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_1.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_1);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_3.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_5.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_5);
            } else if (!oldBadges.contains(BadgeEnum.DRINKER_SPORT_10.getIdBadge()) && count == BadgeEnum.DRINKER_SPORT_10.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_10);
            } else if (count == BadgeEnum.DRINKER_SPORT_25.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINKER_SPORT_25);
            }
         }
         Calendar now = Calendar.getInstance();
         int h=now.get(Calendar.HOUR_OF_DAY);
         int m=now.get(Calendar.MINUTE);
         if(h>20 || h<6)
         {
             log.info("verifica numero bevute nella notte");
             Date startLimit=null;
             Date endLimit=null;
             if(h>20)
             {
             Calendar today20 = Calendar.getInstance();
             today20.set(Calendar.HOUR_OF_DAY, 20);
             today20.set(Calendar.MINUTE, 0);
             today20.set(Calendar.MILLISECOND, 0);
             Calendar today6 =Calendar.getInstance();
             today6.set(Calendar.HOUR_OF_DAY, 6);
             today6.set(Calendar.MINUTE, 0);
             today6.set(Calendar.MILLISECOND, 0);
             today6.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH)+1);
             startLimit=today20.getTime();
             endLimit=today6.getTime();
             }
             else if(h<6)
             {
             Calendar today20 = Calendar.getInstance();
             today20.set(Calendar.HOUR_OF_DAY, 20);
             today20.set(Calendar.MINUTE, 0);
             today20.set(Calendar.MILLISECOND, 0);
             Calendar today6 =Calendar.getInstance();
             today6.set(Calendar.HOUR_OF_DAY, 6);
             today6.set(Calendar.MINUTE, 0);
             today6.set(Calendar.MILLISECOND, 0);
             today20.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH)-1);
             startLimit=today20.getTime();
             endLimit=today6.getTime();
             }
             else
             {
                 log.error("vicolo cieco PUPPA!!");
             }
             int count=0;
             for(Drink d : myDrinks)
             {
                 if(d.getInsertedOn().after(startLimit) && d.getInsertedOn().before(endLimit))
                 {
                     count++;
                 }
             }
             log.info("numero bevute di "+user.getUsername()+":"+count);
              if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_2.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_2.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_2);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_3.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_3.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_3);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_4.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_4.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_4);
            } else if (!oldBadges.contains(BadgeEnum.DRINK_NIGHT_5.getIdBadge()) && count == BadgeEnum.DRINK_NIGHT_5.getQuantity()) {
               updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_5);
            } else if (count == BadgeEnum.DRINK_NIGHT_10.getQuantity()) {
                updateListBadgeLocally(list, newBadges,BadgeEnum.DRINK_NIGHT_10);
            }
         }
        user.setBadges(newBadges);
        user.setCounterBadges(newBadges.size());
        DaoFactory.getInstance().getUserDao().updateUser(user);
        return list;
    }


Input:
	public void run() throws SQLException {
		WikiConnect wiki = new WikiConnect();
		List<Sentence> sentences = wiki.getFile(this.docID);
		AbstractEntityExtractor extractor = new EntityExtractor();
		List<EntityMention> mentions = extractor.extract(sentences);
		AbstractSearcher searcher = new BasicSearcher();
		for (EntityMention mention : mentions) {
			searcher.GetCandidateEntities(mention);
		}
		AbstractDisambiguator disambiguator = new SimpleDisambiguator();
		disambiguator.disambiguate(mentions);
	}

Output:
	public void run() throws SQLException {
		SentenceConnect docs = new SentenceConnect();
		List<Sentence> sentences = docs.getDocument(this.docID);
		AbstractEntityExtractor extractor = new EntityExtractor();
		List<EntityMention> mentions = extractor.extract(sentences);
		AbstractSearcher searcher = new BasicSearcher();
		for (EntityMention mention : mentions) {
			searcher.GetCandidateEntities(mention);
		}
		AbstractDisambiguator disambiguator = new SimpleDisambiguator();
		disambiguator.disambiguate(mentions);
	}


Input:
    public ChainedWorkspaceReader( WorkspaceReader... readers )
    {
        if ( readers != null )
        {
            Collections.addAll( this.readers, readers );
        }
        StringBuilder buffer = new StringBuilder();
        for ( WorkspaceReader reader : readers )
        {
            if ( buffer.length() > 0 )
            {
                buffer.append( '+' );
            }
            buffer.append( reader.getRepository().getContentType() );
        }
        repository = new WorkspaceRepository( buffer.toString(), new Key( this.readers ) );
    }

Output:
    public ChainedWorkspaceReader( WorkspaceReader... readers )
    {
        if ( readers != null )
        {
            Collections.addAll( this.readers, readers );
        }
        StringBuilder buffer = new StringBuilder();
        for ( WorkspaceReader reader : this.readers )
        {
            if ( buffer.length() > 0 )
            {
                buffer.append( '+' );
            }
            buffer.append( reader.getRepository().getContentType() );
        }
        repository = new WorkspaceRepository( buffer.toString(), new Key( this.readers ) );
    }


Input:
  private boolean isRelevant(Context context, Intent intent) {
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
      return false;
    }
    if (!ApplicationMigrationService.isDatabaseImported(context)) {
      return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
        Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction()) &&
        Util.isDefaultSmsProvider(context))
    {
      return false;
    }
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT &&
        PreferenceManager.getDefaultSharedPreferences(context)
                         .getBoolean(ApplicationPreferencesActivity.ALL_MMS_PERF, true))
    {
      return true;
    }
    byte[] mmsData   = intent.getByteArrayExtra("data");
    PduParser parser = new PduParser(mmsData);
    GenericPdu pdu   = parser.parse();
    if (pdu.getMessageType() != PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND)
      return false;
    NotificationInd notificationPdu = (NotificationInd)pdu;
    if (notificationPdu.getSubject() == null)
      return false;
    return WirePrefix.isEncryptedMmsSubject(notificationPdu.getSubject().getString());
  }

Output:
  private boolean isRelevant(Context context, Intent intent) {
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
      return false;
    }
    if (!ApplicationMigrationService.isDatabaseImported(context)) {
      return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
        Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction()) &&
        Util.isDefaultSmsProvider(context))
    {
      return false;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ||
        PreferenceManager.getDefaultSharedPreferences(context)
                         .getBoolean(ApplicationPreferencesActivity.ALL_MMS_PERF, true))
    {
      return true;
    }
    byte[] mmsData   = intent.getByteArrayExtra("data");
    PduParser parser = new PduParser(mmsData);
    GenericPdu pdu   = parser.parse();
    if (pdu.getMessageType() != PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND)
      return false;
    NotificationInd notificationPdu = (NotificationInd)pdu;
    if (notificationPdu.getSubject() == null)
      return false;
    return WirePrefix.isEncryptedMmsSubject(notificationPdu.getSubject().getString());
  }


Input:
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		if (mProgressBounds != null) {
			mProgressBounds.left = mPaddingLeft;
			mProgressBounds.top = mPaddingTop;
			mProgressBounds.right = (int) ((getWidth() - mPaddingRight)
					* mProgressValue / 100f);
			mProgressBounds.bottom = getHeight() - mPaddingBottom;
			mProgressDrawable.setBounds(mProgressBounds);
			mProgressDrawable.draw(canvas);
		}
	}

Output:
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		if (mProgressBounds != null && mProgressDrawable != null) {
			mProgressBounds.left = mPaddingLeft;
			mProgressBounds.top = mPaddingTop;
			mProgressBounds.right = (int) ((getWidth() - mPaddingRight)
					* mProgressValue / 100f);
			mProgressBounds.bottom = getHeight() - mPaddingBottom;
			mProgressDrawable.setBounds(mProgressBounds);
			mProgressDrawable.draw(canvas);
		}
	}


Input:
    public void testRegistry() {
        if (!WindowsUtils.thisIsWindows()) return;
        String keyProxyEnable = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable";
        String keySeleniumFoo = "HKEY_CURRENT_USER\\Software\\Selenium\\RemoteControl\\foo";
        assertTrue("Standard Windows reg key ProxyEnable doesn't exist", WindowsUtils.doesRegistryValueExist(keyProxyEnable));
        System.out.println("ProxyEnable: " + WindowsUtils.readIntRegistryValue(keyProxyEnable));
        WindowsUtils.writeStringRegistryValue(keySeleniumFoo, "bar");
        assertEquals("Didn't set Foo string key correctly", "bar", WindowsUtils.readStringRegistryValue(keySeleniumFoo));
        WindowsUtils.writeStringRegistryValue(keySeleniumFoo, "baz");
        assertEquals("Didn't modify Foo string key correctly", "baz", WindowsUtils.readStringRegistryValue(keySeleniumFoo));
        WindowsUtils.deleteRegistryValue(keySeleniumFoo);
        assertFalse("Didn't delete Foo key correctly", WindowsUtils.doesRegistryValueExist(keySeleniumFoo));
        WindowsUtils.writeBooleanRegistryValue(keySeleniumFoo, true);
        assertTrue("Didn't set Foo boolean key correctly", WindowsUtils.readBooleanRegistryValue(keySeleniumFoo));
        WindowsUtils.deleteRegistryValue(keySeleniumFoo);
        assertFalse("Didn't delete Foo key correctly", WindowsUtils.doesRegistryValueExist(keySeleniumFoo));
    }

Output:
    public void testRegistry() {
        if (!WindowsUtils.thisIsWindows()) return;
        String keyProxyEnable = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ProxyEnable";
        String keySeleniumFoo = "HKEY_CURRENT_USER\\Software\\Selenium\\RemoteControl\\foo";
        assertTrue("Standard Windows reg key CurrentVersion doesn't exist", WindowsUtils.doesRegistryValueExist(keyCurrentVersion));
        System.out.println("CurrentVersion: " + WindowsUtils.readStringRegistryValue(keyCurrentVersion));
        WindowsUtils.writeStringRegistryValue(keySeleniumFoo, "bar");
        assertEquals("Didn't set Foo string key correctly", "bar", WindowsUtils.readStringRegistryValue(keySeleniumFoo));
        WindowsUtils.writeStringRegistryValue(keySeleniumFoo, "baz");
        assertEquals("Didn't modify Foo string key correctly", "baz", WindowsUtils.readStringRegistryValue(keySeleniumFoo));
        WindowsUtils.deleteRegistryValue(keySeleniumFoo);
        assertFalse("Didn't delete Foo key correctly", WindowsUtils.doesRegistryValueExist(keySeleniumFoo));
        WindowsUtils.writeBooleanRegistryValue(keySeleniumFoo, true);
        assertTrue("Didn't set Foo boolean key correctly", WindowsUtils.readBooleanRegistryValue(keySeleniumFoo));
        WindowsUtils.deleteRegistryValue(keySeleniumFoo);
        assertFalse("Didn't delete Foo key correctly", WindowsUtils.doesRegistryValueExist(keySeleniumFoo));
    }


Input:
  public InventoryFrame(Player player)
  {
    super("Inventory");
    addWindowFocusListener(this);
    thePlayer = player;
    use = new JButton("Use");
    drop = new JButton("Drop");
    back = new JButton("Back");
    buttons = new JPanel();
    buttons.setBackground(Color.DARK_GRAY);
    bank = new JLabel("Money: $" + thePlayer.getMoney());
    bank.setForeground(Color.GREEN);
    ButtonListener handler = new ButtonListener();
    use.addActionListener(handler);
    drop.addActionListener(handler);
    back.addActionListener(handler);
    buttons.add(use);
    buttons.add(drop);
    buttons.add(back);
    buttons.add(bank);
    itemPanel = new JPanel();
    itemPanel.setBackground(Color.DARK_GRAY);
    descriptionArea = new JTextArea();
    descriptionArea.setPreferredSize(new Dimension(200, 200));
    descriptionArea.setBackground(Color.BLACK);
    descriptionArea.setForeground(Color.GREEN);
    descriptionArea.setWrapStyleWord(true);
    descriptionArea.setLineWrap(true);
    descriptionArea.setEditable(false);
    descriptionArea.setWrapStyleWord(true);
    usableItems = new Vector<Integer>();
    fillUsuable();
    message = new JLabel();
    message.setForeground(Color.GREEN);
    makeInventory();
    inventory = new JList(inventoryList);
    inventory.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    inventory.setBackground(Color.BLACK);
    inventory.setForeground(Color.GREEN);
    inventory.setSelectionBackground(Color.DARK_GRAY);
    inventory.addListSelectionListener(new ListSelectionListener()
    {
      @Override
      public void valueChanged(ListSelectionEvent arg0)
      {
        descriptionArea.setText(((Item) inventory.getSelectedValue())
            .getDescription());
      }
    });
    scroll = new JScrollPane(inventory);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    itemPanel.add(scroll);
    itemPanel.add(descriptionArea);
    itemPanel.setBackground(Color.DARK_GRAY);
    this.setLayout(new BorderLayout());
    this.add(itemPanel, BorderLayout.CENTER);
    this.add(buttons, BorderLayout.SOUTH);
    this.add(message, BorderLayout.NORTH);
  }

Output:
  public InventoryFrame(Player player)
  {
    super("Inventory");
    addWindowFocusListener(this);
    thePlayer = player;
    use = new JButton("Use");
    drop = new JButton("Drop");
    back = new JButton("Back");
    buttons = new JPanel();
    buttons.setBackground(Color.DARK_GRAY);
    bank = new JLabel("Money: $" + thePlayer.getMoney());
    bank.setForeground(Color.GREEN);
    ButtonListener handler = new ButtonListener();
    use.addActionListener(handler);
    drop.addActionListener(handler);
    back.addActionListener(handler);
    buttons.add(use);
    buttons.add(drop);
    buttons.add(back);
    buttons.add(bank);
    itemPanel = new JPanel();
    itemPanel.setBackground(Color.DARK_GRAY);
    descriptionArea = new JTextArea();
    descriptionArea.setPreferredSize(new Dimension(200, 200));
    descriptionArea.setBackground(Color.BLACK);
    descriptionArea.setForeground(Color.GREEN);
    descriptionArea.setWrapStyleWord(true);
    descriptionArea.setLineWrap(true);
    descriptionArea.setEditable(false);
    descriptionArea.setWrapStyleWord(true);
    usableItems = new Vector<Integer>();
    fillUsuable();
    message = new JLabel();
    message.setForeground(Color.GREEN);
    makeInventory();
    inventory = new JList(inventoryList);
    inventory.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    inventory.setBackground(Color.BLACK);
    inventory.setForeground(Color.WHITE);
    inventory.setSelectionBackground(Color.DARK_GRAY);
    inventory.setSelectionForeground(Color.GREEN);
    inventory.addListSelectionListener(new ListSelectionListener()
    {
      @Override
      public void valueChanged(ListSelectionEvent arg0)
      {
        descriptionArea.setText(((Item) inventory.getSelectedValue())
            .getDescription());
      }
    });
    scroll = new JScrollPane(inventory);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    itemPanel.add(scroll);
    itemPanel.add(descriptionArea);
    itemPanel.setBackground(Color.DARK_GRAY);
    this.setLayout(new BorderLayout());
    this.add(itemPanel, BorderLayout.CENTER);
    this.add(buttons, BorderLayout.SOUTH);
    this.add(message, BorderLayout.NORTH);
  }