code
stringlengths 73
34.1k
| label
stringclasses 1
value |
---|---|
public static base_responses delete(nitro_service client, String prefix[]) throws Exception {
base_responses result = null;
if (prefix != null && prefix.length > 0) {
nsxmlnamespace deleteresources[] = new nsxmlnamespace[prefix.length];
for (int i=0;i<prefix.length;i++){
deleteresources[i] = new nsxmlnamespace();
deleteresources[i].prefix = prefix[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_response update(nitro_service client, nsxmlnamespace resource) throws Exception {
nsxmlnamespace updateresource = new nsxmlnamespace();
updateresource.prefix = resource.prefix;
updateresource.Namespace = resource.Namespace;
updateresource.description = resource.description;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, nsxmlnamespace resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nsxmlnamespace updateresources[] = new nsxmlnamespace[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new nsxmlnamespace();
updateresources[i].prefix = resources[i].prefix;
updateresources[i].Namespace = resources[i].Namespace;
updateresources[i].description = resources[i].description;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static base_response unset(nitro_service client, nsxmlnamespace resource, String[] args) throws Exception{
nsxmlnamespace unsetresource = new nsxmlnamespace();
unsetresource.prefix = resource.prefix;
return unsetresource.unset_resource(client,args);
} | java |
public static base_responses unset(nitro_service client, String prefix[], String args[]) throws Exception {
base_responses result = null;
if (prefix != null && prefix.length > 0) {
nsxmlnamespace unsetresources[] = new nsxmlnamespace[prefix.length];
for (int i=0;i<prefix.length;i++){
unsetresources[i] = new nsxmlnamespace();
unsetresources[i].prefix = prefix[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java |
public static nsxmlnamespace[] get(nitro_service service) throws Exception{
nsxmlnamespace obj = new nsxmlnamespace();
nsxmlnamespace[] response = (nsxmlnamespace[])obj.get_resources(service);
return response;
} | java |
public static nsxmlnamespace get(nitro_service service, String prefix) throws Exception{
nsxmlnamespace obj = new nsxmlnamespace();
obj.set_prefix(prefix);
nsxmlnamespace response = (nsxmlnamespace) obj.get_resource(service);
return response;
} | java |
public static nsxmlnamespace[] get(nitro_service service, String prefix[]) throws Exception{
if (prefix !=null && prefix.length>0) {
nsxmlnamespace response[] = new nsxmlnamespace[prefix.length];
nsxmlnamespace obj[] = new nsxmlnamespace[prefix.length];
for (int i=0;i<prefix.length;i++) {
obj[i] = new nsxmlnamespace();
obj[i].set_prefix(prefix[i]);
response[i] = (nsxmlnamespace) obj[i].get_resource(service);
}
return response;
}
return null;
} | java |
public static nsxmlnamespace[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
nsxmlnamespace obj = new nsxmlnamespace();
options option = new options();
option.set_filter(filter);
nsxmlnamespace[] response = (nsxmlnamespace[]) obj.getfiltered(service, option);
return response;
} | java |
public static lbvserver_appfwpolicy_binding[] get(nitro_service service, String name) throws Exception{
lbvserver_appfwpolicy_binding obj = new lbvserver_appfwpolicy_binding();
obj.set_name(name);
lbvserver_appfwpolicy_binding response[] = (lbvserver_appfwpolicy_binding[]) obj.get_resources(service);
return response;
} | java |
public static sslservice_sslcertkey_binding[] get(nitro_service service, String servicename) throws Exception{
sslservice_sslcertkey_binding obj = new sslservice_sslcertkey_binding();
obj.set_servicename(servicename);
sslservice_sslcertkey_binding response[] = (sslservice_sslcertkey_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response update(nitro_service client, locationparameter resource) throws Exception {
locationparameter updateresource = new locationparameter();
updateresource.context = resource.context;
updateresource.q1label = resource.q1label;
updateresource.q2label = resource.q2label;
updateresource.q3label = resource.q3label;
updateresource.q4label = resource.q4label;
updateresource.q5label = resource.q5label;
updateresource.q6label = resource.q6label;
return updateresource.update_resource(client);
} | java |
public static base_response unset(nitro_service client, locationparameter resource, String[] args) throws Exception{
locationparameter unsetresource = new locationparameter();
return unsetresource.unset_resource(client,args);
} | java |
public static locationparameter get(nitro_service service) throws Exception{
locationparameter obj = new locationparameter();
locationparameter[] response = (locationparameter[])obj.get_resources(service);
return response[0];
} | java |
public static base_response update(nitro_service client, nsappflowparam resource) throws Exception {
nsappflowparam updateresource = new nsappflowparam();
updateresource.templaterefresh = resource.templaterefresh;
updateresource.udppmtu = resource.udppmtu;
updateresource.httpurl = resource.httpurl;
updateresource.httpcookie = resource.httpcookie;
updateresource.httpreferer = resource.httpreferer;
updateresource.httpmethod = resource.httpmethod;
updateresource.httphost = resource.httphost;
updateresource.httpuseragent = resource.httpuseragent;
updateresource.clienttrafficonly = resource.clienttrafficonly;
return updateresource.update_resource(client);
} | java |
public static base_response unset(nitro_service client, nsappflowparam resource, String[] args) throws Exception{
nsappflowparam unsetresource = new nsappflowparam();
return unsetresource.unset_resource(client,args);
} | java |
public static nsappflowparam get(nitro_service service) throws Exception{
nsappflowparam obj = new nsappflowparam();
nsappflowparam[] response = (nsappflowparam[])obj.get_resources(service);
return response[0];
} | java |
@Override
public void randomize(int randomSeed) {
Random rand = new Random(randomSeed);
for(int j = size - 1; j > 0; j --){
int randIndex = rand.nextInt(j);
int [] tmp = data[randIndex];
data[randIndex] = data[j];
data[j] = tmp;
int tmpl = labels[randIndex];
labels[randIndex] = labels[j];
labels[j] = tmpl;
float tmpw = weights[randIndex];
weights[randIndex] = weights[j];
weights[j] = tmpw;
}
} | java |
public static base_response add(nitro_service client, scpolicy resource) throws Exception {
scpolicy addresource = new scpolicy();
addresource.name = resource.name;
addresource.url = resource.url;
addresource.rule = resource.rule;
addresource.delay = resource.delay;
addresource.maxconn = resource.maxconn;
addresource.action = resource.action;
addresource.altcontentsvcname = resource.altcontentsvcname;
addresource.altcontentpath = resource.altcontentpath;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, scpolicy resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
scpolicy addresources[] = new scpolicy[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new scpolicy();
addresources[i].name = resources[i].name;
addresources[i].url = resources[i].url;
addresources[i].rule = resources[i].rule;
addresources[i].delay = resources[i].delay;
addresources[i].maxconn = resources[i].maxconn;
addresources[i].action = resources[i].action;
addresources[i].altcontentsvcname = resources[i].altcontentsvcname;
addresources[i].altcontentpath = resources[i].altcontentpath;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response update(nitro_service client, scpolicy resource) throws Exception {
scpolicy updateresource = new scpolicy();
updateresource.name = resource.name;
updateresource.url = resource.url;
updateresource.rule = resource.rule;
updateresource.delay = resource.delay;
updateresource.maxconn = resource.maxconn;
updateresource.action = resource.action;
updateresource.altcontentsvcname = resource.altcontentsvcname;
updateresource.altcontentpath = resource.altcontentpath;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, scpolicy resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
scpolicy updateresources[] = new scpolicy[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new scpolicy();
updateresources[i].name = resources[i].name;
updateresources[i].url = resources[i].url;
updateresources[i].rule = resources[i].rule;
updateresources[i].delay = resources[i].delay;
updateresources[i].maxconn = resources[i].maxconn;
updateresources[i].action = resources[i].action;
updateresources[i].altcontentsvcname = resources[i].altcontentsvcname;
updateresources[i].altcontentpath = resources[i].altcontentpath;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static scpolicy[] get(nitro_service service) throws Exception{
scpolicy obj = new scpolicy();
scpolicy[] response = (scpolicy[])obj.get_resources(service);
return response;
} | java |
public static scpolicy get(nitro_service service, String name) throws Exception{
scpolicy obj = new scpolicy();
obj.set_name(name);
scpolicy response = (scpolicy) obj.get_resource(service);
return response;
} | java |
public final int needArgumentsNumber() {
int number = 0;
for (int i : needArgument) {
number = Math.max(number, (i + 1));
}
return number;
} | java |
public static csvserver_rewritepolicy_binding[] get(nitro_service service, String name) throws Exception{
csvserver_rewritepolicy_binding obj = new csvserver_rewritepolicy_binding();
obj.set_name(name);
csvserver_rewritepolicy_binding response[] = (csvserver_rewritepolicy_binding[]) obj.get_resources(service);
return response;
} | java |
@SuppressWarnings("rawtypes")
public final Map<String, MtasDataItemNumberComparator> getComparatorList()
throws IOException {
if (collectorType.equals(DataCollector.COLLECTOR_TYPE_LIST)) {
LinkedHashMap<String, MtasDataItemNumberComparator> comparatorList = new LinkedHashMap<>();
for (Entry<String, MtasDataItem<T1, T2>> entry : list.entrySet()) {
comparatorList.put(entry.getKey(),
entry.getValue().getComparableValue());
}
return comparatorList;
} else {
throw new IOException("type " + collectorType + " not supported");
}
} | java |
public static lbvserver_cmppolicy_binding[] get(nitro_service service, String name) throws Exception{
lbvserver_cmppolicy_binding obj = new lbvserver_cmppolicy_binding();
obj.set_name(name);
lbvserver_cmppolicy_binding response[] = (lbvserver_cmppolicy_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, appfwconfidfield resource) throws Exception {
appfwconfidfield addresource = new appfwconfidfield();
addresource.fieldname = resource.fieldname;
addresource.url = resource.url;
addresource.isregex = resource.isregex;
addresource.comment = resource.comment;
addresource.state = resource.state;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, appfwconfidfield resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appfwconfidfield addresources[] = new appfwconfidfield[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new appfwconfidfield();
addresources[i].fieldname = resources[i].fieldname;
addresources[i].url = resources[i].url;
addresources[i].isregex = resources[i].isregex;
addresources[i].comment = resources[i].comment;
addresources[i].state = resources[i].state;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, String fieldname) throws Exception {
appfwconfidfield deleteresource = new appfwconfidfield();
deleteresource.fieldname = fieldname;
return deleteresource.delete_resource(client);
} | java |
public static base_response delete(nitro_service client, appfwconfidfield resource) throws Exception {
appfwconfidfield deleteresource = new appfwconfidfield();
deleteresource.fieldname = resource.fieldname;
deleteresource.url = resource.url;
return deleteresource.delete_resource(client);
} | java |
public static base_responses delete(nitro_service client, String fieldname[]) throws Exception {
base_responses result = null;
if (fieldname != null && fieldname.length > 0) {
appfwconfidfield deleteresources[] = new appfwconfidfield[fieldname.length];
for (int i=0;i<fieldname.length;i++){
deleteresources[i] = new appfwconfidfield();
deleteresources[i].fieldname = fieldname[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_responses delete(nitro_service client, appfwconfidfield resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appfwconfidfield deleteresources[] = new appfwconfidfield[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new appfwconfidfield();
deleteresources[i].fieldname = resources[i].fieldname;
deleteresources[i].url = resources[i].url;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_response update(nitro_service client, appfwconfidfield resource) throws Exception {
appfwconfidfield updateresource = new appfwconfidfield();
updateresource.fieldname = resource.fieldname;
updateresource.url = resource.url;
updateresource.comment = resource.comment;
updateresource.state = resource.state;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, appfwconfidfield resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appfwconfidfield updateresources[] = new appfwconfidfield[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new appfwconfidfield();
updateresources[i].fieldname = resources[i].fieldname;
updateresources[i].url = resources[i].url;
updateresources[i].comment = resources[i].comment;
updateresources[i].state = resources[i].state;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static base_response unset(nitro_service client, appfwconfidfield resource, String[] args) throws Exception{
appfwconfidfield unsetresource = new appfwconfidfield();
unsetresource.fieldname = resource.fieldname;
unsetresource.url = resource.url;
return unsetresource.unset_resource(client,args);
} | java |
public static base_responses unset(nitro_service client, appfwconfidfield resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appfwconfidfield unsetresources[] = new appfwconfidfield[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new appfwconfidfield();
unsetresources[i].fieldname = resources[i].fieldname;
unsetresources[i].url = resources[i].url;
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java |
public static appfwconfidfield[] get(nitro_service service) throws Exception{
appfwconfidfield obj = new appfwconfidfield();
appfwconfidfield[] response = (appfwconfidfield[])obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, dnsnsrec resource) throws Exception {
dnsnsrec addresource = new dnsnsrec();
addresource.domain = resource.domain;
addresource.nameserver = resource.nameserver;
addresource.ttl = resource.ttl;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, dnsnsrec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsnsrec addresources[] = new dnsnsrec[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsnsrec();
addresources[i].domain = resources[i].domain;
addresources[i].nameserver = resources[i].nameserver;
addresources[i].ttl = resources[i].ttl;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, dnsnsrec resource) throws Exception {
dnsnsrec deleteresource = new dnsnsrec();
deleteresource.domain = resource.domain;
deleteresource.nameserver = resource.nameserver;
return deleteresource.delete_resource(client);
} | java |
public static dnsnsrec[] get(nitro_service service) throws Exception{
dnsnsrec obj = new dnsnsrec();
dnsnsrec[] response = (dnsnsrec[])obj.get_resources(service);
return response;
} | java |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
public static String slurpFile(String filename, String encoding)
throws IOException {
Reader r = new InputStreamReader(new FileInputStream(filename), encoding);
return IOUtils.slurpReader(r);
} | java |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
public static nsappflowcollector[] get(nitro_service service) throws Exception{
nsappflowcollector obj = new nsappflowcollector();
nsappflowcollector[] response = (nsappflowcollector[])obj.get_resources(service);
return response;
} | java |
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 |
public void setValue(String fieldName, String value) {
int index = getFieldIndex(fieldName);
assert(index != -1);
values[index] = value;
} | java |
public static systemcountergroup get(nitro_service service) throws Exception{
systemcountergroup obj = new systemcountergroup();
systemcountergroup[] response = (systemcountergroup[])obj.get_resources(service);
return response[0];
} | java |
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 |
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 |
public T next() {
if (nextToken == null) {
nextToken = getNext();
}
T result = nextToken;
nextToken = null;
if (result == null) {
throw new NoSuchElementException();
}
return result;
} | java |
public T peek() {
if (nextToken == null) {
nextToken = getNext();
}
if (nextToken == null) {
throw new NoSuchElementException();
}
return nextToken;
} | java |
public List<T> tokenize() {
// System.out.println("tokenize called");
List<T> result = new ArrayList<T>();
while (hasNext()) {
result.add(next());
}
return result;
} | java |
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 |
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 |
@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 |
@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 |
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 |
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 |
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 |
public void loadDefault() {
try {
load( new BufferedReader(new StringReader(
DefaultTeXHyphenData.hyphenData) ) );
} catch(IOException e) {
// shouldn't happen
throw new RuntimeException(e);
}
} | java |
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 |
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 |
public static appflowcollector[] get(nitro_service service) throws Exception{
appflowcollector obj = new appflowcollector();
appflowcollector[] response = (appflowcollector[])obj.get_resources(service);
return response;
} | java |
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 |
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 |
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 |
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 |
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 |
public static responderaction[] get(nitro_service service) throws Exception{
responderaction obj = new responderaction();
responderaction[] response = (responderaction[])obj.get_resources(service);
return response;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.