Add a resource or an iterable collection of resources to this container.

        Must be implemented in derived class.
326454
def add(self, resource):
        
        if isinstance(resource, collections.Iterable):
            for r in resource:
                self.resources.append(r)
        else:
            self.resources.append(resource)
254905
public static base_responses add(nitro_service client, nspbr6 resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			nspbr6 addresources[] = new nspbr6[resources.length];
			for (int i=0;i<resources.length;i++){
				addresources[i] = new nspbr6();
				addresources[i].name = resources[i].name;
				addresources[i].td = resources[i].td;
				addresources[i].action = resources[i].action;
				addresources[i].srcipv6 = resources[i].srcipv6;
				addresources[i].srcipop = resources[i].srcipop;
				addresources[i].srcipv6val = resources[i].srcipv6val;
				addresources[i].srcport = resources[i].srcport;
				addresources[i].srcportop = resources[i].srcportop;
				addresources[i].srcportval = resources[i].srcportval;
				addresources[i].destipv6 = resources[i].destipv6;
				addresources[i].destipop = resources[i].destipop;
				addresources[i].destipv6val = resources[i].destipv6val;
				addresources[i].destport = resources[i].destport;
				addresources[i].destportop = resources[i].destportop;
				addresources[i].destportval = resources[i].destportval;
				addresources[i].srcmac = resources[i].srcmac;
				addresources[i].protocol = resources[i].protocol;
				addresources[i].protocolnumber = resources[i].protocolnumber;
				addresources[i].vlan = resources[i].vlan;
				addresources[i].Interface = resources[i].Interface;
				addresources[i].priority = resources[i].priority;
				addresources[i].state = resources[i].state;
				addresources[i].msr = resources[i].msr;
				addresources[i].monitor = resources[i].monitor;
				addresources[i].nexthop = resources[i].nexthop;
				addresources[i].nexthopval = resources[i].nexthopval;
				addresources[i].nexthopvlan = resources[i].nexthopvlan;
			}
			result = add_bulk_request(client, addresources);
		}
		return result;
	}
1279106
@Override
    public void add(Statement st, Resource... contexts) throws RepositoryException {
        add(st.getSubject(), st.getPredicate(), st.getObject(), mergeResource(st.getContext(), contexts));
    }
1105293
public static <T, R extends Collection<T>> R addAllTo(Iterable<? extends T> iterable, R targetCollection)
    {
        Iterate.addAllIterable(iterable, targetCollection);
        return targetCollection;
    }
1086532
private <ItemT> void addInternal(@Nonnull Iterable<ItemT> items) {
        // Note that items can be a large lazily evaluated collection,
        // so this method is optimized to only iterate through it as much as needed.

        if (!items.iterator().hasNext()) {
            return;
        }

        nextBuildNumber = getNextBuildNumber(items.iterator().next());

        if (newerThan == null && olderThan == null) {
            // Just return the first page of entries (newest)
            Iterator<ItemT> iter = items.iterator();
            while (iter.hasNext()) {
                add(iter.next());
                if (isFull()) {
                    break;
                }
            }
            hasDownPage = iter.hasNext();
        } else if (newerThan != null) {
            int toFillCount = getFillCount();
            if (toFillCount > 0) {
                // Walk through the items and keep track of the oldest
                // 'toFillCount' items until we reach an item older than
                // 'newerThan' or the end of the list.
                LinkedList<ItemT> itemsToAdd = new LinkedList<>();
                Iterator<ItemT> iter = items.iterator();
                while (iter.hasNext()) {
                    ItemT item = iter.next();
                    if (HistoryPageEntry.getEntryId(item) > newerThan) {
                        itemsToAdd.addLast(item);

                        // Discard an item off the front of the list if we have
                        // to (which means we would be able to page up).
                        if (itemsToAdd.size() > toFillCount) {
                            itemsToAdd.removeFirst();
                            hasUpPage = true;
                        }
                    } else {
                        break;
                    }
                }
                if (itemsToAdd.size() == 0) {
                    // All builds are older than newerThan ?
                    hasDownPage = true;
                } else {
                    // If there's less than a full page of items newer than
                    // 'newerThan', then it's ok to fill the page with older items.
                    if (itemsToAdd.size() < toFillCount) {
                        // We have to restart the iterator and skip the items that we added (because
                        // we may have popped an extra item off the iterator that did not get added).
                        Iterator<ItemT> skippedIter = items.iterator();
                        Iterators.skip(skippedIter, itemsToAdd.size());
                        for (int i = itemsToAdd.size(); i < toFillCount && skippedIter.hasNext(); i++) {
                            ItemT item = skippedIter.next();
                            itemsToAdd.addLast(item);
                        }
                    }
                    hasDownPage = iter.hasNext();
                    for (Object item : itemsToAdd) {
                        add(item);
                    }
                }
            }
        } else if (olderThan != null) {
            Iterator<ItemT> iter = items.iterator();
            while (iter.hasNext()) {
                Object item = iter.next();
                if (HistoryPageEntry.getEntryId(item) >= olderThan) {
                    hasUpPage = true;
                } else {
                    add(item);
                    if (isFull()) {
                        hasDownPage = iter.hasNext();
                        break;
                    }
                }
            }
        }
    }
