code
stringlengths
73
34.1k
label
stringclasses
1 value
public static base_responses enable(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip enableresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ enableresources[i] = new nsip(); enableresources[i].ipaddress = resources[i].ipaddress; enableresources[i].td = resources[i].td; } result = perform_operation_bulk_request(client, enableresources,"enable"); } return result; }
java
public static base_response disable(nitro_service client, String ipaddress) throws Exception { nsip disableresource = new nsip(); disableresource.ipaddress = ipaddress; return disableresource.perform_operation(client,"disable"); }
java
public static base_response disable(nitro_service client, nsip resource) throws Exception { nsip disableresource = new nsip(); disableresource.ipaddress = resource.ipaddress; disableresource.td = resource.td; return disableresource.perform_operation(client,"disable"); }
java
public static base_responses disable(nitro_service client, String ipaddress[]) throws Exception { base_responses result = null; if (ipaddress != null && ipaddress.length > 0) { nsip disableresources[] = new nsip[ipaddress.length]; for (int i=0;i<ipaddress.length;i++){ disableresources[i] = new nsip(); disableresources[i].ipaddress = ipaddress[i]; } result = perform_operation_bulk_request(client, disableresources,"disable"); } return result; }
java
public static base_responses disable(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip disableresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ disableresources[i] = new nsip(); disableresources[i].ipaddress = resources[i].ipaddress; disableresources[i].td = resources[i].td; } result = perform_operation_bulk_request(client, disableresources,"disable"); } return result; }
java
public static nsip[] get(nitro_service service) throws Exception{ nsip obj = new nsip(); nsip[] response = (nsip[])obj.get_resources(service); return response; }
java
public static nsip[] get(nitro_service service, nsip_args args) throws Exception{ nsip obj = new nsip(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nsip[] response = (nsip[])obj.get_resources(service, option); return response; }
java
public static authenticationtacacspolicy_vpnglobal_binding[] get(nitro_service service, String name) throws Exception{ authenticationtacacspolicy_vpnglobal_binding obj = new authenticationtacacspolicy_vpnglobal_binding(); obj.set_name(name); authenticationtacacspolicy_vpnglobal_binding response[] = (authenticationtacacspolicy_vpnglobal_binding[]) obj.get_resources(service); return response; }
java
final public void addIdFromDoc(Integer docId, Long reference) { if (!closed && (docId != null)) { addSinglePoint(docId, 0, 0, docId, reference); } }
java
final public void addParentFromToken(MtasToken token) throws IOException { if (!closed && (token != null)) { if (token.checkParentId()) { addSinglePoint(token.getParentId(), token.getPrefixId(), token.getTermRef(), token.getId(), token.getTokenRef()); } } }
java
final private void addPositionFromToken(MtasToken token, Long ref) throws IOException { int prefixId = storePrefixAndTermRef ? token.getPrefixId() : 0; if (!closed && (token != null)) { if (token.checkPositionType(MtasPosition.POSITION_SINGLE)) { addSinglePoint(token.getPositionStart(), prefixId, token.getTermRef(), token.getId(), ref); } else if (token.checkPositionType(MtasPosition.POSITION_RANGE)) { addRange(token.getPositionStart(), token.getPositionEnd(), prefixId, token.getTermRef(), token.getId(), ref); } else if (token.checkPositionType(MtasPosition.POSITION_SET)) { // split set into minimum number of single points and ranges SortedMap<Integer, Integer> list = new TreeMap<>(); int[] positions = token.getPositions(); Integer lastPoint = null; Integer startPoint = null; for (int position : positions) { if (lastPoint == null) { startPoint = position; lastPoint = position; } else if ((position - lastPoint) != 1) { list.put(startPoint, lastPoint); startPoint = position; } lastPoint = position; } if (lastPoint != null) { list.put(startPoint, lastPoint); } for (Entry<Integer, Integer> entry : list.entrySet()) { if (entry.getKey().equals(entry.getValue())) { addSinglePoint(entry.getKey(), prefixId, token.getTermRef(), token.getId(), ref); } else { addRange(entry.getKey(), entry.getValue(), prefixId, token.getTermRef(), token.getId(), ref); } } } } }
java
public static authenticationldappolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{ authenticationldappolicy_vpnvserver_binding obj = new authenticationldappolicy_vpnvserver_binding(); obj.set_name(name); authenticationldappolicy_vpnvserver_binding response[] = (authenticationldappolicy_vpnvserver_binding[]) obj.get_resources(service); return response; }
java
final public TsurgeonPattern NodeSelection() throws ParseException { /*@bgen(jjtree) NodeSelection */ SimpleNode jjtn000 = new SimpleNode(JJTNODESELECTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);TsurgeonPattern result; try { result = NodeName(); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if (true) return result;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); }
java
final public AuxiliaryTree TreeRoot(boolean requiresFoot) throws ParseException { /*@bgen(jjtree) TreeRoot */ SimpleNode jjtn000 = new SimpleNode(JJTTREEROOT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Tree t; try { t = TreeNode(); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if (true) return new AuxiliaryTree(t,requiresFoot);} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); }
java
public static linkset_channel_binding[] get(nitro_service service, String id) throws Exception{ linkset_channel_binding obj = new linkset_channel_binding(); obj.set_id(id); linkset_channel_binding response[] = (linkset_channel_binding[]) obj.get_resources(service); return response; }
java
public static authenticationldappolicy_binding get(nitro_service service, String name) throws Exception{ authenticationldappolicy_binding obj = new authenticationldappolicy_binding(); obj.set_name(name); authenticationldappolicy_binding response = (authenticationldappolicy_binding) obj.get_resource(service); return response; }
java
public static aaagroup_auditsyslogpolicy_binding[] get(nitro_service service, String groupname) throws Exception{ aaagroup_auditsyslogpolicy_binding obj = new aaagroup_auditsyslogpolicy_binding(); obj.set_groupname(groupname); aaagroup_auditsyslogpolicy_binding response[] = (aaagroup_auditsyslogpolicy_binding[]) obj.get_resources(service); return response; }
java
public static inat_stats[] get(nitro_service service) throws Exception{ inat_stats obj = new inat_stats(); inat_stats[] response = (inat_stats[])obj.stat_resources(service); return response; }
java
public static inat_stats get(nitro_service service, String name) throws Exception{ inat_stats obj = new inat_stats(); obj.set_name(name); inat_stats response = (inat_stats) obj.stat_resource(service); return response; }
java
public static policypatset_binding get(nitro_service service, String name) throws Exception{ policypatset_binding obj = new policypatset_binding(); obj.set_name(name); policypatset_binding response = (policypatset_binding) obj.get_resource(service); return response; }
java
public String processString(String s) { if (decoderPipeline != null) { return decoderPipeline.processString(s); } else { throw new java.lang.RuntimeException("Decoder Not Initialized"); } }
java
public List<LightAnnot> processRawStringAsAnnotList(String s) { Annotation[] annots = decoderPipeline.processRawStringAsAnnotList(s); List<LightAnnot> alist = new ArrayList<LightAnnot>(); int i = 0; for (i = 0; i < annots.length; i++) { Annotation ann = annots[i]; alist.add(new LightAnnot(ann.st(),ann.en(),ann.typ().toString())); } return (alist); }
java
public static vpnglobal_vpnsessionpolicy_binding[] get(nitro_service service) throws Exception{ vpnglobal_vpnsessionpolicy_binding obj = new vpnglobal_vpnsessionpolicy_binding(); vpnglobal_vpnsessionpolicy_binding response[] = (vpnglobal_vpnsessionpolicy_binding[]) obj.get_resources(service); return response; }
java
public static sslvserver_binding get(nitro_service service, String vservername) throws Exception{ sslvserver_binding obj = new sslvserver_binding(); obj.set_vservername(vservername); sslvserver_binding response = (sslvserver_binding) obj.get_resource(service); return response; }
java
public static sslvserver_binding[] get(nitro_service service, String vservername[]) throws Exception{ if (vservername !=null && vservername.length>0) { sslvserver_binding response[] = new sslvserver_binding[vservername.length]; sslvserver_binding obj[] = new sslvserver_binding[vservername.length]; for (int i=0;i<vservername.length;i++) { obj[i] = new sslvserver_binding(); obj[i].set_vservername(vservername[i]); response[i] = (sslvserver_binding) obj[i].get_resource(service); } return response; } return null; }
java
public static transformpolicylabel_transformpolicy_binding[] get(nitro_service service, String labelname) throws Exception{ transformpolicylabel_transformpolicy_binding obj = new transformpolicylabel_transformpolicy_binding(); obj.set_labelname(labelname); transformpolicylabel_transformpolicy_binding response[] = (transformpolicylabel_transformpolicy_binding[]) obj.get_resources(service); return response; }
java
static <INN extends CoreMap & HasWord> void mergeTwoDocuments(List<INN> mainDocument, List<INN> auxDocument, Set<String> auxLabels, String background) { boolean insideAuxTag = false; boolean auxTagValid = true; String prevAnswer = background; Collection<INN> constituents = new ArrayList<INN>(); Iterator<INN> auxIterator = auxDocument.listIterator(); for (INN wMain : mainDocument) { String mainAnswer = wMain.get(AnswerAnnotation.class); INN wAux = auxIterator.next(); String auxAnswer = wAux.get(AnswerAnnotation.class); boolean insideMainTag = !mainAnswer.equals(background); /* if the auxiliary classifier gave it one of the labels unique to auxClassifier, we might set the mainLabel to that. */ if (auxLabels.contains(auxAnswer) && !auxAnswer.equals(background)) { //AZ not equal background symbol (it is background symbol not strong class) if ( ! prevAnswer.equals(auxAnswer) && ! prevAnswer.equals(background)) { if (auxTagValid){ for (INN wi : constituents) { wi.set(AnswerAnnotation.class, prevAnswer); } } constituents = new ArrayList<INN>(); } insideAuxTag = true; if (insideMainTag) { auxTagValid = false; } prevAnswer = auxAnswer; constituents.add(wMain); } else { if (insideAuxTag) { if (auxTagValid){ for (INN wi : constituents) { wi.set(AnswerAnnotation.class, prevAnswer); } } constituents = new ArrayList<INN>(); } insideAuxTag=false; auxTagValid = true; prevAnswer = background; } } // deal with a sequence final auxLabel if (auxTagValid){ for (INN wi : constituents) { wi.set(AnswerAnnotation.class, prevAnswer); } } }
java
@Override public List<IN> classify(List<IN> tokens) { if (baseClassifiers.isEmpty()) { return tokens; } List<List<IN>> baseOutputs = new ArrayList<List<IN>>(); // the first base model works in place, modifying the original tokens List<IN> output = baseClassifiers.get(0).classifySentence(tokens); // classify(List<IN>) is supposed to work in place, so add AnswerAnnotation to tokens! for (int i = 0, sz = output.size(); i < sz; i++) { tokens.get(i).set(AnswerAnnotation.class, output.get(i).get(AnswerAnnotation.class)); } baseOutputs.add(tokens); for (int i = 1, sz = baseClassifiers.size(); i < sz; i ++) { //List<CoreLabel> copy = deepCopy(tokens); // no need for deep copy: classifySentence creates a copy of the input anyway // List<CoreLabel> copy = tokens; output = baseClassifiers.get(i).classifySentence(tokens); baseOutputs.add(output); } assert(baseOutputs.size() == baseClassifiers.size()); List<IN> finalAnswer = mergeDocuments(baseOutputs); return finalAnswer; }
java
public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties(args); ClassifierCombiner ec = new ClassifierCombiner(props); System.err.println(ec.classifyToString("Marketing : Sony Hopes to Win Much Bigger Market For Wide Range of Small-Video Products --- By Andrew B. Cohen Staff Reporter of The Wall Street Journal")); // test_mergeTwoDocumentsByLongestSequence("O O X O O", "O Y Y Y O"); // test_mergeTwoDocumentsByLongestSequence("O Y Y Y Y", "O O X X X"); // test_mergeTwoDocumentsByLongestSequence("X X X O Z Z Z Z Z", "O Y Y Y Y O O O O"); // test_mergeTwoDocumentsByLongestSequence("O Y Y Y Y O O O O", "X X X O Z Z Z Z Z"); // test_mergeTwoDocumentsByLongestSequence("O O O O O", "O X X X O"); // test_mergeTwoDocumentsByLongestSequence("O X X O O O", "O Y Y Y Z O"); // test_mergeTwoDocumentsByLongestSequence("O Y Y Y Z O", "O X X O O O"); // test_mergeTwoDocumentsByLongestSequence("O Y Y Y O O", "O O X X Z O"); // test_mergeTwoDocumentsByLongestSequence("O Y Y Y O O", "O O X X Z Z"); // test_mergeTwoDocumentsByLongestSequence("O X Y Z W", "A B B D E"); // test_mergeTwoDocumentsByLongestSequence("O X O O O", "O O Y Y O"); // test_mergeTwoDocumentsByLongestSequence("O O Y Y O", "O X O O O"); // test_mergeTwoDocumentsByLongestSequence("O X X O O", "O O Y Y Y"); // test_mergeTwoDocumentsByLongestSequence("O O Y Y Y", "O X X O O"); }
java
public static tunneltrafficpolicy_binding get(nitro_service service, String name) throws Exception{ tunneltrafficpolicy_binding obj = new tunneltrafficpolicy_binding(); obj.set_name(name); tunneltrafficpolicy_binding response = (tunneltrafficpolicy_binding) obj.get_resource(service); return response; }
java
public static authenticationlocalpolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{ authenticationlocalpolicy_vpnvserver_binding obj = new authenticationlocalpolicy_vpnvserver_binding(); obj.set_name(name); authenticationlocalpolicy_vpnvserver_binding response[] = (authenticationlocalpolicy_vpnvserver_binding[]) obj.get_resources(service); return response; }
java
public static vpnicaconnection[] get(nitro_service service) throws Exception{ vpnicaconnection obj = new vpnicaconnection(); vpnicaconnection[] response = (vpnicaconnection[])obj.get_resources(service); return response; }
java
public static vpnicaconnection[] get(nitro_service service, vpnicaconnection_args args) throws Exception{ vpnicaconnection obj = new vpnicaconnection(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); vpnicaconnection[] response = (vpnicaconnection[])obj.get_resources(service, option); return response; }
java
public static appfwprofile_xmlattachmenturl_binding[] get(nitro_service service, String name) throws Exception{ appfwprofile_xmlattachmenturl_binding obj = new appfwprofile_xmlattachmenturl_binding(); obj.set_name(name); appfwprofile_xmlattachmenturl_binding response[] = (appfwprofile_xmlattachmenturl_binding[]) obj.get_resources(service); return response; }
java
public static cmpglobal_binding get(nitro_service service) throws Exception{ cmpglobal_binding obj = new cmpglobal_binding(); cmpglobal_binding response = (cmpglobal_binding) obj.get_resource(service); return response; }
java
public static aaaglobal_aaapreauthenticationpolicy_binding[] get(nitro_service service) throws Exception{ aaaglobal_aaapreauthenticationpolicy_binding obj = new aaaglobal_aaapreauthenticationpolicy_binding(); aaaglobal_aaapreauthenticationpolicy_binding response[] = (aaaglobal_aaapreauthenticationpolicy_binding[]) obj.get_resources(service); return response; }
java
public static base_response add(nitro_service client, appqoeaction resource) throws Exception { appqoeaction addresource = new appqoeaction(); addresource.name = resource.name; addresource.priority = resource.priority; addresource.respondwith = resource.respondwith; addresource.customfile = resource.customfile; addresource.altcontentsvcname = resource.altcontentsvcname; addresource.altcontentpath = resource.altcontentpath; addresource.polqdepth = resource.polqdepth; addresource.priqdepth = resource.priqdepth; addresource.maxconn = resource.maxconn; addresource.delay = resource.delay; addresource.dostrigexpression = resource.dostrigexpression; addresource.dosaction = resource.dosaction; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, appqoeaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appqoeaction addresources[] = new appqoeaction[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new appqoeaction(); addresources[i].name = resources[i].name; addresources[i].priority = resources[i].priority; addresources[i].respondwith = resources[i].respondwith; addresources[i].customfile = resources[i].customfile; addresources[i].altcontentsvcname = resources[i].altcontentsvcname; addresources[i].altcontentpath = resources[i].altcontentpath; addresources[i].polqdepth = resources[i].polqdepth; addresources[i].priqdepth = resources[i].priqdepth; addresources[i].maxconn = resources[i].maxconn; addresources[i].delay = resources[i].delay; addresources[i].dostrigexpression = resources[i].dostrigexpression; addresources[i].dosaction = resources[i].dosaction; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response update(nitro_service client, appqoeaction resource) throws Exception { appqoeaction updateresource = new appqoeaction(); updateresource.name = resource.name; updateresource.priority = resource.priority; updateresource.altcontentsvcname = resource.altcontentsvcname; updateresource.altcontentpath = resource.altcontentpath; updateresource.polqdepth = resource.polqdepth; updateresource.priqdepth = resource.priqdepth; updateresource.maxconn = resource.maxconn; updateresource.delay = resource.delay; updateresource.dostrigexpression = resource.dostrigexpression; updateresource.dosaction = resource.dosaction; return updateresource.update_resource(client); }
java
public static base_responses update(nitro_service client, appqoeaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { appqoeaction updateresources[] = new appqoeaction[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new appqoeaction(); updateresources[i].name = resources[i].name; updateresources[i].priority = resources[i].priority; updateresources[i].altcontentsvcname = resources[i].altcontentsvcname; updateresources[i].altcontentpath = resources[i].altcontentpath; updateresources[i].polqdepth = resources[i].polqdepth; updateresources[i].priqdepth = resources[i].priqdepth; updateresources[i].maxconn = resources[i].maxconn; updateresources[i].delay = resources[i].delay; updateresources[i].dostrigexpression = resources[i].dostrigexpression; updateresources[i].dosaction = resources[i].dosaction; } result = update_bulk_request(client, updateresources); } return result; }
java
public static appqoeaction[] get(nitro_service service) throws Exception{ appqoeaction obj = new appqoeaction(); appqoeaction[] response = (appqoeaction[])obj.get_resources(service); return response; }
java
public static appqoeaction get(nitro_service service, String name) throws Exception{ appqoeaction obj = new appqoeaction(); obj.set_name(name); appqoeaction response = (appqoeaction) obj.get_resource(service); return response; }
java
public static lbvserver_pqpolicy_binding[] get(nitro_service service, String name) throws Exception{ lbvserver_pqpolicy_binding obj = new lbvserver_pqpolicy_binding(); obj.set_name(name); lbvserver_pqpolicy_binding response[] = (lbvserver_pqpolicy_binding[]) obj.get_resources(service); return response; }
java
public double[] scoresOf(int[] sequence, int position) { if (position >= factorTables.length) throw new RuntimeException("Index out of bounds: " + position); // DecimalFormat nf = new DecimalFormat("#0.000"); // if (position>0 && position<sequence.length-1) System.out.println(position // + ": asking about " +sequence[position-1] + "(" + sequence[position] + // ")" + sequence[position+1]); double[] probThisGivenPrev = new double[numClasses]; double[] probNextGivenThis = new double[numClasses]; // double[] marginal = new double[numClasses]; // for debugging only // compute prob of this tag given the window-1 previous tags, normalized // extract the window-1 previous tags, pad left with background if necessary int prevLength = windowSize - 1; int[] prev = new int[prevLength + 1]; // leave an extra element for the // label at this position int i = 0; for (; i < prevLength - position; i++) { // will only happen if // position-prevLength < 0 prev[i] = classIndex.indexOf(backgroundSymbol); } for (; i < prevLength; i++) { prev[i] = sequence[position - prevLength + i]; } for (int label = 0; label < numClasses; label++) { prev[prev.length - 1] = label; probThisGivenPrev[label] = factorTables[position].unnormalizedLogProb(prev); // marginal[label] = factorTables[position].logProbEnd(label); // remove: // for debugging only } // ArrayMath.logNormalize(probThisGivenPrev); // compute the prob of the window-1 next tags given this tag // extract the window-1 next tags int nextLength = windowSize - 1; if (position + nextLength >= length()) { nextLength = length() - position - 1; } FactorTable nextFactorTable = factorTables[position + nextLength]; if (nextLength != windowSize - 1) { for (int j = 0; j < windowSize - 1 - nextLength; j++) { nextFactorTable = nextFactorTable.sumOutFront(); } } if (nextLength == 0) { // we are asking about the prob of no sequence Arrays.fill(probNextGivenThis, 1.0); } else { int[] next = new int[nextLength]; System.arraycopy(sequence, position + 1, next, 0, nextLength); for (int label = 0; label < numClasses; label++) { // ask the factor table such that pos is the first position in the // window // probNextGivenThis[label] = // factorTables[position+nextLength].conditionalLogProbGivenFirst(label, // next); // probNextGivenThis[label] = // nextFactorTable.conditionalLogProbGivenFirst(label, next); probNextGivenThis[label] = nextFactorTable.unnormalizedConditionalLogProbGivenFirst(label, next); } } // pointwise multiply return ArrayMath.pairwiseAdd(probThisGivenPrev, probNextGivenThis); }
java
public double scoreOf(int[] sequence) { int[] given = new int[window() - 1]; Arrays.fill(given, classIndex.indexOf(backgroundSymbol)); double logProb = 0; for (int i = 0; i < length(); i++) { int label = sequence[i]; logProb += condLogProbGivenPrevious(i, label, given); System.arraycopy(given, 1, given, 0, given.length - 1); given[given.length - 1] = label; } return logProb; }
java
public double condLogProbGivenPrevious(int position, int label, int[] prevLabels) { if (prevLabels.length + 1 == windowSize) { return factorTables[position].conditionalLogProbGivenPrevious(prevLabels, label); } else if (prevLabels.length + 1 < windowSize) { FactorTable ft = factorTables[position].sumOutFront(); while (ft.windowSize() > prevLabels.length + 1) { ft = ft.sumOutFront(); } return ft.conditionalLogProbGivenPrevious(prevLabels, label); } else { int[] p = new int[windowSize - 1]; System.arraycopy(prevLabels, prevLabels.length - p.length, p, 0, p.length); return factorTables[position].conditionalLogProbGivenPrevious(p, label); } }
java
public double[] getConditionalDistribution(int[] sequence, int position) { double[] result = scoresOf(sequence, position); ArrayMath.logNormalize(result); // System.out.println("marginal: " + ArrayMath.toString(marginal, // nf)); // System.out.println("conditional: " + ArrayMath.toString(result, // nf)); result = ArrayMath.exp(result); // System.out.println("conditional: " + ArrayMath.toString(result, // nf)); return result; }
java
public static authenticationldappolicy_systemglobal_binding[] get(nitro_service service, String name) throws Exception{ authenticationldappolicy_systemglobal_binding obj = new authenticationldappolicy_systemglobal_binding(); obj.set_name(name); authenticationldappolicy_systemglobal_binding response[] = (authenticationldappolicy_systemglobal_binding[]) obj.get_resources(service); return response; }
java
public double scoreOf(Datum<L, F> example, L label) { if(example instanceof RVFDatum<?, ?>)return scoreOfRVFDatum((RVFDatum<L,F>)example, label); int iLabel = labelIndex.indexOf(label); double score = 0.0; for (F f : example.asFeatures()) { score += weight(f, iLabel); } return score + thresholds[iLabel]; }
java
@Deprecated public double scoreOf(RVFDatum<L, F> example, L label) { int iLabel = labelIndex.indexOf(label); double score = 0.0; Counter<F> features = example.asFeaturesCounter(); for (F f : features.keySet()) { score += weight(f, iLabel) * features.getCount(f); } return score + thresholds[iLabel]; }
java
private double scoreOf(int[] feats, L label) { int iLabel = labelIndex.indexOf(label); double score = 0.0; for (int feat : feats) { score += weight(feat, iLabel); } return score + thresholds[iLabel]; }
java
public Counter<L> logProbabilityOf(Datum<L, F> example) { if(example instanceof RVFDatum<?, ?>)return logProbabilityOfRVFDatum((RVFDatum<L,F>)example); Counter<L> scores = scoresOf(example); Counters.logNormalizeInPlace(scores); return scores; }
java
public Counter<L> logProbabilityOf(int[] features) { Counter<L> scores = scoresOf(features); Counters.logNormalizeInPlace(scores); return scores; }
java
protected Set<Integer> getLabelIndices(Set<L> labels) { Set<Integer> iLabels = new HashSet<Integer>(); for (L label:labels) { int iLabel = labelIndex.indexOf(label); iLabels.add(iLabel); if (iLabel < 0) throw new IllegalArgumentException("Unknown label " + label); } return iLabels; }
java
public String topFeaturesToString(List<Triple<F,L,Double>> topFeatures) { // find longest key length (for pretty printing) with a limit int maxLeng = 0; for (Triple<F,L,Double> t : topFeatures) { String key = "(" + t.first + "," + t.second + ")"; int leng = key.length(); if (leng > maxLeng) { maxLeng = leng; } } maxLeng = Math.min(64, maxLeng); // set up pretty printing of weights NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(4); nf.setMaximumFractionDigits(4); if (nf instanceof DecimalFormat) { ((DecimalFormat) nf).setPositivePrefix(" "); } //print high weight features to a String StringBuilder sb = new StringBuilder(); for (Triple<F,L,Double> t : topFeatures) { String key = "(" + t.first + "," + t.second + ")"; sb.append(StringUtils.pad(key, maxLeng)); sb.append(" "); double cnt = t.third(); if (Double.isInfinite(cnt)) { sb.append(cnt); } else { sb.append(nf.format(cnt)); } sb.append("\n"); } return sb.toString(); }
java
public String toDistributionString(int treshold) { Counter<Double> weightCounts = new ClassicCounter<Double>(); StringBuilder s = new StringBuilder(); s.append("Total number of weights: ").append(totalSize()); for (int f = 0; f < weights.length; f++) { for (int l = 0; l < weights[f].length; l++) { weightCounts.incrementCount(weights[f][l]); } } s.append("Counts of weights\n"); Set<Double> keys = Counters.keysAbove(weightCounts, treshold); s.append(keys.size()).append(" keys occur more than ").append(treshold).append(" times "); return s.toString(); }
java
private static int bucketizeValue(double wt) { int index; if (wt >= 0.0) { index = ((int) (wt * 10.0)) + 100; } else { index = ((int) (Math.floor(wt * 10.0))) + 100; } if (index < 0) { index = 201; } else if (index > 200) { index = 200; } return index; }
java
private static void printHistCounts(int ind, String title, PrintWriter pw, double[][] hist, Object[][] histEg) { pw.println(title); for (int i = 0; i < 200; i++) { int intpart, fracpart; if (i < 100) { intpart = 10 - ((i + 9) / 10); fracpart = (10 - (i % 10)) % 10; } else { intpart = (i / 10) - 10; fracpart = i % 10; } pw.print("[" + ((i < 100) ? "-" : "") + intpart + "." + fracpart + ", " + ((i < 100) ? "-" : "") + intpart + "." + fracpart + "+0.1): " + hist[ind][i]); if (histEg[ind][i] != null) { pw.print(" [" + histEg[ind][i] + ((hist[ind][i] > 1) ? ", ..." : "") + "]"); } pw.println(); } }
java
public void dump() { Datum<L, F> allFeatures = new BasicDatum<L, F>(features(), (L)null); justificationOf(allFeatures); }
java
public Map<L,Counter<F>> weightsAsMapOfCounters() { Map<L,Counter<F>> mapOfCounters = new HashMap<L,Counter<F>>(); for(L label : labelIndex){ int labelID = labelIndex.indexOf(label); Counter<F> c = new ClassicCounter<F>(); mapOfCounters.put(label, c); for (F f : featureIndex) { c.incrementCount(f, weights[featureIndex.indexOf(f)][labelID]); } } return mapOfCounters; }
java
public void dumpSorted() { Datum<L, F> allFeatures = new BasicDatum<L, F>(features(), (L)null); justificationOf(allFeatures, new PrintWriter(System.err, true), true); }
java
public static <L, F> LinearClassifier<L, F> readClassifier(String loadPath) { System.err.print("Deserializing classifier from " + loadPath + "..."); try { ObjectInputStream ois = IOUtils.readStreamFromString(loadPath); LinearClassifier<L, F> classifier = ErasureUtils.<LinearClassifier<L, F>>uncheckedCast(ois.readObject()); ois.close(); return classifier; } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Deserialization failed: "+e.getMessage()); } }
java
public static void writeClassifier(LinearClassifier<?, ?> classifier, String writePath) { try { IOUtils.writeObjectToFile(classifier, writePath); } catch (Exception e) { throw new RuntimeException("Serialization failed: "+e.getMessage(), e); } }
java
public static cspolicy_cspolicylabel_binding[] get(nitro_service service, String policyname) throws Exception{ cspolicy_cspolicylabel_binding obj = new cspolicy_cspolicylabel_binding(); obj.set_policyname(policyname); cspolicy_cspolicylabel_binding response[] = (cspolicy_cspolicylabel_binding[]) obj.get_resources(service); return response; }
java
public static long count(nitro_service service, String policyname) throws Exception{ cspolicy_cspolicylabel_binding obj = new cspolicy_cspolicylabel_binding(); obj.set_policyname(policyname); options option = new options(); option.set_count(true); cspolicy_cspolicylabel_binding response[] = (cspolicy_cspolicylabel_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
public static vpnclientlessaccesspolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{ vpnclientlessaccesspolicy_vpnvserver_binding obj = new vpnclientlessaccesspolicy_vpnvserver_binding(); obj.set_name(name); vpnclientlessaccesspolicy_vpnvserver_binding response[] = (vpnclientlessaccesspolicy_vpnvserver_binding[]) obj.get_resources(service); return response; }
java
public static base_response export(nitro_service client, appfwarchive resource) throws Exception { appfwarchive exportresource = new appfwarchive(); exportresource.name = resource.name; exportresource.target = resource.target; return exportresource.perform_operation(client,"export"); }
java
public static base_response Import(nitro_service client, appfwarchive resource) throws Exception { appfwarchive Importresource = new appfwarchive(); Importresource.src = resource.src; Importresource.name = resource.name; Importresource.comment = resource.comment; return Importresource.perform_operation(client,"Import"); }
java
public static appfwarchive get(nitro_service service) throws Exception{ appfwarchive obj = new appfwarchive(); appfwarchive[] response = (appfwarchive[])obj.get_resources(service); return response[0]; }
java
public static vlan_channel_binding[] get(nitro_service service, Long id) throws Exception{ vlan_channel_binding obj = new vlan_channel_binding(); obj.set_id(id); vlan_channel_binding response[] = (vlan_channel_binding[]) obj.get_resources(service); return response; }
java
public static base_response add(nitro_service client, service resource) throws Exception { service addresource = new service(); addresource.name = resource.name; addresource.ip = resource.ip; addresource.servername = resource.servername; addresource.servicetype = resource.servicetype; addresource.port = resource.port; addresource.cleartextport = resource.cleartextport; addresource.cachetype = resource.cachetype; addresource.maxclient = resource.maxclient; addresource.healthmonitor = resource.healthmonitor; addresource.maxreq = resource.maxreq; addresource.cacheable = resource.cacheable; addresource.cip = resource.cip; addresource.cipheader = resource.cipheader; addresource.usip = resource.usip; addresource.pathmonitor = resource.pathmonitor; addresource.pathmonitorindv = resource.pathmonitorindv; addresource.useproxyport = resource.useproxyport; addresource.sc = resource.sc; addresource.sp = resource.sp; addresource.rtspsessionidremap = resource.rtspsessionidremap; addresource.clttimeout = resource.clttimeout; addresource.svrtimeout = resource.svrtimeout; addresource.customserverid = resource.customserverid; addresource.serverid = resource.serverid; addresource.cka = resource.cka; addresource.tcpb = resource.tcpb; addresource.cmp = resource.cmp; addresource.maxbandwidth = resource.maxbandwidth; addresource.accessdown = resource.accessdown; addresource.monthreshold = resource.monthreshold; addresource.state = resource.state; addresource.downstateflush = resource.downstateflush; addresource.tcpprofilename = resource.tcpprofilename; addresource.httpprofilename = resource.httpprofilename; addresource.hashid = resource.hashid; addresource.comment = resource.comment; addresource.appflowlog = resource.appflowlog; addresource.netprofile = resource.netprofile; addresource.td = resource.td; return addresource.add_resource(client); }
java
public static base_response disable(nitro_service client, service resource) throws Exception { service disableresource = new service(); disableresource.name = resource.name; disableresource.delay = resource.delay; disableresource.graceful = resource.graceful; return disableresource.perform_operation(client,"disable"); }
java
public static base_responses disable(nitro_service client, service resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { service disableresources[] = new service[resources.length]; for (int i=0;i<resources.length;i++){ disableresources[i] = new service(); disableresources[i].name = resources[i].name; disableresources[i].delay = resources[i].delay; disableresources[i].graceful = resources[i].graceful; } result = perform_operation_bulk_request(client, disableresources,"disable"); } return result; }
java
public static service[] get(nitro_service service, service_args args) throws Exception{ service obj = new service(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); service[] response = (service[])obj.get_resources(service, option); return response; }
java
public static service get(nitro_service service, String name) throws Exception{ service obj = new service(); obj.set_name(name); service response = (service) obj.get_resource(service); return response; }
java
public static long count(nitro_service service) throws Exception{ service obj = new service(); options option = new options(); option.set_count(true); service[] response = (service[])obj.get_resources(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static base_response add(nitro_service client, channel resource) throws Exception { channel addresource = new channel(); addresource.id = resource.id; addresource.ifnum = resource.ifnum; addresource.state = resource.state; addresource.mode = resource.mode; addresource.conndistr = resource.conndistr; addresource.macdistr = resource.macdistr; addresource.lamac = resource.lamac; addresource.speed = resource.speed; addresource.flowctl = resource.flowctl; addresource.hamonitor = resource.hamonitor; addresource.tagall = resource.tagall; addresource.trunk = resource.trunk; addresource.ifalias = resource.ifalias; addresource.throughput = resource.throughput; addresource.bandwidthhigh = resource.bandwidthhigh; addresource.bandwidthnormal = resource.bandwidthnormal; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, channel resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { channel addresources[] = new channel[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new channel(); addresources[i].id = resources[i].id; addresources[i].ifnum = resources[i].ifnum; addresources[i].state = resources[i].state; addresources[i].mode = resources[i].mode; addresources[i].conndistr = resources[i].conndistr; addresources[i].macdistr = resources[i].macdistr; addresources[i].lamac = resources[i].lamac; addresources[i].speed = resources[i].speed; addresources[i].flowctl = resources[i].flowctl; addresources[i].hamonitor = resources[i].hamonitor; addresources[i].tagall = resources[i].tagall; addresources[i].trunk = resources[i].trunk; addresources[i].ifalias = resources[i].ifalias; addresources[i].throughput = resources[i].throughput; addresources[i].bandwidthhigh = resources[i].bandwidthhigh; addresources[i].bandwidthnormal = resources[i].bandwidthnormal; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response update(nitro_service client, channel resource) throws Exception { channel updateresource = new channel(); updateresource.id = resource.id; updateresource.state = resource.state; updateresource.mode = resource.mode; updateresource.conndistr = resource.conndistr; updateresource.macdistr = resource.macdistr; updateresource.lamac = resource.lamac; updateresource.speed = resource.speed; updateresource.flowctl = resource.flowctl; updateresource.hamonitor = resource.hamonitor; updateresource.tagall = resource.tagall; updateresource.trunk = resource.trunk; updateresource.ifalias = resource.ifalias; updateresource.throughput = resource.throughput; updateresource.lrminthroughput = resource.lrminthroughput; updateresource.bandwidthhigh = resource.bandwidthhigh; updateresource.bandwidthnormal = resource.bandwidthnormal; return updateresource.update_resource(client); }
java
public static base_responses update(nitro_service client, channel resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { channel updateresources[] = new channel[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new channel(); updateresources[i].id = resources[i].id; updateresources[i].state = resources[i].state; updateresources[i].mode = resources[i].mode; updateresources[i].conndistr = resources[i].conndistr; updateresources[i].macdistr = resources[i].macdistr; updateresources[i].lamac = resources[i].lamac; updateresources[i].speed = resources[i].speed; updateresources[i].flowctl = resources[i].flowctl; updateresources[i].hamonitor = resources[i].hamonitor; updateresources[i].tagall = resources[i].tagall; updateresources[i].trunk = resources[i].trunk; updateresources[i].ifalias = resources[i].ifalias; updateresources[i].throughput = resources[i].throughput; updateresources[i].lrminthroughput = resources[i].lrminthroughput; updateresources[i].bandwidthhigh = resources[i].bandwidthhigh; updateresources[i].bandwidthnormal = resources[i].bandwidthnormal; } result = update_bulk_request(client, updateresources); } return result; }
java
public static channel[] get(nitro_service service) throws Exception{ channel obj = new channel(); channel[] response = (channel[])obj.get_resources(service); return response; }
java
public static channel get(nitro_service service, String id) throws Exception{ channel obj = new channel(); obj.set_id(id); channel response = (channel) obj.get_resource(service); return response; }
java
public static channel[] get(nitro_service service, String id[]) throws Exception{ if (id !=null && id.length>0) { channel response[] = new channel[id.length]; channel obj[] = new channel[id.length]; for (int i=0;i<id.length;i++) { obj[i] = new channel(); obj[i].set_id(id[i]); response[i] = (channel) obj[i].get_resource(service); } return response; } return null; }
java
public static lbwlm_lbvserver_binding[] get(nitro_service service, String wlmname) throws Exception{ lbwlm_lbvserver_binding obj = new lbwlm_lbvserver_binding(); obj.set_wlmname(wlmname); lbwlm_lbvserver_binding response[] = (lbwlm_lbvserver_binding[]) obj.get_resources(service); return response; }
java
public static lbwlm_lbvserver_binding[] get_filtered(nitro_service service, String wlmname, filtervalue[] filter) throws Exception{ lbwlm_lbvserver_binding obj = new lbwlm_lbvserver_binding(); obj.set_wlmname(wlmname); options option = new options(); option.set_filter(filter); lbwlm_lbvserver_binding[] response = (lbwlm_lbvserver_binding[]) obj.getfiltered(service, option); return response; }
java
public static long count(nitro_service service, String wlmname) throws Exception{ lbwlm_lbvserver_binding obj = new lbwlm_lbvserver_binding(); obj.set_wlmname(wlmname); options option = new options(); option.set_count(true); lbwlm_lbvserver_binding response[] = (lbwlm_lbvserver_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
public static base_response add(nitro_service client, dnspolicy resource) throws Exception { dnspolicy addresource = new dnspolicy(); addresource.name = resource.name; addresource.rule = resource.rule; addresource.viewname = resource.viewname; addresource.preferredlocation = resource.preferredlocation; addresource.preferredloclist = resource.preferredloclist; addresource.drop = resource.drop; addresource.cachebypass = resource.cachebypass; addresource.actionname = resource.actionname; return addresource.add_resource(client); }
java
public static base_responses add(nitro_service client, dnspolicy resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { dnspolicy addresources[] = new dnspolicy[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new dnspolicy(); addresources[i].name = resources[i].name; addresources[i].rule = resources[i].rule; addresources[i].viewname = resources[i].viewname; addresources[i].preferredlocation = resources[i].preferredlocation; addresources[i].preferredloclist = resources[i].preferredloclist; addresources[i].drop = resources[i].drop; addresources[i].cachebypass = resources[i].cachebypass; addresources[i].actionname = resources[i].actionname; } result = add_bulk_request(client, addresources); } return result; }
java
public static base_response update(nitro_service client, dnspolicy resource) throws Exception { dnspolicy updateresource = new dnspolicy(); updateresource.name = resource.name; updateresource.rule = resource.rule; updateresource.viewname = resource.viewname; updateresource.preferredlocation = resource.preferredlocation; updateresource.preferredloclist = resource.preferredloclist; updateresource.drop = resource.drop; updateresource.cachebypass = resource.cachebypass; updateresource.actionname = resource.actionname; return updateresource.update_resource(client); }
java
public static base_responses update(nitro_service client, dnspolicy resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { dnspolicy updateresources[] = new dnspolicy[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new dnspolicy(); updateresources[i].name = resources[i].name; updateresources[i].rule = resources[i].rule; updateresources[i].viewname = resources[i].viewname; updateresources[i].preferredlocation = resources[i].preferredlocation; updateresources[i].preferredloclist = resources[i].preferredloclist; updateresources[i].drop = resources[i].drop; updateresources[i].cachebypass = resources[i].cachebypass; updateresources[i].actionname = resources[i].actionname; } result = update_bulk_request(client, updateresources); } return result; }
java
public static dnspolicy[] get(nitro_service service) throws Exception{ dnspolicy obj = new dnspolicy(); dnspolicy[] response = (dnspolicy[])obj.get_resources(service); return response; }
java
public static dnspolicy get(nitro_service service, String name) throws Exception{ dnspolicy obj = new dnspolicy(); obj.set_name(name); dnspolicy response = (dnspolicy) obj.get_resource(service); return response; }
java
public static void processPath(File path, String suffix, boolean recursively, FileProcessor processor) { processPath(path, new ExtensionFileFilter(suffix, recursively), processor); }
java
public static dnspolicylabel_dnspolicy_binding[] get(nitro_service service, String labelname) throws Exception{ dnspolicylabel_dnspolicy_binding obj = new dnspolicylabel_dnspolicy_binding(); obj.set_labelname(labelname); dnspolicylabel_dnspolicy_binding response[] = (dnspolicylabel_dnspolicy_binding[]) obj.get_resources(service); return response; }
java
public static authorizationpolicylabel_stats[] get(nitro_service service) throws Exception{ authorizationpolicylabel_stats obj = new authorizationpolicylabel_stats(); authorizationpolicylabel_stats[] response = (authorizationpolicylabel_stats[])obj.stat_resources(service); return response; }
java
public static authorizationpolicylabel_stats get(nitro_service service, String labelname) throws Exception{ authorizationpolicylabel_stats obj = new authorizationpolicylabel_stats(); obj.set_labelname(labelname); authorizationpolicylabel_stats response = (authorizationpolicylabel_stats) obj.stat_resource(service); return response; }
java
public static authenticationcertpolicy_binding get(nitro_service service, String name) throws Exception{ authenticationcertpolicy_binding obj = new authenticationcertpolicy_binding(); obj.set_name(name); authenticationcertpolicy_binding response = (authenticationcertpolicy_binding) obj.get_resource(service); return response; }
java
public static nsmemory_stats[] get(nitro_service service) throws Exception{ nsmemory_stats obj = new nsmemory_stats(); nsmemory_stats[] response = (nsmemory_stats[])obj.stat_resources(service); return response; }
java
public static nsmemory_stats get(nitro_service service, String pool) throws Exception{ nsmemory_stats obj = new nsmemory_stats(); obj.set_pool(pool); nsmemory_stats response = (nsmemory_stats) obj.stat_resource(service); return response; }
java
public static lbmetrictable_binding get(nitro_service service, String metrictable) throws Exception{ lbmetrictable_binding obj = new lbmetrictable_binding(); obj.set_metrictable(metrictable); lbmetrictable_binding response = (lbmetrictable_binding) obj.get_resource(service); return response; }
java