PARTICULAR OPERATIONS - MX

Concatenation by order of importance

Example of sorting silos by importance of weight extracted and sending maximum 2 occurences.

double silo1 = Str.ToDouble(_str1);
double silo2 = Str.ToDouble(_str2);
double silo3 = Str.ToDouble(_str3);
double silo4 = Str.ToDouble(_str4);

//We create a list with weights extracted from silos and sort them from less to most important
double poids[] = {silo1,silo2,silo3,silo4};
Arrays.sort(poids);

//We create a Hashmap where the weight is associated with the corresponding silo
HashMap<Double,String> hm = new HashMap<Double,String>();
hm.put(silo1,"SILO1");
hm.put(silo2,"SILO2");
hm.put(silo3,"SILO3");
hm.put(silo4,"SILO4");

//If weight of second most important silo is under 5T, we neglect and return only most important silo
if(poids[2] < 5) return hm.get(poids[3]);

//otherwise we send the two most important
return (hm.get(poids[3])+"|"+hm.get(poids[2]));

Java sleep

Example of java in order to wait 10 min

if (!_doJava.get("_str1", +1).equals("")) return "OLD";
for (int i = 0; i<600; i++) {
    try {
        Thread.sleep(1000);
    }
    catch (Exception e) {
        return "FAIL";
    }
}
return "NEW";

Was this article helpful?

Powered by Zendesk