code
stringlengths
73
34.1k
label
stringclasses
1 value
public static base_response Import(nitro_service client, responderhtmlpage resource) throws Exception { responderhtmlpage Importresource = new responderhtmlpage(); Importresource.src = resource.src; Importresource.name = resource.name; Importresource.comment = resource.comment; Importresource.overwrite = resource.overwrite; return Importresource.perform_operation(client,"Import"); }
java
public static base_response change(nitro_service client, responderhtmlpage resource) throws Exception { responderhtmlpage updateresource = new responderhtmlpage(); updateresource.name = resource.name; return updateresource.perform_operation(client,"update"); }
java
public static responderhtmlpage get(nitro_service service) throws Exception{ responderhtmlpage obj = new responderhtmlpage(); responderhtmlpage[] response = (responderhtmlpage[])obj.get_resources(service); return response[0]; }
java
public static responderhtmlpage get(nitro_service service, String name) throws Exception{ responderhtmlpage obj = new responderhtmlpage(); obj.set_name(name); responderhtmlpage response = (responderhtmlpage) obj.get_resource(service); return response; }
java
private double goldenMean(double a, double b) { if (geometric) { return a * Math.pow(b / a, GOLDEN_SECTION); } else { return a + (b - a) * GOLDEN_SECTION; } }
java
public int getNumWeights() { if (weights == null) return 0; int numWeights = 0; for (double[] wts : weights) { numWeights += wts.length; } return numWeights; }
java
public void scaleWeights(double scale) { for (int i = 0; i < weights.length; i++) { for (int j = 0; j < weights[i].length; j++) { weights[i][j] *= scale; } } }
java
public void combine(CRFClassifier<IN> crf, double weight) { Timing timer = new Timing(); // Check the CRFClassifiers are compatible if (!this.pad.equals(crf.pad)) { throw new RuntimeException("Incompatible CRFClassifier: pad does not match"); } if (this.windowSize != crf.windowSize) { throw new RuntimeException("Incompatible CRFClassifier: windowSize does not match"); } if (this.labelIndices.length != crf.labelIndices.length) { // Should match since this should be same as the windowSize throw new RuntimeException("Incompatible CRFClassifier: labelIndices length does not match"); } this.classIndex.addAll(crf.classIndex.objectsList()); // Combine weights of the other classifier with this classifier, // weighing the other classifier's weights by weight // First merge the feature indicies int oldNumFeatures1 = this.featureIndex.size(); int oldNumFeatures2 = crf.featureIndex.size(); int oldNumWeights1 = this.getNumWeights(); int oldNumWeights2 = crf.getNumWeights(); this.featureIndex.addAll(crf.featureIndex.objectsList()); this.knownLCWords.addAll(crf.knownLCWords); assert (weights.length == oldNumFeatures1); // Combine weights of this classifier with other classifier for (int i = 0; i < labelIndices.length; i++) { this.labelIndices[i].addAll(crf.labelIndices[i].objectsList()); } System.err.println("Combining weights: will automatically match labelIndices"); combineWeights(crf, weight); int numFeatures = featureIndex.size(); int numWeights = getNumWeights(); long elapsedMs = timer.stop(); System.err.println("numFeatures: orig1=" + oldNumFeatures1 + ", orig2=" + oldNumFeatures2 + ", combined=" + numFeatures); System.err .println("numWeights: orig1=" + oldNumWeights1 + ", orig2=" + oldNumWeights2 + ", combined=" + numWeights); System.err.println("Time to combine CRFClassifier: " + Timing.toSecondsString(elapsedMs) + " seconds"); }
java
public Pair<int[][][], int[]> documentToDataAndLabels(List<IN> document) { int docSize = document.size(); // first index is position in the document also the index of the // clique/factor table // second index is the number of elements in the clique/window these // features are for (starting with last element) // third index is position of the feature in the array that holds them // element in data[j][k][m] is the index of the mth feature occurring in // position k of the jth clique int[][][] data = new int[docSize][windowSize][]; // index is the position in the document // element in labels[j] is the index of the correct label (if it exists) at // position j of document int[] labels = new int[docSize]; if (flags.useReverse) { Collections.reverse(document); } // System.err.println("docSize:"+docSize); for (int j = 0; j < docSize; j++) { CRFDatum<List<String>, CRFLabel> d = makeDatum(document, j, featureFactory); List<List<String>> features = d.asFeatures(); for (int k = 0, fSize = features.size(); k < fSize; k++) { Collection<String> cliqueFeatures = features.get(k); data[j][k] = new int[cliqueFeatures.size()]; int m = 0; for (String feature : cliqueFeatures) { int index = featureIndex.indexOf(feature); if (index >= 0) { data[j][k][m] = index; m++; } else { // this is where we end up when we do feature threshold cutoffs } } // Reduce memory use when some features were cut out by threshold if (m < data[j][k].length) { int[] f = new int[m]; System.arraycopy(data[j][k], 0, f, 0, m); data[j][k] = f; } } IN wi = document.get(j); labels[j] = classIndex.indexOf(wi.get(AnswerAnnotation.class)); } if (flags.useReverse) { Collections.reverse(document); } // System.err.println("numClasses: "+classIndex.size()+" "+classIndex); // System.err.println("numDocuments: 1"); // System.err.println("numDatums: "+data.length); // System.err.println("numFeatures: "+featureIndex.size()); return new Pair<int[][][], int[]>(data, labels); }
java
public Pair<int[][][][], int[][]> documentsToDataAndLabels(Collection<List<IN>> documents) { // first index is the number of the document // second index is position in the document also the index of the // clique/factor table // third index is the number of elements in the clique/window these features // are for (starting with last element) // fourth index is position of the feature in the array that holds them // element in data[i][j][k][m] is the index of the mth feature occurring in // position k of the jth clique of the ith document // int[][][][] data = new int[documentsSize][][][]; List<int[][][]> data = new ArrayList<int[][][]>(); // first index is the number of the document // second index is the position in the document // element in labels[i][j] is the index of the correct label (if it exists) // at position j in document i // int[][] labels = new int[documentsSize][]; List<int[]> labels = new ArrayList<int[]>(); int numDatums = 0; for (List<IN> doc : documents) { Pair<int[][][], int[]> docPair = documentToDataAndLabels(doc); data.add(docPair.first()); labels.add(docPair.second()); numDatums += doc.size(); } System.err.println("numClasses: " + classIndex.size() + ' ' + classIndex); System.err.println("numDocuments: " + data.size()); System.err.println("numDatums: " + numDatums); System.err.println("numFeatures: " + featureIndex.size()); printFeatures(); int[][][][] dataA = new int[0][][][]; int[][] labelsA = new int[0][]; return new Pair<int[][][][], int[][]>(data.toArray(dataA), labels.toArray(labelsA)); }
java
public List<Pair<int[][][], int[]>> documentsToDataAndLabelsList(Collection<List<IN>> documents) { int numDatums = 0; List<Pair<int[][][], int[]>> docList = new ArrayList<Pair<int[][][], int[]>>(); for (List<IN> doc : documents) { Pair<int[][][], int[]> docPair = documentToDataAndLabels(doc); docList.add(docPair); numDatums += doc.size(); } System.err.println("numClasses: " + classIndex.size() + ' ' + classIndex); System.err.println("numDocuments: " + docList.size()); System.err.println("numDatums: " + numDatums); System.err.println("numFeatures: " + featureIndex.size()); return docList; }
java
public CRFDatum<List<String>, CRFLabel> makeDatum(List<IN> info, int loc, edu.stanford.nlp.sequences.FeatureFactory<IN> featureFactory) { pad.set(AnswerAnnotation.class, flags.backgroundSymbol); PaddedList<IN> pInfo = new PaddedList<IN>(info, pad); ArrayList<List<String>> features = new ArrayList<List<String>>(); // for (int i = 0; i < windowSize; i++) { // List featuresC = new ArrayList(); // for (int j = 0; j < FeatureFactory.win[i].length; j++) { // featuresC.addAll(featureFactory.features(info, loc, // FeatureFactory.win[i][j])); // } // features.add(featuresC); // } Collection<Clique> done = new HashSet<Clique>(); for (int i = 0; i < windowSize; i++) { List<String> featuresC = new ArrayList<String>(); List<Clique> windowCliques = FeatureFactory.getCliques(i, 0); windowCliques.removeAll(done); done.addAll(windowCliques); for (Clique c : windowCliques) { featuresC.addAll(featureFactory.getCliqueFeatures(pInfo, loc, c)); //todo useless copy because of typing reasons } features.add(featuresC); } int[] labels = new int[windowSize]; for (int i = 0; i < windowSize; i++) { String answer = pInfo.get(loc + i - windowSize + 1).get(AnswerAnnotation.class); labels[i] = classIndex.indexOf(answer); } printFeatureLists(pInfo.get(loc), features); CRFDatum<List<String>, CRFLabel> d = new CRFDatum<List<String>, CRFLabel>(features, new CRFLabel(labels)); // System.err.println(d); return d; }
java
public List<CRFCliqueTree> getCliqueTrees(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = false; List<CRFCliqueTree> cts = new ArrayList<CRFCliqueTree>(); ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); for (List<IN> doc : docs) { cts.add(getCliqueTree(doc)); } return cts; }
java
protected List<CRFDatum> extractDatumSequence(int[][][] allData, int beginPosition, int endPosition, List<IN> labeledWordInfos) { List<CRFDatum> result = new ArrayList<CRFDatum>(); int beginContext = beginPosition - windowSize + 1; if (beginContext < 0) { beginContext = 0; } // for the beginning context, add some dummy datums with no features! // TODO: is there any better way to do this? for (int position = beginContext; position < beginPosition; position++) { List<Collection<String>> cliqueFeatures = new ArrayList<Collection<String>>(); for (int i = 0; i < windowSize; i++) { // create a feature list cliqueFeatures.add(Collections.<String>emptyList()); } CRFDatum<Collection<String>, String> datum = new CRFDatum<Collection<String>, String>(cliqueFeatures, labeledWordInfos.get(position).get(AnswerAnnotation.class)); result.add(datum); } // now add the real datums for (int position = beginPosition; position <= endPosition; position++) { List<Collection<String>> cliqueFeatures = new ArrayList<Collection<String>>(); for (int i = 0; i < windowSize; i++) { // create a feature list Collection<String> features = new ArrayList<String>(); for (int j = 0; j < allData[position][i].length; j++) { features.add(featureIndex.get(allData[position][i][j])); } cliqueFeatures.add(features); } CRFDatum<Collection<String>,String> datum = new CRFDatum<Collection<String>,String>(cliqueFeatures, labeledWordInfos.get(position).get(AnswerAnnotation.class)); result.add(datum); } return result; }
java
protected void addProcessedData(List<List<CRFDatum<Collection<String>, String>>> processedData, int[][][][] data, int[][] labels, int offset) { for (int i = 0, pdSize = processedData.size(); i < pdSize; i++) { int dataIndex = i + offset; List<CRFDatum<Collection<String>, String>> document = processedData.get(i); int dsize = document.size(); labels[dataIndex] = new int[dsize]; data[dataIndex] = new int[dsize][][]; for (int j = 0; j < dsize; j++) { CRFDatum<Collection<String>, String> crfDatum = document.get(j); // add label, they are offset by extra context labels[dataIndex][j] = classIndex.indexOf(crfDatum.label()); // add features List<Collection<String>> cliques = crfDatum.asFeatures(); int csize = cliques.size(); data[dataIndex][j] = new int[csize][]; for (int k = 0; k < csize; k++) { Collection<String> features = cliques.get(k); // Debug only: Remove // if (j < windowSize) { // System.err.println("addProcessedData: Features Size: " + // features.size()); // } data[dataIndex][j][k] = new int[features.size()]; int m = 0; try { for (String feature : features) { // System.err.println("feature " + feature); // if (featureIndex.indexOf(feature)) ; if (featureIndex == null) { System.out.println("Feature is NULL!"); } data[dataIndex][j][k][m] = featureIndex.indexOf(feature); m++; } } catch (Exception e) { e.printStackTrace(); System.err.printf("[index=%d, j=%d, k=%d, m=%d]\n", dataIndex, j, k, m); System.err.println("data.length " + data.length); System.err.println("data[dataIndex].length " + data[dataIndex].length); System.err.println("data[dataIndex][j].length " + data[dataIndex][j].length); System.err.println("data[dataIndex][j][k].length " + data[dataIndex][j].length); System.err.println("data[dataIndex][j][k][m] " + data[dataIndex][j][k][m]); return; } } } } }
java
public static <IN extends CoreMap> CRFClassifier<IN> getJarClassifier(String resourceName, Properties props) { CRFClassifier<IN> crf = new CRFClassifier<IN>(); crf.loadJarClassifier(resourceName, props); return crf; }
java
public static <IN extends CoreMap> CRFClassifier<IN> getClassifier(File file) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier<IN> crf = new CRFClassifier<IN>(); crf.loadClassifier(file); return crf; }
java
public static CRFClassifier getClassifier(InputStream in) throws IOException, ClassCastException, ClassNotFoundException { CRFClassifier crf = new CRFClassifier(); crf.loadClassifier(in); return crf; }
java
public static void main(String[] args) throws Exception { StringUtils.printErrInvocationString("CRFClassifier", args); Properties props = StringUtils.argsToProperties(args); CRFClassifier<CoreLabel> crf = new CRFClassifier<CoreLabel>(props); String testFile = crf.flags.testFile; String textFile = crf.flags.textFile; String loadPath = crf.flags.loadClassifier; String loadTextPath = crf.flags.loadTextClassifier; String serializeTo = crf.flags.serializeTo; String serializeToText = crf.flags.serializeToText; if (loadPath != null) { crf.loadClassifierNoExceptions(loadPath, props); } else if (loadTextPath != null) { System.err.println("Warning: this is now only tested for Chinese Segmenter"); System.err.println("(Sun Dec 23 00:59:39 2007) (pichuan)"); try { crf.loadTextClassifier(loadTextPath, props); // System.err.println("DEBUG: out from crf.loadTextClassifier"); } catch (Exception e) { throw new RuntimeException("error loading " + loadTextPath, e); } } else if (crf.flags.loadJarClassifier != null) { crf.loadJarClassifier(crf.flags.loadJarClassifier, props); } else if (crf.flags.trainFile != null || crf.flags.trainFileList != null) { crf.train(); } else { crf.loadDefaultClassifier(); } // System.err.println("Using " + crf.flags.featureFactory); // System.err.println("Using " + // StringUtils.getShortClassName(crf.readerAndWriter)); if (serializeTo != null) { crf.serializeClassifier(serializeTo); } if (serializeToText != null) { crf.serializeTextClassifier(serializeToText); } if (testFile != null) { DocumentReaderAndWriter<CoreLabel> readerAndWriter = crf.makeReaderAndWriter(); if (crf.flags.searchGraphPrefix != null) { crf.classifyAndWriteViterbiSearchGraph(testFile, crf.flags.searchGraphPrefix, crf.makeReaderAndWriter()); } else if (crf.flags.printFirstOrderProbs) { crf.printFirstOrderProbs(testFile, readerAndWriter); } else if (crf.flags.printProbs) { crf.printProbs(testFile, readerAndWriter); } else if (crf.flags.useKBest) { int k = crf.flags.kBest; crf.classifyAndWriteAnswersKBest(testFile, k, readerAndWriter); } else if (crf.flags.printLabelValue) { crf.printLabelInformation(testFile, readerAndWriter); } else { crf.classifyAndWriteAnswers(testFile, readerAndWriter); } } if (textFile != null) { crf.classifyAndWriteAnswers(textFile); } if (crf.flags.readStdin) { crf.classifyStdin(); } }
java
public static appfwglobal_auditsyslogpolicy_binding[] get(nitro_service service) throws Exception{ appfwglobal_auditsyslogpolicy_binding obj = new appfwglobal_auditsyslogpolicy_binding(); appfwglobal_auditsyslogpolicy_binding response[] = (appfwglobal_auditsyslogpolicy_binding[]) obj.get_resources(service); return response; }
java
public static csvserver_cmppolicy_binding[] get(nitro_service service, String name) throws Exception{ csvserver_cmppolicy_binding obj = new csvserver_cmppolicy_binding(); obj.set_name(name); csvserver_cmppolicy_binding response[] = (csvserver_cmppolicy_binding[]) obj.get_resources(service); return response; }
java
public static ipset_nsip_binding[] get(nitro_service service, String name) throws Exception{ ipset_nsip_binding obj = new ipset_nsip_binding(); obj.set_name(name); ipset_nsip_binding response[] = (ipset_nsip_binding[]) obj.get_resources(service); return response; }
java
public static base_response delete(nitro_service client, appfwlearningdata resource) throws Exception { appfwlearningdata deleteresource = new appfwlearningdata(); deleteresource.profilename = resource.profilename; deleteresource.starturl = resource.starturl; deleteresource.cookieconsistency = resource.cookieconsistency; deleteresource.fieldconsistency = resource.fieldconsistency; deleteresource.formactionurl_ffc = resource.formactionurl_ffc; deleteresource.crosssitescripting = resource.crosssitescripting; deleteresource.formactionurl_xss = resource.formactionurl_xss; deleteresource.sqlinjection = resource.sqlinjection; deleteresource.formactionurl_sql = resource.formactionurl_sql; deleteresource.fieldformat = resource.fieldformat; deleteresource.formactionurl_ff = resource.formactionurl_ff; deleteresource.csrftag = resource.csrftag; deleteresource.csrfformoriginurl = resource.csrfformoriginurl; deleteresource.xmldoscheck = resource.xmldoscheck; deleteresource.xmlwsicheck = resource.xmlwsicheck; deleteresource.xmlattachmentcheck = resource.xmlattachmentcheck; deleteresource.totalxmlrequests = resource.totalxmlrequests; return deleteresource.delete_resource(client); }
java
public static base_responses delete(nitro_service client, appfwlearningdata resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwlearningdata deleteresources[] = new appfwlearningdata[resources.length]; for (int i=0;i<resources.length;i++){ deleteresources[i] = new appfwlearningdata(); deleteresources[i].profilename = resources[i].profilename; deleteresources[i].starturl = resources[i].starturl; deleteresources[i].cookieconsistency = resources[i].cookieconsistency; deleteresources[i].fieldconsistency = resources[i].fieldconsistency; deleteresources[i].formactionurl_ffc = resources[i].formactionurl_ffc; deleteresources[i].crosssitescripting = resources[i].crosssitescripting; deleteresources[i].formactionurl_xss = resources[i].formactionurl_xss; deleteresources[i].sqlinjection = resources[i].sqlinjection; deleteresources[i].formactionurl_sql = resources[i].formactionurl_sql; deleteresources[i].fieldformat = resources[i].fieldformat; deleteresources[i].formactionurl_ff = resources[i].formactionurl_ff; deleteresources[i].csrftag = resources[i].csrftag; deleteresources[i].csrfformoriginurl = resources[i].csrfformoriginurl; deleteresources[i].xmldoscheck = resources[i].xmldoscheck; deleteresources[i].xmlwsicheck = resources[i].xmlwsicheck; deleteresources[i].xmlattachmentcheck = resources[i].xmlattachmentcheck; deleteresources[i].totalxmlrequests = resources[i].totalxmlrequests; } result = delete_bulk_request(client, deleteresources); } return result; }
java
public static base_response reset(nitro_service client) throws Exception { appfwlearningdata resetresource = new appfwlearningdata(); return resetresource.perform_operation(client,"reset"); }
java
public static base_responses reset(nitro_service client, appfwlearningdata resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwlearningdata resetresources[] = new appfwlearningdata[resources.length]; for (int i=0;i<resources.length;i++){ resetresources[i] = new appfwlearningdata(); } result = perform_operation_bulk_request(client, resetresources,"reset"); } return result; }
java
public static base_response export(nitro_service client, appfwlearningdata resource) throws Exception { appfwlearningdata exportresource = new appfwlearningdata(); exportresource.profilename = resource.profilename; exportresource.securitycheck = resource.securitycheck; exportresource.target = resource.target; return exportresource.perform_operation(client,"export"); }
java
public static base_responses export(nitro_service client, appfwlearningdata resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appfwlearningdata exportresources[] = new appfwlearningdata[resources.length]; for (int i=0;i<resources.length;i++){ exportresources[i] = new appfwlearningdata(); exportresources[i].profilename = resources[i].profilename; exportresources[i].securitycheck = resources[i].securitycheck; exportresources[i].target = resources[i].target; } result = perform_operation_bulk_request(client, exportresources,"export"); } return result; }
java
public static appfwlearningdata[] get(nitro_service service, appfwlearningdata_args args) throws Exception{ appfwlearningdata obj = new appfwlearningdata(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); appfwlearningdata[] response = (appfwlearningdata[])obj.get_resources(service, option); return response; }
java
public static appfwprofile_safeobject_binding[] get(nitro_service service, String name) throws Exception{ appfwprofile_safeobject_binding obj = new appfwprofile_safeobject_binding(); obj.set_name(name); appfwprofile_safeobject_binding response[] = (appfwprofile_safeobject_binding[]) obj.get_resources(service); return response; }
java
public static tmsessionpolicy_binding get(nitro_service service, String name) throws Exception{ tmsessionpolicy_binding obj = new tmsessionpolicy_binding(); obj.set_name(name); tmsessionpolicy_binding response = (tmsessionpolicy_binding) obj.get_resource(service); return response; }
java
public static vpnvserver_auditnslogpolicy_binding[] get(nitro_service service, String name) throws Exception{ vpnvserver_auditnslogpolicy_binding obj = new vpnvserver_auditnslogpolicy_binding(); obj.set_name(name); vpnvserver_auditnslogpolicy_binding response[] = (vpnvserver_auditnslogpolicy_binding[]) obj.get_resources(service); return response; }
java
private void calculateSCL(double[] x) { //System.out.println("Checking at: "+x[0]+" "+x[1]+" "+x[2]); value = 0.0; Arrays.fill(derivative, 0.0); double[] sums = new double[numClasses]; double[] probs = new double[numClasses]; double[] counts = new double[numClasses]; Arrays.fill(counts, 0.0); for (int d = 0; d < data.length; d++) { // if (d == testMin) { // d = testMax - 1; // continue; // } int[] features = data[d]; // activation Arrays.fill(sums, 0.0); for (int c = 0; c < numClasses; c++) { for (int f = 0; f < features.length; f++) { int i = indexOf(features[f], c); sums[c] += x[i]; } } // expectation (slower routine replaced by fast way) // double total = Double.NEGATIVE_INFINITY; // for (int c=0; c<numClasses; c++) { // total = SloppyMath.logAdd(total, sums[c]); // } double total = ArrayMath.logSum(sums); int ld = labels[d]; for (int c = 0; c < numClasses; c++) { probs[c] = Math.exp(sums[c] - total); for (int f = 0; f < features.length; f++) { int i = indexOf(features[f], c); derivative[i] += probs[ld] * probs[c]; } } // observed for (int f = 0; f < features.length; f++) { int i = indexOf(features[f], labels[d]); derivative[i] -= probs[ld]; } value -= probs[ld]; } // priors if (true) { for (int i = 0; i < x.length; i++) { double k = 1.0; double w = x[i]; value += k * w * w / 2.0; derivative[i] += k * w; } } }
java
public static vrid6[] get(nitro_service service) throws Exception{ vrid6 obj = new vrid6(); vrid6[] response = (vrid6[])obj.get_resources(service); return response; }
java
public static vrid6 get(nitro_service service, Long id) throws Exception{ vrid6 obj = new vrid6(); obj.set_id(id); vrid6 response = (vrid6) obj.get_resource(service); return response; }
java
private static Iterator<String> splitIntoDocs(Reader r) { if (TREAT_FILE_AS_ONE_DOCUMENT) { return Collections.singleton(IOUtils.slurpReader(r)).iterator(); } else { Collection<String> docs = new ArrayList<String>(); ObjectBank<String> ob = ObjectBank.getLineIterator(r); StringBuilder current = new StringBuilder(); for (String line : ob) { if (docPattern.matcher(line).lookingAt()) { // Start new doc, store old one if non-empty if (current.length() > 0) { docs.add(current.toString()); current = new StringBuilder(); } } current.append(line); current.append('\n'); } if (current.length() > 0) { docs.add(current.toString()); } return docs.iterator(); } }
java
private CoreLabel makeCoreLabel(String line) { CoreLabel wi = new CoreLabel(); // wi.line = line; String[] bits = line.split("\\s+"); switch (bits.length) { case 0: case 1: wi.setWord(BOUNDARY); wi.set(AnswerAnnotation.class, OTHER); break; case 2: wi.setWord(bits[0]); wi.set(AnswerAnnotation.class, bits[1]); break; case 3: wi.setWord(bits[0]); wi.setTag(bits[1]); wi.set(AnswerAnnotation.class, bits[2]); break; case 4: wi.setWord(bits[0]); wi.setTag(bits[1]); wi.set(ChunkAnnotation.class, bits[2]); wi.set(AnswerAnnotation.class, bits[3]); break; case 5: if (flags.useLemmaAsWord) { wi.setWord(bits[1]); } else { wi.setWord(bits[0]); } wi.set(LemmaAnnotation.class, bits[1]); wi.setTag(bits[2]); wi.set(ChunkAnnotation.class, bits[3]); wi.set(AnswerAnnotation.class, bits[4]); break; default: throw new RuntimeIOException("Unexpected input (many fields): " + line); } wi.set(OriginalAnswerAnnotation.class, wi.get(AnswerAnnotation.class)); return wi; }
java
private void deEndify(List<CoreLabel> tokens) { if (flags.retainEntitySubclassification) { return; } tokens = new PaddedList<CoreLabel>(tokens, new CoreLabel()); int k = tokens.size(); String[] newAnswers = new String[k]; for (int i = 0; i < k; i++) { CoreLabel c = tokens.get(i); CoreLabel p = tokens.get(i - 1); if (c.get(AnswerAnnotation.class).length() > 1 && c.get(AnswerAnnotation.class).charAt(1) == '-') { String base = c.get(AnswerAnnotation.class).substring(2); String pBase = (p.get(AnswerAnnotation.class).length() <= 2 ? p.get(AnswerAnnotation.class) : p.get(AnswerAnnotation.class).substring(2)); boolean isSecond = (base.equals(pBase)); boolean isStart = (c.get(AnswerAnnotation.class).charAt(0) == 'B' || c.get(AnswerAnnotation.class).charAt(0) == 'S'); if (isSecond && isStart) { newAnswers[i] = intern("B-" + base); } else { newAnswers[i] = intern("I-" + base); } } else { newAnswers[i] = c.get(AnswerAnnotation.class); } } for (int i = 0; i < k; i++) { CoreLabel c = tokens.get(i); c.set(AnswerAnnotation.class, newAnswers[i]); } }
java
public void printAnswers(List<CoreLabel> doc, PrintWriter out) { // boolean tagsMerged = flags.mergeTags; // boolean useHead = flags.splitOnHead; if ( ! "iob1".equalsIgnoreCase(flags.entitySubclassification)) { deEndify(doc); } for (CoreLabel fl : doc) { String word = fl.word(); if (word == BOUNDARY) { // Using == is okay, because it is set to constant out.println(); } else { String gold = fl.get(OriginalAnswerAnnotation.class); if(gold == null) gold = ""; String guess = fl.get(AnswerAnnotation.class); // System.err.println(fl.word() + "\t" + fl.get(AnswerAnnotation.class) + "\t" + fl.get(AnswerAnnotation.class)); String pos = fl.tag(); String chunk = (fl.get(ChunkAnnotation.class) == null ? "" : fl.get(ChunkAnnotation.class)); out.println(fl.word() + '\t' + pos + '\t' + chunk + '\t' + gold + '\t' + guess); } } }
java
public static void main(String[] args) throws IOException, ClassNotFoundException { CoNLLDocumentReaderAndWriter f = new CoNLLDocumentReaderAndWriter(); f.init(new SeqClassifierFlags()); int numDocs = 0; int numTokens = 0; int numEntities = 0; String lastAnsBase = ""; for (Iterator<List<CoreLabel>> it = f.getIterator(new FileReader(args[0])); it.hasNext(); ) { List<CoreLabel> doc = it.next(); numDocs++; for (CoreLabel fl : doc) { // System.out.println("FL " + (++i) + " was " + fl); if (fl.word().equals(BOUNDARY)) { continue; } String ans = fl.get(AnswerAnnotation.class); String ansBase; String ansPrefix; String[] bits = ans.split("-"); if (bits.length == 1) { ansBase = bits[0]; ansPrefix = ""; } else { ansBase = bits[1]; ansPrefix = bits[0]; } numTokens++; if (ansBase.equals("O")) { } else if (ansBase.equals(lastAnsBase)) { if (ansPrefix.equals("B")) { numEntities++; } } else { numEntities++; } } } System.out.println("File " + args[0] + " has " + numDocs + " documents, " + numTokens + " (non-blank line) tokens and " + numEntities + " entities."); }
java
protected void getBatch(int batchSize){ // if (numCalls == 0) { // for (int i = 0; i < 1538*\15; i++) { // randGenerator.nextInt(this.dataDimension()); // } // } // numCalls++; if (thisBatch == null || thisBatch.length != batchSize){ thisBatch = new int[batchSize]; } //----------------------------- //RANDOM WITH REPLACEMENT //----------------------------- if (sampleMethod.equals(SamplingMethod.RandomWithReplacement)){ for(int i = 0; i<batchSize;i++){ thisBatch[i] = randGenerator.nextInt(this.dataDimension()); //Just generate a random index // System.err.println("numCalls = "+(numCalls++)); } //----------------------------- //ORDERED //----------------------------- }else if(sampleMethod.equals(SamplingMethod.Ordered)){ for(int i = 0; i<batchSize;i++){ thisBatch[i] = (curElement + i) % this.dataDimension() ; //Take the next batchSize points in order } curElement = (curElement + batchSize) % this.dataDimension(); //watch out for overflow //----------------------------- //RANDOM WITHOUT REPLACEMENT //----------------------------- }else if(sampleMethod.equals(SamplingMethod.RandomWithoutReplacement)){ //Declare the indices array if needed. if (allIndices == null || allIndices.size()!= this.dataDimension()){ allIndices = new ArrayList<Integer>(); for(int i=0;i<this.dataDimension();i++){ allIndices.add(i); } Collections.shuffle(allIndices,randGenerator); } for(int i = 0; i<batchSize;i++){ thisBatch[i] = allIndices.get((curElement + i) % allIndices.size()); //Grab the next batchSize indices } if (curElement + batchSize > this.dataDimension()){ Collections.shuffle(Arrays.asList(allIndices),randGenerator); //Shuffle if we got to the end of the list } //watch out for overflow curElement = (curElement + batchSize) % allIndices.size(); //Rollover }else{ System.err.println("NO SAMPLING METHOD SELECTED"); System.exit(1); } }
java
public static server_service_binding[] get(nitro_service service, String name) throws Exception{ server_service_binding obj = new server_service_binding(); obj.set_name(name); server_service_binding response[] = (server_service_binding[]) obj.get_resources(service); return response; }
java
@SuppressWarnings("rawtypes") public void setReplicationClassLoader(Fqn regionFqn, ClassLoader classLoader) { if (!isLocalMode()) { final Region region = jBossCache.getRegion(regionFqn, true); region.registerContextClassLoader(classLoader); if (!region.isActive() && jBossCache.getCacheStatus() == CacheStatus.STARTED) { region.activate(); } } }
java
@SuppressWarnings("rawtypes") public void unsetReplicationClassLoader(Fqn regionFqn, ClassLoader classLoader) { if (!isLocalMode()) { final Region region = jBossCache.getRegion(regionFqn, true); if (region != null) { if (region.isActive()) { region.deactivate(); } region.unregisterContextClassLoader(); jBossCache.removeRegion(regionFqn); } } }
java
public static systemglobal_authenticationradiuspolicy_binding[] get(nitro_service service) throws Exception{ systemglobal_authenticationradiuspolicy_binding obj = new systemglobal_authenticationradiuspolicy_binding(); systemglobal_authenticationradiuspolicy_binding response[] = (systemglobal_authenticationradiuspolicy_binding[]) obj.get_resources(service); return response; }
java
public static auditsyslogpolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{ auditsyslogpolicy_authenticationvserver_binding obj = new auditsyslogpolicy_authenticationvserver_binding(); obj.set_name(name); auditsyslogpolicy_authenticationvserver_binding response[] = (auditsyslogpolicy_authenticationvserver_binding[]) obj.get_resources(service); return response; }
java
public static lbgroup_lbvserver_binding[] get(nitro_service service, String name) throws Exception{ lbgroup_lbvserver_binding obj = new lbgroup_lbvserver_binding(); obj.set_name(name); lbgroup_lbvserver_binding response[] = (lbgroup_lbvserver_binding[]) obj.get_resources(service); return response; }
java
public static base_response add(nitro_service client, nspbr resource) throws Exception { nspbr addresource = new nspbr(); addresource.name = resource.name; addresource.action = resource.action; addresource.td = resource.td; addresource.srcip = resource.srcip; addresource.srcipop = resource.srcipop; addresource.srcipval = resource.srcipval; addresource.srcport = resource.srcport; addresource.srcportop = resource.srcportop; addresource.srcportval = resource.srcportval; addresource.destip = resource.destip; addresource.destipop = resource.destipop; addresource.destipval = resource.destipval; addresource.destport = resource.destport; addresource.destportop = resource.destportop; addresource.destportval = resource.destportval; addresource.nexthop = resource.nexthop; addresource.nexthopval = resource.nexthopval; addresource.iptunnel = resource.iptunnel; addresource.iptunnelname = resource.iptunnelname; addresource.srcmac = resource.srcmac; addresource.protocol = resource.protocol; addresource.protocolnumber = resource.protocolnumber; addresource.vlan = resource.vlan; addresource.Interface = resource.Interface; addresource.priority = resource.priority; addresource.msr = resource.msr; addresource.monitor = resource.monitor; addresource.state = resource.state; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, nspbr resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr addresources[] = new nspbr[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new nspbr(); addresources[i].name = resources[i].name; addresources[i].action = resources[i].action; addresources[i].td = resources[i].td; addresources[i].srcip = resources[i].srcip; addresources[i].srcipop = resources[i].srcipop; addresources[i].srcipval = resources[i].srcipval; addresources[i].srcport = resources[i].srcport; addresources[i].srcportop = resources[i].srcportop; addresources[i].srcportval = resources[i].srcportval; addresources[i].destip = resources[i].destip; addresources[i].destipop = resources[i].destipop; addresources[i].destipval = resources[i].destipval; addresources[i].destport = resources[i].destport; addresources[i].destportop = resources[i].destportop; addresources[i].destportval = resources[i].destportval; addresources[i].nexthop = resources[i].nexthop; addresources[i].nexthopval = resources[i].nexthopval; addresources[i].iptunnel = resources[i].iptunnel; addresources[i].iptunnelname = resources[i].iptunnelname; addresources[i].srcmac = resources[i].srcmac; addresources[i].protocol = resources[i].protocol; addresources[i].protocolnumber = resources[i].protocolnumber; addresources[i].vlan = resources[i].vlan; addresources[i].Interface = resources[i].Interface; addresources[i].priority = resources[i].priority; addresources[i].msr = resources[i].msr; addresources[i].monitor = resources[i].monitor; addresources[i].state = resources[i].state; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response update(nitro_service client, nspbr resource) throws Exception { nspbr updateresource = new nspbr(); updateresource.name = resource.name; updateresource.action = resource.action; updateresource.srcip = resource.srcip; updateresource.srcipop = resource.srcipop; updateresource.srcipval = resource.srcipval; updateresource.srcport = resource.srcport; updateresource.srcportop = resource.srcportop; updateresource.srcportval = resource.srcportval; updateresource.destip = resource.destip; updateresource.destipop = resource.destipop; updateresource.destipval = resource.destipval; updateresource.destport = resource.destport; updateresource.destportop = resource.destportop; updateresource.destportval = resource.destportval; updateresource.nexthop = resource.nexthop; updateresource.nexthopval = resource.nexthopval; updateresource.iptunnel = resource.iptunnel; updateresource.iptunnelname = resource.iptunnelname; updateresource.srcmac = resource.srcmac; updateresource.protocol = resource.protocol; updateresource.protocolnumber = resource.protocolnumber; updateresource.vlan = resource.vlan; updateresource.Interface = resource.Interface; updateresource.priority = resource.priority; updateresource.msr = resource.msr; updateresource.monitor = resource.monitor; return updateresource.update_resource(client); }
java
public static base_responses update(nitro_service client, nspbr resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr updateresources[] = new nspbr[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nspbr(); updateresources[i].name = resources[i].name; updateresources[i].action = resources[i].action; updateresources[i].srcip = resources[i].srcip; updateresources[i].srcipop = resources[i].srcipop; updateresources[i].srcipval = resources[i].srcipval; updateresources[i].srcport = resources[i].srcport; updateresources[i].srcportop = resources[i].srcportop; updateresources[i].srcportval = resources[i].srcportval; updateresources[i].destip = resources[i].destip; updateresources[i].destipop = resources[i].destipop; updateresources[i].destipval = resources[i].destipval; updateresources[i].destport = resources[i].destport; updateresources[i].destportop = resources[i].destportop; updateresources[i].destportval = resources[i].destportval; updateresources[i].nexthop = resources[i].nexthop; updateresources[i].nexthopval = resources[i].nexthopval; updateresources[i].iptunnel = resources[i].iptunnel; updateresources[i].iptunnelname = resources[i].iptunnelname; updateresources[i].srcmac = resources[i].srcmac; updateresources[i].protocol = resources[i].protocol; updateresources[i].protocolnumber = resources[i].protocolnumber; updateresources[i].vlan = resources[i].vlan; updateresources[i].Interface = resources[i].Interface; updateresources[i].priority = resources[i].priority; 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 enable(nitro_service client, nspbr resource) throws Exception { nspbr enableresource = new nspbr(); enableresource.name = resource.name; return enableresource.perform_operation(client,"enable"); }
java
public static base_responses enable(nitro_service client, nspbr resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nspbr enableresources[] = new nspbr[resources.length]; for (int i=0;i<resources.length;i++){ enableresources[i] = new nspbr(); enableresources[i].name = resources[i].name; } result = perform_operation_bulk_request(client, enableresources,"enable"); } return result; }
java
public static nspbr[] get(nitro_service service) throws Exception{ nspbr obj = new nspbr(); nspbr[] response = (nspbr[])obj.get_resources(service); return response; }
java
public static nspbr[] get(nitro_service service, nspbr_args args) throws Exception{ nspbr obj = new nspbr(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nspbr[] response = (nspbr[])obj.get_resources(service, option); return response; }
java
public static nspbr get(nitro_service service, String name) throws Exception{ nspbr obj = new nspbr(); obj.set_name(name); nspbr response = (nspbr) obj.get_resource(service); return response; }
java
public static vpnglobal_vpnintranetapplication_binding[] get(nitro_service service) throws Exception{ vpnglobal_vpnintranetapplication_binding obj = new vpnglobal_vpnintranetapplication_binding(); vpnglobal_vpnintranetapplication_binding response[] = (vpnglobal_vpnintranetapplication_binding[]) obj.get_resources(service); return response; }
java
public static aaauser_authorizationpolicy_binding[] get(nitro_service service, String username) throws Exception{ aaauser_authorizationpolicy_binding obj = new aaauser_authorizationpolicy_binding(); obj.set_username(username); aaauser_authorizationpolicy_binding response[] = (aaauser_authorizationpolicy_binding[]) obj.get_resources(service); return response; }
java
public static base_response clear(nitro_service client, rnat resource) throws Exception { rnat clearresource = new rnat(); clearresource.network = resource.network; clearresource.netmask = resource.netmask; clearresource.aclname = resource.aclname; clearresource.redirectport = resource.redirectport; clearresource.natip = resource.natip; clearresource.td = resource.td; return clearresource.perform_operation(client,"clear"); }
java
public static base_responses clear(nitro_service client, rnat resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat clearresources[] = new rnat[resources.length]; for (int i=0;i<resources.length;i++){ clearresources[i] = new rnat(); clearresources[i].network = resources[i].network; clearresources[i].netmask = resources[i].netmask; clearresources[i].aclname = resources[i].aclname; clearresources[i].redirectport = resources[i].redirectport; clearresources[i].natip = resources[i].natip; clearresources[i].td = resources[i].td; } result = perform_operation_bulk_request(client, clearresources,"clear"); } return result; }
java
public static base_response update(nitro_service client, rnat resource) throws Exception { rnat updateresource = new rnat(); updateresource.network = resource.network; updateresource.netmask = resource.netmask; updateresource.natip = resource.natip; updateresource.td = resource.td; updateresource.aclname = resource.aclname; updateresource.redirectport = resource.redirectport; updateresource.natip2 = resource.natip2; return updateresource.update_resource(client); }
java
public static base_responses update(nitro_service client, rnat resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat updateresources[] = new rnat[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new rnat(); updateresources[i].network = resources[i].network; updateresources[i].netmask = resources[i].netmask; updateresources[i].natip = resources[i].natip; updateresources[i].td = resources[i].td; updateresources[i].aclname = resources[i].aclname; updateresources[i].redirectport = resources[i].redirectport; updateresources[i].natip2 = resources[i].natip2; } result = update_bulk_request(client, updateresources); } return result; }
java
public static base_response unset(nitro_service client, rnat resource, String[] args) throws Exception{ rnat unsetresource = new rnat(); unsetresource.network = resource.network; unsetresource.netmask = resource.netmask; unsetresource.td = resource.td; unsetresource.aclname = resource.aclname; unsetresource.redirectport = resource.redirectport; unsetresource.natip = resource.natip; return unsetresource.unset_resource(client,args); }
java
public static base_responses unset(nitro_service client, rnat resources[], String[] args) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { rnat unsetresources[] = new rnat[resources.length]; for (int i=0;i<resources.length;i++){ unsetresources[i] = new rnat(); unsetresources[i].network = resources[i].network; unsetresources[i].netmask = resources[i].netmask; unsetresources[i].td = resources[i].td; unsetresources[i].aclname = resources[i].aclname; unsetresources[i].redirectport = resources[i].redirectport; unsetresources[i].natip = resources[i].natip; } result = unset_bulk_request(client, unsetresources,args); } return result; }
java
public static rnat[] get(nitro_service service, options option) throws Exception{ rnat obj = new rnat(); rnat[] response = (rnat[])obj.get_resources(service,option); return response; }
java
public static authorizationpolicy_binding get(nitro_service service, String name) throws Exception{ authorizationpolicy_binding obj = new authorizationpolicy_binding(); obj.set_name(name); authorizationpolicy_binding response = (authorizationpolicy_binding) obj.get_resource(service); return response; }
java
public static cachepolicy_cachepolicylabel_binding[] get(nitro_service service, String policyname) throws Exception{ cachepolicy_cachepolicylabel_binding obj = new cachepolicy_cachepolicylabel_binding(); obj.set_policyname(policyname); cachepolicy_cachepolicylabel_binding response[] = (cachepolicy_cachepolicylabel_binding[]) obj.get_resources(service); return response; }
java
public static authenticationtacacspolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{ authenticationtacacspolicy_vpnvserver_binding obj = new authenticationtacacspolicy_vpnvserver_binding(); obj.set_name(name); authenticationtacacspolicy_vpnvserver_binding response[] = (authenticationtacacspolicy_vpnvserver_binding[]) obj.get_resources(service); return response; }
java
public static gslbsite_binding get(nitro_service service, String sitename) throws Exception{ gslbsite_binding obj = new gslbsite_binding(); obj.set_sitename(sitename); gslbsite_binding response = (gslbsite_binding) obj.get_resource(service); return response; }
java
public static base_response Install(nitro_service client, wipackage resource) throws Exception { wipackage Installresource = new wipackage(); Installresource.jre = resource.jre; Installresource.wi = resource.wi; Installresource.maxsites = resource.maxsites; return Installresource.perform_operation(client); }
java
public static vrid6_interface_binding[] get(nitro_service service, Long id) throws Exception{ vrid6_interface_binding obj = new vrid6_interface_binding(); obj.set_id(id); vrid6_interface_binding response[] = (vrid6_interface_binding[]) obj.get_resources(service); return response; }
java
public static dnspolicy64[] get(nitro_service service) throws Exception{ dnspolicy64 obj = new dnspolicy64(); dnspolicy64[] response = (dnspolicy64[])obj.get_resources(service); return response; }
java
public static dnspolicy64 get(nitro_service service, String name) throws Exception{ dnspolicy64 obj = new dnspolicy64(); obj.set_name(name); dnspolicy64 response = (dnspolicy64) obj.get_resource(service); return response; }
java
public static dnspolicy64[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{ dnspolicy64 obj = new dnspolicy64(); options option = new options(); option.set_filter(filter); dnspolicy64[] response = (dnspolicy64[]) obj.getfiltered(service, option); return response; }
java
public static vpnvserver_intranetip_binding[] get(nitro_service service, String name) throws Exception{ vpnvserver_intranetip_binding obj = new vpnvserver_intranetip_binding(); obj.set_name(name); vpnvserver_intranetip_binding response[] = (vpnvserver_intranetip_binding[]) obj.get_resources(service); return response; }
java
public static vpnglobal_authenticationcertpolicy_binding[] get(nitro_service service) throws Exception{ vpnglobal_authenticationcertpolicy_binding obj = new vpnglobal_authenticationcertpolicy_binding(); vpnglobal_authenticationcertpolicy_binding response[] = (vpnglobal_authenticationcertpolicy_binding[]) obj.get_resources(service); return response; }
java
public static netbridge_binding get(nitro_service service, String name) throws Exception{ netbridge_binding obj = new netbridge_binding(); obj.set_name(name); netbridge_binding response = (netbridge_binding) obj.get_resource(service); return response; }
java
public static appqoepolicy_stats[] get(nitro_service service) throws Exception{ appqoepolicy_stats obj = new appqoepolicy_stats(); appqoepolicy_stats[] response = (appqoepolicy_stats[])obj.stat_resources(service); return response; }
java
public static appqoepolicy_stats get(nitro_service service, String name) throws Exception{ appqoepolicy_stats obj = new appqoepolicy_stats(); obj.set_name(name); appqoepolicy_stats response = (appqoepolicy_stats) obj.stat_resource(service); return response; }
java
public static nstrace get(nitro_service service) throws Exception{ nstrace obj = new nstrace(); nstrace[] response = (nstrace[])obj.get_resources(service); return response[0]; }
java
public static base_response release(nitro_service client) throws Exception { nsdhcpip releaseresource = new nsdhcpip(); return releaseresource.perform_operation(client,"release"); }
java
public static cachepolicy_stats[] get(nitro_service service) throws Exception{ cachepolicy_stats obj = new cachepolicy_stats(); cachepolicy_stats[] response = (cachepolicy_stats[])obj.stat_resources(service); return response; }
java
public static cachepolicy_stats get(nitro_service service, String policyname) throws Exception{ cachepolicy_stats obj = new cachepolicy_stats(); obj.set_policyname(policyname); cachepolicy_stats response = (cachepolicy_stats) obj.stat_resource(service); return response; }
java
public static gslbsite_gslbservice_binding[] get(nitro_service service, String sitename) throws Exception{ gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding(); obj.set_sitename(sitename); gslbsite_gslbservice_binding response[] = (gslbsite_gslbservice_binding[]) obj.get_resources(service); return response; }
java
public static gslbsite_gslbservice_binding[] get_filtered(nitro_service service, String sitename, filtervalue[] filter) throws Exception{ gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding(); obj.set_sitename(sitename); options option = new options(); option.set_filter(filter); gslbsite_gslbservice_binding[] response = (gslbsite_gslbservice_binding[]) obj.getfiltered(service, option); return response; }
java
public static long count(nitro_service service, String sitename) throws Exception{ gslbsite_gslbservice_binding obj = new gslbsite_gslbservice_binding(); obj.set_sitename(sitename); options option = new options(); option.set_count(true); gslbsite_gslbservice_binding response[] = (gslbsite_gslbservice_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
public static gslbsite_stats[] get(nitro_service service, options option) throws Exception{ gslbsite_stats obj = new gslbsite_stats(); gslbsite_stats[] response = (gslbsite_stats[])obj.stat_resources(service,option); return response; }
java
public static gslbsite_stats get(nitro_service service, String sitename) throws Exception{ gslbsite_stats obj = new gslbsite_stats(); obj.set_sitename(sitename); gslbsite_stats response = (gslbsite_stats) obj.stat_resource(service); return response; }
java
public static base_response add(nitro_service client, dnsaddrec resource) throws Exception { dnsaddrec addresource = new dnsaddrec(); addresource.hostname = resource.hostname; addresource.ipaddress = resource.ipaddress; addresource.ttl = resource.ttl; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, dnsaddrec resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { dnsaddrec addresources[] = new dnsaddrec[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new dnsaddrec(); addresources[i].hostname = resources[i].hostname; addresources[i].ipaddress = resources[i].ipaddress; addresources[i].ttl = resources[i].ttl; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response delete(nitro_service client, String hostname) throws Exception { dnsaddrec deleteresource = new dnsaddrec(); deleteresource.hostname = hostname; return deleteresource.delete_resource(client); }
java
public static base_response delete(nitro_service client, dnsaddrec resource) throws Exception { dnsaddrec deleteresource = new dnsaddrec(); deleteresource.hostname = resource.hostname; deleteresource.ipaddress = resource.ipaddress; return deleteresource.delete_resource(client); }
java
public static base_responses delete(nitro_service client, dnsaddrec resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { dnsaddrec deleteresources[] = new dnsaddrec[resources.length]; for (int i=0;i<resources.length;i++){ deleteresources[i] = new dnsaddrec(); deleteresources[i].hostname = resources[i].hostname; deleteresources[i].ipaddress = resources[i].ipaddress; } result = delete_bulk_request(client, deleteresources); } return result; }
java
public static dnsaddrec[] get(nitro_service service) throws Exception{ dnsaddrec obj = new dnsaddrec(); dnsaddrec[] response = (dnsaddrec[])obj.get_resources(service); return response; }
java
public static dnsaddrec[] get(nitro_service service, dnsaddrec_args args) throws Exception{ dnsaddrec obj = new dnsaddrec(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); dnsaddrec[] response = (dnsaddrec[])obj.get_resources(service, option); return response; }
java
public static dnsaddrec get(nitro_service service, String hostname) throws Exception{ dnsaddrec obj = new dnsaddrec(); obj.set_hostname(hostname); dnsaddrec response = (dnsaddrec) obj.get_resource(service); return response; }
java
public static authorizationpolicy_aaauser_binding[] get(nitro_service service, String name) throws Exception{ authorizationpolicy_aaauser_binding obj = new authorizationpolicy_aaauser_binding(); obj.set_name(name); authorizationpolicy_aaauser_binding response[] = (authorizationpolicy_aaauser_binding[]) obj.get_resources(service); return response; }
java
public static base_response add(nitro_service client, nsxmlnamespace resource) throws Exception { nsxmlnamespace addresource = new nsxmlnamespace(); addresource.prefix = resource.prefix; addresource.Namespace = resource.Namespace; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, nsxmlnamespace resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsxmlnamespace addresources[] = new nsxmlnamespace[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new nsxmlnamespace(); addresources[i].prefix = resources[i].prefix; addresources[i].Namespace = resources[i].Namespace; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response delete(nitro_service client, String prefix) throws Exception { nsxmlnamespace deleteresource = new nsxmlnamespace(); deleteresource.prefix = prefix; return deleteresource.delete_resource(client); }
java