_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q11100
dnsnsrec.get
train
public static dnsnsrec[] get(nitro_service service, dnsnsrec_args args) throws Exception{ dnsnsrec obj = new dnsnsrec(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); dnsnsrec[] response = (dnsnsrec[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q11101
dnsnsrec.get
train
public static dnsnsrec get(nitro_service service, String domain) throws Exception{ dnsnsrec obj = new dnsnsrec(); obj.set_domain(domain); dnsnsrec response = (dnsnsrec) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11102
IOUtils.writeObjectToTempFile
train
public static File writeObjectToTempFile(Object o, String filename) throws IOException { File file = File.createTempFile(filename, ".tmp"); file.deleteOnExit(); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream( new GZIPOutputStream(new FileOutputStream(file)))); oos.writeObject(o); oos.close(); return file; }
java
{ "resource": "" }
q11103
IOUtils.writeObjectToTempFileNoExceptions
train
public static File writeObjectToTempFileNoExceptions(Object o, String filename) { try { return writeObjectToTempFile(o, filename); } catch (Exception e) { System.err.println("Error writing object to file " + filename); e.printStackTrace(); return null; } }
java
{ "resource": "" }
q11104
IOUtils.writeStringToFile
train
public static void writeStringToFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(path)); } else { writer = new BufferedOutputStream(new FileOutputStream(path)); } writer.write(contents.getBytes(encoding)); }
java
{ "resource": "" }
q11105
IOUtils.writeStringToFileNoExceptions
train
public static void writeStringToFileNoExceptions(String contents, String path, String encoding) { OutputStream writer = null; try{ if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(path)); } else { writer = new BufferedOutputStream(new FileOutputStream(path)); } writer.write(contents.getBytes(encoding)); } catch (Exception e) { e.printStackTrace(); } finally { if(writer != null){ closeIgnoringExceptions(writer); } } }
java
{ "resource": "" }
q11106
IOUtils.writeStringToTempFile
train
public static File writeStringToTempFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; File tmp = File.createTempFile(path,".tmp"); if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(tmp)); } else { writer = new BufferedOutputStream(new FileOutputStream(tmp)); } writer.write(contents.getBytes(encoding)); writer.close(); return tmp; }
java
{ "resource": "" }
q11107
IOUtils.writeStringToTempFileNoExceptions
train
public static File writeStringToTempFileNoExceptions(String contents, String path, String encoding) { OutputStream writer = null; File tmp = null; try{ tmp = File.createTempFile(path,".tmp"); if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(tmp)); } else { writer = new BufferedOutputStream(new FileOutputStream(tmp)); } writer.write(contents.getBytes(encoding)); } catch (Exception e) { e.printStackTrace(); } finally { if(writer != null){ closeIgnoringExceptions(writer); } } return tmp; }
java
{ "resource": "" }
q11108
IOUtils.readObjectFromFileNoExceptions
train
public static <T> T readObjectFromFileNoExceptions(File file) { Object o = null; try { ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream( new GZIPInputStream(new FileInputStream(file)))); o = ois.readObject(); ois.close(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return ErasureUtils.<T> uncheckedCast(o); }
java
{ "resource": "" }
q11109
IOUtils.findStreamInClasspathOrFileSystem
train
private static InputStream findStreamInClasspathOrFileSystem(String fn) throws FileNotFoundException { // ms 10-04-2010: // - even though this may look like a regular file, it may be a path inside a jar in the CLASSPATH // - check for this first. This takes precedence over the file system. InputStream is = IOUtils.class.getClassLoader().getResourceAsStream(fn); // if not found in the CLASSPATH, load from the file system if (is == null) is = new FileInputStream(fn); return is; }
java
{ "resource": "" }
q11110
IOUtils.openFile
train
public static InputStream openFile(File file) throws RuntimeIOException { try { InputStream is = new BufferedInputStream(new FileInputStream(file)); if (file.getName().endsWith(".gz")) { is = new GZIPInputStream(is); } return is; } catch (Exception e) { throw new RuntimeIOException(e); } }
java
{ "resource": "" }
q11111
IOUtils.slurpFile
train
public static String slurpFile(String filename, String encoding) throws IOException { Reader r = new InputStreamReader(new FileInputStream(filename), encoding); return IOUtils.slurpReader(r); }
java
{ "resource": "" }
q11112
IOUtils.slurpReader
train
public static String slurpReader(Reader reader) { BufferedReader r = new BufferedReader(reader); StringBuilder buff = new StringBuilder(); try { char[] chars = new char[SLURPBUFFSIZE]; while (true) { int amountRead = r.read(chars, 0, SLURPBUFFSIZE); if (amountRead < 0) { break; } buff.append(chars, 0, amountRead); } r.close(); } catch (Exception e) { throw new RuntimeIOException("slurpReader IO problem", e); } return buff.toString(); }
java
{ "resource": "" }
q11113
IOUtils.writeStreamToStream
train
public static void writeStreamToStream(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[4096]; while (true) { int len = input.read(buffer); if (len == -1) { break; } output.write(buffer, 0, len); } }
java
{ "resource": "" }
q11114
IOUtils.readCSVWithHeader
train
public static List<Map<String,String>> readCSVWithHeader(String path, char quoteChar, char escapeChar) throws IOException { String[] labels = null; List<Map<String,String>> rows = Generics.newArrayList(); for (String line : IOUtils.readLines(path)) { System.out.println("Splitting "+line); if (labels == null) { labels = StringUtils.splitOnCharWithQuoting(line,',','"',escapeChar); } else { String[] cells = StringUtils.splitOnCharWithQuoting(line,',',quoteChar,escapeChar); assert(cells.length == labels.length); Map<String,String> cellMap = new HashMap<String,String>(); for (int i=0; i<labels.length; i++) cellMap.put(labels[i],cells[i]); rows.add(cellMap); } } return rows; }
java
{ "resource": "" }
q11115
IOUtils.readColumnSet
train
public static Set<String> readColumnSet(String infile, int field) throws IOException { BufferedReader br = IOUtils.getBufferedFileReader(infile); String line; Set<String> set = new HashSet<String>(); while ((line = br.readLine()) != null) { line = line.trim(); if (line.length() > 0) { if (field < 0) { set.add(line); } else { String[] fields = tab.split(line); if (field < fields.length) { set.add(fields[field]); } } } } br.close(); return set; }
java
{ "resource": "" }
q11116
IOUtils.stringFromFile
train
public static String stringFromFile(String filename, String encoding) { try { StringBuilder sb = new StringBuilder(); BufferedReader in = new BufferedReader(new EncodingFileReader(filename,encoding)); String line; while ((line = in.readLine()) != null) { sb.append(line); sb.append(eolChar); } in.close(); return sb.toString(); } catch (IOException e) { e.printStackTrace(); return null; } }
java
{ "resource": "" }
q11117
IOUtils.linesFromFile
train
public static List<String> linesFromFile(String filename,String encoding) { try { List<String> lines = new ArrayList<String>(); BufferedReader in = new BufferedReader(new EncodingFileReader(filename,encoding)); String line; while ((line = in.readLine()) != null) { lines.add(line); } in.close(); return lines; } catch (IOException e) { e.printStackTrace(); return null; } }
java
{ "resource": "" }
q11118
IOUtils.getJNLPLocalScratch
train
public static File getJNLPLocalScratch() { try { String machineName = InetAddress.getLocalHost().getHostName().split("\\.")[0]; String username = System.getProperty("user.name"); return new File("/"+machineName+"/scr1/"+username); } catch (Exception e) { return new File("./scr/"); // default scratch } }
java
{ "resource": "" }
q11119
IOUtils.ensureDir
train
public static File ensureDir(File tgtDir) throws Exception { if (tgtDir.exists()) { if (tgtDir.isDirectory()) return tgtDir; else throw new Exception("Could not create directory "+tgtDir.getAbsolutePath()+", as a file already exists at that path."); } else { tgtDir.mkdirs(); return tgtDir; } }
java
{ "resource": "" }
q11120
ArrayCoreMap.compact
train
public void compact() { if (keys.length > size) { Class<?>[] newKeys = new Class<?>[size]; Object[] newVals = new Object[size]; System.arraycopy(keys, 0, newKeys, 0, size); System.arraycopy(values, 0, newVals, 0, size); keys = newKeys; values = newVals; } }
java
{ "resource": "" }
q11121
route.add
train
public static base_response add(nitro_service client, route resource) throws Exception { route addresource = new route(); addresource.network = resource.network; addresource.netmask = resource.netmask; addresource.gateway = resource.gateway; addresource.cost = resource.cost; addresource.td = resource.td; addresource.distance = resource.distance; addresource.cost1 = resource.cost1; addresource.weight = resource.weight; addresource.advertise = resource.advertise; addresource.protocol = resource.protocol; addresource.msr = resource.msr; addresource.monitor = resource.monitor; return addresource.add_resource(client); }
java
{ "resource": "" }
q11122
route.add
train
public static base_responses add(nitro_service client, route resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { route addresources[] = new route[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new route(); addresources[i].network = resources[i].network; addresources[i].netmask = resources[i].netmask; addresources[i].gateway = resources[i].gateway; addresources[i].cost = resources[i].cost; addresources[i].td = resources[i].td; addresources[i].distance = resources[i].distance; addresources[i].cost1 = resources[i].cost1; addresources[i].weight = resources[i].weight; addresources[i].advertise = resources[i].advertise; addresources[i].protocol = resources[i].protocol; addresources[i].msr = resources[i].msr; addresources[i].monitor = resources[i].monitor; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11123
route.delete
train
public static base_response delete(nitro_service client, route resource) throws Exception { route deleteresource = new route(); deleteresource.network = resource.network; deleteresource.netmask = resource.netmask; deleteresource.gateway = resource.gateway; deleteresource.td = resource.td; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11124
route.delete
train
public static base_responses delete(nitro_service client, route resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { route deleteresources[] = new route[resources.length]; for (int i=0;i<resources.length;i++){ deleteresources[i] = new route(); deleteresources[i].network = resources[i].network; deleteresources[i].netmask = resources[i].netmask; deleteresources[i].gateway = resources[i].gateway; deleteresources[i].td = resources[i].td; } result = delete_bulk_request(client, deleteresources); } return result; }
java
{ "resource": "" }
q11125
route.update
train
public static base_response update(nitro_service client, route resource) throws Exception { route updateresource = new route(); updateresource.network = resource.network; updateresource.netmask = resource.netmask; updateresource.gateway = resource.gateway; updateresource.td = resource.td; updateresource.distance = resource.distance; updateresource.cost1 = resource.cost1; updateresource.weight = resource.weight; updateresource.advertise = resource.advertise; updateresource.protocol = resource.protocol; updateresource.msr = resource.msr; updateresource.monitor = resource.monitor; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11126
route.update
train
public static base_responses update(nitro_service client, route resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { route updateresources[] = new route[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new route(); updateresources[i].network = resources[i].network; updateresources[i].netmask = resources[i].netmask; updateresources[i].gateway = resources[i].gateway; updateresources[i].td = resources[i].td; updateresources[i].distance = resources[i].distance; updateresources[i].cost1 = resources[i].cost1; updateresources[i].weight = resources[i].weight; updateresources[i].advertise = resources[i].advertise; updateresources[i].protocol = resources[i].protocol; updateresources[i].msr = resources[i].msr; updateresources[i].monitor = resources[i].monitor; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q11127
route.unset
train
public static base_response unset(nitro_service client, route resource, String[] args) throws Exception{ route unsetresource = new route(); unsetresource.network = resource.network; unsetresource.netmask = resource.netmask; unsetresource.gateway = resource.gateway; unsetresource.td = resource.td; return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q11128
route.get
train
public static route[] get(nitro_service service, options option) throws Exception{ route obj = new route(); route[] response = (route[])obj.get_resources(service,option); return response; }
java
{ "resource": "" }
q11129
route.get
train
public static route[] get(nitro_service service, route_args args) throws Exception{ route obj = new route(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); route[] response = (route[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q11130
nsappflowcollector.add
train
public static base_response add(nitro_service client, nsappflowcollector resource) throws Exception { nsappflowcollector addresource = new nsappflowcollector(); addresource.name = resource.name; addresource.ipaddress = resource.ipaddress; addresource.port = resource.port; return addresource.add_resource(client); }
java
{ "resource": "" }
q11131
nsappflowcollector.get
train
public static nsappflowcollector[] get(nitro_service service) throws Exception{ nsappflowcollector obj = new nsappflowcollector(); nsappflowcollector[] response = (nsappflowcollector[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11132
nsappflowcollector.get
train
public static nsappflowcollector get(nitro_service service, String name) throws Exception{ nsappflowcollector obj = new nsappflowcollector(); obj.set_name(name); nsappflowcollector response = (nsappflowcollector) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11133
PascalTemplate.setValue
train
public void setValue(String fieldName, String value) { int index = getFieldIndex(fieldName); assert(index != -1); values[index] = value; }
java
{ "resource": "" }
q11134
systemcountergroup.get
train
public static systemcountergroup get(nitro_service service) throws Exception{ systemcountergroup obj = new systemcountergroup(); systemcountergroup[] response = (systemcountergroup[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q11135
systemcountergroup.get
train
public static systemcountergroup[] get(nitro_service service, systemcountergroup_args args) throws Exception{ systemcountergroup obj = new systemcountergroup(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); systemcountergroup[] response = (systemcountergroup[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q11136
Relation.getRelation
train
static Relation getRelation(String s, String arg, Function<String,String> basicCatFunction, HeadFinder headFinder) throws ParseException { if (arg == null) { return getRelation(s, basicCatFunction, headFinder); } Relation r; if (s.equals("<")) { r = new HasIthChild(Integer.parseInt(arg)); } else if (s.equals(">")) { r = new IthChildOf(Integer.parseInt(arg)); } else if (s.equals("<+")) { r = new UnbrokenCategoryDominates(arg, basicCatFunction); } else if (s.equals(">+")) { r = new UnbrokenCategoryIsDominatedBy(arg, basicCatFunction); } else if (s.equals(".+")) { r = new UnbrokenCategoryPrecedes(arg, basicCatFunction); } else if (s.equals(",+")) { r = new UnbrokenCategoryFollows(arg, basicCatFunction); } else { throw new ParseException("Unrecognized compound relation " + s + ' ' + arg); } return Interner.globalIntern(r); }
java
{ "resource": "" }
q11137
AbstractTokenizer.next
train
public T next() { if (nextToken == null) { nextToken = getNext(); } T result = nextToken; nextToken = null; if (result == null) { throw new NoSuchElementException(); } return result; }
java
{ "resource": "" }
q11138
AbstractTokenizer.peek
train
public T peek() { if (nextToken == null) { nextToken = getNext(); } if (nextToken == null) { throw new NoSuchElementException(); } return nextToken; }
java
{ "resource": "" }
q11139
AbstractTokenizer.tokenize
train
public List<T> tokenize() { // System.out.println("tokenize called"); List<T> result = new ArrayList<T>(); while (hasNext()) { result.add(next()); } return result; }
java
{ "resource": "" }
q11140
lbvserver_transformpolicy_binding.get
train
public static lbvserver_transformpolicy_binding[] get(nitro_service service, String name) throws Exception{ lbvserver_transformpolicy_binding obj = new lbvserver_transformpolicy_binding(); obj.set_name(name); lbvserver_transformpolicy_binding response[] = (lbvserver_transformpolicy_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11141
MtasSolrResultUtil.rewriteToArray
train
private static ArrayList<NamedList<Object>> rewriteToArray( NamedList<Object> nnl) { ArrayList<NamedList<Object>> al = new ArrayList<>(); String key; Iterator<Entry<String, Object>> it = nnl.iterator(); while (it.hasNext()) { Entry<String, Object> entry = it.next(); NamedList<Object> item = (NamedList<Object>) entry.getValue(); key = entry.getKey(); if (key.startsWith(GroupHit.KEY_START)) { StringBuilder newKey = new StringBuilder(""); item.add("group", GroupHit.keyToObject(key, newKey)); item.add("key", newKey.toString().trim()); } else { item.add("key", key); } al.add(item); } return al; }
java
{ "resource": "" }
q11142
MtasSolrResultUtil.rewriteMergeList
train
@SuppressWarnings({ "unchecked", "unused" }) private static void rewriteMergeList(String key, String subKey, NamedList<Object> snl, NamedList<Object> tnl) { for (int i = 0; i < tnl.size(); i++) { Object item = snl.get(tnl.getName(i)); if (item != null && tnl.getVal(i) instanceof NamedList) { NamedList<Object> tnnl = (NamedList<Object>) tnl.getVal(i); Object o = tnnl.get(key); NamedList<Object> tnnnl; if (o != null && o instanceof NamedList) { tnnnl = (NamedList<Object>) o; } else { tnnnl = new SimpleOrderedMap<>(); tnnl.add(key, tnnnl); } tnnnl.add(subKey, item); } } }
java
{ "resource": "" }
q11143
MtasSolrResultUtil.rewriteMergeData
train
@SuppressWarnings({ "unused", "unchecked" }) private static void rewriteMergeData(String key, String subKey, NamedList<Object> snl, NamedList<Object> tnl) { if (snl != null) { Object o = tnl.get(key); NamedList<Object> tnnnl; if (o != null && o instanceof NamedList) { tnnnl = (NamedList<Object>) o; } else { tnnnl = new SimpleOrderedMap<>(); tnl.add(key, tnnnl); } tnnnl.add(subKey, snl); } }
java
{ "resource": "" }
q11144
MtasSolrResultUtil.getIdsFromParameters
train
public static SortedSet<String> getIdsFromParameters(SolrParams params, String prefix) { SortedSet<String> ids = new TreeSet<>(); Iterator<String> it = params.getParameterNamesIterator(); Pattern pattern = Pattern .compile("^" + Pattern.quote(prefix) + "\\.([^\\.]+)(\\..*|$)"); while (it.hasNext()) { String item = it.next(); Matcher m = pattern.matcher(item); if (m.matches()) { ids.add(m.group(1)); } } return ids; }
java
{ "resource": "" }
q11145
MtasSolrResultUtil.compareAndCheck
train
public static void compareAndCheck(String[] list, String[] original, String nameNew, String nameOriginal, Boolean unique) throws IOException { if (list != null) { if (list.length != original.length) { throw new IOException( "unequal size " + nameNew + " and " + nameOriginal); } if (unique) { Set<String> set = new HashSet<>(); for (int i = 0; i < list.length; i++) { set.add(list[i]); } if (set.size() < list.length) { throw new IOException("duplicate " + nameNew); } } } }
java
{ "resource": "" }
q11146
MtasSolrResultUtil.constructQuery
train
public static MtasSpanQuery constructQuery(String queryValue, String queryType, String queryPrefix, HashMap<String, String[]> queryVariables, String field, String queryIgnore, Integer maximumIgnoreLength) throws IOException { if (queryType == null || queryType.isEmpty()) { throw new IOException("no (valid) type for query " + queryValue); } else if (queryValue == null || queryValue.isEmpty()) { throw new IOException("no (valid) value for " + queryType + " query"); } MtasSpanQuery ignore = null; if (queryIgnore != null) { Reader queryIgnoreReader = new BufferedReader( new StringReader(queryIgnore)); if (queryType.equals(QUERY_TYPE_CQL)) { MtasCQLParser ip = new MtasCQLParser(queryIgnoreReader); try { ignore = ip.parse(field, null, null, null, null); } catch (mtas.parser.cql.ParseException e) { throw new IOException("couldn't parse " + queryType + " query " + queryIgnore + " (" + e.getMessage() + ")", e); } catch (TokenMgrError e) { throw new IOException("couldn't parse " + queryType + " query " + queryIgnore + " (" + e.getMessage() + ")", e); } } else { throw new IOException( "unknown queryType " + queryType + " for query " + queryValue); } } Reader queryValueReader = new BufferedReader(new StringReader(queryValue)); if (queryType.equals(QUERY_TYPE_CQL)) { MtasCQLParser qp = new MtasCQLParser(queryValueReader); try { return qp.parse(field, queryPrefix, queryVariables, ignore, maximumIgnoreLength); } catch (mtas.parser.cql.ParseException e) { throw new IOException("couldn't parse " + queryType + " query " + queryValue + " (" + e.getMessage() + ")", e); } catch (TokenMgrError e) { throw new IOException("couldn't parse " + queryType + " query " + queryValue + " (" + e.getMessage() + ")", e); } } else { throw new IOException( "unknown queryType " + queryType + " for query " + queryValue); } }
java
{ "resource": "" }
q11147
TeXHyphenator.loadDefault
train
public void loadDefault() { try { load( new BufferedReader(new StringReader( DefaultTeXHyphenData.hyphenData) ) ); } catch(IOException e) { // shouldn't happen throw new RuntimeException(e); } }
java
{ "resource": "" }
q11148
filterpolicy_lbvserver_binding.get
train
public static filterpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{ filterpolicy_lbvserver_binding obj = new filterpolicy_lbvserver_binding(); obj.set_name(name); filterpolicy_lbvserver_binding response[] = (filterpolicy_lbvserver_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11149
appflowcollector.add
train
public static base_response add(nitro_service client, appflowcollector resource) throws Exception { appflowcollector addresource = new appflowcollector(); addresource.name = resource.name; addresource.ipaddress = resource.ipaddress; addresource.port = resource.port; addresource.netprofile = resource.netprofile; return addresource.add_resource(client); }
java
{ "resource": "" }
q11150
appflowcollector.get
train
public static appflowcollector[] get(nitro_service service) throws Exception{ appflowcollector obj = new appflowcollector(); appflowcollector[] response = (appflowcollector[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11151
appflowcollector.get
train
public static appflowcollector get(nitro_service service, String name) throws Exception{ appflowcollector obj = new appflowcollector(); obj.set_name(name); appflowcollector response = (appflowcollector) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11152
responderaction.add
train
public static base_response add(nitro_service client, responderaction resource) throws Exception { responderaction addresource = new responderaction(); addresource.name = resource.name; addresource.type = resource.type; addresource.target = resource.target; addresource.htmlpage = resource.htmlpage; addresource.bypasssafetycheck = resource.bypasssafetycheck; addresource.comment = resource.comment; return addresource.add_resource(client); }
java
{ "resource": "" }
q11153
responderaction.add
train
public static base_responses add(nitro_service client, responderaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { responderaction addresources[] = new responderaction[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new responderaction(); addresources[i].name = resources[i].name; addresources[i].type = resources[i].type; addresources[i].target = resources[i].target; addresources[i].htmlpage = resources[i].htmlpage; addresources[i].bypasssafetycheck = resources[i].bypasssafetycheck; addresources[i].comment = resources[i].comment; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11154
responderaction.update
train
public static base_response update(nitro_service client, responderaction resource) throws Exception { responderaction updateresource = new responderaction(); updateresource.name = resource.name; updateresource.target = resource.target; updateresource.bypasssafetycheck = resource.bypasssafetycheck; updateresource.htmlpage = resource.htmlpage; updateresource.comment = resource.comment; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11155
responderaction.update
train
public static base_responses update(nitro_service client, responderaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { responderaction updateresources[] = new responderaction[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new responderaction(); updateresources[i].name = resources[i].name; updateresources[i].target = resources[i].target; updateresources[i].bypasssafetycheck = resources[i].bypasssafetycheck; updateresources[i].htmlpage = resources[i].htmlpage; updateresources[i].comment = resources[i].comment; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q11156
responderaction.get
train
public static responderaction[] get(nitro_service service) throws Exception{ responderaction obj = new responderaction(); responderaction[] response = (responderaction[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11157
responderaction.get
train
public static responderaction get(nitro_service service, String name) throws Exception{ responderaction obj = new responderaction(); obj.set_name(name); responderaction response = (responderaction) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11158
vpnsessionpolicy_binding.get
train
public static vpnsessionpolicy_binding get(nitro_service service, String name) throws Exception{ vpnsessionpolicy_binding obj = new vpnsessionpolicy_binding(); obj.set_name(name); vpnsessionpolicy_binding response = (vpnsessionpolicy_binding) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11159
wisite_translationinternalip_binding.get
train
public static wisite_translationinternalip_binding[] get(nitro_service service, String sitepath) throws Exception{ wisite_translationinternalip_binding obj = new wisite_translationinternalip_binding(); obj.set_sitepath(sitepath); wisite_translationinternalip_binding response[] = (wisite_translationinternalip_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11160
wisite_translationinternalip_binding.count
train
public static long count(nitro_service service, String sitepath) throws Exception{ wisite_translationinternalip_binding obj = new wisite_translationinternalip_binding(); obj.set_sitepath(sitepath); options option = new options(); option.set_count(true); wisite_translationinternalip_binding response[] = (wisite_translationinternalip_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
{ "resource": "" }
q11161
authenticationlocalpolicy_systemglobal_binding.get
train
public static authenticationlocalpolicy_systemglobal_binding[] get(nitro_service service, String name) throws Exception{ authenticationlocalpolicy_systemglobal_binding obj = new authenticationlocalpolicy_systemglobal_binding(); obj.set_name(name); authenticationlocalpolicy_systemglobal_binding response[] = (authenticationlocalpolicy_systemglobal_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11162
appfwprofile_xmlwsiurl_binding.get
train
public static appfwprofile_xmlwsiurl_binding[] get(nitro_service service, String name) throws Exception{ appfwprofile_xmlwsiurl_binding obj = new appfwprofile_xmlwsiurl_binding(); obj.set_name(name); appfwprofile_xmlwsiurl_binding response[] = (appfwprofile_xmlwsiurl_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11163
snmpgroup.add
train
public static base_response add(nitro_service client, snmpgroup resource) throws Exception { snmpgroup addresource = new snmpgroup(); addresource.name = resource.name; addresource.securitylevel = resource.securitylevel; addresource.readviewname = resource.readviewname; return addresource.add_resource(client); }
java
{ "resource": "" }
q11164
snmpgroup.add
train
public static base_responses add(nitro_service client, snmpgroup resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmpgroup addresources[] = new snmpgroup[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new snmpgroup(); addresources[i].name = resources[i].name; addresources[i].securitylevel = resources[i].securitylevel; addresources[i].readviewname = resources[i].readviewname; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11165
snmpgroup.delete
train
public static base_response delete(nitro_service client, snmpgroup resource) throws Exception { snmpgroup deleteresource = new snmpgroup(); deleteresource.name = resource.name; deleteresource.securitylevel = resource.securitylevel; return deleteresource.delete_resource(client); }
java
{ "resource": "" }
q11166
snmpgroup.update
train
public static base_response update(nitro_service client, snmpgroup resource) throws Exception { snmpgroup updateresource = new snmpgroup(); updateresource.name = resource.name; updateresource.securitylevel = resource.securitylevel; updateresource.readviewname = resource.readviewname; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11167
snmpgroup.update
train
public static base_responses update(nitro_service client, snmpgroup resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { snmpgroup updateresources[] = new snmpgroup[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new snmpgroup(); updateresources[i].name = resources[i].name; updateresources[i].securitylevel = resources[i].securitylevel; updateresources[i].readviewname = resources[i].readviewname; } result = update_bulk_request(client, updateresources); } return result; }
java
{ "resource": "" }
q11168
snmpgroup.get
train
public static snmpgroup[] get(nitro_service service) throws Exception{ snmpgroup obj = new snmpgroup(); snmpgroup[] response = (snmpgroup[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11169
lbparameter.update
train
public static base_response update(nitro_service client, lbparameter resource) throws Exception { lbparameter updateresource = new lbparameter(); updateresource.httponlycookieflag = resource.httponlycookieflag; updateresource.consolidatedlconn = resource.consolidatedlconn; updateresource.useportforhashlb = resource.useportforhashlb; updateresource.preferdirectroute = resource.preferdirectroute; updateresource.startuprrfactor = resource.startuprrfactor; updateresource.monitorskipmaxclient = resource.monitorskipmaxclient; updateresource.monitorconnectionclose = resource.monitorconnectionclose; updateresource.vserverspecificmac = resource.vserverspecificmac; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11170
lbparameter.unset
train
public static base_response unset(nitro_service client, lbparameter resource, String[] args) throws Exception{ lbparameter unsetresource = new lbparameter(); return unsetresource.unset_resource(client,args); }
java
{ "resource": "" }
q11171
lbparameter.get
train
public static lbparameter get(nitro_service service) throws Exception{ lbparameter obj = new lbparameter(); lbparameter[] response = (lbparameter[])obj.get_resources(service); return response[0]; }
java
{ "resource": "" }
q11172
auditnslogpolicy_lbvserver_binding.get
train
public static auditnslogpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{ auditnslogpolicy_lbvserver_binding obj = new auditnslogpolicy_lbvserver_binding(); obj.set_name(name); auditnslogpolicy_lbvserver_binding response[] = (auditnslogpolicy_lbvserver_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11173
policystringmap.add
train
public static base_response add(nitro_service client, policystringmap resource) throws Exception { policystringmap addresource = new policystringmap(); addresource.name = resource.name; addresource.comment = resource.comment; return addresource.add_resource(client); }
java
{ "resource": "" }
q11174
policystringmap.update
train
public static base_response update(nitro_service client, policystringmap resource) throws Exception { policystringmap updateresource = new policystringmap(); updateresource.name = resource.name; updateresource.comment = resource.comment; return updateresource.update_resource(client); }
java
{ "resource": "" }
q11175
policystringmap.get
train
public static policystringmap[] get(nitro_service service) throws Exception{ policystringmap obj = new policystringmap(); policystringmap[] response = (policystringmap[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11176
policystringmap.get
train
public static policystringmap get(nitro_service service, String name) throws Exception{ policystringmap obj = new policystringmap(); obj.set_name(name); policystringmap response = (policystringmap) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11177
rewritepolicylabel_policybinding_binding.get
train
public static rewritepolicylabel_policybinding_binding[] get(nitro_service service, String labelname) throws Exception{ rewritepolicylabel_policybinding_binding obj = new rewritepolicylabel_policybinding_binding(); obj.set_labelname(labelname); rewritepolicylabel_policybinding_binding response[] = (rewritepolicylabel_policybinding_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11178
MtasFieldsConsumer.registerPrefix
train
private void registerPrefix(String field, String prefix, IndexOutput outPrefix) throws IOException { if (!prefixReferenceIndex.containsKey(field)) { prefixReferenceIndex.put(field, new HashMap<String, Long>()); prefixIdIndex.put(field, new HashMap<String, Integer>()); } if (!prefixReferenceIndex.get(field).containsKey(prefix)) { int id = 1 + prefixReferenceIndex.get(field).size(); prefixReferenceIndex.get(field).put(prefix, outPrefix.getFilePointer()); prefixIdIndex.get(field).put(prefix, id); outPrefix.writeString(prefix); } }
java
{ "resource": "" }
q11179
MtasFieldsConsumer.registerPrefixIntersection
train
private void registerPrefixIntersection(String field, String prefix, int start, int end, HashMap<String, HashSet<Integer>> docFieldAdministration) { if (!intersectingPrefixes.containsKey(field)) { intersectingPrefixes.put(field, new HashSet<String>()); } else if (intersectingPrefixes.get(field).contains(prefix)) { return; } HashSet<Integer> docFieldPrefixAdministration; if (!docFieldAdministration.containsKey(prefix)) { docFieldPrefixAdministration = new HashSet<>(); docFieldAdministration.put(prefix, docFieldPrefixAdministration); } else { docFieldPrefixAdministration = docFieldAdministration.get(prefix); // check for (int p = start; p <= end; p++) { if (docFieldPrefixAdministration.contains(p)) { intersectingPrefixes.get(field).add(prefix); docFieldAdministration.remove(prefix); return; } } } // update for (int p = start; p <= end; p++) { docFieldPrefixAdministration.add(p); } }
java
{ "resource": "" }
q11180
MtasFieldsConsumer.registerPrefixStatsSinglePositionValue
train
public void registerPrefixStatsSinglePositionValue(String field, String prefix, IndexOutput outPrefix) throws IOException { initPrefixStatsField(field); registerPrefix(field, prefix, outPrefix); if (!multiplePositionPrefix.get(field).contains(prefix)) { singlePositionPrefix.get(field).add(prefix); } }
java
{ "resource": "" }
q11181
MtasFieldsConsumer.registerPrefixStatsRangePositionValue
train
public void registerPrefixStatsRangePositionValue(String field, String prefix, IndexOutput outPrefix) throws IOException { initPrefixStatsField(field); registerPrefix(field, prefix, outPrefix); singlePositionPrefix.get(field).remove(prefix); multiplePositionPrefix.get(field).add(prefix); }
java
{ "resource": "" }
q11182
MtasFieldsConsumer.initPrefixStatsField
train
private void initPrefixStatsField(String field) { if (!singlePositionPrefix.containsKey(field)) { singlePositionPrefix.put(field, new HashSet<String>()); } if (!multiplePositionPrefix.containsKey(field)) { multiplePositionPrefix.put(field, new HashSet<String>()); } if (!setPositionPrefix.containsKey(field)) { setPositionPrefix.put(field, new HashSet<String>()); } }
java
{ "resource": "" }
q11183
MtasFieldsConsumer.getPrefixStatsSinglePositionPrefixAttribute
train
public String getPrefixStatsSinglePositionPrefixAttribute(String field) { return String.join(MtasToken.DELIMITER, singlePositionPrefix.get(field)); }
java
{ "resource": "" }
q11184
MtasFieldsConsumer.getPrefixStatsMultiplePositionPrefixAttribute
train
public String getPrefixStatsMultiplePositionPrefixAttribute(String field) { return String.join(MtasToken.DELIMITER, multiplePositionPrefix.get(field)); }
java
{ "resource": "" }
q11185
MtasFieldsConsumer.getPrefixStatsSetPositionPrefixAttribute
train
public String getPrefixStatsSetPositionPrefixAttribute(String field) { return String.join(MtasToken.DELIMITER, setPositionPrefix.get(field)); }
java
{ "resource": "" }
q11186
MtasFieldsConsumer.getPrefixStatsIntersectionPrefixAttribute
train
public String getPrefixStatsIntersectionPrefixAttribute(String field) { if (intersectingPrefixes.containsKey(field)) { return String.join(MtasToken.DELIMITER, intersectingPrefixes.get(field)); } else { return ""; } }
java
{ "resource": "" }
q11187
MtasFieldsConsumer.tokenStatsAdd
train
private void tokenStatsAdd(int min, int max) { tokenStatsNumber++; if (tokenStatsMinPos == null) { tokenStatsMinPos = min; } else { tokenStatsMinPos = Math.min(tokenStatsMinPos, min); } if (tokenStatsMaxPos == null) { tokenStatsMaxPos = max; } else { tokenStatsMaxPos = Math.max(tokenStatsMaxPos, max); } }
java
{ "resource": "" }
q11188
MtasFieldsConsumer.copyObjectAndUpdateStats
train
private void copyObjectAndUpdateStats(int id, IndexInput in, Long inRef, IndexOutput out) throws IOException { int mtasId; int objectFlags; // read in.seek(inRef); mtasId = in.readVInt(); assert id == mtasId : "wrong id detected while copying object"; objectFlags = in.readVInt(); out.writeVInt(mtasId); out.writeVInt(objectFlags); if ((objectFlags & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT) { out.writeVInt(in.readVInt()); } if ((objectFlags & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE) { int minPos = in.readVInt(); int maxPos = in.readVInt(); out.writeVInt(minPos); out.writeVInt(maxPos); tokenStatsAdd(minPos, maxPos); } else if ((objectFlags & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET) { int size = in.readVInt(); out.writeVInt(size); SortedSet<Integer> list = new TreeSet<>(); int previousPosition = 0; for (int t = 0; t < size; t++) { int pos = in.readVInt(); out.writeVInt(pos); previousPosition = (pos + previousPosition); list.add(previousPosition); } assert list.size() == size : "duplicate positions in set are not allowed"; tokenStatsAdd(list.first(), list.last()); } else { int pos = in.readVInt(); out.writeVInt(pos); tokenStatsAdd(pos, pos); } if ((objectFlags & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET) { out.writeVInt(in.readVInt()); out.writeVInt(in.readVInt()); } if ((objectFlags & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET) { out.writeVInt(in.readVInt()); out.writeVInt(in.readVInt()); } if ((objectFlags & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD) { int length = in.readVInt(); out.writeVInt(length); byte[] payload = new byte[length]; in.readBytes(payload, 0, length); out.writeBytes(payload, payload.length); } out.writeVLong(in.readVLong()); }
java
{ "resource": "" }
q11189
aaagroup_vpnintranetapplication_binding.get
train
public static aaagroup_vpnintranetapplication_binding[] get(nitro_service service, String groupname) throws Exception{ aaagroup_vpnintranetapplication_binding obj = new aaagroup_vpnintranetapplication_binding(); obj.set_groupname(groupname); aaagroup_vpnintranetapplication_binding response[] = (aaagroup_vpnintranetapplication_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11190
MemoryTreebank.load
train
public void load(Reader r, String id) { try { // could throw an IO exception? TreeReader tr = treeReaderFactory().newTreeReader(r); int sentIndex = 0; for (Tree pt; (pt = tr.readTree()) != null; ) { if (pt.label() instanceof HasIndex) { // so we can trace where this tree came from HasIndex hi = (HasIndex) pt.label(); if (id != null) { hi.setDocID(id); } hi.setSentIndex(sentIndex); } parseTrees.add(pt); sentIndex++; } } catch (IOException e) { System.err.println("load IO Exception: " + e); } }
java
{ "resource": "" }
q11191
MemoryTreebank.apply
train
@Override public void apply(TreeVisitor tp) { for (int i = 0, size = parseTrees.size(); i < size; i++) { tp.visitTree(parseTrees.get(i)); } // or could do as Iterator but slower // Iterator iter = parseTrees.iterator(); // while (iter.hasNext()) { // tp.visitTree((Tree) iter.next()); // } }
java
{ "resource": "" }
q11192
aaauser_vpnurl_binding.get
train
public static aaauser_vpnurl_binding[] get(nitro_service service, String username) throws Exception{ aaauser_vpnurl_binding obj = new aaauser_vpnurl_binding(); obj.set_username(username); aaauser_vpnurl_binding response[] = (aaauser_vpnurl_binding[]) obj.get_resources(service); return response; }
java
{ "resource": "" }
q11193
iptunnel.add
train
public static base_response add(nitro_service client, iptunnel resource) throws Exception { iptunnel addresource = new iptunnel(); addresource.name = resource.name; addresource.remote = resource.remote; addresource.remotesubnetmask = resource.remotesubnetmask; addresource.local = resource.local; addresource.protocol = resource.protocol; addresource.ipsecprofilename = resource.ipsecprofilename; return addresource.add_resource(client); }
java
{ "resource": "" }
q11194
iptunnel.add
train
public static base_responses add(nitro_service client, iptunnel resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { iptunnel addresources[] = new iptunnel[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new iptunnel(); addresources[i].name = resources[i].name; addresources[i].remote = resources[i].remote; addresources[i].remotesubnetmask = resources[i].remotesubnetmask; addresources[i].local = resources[i].local; addresources[i].protocol = resources[i].protocol; addresources[i].ipsecprofilename = resources[i].ipsecprofilename; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }
q11195
iptunnel.get
train
public static iptunnel[] get(nitro_service service) throws Exception{ iptunnel obj = new iptunnel(); iptunnel[] response = (iptunnel[])obj.get_resources(service); return response; }
java
{ "resource": "" }
q11196
iptunnel.get
train
public static iptunnel[] get(nitro_service service, iptunnel_args args) throws Exception{ iptunnel obj = new iptunnel(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); iptunnel[] response = (iptunnel[])obj.get_resources(service, option); return response; }
java
{ "resource": "" }
q11197
iptunnel.get
train
public static iptunnel get(nitro_service service, String name) throws Exception{ iptunnel obj = new iptunnel(); obj.set_name(name); iptunnel response = (iptunnel) obj.get_resource(service); return response; }
java
{ "resource": "" }
q11198
dnscnamerec.add
train
public static base_response add(nitro_service client, dnscnamerec resource) throws Exception { dnscnamerec addresource = new dnscnamerec(); addresource.aliasname = resource.aliasname; addresource.canonicalname = resource.canonicalname; addresource.ttl = resource.ttl; return addresource.add_resource(client); }
java
{ "resource": "" }
q11199
dnscnamerec.add
train
public static base_responses add(nitro_service client, dnscnamerec resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { dnscnamerec addresources[] = new dnscnamerec[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new dnscnamerec(); addresources[i].aliasname = resources[i].aliasname; addresources[i].canonicalname = resources[i].canonicalname; addresources[i].ttl = resources[i].ttl; } result = add_bulk_request(client, addresources); } return result; }
java
{ "resource": "" }