Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. /**
  2.      * for each service,
  3.      *  for each serviceID
  4.      *      if service id does not appear in array
  5.      *          stop service
  6.      */
  7.     public void autoStopService(int[] serviceIDs)
  8.     {
  9.         IService service;
  10.         System.out.println("Size of Hashset: " + this._services.size());
  11.         for(Enumeration e = this._services.keys(); e.hasMoreElements() ; ){
  12.            for(int i=0; i<serviceIDs.length; i++){
  13.             if(!this._services.contains(Integer.valueOf(serviceIDs[i]))){
  14.                 System.out.println("ServiceID: " + serviceIDs[i] + " not found" );
  15.                 continue;
  16.             }  
  17.              
  18.                System.out.println("Searching for ID: " + serviceIDs[i]);
  19.                service = (IService)this._services.get(Integer.valueOf(i));
  20.                if(service == null)
  21.                {
  22.                    System.out.println("Service was null!!!!");
  23.                    continue;
  24.                }
  25.                System.out.println("Service ID of retrieved Service: " +  service.getServiceId());
  26.                if(service == null) {
  27.                    System.out.println("Null value");
  28.                    continue;
  29.                }
  30.             if(service.getServiceId() != serviceIDs[i] ) {
  31.                 this.stopService(i);
  32.             }
  33.           }
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement