ammopg.setMei(a); ammopg.setService(service); ammopg.setTheater(THEATER); if (anAsset instanceof Level2MEIAsset) { ammopg.setAmmoBG(new Level2AmmoConsumerBG(ammopg)); } else { ammopg.setAmmoBG(new AmmoConsumerBG(ammopg)); } ammopg.initialize(this); anAsset.setPropertyGroup(ammopg); addedPG = true; } if (consumes(consumed, PKG_POL) && anAsset.searchForPropertyGroup(PackagedPOLConsumerPG.class) == null) { logger.debug("addConsumerPGs() CREATING PackagedPOLConsumerPG for "+anAsset+" in "+ getAgentIdentifier());  NewPackagedPOLConsumerPG packagedpg =
ammopg.setMei(a); ammopg.setService(service); ammopg.setTheater(THEATER); if (anAsset instanceof Level2MEIAsset) { ammopg.setAmmoBG(new Level2AmmoConsumerBG(ammopg)); } else { ammopg.setAmmoBG(new AmmoConsumerBG(ammopg)); } ammopg.initialize(this); anAsset.setPropertyGroup(ammopg); addedPG = true; } else { if (logger.isInfoEnabled()) logger.info(getAgentIdentifier() + ".addConsPGs Re-BGing AmmoConsumerPG for " + anAsset); if (didRehydrate()) { if (logger.isInfoEnabled()) logger.info("          Due to rehydrate. Will re-initialize BG only."); ammopg.initialize(this); } else { if (logger.isDebugEnabled()) logger.debug("          DidRehydrate is false. Blindly assume the PG is ok and avoid doing excess work.");    } } } else { if (logger.isInfoEnabled()) logger.info(getAgentIdentifier() + ".addConsPGs not putting AmmopG on asset that does not consume it: " + anAsset); }  if (consumes(consumed, PKG_POL)) { NewPackagedPOLConsumerPG packagedpg = (NewPackagedPOLConsumerPG)anAsset.searchForPropertyGroup(PackagedPOLConsumerPG.class); if (packagedpg == null) { if (logger.isInfoEnabled()) logger.info("addConsumerPGs() CREATING PackagedPOLConsumerPG for "+anAsset+" in "+ getAgentIdentifier());  packagedpg =
  protected void addConsumerPGs(Collection meiConsumers) {    Iterator meis = meiConsumers.iterator();    Asset a, anAsset;    boolean addedPG = false;    while (meis.hasNext()) {      a = (Asset)meis.next();      if (a instanceof AggregateAsset) {        anAsset = ((AggregateAsset)a).getAsset();      } else {        anAsset = a;      }      if (anAsset instanceof ClassVIIMajorEndItem) {        if (anAsset instanceof Level2MEIAsset) {          //This cargo category code means, "do not transport me."          setNoTransportCargoCode(anAsset);        }        boolean[] consumed = checkMeiConsumption(anAsset);        if (consumes(consumed, FUEL) && anAsset.searchForPropertyGroup(FuelConsumerPG.class) == null) {          logger.debug("addConsumerPGs() CREATING FuelConsumerPG for "+anAsset+" in "+                       getAgentIdentifier());          NewFuelConsumerPG fuelpg =              (NewFuelConsumerPG)getLDM().getFactory().createPropertyGroup(FuelConsumerPG.class);          fuelpg.setMei(a);          fuelpg.setService(service);          fuelpg.setTheater(THEATER);          if (anAsset instanceof Level2MEIAsset) {            fuelpg.setFuelBG(new Level2FuelConsumerBG(fuelpg));          } else {            fuelpg.setFuelBG(new FuelConsumerBG(fuelpg));          }          fuelpg.initialize(this);          anAsset.setPropertyGroup(fuelpg);          addedPG = true;        }        if (consumes(consumed, AMMO) && anAsset.searchForPropertyGroup(AmmoConsumerPG.class) == null) {          logger.debug("addConsumerPGs() CREATING AmmoConsumerPG for "+anAsset+" in "+                       getAgentIdentifier());          NewAmmoConsumerPG ammopg =              (NewAmmoConsumerPG)getLDM().getFactory().createPropertyGroup(AmmoConsumerPG.class);          ammopg.setMei(a);          ammopg.setService(service);          ammopg.setTheater(THEATER);          if (anAsset instanceof Level2MEIAsset) {            ammopg.setAmmoBG(new Level2AmmoConsumerBG(ammopg));          } else {            ammopg.setAmmoBG(new AmmoConsumerBG(ammopg));          }          ammopg.initialize(this);          anAsset.setPropertyGroup(ammopg);          addedPG = true;        }        if (consumes(consumed, PKG_POL) && anAsset.searchForPropertyGroup(PackagedPOLConsumerPG.class) == null) {          logger.debug("addConsumerPGs() CREATING PackagedPOLConsumerPG for "+anAsset+" in "+                       getAgentIdentifier());          NewPackagedPOLConsumerPG packagedpg =              (NewPackagedPOLConsumerPG)getLDM().getFactory().createPropertyGroup(PackagedPOLConsumerPG.class);          packagedpg.setMei(a);          packagedpg.setService(service);          packagedpg.setTheater(THEATER);          packagedpg.setPackagedPOLBG(new PackagedPOLConsumerBG(packagedpg));          packagedpg.initialize(this);          anAsset.setPropertyGroup(packagedpg);          addedPG = true;        }        if (consumes(consumed, SPARES) && anAsset.searchForPropertyGroup(RepairPartConsumerPG.class) == null) {          logger.debug("addConsumerPGs() CREATING RepairPartConsumerPG for "+anAsset+" in "+                       getAgentIdentifier());          NewRepairPartConsumerPG partpg =              (NewRepairPartConsumerPG)getLDM().getFactory().createPropertyGroup(RepairPartConsumerPG.class);          partpg.setMei(a);          partpg.setService(service);          partpg.setTheater(THEATER);          partpg.setRepairPartBG(new RepairPartConsumerBG(partpg));          partpg.initialize(this);          anAsset.setPropertyGroup(partpg);          addedPG = true;        }        if (addedPG) {          publishChange(a);        }      }    }  }