1138956
public static <T> Collection<T> addAll(Collection<T> collection, Iterable<T> iterable) {
		return addAll(collection, iterable.iterator());
	}
117794
def add(resource)
      if @list.key? resource.route
        raise DuplicateResource, "A resource accessible via #{resource.http_verb} #{resource.url} already exists"
      end
      @list[resource.route] = resource
    end
1176730
private void addSources( final Collection<File> items, final Collection<String> sourceRoots )
    {
        for ( String path : sourceRoots )
        {
            items.add( new File( path ) );
        }
    }
370528
public void addMethod(final String resource, final ResourceMethod method) {
        resources.putIfAbsent(resource, new HashSet<>());
        resources.get(resource).add(method);
    }
421955
def add(self, resource):
        """"""
        if isinstance(resource, Resource):
            if isinstance(resource, Secret) and \
               resource.mount != 'cubbyhole':
                ensure_backend(resource,
                               SecretBackend,
                               self._mounts,
                               self.opt,
                               False)
            elif isinstance(resource, Mount):
                ensure_backend(resource, SecretBackend, self._mounts, self.opt)
            elif isinstance(resource, Auth):
                ensure_backend(resource, AuthBackend, self._auths, self.opt)
            elif isinstance(resource, AuditLog):
                ensure_backend(resource, LogBackend, self._logs, self.opt)

            self._resources.append(resource)
        else:
            msg = "Unknown resource %s being " \
                  "added to context" % resource.__class__
            raise aomi_excep.AomiError(msg)
184123
public int addAll(KTypeContainer<? extends KType> container) {
    ensureCapacity(container.size());
    return addAll((Iterable<? extends KTypeCursor<? extends KType>>) container);
  }
799323
public void addCreatedResource(Location location, Resource resource) {
        resourceList.add(resource);
        locationToResourceMap.put(location, resource);
    }
1195236
def _add_resources(data, runtime):
    
    if "config" not in data:
        data["config"] = {}
    # Convert input resources, which may be a JSON string
    resources = data.get("resources", {}) or {}
    if isinstance(resources, six.string_types) and resources.startswith(("{", "[")):
        resources = json.loads(resources)
        data["resources"] = resources
    assert isinstance(resources, dict), (resources, data)
    data["config"]["resources"] = resources
    # Add in memory and core usage from CWL
    memory = int(float(runtime["ram"]) / float(runtime["cores"]))
    data["config"]["resources"].update({"default": {"cores": int(runtime["cores"]),
                                                    "memory": "%sM" % memory,
                                                    "jvm_opts": ["-Xms%sm" % min(1000, memory // 2),
                                                                    "-Xmx%sm" % memory]}})
    data["config"]["algorithm"]["num_cores"] = int(runtime["cores"])
    return data
1031576
def add(self, elem):
        
        if isinstance(elem, self._allowedTypes):
            self._collection.add(elem)
            self._collectedTypes.add(type(elem).__name__)
        else:
            raise CollectionTypeError("{} can only contain '{}', '{}' is not allowed.".format(type(self).__name__, self._allowedTypes, elem))
514397
synchronized void add(final Container container) {
    final String containerId = container.getId().toString();
    if (this.hasContainer(containerId)) {
      throw new RuntimeException("Trying to add a Container that is already known: " + containerId);
    }
    this.containers.put(containerId, container);
  }
1372030
def add(self, *resources):
        
        self.doapi_manager.request(self.url + '/resources', method='POST',
                                   data={"resources": _to_taggable(resources)})
712452
private boolean add(ResourceInternal<T> resource) {
    try {
      mLock.lock();
      if (mResources.size() >= mMaxCapacity) {
        return false;
      } else {
        mResources.put(resource.mResource, resource);
        return true;
      }
    } finally {
      mLock.unlock();
    }
  }