code
stringlengths
73
34.1k
label
stringclasses
1 value
public static appqoecustomresp[] get(nitro_service service, options option) throws Exception{ appqoecustomresp obj = new appqoecustomresp(); appqoecustomresp[] response = (appqoecustomresp[])obj.get_resources(service,option); return response; }
java
@SuppressWarnings("unchecked") public static CodecInfo getCodecInfoFromTerms(Terms t) throws IOException { try { HashMap<String, IndexInput> indexInputList = null; HashMap<String, Long> indexInputOffsetList = null; Object version = null; Method[] methods = t.getClass().getMethods(); Object[] emptyArgs = null; for (Method m : methods) { if (m.getName().equals("getIndexInputList")) { indexInputList = (HashMap<String, IndexInput>) m.invoke(t, emptyArgs); } else if (m.getName().equals("getIndexInputOffsetList")) { indexInputOffsetList = (HashMap<String, Long>) m.invoke(t, emptyArgs); } else if (m.getName().equals("getVersion")) { version = m.invoke(t, emptyArgs); } } if (indexInputList == null || indexInputOffsetList == null || version == null) { throw new IOException("Reader doesn't provide MtasFieldsProducer"); } else { return new CodecInfo(indexInputList, indexInputOffsetList, (int) version); } } catch (IllegalAccessException | InvocationTargetException e) { throw new IOException("Can't get codecInfo", e); } }
java
public MtasToken getObjectById(String field, int docId, int mtasId) throws IOException { try { Long ref; Long objectRefApproxCorrection; IndexDoc doc = getDoc(field, docId); IndexInput inObjectId = indexInputList.get("indexObjectId"); IndexInput inObject = indexInputList.get("object"); IndexInput inTerm = indexInputList.get("term"); if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_BYTE) { inObjectId.seek(doc.fpIndexObjectId + (mtasId * 1L)); objectRefApproxCorrection = Long.valueOf(inObjectId.readByte()); } else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_SHORT) { inObjectId.seek(doc.fpIndexObjectId + (mtasId * 2L)); objectRefApproxCorrection = Long.valueOf(inObjectId.readShort()); } else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_INTEGER) { inObjectId.seek(doc.fpIndexObjectId + (mtasId * 4L)); objectRefApproxCorrection = Long.valueOf(inObjectId.readInt()); } else { inObjectId.seek(doc.fpIndexObjectId + (mtasId * 8L)); objectRefApproxCorrection = Long.valueOf(inObjectId.readLong()); } ref = objectRefApproxCorrection + doc.objectRefApproxOffset + (mtasId * (long) doc.objectRefApproxQuotient); return MtasCodecPostingsFormat.getToken(inObject, inTerm, ref); } catch (Exception e) { throw new IOException(e); } }
java
public List<MtasTokenString> getObjectsByParentId(String field, int docId, int position) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectParent = indexInputList.get("indexObjectParent"); ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(position, inIndexObjectParent, doc.fpIndexObjectParent, doc.smallestObjectFilepointer); return getObjects(hits); }
java
public ArrayList<MtasTokenString> getObjectsByPosition(String field, int docId, int position) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectPosition = indexInputList .get("indexObjectPosition"); ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(position, inIndexObjectPosition, doc.fpIndexObjectPosition, doc.smallestObjectFilepointer); return getObjects(hits); }
java
public List<MtasTokenString> getPrefixFilteredObjectsByPositions(String field, int docId, List<String> prefixes, int startPosition, int endPosition) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectPosition = indexInputList .get("indexObjectPosition"); if (doc != null) { ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree( startPosition, endPosition, inIndexObjectPosition, doc.fpIndexObjectPosition, doc.smallestObjectFilepointer); return getPrefixFilteredObjects(hits, prefixes); } else { return new ArrayList<>(); } }
java
private List<MtasTokenString> getPrefixFilteredObjects( List<MtasTreeHit<?>> hits, List<String> prefixes) throws IOException { ArrayList<MtasTokenString> tokens = new ArrayList<>(); IndexInput inObject = indexInputList.get("object"); IndexInput inTerm = indexInputList.get("term"); for (MtasTreeHit<?> hit : hits) { MtasTokenString token = MtasCodecPostingsFormat.getToken(inObject, inTerm, hit.ref); if (token != null) { if (prefixes != null && !prefixes.isEmpty()) { if (prefixes.contains(token.getPrefix())) { tokens.add(token); } } else { tokens.add(token); } } } return tokens; }
java
public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPosition( String field, int docId, List<String> prefixes, int position) throws IOException { return getPositionedTermsByPrefixesAndPositionRange(field, docId, prefixes, position, position); }
java
public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPositionRange( String field, int docId, List<String> prefixes, int startPosition, int endPosition) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectPosition = indexInputList .get("indexObjectPosition"); if (doc != null) { ArrayList<MtasTreeHit<?>> hitItems = CodecSearchTree.searchMtasTree( startPosition, endPosition, inIndexObjectPosition, doc.fpIndexObjectPosition, doc.smallestObjectFilepointer); List<MtasTreeHit<String>> hits = new ArrayList<>(); Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes); if (prefixIds != null && prefixIds.size() > 0) { ArrayList<MtasTreeHit<?>> filteredHitItems = new ArrayList<MtasTreeHit<?>>(); for (MtasTreeHit<?> hitItem : hitItems) { if (prefixIds.containsValue(hitItem.additionalId)) { filteredHitItems.add(hitItem); } } if (filteredHitItems.size() > 0) { ArrayList<MtasTokenString> objects = getObjects(filteredHitItems); for (MtasTokenString token : objects) { MtasTreeHit<String> hit = new MtasTreeHit<String>( token.getPositionStart(), token.getPositionEnd(), token.getTokenRef(), 0, 0, token.getValue()); hits.add(hit); } } } return hits; } else { return new ArrayList<MtasTreeHit<String>>(); } }
java
public void collectTermsByPrefixesForListOfHitPositions(String field, int docId, ArrayList<String> prefixes, ArrayList<IntervalTreeNodeData<String>> positionsHits) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectPosition = indexInputList .get("indexObjectPosition"); IndexInput inTerm = indexInputList.get("term"); // create tree interval hits IntervalRBTree<String> positionTree = new IntervalRBTree<String>( positionsHits); // find prefixIds Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes); // search matching tokens if (prefixIds != null) { CodecSearchTree.searchMtasTreeWithIntervalTree(prefixIds.values(), positionTree, inIndexObjectPosition, doc.fpIndexObjectPosition, doc.smallestObjectFilepointer); // reverse list Map<Integer, String> idPrefixes = new HashMap<>(); for (Entry<String, Integer> entry : prefixIds.entrySet()) { idPrefixes.put(entry.getValue(), entry.getKey()); } // term administration Map<Long, String> refTerms = new HashMap<>(); for (IntervalTreeNodeData<String> positionHit : positionsHits) { for (MtasTreeHit<String> hit : positionHit.list) { if (hit.idData == null) { hit.idData = idPrefixes.get(hit.additionalId); if (!refTerms.containsKey(hit.additionalRef)) { refTerms.put(hit.additionalRef, MtasCodecPostingsFormat.getTerm(inTerm, hit.additionalRef)); } hit.refData = refTerms.get(hit.additionalRef); } } } } }
java
public ArrayList<MtasTreeHit<String>> getTerms(ArrayList<MtasTreeHit<?>> refs) throws IOException { try { ArrayList<MtasTreeHit<String>> terms = new ArrayList<MtasTreeHit<String>>(); IndexInput inTerm = indexInputList.get("term"); for (MtasTreeHit<?> hit : refs) { inTerm.seek(hit.ref); String term = inTerm.readString(); MtasTreeHit<String> newHit = new MtasTreeHit<String>(hit.startPosition, hit.endPosition, hit.ref, hit.additionalId, hit.additionalRef, term); terms.add(newHit); } return terms; } catch (Exception e) { throw new IOException(e); } }
java
Map<String, Integer> getPrefixesIds(String field, List<String> prefixes) { LinkedHashMap<String, Long> refs = getPrefixRefs(field); if (refs != null) { List<String> list = new ArrayList<>(refs.keySet()); Map<String, Integer> result = new HashMap<>(); for (String prefix : prefixes) { int id = list.indexOf(prefix); if (id >= 0) { result.put(prefix, id + 1); } } return result; } else { return null; } }
java
private LinkedHashMap<String, Long> getPrefixRefs(String field) { if (fieldReferences.containsKey(field)) { FieldReferences fr = fieldReferences.get(field); if (!prefixReferences.containsKey(field)) { LinkedHashMap<String, Long> refs = new LinkedHashMap<String, Long>(); try { IndexInput inPrefix = indexInputList.get("prefix"); inPrefix.seek(fr.refPrefix); for (int i = 0; i < fr.numberOfPrefixes; i++) { Long ref = inPrefix.getFilePointer(); String prefix = inPrefix.readString(); refs.put(prefix, ref); } } catch (Exception e) { log.error(e); refs.clear(); } prefixReferences.put(field, refs); return refs; } else { return prefixReferences.get(field); } } else { return null; } }
java
public IndexDoc getDoc(String field, int docId) { if (fieldReferences.containsKey(field)) { FieldReferences fr = fieldReferences.get(field); try { IndexInput inIndexDocId = indexInputList.get("indexDocId"); ArrayList<MtasTreeHit<?>> list = CodecSearchTree.searchMtasTree(docId, inIndexDocId, fr.refIndexDocId, fr.refIndexDoc); if (list.size() == 1) { return new IndexDoc(list.get(0).ref); } } catch (IOException e) { log.debug(e); return null; } } return null; }
java
public IndexDoc getNextDoc(String field, int previousDocId) { if (fieldReferences.containsKey(field)) { FieldReferences fr = fieldReferences.get(field); try { if (previousDocId < 0) { return new IndexDoc(fr.refIndexDoc); } else { int nextDocId = previousDocId + 1; IndexInput inIndexDocId = indexInputList.get("indexDocId"); ArrayList<MtasTreeHit<?>> list = CodecSearchTree.advanceMtasTree( nextDocId, inIndexDocId, fr.refIndexDocId, fr.refIndexDoc); if (list.size() == 1) { IndexInput inDoc = indexInputList.get("doc"); inDoc.seek(list.get(0).ref); return new IndexDoc(inDoc.getFilePointer()); } } } catch (IOException e) { log.debug(e); return null; } } return null; }
java
public int getNumberOfDocs(String field) { if (fieldReferences.containsKey(field)) { FieldReferences fr = fieldReferences.get(field); return fr.numberOfDocs; } else { return 0; } }
java
public Integer getNumberOfPositions(String field, int docId) { if (fieldReferences.containsKey(field)) { IndexDoc doc = getDoc(field, docId); if (doc != null) { return 1 + doc.maxPosition - doc.minPosition; } } return null; }
java
public HashMap<Integer, Integer> getAllNumberOfPositions(String field, int docBase) throws IOException { HashMap<Integer, Integer> numbers = new HashMap<Integer, Integer>(); if (fieldReferences.containsKey(field)) { FieldReferences fr = fieldReferences.get(field); IndexInput inIndexDoc = indexInputList.get("doc"); inIndexDoc.seek(fr.refIndexDoc); IndexDoc doc; for (int i = 0; i < fr.numberOfDocs; i++) { doc = new IndexDoc(null); numbers.put((doc.docId + docBase), (1 + doc.maxPosition - doc.minPosition)); } } return numbers; }
java
public Integer getNumberOfTokens(String field, int docId) { if (fieldReferences.containsKey(field)) { IndexDoc doc = getDoc(field, docId); if (doc != null) { return doc.size; } } return null; }
java
@SuppressWarnings({"MethodMayBeStatic"}) protected void addAllInterningAndSuffixing(Collection<String> accumulator, Collection<String> addend, String suffix) { boolean nonNullSuffix = suffix != null && ! "".equals(suffix); if (nonNullSuffix) { suffix = '|' + suffix; } // boolean intern2 = flags.intern2; for (String feat : addend) { if (nonNullSuffix) { feat = feat.concat(suffix); } // if (intern2) { // feat = feat.intern(); // } accumulator.add(feat); } }
java
protected String getWord(CoreLabel label) { String word = label.getString(TextAnnotation.class); if (flags.wordFunction != null) { word = flags.wordFunction.apply(word); } return word; }
java
private MutableDouble mutableRemove(E key) { MutableDouble md = map.remove(key); if (md != null) { totalCount -= md.doubleValue(); } return md; }
java
public static base_response renumber(nitro_service client) throws Exception { nsacls renumberresource = new nsacls(); return renumberresource.perform_operation(client,"renumber"); }
java
public static base_response clear(nitro_service client) throws Exception { nsacls clearresource = new nsacls(); return clearresource.perform_operation(client,"clear"); }
java
public static base_response apply(nitro_service client) throws Exception { nsacls applyresource = new nsacls(); return applyresource.perform_operation(client,"apply"); }
java
public static vlan_linkset_binding[] get(nitro_service service, Long id) throws Exception{ vlan_linkset_binding obj = new vlan_linkset_binding(); obj.set_id(id); vlan_linkset_binding response[] = (vlan_linkset_binding[]) obj.get_resources(service); return response; }
java
public static base_response update(nitro_service client, nsencryptionparams resource) throws Exception { nsencryptionparams updateresource = new nsencryptionparams(); updateresource.method = resource.method; updateresource.keyvalue = resource.keyvalue; return updateresource.update_resource(client); }
java
public static nsencryptionparams get(nitro_service service) throws Exception{ nsencryptionparams obj = new nsencryptionparams(); nsencryptionparams[] response = (nsencryptionparams[])obj.get_resources(service); return response[0]; }
java
public static vpnvserver_auditsyslogpolicy_binding[] get(nitro_service service, String name) throws Exception{ vpnvserver_auditsyslogpolicy_binding obj = new vpnvserver_auditsyslogpolicy_binding(); obj.set_name(name); vpnvserver_auditsyslogpolicy_binding response[] = (vpnvserver_auditsyslogpolicy_binding[]) obj.get_resources(service); return response; }
java
public static appfwprofile_xmldosurl_binding[] get(nitro_service service, String name) throws Exception{ appfwprofile_xmldosurl_binding obj = new appfwprofile_xmldosurl_binding(); obj.set_name(name); appfwprofile_xmldosurl_binding response[] = (appfwprofile_xmldosurl_binding[]) obj.get_resources(service); return response; }
java
public TregexPattern compile(String tregex) { for (Pair<String, String> macro : macros) { tregex = tregex.replaceAll(macro.first(), macro.second()); } TregexPattern pattern; try { TregexParser parser = new TregexParser(new StringReader(tregex + '\n'), basicCatFunction, headFinder); pattern = parser.Root(); } catch (TokenMgrError tme) { throw new TregexParseException("Could not parse " + tregex, tme); } catch (ParseException e) { throw new TregexParseException("Could not parse " + tregex, e); } pattern.setPatternString(tregex); return pattern; }
java
public static responderpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{ responderpolicy_csvserver_binding obj = new responderpolicy_csvserver_binding(); obj.set_name(name); responderpolicy_csvserver_binding response[] = (responderpolicy_csvserver_binding[]) obj.get_resources(service); return response; }
java
public static sslcrl_serialnumber_binding[] get(nitro_service service, String crlname) throws Exception{ sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding(); obj.set_crlname(crlname); sslcrl_serialnumber_binding response[] = (sslcrl_serialnumber_binding[]) obj.get_resources(service); return response; }
java
public static long count(nitro_service service, String crlname) throws Exception{ sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding(); obj.set_crlname(crlname); options option = new options(); option.set_count(true); sslcrl_serialnumber_binding response[] = (sslcrl_serialnumber_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
public static base_response add(nitro_service client, aaauser resource) throws Exception { aaauser addresource = new aaauser(); addresource.username = resource.username; addresource.password = resource.password; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, aaauser resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { aaauser addresources[] = new aaauser[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new aaauser(); addresources[i].username = resources[i].username; addresources[i].password = resources[i].password; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response update(nitro_service client, aaauser resource) throws Exception { aaauser updateresource = new aaauser(); updateresource.username = resource.username; updateresource.password = resource.password; return updateresource.update_resource(client); }
java
public static aaauser[] get(nitro_service service) throws Exception{ aaauser obj = new aaauser(); aaauser[] response = (aaauser[])obj.get_resources(service); return response; }
java
public static aaauser[] get(nitro_service service, aaauser_args args) throws Exception{ aaauser obj = new aaauser(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); aaauser[] response = (aaauser[])obj.get_resources(service, option); return response; }
java
public static aaauser get(nitro_service service, String username) throws Exception{ aaauser obj = new aaauser(); obj.set_username(username); aaauser response = (aaauser) obj.get_resource(service); return response; }
java
public static aaauser[] get(nitro_service service, String username[]) throws Exception{ if (username !=null && username.length>0) { aaauser response[] = new aaauser[username.length]; aaauser obj[] = new aaauser[username.length]; for (int i=0;i<username.length;i++) { obj[i] = new aaauser(); obj[i].set_username(username[i]); response[i] = (aaauser) obj[i].get_resource(service); } return response; } return null; }
java
public static authenticationcertpolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{ authenticationcertpolicy_authenticationvserver_binding obj = new authenticationcertpolicy_authenticationvserver_binding(); obj.set_name(name); authenticationcertpolicy_authenticationvserver_binding response[] = (authenticationcertpolicy_authenticationvserver_binding[]) obj.get_resources(service); return response; }
java
public void addRule(IntDependency dependency, double count) { if ( ! directional) { dependency = new IntDependency(dependency.head, dependency.arg, false, dependency.distance); } if (verbose) System.err.println("Adding dep " + dependency); // coreDependencies.incrementCount(dependency, count); /*new IntDependency(dependency.head.word, dependency.head.tag, dependency.arg.word, dependency.arg.tag, dependency.leftHeaded, dependency.distance), count); */ expandDependency(dependency, count); // System.err.println("stopCounter: " + stopCounter); // System.err.println("argCounter: " + argCounter); }
java
private IntTaggedWord getCachedITW(short tag) { // The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord). if (tagITWList == null) { tagITWList = new ArrayList<IntTaggedWord>(numTagBins + 2); for (int i=0; i<numTagBins + 2; i++) { tagITWList.add(i, null); } } IntTaggedWord headT = tagITWList.get(tagBin(tag) + 2); if (headT == null) { headT = new IntTaggedWord(ANY_WORD_INT, tagBin(tag)); tagITWList.set(tagBin(tag) + 2, headT); } return headT; }
java
protected void expandDependency(IntDependency dependency, double count) { //if (Test.prunePunc && pruneTW(dependency.arg)) // return; if (dependency.head == null || dependency.arg == null) { return; } if (dependency.arg.word != STOP_WORD_INT) { expandArg(dependency, valenceBin(dependency.distance), count); } expandStop(dependency, distanceBin(dependency.distance), count, true); }
java
public double scoreTB(IntDependency dependency) { return op.testOptions.depWeight * Math.log(probTB(dependency)); }
java
@Override public void readData(BufferedReader in) throws IOException { final String LEFT = "left"; int lineNum = 1; // all lines have one rule per line boolean doingStop = false; for (String line = in.readLine(); line != null && line.length() > 0; line = in.readLine()) { try { if (line.equals("BEGIN_STOP")) { doingStop = true; continue; } String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\'); // split on spaces, quote with doublequote, and escape with backslash // System.out.println("fields:\n" + fields[0] + "\n" + fields[1] + "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4] + "\n" + fields[5]); short distance = (short)Integer.parseInt(fields[4]); IntTaggedWord tempHead = new IntTaggedWord(fields[0], '/', wordIndex, tagIndex); IntTaggedWord tempArg = new IntTaggedWord(fields[2], '/', wordIndex, tagIndex); IntDependency tempDependency = new IntDependency(tempHead, tempArg, fields[3].equals(LEFT), distance); double count = Double.parseDouble(fields[5]); if (doingStop) { expandStop(tempDependency, distance, count, false); } else { expandArg(tempDependency, distance, count); } } catch (Exception e) { IOException ioe = new IOException("Error on line " + lineNum + ": " + line); ioe.initCause(e); throw ioe; } // System.out.println("read line " + lineNum + ": " + line); lineNum++; } }
java
@Override public void writeData(PrintWriter out) throws IOException { // all lines have one rule per line for (IntDependency dependency : argCounter.keySet()) { if (dependency.head != wildTW && dependency.arg != wildTW && dependency.head.word != -1 && dependency.arg.word != -1) { double count = argCounter.getCount(dependency); out.println(dependency.toString(wordIndex, tagIndex) + " " + count); } } out.println("BEGIN_STOP"); for (IntDependency dependency : stopCounter.keySet()) { if (dependency.head.word != -1) { double count = stopCounter.getCount(dependency); out.println(dependency.toString(wordIndex, tagIndex) + " " + count); } } out.flush(); }
java
public static base_response add(nitro_service client, vpnintranetapplication resource) throws Exception { vpnintranetapplication addresource = new vpnintranetapplication(); addresource.intranetapplication = resource.intranetapplication; addresource.protocol = resource.protocol; addresource.destip = resource.destip; addresource.netmask = resource.netmask; addresource.iprange = resource.iprange; addresource.hostname = resource.hostname; addresource.clientapplication = resource.clientapplication; addresource.spoofiip = resource.spoofiip; addresource.destport = resource.destport; addresource.interception = resource.interception; addresource.srcip = resource.srcip; addresource.srcport = resource.srcport; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, vpnintranetapplication resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { vpnintranetapplication addresources[] = new vpnintranetapplication[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new vpnintranetapplication(); addresources[i].intranetapplication = resources[i].intranetapplication; addresources[i].protocol = resources[i].protocol; addresources[i].destip = resources[i].destip; addresources[i].netmask = resources[i].netmask; addresources[i].iprange = resources[i].iprange; addresources[i].hostname = resources[i].hostname; addresources[i].clientapplication = resources[i].clientapplication; addresources[i].spoofiip = resources[i].spoofiip; addresources[i].destport = resources[i].destport; addresources[i].interception = resources[i].interception; addresources[i].srcip = resources[i].srcip; addresources[i].srcport = resources[i].srcport; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response delete(nitro_service client, String intranetapplication) throws Exception { vpnintranetapplication deleteresource = new vpnintranetapplication(); deleteresource.intranetapplication = intranetapplication; return deleteresource.delete_resource(client); }
java
public static vpnintranetapplication[] get(nitro_service service) throws Exception{ vpnintranetapplication obj = new vpnintranetapplication(); vpnintranetapplication[] response = (vpnintranetapplication[])obj.get_resources(service); return response; }
java
public static vpnintranetapplication get(nitro_service service, String intranetapplication) throws Exception{ vpnintranetapplication obj = new vpnintranetapplication(); obj.set_intranetapplication(intranetapplication); vpnintranetapplication response = (vpnintranetapplication) obj.get_resource(service); return response; }
java
public static vpnintranetapplication[] get(nitro_service service, String intranetapplication[]) throws Exception{ if (intranetapplication !=null && intranetapplication.length>0) { vpnintranetapplication response[] = new vpnintranetapplication[intranetapplication.length]; vpnintranetapplication obj[] = new vpnintranetapplication[intranetapplication.length]; for (int i=0;i<intranetapplication.length;i++) { obj[i] = new vpnintranetapplication(); obj[i].set_intranetapplication(intranetapplication[i]); response[i] = (vpnintranetapplication) obj[i].get_resource(service); } return response; } return null; }
java
public static sslpolicy_sslvserver_binding[] get(nitro_service service, String name) throws Exception{ sslpolicy_sslvserver_binding obj = new sslpolicy_sslvserver_binding(); obj.set_name(name); sslpolicy_sslvserver_binding response[] = (sslpolicy_sslvserver_binding[]) obj.get_resources(service); return response; }
java
public static tmsessionpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{ tmsessionpolicy_tmglobal_binding obj = new tmsessionpolicy_tmglobal_binding(); obj.set_name(name); tmsessionpolicy_tmglobal_binding response[] = (tmsessionpolicy_tmglobal_binding[]) obj.get_resources(service); return response; }
java
public static base_response update(nitro_service client, nsweblogparam resource) throws Exception { nsweblogparam updateresource = new nsweblogparam(); updateresource.buffersizemb = resource.buffersizemb; updateresource.customreqhdrs = resource.customreqhdrs; updateresource.customrsphdrs = resource.customrsphdrs; return updateresource.update_resource(client); }
java
public static base_response unset(nitro_service client, nsweblogparam resource, String[] args) throws Exception{ nsweblogparam unsetresource = new nsweblogparam(); return unsetresource.unset_resource(client,args); }
java
public static nsweblogparam get(nitro_service service, options option) throws Exception{ nsweblogparam obj = new nsweblogparam(); nsweblogparam[] response = (nsweblogparam[])obj.get_resources(service,option); return response[0]; }
java
public static nslicense get(nitro_service service) throws Exception{ nslicense obj = new nslicense(); nslicense[] response = (nslicense[])obj.get_resources(service); return response[0]; }
java
public static ipset_binding get(nitro_service service, String name) throws Exception{ ipset_binding obj = new ipset_binding(); obj.set_name(name); ipset_binding response = (ipset_binding) obj.get_resource(service); return response; }
java
public long[] elements() { long[] myElements = new long[size]; for (int i=size; --i >= 0; ) myElements[i]=getQuick(i); return myElements; } /** * Sets the receiver's elements to be the specified array. * The size and capacity of the list is the length of the array. * <b>WARNING:</b> For efficiency reasons and to keep memory usage low, this method may decide <b>not to copy the array</b>. * So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing. * * @param elements the new elements to be stored. * @return the receiver itself. */ public AbstractLongList elements(long[] elements) { clear(); addAllOfFromTo(new LongArrayList(elements),0,elements.length-1); return this; } /** * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory. * If necessary, allocates new internal memory and increases the capacity of the receiver. * * @param minCapacity the desired minimum capacity. */ public abstract void ensureCapacity(int minCapacity); /** * Compares the specified Object with the receiver. * Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the * same size, and all corresponding pairs of elements in the two Lists are identical. * In other words, two Lists are defined to be equal if they contain the * same elements in the same order. * * @param otherObj the Object to be compared for equality with the receiver. * @return true if the specified Object is equal to the receiver. */ public boolean equals(Object otherObj) { //delta if (! (otherObj instanceof AbstractLongList)) {return false;} if (this==otherObj) return true; if (otherObj==null) return false; AbstractLongList other = (AbstractLongList) otherObj; if (size()!=other.size()) return false; for (int i=size(); --i >= 0; ) { if (getQuick(i) != other.getQuick(i)) return false; } return true; } /** * Sets the specified range of elements in the specified array to the specified value. * * @param from the index of the first element (inclusive) to be filled with the specified value. * @param to the index of the last element (inclusive) to be filled with the specified value. * @param val the value to be stored in the specified elements of the receiver. */ public void fillFromToWith(int from, int to, long val) { checkRangeFromTo(from,to,this.size); for (int i=from; i<=to;) setQuick(i++,val); } /** * Applies a procedure to each element of the receiver, if any. * Starts at index 0, moving rightwards. * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. */ public boolean forEach(LongProcedure procedure) { for (int i=0; i<size;) if (! procedure.apply(get(i++))) return false; return true; } /** * Returns the element at the specified position in the receiver. * * @param index index of element to return. * @exception IndexOutOfBoundsException index is out of range (index * &lt; 0 || index &gt;= size()). */ public long get(int index) { if (index >= size || index < 0) throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size); return getQuick(index); } /** * Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions. * Provided with invalid parameters this method may return invalid elements without throwing any exception! * <b>You should only use this method when you are absolutely sure that the index is within bounds.</b> * Precondition (unchecked): <tt>index &gt;= 0 && index &lt; size()</tt>. * * This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop. * However, when desperately, you can give this method <tt>public</tt> visibility in subclasses. * * @param index index of element to return. */ protected abstract long getQuick(int index); /** * Returns the index of the first occurrence of the specified * element. Returns <code>-1</code> if the receiver does not contain this element. * * @param element the element to be searched for. * @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. */ public int indexOf(long element) { //delta return indexOfFromTo(element, 0, size-1); } /** * Returns the index of the first occurrence of the specified * element. Returns <code>-1</code> if the receiver does not contain this element. * Searches between <code>from</code>, inclusive and <code>to</code>, inclusive. * Tests for identity. * * @param element element to search for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public int indexOfFromTo(long element, int from, int to) { checkRangeFromTo(from, to, size); for (int i = from ; i <= to; i++) { if (element==getQuick(i)) return i; //found } return -1; //not found } /** * Returns the index of the last occurrence of the specified * element. Returns <code>-1</code> if the receiver does not contain this element. * * @param element the element to be searched for. * @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. */ public int lastIndexOf(long element) { return lastIndexOfFromTo(element, 0, size-1); } /** * Returns the index of the last occurrence of the specified * element. Returns <code>-1</code> if the receiver does not contain this element. * Searches beginning at <code>to</code>, inclusive until <code>from</code>, inclusive. * Tests for identity. * * @param element element to search for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public int lastIndexOfFromTo(long element, int from, int to) { checkRangeFromTo(from, to, size()); for (int i = to ; i >= from; i--) { if (element==getQuick(i)) return i; //found } return -1; //not found } /** * Sorts the specified range of the receiver into ascending order. * * The sorting algorithm is a modified mergesort (in which the merge is * omitted if the highest element in the low sublist is less than the * lowest element in the high sublist). This algorithm offers guaranteed * n*log(n) performance, and can approach linear performance on nearly * sorted lists. * * <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b> * It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm. * * @param from the index of the first element (inclusive) to be sorted. * @param to the index of the last element (inclusive) to be sorted. * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public void mergeSortFromTo(int from, int to) { int mySize = size(); checkRangeFromTo(from, to, mySize); long[] myElements = elements(); java.util.Arrays.sort(myElements, from, to+1); elements(myElements); setSizeRaw(mySize); } /** * Sorts the receiver according * to the order induced by the specified comparator. All elements in the * range must be <i>mutually comparable</i> by the specified comparator * (that is, <tt>c.compare(e1, e2)</tt> must not throw a * <tt>ClassCastException</tt> for any elements <tt>e1</tt> and * <tt>e2</tt> in the range).<p> * * This sort is guaranteed to be <i>stable</i>: equal elements will * not be reordered as a result of the sort.<p> * * The sorting algorithm is a modified mergesort (in which the merge is * omitted if the highest element in the low sublist is less than the * lowest element in the high sublist). This algorithm offers guaranteed * n*log(n) performance, and can approach linear performance on nearly * sorted lists. * * @param from the index of the first element (inclusive) to be * sorted. * @param to the index of the last element (inclusive) to be sorted. * @param c the comparator to determine the order of the receiver. * @throws ClassCastException if the array contains elements that are not * <i>mutually comparable</i> using the specified comparator. * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt> * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or * <tt>toIndex &gt; a.length</tt> * @see Comparator * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public void mergeSortFromTo(int from, int to, LongComparator c) { int mySize = size(); checkRangeFromTo(from, to, mySize); long[] myElements = elements(); java.util.Arrays.sort(myElements, from, to+1); elements(myElements); setSizeRaw(mySize); } /** * Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive. * @param from the index of the first element (inclusive). * @param to the index of the last element (inclusive). * @return a new list * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public AbstractLongList partFromTo(int from, int to) { checkRangeFromTo(from, to, size); int length = to-from+1; LongArrayList part = new LongArrayList(length); part.addAllOfFromTo(this,from,to); return part; } /** * Sorts the specified range of the receiver into * ascending numerical order. The sorting algorithm is a tuned quicksort, * adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a * Sort Function", Software-Practice and Experience, Vol. 23(11) * P. 1249-1265 (November 1993). This algorithm offers n*log(n) * performance on many data sets that cause other quicksorts to degrade to * quadratic performance. * * <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b> * It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm. * * @param from the index of the first element (inclusive) to be sorted. * @param to the index of the last element (inclusive) to be sorted. * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public void quickSortFromTo(int from, int to) { int mySize = size(); checkRangeFromTo(from, to, mySize); long[] myElements = elements(); java.util.Arrays.sort(myElements, from, to+1); elements(myElements); setSizeRaw(mySize); } /** * Sorts the receiver according * to the order induced by the specified comparator. All elements in the * range must be <i>mutually comparable</i> by the specified comparator * (that is, <tt>c.compare(e1, e2)</tt> must not throw a * <tt>ClassCastException</tt> for any elements <tt>e1</tt> and * <tt>e2</tt> in the range).<p> * * The sorting algorithm is a tuned quicksort, * adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a * Sort Function", Software-Practice and Experience, Vol. 23(11) * P. 1249-1265 (November 1993). This algorithm offers n*log(n) * performance on many data sets that cause other quicksorts to degrade to * quadratic performance. * * @param from the index of the first element (inclusive) to be * sorted. * @param to the index of the last element (inclusive) to be sorted. * @param c the comparator to determine the order of the receiver. * @throws ClassCastException if the array contains elements that are not * <i>mutually comparable</i> using the specified comparator. * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt> * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or * <tt>toIndex &gt; a.length</tt> * @see Comparator * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public void quickSortFromTo(int from, int to, LongComparator c) { int mySize = size(); checkRangeFromTo(from, to, mySize); long[] myElements = elements(); java.util.Arrays.sort(myElements, from, to+1); elements(myElements); setSizeRaw(mySize); } /** * Removes from the receiver all elements that are contained in the specified list. * Tests for identity. * * @param other the other list. * @return <code>true</code> if the receiver changed as a result of the call. */ public boolean removeAll(AbstractLongList other) { if (other.size()==0) return false; //nothing to do int limit = other.size()-1; int j=0; for (int i=0; i<size ; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) < 0) setQuick(j++,getQuick(i)); } boolean modified = (j!=size); setSize(j); return modified; } /** * Removes from the receiver all elements whose index is between * <code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding * elements to the left (reduces their index). * This call shortens the list by <tt>(to - from + 1)</tt> elements. * * @param from index of first element to be removed. * @param to index of last element to be removed. * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public void removeFromTo(int from, int to) { checkRangeFromTo(from, to, size); int numMoved = size - to - 1; if (numMoved > 0) { replaceFromToWithFrom(from, from-1+numMoved, this, to+1); //fillFromToWith(from+numMoved, size-1, 0.0f); //delta } int width = to-from+1; if (width>0) setSizeRaw(size-width); } /** * Replaces a number of elements in the receiver with the same number of elements of another list. * Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code> (inclusive), * with elements of <code>other</code>, starting from <code>otherFrom</code> (inclusive). * * @param from the position of the first element to be replaced in the receiver * @param to the position of the last element to be replaced in the receiver * @param other list holding elements to be copied into the receiver. * @param otherFrom position of first element within other list to be copied. */ public void replaceFromToWithFrom(int from, int to, AbstractLongList other, int otherFrom) { int length=to-from+1; if (length>0) { checkRangeFromTo(from, to, size()); checkRangeFromTo(otherFrom,otherFrom+length-1,other.size()); // unambiguous copy (it may hold other==this) if (from<=otherFrom) { for (; --length >= 0; ) setQuick(from++,other.getQuick(otherFrom++)); } else { int otherTo = otherFrom+length-1; for (; --length >= 0; ) setQuick(to--,other.getQuick(otherTo--)); } } } /** * Replaces the part between <code>from</code> (inclusive) and <code>to</code> (inclusive) with the other list's * part between <code>otherFrom</code> and <code>otherTo</code>. * Powerful (and tricky) method! * Both parts need not be of the same size (part A can both be smaller or larger than part B). * Parts may overlap. * Receiver and other list may (but most not) be identical. * If <code>from &gt; to</code>, then inserts other part before <code>from</code>. * * @param from the first element of the receiver (inclusive) * @param to the last element of the receiver (inclusive) * @param other the other list (may be identical with receiver) * @param otherFrom the first element of the other list (inclusive) * @param otherTo the last element of the other list (inclusive) * * <p><b>Examples:</b><pre> * a=[0, 1, 2, 3, 4, 5, 6, 7] * b=[50, 60, 70, 80, 90] * a.R(...)=a.replaceFromToWithFromTo(...) * * a.R(3,5,b,0,4)-->[0, 1, 2, 50, 60, 70, 80, 90, 6, 7] * a.R(1,6,b,0,4)-->[0, 50, 60, 70, 80, 90, 7] * a.R(0,6,b,0,4)-->[50, 60, 70, 80, 90, 7] * a.R(3,5,b,1,2)-->[0, 1, 2, 60, 70, 6, 7] * a.R(1,6,b,1,2)-->[0, 60, 70, 7] * a.R(0,6,b,1,2)-->[60, 70, 7] * a.R(5,3,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7] * a.R(5,0,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7] * a.R(5,3,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7] * a.R(5,0,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7] * * Extreme cases: * a.R(5,3,b,0,0)-->[0, 1, 2, 3, 4, 50, 5, 6, 7] * a.R(5,3,b,4,4)-->[0, 1, 2, 3, 4, 90, 5, 6, 7] * a.R(3,5,a,0,1)-->[0, 1, 2, 0, 1, 6, 7] * a.R(3,5,a,3,5)-->[0, 1, 2, 3, 4, 5, 6, 7] * a.R(3,5,a,4,4)-->[0, 1, 2, 4, 6, 7] * a.R(5,3,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7] * a.R(0,-1,b,0,4)-->[50, 60, 70, 80, 90, 0, 1, 2, 3, 4, 5, 6, 7] * a.R(0,-1,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7] * a.R(8,0,a,0,4)-->[0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4] * </pre> */ public void replaceFromToWithFromTo(int from, int to, AbstractLongList other, int otherFrom, int otherTo) { if (otherFrom>otherTo) { throw new IndexOutOfBoundsException("otherFrom: "+otherFrom+", otherTo: "+otherTo); } if (this==other && to-from!=otherTo-otherFrom) { // avoid stumbling over my own feet replaceFromToWithFromTo(from, to, partFromTo(otherFrom, otherTo), 0, otherTo-otherFrom); return; } int length=otherTo-otherFrom+1; int diff=length; int theLast=from-1; if (to>=from) { diff -= (to-from+1); theLast=to; } if (diff>0) { beforeInsertDummies(theLast+1, diff); } else { if (diff<0) { removeFromTo(theLast+diff, theLast-1); } } if (length>0) { replaceFromToWithFrom(from,from+length-1,other,otherFrom); } } /** * Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection. * Does not alter the size of the receiver. * Replaces exactly <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements. * * @param from the index at which to copy the first element from the specified collection. * @param other Collection to replace part of the receiver * @exception IndexOutOfBoundsException index is out of range (index &lt; 0 || index &gt;= size()). */ public void replaceFromWith(int from, java.util.Collection other) { checkRange(from,size()); java.util.Iterator e = other.iterator(); int index=from; int limit = Math.min(size()-from, other.size()); for (int i=0; i<limit; i++) set(index++,((Number) e.next()).longValue()); //delta } /** * Retains (keeps) only the elements in the receiver that are contained in the specified other list. * In other words, removes from the receiver all of its elements that are not contained in the * specified other list. * @param other the other list to test against. * @return <code>true</code> if the receiver changed as a result of the call. */ public boolean retainAll(AbstractLongList other) { if (other.size()==0) { if (size==0) return false; setSize(0); return true; } int limit = other.size()-1; int j=0; for (int i=0; i<size ; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) >= 0) setQuick(j++, getQuick(i)); } boolean modified = (j!=size); setSize(j); return modified; } /** * Reverses the elements of the receiver. * Last becomes first, second last becomes second first, and so on. */ public void reverse() { long tmp; int limit=size()/2; int j=size()-1; for (int i=0; i<limit;) { //swap tmp=getQuick(i); setQuick(i++,getQuick(j)); setQuick(j--,tmp); } } /** * Replaces the element at the specified position in the receiver with the specified element. * * @param index index of element to replace. * @param element element to be stored at the specified position. * @throws IndexOutOfBoundsException if <tt>index &lt; 0 || index &gt;= size()</tt>. */ public void set(int index, long element) { if (index >= size || index < 0) throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size); setQuick(index,element); } /** * Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions. * Provided with invalid parameters this method may access invalid indexes without throwing any exception! * <b>You should only use this method when you are absolutely sure that the index is within bounds.</b> * Precondition (unchecked): <tt>index &gt;= 0 && index &lt; size()</tt>. * * This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop. * However, when desperately, you can give this method <tt>public</tt> visibility in subclasses. * * @param index index of element to replace. * @param element element to be stored at the specified position. */ protected abstract void setQuick(int index, long element); /** * Sets the size of the receiver without modifying it otherwise. * This method should not release or allocate new memory but simply set some instance variable like <tt>size</tt>. * * If your subclass overrides and delegates size changing methods to some other object, * you must make sure that those overriding methods not only update the size of the delegate but also of this class. * For example: * public DatabaseList extends AbstractLongList { * ... * public void removeFromTo(int from,int to) { * myDatabase.removeFromTo(from,to); * this.setSizeRaw(size-(to-from+1)); * } * } */ protected void setSizeRaw(int newSize) { size = newSize; } /** * Randomly permutes the part of the receiver between <code>from</code> (inclusive) and <code>to</code> (inclusive). * @param from the index of the first element (inclusive) to be permuted. * @param to the index of the last element (inclusive) to be permuted. * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>). */ public void shuffleFromTo(int from, int to) { checkRangeFromTo(from, to, size()); //cern.jet.random.Uniform gen = new cern.jet.random.Uniform(new cern.jet.random.engine.DRand(new java.util.Date())); java.util.Random gen = new java.util.Random(); for (int i=from; i<to; i++) { int rp = gen.nextInt(to-i); int random = rp + i; // int random = gen.nextIntFromTo(i, to); //swap(i, random) long tmpElement = getQuick(random); setQuick(random,getQuick(i)); setQuick(i,tmpElement); } }
java
public static auditsyslogpolicy_binding get(nitro_service service, String name) throws Exception{ auditsyslogpolicy_binding obj = new auditsyslogpolicy_binding(); obj.set_name(name); auditsyslogpolicy_binding response = (auditsyslogpolicy_binding) obj.get_resource(service); return response; }
java
public static sslcipher_sslciphersuite_binding[] get(nitro_service service, String ciphergroupname) throws Exception{ sslcipher_sslciphersuite_binding obj = new sslcipher_sslciphersuite_binding(); obj.set_ciphergroupname(ciphergroupname); sslcipher_sslciphersuite_binding response[] = (sslcipher_sslciphersuite_binding[]) obj.get_resources(service); return response; }
java
public static sslcipher_binding get(nitro_service service, String ciphergroupname) throws Exception{ sslcipher_binding obj = new sslcipher_binding(); obj.set_ciphergroupname(ciphergroupname); sslcipher_binding response = (sslcipher_binding) obj.get_resource(service); return response; }
java
public static auditnslogpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{ auditnslogpolicy_tmglobal_binding obj = new auditnslogpolicy_tmglobal_binding(); obj.set_name(name); auditnslogpolicy_tmglobal_binding response[] = (auditnslogpolicy_tmglobal_binding[]) obj.get_resources(service); return response; }
java
public static base_response update(nitro_service client, nsdhcpparams resource) throws Exception { nsdhcpparams updateresource = new nsdhcpparams(); updateresource.dhcpclient = resource.dhcpclient; updateresource.saveroute = resource.saveroute; return updateresource.update_resource(client); }
java
public static base_response unset(nitro_service client, nsdhcpparams resource, String[] args) throws Exception{ nsdhcpparams unsetresource = new nsdhcpparams(); return unsetresource.unset_resource(client,args); }
java
public static nsdhcpparams get(nitro_service service) throws Exception{ nsdhcpparams obj = new nsdhcpparams(); nsdhcpparams[] response = (nsdhcpparams[])obj.get_resources(service); return response[0]; }
java
public static base_response update(nitro_service client, filterprebodyinjection resource) throws Exception { filterprebodyinjection updateresource = new filterprebodyinjection(); updateresource.prebody = resource.prebody; return updateresource.update_resource(client); }
java
public static base_response unset(nitro_service client, filterprebodyinjection resource, String[] args) throws Exception{ filterprebodyinjection unsetresource = new filterprebodyinjection(); return unsetresource.unset_resource(client,args); }
java
public static filterprebodyinjection get(nitro_service service) throws Exception{ filterprebodyinjection obj = new filterprebodyinjection(); filterprebodyinjection[] response = (filterprebodyinjection[])obj.get_resources(service); return response[0]; }
java
public static vpntrafficpolicy_aaauser_binding[] get(nitro_service service, String name) throws Exception{ vpntrafficpolicy_aaauser_binding obj = new vpntrafficpolicy_aaauser_binding(); obj.set_name(name); vpntrafficpolicy_aaauser_binding response[] = (vpntrafficpolicy_aaauser_binding[]) obj.get_resources(service); return response; }
java
public static sslpolicylabel_sslpolicy_binding[] get(nitro_service service, String labelname) throws Exception{ sslpolicylabel_sslpolicy_binding obj = new sslpolicylabel_sslpolicy_binding(); obj.set_labelname(labelname); sslpolicylabel_sslpolicy_binding response[] = (sslpolicylabel_sslpolicy_binding[]) obj.get_resources(service); return response; }
java
void init() { numnegative = new int[numSamples() + 1]; numpositive = new int[numSamples() + 1]; numnegative[0] = 0; numpositive[0] = 0; int num = numSamples(); for (int i = 1; i <= num; i++) { numnegative[i] = numnegative[i - 1] + (classes[i - 1] == 0 ? 1 : 0); } for (int i = 1; i <= num; i++) { numpositive[i] = numpositive[i - 1] + (classes[num - i] == 0 ? 0 : 1); } System.err.println("total positive " + numpositive[num] + " total negative " + numnegative[num] + " total " + num); for (int i = 1; i < numpositive.length; i++) { //System.out.println(i + " positive " + numpositive[i] + " negative " + numnegative[i] + " classes " + classes[i - 1] + " " + classes[num - i]); } }
java
public int precision(int recall) { int optimum = 0; for (int right = 0; right <= recall; right++) { int candidate = numpositive[right] + numnegative[recall - right]; if (candidate > optimum) { optimum = candidate; } } return optimum; }
java
public double fmeasure(int numleft, int numright) { int tp = 0, fp = 0, fn = 0; tp = numpositive[numright]; fp = numright - tp; fn = numleft - numnegative[numleft]; return f1(tp, fp, fn); }
java
public int logPrecision(int recall) { int totaltaken = 0; int rightIndex = numSamples() - 1; //next right candidate int leftIndex = 0; //next left candidate int totalcorrect = 0; while (totaltaken < recall) { double confr = Math.abs(scores[rightIndex] - .5); double confl = Math.abs(scores[leftIndex] - .5); int chosen = leftIndex; if (confr > confl) { chosen = rightIndex; rightIndex--; } else { leftIndex++; } //System.err.println("chose "+chosen+" score "+scores[chosen]+" class "+classes[chosen]+" correct "+correct(scores[chosen],classes[chosen])); if ((scores[chosen] >= .5) && (classes[chosen] == 1)) { totalcorrect++; } if ((scores[chosen] < .5) && (classes[chosen] == 0)) { totalcorrect++; } totaltaken++; } return totalcorrect; }
java
public double optFmeasure(int recall) { double max = 0; for (int i = 0; i < (recall + 1); i++) { double f = fmeasure(i, recall - i); if (f > max) { max = f; } } return max; }
java
public double fmeasure(int recall) { int totaltaken = 0; int rightIndex = numSamples() - 1; //next right candidate int leftIndex = 0; //next left candidate int tp = 0, fp = 0, fn = 0; while (totaltaken < recall) { double confr = Math.abs(scores[rightIndex] - .5); double confl = Math.abs(scores[leftIndex] - .5); int chosen = leftIndex; if (confr > confl) { chosen = rightIndex; rightIndex--; } else { leftIndex++; } //System.err.println("chose "+chosen+" score "+scores[chosen]+" class "+classes[chosen]+" correct "+correct(scores[chosen],classes[chosen])); if ((scores[chosen] >= .5)) { if (classes[chosen] == 1) { tp++; } else { fp++; } } if ((scores[chosen] < .5)) { if (classes[chosen] == 1) { fn++; } } totaltaken++; } return f1(tp, fp, fn); }
java
public double logLikelihood() { double loglik = 0; for (int i = 0; i < scores.length; i++) { loglik += Math.log(classes[i] == 0 ? 1 - scores[i] : scores[i]); } return loglik; }
java
public double optimalCwa() { double acc = 0; for (int recall = 1; recall <= numSamples(); recall++) { acc += precision(recall) / (double) recall; } return acc / numSamples(); }
java
public static nssimpleacl6_stats get(nitro_service service) throws Exception{ nssimpleacl6_stats obj = new nssimpleacl6_stats(); nssimpleacl6_stats[] response = (nssimpleacl6_stats[])obj.stat_resources(service); return response[0]; }
java
public static Pair<TregexPattern, TsurgeonPattern> getOperationFromReader(BufferedReader reader, TregexPatternCompiler compiler) throws IOException { String patternString = getPatternFromFile(reader); // System.err.println("Read tregex pattern: " + patternString); if ("".equals(patternString)) { return null; } TregexPattern matchPattern = compiler.compile(patternString); TsurgeonPattern collectedPattern = getTsurgeonOperationsFromReader(reader); return new Pair<TregexPattern,TsurgeonPattern>(matchPattern,collectedPattern); }
java
public static String getPatternFromFile(BufferedReader reader) throws IOException { StringBuilder matchString = new StringBuilder(); for (String thisLine; (thisLine = reader.readLine()) != null; ) { if (matchString.length() > 0 && emptyLinePattern.matcher(thisLine).matches()) { // A blank line after getting some real content (not just comments or nothing) break; } Matcher m = commentPattern.matcher(thisLine); if (m.matches()) { // delete it thisLine = m.replaceFirst(""); } if ( ! emptyLinePattern.matcher(thisLine).matches()) { matchString.append(thisLine); } } return matchString.toString(); }
java
public static List<Pair<TregexPattern, TsurgeonPattern>> getOperationsFromFile(String filename, String encoding, TregexPatternCompiler compiler) throws IOException { List<Pair<TregexPattern,TsurgeonPattern>> operations = new ArrayList<Pair<TregexPattern, TsurgeonPattern>>(); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), encoding)); for ( ; ; ) { Pair<TregexPattern, TsurgeonPattern> operation = getOperationFromReader(reader, compiler); if (operation == null) { break; } operations.add(operation); } reader.close(); return operations; }
java
public static Tree processPatternsOnTree(List<Pair<TregexPattern, TsurgeonPattern>> ops, Tree t) { matchedOnTree = false; for (Pair<TregexPattern,TsurgeonPattern> op : ops) { try { if (DEBUG) { System.err.println("Running pattern " + op.first()); } TregexMatcher m = op.first().matcher(t); while (m.find()) { matchedOnTree = true; t = op.second().evaluate(t,m); if (t == null) { return null; } m = op.first().matcher(t); } } catch (NullPointerException npe) { throw new RuntimeException("Tsurgeon.processPatternsOnTree failed to match label for pattern: " + op.first() + ", " + op.second(), npe); } } return t; }
java
public static TsurgeonPattern collectOperations(List<TsurgeonPattern> patterns) { return new TsurgeonPatternRoot(patterns.toArray(new TsurgeonPattern[patterns.size()])); }
java
public static dnspolicylabel_stats[] get(nitro_service service, options option) throws Exception{ dnspolicylabel_stats obj = new dnspolicylabel_stats(); dnspolicylabel_stats[] response = (dnspolicylabel_stats[])obj.stat_resources(service,option); return response; }
java
public static dnspolicylabel_stats get(nitro_service service, String labelname) throws Exception{ dnspolicylabel_stats obj = new dnspolicylabel_stats(); obj.set_labelname(labelname); dnspolicylabel_stats response = (dnspolicylabel_stats) obj.stat_resource(service); return response; }
java
public static gslbvserver_domain_binding[] get(nitro_service service, String name) throws Exception{ gslbvserver_domain_binding obj = new gslbvserver_domain_binding(); obj.set_name(name); gslbvserver_domain_binding response[] = (gslbvserver_domain_binding[]) obj.get_resources(service); return response; }
java
public static base_response add(nitro_service client, nsip resource) throws Exception { nsip addresource = new nsip(); addresource.ipaddress = resource.ipaddress; addresource.netmask = resource.netmask; addresource.type = resource.type; addresource.arp = resource.arp; addresource.icmp = resource.icmp; addresource.vserver = resource.vserver; addresource.telnet = resource.telnet; addresource.ftp = resource.ftp; addresource.gui = resource.gui; addresource.ssh = resource.ssh; addresource.snmp = resource.snmp; addresource.mgmtaccess = resource.mgmtaccess; addresource.restrictaccess = resource.restrictaccess; addresource.dynamicrouting = resource.dynamicrouting; addresource.ospf = resource.ospf; addresource.bgp = resource.bgp; addresource.rip = resource.rip; addresource.hostroute = resource.hostroute; addresource.hostrtgw = resource.hostrtgw; addresource.metric = resource.metric; addresource.vserverrhilevel = resource.vserverrhilevel; addresource.ospflsatype = resource.ospflsatype; addresource.ospfarea = resource.ospfarea; addresource.state = resource.state; addresource.vrid = resource.vrid; addresource.icmpresponse = resource.icmpresponse; addresource.ownernode = resource.ownernode; addresource.arpresponse = resource.arpresponse; addresource.td = resource.td; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip addresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new nsip(); addresources[i].ipaddress = resources[i].ipaddress; addresources[i].netmask = resources[i].netmask; addresources[i].type = resources[i].type; addresources[i].arp = resources[i].arp; addresources[i].icmp = resources[i].icmp; addresources[i].vserver = resources[i].vserver; addresources[i].telnet = resources[i].telnet; addresources[i].ftp = resources[i].ftp; addresources[i].gui = resources[i].gui; addresources[i].ssh = resources[i].ssh; addresources[i].snmp = resources[i].snmp; addresources[i].mgmtaccess = resources[i].mgmtaccess; addresources[i].restrictaccess = resources[i].restrictaccess; addresources[i].dynamicrouting = resources[i].dynamicrouting; addresources[i].ospf = resources[i].ospf; addresources[i].bgp = resources[i].bgp; addresources[i].rip = resources[i].rip; addresources[i].hostroute = resources[i].hostroute; addresources[i].hostrtgw = resources[i].hostrtgw; addresources[i].metric = resources[i].metric; addresources[i].vserverrhilevel = resources[i].vserverrhilevel; addresources[i].ospflsatype = resources[i].ospflsatype; addresources[i].ospfarea = resources[i].ospfarea; addresources[i].state = resources[i].state; addresources[i].vrid = resources[i].vrid; addresources[i].icmpresponse = resources[i].icmpresponse; addresources[i].ownernode = resources[i].ownernode; addresources[i].arpresponse = resources[i].arpresponse; addresources[i].td = resources[i].td; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response delete(nitro_service client, nsip resource) throws Exception { nsip deleteresource = new nsip(); deleteresource.ipaddress = resource.ipaddress; deleteresource.td = resource.td; return deleteresource.delete_resource(client); }
java
public static base_response update(nitro_service client, nsip resource) throws Exception { nsip updateresource = new nsip(); updateresource.ipaddress = resource.ipaddress; updateresource.td = resource.td; updateresource.netmask = resource.netmask; updateresource.arp = resource.arp; updateresource.icmp = resource.icmp; updateresource.vserver = resource.vserver; updateresource.telnet = resource.telnet; updateresource.ftp = resource.ftp; updateresource.gui = resource.gui; updateresource.ssh = resource.ssh; updateresource.snmp = resource.snmp; updateresource.mgmtaccess = resource.mgmtaccess; updateresource.restrictaccess = resource.restrictaccess; updateresource.dynamicrouting = resource.dynamicrouting; updateresource.ospf = resource.ospf; updateresource.bgp = resource.bgp; updateresource.rip = resource.rip; updateresource.hostroute = resource.hostroute; updateresource.hostrtgw = resource.hostrtgw; updateresource.metric = resource.metric; updateresource.vserverrhilevel = resource.vserverrhilevel; updateresource.ospflsatype = resource.ospflsatype; updateresource.ospfarea = resource.ospfarea; updateresource.vrid = resource.vrid; updateresource.icmpresponse = resource.icmpresponse; updateresource.arpresponse = resource.arpresponse; return updateresource.update_resource(client); }
java
public static base_responses update(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip updateresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nsip(); updateresources[i].ipaddress = resources[i].ipaddress; updateresources[i].td = resources[i].td; updateresources[i].netmask = resources[i].netmask; updateresources[i].arp = resources[i].arp; updateresources[i].icmp = resources[i].icmp; updateresources[i].vserver = resources[i].vserver; updateresources[i].telnet = resources[i].telnet; updateresources[i].ftp = resources[i].ftp; updateresources[i].gui = resources[i].gui; updateresources[i].ssh = resources[i].ssh; updateresources[i].snmp = resources[i].snmp; updateresources[i].mgmtaccess = resources[i].mgmtaccess; updateresources[i].restrictaccess = resources[i].restrictaccess; updateresources[i].dynamicrouting = resources[i].dynamicrouting; updateresources[i].ospf = resources[i].ospf; updateresources[i].bgp = resources[i].bgp; updateresources[i].rip = resources[i].rip; updateresources[i].hostroute = resources[i].hostroute; updateresources[i].hostrtgw = resources[i].hostrtgw; updateresources[i].metric = resources[i].metric; updateresources[i].vserverrhilevel = resources[i].vserverrhilevel; updateresources[i].ospflsatype = resources[i].ospflsatype; updateresources[i].ospfarea = resources[i].ospfarea; updateresources[i].vrid = resources[i].vrid; updateresources[i].icmpresponse = resources[i].icmpresponse; updateresources[i].arpresponse = resources[i].arpresponse; } result = update_bulk_request(client, updateresources); } return result; }
java
public static base_response unset(nitro_service client, nsip resource, String[] args) throws Exception{ nsip unsetresource = new nsip(); unsetresource.ipaddress = resource.ipaddress; unsetresource.td = resource.td; return unsetresource.unset_resource(client,args); }
java
public static base_response enable(nitro_service client, String ipaddress) throws Exception { nsip enableresource = new nsip(); enableresource.ipaddress = ipaddress; return enableresource.perform_operation(client,"enable"); }
java
public static base_response enable(nitro_service client, nsip resource) throws Exception { nsip enableresource = new nsip(); enableresource.ipaddress = resource.ipaddress; enableresource.td = resource.td; return enableresource.perform_operation(client,"enable"); }
java
public static base_responses enable(nitro_service client, String ipaddress[]) throws Exception { base_responses result = null; if (ipaddress != null && ipaddress.length > 0) { nsip enableresources[] = new nsip[ipaddress.length]; for (int i=0;i<ipaddress.length;i++){ enableresources[i] = new nsip(); enableresources[i].ipaddress = ipaddress[i]; } result = perform_operation_bulk_request(client, enableresources,"enable"); } return result; }
java