public static List<Integer> networkTagInterval() {
   final List<Integer> interval = Lists.newArrayList();
   for (Integer i = NetworkGroups.networkingConfiguration().getMinNetworkTag();
       i < NetworkGroups.networkingConfiguration().getMaxNetworkTag();
       i++) {
     interval.add(i);
   }
   return interval;
 }
 public static List<Long> networkIndexInterval() {
   final List<Long> interval = Lists.newArrayList();
   for (Long i = NetworkGroups.networkingConfiguration().getMinNetworkIndex();
       i < NetworkGroups.networkingConfiguration().getMaxNetworkIndex();
       i++) {
     interval.add(i);
   }
   return interval;
 }
 public ExtantNetwork extantNetwork()
     throws NotEnoughResourcesException, TransientEntityException {
   if (!NetworkGroups.networkingConfiguration().hasNetworking()) {
     ExtantNetwork bogusNet = ExtantNetwork.bogus(this);
     if (!this.hasExtantNetwork()) this.setExtantNetwork(bogusNet);
     return bogusNet;
   } else if (!Entities.isPersistent(this)) {
     throw new TransientEntityException(this.toString());
   } else {
     ExtantNetwork exNet = this.getExtantNetwork();
     if (exNet == null) {
       for (Integer i : Numbers.shuffled(NetworkGroups.networkTagInterval())) {
         try {
           Entities.uniqueResult(ExtantNetwork.named(i));
           continue;
         } catch (Exception ex) {
           exNet = ExtantNetwork.create(this, i);
           Entities.persist(exNet);
           this.setExtantNetwork(exNet);
           return this.getExtantNetwork();
         }
       }
       throw new NotEnoughResourcesException(
           "Failed to allocate network tag for network: "
               + this.getFullName()
               + ": no network tags are free.");
     } else {
       return this.getExtantNetwork();
     }
   }
 }
 public ExtantNetwork reclaim(Integer i)
     throws NotEnoughResourcesException, TransientEntityException {
   if (!NetworkGroups.networkingConfiguration().hasNetworking()) {
     return ExtantNetwork.bogus(this);
   } else if (!Entities.isPersistent(this)) {
     throw new TransientEntityException(this.toString());
   } else {
     ExtantNetwork exNet = Entities.persist(ExtantNetwork.create(this, i));
     this.setExtantNetwork(exNet);
     return this.getExtantNetwork();
   }
 }