_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q11300
Counters.toRankCounter
train
public static <E> IntCounter<E> toRankCounter(Counter<E> c) { IntCounter<E> rankCounter = new IntCounter<E>(); List<E> sortedList = toSortedList(c); for (int i = 0; i < sortedList.size(); i++) { rankCounter.setCount(sortedList.get(i), i); } return rankCounter; }
java
{ "resource": "" }
q11301
Counters.toSortedListWithCounts
train
public static <E> List<Pair<E, Double>> toSortedListWithCounts(Counter<E> c) { List<Pair<E, Double>> l = new ArrayList<Pair<E, Double>>(c.size()); for (E e : c.keySet()) { l.add(new Pair<E, Double>(e, c.getCount(e))); } // descending order Collections.sort(l, new Comparator<Pair<E, Double>>() { public int compare(Pair<E, Double> a, Pair<E, Double> b) { return Double.compare(b.second, a.second); } }); return l; }
java
{ "resource": "" }
q11302
Counters.intersection
train
public static <E> Counter<E> intersection(Counter<E> c1, Counter<E> c2) { Counter<E> result = c1.getFactory().create(); for (E key : Sets.union(c1.keySet(), c2.keySet())) { double count1 = c1.getCount(key); double count2 = c2.getCount(key); double minCount = (count1 < count2 ? count1 : count2); if (minCount > 0) { result.setCount(key, minCount); } } return result; }
java
{ "resource": "" }
q11303
Counters.optimizedDotProduct
train
public static <E> double optimizedDotProduct(Counter<E> c1, Counter<E> c2) { double dotProd = 0.0; int size1 = c1.size(); int size2 = c2.size(); if (size1 < size2) { for (E key : c1.keySet()) { double count1 = c1.getCount(key); if (count1 != 0.0) { double count2 = c2.getCount(key); if (count2 != 0.0) dotProd += (count1 * count2); } } } else { for (E key : c2.keySet()) { double count2 = c2.getCount(key); if (count2 != 0.0) { double count1 = c1.getCount(key); if (count1 != 0.0) dotProd += (count1 * count2); } } } return dotProd; }
java
{ "resource": "" }
q11304
Counters.absoluteDifference
train
public static <E> Counter<E> absoluteDifference(Counter<E> c1, Counter<E> c2) { Counter<E> result = c1.getFactory().create(); for (E key : Sets.union(c1.keySet(), c2.keySet())) { double newCount = Math.abs(c1.getCount(key) - c2.getCount(key)); if (newCount > 0) { result.setCount(key, newCount); } } return result; }
java
{ "resource": "" }
q11305
Counters.division
train
public static <E> Counter<E> division(Counter<E> c1, Counter<E> c2) { Counter<E> result = c1.getFactory().create(); for (E key : Sets.union(c1.keySet(), c2.keySet())) { result.setCount(key, c1.getCount(key) / c2.getCount(key)); } return result; }
java
{ "resource": "" }
q11306
Counters.crossEntropy
train
public static <E> double crossEntropy(Counter<E> from, Counter<E> to) { double tot2 = to.totalCount(); double result = 0.0; for (E key : from.keySet()) { double count1 = from.getCount(key); if (count1 == 0.0) { continue; } double count2 = to.getCount(key); double logFract = Math.log(count2 / tot2); if (logFract == Double.NEGATIVE_INFINITY) { return Double.NEGATIVE_INFINITY; // can't recover } result += count1 * (logFract / LOG_E_2); // express it in log base 2 } return result; }
java
{ "resource": "" }
q11307
Counters.L2Normalize
train
public static <E, C extends Counter<E>> C L2Normalize(C c) { return scale(c, 1.0 / L2Norm(c)); }
java
{ "resource": "" }
q11308
Counters.L2NormalizeInPlace
train
public static <E, C extends Counter<E>> Counter<E> L2NormalizeInPlace(Counter<E> c) { return multiplyInPlace(c, 1.0 / L2Norm(c)); }
java
{ "resource": "" }
q11309
Counters.saferL2Normalize
train
public static <E, C extends Counter<E>> C saferL2Normalize(C c) { return scale(c, 1.0 / saferL2Norm(c)); }
java
{ "resource": "" }
q11310
Counters.average
train
public static <E> Counter<E> average(Counter<E> c1, Counter<E> c2) { Counter<E> average = c1.getFactory().create(); Set<E> allKeys = new HashSet<E>(c1.keySet()); allKeys.addAll(c2.keySet()); for (E key : allKeys) { average.setCount(key, (c1.getCount(key) + c2.getCount(key)) * 0.5); } return average; }
java
{ "resource": "" }
q11311
Counters.linearCombination
train
public static <E> Counter<E> linearCombination(Counter<E> c1, double w1, Counter<E> c2, double w2) { Counter<E> result = c1.getFactory().create(); for (E o : c1.keySet()) { result.incrementCount(o, c1.getCount(o) * w1); } for (E o : c2.keySet()) { result.incrementCount(o, c2.getCount(o) * w2); } return result; }
java
{ "resource": "" }
q11312
Counters.scale
train
@SuppressWarnings("unchecked") public static <E, C extends Counter<E>> C scale(C c, double s) { C scaled = (C) c.getFactory().create(); for (E key : c.keySet()) { scaled.setCount(key, c.getCount(key) * s); } return scaled; }
java
{ "resource": "" }
q11313
Counters.tfLogScale
train
@SuppressWarnings("unchecked") public static <E, C extends Counter<E>> C tfLogScale(C c, double base) { C scaled = (C) c.getFactory().create(); for (E key : c.keySet()) { double cnt = c.getCount(key); double scaledCnt = 0.0; if (cnt > 0) { scaledCnt = 1.0 + SloppyMath.log(cnt, base); } scaled.setCount(key, scaledCnt); } return scaled; }
java
{ "resource": "" }
q11314
Counters.loadIntoCounter
train
private static <E> void loadIntoCounter(String filename, Class<E> c, Counter<E> counter) throws RuntimeException { try { Constructor<E> m = c.getConstructor(String.class); BufferedReader in = IOUtils.getBufferedFileReader(filename);// new // BufferedReader(new // FileReader(filename)); String line = in.readLine(); while (line != null && line.length() > 0) { int endPos = Math.max(line.lastIndexOf(' '), line.lastIndexOf('\t')); counter.setCount(m.newInstance(line.substring(0, endPos).trim()), Double.parseDouble(line.substring(endPos, line.length()).trim())); line = in.readLine(); } in.close(); } catch (Exception e) { throw new RuntimeException(e); } }
java
{ "resource": "" }
q11315
Counters.toCounter
train
public static <E> Counter<E> toCounter(Map<Integer, ? extends Number> counts, Index<E> index) { Counter<E> counter = new ClassicCounter<E>(); for (Map.Entry<Integer, ? extends Number> entry : counts.entrySet()) { counter.setCount(index.get(entry.getKey()), entry.getValue().doubleValue()); } return counter; }
java
{ "resource": "" }
q11316
Counters.sample
train
@SuppressWarnings("unchecked") // This is not good code, but what's there to be done? TODO public static <T> T sample(Counter<T> c, Random rand) { Iterable<T> objects; Set<T> keySet = c.keySet(); objects = c.keySet(); if (rand == null) { rand = new Random(); } else { // TODO: Seems like there should be a way to directly check if T is // comparable if (!keySet.isEmpty() && keySet.iterator().next() instanceof Comparable) { List l = new ArrayList<T>(keySet); Collections.sort(l); objects = l; } else { throw new RuntimeException("Results won't be stable since Counters keys are comparable."); } } double r = rand.nextDouble() * c.totalCount(); double total = 0.0; for (T t : objects) { // arbitrary ordering total += c.getCount(t); if (total >= r) return t; } // only chance of reaching here is if c isn't properly normalized, or if // double math makes total<1.0 return c.keySet().iterator().next(); }
java
{ "resource": "" }
q11317
Counters.powNormalized
train
public static <E> Counter<E> powNormalized(Counter<E> c, double temp) { Counter<E> d = c.getFactory().create(); double total = c.totalCount(); for (E e : c.keySet()) { d.setCount(e, Math.pow(c.getCount(e) / total, temp)); } return d; }
java
{ "resource": "" }
q11318
Counters.asCounter
train
public static <E> Counter<E> asCounter(FixedPrioritiesPriorityQueue<E> p) { FixedPrioritiesPriorityQueue<E> pq = p.clone(); ClassicCounter<E> counter = new ClassicCounter<E>(); while (pq.hasNext()) { double priority = pq.getPriority(); E element = pq.next(); counter.incrementCount(element, priority); } return counter; }
java
{ "resource": "" }
q11319
Counters.asMap
train
public static <E> Map<E, Double> asMap(final Counter<E> counter) { return new AbstractMap<E, Double>() { @Override public int size() { return counter.size(); } @Override public Set<Entry<E, Double>> entrySet() { return counter.entrySet(); } @Override @SuppressWarnings("unchecked") public boolean containsKey(Object key) { return counter.containsKey((E) key); } @Override @SuppressWarnings("unchecked") public Double get(Object key) { return counter.getCount((E) key); } @Override public Double put(E key, Double value) { double last = counter.getCount(key); counter.setCount(key, value); return last; } @Override @SuppressWarnings("unchecked") public Double remove(Object key) { return counter.remove((E) key); } @Override public Set<E> keySet() { return counter.keySet(); } }; }
java
{ "resource": "" }
q11320
appqoepolicy_binding.get
train
public static appqoepolicy_binding get(nitro_service service, String name) throws Exception{ appqoepolicy_binding obj = new appqoepolicy_binding(); obj.set_name(name); appqoepolicy_binding response = (appqoepolicy_binding) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11321
appfwxmlcontenttype.add
train
public static base_response add(nitro_service client, appfwxmlcontenttype resource) throws Exception { appfwxmlcontenttype addresource = new appfwxmlcontenttype(); addresource.xmlcontenttypevalue = resource.xmlcontenttypevalue; addresource.isregex = resource.isregex; return addresource.add_resource(client); }
java
{ "resource": "" }
q11322
appfwxmlcontenttype.add
train
public static base_responses add(nitro_service client, appfwxmlcontenttype resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwxmlcontenttype addresources[] = new appfwxmlcontenttype[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new appfwxmlcontenttype(); addresources[i].xmlcontenttypevalue = resources[i].xmlcontenttypevalue; addresources[i].isregex = resources[i].isregex; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11323
appfwxmlcontenttype.delete
train
public static base_response delete(nitro_service client, String xmlcontenttypevalue) throws Exception { appfwxmlcontenttype deleteresource = new appfwxmlcontenttype(); deleteresource.xmlcontenttypevalue = xmlcontenttypevalue; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11324
appfwxmlcontenttype.delete
train
public static base_responses delete(nitro_service client, String xmlcontenttypevalue[]) throws Exception { base_responses result = null; if (xmlcontenttypevalue != null && xmlcontenttypevalue.length > 0) { appfwxmlcontenttype deleteresources[] = new appfwxmlcontenttype[xmlcontenttypevalue.length]; for (int i=0;i<xmlcontenttypevalue.length;i++){ deleteresources[i] = new appfwxmlcontenttype(); deleteresources[i].xmlcontenttypevalue = xmlcontenttypevalue[i]; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q11325
appfwxmlcontenttype.get
train
public static appfwxmlcontenttype[] get(nitro_service service) throws Exception{ appfwxmlcontenttype obj = new appfwxmlcontenttype(); appfwxmlcontenttype[] response = (appfwxmlcontenttype[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11326
appfwxmlcontenttype.get
train
public static appfwxmlcontenttype get(nitro_service service, String xmlcontenttypevalue) throws Exception{ appfwxmlcontenttype obj = new appfwxmlcontenttype(); obj.set_xmlcontenttypevalue(xmlcontenttypevalue); appfwxmlcontenttype response = (appfwxmlcontenttype) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11327
appfwxmlcontenttype.get
train
public static appfwxmlcontenttype[] get(nitro_service service, String xmlcontenttypevalue[]) throws Exception{ if (xmlcontenttypevalue !=null && xmlcontenttypevalue.length>0) { appfwxmlcontenttype response[] = new appfwxmlcontenttype[xmlcontenttypevalue.length]; appfwxmlcontenttype obj[] = new appfwxmlcontenttype[xmlcontenttypevalue.length]; for (int i=0;i<xmlcontenttypevalue.length;i++) { obj[i] = new appfwxmlcontenttype(); obj[i].set_xmlcontenttypevalue(xmlcontenttypevalue[i]); response[i] = (appfwxmlcontenttype) obj[i].get_resource(service); } return response; } return null; }
java
{ "resource": "" }
q11328
policymap.add
train
public static base_response add(nitro_service client, policymap resource) throws Exception { policymap addresource = new policymap(); addresource.mappolicyname = resource.mappolicyname; addresource.sd = resource.sd; addresource.su = resource.su; addresource.td = resource.td; addresource.tu = resource.tu; return addresource.add_resource(client); }
java
{ "resource": "" }
q11329
policymap.add
train
public static base_responses add(nitro_service client, policymap resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { policymap addresources[] = new policymap[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new policymap(); addresources[i].mappolicyname = resources[i].mappolicyname; addresources[i].sd = resources[i].sd; addresources[i].su = resources[i].su; addresources[i].td = resources[i].td; addresources[i].tu = resources[i].tu; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11330
policymap.delete
train
public static base_response delete(nitro_service client, String mappolicyname) throws Exception { policymap deleteresource = new policymap(); deleteresource.mappolicyname = mappolicyname; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11331
policymap.delete
train
public static base_responses delete(nitro_service client, String mappolicyname[]) throws Exception { base_responses result = null; if (mappolicyname != null && mappolicyname.length > 0) { policymap deleteresources[] = new policymap[mappolicyname.length]; for (int i=0;i<mappolicyname.length;i++){ deleteresources[i] = new policymap(); deleteresources[i].mappolicyname = mappolicyname[i]; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q11332
policymap.get
train
public static policymap[] get(nitro_service service) throws Exception{ policymap obj = new policymap(); policymap[] response = (policymap[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11333
policymap.get
train
public static policymap get(nitro_service service, String mappolicyname) throws Exception{ policymap obj = new policymap(); obj.set_mappolicyname(mappolicyname); policymap response = (policymap) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11334
policymap.get
train
public static policymap[] get(nitro_service service, String mappolicyname[]) throws Exception{ if (mappolicyname !=null && mappolicyname.length>0) { policymap response[] = new policymap[mappolicyname.length]; policymap obj[] = new policymap[mappolicyname.length]; for (int i=0;i<mappolicyname.length;i++) { obj[i] = new policymap(); obj[i].set_mappolicyname(mappolicyname[i]); response[i] = (policymap) obj[i].get_resource(service); } return response; } return null; }
java
{ "resource": "" }
q11335
iptunnelparam.unset
train
public static base_response unset(nitro_service client, iptunnelparam resource, String[] args) throws Exception{ iptunnelparam unsetresource = new iptunnelparam(); return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q11336
iptunnelparam.get
train
public static iptunnelparam get(nitro_service service) throws Exception{ iptunnelparam obj = new iptunnelparam(); iptunnelparam[] response = (iptunnelparam[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q11337
statobjects.get
train
public static statobjects get(nitro_service service) throws Exception{ statobjects obj = new statobjects(); statobjects[] response = (statobjects[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q11338
lbmonitor_metric_binding.get
train
public static lbmonitor_metric_binding[] get(nitro_service service, String monitorname) throws Exception{ lbmonitor_metric_binding obj = new lbmonitor_metric_binding(); obj.set_monitorname(monitorname); lbmonitor_metric_binding response[] = (lbmonitor_metric_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11339
lbmonitor_metric_binding.count
train
public static long count(nitro_service service, String monitorname) throws Exception{ lbmonitor_metric_binding obj = new lbmonitor_metric_binding(); obj.set_monitorname(monitorname); options option = new options(); option.set_count(true); lbmonitor_metric_binding response[] = (lbmonitor_metric_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
{ "resource": "" }
q11340
server_binding.get
train
public static server_binding get(nitro_service service, String name) throws Exception{ server_binding obj = new server_binding(); obj.set_name(name); server_binding response = (server_binding) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11341
aaacertparams.update
train
public static base_response update(nitro_service client, aaacertparams resource) throws Exception { aaacertparams updateresource = new aaacertparams(); updateresource.usernamefield = resource.usernamefield; updateresource.groupnamefield = resource.groupnamefield; updateresource.defaultauthenticationgroup = resource.defaultauthenticationgroup; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11342
aaacertparams.unset
train
public static base_response unset(nitro_service client, aaacertparams resource, String[] args) throws Exception{ aaacertparams unsetresource = new aaacertparams(); return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q11343
aaacertparams.get
train
public static aaacertparams get(nitro_service service) throws Exception{ aaacertparams obj = new aaacertparams(); aaacertparams[] response = (aaacertparams[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q11344
cmpaction.add
train
public static base_response add(nitro_service client, cmpaction resource) throws Exception { cmpaction addresource = new cmpaction(); addresource.name = resource.name; addresource.cmptype = resource.cmptype; addresource.deltatype = resource.deltatype; return addresource.add_resource(client); }
java
{ "resource": "" }
q11345
cmpaction.add
train
public static base_responses add(nitro_service client, cmpaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { cmpaction addresources[] = new cmpaction[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new cmpaction(); addresources[i].name = resources[i].name; addresources[i].cmptype = resources[i].cmptype; addresources[i].deltatype = resources[i].deltatype; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11346
cmpaction.get
train
public static cmpaction[] get(nitro_service service, options option) throws Exception{ cmpaction obj = new cmpaction(); cmpaction[] response = (cmpaction[])obj.get_resources(service,option); return response; }
java
{ "resource": "" }
q11347
cmpaction.get
train
public static cmpaction get(nitro_service service, String name) throws Exception{ cmpaction obj = new cmpaction(); obj.set_name(name); cmpaction response = (cmpaction) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11348
netbridge.delete
train
public static base_response delete(nitro_service client, String name) throws Exception { netbridge deleteresource = new netbridge(); deleteresource.name = name; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11349
netbridge.get
train
public static netbridge[] get(nitro_service service, options option) throws Exception{ netbridge obj = new netbridge(); netbridge[] response = (netbridge[])obj.get_resources(service,option); return response; }
java
{ "resource": "" }
q11350
netbridge.get
train
public static netbridge get(nitro_service service, String name) throws Exception{ netbridge obj = new netbridge(); obj.set_name(name); netbridge response = (netbridge) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11351
nsaptlicense.change
train
public static base_response change(nitro_service client, nsaptlicense resource) throws Exception { nsaptlicense updateresource = new nsaptlicense(); updateresource.id = resource.id; updateresource.sessionid = resource.sessionid; updateresource.bindtype = resource.bindtype; updateresource.countavailable = resource.countavailable; updateresource.licensedir = resource.licensedir; return updateresource.perform_operation(client,"update"); }
java
{ "resource": "" }
q11352
nsaptlicense.change
train
public static base_responses change(nitro_service client, nsaptlicense resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsaptlicense updateresources[] = new nsaptlicense[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nsaptlicense(); updateresources[i].id = resources[i].id; updateresources[i].sessionid = resources[i].sessionid; updateresources[i].bindtype = resources[i].bindtype; updateresources[i].countavailable = resources[i].countavailable; updateresources[i].licensedir = resources[i].licensedir; } result = perform_operation_bulk_request(client, updateresources,"update"); } return result; }
java
{ "resource": "" }
q11353
nsaptlicense.get
train
public static nsaptlicense[] get(nitro_service service, nsaptlicense_args args) throws Exception{ nsaptlicense obj = new nsaptlicense(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nsaptlicense[] response = (nsaptlicense[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q11354
cacheglobal_cachepolicy_binding.get
train
public static cacheglobal_cachepolicy_binding[] get(nitro_service service) throws Exception{ cacheglobal_cachepolicy_binding obj = new cacheglobal_cachepolicy_binding(); cacheglobal_cachepolicy_binding response[] = (cacheglobal_cachepolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11355
responderpolicy_stats.get
train
public static responderpolicy_stats[] get(nitro_service service) throws Exception{ responderpolicy_stats obj = new responderpolicy_stats(); responderpolicy_stats[] response = (responderpolicy_stats[])obj.stat_resources(service); return response; }
java
{ "resource": "" }
q11356
responderpolicy_stats.get
train
public static responderpolicy_stats get(nitro_service service, String name) throws Exception{ responderpolicy_stats obj = new responderpolicy_stats(); obj.set_name(name); responderpolicy_stats response = (responderpolicy_stats) obj.stat_resource(service); return response; }
java
{ "resource": "" }
q11357
authenticationradiuspolicy_systemglobal_binding.get
train
public static authenticationradiuspolicy_systemglobal_binding[] get(nitro_service service, String name) throws Exception{ authenticationradiuspolicy_systemglobal_binding obj = new authenticationradiuspolicy_systemglobal_binding(); obj.set_name(name); authenticationradiuspolicy_systemglobal_binding response[] = (authenticationradiuspolicy_systemglobal_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11358
authenticationcertpolicy_systemglobal_binding.get
train
public static authenticationcertpolicy_systemglobal_binding[] get(nitro_service service, String name) throws Exception{ authenticationcertpolicy_systemglobal_binding obj = new authenticationcertpolicy_systemglobal_binding(); obj.set_name(name); authenticationcertpolicy_systemglobal_binding response[] = (authenticationcertpolicy_systemglobal_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11359
snmptrap.add
train
public static base_response add(nitro_service client, snmptrap resource) throws Exception { snmptrap addresource = new snmptrap(); addresource.trapclass = resource.trapclass; addresource.trapdestination = resource.trapdestination; addresource.version = resource.version; addresource.destport = resource.destport; addresource.communityname = resource.communityname; addresource.srcip = resource.srcip; addresource.severity = resource.severity; return addresource.add_resource(client); }
java
{ "resource": "" }
q11360
snmptrap.add
train
public static base_responses add(nitro_service client, snmptrap resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmptrap addresources[] = new snmptrap[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new snmptrap(); addresources[i].trapclass = resources[i].trapclass; addresources[i].trapdestination = resources[i].trapdestination; addresources[i].version = resources[i].version; addresources[i].destport = resources[i].destport; addresources[i].communityname = resources[i].communityname; addresources[i].srcip = resources[i].srcip; addresources[i].severity = resources[i].severity; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11361
snmptrap.delete
train
public static base_response delete(nitro_service client, String trapclass) throws Exception { snmptrap deleteresource = new snmptrap(); deleteresource.trapclass = trapclass; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11362
snmptrap.delete
train
public static base_response delete(nitro_service client, snmptrap resource) throws Exception { snmptrap deleteresource = new snmptrap(); deleteresource.trapclass = resource.trapclass; deleteresource.trapdestination = resource.trapdestination; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11363
snmptrap.delete
train
public static base_responses delete(nitro_service client, String trapclass[]) throws Exception { base_responses result = null; if (trapclass != null && trapclass.length > 0) { snmptrap deleteresources[] = new snmptrap[trapclass.length]; for (int i=0;i<trapclass.length;i++){ deleteresources[i] = new snmptrap(); deleteresources[i].trapclass = trapclass[i]; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q11364
snmptrap.delete
train
public static base_responses delete(nitro_service client, snmptrap resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmptrap deleteresources[] = new snmptrap[resources.length]; for (int i=0;i<resources.length;i++){ deleteresources[i] = new snmptrap(); deleteresources[i].trapclass = resources[i].trapclass; deleteresources[i].trapdestination = resources[i].trapdestination; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q11365
snmptrap.update
train
public static base_response update(nitro_service client, snmptrap resource) throws Exception { snmptrap updateresource = new snmptrap(); updateresource.trapclass = resource.trapclass; updateresource.trapdestination = resource.trapdestination; updateresource.destport = resource.destport; updateresource.version = resource.version; updateresource.communityname = resource.communityname; updateresource.srcip = resource.srcip; updateresource.severity = resource.severity; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11366
snmptrap.update
train
public static base_responses update(nitro_service client, snmptrap resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmptrap updateresources[] = new snmptrap[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new snmptrap(); updateresources[i].trapclass = resources[i].trapclass; updateresources[i].trapdestination = resources[i].trapdestination; updateresources[i].destport = resources[i].destport; updateresources[i].version = resources[i].version; updateresources[i].communityname = resources[i].communityname; updateresources[i].srcip = resources[i].srcip; updateresources[i].severity = resources[i].severity; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q11367
snmptrap.unset
train
public static base_response unset(nitro_service client, snmptrap resource, String[] args) throws Exception{ snmptrap unsetresource = new snmptrap(); unsetresource.trapclass = resource.trapclass; unsetresource.trapdestination = resource.trapdestination; return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q11368
snmptrap.unset
train
public static base_responses unset(nitro_service client, snmptrap resources[], String[] args) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmptrap unsetresources[] = new snmptrap[resources.length]; for (int i=0;i<resources.length;i++){ unsetresources[i] = new snmptrap(); unsetresources[i].trapclass = resources[i].trapclass; unsetresources[i].trapdestination = resources[i].trapdestination; } result = unset_bulk_request(client, unsetresources,args); } return result; }
java
{ "resource": "" }
q11369
snmptrap.get
train
public static snmptrap[] get(nitro_service service) throws Exception{ snmptrap obj = new snmptrap(); snmptrap[] response = (snmptrap[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11370
reporting.enable
train
public static base_response enable(nitro_service client) throws Exception { reporting enableresource = new reporting(); return enableresource.perform_operation(client,"enable"); }
java
{ "resource": "" }
q11371
reporting.disable
train
public static base_response disable(nitro_service client) throws Exception { reporting disableresource = new reporting(); return disableresource.perform_operation(client,"disable"); }
java
{ "resource": "" }
q11372
reporting.get
train
public static reporting get(nitro_service service) throws Exception{ reporting obj = new reporting(); reporting[] response = (reporting[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q11373
systemgroup_systemcmdpolicy_binding.get
train
public static systemgroup_systemcmdpolicy_binding[] get(nitro_service service, String groupname) throws Exception{ systemgroup_systemcmdpolicy_binding obj = new systemgroup_systemcmdpolicy_binding(); obj.set_groupname(groupname); systemgroup_systemcmdpolicy_binding response[] = (systemgroup_systemcmdpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11374
systemgroup_systemcmdpolicy_binding.count
train
public static long count(nitro_service service, String groupname) throws Exception{ systemgroup_systemcmdpolicy_binding obj = new systemgroup_systemcmdpolicy_binding(); obj.set_groupname(groupname); options option = new options(); option.set_count(true); systemgroup_systemcmdpolicy_binding response[] = (systemgroup_systemcmdpolicy_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
{ "resource": "" }
q11375
nssimpleacl_stats.get
train
public static nssimpleacl_stats get(nitro_service service) throws Exception{ nssimpleacl_stats obj = new nssimpleacl_stats(); nssimpleacl_stats[] response = (nssimpleacl_stats[])obj.stat_resources(service); return response[0]; }
java
{ "resource": "" }
q11376
Converter.getAsInteger
train
public static Integer getAsInteger(Object value) { Integer result = null; try { if (value instanceof String) { result = Integer.valueOf((String) value); } else if (value instanceof Number) { result = ((Number) value).intValue(); } else { result = null; } } catch (Exception e) { result = null; } return result == null ? 0 : result; }
java
{ "resource": "" }
q11377
Converter.getAsLong
train
public static Long getAsLong(Object value) { Long result = null; try { if (value instanceof String) { result = Long.valueOf((String) value); } else if (value instanceof Number) { result = ((Number) value).longValue(); } else { result = null; } } catch (Exception e) { result = null; } return result == null ? 0 : result; }
java
{ "resource": "" }
q11378
Converter.getAsDouble
train
public static Double getAsDouble(Object value) { Double result = null; try { if (value instanceof String) { result = Double.valueOf((String) value); } else if (value instanceof Number) { result = ((Number) value).doubleValue(); } else { result = null; } } catch (Exception e) { result = null; } return result == null ? 0 : result; }
java
{ "resource": "" }
q11379
lbvserver_binding.get
train
public static lbvserver_binding get(nitro_service service, String name) throws Exception{ lbvserver_binding obj = new lbvserver_binding(); obj.set_name(name); lbvserver_binding response = (lbvserver_binding) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11380
cspolicy_crvserver_binding.get
train
public static cspolicy_crvserver_binding[] get(nitro_service service, String policyname) throws Exception{ cspolicy_crvserver_binding obj = new cspolicy_crvserver_binding(); obj.set_policyname(policyname); cspolicy_crvserver_binding response[] = (cspolicy_crvserver_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11381
VisibilityHandler.alsoShow
train
public boolean alsoShow(Object filter){ switch(this.defaultState){ case HIDE_ALL: return this.deltaPool.add(filter); case SHOW_ALL: return this.deltaPool.remove(filter); default: throw new IllegalStateException("Unknown default state setting: " + this.defaultState); } }
java
{ "resource": "" }
q11382
systemuser_systemcmdpolicy_binding.get
train
public static systemuser_systemcmdpolicy_binding[] get(nitro_service service, String username) throws Exception{ systemuser_systemcmdpolicy_binding obj = new systemuser_systemcmdpolicy_binding(); obj.set_username(username); systemuser_systemcmdpolicy_binding response[] = (systemuser_systemcmdpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11383
snmpcommunity.add
train
public static base_response add(nitro_service client, snmpcommunity resource) throws Exception { snmpcommunity addresource = new snmpcommunity(); addresource.communityname = resource.communityname; addresource.permissions = resource.permissions; return addresource.add_resource(client); }
java
{ "resource": "" }
q11384
snmpcommunity.add
train
public static base_responses add(nitro_service client, snmpcommunity resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmpcommunity addresources[] = new snmpcommunity[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new snmpcommunity(); addresources[i].communityname = resources[i].communityname; addresources[i].permissions = resources[i].permissions; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11385
snmpcommunity.delete
train
public static base_response delete(nitro_service client, String communityname) throws Exception { snmpcommunity deleteresource = new snmpcommunity(); deleteresource.communityname = communityname; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11386
snmpcommunity.delete
train
public static base_responses delete(nitro_service client, String communityname[]) throws Exception { base_responses result = null; if (communityname != null && communityname.length > 0) { snmpcommunity deleteresources[] = new snmpcommunity[communityname.length]; for (int i=0;i<communityname.length;i++){ deleteresources[i] = new snmpcommunity(); deleteresources[i].communityname = communityname[i]; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q11387
snmpcommunity.get
train
public static snmpcommunity[] get(nitro_service service) throws Exception{ snmpcommunity obj = new snmpcommunity(); snmpcommunity[] response = (snmpcommunity[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11388
snmpcommunity.get
train
public static snmpcommunity get(nitro_service service, String communityname) throws Exception{ snmpcommunity obj = new snmpcommunity(); obj.set_communityname(communityname); snmpcommunity response = (snmpcommunity) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11389
snmpcommunity.get
train
public static snmpcommunity[] get(nitro_service service, String communityname[]) throws Exception{ if (communityname !=null && communityname.length>0) { snmpcommunity response[] = new snmpcommunity[communityname.length]; snmpcommunity obj[] = new snmpcommunity[communityname.length]; for (int i=0;i<communityname.length;i++) { obj[i] = new snmpcommunity(); obj[i].set_communityname(communityname[i]); response[i] = (snmpcommunity) obj[i].get_resource(service); } return response; } return null; }
java
{ "resource": "" }
q11390
sslservice_sslpolicy_binding.get
train
public static sslservice_sslpolicy_binding[] get(nitro_service service, String servicename) throws Exception{ sslservice_sslpolicy_binding obj = new sslservice_sslpolicy_binding(); obj.set_servicename(servicename); sslservice_sslpolicy_binding response[] = (sslservice_sslpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11391
vrid6_nsip6_binding.get
train
public static vrid6_nsip6_binding[] get(nitro_service service, Long id) throws Exception{ vrid6_nsip6_binding obj = new vrid6_nsip6_binding(); obj.set_id(id); vrid6_nsip6_binding response[] = (vrid6_nsip6_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11392
policyexpression.add
train
public static base_response add(nitro_service client, policyexpression resource) throws Exception { policyexpression addresource = new policyexpression(); addresource.name = resource.name; addresource.value = resource.value; addresource.description = resource.description; addresource.comment = resource.comment; addresource.clientsecuritymessage = resource.clientsecuritymessage; return addresource.add_resource(client); }
java
{ "resource": "" }
q11393
policyexpression.add
train
public static base_responses add(nitro_service client, policyexpression resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { policyexpression addresources[] = new policyexpression[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new policyexpression(); addresources[i].name = resources[i].name; addresources[i].value = resources[i].value; addresources[i].description = resources[i].description; addresources[i].comment = resources[i].comment; addresources[i].clientsecuritymessage = resources[i].clientsecuritymessage; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11394
policyexpression.update
train
public static base_response update(nitro_service client, policyexpression resource) throws Exception { policyexpression updateresource = new policyexpression(); updateresource.name = resource.name; updateresource.value = resource.value; updateresource.description = resource.description; updateresource.comment = resource.comment; updateresource.clientsecuritymessage = resource.clientsecuritymessage; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11395
policyexpression.update
train
public static base_responses update(nitro_service client, policyexpression resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { policyexpression updateresources[] = new policyexpression[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new policyexpression(); updateresources[i].name = resources[i].name; updateresources[i].value = resources[i].value; updateresources[i].description = resources[i].description; updateresources[i].comment = resources[i].comment; updateresources[i].clientsecuritymessage = resources[i].clientsecuritymessage; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q11396
policyexpression.get
train
public static policyexpression[] get(nitro_service service) throws Exception{ policyexpression obj = new policyexpression(); policyexpression[] response = (policyexpression[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11397
policyexpression.get
train
public static policyexpression[] get(nitro_service service, policyexpression_args args) throws Exception{ policyexpression obj = new policyexpression(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); policyexpression[] response = (policyexpression[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q11398
policyexpression.get
train
public static policyexpression get(nitro_service service, String name) throws Exception{ policyexpression obj = new policyexpression(); obj.set_name(name); policyexpression response = (policyexpression) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11399
systemdatasource.get
train
public static systemdatasource get(nitro_service service) throws Exception{ systemdatasource obj = new systemdatasource(); systemdatasource[] response = (systemdatasource[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }