query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Based on a set of Cases and an attribute, finds the threshold for that attribute that gives the highest information gain
public static double chooseAttributeThreshold(ArrayList<Case> cases, Attribute attribute) { double currentBestThreshold = -1; double currentBestRemainder = 0; double [] values = new double[cases.size()]; for (int i = 0 ; i < cases.size() ; i++) { // Create an array of the appropriate field values from each case for easy sorting switch (attribute) { case K: values[i] = cases.get(i).k; break; case Na: values[i] = cases.get(i).na; break; case CL: values[i] = cases.get(i).cl; break; case HCO3: values[i] = cases.get(i).hco3; break; case Endotoxin: values[i] = cases.get(i).endotoxin; break; case Aniongap: values[i] = cases.get(i).aniongap; break; case PLA2: values[i] = cases.get(i).pla2; break; case SDH: values[i] = cases.get(i).sdh; break; case GLDH: values[i] = cases.get(i).gldh; break; case TPP: values[i] = cases.get(i).tpp; break; case BreathRate: values[i] = cases.get(i).breathRate; break; case PCV: values[i] = cases.get(i).pcv; break; case PulseRate: values[i] = cases.get(i).pulseRate; break; case Fibrinogen: values[i] = cases.get(i).fibrinogen; break; case Dimer: values[i] = cases.get(i).dimer; break; case FibPerDim: values[i] = cases.get(i).fibPerDim; break; } } Arrays.sort(values); for (int i = 0 ; i < cases.size() - 1 ; i++) { double midpoint = (values[i] + values[i+1]) / 2; // A rough way of dealing with non-unique values; two sequential identical values' average will be themselves, so ignore anything coming from such a pairing if (midpoint == values[i]) continue; double pless = 0; double nless = 0; double pgreater = 0; double ngreater = 0; for (Case c : cases) { // Count the number of positive and negative cases that exist on either side of the threshold double value = 0; switch (attribute) { case K: value = c.k; break; case Na: value = c.na; break; case CL: value = c.cl; break; case HCO3: value = c.hco3; break; case Endotoxin: value = c.endotoxin; break; case Aniongap: value = c.aniongap; break; case PLA2: value = c.pla2; break; case SDH: value = c.sdh; break; case GLDH: value = c.gldh; break; case TPP: value = c.tpp; break; case BreathRate: value = c.breathRate; break; case PCV: value = c.pcv; break; case PulseRate: value = c.pulseRate; break; case Fibrinogen: value = c.fibrinogen; break; case Dimer: value = c.dimer; break; case FibPerDim: value = c.fibPerDim; break; } if (value < midpoint) { if (c.isHealthy) pless++; else nless++; } else { if (c.isHealthy) pgreater++; else ngreater++; } } // Calculate the remainder as defined in lecture notes 17-18 slide 31 double remainder = ((pless+nless)/cases.size() * informationContent(pless, nless)) + ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater)); // We want the attribute that gives the highest information gain, and since information content of the full // set is constant, this is equivalent to the smallest remainder if (remainder < currentBestRemainder || currentBestThreshold == -1) { currentBestThreshold = midpoint; currentBestRemainder = remainder; } } return currentBestThreshold; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static Attribute chooseAttribute(ArrayList<Case> cases) {\n\t\tAttribute currentBestAttribute = null;\n\t\tdouble currentBestRemainder = 0;\n\n\t\t// k\n\t\tdouble [] kValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\t// Extract the correct fields from each case into a separate array for sorting\n\t\t\tkValues[i] = cases.get(i).k;\n\t\t}\n\t\tArrays.sort(kValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\t// Find the midpoint between two sequential values\n\t\t\tdouble midpoint = (kValues[i] + kValues[i+1]) / 2;\n\t\t\t// A rough way of dealing with non-unique values; two sequential identical values' average will be themselves, so ignore anything coming from such a pairing\n\t\t\tif (midpoint == kValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\t// Count the number of positive and negative cases that exist on either side of the threshold\n\t\t\t\tif (c.k < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Calculate the remainder as given in lecture slides 17-18 slide 31\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\t// We want the attribute that gives the highest information gain, and since information content of the full\n\t\t\t// set is constant, this is equivalent to the smallest remainder\n\t\t\tif (remainder < currentBestRemainder || currentBestAttribute == null) {\n\t\t\t\tcurrentBestAttribute = Attribute.K;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// na\n\t\tdouble [] naValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tnaValues[i] = cases.get(i).na;\n\t\t}\n\t\tArrays.sort(naValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (naValues[i] + naValues[i+1]) / 2;\n\t\t\tif (midpoint == naValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.na < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.Na;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// cl\n\t\tdouble [] clValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tclValues[i] = cases.get(i).cl;\n\t\t}\n\t\tArrays.sort(clValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (clValues[i] + clValues[i+1]) / 2;\n\t\t\tif (midpoint == clValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.cl < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.CL;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// hco3\n\t\tdouble [] hco3Values = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\thco3Values[i] = cases.get(i).hco3;\n\t\t}\n\t\tArrays.sort(hco3Values);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (hco3Values[i] + hco3Values[i+1]) / 2;\n\t\t\tif (midpoint == hco3Values[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.hco3 < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.HCO3;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// endotoxin\n\t\tdouble [] endotoxinValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tendotoxinValues[i] = cases.get(i).endotoxin;\n\t\t}\n\t\tArrays.sort(endotoxinValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (endotoxinValues[i] + endotoxinValues[i+1]) / 2;\n\t\t\tif (midpoint == endotoxinValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.endotoxin < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.Endotoxin;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// aniongap\n\t\tdouble [] aniongapValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\taniongapValues[i] = cases.get(i).aniongap;\n\t\t}\n\t\tArrays.sort(aniongapValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (aniongapValues[i] + aniongapValues[i+1]) / 2;\n\t\t\tif (midpoint == aniongapValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.aniongap < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.Aniongap;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// pla2\n\t\tdouble [] pla2Values = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tpla2Values[i] = cases.get(i).pla2;\n\t\t}\n\t\tArrays.sort(pla2Values);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (pla2Values[i] + pla2Values[i+1]) / 2;\n\t\t\tif (midpoint == pla2Values[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.pla2 < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.PLA2;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// sdh\n\t\tdouble [] sdhValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tsdhValues[i] = cases.get(i).sdh;\n\t\t}\n\t\tArrays.sort(sdhValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (sdhValues[i] + sdhValues[i+1]) / 2;\n\t\t\tif (midpoint == sdhValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.sdh < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.SDH;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// gldh\n\t\tdouble [] gldhValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tgldhValues[i] = cases.get(i).gldh;\n\t\t}\n\t\tArrays.sort(gldhValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (gldhValues[i] + gldhValues[i+1]) / 2;\n\t\t\tif (midpoint == gldhValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.gldh < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.GLDH;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// tpp\n\t\tdouble [] tppValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\ttppValues[i] = cases.get(i).tpp;\n\t\t}\n\t\tArrays.sort(tppValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (tppValues[i] + tppValues[i+1]) / 2;\n\t\t\tif (midpoint == tppValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.tpp < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.TPP;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// breathRate\n\t\tdouble [] breathRateValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tbreathRateValues[i] = cases.get(i).breathRate;\n\t\t}\n\t\tArrays.sort(breathRateValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (breathRateValues[i] + breathRateValues[i+1]) / 2;\n\t\t\tif (midpoint == breathRateValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.breathRate < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.BreathRate;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// pcv\n\t\tdouble [] pcvValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tpcvValues[i] = cases.get(i).pcv;\n\t\t}\n\t\tArrays.sort(pcvValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (pcvValues[i] + pcvValues[i+1]) / 2;\n\t\t\tif (midpoint == pcvValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.pcv < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.PCV;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// pulseRate\n\t\tdouble [] pulseRateValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tpulseRateValues[i] = cases.get(i).pulseRate;\n\t\t}\n\t\tArrays.sort(pulseRateValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (pulseRateValues[i] + pulseRateValues[i+1]) / 2;\n\t\t\tif (midpoint == pulseRateValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.pulseRate < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.PulseRate;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// fibrinogen\n\t\tdouble [] fibrinogenValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tfibrinogenValues[i] = cases.get(i).fibrinogen;\n\t\t}\n\t\tArrays.sort(fibrinogenValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (fibrinogenValues[i] + fibrinogenValues[i+1]) / 2;\n\t\t\tif (midpoint == fibrinogenValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.fibrinogen < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.Fibrinogen;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// dimer\n\t\tdouble [] dimerValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tdimerValues[i] = cases.get(i).dimer;\n\t\t}\n\t\tArrays.sort(dimerValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (dimerValues[i] + dimerValues[i+1]) / 2;\n\t\t\tif (midpoint == dimerValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.dimer < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.Dimer;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\t// fibPerDim\n\t\tdouble [] fibPerDimValues = new double[cases.size()];\n\t\tfor (int i = 0 ; i < cases.size() ; i++) {\n\t\t\tfibPerDimValues[i] = cases.get(i).fibPerDim;\n\t\t}\n\t\tArrays.sort(fibPerDimValues);\n\t\tfor (int i = 0 ; i < cases.size() - 1 ; i++) {\n\t\t\tdouble midpoint = (fibPerDimValues[i] + fibPerDimValues[i+1]) / 2;\n\t\t\tif (midpoint == fibPerDimValues[i]) continue;\n\t\t\tdouble pless = 0;\n\t\t\tdouble nless = 0;\n\t\t\tdouble pgreater = 0;\n\t\t\tdouble ngreater = 0;\n\t\t\tfor (Case c : cases) {\n\t\t\t\tif (c.fibPerDim < midpoint) {\n\t\t\t\t\tif (c.isHealthy) pless++;\n\t\t\t\t\telse nless++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (c.isHealthy) pgreater++;\n\t\t\t\t\telse ngreater++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble remainder = ((pless+nless)/cases.size() * informationContent(pless, nless))\n\t\t\t\t\t+ ((pgreater+ngreater)/cases.size() * informationContent(pgreater, ngreater));\n\t\t\tif (remainder < currentBestRemainder) {\n\t\t\t\tcurrentBestAttribute = Attribute.FibPerDim;\n\t\t\t\tcurrentBestRemainder = remainder;\n\t\t\t}\n\t\t}\n\n\t\treturn currentBestAttribute;\n\t}", "float getThreshold();", "double getLowerThreshold();", "double getUpperThreshold();", "private double getAttributeProbability(String attribute, int attributeIndex) {\n\t\tDouble value; // store value of raw data\n\t\tif (attribute.chars().allMatch(Character::isDigit) || attribute.contains(\".\")) {\n\t\t\tvalue = Double.valueOf(attribute);\n\t\t} else {\n\t\t\tvalue = (double) attribute.hashCode();\n\t\t} // end if-else\n\n\n\t\tdouble totalSelectedAttribute = 0;\n\t\tfor (Bin bin : attribBins.get(attributeIndex)) {\n\t\t\tif (bin.binContains(value)) {\n\t\t\t\ttotalSelectedAttribute = bin.getFreq();\n\t\t\t\tbreak;\n\t\t\t} // end if\n\t\t} // end for\n\n\t\tint totalAttributes = 0;\n\t\tfor (int i = 0; i < dc.getDataFold().size(); i++) {\n\t\t\tif (i == testingFold) {\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\ttotalAttributes += dc.getDataFold().get(i).size();\n\t\t\t} // end if-else\n\t\t} // end for\n\t\treturn totalSelectedAttribute / totalAttributes;\n\t}", "private double getMaxThreshold() {\n return maxThreshold;\n }", "protected static void adaptivaeThresholdCalc() {\n\t\tif (triggerCount > 3) {\n\t\t\tthreshold /= 0.9;\n\t\t\t// Log.d(\"visualizer\", \"threshold up to \" + threshold);\n\t\t}\n\t\tif (triggerCount < 2) {\n\t\t\tthreshold *= 0.9;\n\t\t\t// Log.d(\"visualizer\", \"threshold down to \" + threshold);\n\t\t}\n\n\t\tif (threshold < 1.5f)\n\t\t\tthreshold = 1.5f;\n\t}", "public double getThreshold() {\r\n return threshold;\r\n }", "public double getThreshold() {\n return threshold;\n }", "public int getThreshold() {\n return threshold; \n }", "public int getThreshold()\n {\n return threshold;\n }", "public void findEdgesAndThreshold() {\n\t\tActiveImageConverter.convertToGray16();\n\t\tContrastEnhancer enhancer = new ContrastEnhancer();\n\t\tenhancer.equalize(ActiveImage);\n\t\tActiveImageProcessor = ActiveImage.getProcessor();\n\t\tActiveImageProcessor.findEdges();\n\t\tActiveImageProcessor.sqr(); // turns the gradient into gradient squared\n\t\tActiveImageProcessor.sqr(); // further enhances the good edges\n\t\tenhancer.equalize(ActiveImage);\n\t\tdouble mean = ActiveImage.getStatistics().mean;\n\t\tdouble max = ActiveImage.getStatistics().max;\n\t\tActiveImageProcessor.setThreshold(mean*8,max,ActiveImageProcessor.OVER_UNDER_LUT);\n\t\tif(userInput)\n\t\t{\n\t\t\tIJ.run(ActiveImage,\"Threshold...\",\"\");\n\t\t\tnew WaitForUserDialog(\"OK\").show();\n\t\t\tif (WindowManager.getWindow(\"Threshold\")!= null){\n\t\t\t\tIJ.selectWindow(\"Threshold\");\n\t\t\t\tIJ.run(\"Close\"); \n\t\t\t}\n\t\t}\n\t\tIJ.run(ActiveImage,\"Convert to Mask\",\"\");\n\t\tIJ.run(ActiveImage,\"Skeletonize\",\"\");\n\t\treturn;\n\t}", "public double compute(ClassifierSetPoint point) {\n return point.getThreshold();\n }", "public double predictInformationGain(DataSet d, int attribute){\n\t\treturn this.calculateEntrpoy(d)-this.predictEntropy(d, attribute);\n\t\t\n\t}", "public float getThreshold() {\n return threshold;\n }", "public ArrayList<Attribute> getValidAttributes (double threshold) {\r\n\t\t\r\n\t\tArrayList<Attribute> retAttr = new ArrayList<Attribute>();\r\n\t\tHashMap<Integer, Boolean> seen = new HashMap<Integer, Boolean>();\r\n\r\n\t\tfor(Attribute curAttr: valInstances) {\r\n\t\t\tdouble tempProb = findProb(curAttr);\r\n\t\t\t\r\n\t\t\tif(tempProb > threshold && !seen.containsKey(curAttr.hashCode())) {\r\n\t\t\t\tdebugPrint.print(\"Probablility of attribute: \" + curAttr.getName() + \" - \" + curAttr.getVal() + \" is: \" + tempProb,3);\r\n\t\t\t\t//debugPrint.print(\"Found value above the threshold\");\r\n\t\t\t\tretAttr.add(new Attribute(curAttr.getName(), curAttr.getVal(), tempProb, getAllSources(curAttr)));\r\n\t\t\t\tseen.put(curAttr.hashCode(), true);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn retAttr;\r\n\t}", "private int find_bestSplit(KnowledgeBase kb, int attIndex, ArrayList<ArrayList<ArrayList<Integer>>> multiple_counters) {\r\n\t\tif(multiple_counters.size() >0){\r\n\t\t\tfloat best_Gini = calculImpurity2D(kb.getSamples().size(),multiple_counters.get(0));; // it's a minimum!!\r\n\t\t\tint index_Best_Gini =0;\r\n\t\t\tfloat tmp_gini;\r\n\t\t\tfor(int i=1;i<multiple_counters.size();i++){\r\n\t\t\t\ttmp_gini = calculImpurity2D(kb.getSamples().size(),multiple_counters.get(i));\r\n\t\t\t\tif(tmp_gini<best_Gini){\r\n\t\t\t\t\tbest_Gini = tmp_gini;\r\n\t\t\t\t\tindex_Best_Gini = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn index_Best_Gini;\r\n\t\t}\r\n\t\treturn 0;\r\n\t\t\r\n\t\t\r\n\t}", "public byte getAttributeLevel(byte i)\r\n\t{\r\n\t\tswitch(i)\r\n\t\t{\r\n\t\tcase INTELLIGENCE:\r\n\t\t\treturn intelligence;\r\n\t\tcase CUNNING:\r\n\t\t\treturn cunning;\r\n\t\tcase STRENGTH:\r\n\t\t\treturn strength;\r\n\t\tcase AGILITY:\r\n\t\t\treturn agility;\r\n\t\tcase PERCEPTION:\r\n\t\t\treturn perception;\r\n\t\tcase HONOR:\r\n\t\t\treturn honor;\r\n\t\tcase SPEED:\r\n\t\t\treturn speed;\r\n\t\tcase LOYALTY:\r\n\t\t\treturn loyalty;\r\n\t\t}\r\n\t\treturn -1;\r\n\t}", "public String getDescriptor() {\n return \"Threshold\";\n }", "private boolean passThreshold(Decision decision) {\n\t\tint type = decision.getChoiceModifiers().getThresholdType();\n\t\tint sign = decision.getChoiceModifiers().getThresholdSign();\n\t\tint value = decision.getChoiceModifiers().getThresholdValue();\n\t\tCounters counter = storyController.getStory().getPlayerStats();\n\t\tboolean outcome = false;\n\t\tint[] typeBase = {counter.getPlayerHpStat(),counter.getEnemyHpStat(),counter.getTreasureStat()};\n\t\tswitch(sign){\n\t\t\tcase(0):\n\t\t\t\tif(typeBase[type] < value){outcome = true;};\n\t\t\t\tbreak;\n\t\t\tcase(1):\n\t\t\t\tif(typeBase[type] > value){outcome = true;};\n\t\t\t\tbreak;\n\t\t\tcase(2):\n\t\t\t\tif(typeBase[type] == value){outcome = true;};\n\t\t\t\tbreak;\n\t\t}\n\t\treturn outcome;\n\t}", "public int MajorityVote(double sample[]) {\n\t\t \n\t\tif(leaf_buff == null) {\n\t\t\tleaf_buff = new ArrayList<KDNode>();\n\t\t\tLeafNodes(leaf_buff);\n\t\t}\n\n\t\tint class_count[] = new int[]{0, 0, 0, 0};\n\t\tfor(int i=0; i<leaf_buff.size(); i++) {\n\t\t\tint label = leaf_buff.get(i).classifier.Output(sample);\n\n\t\t\tswitch(label) {\n\t\t\t\tcase -2: class_count[0]++;break;\n\t\t\t\tcase -1: class_count[1]++;break;\n\t\t\t\tcase 1: class_count[2]++;break;\n\t\t\t\tcase 2: class_count[3]++;break;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint max = 0;\n\t\tint label = 0;\n\t\tfor(int i=0; i<4; i++) {\n\t\t\t\n\t\t\tif(class_count[i] > max) {\n\t\t\t\tmax = class_count[i];\n\t\t\t\tlabel = i;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn label;\n\t}", "private float calculGainNumerical(KnowledgeBase kb, int attIndex) {\r\n\t\tArrayList<AttributeValue<Float>> possibleValue =findPossibleValueNumerical(kb,attIndex);\r\n\t\tArrayList<ArrayList<ArrayList<Integer>>> multiple_counters2D = new ArrayList<ArrayList<ArrayList<Integer>>>();\r\n\t\tfor(int i=0;i<possibleValue.size()-1;i++){\r\n\t\t\tmultiple_counters2D.add(kb.count2DNumeric(possibleValue.get(i),attIndex));\t\t\r\n\t\t}\r\n\t\tArrayList<Integer> counter1D = kb.count(kb.getIndexClass());\r\n\t\tfloat gini1D = calculImpurity(kb.getSamples().size(),counter1D);\r\n\t\tint indexBestSplit = find_bestSplit(kb,attIndex,multiple_counters2D);\r\n\t\t///\r\n\t\tArrayList<ArrayList<Integer>> counter2D = kb.count2DNumeric(attIndex, kb.getIndexClass(),possibleValue.get(indexBestSplit));\r\n\t\tfloat gini2D = calculImpurity2DForNumerical(kb,attIndex,counter2D,possibleValue.get(indexBestSplit));\r\n\t\treturn gini1D - gini2D;\r\n\t}", "void setThreshold(float value);", "int getSimilarityThreshold(final int field);", "public double getLowThreshold(){\n return lowThreshold;\n }", "float getConfidence();", "@SuppressWarnings(\"unchecked\")\r\n public static void main(String[] args)\r\n {\r\n //final String INPUT_FILE=\"contact-lenses.arff\";\r\n final String INPUT_FILE=\"adult.merged.arff\";\r\n Instances data;\r\n try {\r\n Reader reader = new FileReader(INPUT_FILE);\r\n data = new Instances(reader);\r\n } catch (Exception e) {\r\n System.out.println(\"Failed to read input file \" + INPUT_FILE + \", exiting\");\r\n return;\r\n }\r\n data.setClassIndex(data.numAttributes()-1);\r\n\r\n System.out.println(\"Acquired data from file \" + INPUT_FILE);\r\n System.out.println(\"Got \" + data.numInstances() + \" instances with \" + data.numAttributes() + \" attributes, class attribute is \" + data.classAttribute().name());\r\n AttributeScoreAlgorithm scorer = new MaxScorer ();\r\n Enumeration<Attribute> atts=(Enumeration<Attribute>)data.enumerateAttributes();\r\n while (atts.hasMoreElements())\r\n {\r\n C45Attribute att=new C45Attribute(atts.nextElement());\r\n System.out.println(\"Score for attribute \" + att.WekaAttribute().name() + \" is \" + scorer.Score(data,att));\r\n }\r\n\r\n List<C45Attribute> candidateAttributes = new LinkedList<C45Attribute>();\r\n Enumeration attEnum = data.enumerateAttributes();\r\n while (attEnum.hasMoreElements())\r\n candidateAttributes.add(new C45Attribute((Attribute)attEnum.nextElement()));\r\n BigDecimal epsilon=new BigDecimal(0.1, DiffPrivacyClassifier.MATH_CONTEXT);\r\n PrivacyAgent agent = new PrivacyAgentBudget(epsilon);\r\n\r\n PrivateInstances privData = new PrivateInstances(agent,data);\r\n privData.setDebugMode(true);\r\n\r\n try {\r\n C45Attribute res=privData.privateChooseAttribute(new MaxScorer(), candidateAttributes,epsilon);\r\n System.out.println(\"Picked attribute \" + res.WekaAttribute().name());\r\n } catch(Exception e) { System.out.println(e.getMessage());}\r\n }", "private float applyThreshold(float input) {\n return abs(input) > THRESHOLD_MOTION ? input : 0;\n }", "public double calculateInformationGain (AbstractRule A)\n\t{\n\t\tdouble a = Math.log((double)(A.getPM() + C1)/(double)(A.getPM() + A.getNM() + C2))/Math.log(2);\n\t\treturn a;\n\t}", "@Updatable\n public Double getThreshold() {\n return threshold;\n }", "public double getHighThreshold() {\n return highThreshold;\n }", "public double Score(Instances data, C45Attribute att) {\r\n Instances[] splitData = SplitData(data,att);\r\n double score=0;\r\n for (int j = 0; j < splitData.length; j++) {\r\n if (splitData[j].numInstances() > 0) {\r\n score+=numMajorityClass(splitData[j]);\r\n }\r\n }\r\n return score;\r\n }", "private double calc_gain_ratio(String attrb,int partitonElem,HashMap<Integer, WeatherData> trainDataXMap,HashMap<Integer, WeatherData> trainDataYMap,double information_gain_System,int total_count_in_train)\n\t{\n\t\t\n\t\tHashMap<Integer,Integer> X_Train_attrb_part1 = new HashMap<Integer,Integer>();\n\t\tHashMap<Integer,Integer> X_Train_attrb_part2 = new HashMap<Integer,Integer>();\n\t\tHashMap<Integer,WeatherData> Y_Train_attrb_part1 = new HashMap<Integer,WeatherData>();\n\t\tHashMap<Integer,WeatherData> Y_Train_attrb_part2 = new HashMap<Integer,WeatherData>();\n\t\t//System.out.println(\"the partition elem is\"+partitonElem);\n\t\tfor(int i=1;i<=trainDataXMap.size();i++)\n\t\t{\n\t\t\tWeatherData wd = trainDataXMap.get(i);\n\t\t\t\n\t\t\tfor(Feature f: wd.getFeatures())\n\t\t\t{\n\t\t\t\tif(f.getName().contains(attrb))\n\t\t\t\t{\n\t\t\t\t\tint attrb_val = Integer.parseInt(f.getValues().get(0).toString());\n\t\t\t\t\tint xTRainKey = getKey(wd);\n\t\t\t\t\tif(attrb_val <= partitonElem)\n\t\t\t\t\t{\n\t\t\t\t\t\tX_Train_attrb_part1.put(xTRainKey,attrb_val);\n\t\t\t\t\t\tY_Train_attrb_part1.put(xTRainKey, trainDataYMap.get(xTRainKey));\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tX_Train_attrb_part2.put(xTRainKey,attrb_val);\n\t\t\t\t\t\tY_Train_attrb_part2.put(xTRainKey, trainDataYMap.get(xTRainKey));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//Size of first partition\n\t\tint Total_Count_attr_part1 = X_Train_attrb_part1.size();\n\t\t//System.out.println(\"the size of X first partition\"+Total_Count_attr_part1);\n\t\t//System.out.println(\"the size of Y first partition\"+Y_Train_attrb_part1.size());\n\t\t\n\t\t//Size of second partition\n\t\tint Total_Count_attr_part2 = X_Train_attrb_part2.size();\n\t\t//System.out.println(\"the size of X second partition\"+Total_Count_attr_part2);\n\t\t//System.out.println(\"the size of Y second partition\"+Y_Train_attrb_part2.size());\n\t\t\n\t\t//No of records in first partition where EVENT = RAIN \n\t\tint count_rain_yes_part1 = getCountsOfRain(Y_Train_attrb_part1,true,Total_Count_attr_part1);\n\t\t//System.out.println(\"count of rain in first part1\"+count_rain_yes_part1);\n\t\t\n\t\t//No of records in first partition where EVENT != RAIN Y_Train_attrb_part1\n\t\tint count_rain_no_part1 = getCountsOfRain(Y_Train_attrb_part1,false,Total_Count_attr_part1);\t\t\n\t\t//System.out.println(\"count of no rain in first part1\"+count_rain_no_part1);\n\t\t\n\t\t//Compute the Information Gain in first partition\n\t\t\n\t\tdouble prob_yes_rain_part1 = 0.0;\n\t\tdouble prob_no_rain_part1 = 0.0;\n\t\tdouble prob_yes_rain_part2 = 0.0;\n\t\tdouble prob_no_rain_part2 = 0.0;\n\t\tdouble getInfoGain_part1 = 0.0;\n\t double getInfoGain_part2 = 0.0;\n\t double gain_ratio_partition = 0.0;\n\t\tif(Total_Count_attr_part1!=0){\n\t\t\tprob_yes_rain_part1 = (count_rain_yes_part1/(double)Total_Count_attr_part1);\n\t\t\tprob_no_rain_part1 = (count_rain_no_part1/(double)Total_Count_attr_part1);\t\t\t\n\t\t}\n\t\tif((prob_yes_rain_part1!=0.0) && (prob_no_rain_part1!=0.0))\n\t\t{\n\t\t\tgetInfoGain_part1 = getInformationGain(prob_yes_rain_part1,prob_no_rain_part1);\n\t\t}\t\t\n\t\t\n\t\t//System.out.println(\"the info gain from part1\"+getInfoGain_part1);\n\t\t//No of records in second partition where EVENT = RAIN \n int count_rain_yes_part2 = getCountsOfRain(Y_Train_attrb_part2,true,Total_Count_attr_part2);\n\t\t\n //No of records in first partition where EVENT != RAIN\n\t\tint count_rain_no_part2 = getCountsOfRain(Y_Train_attrb_part2,false,Total_Count_attr_part2);\t\n\t\t\n\t\t//Compute the Information Gain in second partition\n\t\tif(Total_Count_attr_part2!=0)\n\t\t{\n\t\t\tprob_yes_rain_part2 = (count_rain_yes_part2/(double)Total_Count_attr_part2);\n\t\t\tprob_no_rain_part2 = (count_rain_no_part2/(double)Total_Count_attr_part2);\n\t\t\t\n\t\t}\n\t\tif((prob_yes_rain_part2!=0.0) && (prob_no_rain_part2!=0.0))\n\t\t{\n\t\t\tgetInfoGain_part2 = getInformationGain(prob_yes_rain_part2,prob_no_rain_part2);\n\t\t}\n\t\t//System.out.println(\"the info gain from part2\"+getInfoGain_part2);\n\t\t\n\t\t//Total Information from both partitions\n\t\tdouble infoGainFrom_Partition = getInfoGain_part1 + getInfoGain_part2;\n\t\t\n\t\t//Gain from the Partition\n\t\tdouble Gain_from_partition = information_gain_System - infoGainFrom_Partition;\n\t\t//System.out.println(\"The inf gain from system\"+information_gain_System);\n\t\t//System.out.println(\"The inf gain from part\"+infoGainFrom_Partition);\n\t\t//System.out.println(\"The gain from part\"+Gain_from_partition);\n\t\t\n\t\t//Split information of partition\n\t\tif((Total_Count_attr_part1!=0) && (Total_Count_attr_part2!=0))\n\t\t{\n\t\n\t\t\tdouble splitInfoFromPartition = getInformationGain(((double)Total_Count_attr_part1/total_count_in_train),\n ((double)Total_Count_attr_part2/total_count_in_train));\n\t\t\t\n\t\t\t//System.out.println(\"The split info from partition\"+splitInfoFromPartition);\n \n\t\t\t//Gain ratio of Partition\n gain_ratio_partition = Gain_from_partition/splitInfoFromPartition;\n\t\t}\n\t\t//System.out.println(\"The gain ratio info from partition\"+gain_ratio_partition);\n\t\treturn gain_ratio_partition;\n\t}", "public static Node buildTree(ArrayList<Case> cases) {\n\t\tint healthy = 0;\n\t\t// Count the number of healthy cases in the current set\n\t\tfor (Case c : cases) {\n\t\t\tif (c.isHealthy) healthy++;\n\t\t}\n\t\t// If all cases are either healthy or unhealthy, this can be a result node and so is set as such (to the correct value)\n\t\tif (healthy == cases.size() || healthy == 0) {\n\t\t\treturn new Node(cases.get(0).isHealthy);\n\t\t}\n\t\telse {\n\t\t\t// Otherwise we have a mix, so find the best attribute and matching threshold to split on\n\t\t\tAttribute attribute = chooseAttribute(cases);\n\t\t\tdouble threshold = chooseAttributeThreshold(cases, attribute);\n\t\t\tNode tree = new Node();\n\t\t\ttree.attribute = attribute;\n\t\t\ttree.threshold = threshold;\n\t\t\tArrayList<Case> casesLessThan = new ArrayList<Case>();\n\t\t\tArrayList<Case> casesGreaterThan = new ArrayList<Case>();\n\t\t\t// Get the appropriate value and use that to sort into two lists, one for each side of the threshold\n\t\t\tfor (Case c : cases) {\n\t\t\t\tdouble value = 0;\n\t\t\t\tswitch (attribute) {\n\t\t\t\tcase K:\n\t\t\t\t\tvalue = c.k;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Na:\n\t\t\t\t\tvalue = c.na;\n\t\t\t\t\tbreak;\n\t\t\t\tcase CL:\n\t\t\t\t\tvalue = c.cl;\n\t\t\t\t\tbreak;\n\t\t\t\tcase HCO3:\n\t\t\t\t\tvalue = c.hco3;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Endotoxin:\n\t\t\t\t\tvalue = c.endotoxin;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Aniongap:\n\t\t\t\t\tvalue = c.aniongap;\n\t\t\t\t\tbreak;\n\t\t\t\tcase PLA2:\n\t\t\t\t\tvalue = c.pla2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase SDH:\n\t\t\t\t\tvalue = c.sdh;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GLDH:\n\t\t\t\t\tvalue = c.gldh;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TPP:\n\t\t\t\t\tvalue = c.tpp;\n\t\t\t\t\tbreak;\n\t\t\t\tcase BreathRate:\n\t\t\t\t\tvalue = c.breathRate;\n\t\t\t\t\tbreak;\n\t\t\t\tcase PCV:\n\t\t\t\t\tvalue = c.pcv;\n\t\t\t\t\tbreak;\n\t\t\t\tcase PulseRate:\n\t\t\t\t\tvalue = c.pulseRate;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Fibrinogen:\n\t\t\t\t\tvalue = c.fibrinogen;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Dimer:\n\t\t\t\t\tvalue = c.dimer;\n\t\t\t\t\tbreak;\n\t\t\t\tcase FibPerDim:\n\t\t\t\t\tvalue = c.fibPerDim;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (value < threshold) {\n\t\t\t\t\tcasesLessThan.add(c);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcasesGreaterThan.add(c);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Recurse on these sets to create subtrees\n\t\t\ttree.lessThanChildren = buildTree(casesLessThan);\n\t\t\ttree.greaterThanChildren = buildTree(casesGreaterThan);\n\t\t\t\n\t\t\treturn tree;\n\t\t}\n\t}", "private static int compareWeighted(ArrayList<ActivityItem> trace, HashMap<Integer, ActivityPrediction> model) {\n Iterator traceIterator = trace.iterator();\n ActivityPrediction predictionItem = null;\n ActivityItem currentTraceItem;\n int result = 0;\n int traceID;\n if (traceIterator.hasNext()) {\n// get the current item in the trace and get the actual model id from it (needed to distinguish between AM and PM)\n currentTraceItem = (ActivityItem) traceIterator.next();\n traceID = ProcessMiningUtil.getProcessModelID(currentTraceItem.getStarttime(), currentTraceItem.getActivityId(), currentTraceItem.getSubactivityId());\n// find start node of the model representation\n// if (model.containsKey(Fitness.getStartID(model))) {\n if (model.containsKey(9990)) {\n predictionItem = model.get(Fitness.getStartID(model));\n }\n if (Fitness.nextActivityPossible(traceID, predictionItem.getEdgeTargetMap())) {\n predictionItem = model.get(traceID);\n }\n while (predictionItem.getActivityID() == traceID && traceIterator.hasNext()) {\n currentTraceItem = (ActivityItem) traceIterator.next();\n traceID = ProcessMiningUtil.getProcessModelID(currentTraceItem.getStarttime(), currentTraceItem.getActivityId(), currentTraceItem.getSubactivityId());\n if (Fitness.nextActivityPossible(traceID, predictionItem.getEdgeTargetMap())) {\n predictionItem = model.get(traceID);\n } else {\n result = 0;\n break;\n }\n if (!traceIterator.hasNext()) {\n// if (Fitness.nextActivityPossible(Fitness.getEndID(model), predictionItem.getEdgeTargetMap())) {\n if (Fitness.nextActivityPossible(9991, predictionItem.getEdgeTargetMap())) {\n result = 1;\n break;\n }\n }\n }\n }\n return result;\n }", "protected static Object[] calcGainRatios(InstanceList ilist, int[] instIndices, int minNumInsts)\n {\n int numInsts = instIndices.length;\n Alphabet dataDict = ilist.getDataAlphabet();\n LabelAlphabet targetDict = (LabelAlphabet) ilist.getTargetAlphabet();\n double[] targetCounts = new double[targetDict.size()];\n\n // Accumulate target label counts and make sure\n // the sum of each instance's target label is 1\n for (int ii = 0; ii < numInsts; ii++) {\n Instance inst = ilist.get(instIndices[ii]);\n Labeling labeling = inst.getLabeling();\n double labelWeightSum = 0;\n for (int ll = 0; ll < labeling.numLocations(); ll++) {\n int li = labeling.indexAtLocation(ll);\n double labelWeight = labeling.valueAtLocation(ll);\n labelWeightSum += labelWeight;\n targetCounts[li] += labelWeight;\n }\n assert(Maths.almostEquals(labelWeightSum, 1));\n }\n\n // Calculate the base entropy Info(D) and the the \n // label distribution of the given instances\n double[] targetDistribution = new double[targetDict.size()];\n double baseEntropy = 0;\n for (int ci = 0; ci < targetDict.size(); ci++) {\n double p = targetCounts[ci] / numInsts;\n targetDistribution[ci] = p;\n if (p > 0)\n baseEntropy -= p * Math.log(p) / log2;\n }\n\n LabelVector baseLabelDistribution = new LabelVector(targetDict, targetDistribution);\n double infoGainSum = 0;\n int totalNumSplitPoints = 0;\n double[] passTestTargetCounts = new double[targetDict.size()];\n // Maps feature index -> Hashtable, and each table \n // maps (split point) -> (info gain, split ratio)\n HashMap[] featureToInfo = new HashMap[dataDict.size()]; \n \n // Go through each feature's split points in ascending order\n for (int fi = 0; fi < dataDict.size(); fi++) {\n \n if ((fi+1) % 1000 == 0)\n logger.info(\"at feature \" + (fi+1) + \" / \" + dataDict.size());\n \n featureToInfo[fi] = new HashMap();\n Arrays.fill(passTestTargetCounts, 0);\n // Sort instances on this feature's values\n instIndices = sortInstances(ilist, instIndices, fi);\n\n // Iterate through the sorted instances\n for (int ii = 0; ii < numInsts-1; ii++) {\n Instance inst = ilist.get(instIndices[ii]);\n Instance instPlusOne = ilist.get(instIndices[ii+1]);\n FeatureVector fv1 = (FeatureVector) inst.getData();\n FeatureVector fv2 = (FeatureVector) instPlusOne.getData();\n double lower = fv1.value(fi);\n double higher = fv2.value(fi);\n\n // Accumulate the label weights for instances passing the test\n Labeling labeling = inst.getLabeling();\n for (int ll = 0; ll < labeling.numLocations(); ll++) {\n int li = labeling.indexAtLocation(ll);\n double labelWeight = labeling.valueAtLocation(ll);\n passTestTargetCounts[li] += labelWeight;\n }\n\n if (Maths.almostEquals(lower, higher) || inst.getLabeling().toString().equals(instPlusOne.getLabeling().toString()))\n continue;\n\n // For this (feature, spilt point) pair, calculate the \n // info gain of using this pair to split insts into those \n // with value of feature <= p versus > p\n totalNumSplitPoints++;\n double splitPoint = (lower + higher) / 2;\n double numPassInsts = ii+1;\n \n // If this split point creates a partition \n // with too few instances, ignore it\n double numFailInsts = numInsts - numPassInsts;\n if (numPassInsts < minNumInsts || numFailInsts < minNumInsts)\n continue;\n \n // If all instances pass or fail this test, it is useless\n double passProportion = numPassInsts / numInsts;\n if (Maths.almostEquals(passProportion, 0) || Maths.almostEquals(passProportion, 1))\n continue; \n \n // Calculate the entropy of instances passing and failing the test\n double passEntropy = 0;\n double failEntropy = 0;\n double p;\n \n for (int ci = 0; ci < targetDict.size(); ci++) {\n if (numPassInsts > 0) {\n p = passTestTargetCounts[ci] / numPassInsts;\n if (p > 0)\n passEntropy -= p * Math.log(p) / log2;\n }\n if (numFailInsts > 0) {\n double failTestTargetCount = targetCounts[ci] - passTestTargetCounts[ci];\n p = failTestTargetCount / numFailInsts;\n if (p > 0)\n failEntropy -= p * Math.log(p) / log2;\n }\n }\n \n // Calculate Gain(D, T), the information gained \n // by testing on this (feature, split-point) pair\n double gainDT = baseEntropy \n - passProportion * passEntropy\n - (1-passProportion) * failEntropy; \n infoGainSum += gainDT;\n // Calculate Split(D, T), the split information\n double splitDT = \n - passProportion * Math.log(passProportion) / log2\n - (1-passProportion) * Math.log(1-passProportion) / log2;\n // Calculate the gain ratio\n double gainRatio = gainDT / splitDT;\n featureToInfo[fi].put(Double.valueOf(splitPoint),\n new Point2D.Double(gainDT, gainRatio));\n } // End loop through sorted instances\n } // End loop through features\n\n // For each feature's split point with at least average gain, \n // get the maximum gain ratio and the associated split point\n // (using the info gain as tie breaker)\n double[] gainRatios = new double[dataDict.size()];\n double[] splitPoints = new double[dataDict.size()];\n int numSplitsForBestFeature = 0;\n\n // If all feature vectors are identical or no splits are worthy, return all 0s\n if (totalNumSplitPoints == 0 || Maths.almostEquals(infoGainSum, 0))\n return new Object[] {gainRatios, splitPoints, Double.valueOf(baseEntropy), \n baseLabelDistribution, Integer.valueOf(numSplitsForBestFeature)};\n\n double avgInfoGain = infoGainSum / totalNumSplitPoints;\n double maxGainRatio = 0;\n double gainForMaxGainRatio = 0; // tie breaker\n \n int xxx = 0;\n \n \n for (int fi = 0; fi < dataDict.size(); fi++) {\n double featureMaxGainRatio = 0;\n double featureGainForMaxGainRatio = 0;\n double bestSplitPoint = Double.NaN;\n\n for (Iterator iter = featureToInfo[fi].keySet().iterator(); iter.hasNext(); ) {\n Object key = iter.next();\n Point2D.Double pt = (Point2D.Double) featureToInfo[fi].get(key);\n double splitPoint = ((Double) key).doubleValue();\n double infoGain = pt.getX();\n double gainRatio = pt.getY();\n\n if (infoGain >= avgInfoGain) {\n if (gainRatio > featureMaxGainRatio || (gainRatio == featureMaxGainRatio && infoGain > featureGainForMaxGainRatio)) {\n featureMaxGainRatio = gainRatio;\n featureGainForMaxGainRatio = infoGain;\n bestSplitPoint = splitPoint;\n }\n }\n else {\n xxx++;\n }\n \n }\n assert(! Double.isNaN(bestSplitPoint));\n gainRatios[fi] = featureMaxGainRatio;\n splitPoints[fi] = bestSplitPoint;\n\n if (featureMaxGainRatio > maxGainRatio || (featureMaxGainRatio == maxGainRatio && featureGainForMaxGainRatio > gainForMaxGainRatio)) {\n maxGainRatio = featureMaxGainRatio;\n gainForMaxGainRatio = featureGainForMaxGainRatio;\n numSplitsForBestFeature = featureToInfo[fi].size();\n }\n }\n \n logger.info(\"label distrib:\\n\" + baseLabelDistribution);\n logger.info(\"base entropy=\" + baseEntropy + \", info gain sum=\" + infoGainSum + \", total num split points=\" + totalNumSplitPoints + \", avg info gain=\" + avgInfoGain + \", num splits with < avg gain=\" + xxx);\n \n return new Object[] {gainRatios, splitPoints, Double.valueOf(baseEntropy), \n baseLabelDistribution, Integer.valueOf(numSplitsForBestFeature)};\n }", "private void setMaxThreshold() {\n maxThreshold = value - value * postBoundChange / 100;\n }", "@Override\n\tpublic int select_arm() {\n\t\tint countsSum = 0;\n\t\t\n\t\tfor(int arm : m_counts){\n\t\t\tif(arm == 0) return arm;\n\t\t\tcountsSum += arm;\n\t\t}\n\t\t\n\t\tdouble max = 0;\n\t\tint max_indx = 0;\n\t\tfor(int i = 0; i<m_counts.length; i++){\n\t\t\tdouble bonus = Math.sqrt((2 * Math.log(countsSum)) / m_counts[i]);\n\t\t\tdouble ucb_value = m_values[i] + bonus;\n\t\t\tif(ucb_value > max){ \n\t\t\t\tmax = ucb_value;\n\t\t\t\tmax_indx = i;\n\t\t\t}\n\t\t}\n\t\treturn max_indx;\n\t}", "double getCritChance();", "public float getConfidence();", "ProbeLevel minimumLevel();", "private HashMap<String, int[] > getAttrClassRatio ( ArrayList<String> alCalcAttr, ArrayList<String> alClasAttr ) {\r\n\t\tHashMap< String, int[] > attrClassRatioMap = new HashMap<String, int[] >();\r\n\t\tString classA = alClasAttr.get(0);\r\n\t\tfor ( int i = 0; i < alCalcAttr.size(); i++ ) {\r\n\t\t\tString attr = alCalcAttr.get(i);\r\n\t\t\tString classification = alClasAttr.get(i);\r\n\t\t\tif ( !attrClassRatioMap.containsKey(attr) ) {\r\n\t\t\t\tattrClassRatioMap.put( attr, new int[2] );\r\n\t\t\t}\r\n\t\t\tif ( classA.equals( classification ) ) {\r\n\t\t\t\tint[] classCount = attrClassRatioMap.get( attr );\r\n\t\t\t\t++classCount[0];\r\n\t\t\t\tattrClassRatioMap.put( attr, classCount );\r\n\t\t\t} else {\r\n\t\t\t\tint[] classCount = attrClassRatioMap.get( attr );\r\n\t\t\t\t++classCount[1];\r\n\t\t\t\tattrClassRatioMap.put( attr, classCount );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn attrClassRatioMap;\r\n\t}", "private boolean holds(int attrIndex, double value) {\n\t\n if (numAttributes() == 0)\n\treturn false;\n\t\n if(attribute(attrIndex).isNumeric())\n\treturn(m_MinBorder[attrIndex] <= value && value <= m_MaxBorder[attrIndex]);\n else\n\treturn m_Range[attrIndex][(int) value];\n }", "private int getDominantI(float[] l) {\n float max = 0;\n int maxi = -1;\n for(int i=0;i<l.length;i++) {\n if (l[i]>max)\n max = l[i]; maxi = i;\n }\n return maxi;\n }", "public int getLowerThreshold() {\n return lowerThreshold;\n }", "public final double getRecommendedThreshold(double safetyFactor){\n\t\t\n\t\tdouble toReturn = 0;\n\t\t\n\t\t// if there is no value, then the recommended threshold calculation is meaningless\n\t\tif(values.length < 2)\n\t\t\treturn NO_RECOMMENDED_THRESHOLD;\n\n\t\t\n\t\t\n\t\t// get the minimum and the maximum value from last [priorityArray.length] data\n\t\tdouble min = values[0], max = values[0];\n\t\t\n\t\tfor(int i = 0; i < values.length; i++){\n\t\t\tif(values[i] < min)\n\t\t\t\tmin = values[i];\n\t\t\tif(values[i] > max)\n\t\t\t\tmax = values[i];\n\t\t}\n\t\t\n\t\tif( (Math.abs(lastResultValue - max)) > (Math.abs(lastResultValue - min)) )\n\t\t\ttoReturn = safetyFactor * (Math.abs((lastResultValue - max)));\n\t\telse\n\t\t\ttoReturn = safetyFactor * (Math.abs((lastResultValue - min)));\n\t\t\n\t\t\n\t\treturn toReturn;\n\t}", "String getConfidence();", "protected void calculateAccuracyOfTestFile( double threshold, String test_file_name ) throws FileNotFoundException\n\t{\n\t\ttry\n\t\t{\n\t\t\tFile test_file = new File( test_file_name );\n\t\t\tScanner in;\n\t\t\tString[] tokens;\n\t\t\tint total_tokens = 0, total_matched = 0, n, result;\n\t\t\tdouble sum;\n\t\t\tAttribute temp;\n\n\t\t\tin = new Scanner( test_file );\n\t\t\tin.nextLine();\n\n\t\t\twhile ( in.hasNextLine() )\n\t\t\t{\n\t\t\t\ttokens = in.nextLine().trim().split( \"\\\\s+\" );\n\t\t\t\tn = tokens.length;\n\t\t\t\tif ( n > 1 )\n\t\t\t\t{\n\t\t\t\t\ttemp = this.attribute_list.get( 0 );\n\t\t\t\t\tsum = temp.getWeigth();\n\n\t\t\t\t\tfor ( int i = 1; i < n; i++ )\n\t\t\t\t\t{\n\t\t\t\t\t\ttemp = this.attribute_list.get( i );\n\t\t\t\t\t\tsum += Integer.parseInt( tokens[ i - 1 ] ) * temp.getWeigth();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( sum < threshold )\n\t\t\t\t\t\tresult = 0;\n\t\t\t\t\telse\n\t\t\t\t\t\tresult = 1;\n\n\t\t\t\t\tif ( Integer.parseInt( tokens[ n - 1 ] ) == result )\n\t\t\t\t\t\ttotal_matched++;\n\n\t\t\t\t\ttotal_tokens++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tDecimalFormat df = new DecimalFormat( \"#.##\" );\n\t\t\tSystem.out.println( \"Accuracy of test data ( \" + total_tokens + \" instances ) = \" + df.format( total_matched * 100.00 / total_tokens ) );\n\n\t\t\tin.close();\n\t\t}\n\t\tcatch ( FileNotFoundException e )\n\t\t{\n\t\t\tSystem.out.println( \"Cannot find test file - \" + test_file_name );\n\t\t\tthrow e;\n\t\t}\n\t}", "public void writeAttributeAssociations(String inputFilename, String outputFilename, int maxAssociations){\r\n\t\ttry {\r\n\t\t\tFile aFile = new File(inputFilename);\r\n\t\t\t\r\n\t\t\tif (!aFile.exists()) {\r\n\t\t\t\tthrow new IOException();\r\n\t\t\t}\r\n\t\t\tif (!aFile.isFile()) {\r\n\t\t\t\tthrow new IOException();\r\n\t\t\t}\r\n\t\t\tif (!aFile.canRead()) {\r\n\t\t\t\tthrow new IOException();\r\n\t\t\t}\r\n\t\r\n\t\t File awFile = new File(outputFilename);\r\n\t\t Writer output = new BufferedWriter( new FileWriter(awFile) );\r\n\t\t ArrayList<AttributeValue<String>> tokensList = new ArrayList<AttributeValue<String>>(300);\r\n\t\t float[] logProbOfAttributeGivenCluster = new float[numberOfExperts];\r\n\t\t double[][] logQuant = new double[numberOfExperts][];\r\n\t\t for (int c=0; c<numberOfExperts; c++)\r\n\t\t \tlogQuant[c] = new double[numberOfExperts];\r\n\t\t \r\n\t\t // Calculate the distinctiveness of each attribute, i.e p(c|att)/p(c) for each cluster\r\n\t\t ArrayList<HashMap<String,Float>> attributeScores = null;\r\n\t \r\n\t \tFileReader fr = new FileReader(aFile);\r\n\t \tBufferedReader br = new BufferedReader(fr);\r\n\t \tString lineStr;\r\n\t \twhile ((lineStr = br.readLine()) != null) {\r\n\t \t\tString[] st = lineStr.split(\",\");\r\n\t \t\tString category = st[0];\r\n\t \t\tStringBuffer sb2 = new StringBuffer();\r\n\t \t\tsb2.append(\"\\\"\" + category + \"\\\"\");\r\n\t \t\t\r\n\t \t\tboolean found=false;\r\n\r\n\t \t\t// Compute p(c|list_of_seed_terms)\r\n\t \t\tfor (int c=0; c<numberOfExperts; c++)\r\n\t \t\t\tfor (int r=0; r<numberOfExperts; r++)\r\n\t \t\t\t\tlogQuant[r][c] = logProbOfCluster[r] - logProbOfCluster[c];\r\n\t \t\tfor (int i=1; i<st.length; i++){\r\n\t \t\t\tInteger indx = attribute2Index.get(st[i]);\r\n\t \t\t\tif (indx == null)\r\n\t \t\t\t\tcontinue;\r\n \t\t\r\n\t \t\t\tfound=true;\r\n// \t\tSystem.out.print(\" \" + st[i]);\r\n\t \t\t\tsb2.append(\",\\\"\"); sb2.append(st[i]); sb2.append(\"\\\"\");\r\n\t \t\t\tint attribute = indx.intValue();\r\n\t \t\t\tgetAttributeClusterLogProbs(attribute,logProbOfAttributeGivenCluster);\r\n\t \t\t\tfor (int c=0; c<numberOfExperts; c++)\r\n\t \t\t\t\tfor (int r=0; r<numberOfExperts; r++){\r\n\t \t\t\t\t\tlogQuant[r][c] += logProbOfAttributeGivenCluster[r] - logProbOfAttributeGivenCluster[c];\r\n\t \t\t\t\t}\r\n\t \t\t}\r\n\t \t\tsb2.append(\"\\n\");\r\n \t\r\n \t\r\n\t \t\tif (! found){\r\n\t \t\t\tStringBuffer sb = new StringBuffer();\r\n\t \t\t\tsb.append(\"\\\"\" + category + \"\\\"\");\r\n\t \t\t\tsb.append(\",\\\"NULL\\\"\\n\"); \r\n//\t \t\t\toutput.write(sb2.toString());\r\n \t\toutput.write(sb.toString());\r\n\t \t\t\tcontinue;\r\n\t \t\t}\r\n\r\n \t\r\n\t \t\tdouble[] conditionalProb = new double[numberOfExperts];\r\n\t \t\tfor (int c=0; c<numberOfExperts; c++){\r\n\t \t\t\tboolean zeroProb = false;\r\n\t \t\t\tfor (int r=0; r<numberOfExperts; r++){\r\n\t \t\t\t\tif (logQuant[r][c] > 15.0){\r\n\t \t\t\t\t\tconditionalProb[c] = 0.0;\r\n\t \t\t\t\t\tzeroProb = true;\r\n\t \t\t\t\t\tbreak;\r\n\t \t\t\t\t}\r\n\t \t\t\t\telse {\r\n\t \t\t\t\t\tconditionalProb[c] += Math.exp(logQuant[r][c]);\r\n\t \t\t\t\t}\r\n\t \t\t\t}\r\n\t \t\t\tif (! zeroProb)\r\n\t \t\t\t\tconditionalProb[c] = 1.0 / conditionalProb[c];\r\n\t \t\t}\r\n\r\n\t \t\ttokensList.clear();\r\n\t \t\tfor (int i=0; i<numberOfAttributes; i ++){\r\n\t \t\t\tfloat score = 0.0f;\r\n\t \t\t\tfor (int c=0; c<numberOfExperts; c ++){\r\n\t \t\t\t\tif (! attributeScores.get(c).containsKey(attributeName.get(i))){\r\n\t \t\t\t\t\tcontinue;\r\n\t \t\t\t\t}\r\n\t \t\t\t\tFloat dprob=attributeScores.get(c).get(attributeName.get(i));\r\n\t \t\t\t\tscore += dprob.floatValue() * conditionalProb[c];\r\n\t \t\t\t}\r\n\t \t\t\tif (score > 0.0f)\r\n\t \t\t\t\ttokensList.add(new AttributeValue<String>(attributeName.get(i), score));\r\n\t \t\t}\r\n\t \t\tCollections.sort(tokensList);\r\n\t \t\tint associationsShown=0;\r\n\t \t\tStringBuffer sb = new StringBuffer();\r\n\t \t\tfor (AttributeValue<String> attObj : tokensList){\r\n\t \t\t\tfloat score = attObj.getValue();\r\n\t \t\t\tString attribute = attObj.getIndex();\r\n\r\n\t \t\t\tif (associationsShown >= maxAssociations)\r\n\t \t\t\t\tbreak;\r\n\r\n\t \t\t\tsb.append(\"\\\"\" + category + \"\\\"\");\r\n\t \t\t\tsb.append(\",\\\"\"); sb.append(attribute); sb.append(\"\\\",\"); sb.append(score); sb.append(\"\\n\");\r\n\r\n\t \t\t\tassociationsShown ++;\r\n\t \t\t}\r\n // \toutput.write(sb2.toString());\r\n\t \t\toutput.write(sb.toString());\r\n\t \t}\r\n\t \toutput.close();\r\n\t }\r\n\t catch (IOException e){\r\n\t \te.printStackTrace();\r\n\t \tSystem.exit(1);\r\n\t }\r\n\t}", "private TargetInformation findHighGoal(Mat image) {\r\n\t\tTargetInformation ret = new TargetInformation();\r\n\t\tret.targetingPeg = false;\r\n\t\t\r\n long[] xsums = sums(image, true);\r\n long[] ysums = sums(image, false);\r\n \r\n\t List<PeakLoc> xpeaks = findPeaks(xsums, 10);\r\n\t List<PeakLoc> ypeaks = findPeaks(ysums, 10);\r\n\r\n\t if (ypeaks.size() == 2 && xpeaks.size() > 0) {\r\n\t \tret.targetFound = true;\r\n\t \tret.x = (xpeaks.get(0).getStop() - xpeaks.get(0).getStart()) / 2;\r\n\t \tret.gap = ypeaks.get(1).getStart() - ypeaks.get(0).getStop();\r\n\t \tret.width = xpeaks.get(0).getStop() - xpeaks.get(0).getStart();\r\n\t \tret.height = ypeaks.get(1).getStop() - ypeaks.get(0).getStart();\r\n\t \tret.y = (ypeaks.get(0).getStop() + ypeaks.get(1).getStart())/2;\r\n\t \t\r\n\t \tdouble pixelsPerInch = ret.gap / highGoalGapInches;\r\n\t \tif (xpeaks.get(0).isTruePeak() && xpeaks.get(1).isTruePeak())\r\n\t \t{\r\n\t \t\tpixelsPerInch = (pixelsPerInch + ret.width / highGoalWidthInches) / 2;\r\n\t \t}\r\n\t \tif (ypeaks.get(0).isTruePeak())\r\n\t \t{\r\n\t \t\tif (xpeaks.get(0).isTruePeak() && xpeaks.get(1).isTruePeak())\r\n\t \t\t{\r\n\t \t\t\tpixelsPerInch = (pixelsPerInch * 2 + ret.width / highGoalHeightInches) / 3;\r\n\t \t\t}\r\n\t \t\telse\r\n\t \t\t{\r\n\t \t\t\tpixelsPerInch = (pixelsPerInch + ret.width / highGoalHeightInches) / 2;\r\n\t \t\t}\r\n\t \t} \t\r\n\t \t\r\n\t \tret.aimX = ret.x + (cameraOffsetInches - shooterOffsetInches) * pixelsPerInch;\r\n\t \t\r\n\t \tret.correctionAngle = (double)((ret.aimX - image.cols() / 2)) / pixelsPerXDegree;\r\n\t }\r\n\t else\r\n\t {\r\n\t \tret.targetFound = false;\r\n\t }\r\n\t \r\n\t return ret;\r\n\t}", "public int countClassAttribute(String[][] examples, String attribute,\n String attributeValue, String classification) {\n\n int num = 0;\n\n for (int i = 0; i < examples.length; i++) {\n for (int j = 0; j < examples[0].length; j++) {\n\n if (examples[0][j].equalsIgnoreCase(attribute)\n && examples[i][j].equalsIgnoreCase(attributeValue)\n && examples[i][examples[0].length - 1]\n .equalsIgnoreCase(classification)) {\n num++;\n }\n\n }\n }\n\n return num;\n }", "public double getThresholdMultiplier() {\n\t\treturn m_thresholdMultiplier;\n\t}", "public BigDecimal entropyfAttributewithCutpoint(int attrNo){\r\n\t\tint tempCutpoint = cutPointsNumber[attrNo];\r\n\t\tBigDecimal[] blocks = new BigDecimal[tempCutpoint];\r\n\t\tBigDecimal startpoint,endpoint;\r\n\t\tBigDecimal[] maxmin = originalTable.calcuateMaxandMinAttribute(attrNo);\r\n\t\tstartpoint = maxmin[1];\r\n\t\tendpoint = maxmin[0];\r\n\t\tBigDecimal interval = maxmin[0].subtract(maxmin[1]).divide(new BigDecimal(tempCutpoint+1),3, RoundingMode.HALF_UP);\r\n\t\tfor(int i = 0;i < tempCutpoint;i++){\r\n\t\t\tblocks[i] = maxmin[1].add(interval.multiply(new BigDecimal(i+1)));\r\n\t\t}\r\n\t\tEntropyCalculation entropyCalcul = new EntropyCalculation(originalTable, attrNo, blocks, startpoint, endpoint);\r\n\t\tentropyCalcul.dispatchCaseMapConceptoDifferentSets();\r\n\t\tBigDecimal result = entropyCalcul.calculatetheEntroy(true);\r\n\t\treturn result;\r\n\t}", "public double calculateInformationGain (AbstractRule A, AbstractRule B)\n\t{\n\t\tdouble a = Math.log((double)(A.getPM() + C1)/(double)(A.getPM() + A.getNM() + C2))/Math.log(2);\n\t\tdouble b = Math.log((double)(B.getPM() + C1)/(double)(B.getPM() + B.getNM() + C2))/Math.log(2);\n\t\treturn a - b;\n\t}", "float getFixedHotwordGain();", "public Object[] argmax(float[] array) {\n int best = -1;\n float best_confidence = 0.0f;\n\n for (int i = 0; i < array.length; i++) {\n\n float value = array[i];\n\n if (value > best_confidence) {\n\n best_confidence = value;\n best = i;\n }\n }\n return new Object[]{best, best_confidence};\n }", "int findMax(List<double[]> x){\n List<double[]> maxInfo = new ArrayList<>();\n boolean increasing = false;\n double maxNum = x.get(0)[0];\n double maxFrame = 1;\n double slope = 0;\n for(int i = 0; i<x.size()-1;i++){\n System.out.println(x.get(i)[0]);\n if(x.get(i+1)[0] < x.get(i)[0]){\n increasing = true;\n slope = x.get(i+1)[0] - x.get(i)[0];\n maxNum = x.get(i+1)[0];\n maxFrame = x.get(i+1)[1];\n }\n else if(x.get(i+1)[0] > x.get(i)[0] && increasing && maxNum<150){\n System.out.println(\"PEAK: \" + maxNum + \",\" + maxFrame);\n increasing = false;\n maxInfo.add(new double[]{maxNum, maxFrame});\n maxNum = 0;\n maxFrame = 0;\n }\n }\n //removes false peaks with close frame tag near each other\n for(int i = 0; i < maxInfo.size()-1;i++){\n if(maxInfo.get(i+1)[1] - maxInfo.get(i)[1] <=10){\n System.out.println(\"REMOVED \" + maxInfo.get(i+1)[0]);\n maxInfo.remove(i+1);\n }\n }\n return maxInfo.size();\n }", "public double getHighestConfidence() {\n\t\tdouble best = Double.MIN_VALUE;\n\n\t\tfor (ResultConfidencePairing rcp : m_results) {\n\t\t\tif (rcp.getConfidence() > best)\n\t\t\t\tbest = rcp.getConfidence();\n\t\t}\n\t\treturn best;\n\t}", "@SuppressWarnings(\"boxing\")\n public void matchAttributes(String type, double cutoff) {\n\n MWBMatchingAlgorithm mwbm =\n new MWBMatchingAlgorithm(this.train.numAttributes(), this.test.numAttributes());\n\n if (type.equals(\"spearman\")) {\n this.spearmansRankCorrelation(cutoff, mwbm);\n }\n else if (type.equals(\"ks\")) {\n this.kolmogorovSmirnovTest(cutoff, mwbm);\n }\n else if (type.equals(\"percentile\")) {\n this.percentiles(cutoff, mwbm);\n }\n else {\n throw new RuntimeException(\"unknown matching method\");\n }\n\n // resulting maximal match gets assigned to this.attributes\n int[] result = mwbm.getMatching();\n for (int i = 0; i < result.length; i++) {\n\n // -1 means that it is not in the set of maximal matching\n if (i != -1 && result[i] != -1) {\n this.p_sum += mwbm.weights[i][result[i]]; // we add the weight of the returned\n // matching for scoring the complete\n // match later\n this.attributes.put(i, result[i]);\n }\n }\n }", "private static String bmiClassification (Double bmi) {\n String bmiToString = \"\";\n\n if (bmi < 18.5)\n bmiToString = \"Underweight\";\n else if (bmi < 25.0)\n bmiToString = \"Normal\";\n else if (bmi < 30.0)\n bmiToString = \"Overweight\";\n else if (bmi >= 30.0)\n bmiToString = \"Obese\";\n\n return bmiToString;\n }", "public void calculateEffectiveness(){\n double[] typeEffective = new double[18];\n \n for(int i = 0; i < 18; i++){\n typeEffective[i] = tc.getEffectiveNumber(i, tc.convertType(type1));\n }\n \n if(type2 != null){\n for(int i = 0; i < 18; i++){\n typeEffective[i] *= tc.getEffectiveNumber(i, tc.convertType(type2));\n }\n }\n \n for(int i = 0; i < 18; i++){\n if(typeEffective[i] != 1){\n if(typeEffective[i] > 1){\n double[] newWeak = {i,typeEffective[i]};\n weak.add(newWeak);\n }else{\n double[] newStrong = {i,typeEffective[i]};\n strong.add(newStrong);\n }\n }\n }\n }", "private void computeTargetContrib(final int[][] pix) {\n \t\t// NB: Computation could certainly be made more efficient, but this\n \t\t// method is performant enough and hopefully easy to understand.\n \n \t\t// compute minimum scale factor needed for desired image\n \t\t//\n \t\t// TODO: rather than scaling up and comparing... search for maxContrib\n \t\t// directly? Need to robustly convert from maxContrib to the four bin\n \t\t// ranges. Look at various GitHub users to derive the formula.\n \t\t// Can still use the same strategy of looping only once through (y, x),\n \t\t// increasing maxContrib as needed when one of the pixels fails.\n \t\t//\n \t\t// Also should think about what to do if *no* pixel has max value...\n \t\t// for now might be easiest to just document that such is unsupported.\n \t\tint scale = 1;\n \t\tfor (int y = 0; y < CAL_HEIGHT; y++) {\n \t\t\tfor (int x = 0; x < CAL_WIDTH; x++) {\n \t\t\t\tif (contrib[y][x] == null) continue;\n \t\t\t\twhile (contrib[y][x].current > scale(pix[y][x], scale)) {\n \t\t\t\t\tscale++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tdebug(\"Scale factor = \" + scale);\n \n \t\t// populate new contribution matrix\n \t\tmaxContrib = scale(0, scale);\n \t\tboolean maxFulfilled = false;\n \t\tfor (int y = 0; y < CAL_HEIGHT; y++) {\n \t\t\tfor (int x = 0; x < CAL_WIDTH; x++) {\n \t\t\t\tif (contrib[y][x] == null) continue;\n \t\t\t\tfinal int target = scale(pix[y][x], scale, maxFulfilled);\n \t\t\t\tif (target == maxContrib) maxFulfilled = true;\n \t\t\t\tcontrib[y][x].target = target;\n \t\t\t}\n \t\t}\n \t}", "public int getLowerThreshold() {\r\n\t\tint lowerThreshold;\r\n\t\tlowerThreshold=this.lowerThreshold;\r\n\t\treturn lowerThreshold;\r\n\t}", "public double getPercentThreshold()\n {\n return percentThreshold;\n }", "public final void updateThreshold(double newThreshold){\n\t\t\n\t\tif(newThreshold != SignalSmoother.NO_RECOMMENDED_THRESHOLD){\n\t\t\t\n\t\t\tif(newThreshold == Double.valueOf(0)){\n\t\t\t\tthis.isThresholdUsingEnabled = THRESHOLD_STATE_DISABLED;\n\t\t\t}else\n\t\t\t\tthis.threshold = Math.abs(newThreshold);\n\t\t\t\n\t\t}\n\t\t\n\t}", "public double getProficiency(DefaultActivity i) {\n ActivityTypes subType = i.getActivityType();\n double proficiency = 0.0;\n int count = 1;\n switch (subType) {\n case SLEEP: //day\n for (String keyValue : i.getName().split(\" \")) {\n if (keyValue.length() >= 3) {\n if (sleepMap.get(keyValue) != null) {\n if (sleepMap.get(keyValue) <= 3) {\n proficiency += sleepMap.get(keyValue) * 100;\n count += sleepMap.get(keyValue);\n }\n } else {\n proficiency += 30;\n count++;\n }\n proficiency += proficiency / count;\n }\n }\n return proficiency;\n case MEAL: //day\n for (String keyValue : i.getName().split(\" \")) {\n if (keyValue.length() >= 4) {\n if (mealMap.get(keyValue) != null) {\n if (mealMap.get(keyValue) >= 4) {\n proficiency += mealMap.get(keyValue) * 100;\n count += mealMap.get(keyValue);\n }\n } else {\n proficiency += 30;\n }\n proficiency += proficiency / count;\n }\n }\n return proficiency;\n case TESTSTUDY: //week\n for (String keyValue : i.getName().split(\" \")) {\n if (keyValue.length() >= 4) {\n if (testMap.get(keyValue) != null) {\n if (testMap.get(keyValue) > 4) {\n proficiency += testMap.get(keyValue) * 100;\n count += testMap.get(keyValue);\n }\n } else {\n proficiency += 25;\n }\n proficiency += proficiency / count;\n }\n }\n return proficiency;\n default:\n return 50;\n }\n }", "private double getMinThreshold() {\n return minThreshold;\n }", "int getLikelihoodValue();", "private long getAlpha(long minCardinality, long maxCardinality, float threshold) {\n\treturn (long) ((minCardinality - (threshold * maxCardinality)) / (1 + threshold));\n }", "private int GetBestCard(Card[] card) {\n\t int iPos = 0;\n\t int iWeightTemp = 0;\n\t int iWeight[] = new int[8];\n\t for (int i = 0; i < 8; i++){\n\t\t iWeight[i] = -1;\n\t }\n\t // For each selectable card, work out a weight, the highest weight is the one selected.\n\t // The weight is worked out by the distance another of the players cards is from playable ones, with no playable cards in between\n\t Card myCard, nextCard;\n\t for (int i = 0; i < 8; i++){\n\t\t if (card[i] != null){\n\t\t\t // if card value > 7\n\t\t\t if (card[i].GetValue() > 7){\n\t\t\t\t // do you have cards that are higher than this card\n\t\t\t\t myCard = card[i];\n\t\t\t\t iWeightTemp = 0;\n\t\t\t \tfor (int j = 0; j < mCardCount; j++){\n\t\t\t \t\tnextCard = mCard[j];\n\t\t\t \t\tif (nextCard != null && nextCard.GetSuit() == myCard.GetSuit() && nextCard.GetValue() > myCard.GetValue()){\n\t\t\t \t\t\tif (nextCard.GetValue() - myCard.GetValue() > iWeightTemp)\n\t\t\t \t\t\t\tiWeightTemp = nextCard.GetValue() - myCard.GetValue();\n\t\t\t \t\t\tmyCard = nextCard;\n\t\t\t \t\t}\n\t\t\t \t}\n\t\t\t \tiWeight[i] = iWeightTemp;\n\t\t\t \t\t\n\t\t\t }\n\t\t\t if (card[i].GetValue() < 7){\n\t\t\t\t // do you have cards that are lower than this card\n\t\t\t\t myCard = card[i];\n\t\t\t\t iWeightTemp = 0;\n\t\t\t \tfor (int j = mCardCount-1; j >=0; j--){\n\t\t\t \t\tnextCard = mCard[j];\n\t\t\t \t\tif (nextCard != null && nextCard.GetSuit() == myCard.GetSuit() && nextCard.GetValue() < myCard.GetValue()){\n\t\t\t \t\t\tif (myCard.GetValue() - nextCard.GetValue() > iWeightTemp)\n\t\t\t \t\t\t\tiWeightTemp = myCard.GetValue() - nextCard.GetValue();\n\t\t\t \t\t\tmyCard = nextCard;\n\t\t\t \t\t}\n\t\t\t \t}\n\t\t\t \tiWeight[i] = iWeightTemp;\n\t\t\t \t\t\n\t\t\t }\t\n\t\t\t if (card[i].GetValue() == 7){\n\t\t\t\t // do you have cards that are in this suit\n\t\t\t\t myCard = card[i];\n\t\t\t\t int iWeightTemp1;\n\t\t\t\t iWeightTemp = 0;\n\t\t\t\t iWeightTemp1 = 0;\n\t\t\t\t // do you have cards that are higher than this card\n\t\t\t \tfor (int j = 0; j < mCardCount; j++){\n\t\t\t \t\tnextCard = mCard[j];\n\t\t\t \t\tif (nextCard != null && nextCard.GetSuit() == myCard.GetSuit() && nextCard.GetValue() > myCard.GetValue()){\n\t\t\t \t\t\tif (nextCard.GetValue() - myCard.GetValue() > iWeightTemp)\n\t\t\t \t\t\t\tiWeightTemp = nextCard.GetValue() - myCard.GetValue();\n\t\t\t \t\t\tmyCard = nextCard;\n\t\t\t \t\t}\n\t\t\t \t}\n\t\t\t \tmyCard = card[i];\n\t\t\t \t// do you have cards that are lower than this card\n\t\t\t \tfor (int j = mCardCount-1; j >=0; j--){\n\t\t\t \t\tnextCard = mCard[j];\n\t\t\t \t\tif (nextCard != null && nextCard.GetSuit() == myCard.GetSuit() && nextCard.GetValue() < myCard.GetValue()){\n\t\t\t \t\t\tif (myCard.GetValue() - nextCard.GetValue() > iWeightTemp1)\n\t\t\t \t\t\t\tiWeightTemp1 = myCard.GetValue() - nextCard.GetValue();\n\t\t\t \t\t\tmyCard = nextCard;\n\t\t\t \t\t}\n\t\t\t \t} \t\n\t\t\t \tiWeight[i] = iWeightTemp + iWeightTemp1;\n\t\t\t \t\t\n\t\t\t }\t\t\t \n\t\t }\n\t\t \t \n\t }\n\t boolean bLoopAceKing = true;\n\t int iMaxTemp = 0;\n\t int iMaxCount = 0;\t\n\t int[] iMaxs;\n\t iMaxs = new int[8];\n\t while (bLoopAceKing){\n\t\t for (int i = 0; i < 8; i++){\n\t\t\t if (iWeight[i] >= iMaxTemp){\n\t\t\t\t if (iWeight[i] == iMaxTemp){\n\t\t\t\t\t iMaxs[iMaxCount] = i;\n\t\t\t\t\t iMaxCount++;\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t\t\t iMaxTemp = iWeight[i];\n\t\t\t\t\t iMaxs = new int[8];\n\t\t\t\t\t iMaxCount = 0;\n\t\t\t\t\t iMaxs[iMaxCount] = i;\n\t\t\t\t\t iMaxCount++;\n\t\t\t\t }\t\t\t \n\t\t\t }\t \n\t\t }\n\t\t boolean bAceKing = false;\n\t\t // If the top weight is zero, meaning your options don't help you, then play the one that is closest to ace/king\n\t\t if (iMaxTemp == 0 && iMaxCount > 1){\n\t\t\t for (int k = 0; k < iMaxCount; k++){\n\t\t\t\t\t iWeight[iMaxs[k]] = Math.abs(card[iMaxs[k]].GetValue()-7);\n\t\t\t\t\t bAceKing = true;\t\t\t\t \n\t\t\t } \t\t \n\t\t }\n\t\t if (bAceKing){\n\t\t\t bLoopAceKing = true;\n\t\t\t iMaxs = new int[8];\n\t\t\t iMaxTemp = 0;\n\t\t\t iMaxCount = 0;\t\t\t \n\t\t }\n\t\t else \n\t\t\t bLoopAceKing = false;\n\t }\n\t if (iMaxCount == 1)\n\t\t iPos = iMaxs[iMaxCount-1];\n\t else {\n\t\t Random generator = new Random();\n\t\t int randomIndex = generator.nextInt( iMaxCount );\n\t\t iPos = iMaxs[randomIndex];\n\t }\n\t\t \n\t return iPos;\n\t \n }", "public void setThreshold(int inputThreshold) {\r\n\t\tthis.threshold = inputThreshold;\r\n\t}", "private Map.Entry<Activity, Prediction> chooseBestPrediction(Map<Activity, Prediction> predictions) {\n \n Map.Entry<Activity, Prediction> prediction = null;\n int result1, result2, lastIndex;\n double probability1, probability2;\n \n \n for (Map.Entry<Activity, Prediction> entry : predictions.entrySet()) {\n \n if (prediction == null) {\n prediction = entry;\n } else {\n lastIndex = prediction.getValue().getObservations().length - 1;\n \n result1 = prediction.getValue().getPredictions()[lastIndex];\n probability1 = prediction.getValue().getProbability();\n result2 = entry.getValue().getPredictions()[lastIndex];\n probability2 = entry.getValue().getProbability();\n \n /*a result 1 means that an activity has been detected,\n * thus we prefer a result that predicts an activity*/\n if (result2 == 1 && result1 == 0)\n prediction = entry;\n \n /* if both predict an activity, or don't predict anything then\n * we take the probability into consideration */\n if (result1 == result2) {\n if (probability2 > probability1)\n prediction = entry;\n }\n \n }\n \n }\n \n return prediction;\n \n }", "private double attrWeight (int index) {\n return m_MI[index];\n }", "public static int findChannelWeight()\n {\n for (int i = 0; i < DCService.wifiScanList.size(); i++) {\n\n allFrequency.add(convertFrequencyToChannel(DCService.wifiScanList.get(i).frequency));\n Log.v(\"Channel + AP: \", String.valueOf(convertFrequencyToChannel(DCService.wifiScanList.get(i).frequency)) + \"->\" + String.valueOf(DCService.wifiScanList.get(i).SSID));\n }\n Log.v(\"All frequency:\",allFrequency.toString());\n\n double channelArray[] = new double[13];\n\n // Fill all the elements with 0\n Arrays.fill(channelArray,0);\n\n double factor = 0.20;\n\n for (int band:allFrequency)\n {\n for (int i=band-5 ;i<= band+6 ;i++)\n {\n if (i<1 || i>13)\n continue;\n channelArray[i-1] = (channelArray[i-1] + (6-Math.abs(i-band))*factor);\n }\n }\n Log.v(\"Channel Array:\",Arrays.toString(channelArray));\n\n // Minimum value of channel array\n int bestFoundChannel;\n\n // Find minimum value from the channel array\n double small = channelArray[0];\n int index = 0;\n for (int i = 0; i < channelArray.length; i++) {\n if (channelArray[i] < small) {\n small = channelArray[i];\n index = i;\n }\n }\n\n // Find in channel array the elements with minimum channel value\n ArrayList<Integer> bestFoundAvailableChannels = new ArrayList();\n for(int items = 0;items < channelArray.length;items++)\n {\n if(channelArray[items] == small)\n {\n bestFoundAvailableChannels.add(items);\n }\n }\n if(channelArray[6] < channelArray[0] && channelArray[6] <channelArray[11] )\n return 6;\n if(channelArray[11] < channelArray[0] && channelArray[11] < channelArray[6])\n return 11;\n //Log.v(\"Minimum Channel Value,Best Found Channel:\", String.valueOf(small) + \",\" + String.valueOf(bestFoundChannel));\n // Find a random available channel from best found available channels\n /* Random rand = new Random();\n Integer randGeneratedBestFoundChannel = (Integer) bestFoundAvailableChannels.get(rand.nextInt(bestFoundAvailableChannels.size())) + 1;\n Log.v(\"Generated Random Available Channel:\" ,randGeneratedBestFoundChannel.toString());\n *///return (randGeneratedBestFoundChannel + 1);\n\n return 1;\n\n }", "public int getMyNearbyThreshold() {\n return myNearbyThreshold;\n }", "public void setThreshold(double t)\n {\n this.threshold = t;\n }", "public int getThreshold() {\n/* 340 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public double getScore() {\n int as = this.attributes.size(); // # of attributes that were matched\n\n // we use thresholding ranking approach for numInstances to influence the matching score\n int instances = this.train.numInstances();\n int inst_rank = 0;\n if (instances > 100) {\n inst_rank = 1;\n }\n if (instances > 500) {\n inst_rank = 2;\n }\n\n return this.p_sum + as + inst_rank;\n }", "private float calculateMaxValue(int[] probes) {\r\n float max = 0f;\r\n float value;\r\n final int samples = experiment.getNumberOfSamples();\r\n for (int sample=0; sample<samples; sample++) {\r\n for (int probe=0; probe<probes.length; probe++) {\r\n value = experiment.get(probes[probe], sample);\r\n if (!Float.isNaN(value)) {\r\n max = Math.max(max, Math.abs(value));\r\n }\r\n }\r\n }\r\n return max;\r\n }", "public int getHighestCombatSkill() {\r\n int id = 0;\r\n int last = 0;\r\n for (int i = 0; i < 5; i++) {\r\n if (staticLevels[i] > last) {\r\n last = staticLevels[i];\r\n id = i;\r\n }\r\n }\r\n return id;\r\n }", "public static void main(String[] args) {\n\t\tList<String> attributeList = new ArrayList<>();\n\t\tattributeList.add(\"srvac/v-pen/c04-ch02inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-ch05-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-ch07-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-ch09-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-ch13-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-ch14-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-ch16inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-pen/c04-sept-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch02inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch04inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch05-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch06-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch07-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch07-2/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch08-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch09-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch09-2/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch12-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch13-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch14-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch15inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch16inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-ch22inj-1/pressure\");\n\t\tattributeList.add(\"srvac/v-ip/c04-sept-1/pressure\");\n\n\t\tList<String> selectionList = new ItemSelectionDialog(\n\t\t\t\t(JFrame) null, \"Attribute Selection\", attributeList, true).showDialog();\n\t\tif (selectionList.isEmpty())\n\t\t\tSystem.out.println(\"No Selection\");\n\t\telse {\n\t\t\tfor (String selection : selectionList)\n\t\t\t\tSystem.out.println(selection);\n\t\t}\n\t}", "public double findProb(Attribute attr) {\r\n\t\tif(!attrName.equals(attr.getName())){\r\n\t\t\treturn 0.0;\r\n\t\t}\r\n\t\tif(valInstances.size() == 0) {\r\n\t\t\t//debugPrint.print(\"There are no values for this attribute name...this should not happen, just saying\");\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tdouble occurenceCount = 0;\r\n\t\tfor(Attribute curAttr: valInstances) {\r\n\t\t\tif(curAttr.getVal().equals(attr.getVal())) {\r\n\t\t\t\toccurenceCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (double)occurenceCount / (double) valInstances.size();\r\n\t}", "private double efficientLInfinityDistance(Instance one, Instance two, double threshold) {\n\n double attributeDistance;\n double maxDistance = 0;\n\n for (int i = 0; i < one.numAttributes() - 1; i++) {\n attributeDistance = Math.abs(one.value(i) - two.value(i));\n\n if (attributeDistance > maxDistance) {\n maxDistance = attributeDistance;\n }\n if (maxDistance > threshold) {\n return Double.MAX_VALUE;\n }\n }\n\n return maxDistance;\n }", "public double confidenceHi(){\n return (this.average + (this.confidence_constant * this.std)/Math.sqrt((double) this.num_trials));\n }", "private FastVector getAccInstanceAttributes() {\n Attribute x_mean = new Attribute(\"x-axis mean\");\n Attribute x_var = new Attribute(\"x-axis var\");\n Attribute y_mean = new Attribute(\"y-axis mean\");\n Attribute y_var = new Attribute(\"y-axis var\");\n Attribute z_mean = new Attribute(\"z-axis mean\");\n Attribute z_var = new Attribute(\"z-axis var\");\n\n // Declare the class attribute along with its values\n FastVector fvClassVal = new FastVector(2);\n fvClassVal.addElement(\"none\");\n fvClassVal.addElement(\"tap\");\n Attribute classAttribute = new Attribute(\"theClass\", fvClassVal);\n\n // Declare the feature vector\n FastVector fvWekaAttributes = new FastVector(7);\n\n fvWekaAttributes.addElement(x_mean);\n fvWekaAttributes.addElement(x_var);\n fvWekaAttributes.addElement(y_mean);\n fvWekaAttributes.addElement(y_var);\n fvWekaAttributes.addElement(z_mean);\n fvWekaAttributes.addElement(z_var);\n fvWekaAttributes.addElement(classAttribute);\n\n// // Declare the numeric attributes\n// Attribute x_var = new Attribute(\"var_x\");\n// Attribute x_var_delta = new Attribute(\"delta_var_x\");\n// Attribute y_var = new Attribute(\"var_y\");\n// Attribute y_var_delta = new Attribute(\"delta_var_y\");\n// Attribute z_var = new Attribute(\"var_z\");\n// Attribute z_var_delta = new Attribute(\"delta_var_z\");\n//\n// // Declare the class attribute along with its values\n// FastVector fvClassVal = new FastVector(3);\n// fvClassVal.addElement(\"none\");\n// fvClassVal.addElement(\"motion\");\n// fvClassVal.addElement(\"tap\");\n// Attribute classAttribute = new Attribute(\"theClass\", fvClassVal);\n\n// // Declare the feature vector\n// FastVector fvWekaAttributes = new FastVector(7);\n//\n// fvWekaAttributes.addElement(x_var);\n// fvWekaAttributes.addElement(x_var_delta);\n// fvWekaAttributes.addElement(y_var);\n// fvWekaAttributes.addElement(y_var_delta);\n// fvWekaAttributes.addElement(z_var);\n// fvWekaAttributes.addElement(z_var_delta);\n// fvWekaAttributes.addElement(classAttribute);\n\n return fvWekaAttributes;\n }", "public double confidenceHi() {\n\t\treturn mean() + 1.96 * stddev() / Math.sqrt(threshold.length);\n\t}", "public boolean isOverThreshold(){return isOverThreshold;}", "public double confidenceHi() {\n return this.mean() + this.stddev() * 1.96 / Math.sqrt(this.threshold.length);\n\n }", "protected int getAction(TreeSet<ActionValueTuple> stateValueSet) {\r\n double lowValue = stateValueSet.first().value();\r\n double highValue = stateValueSet.last().value();\r\n double thresholdValue = highValue - (highValue - lowValue) * thresholdCurrent * random.nextDouble();\r\n while (!stateValueSet.isEmpty()) {\r\n ActionValueTuple actionValueTuple = stateValueSet.pollFirst();\r\n if (Objects.requireNonNull(actionValueTuple).value() >= thresholdValue) return actionValueTuple.action();\r\n }\r\n return -1;\r\n }", "static void getBiggestGain(long gain) {\n if (gain > biggestGain) {\n biggestGain = gain;\n }\n }", "private static int compareUnweighted(ArrayList<ActivityItem> trace, HashMap<Integer, ActivityPrediction> model) {\n Iterator traceIterator = trace.iterator();\n ActivityPrediction predictionItem = null;\n ActivityItem currentTraceItem;\n int result = 0;\n int traceID;\n if (traceIterator.hasNext()) {\n// get the current item in the trace and get the actual model id from it (needed to distinguish between AM and PM)\n currentTraceItem = (ActivityItem) traceIterator.next();\n traceID = ProcessMiningUtil.getProcessModelID(currentTraceItem.getStarttime(), currentTraceItem.getActivityId(), currentTraceItem.getSubactivityId());\n// find start node of the model representation\n if (model.containsKey(Fitness.getStartID(model))) {\n predictionItem = model.get(Fitness.getStartID(model));\n }\n if (predictionItem.getEdgeTargetMap().containsKey(traceID)) {\n predictionItem = model.get(traceID);\n }\n while (predictionItem.getActivityID() == traceID && traceIterator.hasNext()) {\n currentTraceItem = (ActivityItem) traceIterator.next();\n traceID = ProcessMiningUtil.getProcessModelID(currentTraceItem.getStarttime(), currentTraceItem.getActivityId(), currentTraceItem.getSubactivityId());\n if (predictionItem.getEdgeTargetMap().containsKey(traceID)) {\n predictionItem = model.get(traceID);\n } else {\n result = 0;\n break;\n }\n if (!traceIterator.hasNext()) {\n if (predictionItem.getEdgeTargetMap().containsKey(Fitness.getEndID(model))) {\n result = 1;\n break;\n }\n }\n }\n }\n return result;\n }", "public void setThreshold(float threshold){\n this.threshold = threshold;\n }", "public void combineThresholdsFromThresholdFiles(List<String> edgeThresholdFiles, String resultFile,\n\t\t\tboolean includeChipData) throws Exception {\n\t\tHdf5Helper hdf = Hdf5Helper.getInstance();\n\t\thdf.concatenateDataSetsFromFiles(edgeThresholdFiles, getEqualisationLocation(), THRESHOLD_DATASET, resultFile);\n\t\tif (includeChipData) {\n\t\t\thdf.concatenateDataSetsFromFiles(edgeThresholdFiles, getEqualisationLocation(), CHIP_PRESENT_DATASET,\n\t\t\t\t\tresultFile);\n\t\t\thdf.concatenateDataSetsFromFiles(edgeThresholdFiles, getEqualisationLocation(),\n\t\t\t\t\tCHIP_THRESHOLD_GAUSSIAN_SIGMA_DATASET, resultFile);\n\t\t\thdf.concatenateDataSetsFromFiles(edgeThresholdFiles, getEqualisationLocation(),\n\t\t\t\t\tCHIP_THRESHOLD_GAUSSIAN_HEIGHT_DATASET, resultFile);\n\t\t\thdf.concatenateDataSetsFromFiles(edgeThresholdFiles, getEqualisationLocation(),\n\t\t\t\t\tCHIP_THRESHOLD_GAUSSIAN_POSITION_DATASET, resultFile);\n\t\t}\n\n\t\tHDF5HelperLocations edgeloc = getEdgeThresholdsLocation();\n\t\thdf.writeAttribute(resultFile, Hdf5Helper.TYPE.DATASET, edgeloc, \"signal\", 1);\n\t\tVector<Hdf5HelperData> data = new Vector<Hdf5HelperData>();\n\t\tfor (String f : edgeThresholdFiles) {\n\t\t\tdata.add(hdf.readAttribute(f, Hdf5Helper.TYPE.DATASET, edgeloc.getLocationForOpen(), THRESHOLDABNVAL_ATTR));\n\t\t}\n\t\thdf.concatenateDataSets(data, getEqualisationLocation(), THRESHOLDABNVAL_DATASET, resultFile);\n\n\t\tHDF5HelperLocations thresholdLoc = getEqualisationLocation();\n\t\tthresholdLoc.add(THRESHOLDABNVAL_DATASET);\n\n\t\thdf.writeAttribute(resultFile, Hdf5Helper.TYPE.DATASET, thresholdLoc, \"axis\", 1);\n\t}", "public int getLevel(){\n \t\treturn (strength + intelligence + stamina + Math.abs(charm) + Math.abs(cuteness))/5;\n \t}", "private Object keyOfBestUnlabeledInstance(Classifier[] committee){\n\t\tdouble worstAgreement=2.0;\n\t\tObject queryKey=null;\n\t\tfor(Iterator<Double> i=unlabeled.keySet().iterator();i.hasNext();){\n\t\t\tObject key=i.next();\n\t\t\tInstance instance=unlabeled.get(key);\n\t\t\tTObjectDoubleHashMap counts=new TObjectDoubleHashMap();\n\t\t\tdouble biggestCount=0;\n\t\t\tfor(int j=0;j<committee.length;j++){\n\t\t\t\tString best=committee[j].classification(instance).bestClassName();\n\t\t\t\tdouble c=counts.get(best)+1;\n\t\t\t\tcounts.put(best,c);\n\t\t\t\tif(c>biggestCount)\n\t\t\t\t\tbiggestCount=c;\n\t\t\t}\n\t\t\tdouble agreement=biggestCount/committee.length;\n\t\t\tlog.info(\"instance: \"+instance+\" committee: \"+counts+\" agreement: \"+\n\t\t\t\t\tagreement);\n\t\t\tif(agreement<worstAgreement){\n\t\t\t\tworstAgreement=agreement;\n\t\t\t\tqueryKey=key;\n\t\t\t\tlog.debug(\" ==> best\");\n\t\t\t}\n\t\t}\n\t\tlog.info(\"queryInstance is: \"+unlabeled.get(queryKey));\n\t\treturn queryKey;\n\t}", "protected void calculateAccuracyOfTrainFile( double threshold )\n\t{\n\t\tint result = 0, n = this.class_data.attribute_data.size();\n\t\tdouble sum, total = 0;\n\t\tAttribute temp;\n\n\t\tfor ( int i = 0; i < n; i++ )\n\t\t{\n\t\t\tsum = 0;\n\t\t\tfor ( int j = 0; j < this.attribute_list.size(); j++ )\n\t\t\t{\n\t\t\t\ttemp = this.attribute_list.get( j );\n\t\t\t\tsum += temp.attribute_data.get( i ) * temp.getWeigth();\n\t\t\t}\n\n\t\t\tif ( sum < threshold )\n\t\t\t\tresult = 0;\n\t\t\telse\n\t\t\t\tresult = 1;\n\n\t\t\tif ( result == this.class_data.attribute_data.get( i ) )\n\t\t\t\ttotal++;\n\t\t}\n\n\t\tDecimalFormat df = new DecimalFormat( \"#.##\" );\n\t\tSystem.out.println( \"Accuracy of training file ( \" + n + \" instance ) = \" + df.format( (total * 100.00 / n) ) );\n\t}", "public Double getLastFirstAttScore(String methodName, Environment env);", "private int selectFeature(int[] partition, int[] features) {\r\n\t\tdouble[] probs = new double[classes.length]; // allocate space for\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// storing the ratio of\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// each output class\r\n\t\t// for each of the output classes\r\n\t\tfor (int c = 0; c < classes.length; c++) {\r\n\t\t\t// check how many samples that map to the class\r\n\t\t\tint[] subset = matches(partition, classes[c]);\r\n\t\t\t// calculate the ratio (to be seen as the probability of its\r\n\t\t\t// occurrence)\r\n\t\t\tprobs[c] = (double) subset.length / (double) partition.length;\r\n\t\t}\r\n\t\t// use the current partition's entropy as reference point\r\n\t\tdouble infoContent = infobits(probs);\r\n\t\t// while we iterate through possible features, keep track of the best\r\n\t\t// gain so far\r\n\t\tdouble bestGain = -.999;\r\n\t\tint bestFeature = features[0];\r\n\t\tfor (int a = 0; a < features.length; a++) {\r\n\t\t\tdouble remainder = 0;\r\n\t\t\t// extract which samples that have the true value in the studied\r\n\t\t\t// feature\r\n\t\t\tint[] subsetTrue = matches(partition, features[a], true);\r\n\t\t\t// extract which samples that have the false value in the studied\r\n\t\t\t// feature\r\n\t\t\tint[] subsetFalse = matches(partition, features[a], false);\r\n\t\t\t// there will be two probability distributions (one for each of the\r\n\t\t\t// above subsets) over the classes\r\n\t\t\tdouble[] probsTrue = new double[classes.length];\r\n\t\t\tdouble[] probsFalse = new double[classes.length];\r\n\t\t\t// check so that we have two groups of samples\r\n\t\t\tif (subsetTrue.length != 0 && subsetFalse.length != 0) {\r\n\t\t\t\t// if so, go through each of the output classes\r\n\t\t\t\tfor (int c = 0; c < classes.length; c++) {\r\n\t\t\t\t\t// and extract the samples that match them, to be used for\r\n\t\t\t\t\t// determining the probability distributions\r\n\t\t\t\t\tint[] subset = matches(subsetTrue, classes[c]);\r\n\t\t\t\t\tprobsTrue[c] = (double) subset.length\r\n\t\t\t\t\t\t\t/ (double) subsetTrue.length;\r\n\t\t\t\t\tsubset = matches(subsetFalse, classes[c]);\r\n\t\t\t\t\tprobsFalse[c] = (double) subset.length\r\n\t\t\t\t\t\t\t/ (double) subsetFalse.length;\r\n\t\t\t\t}\r\n\t\t\t\t// now we calculate what remains after we've split the partition\r\n\t\t\t\t// into the subsets with studied feature\r\n\t\t\t\tremainder = ((double) subsetTrue.length / (double) partition.length)\r\n\t\t\t\t\t\t* infobits(probsTrue)\r\n\t\t\t\t\t\t+ ((double) (subsetFalse.length) / (double) partition.length)\r\n\t\t\t\t\t\t* infobits(probsFalse);\r\n\t\t\t} else {\r\n\t\t\t\t// one subset was empty...\r\n\t\t\t\tremainder = infoContent;\r\n\t\t\t}\r\n\t\t\t// using the reference point, how much do we gain by using this\r\n\t\t\t// feature?\r\n\t\t\tdouble gain = infoContent - remainder;\r\n\t\t\t// if best so far, remember...\r\n\t\t\tif (gain > bestGain) {\r\n\t\t\t\tbestGain = gain;\r\n\t\t\t\tbestFeature = features[a];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn bestFeature;\r\n\t}", "public abstract double classify(Instance e);", "public static void main(String[] args) throws IOException {\n int activeThreshold = 300;\n //Activity.selectActive(\"st\", 6, activeThreshold);\n //Activity.selectActive(\"ri\", 6, activeThreshold);\n //Activity.selectActive(\"dw\", 9, activeThreshold);\n\n //Interaction.analysis(\"st\", 6);\n //Interaction.analysis(\"ri\", 6);\n\n //BehaviourIndicators.analysis(\"st\", 6);\n //BehaviourIndicators.analysis(\"ri\", 6);\n //BehaviourIndicators.analysis(\"dw\", 9);\n\n Engagement.analysis(\"st\",6);\n Engagement.analysis(\"ri\",6);\n //todo the data files for DW have to be adjusted to the ones of the other two to be able to run it\n //Engagement.analysis(\"dw\",9);\n\n //Motivation.analysis(\"ri\", 6);\n //Motivation.analysis(\"st\", 6);\n }" ]
[ "0.72548085", "0.6264076", "0.61963856", "0.6016736", "0.5972371", "0.56298", "0.561494", "0.5529074", "0.5507053", "0.5499641", "0.54834104", "0.5357695", "0.53454554", "0.5342307", "0.53385824", "0.53352314", "0.5314181", "0.5283418", "0.52368045", "0.51958144", "0.5178072", "0.5172284", "0.51564366", "0.5134423", "0.5126056", "0.51210403", "0.51098484", "0.51000994", "0.5083341", "0.5079373", "0.5060999", "0.5041412", "0.5036742", "0.50354785", "0.50102717", "0.50048167", "0.50024813", "0.49979848", "0.49947464", "0.49880216", "0.49853688", "0.4979708", "0.4972573", "0.49569654", "0.49525794", "0.49389422", "0.49270424", "0.49236518", "0.4919065", "0.49061817", "0.4895022", "0.4883372", "0.48662552", "0.48610213", "0.48598704", "0.4850066", "0.48395476", "0.48338678", "0.48293436", "0.48256275", "0.48168254", "0.48105267", "0.4805872", "0.4799786", "0.4797779", "0.47944745", "0.47892228", "0.47848177", "0.4783409", "0.4782662", "0.47814277", "0.47710478", "0.47693148", "0.47558546", "0.47523606", "0.4748649", "0.4742704", "0.47420067", "0.47399634", "0.47345078", "0.4727189", "0.47213858", "0.47212726", "0.4703916", "0.47031397", "0.4701196", "0.4698795", "0.46918106", "0.46881515", "0.46868098", "0.46864384", "0.46791506", "0.46786794", "0.467576", "0.46742502", "0.46713302", "0.4664521", "0.46596032", "0.46526176", "0.46401954" ]
0.7710242
0
Get exchange rates for a chosen date
ExchangeRateDto getByDate(ExchangeRateDateFilter filter);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@RequestMapping(method = RequestMethod.GET, value = \"/{date}/{baseCurrency}/{targetCurrency}\")\n public ResponseEntity exchangeRate(@PathVariable String date, @PathVariable String baseCurrency,\n @PathVariable String targetCurrency) throws ParseException {\n Utils.validateDate(date);\n CurrentExchangeRate currentExchangeRate = exchangeService.getExchangeRate(Utils.parseDate(date),\n baseCurrency,\n targetCurrency);\n return ResponseEntity.ok(currentExchangeRate);\n }", "public void testGetExchangeRateForCurrencyAndDate() {\n final String destinationCurrency = \"EUR\";\n final String sourceCurrency = \"GBP\";\n final Calendar conversionDate = Calendar.getInstance();\n conversionDate.set(Integer.valueOf(\"2005\"), Integer.valueOf(\"3\"), Integer.valueOf(\"2\"));\n \n final ExchangeRateUtil exchangeRateUtilities =\n new ExchangeRateUtil(true, destinationCurrency);\n exchangeRateUtilities.loadExchangeRatesFromCurrency(sourceCurrency);\n \n final double factor =\n exchangeRateUtilities.getExchangeRateForCurrencyAndDate(sourceCurrency,\n ExchangeRateType.BUDGET, conversionDate.getTime());\n \n assertEquals(\"1.41\", String.valueOf(factor));\n }", "List<ExchangeRateDto> getHistoryRates(ExchangeRateHistoryFilter filter);", "@RequestMapping(value = \"/getRatesByDate\", method = RequestMethod.POST)\n public String getRatesByDate(@RequestParam(\"date\") String date, @ModelAttribute(\"model\") ModelMap model) {\n\n try {\n\n // validating date\n DateValidator dateValidator = new DateValidator();\n String error = dateValidator.validate(date);\n\n if (error != null){\n model.addAttribute(\"dateError\", error);\n return VIEW_INDEX;\n }\n\n model.addAttribute(\"dateVal\", date);\n\n //getting results from WS\n GetExchangeRatesByDateResponse.GetExchangeRatesByDateResult list = soapClient.getExchangeRatesByDate(date);\n\n //checking has server returned data\n if (list == null || list.getContent() == null || list.getContent().isEmpty()) {\n model.addAttribute(\"emptyList\", \"No data for date - \" + date);\n return VIEW_INDEX;\n }\n\n //as WS result is xml we need to parse it to Items object\n Node node = (Node) list.getContent().get(0);\n JAXBContext jaxbContext = JAXBContext.newInstance(ExchangeRates.class);\n Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();\n ExchangeRates exchangeRates = (ExchangeRates) unmarshaller.unmarshal(node);\n\n //checking data\n if (exchangeRates == null || exchangeRates.getItem() == null || exchangeRates.getItem().isEmpty()) {\n model.addAttribute(\"emptyList\", \"No data for date - \" + date);\n return VIEW_INDEX;\n }\n\n //sorting list by rates value\n List<ExchangeRates.Item> items = exchangeRates.getItem();\n Collections.sort(items, new RateComparator());\n Collections.reverse(items);\n\n model.addAttribute(\"itemsList\", items);\n\n } catch (Exception e) {\n logger.error(\"getRatesByDate error\", e);\n model.addAttribute(\"getRatesByDateError\", e.getLocalizedMessage());\n }\n\n return VIEW_INDEX;\n }", "public Map<String, Double> getAllExchangeRates() {\n init();\n return allExchangeRates;\n }", "String getExchangeRates(String currency) throws Exception\n\t{\n\t\tString[] rateSymbols = { \"CAD\", \"HKD\", \"ISK\", \"PHP\", \"DKK\", \"HUF\", \"CZK\", \"GBP\", \"RON\", \"HRK\", \"JPY\", \"THB\",\n\t\t\t\t\"CHF\", \"EUR\", \"TRY\", \"CNY\", \"NOK\", \"NZD\", \"ZAR\", \"USD\", \"MXN\", \"AUD\", };\n\n\t\tString rates = \"\";\n\n\t\tfinal String urlHalf1 = \"https://api.exchangeratesapi.io/latest?base=\";\n\n\t\tString url = urlHalf1 + currency.toUpperCase();\n\n\t\tJsonParser parser = new JsonParser();\n\n\t\tString hitUrl = url;\n\t\tString jsonData = getJsonData(hitUrl);\n\n\t\tJsonElement jsonTree = parser.parse(jsonData);\n\n\t\tif (jsonTree.isJsonObject())\n\t\t{\n\t\t\tJsonObject jObject = jsonTree.getAsJsonObject();\n\n\t\t\tJsonElement rateElement = jObject.get(\"rates\");\n\n\t\t\tif (rateElement.isJsonObject())\n\t\t\t{\n\t\t\t\tJsonObject rateObject = rateElement.getAsJsonObject();\n\n\t\t\t\tfor (int i = 0; i < rateSymbols.length; i++)\n\t\t\t\t{\n\t\t\t\t\tJsonElement currentExchangeElement = rateObject.get(rateSymbols[i]);\n\n\t\t\t\t\trates += rateSymbols[i] + \"=\" + currentExchangeElement.getAsDouble()\n\t\t\t\t\t\t\t+ (i < rateSymbols.length - 1 ? \" \" : \".\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn rates;\n\t}", "public List<ExchangeRate> parseRates(InputStream xml, String currency) {\n List<ExchangeRate> rates = new ArrayList<ExchangeRate>();\n\n try {\n XMLInputFactory factory = XMLInputFactory.newInstance();\n XMLStreamReader r = factory.createXMLStreamReader(xml);\n try {\n int event = r.getEventType();\n String date = null;\n boolean matchCurrency = false;\n boolean continueParse = true;\n while (continueParse) {\n if (event == XMLStreamConstants.START_ELEMENT) {\n // Both the date and rates use the Cube element\n if (r.getLocalName().equals(\"Cube\")) {\n for(int i = 0, n = r.getAttributeCount(); i < n; ++i) {\n // First mark the date\n if (r.getAttributeLocalName(i).equals(\"time\")) {\n date = r.getAttributeValue(i);\n }\n\n // Now get the currency\n if ((r.getAttributeLocalName(i).equals(\"currency\")) && r.getAttributeValue(i).equals(currency)) {\n matchCurrency = true;\n }\n\n // Finally, get the rate and add to the list\n if (r.getAttributeLocalName(i).equals(\"rate\")) {\n if (matchCurrency) {\n ExchangeRate rate = new ExchangeRate(date, currency, Double.parseDouble(r.getAttributeValue(i)));\n rates.add(rate);\n matchCurrency = false;\n }\n\n }\n }\n }\n }\n\n if (!r.hasNext()) {\n continueParse = false;\n } else {\n event = r.next();\n }\n }\n } finally {\n r.close();\n }\n } catch (Exception e) {\n Logger.error(\"Error parsing XML\", e);\n }\n\n\n return rates;\n }", "public Rates getRates() throws RateQueryException {\n List<Rate> rates;\n\n try {\n HttpResponse response = this.bitPayClient.get(\"rates\");\n rates = Arrays.asList(\n JsonMapperFactory.create().readValue(this.bitPayClient.responseToJsonString(response), Rate[].class)\n );\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n\n return new Rates(rates);\n }", "public float getExchangeRate(String fromCurrency, String toCurrency, int year, int month, int day) { \n\t\tfloat resultOne;\n\t\tfloat resultTwo;\n\t\tfloat result;\n\t\ttry{\n\t\t\tString url = urlBuilder(year, month, day);\n\t\t\tXML_Parser parser = new XML_Parser();\n\t\t\tresultOne = parser.processDocument(url, fromCurrency);\n\t\t\tresultTwo = parser.processDocument(url, toCurrency);\n\t\t\tresult = (resultOne/resultTwo); //Calculating the exchange rate\n\t\t}catch (UnsupportedOperationException | IOException | ParserConfigurationException | SAXException e){\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\t\t\n\t\treturn result;\n\t}", "public static void conversionsummary (Date startdate, Date enddate, String currencyfrom, String currencyto, List<Time> times){\n List<Double> rates = new ArrayList<>(); // conversion rates of the 2 currencies in the period\n List<String> timesinp = new ArrayList<>(); // the date of those rates added within the period\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");\n if (times.size() != 0) {\n if (startdate.compareTo(enddate) <= 0) {\n times.sort((i, j) -> i.getDate().compareTo(j.getDate())); // sort the time arraylist according the date of time object from old to new\n try {\n for (int i = 0; i < times.size(); i += 1) {\n // only search time object in the period\n if (startdate.compareTo(sdf.parse(times.get(i).getDate())) <= 0 && enddate.compareTo(sdf.parse(times.get(i).getDate())) >= 0) {\n for (int j = 0; j < times.get(i).getExchanges().size(); j += 1) {\n // find exchange rate between the 2 currencies and put the date of the rate added and the rate to 2 lists.\n if (times.get(i).getExchanges().get(j).getFromCurrency().getName().equals(currencyfrom) && times.get(i).getExchanges().get(j).getToCurrency().getName().equals(currencyto)) {\n rates.add(times.get(i).getExchanges().get(j).getRate());\n timesinp.add(times.get(i).getDate());\n }\n }\n }\n }\n } catch (ParseException e) {\n System.out.println(e);\n }\n if (rates.size()==0){ // if there is no such rate during the period\n System.out.println(\"No exchange rate from \" + currencyfrom + \" to \" + currencyto + \" between \" + sdf.format(startdate) + \" and \" + sdf.format(enddate) + \".\");\n return;\n }\n\n for (int i = 0; i < rates.size(); i += 1) { // print conversion history of the 2 currencies\n System.out.println(timesinp.get(i) + \" \" + rates.get(i));\n }\n\n double mean = rates.stream().mapToDouble(i -> i).average().getAsDouble(); // calculate the mean of all exchange rate of the 2 currencies\n System.out.println(\"average rate: \" + String.format(\"%.2f\", mean));\n\n Collections.sort(rates);// sort by the rate\n if (rates.size() == 1) { // if there is only one exchange rate, this rate is the median\n System.out.println(\"median rate: \" + String.format(\"%.2f\", rates.get(0)));\n } else if (rates.size() % 2 != 0) { // if the number of exchange rate is odd, the n/2th rate is median\n System.out.println(\"median rate: \" + String.format(\"%.2f\", rates.get(rates.size() / 2)));\n } else { // if the number of exchange rate is even, the average of the n/2 th and n/2-1 th rate is the median\n System.out.println(\"median rate: \" + String.format(\"%.2f\", (rates.get(rates.size() / 2) + rates.get(rates.size() / 2 - 1)) / 2));\n }\n\n System.out.println(\"max rate: \" + String.format(\"%.2f\", rates.stream().mapToDouble(i -> i).max().getAsDouble())); // get the max\n System.out.println(\"min rate: \" + String.format(\"%.2f\", rates.stream().mapToDouble(i -> i).min().getAsDouble())); // get the min\n\n // calculate the standard deviation\n double variance = 0.0;\n for (int i = 0; i < rates.size(); i += 1) {\n variance += Math.pow((rates.get(i) - mean), 2);\n }\n double sd = Math.sqrt(variance / rates.size());\n System.out.println(\"standard deviation of rates: \" + String.format(\"%.2f\", sd));\n\n }else{\n System.out.println(\"The end date is earlier than start date, no such period exist, please enter correct period.\");\n }\n }else{\n System.out.println(\"No data in database, please contact admin for help.\");\n }\n\n }", "@Override\n public String get_rates(String betrag, String currency, List<String> targetcurrencies) {\n String api = null;\n try {\n api = new String(Files.readAllBytes(Paths.get(\"src/resources/OfflineData.json\")));\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n JSONObject obj = new JSONObject(api);\n ArrayList<String> calculatedrates = new ArrayList<>();\n if (currency.equals(\"EUR\")) {\n for (String targetcurrency : targetcurrencies) {\n float rate = obj.getJSONObject(\"rates\").getFloat(targetcurrency);\n calculatedrates.add((Float.parseFloat(betrag) * rate) + \" \" + targetcurrency + \" (Kurs: \" + rate + \")\");\n }\n } else {\n float currencyrate = obj.getJSONObject(\"rates\").getFloat(currency);\n for (String targetcurrency : targetcurrencies) {\n float rate = obj.getJSONObject(\"rates\").getFloat(targetcurrency);\n calculatedrates.add((Float.parseFloat(betrag) / currencyrate * rate) + \" \" + targetcurrency + \" (Kurs: \" + rate / currencyrate + \")\");\n }\n }\n return Data.super.display(betrag, currency, calculatedrates, obj.get(\"date\").toString());\n }", "private JsonObject getRatesFromApi(){\n try {\n // Setting URL\n String url_str = \"https://v6.exchangerate-api.com/v6/\"+ getApiKey() +\"/latest/\"+ Convert.getBaseCurrency();\n\n // Making Request\n URL url = new URL(url_str);\n HttpURLConnection request = (HttpURLConnection) url.openConnection();\n request.connect();\n\n // Return parsed JSON object\n return parseRequest(request);\n\n } catch (IOException e) {\n e.printStackTrace();\n return new JsonObject();\n }\n }", "public Rates getRates(String baseCurrency) throws RateQueryException {\n List<Rate> rates;\n\n try {\n HttpResponse response = this.bitPayClient.get(\"rates/\" + baseCurrency);\n rates = Arrays.asList(\n JsonMapperFactory.create().readValue(this.bitPayClient.responseToJsonString(response), Rate[].class)\n );\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n\n return new Rates(rates);\n }", "public Collection getAllExchangeRates()\n throws RemoteException;", "public String exchangeRateList() {\r\n\t\tif (exRateS == null) {\r\n\t\t\texRateS = new ExchangeRate();\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\texchangeRateList = service.exchangeRateList(exRateS);\r\n\t\ttotalCount = ((PagenateList) exchangeRateList).getTotalCount();\r\n\t\t\r\n\t\treturn SUCCESS;\r\n\t}", "public static double getValue(Exchange exchange, String name) {\n\n double rate = -1.0;\n\n switch (name) {\n case \"AUD\":\n rate = exchange.getRates().getAUD();\n break;\n case \"BGN\":\n rate = exchange.getRates().getBGN();\n break;\n case \"BRL\":\n rate = exchange.getRates().getBRL();\n break;\n case \"CAD\":\n rate = exchange.getRates().getCAD();\n break;\n case \"CHF\":\n rate = exchange.getRates().getCHF();\n break;\n case \"CNY\":\n rate = exchange.getRates().getCNY();\n break;\n case \"CZK\":\n rate = exchange.getRates().getCZK();\n break;\n case \"DKK\":\n rate = exchange.getRates().getDKK();\n break;\n case \"GBP\":\n rate = exchange.getRates().getGBP();\n break;\n case \"HKD\":\n rate = exchange.getRates().getHKD();\n break;\n case \"HRK\":\n rate = exchange.getRates().getHRK();\n break;\n case \"HUF\":\n rate = exchange.getRates().getHUF();\n break;\n case \"IDR\":\n rate = exchange.getRates().getIDR();\n break;\n case \"ILS\":\n rate = exchange.getRates().getILS();\n break;\n case \"INR\":\n rate = exchange.getRates().getINR();\n break;\n case \"JPY\":\n rate = exchange.getRates().getJPY();\n break;\n case \"KRW\":\n rate = exchange.getRates().getKRW();\n break;\n case \"MXN\":\n rate = exchange.getRates().getMXN();\n break;\n case \"MYR\":\n rate = exchange.getRates().getMYR();\n break;\n case \"NOK\":\n rate = exchange.getRates().getNOK();\n break;\n case \"NZD\":\n rate = exchange.getRates().getNZD();\n break;\n case \"PHP\":\n rate = exchange.getRates().getPHP();\n break;\n case \"PLN\":\n rate = exchange.getRates().getPLN();\n break;\n case \"RON\":\n rate = exchange.getRates().getRON();\n break;\n case \"RUB\":\n rate = exchange.getRates().getRUB();\n break;\n case \"SEK\":\n rate = exchange.getRates().getSEK();\n break;\n case \"SGD\":\n rate = exchange.getRates().getSGD();\n break;\n case \"THB\":\n rate = exchange.getRates().getTHB();\n break;\n case \"TRY\":\n rate = exchange.getRates().getTRY();\n break;\n case \"ZAR\":\n rate = exchange.getRates().getZAR();\n break;\n case \"EUR\":\n rate = exchange.getRates().getEUR();\n break;\n case \"USD\":\n rate = exchange.getRates().getUSD();\n break;\n default:\n break;\n }\n\n return rate;\n }", "private void givenExchangeRateExistsForABaseAndDate() {\n }", "ResponseEntity<List<TieredRates>> getTieredRates();", "ResponseEntity<List<TOURates>> getTouRates();", "public float getExchangeRate(String currencyCode, int year, int month, int day) {\n\t\tfloat result;\n\t\ttry{\n\t\t\tString url = urlBuilder(year, month, day);\n\t\t\tXML_Parser parser = new XML_Parser();\n\t\t\tresult = parser.processDocument(url, currencyCode);\n\t\t}catch (UnsupportedOperationException | IOException | ParserConfigurationException | SAXException e){\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\t\t\n\t\treturn result;\n\t}", "@PostMapping(\"/exchange\")\n public ResponseEntity<ExchangeResult> getExchangeRate(@RequestBody ExchangeRequest exchangeRequest) {\n\n ExchangeResult result = currencyExchangeService.calculate(exchangeRequest);\n\n\n// 4. do nbp exchange downoloaderprzekazujemy date i walute(wartosci nie bo jąliczymy w serwisie)\n// 5. w nbp exchange downoloader wstzukyjemy rest tempplate\n// 6. majac wynik wracamy do currency exchange servise(typem zwracamyn bedzie obiekt ktory bedzie zawierał rating i error message(typ string))\n// i w momencie jak nie bedzie błedu uzupełniamy rating lub error , dodac boolena ktory nam powie czy jest ok czy nie\n// jak jest ok to wyciagamy stawke rate i dzielimy ją\n// 7. nastepnie mamy wynik\n\n\n return new ResponseEntity<>(result, result.getStatus());\n }", "@ApiModelProperty(value = \"The total price of staying in this room from the given check-in date to the given check-out date\")\n public List<PeriodRate> getRates() {\n return rates;\n }", "public Map<String, Double> getExchangeRates(String[] rates){\n Map<String, Double> map = new HashMap<>();\n\n JsonObject conversionRates = getRatesFromApi().getAsJsonObject(\"conversion_rates\");\n if (rates != null) {\n\n for (String temp :\n rates) {\n if (conversionRates.has(temp))\n map.put(temp, conversionRates.get(temp).getAsDouble());\n }\n } else {\n for (Map.Entry<String, JsonElement> element :\n conversionRates.entrySet()) {\n map.put(element.getKey(), element.getValue().getAsDouble());\n }\n }\n\n return map;\n }", "double requestCurrentRate(String fromCurrency,\n String toCurrency);", "public static Collection getCostingRates() throws EnvoyServletException\n {\n try\n {\n return ServerProxy.getCostingEngine().getRates();\n }\n catch (Exception e)\n {\n throw new EnvoyServletException(e);\n }\n }", "private void fetchRatesData() {\r\n RequesterBean requesterBean = new RequesterBean();\r\n requesterBean.setFunctionType(GET_RATE_DATA);\r\n requesterBean.setDataObject(instituteRatesBean);\r\n \r\n AppletServletCommunicator appletServletCommunicator = new \r\n AppletServletCommunicator(CONNECTION_STRING, requesterBean);\r\n appletServletCommunicator.setRequest(requesterBean);\r\n appletServletCommunicator.send();\r\n ResponderBean responderBean = appletServletCommunicator.getResponse();\r\n \r\n if(responderBean == null) {\r\n //Could not contact server.\r\n CoeusOptionPane.showErrorDialog(COULD_NOT_CONTACT_SERVER);\r\n return;\r\n }\r\n \r\n if(responderBean.isSuccessfulResponse()) {\r\n Hashtable ratesData = (Hashtable)responderBean.getDataObject();\r\n hasMaintainCodeTablesRt = ((Boolean)ratesData.get(\"HAS_OSP_RIGHT\")).booleanValue();\r\n if( hasMaintainCodeTablesRt ){\r\n setFunctionType(TypeConstants.MODIFY_MODE);\r\n }else {\r\n setFunctionType(TypeConstants.DISPLAY_MODE);\r\n }\r\n //queryKey = RATES + ratesData.get(\"PARENT_UNIT_NUMBER\").toString();\r\n\r\n //Set title\r\n dlgRates.setTitle(RATES + \" for Unit \" + instituteRatesBean.getUnitNumber());\r\n queryEngine.addDataCollection(queryKey, ratesData);\r\n\r\n }else {\r\n //Server Error\r\n CoeusOptionPane.showErrorDialog(responderBean.getMessage());\r\n return;\r\n }\r\n }", "@RequestMapping(value = \"/getdelivered\", method = RequestMethod.GET)\n\tpublic ResponseEntity<List<Booked>> getdeliverToday(@RequestParam(\"date\")@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date) {\n\n\t\treturn ResponseEntity.ok(bookedService.getDeliveredByDay(date));\n\t}", "ResponseEntity<List<TieredRatesHistory>> getTieredRatesHistory();", "public interface StockPriceDataSource {\n\n /**\n * daily prices\n * @param date required date, can be today\n * @return list of deals for the day\n */\n List<StockTrade> getDayPrices(LocalDate date) throws IOException;\n}", "public BigDecimal getTaxRateForDate(LocalDate date) {\n\t\tIterator<TaxRate> it= taxRates.iterator();\n\t\t\n\t\t\n\t\tBigDecimal bg = null;\n\t\twhile(it.hasNext())\n\t\t{\n\t\t\tTaxRate taxRate= it.next();\n\t\t\tif(taxRate.isEffective(date))\n\t\t\t\tbg=taxRate.getTaxRate();\n\t\t}\n\t\treturn bg.setScale(2, RoundingMode.HALF_UP);\n\t}", "public ExchangeRateVO getExchangeRate(Integer exchRateId)\n throws RemoteException, FinderException;", "public static JSONObject sendRequest(){\n \tJSONObject exchangeRates = null;\n \t \n try {\n \t stream = new URL(BASE_URL + \"?access_key=\" + ACCESS_KEY).openStream();\n \t BufferedReader rd = new BufferedReader(new InputStreamReader(stream, Charset.forName(\"UTF-8\")));\n \t exchangeRates = new JSONObject(streamToString(rd)).getJSONObject(\"rates\");;\n \n }catch(MalformedURLException e) {\n \t e.printStackTrace();\n \t \n }catch (IOException e) {\n \n e.printStackTrace();\n }catch (JSONException e) {\n \n e.printStackTrace();\n } \n\t\treturn exchangeRates;\n \n }", "public BigDecimal getExchangeRate() {\n return exchangeRate;\n }", "double getStockCostBasis(String date) throws IllegalArgumentException;", "@ApiModelProperty(value = \"Rates that will be applied during the duration of the car rental requested. These rates are generally not inclusive of tax and are used by the car rental company to compute the total cost at the end of the rental period.\")\n public List<Rate> getRates() {\n return rates;\n }", "ResponseEntity<List<TOURatesHistory>> getTouRatesHistory();", "public interface ICurrencyExchangeService {\n/**\n * Requests the current exchange rate from one currency\n * to another.\n * @param fromCurrency the original Currency\n * @param toCurrency the 'destination' or final Currency\n * @return the currency exchange rate\n */\n\n double requestCurrentRate(String fromCurrency,\n String toCurrency);\n}", "@GET(\"api/valuedates\")\n Call<String> getNextValueDate(@Query(\"CurrencyPair\") String currencyPair, @Query(\"ValueType\") String valueType);", "ResponseEntity<List<GenericRates>> getGenericRates();", "double getRate();", "private static Map<String, Double> createCurrencyPairRates() {\n\t\t\n\t\tMap<String, Double> currencyRates = new HashMap<>();\n\t\tcurrencyRates.put(\"AUDUSD\", 0.8371);\n\t\tcurrencyRates.put(\"CADUSD\", 0.8711);\n\t\tcurrencyRates.put(\"CNYUSD\", 6.1715);\n\t\tcurrencyRates.put(\"EURUSD\", 1.2315);\n\t\tcurrencyRates.put(\"GBPUSD\", 1.5683);\n\t\tcurrencyRates.put(\"NZDUSD\", 0.7750);\n\t\tcurrencyRates.put(\"USDJPY\", 119.95);\n\t\tcurrencyRates.put(\"EURCZK\", 27.6028);\n\t\tcurrencyRates.put(\"EURDKK\", 7.4405);\n\t\tcurrencyRates.put(\"EURNOK\", 8.6651);\n\t\t\n\t\treturn currencyRates;\n\t\t\n\t}", "public List<Order> getOrdersByDate(Date date);", "@RequestMapping(method = RequestMethod.GET, value = \"/history/daily/{year}/{month}/{day}\")\n public ResponseEntity getDailyExchangeRateHistory(@PathVariable String year, @PathVariable String month,\n @PathVariable String day) throws ParseException {\n Utils.validateDay(day);\n Utils.validateYear(year);\n Utils.validateMonth(month);\n\n List<ExchangeRateHistoryResponse> exchangeRateHistoryObject =\n exchangeService.getDailyExchangeRateHistory(\n Integer.parseInt(year),\n Integer.parseInt(month),\n Integer.parseInt(day)\n );\n return ResponseEntity.ok(exchangeRateHistoryObject);\n }", "@SuppressWarnings(\"unchecked\")\n\t@Override\n\tpublic GetRatesResult execute(final GetRatesAction action,\n\t\t\tfinal ExecutionContext ctx) throws ActionException {\n\t\tfinal List<Rate> recentRates = _recentRatesCache.getCachedResult();\n\t\tif (recentRates != null) {\n\t\t\treturn new GetRatesResult(recentRates);\n\t\t}\n\n\t\t// If not, we query the data store\n\t\tfinal PersistenceManager pm = _pmp.get();\n\n\t\ttry {\n\t\t\tfinal Query query = pm.newQuery(Rate.class);\n\t\t\tquery.setRange(0, 10);\n\t\t\tquery.setOrdering(\"timeFetched desc\");\n\n\t\t\t// The following is needed because of an issue\n\t\t\t// with the result of type StreamingQueryResult not\n\t\t\t// being serializable for GWT\n\t\t\t// See the discussion here:\n\t\t\t// http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/bce6630a3f01f23a/62cb1c4d38cc06c7?lnk=gst&q=com.google.gwt.user.client.rpc.SerializationException:+Type+'org.datanucleus.store.appengine.query.StreamingQueryResult'+was+not+included+in+the+set+of+types+which+can+be+serialized+by+this+SerializationPolicy\n\t\t\tfinal List queryResult = (List) query.execute();\n\t\t\tfinal List<Rate> rates = new ArrayList<Rate>(queryResult.size());\n\n\t\t\tfor (final Object rate : queryResult) {\n\t\t\t\trates.add((Rate) rate);\n\t\t\t}\n\n\t\t\t// Then update the memcache\n\t\t\t_recentRatesCache.setResult(rates);\n\t\t\treturn new GetRatesResult(rates);\n\t\t} finally {\n\t\t\tpm.close();\n\t\t}\n\t}", "private void showRate() {\r\n\t\tString currencyCode = signalThreeLetters();\r\n\t\tif (currencyCode == null){\r\n\t\t\treturn;\r\n }\r\n //needed if-else to check if currencies is null. As currencies.getCurrencyByCode doesn't work if currencies is null\r\n if (currencies == null){\r\n \tSystem.out.println(\"There are currently no currencies in the system.\");\r\n \tSystem.out.println();}\r\n \t\r\n else{\r\n Currency currency = currencies.getCurrencyByCode(currencyCode);\r\n if (currency == null) {\r\n\t\t\t// No, so complain and return\r\n\t\t\tSystem.out.println(\"\\\"\" + currencyCode + \"\\\" is is not in the system.\");\r\n\t\t\tSystem.out.println();}\r\n else {\r\n System.out.println(\"Currency \" +currencyCode+ \" has exchange rate \" + currency.getExchangeRate() + \".\");\r\n System.out.println();}\r\n \r\n }\r\n \r\n\t}", "@RequiresApi(api = Build.VERSION_CODES.N)\n private double GetIterativeConversion(List<RateModel> rates, String fromCurrency, String toCurrency) {\n int numberAttempts = 0;\n double result = 0;\n String filter = fromCurrency;\n double conversion = 1;\n do{\n String finalFilter = filter;\n List<RateModel> fromRates = rates.stream()\n .filter(rate -> rate.getFromCurrency().equals(finalFilter))\n .collect(Collectors.toList());\n\n Optional<RateModel> rate = fromRates.stream().\n filter(x -> x.getToCurrency().equals(toCurrency))\n .findFirst();\n if(rate.isPresent()){\n result = conversion * rate.get().getRate();\n }\n else {\n RateModel firstFromRates = fromRates.get(0);\n conversion = conversion * firstFromRates.getRate();\n filter = firstFromRates.getToCurrency();\n }\n numberAttempts++;\n }\n while (numberAttempts <20 && result == 0);\n\n Log.d(TAG, String.format(\"Looped %1%d times. Conversion: %2%s to %3$s x%4$f\", numberAttempts, fromCurrency, toCurrency, result));\n return result;\n }", "public Map<Number, Double> getTodayPrice(Number stockID, Number stDate, Number enDate) {\n Map<Number, Double> m = new HashMap<Number, Double>();\n //get VO instance\n TestStockPricesVOImpl tspVO = getTestStockPricesVO();\n\n //get VC instance\n ViewCriteria vc =\n tspVO.getViewCriteria(\"GetStockPricesInGivenDateRangeCriteria\");\n vc.resetCriteria();\n\n //set All the bind parameters\n tspVO.setBindStockID(stockID);\n tspVO.setBindStartDate(stDate);\n tspVO.setBindEndDate(enDate);\n \n //apply the view criteria\n tspVO.applyViewCriteria(vc);\n \n //execute the view Object programatically\n tspVO.executeQuery();\n System.out.print(\"Row count: \");\n System.out.println(tspVO.getRowCount());\n\n //Iterate through the results\n RowSetIterator it = tspVO.createRowSetIterator(null);\n while (it.hasNext()) {\n TestStockPricesVORowImpl newRow = (TestStockPricesVORowImpl)it.next();\n Number timetracked = newRow.getTimetracked();\n Number price = newRow.getPrice();\n \n m.put(timetracked, price.doubleValue());\n }\n it.closeRowSetIterator();\n return m;\n }", "public double getRate( ) {\nreturn monthlyInterestRate * 100.0 * MONTHS;\n}", "public static ArrayList<Integer> getRates(){\n\t\treturn heartRates;\n\t}", "public Map<Number, Double> getThePastPrices(Number stockID, Number stDate, Number enDate) {\n Map<Number, Double> m = new HashMap<Number, Double>();\n\n //get VO instance\n TestStockPricesVOImpl tspVO = getTestStockPricesVO();\n\n //get VC instance\n ViewCriteria vc =\n tspVO.getViewCriteria(\"GetStockPricesInGivenDateRangeCriteria\");\n vc.resetCriteria();\n\n //set All the bind parameters\n tspVO.setBindStockID(stockID);\n tspVO.setBindStartDate(stDate);\n tspVO.setBindEndDate(enDate);\n \n //apply the view criteria\n tspVO.applyViewCriteria(vc);\n \n //execute the view Object programatically\n tspVO.executeQuery();\n System.out.print(\"Row count: \");\n System.out.println(tspVO.getRowCount());\n\n //Iterate through the results\n RowSetIterator it = tspVO.createRowSetIterator(null);\n while (it.hasNext()) {\n TestStockPricesVORowImpl newRow = (TestStockPricesVORowImpl)it.next();\n Number datetracked = newRow.getDatetracked();\n Number timetracked = newRow.getTimetracked();\n Number price = newRow.getPrice();\n \n m.put(datetracked, price.doubleValue());\n }\n it.closeRowSetIterator();\n return m;\n }", "@Override\n public RoomRatesEntity findOnlineRateForRoomType(Long roomTypeId, Date currentDate) throws NoAvailableOnlineRoomRateException {\n Query query = em.createQuery(\"SELECT r FROM RoomRatesEntity r JOIN r.roomTypeList r1 WHERE r1.roomTypeId = :roomTypeId\");\n query.setParameter(\"roomTypeId\", roomTypeId);\n List<RoomRatesEntity> roomRates = query.getResultList();\n\n //Check what rate type are present\n boolean normal = false;\n boolean promo = false;\n boolean peak = false;\n\n for (RoomRatesEntity roomRate : roomRates) {\n// if (!checkValidityOfRoomRate(roomRate)) { //skips expired/not started rates, price is determined by check in and check out date, it becomes not considered in our final prediction\n// continue;\n// }\n// if null do smt else\n if (roomRate.getIsDisabled() == false) {\n if (null != roomRate.getRateType()) {\n System.out.println(roomRate.getRateType());\n switch (roomRate.getRateType()) {\n case NORMAL:\n normal = true;\n \n break;\n case PROMOTIONAL:\n System.out.println(\"ValidStart \"+roomRate.getValidityStart()+\" ValidEnd: \"+roomRate.getValidityEnd()+\" CurrentDate: \"+currentDate);\n if (rateIsWithinRange(roomRate.getValidityStart(), roomRate.getValidityEnd(), currentDate)) {\n promo = true;\n }\n break;\n\n case PEAK:\n System.out.println(\"ValidStart \"+roomRate.getValidityStart()+\" ValidEnd: \"+roomRate.getValidityEnd()+\" CurrentDate: \"+currentDate);\n\n if (rateIsWithinRange(roomRate.getValidityStart(), roomRate.getValidityEnd(), currentDate)) {\n peak = true;\n }\n break;\n default:\n break;\n }\n }\n\n System.out.println(normal + \" \" + promo + \" \" + peak);\n //5 rules here\n if (normal && promo && peak) {\n //find promo\n Query rule = em.createQuery(\"SELECT r FROM RoomRatesEntity r JOIN r.roomTypeList r1 WHERE r1.roomTypeId = :roomTypeId AND r.rateType = :p ORDER BY r.ratePerNight ASC\");\n rule.setParameter(\"p\", RateType.PROMOTIONAL);\n rule.setParameter(\"roomTypeId\", roomTypeId);\n\n return (RoomRatesEntity) rule.getResultList().get(0);\n } else if (promo && peak && !normal || normal && peak && !promo) {\n //apply peak, assume only 1\n Query rule = em.createQuery(\"SELECT r FROM RoomRatesEntity r JOIN r.roomTypeList r1 WHERE r1.roomTypeId = :roomTypeId AND r.rateType = :p\");\n rule.setParameter(\"p\", RateType.PEAK);\n rule.setParameter(\"roomTypeId\", roomTypeId);\n\n return (RoomRatesEntity) rule.getSingleResult();\n } else if (normal && promo && !peak) {\n //apply promo\n Query rule = em.createQuery(\"SELECT r FROM RoomRatesEntity r JOIN r.roomTypeList r1 WHERE r1.roomTypeId = :roomTypeId AND r.rateType = :p ORDER BY r.ratePerNight ASC\");\n rule.setParameter(\"p\", RateType.PROMOTIONAL);\n rule.setParameter(\"roomTypeId\", roomTypeId);\n\n return (RoomRatesEntity) rule.getResultList().get(0);\n } else if (normal && !promo && !peak) {\n //apply normal\n Query rule = em.createQuery(\"SELECT r FROM RoomRatesEntity r JOIN r.roomTypeList r1 WHERE r1.roomTypeId = :roomTypeId AND r.rateType = :p\");\n rule.setParameter(\"p\", RateType.NORMAL);\n rule.setParameter(\"roomTypeId\", roomTypeId);\n\n return (RoomRatesEntity) rule.getSingleResult();\n }\n }\n\n }\n throw new NoAvailableOnlineRoomRateException(\"There is no available room rate to be used!\");\n }", "ResponseEntity<List<GenericRatesHistory>> getGenericRatesHistory();", "List<CurrencyDTO> getCurrencies();", "@Override\n\tpublic BigDecimal getExchangedFeeRate(String getExchangedFeeRate,\n\t\t\tDate billTime) {\n\t\treturn null;\n\t}", "public String getExchangeRateUrl() {\n return exchangeRateUrl;\n }", "public static Collection getRatesForActivity(Activity activity,\n GlobalSightLocale sourceLocale, GlobalSightLocale targetLocale)\n\n throws EnvoyServletException\n {\n try\n {\n return ServerProxy.getCostingEngine().getRates(activity,\n sourceLocale, targetLocale);\n }\n catch (Exception e)\n {\n throw new EnvoyServletException(e);\n }\n }", "public List<CurrencyExchangeRate> withExchangeRates(List<CurrencyExchangeRate> rates) {\n // TODO: return copy(rates = rates);\n return rates;\n }", "@RequestMapping(value = \"${app.paths.historical-path}\",\n method = RequestMethod.GET,\n produces = MediaType.APPLICATION_JSON_VALUE)\n public ResponseEntity<Collection<Bitcoin>> getBitcoinHistoricalRatesInDateRange(\n @RequestParam(\"dateFrom\") String dateFromString, @RequestParam(\"dateTo\") String dateToString)\n throws InterruptedException, ExecutionException {\n log.info(\"> BitcoinController :: getBitcoinPricesInDateTimeRange\");\n ZonedDateTime dateTimeFrom = LocalDate.parse(dateFromString).atStartOfDay(ZoneId.systemDefault());\n ZonedDateTime dateTimeTo = LocalDate.parse(dateToString).atStartOfDay(ZoneId.systemDefault()).plusDays(1)\n .minusNanos(1);\n Collection<Bitcoin> response = service.findAllInRange(dateTimeFrom, dateTimeTo);\n log.info(\"< BitcoinController :: getBitcoinPricesInDateTimeRange\");\n return new ResponseEntity<Collection<Bitcoin>>(response, HttpStatus.OK);\n }", "public List<Serie> getWeightByDate(){\r\n\t\t\r\n\t\treturn daoEjercicio.getWeightByDate();\r\n\t\t\r\n\t}", "@RequestMapping(value = \"/getreturned\", method = RequestMethod.GET)\n\tpublic ResponseEntity<List<Booked>> getreturnedToday(@RequestParam(\"date\")@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date) {\n\t\ttry{\n\t\t\tEmployee employee=(Employee) userService.get(Integer.parseInt(httpSession.getAttribute(\"user\").toString()));\n\t\t\tBranchOffice branch=(employee.getBranchOffice());\n\t\t\treturn ResponseEntity.ok(bookedService.getReturnedToday(branch, date));\n\t\t}catch(Exception e){\n\t\t\treturn ResponseEntity.ok(bookedService.getReturnedToday(date));\t\n\t\t}\n\t}", "public HashMap<String, Double> getFreezedListByDate(Timestamp dateCurrent){\r\n HashMap<String, Double> freezedMap = new HashMap<>();\r\n try (Connection connection = jdbcUtils.getConnection();){\r\n preparedStatement = connection.prepareStatement(GET_FOLLOWERS_ALL_SQL);\r\n resultSet = preparedStatement.executeQuery();\r\n while (resultSet.next()) {\r\n if (resultSet.getTimestamp(FOLLOWERS_DATE_FREEZ_COLUMN_NAME).before(dateCurrent)){\r\n if (freezedMap.containsKey(resultSet.getString(FOLLOWERS_PERIODICAL_COLUMN_NAME))){\r\n String keyPeriodical = resultSet.getString(FOLLOWERS_PERIODICAL_COLUMN_NAME);\r\n double existMoney = freezedMap.get(keyPeriodical);\r\n double putMoney = existMoney + resultSet.getDouble(FOLLOWERS_MOUNTHPRICE_COLUMN_NAME);\r\n freezedMap.put(keyPeriodical, putMoney);\r\n } else {\r\n freezedMap.put(resultSet.getString(FOLLOWERS_PERIODICAL_COLUMN_NAME)\r\n , resultSet.getDouble(FOLLOWERS_MOUNTHPRICE_COLUMN_NAME));\r\n } \r\n }\r\n }\r\n } catch (SQLException ex) {\r\n configLog.init();\r\n logger.info(LOG_SQL_EXCEPTION_MESSAGE + AdminDao.class.getName());\r\n Logger.getLogger(AdminDao.class.getName()).log(Level.SEVERE, null, ex);\r\n throw new RuntimeException();\r\n }\r\n return freezedMap;\r\n }", "public Rate get(\n String baseCurrency,\n String currency\n ) throws RateQueryException {\n try {\n HttpResponse response = this.bitPayClient.get(\"rates/\" + baseCurrency + \"/\" + currency);\n final String content = this.bitPayClient.responseToJsonString(response);\n return JsonMapperFactory.create().readValue(content, Rate.class);\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n }", "@Scheduled(fixedRate = 8 * 1000 * 60 * 60)\n private void getRatesTask() {\n try {\n RestTemplate restTemplate = new RestTemplate();\n CurrencyDTO forObject = restTemplate.getForObject(fixerIoApiKey, CurrencyDTO.class);\n forObject.getRates().forEach((key, value) -> {\n Currency currency = new Currency(key, value);\n this.currencyRepository.save(currency);\n });\n } catch (RestClientException ex) {\n System.out.println(ex.getMessage());\n }\n }", "public String getExchangeRateType() {\n return this.exchangeRateType;\n }", "public void GetAvailableDates()\n\t{\n\t\topenDates = new ArrayList<TimePeriod>(); \n\t\t\n\t\ttry\n\t\t{\n\t\t\tConnector con = new Connector();\n\t\t\t\n\t\t\tString query = \"SELECT startDate, endDate FROM Available WHERE available_hid = '\"+hid+\"'\"; \n\t\t\tResultSet rs = con.stmt.executeQuery(query);\n\t\t\t\n\t\t\twhile(rs.next())\n\t\t\t{\n\t\t\t\tTimePeriod tp = new TimePeriod(); \n\t\t\t\ttp.stringStart = rs.getString(\"startDate\"); \n\t\t\t\ttp.stringEnd = rs.getString(\"endDate\"); \n\t\t\t\ttp.StringToDate();\n\t\t\t\t\n\t\t\t\topenDates.add(tp); \n\t\t\t}\n\t\t\tcon.closeConnection(); \n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t}", "private void givenExchangeRatesExistsForEightMonths() {\n }", "@GetMapping(\"/{symbol}/{date}\")\n public ModelAndView daily(@PathVariable(\"symbol\") String symbol, @PathVariable(\"date\") String date) throws ParseException {\n\n Date sdf = new SimpleDateFormat(\"yyyy-MM-dd\").parse(date);\n\n String beginOfTheMonth = date.substring(0, 7) + \"-00\";\n String endOfTheMonth = date.substring(0,7) + \"-31\";\n Map<String, Object> model = new HashMap<>();\n\n try{\n String[] resp = quoteRepository.daily(symbol, sdf).split(\",\");\n Double closingResp = quoteRepository.closingDay(symbol, sdf);\n String[] monthResp = quoteRepository.monthly(symbol, beginOfTheMonth, endOfTheMonth).split(\",\");\n Double closingMonth = quoteRepository.closingMonth(symbol, beginOfTheMonth, endOfTheMonth);\n\n DayRecord dr = new DayRecord(Double.parseDouble(resp[0]), Double.parseDouble(resp[1]), Integer.parseInt(resp[2]), date, symbol);\n DayRecord mr = new DayRecord(Double.parseDouble(monthResp[0]), Double.parseDouble(monthResp[1]), Integer.parseInt(monthResp[2]), beginOfTheMonth, symbol);\n\n model.put(\"daily\", dr);\n model.put(\"closing\", closingResp);\n model.put(\"monthly\", mr);\n model.put(\"closingMonthly\", closingMonth);\n\n\n return new ModelAndView(\"main\", model);\n\n } catch (Exception e) {\n return new ModelAndView(\"error\", model);\n }\n }", "public ArrayList<ArrayList<Double>> getReportsFromServer(LocalDate date)\n {\n\t //Go to DB and ask for reports of a specific date\n\t return null;\n }", "@SOAPMethod(\"ConversionRate\")\n String conversionRate(@SOAPProperty(\"FromCurrency\") String fromCurrency,\n @SOAPProperty(\"ToCurrency\") String toCurrency);", "public interface ExchangeRateService {\n BigDecimal exchange(Currency curr1, Currency curr2, BigDecimal amount);\n}", "public GainDTO getgainday(String date) {\n\t\tString days = date.substring(2,4) +\"/\"+ date.substring(5,7)+\"/\"+date.substring(8);\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\tString sql = \"select Atype, Btype, Ctype, Dtype, Etype, (Atype *100000+Btype*200000+Ctype*300000+Dtype*400000+Etype*500000) as sum from (select count(case when sp.type = 'a상품' then 1 end) as Atype, count(case when sp.type = 'b상품' then 1 end) as Btype, count(case when sp.type = 'c상품' then 1 end) as Ctype, count(case when sp.type = 'd상품' then 1 end) as Dtype, count(case when sp.type = 'e상품' then 1 end) as Etype from tblServiceproduct sp inner join tblPayment pm on sp.serviceProductSeq = pm.serviceProductSeq where to_char(pm.paydate,'yy/mm/dd') = ?)\";\n\t\t\t\n\t\t\tpstat = conn.prepareStatement(sql);\n\t\t\tpstat.setString(1, days);\n\t\t\t\n\t\t\trs = pstat.executeQuery();\n\t\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\t\tGainDTO dto = new GainDTO();\n\n\t\t\tif(rs.next()) {\n\t\t\t\n\t\t\t\tdto.setA(rs.getString(\"Atype\"));\n\t\t\t\tdto.setB(rs.getString(\"Btype\"));\n\t\t\t\tdto.setC(rs.getString(\"Ctype\"));\n\t\t\t\tdto.setD(rs.getString(\"Dtype\"));\n\t\t\t\tdto.setE(rs.getString(\"Etype\"));\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\treturn dto;\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\t\treturn null;\n\t}", "static double chooseRate(String selectedRate){\n JsonObject listRates = conversionRates.get(\"rates\").getAsJsonObject();\n return listRates.get(selectedRate).getAsDouble();\n\n }", "private void prepareRates() {\n // set the Currency as GBP (symbol) which is applicable in all rates\n Currency gbp = Currency.getInstance(\"GBP\");\n rates.add(new Rate(\"Morning\", gbp, 15d, LocalTime.of(5, 0), LocalTime.of(10, 0)));\n rates.add(new Rate(\"Evening\", gbp, 18d, LocalTime.of(16, 30), LocalTime.of(20, 0)));\n rates.add(new Rate(\"Night\", gbp, 20d, LocalTime.of(20, 0), LocalTime.of(23, 0)));\n rates.add(new Rate(\"Default\", gbp, 10d, null, null));\n }", "public ArrayList getDataforVol_EurGbp(String date1){\n \n //Date date;\n List stPrices = new ArrayList();\n String sqlQuery = \"SELECT close_price FROM eur_gbp\"\n + \"WHERE day_date <'\"+ date1 +\"' AND \"\n + \"day_date >= DATE_SUB('\" +date1 +\"',INTERVAL 30 DAY);\";\n try {\n rs = dbCon.getData(sqlQuery);\n \n while (rs.next()) {\n stPrices.add(rs.getString(\"close_price\"));\n } \n } catch(SQLException e){} \n return (ArrayList) stPrices; \n }", "public DDbExchangeRate() {\n super(DModConsts.F_EXR);\n initRegistry();\n }", "private LocalDate getTradeDay(String currency, LocalDate settlementDate) {\n return new TradableDays().getTradableDate(currency, settlementDate);\n }", "org.adscale.format.opertb.AmountMessage.Amount getExchangeprice();", "public void testGetExchangeRateForCurrency() {\n final String destinationCurrency = \"EUR\";\n final String sourceCurrency = \"GBP\";\n \n final ExchangeRateUtil exchangeRateUtilities =\n new ExchangeRateUtil(true, destinationCurrency);\n exchangeRateUtilities.loadExchangeRatesFromCurrency(sourceCurrency);\n \n final double factor =\n exchangeRateUtilities.getExchangeRateForCurrency(sourceCurrency,\n ExchangeRateType.BUDGET);\n \n assertEquals(\"1.18\", String.valueOf(factor));\n }", "public String getCurrencies() {\n try {\n URLConnection connection = new URL(url).openConnection();\n connection.setConnectTimeout(30000);\n connection.setReadTimeout(60000);\n return inputStreamToString(connection.getInputStream());\n } catch (IOException ignored) {\n }\n return null;\n // return \"{\\\"success\\\":true,\\\"timestamp\\\":1522438448,\\\"base\\\":\\\"EUR\\\",\\\"date\\\":\\\"2018-03-30\\\",\\\"rates\\\":{\\\"AED\\\":4.525864,\\\"AFN\\\":85.161016,\\\"ALL\\\":129.713915,\\\"AMD\\\":591.02486,\\\"ANG\\\":2.194225,\\\"AOA\\\":263.604778,\\\"ARS\\\":24.782964,\\\"AUD\\\":1.603522,\\\"AWG\\\":2.193728,\\\"AZN\\\":2.094523,\\\"BAM\\\":1.959078,\\\"BBD\\\":2.464863,\\\"BDT\\\":102.168576,\\\"BGN\\\":1.956367,\\\"BHD\\\":0.464385,\\\"BIF\\\":2157.962929,\\\"BMD\\\":1.232432,\\\"BND\\\":1.622501,\\\"BOB\\\":8.454972,\\\"BRL\\\":4.072329,\\\"BSD\\\":1.232432,\\\"BTC\\\":0.000181,\\\"BTN\\\":80.292916,\\\"BWP\\\":11.742489,\\\"BYN\\\":2.403731,\\\"BYR\\\":24155.657915,\\\"BZD\\\":2.462157,\\\"CAD\\\":1.588901,\\\"CDF\\\":1929.376385,\\\"CHF\\\":1.174759,\\\"CLF\\\":0.027287,\\\"CLP\\\":743.649213,\\\"CNY\\\":7.730802,\\\"COP\\\":3437.005101,\\\"CRC\\\":692.811412,\\\"CUC\\\":1.232432,\\\"CUP\\\":32.659435,\\\"CVE\\\":110.314948,\\\"CZK\\\":25.337682,\\\"DJF\\\":217.930869,\\\"DKK\\\":7.455792,\\\"DOP\\\":60.88212,\\\"DZD\\\":140.270429,\\\"EGP\\\":21.66663,\\\"ERN\\\":18.474632,\\\"ETB\\\":33.546785,\\\"EUR\\\":1,\\\"FJD\\\":2.489994,\\\"FKP\\\":0.876387,\\\"GBP\\\":0.878367,\\\"GEL\\\":2.977929,\\\"GGP\\\":0.878427,\\\"GHS\\\":5.436305,\\\"GIP\\\":0.876757,\\\"GMD\\\":58.022879,\\\"GNF\\\":11085.722017,\\\"GTQ\\\":9.041167,\\\"GYD\\\":251.699486,\\\"HKD\\\":9.672744,\\\"HNL\\\":29.022579,\\\"HRK\\\":7.425898,\\\"HTG\\\":79.270474,\\\"HUF\\\":312.396738,\\\"IDR\\\":16958.257802,\\\"ILS\\\":4.30267,\\\"IMP\\\":0.878427,\\\"INR\\\":80.242385,\\\"IQD\\\":1459.198927,\\\"IRR\\\":46515.663531,\\\"ISK\\\":121.33288,\\\"JEP\\\":0.878427,\\\"JMD\\\":154.325077,\\\"JOD\\\":0.873183,\\\"JPY\\\":130.921205,\\\"KES\\\":124.16795,\\\"KGS\\\":84.307561,\\\"KHR\\\":4914.197347,\\\"KMF\\\":490.729577,\\\"KPW\\\":1109.188805,\\\"KRW\\\":1306.217196,\\\"KWD\\\":0.368748,\\\"KYD\\\":1.011066,\\\"KZT\\\":393.096349,\\\"LAK\\\":10204.533468,\\\"LBP\\\":1860.972035,\\\"LKR\\\":191.667756,\\\"LRD\\\":162.373324,\\\"LSL\\\":14.567811,\\\"LTL\\\":3.757319,\\\"LVL\\\":0.764786,\\\"LYD\\\":1.634332,\\\"MAD\\\":11.330857,\\\"MDL\\\":20.258758,\\\"MGA\\\":3919.132681,\\\"MKD\\\":61.251848,\\\"MMK\\\":1639.134357,\\\"MNT\\\":2940.582048,\\\"MOP\\\":9.954478,\\\"MRO\\\":432.583892,\\\"MUR\\\":41.29107,\\\"MVR\\\":19.189425,\\\"MWK\\\":879.265951,\\\"MXN\\\":22.379772,\\\"MYR\\\":4.759698,\\\"MZN\\\":75.486896,\\\"NAD\\\":14.553832,\\\"NGN\\\":438.746047,\\\"NIO\\\":38.143757,\\\"NOK\\\":9.665842,\\\"NPR\\\":128.377096,\\\"NZD\\\":1.702979,\\\"OMR\\\":0.474245,\\\"PAB\\\":1.232432,\\\"PEN\\\":3.975213,\\\"PGK\\\":3.925342,\\\"PHP\\\":64.28409,\\\"PKR\\\":142.185629,\\\"PLN\\\":4.210033,\\\"PYG\\\":6843.692686,\\\"QAR\\\":4.487658,\\\"RON\\\":4.655145,\\\"RSD\\\":118.061885,\\\"RUB\\\":70.335482,\\\"RWF\\\":1038.853498,\\\"SAR\\\":4.62113,\\\"SBD\\\":9.587829,\\\"SCR\\\":16.588987,\\\"SDG\\\":22.246869,\\\"SEK\\\":10.278935,\\\"SGD\\\":1.615324,\\\"SHP\\\":0.876757,\\\"SLL\\\":9588.317692,\\\"SOS\\\":693.859366,\\\"SRD\\\":9.145099,\\\"STD\\\":24512.446842,\\\"SVC\\\":10.784232,\\\"SYP\\\":634.677563,\\\"SZL\\\":14.552187,\\\"THB\\\":38.403022,\\\"TJS\\\":10.877199,\\\"TMT\\\":4.202592,\\\"TND\\\":2.98138,\\\"TOP\\\":2.726513,\\\"TRY\\\":4.874764,\\\"TTD\\\":8.17041,\\\"TWD\\\":35.851887,\\\"TZS\\\":2774.203779,\\\"UAH\\\":32.339456,\\\"UGX\\\":4541.510587,\\\"USD\\\":1.232432,\\\"UYU\\\":34.915237,\\\"UZS\\\":10007.344406,\\\"VEF\\\":60824.193529,\\\"VND\\\":28089.579347,\\\"VUV\\\":129.873631,\\\"WST\\\":3.158603,\\\"XAF\\\":655.530358,\\\"XAG\\\":0.075316,\\\"XAU\\\":0.00093,\\\"XCD\\\":3.33201,\\\"XDR\\\":0.847694,\\\"XOF\\\":655.530358,\\\"XPF\\\":119.368042,\\\"YER\\\":307.923024,\\\"ZAR\\\":14.559828,\\\"ZMK\\\":11093.367083,\\\"ZMW\\\":11.622277,\\\"ZWL\\\":397.280478}}\";\n }", "public List<Absence> getAllAbsencesOnAGivenDate(LocalDate date) throws SQLException {\n List<Absence> allAbsencesForADate = new ArrayList(); //get a list to store the values.\n java.sql.Date sqlDate = java.sql.Date.valueOf(date); // converts LocalDate date to sqlDate\n try(Connection con = dbc.getConnection()){\n String SQLStmt = \"SELECT * FROM ABSENCE WHERE DATE = '\" + sqlDate + \"'\";\n Statement statement = con.createStatement();\n ResultSet rs = statement.executeQuery(SQLStmt);\n while(rs.next()) //While you have something in the results\n {\n int userKey = rs.getInt(\"studentKey\");\n allAbsencesForADate.add(new Absence(userKey, date)); \n } \n }\n return allAbsencesForADate;\n }", "static double userOnDay(final float rate, final int day) {\n return Math.pow(rate, day);\n }", "@gw.internal.gosu.parser.ExtendedProperty\n public entity.RateTable[] getRateTables();", "public interface CurrencyRatesUpdater {\n\n public static final String ERROR_CONNECTING = \"ERROR_CONNECTING\";\n public static final String ERROR_RESPONSE = \"ERROR_RESPONSE\";\n public static final String ERROR_UNKNOWN = \"ERROR_UNKNOWN\";\n\n public ResponseRateUpdate getRate(String fromCurrencyCode, String toCurrencyCode);\n\n public class ResponseRateUpdate {\n\n public ResponseRateUpdate() {\n }\n\n public ResponseRateUpdate(Double rateValue, Date rateDate) {\n this.rateValue = rateValue;\n this.rateDate = rateDate;\n }\n\n public ResponseRateUpdate(String error) {\n this.error = error;\n }\n\n private Double reverseRateValue;\n private Double rateValue;\n private Date rateDate;\n private String error;\n\n public Double getRateValue() {\n return rateValue;\n }\n\n public void setRateValue(Double rateValue) {\n this.rateValue = rateValue;\n }\n\n public Date getRateDate() {\n return rateDate;\n }\n\n public void setRateDate(Date rateDate) {\n this.rateDate = rateDate;\n }\n\n public Double getReverseRateValue() {\n return reverseRateValue;\n }\n\n public void setReverseRateValue(Double reverseRateValue) {\n this.reverseRateValue = reverseRateValue;\n }\n\n public String getError() {\n return error;\n }\n\n public void setError(String error) {\n this.error = error;\n }\n }\n}", "HashMap<String, Double> getPortfolioData(String date);", "String getTradeCurrency();", "Currency getCurrency();", "@Override\n @Cacheable(value=AccountingPeriod.CACHE_NAME, key=\"'date='+#p0\")\n public AccountingPeriod getByDate(Date date) {\n Map<String,Object> primaryKeys = new HashMap<String, Object>();\n primaryKeys.put(OLEPropertyConstants.UNIVERSITY_DATE, date);\n UniversityDate universityDate = businessObjectService.findByPrimaryKey(UniversityDate.class, primaryKeys);\n primaryKeys.clear();\n primaryKeys.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, universityDate.getUniversityFiscalYear());\n primaryKeys.put(OLEPropertyConstants.UNIVERSITY_FISCAL_PERIOD_CODE, universityDate.getUniversityFiscalAccountingPeriod());\n return businessObjectService.findByPrimaryKey(AccountingPeriod.class, primaryKeys);\n }", "public static JsonObject updateRates() {\n\n try {\n URL fixerAPI = new URL(\"http://api.fixer.io/latest?base=AUD\");\n URLConnection urlConnect = fixerAPI.openConnection();\n InputStream is = urlConnect.getInputStream();\n\n //Parsing API in as string\n Scanner s = new Scanner(is).useDelimiter(\"\\\\A\");\n String stringRates = s.hasNext() ? s.next() : \"\";\n is.close();\n \n\n //Converting string to JsonObject\n JsonParser parser = new JsonParser();\n conversionRates = parser.parse(stringRates).getAsJsonObject();\n\n DateFormat df = new SimpleDateFormat(\"h:mm a\");\n updateTime = df.format(Calendar.getInstance().getTime());\n\n\n } catch (Exception e) {\n //Raised if there is an error retrieving data from the input stream\n e.printStackTrace();\n JsonParser parserException = new JsonParser();\n //Backup Rates to be used if the device has no internet connection\n String backupRates = \"{\\\"base\\\":\\\"AUD\\\",\\\"date\\\":\\\"2017-03-31\\\",\\\"rates\\\":{\\\"BGN\\\":1.3988,\\\"BRL\\\":2.4174,\\\"CAD\\\":1.0202,\\\"CHF\\\":0.76498,\\\"CNY\\\":5.2669,\\\"CZK\\\":19.332,\\\"DKK\\\":5.3196,\\\"GBP\\\":0.61188,\\\"HKD\\\":5.9415,\\\"HRK\\\":5.3258,\\\"HUF\\\":220.01,\\\"IDR\\\":10183.0,\\\"ILS\\\":2.7788,\\\"INR\\\":49.632,\\\"JPY\\\":85.503,\\\"KRW\\\":854.31,\\\"MXN\\\":14.317,\\\"MYR\\\":3.3839,\\\"NOK\\\":6.5572,\\\"NZD\\\":1.0949,\\\"PHP\\\":38.376,\\\"PLN\\\":3.0228,\\\"RON\\\":3.256,\\\"RUB\\\":43.136,\\\"SEK\\\":6.8175,\\\"SGD\\\":1.0685,\\\"THB\\\":26.265,\\\"TRY\\\":2.7817,\\\"USD\\\":0.76463,\\\"ZAR\\\":10.185,\\\"EUR\\\":0.71521}}\";\n conversionRates = parserException.parse(backupRates).getAsJsonObject();\n }\n\n return conversionRates;\n }", "double getStockValue(String date) throws IllegalArgumentException;", "private void givenExchangeRatesExistsForSixMonths() {\n }", "private static List<Date> getTradeDays(Date startDate, Date expiration) {\r\n\t\t\r\n\t\tEntityManagerFactory emf = Persistence.createEntityManagerFactory(\"JPAOptionsTrader\");\r\n\t\tEntityManager em = emf.createEntityManager();\r\n\t\t\r\n\t\t// Note: table name refers to the Entity Class and is case sensitive\r\n\t\t// field names are property names in the Entity Class\r\n\t\tQuery query = em.createQuery(\"select distinct(opt.trade_date) from \" + TradeProperties.SYMBOL_FOR_QUERY + \" opt where \"\r\n\t\t\t\t+ \"opt.trade_date >= :tradeDate \" \r\n\t\t\t\t+ \"and opt.expiration=:expiration \"\t\r\n\t\t\t\t+ \" order by opt.trade_date\");\r\n\t\t\r\n\t\tquery.setParameter(\"tradeDate\", startDate);\r\n\t\tquery.setParameter(\"expiration\", expiration);\r\n\r\n\t\tquery.setHint(\"odb.read-only\", \"true\");\r\n\r\n\t\t@SuppressWarnings(\"unchecked\")\r\n\t\tList<Date> tradeDates = query.getResultList();\r\n\t\t\r\n\t\tem.close();\r\n\t\t\r\n\t\treturn tradeDates;\r\n\t}", "@GetMapping(\"/signalforbullish/{ticker}\")\n public List<String> getBullishEngulfingforstock(@PathVariable String ticker) {\n List<CandleModel> result = candleService.getCandleData(ticker);\n List<String> dates=candleService.getBullishEngulfingCandleSignal(result);\n System.out.println(dates);\n return dates;\n }", "public Double getRawGross(java.sql.Timestamp transDate, java.sql.Timestamp eodDate, int storeCode) {\r\n\t\tString query = \"SELECT SUM(i.SELL_PRICE*i.QUANTITY) FROM invoice_item i, invoice o WHERE o.TRANS_DT >= ? AND o.TRANS_DT <= ? AND i.OR_NO = o.OR_NO AND i.STORE_CODE = o.STORE_CODE AND o.STORE_CODE = ?\"\r\n\t\t+ \" AND NOT EXISTS (SELECT 1 FROM INVOICE_SET s WHERE s.OR_NO = o.OR_NO) \";\r\n\t\tPreparedStatement pquery;\r\n\t\tResultSet rs = null;\r\n\t\tDouble dailySale = 0.0d;\r\n\t\ttry {\r\n\t\t\tpquery = Main.getDBManager().getConnection().prepareStatement(query);\r\n\t\t\t\r\n\t\t\tpquery.setTimestamp(1, transDate);\r\n\t\t\tpquery.setTimestamp(2, eodDate);\r\n\t\t\tpquery.setInt(3, storeCode);\r\n\t\t\tlogger.debug(\"TRANS DATE BEFORE\"+transDate.toLocaleString());\r\n\t\t\tlogger.debug(\"TRANS DATE BEFORE\"+eodDate.toLocaleString());\r\n\t\t\t\r\n\t\t\trs = pquery.executeQuery();\r\n\t\t\t\r\n\t\t\twhile(rs.next()){\r\n//\t\t\t\tdouble amount = rs.getDouble(1);\r\n//\t\t\t\tdailySale = amount/getVatRate();\r\n\t\t\t\tdailySale = rs.getDouble(1);\r\n\t\t\t\tlogger.debug(\"Raw Gross BEFORE SUBTRACTION: \"+dailySale);\r\n\t\t\t\t// SUBTRACT all returned items\r\n\t\t\t\tdailySale = dailySale - getDeductibles(transDate, eodDate, storeCode) + getCompletedTransactions(transDate, eodDate, storeCode);\r\n\t\t\t\tlogger.debug(\"Raw Gross AFTER RETURNED SUBTRACTION: \"+dailySale);\r\n\t\t\t\treturn dailySale;\r\n\t\t\t}\r\n\t\t} catch (SQLException e1) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te1.printStackTrace();\r\n\t\t}\r\n\t\treturn dailySale;\r\n\r\n\t}", "@Override\n public double calculatePayDay()\n {\n double perWeekEarned = hourlyRate * hoursPerWeek;\n return (double)Math.round(perWeekEarned * 100) / 100;\n }", "public Option<CurrencyExchangeRate> indirectRateFor(final Currency curA, final Currency curB) throws NoSuchExchangeRateException {\n\n // TODO Improve this to attempt to use defaultCurrency first\n Option<CurrencyExchangeRate> directRateFor = directRateFor(curA, curB);\n if (!directRateFor.isEmpty()) {\n return directRateFor;\n } else {\n List<CurrencyExchangeRate> ratesWithCurA = new ArrayList<CurrencyExchangeRate>();\n List<CurrencyExchangeRate> ratesWithCurB = new ArrayList<CurrencyExchangeRate>();\n for (CurrencyExchangeRate r : this.rates) {\n if (r.base.currency == curA || r.counter.currency == curA) {\n ratesWithCurA.add(r);\n }\n if (r.base.currency == curB || r.counter.currency == curB) {\n ratesWithCurB.add(r);\n }\n }\n List<Currency> curs = new ArrayList<Currency>();\n for (Currency cur : this.currencies) {\n if ((containsBaseCurrency(ratesWithCurA, cur) || containsCounterCurrency(ratesWithCurA, cur)) && \n (containsBaseCurrency(ratesWithCurB, cur) || containsCounterCurrency(ratesWithCurB, cur))) {\n curs.add(cur);\n }\n }\n if (curs.size() > 0) {\n Money m = Money(1d, curs.get(0));\n return Some.some(new CurrencyExchangeRate(convert(m, curA), convert(m, curB)));\n } else {\n return None.none();\n }\n }\n }", "public List<Order> retrieveOrders1DayAgo( Date currentDate ) throws OrderException;", "@Test\n public void getExchangeRateUSD() {\n\n ConverterSvc converterSvc = new ConverterSvc(client);\n var actual = converterSvc.getExchangeRate(ConverterSvc.Currency.USD);\n\n float expected = (float)11486.5341;\n Assert.assertEquals(actual, expected);\n }", "public CurrencyRates() {\n this(DSL.name(\"currency_rates\"), null);\n }", "Pair<Date, Date> getForDatesFrame();", "List<InsureUnitTrend> queryInsureDate();" ]
[ "0.670901", "0.66611046", "0.661874", "0.6571793", "0.64523846", "0.63864213", "0.6371617", "0.63185865", "0.6265709", "0.6241024", "0.61921465", "0.61071706", "0.6098057", "0.607627", "0.60678995", "0.60479325", "0.60120547", "0.59594345", "0.5951822", "0.59094614", "0.5894217", "0.5884937", "0.5882196", "0.58501464", "0.57993007", "0.5794244", "0.57796395", "0.5765518", "0.57449794", "0.57228005", "0.56879693", "0.5683547", "0.5648086", "0.5629709", "0.55867505", "0.55860966", "0.5580811", "0.5528388", "0.5506606", "0.55044997", "0.5484073", "0.5483658", "0.545886", "0.5451163", "0.54508066", "0.5433762", "0.54304034", "0.5410842", "0.5383612", "0.5376647", "0.53726393", "0.53712636", "0.5342884", "0.5330208", "0.53013605", "0.530122", "0.53009874", "0.52933884", "0.5292653", "0.5281271", "0.5276593", "0.52729845", "0.52618635", "0.5256253", "0.52505916", "0.5249449", "0.52432036", "0.5240741", "0.52373904", "0.5231889", "0.5222527", "0.52193236", "0.52130383", "0.5204793", "0.5182109", "0.51706433", "0.5152388", "0.51517546", "0.5141188", "0.5126676", "0.5122437", "0.5119333", "0.5116826", "0.5083841", "0.5065666", "0.50645095", "0.5059331", "0.50589406", "0.5050866", "0.50453484", "0.5037667", "0.50193685", "0.50119877", "0.50057495", "0.5005351", "0.50034624", "0.4995485", "0.49925748", "0.49778557", "0.49723384" ]
0.7005935
0
Save new or update existing Exchange rate
ExchangeRate saveOrUpdate(ExchangeRate rate);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Rate save(Rate u);", "@Override\r\n\tpublic void updateRate(Rates rates) {\n\t\tsession.saveOrUpdate(rates);\r\n\t\tsession.beginTransaction().commit();\r\n\t}", "public String insertExchangeRate() {\r\n\t\t\r\n\t\tString loginId = com.omp.admin.common.util.CommonUtil.getLoginId(this.req.getSession());\r\n\t\texRateS.setInsBy(loginId);\r\n\t\tservice.insertExchangeRate(exRateS);\r\n\t\t\t\r\n\t\treturn SUCCESS;\r\n\t}", "@Override\n public RateDTO updateRate(RateDTO rateDTO) {\n Rate rate = modelMapper.map(rateDTO, Rate.class);\n return modelMapper.map(rateRepository.save(rate), RateDTO.class);\n }", "public void updateExchangeRate(ExchangeRateVO exchangeRateVO)\n throws RemoteException, ExchangeRateException;", "public void setRate(int rate) { this.rate = rate; }", "@Scheduled(fixedRate = 5 * 1000 * 60 * 60)\n public void save(){\n // delete old currencies amounts\n repository.deleteAllInBatch();\n\n FxRates rates = currencyTableService.getCurrencies();\n List<CurrencyTable> currencyTables = transform(rates);\n // add euro in currency list\n CurrencyTable euro = new CurrencyTable();\n euro.setCurrency(\"EUR\");\n euro.setExchangeRate(BigDecimal.ONE);\n\n repository.save(euro);\n repository.saveAll(currencyTables);\n }", "@Override\n public RateDTO addRate(RateDTO rateDTO) {\n Rate rate = modelMapper.map(rateDTO, Rate.class);\n return modelMapper.map(rateRepository.save(rate), RateDTO.class);\n }", "void writeEcbRatesToDb(EcbEnvelope envelope);", "private void saveRatesData() throws CoeusUIException {\r\n if(getFunctionType() == TypeConstants.DISPLAY_MODE) {\r\n dlgRates.dispose();\r\n return ;\r\n }\r\n try{\r\n //Bug Fix id 1654\r\n //dlgRates.setCursor(new Cursor(Cursor.WAIT_CURSOR));\r\n try{\r\n if(!validate()) {\r\n throw new CoeusUIException();\r\n }\r\n }catch (CoeusUIException coeusUIException) {\r\n throw coeusUIException;\r\n }\r\n\r\n saveFormData();\r\n \r\n Hashtable ratesData = new Hashtable();\r\n CoeusVector cvData = queryEngine.getDetails(queryKey, InstituteRatesBean.class);\r\n \r\n //Bug Fix: 1742: Performance Fix - Start 1\r\n //cvData.sort(\"acType\");\r\n //Bug Fix: 1742: Performance Fix - End 1\r\n \r\n ratesData.put(InstituteRatesBean.class, cvData);\r\n\r\n cvData = queryEngine.getDetails(queryKey, KeyConstants.RATE_CLASS_DATA);\r\n ratesData.put(KeyConstants.RATE_CLASS_DATA, cvData);\r\n\r\n cvData = queryEngine.getDetails(queryKey, KeyConstants.RATE_TYPE_DATA);\r\n ratesData.put(KeyConstants.RATE_TYPE_DATA, cvData);\r\n \r\n RequesterBean requesterBean = new RequesterBean();\r\n requesterBean.setFunctionType(UPDATE_RATE_DATA);\r\n requesterBean.setDataObject(ratesData);\r\n \r\n AppletServletCommunicator appletServletCommunicator = new \r\n AppletServletCommunicator(CONNECTION_STRING, requesterBean);\r\n appletServletCommunicator.send();\r\n ResponderBean responderBean = appletServletCommunicator.getResponse();\r\n \r\n if(responderBean == null) {\r\n //Could not contact server.\r\n CoeusOptionPane.showErrorDialog(COULD_NOT_CONTACT_SERVER);\r\n throw new CoeusUIException();\r\n }\r\n \r\n if(responderBean.isSuccessfulResponse()) {\r\n cleanUp();\r\n dlgRates.dispose();\r\n }else {\r\n //Server Error\r\n CoeusOptionPane.showErrorDialog(responderBean.getMessage());\r\n throw new CoeusUIException();\r\n }\r\n }catch (CoeusException coeusException){\r\n coeusException.printStackTrace();\r\n }\r\n }", "ResponseEntity<String> saveTieredRates(TieredRates tieredRates);", "public void setRate(double newRate) {\n this.rate = newRate;\n }", "public boolean saveOrUpdateStockExchange(StockExchange stockExchange);", "public void setRate(Integer rate) {\r\n this.rate = rate;\r\n }", "public void setExchangeRate(ExchangeRateVO exchangeRateVO)\n throws RemoteException, ExchangeRateException;", "@PostMapping(\"/exchange\")\n public ResponseEntity<ExchangeResult> getExchangeRate(@RequestBody ExchangeRequest exchangeRequest) {\n\n ExchangeResult result = currencyExchangeService.calculate(exchangeRequest);\n\n\n// 4. do nbp exchange downoloaderprzekazujemy date i walute(wartosci nie bo jąliczymy w serwisie)\n// 5. w nbp exchange downoloader wstzukyjemy rest tempplate\n// 6. majac wynik wracamy do currency exchange servise(typem zwracamyn bedzie obiekt ktory bedzie zawierał rating i error message(typ string))\n// i w momencie jak nie bedzie błedu uzupełniamy rating lub error , dodac boolena ktory nam powie czy jest ok czy nie\n// jak jest ok to wyciagamy stawke rate i dzielimy ją\n// 7. nastepnie mamy wynik\n\n\n return new ResponseEntity<>(result, result.getStatus());\n }", "public DDbExchangeRate() {\n super(DModConsts.F_EXR);\n initRegistry();\n }", "public void updateAmount(double amount, Double rate){\r\n\t\t\tcurrencyAmount = currencyAmount + amount;\r\n\t\t\tdefaultCurrencyAmount = rate == null ? 0 : defaultCurrencyAmount + amount * rate.doubleValue();\r\n\t\t}", "public BigDecimal getExchangeRate() {\n return exchangeRate;\n }", "ResponseEntity<String> saveTouRates(TOURates touRates);", "@Override\n\tpublic void saveEntityObj(StdMilkRate e) {\n\t}", "public void setExchrate(BigDecimal exchrate) {\n this.exchrate = exchrate;\n }", "ResponseEntity<String> saveGenericRates(GenericRates genericRates);", "public void setRate();", "public static void rateMarket(Supermarket supermarket, int rating_no, double new_quality) throws SQLException {\r\n\t\tPreparedStatement statement = null;\r\n\t\tString query;\r\n\t\ttry {\r\n\t\t\tquery = \"UPDATE CS_MARKETS\" +\" SET MARKET_REVNO=?, MARKET_QUALITY=? WHERE MARKET_NAME=?\";\r\n\t\t\tstatement = JdbcCommon.connection.prepareStatement(query);\r\n\t\t\tstatement.setInt(1, rating_no);\r\n\t\t\tstatement.setDouble(2, new_quality);\r\n\t\t\tstatement.setString(3, supermarket.getSuper_name());\r\n\t\t\tstatement.executeUpdate();\t\r\n\t\t} catch (SQLException e) {e.printStackTrace();}\r\n\t\tstatement.close();\r\n\t}", "public void updateRate(double r){\r\n rate *= r;\r\n }", "private boolean saveRate(TSDBData rateObj) {\n InfluxDBClient dbClient = new InfluxDBClient();\n\n ObjectMapper mapper = new ObjectMapper();\n String jsonData = null;\n boolean result;\n try {\n jsonData = mapper.writeValueAsString(rateObj);\n } catch (JsonProcessingException e) {\n e.printStackTrace();\n }\n result = dbClient.saveData(jsonData);\n return result;\n }", "int updateByPrimaryKey(BasicInfoAnodeBurningLossRate record);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == 1 && resultCode == 2) {\n rate.put(\"dollar\", data.getFloatExtra(\"dollar\", 0f));\n rate.put(\"euro\", data.getFloatExtra(\"euro\", 0f));\n rate.put(\"won\", data.getFloatExtra(\"won\", 0f));\n SharedPreferences sp = getSharedPreferences(\"myrate\", Activity.MODE_PRIVATE);\n SharedPreferences.Editor ed = sp.edit();\n ed.putFloat(\"dollar\", data.getFloatExtra(\"dollar\", 0f));\n ed.putFloat(\"euro\", data.getFloatExtra(\"euro\", 0f));\n ed.putFloat(\"won\", data.getFloatExtra(\"won\", 0f));\n ed.apply();\n\n }\n }", "public void addRate(Rate rate){\n //create ContentValue containning values to be inserted/updated in database in this case only on column\n ContentValues values = new ContentValues();\n\n values.put(COL_CARNUM, rate.getCarnum());\n values.put(COL_DATE, rate.getDate());\n values.put(COL_RATE, rate.getRate());\n values.put(COL_PARKINPNUM, rate.getParkingnum());\n values.put(COL_FLOORNUM, rate.getFloornum());\n\n //create SQLiteDatabase object to enable writing/reading in database\n SQLiteDatabase db = getWritableDatabase();\n long id = db.insert(TABLE_RATE, null, values);\n rate.setId(id);//update the user ID according to the auto incremented id in the DB\n\n //logging for debugging purposes\n Log.d(\"ID \", \"Category id: \"+id+\" added to DB\");\n\n //close connection to database\n db.close();\n }", "public void setRate(double annualRate) {\nmonthlyInterestRate = annualRate / 100.0 / MONTHS;\n}", "public void setEntrenchmentRate(int value) {\n this.entrenchmentRate = value;\n }", "public void singleUpdate() {\n\t\ttry {\n\t\t\tthis.updateBy = CacheUtils.getUser().username;\n\t\t} catch (Exception e) {\n\t\t\tif (! getClass().equals(GlobalCurrencyRate.class)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.updateBy = \"super\";\n\t\t}\n\t\tthis.workspace = CacheUtils.getWorkspaceId();\n\t\tthis.updateAt = new Date();\n\n\t\tif (insertBy == null) insertBy = updateBy;\n\t\tif (insertAt == null) insertAt = updateAt;\n\n\t\tsuper.update();\n\t\tCacheUtils.cleanAll(this.getClass(), getAuditRight());\n\t}", "@PostMapping(\"/rating/update/{id}\")\r\n public String updateRating(@PathVariable(\"id\") Integer id, @Valid Rating rating,\r\n BindingResult result, Model model) {\r\n if (result.hasErrors()) {\r\n return \"rating/update\";\r\n }\r\n rating.setId(id);\r\n ratingRepository.save(rating);\r\n model.addAttribute(\"trades\", ratingRepository.findAll());\r\n return \"redirect:/rating/list\";\r\n }", "public void setRate(float rate) {\n\t\tthis.rate = rate;\n\t}", "int updateByExample(@Param(\"record\") BasicInfoAnodeBurningLossRate record, @Param(\"example\") BasicInfoAnodeBurningLossRateExample example);", "public void setEXCH_RATE(BigDecimal EXCH_RATE) {\r\n this.EXCH_RATE = EXCH_RATE;\r\n }", "public interface ExchangeRateService {\n BigDecimal exchange(Currency curr1, Currency curr2, BigDecimal amount);\n}", "public abstract void setRate();", "public void saveRating(sust.bookshelves.entity.Rating model) throws GenericBusinessException {\n // We have to create an object:\n sust.bookshelves.hibernatehelper.HibernateQueryHelper hibernateTemplate = new sust.bookshelves.hibernatehelper.HibernateQueryHelper();\n try {\n // Now update the data.\n hibernateTemplate.update(model);\n } finally {\n log.debug(\"finished saveRating(sust.bookshelves.entity.Rating model)\");\n }\n }", "public void addActivityRates(ActivityRates activityRates) {\n jdbcTemplate.update(\"INSERT INTO Activity_rates VALUES(?, ?, ?)\",\n activityRates.getIdActivity(), activityRates.getRateName(), activityRates.getPrice());\n }", "int updateByExample(PaymentTrade record, PaymentTradeExample example);", "public void setOriginalExchangeRate(java.math.BigDecimal originalExchangeRate) {\r\n this.originalExchangeRate = originalExchangeRate;\r\n }", "public void setExchangeRateType(final String exchangeRateType) {\n this.exchangeRateType = exchangeRateType;\n }", "boolean saveExpense(Expenses exp);", "public String getExchangeRateType() {\n return this.exchangeRateType;\n }", "public void singleSave() {\n\t\ttry {\n\t\t\tthis.insertBy = CacheUtils.getUser().username;\n\t\t} catch (Exception e) {\n\t\t\tif (! getClass().equals(GlobalCurrencyRate.class)) {\n\t\t\t\tlog.error(\"ERROR\", e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.insertBy = \"super\";\n\t\t}\n\t\tthis.workspace = CacheUtils.getWorkspaceId();\n\t\tthis.insertAt = new Date();\n\n\t\tsuper.save();\n\t\tCacheUtils.cleanAll(this.getClass(), getAuditRight());\n\t}", "@Override protected double convertRate(double rate) {\n return super.convertRate(rate);\n }", "public void setHourlyRate(double rate) {\n\t\tthis.hourlyRate = rate;\n\t}", "public void setInterest(double rate)\n {\n interestRate = rate;\n }", "public static void updatePayRate(Statement stmt, String empID, double payRate) throws SQLException{\r\n //create an update statement to update the payrate\r\n //for the specified employee ID\r\n String sqlStatement = \"UPDATE Employee \" +\r\n \"SET HOURLYPAYRATE = \" + Double.toString(payRate) +\r\n \"WHERE EmpID = '\" + empID + \"'\";\r\n\r\n //Send the UPDATE statement to the DBMS\r\n int rows = stmt.executeUpdate(sqlStatement);\r\n\r\n //display the results\r\n System.out.println(rows + \" row(s) updated.\");\r\n }", "int updateByExampleSelective(@Param(\"record\") BasicInfoAnodeBurningLossRate record, @Param(\"example\") BasicInfoAnodeBurningLossRateExample example);", "public void updateRate(String sponsorName, Double newRate) throws LowerRateException, InvalidRateException {\n\t\tif (newRate < 0.0 || newRate > 0.1) {\n\t\t\tthrow new InvalidRateException(newRate);\n\t\t} else if (sponsors.containsKey(sponsorName)) {\n\t\t\tif (newRate < sponsors.get(sponsorName)) {\n\t\t\t\tthrow new LowerRateException(sponsors.get(sponsorName), newRate);\n\t\t\t}\n\t\t} else {\n\t\t\tsponsors.put(sponsorName, newRate);\n\t\t}\n\t}", "public Trade saveTrade(Trade trade) {\n Account account = trade.getTrader().getAccount();\n Double currentBalUSD = account.getUsd();\n Double usdAmount = trade.getUsdAmount();\n Double foreignAmount = -usdAmount*(1/trade.getRate()); // this calculation is happening on the front end too, more efficient: store the foreign amount in the table too and send it in with the trade\n account.setUsd(currentBalUSD+usdAmount);\n\n /*\n Checking which type of trade to be made (eurusd, gbpusd, nzdusd)\n */\n switch (trade.getCurrencyPair().getId()) {\n case 1: {\n Double currentForeignBal = account.getEur();\n account.setEur(currentForeignBal + foreignAmount);\n break;\n }\n case 2: {\n Double currentForeignBal = account.getGbp();\n account.setGbp(currentForeignBal + foreignAmount);\n break;\n }\n case 3: {\n Double currentForeignBal = account.getNzd();\n account.setNzd(currentForeignBal + foreignAmount);\n break;\n }\n }\n\n return tradeRepository.save(trade);\n }", "public void registerCurrency(String identifier, BigDecimal exchangeRate) {\n if (exchangeRates.containsKey(identifier))\n throw new IllegalArgumentException(\"Currency identifier already used.\");\n\n exchangeRates.put(identifier, exchangeRate);\n }", "private void updatePriceAndSaving() {\n movieOrder = new MovieOrder(movie, Weekday.weekdayForValue(selectedDay), flagsApplied, numberOfTickets);\n\n tvTotalPriceNewTickets.setText(getResources().getString(\n R.string.total_price_new_tickets,\n movieOrder.getTotalPriceAfterDiscount(),\n movieOrder.getNumberOfTicketsAfterOfferIsApplied())\n );\n\n tvSavingsNewTickets.setText(getResources().getString(\n R.string.today_saving_new_tickets,\n movieOrder.getTotalSaving()\n ));\n }", "public SavingsAccount(double rate) //setting interest rate with constructor\r\n { \r\n interestRate = rate;\r\n }", "double requestCurrentRate(String fromCurrency,\n String toCurrency);", "@Override\r\n\tpublic int updateMarket(MarketDto dto) {\n\t\treturn session.update(\"kdc.market.updateMarket\", dto);\r\n\t}", "public void addToRateTables(entity.RateTable element);", "public void updateModel(Bid bid, double time) {\n\t\tif (bid != null) {\n\t\t\t// We receiveMessage each issueEvaluation with the value that has\n\t\t\t// been offered in the bid.\n\t\t\tList<Issue> issues = negotiationSession.getUtilitySpace().getDomain().getIssues();\n\t\t\tfor (Issue issue : issues) {\n\t\t\t\ttry {\n\t\t\t\t\tint issueID = issue.getNumber();\n\t\t\t\t\tValue offeredValue = bid.getValue(issueID);\n\t\t\t\t\tthis.issueEvaluationList.updateIssueEvaluation(issueID, offeredValue);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// After all issueEvaluations have been updated, we can calculate\n\t\t\t// the new\n\t\t\t// estimated weights for the issues themselves.\n\t\t\tthis.issueEvaluationList.updateIssueWeightMap();\n\t\t}\n\t}", "public static void updateCalorieRate(Person person) {\n\n double calorieRate = person.getCalorieRate();\n updatePerson(person, \"usercaloryrate\", calorieRate);\n }", "public int setRate(int rateToServer){\r\n\t\tint resultOfRate=1;\r\n\t\t//! send rate to server and check if ok.\r\n\t\tFLAG_RATED=true;\r\n\t\treturn resultOfRate;\r\n\t}", "@RequestMapping(value = \"/broadband-user/system/ir/edit\")\n\tpublic String toInviteRates(Model model) {\n\n\t\tmodel.addAttribute(\"panelheading\", \"Invite Rates Edit\");\n\t\tmodel.addAttribute(\"action\", \"/broadband-user/system/ir/edit\");\n\n\t\tInviteRates ir = this.systemService.queryInviteRate();\n\n\t\tmodel.addAttribute(\"ir\", ir);\n\n\t\treturn \"broadband-user/system/invite_rates\";\n\t}", "public List<CurrencyExchangeRate> withExchangeRates(List<CurrencyExchangeRate> rates) {\n // TODO: return copy(rates = rates);\n return rates;\n }", "public void save(Currency currency) {\n startTransaction();\n manager.persist(currency);\n endTransaction();\n }", "public void setShippingRateInput(final ShippingRateInputDraft shippingRateInput);", "public void setRate(String rate) {\r\n for (int index = 0; index < RATES.length; ++index){\r\n if (RATES[index].equals(rate)) {\r\n Rate = index;\r\n }\r\n }\r\n }", "private void givenExchangeRateExistsForABaseAndDate() {\n }", "int updateByPrimaryKeySelective(BasicInfoAnodeBurningLossRate record);", "@Override\n\tpublic BigDecimal getExchangedFeeRate(String getExchangedFeeRate,\n\t\t\tDate billTime) {\n\t\treturn null;\n\t}", "public abstract void setDiscountRate(double discountRate);", "public void setHourlyRate(double newPayRate){\r\n if(newPayRate>=MINIMUMWAGE)\r\n hourlyRate = newPayRate;\r\n else\r\n throw new IllegalArgumentException(\"The hourly rate must be greater than or equal to\"+MINIMUMWAGE);\r\n }", "@Override\n\tpublic void doSave(SellOfer model, HttpServletRequest request,\n\t\t\tHttpServletResponse response) {\n\t\t if(StringUtil.isEmpty(model.getPrice())){\n\t\t\t model.setPrice(\"0\");\n\t\t }\n\t\t double dprice =Double.parseDouble(model.getPrice());\n\t BigDecimal bg = new BigDecimal(dprice/10000);\n\t double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();\n\t model.setPrice(f1+\"\");\n\t model.setSource(\"001\");\n\t\t\n\t\tsuper.doSave(model, request, response);\n\t}", "public void sendeRate(String spieler);", "@PostMapping(value= \"/expression\")\n\tpublic String save(final@RequestBody @Valid MathExpression exp){\n\t\tservice.save(exp);\n\t\topratorService.updateOpratorTable(exp);\n\t\treturn service.calulateExp(exp);\n\t}", "public int addRate(String uname, String cid, String rate, String review) {\n\t\ttry {\n\t\t\tPreparedStatement updateStatus = null;\n\t\t\tsql = \"insert into rate values(?,?,?,?)\";\n\t\t\ttry {\n\t\t\t\tupdateStatus = conn.prepareStatement(sql);\n\t\t\t\tupdateStatus.setString(1, uname);\n\t\t\t\tupdateStatus.setString(2, cid);\n\t\t\t\tupdateStatus.setString(3, rate);\n\t\t\t\tupdateStatus.setString(4, review);\n\t\t\t\tupdateStatus.executeUpdate();\n\t\t\t} catch (SQLException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn 0;\n\t\t\t} finally {\n\t\t\t\tupdateStatus.close();\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(\"sql error\");\n\t\t\te.printStackTrace();\n\t\t\treturn 0;\n\t\t}\n\t\treturn 1;\n\t}", "public void applyInterest(double rate) {\n if ((rate > 0) && (balance < 0)) {\n withdraw((int) (-balance*rate));\n } \n if ((rate > 0) && (balance > 0)) {\n deposit((int) (balance*rate));\n }\n }", "double getRate();", "@Override\n\tpublic void doUpdate(SellOfer model, HttpServletRequest request,\n\t\t\tHttpServletResponse response) {\n\t\t if(StringUtil.isEmpty(model.getPrice())){\n\t\t\t\t model.setPrice(\"0\");\n\t\t\t }\n\t\t\t double dprice =Double.parseDouble(model.getPrice());\n\t\t BigDecimal bg = new BigDecimal(dprice/10000);\n\t\t double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();\n\t\t model.setPrice(f1+\"\");\n\t\t model.setSource(\"001\");\n\t\t model.setSellContent(\"\");\n\t\tsuper.doUpdate(model, request, response);\n\t}", "private void addCurrency() {\r\n\t\tString currencyCode = signalThreeLetters();\r\n\t\tif (currencyCode == null){\r\n\t\t\treturn;\r\n\t\t}\r\n System.out.print(\"Enter the exchange rate (value of 1 \" +currencyCode+ \" in NZD): \");\r\n String exchangeRateStr = keyboardInput.getLine();\r\n \r\n double exchangeRate = Double.parseDouble(exchangeRateStr);\r\n if (exchangeRate <= 0) {\r\n \tSystem.out.println(\"Negative exchange rates not permitted. Returning to menu.\");\r\n \tSystem.out.println();\r\n \treturn;\r\n }\r\n System.out.println();\r\n if (currencies == null) {\r\n \tcurrencies = new Currencies();\r\n }\r\n currencies.addCurrency(currencyCode, exchangeRate);\r\n System.out.println(\"Currency \" +currencyCode+ \" with exchange rate \" + exchangeRate + \" added\");\r\n System.out.println();\r\n\t}", "public ExchangeRateVO getExchangeRate(Integer exchRateId)\n throws RemoteException, FinderException;", "protected void onChange_EncounterRate() {\n onChange_EncounterRate_xjal( EncounterRate );\n }", "@Scheduled(fixedRateString = \"${application.updateCheck}\")\n public void readRatesFromWebSite() {\n rateUpdater.update();\n }", "protected void saveEarningHistory(EarningHistory earningHistory){\n }", "public Integer getRate() {\r\n return rate;\r\n }", "private Account_Type(int rate) {\r\n\tthis.rate=rate;\r\n\t}", "public void setRatetype(java.lang.Integer newRatetype) {\n\tratetype = newRatetype;\n}", "public String insertOrUpdateCurrency() {\n if (currency.getHcmoCurrencyId() == null) {\n currencyList = currencyService.getAllCurrency();\n if (currencyList.size() == 1) {\n addActionError(getText(\"errors.currency.restriction\"));\n return INPUT;\n } else {\n Map session = ActionContext.getContext().getSession();\n EmployeesVO oEmp = (EmployeesVO) session.get(\"EMPLOYEE_OBJECT\");\n// currency.setCreated(DateUtils.getCurrentDateTime());\n// currency.setCreatedBy(oEmp);\n // currency.setUpdatedBy(oEmp);\n currency.setIsActive(1);\n currencyService.insertCurrency(currency);\n addActionMessage(getText(\"Added Successfully\"));\n }\n } else {\n Map session = ActionContext.getContext().getSession();\n EmployeesVO oEmp = (EmployeesVO) session.get(\"EMPLOYEE_OBJECT\");\n // currency.setUpdatedBy(oEmp);\n currencyService.updateCurrency(currency);\n addActionMessage(getText(\"Updated Successfully\"));\n }\n // For Drop down List\n return SUCCESS;\n }", "public static void modifyInterestRate(double interestRate){\n annualInterestRate = interestRate;\n }", "public int getRate() {\n return rate_;\n }", "@Override\r\n\tpublic void updateDriverRate(int score, String driverID) {\n\t\t\r\n\t}", "public interface ICurrencyExchangeService {\n/**\n * Requests the current exchange rate from one currency\n * to another.\n * @param fromCurrency the original Currency\n * @param toCurrency the 'destination' or final Currency\n * @return the currency exchange rate\n */\n\n double requestCurrentRate(String fromCurrency,\n String toCurrency);\n}", "public void setEngineeringRate(int value) {\n this.engineeringRate = value;\n }", "@RequestMapping(method = RequestMethod.GET, value = \"/{date}/{baseCurrency}/{targetCurrency}\")\n public ResponseEntity exchangeRate(@PathVariable String date, @PathVariable String baseCurrency,\n @PathVariable String targetCurrency) throws ParseException {\n Utils.validateDate(date);\n CurrentExchangeRate currentExchangeRate = exchangeService.getExchangeRate(Utils.parseDate(date),\n baseCurrency,\n targetCurrency);\n return ResponseEntity.ok(currentExchangeRate);\n }", "public void setStatus(typekey.RateBookStatus value);", "public sust.bookshelves.entity.Rating addRating(sust.bookshelves.entity.Rating model) throws GenericBusinessException {\n sust.bookshelves.hibernatehelper.HibernateQueryHelper hibernateTemplate = new sust.bookshelves.hibernatehelper.HibernateQueryHelper();\n try {\n hibernateTemplate.save(model);\n return getRating(model.getPrimaryKey());\n } finally {\n log.debug(\"finished addRating(sust.bookshelves.entity.Rating model)\");\n }\n }", "public void addToRatebooks(entity.ImpactTestingRateBook element);", "int updateByExample(@Param(\"record\") ExchangeOrder record, @Param(\"example\") ExchangeOrderExample example);", "public Builder setRate(int value) {\n \n rate_ = value;\n onChanged();\n return this;\n }" ]
[ "0.71780324", "0.7034827", "0.6937259", "0.67453885", "0.6640454", "0.6253453", "0.62503815", "0.6170907", "0.6116238", "0.608065", "0.60754144", "0.60376626", "0.6029138", "0.5998314", "0.5938972", "0.59371847", "0.5909589", "0.58947307", "0.58462286", "0.58367085", "0.58312815", "0.5810242", "0.5756852", "0.57429606", "0.5694772", "0.56941175", "0.566508", "0.5656793", "0.5649786", "0.5643758", "0.56411886", "0.56257564", "0.5624046", "0.5613666", "0.56068903", "0.5606255", "0.5597344", "0.5586819", "0.55851364", "0.5584271", "0.5576597", "0.55620015", "0.55542547", "0.5553865", "0.5514036", "0.54976934", "0.54782563", "0.54531074", "0.54366606", "0.5419083", "0.53929555", "0.53807896", "0.5372459", "0.53484815", "0.5337796", "0.5336134", "0.53348047", "0.5332952", "0.53311497", "0.5331077", "0.5324653", "0.53236437", "0.5323419", "0.5316875", "0.5309924", "0.53088194", "0.52923024", "0.52906924", "0.5290099", "0.5275613", "0.5265286", "0.5263957", "0.52507806", "0.52477515", "0.5240173", "0.52375203", "0.5231863", "0.52286756", "0.5225257", "0.5223398", "0.5217411", "0.52174073", "0.5215955", "0.5198517", "0.5192252", "0.5189486", "0.5187439", "0.5187003", "0.5178685", "0.5177521", "0.5175443", "0.5171845", "0.5170114", "0.5166967", "0.5161919", "0.5155786", "0.51522183", "0.51520103", "0.5150787", "0.51441133" ]
0.8633588
0
Get a number of exchange rates in the database
Long count();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String exchangeRateList() {\r\n\t\tif (exRateS == null) {\r\n\t\t\texRateS = new ExchangeRate();\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\texchangeRateList = service.exchangeRateList(exRateS);\r\n\t\ttotalCount = ((PagenateList) exchangeRateList).getTotalCount();\r\n\t\t\r\n\t\treturn SUCCESS;\r\n\t}", "public BigDecimal getExchangeRate() {\n return exchangeRate;\n }", "public static ArrayList<Integer> getRates(){\n\t\treturn heartRates;\n\t}", "List<ExchangeRateDto> getHistoryRates(ExchangeRateHistoryFilter filter);", "public Collection getAllExchangeRates()\n throws RemoteException;", "String getExchangeRates(String currency) throws Exception\n\t{\n\t\tString[] rateSymbols = { \"CAD\", \"HKD\", \"ISK\", \"PHP\", \"DKK\", \"HUF\", \"CZK\", \"GBP\", \"RON\", \"HRK\", \"JPY\", \"THB\",\n\t\t\t\t\"CHF\", \"EUR\", \"TRY\", \"CNY\", \"NOK\", \"NZD\", \"ZAR\", \"USD\", \"MXN\", \"AUD\", };\n\n\t\tString rates = \"\";\n\n\t\tfinal String urlHalf1 = \"https://api.exchangeratesapi.io/latest?base=\";\n\n\t\tString url = urlHalf1 + currency.toUpperCase();\n\n\t\tJsonParser parser = new JsonParser();\n\n\t\tString hitUrl = url;\n\t\tString jsonData = getJsonData(hitUrl);\n\n\t\tJsonElement jsonTree = parser.parse(jsonData);\n\n\t\tif (jsonTree.isJsonObject())\n\t\t{\n\t\t\tJsonObject jObject = jsonTree.getAsJsonObject();\n\n\t\t\tJsonElement rateElement = jObject.get(\"rates\");\n\n\t\t\tif (rateElement.isJsonObject())\n\t\t\t{\n\t\t\t\tJsonObject rateObject = rateElement.getAsJsonObject();\n\n\t\t\t\tfor (int i = 0; i < rateSymbols.length; i++)\n\t\t\t\t{\n\t\t\t\t\tJsonElement currentExchangeElement = rateObject.get(rateSymbols[i]);\n\n\t\t\t\t\trates += rateSymbols[i] + \"=\" + currentExchangeElement.getAsDouble()\n\t\t\t\t\t\t\t+ (i < rateSymbols.length - 1 ? \" \" : \".\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn rates;\n\t}", "public Map<String, Double> getAllExchangeRates() {\n init();\n return allExchangeRates;\n }", "@PostMapping(\"/exchange\")\n public ResponseEntity<ExchangeResult> getExchangeRate(@RequestBody ExchangeRequest exchangeRequest) {\n\n ExchangeResult result = currencyExchangeService.calculate(exchangeRequest);\n\n\n// 4. do nbp exchange downoloaderprzekazujemy date i walute(wartosci nie bo jąliczymy w serwisie)\n// 5. w nbp exchange downoloader wstzukyjemy rest tempplate\n// 6. majac wynik wracamy do currency exchange servise(typem zwracamyn bedzie obiekt ktory bedzie zawierał rating i error message(typ string))\n// i w momencie jak nie bedzie błedu uzupełniamy rating lub error , dodac boolena ktory nam powie czy jest ok czy nie\n// jak jest ok to wyciagamy stawke rate i dzielimy ją\n// 7. nastepnie mamy wynik\n\n\n return new ResponseEntity<>(result, result.getStatus());\n }", "ResponseEntity<List<TOURates>> getTouRates();", "long getExpirations();", "private JsonObject getRatesFromApi(){\n try {\n // Setting URL\n String url_str = \"https://v6.exchangerate-api.com/v6/\"+ getApiKey() +\"/latest/\"+ Convert.getBaseCurrency();\n\n // Making Request\n URL url = new URL(url_str);\n HttpURLConnection request = (HttpURLConnection) url.openConnection();\n request.connect();\n\n // Return parsed JSON object\n return parseRequest(request);\n\n } catch (IOException e) {\n e.printStackTrace();\n return new JsonObject();\n }\n }", "public float getlatestrate(String selection,String item) throws SQLException\n {\n // int stock_rate[]= new int [2];\n PreparedStatement remaining_stock = conn.prepareStatement(\"Select latest_rate from purchases where Categroy=? and Item=? \");\n remaining_stock.setString(1, selection);\n remaining_stock.setString(2, item);\n ResultSet remaining_stock_rows = remaining_stock.executeQuery(); \n \n float rate=0;\n while(remaining_stock_rows.next()) \n {\n \n rate=Float.parseFloat(remaining_stock_rows.getString(1));\n \n }\n return rate;\n }", "@gw.internal.gosu.parser.ExtendedProperty\n public entity.RateTable[] getRateTables();", "private int[] funcGetRateDigits(int iCurrency, int iCurrency2) throws OException\r\n\t{\r\n\r\n//\t\tINCGeneralItau.print_msg(\"INFO\", \"**** funcGetRateDigits ****\");\r\n\t\t\r\n\t\t@SuppressWarnings(\"unused\")\r\n int iRetVal, iRateDigits = 0, iCcy1Digits = 0, iCcy2Digits = 0;\r\n\t\tTable tblInsNum = Util.NULL_TABLE;\r\n\r\n\t\t/* Array */\r\n\t\tint[] iRounding = new int[3];\r\n\r\n\t\ttblInsNum = Table.tableNew();\r\n\t\tString sQuery = \"Select ab.ins_num, ab.cflow_type, ab.reference, par.currency, par1.currency as currency2, par.nearby as rate_digits, \" +\r\n\t\t\t\t\t\"c.round as currency1_digits, c2.round as currency2_digits \" +\r\n\t\t\t\t\t\"From ab_tran ab \" +\r\n\t\t\t\t\t\"Left Join parameter par on ab.ins_num = par.ins_num \" +\r\n\t\t\t\t\t\"Left Join parameter par1 on ab.ins_num = par1.ins_num \" +\r\n\t\t\t\t\t\"Left Join header hea on ab.ins_num = hea.ins_num, \" +\r\n\t\t\t\t\t\"currency c, currency c2 \" +\r\n\t\t\t\t\t\"Where ab.tran_type = \" + TRAN_TYPE_ENUM.TRAN_TYPE_HOLDING.jvsValue() +\r\n\t\t\t\t\t\" And ab.tran_status = \" + TRAN_STATUS_ENUM.TRAN_STATUS_VALIDATED.jvsValue() +\r\n\t\t\t\t\t\" And ab.toolset = \" + TOOLSET_ENUM.FX_TOOLSET.jvsValue() +\r\n\t\t\t\t\t\" And par.param_seq_num = 0 And par1.param_seq_num = 1\" +\r\n\t\t\t\t\t\" And c.id_number = \" + iCurrency +\r\n\t\t\t\t\t\" And c2.id_number = \" + iCurrency2 +\r\n\t\t\t\t\t\" And ((par.currency = \" + iCurrency +\r\n\t\t\t\t\t\" And par1.currency = \" + iCurrency2 + \")\" +\r\n\t\t\t\t\t\" Or (par.currency = \" + iCurrency2 +\r\n \" And par1.currency = \" + iCurrency + \"))\" +\r\n\t\t\t\t\t\" And hea.portfolio_group_id > 0\";\r\n\r\n\t\tiRetVal = DBaseTable.execISql(tblInsNum, sQuery);\r\n\r\n//\t\tINCGeneralItau.print_msg(\"DEBUG\", \"(funcGetInsNum)\\n\" + sQuery);\r\n\r\n\t\tif (tblInsNum.getNumRows() > 0)\r\n\t\t{\r\n\t\t\tiRateDigits = tblInsNum.getInt(\"rate_digits\", 1);\r\n\t\t\tiCcy1Digits = tblInsNum.getInt(\"currency1_digits\", 1);\r\n\t\t\tiCcy2Digits = tblInsNum.getInt(\"currency2_digits\", 1);\r\n\r\n\t\t\tiRounding[0] = iRateDigits;\r\n\t\t\tiRounding[1] = iCcy1Digits;\r\n\t\t\tiRounding[2] = iCcy2Digits;\r\n\t\t}\r\n\t\ttblInsNum.destroy();\r\n\r\n\t\treturn iRounding;\r\n\t}", "int getExchangeHistoryListCount();", "public Rates getRates() throws RateQueryException {\n List<Rate> rates;\n\n try {\n HttpResponse response = this.bitPayClient.get(\"rates\");\n rates = Arrays.asList(\n JsonMapperFactory.create().readValue(this.bitPayClient.responseToJsonString(response), Rate[].class)\n );\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n\n return new Rates(rates);\n }", "double getRate();", "public int getChargeRate();", "@RequiresApi(api = Build.VERSION_CODES.N)\n private double GetIterativeConversion(List<RateModel> rates, String fromCurrency, String toCurrency) {\n int numberAttempts = 0;\n double result = 0;\n String filter = fromCurrency;\n double conversion = 1;\n do{\n String finalFilter = filter;\n List<RateModel> fromRates = rates.stream()\n .filter(rate -> rate.getFromCurrency().equals(finalFilter))\n .collect(Collectors.toList());\n\n Optional<RateModel> rate = fromRates.stream().\n filter(x -> x.getToCurrency().equals(toCurrency))\n .findFirst();\n if(rate.isPresent()){\n result = conversion * rate.get().getRate();\n }\n else {\n RateModel firstFromRates = fromRates.get(0);\n conversion = conversion * firstFromRates.getRate();\n filter = firstFromRates.getToCurrency();\n }\n numberAttempts++;\n }\n while (numberAttempts <20 && result == 0);\n\n Log.d(TAG, String.format(\"Looped %1%d times. Conversion: %2%s to %3$s x%4$f\", numberAttempts, fromCurrency, toCurrency, result));\n return result;\n }", "int getPriceCount();", "public Map<String, Double> getExchangeRates(String[] rates){\n Map<String, Double> map = new HashMap<>();\n\n JsonObject conversionRates = getRatesFromApi().getAsJsonObject(\"conversion_rates\");\n if (rates != null) {\n\n for (String temp :\n rates) {\n if (conversionRates.has(temp))\n map.put(temp, conversionRates.get(temp).getAsDouble());\n }\n } else {\n for (Map.Entry<String, JsonElement> element :\n conversionRates.entrySet()) {\n map.put(element.getKey(), element.getValue().getAsDouble());\n }\n }\n\n return map;\n }", "ResponseEntity<List<TieredRates>> getTieredRates();", "public DDbExchangeRate() {\n super(DModConsts.F_EXR);\n initRegistry();\n }", "public Integer getRate() {\r\n return rate;\r\n }", "public int getRate() {\r\n return Integer.parseInt(RATES[Rate]);\r\n }", "int getNumOfSellOrders();", "public int getTotRuptures();", "public Rates getRates(String baseCurrency) throws RateQueryException {\n List<Rate> rates;\n\n try {\n HttpResponse response = this.bitPayClient.get(\"rates/\" + baseCurrency);\n rates = Arrays.asList(\n JsonMapperFactory.create().readValue(this.bitPayClient.responseToJsonString(response), Rate[].class)\n );\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n\n return new Rates(rates);\n }", "private void showRate() {\r\n\t\tString currencyCode = signalThreeLetters();\r\n\t\tif (currencyCode == null){\r\n\t\t\treturn;\r\n }\r\n //needed if-else to check if currencies is null. As currencies.getCurrencyByCode doesn't work if currencies is null\r\n if (currencies == null){\r\n \tSystem.out.println(\"There are currently no currencies in the system.\");\r\n \tSystem.out.println();}\r\n \t\r\n else{\r\n Currency currency = currencies.getCurrencyByCode(currencyCode);\r\n if (currency == null) {\r\n\t\t\t// No, so complain and return\r\n\t\t\tSystem.out.println(\"\\\"\" + currencyCode + \"\\\" is is not in the system.\");\r\n\t\t\tSystem.out.println();}\r\n else {\r\n System.out.println(\"Currency \" +currencyCode+ \" has exchange rate \" + currency.getExchangeRate() + \".\");\r\n System.out.println();}\r\n \r\n }\r\n \r\n\t}", "public static Collection getCostingRates() throws EnvoyServletException\n {\n try\n {\n return ServerProxy.getCostingEngine().getRates();\n }\n catch (Exception e)\n {\n throw new EnvoyServletException(e);\n }\n }", "private void fetchRatesData() {\r\n RequesterBean requesterBean = new RequesterBean();\r\n requesterBean.setFunctionType(GET_RATE_DATA);\r\n requesterBean.setDataObject(instituteRatesBean);\r\n \r\n AppletServletCommunicator appletServletCommunicator = new \r\n AppletServletCommunicator(CONNECTION_STRING, requesterBean);\r\n appletServletCommunicator.setRequest(requesterBean);\r\n appletServletCommunicator.send();\r\n ResponderBean responderBean = appletServletCommunicator.getResponse();\r\n \r\n if(responderBean == null) {\r\n //Could not contact server.\r\n CoeusOptionPane.showErrorDialog(COULD_NOT_CONTACT_SERVER);\r\n return;\r\n }\r\n \r\n if(responderBean.isSuccessfulResponse()) {\r\n Hashtable ratesData = (Hashtable)responderBean.getDataObject();\r\n hasMaintainCodeTablesRt = ((Boolean)ratesData.get(\"HAS_OSP_RIGHT\")).booleanValue();\r\n if( hasMaintainCodeTablesRt ){\r\n setFunctionType(TypeConstants.MODIFY_MODE);\r\n }else {\r\n setFunctionType(TypeConstants.DISPLAY_MODE);\r\n }\r\n //queryKey = RATES + ratesData.get(\"PARENT_UNIT_NUMBER\").toString();\r\n\r\n //Set title\r\n dlgRates.setTitle(RATES + \" for Unit \" + instituteRatesBean.getUnitNumber());\r\n queryEngine.addDataCollection(queryKey, ratesData);\r\n\r\n }else {\r\n //Server Error\r\n CoeusOptionPane.showErrorDialog(responderBean.getMessage());\r\n return;\r\n }\r\n }", "ResponseEntity<List<TieredRatesHistory>> getTieredRatesHistory();", "ResponseEntity<List<TOURatesHistory>> getTouRatesHistory();", "public int getRate() {\n return rate_;\n }", "int getConversionsNumber() throws SQLException;", "float getBounceRate() throws SQLException;", "public int getRate2Count() {\n return rate2_.size();\n }", "public int getListCount() {\n\t\tConnection con = getConnection();\r\n\t\tMemberDAO memberDao = MemberDAO.getInstance();\r\n\t\tmemberDao.setConnection(con);\r\n\r\n\t\tint listCount = memberDao.selectRatingCount();\r\n\r\n\t\tclose(con);\r\n\t\treturn listCount;\r\n\t}", "public static double getValue(Exchange exchange, String name) {\n\n double rate = -1.0;\n\n switch (name) {\n case \"AUD\":\n rate = exchange.getRates().getAUD();\n break;\n case \"BGN\":\n rate = exchange.getRates().getBGN();\n break;\n case \"BRL\":\n rate = exchange.getRates().getBRL();\n break;\n case \"CAD\":\n rate = exchange.getRates().getCAD();\n break;\n case \"CHF\":\n rate = exchange.getRates().getCHF();\n break;\n case \"CNY\":\n rate = exchange.getRates().getCNY();\n break;\n case \"CZK\":\n rate = exchange.getRates().getCZK();\n break;\n case \"DKK\":\n rate = exchange.getRates().getDKK();\n break;\n case \"GBP\":\n rate = exchange.getRates().getGBP();\n break;\n case \"HKD\":\n rate = exchange.getRates().getHKD();\n break;\n case \"HRK\":\n rate = exchange.getRates().getHRK();\n break;\n case \"HUF\":\n rate = exchange.getRates().getHUF();\n break;\n case \"IDR\":\n rate = exchange.getRates().getIDR();\n break;\n case \"ILS\":\n rate = exchange.getRates().getILS();\n break;\n case \"INR\":\n rate = exchange.getRates().getINR();\n break;\n case \"JPY\":\n rate = exchange.getRates().getJPY();\n break;\n case \"KRW\":\n rate = exchange.getRates().getKRW();\n break;\n case \"MXN\":\n rate = exchange.getRates().getMXN();\n break;\n case \"MYR\":\n rate = exchange.getRates().getMYR();\n break;\n case \"NOK\":\n rate = exchange.getRates().getNOK();\n break;\n case \"NZD\":\n rate = exchange.getRates().getNZD();\n break;\n case \"PHP\":\n rate = exchange.getRates().getPHP();\n break;\n case \"PLN\":\n rate = exchange.getRates().getPLN();\n break;\n case \"RON\":\n rate = exchange.getRates().getRON();\n break;\n case \"RUB\":\n rate = exchange.getRates().getRUB();\n break;\n case \"SEK\":\n rate = exchange.getRates().getSEK();\n break;\n case \"SGD\":\n rate = exchange.getRates().getSGD();\n break;\n case \"THB\":\n rate = exchange.getRates().getTHB();\n break;\n case \"TRY\":\n rate = exchange.getRates().getTRY();\n break;\n case \"ZAR\":\n rate = exchange.getRates().getZAR();\n break;\n case \"EUR\":\n rate = exchange.getRates().getEUR();\n break;\n case \"USD\":\n rate = exchange.getRates().getUSD();\n break;\n default:\n break;\n }\n\n return rate;\n }", "@Override\n public String get_rates(String betrag, String currency, List<String> targetcurrencies) {\n String api = null;\n try {\n api = new String(Files.readAllBytes(Paths.get(\"src/resources/OfflineData.json\")));\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n JSONObject obj = new JSONObject(api);\n ArrayList<String> calculatedrates = new ArrayList<>();\n if (currency.equals(\"EUR\")) {\n for (String targetcurrency : targetcurrencies) {\n float rate = obj.getJSONObject(\"rates\").getFloat(targetcurrency);\n calculatedrates.add((Float.parseFloat(betrag) * rate) + \" \" + targetcurrency + \" (Kurs: \" + rate + \")\");\n }\n } else {\n float currencyrate = obj.getJSONObject(\"rates\").getFloat(currency);\n for (String targetcurrency : targetcurrencies) {\n float rate = obj.getJSONObject(\"rates\").getFloat(targetcurrency);\n calculatedrates.add((Float.parseFloat(betrag) / currencyrate * rate) + \" \" + targetcurrency + \" (Kurs: \" + rate / currencyrate + \")\");\n }\n }\n return Data.super.display(betrag, currency, calculatedrates, obj.get(\"date\").toString());\n }", "static void populateDB() {\n initializeJSON();\n JSONArray thisArray = new JSONArray(getRateString());\n JSONObject desiredObject = thisArray.getJSONObject(0);\n Iterator<String> keyList = desiredObject.keys();\n\n CurrencyInterface dbConn = new DatabaseConnection();\n while (keyList.hasNext()) {\n String abbrev = keyList.next().toString();\n Object actualRates = desiredObject.get(abbrev);\n String actualRateStr = actualRates.toString();\n double rate = Double.parseDouble(actualRateStr);\n rate = 1/rate;\n // ^ actualRates produces an Integer object, can't cast directly to a Double\n // Also inverting value since values are given as USD/x where my calculations are x/USD.\n dbConn.saveCurrency(new Currency(abbrev, rate));\n }\n }", "public int getRate2Count() {\n return rate2_.size();\n }", "org.adscale.format.opertb.AmountMessage.Amount getExchangeprice();", "int getReaultCount();", "int getFundsCount();", "int getFundsCount();", "@Override\n public int getItemCount() {\n if (mRates!=null){\n return mRates.size();\n }else{\n return 0;\n }\n }", "private int getExposures(Connection connection, String campaignName) {\r\n\r\n ExposureTable table = new ExposureTable(connection);\r\n int responses = table.getUserExposure(userId, campaignName, 150); // Look 150 days back for exposures\r\n return responses;\r\n\r\n }", "public int getRate() {\n return rate_;\n }", "public int getEntrenchmentRate() {\n return entrenchmentRate;\n }", "public List<ExchangeRate> parseRates(InputStream xml, String currency) {\n List<ExchangeRate> rates = new ArrayList<ExchangeRate>();\n\n try {\n XMLInputFactory factory = XMLInputFactory.newInstance();\n XMLStreamReader r = factory.createXMLStreamReader(xml);\n try {\n int event = r.getEventType();\n String date = null;\n boolean matchCurrency = false;\n boolean continueParse = true;\n while (continueParse) {\n if (event == XMLStreamConstants.START_ELEMENT) {\n // Both the date and rates use the Cube element\n if (r.getLocalName().equals(\"Cube\")) {\n for(int i = 0, n = r.getAttributeCount(); i < n; ++i) {\n // First mark the date\n if (r.getAttributeLocalName(i).equals(\"time\")) {\n date = r.getAttributeValue(i);\n }\n\n // Now get the currency\n if ((r.getAttributeLocalName(i).equals(\"currency\")) && r.getAttributeValue(i).equals(currency)) {\n matchCurrency = true;\n }\n\n // Finally, get the rate and add to the list\n if (r.getAttributeLocalName(i).equals(\"rate\")) {\n if (matchCurrency) {\n ExchangeRate rate = new ExchangeRate(date, currency, Double.parseDouble(r.getAttributeValue(i)));\n rates.add(rate);\n matchCurrency = false;\n }\n\n }\n }\n }\n }\n\n if (!r.hasNext()) {\n continueParse = false;\n } else {\n event = r.next();\n }\n }\n } finally {\n r.close();\n }\n } catch (Exception e) {\n Logger.error(\"Error parsing XML\", e);\n }\n\n\n return rates;\n }", "public static JSONObject sendRequest(){\n \tJSONObject exchangeRates = null;\n \t \n try {\n \t stream = new URL(BASE_URL + \"?access_key=\" + ACCESS_KEY).openStream();\n \t BufferedReader rd = new BufferedReader(new InputStreamReader(stream, Charset.forName(\"UTF-8\")));\n \t exchangeRates = new JSONObject(streamToString(rd)).getJSONObject(\"rates\");;\n \n }catch(MalformedURLException e) {\n \t e.printStackTrace();\n \t \n }catch (IOException e) {\n \n e.printStackTrace();\n }catch (JSONException e) {\n \n e.printStackTrace();\n } \n\t\treturn exchangeRates;\n \n }", "public String getExchangeRateUrl() {\n return exchangeRateUrl;\n }", "ResponseEntity<List<GenericRates>> getGenericRates();", "int getNumOfBuyOrders();", "void writeEcbRatesToDb(EcbEnvelope envelope);", "public BigDecimal getEXCH_RATE() {\r\n return EXCH_RATE;\r\n }", "double getTransRate();", "public void testGetExchangeRateForCurrency() {\n final String destinationCurrency = \"EUR\";\n final String sourceCurrency = \"GBP\";\n \n final ExchangeRateUtil exchangeRateUtilities =\n new ExchangeRateUtil(true, destinationCurrency);\n exchangeRateUtilities.loadExchangeRatesFromCurrency(sourceCurrency);\n \n final double factor =\n exchangeRateUtilities.getExchangeRateForCurrency(sourceCurrency,\n ExchangeRateType.BUDGET);\n \n assertEquals(\"1.18\", String.valueOf(factor));\n }", "@Scheduled(fixedRate = 8 * 1000 * 60 * 60)\n private void getRatesTask() {\n try {\n RestTemplate restTemplate = new RestTemplate();\n CurrencyDTO forObject = restTemplate.getForObject(fixerIoApiKey, CurrencyDTO.class);\n forObject.getRates().forEach((key, value) -> {\n Currency currency = new Currency(key, value);\n this.currencyRepository.save(currency);\n });\n } catch (RestClientException ex) {\n System.out.println(ex.getMessage());\n }\n }", "hr.client.appuser.CouponCenter.ExchangeRecord getExchangeHistoryList(int index);", "int getDeliveriesCount();", "public float getExchangeRate(String fromCurrency, String toCurrency, int year, int month, int day) { \n\t\tfloat resultOne;\n\t\tfloat resultTwo;\n\t\tfloat result;\n\t\ttry{\n\t\t\tString url = urlBuilder(year, month, day);\n\t\t\tXML_Parser parser = new XML_Parser();\n\t\t\tresultOne = parser.processDocument(url, fromCurrency);\n\t\t\tresultTwo = parser.processDocument(url, toCurrency);\n\t\t\tresult = (resultOne/resultTwo); //Calculating the exchange rate\n\t\t}catch (UnsupportedOperationException | IOException | ParserConfigurationException | SAXException e){\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\t\t\n\t\treturn result;\n\t}", "public int getCurrRuptures();", "double requestCurrentRate(String fromCurrency,\n String toCurrency);", "@SuppressWarnings(\"unchecked\")\n\t@Override\n\tpublic GetRatesResult execute(final GetRatesAction action,\n\t\t\tfinal ExecutionContext ctx) throws ActionException {\n\t\tfinal List<Rate> recentRates = _recentRatesCache.getCachedResult();\n\t\tif (recentRates != null) {\n\t\t\treturn new GetRatesResult(recentRates);\n\t\t}\n\n\t\t// If not, we query the data store\n\t\tfinal PersistenceManager pm = _pmp.get();\n\n\t\ttry {\n\t\t\tfinal Query query = pm.newQuery(Rate.class);\n\t\t\tquery.setRange(0, 10);\n\t\t\tquery.setOrdering(\"timeFetched desc\");\n\n\t\t\t// The following is needed because of an issue\n\t\t\t// with the result of type StreamingQueryResult not\n\t\t\t// being serializable for GWT\n\t\t\t// See the discussion here:\n\t\t\t// http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/bce6630a3f01f23a/62cb1c4d38cc06c7?lnk=gst&q=com.google.gwt.user.client.rpc.SerializationException:+Type+'org.datanucleus.store.appengine.query.StreamingQueryResult'+was+not+included+in+the+set+of+types+which+can+be+serialized+by+this+SerializationPolicy\n\t\t\tfinal List queryResult = (List) query.execute();\n\t\t\tfinal List<Rate> rates = new ArrayList<Rate>(queryResult.size());\n\n\t\t\tfor (final Object rate : queryResult) {\n\t\t\t\trates.add((Rate) rate);\n\t\t\t}\n\n\t\t\t// Then update the memcache\n\t\t\t_recentRatesCache.setResult(rates);\n\t\t\treturn new GetRatesResult(rates);\n\t\t} finally {\n\t\t\tpm.close();\n\t\t}\n\t}", "String getBackOffMultiplier();", "int getQuantite();", "int getQuantite();", "public int getremainingstock(String selection,String item) throws SQLException\n {\n // int stock_rate[]= new int [2];\n PreparedStatement remaining_stock = conn.prepareStatement(\"Select stock from purchases where Categroy=? and Item=? \");\n remaining_stock.setString(1, selection);\n remaining_stock.setString(2, item);\n ResultSet remaining_stock_rows = remaining_stock.executeQuery(); \n \n int sum=0,current=0;\n while(remaining_stock_rows.next()) \n {\n sum=Integer.parseInt(remaining_stock_rows.getString(1));\n \n \n }\n return sum;\n }", "int countByExample(ExchangeOrderExample example);", "@Test\n public void getExchangeRateUSD() {\n\n ConverterSvc converterSvc = new ConverterSvc(client);\n var actual = converterSvc.getExchangeRate(ConverterSvc.Currency.USD);\n\n float expected = (float)11486.5341;\n Assert.assertEquals(actual, expected);\n }", "com.unitedtote.schema.totelink._2008._06.program.ExchangeWagers xgetExchange();", "BigInteger getCount();", "public ExchangeRateVO getExchangeRate(Integer exchRateId)\n throws RemoteException, FinderException;", "public String getExchangeRateType() {\n return this.exchangeRateType;\n }", "int getRefundToCount();", "@GET\n\t@Produces(MediaType.APPLICATION_JSON)\n\tpublic String getCount() {\n\t\tDB db = connectionManager.getConnection();\n\t\tDBCollection coll = db.getCollection(TableName.BOOKS);\n\t\tDBCursor cursor = coll.find(QueryCriteria.getByUser(getUserUuid()));\n\t\t\n\t\treturn \"{count: \" + Integer.valueOf(cursor.count()).toString() + \"}\";\n\t}", "long getCount();", "long getCount();", "public Rate rate() {\n _initialize();\n return rate;\n }", "@Override\n public HttpClientApiLayerEntity getCuotesByCurrencies(String currencies) {\n HttpRequest<?> req = HttpRequest.GET(uri+\"&currencies=\"+currencies);\n return (HttpClientApiLayerEntity) httpClient.retrieve(req, Argument.of(List.class, HttpClientApiLayerEntity.class)).blockingSingle().get(0);\n }", "@ApiModelProperty(value = \"The total price of staying in this room from the given check-in date to the given check-out date\")\n public List<PeriodRate> getRates() {\n return rates;\n }", "private static Map<String, Double> createCurrencyPairRates() {\n\t\t\n\t\tMap<String, Double> currencyRates = new HashMap<>();\n\t\tcurrencyRates.put(\"AUDUSD\", 0.8371);\n\t\tcurrencyRates.put(\"CADUSD\", 0.8711);\n\t\tcurrencyRates.put(\"CNYUSD\", 6.1715);\n\t\tcurrencyRates.put(\"EURUSD\", 1.2315);\n\t\tcurrencyRates.put(\"GBPUSD\", 1.5683);\n\t\tcurrencyRates.put(\"NZDUSD\", 0.7750);\n\t\tcurrencyRates.put(\"USDJPY\", 119.95);\n\t\tcurrencyRates.put(\"EURCZK\", 27.6028);\n\t\tcurrencyRates.put(\"EURDKK\", 7.4405);\n\t\tcurrencyRates.put(\"EURNOK\", 8.6651);\n\t\t\n\t\treturn currencyRates;\n\t\t\n\t}", "public Long get_cacherequestsrate() throws Exception {\n\t\treturn this.cacherequestsrate;\n\t}", "public float getCountRate() {\n return countMonitor.getRate();\n }", "int countByExample(TbComEqpModelExample example);", "int getSmpRate();", "int getInterestsCount();", "public int getEngineeringRate() {\n return engineeringRate;\n }", "public void setRate(int rate) { this.rate = rate; }", "@Override\r\n\tpublic Object get(Iterable<?> objs, int size) {\n\t\tModelRatesHelper.getInstance().gatherData();\r\n\t\treturn 0;\r\n\t}", "ResponseEntity<List<GenericRatesHistory>> getGenericRatesHistory();", "int getCazuriCount();", "public int getSessionCreateRate();", "List<CurrencyDTO> getCurrencies();", "public int getNumOfTravellingBikes(){\n int numberOfBikes = 0;\n try(Connection con = DatabaseConnector.getConnection();\n PreparedStatement ps = con.prepareStatement(ALL_TRAVEL_DATA);\n ResultSet rs = ps.executeQuery()){\n \n while(rs.next()){\n numberOfBikes++;\n }\n \n }catch(Exception e){\n System.out.println(\"Exception: \" + e);\n }\n return numberOfBikes;\n }", "public static double connection1 (String currency1, String currency2, Match []a){\n\t\tdouble exchangeRate = 0.0;\n\t\tfor(int i=0; i <a.length; i++){\n\t\t\t//If you have both currencies...\n\t\t\tif (a[i].getCurrency1().equalsIgnoreCase(currency1) && a[i].getCurrency2().equalsIgnoreCase(currency2)){\n\t\t\t\t//get the exchange rate\n\t\t\t\texchangeRate = a[i].getExchangeRate();\t\n\t\t\t}\n\t\t}\n\t\treturn exchangeRate;\n\n\t}", "public CurrencyRates() {\n this(DSL.name(\"currency_rates\"), null);\n }", "public int getSettable() {\n\t\t\n\t\t\n\t\t\n\t\treturn rate;\n\t}", "public int getCustomInformationTransferRate();" ]
[ "0.69949263", "0.6134581", "0.6130202", "0.6098027", "0.606782", "0.6066144", "0.6020523", "0.5926318", "0.5894676", "0.5891734", "0.5865387", "0.5831769", "0.5827154", "0.5799114", "0.5782624", "0.5775316", "0.576573", "0.576542", "0.5734899", "0.5689593", "0.5687801", "0.5687136", "0.5644471", "0.5627535", "0.5616112", "0.56157315", "0.5578782", "0.5574023", "0.5566318", "0.55523723", "0.55518335", "0.55487853", "0.5536868", "0.5532546", "0.55218005", "0.5518265", "0.55104446", "0.5499937", "0.5462773", "0.54470587", "0.54424655", "0.54410464", "0.54379314", "0.54207706", "0.5408269", "0.5408269", "0.5404207", "0.53989077", "0.53889936", "0.538868", "0.53722095", "0.53544474", "0.5353449", "0.5352758", "0.5344925", "0.53243893", "0.53163487", "0.53071576", "0.52932453", "0.5280569", "0.52801687", "0.5277776", "0.5276931", "0.52644765", "0.52572304", "0.5253547", "0.52533966", "0.5244242", "0.5244242", "0.52374345", "0.52353275", "0.5232925", "0.52177024", "0.5212329", "0.52097154", "0.5200352", "0.51998264", "0.51979005", "0.5197739", "0.5197739", "0.5197535", "0.5187953", "0.5187233", "0.51694", "0.5156212", "0.51536447", "0.51506466", "0.51479465", "0.5145686", "0.513592", "0.51347107", "0.512934", "0.51234984", "0.51189154", "0.51156837", "0.5115307", "0.5110726", "0.5109042", "0.51017076", "0.50998145", "0.5097781" ]
0.0
-1
Write parsed data from European Central Bank to the database.
void writeEcbRatesToDb(EcbEnvelope envelope);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public final /* synthetic */ void saveToDb() {\n DruidPooledConnection druidPooledConnection;\n DruidPooledConnection druidPooledConnection2;\n block18: {\n block17: {\n StringBuilder stringBuilder;\n PreparedStatement preparedStatement;\n MaplePet a2;\n if (!a2.a) {\n return;\n }\n try {\n druidPooledConnection2 = DBConPool.getInstance().getDataSource().getConnection();\n try {\n preparedStatement = druidPooledConnection2.prepareStatement(ConcurrentEnumMap.ALLATORIxDEMO(\";\\t*\\u0018:\\u001cN)\\u000b-\\u001dy=\\u001c:y\\u00008\\u0003<NdNfBy\\u0002<\\u0018<\\u0002ySyQuN:\\u00026\\u001d<\\u0000<\\u001d*NdNfBy\\b,\\u00025\\u0000<\\u001d*NdNfBy\\u001d<\\r6\\u0000=\\u001dySyQuN?\\u00028\\t*NdNfBy\\u000b!\\r5\\u001b=\\u000b=NdNfNuN*\\u001e<\\u000b=NdNfBy\\f,\\b?\\u001d2\\u00075\\u00020\\nySyQuN:\\u000f7>0\\r2;)NdNfBy\\u001d2\\u00075\\u00020\\nySyQy9\\u0011+\\u000b+y\\u001e<\\u001a0\\nySyQ\"));\n try {\n int n2;\n PreparedStatement preparedStatement2 = preparedStatement;\n PreparedStatement preparedStatement3 = preparedStatement;\n preparedStatement.setString(1, a2.h);\n preparedStatement3.setByte(2, a2.e);\n preparedStatement3.setShort(3, a2.B);\n preparedStatement2.setByte(4, a2.H);\n preparedStatement2.setInt(5, a2.J);\n preparedStatement.setShort(6, a2.k);\n stringBuilder = new StringBuilder();\n int n3 = n2 = 0;\n while (n3 < a2.d.length) {\n stringBuilder.append(a2.d[n2]);\n stringBuilder.append(KoreanDateUtil.ALLATORIxDEMO(\"V\"));\n n3 = ++n2;\n }\n }\n catch (Throwable throwable) {\n Throwable throwable2;\n if (preparedStatement != null) {\n try {\n preparedStatement.close();\n throwable2 = throwable;\n throw throwable2;\n }\n catch (Throwable throwable3) {\n throwable.addSuppressed(throwable3);\n }\n }\n throwable2 = throwable;\n throw throwable2;\n }\n }\n catch (Throwable throwable) {\n Throwable throwable4;\n if (druidPooledConnection2 != null) {\n try {\n druidPooledConnection2.close();\n throwable4 = throwable;\n throw throwable4;\n }\n catch (Throwable throwable5) {\n throwable.addSuppressed(throwable5);\n }\n }\n throwable4 = throwable;\n throw throwable4;\n }\n }\n catch (SQLException sQLException) {\n FilePrinter.printError(ConcurrentEnumMap.ALLATORIxDEMO(\"\\u0014\\u000f)\\u0002<><\\u001aw\\u001a!\\u001a\"), sQLException, KoreanDateUtil.ALLATORIxDEMO(\"e\\u001b`\\u001fB\\u0015R\\u0018\"));\n return;\n }\n {\n String string = stringBuilder.toString();\n PreparedStatement preparedStatement4 = preparedStatement;\n PreparedStatement preparedStatement5 = preparedStatement;\n PreparedStatement preparedStatement6 = preparedStatement;\n String string2 = string;\n preparedStatement6.setString(7, string2.substring(0, string2.length() - 1));\n preparedStatement6.setInt(8, a2.ALLATORIxDEMO);\n preparedStatement5.setInt(9, a2.I);\n preparedStatement5.setShort(10, a2.K);\n preparedStatement4.setInt(11, a2.M);\n preparedStatement4.setInt(12, a2.D);\n preparedStatement4.executeUpdate();\n a2.a = false;\n if (preparedStatement == null) break block17;\n druidPooledConnection = druidPooledConnection2;\n }\n preparedStatement.close();\n break block18;\n }\n druidPooledConnection = druidPooledConnection2;\n }\n if (druidPooledConnection == null) return;\n druidPooledConnection2.close();\n }", "private static void depositAmount(String format, Bank bank, String username) {\n\n\t\tObjectOutputStream oos = null;\n\t\tString outputFile = \"resource/Transactions.txt\";\n\n\t\ttry {\n\t\t\toos = new ObjectOutputStream(new FileOutputStream(outputFile));\n\t\t\tbank.transactions.add(0, format);\n\n//\t\t\tfor (String t:bank.transactions)\n\t\t\toos.writeObject(bank.transactions);\n\t\t\toos.close();\n\t\t\tSystem.out.println(\"serilization is done\");\n\t\t}\n\n\t\tcatch (Exception e) {\n\t\t\te.printStackTrace();\n\n\t\t} finally {\n\t\t\tif (oos != null)\n\t\t\t\ttry {\n\t\t\t\t\toos.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t}\n\n\t\t}\n\n\t}", "public void save() throws Exception{\n\t\tm_service = new DistrictService();\n\t\t//插入城市\t\t\n\t\t//String saveStr = \"~`哈迪~`达鲁~`哥本~`~`~`C~`9898~`9898~`0~`~`0~`~`从DHL地区表中导入~`N~`N~`N~`~`~`~`~`~`~`EMS~`~`~@~#\";\t\n\t\t//插入国家\n\t\tString saveStr = \"3785~`麦克1~`纽斯1~`迪录1~`~`~`C~`9898~`9898~`0~`~`0~`~`从DHL地区表中导入~`N~`N~`N~`1~`~`~`~`~`~`EMS~`~`~@~#\";\t\n\n\t\tDecoder objPD = new Decoder(saveStr);\n\t\tString objReturn = m_service.save(objPD);\n\t\tSystem.out.println(objReturn);\n\t\t\n\t}", "public void write()\n {\n getCsvParser().parse(getReader());\n }", "public static void parseAccountDB(ATMAccount accountNew) throws FileNotFoundException, IOException {\r\n\r\n\t\ttry {\r\n\t\t\tFileWriter fileWriter = new FileWriter(\"accountsdb.txt\", true);\r\n\t\t\tBufferedWriter fileBuffer = new BufferedWriter(fileWriter);\r\n\t\t\tPrintWriter fileOutput = new PrintWriter(fileBuffer);\r\n\t\t\tfileOutput.println(accountNew.parseString());\r\n\r\n\t\t\tif (fileOutput != null) {\r\n\t\t\t\tfileOutput.close();\r\n\t\t\t}\r\n\t\t\tif (fileBuffer != null) {\r\n\t\t\t\tfileBuffer.close();\r\n\t\t\t}\r\n\t\t\tif (fileWriter != null) {\r\n\t\t\t\tfileWriter.close();\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(\"Error!\");\r\n\t\t}\r\n\t}", "public void insertData() throws SQLException, URISyntaxException, FileNotFoundException {\n\t \t\t//On vide la base en premier\n\t \t\tdropDB();\n\t \t\t\n\t \t\t//Fichier contenant les jeux de test\n\t \t\tBufferedReader br = new BufferedReader(new FileReader(\"./data.txt\"));\n\t \t \n\t \t PreparedStatement pstmt = null;\n\t \t Connection conn = null;\n\t \t int id;\n\t \t String lastname, firstname, cardNumber, expirationMonth, expirationYear, cvv, query;\n\t \t try {\n\t \t conn = this.connectToBDD();\n\t \t \n\t \t String line = null;\n\t \t \n\t \t //On lit le fichier data.txt pour inserer en base\n\t \t while((line=br.readLine()) != null) {\n\t \t \t String tmp[]=line.split(\",\");\n\t \t \t id=Integer.parseInt(tmp[0]);\n\t\t\t \t lastname=tmp[1];\n\t\t\t \t firstname=tmp[2];\n\t\t\t \t cardNumber=tmp[3];\n\t\t\t \t expirationMonth=tmp[4];\n\t\t\t \t expirationYear=tmp[5];\n\t\t\t \t cvv=tmp[6];\n\t\t\t \t \n\t\t\t \t //Insertion des clients\n\t\t\t \t query = \"INSERT INTO consumer VALUES(\"+ id + \",'\" +firstname+\"','\"+lastname+\"')\";\n\t\t\t \t \n\t\t\t \t pstmt = conn.prepareStatement(query);\n\t\t\t \t pstmt.executeUpdate();\n\t\t\t \t \n\t\t\t \t \n\t\t\t \t //Insertion des comptes\n\t\t\t \t query = \"INSERT INTO account (card_number, expiration_month, expiration_year, cvv, remain_balance, consumer_id) \"\n\t\t \t\t\t\t+ \"VALUES ('\"+cardNumber+\"','\"+expirationMonth+\"','\"+expirationYear+\"','\"+cvv+\"',300,\"+id+\")\";\n\t\t\t \t\n\t\t\t \t pstmt = conn.prepareStatement(query);\n\t\t\t \t pstmt.executeUpdate();\n\t \t }\n\t \t \n\t \t \n\t \t } catch (Exception e) {\n\t \t System.err.println(\"Error: \" + e.getMessage());\n\t \t e.printStackTrace();\n\t \t }\n\t \t }", "private void actuallyWriteData() {\r\n\t\t// Get rid of old data. Getting rid of trips, trip patterns, and blocks\r\n\t\t// is a bit complicated. Need to delete them in proper order because\r\n\t\t// of the foreign keys. Because appear to need to use plain SQL\r\n\t\t// to do so successfully (without reading in objects and then\r\n\t\t// deleting them, which takes too much time and memory). Therefore\r\n\t\t// deleting of this data is done here before writing the data.\r\n\t\tlogger.info(\"Deleting old blocks and associated trips from database...\");\r\n\t\tBlock.deleteFromSandboxRev(session);\r\n\r\n\t\tlogger.info(\"Deleting old trips from database...\");\r\n\t\tTrip.deleteFromSandboxRev(session);\r\n\r\n\t\tlogger.info(\"Deleting old trip patterns from database...\");\r\n\t\tTripPattern.deleteFromSandboxRev(session);\r\n\t\t\r\n\t\t// Now write the data to the database.\r\n\t\t// First write the Blocks. This will also write the Trips, TripPatterns,\r\n\t\t// Paths, and TravelTimes since those all have been configured to be\r\n\t\t// cascade=CascadeType.ALL .\r\n\t\tlogger.info(\"Saving {} blocks (plus associated trips) to database...\", \r\n\t\t\t\tgtfsData.getBlocks().size());\r\n\t\tint c = 0;\r\n\t\tfor (Block block : gtfsData.getBlocks()) {\r\n\t\t\tlogger.debug(\"Saving block #{} with blockId={} serviceId={} blockId={}\",\r\n\t\t\t\t\t++c, block.getId(), block.getServiceId(), block.getId());\r\n\t\t\twriteObject(block);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving routes to database...\");\r\n\t\tRoute.deleteFromSandboxRev(session);\r\n\t\tfor (Route route : gtfsData.getRoutes()) {\r\n\t\t\twriteObject(route);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving stops to database...\");\r\n\t\tStop.deleteFromSandboxRev(session);\r\n\t\tfor (Stop stop : gtfsData.getStops()) {\r\n\t\t\twriteObject(stop);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving agencies to database...\");\r\n\t\tAgency.deleteFromSandboxRev(session);\r\n\t\tfor (Agency agency : gtfsData.getAgencies()) {\r\n\t\t\twriteObject(agency);\r\n\t\t}\r\n\r\n\t\tlogger.info(\"Saving calendars to database...\");\r\n\t\tCalendar.deleteFromSandboxRev(session);\r\n\t\tfor (Calendar calendar : gtfsData.getCalendars()) {\r\n\t\t\twriteObject(calendar);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving calendar dates to database...\");\r\n\t\tCalendarDate.deleteFromSandboxRev(session);\r\n\t\tfor (CalendarDate calendarDate : gtfsData.getCalendarDates()) {\r\n\t\t\twriteObject(calendarDate);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving fare rules to database...\");\r\n\t\tFareRule.deleteFromSandboxRev(session);\r\n\t\tfor (FareRule fareRule : gtfsData.getFareRules()) {\r\n\t\t\twriteObject(fareRule);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving fare attributes to database...\");\r\n\t\tFareAttribute.deleteFromSandboxRev(session);\r\n\t\tfor (FareAttribute fareAttribute : gtfsData.getFareAttributes()) {\r\n\t\t\twriteObject(fareAttribute);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving frequencies to database...\");\r\n\t\tFrequency.deleteFromSandboxRev(session);\r\n\t\tfor (Frequency frequency : gtfsData.getFrequencies()) {\r\n\t\t\twriteObject(frequency);\r\n\t\t}\r\n\t\t\r\n\t\tlogger.info(\"Saving transfers to database...\");\r\n\t\tTransfer.deleteFromSandboxRev(session);\r\n\t\tfor (Transfer transfer : gtfsData.getTransfers()) {\r\n\t\t\twriteObject(transfer);\r\n\t\t}\r\n\t}", "public static void save() {\r\n\t\ttry {\r\n\t\t\tFile csv = new File(\"src/transaction.csv\");\r\n\t\t\tBufferedWriter bw = new BufferedWriter(new FileWriter(csv, false));\r\n\t\t\tbw.write(\"type,account number,amount,year,month,date,cleared\");\r\n\t\t\tbw.newLine();\r\n\t\t\tfor (int i = 0; i < transList.size(); i++) {\r\n\t\t\t\tbw.write(transList.get(i).toFile());\r\n\t\t\t\tbw.newLine();\r\n\t\t\t}\r\n\t\t\tbw.close();\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public BankDatabase() {\r\n accounts = new Account[3];\r\n Connection c = null;\r\n Statement stmt = null;\r\n try {\r\n Class.forName(\"org.postgresql.Driver\");\r\n c = DriverManager\r\n .getConnection(\"jdbc:postgresql://localhost:5432/ATM\",\r\n \"postgres\", \"0000\");\r\n c.setAutoCommit(false);\r\n stmt = c.createStatement();\r\n ResultSet rs = stmt.executeQuery( \"SELECT * FROM accounts;\" );\r\n var i = 0;\r\n while ( rs.next() ) {\r\n int theAccountNumber = rs.getInt(\"accountnumber\");\r\n int thePin = rs.getInt(\"pin\");\r\n double theAvailiableBalance = rs.getDouble(\"availiablebalance\");\r\n double theTotalBalance = rs.getDouble(\"totalbalance\");\r\n accounts[i] = new Account( theAccountNumber, thePin, theAvailiableBalance, theTotalBalance);\r\n i++;\r\n }\r\n rs.close();\r\n stmt.close();\r\n c.close();\r\n } catch ( Exception e ) {\r\n System.err.println( e.getClass().getName()+\": \"+ e.getMessage() );\r\n System.exit(0);\r\n }\r\n\r\n\r\n// accounts = new Account[2]; // just 2 accounts for testing\r\n// accounts[0] = new Account(12345, 54321, 1000.0, 1200.0);\r\n// accounts[1] = new Account(98765, 56789, 200.0, 200.0);\r\n }", "public void saveCurrencyListToDb() {\n LOGGER.info(\"SAVING CURRENCY LIST TO DB.\");\n List<Currency> currencyList = currencyService.fetchCurrencyFromCRB();\n currencyRepository.saveAll(currencyList);\n }", "public void enterData(IBankDB bankDB) {\n this.bankDB = bankDB;\n }", "void insert(CusBankAccount record);", "public static void store() {\r\n//\t\tSystem.out.println(\"mar\"+readMAR().getStr());\r\n\t\tString mar = new String(readMAR().getStr());\r\n\t\tTraceINF.write(\"Write memory \"+mar);\r\n\t\tFormatstr content = new Formatstr();\r\n\t\t\r\n\t\tcontent = readMBR();\r\n\t\tgetBank(mar)[Integer.parseInt(mar.substring(0, mar.length() - 2), 2)] = content.getStr();\r\n\t\tTraceINF.write(\"Write finished.\");\r\n\t}", "public void setJP_BankData_EDI_Info (String JP_BankData_EDI_Info);", "void saveFile () {\r\n\r\n\t\ttry {\r\n\t\t\tFileOutputStream fos = new FileOutputStream (\"Bank.dat\", true);\r\n\t\t\tDataOutputStream dos = new DataOutputStream (fos);\r\n\t\t\tdos.writeUTF (saves[count][0]);\r\n\t\t\tdos.writeUTF (saves[count][1]);\r\n\t\t\tdos.writeUTF (saves[count][2]);\r\n\t\t\tdos.writeUTF (saves[count][3]);\r\n\t\t\tdos.writeUTF (saves[count][4]);\r\n\t\t\tdos.writeUTF (saves[count][5]);\r\n\t\t\tJOptionPane.showMessageDialog (this, \"The Record has been Saved Successfully\",\r\n\t\t\t\t\t\t\"BankSystem - Record Saved\", JOptionPane.PLAIN_MESSAGE);\r\n\t\t\ttxtClear ();\r\n\t\t\tdos.close();\r\n\t\t\tfos.close();\r\n\t\t}\r\n\t\tcatch (IOException ioe) {\r\n\t\t\tJOptionPane.showMessageDialog (this, \"There are Some Problem with File\",\r\n\t\t\t\t\t\t\"BankSystem - Problem\", JOptionPane.PLAIN_MESSAGE);\r\n\t\t}\r\n\r\n\t}", "@Override\n\tpublic void saveData()\n\t{\n ssaMain.d1.pin = ssaMain.tmp_pin1;\n ssaMain.d1.balance = ssaMain.tmp_balance1;\n System.out.println(\"Your account has been established successfully.\");\n\t}", "private void saveToDb() {\r\n ContentValues values = new ContentValues();\r\n values.put(DbAdapter.KEY_DATE, mTime);\r\n if (mPayeeText != null && mPayeeText.getText() != null)\r\n \tvalues.put(DbAdapter.KEY_PAYEE, mPayeeText.getText().toString());\r\n if (mAmountText != null && mAmountText.getText() != null)\r\n \tvalues.put(DbAdapter.KEY_AMOUNT, mAmountText.getText().toString());\r\n if (mCategoryText != null && mCategoryText.getText() != null)\r\n \tvalues.put(DbAdapter.KEY_CATEGORY, mCategoryText.getText().toString());\r\n if (mMemoText != null && mMemoText.getText() != null)\r\n \tvalues.put(DbAdapter.KEY_MEMO, mMemoText.getText().toString());\r\n if (mTagText != null && mTagText.getText() != null)\r\n \tvalues.put(DbAdapter.KEY_TAG, mTagText.getText().toString());\r\n\r\n \tif (Utils.validate(values)) {\r\n \t\tmDbHelper.open();\r\n \t\tif (mRowId == null) {\r\n \t\t\tlong id = mDbHelper.create(values);\r\n \t\t\tif (id > 0) {\r\n \t\t\t\tmRowId = id;\r\n \t\t\t}\r\n \t\t} else {\r\n \t\t\tmDbHelper.update(mRowId, values);\r\n \t\t}\r\n \t\tmDbHelper.close();\r\n \t}\r\n\t}", "public void writeDataToDatabase(List<Company> cl){\n\t\tjdbcTemplate.update(\"CREATE TABLE IF NOT EXISTS \" + table + \" (date varchar(40), security varchar(100), weighting float(53));\");\n\t\tfor(Company c : cl){\n\t\t\tthis.writeCompany(c.getDate(), c.getSecurity() ,c.getWeighting());\n\t\t}\n\t}", "public static void backup() throws FileNotFoundException, SQLException {\n\n // Laver en dato til vores End Of Days filer i filnavnet\n Date date = new Date();\n String dagensDato = date.toString();\n dagensDato = dagensDato.replaceAll(\" \", \"_\");\n dagensDato = dagensDato.replaceAll(\":\", \"_\");\n\n File file = new File(\"End_Of_Days/End_Of_Day_\" + dagensDato + \".txt\");\n\n try (\n // Laver filen\n PrintWriter output = new PrintWriter(file);\n ) {\n // Initialiserer varibler der skal bruges\n String sql, hentetFnavn, hentetLnavn, hentetAdresse, hentetKonto_type, hentetOvertraeks, hentetUsername;\n int hentetPerson_id, hentetReg_nr, hentetKonto_nr, hentetRentesats, hentetSaldo, hentetOvertraeksgebyr, hentetId, hentetFra_Konto, hentetTil_Konto, hentetPassword;\n double hentetTrukketbelob, hentetIndfortbelob;\n Timestamp hentetTimestamp;\n\n\n output.println(\"Person_id \\t\\t fnavn \\t\\t lnavn \\t\\t adresse\");\n output.println(\"------------------------------------------------\");\n\n // Henter bruger tabelen\n stmt = con.createStatement();\n sql = \"SELECT * FROM bruger\";\n ResultSet rs = stmt.executeQuery(sql);\n while (rs.next()) { // Indsaetter raekkerne fra bruger tabelen ind i tekstfilen\n hentetPerson_id = rs.getInt(1);\n hentetFnavn = rs.getNString(2);\n hentetLnavn = rs.getNString(3);\n hentetAdresse = rs.getNString(4);\n output.print(hentetPerson_id + \"\\t\\t\" + hentetFnavn + \"\\t\\t\" + hentetLnavn + \"\\t\\t\" + hentetAdresse + \"\\n\");\n }\n\n output.println();\n output.println(\"Konto_type \\t\\t reg_nr \\t\\t konto_nr \\t\\t rentesats \\t\\t saldo \\t\\t overtraeksgebyr \\t\\t overtraek \\t\\t id\");\n output.println(\"------------------------------------------------------------------------------------------------------------------------------------\");\n\n // Henter konto tabelen\n stmt = con.createStatement();\n sql = \"SELECT * FROM konto\";\n rs = stmt.executeQuery(sql);\n while (rs.next()) { // Indsaetter raekkerne fra konto tabelen ind i tekstfilen\n hentetKonto_type = rs.getNString(1);\n hentetReg_nr = rs.getInt(2);\n hentetKonto_nr = rs.getInt(3);\n hentetRentesats = rs.getInt(4);\n hentetSaldo = rs.getInt(5);\n hentetOvertraeksgebyr = rs.getInt(6);\n hentetOvertraeks = rs.getNString(7);\n hentetId = rs.getInt(8);\n output.print(hentetKonto_type + \"\\t\\t\" + hentetReg_nr + \"\\t\\t\" + hentetKonto_nr + \"\\t\\t\" + hentetRentesats + \"\\t\\t\" + hentetSaldo + \"\\t\\t\" + hentetOvertraeksgebyr + \"\\t\\t\" + hentetOvertraeks + \"\\t\\t\" + hentetId + \"\\n\");\n }\n\n output.println();\n output.println(\"id \\t\\t Fra_Konto \\t\\t Trukketbeløb \\t\\t Til_kontoNr \\t\\t Indførtbeløb \\t\\t Timestamp\");\n output.println(\"------------------------------------------------------------------------------------------------------------------------------------\");\n\n // Henter transactioner tabelen\n stmt = con.createStatement();\n sql = \"SELECT * FROM transactioner\";\n rs = stmt.executeQuery(sql);\n while (rs.next()) { // Indsaetter raekkerne fra transactioner tabelen ind i tekstfilen\n hentetId = rs.getInt(1);\n hentetFra_Konto = rs.getInt(2);\n hentetTrukketbelob = rs.getDouble(3);\n hentetTil_Konto = rs.getInt(4);\n hentetIndfortbelob = rs.getDouble(5);\n hentetTimestamp = rs.getTimestamp(6);\n output.print(hentetId + \"\\t\\t\" + hentetFra_Konto + \"\\t\\t\" + hentetTrukketbelob + \"\\t\\t\" + hentetTil_Konto + \"\\t\\t\" + hentetIndfortbelob + \"\\t\\t\" + hentetTimestamp + \"\\n\");\n }\n\n output.println();\n output.println(\"username \\t\\t password\");\n output.println(\"------------------------------------------------------------------------------------------------------------------------------------\");\n\n // Henter login tabelen\n stmt = con.createStatement();\n sql = \"SELECT * FROM login\";\n rs = stmt.executeQuery(sql);\n while (rs.next()) { // Indsaetter raekkerne fra login tabelen ind i tekstfilen\n hentetUsername = rs.getNString(1);\n hentetPassword = rs.getInt(2);\n output.print(hentetUsername + \"\\t\\t\" + hentetPassword + \"\\n\");\n }\n\n }\n System.out.println(\"End Of Days backup successful!\");\n }", "@Override\n public void writeToDb(List<String> data) {\n\n try {\n openConnection();\n if (validateData((ArrayList<String>) data)) {\n for (String datum : data) {\n bufferedWriter.write(getDate() + \" - \" + datum);\n bufferedWriter.newLine();\n }\n bufferedWriter.write(\"==================\\n\");\n System.out.println(\"All data is written to MS SQL DB\");\n closeConnection();\n }\n } catch (IOException e) {\n System.err.println(\"ERROR!!!\");\n e.printStackTrace();\n }\n\n }", "void insert(VRpWkProvinceGprsCsBh record);", "int insert(BankUserInfo record);", "int insert(BankUserInfo record);", "public Bank saveBankInfo(Bank bank) throws Exception {\n\t\t// persist means insert record into the table\n\t\treturn bankDAOImpl.saveBankInfo(bank);\n\t}", "public void translate(\r\n String mob_db,\r\n String mob_db_tc,\r\n String outputFileName) {\r\n\r\n try {\r\n parseNameTable(mob_db_tc);\r\n\r\n try (BufferedReader reader = new BufferedReader(new FileReader(mob_db));\r\n BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFileName), \"Big5\"))) {\r\n while (reader.ready()) {\r\n String line = reader.readLine();\r\n if (line.matches(\"\\\\d+,.+\")) {\r\n String[] cols = line.split(\",\");\r\n if (nameTable.containsKey(cols[0])) {\r\n StringBuilder builder = new StringBuilder();\r\n builder.append(cols[0]).append(\",\").append(cols[1]).append(\",\").append(nameTable.get(cols[0]));\r\n for (int i=3; i<cols.length; i++)\r\n builder.append(\",\").append(cols[i]);\r\n line = builder.toString();\r\n }\r\n }\r\n writer.write(line);\r\n writer.newLine();\r\n }\r\n writer.flush();\r\n }\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "public synchronized void writeFromFileIntoDB()throws IOWrapperException, IOIteratorException{\r\n \r\n fromFile_Name=Controller.CLASSES_TMP_FILENAME;\r\n iow_ReadFromFile = new IOWrapper();\r\n \r\n //System.out.println(\"Readin' from \"+fromFile_Name);\r\n \r\n iow_ReadFromFile.setupInput(fromFile_Name,0);\r\n \r\n iter_ReadFromFile = iow_ReadFromFile.getLineIterator();\r\n iow_ReadFromFile.setupOutput(this.dbname,this.username,this.password,this.hostname,this.port);\r\n \r\n iow_ReadFromFile.sendOutputQuery(\"DROP TABLE IF EXISTS \"+outtable);\r\n \r\n iow_ReadFromFile.sendOutputQuery(\r\n \"CREATE TABLE IF NOT EXISTS \"\r\n +outtable+\" (\"\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[0]+\" int(10) NOT NULL AUTO_INCREMENT, \"//wort_nr\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[1]+\" varchar(225), \"//wort_alph\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[2]+\" int(10), \"//krankheit \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[3]+\" int(10), \"//farbe1 \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[4]+\" real(8,2), \"//farbe1prozent\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[5]+\" int(10), \"//farbe2\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[6]+\" real(8,2), \"//farbe2prozent\r\n +\"PRIMARY KEY (\"+Controller.COLUMN_NAMES_FOR_DB_OUT[0]+\")) \"\r\n +\"ENGINE=MyISAM\"\r\n );\r\n while(iter_ReadFromFile.hasNext()){\r\n singleProgress+=1;\r\n String[] data = (String[])iter_ReadFromFile.next();\r\n \r\n //System.out.println(\"--> processing line \"+data);\r\n //escape quotes ' etc for SQL query\r\n if(data[1].matches(\".*'.*\")||data[1].matches(\".*\\\\.*\")){\r\n int sl = data[1].length();\r\n String escapedString = \"\";\r\n \r\n for (int i = 0; i < sl; i++) {\r\n char ch = data[1].charAt(i);\r\n switch (ch) {\r\n case '\\'':\r\n escapedString +='\\\\';\r\n escapedString +='\\'';\r\n break;\r\n case '\\\\':\r\n escapedString +='\\\\';\r\n escapedString +='\\\\';\r\n break;\r\n default :\r\n escapedString +=ch;\r\n break;\r\n }\r\n }\r\n data[1]=escapedString;\r\n }\r\n \r\n String insertStatement=\"INSERT INTO \"\r\n +outtable+\" (\"\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[0]+\", \"//node id\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[1]+\", \"//label\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[2]+\", \"//class id \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[3]+\", \"//class id 1 \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[4]+\", \"//percent\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[5]+\", \"//class id 2\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[6]+\") \"//percent \r\n +\"VALUES ('\"\r\n +data[0]+\"', '\"\r\n +data[1]+\"', '\"\r\n +data[2]+\"', '\"\r\n +data[3]+\"', '\"\r\n +data[4]+\"', '\"\r\n +data[5]+\"', '\"\r\n +data[6]+\"')\";\r\n \r\n //System.out.println(\"Sending insert statement:\"+insertStatement);\r\n iow_ReadFromFile.sendOutputQuery(insertStatement);\r\n }\r\n \r\n \r\n //iow_ReadFromFile.closeOutput();\r\n \r\n this.stillWorks=false;\r\n writeIntoDB=false;\r\n System.out.println(\"*\\tData written into database.\");\r\n\t}", "@Override\n\tprotected void save() throws Exception {\n\t\t//turn the list of data into a unique list of tickets\n\t\tMap<String, ExtTicketVO> tickets= new HashMap<>(data.size());\n\t\tfor (SOHDRFileVO dataVo : data) {\n\t\t\t//035 are harvests and all we care about\n\t\t\tif (\"035\".equals(dataVo.getSoType())) {\n\t\t\t\tExtTicketVO vo = transposeTicketData(dataVo, new ExtTicketVO());\n\t\t\t\ttickets.put(vo.getTicketId(), vo);\n\t\t\t}\n\t\t}\n\n\t\tpopulateTicketDBData(tickets);\n\n\t\ttickets = removeGhostRecords(tickets);\n\n\t\t//don't bother with the rest of this class if we have no tickets\n\t\tif (tickets.isEmpty()) return;\n\n\t\tdecomissionUnits(tickets.keySet()); //ticket\n\n\t\tpurgePartShipments(tickets.keySet()); //calls purgeShipments to cascade deletion\n\n\t\tsetDispositionCode(tickets); //ticket_data attr_dispositionCode\tNONREPAIRABLE\n\n\t\tcorrectLedgerEntries(tickets);\n\t}", "private void updateDatabase() {\n\t\tAbstractSerializer serializer = new CineplexSerializer();\n\t\tArrayList<String> updatedRecords = serializer.serialize(records);\n\t\tDatabaseHandler.writeToDatabase(DATABASE_NAME, updatedRecords);\n\t}", "public void insertdata(String file) {\n\r\n\r\n final String csvFile = file;\r\n\r\n try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) {\r\n\r\n\r\n while ((line = br.readLine()) != null) {\r\n\r\n\r\n // use comma as separator\r\n String[] country = line.split(\",\");\r\n\r\n if (country.length == 12) {\r\n model_lacakMobil = new Model_LacakMobil();\r\n realmHelper = new RealmHelper(realm);\r\n\r\n model_lacakMobil.setNama_mobil(country[1]);\r\n model_lacakMobil.setNo_plat(country[2]);\r\n model_lacakMobil.setNamaunit(country[3]);\r\n model_lacakMobil.setFinance(country[4]);\r\n model_lacakMobil.setOvd(country[5]);\r\n model_lacakMobil.setSaldo(country[6]);\r\n model_lacakMobil.setCabang(country[7]);\r\n model_lacakMobil.setNoka(country[8]);\r\n model_lacakMobil.setNosin(country[9]);\r\n model_lacakMobil.setTahun(country[10]);\r\n model_lacakMobil.setWarna(country[11]);\r\n realmHelper.save(model_lacakMobil);\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n// fixing_data();\r\n\r\n }\r\n }", "private static void parseLawsAndSaveToDB() throws Exception {\n Iterable<RadaSessionDay> days = radaSessionDayRepository.findWithUrl();\n for (RadaSessionDay day : days){\n System.out.print(day.getRadaSession().getSklikanya()\n +\"\\t\" + day.getRadaSession().getsName()\n + \"\\t\" + day.getMonth()\n + \"\\t\" + day.getDay()\n + \"\\t\" + day.getUrl()\n );\n List<Law> laws = parser.loadLawsForDay(day);\n System.out.println(\"\\t\" + laws.size());\n if (laws.isEmpty())\n continue;\n try {\n lawRepository.save(laws);\n }catch (Exception ex){\n int f =5;\n }\n //radaSessionDayRepository.save(day);\n }\n }", "public void deposit(double amount) {\n balance += amount;\n \n try {\n \n Class.forName(\"net.ucanaccess.jdbc.UcanaccessDriver\");\n \n // Load Driver\n String connURL=\"jdbc:ucanaccess://c:/Users/Ellen/Documents/CIST2373/ChattBankMDB.mdb\";\n \n // Get Connection\n Connection con = DriverManager.getConnection(connURL);\n \n // Create Statement\n Statement stmt = con.createStatement();\n \n // Create sql string \n String sql = \"Update Accounts set Balance = \"+getBalance()+ \n \" where AcctNo='\"+getAcctNo()+\"'\";\n \n // Check for properly formed sql\n System.out.println(sql);\n \n // Execute Statement\n int n = stmt.executeUpdate(sql);\n if (n == 1)\n System.out.println(\"Update was successful!\");\n else\n System.out.println(\"Update failed!\"); \n \n // Close Connection\n con.close(); \n } //end try\n \n catch (Exception err) {\n System.out.println(\"Error: \" + err);\n } //end catch\n }", "public void deposit(String accountNumber, int amount) {\n\t\tConnection conn;\n\t\tPreparedStatement ps, pp, ll;\n\t\tString url = \"jdbc:mysql://localhost:3306/mars\";\n\t\tString username = \"root\";\n\t\tString password = \"1113\";\n\t\tint lastBalance;\n\t\ttry {\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t} catch (ClassNotFoundException e1) {\n\t\t\te1.printStackTrace();\n\t\t}\n\t\ttry{\n\t\tconn=DriverManager.getConnection(url, username, password);\n\t\tString sql = \"select balance,userId from \"+this.name+\" where accountNumber=?\";\n\t\tps= (PreparedStatement) conn.prepareStatement(sql);\n\t\tps.setString(1, accountNumber.toString());\n\t\tResultSet rs = ps.executeQuery();\n\t\tint nowBalance = 0;\n\t\tString id = \"\";\n\t\twhile(rs.next()) { \n\t\t\tnowBalance=rs.getInt(\"balance\");\n\t\t\tid = rs.getString(\"userId\");\n\t\t}\n\t\tlastBalance = nowBalance + amount;\n\t\t//System.out.println(lastBalance);\n\t\t\n\t\tString sql1 = \"UPDATE \"+this.name+\" SET balance=? where accountNumber=?\";\n\t\tpp = (PreparedStatement) conn.prepareStatement(sql1);\n\t\tpp.setInt(1, lastBalance);\n\t\tpp.setString(2, accountNumber.toString());\n\t\tpp.executeUpdate();\n\t\t\n\t\tString logs = \"deposit : \"+ amount+\" / balance: \"+String.valueOf(lastBalance);\n\t\tString sql11 = \"insert into \"+id+\" (log) values (?)\";\n\t\tll = (PreparedStatement) conn.prepareStatement(sql11);\n\t\tll.setString(1, logs);\n\t\tll.executeUpdate();\n\t\t\n\t\t}catch (SQLException e) {\n\t\t throw new IllegalStateException(\"Cannot connect the database!\", e);\n\t\t}\n\t}", "public void dump(AbstractPhoneBill bill) throws IOException{\n\n if(!file.exists()){\n file.createNewFile();\n }\n\n FileWriter fw = new FileWriter(file.getAbsoluteFile());\n FileReader fr = new FileReader(file);\n BufferedWriter bw = new BufferedWriter(fw);\n BufferedReader br = new BufferedReader(fr);\n //bw.write(String.valueOf(bill.getPhoneCalls()));\n\n if(br.readLine()==null) {\n bw.write(bill.toString());\n bw.write(\"\\n\");\n bw.write(String.valueOf(bill.getPhoneCalls()));\n }else{\n bw.write(\",\");\n bw.write(String.valueOf(bill.getPhoneCalls()));\n\n }\n\n bw.close();\n\n\n\n\n }", "public static void saveData() throws FileNotFoundException {\t\n\t\t\t\n\tScanner inputStream = new Scanner(new File(\"bookings.dat\"));\n\t\ttry {\n\t\t\t\n\t\t\tBookingList.surName = inputStream.nextLine();\n\t\t\tBookingList.tableNo = inputStream.nextLine();\n\t\t\tBookingList.sittingTime = inputStream.nextLine();\n\t\t\tBookingList.partyOf = inputStream.nextLine();\n\t\t\t\t\n\t\t\tBooking<?> bookingData = new Booking<Object>(null, surName, tableNo, sittingTime, partyOf);\n\t\t\tb1.insert(bookingData);\n\t\t\t\t\n\t\t}finally {\n\t\t\tinputStream.close();\n\t\t}\n\t\t\t\n\t}", "protected void saveData(File file) throws Exception{\n\t\t\n\n\t \n\t\t// Build the DataThing map from the resultReferencesMap\n\t\t// First convert map of references to objects into a map of real result objects\n\t\tMap<String, Object> resultMap = new HashMap<String, Object>();\n\t\tfor (Iterator<String> i = chosenReferences.keySet().iterator(); i.hasNext();) {\n\t\t\tString portName = (String) i.next();\n\t\t\tT2Reference reference = chosenReferences.get(portName);\n\t\t\tObject obj = convertReferencesToObjects(reference);\n\t\t\tresultMap.put(portName, obj);\n\t\t}\n\t\tMap<String, DataThing> dataThings = bakeDataThingMap(resultMap);\n\t\t\n\t\tfor (String portName : dataThings.keySet()) {\n\t\t\tDataThing thing = dataThings.get(portName);\n\t\t\tthing.writeToFileSystem(file, portName);\n\t\t}\n\t}", "@Override\r\n\tpublic void save(Bankcard bankcard) {\n\t\tbankcardMapper.insert(bankcard);\r\n\t}", "@SuppressWarnings(\"deprecation\")\n\tpublic void writeTable()\n\t{\n\t\tIterator<WPPost> itr = readValues.iterator();\n\t\t\n\t\twhile(itr.hasNext())\n\t\t{\n\t\t\tWPPost post = itr.next();\n\t\t\tPreparedStatement prStm;\n\t\t\tint res = 0;\n\t\t\t\n\t\t\ttry \n\t\t\t{\n\t\t\t\tif(post.getPostDateGMT() == null)\n\t\t\t\t{\n\t\t\t\t\tpost.setPostDateGMT(new Timestamp(0));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(post.getPostModifiedGMT() == null)\n\t\t\t\t{\n\t\t\t\t\tpost.setPostModifiedGMT(new Timestamp(0));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tprStm = conn.prepareStatement(WRITE_STATEMENT);\n\t\t\t\tprStm.setInt(1, post.getId());\n\t\t\t\tprStm.setInt(2, post.getPostAuthor());\n\t\t\t\tprStm.setTimestamp(3, post.getPostDate());\n\t\t\t\tprStm.setTimestamp(4, post.getPostDateGMT());\n\t\t\t\tprStm.setString(5, post.getPostContent());\n\t\t\t\tprStm.setString(6, post.getPostTitle());\n\t\t\t\tprStm.setString(7, post.getPostExcerpt());\n\t\t\t\tprStm.setString(8, post.getPostStatus());\n\t\t\t\tprStm.setString(9, post.getCommentStatus());\n\t\t\t\tprStm.setString(10, post.getPingStatus());\n\t\t\t\tprStm.setString(11, post.getPostPassword());\n\t\t\t\tprStm.setString(12, post.getPostName());\n\t\t\t\tprStm.setString(13, post.getToPing());\n\t\t\t\tprStm.setString(14, post.getPinged());\n\t\t\t\tprStm.setTimestamp(15, post.getPostModified());\n\t\t\t\tprStm.setTimestamp(16, post.getPostModifiedGMT());\n\t\t\t\tprStm.setString(17, post.getPostContentFiltered());\n\t\t\t\tprStm.setInt(18, post.getPostParent());\n\t\t\t\tprStm.setString(19, post.getGuid());\n\t\t\t\tprStm.setInt(20, post.getMenuOrder());\n\t\t\t\tprStm.setString(21, post.getPostType());\n\t\t\t\tprStm.setString(22, post.getPostMimeType());\n\t\t\t\tprStm.setInt(23, post.getCommentCount());\n\t\t\t\t\n\t\t\t\tres = prStm.executeUpdate();\n\t\t\t\t\n\t\t\t\tif(res == 0)\n\t\t\t\t{\n\t\t\t\t\ttry \n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new WriteWPPostException(post.toString());\n\t\t\t\t\t} \n\t\t\t\t\tcatch (WriteWPPostException e) \n\t\t\t\t\t{\n\t\t\t\t\t\t//e.printStackTrace(); // TODO Debug Mode! Delete This!\n\t\t\t\t\t\tthis.rowsWithErrors.add(post);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t\tcatch (SQLException e1) \n\t\t\t{\n\t\t\t\t//e1.printStackTrace(); // TODO Debug Mode! Delete This!\n\t\t\t\tthis.rowsWithErrors.add(post);\n\t\t\t}\n\t\t}\n\t}", "public BankDataBase()\n {\n accounts = new Account[ 2 ];\n accounts[ 0 ] = new Account( 12345, 54321, 1000.0, 1200.0 );\n accounts[ 1 ] = new Account( 98765, 56789, 200.0, 200.0 );\n }", "public void sendDataToDB() throws JSONException, InstantiationException, IllegalAccessException, ClassNotFoundException, UnirestException, ParseException {\r\n\t\t\r\n\t\tArrayList<HashMap<String, String>> dataSet = new ArrayList<>();\r\n\t\t\r\n\t\tfor (int i = 0; i < dataArray.length(); i++) {\r\n\t\t\tHashMap<String, String> jsonObject = new HashMap<String, String>();\r\n\t\t\tjsonObject.put(\"id\" ,dataArray.getJSONObject(i).get(\"id\").toString());\r\n\t\t\tjsonObject.put(\"name\", dataArray.getJSONObject(i).get(\"name\").toString());\r\n\t\t\tjsonObject.put(\"free_bikes\", dataArray.getJSONObject(i).get(\"free_bikes\").toString());\r\n\t\t\tjsonObject.put(\"timestamp\", changeTimeStamptoUnixTimeString(dataArray.getJSONObject(i).get(\"timestamp\").toString()));\r\n\t\t\tjsonObject.put(\"latitude\", dataArray.getJSONObject(i).get(\"latitude\").toString());\r\n\t\t\tjsonObject.put(\"longitude\", dataArray.getJSONObject(i).get(\"longitude\").toString());\r\n\r\n\t\t\tdataSet.add(jsonObject);\r\n\t\t}\r\n\t\t\r\n\t\t// Send whole data to DBService\r\n\t\tUnirest.post(\"http://stadtraddbservice:6000/newData\")\r\n\t\t//Unirest.post(\"http://localhost:6000/newData\") // Fuer lokalen Test\r\n\t\t .body(new Gson().toJson(dataSet))\r\n\t\t .asString();\r\n\t}", "protected void exit() {\n (new CSVFile(bankDB)).writeCSV();\n try{\n FileUtil.writeTransactions(bankDB.getTransactions());\n }catch(IOException e){\n AlertBox.display(ERROR, \"There was an error printing the transactions\");\n }\n System.exit(0);\n }", "public static void LineArchive() throws ClassNotFoundException, SQLException {\r\n Statement s1 = DBConnect.connection.createStatement();\r\n String writeLine = \"INSERT INTO completed_lines \"\r\n + \"(Line, Sku, Qty, Description1, Orig_Sku, Description2, Attribute2, Size2, Orig_Retail, Manuf_Inspection, New_Used, Reason, \"\r\n + \"Desc_Damage, Cust_Satisf, Warranty, Second_Cost, Form_Name, Ln_Date, Second_Sku_Vendor, Second_Sku_VPNum, Ord_C$, New_Sku, \"\r\n + \"First_DCS, Second_DCS) SELECT * FROM \" + InvAdj_Admin.frmNm + \" WHERE Sku IS NOT NULL\";\r\n \r\n // This inserts store and form name because I could not figure out how to include it in the insert statement above\r\n String setStrFmNm = \"UPDATE completed_lines \"\r\n // + \"SET Form_Name = '\" + InvAdj_Admin.frmNm + \"'\" + \",\"\r\n + \"SET Store = '\" + InvAdj_Admin.frmNm.split(\"_\")[1] + \"' \"\r\n + \"WHERE Sku IS NOT NULL AND Form_Name = '\"+ InvAdj_Admin.frmNm +\"'\";\r\n s1.execute(writeLine); \r\n s1.execute(setStrFmNm);\r\n }", "private static void ceSync(Connection con, InputStreamReader isr, String club) {\n\n PreparedStatement pstmt2 = null;\n Statement stmt = null;\n ResultSet rs = null;\n\n\n Member member = new Member();\n\n String line = \"\";\n String password = \"\";\n String temp = \"\";\n\n int i = 0;\n int ext = 1;\n\n // Values from CE records\n //\n String fname = \"\";\n String lname = \"\";\n String mi = \"\";\n String suffix = \"\";\n String posid = \"\";\n String gender = \"\";\n String ghin = \"\";\n String memid = \"\";\n String webid = \"\";\n String mNum = \"\";\n String u_hndcp = \"\";\n String c_hndcp = \"\";\n String mship = \"\";\n String mtype = \"\";\n String bag = \"\";\n String email = \"\";\n String email2 = \"\";\n String phone = \"\";\n String phone2 = \"\";\n String mobile = \"\";\n String primary = \"\";\n String active = \"\";\n String webid_new = \"\";\n String memid_new = \"\";\n String lnamePart2;\n\n String mship2 = \"\"; // used to tell if match was found\n\n float u_hcap = 0;\n float c_hcap = 0;\n int birth = 0;\n int inact = 0;\n\n // Values from ForeTees records\n //\n String memid_old = \"\";\n String fname_old = \"\";\n String lname_old = \"\";\n String mi_old = \"\";\n String mship_old = \"\";\n String mtype_old = \"\";\n String email_old = \"\";\n String mNum_old = \"\";\n String ghin_old = \"\";\n String bag_old = \"\";\n String posid_old = \"\";\n String email2_old = \"\";\n String phone_old = \"\";\n String phone2_old = \"\";\n String suffix_old = \"\";\n\n float u_hcap_old = 0;\n float c_hcap_old = 0;\n int birth_old = 0;\n int inact_old = 0;\n\n // Values for New ForeTees records\n //\n String fname_new = \"\";\n String lname_new = \"\";\n String mi_new = \"\";\n String mship_new = \"\";\n String mtype_new = \"\";\n String email_new = \"\";\n String mNum_new = \"\";\n String ghin_new = \"\";\n String bag_new = \"\";\n String posid_new = \"\";\n String email2_new = \"\";\n String phone_new = \"\";\n String phone2_new = \"\";\n String suffix_new = \"\";\n String last_mship = \"\";\n String last_mnum = \"\";\n String openParen = \"(\";\n String closeParen = \")\";\n String asterik = \"*\";\n String slash = \"/\";\n String backslash = \"\\\\\";\n\n float u_hcap_new = 0;\n float c_hcap_new = 0;\n int birth_new = 0;\n int inact_new = 0;\n int rcount = 0;\n int pcount = 0;\n int ncount = 0;\n int ucount = 0;\n int errCount = 0;\n int warnCount = 0;\n int totalErrCount = 0;\n int totalWarnCount = 0;\n int email_bounce1 = 0;\n int email_bounce2 = 0;\n\n String errorMsg = \"\";\n String errMsg = \"\";\n String warnMsg = \"\";\n String errMemInfo = \"\";\n\n boolean failed = false;\n boolean changed = false;\n boolean skip = false;\n boolean headerFound = false;\n boolean found = false;\n boolean useWebid = false;\n boolean genderMissing = false;\n\n ArrayList<String> errList = new ArrayList<String>();\n ArrayList<String> warnList = new ArrayList<String>();\n\n\n // Overwrite log file with fresh one for today's logs\n SystemUtils.logErrorToFile(\"Clubessential: Error log for \" + club + \"\\nStart time: \" + new java.util.Date().toString() + \"\\n\", club, false);\n\n try {\n\n Calendar caly = new GregorianCalendar(); // get todays date\n int thisYear = caly.get(Calendar.YEAR); // get this year value\n\n thisYear = thisYear - 2000; // 2 digit value\n\n\n BufferedReader br = new BufferedReader(isr);\n\n // format of each line in the file:\n //\n // memid, mNum, fname, mi, lname, suffix, mship, mtype, gender, email, email2,\n // phone, phone2, bag, hndcp#, uhndcp, chndcp, birth, posid, mobile, primary, act/inact\n //\n //\n while (true) {\n\n line = br.readLine();\n\n if (line == null) {\n break;\n }\n\n // Skip the 1st row (header row)\n\n if (headerFound == false) {\n\n headerFound = true;\n\n } else {\n\n // Remove the dbl quotes and check for embedded commas\n\n line = cleanRecord( line );\n\n rcount++; // count the records\n\n // parse the line to gather all the info\n\n StringTokenizer tok = new StringTokenizer( line, \",\" ); // delimiters are comma\n\n if ( tok.countTokens() > 20 ) { // enough data ?\n\n memid = tok.nextToken(); // a\n mNum = tok.nextToken(); // b\n fname = tok.nextToken(); // c\n mi = tok.nextToken(); // d\n lname = tok.nextToken(); // e\n suffix = tok.nextToken(); // f\n mship = tok.nextToken(); // g\n mtype = tok.nextToken(); // h\n gender = tok.nextToken(); // i\n email = tok.nextToken(); // j\n email2 = tok.nextToken(); // k\n phone = tok.nextToken(); // l\n phone2 = tok.nextToken(); // m\n bag = tok.nextToken(); // n\n ghin = tok.nextToken(); // o\n u_hndcp = tok.nextToken(); // p\n c_hndcp = tok.nextToken(); // q\n temp = tok.nextToken(); // r\n posid = tok.nextToken(); // s\n mobile = tok.nextToken(); // t\n primary = tok.nextToken(); // u\n active = tok.nextToken(); // v\n\n //\n // Check for ? (not provided)\n //\n if (memid.equals( \"?\" )) {\n\n memid = \"\";\n }\n if (mNum.equals( \"?\" )) {\n\n mNum = \"\";\n }\n if (fname.equals( \"?\" )) {\n\n fname = \"\";\n }\n if (mi.equals( \"?\" )) {\n\n mi = \"\";\n }\n if (lname.equals( \"?\" )) {\n\n lname = \"\";\n }\n if (suffix.equals( \"?\" )) {\n\n suffix = \"\";\n }\n if (mship.equals( \"?\" )) {\n\n mship = \"\";\n }\n if (mtype.equals( \"?\" )) {\n\n mtype = \"\";\n }\n if (gender.equals( \"?\" ) || (!gender.equalsIgnoreCase(\"M\") && !gender.equalsIgnoreCase(\"F\"))) {\n\n if (gender.equals( \"?\" )) {\n genderMissing = true;\n } else {\n genderMissing = false;\n }\n gender = \"\";\n }\n if (email.equals( \"?\" )) {\n\n email = \"\";\n }\n if (email2.equals( \"?\" )) {\n\n email2 = \"\";\n }\n if (phone.equals( \"?\" )) {\n\n phone = \"\";\n }\n if (phone2.equals( \"?\" )) {\n\n phone2 = \"\";\n }\n if (bag.equals( \"?\" )) {\n\n bag = \"\";\n }\n if (ghin.equals( \"?\" )) {\n\n ghin = \"\";\n }\n if (u_hndcp.equals( \"?\" )) {\n\n u_hndcp = \"\";\n }\n if (c_hndcp.equals( \"?\" )) {\n\n c_hndcp = \"\";\n }\n if (temp.equals( \"?\" ) || temp.equals( \"0\" )) {\n\n temp = \"\";\n }\n if (posid.equals( \"?\" )) {\n\n posid = \"\";\n }\n if (mobile.equals( \"?\" )) {\n\n mobile = \"\";\n }\n if (primary.equals( \"?\" )) {\n\n primary = \"\";\n }\n if (active.equals( \"?\" )) {\n\n active = \"\";\n }\n\n\n //\n // Westchester memids will be empty for dependents\n //\n if (club.equals( \"westchester\" ) && memid.equals( \"\" )) {\n\n memid = mNum; // use mNum\n }\n\n\n if (club.equals( \"virginiacc\" )) {\n\n //\n // Make sure name is titled\n //\n fname = toTitleCase(fname);\n lname = toTitleCase(lname);\n }\n\n\n //\n // Ignore mi if not alpha\n //\n if (mi.endsWith( \"0\" ) || mi.endsWith( \"1\" ) || mi.endsWith( \"2\" ) || mi.endsWith( \"3\" ) ||\n mi.endsWith( \"4\" ) || mi.endsWith( \"5\" ) || mi.endsWith( \"6\" ) || mi.endsWith( \"7\" ) ||\n mi.endsWith( \"8\" ) || mi.endsWith( \"9\" )) {\n\n mi = \"\";\n }\n\n\n tok = new StringTokenizer( lname, openParen ); // check for open paren '('\n\n if ( tok.countTokens() > 1 ) {\n\n lname = tok.nextToken(); // skip open paren and anything following it\n }\n\n tok = new StringTokenizer( lname, slash ); // check for slash\n\n if ( tok.countTokens() > 1 ) {\n\n lname = tok.nextToken(); // skip them and anything following it\n }\n\n tok = new StringTokenizer( lname, backslash ); // check for backslash\n\n if ( tok.countTokens() > 1 ) {\n\n lname = tok.nextToken(); // skip them and anything following it\n }\n\n tok = new StringTokenizer( fname, openParen ); // check for open paren '('\n\n if ( tok.countTokens() > 1 ) {\n\n fname = tok.nextToken(); // skip open paren and anything following it\n }\n\n tok = new StringTokenizer( fname, \"/\\\\\" ); // check for slash and backslash\n\n if ( tok.countTokens() > 1 ) {\n\n fname = tok.nextToken(); // skip them and anything following it\n }\n\n\n //\n // Determine if we should process this record (does it meet the minimum requirements?)\n //\n if (!memid.equals( \"\" ) && !mNum.equals( \"\" ) && !lname.equals( \"\" ) && !fname.equals( \"\" )) {\n\n //\n // Remove spaces, etc. from name fields\n //\n tok = new StringTokenizer( fname, \" \" ); // delimiters are space\n\n fname = tok.nextToken(); // remove any spaces and middle name\n\n if ( tok.countTokens() > 0 ) {\n\n mi = tok.nextToken(); // over-write mi if already there\n\n if (mi.startsWith(\"&\")) {\n mi = \"\";\n }\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n tok = new StringTokenizer( suffix, \" \" ); // delimiters are space\n\n suffix = tok.nextToken(); // remove any extra (only use one value)\n }\n\n tok = new StringTokenizer( lname, \" \" ); // delimiters are space\n\n if ( tok.countTokens() > 0 ) { // more than just lname?\n\n lname = tok.nextToken(); // remove suffix and spaces\n }\n\n if (suffix.equals( \"\" )) { // if suffix not provided\n\n if ( tok.countTokens() > 1 ) { // check for suffix and 2 part lname (i.e. Van Buren)\n\n lnamePart2 = tok.nextToken();\n\n if (!lnamePart2.startsWith(\"&\") && !lnamePart2.startsWith(openParen)) { // if ok to add\n\n lname = lname + lnamePart2; // combine (i.e. VanBuren)\n }\n }\n\n if ( tok.countTokens() > 0 ) { // suffix?\n\n suffix = tok.nextToken();\n\n if (suffix.startsWith(\"&\")) {\n suffix = \"\";\n }\n }\n\n } else { // suffix provided in suffix field - check for 2 part lname (i.e. Van Buren)\n\n if ( tok.countTokens() > 0 ) {\n\n lnamePart2 = tok.nextToken();\n\n if (!lnamePart2.startsWith(\"&\") && !lnamePart2.startsWith(\"(\") && !lnamePart2.equals(suffix)) { // if ok to add\n\n lname = lname + lnamePart2; // combine (i.e. VanBuren)\n }\n }\n }\n\n if (suffix.startsWith(openParen)) { // if not really a suffix\n\n suffix = \"\";\n }\n\n\n //\n // Isolate the last name in case extra info attached (i.e. lname..yyyy/nnn)\n //\n if (!lname.equals( \"\" )) {\n\n tok = new StringTokenizer( lname, asterik ); // delimiters are slashes, asterics (backslash needs 2)\n\n if ( tok.countTokens() > 0 ) {\n\n lname = tok.nextToken(); // isolate lname\n }\n\n tok = new StringTokenizer( lname, slash );\n\n if ( tok.countTokens() > 0 ) {\n\n lname = tok.nextToken();\n }\n\n tok = new StringTokenizer( lname, backslash );\n\n if ( tok.countTokens() > 0 ) {\n\n lname = tok.nextToken();\n }\n }\n\n //\n // Append the suffix to last name if it exists and isn't already appended\n //\n if (!suffix.equals(\"\")) {\n\n if (!lname.endsWith(suffix)) {\n\n lname = lname + \"_\" + suffix; // append it\n }\n\n suffix = \"\"; // done with it now\n }\n\n\n //\n // Determine the handicaps\n //\n u_hcap = -99; // indicate no hndcp\n c_hcap = -99; // indicate no c_hndcp\n\n if (!u_hndcp.equals( \"\" ) && !u_hndcp.equalsIgnoreCase(\"NH\") && !u_hndcp.equalsIgnoreCase(\"NHL\")) {\n\n u_hndcp = u_hndcp.replace('L', ' '); // isolate the handicap - remove spaces and trailing 'L'\n u_hndcp = u_hndcp.replace('H', ' '); // or 'H' if present\n u_hndcp = u_hndcp.replace('N', ' '); // or 'N' if present\n u_hndcp = u_hndcp.replace('J', ' '); // or 'J' if present\n u_hndcp = u_hndcp.replace('R', ' '); // or 'R' if present\n u_hndcp = u_hndcp.trim();\n\n u_hcap = Float.parseFloat(u_hndcp); // usga handicap\n\n if ((!u_hndcp.startsWith(\"+\")) && (!u_hndcp.startsWith(\"-\"))) {\n\n u_hcap = 0 - u_hcap; // make it a negative hndcp (normal)\n }\n }\n\n if (!c_hndcp.equals( \"\" ) && !c_hndcp.equalsIgnoreCase(\"NH\") && !c_hndcp.equalsIgnoreCase(\"NHL\")) {\n\n c_hndcp = c_hndcp.replace('L', ' '); // isolate the handicap - remove spaces and trailing 'L'\n c_hndcp = c_hndcp.replace('H', ' '); // or 'H' if present\n c_hndcp = c_hndcp.replace('N', ' '); // or 'N' if present\n c_hndcp = c_hndcp.replace('J', ' '); // or 'J' if present\n c_hndcp = c_hndcp.replace('R', ' '); // or 'R' if present\n c_hndcp = c_hndcp.trim();\n\n c_hcap = Float.parseFloat(c_hndcp); // usga handicap\n\n if ((!c_hndcp.startsWith(\"+\")) && (!c_hndcp.startsWith(\"-\"))) {\n\n c_hcap = 0 - c_hcap; // make it a negative hndcp (normal)\n }\n }\n\n //\n // convert birth date (mm/dd/yyyy to yyyymmdd)\n //\n if (!temp.equals( \"\" )) {\n\n int mm = 0;\n int dd = 0;\n int yy = 0;\n\n tok = new StringTokenizer( temp, \"/-\" ); // delimiters are / & -\n\n if ( tok.countTokens() > 2 ) {\n\n String b1 = tok.nextToken();\n String b2 = tok.nextToken();\n String b3 = tok.nextToken();\n\n mm = Integer.parseInt(b1);\n dd = Integer.parseInt(b2);\n yy = Integer.parseInt(b3);\n\n } else { // try 'Jan 20, 1951' format\n\n tok = new StringTokenizer( temp, \", \" ); // delimiters are comma and space\n\n if ( tok.countTokens() > 2 ) {\n\n String b1 = tok.nextToken();\n String b2 = tok.nextToken();\n String b3 = tok.nextToken();\n\n if (b1.startsWith( \"Jan\" )) {\n mm = 1;\n } else {\n if (b1.startsWith( \"Feb\" )) {\n mm = 2;\n } else {\n if (b1.startsWith( \"Mar\" )) {\n mm = 3;\n } else {\n if (b1.startsWith( \"Apr\" )) {\n mm = 4;\n } else {\n if (b1.startsWith( \"May\" )) {\n mm = 5;\n } else {\n if (b1.startsWith( \"Jun\" )) {\n mm = 6;\n } else {\n if (b1.startsWith( \"Jul\" )) {\n mm = 7;\n } else {\n if (b1.startsWith( \"Aug\" )) {\n mm = 8;\n } else {\n if (b1.startsWith( \"Sep\" )) {\n mm = 9;\n } else {\n if (b1.startsWith( \"Oct\" )) {\n mm = 10;\n } else {\n if (b1.startsWith( \"Nov\" )) {\n mm = 11;\n } else {\n if (b1.startsWith( \"Dec\" )) {\n mm = 12;\n } else {\n mm = Integer.parseInt(b1);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n dd = Integer.parseInt(b2);\n yy = Integer.parseInt(b3);\n\n } else {\n\n birth = 0;\n }\n }\n\n if (mm > 0) { // if birth provided\n\n if (mm == 1 && dd == 1 && yy == 1) { // skip if 1/1/0001\n\n birth = 0;\n\n } else {\n\n if (yy < 100) { // if 2 digit year\n\n if (yy <= thisYear) {\n\n yy += 2000; // 20xx\n\n } else {\n\n yy += 1900; // 19xx\n }\n }\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n }\n\n } else {\n\n birth = 0;\n }\n\n } else {\n\n birth = 0;\n }\n\n password = lname;\n\n //\n // if lname is less than 4 chars, fill with 1's\n //\n int length = password.length();\n\n while (length < 4) {\n\n password = password + \"1\";\n length++;\n }\n\n //\n // Verify the email addresses\n //\n if (!email.equals( \"\" )) { // if specified\n\n email = email.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email));\n\n if (!feedback.isPositive()) { // if error\n\n email = \"\"; // do not use it\n }\n }\n if (!email2.equals( \"\" )) { // if specified\n\n email2 = email2.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email2));\n\n if (!feedback.isPositive()) { // if error\n\n email2 = \"\"; // do not use it\n }\n }\n\n // if email #1 is empty then assign email #2 to it\n if (email.equals(\"\")) email = email2;\n\n\n skip = false;\n errCount = 0; // reset the error counter\n warnCount = 0; // reset warning counter\n errMsg = \"\"; // reset error message\n warnMsg = \"\"; // reset warning message\n errMemInfo = \"\"; // reset the error member info\n found = false; // default to club NOT found\n\n\n //\n // Set the active/inactive flag in case it is used\n //\n inact = 0; // default = active\nif (!club.equals(\"tpcwakefieldplantation\")) {\n if (active.equalsIgnoreCase( \"I\" )) {\n\n inact = 1; // set inactive\n }\n}\n\n //\n // Weed out any non-members\n //\n if (fname.equalsIgnoreCase(\"admin\") || lname.equalsIgnoreCase(\"admin\") ||\n fname.equalsIgnoreCase(\"test\") || lname.equalsIgnoreCase(\"test\")) {\n\n inact = 1; // skip this record\n }\n\n //\n // Format member info for use in error logging before club-specific manipulation\n //\n errMemInfo = \"Member Details:\\n\" +\n \" name: \" + lname + \", \" + fname + \" \" + mi + \"\\n\" +\n \" mtype: \" + mtype + \" mship: \" + mship + \"\\n\" +\n \" memid: \" + memid + \" mNum: \" + mNum + \" gender: \" + gender;\n\n\n // if gender is incorrect or missing, flag a warning in the error log\n if (gender.equals(\"\")) {\n warnCount++;\n if (genderMissing) {\n warnMsg = warnMsg + \"\\n\" +\n \" -GENDER missing! (Defaulted to 'M')\";\n } else {\n warnMsg = warnMsg + \"\\n\" +\n \" -GENDER incorrect! (Defaulted to 'M')\";\n }\n gender = \"M\";\n }\n\n //\n // Skip entries with no membership type\n //\n if (mship.equals(\"\")) {\n errCount++;\n skip = true;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n }\n\n //\n // Skip entries with first/last names of 'admin'\n //\n if (fname.equalsIgnoreCase(\"admin\") || lname.equalsIgnoreCase(\"admin\")) {\n errCount++;\n skip = true;\n errMsg = errMsg + \"\\n\" +\n \" -INVALID NAME! 'Admin' or 'admin' not allowed for first or last name\";\n }\n\n //\n // Make sure the member is not inactive - skip it it is\n //\n if (inact == 0 || club.equals( \"congressional\" )) { // if active or Congressional\n\n //\n // *********************************************************************\n //\n // The following will be dependent on the club - customized\n //\n // *********************************************************************\n //\n if (club.equals( \"weeburn\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (mship.equalsIgnoreCase( \"house\" ) ||\n mship.equalsIgnoreCase( \"non-golf\" ) || mship.equalsIgnoreCase( \"non-resident house\" ) ||\n mship.equalsIgnoreCase( \"non-resident non-golf\" ) || mship.equalsIgnoreCase( \"senior house\" ) ||\n mship.equalsIgnoreCase( \"senior non-golf\" ) || mship.equalsIgnoreCase( \"senior non golf\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: MEMBERSHIP TYPE NOT FOUND!\";\n \n } else {\n\n if (mship.startsWith( \"WFG\" )) {\n\n mship = \"WAITING FOR GOLF\"; // convert mship\n }\n\n if (mship.equalsIgnoreCase( \"golf\" )) {\n\n mship = \"Golf\"; // convert mship\n }\n\n //\n // set defaults\n //\n if (gender.equalsIgnoreCase( \"f\" )) {\n\n gender = \"F\"; // Female\n\n } else {\n\n gender = \"M\"; // default to Male\n }\n\n //\n // Set the Member Type\n //\n if (primary.equalsIgnoreCase( \"p\" )) {\n\n mtype = \"Primary Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Primary Female\";\n }\n\n posid = mNum;\n\n } else if (primary.equalsIgnoreCase( \"s\" )) {\n\n mtype = \"Spouse Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Spouse Female\";\n }\n\n posid = mNum + \"S\";\n\n } else {\n\n mtype = \"Junior\";\n }\n\n if (mship.equalsIgnoreCase( \"DEPENDENT CHILD\" )) {\n\n //\n // Determine the age in years\n //\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 18; // backup 18 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is < 18 yrs old\n\n mtype = \"Junior\";\n\n } else {\n\n year = year - 5; // back up 5 more years (23 total)\n\n oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is 18 - 22 yrs old (< 23)\n\n mtype = \"Adult Child\";\n\n } else {\n\n year = year - 6; // back up 6 more years (29 total)\n\n oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is 23 - 28 yrs old (< 29)\n\n mtype = \"Extended Family\";\n\n } else {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT CHILD OVER 29\";\n }\n }\n }\n }\n\n //\n // Try to set the correct mship type (spouses must be changed)\n //\n if (primary.equalsIgnoreCase( \"s\" ) || mship.equalsIgnoreCase( \"Dependent Spouse\" ) ||\n mship.equalsIgnoreCase(\"DEPENDENT CHILD\")) {\n\n if (mNum.equals( last_mnum )) { // if spouse of last member processed\n\n mship = last_mship; // get primary's mship value\n\n } else {\n\n //\n // Check the db for the primary's mship type\n //\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship FROM member2b WHERE memNum = ? AND m_type like 'Primary%'\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, mNum);\n rs = pstmt2.executeQuery();\n\n if(rs.next()) {\n\n mship = rs.getString(\"m_ship\");\n\n } else {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n pstmt2.close();\n }\n\n } else { // must be primary\n\n last_mnum = mNum; // save these for spouse\n last_mship = mship;\n }\n\n }\n\n } // end of IF club = ???\n\n\n if (club.equals( \"westchester\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (mship.equalsIgnoreCase( \"courtesy\" ) || mship.equalsIgnoreCase( \"houseres\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) {\n\n //\n // Set the Member & Membership Types\n //\n if (primary.equalsIgnoreCase( \"P\" )) { // if primary member\n\n mship = \"Members\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Member Female\";\n\n } else {\n\n mtype = \"Member Male\";\n }\n\n } else { // all others (spouse and dependents)\n\n mship = \"Family Members\";\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n\n } else {\n\n mtype = \"Dependent\";\n\n //\n // Set memid for dependents\n //\n ext++; // bump common extension value (1 - nnnnn)\n memid = memid + ext;\n }\n }\n } else {\n\n skip = true;\n }\n } // end of IF club = westchester\n\n\n //\n // CC of Virginia\n //\n if (club.equals( \"virginiacc\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" )) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n //\n // Set the Member Types (based on age and gender)\n //\n if (birth == 0) { // if age unknown\n\n mtype = \"Adult Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Adult Female\";\n }\n\n } else {\n\n //\n // Determine the age in years\n //\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 16; // backup 16 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is < 16 yrs old\n\n mtype = \"Junior Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Junior Female\";\n }\n\n } else {\n\n year = year - 7; // backup 7 more years (23 total)\n\n oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is 16 - 22 yrs old (< 23)\n\n mtype = \"Student Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Student Female\";\n }\n\n } else {\n\n year = year - 7; // backup 7 more years (30 total)\n\n oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is 23 - 29 yrs old (< 30)\n\n mtype = \"Young Adult Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Young Adult Female\";\n }\n\n } else {\n\n year = year - 30; // backup 30 more years (60 total)\n\n oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is 30 - 59 yrs old (< 60)\n\n mtype = \"Adult Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Adult Female\";\n }\n\n } else {\n\n mtype = \"Senior Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Senior Female\";\n }\n }\n }\n }\n }\n }\n\n if (mship.equalsIgnoreCase(\"HONORARY-MALE\")) {\n mtype = \"Honorary Male\";\n } else if (mship.equalsIgnoreCase(\"HONORARY-FEMALE\")) {\n mtype = \"Honorary Female\";\n } else if (mship.equalsIgnoreCase(\"HONORARY RETIREES\")) {\n mtype = \"Honorary Retirees\";\n }\n\n mship = \"Active\"; // convert all to Active\n\n } else {\n\n skip = true;\n }\n } // end of IF club =\n\n\n //\n // The Point Lake CLub\n //\n/*\n if (club.equals( \"pointlake\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" ) || mship.equalsIgnoreCase(\"CSH\")) {\n\n //\n // Set the Member Types\n //\n if (gender.equals( \"\" )) {\n\n gender = \"M\";\n }\n\n if (mship.equalsIgnoreCase( \"SPS\" ) || mship.equalsIgnoreCase( \"SPG\" )) { // TEMP until they fix their genders\n\n gender = \"F\";\n }\n\n if (primary.equalsIgnoreCase( \"P\" )) { // if primary member\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n } else { // spouse\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n }\n\n } else { // no mship\n\n skip = true; // skip this record\n }\n\n } // end of IF club =\n*/\n\n //\n // Wichita - uses mapping (webid) !!!\n //\n if (club.equals( \"wichita\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equals( \"\" )) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n\n //\n // Set the Member Types\n //\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Adult Female\";\n\n } else {\n\n mtype = \"Adult Male\";\n }\n\n if (mship.equalsIgnoreCase( \"child\" )) {\n\n //\n // if Child, set member type according to age\n //\n mtype = \"Juniors\"; // default\n\n if (birth > 0) { // if age provided\n\n //\n // Determine the age in years\n //\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 18; // backup 18 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is < 18 yrs old\n\n mtype = \"Juniors\";\n\n } else {\n\n mtype = \"18-24\";\n }\n }\n }\n\n mship = \"Golf\"; // everyone is Golf\n\n } else { // no mship\n\n skip = true; // skip this record\n }\n\n } // end of IF club =\n\n\n //\n // Brantford\n //\n if (club.equals( \"brantford\" )) {\n\n found = true; // club found\n\n // if there is no posid, then use the mNum\n if (posid.equals(\"\")) posid = mNum;\n\n mship = mtype; // use member type for mship\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (mship.equalsIgnoreCase( \"1 day curl\" ) || mship.equalsIgnoreCase( \"asc crl ld\" ) ||\n mship.startsWith( \"ASSC CUR\" ) || mship.startsWith( \"RESIGN\" )) {\n\n skip = true; // skip this record\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) { // mship ok\n\n //\n // Set the Membership Types\n //\n if (mship.startsWith( \"EXT\" )) {\n\n mship = \"Extended Junior\";\n }\n\n if (mship.startsWith( \"CURL\" ) || mship.equalsIgnoreCase( \"lds curl\" )) {\n\n mship = \"Curler\";\n }\n\n if (mship.startsWith( \"FULL\" ) || mship.startsWith( \"HONO\" ) || mship.startsWith( \"INT\" ) ||\n mship.startsWith( \"LDYFULL\" ) || mship.startsWith( \"MST FL\" ) || mship.startsWith( \"MSTR FU\" ) ||\n mship.startsWith( \"PLAYER\" ) || mship.startsWith( \"SEN\" ) || mship.startsWith( \"SR FULL\" )) {\n\n mship = \"Full\";\n }\n\n if (mship.startsWith( \"JR\" ) || mship.startsWith( \"JUNIO\" )) {\n\n mship = \"Junior\";\n }\n\n if (mship.startsWith( \"NOVIC\" )) {\n\n mship = \"Novice\";\n }\n\n if (mship.startsWith( \"OV65\" ) || mship.startsWith( \"OVR 65\" )) {\n\n mship = \"Over 65 Restricted\";\n }\n\n if (mship.startsWith( \"MST RST\" ) || mship.startsWith( \"MSTR/RE\" )) {\n\n mship = \"Restricted\";\n }\n\n if (mship.startsWith( \"SOCGLF\" )) {\n\n mship = \"Social Golf Waitlist\";\n }\n\n if (mship.startsWith( \"SOCIAL\" ) || mship.startsWith( \"MAIN\" )) {\n\n mship = \"Social\";\n }\n\n //\n // Now check the birth date and set anyone age 19 - 25 to 'Extended Junior'\n //\n if (birth > 0) { // if birth date provided\n\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 19; // backup 19 years\n\n int oldDate1 = (year * 10000) + (month * 100) + day; // get date\n\n year = year - 7; // backup another 7 years (26 total)\n\n int oldDate2 = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate2 && birth < oldDate1) { // if member is 19 to 25 yrs old\n\n mship = \"Extended Junior\";\n }\n }\n\n\n //\n // Set the Member Types\n //\n if (primary.equalsIgnoreCase( \"P\" )) { // if primary member\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase( \"S\" )) { // spouse\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n } else {\n mtype = \"Dependent\";\n }\n\n } else {\n\n skip = true;\n }\n\n } // end of IF club =\n\n\n //\n // Congressional\n //\n if (club.equals( \"congressional\" )) {\n\n found = true; // club found\n\n // if there is no posid, then use the mNum\n if (posid.equals(\"\")) posid = mNum;\n\n if (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (mship.equalsIgnoreCase( \"SG\" ) || mship.equalsIgnoreCase( \"BI\" )) {\n\n skip = true; // skip this record\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) { // mship ok\n\n if (mship.equals( \"SP\" )) { // if Spouse\n\n mship = \"\";\n\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship FROM member2b WHERE username = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, mNum); // primary's username is the mNum\n rs = pstmt2.executeQuery();\n\n if(rs.next()) {\n\n mship = rs.getString(\"m_ship\"); // spouse = use primary's mship type\n }\n pstmt2.close();\n \n if (mship.equals(\"\")) { \n \n skip = true; // skip if mship or primary not found\n }\n }\n\n } else {\n\n skip = true;\n }\n\n if (skip == false) {\n\n //\n // Set the Membership Types\n //\n if (mship.equals( \"AG\" )) {\n\n mship = \"Annual Guest\";\n }\n if (mship.equals( \"BA\" )) {\n\n mship = \"Beneficiary Active\";\n }\n if (mship.equals( \"BS\" )) {\n\n mship = \"Beneficiary Special\";\n }\n if (mship.equals( \"BT\" )) {\n\n mship = \"Beneficiary Twenty\";\n }\n if (mship.equals( \"HL\" )) {\n\n mship = \"Honorary Life\";\n }\n if (mship.equals( \"HO\" )) {\n\n mship = \"Honorary\";\n }\n if (mship.equals( \"JA\" )) {\n\n mship = \"Junior A\";\n }\n if (mship.equals( \"JB\" )) {\n\n mship = \"Junior B\";\n }\n if (mship.equals( \"JC\" )) {\n\n mship = \"Junior C\";\n }\n if (mship.equals( \"JM\" )) {\n\n mship = \"Junior Military\";\n }\n if (mship.equals( \"JX\" )) {\n\n mship = \"Junior Absent\";\n }\n if (mship.equals( \"NR\" )) {\n\n mship = \"Non Resident\";\n }\n if (mship.equals( \"NS\" )) {\n\n mship = \"Non Resident Special\";\n }\n if (mship.equals( \"RA\" )) {\n\n mship = \"Resident Active\";\n }\n if (mship.equals( \"RI\" )) {\n\n mship = \"Resident Inactive\";\n }\n if (mship.equals( \"RT\" )) {\n\n mship = \"Resident Twenty\";\n }\n if (mship.equals( \"RX\" )) {\n\n mship = \"Resident Absent\";\n }\n\n\n //\n // Now check the birth date and set anyone age 19 - 25 to 'Extended Junior'\n //\n if (birth == 19000101) { // if birth date mot good\n\n birth = 0;\n }\n\n\n //\n // Set the Member Types\n //\n if (primary.equalsIgnoreCase( \"P\" )) { // if primary member\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n } else { // spouse\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n }\n\n //\n // Set the Username\n //\n if (mtype.startsWith( \"Primary\" )) { // if primary member\n\n memid = mNum; // use mNum\n\n } else {\n\n memid = mNum + \"A\"; // use mNum + A\n }\n\n //\n // Set the password for Monagus\n //\n password = \"jjjj\";\n\n }\n\n } // end of IF club =\n\n\n //\n // Cherry Creek\n //\n/*\n if (club.equals( \"cherrycreek\" )) {\n\n found = true; // club found\n\n if (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n\n mship = toTitleCase(mship);\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (mship.equalsIgnoreCase( \"professional member honorary\" ) ||\n mship.startsWith( \"Reciprocal\" ) || mship.startsWith( \"Social\" )) {\n\n skip = true; // skip this record\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) { // mship ok\n\n if (mship.startsWith( \"Corp Full Golf Founders Individ\" )) {\n\n mship = \"Corp Full Golf Founders Indiv\";\n\n } else {\n\n\n /* 3-13-08 ALLOW CORP FULL GOLF FOUNDERS FAMILY TO COME ACROSS AS IS - PER LARRY\n if (mship.startsWith( \"Corp Full Golf Founders\" )) {\n\n mship = \"Corp Full Golf Founders\";\n }\n */\n /*\n }\n\n\n //\n // Set the Member Types\n //\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Adult Female\";\n\n } else {\n\n if (gender.equalsIgnoreCase( \"M\" )) {\n\n mtype = \"Adult Male\";\n\n } else { // unknown gender - check pri/spouse\n\n if (primary.equalsIgnoreCase( \"S\" )) {\n\n mtype = \"Adult Female\";\n\n } else {\n\n mtype = \"Adult Male\";\n }\n }\n }\n\n\n //\n // Set the Username\n //\n if (mtype.equals( \"Adult Male\" )) { // if primary member\n\n memid = mNum + \"-000\";\n\n } else {\n\n memid = mNum + \"-001\";\n }\n\n // if there is no posid, then use the memid\n if (posid.equals(\"\")) posid = memid;\n\n } else {\n\n skip = true;\n }\n\n } // end of IF club =\n*/\n\n //\n // Baltimore CC\n //\n if (club.equals( \"baltimore\" )) {\n\n found = true; // club found\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n\n // if there is no posid, then use the mNum\n if (posid.equals(\"\")) posid = mNum;\n\n\n mship2 = mship;\n mship = \"\";\n\n //\n // convert mship\n //\n\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF NON ACTIV NON RES FD\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT NON GOLF NON RES FD\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF NON ACTIV NON RES\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT NON GOLF NON RES\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF NON ACTIV NON RES FD\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES NON GOLF NON RES FD\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF NON ACTIV NON RES\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES NON GOLF NON RES\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF NON ACTIV NON RES FD\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT NON GOLF NON RES FD\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF NON ACTIV NON RES\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT NON GOLF NON RES\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF NON ACTIV NON RES FD\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES NON GOLF NON RES FD\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF NON ACTIV NON RES\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES NON GOLF NON RES\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF NON ACTIV NON RES FD\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT NON GOLF NON RES FD\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF NON ACTIV NON RES\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT NON GOLF NON RES\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF NON ACTIV NON RES FD\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES NON GOLF NON RES FD\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF NON ACTIV NON RES\" )) {\n\n mship = \"Non Resident No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES NON GOLF NON RES\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT GOLF NON ACTIV DISC\" )) {\n\n mship = \"No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES GOLF NON ACTIV DISC\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"J GENT NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"J LADIES NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"L GENT GOLF NON ACTIV\" )) { // supposed to be non?\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"L GENT GOLF HONORARY\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"L GENT NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"L GENT GOLF FULL SEAS\")) {\n\n mship = \"Discounted Season Golfer\";\n mtype = \"Male Discounted Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"L LADIES GOLF HONORARY\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"L LADIES NON GOLF\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"M MINOR GENT\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Dependent\";\n }\n\n if (mship2.equalsIgnoreCase( \"M MINOR LADIES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Dependent\";\n }\n\n // end non online members\n\n\n // start on members\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF PART SEAS NON RES FD\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF FULL SEAS NON RES FD\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF FULL SEAS NON RES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF PART SEAS NON RES\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A GENT GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF PART SEAS NON RES FD\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF FULL SEAS NON RES FD\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF FULL SEAS NON RES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF PART SEAS NON RES\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"A LADIES GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF PART SEAS NON RES FD\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF FULL SEAS NON RES FD\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF FULL SEAS NON RES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF PART SEAS NON RES\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF FULL SEAS NON RES FD\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF FULL SEAS NON RES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF PART SEAS NON RES\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF PART SEAS NON RES FD\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF FULL SEAS NON RES FD\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF FULL SEAS NON RES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF PART SEAS NON RES\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D GENT GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF PART SEAS NON RES FD\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF FULL SEAS NON RES FD\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF FULL SEAS NON RES\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF PART SEAS NON RES\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"D LADIES GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT GOLF PART SEAS DISC\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non-Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT GOLF FULL SEAS DISC\" )) {\n\n mship = \"Discounted Season Golfer\";\n mtype = \"Male Discounted Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H GENT GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES GOLF PART SEAS DISC\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non-Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES GOLF FULL SEAS DISC\" )) {\n\n mship = \"Discounted Season Golfer\";\n mtype = \"Female Discounted Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"H LADIES GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"JM Gent Season\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Junior Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"J GENT GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Junior Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"JW Ladies Season\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Junior Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"J LADIES GOLF PART SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Junior Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"LW Ladies Golf\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"J GENT GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Male No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"J LADIES GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n if (mship2.equalsIgnoreCase( \"J GENT GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"J LADIES GOLF FULL SEAS\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n //\n // New mship types (6/12/07)\n //\n if (mship2.equalsIgnoreCase( \"J GENT GOLF COLL STUD\" )) {\n\n mship = \"College Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n if (mship2.equalsIgnoreCase( \"J LADIES GOLF COLL STUD\" )) {\n\n mship = \"College Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"L LADIES GOLF FULL SEAS\" )) {\n\n mship = \"Discounted Season Golfer\";\n mtype = \"Female Discounted Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"L LADIES GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Female Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"M MINOR GENT GOLF ENT\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Male Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"M MINOR LADIES GOLF ENT\" )) {\n\n mship = \"Season Golfer\";\n mtype = \"Female Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"B GENT NON GOLF EXT LEGASY\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"B LADIES NON GOLF EXT LEGASY\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Female Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"J JUNIOR GENT NON GOLF GE\" )) {\n\n mship = \"Non Golf\";\n mtype = \"Male Non Golf\";\n }\n\n if (mship2.equalsIgnoreCase( \"L GENT GOLF PART SEAS\" )) {\n\n mship = \"Non Season Golfer\";\n mtype = \"Male Non Season Golfer\";\n }\n\n if (mship2.equalsIgnoreCase( \"L LADIES GOLF NON ACTIV\" )) {\n\n mship = \"No Package\";\n mtype = \"Female No Package\";\n }\n\n //\n // Skip this record if a valid mship type was not specified\n //\n if (mship.equals(\"\")) {\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n } // end if club == baltimore\n\n\n //\n // Providence\n //\n if (club.equals( \"providence\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" ) && (mship.equalsIgnoreCase( \"A\" ) || mship.equalsIgnoreCase( \"E\" ) ||\n mship.equalsIgnoreCase( \"Z\" ) || mship.equalsIgnoreCase( \"H\" ) || mship.equalsIgnoreCase( \"I\" ) ||\n mship.equalsIgnoreCase( \"L\" ) || mship.equalsIgnoreCase( \"S\" ) || mship.equalsIgnoreCase( \"ZA\" ))) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n //\n // Set the Member Type\n //\n mtype = \"Primary Male\"; // default\n\n// if (mNum.endsWith( \"B\" ) ||mNum.endsWith( \"C\" ) ||\n// mNum.endsWith( \"D\" ) || mNum.endsWith( \"E\" ) ||mNum.endsWith( \"F\" ) ||\n// mNum.endsWith( \"G\" ) || mNum.endsWith( \"H\" ) ||mNum.endsWith( \"I\" )) {\n//\n// mtype = \"Dependent\";\n//\n// } else {\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Spouse Male\";\n\n } else {\n\n mtype = \"Spouse Female\";\n }\n\n } else { // primary\n\n if (primary.equalsIgnoreCase( \"P\" )) { // if Primary\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Primary Male\";\n\n } else {\n\n mtype = \"Primary Female\";\n }\n\n } else {\n\n mtype = \"Dependent\"; // all others = juniors\n }\n }\n\n //\n // Set the Mship Type\n //\n if (mship.equalsIgnoreCase( \"A\" )) {\n\n mship = \"Active\";\n\n } else {\n\n if (mship.equalsIgnoreCase( \"E\" )) {\n\n mship = \"Employee\";\n\n } else {\n\n if (mship.equalsIgnoreCase( \"H\" )) {\n\n mship = \"Honorary\";\n\n } else {\n\n if (mship.equalsIgnoreCase( \"I\" )) {\n\n mship = \"Inactive\";\n\n } else {\n\n if (mship.equalsIgnoreCase( \"L\" )) {\n\n mship = \"Member Resigning\";\n\n } else {\n\n if (mship.equalsIgnoreCase( \"S\" )) {\n\n mship = \"Suspended\";\n\n } else {\n\n if (mship.equalsIgnoreCase( \"Z\" ) || mship.equalsIgnoreCase( \"ZA\" )) {\n\n mship = \"Family Active\";\n\n } else {\n\n skip = true; // skip all others\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n }\n }\n }\n }\n }\n\n } else {\n\n skip = true; // skip this record\n\n if (!mship.equals( \"\" )) {\n\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n\n } // end of IF club\n\n //\n // Algonquin\n //\n if (club.equals( \"algonquin\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" )) {\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // Set the Membership and Member Types - both dependent on the mship received\n //\n mtype = \"Primary Male\"; // default\n\n mship2 = \"\"; // init as none\n\n if (mship.equalsIgnoreCase( \"Active\" )) {\n\n mship2 = \"Active\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Associate\" )) {\n\n mship2 = \"Associate\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Senior\" )) {\n\n mship2 = \"Senior\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"non-res\" )) {\n\n mship2 = \"Non-Res\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"nonresgolf\" )) {\n\n mship2 = \"Nonresgolf\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Social\" )) {\n\n mship2 = \"Social\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Clerical M\" )) {\n\n mship2 = \"Clerical M\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Junior Class A\" ) || mship.equalsIgnoreCase( \"Jr Class A\" )) {\n\n mship2 = \"Jr Class A\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Junior Class B\" ) || mship.equalsIgnoreCase( \"Jr Class B\" )) {\n\n mship2 = \"Jr Class B\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Junior Class C\" ) || mship.equalsIgnoreCase( \"Jr Class C\" )) {\n\n mship2 = \"Jr Class C\";\n\n if (gender.equals( \"F\" )) { // otherwise use default if Male\n\n mtype = \"Primary Female\"; // always a primary member\n }\n }\n\n if (mship.equalsIgnoreCase( \"Spouse\" ) || mship.equalsIgnoreCase( \"Child\" )) { // if Spouse or Dependent\n\n if (mship.equalsIgnoreCase( \"Child\" )) { // if Dependent\n\n mtype = \"Dependent\";\n\n } else {\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n }\n\n\n //\n // Get the mship type from the primary\n //\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship FROM member2b WHERE username != ? AND memNum = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, memid);\n pstmt2.setString(2, mNum);\n rs = pstmt2.executeQuery();\n\n if(rs.next()) {\n\n mship2 = rs.getString(\"m_ship\"); // spouse = use primary's mship type\n }\n pstmt2.close();\n\n } // end of IF spouse or child\n\n if (mship2.equals( \"\" )) { // if matching mship NOT found\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else {\n\n mship = mship2; // set new mship\n }\n\n } else { // mship not provided\n\n skip = true; // skip this record\n }\n\n } // end of IF Algonquin\n\n\n //\n // Bent Tree\n //\n if (club.equals( \"benttreecc\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equalsIgnoreCase( \"Active\" ) && !mship.startsWith( \"D\" )) { // if NOT Active or Dxx\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MSHIP invalid!\";\n\n } else {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n\n //\n // Set the Member Type\n //\n mtype = \"Member Male\"; // default\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Spouse Male\";\n\n } else {\n\n mtype = \"Spouse Female\";\n }\n\n } else { // primary\n\n if (primary.equalsIgnoreCase( \"P\" )) { // if Primary\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Member Male\";\n\n } else {\n\n mtype = \"Member Female\";\n }\n\n } else {\n\n mtype = \"Junior\"; // all others = juniors\n }\n }\n\n //\n // Convert the mship from Dxx to real value\n //\n if (!mship.equalsIgnoreCase( \"Active\" )) { // accept Active as is\n\n if (mship.equalsIgnoreCase( \"D01\" )) {\n\n mship = \"Resident\";\n\n } else if (mship.equalsIgnoreCase( \"D02\" )) {\n\n mship = \"Young Executive\";\n\n } else if (mship.equalsIgnoreCase( \"D03\" ) || mship.equalsIgnoreCase( \"D05\" )) {\n\n mship = \"Tennis\";\n\n } else if (mship.equalsIgnoreCase( \"D04\" ) || mship.equalsIgnoreCase( \"D11\" )) {\n\n mship = \"Junior\";\n\n } else if (mship.equalsIgnoreCase( \"D06\" )) {\n\n mship = \"Temp Non-Resident\";\n\n } else if (mship.equalsIgnoreCase( \"D08\" )) {\n\n mship = \"Non-Resident\";\n\n } else if (mship.equalsIgnoreCase( \"D09\" )) {\n\n mship = \"Senior\";\n\n } else if (mship.equalsIgnoreCase( \"D12\" )) {\n\n mship = \"Employee\";\n\n } else {\n\n skip = true;\n }\n }\n } // end of IF mship ok\n\n } // end of IF club\n\n\n //\n // Orchid Island\n //\n if (club.equals( \"orchidisland\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equals( \"\" )) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n if (gender.equals( \"\" )) {\n\n gender = \"M\"; // default\n }\n\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // Primary = 1234\n\n if (mship.equalsIgnoreCase(\"Depend\") ||\n (!primary.equalsIgnoreCase(\"P\") && !primary.equalsIgnoreCase(\"S\"))) {\n\n memid = memid + \"-\" + primary; // 1234-2\n\n mtype = \"Dependents\";\n\n } else if (mship.equalsIgnoreCase( \"Spouse\" ) || primary.equalsIgnoreCase( \"S\" )) {\n\n memid = memid + \"-1\"; // 1234-1\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Adult Female\";\n }\n } else {\n \n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n }\n\n\n\n\n //\n // Set mship\n //\n if (mship.endsWith( \"TEN\" )) {\n\n mship = \"Beach & Tennis\";\n\n } else if (mship.endsWith( \"GOLF\" ) || mship.equalsIgnoreCase(\"Employee\")) {\n\n if (mship.equalsIgnoreCase(\"I GOLF\")) {\n mship = \"Invitational Golf\";\n } else {\n mship = \"EQ Golf\";\n }\n\n } else {\n\n //\n // Spouse or Dependent - look for Primary mship type and use that\n //\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship FROM member2b WHERE username != ? AND (m_ship = 'EQ Golf' OR m_ship = 'Beach & Tennis' OR m_ship = 'Invitational Golf') AND memNum = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, memid);\n pstmt2.setString(2, mNum);\n rs = pstmt2.executeQuery();\n\n if(rs.next()) {\n\n mship = rs.getString(\"m_ship\"); // use primary mship type\n } else {\n skip = true;\n }\n pstmt2.close();\n }\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club\n\n\n //\n // Colleton River\n //\n if (club.equals( \"colletonriverclub\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equals( \"\" )) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n if (gender.equals( \"\" )) {\n\n gender = \"M\"; // default\n }\n\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // Primary = 1234\n\n mtype = \"Adult Male\"; // default\n\n if (!primary.equalsIgnoreCase(\"P\") && !primary.equalsIgnoreCase(\"S\")) {\n\n memid = memid + \"-\" + primary; // 1234-2\n\n mtype = \"Dependents\";\n\n } else {\n\n if (primary.equalsIgnoreCase( \"S\" )) {\n\n memid = memid + \"-1\"; // 1234-1\n }\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Adult Female\";\n }\n }\n\n // Convert 'FULL3' mship to 'FULL'\n if (mship.equalsIgnoreCase(\"FULL3\")) {\n mship = \"FULL\";\n }\n\n\n //\n // Set mship\n //\n if (mship.equalsIgnoreCase( \"Member\" )) {\n\n //mship = \"Resident\"; // do not change others\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club\n\n\n //\n // Claremont CC\n //\n if (club.equals( \"claremontcc\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equals( \"\" )) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n if (gender.equals( \"\" )) {\n\n gender = \"M\"; // default\n }\n\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n\n mtype = \"Adult Male\"; // default\n\n if (!primary.equalsIgnoreCase(\"P\") && !primary.equalsIgnoreCase(\"S\")) {\n\n mtype = \"Juniors\";\n\n } else {\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Adult Female\";\n }\n }\n\n //\n // Set mship - TEMP until CE fixes them !!!!!!!!!!!!!!!!!!!!!!!\n //\n if (mship.equalsIgnoreCase( \"Member\" )) {\n\n mship = \"Employee\";\n\n } else if (mship.equalsIgnoreCase(\"Exempt\")) {\n\n mship = \"REG\";\n\n } else if (mship.equalsIgnoreCase(\"active\") || mship.equalsIgnoreCase(\"Oak Tree\") || mship.equalsIgnoreCase(\"Standards\")) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club\n\n /*\n //\n // Meridian GC\n //\n if (club.equals( \"meridiangc\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equals( \"\" )) {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n if (posid.equals( \"\" )) {\n\n posid = mNum; // default posid = mnum\n }\n\n if (gender.equals( \"\" )) {\n\n gender = \"M\"; // default\n }\n\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n\n mtype = \"Primary Male\"; // default\n\n if (!primary.equalsIgnoreCase(\"P\") && !primary.equalsIgnoreCase(\"S\")) {\n\n mtype = \"Dependent\";\n\n } else if (primary.equalsIgnoreCase(\"P\") && gender.equalsIgnoreCase( \"M\" )) {\n\n mtype = \"Primary Male\";\n\n } else if (primary.equalsIgnoreCase(\"P\") && gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Primary Female\";\n\n } else if (primary.equalsIgnoreCase(\"S\") && gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Non-Primary Female\";\n\n } else if (primary.equalsIgnoreCase(\"S\") && gender.equalsIgnoreCase( \"M\" )) {\n\n mtype = \"Non-Primary Male\";\n }\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club\n\n\n\n*/\n if (club.equals(\"berkeleyhall\")) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (!mship.equals( \"\" )) {\n\n posid = mNum; // they use their member numbers as their posid\n webid = memid; // they use their member id (our username) as their webid\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n if (!primary.equalsIgnoreCase(\"P\") && !primary.equalsIgnoreCase(\"S\")) {\n\n mtype = \"Dependent\";\n\n } else if (gender.equalsIgnoreCase( \"M\" )) {\n\n mtype = \"Adult Male\";\n\n } else if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Adult Female\";\n\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n }\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end if berkeleyhall\n\n\n if (club.equals(\"indianhillscc\")) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (mship.equalsIgnoreCase( \"Social\" ) || mship.equalsIgnoreCase( \"Social SS\" ) || mship.equalsIgnoreCase( \"Spouse\" ) ||\n mship.equalsIgnoreCase( \"Spouse S\" ) || mship.equalsIgnoreCase( \"Child\" )) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) {\n\n posid = mNum; // they use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n //\n // use the mnum for memid\n //\n if (primary.equalsIgnoreCase(\"P\")) {\n\n memid = mNum;\n\n } else {\n\n if (primary.equalsIgnoreCase(\"S\")) {\n\n memid = mNum + \"-1\"; // spouse\n\n } else {\n\n memid = mNum + \"-\" + primary; // dependents (2 and up)\n }\n }\n\n mship = toTitleCase(mship);\n\n //\n // Set the member types\n //\n if (mship.startsWith(\"Spouse\")) {\n\n if (gender.equalsIgnoreCase(\"M\")) {\n\n mtype = \"Spouse Male\";\n\n } else {\n\n mtype = \"Spouse Female\";\n }\n\n } else {\n\n if (mship.startsWith(\"Child\")) {\n\n if (gender.equalsIgnoreCase(\"M\")) {\n\n mtype = \"Junior Male\";\n\n } else {\n\n mtype = \"Junior Female\";\n }\n\n } else { // all others\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n }\n }\n\n //\n // Convert some mship types\n //\n if (mship.equals(\"Found\") || mship.equals(\"Spouse F\") || mship.equals(\"Child F\") ||\n mship.equalsIgnoreCase(\"G/F SS\") || mship.equalsIgnoreCase(\"Golf SS\")) {\n\n mship = \"Foundation\";\n\n } else {\n\n if (mship.equals(\"Interm\") || mship.equals(\"Spouse I\") || mship.equals(\"Child I\")) {\n\n mship = \"Intermediate\";\n }\n }\n\n } else { // missing field or mship not allowed\n\n skip = true; // skip this record\n }\n\n } // end if indianhillscc\n\n /*\n if (club.equals(\"rtjgc\")) { // Robert Trent Jones GC\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" )) {\n\n posid = mNum; // use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n //\n // use the mnum for memid\n //\n if (primary.equalsIgnoreCase(\"S\") || gender.equalsIgnoreCase(\"F\")) {\n\n memid = mNum + \"A\"; // spouse or female\n\n } else {\n\n memid = mNum; // primary males\n }\n\n\n //\n // Set the member type\n //\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n\n //\n // Set the membership type\n //\n if (mship.equalsIgnoreCase(\"HON\")) {\n\n mship = \"Honorary\";\n\n } else {\n\n if (mship.endsWith(\"IR\")) {\n\n mship = \"Individual Resident\";\n\n } else {\n\n if (mship.endsWith(\"SNR\")) {\n\n mship = \"Senior Non Resident\";\n\n } else {\n\n if (mship.endsWith(\"SR\")) {\n\n mship = \"Senior\";\n\n } else {\n\n if (mship.endsWith(\"CR\")) {\n\n mship = \"Corporate Resident\";\n\n } else {\n\n if (mship.endsWith(\"CNR\")) {\n\n mship = \"Corporate Non Resident\";\n\n } else {\n\n if (mship.endsWith(\"INR\")) {\n\n mship = \"Individual Non Resident\";\n\n } else {\n\n if (mship.endsWith(\"P\")) {\n\n mship = \"Playing Member\";\n\n } else {\n\n mship = \"Junior\";\n }\n }\n }\n }\n }\n }\n }\n }\n\n } else { // missing field or mship not allowed\n\n skip = true; // skip this record\n }\n\n } // end if Robert Trent Jones GC\n */\n\n if (club.equals(\"oakhillcc\")) { // Oak Hill CC\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" )) {\n\n posid = mNum; // use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n //\n // use the mnum for memid\n //\n if (primary.equalsIgnoreCase(\"S\")) {\n\n memid = mNum + \"A\"; // spouse\n\n } else {\n\n if (primary.equalsIgnoreCase(\"P\")) {\n\n memid = mNum; // Primary\n\n } else {\n\n memid = mNum + \"-\" + primary; // dependents (nnn-p)\n }\n }\n\n\n //\n // Set the member type\n //\n if (primary.equalsIgnoreCase(\"P\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n } else {\n\n if (primary.equalsIgnoreCase(\"S\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n\n } else {\n\n mtype = \"Dependent\";\n }\n }\n\n //\n // Set the membership type\n //\n mship = \"G\"; // all are Golf\n\n } else { // missing field or mship not allowed\n\n skip = true; // skip this record\n }\n\n } // end if Oak Hill CC\n\n\n if (club.equals(\"internationalcc\")) { // International CC\n\n found = true; // club found\n\n mship = toTitleCase(mship);\n\n //\n // Determine if we should process this record\n //\n if (mship.equalsIgnoreCase( \"Corp-Social\" ) || mship.equalsIgnoreCase( \"Employees\" ) ||\n mship.equalsIgnoreCase( \"Leave Of Absence\" ) || mship.equalsIgnoreCase( \"Member\" ) ||\n mship.equalsIgnoreCase( \"Social\" ) || mship.equalsIgnoreCase( \"Social-Wci\" ) ||\n mship.equalsIgnoreCase( \"Bad Addresses\" ) || mship.equalsIgnoreCase( \"Expelled\" ) ||\n mship.equalsIgnoreCase( \"Resigned\" ) || mship.equalsIgnoreCase( \"Parties\" ) ||\n mship.equalsIgnoreCase( \"Clubhouse\" )) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) {\n \n posid = mNum; // use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n/*\n // Custom to handle memNum 1217 differently, as they have to have the primary and spouse flip-flopped\n if (mNum.equals(\"1217\")) {\n\n if (primary.equalsIgnoreCase(\"P\")) {\n primary = \"S\";\n } else if (primary.equalsIgnoreCase(\"S\")) {\n primary = \"P\";\n }\n }\n*/\n //\n // use the mnum for memid\n //\n if (primary.equalsIgnoreCase(\"S\")) {\n\n memid = mNum + \"A\"; // spouse\n\n } else {\n\n if (primary.equalsIgnoreCase(\"P\")) {\n\n memid = mNum; // Primary\n\n } else {\n\n memid = mNum + \"-\" + primary; // dependents (nnn-p)\n }\n }\n\n\n //\n // Set the member type\n //\n if (primary.equalsIgnoreCase(\"P\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n } else {\n\n if (primary.equalsIgnoreCase(\"S\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n\n } else {\n\n mtype = \"Dependent\";\n }\n\n // If Spouse/Dependent, hit the database and use the Primary's membership type (if exists)\n try {\n PreparedStatement pstmtTemp = null;\n ResultSet rsTemp = null;\n\n pstmtTemp = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE username = ?\");\n pstmtTemp.clearParameters();\n pstmtTemp.setString(1, mNum);\n\n rsTemp = pstmtTemp.executeQuery();\n\n if (rsTemp.next()) {\n \n mship = rsTemp.getString(\"m_ship\"); // get primary's mship type\n \n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NO PRIMARY FOUND!\";\n }\n\n pstmtTemp.close();\n \n } catch (Exception ignore) { }\n }\n\n\n } else { // missing field or mship not allowed\n\n skip = true; // skip this record\n }\n\n } // end if International CC\n\n\n if (club.equals(\"greenwich\")) { // Greenwich CC\n\n found = true; // club found\n\n mship = toTitleCase(mship);\n\n //\n // Determine if we should process this record\n //\n if (!mship.equals( \"\" )) {\n\n posid = mNum; // use their member numbers as their posid\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n\n //\n // mship - ALL = Golf !!!!!!\n //\n mship = \"Golf\";\n\n\n //\n // use the mnum for memid\n //\n if (primary.equalsIgnoreCase(\"S\")) {\n\n memid = mNum + \"A\"; // spouse\n\n } else {\n\n if (primary.equalsIgnoreCase(\"P\")) {\n\n memid = mNum; // Primary\n\n } else {\n\n memid = mNum + \"-\" + primary; // dependents (nnn-p)\n }\n }\n\n\n //\n // Set the member type\n //\n if (primary.equalsIgnoreCase(\"P\") || primary.equalsIgnoreCase(\"S\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n\n } else {\n\n mtype = \"Dependent\";\n }\n\n\n } else { // missing field or mship not allowed\n\n skip = true; // skip this record\n }\n\n } // end if Greenwich CC\n\n\n\n //******************************************************************\n // TPC Southwind\n //******************************************************************\n //\n if (club.equals(\"tpcsouthwind\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"A\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n if (primary.equals(\"2\")) {\n memid += \"B\";\n } else if (primary.equals(\"3\")) {\n memid += \"C\";\n } else if (primary.equals(\"4\")) {\n memid += \"D\";\n } else if (primary.equals(\"5\")) {\n memid += \"E\";\n } else if (primary.equals(\"6\")) {\n memid += \"F\";\n }\n\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcsouthwind\n\n\n //******************************************************************\n // TPC Sugarloaf\n //******************************************************************\n //\n if (club.equals(\"tpcsugarloaf\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" ) || mship.equalsIgnoreCase(\"Charter Social\") || mship.equalsIgnoreCase(\"Charter Swim/Tennis\")) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"A\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\") || primary.equals(\"7\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n if (primary.equals(\"2\")) {\n memid += \"B\";\n } else if (primary.equals(\"3\")) {\n memid += \"C\";\n } else if (primary.equals(\"4\")) {\n memid += \"D\";\n } else if (primary.equals(\"5\")) {\n memid += \"E\";\n } else if (primary.equals(\"6\")) {\n memid += \"F\";\n } else if (primary.equals(\"7\")) {\n memid += \"G\";\n }\n\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcsugarloaf\n\n\n //******************************************************************\n // TPC Wakefield Plantation\n //******************************************************************\n //\n if (club.equals(\"tpcwakefieldplantation\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" ) || mship.equalsIgnoreCase(\"Sports Club\") || mship.equalsIgnoreCase(\"Sports Club Non-Resident\")) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcwakefieldplantation\n\n\n //******************************************************************\n // TPC River Highlands\n //******************************************************************\n //\n if (club.equals(\"tpcriverhighlands\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcriverhighlands\n\n\n //******************************************************************\n // TPC River's Bend\n //******************************************************************\n //\n if (club.equals(\"tpcriversbend\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcriversbend\n\n //******************************************************************\n // TPC Jasna Polana\n //******************************************************************\n //\n if (club.equals(\"tpcjasnapolana\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcjasnapolana\n\n\n //******************************************************************\n // TPC Boston\n //******************************************************************\n //\n if (club.equals(\"tpcboston\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n\n if (mship.equalsIgnoreCase(\"CHARTER NON-REFUNDABLE\")) {\n mship = \"CHARTER\";\n }\n }\n\n } // end if tpcboston\n\n //******************************************************************\n // TPC Craig Ranch\n //******************************************************************\n //\n if (club.equals(\"tpccraigranch\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpccraigranch\n\n\n //******************************************************************\n // TPC Potomac\n //******************************************************************\n //\n if (club.equals(\"tpcpotomac\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n // memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n //memid = memid + \"A\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\") || primary.equals(\"7\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n/*\n if (primary.equals(\"2\")) {\n memid += \"B\";\n } else if (primary.equals(\"3\")) {\n memid += \"C\";\n } else if (primary.equals(\"4\")) {\n memid += \"D\";\n } else if (primary.equals(\"5\")) {\n memid += \"E\";\n } else if (primary.equals(\"6\")) {\n memid += \"F\";\n } else if (primary.equals(\"7\")) {\n memid += \"G\";\n }\n */\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n/*\n if (primary.equals(\"8\")) {\n memid += \"H\";\n } else if (primary.equals(\"9\")) {\n memid += \"I\";\n } else if (primary.equals(\"10\")) {\n memid += \"J\";\n } else if (primary.equals(\"11\")) {\n memid += \"K\";\n }\n */\n primary = \"AC\";\n }\n }\n\n } // end if tpcpotomac\n\n\n //******************************************************************\n // TPC Summerlin\n //******************************************************************\n //\n if (club.equals(\"tpcsummerlin\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\") || primary.equals(\"7\") ||\n primary.equals(\"8\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n\n } // end if tpcsummerlin\n\n\n //******************************************************************\n // TPC Twin Cities\n //******************************************************************\n //\n if (club.equals(\"tpctc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n mship = checkTPCmship(mship, club); // check for non-golf and trim the mships\n\n if (mship.equals( \"\" )) { // if mship to be skipped\n\n skip = true; // skip these\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n if (skip == false) {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else if (primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\")) { // Dependent\n\n if (birth > 0) { // if birth date provided\n\n mtype = checkTPCkids(birth, gender); // get mtype based on age\n\n if (mtype.equals(\"\")) { // if too old now (26)\n\n skip = true; // force them to go inactive\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: DEPENDENT OVER 25!\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) { // defaults\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n memid = memid + primary;\n primary = \"D\";\n\n } else { // Authorized Caller\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n memid = memid + primary;\n primary = \"AC\";\n }\n }\n /*\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else if ((primary.equals(\"1\") || primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\") || primary.equals(\"7\") || primary.equals(\"8\")) &&\n birth == 0) {\n skip = true;\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -BIRTH DATE missing for DEPENDENT!\";\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n\n mship = toTitleCase(mship); // make sure mship is titlecased\n\n\n if (mship.equalsIgnoreCase(\"Social\") || mship.equalsIgnoreCase(\"Member\")) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n if (primary.equals(\"1\") || primary.equals(\"2\") || primary.equals(\"3\") || primary.equals(\"4\") ||\n primary.equals(\"5\") || primary.equals(\"6\") || primary.equals(\"7\") || primary.equals(\"8\")) {\n\n //\n // Determine the age in years\n //\n\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 18; // backup 16 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate) { // if member is < 18 yrs old\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Certified Dependent Female\";\n } else {\n mtype = \"Certified Dependent Male\";\n }\n } else {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n if (primary.equals(\"1\")) {\n memid = memid + \"B\";\n } else if (primary.equals(\"2\")) {\n memid = memid + \"C\";\n } else if (primary.equals(\"3\")) {\n memid = memid + \"D\";\n } else if (primary.equals(\"4\")) {\n memid = memid + \"E\";\n } else if (primary.equals(\"5\")) {\n memid = memid + \"F\";\n } else if (primary.equals(\"6\")) {\n memid = memid + \"G\";\n } else if (primary.equals(\"7\")) {\n memid = memid + \"H\";\n } else if (primary.equals(\"8\")) {\n memid = memid + \"I\";\n }\n\n primary = \"D\";\n\n } else if (primary.equals(\"9\") || primary.equals(\"10\")) {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Authorized Caller Female\";\n } else {\n mtype = \"Authorized Caller Male\";\n }\n\n if (primary.equals(\"9\")) {\n memid = memid + \"J\";\n } else if (primary.equals(\"10\")) {\n memid = memid + \"K\";\n }\n\n } else if (primary.equalsIgnoreCase(\"P\")) { // Primary\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n memid = memid + \"A\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else {\n skip = true;\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -UNKNOWN RELATIONSHIP TYPE!\";\n }\n }\n */\n } // end if tpctc\n\n/*\n //******************************************************************\n // Royal Oaks CC - Houston\n //******************************************************************\n //\n if (club.equals(\"royaloakscc\")) {\n\n int mshipInt = 0;\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"S\")) {\n memid = memid + \"A\";\n } else if (primary.equals(\"2\")) {\n mtype = \"Dependent\";\n memid = memid + \"B\";\n } else if (primary.equals(\"3\")) {\n mtype = \"Dependent\";\n memid = memid + \"C\";\n } else if (primary.equals(\"4\")) {\n mtype = \"Dependent\";\n memid = memid + \"D\";\n } else if (primary.equals(\"5\")) {\n mtype = \"Dependent\";\n memid = memid + \"E\";\n } else if (primary.equals(\"6\")) {\n mtype = \"Dependent\";\n memid = memid + \"F\";\n } else if (primary.equals(\"7\")) {\n mtype = \"Dependent\";\n memid = memid + \"G\";\n }\n\n if (gender.equalsIgnoreCase(\"F\") && !mtype.equals(\"Dependent\")) {\n mtype = \"Adult Female\";\n } else if (!mtype.equals(\"Dependent\")) {\n mtype = \"Adult Male\";\n }\n\n try {\n mshipInt = Integer.parseInt(mNum);\n } catch (Exception exc) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Invalid Member Number!\";\n }\n\n if (!skip) {\n if (mshipInt >= 0 && mshipInt < 200) {\n mship = \"Honorary\";\n } else if (mshipInt >= 500 && mshipInt < 600) {\n mship = \"Executive Honorary\";\n } else if (mshipInt >= 1000 && mshipInt < 2000) {\n mship = \"Golf\";\n } else if (mshipInt >= 2000 && mshipInt < 3000) {\n mship = \"Executive\";\n } else if (mshipInt >= 3000 && mshipInt < 3400) {\n mship = \"Sports Club w/Golf\";\n } else if (mshipInt >= 5000 && mshipInt < 5400) {\n mship = \"Preview Golf\";\n } else if (mshipInt >= 5400 && mshipInt < 5700) {\n mship = \"Preview Executive\";\n } else if (mshipInt >= 7000 && mshipInt < 7500) {\n mship = \"Sampler Golf\";\n } else if (mshipInt >= 7500 && mshipInt < 8000) {\n mship = \"Sampler Executive\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n }\n } // end if royaloakscc\n*/\n\n //******************************************************************\n // TPC San Francisco Bay\n //******************************************************************\n //\n if (club.equals(\"tpcsfbay\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (mship.equalsIgnoreCase(\"Social\")) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n if (primary.equalsIgnoreCase(\"P\")) { // Primary\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n } else if (primary.equalsIgnoreCase(\"S\")) { // Spouse\n memid = memid + \"1\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else { // Dependent\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n memid = memid + primary;\n primary = \"D\";\n }\n }\n } // end if tpcsfbay\n\n/*\n //******************************************************************\n // Mission Viejo - missionviejo\n //******************************************************************\n //\n if (club.equals(\"missionviejo\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n memid += \"B\";\n mtype = \"Green\";\n } else {\n gender = \"M\";\n memid += \"A\";\n mtype = \"Gold\";\n }\n\n if (mship.equalsIgnoreCase(\"Employee\")) {\n mship = \"Staff\";\n } else if (mship.equalsIgnoreCase(\"Equity\") || mship.equalsIgnoreCase(\"Honorary\") || mship.equalsIgnoreCase(\"Member\")) {\n mship = \"Equity\";\n } else if (mship.equalsIgnoreCase(\"Non-Res\") || mship.equalsIgnoreCase(\"Non-Resident\")) {\n mship = \"Non-Res\";\n } else if (mship.equalsIgnoreCase(\"Senior\")) {\n mship = \"Senior\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n } // end if missionviejo\n\n*/\n\n //******************************************************************\n // Cherry Hills CC - cherryhills\n //******************************************************************\n //\n if (club.equals(\"cherryhills\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum + \"-000\"; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"S\")) {\n memid += \"A\";\n mtype = \"Spouse\";\n } else {\n mtype = \"Member\";\n }\n \n if (mship.equalsIgnoreCase(\"CLG\")) {\n mship = \"Clergy\";\n } else if (mship.equalsIgnoreCase(\"RES\")) {\n mship = \"Resident\";\n } else if (mship.equalsIgnoreCase(\"SRA\")) {\n mship = \"Special Resident A\";\n } else if (mship.equalsIgnoreCase(\"SRB\")) {\n mship = \"Special Resident B\";\n } else if (mship.equalsIgnoreCase(\"SRC\")) {\n mship = \"Special Resident C\";\n } else if (mship.equalsIgnoreCase(\"NRE\")) {\n mship = \"Non-Resident\";\n } else if (mship.equalsIgnoreCase(\"SSP\")) {\n mship = \"Surviving Spouse\";\n } else if (mship.equalsIgnoreCase(\"FSP\")) {\n mship = \"Former Spouse\";\n } else if (mship.equalsIgnoreCase(\"LFE\")) {\n mship = \"Life Member\";\n } else if (mship.equalsIgnoreCase(\"HLF\")) {\n mship = \"Honorary Life\";\n } else if (mship.equalsIgnoreCase(\"SEN\")) {\n mship = \"Senior\";\n } else if (mship.equalsIgnoreCase(\"RE\")) {\n mship = \"Resident Emeritus\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n } // end if cherryhills\n\n //\n // Mission Viejo CC\n //\n /*\n if (club.equals( \"missionviejo\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (memid.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMID missing!\";\n\n } else if (mship.equalsIgnoreCase( \"Social\" ) || mship.equalsIgnoreCase( \"Social SS\" ) || mship.equalsIgnoreCase( \"Spouse\" ) ||\n mship.equalsIgnoreCase( \"Spouse S\" ) || mship.equalsIgnoreCase( \"Child\" )) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (!mship.equals( \"\" )) {\n\n }\n\n } // end of IF missionviejo club\n*/\n\n //******************************************************************\n // Philadelphia Cricket Club\n //******************************************************************\n //\n if (club.equals( \"philcricket\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is not an admin record or missing mship/mtype\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (lname.equalsIgnoreCase( \"admin\" )) {\n\n skip = true; // skip it\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Admin' MEMBERSHIP TYPE!\";\n } else {\n\n if (mship.equalsIgnoreCase(\"Leave of Absence\") || mship.equalsIgnoreCase(\"Loa\") || mship.equalsIgnoreCase(\"Member\")) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n if (primary.equalsIgnoreCase(\"S\")) {\n memid += \"A\";\n } else if (primary.equals(\"2\")) {\n memid += \"B\";\n } else if (primary.equals(\"3\")) {\n memid += \"C\";\n } else if (primary.equals(\"4\")) {\n memid += \"D\";\n } else if (primary.equals(\"5\")) {\n memid += \"E\";\n } else if (primary.equals(\"6\")) {\n memid += \"F\";\n } else if (primary.equals(\"7\")) {\n memid += \"G\";\n } else if (primary.equals(\"8\")) {\n memid += \"H\";\n } else if (primary.equals(\"9\")) {\n memid += \"I\";\n }\n\n //\n // determine member type\n //\n if (mship.equalsIgnoreCase( \"golf stm family\" ) || mship.equalsIgnoreCase( \"golf stm ind.\" )) {\n\n lname = lname + \"*\"; // add an astericks\n }\n\n // if mtype = no golf, add ^ to their last name\n if (mship.equalsIgnoreCase( \"no golf\" )) {\n\n lname += \"^\";\n }\n\n mship = toTitleCase(mship); // mship = mtype\n\n }\n } // end of IF club = philcricket\n \n/*\n //******************************************************************\n // Sea Pines CC - seapines\n //******************************************************************\n //\n if (club.equals(\"seapines\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"S\")) {\n memid += \"A\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n if (mship.equalsIgnoreCase(\"EQUITY-NP\") || mship.equalsIgnoreCase(\"RESIGN A\") || mship.equalsIgnoreCase(\"ASSOC\") || mship.equalsIgnoreCase(\"NON-EQ-NP\")) {\n mship = \"Social\";\n } else if (mship.equalsIgnoreCase(\"SELECT\") || mship.equalsIgnoreCase(\"TENNIS\")) {\n mship = \"Tennis\";\n } else if (mship.equalsIgnoreCase(\"GOLF\") || mship.equalsIgnoreCase(\"GOLF-CART\")) {\n mship = \"Golf\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n } // end if seapines\n*/\n\n //\n //******************************************************************\n // Common processing - add or update the member record\n //******************************************************************\n //\n if (skip == false && found == true && !fname.equals(\"\") && !lname.equals(\"\") && !memid.equals(\"\")) {\n\n //\n // now determine if we should update an existing record or add the new one\n //\n memid_old = \"\";\n fname_old = \"\";\n lname_old = \"\";\n mi_old = \"\";\n mship_old = \"\";\n mtype_old = \"\";\n email_old = \"\";\n mNum_old = \"\";\n ghin_old = \"\";\n bag_old = \"\";\n posid_old = \"\";\n email2_old = \"\";\n phone_old = \"\";\n phone2_old = \"\";\n suffix_old = \"\";\n u_hcap_old = 0;\n c_hcap_old = 0;\n birth_old = 0;\n email_bounce1 = 0;\n email_bounce2 = 0;\n\n\n //\n // Truncate the string values to avoid sql error\n //\n if (!mi.equals( \"\" )) { // if mi specified\n\n mi = truncate(mi, 1); // make sure it is only 1 char\n }\n if (!memid.equals( \"\" )) {\n\n memid = truncate(memid, 15);\n }\n if (!password.equals( \"\" )) {\n\n password = truncate(password, 15);\n }\n if (!lname.equals( \"\" )) {\n\n lname = truncate(lname, 20);\n }\n if (!fname.equals( \"\" )) {\n\n fname = truncate(fname, 20);\n }\n if (!mship.equals( \"\" )) {\n\n mship = truncate(mship, 30);\n }\n if (!mtype.equals( \"\" )) {\n\n mtype = truncate(mtype, 30);\n }\n if (!email.equals( \"\" )) {\n\n email = truncate(email, 50);\n }\n if (!email2.equals( \"\" )) {\n\n email2 = truncate(email2, 50);\n }\n if (!mNum.equals( \"\" )) {\n\n mNum = truncate(mNum, 10);\n }\n if (!ghin.equals( \"\" )) {\n\n ghin = truncate(ghin, 16);\n }\n if (!bag.equals( \"\" )) {\n\n bag = truncate(bag, 12);\n }\n if (!posid.equals( \"\" )) {\n\n posid = truncate(posid, 15);\n }\n if (!phone.equals( \"\" )) {\n\n phone = truncate(phone, 24);\n }\n if (!phone2.equals( \"\" )) {\n\n phone2 = truncate(phone2, 24);\n }\n if (!suffix.equals( \"\" )) {\n\n suffix = truncate(suffix, 4);\n }\n if (!webid.equals( \"\" )) {\n\n webid = truncate(webid, 15);\n }\n\n //\n // Use try/catch here so processing will continue on rest of file if it fails\n //\n try {\n\n if (useWebid == false) { // use webid to locate member?\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE username = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, memid);\n\n } else { // use webid\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE webid = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, webid);\n }\n\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if(rs.next()) {\n\n memid_old = rs.getString(\"username\"); // get username in case we used webid\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n ghin_old = rs.getString(\"ghin\");\n bag_old = rs.getString(\"bag\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n email2_old = rs.getString(\"email2\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n suffix_old = rs.getString(\"name_suf\");\n inact_old = rs.getInt(\"inact\");\n email_bounce1 = rs.getInt(\"email_bounced\");\n email_bounce2 = rs.getInt(\"email2_bounced\");\n\n }\n pstmt2.close(); // close the stmt\n\n\n boolean memFound = false;\n boolean dup = false;\n boolean userChanged = false;\n boolean nameChanged = false;\n String dupuser = \"\";\n String dupmnum = \"\";\n String dupwebid = \"\";\n\n webid_new = webid; // default\n\n if ((club.equals(\"tpcsouthwind\") || club.equals(\"tpcpotomac\") || club.equals(\"tpcsugarloaf\")) && !memid.equals(memid_old)) { // Look into making this change for ALL tpc clubs!\n\n // memid has changed! Update the username\n memid_new = memid;\n userChanged = true;\n\n } else {\n memid_new = memid_old; // Don't change for old clubs\n }\n\n //\n // If member NOT found, then check if new member OR id has changed\n //\n if (fname_old.equals( \"\" )) { // if member NOT found\n\n //\n // New member - first check if name already exists\n //\n pstmt2 = con.prepareStatement (\n \"SELECT username, memNum, webid FROM member2b WHERE name_last = ? AND name_first = ? AND name_mi = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, lname);\n pstmt2.setString(2, fname);\n pstmt2.setString(3, mi);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n dupuser = rs.getString(\"username\"); // get this username\n dupmnum = rs.getString(\"memNum\");\n dupwebid = rs.getString(\"webid\"); // get this webid\n\n if (club.equals( \"virginiacc\" ) || club.equals( \"algonquin\" ) || club.equals( \"congressional\" )) {\n\n dup = true; // do not change members for these clubs\n\n } else {\n\n //\n // name already exists - see if this is the same member\n //\n if (!dupmnum.equals( \"\" ) && dupmnum.equals( mNum )) { // if name and mNum match, then memid or webid must have changed\n\n if (useWebid == true) { // use webid to locate member?\n\n webid_new = webid; // set new ids\n memid_new = dupuser;\n memid_old = dupuser; // update this record\n\n } else {\n\n webid_new = dupwebid; // set new ids\n memid_new = memid;\n memid_old = dupuser; // update this record\n userChanged = true; // indicate the username has changed\n }\n\n memFound = true; // update the member\n\n } else {\n\n dup = true; // dup member - do not add\n }\n }\n\n }\n pstmt2.close(); // close the stmt\n\n } else { // member found\n\n memFound = true;\n }\n\n //\n // Now, update the member record if existing member\n //\n if (memFound == true) { // if member exists\n\n changed = false; // init change indicator\n\n lname_new = lname_old;\n\n if (!lname.equals( \"\" ) && !lname_old.equals( lname )) {\n\n lname_new = lname; // set value from CE record\n changed = true;\n nameChanged = true;\n }\n\n fname_new = fname_old;\n\n if (club.equals( \"virginiacc\" ) || club.equals( \"algonquin\" ) || club.equals( \"congressional\" )) {\n\n fname = fname_old; // DO NOT change first names\n }\n\n if (!fname.equals( \"\" ) && !fname_old.equals( fname )) {\n\n fname_new = fname; // set value from CE record\n changed = true;\n nameChanged = true;\n }\n\n mi_new = mi_old;\n\n if (!mi.equals( \"\" ) && !mi_old.equals( mi )) {\n\n mi_new = mi; // set value from CE record\n changed = true;\n nameChanged = true;\n }\n\n mship_new = mship_old;\n\n if (!mship.equals( \"\" ) && !mship_old.equals( mship )) {\n\n mship_new = mship; // set value from CE record\n changed = true;\n }\n\n mtype_new = mtype_old;\n birth_new = birth_old;\n\n if (club.equals( \"meridiangc\" )) { // TEMP until they fix gender !!!!!!!!!!!!!!!!!!!!!\n\n mtype = mtype_old; // DO NOT change mtype\n }\n\n if (!mtype.equals( \"\" ) && (club.equalsIgnoreCase(\"brantford\") || club.equalsIgnoreCase(\"oakhillcc\") || !mtype.equals( \"Dependent\" )) && !mtype_old.equals( mtype )) {\n\n mtype_new = mtype; // set value from CE record\n changed = true;\n }\n\n if (birth > 0 && birth != birth_old) {\n\n birth_new = birth; // set value from CE record\n changed = true;\n }\n\n ghin_new = ghin_old;\n\n if (!ghin.equals( \"\" ) && !ghin_old.equals( ghin )) {\n\n ghin_new = ghin; // set value from CE record\n changed = true;\n }\n\n bag_new = bag_old;\n\n if (!bag.equals( \"\" ) && !bag_old.equals( bag )) {\n\n bag_new = bag; // set value from CE record\n changed = true;\n }\n\n posid_new = posid_old;\n\n if (!posid.equals( \"\" ) && !posid_old.equals( posid )) {\n\n posid_new = posid; // set value from CE record\n changed = true;\n }\n\n phone_new = phone_old;\n\n if (!phone.equals( \"\" ) && !phone_old.equals( phone )) {\n\n phone_new = phone; // set value from CE record\n changed = true;\n }\n\n phone2_new = phone2_old;\n\n if (!phone2.equals( \"\" ) && !phone2_old.equals( phone2 )) {\n\n phone2_new = phone2; // set value from CE record\n changed = true;\n }\n\n suffix_new = suffix_old;\n\n if (!suffix.equals( \"\" ) && !suffix_old.equals( suffix )) {\n\n suffix_new = suffix; // set value from CE record\n changed = true;\n }\n\n email_new = email_old; // start with old emails\n email2_new = email2_old;\n\n //\n // Update email addresses if specified and different than current\n //\n if ((!email.equals( \"\" ) || club.startsWith(\"tpc\")) && !email_old.equals( email )) {\n\n email_new = email; // set value from CE record\n changed = true;\n email_bounce1 = 0; // reset bounce flag\n }\n\n if (club.equals(\"colletonriverclub\")) { // don't update email2 for these clubs\n email2 = email2_old;\n }\n\n if ((!email2.equals( \"\" ) || club.startsWith(\"tpc\")) && !email2_old.equals( email2 )) {\n\n email2_new = email2; // set value from CE record\n changed = true;\n email_bounce2 = 0; // reset bounce flag\n }\n\n // don't allow both emails to be the same\n if (email_new.equalsIgnoreCase(email2_new)) email2_new = \"\";\n\n\n mNum_new = mNum_old; // do not change mNums (?? not sure why we do this for CE clubs ??)\n\n if (club.equals( \"weeburn\" ) || club.equals( \"benttreecc\" ) || club.equals( \"algonquin\" ) ||\n club.equals( \"berkeleyhall\" ) || club.equals( \"cherrycreek\" ) || club.equals(\"internationalcc\") ||\n club.startsWith( \"tpc\" ) || club.equals( \"missionviejo\" ) || club.equals(\"virginiacc\") ||\n club.equals(\"oakhillcc\") || club.equals( \"orchidisland\" )) { // change mNums for some clubs\n\n if (!mNum.equals( \"\" ) && !mNum_old.equals( mNum )) {\n\n mNum_new = mNum; // set value from CE record\n changed = true;\n }\n }\n\n inact_new = 0; // do not change inact status for most clubs\n\n if (club.equals( \"congressional\" )) { // change status for Congressional\n\n if (inact_new != inact) { // if status has changed\n\n inact_new = inact; // set value from CE record\n changed = true;\n }\n }\n\n\n if (club.equals( \"benttreecc\" )) { // special processing for Bent Tree\n\n String tempM = remZeroS(mNum_old); // strip alpha from our old mNum\n\n if ((tempM.startsWith(\"5\") || tempM.startsWith(\"7\")) && inact_old == 1) {\n\n // If our mNum contains an old inactive value and the member is inactive\n // then set him active and let mNum change (above).\n\n inact_new = inact; // set value from CE record (must be active to get this far)\n }\n }\n\n\n //\n // Update our record if something has changed\n //\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET username = ?, name_last = ?, name_first = ?, \" +\n \"name_mi = ?, m_ship = ?, m_type = ?, email = ?, \" +\n \"memNum = ?, ghin = ?, bag = ?, birth = ?, posid = ?, email2 = ?, phone1 = ?, \" +\n \"phone2 = ?, name_suf = ?, webid = ?, inact = ?, last_sync_date = now(), gender = ?, \" +\n \"email_bounced = ?, email2_bounced = ? \" +\n \"WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid_new);\n pstmt2.setString(2, lname_new);\n pstmt2.setString(3, fname_new);\n pstmt2.setString(4, mi_new);\n pstmt2.setString(5, mship_new);\n pstmt2.setString(6, mtype_new);\n pstmt2.setString(7, email_new);\n pstmt2.setString(8, mNum_new);\n pstmt2.setString(9, ghin_new);\n pstmt2.setString(10, bag_new);\n pstmt2.setInt(11, birth_new);\n pstmt2.setString(12, posid_new);\n pstmt2.setString(13, email2_new);\n pstmt2.setString(14, phone_new);\n pstmt2.setString(15, phone2_new);\n pstmt2.setString(16, suffix_new);\n pstmt2.setString(17, webid_new);\n pstmt2.setInt(18, inact_new);\n pstmt2.setString(19, gender);\n pstmt2.setInt(20, email_bounce1);\n pstmt2.setInt(21, email_bounce2);\n\n pstmt2.setString(22, memid_old);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n ucount++; // count records updated\n\n //\n // Member updated - now see if the username or name changed\n //\n if (userChanged == true || nameChanged == true) { // if username or name changed\n\n //\n // username or name changed - we must update other tables now\n //\n StringBuffer mem_name = new StringBuffer( fname_new ); // get the new first name\n\n if (!mi_new.equals( \"\" )) {\n mem_name.append(\" \" +mi_new); // new mi\n }\n mem_name.append(\" \" +lname_new); // new last name\n\n String newName = mem_name.toString(); // convert to one string\n\n Admin_editmem.updTeecurr(newName, memid_new, memid_old, con); // update teecurr with new values\n\n Admin_editmem.updTeepast(newName, memid_new, memid_old, con); // update teepast with new values\n\n Admin_editmem.updLreqs(newName, memid_new, memid_old, con); // update lreqs with new values\n\n Admin_editmem.updPartner(memid_new, memid_old, con); // update partner with new values\n\n Admin_editmem.updEvents(newName, memid_new, memid_old, con); // update evntSignUp with new values\n\n Admin_editmem.updLessons(newName, memid_new, memid_old, con); // update the lesson books with new values\n }\n\n\n } else { // member NOT found\n\n\n if (dup == false && !fname.equals(\"\") && !lname.equals(\"\")) { // if name does not already exist\n\n //\n // New member - add it\n //\n pstmt2 = con.prepareStatement (\n \"INSERT INTO member2b (username, password, name_last, name_first, name_mi, \" +\n \"m_ship, m_type, email, count, c_hancap, g_hancap, wc, message, emailOpt, memNum, \" +\n \"ghin, locker, bag, birth, posid, msub_type, email2, phone1, phone2, name_pre, name_suf, \" +\n \"webid, last_sync_date, gender) \" +\n \"VALUES (?,?,?,?,?,?,?,?,0,?,?,'','',1,?,?,'',?,?,?,'',?,?,?,'',?,?,now(),?)\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n pstmt2.setString(2, password);\n pstmt2.setString(3, lname);\n pstmt2.setString(4, fname);\n pstmt2.setString(5, mi);\n pstmt2.setString(6, mship);\n pstmt2.setString(7, mtype);\n pstmt2.setString(8, email);\n pstmt2.setFloat(9, c_hcap);\n pstmt2.setFloat(10, u_hcap);\n pstmt2.setString(11, mNum);\n pstmt2.setString(12, ghin);\n pstmt2.setString(13, bag);\n pstmt2.setInt(14, birth);\n pstmt2.setString(15, posid);\n pstmt2.setString(16, email2);\n pstmt2.setString(17, phone);\n pstmt2.setString(18, phone2);\n pstmt2.setString(19, suffix);\n pstmt2.setString(20, webid);\n pstmt2.setString(21, gender);\n pstmt2.executeUpdate(); // execute the prepared stmt\n\n pstmt2.close(); // close the stmt\n\n ncount++; // count records added (new)\n\n } else if (dup) {\n errCount++;\n errMsg = errMsg + \"\\n -Dup user found:\\n\" +\n \" new: memid = \" + memid + \" : cur: \" + dupuser + \"\\n\" +\n \" webid = \" + webid + \" : \" + dupwebid + \"\\n\" +\n \" mNum = \" + mNum + \" : \" + dupmnum;\n }\n }\n\n pcount++; // count records processed (not skipped)\n\n\n }\n catch (Exception e3b) {\n errCount++;\n errMsg = errMsg + \"\\n -Error2 processing roster (record #\" +rcount+ \") for \" +club+ \"\\n\" +\n \" line = \" +line+ \": \" + e3b.getMessage(); // build msg\n }\n\n } else {\n\n // Only report errors that AREN'T due to skip == true, since those were handled earlier!\n if (!found) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBER NOT FOUND!\";\n }\n if (fname.equals(\"\")) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n }\n if (lname.equals(\"\")) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -LAST NAME missing!\";\n }\n if (memid.equals(\"\")) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -USERNAME missing!\";\n }\n\n } // end of IF skip\n\n } // end of IF inactive\n\n } // end of IF minimum requirements\n\n } // end of IF tokens\n\n } // end of IF header row\n\n // log any errors and warnings that occurred\n if (errCount > 0) {\n totalErrCount += errCount;\n errList.add(errMemInfo + \"\\n *\" + errCount + \" error(s) found*\" + errMsg + \"\\n\");\n }\n if (warnCount > 0) {\n totalWarnCount += warnCount;\n warnList.add(errMemInfo + \"\\n *\" + warnCount + \" warning(s) found*\" + warnMsg + \"\\n\");\n }\n } // end of while\n\n //\n // Done with this file for this club - now set any members that were excluded from this file inactive\n //\n if (found == true) { // if we processed this club\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET inact = 1 \" +\n \"WHERE last_sync_date != now() AND last_sync_date != '0000-00-00'\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n \n \n //\n // Roster File Found for this club - make sure the roster sync indicator is set in the club table\n //\n setRSind(con, club);\n\n }\n }\n catch (Exception e3) {\n\n errorMsg = errorMsg + \" Error processing roster (record #\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e3.getMessage() + \"\\n\"; // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.ceSync: \"; // reset msg\n }\n\n // Print error and warning count totals to error log\n SystemUtils.logErrorToFile(\"\" +\n \"Total Errors Found: \" + totalErrCount + \"\\n\" +\n \"Total Warnings Found: \" + totalWarnCount + \"\\n\", club, true);\n\n // Print errors and warnings to error log\n if (totalErrCount > 0) {\n SystemUtils.logErrorToFile(\"\" +\n \"********************************************************************\\n\" +\n \"****ERRORS FOR \" + club + \" (Member WAS NOT synced!)\\n\" +\n \"********************************************************************\\n\", club, true);\n while (errList.size() > 0) {\n SystemUtils.logErrorToFile(errList.remove(0), club, true);\n }\n }\n if (totalWarnCount > 0) {\n SystemUtils.logErrorToFile(\"\" +\n \"********************************************************************\\n\" +\n \"****WARNINGS FOR \" + club + \" (Member MAY NOT have synced!)\\n\" +\n \"********************************************************************\\n\", club, true);\n while (warnList.size() > 0) {\n SystemUtils.logErrorToFile(warnList.remove(0), club, true);\n }\n }\n\n // TEMP!!!!\n if (club.equals(\"berkeleyhall\")) {\n\n errorMsg = \" CE sync complete. Records = \" +rcount+ \" for \" +club+ \", records processed = \" +pcount+ \", records added = \" +ncount+ \", records updated = \" +ucount + \"\\n\"; // build msg\n SystemUtils.logErrorToFile(errorMsg, club, true); // log it\n }\n\n // Print end time to error log\n SystemUtils.logErrorToFile(\"End time: \" + new java.util.Date().toString() + \"\\n\", club, true);\n }", "public int toDatabase()\r\n\t{\r\n\t\tRationaleDB db = RationaleDB.getHandle();\r\n\t\tConnection conn = db.getConnection();\r\n\t\t\r\n\t\tint ourid = 0;\r\n\r\n\t\t// Update Event To Inform Subscribers Of Changes\r\n\t\t// To Rationale\r\n\t\tRationaleUpdateEvent l_updateEvent;\t\t\r\n\t\t\r\n\t\t//find out if this tradeoff is already in the database\r\n\t\tStatement stmt = null; \r\n\t\tResultSet rs = null; \r\n\t\t\r\n//\t\tSystem.out.println(\"Saving to the database\");\r\n\t\t\r\n\t\ttry {\r\n\t\t\tstmt = conn.createStatement(); \r\n\t\t\t\r\n\t\t\t//now we need to find our ontology entries, and that's it!\r\n\t\t\tString findQuery3 = \"SELECT id FROM OntEntries where name='\" +\r\n\t\t\tRationaleDBUtil.escape(this.ont1.getName()) + \"'\";\r\n\t\t\trs = stmt.executeQuery(findQuery3); \r\n//\t\t\t***\t\t\tSystem.out.println(findQuery3);\r\n\t\t\tint ontid1;\r\n\t\t\tif (rs.next())\r\n\t\t\t{\r\n\t\t\t\tontid1 = rs.getInt(\"id\");\r\n//\t\t\t\trs.close();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tontid1 = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//now we need to find our ontology entries\r\n\t\t\tString findQuery4 = \"SELECT id FROM OntEntries where name='\" +\r\n\t\t\tRationaleDBUtil.escape(this.ont2.getName()) + \"'\";\r\n\t\t\trs = stmt.executeQuery(findQuery4); \r\n//\t\t\t***\t\t\tSystem.out.println(findQuery4);\r\n\t\t\tint ontid2;\r\n\t\t\tif (rs.next())\r\n\t\t\t{\r\n\t\t\t\tontid2 = rs.getInt(\"id\");\r\n//\t\t\t\trs.close();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tontid2 = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tString trade;\r\n\t\t\tif (tradeoff)\r\n\t\t\t{\r\n\t\t\t\ttrade = \"Tradeoff\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttrade = \"Co-Occurrence\";\r\n\t\t\t}\r\n\t\t\tString sym;\r\n\t\t\tsym = new Boolean(symmetric).toString();\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t String findQuery = \"SELECT id FROM tradeoffs where name='\" +\r\n\t\t\t this.name + \"'\";\r\n\t\t\t System.out.println(findQuery);\r\n\t\t\t rs = stmt.executeQuery(findQuery); \r\n\t\t\t \r\n\t\t\t if (rs.next())\r\n\t\t\t {\r\n\t\t\t System.out.println(\"already there\");\r\n\t\t\t ourid = rs.getInt(\"id\");\r\n\t\t\t //\t\t\t\trs.close();\r\n\t\t\t */\r\n\t\t\t\r\n\t\t\tif (this.id > 0)\r\n\t\t\t{\t\t\t\t\r\n\t\t\t\t//now, update it with the new information\r\n\t\t\t\tString updateOnt = \"UPDATE Tradeoffs \" +\r\n\t\t\t\t\"SET name = '\" +\r\n\t\t\t\tRationaleDBUtil.escape(this.name) + \"', \" +\r\n\t\t\t\t\"description = '\" +\r\n\t\t\t\tRationaleDBUtil.escape(this.description) + \"', \" +\r\n\t\t\t\t\"type = '\" + \r\n\t\t\t\ttrade + \"', \" +\r\n\t\t\t\t\"symmetric = '\" +\r\n\t\t\t\tsym + \"', \" +\r\n\t\t\t\t\"ontology1 = \" + new Integer(ontid1).toString() + \", \" +\r\n\t\t\t\t\"ontology2 = \" + new Integer(ontid2).toString() +\r\n\t\t\t\t\" WHERE \" +\r\n\t\t\t\t\"id = \" + this.id + \" \" ;\r\n//\t\t\t\tSystem.out.println(updateOnt);\r\n\t\t\t\tstmt.execute(updateOnt);\r\n\t\t\t\t\r\n\t\t\t\tourid = this.id;\r\n\t\t\t\t\r\n\t\t\t\tl_updateEvent = m_eventGenerator.MakeUpdated();\r\n\t\t\t\t//\t\t\tSystem.out.println(\"sucessfully added?\");\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t//now, we have determined that the tradeoff is new\r\n\t\t\t\t\r\n\t\t\t\tString newArgSt = \"INSERT INTO Tradeoffs \" +\r\n\t\t\t\t\"(name, description, type, symmetric, ontology1, ontology2) \" +\r\n\t\t\t\t\"VALUES ('\" +\r\n\t\t\t\tRationaleDBUtil.escape(this.name) + \"', '\" +\r\n\t\t\t\tRationaleDBUtil.escape(this.description) + \"', '\" +\r\n\t\t\t\ttrade + \"', '\" +\r\n\t\t\t\tsym + \"', \" +\r\n\t\t\t\tnew Integer(ontid1).toString() + \", \" +\r\n\t\t\t\tnew Integer(ontid2).toString() + \")\";\r\n\t\t\t\t\r\n//\t\t\t\tSystem.out.println(newArgSt);\r\n\t\t\t\tstmt.execute(newArgSt); \r\n//\t\t\t\tSystem.out.println(\"inserted stuff\");\r\n\t\t\t\t\r\n//\t\t\t\tnow, we need to get our ID\r\n\t\t\t\tString findQuery2 = \"SELECT id FROM tradeoffs where name='\" +\r\n\t\t\t\tRationaleDBUtil.escape(this.name) + \"'\";\r\n\t\t\t\trs = stmt.executeQuery(findQuery2); \r\n\t\t\t\t\r\n\t\t\t\tif (rs.next())\r\n\t\t\t\t{\r\n\t\t\t\t\tourid = rs.getInt(\"id\");\r\n\t\t\t\t\trs.close();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tourid = -1;\r\n\t\t\t\t}\r\n\t\t\t\tthis.id = ourid;\r\n\t\t\t\t\r\n\t\t\t\tl_updateEvent = m_eventGenerator.MakeCreated();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tm_eventGenerator.Broadcast(l_updateEvent);\r\n\t\t} catch (SQLException ex) {\r\n\t\t\tRationaleDB.reportError(ex, \"Tradeoff.toDatabase\", \"SQL Error\");\r\n\t\t}\r\n\t\t\r\n\t\tfinally { \r\n\t\t\tRationaleDB.releaseResources(stmt, rs);\r\n\t\t}\r\n\t\t\r\n\t\treturn ourid;\t\r\n\t\t\r\n\t}", "public Bank() {\n\n\t\tcustomerList = new ArrayList<Customer>();\n\t\tCustomer C = new Customer(\"madison\", \"bynum\", \"madb\", \"123\");\n\t\tcustomerList.add(C);\n\t\temployeeList = new ArrayList<Employee>();\n\t\tEmployee E = new Employee(\"madi\", \"by\", \"madib\", \"1234\");\n\t\temployeeList.add(E);\n\t\tadminList = new ArrayList<Admin>();\n\t\tAdmin A = new Admin(\"amber\", \"stone\", \"amberstone195\", \"12345\");\n\t\tadminList.add(A);\n\t\tsbank.writeSerializeMyBank();\n\t\tsbank.loadSerializeMyBank();\n\t}", "public void WriteCalendarToDatabase() throws IOException\r\n\t{\r\n\t\tObjectOutputStream outputfile;\r\n\t\toutputfile = new ObjectOutputStream(Files.newOutputStream(Paths.get(fileName)));\r\n\t\toutputfile.writeObject(calendar);\r\n\t\toutputfile.close();\r\n\t}", "public void doConvertion() throws IOException{\n String filename = \"test\";\n writer = new PrintWriter(new FileWriter(filename));\n writer.write(\"\\\"token\\\",\\\"prev_word\\\",\\\"next_word\\\",\\\"tag\\\",\\\"prev_tag\\\",\\\"next_tag\\\",\\\"is_number\\\",\\\"is_punctuation\\\",\\\"is_place_directive\\\",\\\"is_url\\\",\\\"is_twitter_account\\\",\\\"is_hashtag\\\",\\\"is_month_name\\\",\\\"is_gazeteer\\\",\\\"label\\\"\");\n // write header first.. \n \n // Select from db.\n// ArrayList<String> tweets = selectTweet();\n// for (int i = 0; i < tweets.size(); i++) {\n// String tobewriten = parseTweet(tweets.get(i));\n// writer.write(tobewriten);\n// }\n // put arff header in bottom but next to be moved to top..\n writer.write(parseTweet());\n //writer.write(getArffHeader());\n \n writer.close();\n // write to external file\n \n }", "public void store(Census census)\n\t{\n\t\topen();\n\t\ttry\n\t\t{\n\t\t\tDB.store(census);\n\t\t\tSystem.out.println(\"[DB4O]Census was stored\");\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t\tSystem.out.println(\"[DB4O]ERROR:Census could not be stored\");\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tclose();\n\t\t}\n\t}", "protected abstract boolean pvSaveBalance(OperationDataClass pOperationData, Boolean pInsert) throws DBSIOException;", "public void saveInformation(){\n market.saveInformationOfMarket();\n deckProductionCardOneBlu.saveInformationOfProductionDeck();\n deckProductionCardOneGreen.saveInformationOfProductionDeck();\n deckProductionCardOneViolet.saveInformationOfProductionDeck();\n deckProductionCardOneYellow.saveInformationOfProductionDeck();\n deckProductionCardThreeBlu.saveInformationOfProductionDeck();\n deckProductionCardThreeGreen.saveInformationOfProductionDeck();\n deckProductionCardThreeYellow.saveInformationOfProductionDeck();\n deckProductionCardThreeViolet.saveInformationOfProductionDeck();\n deckProductionCardTwoBlu.saveInformationOfProductionDeck();\n deckProductionCardTwoGreen.saveInformationOfProductionDeck();\n deckProductionCardTwoViolet.saveInformationOfProductionDeck();\n deckProductionCardTwoYellow.saveInformationOfProductionDeck();\n\n\n }", "int insert(R_dept_trade record);", "@Override\n\tpublic void saveBankingDetail(BankingDetail baningDetail) {\n\t\t\n\t}", "void getCompanyInfoFromText() {\r\n\r\n String first = texts.get(0).getText();\r\n String cID = first;\r\n String second = texts.get(1).getText();\r\n String cNAME = second;\r\n String third = texts.get(2).getText();\r\n String password = third;\r\n String forth = texts.get(3).getText();\r\n String GUR = forth;\r\n double d = Double.parseDouble(GUR);\r\n String fifth = texts.get(4).getText();\r\n String EUR = fifth;\r\n double dd = Double.parseDouble(EUR);\r\n String sixth = texts.get(5).getText();\r\n String TSB = sixth ;\r\n String TT = \"2018-04-/08:04:26\";\r\n StringBuffer sb = new StringBuffer();\r\n sb.append(TT).insert(8,TSB);\r\n String ts = sb.toString();\r\n\r\n companyInfo.add(new CompanyInfo(cID,cNAME,password,d,dd,ts));\r\n\r\n new CompanyInfo().WriteFiles_append(companyInfo);\r\n }", "public static void createTransaction() throws IOException {\n\t\t\n\t\tDate date = new Date((long) random(100000000));\n\t\tString date2 = \"'19\" + date.getYear() + \"-\" + (random(12)+1) + \"-\" + (random(28)+1) + \"'\";\n\t\tint amount = random(10000);\n\t\tint cid = random(SSNmap.size()) + 1;\n\t\tint vid = random(venders.size()) + 1;\n\t\t\n\t\twhile(ownership.get(cid) == null)\n\t\t\tcid = random(SSNmap.size()) + 1;\n\t\tString cc = ownership.get(cid).get(random(ownership.get(cid).size()));\n\t\t\n\t\twriter.write(\"INSERT INTO Transaction (Id, Date, vid, cid, CCNum, amount) Values (\" + tid++ +\", \" \n\t\t\t\t+ date2 + \", \" + vid + \", \" + cid + \", '\" + cc + \"', \" + amount + line);\n\t\twriter.flush();\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString username, password, payee;\n\t\tUser user;\n\t\tBank bank = new Bank();\n\t\tObjectOutputStream oos = null;\n\t\tString outputFile = \"resource/Bank.txt\";\n\t\tObjectInputStream ois = null;\n\t\tString inputFile = \"resource/Bank.txt\";\n\t\tString trInputFile = \"resource/Transactions.txt\";\n\t\tFile f = new File(outputFile);\n\n\t\tdouble amount;\n\n\t\tint choice;\n\t\tdashbord: while (true) {\n\t\t\tSystem.out.println(\"\\n-------------------\");\n\t\t\tSystem.out.println(\"BANK OF MyBank\");\n\t\t\tSystem.out.println(\"-------------------\\n\");\n\t\t\tSystem.out.println(\"1. Register account.\");\n\t\t\tSystem.out.println(\"2. Login.\");\n\t\t\tSystem.out.println(\"3. Update accounts.\");\n\t\t\tSystem.out.println(\"4. Exit.\");\n\t\t\tSystem.out.print(\"\\nEnter your choice : \");\n\t\t\tchoice = sc.nextInt();\n\t\t\tsc.nextLine();\n\t\t\tswitch (choice) {\n\t\t\tcase 1:\n\t\t\t\tSystem.out.print(\"Enter name : \");\n\t\t\t\tString name = sc.nextLine();\n\t\t\t\tSystem.out.print(\"Enter address : \");\n\t\t\t\tString address = sc.nextLine();\n\t\t\t\tSystem.out.print(\"Enter contact number : \");\n\t\t\t\tString phone = sc.nextLine();\n\t\t\t\tSystem.out.println(\"Set username : \");\n\t\t\t\tusername = sc.next();\n\t\t\t\t// -------------------------------------------------------\n\n\t\t\t\ttry {\n\t\t\t\t\tois = new ObjectInputStream(new FileInputStream(inputFile));\n\t\t\t\t\tif (f.length() != 0) {\n\n\t\t\t\t\t\tbank.userMap = (Map<String, User>) ois.readObject();\n\t\t\t\t\t}\n\n\t\t\t\t} catch (EOFException e) {\n\t\t\t\t\tSystem.out.println(\"its end of the record\");\n\t\t\t\t}\n\n\t\t\t\tcatch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\n\t\t\t\t} finally {\n\t\t\t\t\tif (ois != null)\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tois.close();\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t// --------------------------------------------------------\n\n\t\t\t\twhile (bank.userMap.containsKey(username)) {\n\t\t\t\t\tSystem.out.println(\"Username already exists. Set again : \");\n\t\t\t\t\tusername = sc.next();\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\n\t\t\t\t\t\t\"Set a password (minimum 8 chars; minimum 1 digit, 1 lowercase, 1 uppercase, 1 special character[!@#$%^&*_]) :\");\n\t\t\t\tpassword = sc.next();\n\t\t\t\tsc.nextLine();\n\t\t\t\twhile (!password.matches(((\"(?=.*\\\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*_]).{8,}\")))) {\n\t\t\t\t\tSystem.out.println(\"Invalid password . Set again :\");\n\t\t\t\t\tpassword = sc.next();\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"Enter initial deposit :10000 \");\n\t\t\t\tamount = sc.nextDouble();\n//\t\t\t\twhile (!sc.hasNextDouble()) {\n//\t\t\t\t\tSystem.out.println(\"Invalid amount. Enter again :\");\n//\t\t\t\t\tamount=sc.nextDouble();\n//\t\t\t\t}\n\n//\t\t\t\tsc.nextLine();\n\t\t\t\tuser = new User(name, address, phone, username, password, amount, new Date());\n\t\t\t\ttry {\n\t\t\t\t\toos = new ObjectOutputStream(new FileOutputStream(outputFile));\n//\t\t\t\t\tif(f.length()==0)\n\t\t\t\t\tbank.userMap.put(username, user);\n\t\t\t\t\tfor (Entry<String, User> entry : bank.userMap.entrySet())\n\t\t\t\t\t\toos.writeObject(bank.userMap);\n\t\t\t\t\toos.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t} finally {\n\t\t\t\t\tif (oos != null)\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\toos.close();\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tSystem.out.println(\"Enter username : \");\n\t\t\t\tusername = sc.next();\n\t\t\t\tsc.nextLine();\n\t\t\t\tSystem.out.println(\"Enter password : \");\n\t\t\t\tpassword = sc.next();\n\t\t\t\tsc.nextLine();\n\n\t\t\t\ttry {\n\t\t\t\t\tois = new ObjectInputStream(new FileInputStream(inputFile));\n\n\t\t\t\t\twhile (true) {\n\t\t\t\t\t\tbank.userMap = (Map<String, User>) ois.readObject();\n\t\t\t\t\t\tSystem.out.println(bank.userMap);\n\t\t\t\t\t\t// System.out.println(bank.userMap);\n\t\t\t\t\t\tif (bank.userMap.containsKey(username)) {\n\t\t\t\t\t\t\tuser = bank.userMap.get(username);\n\t\t\t\t\t\t\tif (bank.userMap.get(username).getPassword().equals(password)) {\n//\t\t\t\t\t\t\tSystem.out.println(\"hi\");\n\t\t\t\t\t\t\t\twhile (true) {\n\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\n---------------------------------\");\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"W E L C O M E, \" + username.toUpperCase());\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"-----------------------------------\\n\");\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"1. Deposit.\");\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"2. Transfer.\");\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"3. Last 5 transactions.\");\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"4. User information.\");\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"5. Log out.\");\n\t\t\t\t\t\t\t\t\tSystem.out.print(\"\\nEnter your choice : \");\n\t\t\t\t\t\t\t\t\tchoice = sc.nextInt();\n\t\t\t\t\t\t\t\t\tsc.nextLine();\n\t\t\t\t\t\t\t\t\tswitch (choice) {\n\t\t\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t\t\tSystem.out.print(\"Enter amount : \");\n//\t\t\t\t\t\t\t\t\twhile (!sc.hasNextDouble()) {\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Invalid amount. Enter again :\");\n//\t\t\t\t\t\t\t\t\t\tsc.nextLine();\n//\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tamount = sc.nextDouble();\n\t\t\t\t\t\t\t\t\t\tsc.nextLine();\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(amount);\n\n\t\t\t\t\t\t\t\t\t\tdeposit(amount, new Date(), bank, username, user, payee = null);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\t\t\tSystem.out.print(\"Enter payee username : \");\n\t\t\t\t\t\t\t\t\t\tpayee = sc.next();\n\t\t\t\t\t\t\t\t\t\tsc.nextLine();\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Enter amount : \");\n//\t\t\t\t\t\t\t\t\twhile (!sc.hasNextDouble()) {\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Invalid amount. Enter again :\");\n//\t\t\t\t\t\t\t\t\t\tsc.nextLine();\n//\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tamount = sc.nextDouble();\n\t\t\t\t\t\t\t\t\t\tsc.nextLine();\n//\t\t\t\t\t\t\t\t\tif (amount > 300000) {\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Transfer limit exceeded. Contact bank manager.\");\n//\t\t\t\t\t\t\t\t\t\tbreak;\n//\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// --------------------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tois = new ObjectInputStream(new FileInputStream(inputFile));\n\n//\t\t\t\t\t\t\t\t\t while(true) {\n\t\t\t\t\t\t\t\t\t\t\tbank.userMap = (Map<String, User>) ois.readObject();\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"whil\");\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(bank.userMap);\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(bank.userMap.get(username).getPassword().equals(password));\n\t\t\t\t\t\t\t\t\t\t\tif (bank.userMap.containsKey(payee)) {\n\t\t\t\t\t\t\t\t\t\t\t\twithdraw(amount, new Date(), bank, username, user);\n\t\t\t\t\t\t\t\t\t\t\t\tdeposit(amount, new Date(), bank, username, bank.userMap.get(payee),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpayee);\n\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Username doesn't exist.\");\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (EOFException e) {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"its end of the record\");\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcatch (Exception e) {\n\t\t\t\t\t\t\t\t\t\t\te.printStackTrace();\n\n\t\t\t\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\t\t\t\tif (ois != null)\n\t\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t\tois.close();\n\t\t\t\t\t\t\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tois = new ObjectInputStream(new FileInputStream(trInputFile));\n\n\t\t\t\t\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\t\t\t\t\tbank.transactions = (ArrayList<String>) ois.readObject();\n\t\t\t\t\t\t\t\t\t\t\t\tfor (String tr : bank.transactions)\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (tr.contains(username))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(tr);\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (EOFException e) {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"its end of the record\");\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcatch (Exception e) {\n\t\t\t\t\t\t\t\t\t\t\te.printStackTrace();\n\n\t\t\t\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\t\t\t\tif (ois != null)\n\t\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t\tois.close();\n\t\t\t\t\t\t\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t}\n\n//\t\t\t\t\t\t\t\t\tSet set = bank.transactions.entrySet();\n//\t\t\t\t\t\t\t Iterator iterator = set.iterator();\n//\t\t\t\t\t\t\t \n//\t\t\t\t\t\t\t while (iterator.hasNext()) {\n//\t\t\t\t\t\t\t Map.Entry entry = (Map.Entry)iterator.next();\n//\t\t\t\t\t\t\t System.out.println();\n//\t\t\t\t\t\t\t }\n//\t\t\t\t\t\t\t\t\tfor (String transactions : user.transactions) {\n//\t\t\t\t\t\t\t\t\t\tSystem.out.println(transactions);\n//\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Accountholder name : \" + user.getName());\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Accountholder address : \" + user.getAddress());\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Accountholder contact : \" + user.getPhone());\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 5:\n\t\t\t\t\t\t\t\t\t\tcontinue dashbord;\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"Wrong choice !\");\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tSystem.out.println(\"wrong password\");\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tSystem.out.println(\"user name dosnt exist\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} catch (OptionalDataException e) {\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t} catch (EOFException e) {\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t} finally {\n\t\t\t\t\tif (oos != null)\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\toos.close();\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tSystem.out.println(\"Enter username : \");\n\t\t\t\tusername = sc.next();\n\t\t\t\tuser = bank.userMap.get(username);\n\t\t\t\tif (bank.userMap.containsKey(username)) {\n\t\t\t\t\tbank.userMap.replace(username, new User(user.getName(), user.getAddress(), user.getPhone(),\n\t\t\t\t\t\t\tuser.getName(), user.getPassword(), user.getAmount(), new Date()));\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"Username doesn't exist.\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tSystem.out.println(\"\\nThank you for choosing Bank Of MyBank.\");\n\t\t\t\tSystem.exit(1);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Wrong choice !\");\n\t\t\t}\n\n\t\t}\n\t}", "public static void save(Airport a) throws DBException {\r\n Connection con = null;\r\n try {\r\n con = DBConnector.getConnection();\r\n Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);\r\n \r\n String sql = \"SELECT airportcode \"\r\n + \"FROM airport \"\r\n + \"WHERE number = \" + a.getAirportCode();\r\n ResultSet srs = stmt.executeQuery(sql);\r\n \r\n // UPDATE\r\n \r\n if (srs.next()) {\r\n //Getters moeten worden aangemaakt bij logic?\r\n\tsql = \"UPDATE airport \"\r\n + \"SET airportname = '\" + a.getAirportname() + \"'\"\r\n + \", timezone = '\" + a.getTimezone() + \"'\"\r\n + \"WHERE number = \" + a.getAirportCode();\r\n stmt.executeUpdate(sql);\r\n } \r\n \r\n // INSERT\r\n \r\n else {\r\n\tsql = \"INSERT into airport \"\r\n + \"(airportcode, airportname, timezone) \"\r\n\t\t+ \"VALUES (\" + a.getAirportCode()\r\n\t\t+ \", '\" + a.getAirportname() + \"'\"\r\n\t\t+ \", '\" + a.getTimezone() + \"')\";\r\n stmt.executeUpdate(sql);\r\n }\r\n \r\n DBConnector.closeConnection(con);\r\n } \r\n \r\n catch (Exception ex) {\r\n ex.printStackTrace();\r\n DBConnector.closeConnection(con);\r\n throw new DBException(ex);\r\n }\r\n }", "public static void depositMoney(ATMAccount account) throws FileNotFoundException {\r\n\t\taccountsdb = new File(\"accountsdb.txt\");\r\n\t\t//Use of two dimensional array to account for line number\r\n\t\tString[][] accountInfo = null;\r\n\r\n\t\tif (accountsdb.exists()) {\r\n\t\t\taccountsdbReader = new Scanner(accountsdb);\r\n\t\t\tint y = 0;\r\n\t\t\twhile (accountsdbReader.hasNextLine()) {\r\n\t\t\t\ty++;\r\n\t\t\t\taccountInfo = new String[y][4];\r\n\t\t\t\taccountsdbReader.nextLine();\r\n\t\t\t}\r\n\t\t\taccountsdbReader.close();\r\n\t\t}\r\n\r\n\t\tdouble depositAmount;\r\n\t\tdo {\r\n\t\t\tSystem.out.println(\"Enter the amount you want to deposit:\");\r\n\t\t\tdepositAmount = userInput.nextDouble();\r\n\t\t\tif (depositAmount < 0) {\r\n\t\t\t\tSystem.out.println(\"You cannot deposit a negative amount!\");\r\n\t\t\t}\r\n\r\n\t\t} while (depositAmount < 0);\r\n\t\taccount.setDeposit(depositAmount);\r\n\t\tSystem.out.println(\"Your deposit has been made.\");\r\n\r\n\t\tSystem.out.println(accountInfo.length);\r\n\r\n\t\tString s = \"\";\r\n\t\tif (accountsdb.exists()) {\r\n\t\t\tint y = 0;\r\n\t\t\taccountsdbReader = new Scanner(accountsdb);\r\n\r\n\t\t\twhile (accountsdbReader.hasNextLine()) {\r\n\t\t\t\ts = accountsdbReader.nextLine();\r\n\t\t\t\tStringTokenizer spl = new StringTokenizer(s, \" \");\r\n\t\t\t\tfor (int x = 0; x != 4; x++) {\r\n\t\t\t\t\taccountInfo[y][x] = spl.nextToken();\r\n\r\n\t\t\t\t}\r\n\t\t\t\ty++;\r\n\t\t\t}\r\n\t\t}\r\n/**\t\t\t\t\t\t\t\t\t\t\t VALIDATION PROOF\r\n *\t\tSystem.out.println(\"Line #1\" + \"\\n Index #0: \" + accountInfo[0][0] + \"\\t Index #1: \" + accountInfo[0][1]\r\n *\t\t\t\t+ \"\\t Index #2: \" + accountInfo[0][2] + \"\\t Index #3: \" + accountInfo[0][3]);\r\n *\t\tSystem.out.println(\"Line #2\" + \"\\n Index #0: \" + accountInfo[1][0] + \"\\t Index #1: \" + accountInfo[1][1]\r\n *\t\t\t\t+ \"\\t Index #2: \" + accountInfo[1][2] + \"\\t Index #3: \" + accountInfo[1][3]);\r\n *\t\tSystem.out.println(\"Line #3\" + \"\\n Index #0: \" + accountInfo[2][0] + \"\\t Index #1: \" + accountInfo[2][1]\r\n *\t\t\t\t+ \"\\t Index #2: \" + accountInfo[2][2] + \"\\t Index #3: \" + accountInfo[2][3]);\r\n *\t\tSystem.out.println(\"Line #4\" + \"\\n Index #0: \" + accountInfo[3][0] + \"\\t Index #1: \" + accountInfo[3][1]\r\n *\t\t\t\t+ \"\\t Index #2: \" + accountInfo[3][2] + \"\\t Index #3: \" + accountInfo[3][3]);\r\n *\t\t\t\t\r\n */\r\n\t\tint line = -1;\r\n\t\ttry {\r\n\r\n\t\t\tint accID;\r\n\t\t\tfor (int y = 0; y != accountInfo.length; y++) {\r\n\t\t\t\taccID = Integer.parseInt(accountInfo[y][0]);\r\n\t\t\t\tif (accID == account.getID())\r\n\t\t\t\t\tline = y;\r\n\r\n\t\t\t}\r\n\t\t\taccountInfo[line][2] = \"\" + account.getBalance();\r\n\t\t\tSystem.out.println(\"Depositing...\");\r\n\t\t\tSystem.out.println(\"New Balance: \" + accountInfo[line][2]);\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(\"Account was not found in database array!\");\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tPrintWriter scrubFile = new PrintWriter(accountsdb);\r\n\t\t\tscrubFile.write(\"\");\r\n\t\t\tscrubFile.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tFileWriter fileWriter = new FileWriter(accountsdb, true);\r\n\t\t\tBufferedWriter fileBuffer = new BufferedWriter(fileWriter);\r\n\t\t\tPrintWriter fileOutput = new PrintWriter(fileBuffer);\r\n\t\t\tfor (int i = 0; i != accountInfo.length; i++) {\r\n\t\t\t\tfileOutput.println(accountInfo[i][0] + \" \" + accountInfo[i][1] + \" \" + accountInfo[i][2] + \" \"\r\n\t\t\t\t\t\t+ accountInfo[i][3]);\r\n\t\t\t}\r\n\r\n\t\t\tif (fileOutput != null) {\r\n\t\t\t\tfileOutput.close();\r\n\t\t\t}\r\n\t\t\tif (fileBuffer != null) {\r\n\t\t\t\tfileBuffer.close();\r\n\t\t\t}\r\n\t\t\tif (fileWriter != null) {\r\n\t\t\t\tfileWriter.close();\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\taccountsdbReader.close();\r\n\r\n\t}", "int insert(FinanceAccount record);", "public Bank() throws Exception\r\n\t{\r\n\t\tScanner fileScan = new Scanner(new File(\"C:\\\\Users\\\\jason\\\\workspace\\\\proj1fa14\\\\bankdata.txt\"));\r\n\t\taccounts = new Account[10];\r\n\t\tnumAccounts = 0;\r\n\t\tCustomer customer;\r\n\t\tAccount account;\r\n\t\tfor(int i = 0; i<9; i++)\r\n\t\t{\r\n\t\t\tString first = fileScan.next();\r\n\t\t\t//System.out.println(first);\r\n\t\t\tString last = fileScan.next();\r\n\t\t\t//System.out.println(last);\r\n\t\t\tint age = fileScan.nextInt();\r\n\t\t\tString pN = fileScan.next();\r\n\t\t\tint ba = fileScan.nextInt();\r\n\t\t\tint ch = fileScan.nextInt();\r\n\t\t\tString accNum = fileScan.next();\r\n\t\t\tcustomer = new Customer(first,last,age,pN);\r\n\t\t\taccount = new Account(customer,ba,ch, accNum);\r\n\t\t\taccounts[i] = account;\r\n\t\t\tnumAccounts++;\r\n\t\t}\r\n\t\tfileScan.close();\r\n\t}", "public void saveToDB() throws java.sql.SQLException\n\t{\n\t\tStringBuffer sSQL=null;\n Vector vParams=new Vector();\n\t\t//-- Chequeamos a ver si es un objeto nuevo\n\t\tif(getID_BBDD()==-1) {\n\t\t\tsSQL = new StringBuffer(\"INSERT INTO INF_BBDD \");\n\t\t\tsSQL.append(\"(NOMBRE,DRIVER,URL,USUARIO,CLAVE,JNDI\");\n\t\t\tsSQL.append(\") VALUES (?,?,?,?,?,?)\");\n\n vParams = new Vector();\n vParams.add(getNOMBRE());\n vParams.add(getDRIVER());\n vParams.add(getURL());\n vParams.add(getUSUARIO());\n vParams.add(getCLAVE());\n vParams.add(getJNDI());\n\t\t}\n\t\telse {\n\t\t\tsSQL = new StringBuffer(\"UPDATE INF_BBDD SET \");\n sSQL.append(\" NOMBRE=?\");\n sSQL.append(\", DRIVER=?\");\n sSQL.append(\", URL=?\");\n sSQL.append(\", USUARIO=?\");\n sSQL.append(\", CLAVE=?\");\n\t\t\tsSQL.append(\", JNDI=?\");\n\t\t\tsSQL.append(\" WHERE ID_BBDD=?\");\n\n vParams = new Vector();\n vParams.add(getNOMBRE());\n vParams.add(getDRIVER());\n vParams.add(getURL());\n vParams.add(getUSUARIO());\n vParams.add(getCLAVE());\n vParams.add(getJNDI());\n vParams.add(new Integer(getID_BBDD()));\n\t\t}\n\n\t\tAbstractDBManager dbm = DBManager.getInstance();\n dbm.executeUpdate(sSQL.toString(),vParams);\n\n // Actualizamos la caché\n com.emesa.bbdd.cache.QueryCache.reloadQuery(\"base_datos\");\n\t}", "public static void serializeDatabase(MainDatabase data) {\n // truncate the file by default.\n try (FileOutputStream out = new FileOutputStream(Constants.SAVE_FILE);\n BufferedOutputStream writer = new BufferedOutputStream(out)) {\n\n byte[] salt = generateSalt();\n Cipher enc = getEncryptionCipher(salt, null);\n // un-encrypted header (necessary information for decryption)\n writer.write(salt.length);\n writer.write(salt);\n writer.write(enc.getIV().length);\n writer.write(enc.getIV());\n\n try (CipherOutputStream cos = new CipherOutputStream(writer, enc);\n ObjectOutputStream oos = new ObjectOutputStream(cos)) {\n\n // if we need any settings, write them here\n\n // write the travel database\n oos.writeByte(TravelType.values().length);\n for (TravelType tt : TravelType.values()) {\n // we don't directly serialize the collection because\n // MainDatabase indexes the origins\n // so each SingleTravel must be added one by one on reading\n Collection<SingleTravel> travels = data.getAllTravels(tt);\n oos.writeInt(travels.size());\n for (SingleTravel st : travels) {\n oos.writeObject(st);\n }\n }\n\n // write the user database\n oos.writeInt(data.getAllUsers().size());\n for (RegisteredUser ru : data.getAllUsers()) {\n // we don't want to directly serialize the itineraries because we want\n // to strictly check them to make sure they're valid\n // plus, we can use the existing TravelDatabase to avoid conflicts\n // with equals() and hashCode() for itineraries\n oos.writeObject(ru);\n\n oos.writeInt(ru.getBookedItineraries().size());\n for (Itinerary it : ru.getBookedItineraries()) {\n oos.writeInt(it.size());\n for (SingleTravel st : it.getTravels()) {\n oos.writeByte(st.getType().ordinal());\n oos.writeUTF(st.getIdentifier());\n }\n }\n }\n }\n } catch (IOException | GeneralSecurityException e) {\n log.log(Level.SEVERE, \"Error saving to file.\", e);\n }\n }", "void insert(PaymentTrade record);", "public void salvar() throws IOException {\n\t\tString pathToCsv = \"/home/rodrigo/git/Sistema-covid-19/src/Clinica/Database.csv\";\n\t\tFileWriter csvWriter = new FileWriter(pathToCsv, true);\n\t\t\n\t\tcsvWriter.append(this.login);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.password);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.name);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.adress);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.cnpj);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.employers);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.phoneNumber);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.email);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.stock);\n\t\tcsvWriter.append(\",\");\n\t\tcsvWriter.append(this.schedule);\n\t\tcsvWriter.append(\"\\n\");\n\n\t\tcsvWriter.flush();\n\t\tcsvWriter.close();\n\t\t\n\t}", "public void dump(PhoneBill bill) throws IOException{\n String customer = bill.getCustomer();\n File file = new File(\"/Users/srubey/PortlandStateJavaSummer2020/phonebill/src/main/resources/edu/pdx/cs410J/scrubey/\"\n + Project2.getFileName());\n FileWriter writer = null;\n\n try{\n //**if file not yet created\n writer = new FileWriter(file);\n\n writer.write(\"Customer name: \" + bill.getCustomer() + \"\\n\\n\");\n writer.write(\"Caller# Callee#\\t\\t Start Date\\tStart Time\\tEnd Date\\tEnd Time\\n\");\n\n //iterate through each phone call, extracting and adding data to file\n for(int i = 0; i < bill.getPhoneCalls().size(); ++i) {\n String caller = bill.getPhoneCalls().get(i).callerNumber;\n String callee = bill.getPhoneCalls().get(i).calleeNumber;\n String sd = bill.getPhoneCalls().get(i).startDate;\n String st = bill.getPhoneCalls().get(i).startTime;\n String ed = bill.getPhoneCalls().get(i).endDate;\n String et = bill.getPhoneCalls().get(i).endTime;\n\n writer.write(caller + \" \" + callee + \" \" + sd);\n\n //formatting\n if(sd.length() < 10)\n writer.write(\"\\t\");\n\n writer.write(\"\\t\" + st + \"\\t\\t\" + ed + \"\\t\" + et + \"\\n\");\n }\n\n file.createNewFile();\n }catch(IOException e){\n System.out.print(\"\\nText File error\");\n }finally{\n writer.close();\n }\n }", "public void saveSensorsDB() throws Exception {\n\n\t\t//Get JDBC connection\n\t\tConnection connection = null;\n\t\tStatement stmt = null;\n\t\tConnectDB conn = new ConnectDB();\n\t\tconnection = conn.getConnection();\n\n\t\tstmt = connection.createStatement();\n\t\tfor (int key : getMap().keySet()) {\n\t\t\tSubArea value = getMap().get(key);\n\t\t\tint fireValue = (value.isFireSensor()) ? 1 : 0;\n\t\t\tint burglaryValue = (value.isBurglarySensor()) ? 1 : 0;\n\t\t\t//Save Fire and Burglary sensors\n\t\t\tString sql = \"UPDATE section SET fireSensor=\" + fireValue\n\t\t\t\t\t+ \", burglarySensor=\" + burglaryValue + \" WHERE id=\" + key;\n\t\t\tstmt.executeUpdate(sql);\n\t\t}\n\n\t}", "Databank getBank();", "private void readData () throws SQLException {\n int currentFetchSize = getFetchSize();\n setFetchSize(0);\n close();\n setFetchSize(currentFetchSize);\n moveToInsertRow();\n\n CSVRecord record;\n\n for (int i = 1; i <= getFetchSize(); i++) {\n lineNumber++;\n try {\n\n if (this.records.iterator().hasNext()) {\n record = this.records.iterator().next();\n\n for (int j = 0; j <= this.columnsTypes.length - 1; j++) {\n\n switch (this.columnsTypes[j]) {\n case \"VARCHAR\":\n case \"CHAR\":\n case \"LONGVARCHAR\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateString(j + 1, record.get(j));\n break;\n case \"INTEGER\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateInt(j + 1, Integer.parseInt(record.get(j)));\n break;\n case \"TINYINT\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateByte(j + 1, Byte.parseByte(record.get(j)));\n break;\n case \"SMALLINT\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateShort(j + 1, Short.parseShort(record.get(j)));\n break;\n case \"BIGINT\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateLong(j + 1, Long.parseLong(record.get(j)));\n break;\n case \"NUMERIC\":\n case \"DECIMAL\":\n /*\n * \"0\" [0,0]\n * \"0.00\" [0,2]\n * \"123\" [123,0]\n * \"-123\" [-123,0]\n * \"1.23E3\" [123,-1]\n * \"1.23E+3\" [123,-1]\n * \"12.3E+7\" [123,-6]\n * \"12.0\" [120,1]\n * \"12.3\" [123,1]\n * \"0.00123\" [123,5]\n * \"-1.23E-12\" [-123,14]\n * \"1234.5E-4\" [12345,5]\n * \"0E+7\" [0,-7]\n * \"-0\" [0,0]\n */\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateBigDecimal(j + 1, new BigDecimal(record.get(j)));\n break;\n case \"DOUBLE\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateDouble(j + 1, Double.parseDouble(record.get(j)));\n break;\n case \"FLOAT\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateFloat(j + 1, Float.parseFloat(record.get(j)));\n break;\n case \"DATE\":\n // yyyy-[m]m-[d]d\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateDate(j + 1, Date.valueOf(record.get(j)));\n break;\n case \"TIMESTAMP\":\n // yyyy-[m]m-[d]d hh:mm:ss[.f...]\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateTimestamp(j + 1, Timestamp.valueOf(record.get(j)));\n break;\n case \"TIME\":\n // hh:mm:ss\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateTime(j + 1, Time.valueOf(record.get(j)));\n break;\n case \"BOOLEAN\":\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateBoolean(j + 1, convertToBoolean(record.get(j)));\n break;\n default:\n if (getStringOrNull(record.get(j)) == null) updateNull(j + 1);\n else updateString(j + 1, record.get(j));\n break;\n }\n }\n\n insertRow();\n incrementRowCount();\n }\n } catch (Exception e) {\n LOG.error(\"An error has occurred reading line number {} of the CSV file\", lineNumber, e);\n throw e;\n }\n }\n\n moveToCurrentRow();\n beforeFirst(); \n }", "public String getJP_BankData_EDI_Info();", "public void wire(String accountNumber,int bankNumber, String toAccountNumber, int amount) {\n\t\t\n\t\tConnection conn;\n\t\tPreparedStatement ps, pp, ll, lp, ls, mm, nn;\n\t\tString url = \"jdbc:mysql://localhost:3306/mars\";\n\t\tString username = \"root\";\n\t\tString password = \"1113\";\n\t\tint lastBalance;\n\t\tint tolastBalance;\n\t\ttry {\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t} catch (ClassNotFoundException e1) {\n\t\t\te1.printStackTrace();\n\t\t}\n\t\ttry{\n\t\tconn=DriverManager.getConnection(url, username, password);\n\t\tString sql = \"select balance,userId from \"+this.name+\" where accountNumber=?\";\n\t\tps= (PreparedStatement) conn.prepareStatement(sql);\n\t\tps.setString(1, accountNumber.toString());\n\t\tResultSet rs = ps.executeQuery();\n\t\tint nowBalance = 0;\n\t\tString id = \"\";\n\t\twhile(rs.next()) { \n\t\t\tnowBalance=rs.getInt(\"balance\");\n\t\t\tid = rs.getString(\"userId\");\n\t\t}\n\t\tif (nowBalance<amount) {\n\t\t\tSystem.out.println(\"No Balance\");\n\t\t\treturn;\n\t\t}\n\t\tlastBalance = nowBalance - amount;\n\t\t//System.out.println(lastBalance);\n\t\tString sql1 = \"UPDATE \"+this.name+\" SET balance=? where accountNumber=?\";\n\t\tls = (PreparedStatement) conn.prepareStatement(sql1);\n\t\tls.setInt(1, lastBalance);\n\t\tls.setString(2, accountNumber.toString());\n\t\tls.executeUpdate();\n\t\t\n\t\t\n\t\t\n\t\t//to account\n\t\tconn=DriverManager.getConnection(url, username, password);\n\t\tString sql3 = \"select bankName from bank where bankNumber=?\";\n\t\tll= (PreparedStatement) conn.prepareStatement(sql3);\n\t\tll.setString(1, String.valueOf(bankNumber).toString());\n\t\tResultSet rs3 = ll.executeQuery();\n\t\tString toname = \"\";\n\t\twhile(rs3.next()) { \n\t\t\ttoname=rs3.getString(\"bankName\");\n\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tString sql4 = \"select balance,userId from \"+toname+\" where accountNumber=?\";\n\t\tpp= (PreparedStatement) conn.prepareStatement(sql4);\n\t\tpp.setString(1, accountNumber.toString());\n\t\tResultSet rs4 = pp.executeQuery();\n\t\tint tonowBalance = 0;\n\t\tString toid = \"\";\n\t\twhile(rs4.next()) { \n\t\t\ttonowBalance=rs4.getInt(\"balance\");\n\t\t\ttoid = rs4.getString(\"userId\");\n\t\t}\n\t\t\n\t\ttolastBalance = tonowBalance + amount;\n\t\t//System.out.println(lastBalance);\n\t\tString sql5 = \"UPDATE \"+toname+\" SET balance=? where accountNumber=?\";\n\t\tlp = (PreparedStatement) conn.prepareStatement(sql5);\n\t\tlp.setInt(1, tolastBalance);\n\t\tlp.setString(2, toAccountNumber.toString());\n\t\tlp.executeUpdate();\n\t\t\n\t\t\n\t\t//log\n\t\tString logs = \"wired : \"+ amount+\" to \"+toAccountNumber+\"/ balance: \"+String.valueOf(lastBalance);\n\t\tString sql11 = \"insert into \"+id+\" (log) values (?)\";\n\t\tmm = (PreparedStatement) conn.prepareStatement(sql11);\n\t\tmm.setString(1, logs);\n\t\tmm.executeUpdate();\n\t\tSystem.out.println(\"You wired $\"+String.valueOf(amount));\n\t\t\n\t\tString logs1 = \"get : \"+ amount+\" from \" +accountNumber+ \"/ balance: \"+String.valueOf(tolastBalance);\n\t\tString sql12 = \"insert into \"+toid+\" (log) values (?)\";\n\t\tnn = (PreparedStatement) conn.prepareStatement(sql12);\n\t\tnn.setString(1, logs1);\n\t\tnn.executeUpdate();\n\t\tSystem.out.println(\"You got $\"+String.valueOf(amount));\n\t\t\n\t\t\n\t\t}catch (SQLException e) {\n\t\t throw new IllegalStateException(\"Cannot connect the database!\", e);\n\t\t}\n\t}", "public static void main(String[] args) throws FileNotFoundException\r\n\t{\n\t\tBank b1 = new Bank();\r\n//\t\tb1.setCustomers(b1.LoadCustomersFromFile());\r\n\t\tSystem.out.println(b1.printCustomersToString());\r\n\t\tSystem.out.println(b1.printTransactionsToString());\r\n\t\tCustomer customer = b1.getCustomers().get(5);\r\n\t\tAccount account = b1.getCustomers().get(5).getAccounts().get(0);\r\n//\t\taccount.createMonthlyStatement(\"Oct\", 2019, account, customer, b1);\r\n//\t\tb1.setTransactions(b1.LoadTransactionsFromFile());\r\n\t\tSystem.out.println(b1);\r\n//\t\tBank b1=runcreate();\r\n//\t\tSystem.out.println(b1);\r\n//\t\tSaveorLoadBank.LoadBankFromFile();\r\n//\t\tArrayList<Customer> customers = b1.getCustomers();\r\n//\t\tCustomer c1 = customers.get(4);\r\n//\t\tCustomer c2 = customers.get(5);\r\n//\t\tSystem.out.println(customers.get(4));\r\n//\t\tSystem.out.println(customers.get(5));\r\n//\t\tAccount a1 = customers.get(4).getAccounts().get(0);\r\n//\t\tAccount a2 = customers.get(5).getAccounts().get(0);\r\n//\t\tTransferManager.Transfer(c1, a1, c2, a2, (long) 100);\r\n//\t\tSystem.out.println(c1);\r\n//\t\tSystem.out.println(c2);\r\n//\t\tSystem.out.println(b1);\r\n//\t\tSystem.out.println(b1);\r\n\t\tb1.saveTofilePrintWriter();\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\t}", "public void writeToFile(Account account) {\n try {\n FileWriter fileWriter = new FileWriter(fileName);\n BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);\n bufferedWriter.write(\"\");\n writeInit(account, bufferedWriter);\n writeBaseSavings(account,bufferedWriter);\n\n for (Income i : account.getIncomeListTotal()) {\n writeIncome(i, bufferedWriter);\n }\n\n for (Expenditure exp : account.getExpListTotal()) {\n writeExp(exp, bufferedWriter);\n }\n\n for (Goal g : account.getShortTermGoals()) {\n writeGoal(g, bufferedWriter);\n }\n\n for (Instalment ins : account.getInstalments()) {\n writeInstalment(ins, bufferedWriter);\n }\n\n for (Loan l : account.getLoans()) {\n writeLoan(l,bufferedWriter);\n }\n\n for (BankTracker b : account.getBankTrackerList()) {\n writeBank(b,bufferedWriter);\n }\n\n bufferedWriter.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void mSaveBillData(int TenderType) { // TenderType:\r\n // 1=PayCash\r\n // 2=PayBill\r\n\r\n // Insert all bill items to database\r\n InsertBillItems();\r\n\r\n // Insert bill details to database\r\n InsertBillDetail(TenderType);\r\n\r\n updateMeteringData();\r\n\r\n /*if (isPrintBill) {\r\n // Print bill\r\n PrintBill();\r\n }*/\r\n }", "public boolean saveToBP_BankAccount(MBPBankAccount ba) {\n if (ba == null) {\n return false;\n }\n ba.setA_Name(getA_Name());\n ba.setA_Street(getA_Street());\n ba.setA_City(getA_City());\n ba.setA_State(getA_State());\n ba.setA_Zip(getA_Zip());\n ba.setA_Country(getA_Country());\n ba.setA_EMail(getA_EMail());\n ba.setA_Ident_DL(getA_Ident_DL());\n ba.setA_Ident_SSN(getA_Ident_SSN());\n //\tCC\n ba.setCreditCardType(getCreditCardType());\n ba.setCreditCardNumber(getCreditCardNumber());\n ba.setCreditCardExpMM(getCreditCardExpMM());\n ba.setCreditCardExpYY(getCreditCardExpYY());\n ba.setCreditCardVV(getCreditCardVV());\n //\tBank\n if (getAccountNo() != null) {\n ba.setAccountNo(getAccountNo());\n }\n if (getRoutingNo() != null) {\n ba.setRoutingNo(getRoutingNo());\n }\n //\tTrx\n ba.setR_AvsAddr(getR_AvsAddr());\n ba.setR_AvsZip(getR_AvsZip());\n //\n boolean ok = ba.save(get_TrxName());\n log.fine(\"saveToBP_BankAccount - \" + ba);\n return ok;\n }", "public static void createPayment() throws IOException {\t\t\n\t\tDate date = new Date((long) random(100000000));\n\t\tString date2 = \"'19\" + date.getYear() + \"-\" + (random(12)+1) + \"-\" + (random(28)+1) + \"'\";\n\t\tint amount = random(10000);\n\t\t\n\t\twriter.write(\"INSERT INTO Payment (Id, Date, CCNum, amount) Values (\" + pid++ +\", \" \n\t\t\t\t+ date2 + \", '\" + CCnumbers.get(random(CCnumbers.size())) + \"', \" + amount + line);\n\t\twriter.flush();\n\t}", "@Override\n\tpublic void write() throws IOException {\n\t\t// declare and instantiate a filewriter to write to the customer's file\n\t\tFileWriter wr = new FileWriter(this.customer);\n\t\tBufferedWriter br = new BufferedWriter(wr);\n\n\t\t// write the customers first and last name (seperate lines)\n\t\tbr.write(this.firstName + \"\\n\");\n\t\tbr.write(this.lastName + \"\\n\");\n\t\t// write the customers phone number (remove the parenthesis around the\n\t\t// area code and spaces)\n\t\t// only write a new line if the customer has transactions\n\t\t// (BufferedReader does not allow preceding \"\\n\")\n\t\tString phoneNum = this.phoneNum.substring(1, 4) + this.phoneNum.substring(6, 9) + this.phoneNum.substring(10);\n\n\t\tif (this.transactions.size() == 0) {\n\t\t\tbr.write(phoneNum);\n\t\t} else {\n\t\t\tbr.write(phoneNum + \"\\n\");\n\t\t}\n\n\t\t// write all of the transaction numbers\n\t\tfor (int i = 0; i < this.transactions.size(); i++) {\n\t\t\t// if this last transaction, do not write an enter\n\t\t\t// else, write an enter\n\t\t\tif (i == this.transactions.size() - 1) {\n\t\t\t\tbr.write(this.transactions.get(i));\n\t\t\t} else {\n\t\t\t\tbr.write(this.transactions.get(i) + \"\\n\");\n\t\t\t}\n\t\t}\n\n\t\t// close the filewriter (finished writing)\n\t\tbr.close();\n\t}", "public void writeDatabase();", "void insertSelective(CusBankAccount record);", "public void storeValuesDump() throws SQLException{ //store DUMP values into the database\n \tString sqlDump = \"INSERT INTO dump VALUES ('\" + massSelection + \"', '\" + smokeSelection + \"', '\" + framesText.getText() + \"', '\" + dtDevcText.getText() + \"');\";\n \tConnectionClass connectionClass = new ConnectionClass();\n\t\tConnection connection = connectionClass.getConnection();\n\t\tStatement statement = connection.createStatement();\n\t\tstatement.executeUpdate(sqlDump);\n }", "private void writeToFile(){\n try(BufferedWriter br = new BufferedWriter(new FileWriter(filename))){\n for(Teme x:getAll())\n br.write(x.toString()+\"\\n\");\n br.close();\n }catch (IOException e){\n e.printStackTrace();\n }\n }", "public void writeBank(BankTracker b, BufferedWriter bufferedWriter) throws IOException {\n bufferedWriter.write(\"BAN @ \" + b.getAmt() + \" @ \" + b.getDescription()\n + \" @ \" + b.getLatestDate().toString() + \" @ \" + b.getRate() + \"\\n\");\n }", "private static void writeCLOBData() {\n\t\tConnection conn = null;\n\t\tPreparedStatement stmt = null;\n\t\ttry {\n\t\t\tconn = JDBCUtils.getMySQLConnection();\n\t\t\tString sql = \"INSERT INTO testclob(name, resume) values(?,?)\";\n\t\t\tstmt = conn.prepareStatement(sql);\n\t\t\tstmt.setString(1, \"ke\");\n\t\t\tFile file = new File(\"D:\" + File.separator + \"test.txt\");\n\t\t\tReader reader = new InputStreamReader(new FileInputStream(file), \"utf-8\");\n\t\t\tstmt.setCharacterStream(2, reader, (int)file.length());\n\t\t\tstmt.executeUpdate();\n\t\t}\n\t\tcatch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tfinally {\n\t\t\tJDBCUtils.release(stmt, conn);\n\t\t}\n\t}", "public static MainDatabase deserializeDatabase() {\n MainDatabase data = new MainDatabase();\n // first check if the file exists\n File file = new File(Constants.SAVE_FILE);\n if (!file.exists()) {\n return data;\n }\n try (FileInputStream in = new FileInputStream(Constants.SAVE_FILE);\n BufferedInputStream reader = new BufferedInputStream(in)) {\n\n // un-encrypted header (salt and iv necessary for decryption)\n byte[] salt = new byte[reader.read()];\n reader.read(salt);\n byte[] iv = new byte[reader.read()];\n reader.read(iv);\n Cipher enc = getEncryptionCipher(salt, iv);\n\n try (CipherInputStream cis = new CipherInputStream(reader, enc);\n ObjectInputStream ois = new ObjectInputStream(cis)) {\n\n // if we need any settings, read them here\n\n // read the travel database\n int count = ois.readByte();\n for (int i = 0; i < count; i++) {\n int size = ois.readInt();\n for (int j = 0; j < size; j++) {\n data.addTravel((SingleTravel) ois.readObject());\n }\n }\n\n // read the user database\n count = ois.readInt();\n for (int i = 0; i < count; i++) {\n RegisteredUser ru = (RegisteredUser) ois.readObject();\n data.addUser(ru);\n\n int size = ois.readInt();\n for (int j = 0; j < size; j++) {\n int itSize = ois.readInt();\n // check the itinerary to make sure it is still valid\n boolean validItinerary = (itSize > 0);\n Itinerary it = new Itinerary();\n for (int k = 0; k < itSize; k++) {\n try {\n SingleTravel st = data.getTravel(TravelType.values()[ois.readByte()],\n ois.readUTF());\n if (st == null) { // doesn't exist; do not add itinerary\n validItinerary = false;\n } else {\n it.add(st);\n }\n } catch (IllegalArgumentException e) {\n validItinerary = false;\n // we don't need to log this -- probably a travel expired\n }\n }\n if (validItinerary) {\n ru.bookItinerary(it);\n }\n }\n }\n }\n } catch (IOException | GeneralSecurityException | ClassNotFoundException e) {\n log.log(Level.SEVERE, \"Error reading from file.\", e);\n }\n return data;\n }", "@Override\n public void run() {\n try {\n // EXPORT CONNECTION \n //System.out.println(t3.get(c));\n Class.forName(t2.get(c)).newInstance();\n Connection conn1 = DriverManager.getConnection(t3.get(c) + \"?verifyServerCertificate=false&useSSL=true\", t4.get(c), t5.get(c));\n //System.out.println(t1.get(c));\n // GETTING DATA FROM TABLE 1\n String exportQuery = \"SELECT * FROM \" + t1.get(c);\n PreparedStatement statement1 = conn1.prepareStatement(exportQuery);\n ResultSet rs = statement1.executeQuery();\n ResultSetMetaData rsmd = rs.getMetaData();\n List<String> columnNames = new ArrayList<String>();\n Object temp = null;\n int columnCount = rsmd.getColumnCount();\n for (int i = 1; i <= columnCount; i++) {\n columnNames.add(rsmd.getColumnName(i));\n }\n //System.out.println(sb.toString());\n while (rs.next()) {\n StringBuilder sb = new StringBuilder();\n sb.append(\"INSERT INTO \" + t1.get(0) + \" (\" + d + \") VALUES (\");\n for (int k = 0; k < columnCount; k++) {\n if (rsmd.getColumnType(k + 1) == Types.INTEGER) {\n temp = rs.getInt(k + 1);\n sb.append(temp + \", \");\n } else if (rsmd.getColumnType(k + 1) == Types.VARCHAR || rsmd.getColumnType(k + 1) == Types.CHAR) {\n temp = rs.getString(k + 1);\n sb.append(\"'\" + temp + \"', \");\n } else if (rsmd.getColumnType(k + 1) == Types.DECIMAL) {\n temp = rs.getFloat(k + 1);\n //System.out.println(\"temp \" + temp);\n sb.append(temp + \", \");\n } else if (rsmd.getColumnType(k + 1) == Types.BOOLEAN) {\n temp = rs.getBoolean(k + 1);\n sb.append(temp + \", \");\n } else if (rsmd.getColumnType(k + 1) == Types.DATE) {\n temp = rs.getDate(k + 1);\n sb.append(\"'\" + temp + \"', \");\n }\n //sb.append(temp + \", \");\n }\n sb.setLength(sb.length() - 2);\n sb.append(\");\");\n //System.out.println(sb.toString());\n String query2 = sb.toString();\n //System.out.println(query2);\n // NEED TO PERFORM A QUERY FOR EACH ROW\n PreparedStatement pstmt;\n pstmt = iconn.prepareStatement(query2);\n pstmt.executeUpdate();\n\n }\n \n } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | SQLException e) {\n System.err.println(e);\n } finally {\n //System.out.println();\n }\n\n }", "int insert(FinancialManagement record);", "private static void flexSync(Connection con, InputStreamReader isr, String club) {\n\n PreparedStatement pstmt2 = null;\n Statement stmt = null;\n ResultSet rs = null;\n\n\n Member member = new Member();\n\n String line = \"\";\n String password = \"\";\n String temp = \"\";\n\n int i = 0;\n\n // Values from Flexscape records\n //\n String fname = \"\";\n String lname = \"\";\n String mi = \"\";\n String suffix = \"\";\n String posid = \"\";\n String gender = \"\";\n String ghin = \"\";\n String memid = \"\";\n String webid = \"\";\n String mNum = \"\";\n String u_hndcp = \"\";\n String c_hndcp = \"\";\n String mship = \"\";\n String mtype = \"\";\n String bag = \"\";\n String email = \"\";\n String email2 = \"\";\n String phone = \"\";\n String phone2 = \"\";\n String mobile = \"\";\n String primary = \"\";\n String active = \"\";\n\n String mship2 = \"\"; // used to tell if match was found\n\n float u_hcap = 0;\n float c_hcap = 0;\n int birth = 0;\n\n // Values from ForeTees records\n //\n String fname_old = \"\";\n String lname_old = \"\";\n String mi_old = \"\";\n String mship_old = \"\";\n String mtype_old = \"\";\n String email_old = \"\";\n String mNum_old = \"\";\n String ghin_old = \"\";\n String bag_old = \"\";\n String posid_old = \"\";\n String email2_old = \"\";\n String phone_old = \"\";\n String phone2_old = \"\";\n String suffix_old = \"\";\n String memid_old = \"\";\n\n float u_hcap_old = 0;\n float c_hcap_old = 0;\n int birth_old = 0;\n\n // Values for New ForeTees records\n //\n String fname_new = \"\";\n String lname_new = \"\";\n String mi_new = \"\";\n String mship_new = \"\";\n String mtype_new = \"\";\n String email_new = \"\";\n String mNum_new = \"\";\n String ghin_new = \"\";\n String bag_new = \"\";\n String posid_new = \"\";\n String email2_new = \"\";\n String phone_new = \"\";\n String phone2_new = \"\";\n String suffix_new = \"\";\n String memid_new = \"\";\n String last_mship = \"\";\n String last_mnum = \"\";\n\n float u_hcap_new = 0;\n float c_hcap_new = 0;\n int birth_new = 0;\n int rcount = 0;\n int newCount = 0;\n int modCount = 0;\n int work = 0;\n\n String errorMsg = \"Error in Common_sync.flexSync: \";\n\n boolean failed = false;\n boolean changed = false;\n boolean skip = false;\n boolean headerFound = false;\n boolean found = false;\n boolean memidChanged = false;\n\n\n SystemUtils.logErrorToFile(\"FlexScape: Error log for \" + club + \"\\nStart time: \" + new java.util.Date().toString() + \"\\n\", club, false);\n\n try {\n\n BufferedReader br = new BufferedReader(isr);\n\n while (true) {\n\n line = br.readLine();\n\n if (line == null) {\n break;\n }\n\n // Skip the 1st row (header row)\n\n if (headerFound == false) {\n\n headerFound = true;\n\n } else {\n\n skip = false;\n found = false; // default to club NOT found\n\n //\n // *********************************************************************\n //\n // The following will be dependent on the club - customized\n //\n // *********************************************************************\n //\n if (club.equals( \"fourbridges\" )) {\n\n found = true; // club found\n\n // Remove the dbl quotes and check for embedded commas\n\n line = cleanRecord4( line );\n line = cleanRecord2( line );\n\n rcount++; // count the records\n\n // parse the line to gather all the info\n\n StringTokenizer tok = new StringTokenizer( line, \",\" ); // delimiters are comma\n\n if ( tok.countTokens() > 10 ) { // enough data ?\n\n webid = tok.nextToken();\n memid = tok.nextToken();\n fname = tok.nextToken();\n mi = tok.nextToken();\n lname = tok.nextToken();\n gender = tok.nextToken();\n email = tok.nextToken();\n phone = tok.nextToken();\n phone2 = tok.nextToken();\n temp = tok.nextToken();\n primary = tok.nextToken();\n\n mNum = \"\";\n suffix = \"\";\n mship = \"\";\n mtype = \"\";\n email2 = \"\";\n bag = \"\";\n ghin = \"\";\n u_hndcp = \"\";\n c_hndcp = \"\";\n posid = \"\";\n mobile = \"\";\n active = \"\";\n\n //\n // Check for ? (not provided)\n //\n if (webid.equals( \"?\" )) {\n\n webid = \"\";\n }\n if (memid.equals( \"?\" )) {\n\n memid = \"\";\n }\n if (fname.equals( \"?\" )) {\n\n fname = \"\";\n }\n if (mi.equals( \"?\" )) {\n\n mi = \"\";\n }\n if (lname.equals( \"?\" )) {\n\n lname = \"\";\n }\n if (gender.equals( \"?\" )) {\n\n gender = \"\";\n }\n if (email.equals( \"?\" )) {\n\n email = \"\";\n }\n if (phone.equals( \"?\" )) {\n\n phone = \"\";\n }\n if (phone2.equals( \"?\" )) {\n\n phone2 = \"\";\n }\n if (temp.equals( \"?\" ) || temp.equals( \"0\" )) {\n\n temp = \"\";\n }\n if (primary.equals( \"?\" )) {\n\n primary = \"\";\n }\n\n //\n // Determine if we should process this record (does it meet the minimum requirements?)\n //\n if (!webid.equals( \"\" ) && !memid.equals( \"\" ) && !lname.equals( \"\" ) && !fname.equals( \"\" )) {\n\n //\n // Remove spaces, etc. from name fields\n //\n tok = new StringTokenizer( fname, \" \" ); // delimiters are space\n\n fname = tok.nextToken(); // remove any spaces and middle name\n\n if ( tok.countTokens() > 0 ) {\n\n mi = tok.nextToken(); // over-write mi if already there\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n tok = new StringTokenizer( suffix, \" \" ); // delimiters are space\n\n suffix = tok.nextToken(); // remove any extra (only use one value)\n }\n\n tok = new StringTokenizer( lname, \" \" ); // delimiters are space\n\n lname = tok.nextToken(); // remove suffix and spaces\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n lname = lname + \"_\" + suffix; // append suffix to last name\n\n } else { // sufix after last name ?\n\n if ( tok.countTokens() > 0 ) {\n\n suffix = tok.nextToken();\n lname = lname + \"_\" + suffix; // append suffix to last name\n }\n }\n\n //\n // Determine the handicaps\n //\n u_hcap = -99; // indicate no hndcp\n c_hcap = -99; // indicate no c_hndcp\n\n\n //\n // convert birth date (mm/dd/yyyy to yyyymmdd)\n //\n birth = 0;\n\n if (!temp.equals( \"\" )) {\n\n String b1 = \"\";\n String b2 = \"\";\n String b3 = \"\";\n int mm = 0;\n int dd = 0;\n int yy = 0;\n\n tok = new StringTokenizer( temp, \"/-\" ); // delimiters are / & -\n\n if ( tok.countTokens() > 2 ) {\n\n b1 = tok.nextToken();\n b2 = tok.nextToken();\n b3 = tok.nextToken();\n\n mm = Integer.parseInt(b1);\n dd = Integer.parseInt(b2);\n yy = Integer.parseInt(b3);\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n\n } else { // try 'Jan 20, 1951' format\n\n tok = new StringTokenizer( temp, \", \" ); // delimiters are comma and space\n\n if ( tok.countTokens() > 2 ) {\n\n b1 = tok.nextToken();\n b2 = tok.nextToken();\n b3 = tok.nextToken();\n\n if (b1.startsWith( \"Jan\" )) {\n mm = 1;\n } else {\n if (b1.startsWith( \"Feb\" )) {\n mm = 2;\n } else {\n if (b1.startsWith( \"Mar\" )) {\n mm = 3;\n } else {\n if (b1.startsWith( \"Apr\" )) {\n mm = 4;\n } else {\n if (b1.startsWith( \"May\" )) {\n mm = 5;\n } else {\n if (b1.startsWith( \"Jun\" )) {\n mm = 6;\n } else {\n if (b1.startsWith( \"Jul\" )) {\n mm = 7;\n } else {\n if (b1.startsWith( \"Aug\" )) {\n mm = 8;\n } else {\n if (b1.startsWith( \"Sep\" )) {\n mm = 9;\n } else {\n if (b1.startsWith( \"Oct\" )) {\n mm = 10;\n } else {\n if (b1.startsWith( \"Nov\" )) {\n mm = 11;\n } else {\n if (b1.startsWith( \"Dec\" )) {\n mm = 12;\n } else {\n mm = Integer.parseInt(b1);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n dd = Integer.parseInt(b2);\n yy = Integer.parseInt(b3);\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n }\n }\n }\n\n password = lname;\n\n //\n // if lname is less than 4 chars, fill with 1's\n //\n int length = password.length();\n\n while (length < 4) {\n\n password = password + \"1\";\n length++;\n }\n\n //\n // Verify the email addresses\n //\n if (!email.equals( \"\" )) { // if specified\n\n email = email.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email));\n\n if (!feedback.isPositive()) { // if error\n\n email = \"\"; // do not use it\n }\n }\n if (!email2.equals( \"\" )) { // if specified\n\n email2 = email2.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email2));\n\n if (!feedback.isPositive()) { // if error\n\n email2 = \"\"; // do not use it\n }\n }\n\n // if email #1 is empty then assign email #2 to it\n if (email.equals(\"\")) email = email2;\n\n //\n // Determine if we should process this record\n //\n if (!webid.equals( \"\" )) { // must have a webid\n\n mNum = memid;\n\n if (mNum.endsWith( \"A\" ) || mNum.endsWith( \"a\" ) || mNum.endsWith( \"B\" ) || mNum.endsWith( \"b\" ) ||\n mNum.endsWith( \"C\" ) || mNum.endsWith( \"c\" ) || mNum.endsWith( \"D\" ) || mNum.endsWith( \"d\" ) ||\n mNum.endsWith( \"E\" ) || mNum.endsWith( \"e\" ) || mNum.endsWith( \"F\" ) || mNum.endsWith( \"f\" )) {\n\n mNum = stripA(mNum);\n }\n\n posid = mNum;\n\n\n //\n // Use a version of the webid for our username value. We cannot use the mNum for this because the mNum can\n // change at any time (when their mship changes). The webid does not change for members.\n //\n memid = \"100\" + webid; // use 100xxxx so username will never match any old usernames that were originally\n // based on mNums!!\n\n\n if (gender.equals( \"\" )) {\n\n gender = \"M\";\n }\n if (primary.equals( \"\" )) {\n\n primary = \"0\";\n }\n\n //\n // Determine mtype value\n //\n if (gender.equalsIgnoreCase( \"M\" )) {\n\n mtype = \"Primary Male\";\n\n if (primary.equalsIgnoreCase( \"1\" )) {\n\n mtype = \"Spouse Male\";\n\n }\n\n } else {\n\n mtype = \"Primary Female\";\n\n if (primary.equalsIgnoreCase( \"1\" )) {\n\n mtype = \"Spouse Female\";\n\n }\n }\n\n //\n // Determine mship value\n //\n work = Integer.parseInt(mNum); // create int for compares\n\n mship = \"\";\n\n if (work < 1000) { // 0001 - 0999 (see 7xxx below also)\n\n mship = \"Full Family Golf\";\n\n } else {\n\n if (work < 1500) { // 1000 - 1499\n\n mship = \"Individual Golf\";\n\n } else {\n\n if (work < 2000) { // 1500 - 1999\n\n mship = \"Individual Golf Plus\";\n\n } else {\n\n if (work > 2999 && work < 4000) { // 3000 - 3999\n\n mship = \"Corporate Golf\";\n\n } else {\n\n if (work > 3999 && work < 5000) { // 4000 - 4999\n\n mship = \"Sports\";\n\n } else {\n\n if (work > 6499 && work < 6600) { // 6500 - 6599\n\n mship = \"Player Development\";\n\n } else {\n\n if (work > 7002 && work < 7011) { // 7003 - 7010\n\n mship = \"Harpors Point\";\n\n if (work == 7004 || work == 7008 || work == 7009) { // 7004, 7008 or 7009\n\n mship = \"Full Family Golf\";\n }\n\n } else {\n\n if (work > 8999 && work < 10000) { // 9000 - 9999\n\n mship = \"Employees\";\n mtype = \"Employee\"; // override mtype for employees\n }\n }\n }\n }\n }\n }\n }\n }\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip record if mship not one of above\n SystemUtils.logErrorToFile(\"MSHIP MISSING - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + work, \"fourbridges\", true);\n }\n\n } else {\n\n skip = true; // skip record if webid not provided\n SystemUtils.logErrorToFile(\"WEBID MISSING - SKIPPED\", \"fourbridges\", true);\n }\n\n } else {\n\n skip = true; // skip record if memid or name not provided\n SystemUtils.logErrorToFile(\"USERNAME/NAME MISSING - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + memid, \"fourbridges\", true);\n\n } // end of IF minimum requirements met (memid, etc)\n\n\n\n //\n //******************************************************************\n // Common processing - add or update the member record\n //******************************************************************\n //\n if (skip == false && found == true && !fname.equals(\"\") && !lname.equals(\"\")) {\n\n //\n // now determine if we should update an existing record or add the new one\n //\n memid_old = \"\";\n fname_old = \"\";\n lname_old = \"\";\n mi_old = \"\";\n mship_old = \"\";\n mtype_old = \"\";\n email_old = \"\";\n mNum_old = \"\";\n posid_old = \"\";\n phone_old = \"\";\n phone2_old = \"\";\n birth_old = 0;\n\n memidChanged = false;\n changed = false;\n\n //\n // Truncate the string values to avoid sql error\n //\n if (!mi.equals( \"\" )) { // if mi specified\n\n mi = truncate(mi, 1); // make sure it is only 1 char\n }\n if (!memid.equals( \"\" )) {\n\n memid = truncate(memid, 15);\n }\n if (!password.equals( \"\" )) {\n\n password = truncate(password, 15);\n }\n if (!lname.equals( \"\" )) {\n\n lname = truncate(lname, 20);\n }\n if (!fname.equals( \"\" )) {\n\n fname = truncate(fname, 20);\n }\n if (!mship.equals( \"\" )) {\n\n mship = truncate(mship, 30);\n }\n if (!mtype.equals( \"\" )) {\n\n mtype = truncate(mtype, 30);\n }\n if (!email.equals( \"\" )) {\n\n email = truncate(email, 50);\n }\n if (!email2.equals( \"\" )) {\n\n email2 = truncate(email2, 50);\n }\n if (!mNum.equals( \"\" )) {\n\n mNum = truncate(mNum, 10);\n }\n if (!ghin.equals( \"\" )) {\n\n ghin = truncate(ghin, 16);\n }\n if (!bag.equals( \"\" )) {\n\n bag = truncate(bag, 12);\n }\n if (!posid.equals( \"\" )) {\n\n posid = truncate(posid, 15);\n }\n if (!phone.equals( \"\" )) {\n\n phone = truncate(phone, 24);\n }\n if (!phone2.equals( \"\" )) {\n\n phone2 = truncate(phone2, 24);\n }\n if (!suffix.equals( \"\" )) {\n\n suffix = truncate(suffix, 4);\n }\n\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, webid); // put the parm in stmt\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if(rs.next()) {\n\n memid_old = rs.getString(\"username\");\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n }\n pstmt2.close(); // close the stmt\n\n if (!fname_old.equals( \"\" )) { // if member found\n\n changed = false; // init change indicator\n\n memid_new = memid_old;\n\n if (!memid.equals( memid_old )) { // if username has changed\n\n memid_new = memid; // use new memid\n changed = true;\n memidChanged = true;\n }\n\n lname_new = lname_old;\n\n if (!lname.equals( \"\" ) && !lname_old.equals( lname )) {\n\n lname_new = lname; // set value from Flexscape record\n changed = true;\n }\n\n fname_new = fname_old;\n\n fname = fname_old; // DO NOT change first names\n\n/*\n if (!fname.equals( \"\" ) && !fname_old.equals( fname )) {\n\n fname_new = fname; // set value from Flexscape record\n changed = true;\n }\n*/\n\n mi_new = mi_old;\n\n if (!mi.equals( \"\" ) && !mi_old.equals( mi )) {\n\n mi_new = mi; // set value from Flexscape record\n changed = true;\n }\n\n mship_new = mship_old;\n\n if (mship_old.startsWith( \"Founding\" )) { // do not change if Founding ....\n\n mship = mship_old;\n\n } else {\n\n if (!mship_old.equals( mship )) { // if the mship has changed\n\n mship_new = mship; // set value from Flexscape record\n changed = true;\n }\n }\n\n mtype_new = mtype_old;\n\n if (!mtype.equals( \"\" ) && !mtype_old.equals( mtype )) {\n\n mtype_new = mtype; // set value from Flexscape record\n changed = true;\n }\n\n birth_new = birth_old;\n\n if (birth > 0 && birth != birth_old) {\n\n birth_new = birth; // set value from Flexscape record\n changed = true;\n }\n\n posid_new = posid_old;\n\n if (!posid.equals( \"\" ) && !posid_old.equals( posid )) {\n\n posid_new = posid; // set value from Flexscape record\n changed = true;\n }\n\n phone_new = phone_old;\n\n if (!phone.equals( \"\" ) && !phone_old.equals( phone )) {\n\n phone_new = phone; // set value from Flexscape record\n changed = true;\n }\n\n phone2_new = phone2_old;\n\n if (!phone2.equals( \"\" ) && !phone2_old.equals( phone2 )) {\n\n phone2_new = phone2; // set value from Flexscape record\n changed = true;\n }\n\n email_new = email_old; // do not change emails\n email2_new = email2_old;\n\n // don't allow both emails to be the same\n if (email_new.equalsIgnoreCase(email2_new)) email2_new = \"\";\n\n //\n // NOTE: mNums can change for this club!!\n //\n // DO NOT change the webid!!!!!!!!!\n //\n mNum_new = mNum_old;\n\n if (!mNum.equals( \"\" ) && !mNum_old.equals( mNum )) {\n\n mNum_new = mNum; // set value from Flexscape record\n\n //\n // mNum changed - change it for all records that match the old mNum.\n // This is because most dependents are not included in web site roster,\n // but are in our roster.\n //\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET memNum = ? \" +\n \"WHERE memNum = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, mNum_new);\n pstmt2.setString(2, mNum_old);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n }\n\n\n //\n // Update our record\n //\n if (changed == true) {\n\n modCount++; // count records changed\n }\n\n try {\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET username = ?, name_last = ?, name_first = ?, \" +\n \"name_mi = ?, m_ship = ?, m_type = ?, email = ?, \" +\n \"memNum = ?, birth = ?, posid = ?, phone1 = ?, \" +\n \"phone2 = ?, inact = 0, last_sync_date = now(), gender = ? \" +\n \"WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid_new);\n pstmt2.setString(2, lname_new);\n pstmt2.setString(3, fname_new);\n pstmt2.setString(4, mi_new);\n pstmt2.setString(5, mship_new);\n pstmt2.setString(6, mtype_new);\n pstmt2.setString(7, email_new);\n pstmt2.setString(8, mNum_new);\n pstmt2.setInt(9, birth_new);\n pstmt2.setString(10, posid_new);\n pstmt2.setString(11, phone_new);\n pstmt2.setString(12, phone2_new);\n pstmt2.setString(13, gender);\n pstmt2.setString(14, webid);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n }\n catch (Exception e9) {\n\n errorMsg = errorMsg + \" Error updating record (#\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e9.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n SystemUtils.logErrorToFile(\"UPDATE MYSQL ERROR!\", \"fourbridges\", true);\n }\n\n\n //\n // Now, update other tables if the username has changed\n //\n if (memidChanged == true) {\n\n StringBuffer mem_name = new StringBuffer( fname_new ); // get the new first name\n\n if (!mi_new.equals( \"\" )) {\n mem_name.append(\" \" +mi_new); // new mi\n }\n mem_name.append(\" \" +lname_new); // new last name\n\n String newName = mem_name.toString(); // convert to one string\n\n Admin_editmem.updTeecurr(newName, memid_new, memid_old, con); // update teecurr with new values\n\n Admin_editmem.updTeepast(newName, memid_new, memid_old, con); // update teepast with new values\n\n Admin_editmem.updLreqs(newName, memid_new, memid_old, con); // update lreqs with new values\n\n Admin_editmem.updPartner(memid_new, memid_old, con); // update partner with new values\n\n Admin_editmem.updEvents(newName, memid_new, memid_old, con); // update evntSignUp with new values\n\n Admin_editmem.updLessons(newName, memid_new, memid_old, con); // update the lesson books with new values\n }\n\n\n } else {\n\n //\n // New member - first check if name already exists\n //\n boolean dup = false;\n\n pstmt2 = con.prepareStatement (\n \"SELECT username FROM member2b WHERE name_last = ? AND name_first = ? AND name_mi = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, lname);\n pstmt2.setString(2, fname);\n pstmt2.setString(3, mi);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n dup = true;\n }\n pstmt2.close(); // close the stmt\n\n if (dup == false) {\n\n //\n // New member - add it\n //\n newCount++; // count records added\n\n try {\n\n pstmt2 = con.prepareStatement (\n \"INSERT INTO member2b (username, password, name_last, name_first, name_mi, \" +\n \"m_ship, m_type, email, count, c_hancap, g_hancap, wc, message, emailOpt, memNum, \" +\n \"ghin, locker, bag, birth, posid, msub_type, email2, phone1, phone2, name_pre, name_suf, \" +\n \"webid, last_sync_date, gender) \" +\n \"VALUES (?,?,?,?,?,?,?,?,0,?,?,'','',1,?,?,'',?,?,?,'',?,?,?,'',?,?,now(),?)\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n pstmt2.setString(2, password);\n pstmt2.setString(3, lname);\n pstmt2.setString(4, fname);\n pstmt2.setString(5, mi);\n pstmt2.setString(6, mship);\n pstmt2.setString(7, mtype);\n pstmt2.setString(8, email);\n pstmt2.setFloat(9, c_hcap);\n pstmt2.setFloat(10, u_hcap);\n pstmt2.setString(11, mNum);\n pstmt2.setString(12, ghin);\n pstmt2.setString(13, bag);\n pstmt2.setInt(14, birth);\n pstmt2.setString(15, posid);\n pstmt2.setString(16, email2);\n pstmt2.setString(17, phone);\n pstmt2.setString(18, phone2);\n pstmt2.setString(19, suffix);\n pstmt2.setString(20, webid);\n pstmt2.setString(21, gender);\n pstmt2.executeUpdate(); // execute the prepared stmt\n\n pstmt2.close(); // close the stmt\n\n }\n catch (Exception e8) {\n\n errorMsg = errorMsg + \" Error adding record (#\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e8.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n SystemUtils.logErrorToFile(\"INSERT MYSQL ERROR!\", \"fourbridges\", true);\n }\n\n } else { // Dup name\n\n // errorMsg = errorMsg + \" Duplicate Name found, name = \" +fname+ \" \" +lname+ \", record #\" +rcount+ \" for \" +club+ \", line = \" +line; // build msg\n // SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n SystemUtils.logErrorToFile(\"DUPLICATE NAME!\", \"fourbridges\", true);\n }\n }\n\n } // end of IF skip\n\n } // end of IF record valid (enough tokens)\n\n } else { // end of IF club = fourbridges\n\n // Remove the dbl quotes and check for embedded commas\n\n line = cleanRecord4( line );\n line = cleanRecord2( line );\n\n rcount++; // count the records\n\n // parse the line to gather all the info\n\n StringTokenizer tok = new StringTokenizer( line, \",\" ); // delimiters are comma\n\n if ( tok.countTokens() > 10 ) { // enough data ?\n\n webid = tok.nextToken();\n memid = tok.nextToken();\n tok.nextToken(); // eat this value, not used\n fname = tok.nextToken();\n mi = tok.nextToken();\n lname = tok.nextToken();\n gender = tok.nextToken();\n email = tok.nextToken();\n phone = tok.nextToken();\n phone2 = tok.nextToken();\n temp = tok.nextToken();\n primary = tok.nextToken();\n mship = tok.nextToken();\n\n mNum = \"\";\n suffix = \"\";\n mtype = \"\";\n email2 = \"\";\n bag = \"\";\n ghin = \"\";\n u_hndcp = \"\";\n c_hndcp = \"\";\n posid = \"\";\n mobile = \"\";\n active = \"\";\n\n //\n // Check for ? (not provided)\n //\n if (webid.equals( \"?\" )) {\n\n webid = \"\";\n }\n if (memid.equals( \"?\" )) {\n\n memid = \"\";\n }\n if (fname.equals( \"?\" )) {\n\n fname = \"\";\n }\n if (mi.equals( \"?\" )) {\n\n mi = \"\";\n }\n if (lname.equals( \"?\" )) {\n\n lname = \"\";\n }\n if (mship.equals( \"?\" )) {\n\n mship = \"\";\n }\n if (gender.equals( \"?\" )) {\n\n gender = \"\";\n }\n if (email.equals( \"?\" )) {\n\n email = \"\";\n }\n if (phone.equals( \"?\" )) {\n\n phone = \"\";\n }\n if (phone2.equals( \"?\" )) {\n\n phone2 = \"\";\n }\n if (temp.equals( \"?\" ) || temp.equals( \"0\" )) {\n\n temp = \"\";\n }\n if (primary.equals( \"?\" )) {\n\n primary = \"\";\n }\n\n //\n // Determine if we should process this record (does it meet the minimum requirements?)\n //\n if (!webid.equals( \"\" ) && !memid.equals( \"\" ) && !lname.equals( \"\" ) && !fname.equals( \"\" )) {\n\n //\n // Remove spaces, etc. from name fields\n //\n tok = new StringTokenizer( fname, \" \" ); // delimiters are space\n\n fname = tok.nextToken(); // remove any spaces and middle name\n\n if ( tok.countTokens() > 0 ) {\n\n mi = tok.nextToken(); // over-write mi if already there\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n tok = new StringTokenizer( suffix, \" \" ); // delimiters are space\n\n suffix = tok.nextToken(); // remove any extra (only use one value)\n }\n\n tok = new StringTokenizer( lname, \" \" ); // delimiters are space\n\n lname = tok.nextToken(); // remove suffix and spaces\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n lname = lname + \"_\" + suffix; // append suffix to last name\n\n } else { // sufix after last name ?\n\n if ( tok.countTokens() > 0 ) {\n\n suffix = tok.nextToken();\n lname = lname + \"_\" + suffix; // append suffix to last name\n }\n }\n\n //\n // Determine the handicaps\n //\n u_hcap = -99; // indicate no hndcp\n c_hcap = -99; // indicate no c_hndcp\n\n\n //\n // convert birth date (mm/dd/yyyy to yyyymmdd)\n //\n birth = 0;\n\n if (!temp.equals( \"\" )) {\n\n String b1 = \"\";\n String b2 = \"\";\n String b3 = \"\";\n int mm = 0;\n int dd = 0;\n int yy = 0;\n\n tok = new StringTokenizer( temp, \"/-\" ); // delimiters are / & -\n\n if ( tok.countTokens() > 2 ) {\n\n b1 = tok.nextToken();\n b2 = tok.nextToken();\n b3 = tok.nextToken();\n\n mm = Integer.parseInt(b1);\n dd = Integer.parseInt(b2);\n yy = Integer.parseInt(b3);\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n\n } else { // try 'Jan 20, 1951' format\n\n tok = new StringTokenizer( temp, \", \" ); // delimiters are comma and space\n\n if ( tok.countTokens() > 2 ) {\n\n b1 = tok.nextToken();\n b2 = tok.nextToken();\n b3 = tok.nextToken();\n\n if (b1.startsWith( \"Jan\" )) {\n mm = 1;\n } else {\n if (b1.startsWith( \"Feb\" )) {\n mm = 2;\n } else {\n if (b1.startsWith( \"Mar\" )) {\n mm = 3;\n } else {\n if (b1.startsWith( \"Apr\" )) {\n mm = 4;\n } else {\n if (b1.startsWith( \"May\" )) {\n mm = 5;\n } else {\n if (b1.startsWith( \"Jun\" )) {\n mm = 6;\n } else {\n if (b1.startsWith( \"Jul\" )) {\n mm = 7;\n } else {\n if (b1.startsWith( \"Aug\" )) {\n mm = 8;\n } else {\n if (b1.startsWith( \"Sep\" )) {\n mm = 9;\n } else {\n if (b1.startsWith( \"Oct\" )) {\n mm = 10;\n } else {\n if (b1.startsWith( \"Nov\" )) {\n mm = 11;\n } else {\n if (b1.startsWith( \"Dec\" )) {\n mm = 12;\n } else {\n mm = Integer.parseInt(b1);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n dd = Integer.parseInt(b2);\n yy = Integer.parseInt(b3);\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n }\n }\n }\n\n password = lname;\n\n //\n // if lname is less than 4 chars, fill with 1's\n //\n int length = password.length();\n\n while (length < 4) {\n\n password = password + \"1\";\n length++;\n }\n\n //\n // Verify the email addresses\n //\n if (!email.equals( \"\" )) { // if specified\n\n email = email.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email));\n\n if (!feedback.isPositive()) { // if error\n\n email = \"\"; // do not use it\n }\n }\n if (!email2.equals( \"\" )) { // if specified\n\n email2 = email2.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email2));\n\n if (!feedback.isPositive()) { // if error\n\n email2 = \"\"; // do not use it\n }\n }\n\n // if email #1 is empty then assign email #2 to it\n if (email.equals(\"\")) email = email2;\n\n\n //*********************************************\n // Start of club specific processing\n //*********************************************\n\n\n //******************************************************************\n // Ocean Reef - oceanreef\n //******************************************************************\n //\n if (club.equals( \"oceanreef\" )) {\n\n found = true; // club found\n \n //\n // Determine if we should process this record\n //\n if (!webid.equals( \"\" )) { // must have a webid\n\n mNum = memid;\n //\n\n posid = mNum;\n\n\n if (primary.equals( \"\" )) {\n\n primary = \"0\";\n }\n\n if (mNum.endsWith(\"-000\")) {\n primary = \"0\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n gender = \"M\";\n mtype = \"Primary Male\";\n }\n } else if (mNum.endsWith(\"-001\")) {\n primary = \"1\";\n if (gender.equalsIgnoreCase(\"M\")) {\n mtype = \"Spouse Male\";\n } else {\n gender = \"F\";\n mtype = \"Spouse Female\";\n }\n } else if (mNum.endsWith(\"-002\")) {\n primary = \"2\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Family Female\";\n } else {\n gender = \"M\";\n mtype = \"Family Male\";\n }\n } else {\n skip = true;\n SystemUtils.logErrorToFile(\"DEPENDENT MSHIP - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + work, \"oceanreef\", true);\n }\n\n mNum = mNum.substring(0, mNum.length() - 4);\n\n if (mship.equals(\"100\") || mship.equals(\"105\") || mship.equals(\"109\") || mship.equals(\"110\") || mship.equals(\"115\") ||\n mship.equals(\"150\") || mship.equals(\"159\") || mship.equals(\"160\") || mship.equals(\"180\") || mship.equals(\"199\") ||\n mship.equals(\"300\") || mship.equals(\"360\")) {\n mship = \"Social\";\n } else if (mship.equals(\"101\")) {\n mship = \"Multi-Game Card\";\n } else if (mship.equals(\"102\")) {\n mship = \"Summer Option\";\n } else if (mship.equals(\"130\")) {\n mship = \"Social Legacy\";\n } else if (mship.equals(\"400\") || mship.equals(\"450\") || mship.equals(\"460\") || mship.equals(\"480\")) {\n mship = \"Charter\";\n } else if (mship.equals(\"420\") || mship.equals(\"430\")) {\n mship = \"Charter Legacy\";\n } else if (mship.equals(\"401\")) {\n mship = \"Charter w/Trail Pass\";\n } else if (mship.equals(\"500\") || mship.equals(\"540\") || mship.equals(\"580\")) {\n mship = \"Patron\";\n } else if (mship.equals(\"520\") || mship.equals(\"530\")) {\n mship = \"Patron Legacy\";\n } else if (mship.equals(\"800\") || mship.equals(\"801\") || mship.equals(\"860\") || mship.equals(\"880\")) {\n mship = \"Other\";\n } else {\n skip = true;\n SystemUtils.logErrorToFile(\"MSHIP NON-GOLF OR UNKNOWN TYPE - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + work, club, true);\n }\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip record if mship not one of above\n SystemUtils.logErrorToFile(\"MSHIP MISSING - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + work, club, true);\n }\n\n } else {\n\n skip = true; // skip record if webid not provided\n SystemUtils.logErrorToFile(\"WEBID MISSING - SKIPPED\", club, true);\n }\n } // end of if oceanreef\n\n\n //******************************************************************\n // Colorado Springs CC - coloradospringscountryclub\n //******************************************************************\n //\n if (club.equals( \"coloradospringscountryclub\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip record if mship not one of above\n SystemUtils.logErrorToFile(\"MSHIP MISSING - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + work, club, true);\n \n } else if (webid.equals(\"\")) {\n\n skip = true; // skip record if webid not provided\n SystemUtils.logErrorToFile(\"WEBID MISSING - SKIPPED\", club, true);\n \n } else {\n\n while (memid.startsWith(\"0\")) {\n memid = memid.substring(1);\n }\n\n mNum = memid;\n\n posid = mNum;\n\n while (posid.length() < 8) {\n posid = \"0\" + posid;\n }\n\n primary = mNum.substring(mNum.length() - 1);\n\n if (mNum.endsWith(\"-000\") || mNum.endsWith(\"-001\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n } else if (mNum.endsWith(\"-002\") || mNum.endsWith(\"-003\") || mNum.endsWith(\"-004\") || mNum.endsWith(\"-005\") ||\n mNum.endsWith(\"-006\") || mNum.endsWith(\"-007\") || mNum.endsWith(\"-008\") || mNum.endsWith(\"-009\")) {\n\n mtype = \"Youth\";\n }\n\n mNum = mNum.substring(0, mNum.length() - 4);\n\n if (mship.equalsIgnoreCase(\"Recreational\") || mship.equalsIgnoreCase(\"Clubhouse\")) {\n\n skip = true; // skip record if webid not provided\n SystemUtils.logErrorToFile(\"NON-GOLF MEMBERSHIP TYPE - SKIPPED\", club, true);\n }\n \n }\n } // end of if coloradospringscountryclub\n\n //*********************************************\n // End of club specific processing\n //*********************************************\n\n } else {\n\n skip = true; // skip record if memid or name not provided\n SystemUtils.logErrorToFile(\"USERNAME/NAME MISSING - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + memid, club, true);\n\n } // end of IF minimum requirements met (memid, etc)\n\n\n\n //\n //******************************************************************\n // Common processing - add or update the member record\n //******************************************************************\n //\n if (skip == false && found == true && !fname.equals(\"\") && !lname.equals(\"\")) {\n\n //\n // now determine if we should update an existing record or add the new one\n //\n memid_old = \"\";\n fname_old = \"\";\n lname_old = \"\";\n mi_old = \"\";\n mship_old = \"\";\n mtype_old = \"\";\n email_old = \"\";\n mNum_old = \"\";\n posid_old = \"\";\n phone_old = \"\";\n phone2_old = \"\";\n birth_old = 0;\n\n memidChanged = false;\n changed = false;\n\n //\n // Truncate the string values to avoid sql error\n //\n if (!mi.equals( \"\" )) { // if mi specified\n\n mi = truncate(mi, 1); // make sure it is only 1 char\n }\n if (!memid.equals( \"\" )) {\n\n memid = truncate(memid, 15);\n }\n if (!password.equals( \"\" )) {\n\n password = truncate(password, 15);\n }\n if (!lname.equals( \"\" )) {\n\n lname = truncate(lname, 20);\n }\n if (!fname.equals( \"\" )) {\n\n fname = truncate(fname, 20);\n }\n if (!mship.equals( \"\" )) {\n\n mship = truncate(mship, 30);\n }\n if (!mtype.equals( \"\" )) {\n\n mtype = truncate(mtype, 30);\n }\n if (!email.equals( \"\" )) {\n\n email = truncate(email, 50);\n }\n if (!email2.equals( \"\" )) {\n\n email2 = truncate(email2, 50);\n }\n if (!mNum.equals( \"\" )) {\n\n mNum = truncate(mNum, 10);\n }\n if (!ghin.equals( \"\" )) {\n\n ghin = truncate(ghin, 16);\n }\n if (!bag.equals( \"\" )) {\n\n bag = truncate(bag, 12);\n }\n if (!posid.equals( \"\" )) {\n\n posid = truncate(posid, 15);\n }\n if (!phone.equals( \"\" )) {\n\n phone = truncate(phone, 24);\n }\n if (!phone2.equals( \"\" )) {\n\n phone2 = truncate(phone2, 24);\n }\n if (!suffix.equals( \"\" )) {\n\n suffix = truncate(suffix, 4);\n }\n\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, webid); // put the parm in stmt\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if(rs.next()) {\n\n memid_old = rs.getString(\"username\");\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n }\n pstmt2.close(); // close the stmt\n\n if (!fname_old.equals( \"\" )) { // if member found\n\n changed = false; // init change indicator\n\n memid_new = memid_old;\n\n if (!memid.equals( memid_old )) { // if username has changed\n\n memid_new = memid; // use new memid\n changed = true;\n memidChanged = true;\n }\n\n lname_new = lname_old;\n\n if (!lname.equals( \"\" ) && !lname_old.equals( lname )) {\n\n lname_new = lname; // set value from Flexscape record\n changed = true;\n }\n\n fname_new = fname_old;\n\n fname = fname_old; // DO NOT change first names\n\n/*\n if (!fname.equals( \"\" ) && !fname_old.equals( fname )) {\n\n fname_new = fname; // set value from Flexscape record\n changed = true;\n }\n*/\n mi_new = mi_old;\n\n if (!mi.equals( \"\" ) && !mi_old.equals( mi )) {\n\n mi_new = mi; // set value from Flexscape record\n changed = true;\n }\n\n mship_new = mship_old;\n\n if (!mship_old.equals( mship )) { // if the mship has changed\n\n mship_new = mship; // set value from Flexscape record\n changed = true;\n }\n\n mtype_new = mtype_old;\n\n if (!mtype.equals( \"\" ) && !mtype_old.equals( mtype )) {\n mtype_new = mtype; // set value from Flexscape record\n changed = true;\n }\n\n if (birth > 0 && birth != birth_old) {\n\n birth_new = birth; // set value from Flexscape record\n changed = true;\n }\n\n posid_new = posid_old;\n\n if (!posid.equals( \"\" ) && !posid_old.equals( posid )) {\n\n posid_new = posid; // set value from Flexscape record\n changed = true;\n }\n\n phone_new = phone_old;\n\n if (!phone.equals( \"\" ) && !phone_old.equals( phone )) {\n\n phone_new = phone; // set value from Flexscape record\n changed = true;\n }\n\n phone2_new = phone2_old;\n\n if (!phone2.equals( \"\" ) && !phone2_old.equals( phone2 )) {\n\n phone2_new = phone2; // set value from Flexscape record\n changed = true;\n }\n\n email_new = email_old; // do not change emails\n email2_new = email2_old;\n\n // don't allow both emails to be the same\n if (email_new.equalsIgnoreCase(email2_new)) email2_new = \"\";\n\n //\n // NOTE: mNums can change for this club!!\n //\n // DO NOT change the webid!!!!!!!!!\n //\n mNum_new = mNum_old;\n\n if (!mNum.equals( \"\" ) && !mNum_old.equals( mNum )) {\n\n mNum_new = mNum; // set value from Flexscape record\n\n //\n // mNum changed - change it for all records that match the old mNum.\n // This is because most dependents are not included in web site roster,\n // but are in our roster.\n //\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET memNum = ? \" +\n \"WHERE memNum = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, mNum_new);\n pstmt2.setString(2, mNum_old);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n }\n\n\n //\n // Update our record\n //\n if (changed == true) {\n\n modCount++; // count records changed\n }\n\n try {\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET username = ?, name_last = ?, name_first = ?, \" +\n \"name_mi = ?, m_ship = ?, m_type = ?, email = ?, \" +\n \"memNum = ?, birth = ?, posid = ?, phone1 = ?, \" +\n \"phone2 = ?, inact = 0, last_sync_date = now(), gender = ? \" +\n \"WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid_new);\n pstmt2.setString(2, lname_new);\n pstmt2.setString(3, fname_new);\n pstmt2.setString(4, mi_new);\n pstmt2.setString(5, mship_new);\n pstmt2.setString(6, mtype_new);\n pstmt2.setString(7, email_new);\n pstmt2.setString(8, mNum_new);\n pstmt2.setInt(9, birth_new);\n pstmt2.setString(10, posid_new);\n pstmt2.setString(11, phone_new);\n pstmt2.setString(12, phone2_new);\n pstmt2.setString(13, gender);\n pstmt2.setString(14, webid);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n }\n catch (Exception e9) {\n\n errorMsg = errorMsg + \" Error updating record (#\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e9.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n SystemUtils.logErrorToFile(\"UPDATE MYSQL ERROR!\", club, true);\n }\n\n\n //\n // Now, update other tables if the username has changed\n //\n if (memidChanged == true) {\n\n StringBuffer mem_name = new StringBuffer( fname_new ); // get the new first name\n\n if (!mi_new.equals( \"\" )) {\n mem_name.append(\" \" +mi_new); // new mi\n }\n mem_name.append(\" \" +lname_new); // new last name\n\n String newName = mem_name.toString(); // convert to one string\n\n Admin_editmem.updTeecurr(newName, memid_new, memid_old, con); // update teecurr with new values\n\n Admin_editmem.updTeepast(newName, memid_new, memid_old, con); // update teepast with new values\n\n Admin_editmem.updLreqs(newName, memid_new, memid_old, con); // update lreqs with new values\n\n Admin_editmem.updPartner(memid_new, memid_old, con); // update partner with new values\n\n Admin_editmem.updEvents(newName, memid_new, memid_old, con); // update evntSignUp with new values\n\n Admin_editmem.updLessons(newName, memid_new, memid_old, con); // update the lesson books with new values\n }\n\n\n } else {\n\n //\n // New member - first check if name already exists\n //\n boolean dup = false;\n\n pstmt2 = con.prepareStatement (\n \"SELECT username FROM member2b WHERE name_last = ? AND name_first = ? AND name_mi = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, lname);\n pstmt2.setString(2, fname);\n pstmt2.setString(3, mi);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n dup = true;\n }\n pstmt2.close(); // close the stmt\n\n if (dup == false) {\n\n //\n // New member - add it\n //\n newCount++; // count records added\n\n try {\n\n pstmt2 = con.prepareStatement (\n \"INSERT INTO member2b (username, password, name_last, name_first, name_mi, \" +\n \"m_ship, m_type, email, count, c_hancap, g_hancap, wc, message, emailOpt, memNum, \" +\n \"ghin, locker, bag, birth, posid, msub_type, email2, phone1, phone2, name_pre, name_suf, \" +\n \"webid, last_sync_date, gender) \" +\n \"VALUES (?,?,?,?,?,?,?,?,0,?,?,'','',1,?,?,'',?,?,?,'',?,?,?,'',?,?,now(),?)\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n pstmt2.setString(2, password);\n pstmt2.setString(3, lname);\n pstmt2.setString(4, fname);\n pstmt2.setString(5, mi);\n pstmt2.setString(6, mship);\n pstmt2.setString(7, mtype);\n pstmt2.setString(8, email);\n pstmt2.setFloat(9, c_hcap);\n pstmt2.setFloat(10, u_hcap);\n pstmt2.setString(11, mNum);\n pstmt2.setString(12, ghin);\n pstmt2.setString(13, bag);\n pstmt2.setInt(14, birth);\n pstmt2.setString(15, posid);\n pstmt2.setString(16, email2);\n pstmt2.setString(17, phone);\n pstmt2.setString(18, phone2);\n pstmt2.setString(19, suffix);\n pstmt2.setString(20, webid);\n pstmt2.setString(21, gender);\n pstmt2.executeUpdate(); // execute the prepared stmt\n\n pstmt2.close(); // close the stmt\n\n }\n catch (Exception e8) {\n\n errorMsg = errorMsg + \" Error adding record (#\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e8.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n SystemUtils.logErrorToFile(\"INSERT MYSQL ERROR! - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + memid, club, true);\n }\n\n } else { // Dup name\n\n // errorMsg = errorMsg + \" Duplicate Name found, name = \" +fname+ \" \" +lname+ \", record #\" +rcount+ \" for \" +club+ \", line = \" +line; // build msg\n // SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n SystemUtils.logErrorToFile(\"DUPLICATE NAME! - SKIPPED - name: \" + lname + \", \" + fname + \" - \" + memid, club, true);\n }\n }\n } // end of IF skip\n } // end of IF record valid (enough tokens)\n }\n\n/*\n // FIX the mship types and have them add gender!!!!!!!!!!!!!!!!!!!!!!!!\n //\n // Scitot Reserve\n //\n if (club.equals( \"sciotoreserve\" )) {\n\n found = true; // club found\n\n // Remove the dbl quotes and check for embedded commas\n\n line = cleanRecord2( line );\n\n rcount++; // count the records\n\n // parse the line to gather all the info\n\n StringTokenizer tok = new StringTokenizer( line, \",\" ); // delimiters are comma\n\n if ( tok.countTokens() > 10 ) { // enough data ?\n\n webid = tok.nextToken();\n memid = tok.nextToken();\n fname = tok.nextToken();\n mi = tok.nextToken();\n lname = tok.nextToken();\n gender = tok.nextToken();\n email = tok.nextToken();\n phone = tok.nextToken();\n phone2 = tok.nextToken();\n temp = tok.nextToken();\n primary = tok.nextToken();\n\n mNum = \"\";\n suffix = \"\";\n mship = \"\";\n mtype = \"\";\n email2 = \"\";\n bag = \"\";\n ghin = \"\";\n u_hndcp = \"\";\n c_hndcp = \"\";\n posid = \"\";\n mobile = \"\";\n active = \"\";\n\n //\n // Check for ? (not provided)\n //\n if (memid.equals( \"?\" )) {\n\n memid = \"\";\n }\n if (fname.equals( \"?\" )) {\n\n fname = \"\";\n }\n if (mi.equals( \"?\" )) {\n\n mi = \"\";\n }\n if (lname.equals( \"?\" )) {\n\n lname = \"\";\n }\n if (gender.equals( \"?\" )) {\n\n gender = \"\";\n }\n if (email.equals( \"?\" )) {\n\n email = \"\";\n }\n if (phone.equals( \"?\" )) {\n\n phone = \"\";\n }\n if (phone2.equals( \"?\" )) {\n\n phone2 = \"\";\n }\n if (temp.equals( \"?\" ) || temp.equals( \"0\" )) {\n\n temp = \"\";\n }\n if (primary.equals( \"?\" )) {\n\n primary = \"\";\n }\n\n //\n // Determine if we should process this record (does it meet the minimum requirements?)\n //\n if (!memid.equals( \"\" ) && !lname.equals( \"\" ) && !fname.equals( \"\" )) {\n\n //\n // Remove spaces, etc. from name fields\n //\n tok = new StringTokenizer( fname, \" \" ); // delimiters are space\n\n fname = tok.nextToken(); // remove any spaces and middle name\n\n if ( tok.countTokens() > 0 ) {\n\n mi = tok.nextToken(); // over-write mi if already there\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n tok = new StringTokenizer( suffix, \" \" ); // delimiters are space\n\n suffix = tok.nextToken(); // remove any extra (only use one value)\n }\n\n tok = new StringTokenizer( lname, \" \" ); // delimiters are space\n\n lname = tok.nextToken(); // remove suffix and spaces\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n lname = lname + \"_\" + suffix; // append suffix to last name\n\n } else { // sufix after last name ?\n\n if ( tok.countTokens() > 0 ) {\n\n suffix = tok.nextToken();\n lname = lname + \"_\" + suffix; // append suffix to last name\n }\n }\n\n //\n // Determine the handicaps\n //\n u_hcap = -99; // indicate no hndcp\n c_hcap = -99; // indicate no c_hndcp\n\n\n //\n // convert birth date (mm/dd/yyyy to yyyymmdd)\n //\n if (!temp.equals( \"\" )) {\n\n tok = new StringTokenizer( temp, \"/-\" ); // delimiters are / & -\n\n String b1 = tok.nextToken();\n String b2 = tok.nextToken();\n String b3 = tok.nextToken();\n\n int mm = Integer.parseInt(b1);\n int dd = Integer.parseInt(b2);\n int yy = Integer.parseInt(b3);\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n\n } else {\n\n birth = 0;\n }\n\n password = lname;\n\n //\n // if lname is less than 4 chars, fill with 1's\n //\n int length = password.length();\n\n while (length < 4) {\n\n password = password + \"1\";\n length++;\n }\n\n //\n // Verify the email addresses\n //\n if (!email.equals( \"\" )) { // if specified\n\n email = email.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email));\n\n if (!feedback.isPositive()) { // if error\n\n email = \"\"; // do not use it\n }\n }\n if (!email2.equals( \"\" )) { // if specified\n\n email2 = email2.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email2));\n\n if (!feedback.isPositive()) { // if error\n\n email2 = \"\"; // do not use it\n }\n }\n\n // if email #1 is empty then assign email #2 to it\n if (email.equals(\"\")) email = email2;\n\n //\n // Determine if we should process this record\n //\n if (!webid.equals( \"\" )) { // must have a webid\n\n mNum = memid;\n\n posid = memid;\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username !!\n\n\n if (gender.equals( \"\" )) {\n\n gender = \"M\";\n }\n if (primary.equals( \"\" )) {\n\n primary = \"0\";\n }\n\n //\n // Determine mtype value\n //\n if (gender.equalsIgnoreCase( \"M\" )) {\n\n if (primary.equalsIgnoreCase( \"0\" )) {\n\n mtype = \"Main Male\";\n\n } else {\n\n if (primary.equalsIgnoreCase( \"1\" )) {\n\n mtype = \"Spouse Male\";\n\n } else {\n\n mtype = \"Junior Male\";\n }\n }\n\n } else { // Female\n\n if (primary.equalsIgnoreCase( \"0\" )) {\n\n mtype = \"Main Female\";\n\n } else {\n\n if (primary.equalsIgnoreCase( \"1\" )) {\n\n mtype = \"Spouse Female\";\n\n } else {\n\n mtype = \"Junior Female\";\n }\n }\n }\n\n //\n // Determine mship value ?????????????????\n //\n work = Integer.parseInt(mNum); // create int for compares\n\n mship = \"\";\n\n if (work < 1000) { // 0001 - 0999 (see 7xxx below also)\n\n mship = \"Full Family Golf\";\n\n } else {\n\n if (work < 1500) { // 1000 - 1499\n\n mship = \"Individual Golf\";\n\n } else {\n\n if (work < 2000) { // 1500 - 1999\n\n mship = \"Individual Golf Plus\";\n\n } else {\n\n if (work > 2999 && work < 4000) { // 3000 - 3999\n\n mship = \"Corporate Golf\";\n\n } else {\n\n if (work > 3999 && work < 5000) { // 4000 - 4999\n\n mship = \"Sports\";\n\n } else {\n\n if (work > 6499 && work < 6600) { // 6500 - 6599\n\n mship = \"Player Development\";\n\n } else {\n\n if (work > 7002 && work < 7011) { // 7003 - 7010\n\n mship = \"Harpors Point\";\n\n if (work == 7004 || work == 7008 || work == 7009) { // 7004, 7008 or 7009\n\n mship = \"Full Family Golf\";\n }\n\n } else {\n\n if (work > 8999 && work < 10000) { // 9000 - 9999\n\n mship = \"Employees\";\n mtype = \"Employee\"; // override mtype for employees\n }\n }\n }\n }\n }\n }\n }\n }\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip record if mship not one of above\n }\n\n } else {\n\n skip = true; // skip record if webid not provided\n }\n\n } else {\n\n skip = true; // skip record if memid or name not provided\n\n } // end of IF minimum requirements met (memid, etc)\n\n\n\n //\n //******************************************************************\n // Common processing - add or update the member record\n //******************************************************************\n //\n if (skip == false && found == true && !fname.equals(\"\") && !lname.equals(\"\")) {\n\n //\n // now determine if we should update an existing record or add the new one\n //\n fname_old = \"\";\n lname_old = \"\";\n mi_old = \"\";\n mship_old = \"\";\n mtype_old = \"\";\n email_old = \"\";\n mNum_old = \"\";\n posid_old = \"\";\n phone_old = \"\";\n phone2_old = \"\";\n birth_old = 0;\n\n\n //\n // Truncate the string values to avoid sql error\n //\n if (!mi.equals( \"\" )) { // if mi specified\n\n mi = truncate(mi, 1); // make sure it is only 1 char\n }\n if (!memid.equals( \"\" )) {\n\n memid = truncate(memid, 15);\n }\n if (!password.equals( \"\" )) {\n\n password = truncate(password, 15);\n }\n if (!lname.equals( \"\" )) {\n\n lname = truncate(lname, 20);\n }\n if (!fname.equals( \"\" )) {\n\n fname = truncate(fname, 20);\n }\n if (!mship.equals( \"\" )) {\n\n mship = truncate(mship, 30);\n }\n if (!mtype.equals( \"\" )) {\n\n mtype = truncate(mtype, 30);\n }\n if (!email.equals( \"\" )) {\n\n email = truncate(email, 50);\n }\n if (!email2.equals( \"\" )) {\n\n email2 = truncate(email2, 50);\n }\n if (!mNum.equals( \"\" )) {\n\n mNum = truncate(mNum, 10);\n }\n if (!ghin.equals( \"\" )) {\n\n ghin = truncate(ghin, 16);\n }\n if (!bag.equals( \"\" )) {\n\n bag = truncate(bag, 12);\n }\n if (!posid.equals( \"\" )) {\n\n posid = truncate(posid, 15);\n }\n if (!phone.equals( \"\" )) {\n\n phone = truncate(phone, 24);\n }\n if (!phone2.equals( \"\" )) {\n\n phone2 = truncate(phone2, 24);\n }\n if (!suffix.equals( \"\" )) {\n\n suffix = truncate(suffix, 4);\n }\n\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, webid); // put the parm in stmt\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if(rs.next()) {\n\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n }\n pstmt2.close(); // close the stmt\n\n if (!fname_old.equals( \"\" )) { // if member found\n\n changed = false; // init change indicator\n\n lname_new = lname_old;\n\n if (!lname.equals( \"\" ) && !lname_old.equals( lname )) {\n\n lname_new = lname; // set value from Flexscape record\n changed = true;\n }\n\n fname_new = fname_old;\n\n fname = fname_old; // DO NOT change first names\n\n if (!fname.equals( \"\" ) && !fname_old.equals( fname )) {\n\n fname_new = fname; // set value from Flexscape record\n changed = true;\n }\n\n mi_new = mi_old;\n\n if (!mi.equals( \"\" ) && !mi_old.equals( mi )) {\n\n mi_new = mi; // set value from Flexscape record\n changed = true;\n }\n\n mship_new = mship_old;\n\n if (mship_old.startsWith( \"Founding\" )) { // do not change if Founding ....\n\n mship = mship_old;\n\n } else {\n\n if (!mship_old.equals( mship )) { // if the mship has changed\n\n mship_new = mship; // set value from Flexscape record\n changed = true;\n }\n }\n\n mtype_new = mtype_old;\n\n if (!mtype.equals( \"\" ) && !mtype_old.equals( mtype )) {\n\n mtype_new = mtype; // set value from Flexscape record\n changed = true;\n }\n\n birth_new = birth_old;\n\n if (birth > 0 && birth != birth_old) {\n\n birth_new = birth; // set value from Flexscape record\n changed = true;\n }\n\n posid_new = posid_old;\n\n if (!posid.equals( \"\" ) && !posid_old.equals( posid )) {\n\n posid_new = posid; // set value from Flexscape record\n changed = true;\n }\n\n phone_new = phone_old;\n\n if (!phone.equals( \"\" ) && !phone_old.equals( phone )) {\n\n phone_new = phone; // set value from Flexscape record\n changed = true;\n }\n\n phone2_new = phone2_old;\n\n if (!phone2.equals( \"\" ) && !phone2_old.equals( phone2 )) {\n\n phone2_new = phone2; // set value from Flexscape record\n changed = true;\n }\n\n email_new = email_old; // do not change emails\n email2_new = email2_old;\n\n // don't allow both emails to be the same\n if (email_new.equalsIgnoreCase(email2_new)) email2_new = \"\";\n\n //\n // NOTE: mNums can change for this club!! This will also result in a different memid!!\n //\n // DO NOT change the memid or webid!!!!!!!!!\n //\n mNum_new = mNum_old;\n\n if (!mNum.equals( \"\" ) && !mNum_old.equals( mNum )) {\n\n mNum_new = mNum; // set value from Flexscape record\n\n //\n // mNum changed - change it for all records that match the old mNum.\n // This is because most dependents are not included in web site roster,\n // but are in our roster.\n //\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET memNum = ? \" +\n \"WHERE memNum = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, mNum_new);\n pstmt2.setString(2, mNum_old);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n }\n\n\n //\n // Update our record\n //\n if (changed == true) {\n\n modCount++; // count records changed\n }\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET name_last = ?, name_first = ?, \" +\n \"name_mi = ?, m_ship = ?, m_type = ?, email = ?, \" +\n \"memNum = ?, birth = ?, posid = ?, phone1 = ?, \" +\n \"phone2 = ?, inact = 0, last_sync_date = now() \" +\n \"WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, lname_new);\n pstmt2.setString(2, fname_new);\n pstmt2.setString(3, mi_new);\n pstmt2.setString(4, mship_new);\n pstmt2.setString(5, mtype_new);\n pstmt2.setString(6, email_new);\n pstmt2.setString(7, mNum_new);\n pstmt2.setInt(8, birth_new);\n pstmt2.setString(9, posid_new);\n pstmt2.setString(10, phone_new);\n pstmt2.setString(11, phone2_new);\n pstmt2.setString(12, webid);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n } else {\n\n //\n // New member - first check if name already exists\n //\n boolean dup = false;\n\n pstmt2 = con.prepareStatement (\n \"SELECT username FROM member2b WHERE name_last = ? AND name_first = ? AND name_mi = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, lname);\n pstmt2.setString(2, fname);\n pstmt2.setString(3, mi);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n dup = true;\n }\n pstmt2.close(); // close the stmt\n\n if (dup == false) {\n\n //\n // New member - add it\n //\n newCount++; // count records added\n\n pstmt2 = con.prepareStatement (\n \"INSERT INTO member2b (username, password, name_last, name_first, name_mi, \" +\n \"m_ship, m_type, email, count, c_hancap, g_hancap, wc, message, emailOpt, memNum, \" +\n \"ghin, locker, bag, birth, posid, msub_type, email2, phone1, phone2, name_pre, name_suf, webid, \" +\n \"last_sync_date) \" +\n \"VALUES (?,?,?,?,?,?,?,?,0,?,?,'','',1,?,?,'',?,?,?,'',?,?,?,'',?,?,now())\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n pstmt2.setString(2, password);\n pstmt2.setString(3, lname);\n pstmt2.setString(4, fname);\n pstmt2.setString(5, mi);\n pstmt2.setString(6, mship);\n pstmt2.setString(7, mtype);\n pstmt2.setString(8, email);\n pstmt2.setFloat(9, c_hcap);\n pstmt2.setFloat(10, u_hcap);\n pstmt2.setString(11, mNum);\n pstmt2.setString(12, ghin);\n pstmt2.setString(13, bag);\n pstmt2.setInt(14, birth);\n pstmt2.setString(15, posid);\n pstmt2.setString(16, email2);\n pstmt2.setString(17, phone);\n pstmt2.setString(18, phone2);\n pstmt2.setString(19, suffix);\n pstmt2.setString(20, webid);\n pstmt2.executeUpdate(); // execute the prepared stmt\n\n pstmt2.close(); // close the stmt\n }\n }\n\n } // end of IF skip\n\n } // end of IF record valid (enough tokens)\n\n } // end of IF club = ????\n*/\n\n } // end of IF header row\n\n } // end of while\n\n //\n // Done with this file for this club - now set any members that were excluded from this file inactive\n //\n if (found == true) { // if we processed this club\n\n // Set anyone inactive that didn't sync, but has at one point. (Not sure why this was turned off for all flexscape clubs, fourbridges requested it be turned back on.\n if (club.equals(\"fourbridges\") || club.equals(\"coloradospringscountryclub\")) {\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET inact = 1 \" +\n \"WHERE last_sync_date != now() AND last_sync_date != '0000-00-00'\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n \n \n //\n // Roster File Found for this club - make sure the roster sync indicator is set in the club table\n //\n setRSind(con, club);\n }\n }\n\n }\n catch (Exception e3) {\n\n errorMsg = errorMsg + \" Error processing roster (record #\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e3.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.flexSync: \";\n }\n\n }", "public void saveStage1(String format)\n {\n super.saveStage1(format);\n try{\n writer.write(\"CB336\");\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(33).getText()));\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(34).getText()));\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(35).getText()));\n writer.write(\"\\r\\n\");\n\n writer.write(\"CB714\");\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(36).getText()));\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(37).getText()));\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(38).getText()));\n writer.write(\"\\t\");\n writer.write(checkValue(input.get(39).getText())); \n writer.close();\n }\n catch(IOException e){\n JOptionPane.showMessageDialog(null, \"Error in exporting file\", \"Error\",\n JOptionPane.ERROR_MESSAGE);\n }\n }", "private void BackupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackupActionPerformed\n try{\n BufferedWriter writer = new BufferedWriter(new FileWriter(\"salvare.sql\"));\n Vector allData = getData(\"\");\n\n for(int row = 0; row < allData.size(); ++row){\n Person data = (Person)allData.elementAt(row);\n\n String sql = \"insert into \" + tableName + \" values ('\" + data.getName() + \"' , '\" +\n data.getCity() + \"' , '\" + data.getPhone() + \"');\";\n writer.write(sql);\n writer.newLine();\n }\n writer.close();\n JOptionPane.showMessageDialog(this, \"Salvare cu succes!\" , \"salvare\", JOptionPane.INFORMATION_MESSAGE);\n }catch(Exception e){\n JOptionPane.showMessageDialog(this, \"O eroare la salvarea fisierului!\" , \"formWindowOpened\", JOptionPane.ERROR_MESSAGE);\n }\n}", "private static void northstarSync(Connection con, InputStreamReader isr, String club) {\n\n PreparedStatement pstmt1 = null;\n PreparedStatement pstmt2 = null;\n Statement stmt = null;\n ResultSet rs = null;\n\n\n Member member = new Member();\n\n String line = \"\";\n String password = \"\";\n String temp = \"\";\n\n int i = 0;\n\n // Values from NStar records\n //\n String fname = \"\";\n String lname = \"\";\n String mi = \"\";\n String suffix = \"\";\n String posid = \"\";\n String gender = \"\";\n String ghin = \"\";\n String memid = \"\";\n String mNum = \"\";\n String u_hndcp = \"\";\n String c_hndcp = \"\";\n String mship = \"\";\n String mtype = \"\";\n String bag = \"\";\n String email = \"\";\n String email2 = \"\";\n String phone = \"\";\n String phone2 = \"\";\n String mobile = \"\";\n String primary = \"\";\n\n float u_hcap = 0;\n float c_hcap = 0;\n int birth = 0;\n\n // Values from ForeTees records\n //\n String fname_old = \"\";\n String lname_old = \"\";\n String mi_old = \"\";\n String mship_old = \"\";\n String mtype_old = \"\";\n String email_old = \"\";\n String mNum_old = \"\";\n String ghin_old = \"\";\n String bag_old = \"\";\n String posid_old = \"\";\n String email2_old = \"\";\n String phone_old = \"\";\n String phone2_old = \"\";\n String suffix_old = \"\";\n\n float u_hcap_old = 0;\n float c_hcap_old = 0;\n int birth_old = 0;\n\n // Values for New ForeTees records\n //\n String fname_new = \"\";\n String lname_new = \"\";\n String mi_new = \"\";\n String mship_new = \"\";\n String mtype_new = \"\";\n String email_new = \"\";\n String mNum_new = \"\";\n String ghin_new = \"\";\n String bag_new = \"\";\n String posid_new = \"\";\n String email2_new = \"\";\n String phone_new = \"\";\n String phone2_new = \"\";\n String suffix_new = \"\";\n\n float u_hcap_new = 0;\n float c_hcap_new = 0;\n int birth_new = 0;\n int rcount = 0;\n\n String errorMsg = \"Error in Common_sync.northStarSync: \";\n\n boolean failed = false;\n boolean changed = false;\n boolean skip = false;\n boolean headerFound = false;\n boolean found = false;\n\n\n try {\n\n BufferedReader br = new BufferedReader(isr);\n\n // format of each line in the file:\n //\n // memid, mNum, fname, mi, lname, suffix, mship, mtype, gender, email, email2,\n // phone, phone2, bag, hndcp#, uhndcp, chndcp, birth, posid, primary\n //\n //\n while (true) {\n\n line = br.readLine();\n\n if (line == null) {\n break;\n }\n\n // Skip the 1st row (header row)\n\n if (headerFound == false) {\n\n headerFound = true;\n\n } else {\n\n // Remove the dbl quotes and check for embedded commas\n\n line = cleanRecord( line );\n\n rcount++; // count the records\n\n // parse the line to gather all the info\n\n StringTokenizer tok = new StringTokenizer( line, \",\" ); // delimiters are comma\n\n if ( tok.countTokens() > 19 ) { // enough data ?\n\n memid = tok.nextToken();\n mNum = tok.nextToken();\n fname = tok.nextToken();\n mi = tok.nextToken();\n lname = tok.nextToken();\n suffix = tok.nextToken();\n mship = tok.nextToken();\n mtype = tok.nextToken();\n gender = tok.nextToken();\n email = tok.nextToken();\n email2 = tok.nextToken();\n phone = tok.nextToken();\n phone2 = tok.nextToken();\n bag = tok.nextToken();\n ghin = tok.nextToken();\n u_hndcp = tok.nextToken();\n c_hndcp = tok.nextToken();\n temp = tok.nextToken();\n posid = tok.nextToken();\n primary = tok.nextToken();\n\n //\n // Check for ? (not provided)\n //\n if (memid.equals( \"?\" )) {\n\n memid = \"\";\n }\n if (mNum.equals( \"?\" )) {\n\n mNum = \"\";\n }\n if (fname.equals( \"?\" )) {\n\n fname = \"\";\n }\n if (mi.equals( \"?\" )) {\n\n mi = \"\";\n }\n if (lname.equals( \"?\" )) {\n\n lname = \"\";\n }\n if (suffix.equals( \"?\" )) {\n\n suffix = \"\";\n }\n if (mship.equals( \"?\" )) {\n\n mship = \"\";\n }\n if (mtype.equals( \"?\" )) {\n\n mtype = \"\";\n }\n if (gender.equals( \"?\" )) {\n\n gender = \"\";\n }\n if (email.equals( \"?\" )) {\n\n email = \"\";\n }\n if (email2.equals( \"?\" )) {\n\n email2 = \"\";\n }\n if (phone.equals( \"?\" )) {\n\n phone = \"\";\n }\n if (phone2.equals( \"?\" )) {\n\n phone2 = \"\";\n }\n if (bag.equals( \"?\" )) {\n\n bag = \"\";\n }\n if (ghin.equals( \"?\" )) {\n\n ghin = \"\";\n }\n if (u_hndcp.equals( \"?\" )) {\n\n u_hndcp = \"\";\n }\n if (c_hndcp.equals( \"?\" )) {\n\n c_hndcp = \"\";\n }\n if (temp.equals( \"?\" ) || temp.equals( \"0\" )) {\n\n temp = \"\";\n }\n if (posid.equals( \"?\" )) {\n\n posid = \"\";\n }\n if (primary.equals( \"?\" )) {\n\n primary = \"\";\n }\n\n //\n // Determine if we should process this record (does it meet the minimum requirements?)\n //\n if (!memid.equals( \"\" ) && !mNum.equals( \"\" ) && !lname.equals( \"\" ) && !fname.equals( \"\" )) {\n\n //\n // Remove spaces, etc. from name fields\n //\n tok = new StringTokenizer( fname, \" \" ); // delimiters are space\n\n fname = tok.nextToken(); // remove any spaces and middle name\n\n if ( tok.countTokens() > 0 ) {\n\n mi = tok.nextToken(); // over-write mi if already there\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n tok = new StringTokenizer( suffix, \" \" ); // delimiters are space\n\n suffix = tok.nextToken(); // remove any extra (only use one value)\n }\n\n tok = new StringTokenizer( lname, \" \" ); // delimiters are space\n\n lname = tok.nextToken(); // remove suffix and spaces\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n lname = lname + \"_\" + suffix; // append suffix to last name\n\n } else { // sufix after last name ?\n\n if ( tok.countTokens() > 0 ) {\n\n suffix = tok.nextToken();\n lname = lname + \"_\" + suffix; // append suffix to last name\n }\n }\n\n //\n // Determine the handicaps\n //\n u_hcap = -99; // indicate no hndcp\n c_hcap = -99; // indicate no c_hndcp\n\n if (!u_hndcp.equals( \"\" ) && !u_hndcp.equalsIgnoreCase(\"NH\") && !u_hndcp.equalsIgnoreCase(\"NHL\")) {\n\n u_hndcp = u_hndcp.replace('L', ' '); // isolate the handicap - remove spaces and trailing 'L'\n u_hndcp = u_hndcp.replace('H', ' '); // or 'H' if present\n u_hndcp = u_hndcp.replace('N', ' '); // or 'N' if present\n u_hndcp = u_hndcp.replace('J', ' '); // or 'J' if present\n u_hndcp = u_hndcp.replace('R', ' '); // or 'R' if present\n u_hndcp = u_hndcp.trim();\n\n u_hcap = Float.parseFloat(u_hndcp); // usga handicap\n\n if ((!u_hndcp.startsWith(\"+\")) && (!u_hndcp.startsWith(\"-\"))) {\n\n u_hcap = 0 - u_hcap; // make it a negative hndcp (normal)\n }\n }\n\n if (!c_hndcp.equals( \"\" ) && !c_hndcp.equalsIgnoreCase(\"NH\") && !c_hndcp.equalsIgnoreCase(\"NHL\")) {\n\n c_hndcp = c_hndcp.replace('L', ' '); // isolate the handicap - remove spaces and trailing 'L'\n c_hndcp = c_hndcp.replace('H', ' '); // or 'H' if present\n c_hndcp = c_hndcp.replace('N', ' '); // or 'N' if present\n c_hndcp = c_hndcp.replace('J', ' '); // or 'J' if present\n c_hndcp = c_hndcp.replace('R', ' '); // or 'R' if present\n c_hndcp = c_hndcp.trim();\n\n c_hcap = Float.parseFloat(c_hndcp); // usga handicap\n\n if ((!c_hndcp.startsWith(\"+\")) && (!c_hndcp.startsWith(\"-\"))) {\n\n c_hcap = 0 - c_hcap; // make it a negative hndcp (normal)\n }\n }\n\n //\n // convert birth date (yyyy-mm-dd to yyyymmdd)\n //\n if (!temp.equals( \"\" )) {\n\n tok = new StringTokenizer( temp, \"/-\" ); // delimiters are / & -\n\n String b1 = tok.nextToken();\n String b2 = tok.nextToken();\n String b3 = tok.nextToken();\n\n int yy = Integer.parseInt(b1);\n int mm = Integer.parseInt(b2);\n int dd = Integer.parseInt(b3);\n\n birth = (yy * 10000) + (mm * 100) + dd; // yyyymmdd\n\n if (yy < 1900) { // check for invalid date\n\n birth = 0;\n }\n\n } else {\n\n birth = 0;\n }\n\n password = lname;\n\n //\n // if lname is less than 4 chars, fill with 1's\n //\n int length = password.length();\n\n while (length < 4) {\n\n password = password + \"1\";\n length++;\n }\n\n //\n // Verify the email addresses\n //\n if (!email.equals( \"\" )) { // if specified\n\n email = email.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email));\n\n if (!feedback.isPositive()) { // if error\n\n email = \"\"; // do not use it\n }\n }\n if (!email2.equals( \"\" )) { // if specified\n\n email2 = email2.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email2));\n\n if (!feedback.isPositive()) { // if error\n\n email2 = \"\"; // do not use it\n }\n }\n\n // if email #1 is empty then assign email #2 to it\n if (email.equals(\"\")) email = email2;\n\n skip = false;\n found = false; // default to club NOT found\n\n //\n // *********************************************************************\n //\n // The following will be dependent on the club - customized\n //\n // *********************************************************************\n //\n if (club.equals( \"brooklawn\" )) { // Grapevine Web Site Provider - NorthStar Roster Sync\n\n found = true; // club found\n\n //\n // Determine if we should process this record (per Judy Barbagallo)\n //\n if (!mtype.equals( \"\" ) && !mship.equals( \"\" ) && !mship.startsWith( \"Special\" ) &&\n !mship.startsWith( \"Other\" ) && !mship.startsWith( \"Resign\" ) &&\n !mship.startsWith( \"Transitional\" ) && !mship.startsWith( \"Senior Plus\" )) {\n\n\n // clean up mNum\n if (!mNum.equals(\"\")) {\n\n mNum = mNum.toUpperCase();\n\n if (mNum.length() > 2 && (mNum.endsWith(\"S1\") || mNum.endsWith(\"C1\") || mNum.endsWith(\"C2\") || mNum.endsWith(\"C3\") || mNum.endsWith(\"C4\") ||\n mNum.endsWith(\"C5\") || mNum.endsWith(\"C6\") || mNum.endsWith(\"C7\") || mNum.endsWith(\"C8\") || mNum.endsWith(\"C9\"))) {\n\n mNum = mNum.substring(0, mNum.length() - 2);\n\n } else if (mNum.length() > 1 && mNum.endsWith(\"S\")) {\n\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n }\n\n //\n // set defaults\n //\n if (gender.equalsIgnoreCase( \"female\" )) {\n\n gender = \"F\"; // Female\n\n } else {\n\n gender = \"M\"; // default to Male\n }\n\n suffix = \"\"; // done with suffix for now\n\n //\n // Set the Member Type\n //\n if (mtype.equalsIgnoreCase( \"primary\" )) {\n\n mtype = \"Primary Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Primary Female\";\n }\n\n } else if (mtype.equalsIgnoreCase( \"spouse\" )) {\n\n mtype = \"Spouse Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Spouse Female\";\n }\n\n } else if (!mtype.equalsIgnoreCase(\"maid\") && !mtype.equalsIgnoreCase(\"other\")) {\n\n mtype = \"Dependent\";\n\n } else {\n\n skip = true;\n }\n\n //\n // Determine the age in years\n //\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 24; // backup 24 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (mtype.equals(\"Dependent\") && birth > 0 && birth < oldDate) {\n\n skip = true;\n }\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club = brooklawn\n\n\n if (club.equals( \"bellevuecc\" )) { // Bellevue CC\n\n found = true; // club found\n\n //\n // Determine if we should process this record - skip 'House', 'House/Pool' and 'Country Clubs' (do this below!!)\n //\n if (!mtype.equals( \"\" ) && !mship.equals( \"\" )) {\n\n //\n // Strip any leading zeros from username\n //\n if (memid.startsWith( \"0\" )) {\n\n memid = remZeroS( memid );\n }\n if (memid.startsWith( \"0\" )) { // in case there are 2 zeros\n\n memid = remZeroS( memid );\n }\n\n //\n // Set the Membership Type\n //\n if (mship.startsWith( \"Assoc\" )) { // if Associate...\n\n mship = \"Associate\";\n }\n\n if (mship.startsWith( \"Junior\" )) { // if Junior...\n\n mship = \"Junior\";\n }\n\n if (mship.equalsIgnoreCase(\"House\") || mship.equalsIgnoreCase(\"House/Pool\") || mship.equalsIgnoreCase(\"Country Clubs\")) {\n skip = true;\n }\n //\n // set defaults\n //\n if (gender.equalsIgnoreCase( \"female\" )) {\n\n gender = \"F\"; // Female\n\n } else {\n\n gender = \"M\"; // default to Male\n }\n\n suffix = \"\"; // done with suffix for now\n\n //\n // Set the Member Type\n //\n if (mtype.equalsIgnoreCase( \"primary\" )) {\n\n mtype = \"Primary Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Primary Female\";\n }\n\n } else {\n\n if (mtype.equalsIgnoreCase( \"spouse\" )) {\n\n mtype = \"Spouse Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Spouse Female\";\n }\n\n } else {\n\n mtype = \"Dependent\";\n }\n\n // Search or primary and use their mship\n try {\n String tempmNum = mNum;\n\n while (tempmNum.startsWith(\"0\")) {\n tempmNum = tempmNum.substring(1);\n }\n\n PreparedStatement belstmt = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE username = ?\");\n belstmt.clearParameters();\n belstmt.setString(1, tempmNum);\n\n ResultSet belrs = belstmt.executeQuery();\n\n if (belrs.next()) {\n mship = belrs.getString(\"m_ship\");\n } else {\n skip = true;\n }\n\n belstmt.close();\n\n } catch (Exception exc) {\n skip = true;\n }\n }\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club = ??\n\n if (club.equals( \"greenacrescountryclub\" )) { // Green Acres CC\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mtype.equals( \"\" ) && !mship.equals( \"\" )) {\n\n //\n // Strip any leading zeros from username and member number\n //\n while (memid.startsWith(\"0\")) {\n memid = memid.substring(1);\n }\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n //\n // Set the Membership Type\n //\n if (mship.equalsIgnoreCase(\"Regular\") || mship.startsWith(\"Female Regular\") || mship.equalsIgnoreCase(\"Honorairium\") ||\n mship.equalsIgnoreCase(\"Male Hnr\") || mship.startsWith(\"Male Regular\") || mship.equalsIgnoreCase(\"Spec Male Hnr 85/25\") ||\n mship.equalsIgnoreCase(\"Social 85/50 Years Mbrshp +\") || mship.startsWith(\"Male 3\") || mship.startsWith(\"Female 3\")) {\n\n mship = \"Regular\";\n\n } else if (mship.equalsIgnoreCase(\"Female Junior\") || mship.equalsIgnoreCase(\"Female Young Jr 21-24\") || mship.equalsIgnoreCase(\"Male Junior\") ||\n mship.equalsIgnoreCase(\"Male Limited Jr 28-29\") || mship.equalsIgnoreCase(\"Male Young Jr 21-24\") || mship.equalsIgnoreCase(\"Male Young Junior 25-27\") ||\n mship.startsWith(\"Male Jr\")) {\n\n mship = \"Junior\";\n\n } else if (mship.startsWith(\"Social Female\") || mship.startsWith(\"Social Male\") || mship.startsWith(\"Social Junior\") ||\n mship.startsWith(\"Social Jr\")) {\n\n mship = \"Social\";\n\n } else if (mship.startsWith(\"Loa Soc\")) {\n\n mship = \"LOA Social\";\n\n } else if (mship.startsWith(\"Loa Junior\") || mship.startsWith(\"Loa Jr\") || mship.startsWith(\"Loa Ltd Jr\") ||\n mship.startsWith(\"Loa Jr\") || mship.equalsIgnoreCase(\"Loa Male 37\")) {\n\n mship = \"LOA Junior\";\n\n } else if (mship.equalsIgnoreCase(\"Loa Regular Male\")) {\n\n mship = \"LOA Regular\";\n\n } else if (mship.equalsIgnoreCase(\"Significant Other\") || mship.equalsIgnoreCase(\"Spouse\") || mship.equalsIgnoreCase(\"Child\")) {\n\n try {\n pstmt2 = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE username = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, mNum);\n\n rs = pstmt2.executeQuery();\n\n if (rs.next()) {\n mship = rs.getString(\"m_ship\");\n } else {\n mship = \"No Primary Found - \" + mship;\n }\n\n pstmt2.close();\n\n } catch (Exception exc) {\n\n mship = \"Error Finding Primary - \" + mship;\n\n }\n\n } else if (mship.startsWith(\"Pool & Tennis\")) {\n\n mship = \"Pool & Tennis\";\n\n }\n\n else if (!mship.equalsIgnoreCase(\"Two Week Usage\")) {\n\n skip = true; // Skip all others\n\n }\n\n\n // set defaults\n if (gender.equalsIgnoreCase( \"Female\" )) {\n gender = \"F\"; // Female\n } else {\n gender = \"M\"; // default to Male\n }\n\n // Set mtype\n if (mtype.equalsIgnoreCase(\"Primary\") || mtype.equalsIgnoreCase(\"Spouse\") || mtype.equalsIgnoreCase(\"Signi Other\")) {\n if (gender.equals(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n } else if (mtype.equalsIgnoreCase(\"Child\")) {\n mtype = \"Qualified Child\";\n }\n\n suffix = \"\"; // done with suffix for now\n\n } else {\n\n skip = true; // skip this record\n }\n\n } // end of IF club = greenacrescountryclub\n\n //\n // Ritz Carlotn CC\n //\n/*\n if (club.equals( \"ritzcarlton\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n ??? if (!mtype.equals( \"\" ) && !mship.equals( \"\" ) && !mship.startsWith( \"????\" ) &&\n !mship.startsWith( \"???\" ) && !mship.startsWith( \"???\" )) {\n\n //\n // set defaults\n //\n if (gender.equalsIgnoreCase( \"female\" )) {\n\n gender = \"F\"; // Female\n\n } else {\n\n gender = \"M\"; // default to Male\n }\n\n suffix = \"\"; // done with suffix for now\n\n //\n // Set the Member Type\n //\n if (mtype.equalsIgnoreCase( \"primary\" )) {\n\n mtype = \"Primary Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Primary Female\";\n }\n\n } else {\n\n if (mtype.equalsIgnoreCase( \"spouse\" )) {\n\n mtype = \"Spouse Male\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Spouse Female\";\n }\n\n } else {\n\n mtype = \"Dependent\";\n }\n }\n\n //\n // *** TEMP *** currently the birth dates are invalid for all members\n //\n birth = 0;\n\n //\n // Verify the member id's\n //\n if (mtype.equalsIgnoreCase( \"spouse\" )) {\n\n if (!memid.endsWith( \"s\" ) && !memid.endsWith( \"S\" ) && !memid.endsWith( \"s1\" ) && !memid.endsWith( \"S1\" )) {\n\n skip = true; // skip this record\n }\n\n } else {\n\n if (mtype.equalsIgnoreCase( \"dependent\" )) {\n\n if (!memid.endsWith( \"C1\" ) && !memid.endsWith( \"C2\" ) && !memid.endsWith( \"C3\" ) && !memid.endsWith( \"C4\" ) &&\n !memid.endsWith( \"C5\" ) && !memid.endsWith( \"C6\" ) && !memid.endsWith( \"C7\" ) && !memid.endsWith( \"C8\" )) {\n\n skip = true; // skip this record\n }\n }\n }\n\n } else {\n\n skip = true; // skip this record\n }\n } // end of IF club = ritzcarlton\n*/\n\n\n //\n //******************************************************************\n // Common processing - add or update the member record\n //******************************************************************\n //\n if (skip == false && found == true && !fname.equals(\"\") && !lname.equals(\"\")) {\n\n //\n // now determine if we should update an existing record or add the new one\n //\n fname_old = \"\";\n lname_old = \"\";\n mi_old = \"\";\n mship_old = \"\";\n mtype_old = \"\";\n email_old = \"\";\n mNum_old = \"\";\n ghin_old = \"\";\n bag_old = \"\";\n posid_old = \"\";\n email2_old = \"\";\n phone_old = \"\";\n phone2_old = \"\";\n suffix_old = \"\";\n u_hcap_old = 0;\n c_hcap_old = 0;\n birth_old = 0;\n\n\n //\n // Truncate the string values to avoid sql error\n //\n if (!mi.equals( \"\" )) { // if mi specified\n\n mi = truncate(mi, 1); // make sure it is only 1 char\n }\n if (!memid.equals( \"\" )) {\n\n memid = truncate(memid, 15);\n }\n if (!password.equals( \"\" )) {\n\n password = truncate(password, 15);\n }\n if (!lname.equals( \"\" )) {\n\n lname = truncate(lname, 20);\n }\n if (!fname.equals( \"\" )) {\n\n fname = truncate(fname, 20);\n }\n if (!mship.equals( \"\" )) {\n\n mship = truncate(mship, 30);\n }\n if (!mtype.equals( \"\" )) {\n\n mtype = truncate(mtype, 30);\n }\n if (!email.equals( \"\" )) {\n\n email = truncate(email, 50);\n }\n if (!email2.equals( \"\" )) {\n\n email2 = truncate(email2, 50);\n }\n if (!mNum.equals( \"\" )) {\n\n mNum = truncate(mNum, 10);\n }\n if (!ghin.equals( \"\" )) {\n\n ghin = truncate(ghin, 16);\n }\n if (!bag.equals( \"\" )) {\n\n bag = truncate(bag, 12);\n }\n if (!posid.equals( \"\" )) {\n\n posid = truncate(posid, 15);\n }\n if (!phone.equals( \"\" )) {\n\n phone = truncate(phone, 24);\n }\n if (!phone2.equals( \"\" )) {\n\n phone2 = truncate(phone2, 24);\n }\n if (!suffix.equals( \"\" )) {\n\n suffix = truncate(suffix, 4);\n }\n\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if(rs.next()) {\n\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n ghin_old = rs.getString(\"ghin\");\n bag_old = rs.getString(\"bag\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n email2_old = rs.getString(\"email2\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n suffix_old = rs.getString(\"name_suf\");\n }\n pstmt2.close(); // close the stmt\n\n if (!fname_old.equals( \"\" )) { // if member found\n\n changed = false; // init change indicator\n\n lname_new = lname_old;\n\n if (!lname.equals( \"\" ) && !lname_old.equals( lname )) {\n\n lname_new = lname; // set value from NStar record\n changed = true;\n }\n\n fname_new = fname_old;\n\n fname = fname_old; // DO NOT change the first names\n\n/*\n if (!fname.equals( \"\" ) && !fname_old.equals( fname )) {\n\n fname_new = fname; // set value from NStar record\n changed = true;\n }\n*/\n\n mi_new = mi_old;\n\n if (!mi.equals( \"\" ) && !mi_old.equals( mi )) {\n\n mi_new = mi; // set value from NStar record\n changed = true;\n }\n\n mship_new = mship_old;\n\n if (!mship.equals( \"\" ) && !mship_old.equals( mship )) {\n\n mship_new = mship; // set value from NStar record\n changed = true;\n }\n\n mtype_new = mtype_old;\n\n if (!club.equals( \"ritzcarlton\" ) && !club.equals( \"brooklawn\" )) { // do not change mtypes for dependents\n\n if (!mtype.equals( \"\" ) && !mtype.equals( \"Dependent\" ) && !mtype_old.equals( mtype )) {\n\n mtype_new = mtype; // set value from NStar record\n changed = true;\n }\n }\n\n birth_new = birth_old;\n\n if (!club.equals( \"ritzcarlton\" )) { // do not change birthdates\n\n if (birth > 0 && birth != birth_old) {\n\n birth_new = birth; // set value from NStar record\n changed = true;\n }\n }\n\n ghin_new = ghin_old;\n\n if (!ghin.equals( \"\" ) && !ghin_old.equals( ghin )) {\n\n ghin_new = ghin; // set value from NStar record\n changed = true;\n }\n\n bag_new = bag_old;\n\n if (!bag.equals( \"\" ) && !bag_old.equals( bag )) {\n\n bag_new = bag; // set value from NStar record\n changed = true;\n }\n\n posid_new = posid_old;\n\n if (!posid.equals( \"\" ) && !posid_old.equals( posid )) {\n\n posid_new = posid; // set value from NStar record\n changed = true;\n }\n\n phone_new = phone_old;\n\n if (!phone.equals( \"\" ) && !phone_old.equals( phone )) {\n\n phone_new = phone; // set value from NStar record\n changed = true;\n }\n\n phone2_new = phone2_old;\n\n if (!phone2.equals( \"\" ) && !phone2_old.equals( phone2 )) {\n\n phone2_new = phone2; // set value from NStar record\n changed = true;\n }\n\n suffix_new = suffix_old;\n\n if (!suffix.equals( \"\" ) && !suffix_old.equals( suffix )) {\n\n suffix_new = suffix; // set value from NStar record\n changed = true;\n }\n\n email_new = email_old; // do not change emails\n email2_new = email2_old;\n\n //\n // update emails if Brooklawn\n //\n if (club.equals( \"brooklawn\" )) {\n\n if (!email.equals( \"\" )) { // if email provided\n\n email_new = email; // set value from NStar record\n }\n\n if (!email2.equals( \"\" )) { // if email provided\n\n email2_new = email2; // set value from NStar record\n }\n }\n\n\n\n // don't allow both emails to be the same\n if (email_new.equalsIgnoreCase(email2_new)) email2_new = \"\";\n\n\n mNum_new = mNum_old; // do not change mNums\n\n if (club.equals(\"brooklawn\")) { // update member numbers if brooklawn\n if (!mNum.equals( \"\" ) && !mNum_old.equals( mNum )) {\n\n mNum_new = mNum; // set value from NStar record\n changed = true;\n }\n }\n\n\n //\n // Update our record if something has changed\n //\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET name_last = ?, name_first = ?, \" +\n \"name_mi = ?, m_ship = ?, m_type = ?, email = ?, \" +\n \"memNum = ?, ghin = ?, bag = ?, birth = ?, posid = ?, email2 = ?, phone1 = ?, \" +\n \"phone2 = ?, name_suf = ?, inact = 0, last_sync_date = now(), gender = ? \" +\n \"WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, lname_new);\n pstmt2.setString(2, fname_new);\n pstmt2.setString(3, mi_new);\n pstmt2.setString(4, mship_new);\n pstmt2.setString(5, mtype_new);\n pstmt2.setString(6, email_new);\n pstmt2.setString(7, mNum_new);\n pstmt2.setString(8, ghin_new);\n pstmt2.setString(9, bag_new);\n pstmt2.setInt(10, birth_new);\n pstmt2.setString(11, posid_new);\n pstmt2.setString(12, email2_new);\n pstmt2.setString(13, phone_new);\n pstmt2.setString(14, phone2_new);\n pstmt2.setString(15, suffix_new);\n pstmt2.setString(16, gender);\n pstmt2.setString(17, memid);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n } else {\n\n //\n // New member - first check if name already exists\n //\n boolean dup = false;\n\n pstmt2 = con.prepareStatement (\n \"SELECT username FROM member2b WHERE name_last = ? AND name_first = ? AND name_mi = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, lname);\n pstmt2.setString(2, fname);\n pstmt2.setString(3, mi);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n dup = true;\n }\n pstmt2.close(); // close the stmt\n\n if (dup == false) {\n\n //\n // New member - add it\n //\n pstmt2 = con.prepareStatement (\n \"INSERT INTO member2b (username, password, name_last, name_first, name_mi, \" +\n \"m_ship, m_type, email, count, c_hancap, g_hancap, wc, message, emailOpt, memNum, \" +\n \"ghin, locker, bag, birth, posid, msub_type, email2, phone1, phone2, name_pre, name_suf, \" +\n \"webid, last_sync_date, gender) \" +\n \"VALUES (?,?,?,?,?,?,?,?,0,?,?,'','',1,?,?,'',?,?,?,'',?,?,?,'',?,'',now(),?)\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n pstmt2.setString(2, password);\n pstmt2.setString(3, lname);\n pstmt2.setString(4, fname);\n pstmt2.setString(5, mi);\n pstmt2.setString(6, mship);\n pstmt2.setString(7, mtype);\n pstmt2.setString(8, email);\n pstmt2.setFloat(9, c_hcap);\n pstmt2.setFloat(10, u_hcap);\n pstmt2.setString(11, mNum);\n pstmt2.setString(12, ghin);\n pstmt2.setString(13, bag);\n pstmt2.setInt(14, birth);\n pstmt2.setString(15, posid);\n pstmt2.setString(16, email2);\n pstmt2.setString(17, phone);\n pstmt2.setString(18, phone2);\n pstmt2.setString(19, suffix);\n pstmt2.setString(20, gender);\n pstmt2.executeUpdate(); // execute the prepared stmt\n\n pstmt2.close(); // close the stmt\n }\n }\n\n } // end of IF skip\n\n } // end of IF minimum requirements\n\n } // end of IF tokens\n\n } // end of IF header row\n\n } // end of WHILE records in file\n\n //\n // Done with this file for this club - now set any members that were excluded from this file inactive\n //\n if (found == true) { // if we processed this club\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET inact = 1 \" +\n \"WHERE last_sync_date != now() AND last_sync_date != '0000-00-00'\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n \n \n //\n // Roster File Found for this club - make sure the roster sync indicator is set in the club table\n //\n setRSind(con, club);\n }\n\n }\n catch (Exception e3) {\n\n errorMsg = errorMsg + \" Error processing roster (record #\" +rcount+ \") for \" +club+ \", line = \" +line+ \": \" + e3.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.northStarSync: \"; // reset the msg\n }\n\n\n //\n // Bellevue - now change the mship types of all spouses and dependents to match the primary, then remove the unwanted mships\n //\n /*\n if (club.equals( \"bellevuecc\" )) { // Bellevue CC\n\n try {\n\n //\n // get all primary members\n //\n String mtype1 = \"Primary Male\";\n String mtype2 = \"Primary Female\";\n\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship, memNum FROM member2b WHERE m_type = ? OR m_type = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, mtype1);\n pstmt2.setString(2, mtype2);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n while(rs.next()) {\n\n mship = rs.getString(\"m_ship\");\n mNum = rs.getString(\"memNum\");\n\n //\n // Set mship in all members with matching mNum\n //\n pstmt1 = con.prepareStatement (\n \"UPDATE member2b SET m_ship = ? \" +\n \"WHERE memNum = ?\");\n\n pstmt1.clearParameters(); // clear the parms\n pstmt1.setString(1, mship);\n pstmt1.setString(2, mNum);\n pstmt1.executeUpdate();\n\n pstmt1.close(); // close the stmt\n\n } // end of WHILE primary members\n\n pstmt2.close(); // close the stmt\n\n\n String mship1 = \"House\";\n String mship2 = \"House/Pool\";\n String mship3 = \"Country Clubs\";\n\n //\n // Remove the 'House', 'House/Pool' and 'Country Clubs' mship types\n //\n pstmt1 = con.prepareStatement (\n \"DELETE FROM member2b \" +\n \"WHERE m_ship = ? OR m_ship = ? OR m_ship = ?\");\n\n pstmt1.clearParameters(); // clear the parms\n pstmt1.setString(1, mship1);\n pstmt1.setString(2, mship2);\n pstmt1.setString(3, mship3);\n pstmt1.executeUpdate();\n\n pstmt1.close(); // close the stmt\n\n }\n catch (Exception e3) {\n\n errorMsg = errorMsg + \" Error processing roster for \" +club+ \", setting mship values: \" + e3.getMessage(); // build msg\n SystemUtils.logError(errorMsg); // log it\n errorMsg = \"Error in Common_sync.northStarSync: \"; // reset the msg\n }\n\n } // end of IF Bellevue\n*/\n \n }", "public void save(){\n try{\n Date date = new Date();\n \n PrintWriter writer = new PrintWriter(\"data.MBM\", \"UTF-8\");\n \n writer.println(\"version:\"+MBMDriver.version);\n writer.println(\"numworlds:\" + worlds.size());\n writer.println(\"lastclosed:\" + date.toString());\n writer.println(\"outDir:\"+outputDir.toPath());\n \n for(int i = 0; i < worlds.size(); i++){\n \n writer.println(\"MBMWORLD:\"+worlds.get(i).getWorldFile().getName()+\":\"+worlds.get(i).getName()+\":\"+worlds.get(i).getWorldFile().toPath()+\":\"+worlds.get(i).getLastBackupDate());\n }\n \n writer.close();\n }catch(FileNotFoundException e){\n System.out.println(\"ERROR: Failed to Find File\");\n }catch(UnsupportedEncodingException e){\n System.out.println(\"ERROR: Unsupported Encoding Exception\");\n }\n }", "public void save() throws IOException {\n/* 481 */ Connection dbcon = null;\n/* 482 */ PreparedStatement ps = null;\n/* */ \n/* */ try {\n/* 485 */ CreaturePos pos = CreaturePos.getPosition(this.wurmid);\n/* 486 */ if (pos != null) {\n/* */ \n/* 488 */ pos.setPosX(this.posx);\n/* 489 */ pos.setPosY(this.posy);\n/* 490 */ pos.setPosZ(this.posz, false);\n/* 491 */ pos.setRotation(this.rotation);\n/* 492 */ pos.setZoneId(this.zoneid);\n/* 493 */ pos.setLayer(0);\n/* */ } else {\n/* */ \n/* 496 */ new CreaturePos(this.wurmid, this.posx, this.posy, this.posz, this.rotation, this.zoneid, 0, -10L, true);\n/* 497 */ } dbcon = DbConnector.getPlayerDbCon();\n/* 498 */ if (exists(dbcon)) {\n/* */ \n/* 500 */ ps = dbcon.prepareStatement(\"DELETE FROM PLAYERS WHERE WURMID=?\");\n/* 501 */ ps.setLong(1, this.wurmid);\n/* 502 */ ps.executeUpdate();\n/* 503 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ } \n/* 505 */ ps = dbcon.prepareStatement(\"insert into PLAYERS (MAYUSESHOP,PASSWORD,WURMID,LASTLOGOUT,PLAYINGTIME,TEMPLATENAME,SEX,CENTIMETERSHIGH,CENTIMETERSLONG,CENTIMETERSWIDE,INVENTORYID,BODYID,MONEYSALES,BUILDINGID,STAMINA,HUNGER,THIRST,IPADDRESS,REIMBURSED,PLANTEDSIGN,BANNED,PAYMENTEXPIRE,POWER,RANK,DEVTALK,WARNINGS,LASTWARNED,FAITH,DEITY,ALIGNMENT,GOD,FAVOR,LASTCHANGEDDEITY,REALDEATH,CHEATED,LASTFATIGUE,FATIGUE,DEAD,KINGDOM,SESSIONKEY,SESSIONEXPIRE,VERSION,MUTED,LASTFAITH,NUMFAITH,MONEY,CLIMBING,NUMSCHANGEDKINGDOM,AGE,LASTPOLLEDAGE,FAT,BANEXPIRY,BANREASON,FACE,REPUTATION,LASTPOLLEDREP,TITLE,PET,NICOTINE,NICOTINETIME,ALCOHOL,ALCOHOLTIME,LOGGING,MAYMUTE,MUTEEXPIRY,MUTEREASON,LASTSERVER,CURRENTSERVER,REFERRER,EMAIL,PWQUESTION,PWANSWER,PRIEST,BED,SLEEP,CREATIONDATE,THEFTWARNED,NOREIMB,DEATHPROT,FATIGUETODAY,FATIGUEYDAY,FIGHTMODE,NEXTAFFINITY,DETECTIONSECS,TUTORIALLEVEL,AUTOFIGHT,APPOINTMENTS,PA,APPOINTPA,PAWINDOW,NUTRITION,DISEASE,PRIESTTYPE,LASTCHANGEDPRIEST,LASTCHANGEDKINGDOM,LASTLOSTCHAMPION,CHAMPIONPOINTS,CHAMPCHANNELING,MUTETIMES,VOTEDKING,EPICKINGDOM,EPICSERVER,CHAOSKINGDOM,FREETRANSFER,HOTA_WINS,LASTMODIFIEDRANK,MAXRANK,KARMA,MAXKARMA,TOTALKARMA,BLOOD,FLAGS,FLAGS2,ABILITIES,ABILITYTITLE,SCENARIOKARMA,UNDEADTYPE,UNDEADKILLS,UNDEADPKILLS,UNDEADPSECS,NAME,CALORIES,CARBS,FATS,PROTEINS,SECONDTITLE) VALUES(?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\");\n/* 506 */ ps.setBoolean(1, this.overrideshop);\n/* 507 */ ps.setString(2, this.password);\n/* 508 */ ps.setLong(3, this.wurmid);\n/* 509 */ ps.setLong(4, System.currentTimeMillis());\n/* 510 */ ps.setLong(5, this.playingTime);\n/* 511 */ ps.setString(6, this.templateName);\n/* 512 */ ps.setByte(7, this.sex);\n/* 513 */ ps.setShort(8, this.centhigh);\n/* 514 */ ps.setShort(9, this.centlong);\n/* 515 */ ps.setShort(10, this.centwide);\n/* 516 */ ps.setLong(11, this.inventoryId);\n/* 517 */ ps.setLong(12, this.bodyId);\n/* 518 */ ps.setLong(13, this.moneySalesEver);\n/* 519 */ ps.setLong(14, this.buildingId);\n/* 520 */ ps.setShort(15, (short)this.stamina);\n/* 521 */ ps.setShort(16, (short)this.hunger);\n/* 522 */ ps.setShort(17, (short)this.thirst);\n/* 523 */ ps.setString(18, this.lastip);\n/* 524 */ ps.setBoolean(19, this.reimbursed);\n/* 525 */ ps.setLong(20, this.plantedSign);\n/* 526 */ ps.setBoolean(21, this.banned);\n/* 527 */ ps.setLong(22, this.paymentExpire);\n/* 528 */ ps.setByte(23, this.power);\n/* 529 */ ps.setInt(24, this.rank);\n/* 530 */ ps.setBoolean(25, this.mayHearDevtalk);\n/* 531 */ ps.setShort(26, (short)this.warnings);\n/* 532 */ ps.setLong(27, this.lastwarned);\n/* 533 */ ps.setFloat(28, this.faith);\n/* 534 */ ps.setByte(29, this.deity);\n/* 535 */ ps.setFloat(30, this.align);\n/* 536 */ ps.setByte(31, this.god);\n/* 537 */ ps.setFloat(32, this.favor);\n/* 538 */ ps.setLong(33, this.lastChangedDeity);\n/* 539 */ ps.setByte(34, this.realdeathcounter);\n/* 540 */ ps.setLong(35, this.lastcheated);\n/* 541 */ ps.setLong(36, this.lastfatigue);\n/* 542 */ ps.setInt(37, this.fatiguesecsleft);\n/* 543 */ ps.setBoolean(38, this.dead);\n/* 544 */ ps.setByte(39, this.kingdom);\n/* 545 */ ps.setString(40, this.session);\n/* 546 */ ps.setLong(41, this.sessionExpiration);\n/* 547 */ ps.setLong(42, this.ver);\n/* 548 */ ps.setBoolean(43, this.mute);\n/* 549 */ ps.setLong(44, this.lastfaith);\n/* 550 */ ps.setByte(45, this.numfaith);\n/* 551 */ ps.setLong(46, this.money);\n/* 552 */ ps.setBoolean(47, this.climbing);\n/* 553 */ ps.setByte(48, this.changedKingdom);\n/* 554 */ ps.setInt(49, this.age);\n/* 555 */ ps.setLong(50, this.lastPolledAge);\n/* 556 */ ps.setByte(51, this.fat);\n/* 557 */ ps.setLong(52, this.banexpiry);\n/* 558 */ ps.setString(53, this.banreason);\n/* 559 */ ps.setLong(54, this.face);\n/* 560 */ ps.setInt(55, this.reputation);\n/* 561 */ ps.setLong(56, this.lastPolledReputation);\n/* 562 */ ps.setInt(57, this.title);\n/* 563 */ ps.setLong(58, this.pet);\n/* 564 */ ps.setFloat(59, this.nicotine);\n/* 565 */ ps.setLong(60, this.nicotineTime);\n/* 566 */ ps.setFloat(61, this.alcohol);\n/* 567 */ ps.setLong(62, this.alcoholTime);\n/* 568 */ ps.setBoolean(63, this.logging);\n/* 569 */ ps.setBoolean(64, this.mayMute);\n/* 570 */ ps.setLong(65, this.muteexpiry);\n/* 571 */ ps.setString(66, this.mutereason);\n/* 572 */ ps.setInt(67, this.lastServer);\n/* 573 */ ps.setInt(68, this.currentServer);\n/* 574 */ ps.setLong(69, this.referrer);\n/* 575 */ ps.setString(70, this.emailAdress);\n/* 576 */ ps.setString(71, this.pwQuestion);\n/* 577 */ ps.setString(72, this.pwAnswer);\n/* 578 */ ps.setBoolean(73, this.isPriest);\n/* 579 */ ps.setLong(74, this.bed);\n/* 580 */ ps.setInt(75, this.sleep);\n/* 581 */ ps.setLong(76, this.creationDate);\n/* 582 */ ps.setBoolean(77, this.istheftwarned);\n/* 583 */ ps.setBoolean(78, this.noReimbLeft);\n/* 584 */ ps.setBoolean(79, this.deathProt);\n/* 585 */ ps.setInt(80, this.fatigueSecsToday);\n/* 586 */ ps.setInt(81, this.fatigueSecsYday);\n/* 587 */ ps.setByte(82, this.fightmode);\n/* 588 */ ps.setLong(83, this.nextAffinity);\n/* 589 */ ps.setShort(84, this.detectionSecs);\n/* 590 */ ps.setInt(85, this.tutLevel);\n/* 591 */ ps.setBoolean(86, this.autofight);\n/* 592 */ ps.setLong(87, this.appointments);\n/* 593 */ ps.setBoolean(88, this.isPA);\n/* 594 */ ps.setBoolean(89, this.mayAppointPA);\n/* 595 */ ps.setBoolean(90, this.seesPAWin);\n/* 596 */ ps.setFloat(91, this.nutrition);\n/* 597 */ ps.setByte(92, this.disease);\n/* 598 */ ps.setByte(93, this.priestType);\n/* 599 */ ps.setLong(94, this.lastChangedPriestType);\n/* 600 */ ps.setLong(95, this.lastChangedKingdom);\n/* 601 */ ps.setLong(96, this.lastLostChampion);\n/* 602 */ ps.setShort(97, this.championPoints);\n/* 603 */ ps.setFloat(98, this.champChanneling);\n/* 604 */ ps.setShort(99, this.muteTimes);\n/* 605 */ ps.setBoolean(100, this.voteKing);\n/* 606 */ ps.setByte(101, this.epicKingdom);\n/* 607 */ ps.setInt(102, this.epicServerId);\n/* 608 */ ps.setInt(103, this.chaosKingdom);\n/* 609 */ ps.setBoolean(104, this.hasFreeTransfer);\n/* 610 */ ps.setShort(105, this.hotaWins);\n/* */ \n/* 612 */ ps.setLong(106, this.lastModifiedRank);\n/* 613 */ ps.setInt(107, this.maxRank);\n/* 614 */ ps.setInt(108, this.karma);\n/* 615 */ ps.setInt(109, this.maxKarma);\n/* 616 */ ps.setInt(110, this.totalKarma);\n/* 617 */ ps.setByte(111, this.blood);\n/* 618 */ ps.setLong(112, this.flags);\n/* 619 */ ps.setLong(113, this.flags2);\n/* 620 */ ps.setLong(114, this.abilities);\n/* 621 */ ps.setInt(115, this.abilityTitle);\n/* 622 */ ps.setInt(116, this.scenarioKarma);\n/* */ \n/* 624 */ ps.setByte(117, this.undeadType);\n/* 625 */ ps.setInt(118, this.undeadKills);\n/* 626 */ ps.setInt(119, this.undeadPKills);\n/* 627 */ ps.setInt(120, this.undeadPSecs);\n/* */ \n/* 629 */ ps.setString(121, this.name);\n/* 630 */ ps.setFloat(122, this.calories);\n/* 631 */ ps.setFloat(123, this.carbs);\n/* 632 */ ps.setFloat(124, this.fats);\n/* 633 */ ps.setFloat(125, this.proteins);\n/* */ \n/* 635 */ ps.setInt(126, this.secondTitle);\n/* */ \n/* 637 */ ps.executeUpdate();\n/* 638 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ \n/* 640 */ Players.getInstance().registerNewKingdom(this.wurmid, this.kingdom);\n/* */ \n/* 642 */ ps = dbcon.prepareStatement(\"DELETE FROM FRIENDS WHERE WURMID=?\");\n/* 643 */ ps.setLong(1, this.wurmid);\n/* 644 */ ps.executeUpdate();\n/* 645 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ \n/* 647 */ if (this.friends != null)\n/* */ {\n/* 649 */ for (int x = 0; x < this.friends.length; x++) {\n/* */ \n/* 651 */ ps = dbcon.prepareStatement(INSERT_FRIEND);\n/* 652 */ ps.setLong(1, this.wurmid);\n/* 653 */ ps.setLong(2, this.friends[x]);\n/* 654 */ ps.setByte(3, this.friendcats[x]);\n/* 655 */ ps.executeUpdate();\n/* 656 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ } \n/* */ }\n/* */ \n/* 660 */ ps = dbcon.prepareStatement(\"DELETE FROM IGNORED WHERE WURMID=?\");\n/* 661 */ ps.setLong(1, this.wurmid);\n/* 662 */ ps.executeUpdate();\n/* 663 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ \n/* 665 */ if (this.ignored != null)\n/* */ {\n/* 667 */ for (int x = 0; x < this.ignored.length; x++) {\n/* */ \n/* 669 */ ps = dbcon.prepareStatement(INSERT_IGNORED);\n/* 670 */ ps.setLong(1, this.wurmid);\n/* 671 */ ps.setLong(2, this.ignored[x]);\n/* 672 */ ps.executeUpdate();\n/* 673 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ } \n/* */ }\n/* */ \n/* 677 */ if (this.enemies != null)\n/* */ {\n/* 679 */ for (int x = 0; x < this.enemies.length; x++) {\n/* */ \n/* 681 */ ps = dbcon.prepareStatement(INSERT_ENEMY);\n/* 682 */ ps.setLong(1, this.wurmid);\n/* 683 */ ps.setLong(2, this.enemies[x]);\n/* 684 */ ps.executeUpdate();\n/* 685 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ } \n/* */ }\n/* */ \n/* 689 */ if (this.titleArr.length > 0)\n/* */ {\n/* 691 */ for (int x = 0; x < this.titleArr.length; x++) {\n/* */ \n/* 693 */ Titles.Title t = Titles.Title.getTitle(this.titleArr[x]);\n/* 694 */ if (t != null) {\n/* */ \n/* 696 */ ps = dbcon.prepareStatement(\"INSERT INTO TITLES (WURMID,TITLEID,TITLENAME) VALUES(?,?,?)\");\n/* 697 */ ps.setLong(1, this.wurmid);\n/* 698 */ ps.setInt(2, this.titleArr[x]);\n/* 699 */ ps.setString(3, t.getName(true));\n/* 700 */ ps.executeUpdate();\n/* 701 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ } \n/* */ } \n/* */ }\n/* */ \n/* 706 */ if (this.hasAwards) {\n/* */ \n/* 708 */ ps = dbcon.prepareStatement(\"DELETE FROM AWARDS WHERE WURMID=?\");\n/* 709 */ ps.setLong(1, this.wurmid);\n/* 710 */ ps.executeUpdate();\n/* 711 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ \n/* 713 */ ps = dbcon.prepareStatement(\"INSERT INTO AWARDS(WURMID, DAYSPREM, MONTHSPREM, MONTHSEVER, CONSECMONTHS, SILVERSPURCHASED, LASTTICKEDPREM, CURRENTLOYALTY, TOTALLOYALTY) VALUES(?,?,?,?,?,?,?,?,?)\");\n/* 714 */ ps.setLong(1, this.wurmid);\n/* 715 */ ps.setInt(2, this.daysPrem);\n/* 716 */ ps.setInt(3, this.monthsPaidSinceReset);\n/* 717 */ ps.setInt(4, this.monthsPaidEver);\n/* 718 */ ps.setInt(5, this.monthsPaidInARow);\n/* 719 */ ps.setInt(6, this.silverPaidEver);\n/* 720 */ ps.setLong(7, this.lastTicked);\n/* 721 */ ps.setInt(8, this.currentLoyaltyPoints);\n/* 722 */ ps.setInt(9, this.totalLoyaltyPoints);\n/* 723 */ ps.executeUpdate();\n/* 724 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* */ } \n/* 726 */ if (this.cooldowns.size() > 0)\n/* */ {\n/* 728 */ Cooldowns cd = Cooldowns.getCooldownsFor(this.wurmid, true);\n/* 729 */ for (Map.Entry<Integer, Long> ent : this.cooldowns.entrySet())\n/* */ {\n/* 731 */ cd.addCooldown(((Integer)ent.getKey()).intValue(), ((Long)ent.getValue()).longValue(), false);\n/* */ }\n/* */ }\n/* */ \n/* 735 */ } catch (SQLException sqex) {\n/* */ \n/* 737 */ logger.log(Level.WARNING, this.name + \" \" + sqex.getMessage(), sqex);\n/* 738 */ throw new IOException(sqex);\n/* */ }\n/* */ finally {\n/* */ \n/* 742 */ DbUtilities.closeDatabaseObjects(ps, null);\n/* 743 */ DbConnector.returnConnection(dbcon);\n/* */ } \n/* */ }", "@Override\n\tpublic boolean addDeposit(Deposits deposit) throws Exception {\n\t\tConnection conn = null;\n\t\tPreparedStatement ps = null;\n\t\tString sql=\"\";\n\t\tif (deposit.getType().equals(\"time\")) {\n\t\t sql = \"insert into deposits(a_id,amount,currency,deposit_time,interest,period,type,statement) values('\"\n\t\t\t\t\t+ deposit.getA_id()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getAmount()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getCurrency()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getDeposit_time()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getInterest()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getPeriod()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getType()\n\t\t\t\t\t+ \"','deposit')\";\n\t\t} else {\n\t\t\tsql = \"insert into deposits(a_id,amount,currency,deposit_time,interest,period,type) values('\"\n\t\t\t\t\t+ deposit.getA_id()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getAmount()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getCurrency()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getDeposit_time()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getInterest()\n\t\t\t\t\t+ \"','\"\n\t\t\t\t\t+ deposit.getPeriod() + \"','\" + deposit.getType() + \"')\";\n\t\t}\n\t\ttry {\n\t\t\tconn = DBConnection.getConnection();\n\t\t\tps = conn.prepareStatement(sql);\n\t\t\tint col = ps.executeUpdate();\n\t\t\tif (col > 0) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\tthrow new Exception(\"insert deposit record exception:\"\n\t\t\t\t\t+ e.getMessage());\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (ps != null) {\n\t\t\t\t\tps.close();\n\t\t\t\t}\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new Exception(\"ps close exception:\" + e.getMessage());\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (conn != null) {\n\t\t\t\t\tconn.close();\n\t\t\t\t}\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new Exception(\"conn close exception:\" + e.getMessage());\n\t\t\t}\n\t\t}\n\t}", "public void storeData(Data dataFrame, Map<String, Object> headers) throws Exception {\n\n BasicDBObject sphinxData = storeSphinxData(dataFrame, headers);\n storeSphinx4socDataStream(sphinxData.getString(\"_id\"), headers);\n }", "private static void writeDataBase() throws IOException{\n \t\n \t// Write variables and class labels\n \tFileSystem fs = FileSystem.get(Mediator.getConfiguration());\n\t ObjectOutputStream objectOutputStream = new ObjectOutputStream(fs.create(new Path(Mediator.getHDFSLocation()+\"/\"+Mediator.getLearnerDatabasePath())));\n\t objectOutputStream.writeObject(Mediator.getVariables());\n\t objectOutputStream.writeObject(Mediator.getClassLabels());\n\t objectOutputStream.close();\n\t fs.close();\n \t\n }", "public void backupAll() throws Exception {\n // create DataSet from database.\n IDataSet ds = conn.createDataSet();\n\n // write the content of database to temp file\n FlatXmlDataSet.write(ds, new FileWriter(backupFile), \"UTF-8\");\n }", "public void commit() {\n\t\tif (commit) {\n\t\t\t// Récupérer le path du JSON\n\t\t\tSystem.out.println(ClassLoader.getSystemResource(jsonFile));\n\t\t\tURL url = ClassLoader.getSystemResource(jsonFile);\n\t\t\t// On ouvre un flux d'écriture vers le fichier JSON\n\t\t\ttry (OutputStream ops = new FileOutputStream(Paths.get(url.toURI()).toFile())) {\n\t\t\t\t// Ecriture du fichier JSON avec formatage\n\t\t\t\t// (WithDefaultPrettyPrinter)\n\t\t\t\tobjectMapper.writerWithDefaultPrettyPrinter().writeValue(ops, database);\n\t\t\t\tlogger.info(\"OK - fichier JSON mis à jour \" + jsonFile);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tlogger.info(\"KO - FILE_NOT_FOUND\" + jsonFile);\n\t\t\t\tthrow new DataRepositoryException(\"KO - FILE_NOT_FOUND\", e);\n\t\t\t} catch (IOException e) {\n\t\t\t\tlogger.info(\"KO - I/O ERROR\" + jsonFile);\n\t\t\t\tthrow new DataRepositoryException(\"KO - I/O ERROR\", e);\n\t\t\t} catch (URISyntaxException e1) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "private static void mFirstSync(Connection con, FileReader fr, String club, boolean clubcorp) {\n\n PreparedStatement pstmt2 = null;\n Statement stmt = null;\n ResultSet rs = null;\n\n\n Member member = new Member();\n\n String line = \"\";\n String password = \"\";\n String temp = \"\";\n\n int i = 0;\n int inact = 0;\n int pri_indicator = 0;\n\n // Values from MFirst records\n //\n String fname = \"\";\n String lname = \"\";\n String mi = \"\";\n String suffix = \"\";\n String posid = \"\";\n String gender = \"\";\n String ghin = \"\";\n String memid = \"\";\n String mNum = \"\";\n String u_hndcp = \"\";\n String c_hndcp = \"\";\n String mship = \"\";\n String mtype = \"\";\n String msub_type = \"\";\n String bag = \"\";\n String email = \"\";\n String email2 = \"\";\n String phone = \"\";\n String phone2 = \"\";\n String mobile = \"\";\n String primary = \"\";\n String webid = \"\";\n String custom1 = \"\";\n String custom2 = \"\";\n String custom3 = \"\";\n\n float u_hcap = 0;\n float c_hcap = 0;\n int birth = 0;\n\n // Values from ForeTees records\n //\n String fname_old = \"\";\n String lname_old = \"\";\n String mi_old = \"\";\n String mship_old = \"\";\n String mtype_old = \"\";\n String email_old = \"\";\n String mNum_old = \"\";\n String ghin_old = \"\";\n String bag_old = \"\";\n String posid_old = \"\";\n String email2_old = \"\";\n String phone_old = \"\";\n String phone2_old = \"\";\n String suffix_old = \"\";\n String msub_type_old = \"\";\n\n float u_hcap_old = 0;\n float c_hcap_old = 0;\n int birth_old = 0;\n\n // Values for New ForeTees records\n //\n String memid_new = \"\";\n String webid_new = \"\";\n String fname_new = \"\";\n String lname_new = \"\";\n String mi_new = \"\";\n String mship_new = \"\";\n String mtype_new = \"\";\n String email_new = \"\";\n String mNum_new = \"\";\n String ghin_new = \"\";\n String bag_new = \"\";\n String posid_new = \"\";\n String email2_new = \"\";\n String phone_new = \"\";\n String phone2_new = \"\";\n String suffix_new = \"\";\n String msub_type_new = \"\";\n String dupuser = \"\";\n String dupwebid = \"\";\n String dupmnum = \"\";\n String emailMF = \"[email protected]\";\n String subject = \"Roster Sync Warning from ForeTees for \" +club;\n\n float u_hcap_new = 0;\n float c_hcap_new = 0;\n int birth_new = 0;\n int errCount = 0;\n int warnCount = 0;\n int totalErrCount = 0;\n int totalWarnCount = 0;\n int email_bounce1 = 0;\n int email_bounce2 = 0;\n\n String errorMsg = \"\";\n String errMemInfo = \"\";\n String errMsg = \"\";\n String warnMsg = \"\";\n String emailMsg1 = \"Duplicate names found in MembersFirst file during ForeTees Roster Sync processing for club: \" +club+ \".\\n\\n\";\n String emailMsg2 = \"\\nThis indicates that either 2 members have the exact same names (not allowed), or MF's member id has changed.\\n\\n\";\n\n ArrayList<String> errList = new ArrayList<String>();\n ArrayList<String> warnList = new ArrayList<String>();\n\n boolean failed = false;\n boolean changed = false;\n boolean skip = false;\n boolean found = false;\n boolean sendemail = false;\n boolean genderMissing = false;\n boolean useWebid = false;\n boolean useWebidQuery = false;\n\n\n // Overwrite log file with fresh one for today's logs\n SystemUtils.logErrorToFile(\"Members First: Error log for \" + club + \"\\nStart time: \" + new java.util.Date().toString() + \"\\n\", club, false);\n\n try {\n\n BufferedReader bfrin = new BufferedReader(fr);\n line = new String();\n\n // format of each line in the file:\n //\n // memid, mNum, fname, mi, lname, suffix, mship, mtype, gender, email, email2,\n // phone, phone2, bag, hndcp#, uhndcp, chndcp, birth, posid, mobile, primary\n //\n //\n while ((line = bfrin.readLine()) != null) { // get one line of text\n\n // Remove the dbl quotes and check for embedded commas\n\n line = cleanRecord( line );\n\n // parse the line to gather all the info\n\n StringTokenizer tok = new StringTokenizer( line, \",\" ); // delimiters are comma\n\n if ( tok.countTokens() > 20 ) { // enough data ?\n\n memid = tok.nextToken();\n mNum = tok.nextToken();\n fname = tok.nextToken();\n mi = tok.nextToken();\n lname = tok.nextToken();\n suffix = tok.nextToken();\n mship = tok.nextToken(); // col G\n mtype = tok.nextToken(); // col H\n gender = tok.nextToken();\n email = tok.nextToken();\n email2 = tok.nextToken();\n phone = tok.nextToken();\n phone2 = tok.nextToken();\n bag = tok.nextToken();\n ghin = tok.nextToken();\n u_hndcp = tok.nextToken();\n c_hndcp = tok.nextToken();\n temp = tok.nextToken();\n posid = tok.nextToken();\n mobile = tok.nextToken();\n primary = tok.nextToken(); // col U\n\n if ( tok.countTokens() > 0 ) {\n\n custom1 = tok.nextToken();\n }\n if ( tok.countTokens() > 0 ) {\n\n custom2 = tok.nextToken();\n }\n if ( tok.countTokens() > 0 ) {\n\n custom3 = tok.nextToken();\n }\n\n\n // trim gender in case followed be spaces\n gender = gender.trim();\n\n //\n // Check for ? (not provided)\n //\n if (memid.equals( \"?\" )) {\n\n memid = \"\";\n }\n if (mNum.equals( \"?\" )) {\n\n mNum = \"\";\n }\n if (fname.equals( \"?\" )) {\n\n fname = \"\";\n }\n if (mi.equals( \"?\" )) {\n\n mi = \"\";\n }\n if (lname.equals( \"?\" )) {\n\n lname = \"\";\n }\n if (suffix.equals( \"?\" )) {\n\n suffix = \"\";\n }\n if (mship.equals( \"?\" )) {\n\n mship = \"\";\n }\n if (mtype.equals( \"?\" )) {\n\n mtype = \"\";\n }\n if (gender.equals( \"?\" ) || (!gender.equalsIgnoreCase(\"M\") && !gender.equalsIgnoreCase(\"F\"))) {\n\n if (gender.equals( \"?\" )) {\n genderMissing = true;\n } else {\n genderMissing = false;\n }\n gender = \"\";\n }\n if (email.equals( \"?\" )) {\n\n email = \"\";\n }\n if (email2.equals( \"?\" )) {\n\n email2 = \"\";\n }\n if (phone.equals( \"?\" )) {\n\n phone = \"\";\n }\n if (phone2.equals( \"?\" )) {\n\n phone2 = \"\";\n }\n if (bag.equals( \"?\" )) {\n\n bag = \"\";\n }\n if (ghin.equals( \"?\" )) {\n\n ghin = \"\";\n }\n if (u_hndcp.equals( \"?\" )) {\n\n u_hndcp = \"\";\n }\n if (c_hndcp.equals( \"?\" )) {\n\n c_hndcp = \"\";\n }\n if (temp.equals( \"?\" )) {\n\n birth = 0;\n\n } else {\n\n birth = Integer.parseInt(temp);\n }\n if (posid.equals( \"?\" )) {\n\n posid = \"\";\n }\n if (mobile.equals( \"?\" )) {\n\n mobile = \"\";\n }\n if (primary.equals( \"?\" )) {\n\n primary = \"\";\n }\n\n //\n // Determine if we should process this record (does it meet the minimum requirements?)\n //\n if (!memid.equals( \"\" ) && !mNum.equals( \"\" ) &&\n !lname.equals( \"\" ) && !fname.equals( \"\" )) {\n\n //\n // Remove spaces, etc. from name fields\n //\n tok = new StringTokenizer( fname, \" \" ); // delimiters are space\n fname = tok.nextToken(); // remove any spaces and middle name\n\n if ( tok.countTokens() > 0 && mi.equals( \"\" )) {\n\n mi = tok.nextToken();\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n tok = new StringTokenizer( suffix, \" \" ); // delimiters are space\n suffix = tok.nextToken(); // remove any extra (only use one value)\n }\n\n tok = new StringTokenizer( lname, \" \" ); // delimiters are space\n lname = tok.nextToken(); // remove suffix and spaces\n\n if (!suffix.equals( \"\" ) && tok.countTokens() > 0 && club.equals(\"pradera\")) { // Pradera - if suffix AND 2-part lname, use both\n\n String lpart2 = tok.nextToken();\n\n lname = lname + \"_\" + lpart2; // combine them (i.e. Van Ess = Van_Ess)\n\n } else {\n\n if (suffix.equals( \"\" ) && tok.countTokens() > 0) { // if suffix not provided\n\n suffix = tok.nextToken();\n }\n }\n\n //\n // Make sure name is titled (most are already)\n //\n if (!club.equals(\"thereserveclub\")) {\n fname = toTitleCase(fname);\n }\n\n if (!club.equals(\"lakewoodranch\") && !club.equals(\"ballantyne\") && !club.equals(\"pattersonclub\") && !club.equals(\"baldpeak\") && !club.equals(\"pradera\") &&\n !club.equals(\"wellesley\") && !club.equals(\"portlandgc\") && !club.equals(\"trooncc\") && !club.equals(\"pmarshgc\") && !club.equals(\"paloaltohills\") &&\n !club.equals(\"thereserveclub\") && !club.equals(\"castlepines\")) {\n\n lname = toTitleCase(lname);\n }\n\n if (!suffix.equals( \"\" )) { // if suffix provided\n\n lname = lname + \"_\" + suffix; // append suffix to last name\n }\n\n //\n // Determine the handicaps\n //\n u_hcap = -99; // indicate no hndcp\n c_hcap = -99; // indicate no c_hndcp\n\n if (!u_hndcp.equals( \"\" ) && !u_hndcp.equalsIgnoreCase(\"NH\") && !u_hndcp.equalsIgnoreCase(\"NHL\")) {\n\n u_hndcp = u_hndcp.replace('L', ' '); // isolate the handicap - remove spaces and trailing 'L'\n u_hndcp = u_hndcp.replace('H', ' '); // or 'H' if present\n u_hndcp = u_hndcp.replace('N', ' '); // or 'N' if present\n u_hndcp = u_hndcp.replace('J', ' '); // or 'J' if present\n u_hndcp = u_hndcp.replace('R', ' '); // or 'R' if present\n u_hndcp = u_hndcp.trim();\n\n u_hcap = Float.parseFloat(u_hndcp); // usga handicap\n\n if ((!u_hndcp.startsWith(\"+\")) && (!u_hndcp.startsWith(\"-\"))) {\n\n u_hcap = 0 - u_hcap; // make it a negative hndcp (normal)\n }\n }\n\n if (!c_hndcp.equals( \"\" ) && !c_hndcp.equalsIgnoreCase(\"NH\") && !c_hndcp.equalsIgnoreCase(\"NHL\")) {\n\n c_hndcp = c_hndcp.replace('L', ' '); // isolate the handicap - remove spaces and trailing 'L'\n c_hndcp = c_hndcp.replace('H', ' '); // or 'H' if present\n c_hndcp = c_hndcp.replace('N', ' '); // or 'N' if present\n c_hndcp = c_hndcp.replace('J', ' '); // or 'J' if present\n c_hndcp = c_hndcp.replace('R', ' '); // or 'R' if present\n c_hndcp = c_hndcp.trim();\n\n c_hcap = Float.parseFloat(c_hndcp); // usga handicap\n\n if ((!c_hndcp.startsWith(\"+\")) && (!c_hndcp.startsWith(\"-\"))) {\n\n c_hcap = 0 - c_hcap; // make it a negative hndcp (normal)\n }\n }\n\n password = lname;\n\n //\n // if lname is less than 4 chars, fill with 1's\n //\n int length = password.length();\n\n while (length < 4) {\n\n password = password + \"1\";\n length++;\n }\n\n //\n // Verify the email addresses\n //\n if (!email.equals( \"\" )) { // if specified\n \n email = email.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email));\n\n if (!feedback.isPositive()) { // if error\n\n email = \"\"; // do not use it\n }\n }\n if (!email2.equals( \"\" )) { // if specified\n\n email2 = email2.trim(); // remove spaces\n\n FeedBack feedback = (member.isEmailValid(email2));\n\n if (!feedback.isPositive()) { // if error\n\n email2 = \"\"; // do not use it\n }\n }\n\n // if email #1 is empty then assign email #2 to it\n if (email.equals(\"\")) email = email2;\n\n skip = false;\n errCount = 0; // reset error count\n warnCount = 0; // reset warning count\n errMsg = \"\"; // reset error message\n warnMsg = \"\"; // reset warning message\n errMemInfo = \"\"; // reset error member info\n found = false; // init club found\n\n\n //\n // Format member info for use in error logging before club-specific manipulation\n //\n errMemInfo = \"Member Details:\\n\" +\n \" name: \" + lname + \", \" + fname + \" \" + mi + \"\\n\" +\n \" mtype: \" + mtype + \" mship: \" + mship + \"\\n\" +\n \" memid: \" + memid + \" mNum: \" + mNum + \" gender: \" + gender;\n\n // if gender is incorrect or missing, flag a warning in the error log\n if (gender.equals(\"\")) {\n\n // report only if not a club that uses blank gender fields\n if (!club.equals(\"roccdallas\") && !club.equals(\"charlottecc\") && !club.equals(\"sawgrass\") && !clubcorp) {\n\n warnCount++;\n if (genderMissing) {\n warnMsg = warnMsg + \"\\n\" +\n \" -GENDER missing! (Defaulted to 'M')\";\n } else {\n warnMsg = warnMsg + \"\\n\" +\n \" -GENDER incorrect! (Defaulted to 'M')\";\n }\n\n gender = \"M\";\n\n } else if (club.equals(\"charlottecc\") || club.equals(\"sawgrass\")) { // default to female instead\n\n warnCount++;\n if (genderMissing) {\n warnMsg = warnMsg + \"\\n\" +\n \" -GENDER missing! (Defaulted to 'F')\";\n } else {\n warnMsg = warnMsg + \"\\n\" +\n \" -GENDER incorrect! (Defaulted to 'F)\";\n }\n\n gender = \"F\";\n\n } else if (clubcorp) {\n\n errCount++;\n skip = true;\n if (genderMissing) {\n errMsg = errMsg + \"\\n\" +\n \" -SKIPPED: GENDER missing!\";\n } else {\n errMsg = errMsg + \"\\n\" +\n \" -SKIPPED: GENDER incorrect!\";\n }\n }\n }\n\n //\n // Skip entries with first/last names of 'admin'\n //\n if (fname.equalsIgnoreCase(\"admin\") || lname.equalsIgnoreCase(\"admin\")) {\n errCount++;\n skip = true;\n errMsg = errMsg + \"\\n\" +\n \" -INVALID NAME! 'Admin' or 'admin' not allowed for first or last name\";\n }\n\n //\n // *********************************************************************\n //\n // The following will be dependent on the club - customized\n //\n // *********************************************************************\n //\n\n //******************************************************************\n // Saucon Valley Country Club\n //******************************************************************\n //\n if (club.equals( \"sauconvalleycc\" )) {\n\n found = true; // club found\n\n //\n // Determine if we should process this record\n //\n if (!mship.equalsIgnoreCase( \"No Privileges\" ) && !mtype.equalsIgnoreCase( \"Social\" ) &&\n !mtype.equalsIgnoreCase( \"Recreational\" )) {\n\n //\n // determine member type\n //\n if (mtype.equals( \"\" )) { // if not specified\n mtype = \"Staff\"; // they are staff\n }\n if (mship.equals( \"\" )) { // if not specified\n mship = \"Staff\"; // they are staff\n }\n\n if (gender.equals( \"\" )) { // if not specified\n\n gender = \"M\"; // default to Male\n }\n\n //\n // The Member Types and Mship Types for this club are backwards.\n // We must set our fields accordingly.\n //\n String memType = mship; // set actual mtype value\n mship = mtype; // set actual mship value\n\n if (memType.equals( \"Full Golf Privileges\" )) {\n\n mtype = \"Full Golf Privileges Men\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Full Golf Privileges Women\";\n }\n }\n\n if (memType.equals( \"Limited Golf Privileges\" )) {\n\n mtype = \"Limited Golf Privileges Men\";\n\n if (gender.equals( \"F\" )) {\n\n mtype = \"Limited Golf Privileges Women\";\n }\n }\n\n if (memType.equals( \"Senior Limited Golf Privileges\" )) {\n\n mtype = \"Senior Limited Golf Privileges\";\n }\n\n //\n // set posid according to mNum\n //\n if (mNum.endsWith( \"-1\" )) { // if spouse\n\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n posid = tok.nextToken(); // get mNum without extension\n posid = stripA(posid); // remove the ending '0' (i.e. was 2740-1)\n posid = posid + \"1\"; // add a '1' (now 2741)\n\n } else {\n\n if (mNum.endsWith( \"-2\" )) { // if spouse or other\n\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n posid = tok.nextToken(); // get mNum without extension\n posid = stripA(posid); // remove the ending '0' (i.e. was 2740-2)\n posid = posid + \"2\"; // add a '2' (now 2742)\n\n } else {\n\n if (mNum.endsWith( \"-3\" )) { // if spouse or other\n\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n posid = tok.nextToken(); // get mNum without extension\n posid = stripA(posid); // remove the ending '0' (i.e. was 2740-3)\n posid = posid + \"3\"; // add a '3' (now 2743)\n\n } else {\n\n if (mNum.endsWith( \"-4\" )) { // if spouse or other\n\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n posid = tok.nextToken(); // get mNum without extension\n posid = stripA(posid); // remove the ending '0' (i.e. was 2740-4)\n posid = posid + \"4\"; // add a '4' (now 2744)\n\n } else {\n\n posid = mNum; // primary posid = mNum\n }\n }\n }\n }\n\n suffix = \"\"; // done with suffix for now\n\n //\n // Check if member is over 70 yrs old - if so, add '_*' to the end of the last name\n // so proshop will know\n //\n if (birth > 0 && birth < 19500000) { // if worth checking\n\n //\n // Get today's date and then go back 70 years\n //\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 70; // go back 70 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth <= oldDate) { // if member is 70+ yrs old\n\n lname = lname + \"_*\"; // inidicate such\n }\n }\n\n } else {\n\n skip = true; // skip this record\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n } // end of IF club = sauconvalleycc\n\n //******************************************************************\n // Crestmont CC\n //******************************************************************\n //\n if (club.equals( \"crestmontcc\" )) {\n\n found = true; // club found\n\n //\n // determine member type\n //\n\n if (gender.equals( \"\" )) { // if not specified\n\n gender = \"M\"; // default to Male\n }\n\n mtype = \"T Designated Male\";\n\n if (gender.equals( \"F\" )) {\n mtype = \"T Designated Female\";\n }\n\n } // end of IF club = crestmontcc\n\n //******************************************************************\n // Black Rock CC\n //******************************************************************\n //\n /*\n if (club.equals( \"blackrock\" )) {\n\n found = true; // club found\n\n //\n // remove the 'A' from spouses mNum\n //\n if (mNum.endsWith( \"A\" ) || mNum.endsWith( \"B\" ) || mNum.endsWith( \"C\" ) ||\n mNum.endsWith( \"D\" ) || mNum.endsWith( \"E\" ) || mNum.endsWith( \"F\" )) {\n\n mNum = stripA(mNum); // remove the ending 'A'\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (gender.equals( \"\" )) { // if not specified\n\n gender = \"M\"; // default to Male\n }\n\n if (!mtype.equals( \"Dependents\" )) { // if not a junior\n\n if (gender.equals( \"F\" )) {\n\n if (mtype.equals( \"Primary\" )) {\n\n mtype = \"Member Female\";\n\n } else {\n\n mtype = \"Spouse Female\";\n }\n\n } else { // Male\n\n if (mtype.equals( \"Primary\" )) {\n\n mtype = \"Member Male\";\n\n } else {\n\n mtype = \"Spouse Male\";\n }\n }\n }\n\n } // end of IF club = blackrock\n */\n\n //******************************************************************\n // John's Island CC\n //******************************************************************\n //\n if (club.equals( \"johnsisland\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is not a blank or admin record\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (lname.equalsIgnoreCase( \"admin\" )) {\n\n skip = true; // skip it\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Admin' MEMBERSHIP TYPE!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine membership type\n //\n if (mship.equals( \"Golf Member\" )) {\n mship = \"Golf\";\n } else if (mship.startsWith( \"Golf Swap\" )) {\n mship = \"Golf Swap\";\n lname = lname + \"*\"; // mark these members\n } else if (mship.equals( \"Sport/Social Member\" )) {\n mship = \"Sport Social\";\n lname = lname + \"*\"; // mark these members\n } else if (mship.startsWith( \"Sport/Social Swap\" )) {\n mship = \"Sport Social Swap\";\n } else {\n mship = \"Golf\";\n }\n\n //\n // determine member type\n //\n if (gender.equals( \"\" )) { // if not specified\n\n gender = \"M\"; // default to Male\n }\n\n if (gender.equals( \"M\" ) && primary.equals( \"P\" )) {\n mtype = \"Primary Male\";\n } else if (gender.equals( \"F\" ) && primary.equals( \"P\" )) {\n mtype = \"Primary Female\";\n } else if (gender.equals( \"M\" ) && primary.equals( \"S\" )) {\n mtype = \"Spouse Male\";\n } else if (gender.equals( \"F\" ) && primary.equals( \"S\" )) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n } // end of IF club = johnsisland\n\n/*\n //******************************************************************\n // Philadelphia Cricket Club\n //******************************************************************\n //\n if (club.equals( \"philcricket\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is not an admin record or missing mship/mtype\n //\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*Note* mship located in mtype field)\";\n\n } else if (lname.equalsIgnoreCase( \"admin\" )) {\n\n skip = true; // skip it\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Admin' MEMBERSHIP TYPE!\";\n } else {\n\n if (mtype.equalsIgnoreCase(\"Leave of Absence\")) {\n \n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (mtype.equalsIgnoreCase( \"golf stm family\" ) || mtype.equalsIgnoreCase( \"golf stm ind.\" )) {\n\n lname = lname + \"*\"; // add an astericks\n }\n\n // if mtype = no golf, add ^ to their last name\n if (mtype.equalsIgnoreCase( \"no golf\" )) {\n\n lname += \"^\";\n }\n\n mship = toTitleCase(mtype); // mship = mtype\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n\n /*\n //\n // determine member type\n //\n if (mtype.equalsIgnoreCase( \"2 junior ft golfers\" ) || mtype.equalsIgnoreCase( \"add'l jr. ft golfers\" ) ||\n mtype.equalsIgnoreCase( \"ft golf full 18-20\" ) || mtype.equalsIgnoreCase( \"ft jr. 17 & under\" ) ||\n mtype.equalsIgnoreCase( \"jr 17 & under w/golf\" ) || mtype.equalsIgnoreCase( \"jr 18-20 w/golf\" ) ||\n mtype.equalsIgnoreCase( \"jr. activity/no chg\" )) {\n\n mtype = \"Certified Juniors\";\n\n } else {\n\n if (gender.equals( \"\" )) { // if not specified\n\n gender = \"M\"; // default to Male\n }\n\n if (mtype.equalsIgnoreCase( \"ft assoc golf 21-30\" ) || mtype.equalsIgnoreCase( \"ft assoc ind golf\" ) ||\n mtype.equalsIgnoreCase( \"ft assoc ind/stm fm\" )) {\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Associate Male\";\n\n } else {\n\n mtype = \"Associate Female\";\n }\n\n } else {\n\n if (mtype.equalsIgnoreCase( \"ft full fm/ind 21-30\" ) || mtype.equalsIgnoreCase( \"ft full ind/sm fm\" ) ||\n mtype.equalsIgnoreCase( \"ft golf full fam.\" ) || mtype.equalsIgnoreCase( \"ft golf full ind.\" ) ||\n mtype.equalsIgnoreCase( \"ft golf honorary\" )) {\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Full Male\";\n\n } else {\n\n mtype = \"Full Female\";\n }\n\n } else {\n\n if (mtype.equalsIgnoreCase( \"golf stm family\" ) || mtype.equalsIgnoreCase( \"golf stm ind.\" )) {\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"STM Male\";\n\n } else {\n\n mtype = \"STM Female\";\n }\n\n } else {\n\n if (mtype.equalsIgnoreCase( \"golf stm (17-20)\" ) || mtype.equalsIgnoreCase( \"golf stm 16 & under\" )) {\n\n mtype = \"STM Junior\";\n\n } else {\n\n mtype = \"Non-Golfing\";\n }\n }\n }\n }\n }\n }\n\n } // end of IF club = philcricket\n\n */\n /*\n //******************************************************************\n // Edgewood CC\n //******************************************************************\n //\n if (club.equals( \"edgewood\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mship.equalsIgnoreCase( \"Sport\" )) {\n\n skip = true; // skip it\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Sport' MEMBERSHIP TYPE!\";\n } else if (mship.equalsIgnoreCase( \"Dining\" )) {\n\n skip = true; // skip it\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Dining' MEMBERSHIP TYPE!\";\n } else {\n\n //\n // Make sure mship is titled\n //\n mship = toTitleCase(mship);\n\n //\n // May have to strip -1 off end of mnum\n //\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken(); // get mNum without extension\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Strip any leading zeros from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // determine member type\n //\n if (gender.equals( \"\" ) || gender.equals( \"U\" )) { // if not specified or U (??)\n\n gender = \"M\"; // default to Male\n }\n\n if (primary.equals( \"P\" )) {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Primary Male\";\n } else {\n mtype = \"Primary Female\";\n }\n\n } else {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n }\n }\n } // end of IF club = edgewood\n */\n /*\n //******************************************************************\n // Out Door CC\n //******************************************************************\n //\n if (club.equals( \"outdoor\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n //\n // Translate the mship value - remove the '00x-' prefix\n //\n tok = new StringTokenizer( mship, \"-\" ); // delimiter is '-'\n\n if ( tok.countTokens() > 1 ) {\n\n mship = tok.nextToken(); // get prefix\n mship = tok.nextToken(); // get mship without prefix\n }\n\n\n //\n // May have to strip -1 off end of mnum\n //\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken(); // get mNum without extension\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (gender.equals( \"\" ) || gender.equals( \"U\" )) { // if not specified or U (??)\n\n gender = \"M\"; // default to Male\n }\n\n if (primary.equals( \"P\" )) {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Member Male\";\n } else {\n mtype = \"Member Female\";\n }\n\n } else {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n }\n }\n } // end of IF club = outdoor\n */\n\n\n //******************************************************************\n // Rhode Island CC\n //******************************************************************\n //\n if (club.equals( \"rhodeisland\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n //\n // May have to strip -1 off end of mnum\n //\n tok = new StringTokenizer( mNum, \"-\" ); // delimiter is '-'\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken(); // get mNum without extension\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (gender.equals( \"\" ) || gender.equals( \"U\" )) { // if not specified or U (??)\n\n gender = \"M\"; // default to Male\n }\n\n if (primary.equals( \"P\" )) {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Primary Male\";\n } else {\n mtype = \"Primary Female\";\n }\n\n } else {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n }\n }\n } // end of IF club = rhodeisland\n\n //******************************************************************\n // Wellesley CC\n //******************************************************************\n //\n if (club.equals( \"wellesley\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type (mship value plus 'Male' or 'Female' - i.e. 'Golf Male')\n //\n if (gender.equals( \"F\" )) { // if Female\n mtype = mship + \" Female\";\n } else {\n mtype = mship + \" Male\";\n }\n }\n } // end of IF club = wellesley\n\n //******************************************************************\n // Lakewood Ranch CC\n //******************************************************************\n //\n if (club.equals( \"lakewoodranch\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (gender.equals( \"\" ) || gender.equals( \"U\" )) { // if not specified or U (??)\n\n gender = \"M\"; // default to Male\n }\n\n if (mship.equalsIgnoreCase(\"SMR Members and Staff\")) {\n mship = \"SMR Members\";\n }\n\n if (primary.equals( \"P\" )) {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Primary Male\";\n } else {\n mtype = \"Primary Female\";\n }\n\n } else {\n\n if (gender.equals( \"M\" )) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n }\n }\n } // end of IF club = lakewoodranch\n\n //******************************************************************\n // Long Cove CC\n //******************************************************************\n //\n if (club.equals( \"longcove\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member sub-type (MGA or LGA)\n //\n msub_type = \"\";\n\n if (!mtype.equals( \"\" )) { // if mtype specified (actually is sub-type)\n\n msub_type = mtype; // set it in case they ever need it\n }\n\n //\n // determine member type\n //\n if (gender.equals( \"\" ) || gender.equals( \"U\" )) { // if not specified or U (??)\n\n gender = \"M\"; // default to Male\n }\n\n if (gender.equals( \"M\" )) {\n mtype = \"Adult Male\";\n } else {\n mtype = \"Adult Female\";\n }\n }\n } // end of IF club = longcove\n\n //******************************************************************\n // Bellerive CC\n //******************************************************************\n //\n /*\n if (club.equals( \"bellerive\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) { // mship exist ?\n\n skip = true; // no - skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (gender.equals( \"\" ) || gender.equals( \"U\" )) { // if not specified or U (??)\n\n if (primary.equalsIgnoreCase( \"P\" )) {\n\n gender = \"M\"; // default to Male\n\n } else {\n\n gender = \"F\"; // default to Female\n }\n }\n\n if (gender.equals( \"M\" )) {\n\n mtype = \"Adult Male\";\n\n } else {\n\n mtype = \"Adult Female\";\n }\n\n //\n // Strip any extra chars from mNum\n //\n if (mNum.endsWith( \"A\" ) || mNum.endsWith( \"B\" ) || mNum.endsWith( \"C\" ) ||\n mNum.endsWith( \"D\" ) || mNum.endsWith( \"E\" ) || mNum.endsWith( \"F\" )) {\n\n mNum = stripA(mNum); // remove the ending 'A'\n }\n\n if (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n // *** see oahucc and common MF processing below if we use this again *****************\n\n webid = memid; // use id from MF\n\n //\n // Set the proper mship type\n //\n if (mship.equalsIgnoreCase( \"Active\" ) || mship.equalsIgnoreCase( \"Associate\" ) ||\n mship.equalsIgnoreCase( \"Junior\" ) || mship.equalsIgnoreCase( \"Life\" )) {\n\n mship = \"Golf\";\n }\n\n if (mship.equalsIgnoreCase( \"Non-Golf\" )) {\n\n mship = \"Non-Golf Senior\";\n }\n\n if (mship.equalsIgnoreCase( \"Non-Res\" )) {\n\n mship = \"Non-Resident\";\n }\n\n if (mship.equalsIgnoreCase( \"Spouse\" )) {\n\n //\n // See if we can locate the primary and use his/her mship (else leave as is, it will change next time)\n //\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship FROM member2b WHERE memNum = ? AND webid != ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, mNum);\n pstmt2.setString(2, webid);\n rs = pstmt2.executeQuery();\n\n if(rs.next()) {\n\n mship = rs.getString(\"m_ship\");\n }\n pstmt2.close(); // close the stmt\n }\n }\n } // end of IF club = bellerive\n */\n\n //******************************************************************\n // Peninsula Club\n //******************************************************************\n //\n if (club.equals( \"peninsula\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals(\"\")) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (!mship.equalsIgnoreCase( \"Full\" ) && !mship.equalsIgnoreCase( \"Sports\" ) && !mship.equalsIgnoreCase( \"Corp Full\" ) &&\n !mship.equalsIgnoreCase( \"Tennis\" )) { // mship ok ?\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // determine member type\n //\n if (primary.equalsIgnoreCase( \"P\" )) { // if Primary member\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n } else { // Spouse\n\n if (gender.equalsIgnoreCase( \"M\" )) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n }\n }\n } // end of IF club = peninsula\n\n\n //******************************************************************\n // Wilmington CC\n //******************************************************************\n //\n if (club.equals( \"wilmington\" )) {\n\n found = true; // club found\n\n // Make sure this is ok\n if (mship.equals( \"\" )) { // mship missing ?\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else {\n\n // Set POS Id in case they ever need it\n posid = mNum;\n\n // determine membership type and member type\n if (mship.equalsIgnoreCase( \"Child\" )) { // if child\n\n mship = \"Associate\";\n\n // Check if member is 13 or over\n if (birth > 0) {\n\n // Get today's date and then go back 13 years\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 13; // go back 13 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth <= oldDate) { // if member is 13+ yrs old\n mtype = \"Dependent\";\n } else {\n mtype = \"Dependent - U13\";\n }\n }\n\n } else {\n\n if (mship.equalsIgnoreCase( \"Senior\" ) || mship.equalsIgnoreCase( \"Associate\" ) || mship.equalsIgnoreCase(\"Clerical\")) { // if Senior or spouse\n skip = false; // ok\n } else if (mship.endsWith( \"Social\" )) { // if any Social\n mship = \"Social\"; // convert all to Social\n } else if (mship.equalsIgnoreCase( \"Senior Special\" )) { // if Senior Special\n mship = \"Associate\"; // convert to Associate\n } else if (mship.equalsIgnoreCase( \"Senior Transfer\" )) { // if Senior Special\n mship = \"Senior\"; // convert to Senior\n } else {\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n if (gender.equalsIgnoreCase( \"M\" )) {\n mtype = \"Adult Male\";\n } else {\n mtype = \"Adult Female\";\n }\n }\n\n // Check if member has range privileges\n msub_type = \"\"; // init\n\n if (custom1.equalsIgnoreCase( \"range\" )) {\n msub_type = \"R\"; // yes, indicate this so it can be displayed on Pro's tee sheet\n }\n\n }\n } // end of IF club = wilmington\n\n\n //******************************************************************\n // Awbrey Glen CC\n //******************************************************************\n //\n if (club.equals( \"awbreyglen\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) { // mship missing ?\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (mship.equalsIgnoreCase(\"Employee\")) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n if (gender.equals( \"\" )) { // if gender not specified\n\n gender = \"M\"; // default to Male\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n gender = \"F\"; // assume Female\n }\n }\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n }\n } // end of IF club = awbreyglen\n\n\n //******************************************************************\n // The Pinery CC\n //******************************************************************\n //\n if (club.equals( \"pinery\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip it\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mship.equalsIgnoreCase( \"Tennis Dues\" ) || mship.equalsIgnoreCase( \"Social Dues\" ) ||\n mship.equalsIgnoreCase( \"Premier Tennis Dues\" ) || mship.equalsIgnoreCase( \"Premier Social Prepaid\" ) ||\n mship.equalsIgnoreCase( \"Premier Social Dues\" ) || mship.equalsIgnoreCase( \"Premier Dining Dues\" ) ||\n mship.equalsIgnoreCase( \"Dining Dues\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Make sure mship is titled\n //\n mship = toTitleCase(mship);\n\n //\n // Set mtype\n //\n if (primary.equals( \"\" )) { // if primary not specified\n\n primary = \"P\"; // default to Primary\n }\n\n if (gender.equals( \"\" )) { // if gender not specified\n\n gender = \"M\"; // default to Male\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n gender = \"F\"; // assume Female\n }\n }\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equalsIgnoreCase( \"M\" )) { // if Male\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\"; // default Spouse\n }\n\n } else { // Primary\n\n if (gender.equalsIgnoreCase( \"F\" )) { // if Female\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\"; // default Primary\n }\n }\n\n }\n } // end of IF club = pinery\n\n\n\n //******************************************************************\n // The Country Club\n //******************************************************************\n //\n if (club.equals( \"tcclub\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else {\n\n if (mship.startsWith( \"65 & above \" )) {\n\n mship = \"65 & Above Exempt\"; // remove garbage character\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n if (primary.equals( \"\" )) { // if primary not specified\n\n primary = \"P\"; // default to Primary\n }\n\n if (gender.equals( \"\" )) { // if gender not specified\n\n gender = \"M\"; // default to Male\n }\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equalsIgnoreCase( \"M\" )) { // if Male\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\"; // default Spouse\n }\n\n } else { // Primary\n\n if (gender.equalsIgnoreCase( \"F\" )) { // if Female\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\"; // default Primary\n }\n }\n\n //\n // Check for dependents\n //\n if (mNum.endsWith(\"-2\") || mNum.endsWith(\"-3\") || mNum.endsWith(\"-4\") || mNum.endsWith(\"-5\") ||\n mNum.endsWith(\"-6\") || mNum.endsWith(\"-7\") || mNum.endsWith(\"-8\") || mNum.endsWith(\"-9\")) {\n if (gender.equalsIgnoreCase( \"F \")) {\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n }\n\n }\n } // end of IF club = tcclub\n\n //******************************************************************\n // Navesink Country Club\n //******************************************************************\n //\n if (club.equals( \"navesinkcc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok - mship is in the mtype field for this club!!!!!!!!\n //\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else {\n\n useWebid = true;\n webid = memid;\n memid = mNum; // use mNum for username, they are unique!\n\n\n if (mtype.startsWith( \"Member Type\" )) {\n\n mship = mtype.substring(12); // remove garbage character\n\n } else {\n mship = mtype;\n }\n\n if (mship.equalsIgnoreCase(\"SS\") || mship.equalsIgnoreCase(\"SSQ\") || mship.equalsIgnoreCase(\"WMF\") ||\n mship.equalsIgnoreCase(\"WMS\") || mship.equalsIgnoreCase(\"HQ\") || mship.equalsIgnoreCase(\"HM\") ||\n mship.equalsIgnoreCase(\"H\") || mship.equalsIgnoreCase(\"HL\") || mship.equalsIgnoreCase(\"HR\") ||\n mship.equalsIgnoreCase(\"JSQ\") || mship.equalsIgnoreCase(\"SHL\") || mship.equalsIgnoreCase(\"SP\") ||\n mship.equalsIgnoreCase(\"SPJ\") || mship.equalsIgnoreCase(\"SPQ\")) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else {\n\n StringTokenizer navTok = null;\n\n // check Primary/Spouse\n if (mNum.endsWith(\"-1\")) {\n primary = \"S\";\n mNum = mNum.substring(0, mNum.length() - 2);\n\n } else if (mNum.endsWith(\"-2\") || mNum.endsWith(\"-3\") || mNum.endsWith(\"-4\") ||\n mNum.endsWith(\"-5\") || mNum.endsWith(\"-6\") || mNum.endsWith(\"-7\") ||\n mNum.endsWith(\"-8\") || mNum.endsWith(\"-9\")) {\n primary = \"D\";\n mNum = mNum.substring(0, mNum.length() - 2);\n } else {\n primary = \"P\";\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equalsIgnoreCase( \"M\" )) { // if Male\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\"; // default Spouse\n }\n\n } else if (primary.equalsIgnoreCase( \"D\" )) {\n\n //\n // Dependent mtype based on age\n //\n Calendar cal = new GregorianCalendar(); // get todays date\n\n int year = cal.get(Calendar.YEAR);\n int month = cal.get(Calendar.MONTH) +1;\n int day = cal.get(Calendar.DAY_OF_MONTH);\n\n year = year - 18; // backup 18 years\n\n int oldDate = (year * 10000) + (month * 100) + day; // get date\n\n if (birth > oldDate || birth == 0) { // dependent is under 18 or no bday provided\n\n mtype = \"Dependent Under 18\";\n } else {\n mtype = \"Dependent 18-24\";\n }\n\n } else { // Primary\n\n if (gender.equalsIgnoreCase( \"F\" )) { // if Female\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\"; // default Primary\n }\n }\n\n if (mship.equalsIgnoreCase(\"SR\") || mship.equalsIgnoreCase(\"SRQ\")) {\n mship = \"SR\";\n } else if (mship.equalsIgnoreCase(\"JR\") || mship.equalsIgnoreCase(\"JRQ\")) {\n mship = \"JR\";\n } else if (mship.equalsIgnoreCase(\"NR\") || mship.equalsIgnoreCase(\"NRQ\")) {\n mship = \"NR\";\n } else if (mship.equalsIgnoreCase(\"R\") || mship.equalsIgnoreCase(\"RQ\")) {\n mship = \"R\";\n }\n }\n }\n } // end of IF club = navesinkcc\n\n\n //******************************************************************\n // The International\n //******************************************************************\n //\n if (club.equals( \"international\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n mship = \"Unknown\"; // allow for missing mships for now\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n if (gender.equalsIgnoreCase( \"F\" )) { // if Female\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\"; // default Primary\n }\n\n //\n // Set mship\n //\n if (mship.equals( \"Other\" ) || mship.equals( \"Social\" ) || mship.startsWith( \"Spouse of\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else {\n\n if (mship.startsWith( \"Corporate\" ) || mship.startsWith( \"ITT\" )) {\n mship = \"Corporate\";\n } else if (mship.equals( \"Individual\" ) || mship.endsWith( \"Individual\" ) || mship.startsWith( \"Honorary\" ) ||\n mship.startsWith( \"Owner\" ) || mship.equals( \"Trade\" )) {\n mship = \"Individual\";\n } else if (mship.startsWith( \"Family\" ) || mship.startsWith( \"Senior Family\" )) {\n mship = \"Family\";\n } else if (mship.startsWith( \"Out of Region\" )) {\n mship = \"Out of Region\";\n } else if (mship.startsWith( \"Associat\" )) {\n mship = \"Associate\";\n } else if (mship.startsWith( \"Staff\" )) {\n mship = \"Staff\";\n }\n\n }\n } // end of IF club = international\n\n\n //******************************************************************\n // Blue Hill\n //******************************************************************\n //\n if (club.equals( \"bluehill\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok - mship is in the mtype field for this club!!!!!!!!\n //\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n } else {\n\n mship = mtype; // move over\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equalsIgnoreCase( \"M\" )) { // if Male\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n\n } else { // must be Primary\n\n if (gender.equalsIgnoreCase( \"F\" )) { // if Female\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\"; // default Primary\n }\n }\n\n //\n // Set mship\n //\n if (mship.startsWith( \"Social\" )) {\n mship = \"Social Golf\";\n } else if (mship.startsWith( \"Associat\" )) {\n mship = \"Associate\";\n } else if (mship.startsWith( \"Corporate\" )) {\n mship = \"Corporate\";\n } else if (!mship.equals( \"Junior\" )) {\n mship = \"Regular Golf\"; // all others (Junior remains as Junior)\n }\n }\n } // end of IF club = bluehill\n\n\n //******************************************************************\n // Oak Lane\n //******************************************************************\n //\n if (club.equals( \"oaklane\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok - mship is in the mtype field for this club!!!!!!!!!!!!!!!!!\n //\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing or not allowed! (*NOTE* mship located in mtype field)\";\n } else {\n\n mship = mtype; // move over\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Remove '-n' from mNum\n //\n tok = new StringTokenizer( mNum, \"-\" ); // delimiters are space\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken(); // get main mNum\n }\n\n //\n // Set mtype\n //\n if (primary.equalsIgnoreCase( \"S\" )) { // if Spouse\n\n if (gender.equalsIgnoreCase( \"M\" )) { // if Male\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n\n } else { // must be Primary\n\n if (gender.equalsIgnoreCase( \"F\" )) { // if Female\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\"; // default Primary\n }\n }\n\n //\n // Set mship\n //\n if (mship.startsWith( \"Senior Social\" ) || mship.startsWith( \"Social\" )) {\n mship = \"Social\";\n } else if (mship.startsWith( \"Senior Tennis\" ) || mship.startsWith( \"Summer Tennis\" ) || mship.startsWith( \"Tennis\" )) {\n mship = \"Tennis\";\n }\n }\n } // end of IF club = oaklane\n\n\n //******************************************************************\n // Green Hills\n //******************************************************************\n //\n if (club.equals( \"greenhills\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok - mship is in the mtype field for this club!!!!!!!!!!!!!!!!!\n //\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n } else {\n\n mship = mtype; // move over\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n mtype = \"Primary Male\"; // default Primary\n\n if (mNum.endsWith( \"-1\" )) { // if Spouse\n mtype = \"Spouse Female\";\n }\n\n //\n // Remove '-n' from mNum\n //\n tok = new StringTokenizer( mNum, \"-\" ); // delimiters are space\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken(); // get main mNum\n }\n }\n } // end of IF club = greenhills\n\n\n //******************************************************************\n // Oahu CC\n //******************************************************************\n //\n if (club.equals( \"oahucc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n memid = mNum; // use mNum for username (each is unique) - if new member!!!\n // mNum can change so we can't count on this being the username for existing members!!\n\n // This family has a last name consisting of 3 words. If them, just plug in the correct name\n if (memid.equals(\"4081\") || memid.equals(\"4081-1\")) {\n lname = \"de_los_Reyes\";\n }\n\n //\n // Convert some mships\n //\n if (mship.equalsIgnoreCase( \"Surviving Spouse 50 Year Honorary\" )) {\n mship = \"Surv Sp 50 Year Honorary\";\n } else if (mship.equalsIgnoreCase( \"Surviving Spouse - Non-Resident\" )) {\n mship = \"Surviving Spouse Non-Resident\";\n } else if (mship.equalsIgnoreCase( \"Surviving Spouse Non-Resident - Golf\" )) {\n mship = \"Surv Sp Non-Resident - Golf\";\n } else if (mship.equalsIgnoreCase( \"Surviving Spouse Super Senior - Golf\" )) {\n mship = \"Surv Sp Super Senior - Golf\";\n } else if (mship.equalsIgnoreCase( \"Surviving Spouse Super Senior - Social\" )) {\n mship = \"Surv Sp Super Senior - Social\";\n }\n\n //\n // Set mtype\n //\n if (mship.startsWith(\"Surv\") || mship.equalsIgnoreCase(\"SS50\")) { // if Surviving Spouse\n\n mtype = \"Spouse\"; // always Spouse\n\n } else {\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if spouse\n mtype = \"Spouse\";\n } else {\n mtype = \"Primary\"; // default to Primary\n }\n }\n\n //\n // Check for Junior Legacy members last\n //\n if (mship.startsWith( \"Jr\" )) {\n\n mship = \"Junior Legacy\";\n mtype = \"Spouse\";\n }\n }\n } // end of IF club = oahucc\n\n\n\n //******************************************************************\n // Ballantyne CC\n //******************************************************************\n //\n if (club.equals( \"ballantyne\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n memid = mNum; // use mNum for username (each is unique) - if new member!!!\n // mNum can change so we can't count on this being the username for existing members!!\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n tok = new StringTokenizer( mNum, \"-\" );\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken();\n }\n\n //\n // Convert some mships ************** finish this!!!!!!!!! ************\n //\n if (mtype.equalsIgnoreCase( \"Full Golf\" ) || mship.equalsIgnoreCase(\"Trial Member - Golf\")) {\n\n mship = \"Golf\";\n skip = false;\n\n } else if (mtype.equalsIgnoreCase( \"Limited Golf\" ) || mship.equalsIgnoreCase( \"Master Member\" ) || mship.equalsIgnoreCase(\"Trial Sports Membership\")) {\n\n mship = \"Sports\";\n skip = false;\n\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n //\n // Set mtype ?????????? **************** and this !!!! **************\n //\n if (primary.equalsIgnoreCase( \"S\" )) { // if spouse\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\"; // default to Primary\n }\n }\n } // end of IF club is ballantyne\n\n\n //******************************************************************\n // Troon CC\n //******************************************************************\n //\n if (club.equals( \"trooncc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique) - if new member!!!\n // mNum can change so we can't count on this being the username for existing members!!\n\n tok = new StringTokenizer( mNum, \"-\" );\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken();\n }\n\n if (mship.equalsIgnoreCase(\"Golf\") || mship.equalsIgnoreCase(\"Intermediate Golf\") ||\n mship.equalsIgnoreCase(\"Social to Golf Upgrade\") || mship.equalsIgnoreCase(\"Founding\")) {\n mship = \"Golf\";\n } else if (mship.equalsIgnoreCase(\"Social\") || mship.equalsIgnoreCase(\"Social from Golf\")) {\n mship = \"Social\";\n } else if (!mship.equalsIgnoreCase(\"Senior\") && !mship.equalsIgnoreCase(\"Dependent\")) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n try {\n if (mship.equalsIgnoreCase(\"Dependent\") && (mNum.endsWith(\"A\") || mNum.endsWith(\"a\") || mNum.endsWith(\"B\") || mNum.endsWith(\"b\"))) {\n String mNumTemp = mNum.substring(0, mNum.length() - 1);\n PreparedStatement pstmtTemp = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE username = ?\");\n\n pstmtTemp.clearParameters();\n pstmtTemp.setString(1, mNumTemp);\n\n ResultSet rsTemp = pstmtTemp.executeQuery();\n\n if (rsTemp.next()) {\n mship = rsTemp.getString(\"m_ship\");\n }\n\n pstmtTemp.close();\n }\n } catch (Exception exc) {\n mship = \"Unknown\";\n }\n\n //\n // Set mtype\n //\n if (gender.equalsIgnoreCase( \"F\" )) { // if spouse\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\"; // default to Primary\n }\n }\n } // end of IF club = trooncc\n\n\n //******************************************************************\n // Imperial GC\n //******************************************************************\n //\n if (club.equals( \"imperialgc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mship.startsWith( \"Account\" ) || mship.equals( \"Dining Full\" ) ||\n mship.equals( \"Dining Honorary\" ) || mship.equals( \"Dining Single\" ) ||\n mship.equals( \"Resigned\" ) || mship.equals( \"Suspended\" )) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else {\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n //useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique) - if new member!!!\n // mNum can change so we can't count on this being the username for existing members!!\n\n tok = new StringTokenizer( mNum, \"-\" );\n\n if ( tok.countTokens() > 1 ) {\n\n mNum = tok.nextToken();\n }\n\n\n //\n // Convert some mships\n //\n if (mship.startsWith( \"Associate\" )) {\n mship = \"Associate\";\n } else if (mship.startsWith( \"Dining Summer\" )) {\n mship = \"Dining Summer Golf\";\n } else if (mship.startsWith( \"Golf Royal\" )) {\n mship = \"Golf Royal\";\n } else if (mship.startsWith( \"Golf Single\" ) || mship.equalsIgnoreCase(\"RISINGLE\")) {\n mship = \"Golf Single\";\n } else if (mship.equalsIgnoreCase(\"RIMEMBER\")) {\n mship = \"Golf Full\";\n } else if (mship.startsWith( \"Limited Convert\" )) {\n mship = \"Limited Convertible\";\n } else if (mship.startsWith( \"Resigned\" )) {\n mship = \"Resigned PCD\";\n }\n\n //\n // Set mtype\n //\n if (gender.equals( \"\" )) {\n\n gender = \"M\";\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if spouse\n\n gender = \"F\";\n }\n }\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\"; // default to Primary\n }\n }\n } // end of IF club = imperialgc\n\n\n\n /* Disable - Pro wants to maintain roster himself !!!\n *\n //******************************************************************\n // Hop Meadow GC\n //******************************************************************\n //\n if (club.equals( \"hopmeadowcc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique) - if new member!!!\n\n tok = new StringTokenizer( mNum, \"-\" );\n\n if ( tok.countTokens() > 1 ) {\n\n mNum = tok.nextToken(); // keep mnum same for all family members\n }\n\n\n //\n // Convert some mships\n //\n if (mship.startsWith( \"Sporting\" )) {\n\n mship = \"Sporting Member\";\n\n } else {\n\n if (mship.startsWith( \"Dependent\" )) {\n\n mship = \"Dependents\";\n\n } else {\n\n if (mship.startsWith( \"Non-Resid\" )) {\n\n mship = \"Non Resident\";\n\n } else {\n\n if (mship.equals( \"Clergy\" ) || mship.startsWith( \"Full Privilege\" ) ||\n mship.equals( \"Honorary\" ) || mship.startsWith( \"Retired Golf\" )) {\n\n mship = \"Full Privilege Golf\";\n\n } else if (mship.equals(\"Senior\")) {\n\n // let Senior come through as-is\n\n } else {\n\n skip = true; // skip all others\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n }\n }\n\n //\n // Set mtype\n //\n if (gender.equals( \"\" )) {\n\n gender = \"M\";\n }\n\n if (primary.equalsIgnoreCase( \"S\" )) { // if spouse\n\n mtype = \"Spouse Female\";\n\n if (!gender.equalsIgnoreCase( \"F\")) {\n\n mtype = \"Spouse Male\";\n }\n\n } else {\n\n mtype = \"Primary Male\";\n\n if (gender.equalsIgnoreCase( \"F\" )) {\n\n mtype = \"Primary Female\";\n }\n }\n }\n } // end of IF club = hopmeadowcc\n */\n\n\n\n //******************************************************************\n // Bentwater Yacht & CC\n //******************************************************************\n //\n if (club.equals( \"bentwaterclub\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique) - if new member!!!\n\n //\n // Convert the mships (\"Member Type:xxx\" - just take the xxx)\n //\n tok = new StringTokenizer( mship, \":\" );\n\n if ( tok.countTokens() > 1 ) {\n\n mship = tok.nextToken(); // skip 1st part\n mship = tok.nextToken(); // get actual mship\n }\n\n\n //\n // Set mtype\n //\n mtype = \"Member\"; // same for all\n }\n } // end of IF club = bentwaterclub\n\n\n //******************************************************************\n // Sharon Heights\n //******************************************************************\n //\n if (club.equals( \"sharonheights\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else {\n\n //\n // Make sure mship is titled\n //\n mship = toTitleCase(mship);\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use id from MF\n\n\n //\n // Set POS Id - leave leading zeros, but strip trailing alpha!!\n //\n if (!mNum.endsWith( \"0\" ) && !mNum.endsWith( \"1\" ) && !mNum.endsWith( \"2\" ) && !mNum.endsWith( \"3\" ) &&\n !mNum.endsWith( \"4\" ) && !mNum.endsWith( \"5\" ) && !mNum.endsWith( \"6\" ) && !mNum.endsWith( \"7\" ) &&\n !mNum.endsWith( \"8\" ) && !mNum.endsWith( \"9\" )) {\n\n posid = stripA(mNum); // remove trailing alpha for POSID\n }\n\n\n //\n // Strip any leading zeros and from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum w/o zeros for username (each is unique - MUST include the trailing alpha!!)\n\n //\n // Set mtype\n //\n mtype = \"Adult Male\"; // default\n\n if (!gender.equals(\"\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Adult Female\";\n }\n\n } else {\n\n if (mNum.endsWith(\"B\") || mNum.endsWith(\"b\")) {\n\n mtype = \"Adult Female\";\n }\n }\n\n //\n // Now remove the trainling alpha from mNum\n //\n if (!mNum.endsWith( \"0\" ) && !mNum.endsWith( \"1\" ) && !mNum.endsWith( \"2\" ) && !mNum.endsWith( \"3\" ) &&\n !mNum.endsWith( \"4\" ) && !mNum.endsWith( \"5\" ) && !mNum.endsWith( \"6\" ) && !mNum.endsWith( \"7\" ) &&\n !mNum.endsWith( \"8\" ) && !mNum.endsWith( \"9\" )) {\n\n mNum = stripA(mNum); // remove trailing alpha\n }\n }\n } // end of IF club = sharonheights\n\n\n/*\n //******************************************************************\n // Bald Peak\n //******************************************************************\n //\n if (club.equals( \"baldpeak\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else {\n\n //\n // Make sure mship is titled\n //\n mship = toTitleCase(mship);\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use MF's memid\n memid = mNum; // use mNum for username (each is unique)\n\n\n if (!mNum.endsWith( \"0\" ) && !mNum.endsWith( \"1\" ) && !mNum.endsWith( \"2\" ) && !mNum.endsWith( \"3\" ) &&\n !mNum.endsWith( \"4\" ) && !mNum.endsWith( \"5\" ) && !mNum.endsWith( \"6\" ) && !mNum.endsWith( \"7\" ) &&\n !mNum.endsWith( \"8\" ) && !mNum.endsWith( \"9\" )) {\n\n mNum = stripA(mNum); // remove trailing alpha\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n\n //\n // Set mtype\n //\n mtype = \"Adult Male\"; // default\n\n if (!gender.equals(\"\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Adult Female\";\n }\n\n } else {\n\n if (primary.equalsIgnoreCase(\"S\")) {\n\n mtype = \"Adult Female\";\n gender = \"F\";\n }\n }\n }\n } // end of IF club = baldpeak\n*/\n\n //******************************************************************\n // Mesa Verde CC\n //******************************************************************\n //\n if (club.equals( \"mesaverdecc\" )) {\n\n found = true; // club found\n\n //\n // Make sure mship is titled\n //\n mship = toTitleCase(mship);\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (mship.startsWith( \"Social\" )) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique)\n\n //\n // Set mtype\n //\n mtype = \"Member\"; // default\n\n if (!gender.equals(\"\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Auxiliary\";\n }\n\n } else {\n\n if (primary.equalsIgnoreCase(\"S\")) {\n\n mtype = \"Auxiliary\";\n gender = \"F\";\n }\n }\n }\n } // end of IF club = mesaverdecc\n\n\n //******************************************************************\n // Portland CC\n //******************************************************************\n //\n if (club.equals( \"portlandcc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique)\n\n //\n // Set mtype\n //\n if (gender.equalsIgnoreCase(\"F\")) {\n\n if (primary.equalsIgnoreCase(\"P\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Spouse Female\";\n }\n\n } else {\n\n if (primary.equalsIgnoreCase(\"P\")) {\n mtype = \"Primary Male\";\n } else {\n mtype = \"Spouse Male\";\n }\n }\n\n //\n // Set mship\n //\n if (mship.endsWith(\"10\") || mship.endsWith(\"11\") || mship.endsWith(\"12\") || mship.endsWith(\"14\") ||\n mship.endsWith(\"15\") || mship.endsWith(\"16\") || mship.endsWith(\"17\")) {\n\n mship = \"Active\";\n\n } else if (mship.endsWith(\"20\") || mship.endsWith(\"21\")) {\n mship = \"Social\";\n } else if (mship.endsWith(\"30\") || mship.endsWith(\"31\")) {\n mship = \"Senior Active\";\n } else if (mship.endsWith(\"40\") || mship.endsWith(\"41\")) {\n mship = \"Junior Active\";\n } else if (mship.endsWith(\"18\") || mship.endsWith(\"19\")) {\n mship = \"Junior Social\";\n } else if (mship.endsWith(\"50\") || mship.endsWith(\"51\") || mship.endsWith(\"60\")) {\n mship = \"Unattached\";\n } else if (mship.endsWith(\"78\") || mship.endsWith(\"79\")) {\n mship = \"Social Non-Resident\";\n } else if (mship.endsWith(\"80\") || mship.endsWith(\"81\")) {\n mship = \"Active Non-Resident\";\n } else if (mship.endsWith(\"70\") || mship.endsWith(\"71\") || mship.endsWith(\"72\")) {\n mship = \"Spousal\";\n } else {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n } // end of IF club = portlandcc\n\n\n /*\n //******************************************************************\n // Dorset FC - The Pro does not want to use RS - he will maintain the roster\n //******************************************************************\n //\n if (club.equals( \"dorsetfc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else {\n\n if (!mship.endsWith( \":5\" ) && !mship.endsWith( \":9\" ) && !mship.endsWith( \":17\" ) && !mship.endsWith( \":21\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique)\n\n\n //\n // Set mtype\n //\n mtype = \"Adult Male\"; // default\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Adult Female\";\n }\n\n //\n // Set mship\n //\n mship = \"Family Full\";\n }\n }\n } // end of IF club = dorsetfc\n */\n\n\n //******************************************************************\n // Baltusrol GC\n //******************************************************************\n //\n if (club.equals( \"baltusrolgc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else {\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique)\n\n\n //\n // Set mtype\n //\n if (memid.endsWith(\"-1\")) { // if Spouse\n\n if (gender.equalsIgnoreCase(\"M\")) {\n\n mtype = \"Spouse Male\";\n\n } else {\n\n mtype = \"Spouse Female\";\n\n fname = \"Mrs_\" + fname; // change to Mrs....\n }\n\n } else { // Primary\n\n if (gender.equalsIgnoreCase(\"F\")) {\n\n mtype = \"Primary Female\";\n\n } else {\n\n mtype = \"Primary Male\";\n }\n }\n\n //\n // Set the mship type\n //\n if (mship.startsWith(\"Junior\")) { // Funnel anything starting with 'Junior' to be simply \"Junior\"\n\n mship = \"Junior\";\n\n } else if (mship.equalsIgnoreCase(\"Staff\") || mship.startsWith(\"Type\")) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n } // end of IF club = baultusrolcc\n\n\n\n\n //******************************************************************\n // The Club at Pradera\n //******************************************************************\n //\n if (club.equals( \"pradera\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n } else {\n\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n memid = mNum; // use mNum for username (each is unique)\n\n //\n // Set mtype\n //\n if (mNum.endsWith(\"-1\")) { // if Spouse\n mNum = mNum.substring(0, mNum.length()-2);\n if (!genderMissing && gender.equalsIgnoreCase(\"M\")) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n gender = \"F\";\n }\n } else {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Spouse\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set the mship type\n //\n mship = \"Golf\"; // default\n\n if (mNum.startsWith(\"I\")) {\n mship = \"Invitational\";\n } else if (mNum.startsWith(\"P\")) {\n mship = \"Prestige\";\n } else if (mNum.startsWith(\"F\")) {\n mship = \"Founding\";\n } else if (mNum.startsWith(\"J\")) {\n mship = \"Junior Executive\";\n } else if (mNum.startsWith(\"C\")) {\n mship = \"Corporate\";\n } else if (mNum.startsWith(\"H\")) {\n mship = \"Honorary\";\n } else if (mNum.startsWith(\"Z\")) {\n mship = \"Employee\";\n } else if (mNum.startsWith(\"S\")) {\n mship = \"Sports\";\n } else if (mNum.startsWith(\"L\") || mNum.startsWith(\"l\")) {\n mship = \"Lifetime\";\n } else if (mNum.startsWith(\"X\")) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n } // end of IF club = pradera\n\n\n\n //******************************************************************\n // Scarsdale GC\n //******************************************************************\n //\n if (club.equals( \"scarsdalegolfclub\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else if (fname.equalsIgnoreCase( \"admin\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Admin' FIRST NAME!\";\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n } else {\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n if (!mNum.endsWith(\"-1\")) {\n\n memid = mNum; // use mNum for username\n\n } else {\n\n tok = new StringTokenizer( mNum, \"-\" );\n\n if ( tok.countTokens() > 1 ) {\n mNum = tok.nextToken(); // isolate mnum\n }\n\n memid = mNum + \"A\";\n }\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n if (primary.equalsIgnoreCase(\"S\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n\n //\n // Set mship\n //\n if (mship.endsWith(\"egular\")) { // catch all Regulars\n mship = \"Regular\";\n } else if (mship.endsWith(\"ssociate\")) { // catch all Associates\n mship = \"Associate\";\n } else if (mship.endsWith(\"Social\")) { // catch all Socials\n mship = \"House Social\";\n } else if (mship.endsWith(\"Sports\")) { // catch all Sports\n mship = \"House Sports\";\n } else if (mship.equals(\"P\") || mship.equals(\"Privilege\")) {\n mship = \"Privilege\";\n } else if (!mship.equals(\"Special Visitors\") && !mship.equals(\"Non-Resident\") && !mship.equals(\"Honorary\")) {\n\n skip = true; // skip if not one of the above\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n } // end of IF club is Scarsdale\n\n\n\n //******************************************************************\n // Patterson Club\n //******************************************************************\n //\n if (club.equals( \"pattersonclub\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else if (fname.equalsIgnoreCase( \"admin\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Admin' FIRST NAME!\";\n } else if (mship.startsWith( \"DS\" ) || mship.startsWith( \"Employee\" ) || mship.equals( \"LOA\" ) ||\n mship.equals( \"Resigned\" ) || mship.equals( \"Honorary\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n } else {\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use id from MF\n\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n\n memid = mNum; // use mNum for username\n\n\n tok = new StringTokenizer( mNum, \"-\" );\n\n /*\n if ( tok.countTokens() > 1 ) {\n\n mNum = tok.nextToken(); // isolate mnum\n\n if (memid.endsWith(\"-1\")) {\n\n memid = mNum + \"A\"; // use nnnA\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n } else {\n mtype = \"Dependent\";\n }\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n */\n\n if (mNum.endsWith(\"A\")) {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n\n\n //\n // Set mship - these do not exist any longer, but leave just in case\n //\n if (mship.equalsIgnoreCase(\"FP-Intermediate\")) {\n mship = \"FP\";\n } else {\n if (mship.equalsIgnoreCase(\"HTP Intermediate\")) {\n mship = \"HTP\";\n }\n } // Accept others as is\n }\n } // end of IF club = pattersonclub\n\n\n //******************************************************************\n // Tamarack\n //******************************************************************\n //\n if (club.equals( \"tamarack\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n } else if (fname.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n } else if (fname.equalsIgnoreCase( \"survey\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Survey' FIRST NAME!\";\n } else if (fname.equalsIgnoreCase( \"admin\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: 'Admin' FIRST NAME!\";\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n } else {\n //\n // use memid as webid !! (do NOT change the username in records)\n //\n useWebid = true; // use webid to locate member\n webid = memid; // use id from MF\n\n //\n // Strip any leading zeros and extension from mNum\n //\n while (mNum.startsWith( \"0\" )) { // if starts with a zero\n mNum = remZeroS(mNum); // remove the leading zero\n }\n\n //\n // Set username to mNum (it is unique)\n //\n memid = mNum;\n\n //\n // Remove extension from mNum if not primary\n //\n StringTokenizer tok9 = new StringTokenizer( mNum, \"-\" ); // look for a dash (i.e. 1234-1)\n\n if ( tok9.countTokens() > 1 ) { \n\n mNum = tok9.nextToken(); // get just the mNum if it contains an extension\n }\n\n /*\n if (!primary.equalsIgnoreCase(\"P\")) {\n mNum = stripA(mNum);\n }\n */\n\n //\n // Set POS Id in case they ever need it\n //\n posid = mNum;\n\n //\n // Set mtype\n //\n if (mship.startsWith(\"SP-\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n mship = mship.substring(3);\n\n } else if (mship.startsWith(\"DEP-\")) {\n\n mtype = \"Dependent\";\n\n mship = mship.substring(4);\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n\n if (memid.contains(\"-\")) {\n memid = memid.substring(0, memid.length() - 2) + memid.substring(memid.length() - 1);\n }\n \n\n //\n // Set mship\n //\n if (mship.equalsIgnoreCase(\"Associate\") || mship.equalsIgnoreCase(\"Corporate\") || mship.equalsIgnoreCase(\"Dependent\") ||\n mship.equalsIgnoreCase(\"Junior\") || mship.equalsIgnoreCase(\"Non-Resident\") || mship.equalsIgnoreCase(\"Senior\") ||\n mship.equalsIgnoreCase(\"Regular\") || mship.equalsIgnoreCase(\"Sr Cert\") || mship.equalsIgnoreCase(\"Intermed/C\") ||\n mship.equalsIgnoreCase(\"Widow\")) {\n\n // Do nothing\n\n } else if (mship.equalsIgnoreCase(\"Certificate\")) {\n mship = \"Certificat\";\n } else if (mship.equalsIgnoreCase(\"Intermediate\")) {\n mship = \"Intermedia\";\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n }\n } // end of IF club = tamarack\n\n //******************************************************************\n // St. Clair Country Club\n //******************************************************************\n //\n if (club.equals( \"stclaircc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n } else {\n\n // strip \"Member Type:\" from mship if present\n if (mtype.startsWith(\"Member Type:\")) {\n mtype = mtype.substring(12);\n }\n\n // set mship\n if (mtype.equalsIgnoreCase(\"ACTIVE\") || mtype.equalsIgnoreCase(\"VOTING\")) {\n mship = \"Voting\";\n } else if (mtype.equalsIgnoreCase(\"ACTIVESR\") || mtype.equalsIgnoreCase(\"SENIOR\")) {\n mship = \"Senior\";\n } else if (mtype.startsWith(\"INT\")) {\n mship = \"Intermediate\";\n } else if (mtype.equalsIgnoreCase(\"ASSOC20\")) {\n mship = \"Assoc20\";\n } else if (mtype.equalsIgnoreCase(\"ASSOCIATE\")) {\n mship = \"Associate Golf\";\n } else if (mtype.equalsIgnoreCase(\"LTD GOLF\")) {\n mship = \"Limited Golf\";\n } else if (mtype.equalsIgnoreCase(\"SOCGLF\")) {\n mship = \"Social Golf\";\n } else if (mtype.equalsIgnoreCase(\"NRGP\")) {\n mship = \"NR Golf\";\n } else if (mtype.equalsIgnoreCase(\"FAMILY GP\") || mtype.equalsIgnoreCase(\"SPOUSE GP\")) {\n mship = \"Spouse Golf\";\n } else if (mtype.equalsIgnoreCase(\"FAMILYSPGP\") || mtype.equalsIgnoreCase(\"SPOUSESPGP\")) {\n mship = \"Spouse Golf 9\";\n } else if (mtype.equalsIgnoreCase(\"ASSP20GP\")) {\n mship = \"Assoc Spouse20\";\n } else if (mtype.equalsIgnoreCase(\"ASGP\")) {\n mship = \"Assoc/Ltd Spouse\";\n } else if (mtype.equalsIgnoreCase(\"LTDSP GP\") || mtype.equalsIgnoreCase(\"ASGP\")) {\n mship = \"Limited Spouse\";\n } else if (mtype.equalsIgnoreCase(\"ASSSPGP\")) {\n mship = \"Associate Spouse\";\n } else if (mtype.equalsIgnoreCase(\"SOCSP GP\") || mtype.equalsIgnoreCase(\"ASRGP\")) {\n mship = \"Soc Golf Spouse\";\n } else if (mtype.equalsIgnoreCase(\"JR 12-17\") || mtype.equalsIgnoreCase(\"JR 18-24\")) {\n mship = \"Junior Golf\";\n } else if (mtype.equalsIgnoreCase(\"ASSOC20J\") || mtype.equalsIgnoreCase(\"ASSOC20J18\")) {\n mship = \"Assoc Jr20\";\n } else if (mtype.equalsIgnoreCase(\"ASSOCJR\") || mtype.equalsIgnoreCase(\"ASSOCJR18\")) {\n mship = \"Associate Jr\";\n } else if (mtype.startsWith(\"LTD JR\")) {\n mship = \"Limited Jr\";\n } else if (mtype.equalsIgnoreCase(\"SOCJR<18\") || mtype.equalsIgnoreCase(\"SOCJR>18\")) {\n mship = \"Soc Jr Golf\";\n } else if (mtype.equalsIgnoreCase(\"EMERITUS\")) {\n mship = \"Emeritus\";\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n // set other values\n posid = mNum; // set posid in case we ever need it\n while (mNum.startsWith(\"0\")){\n mNum = remZeroS(mNum);\n }\n\n useWebid = true; // use these webids\n webid = memid;\n memid = mNum;\n\n // set mtype\n if (mNum.endsWith(\"S\")) {\n if (gender.equalsIgnoreCase(\"M\")) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n }\n mNum = mNum.substring(0,mNum.length()-1); // remove extension char\n } else if (mNum.endsWith(\"J\") || mNum.endsWith(\"K\") || mNum.endsWith(\"L\") || mNum.endsWith(\"M\") || mNum.endsWith(\"N\") || mNum.endsWith(\"O\") || mNum.endsWith(\"P\")) {\n mtype = \"Dependent\";\n mNum = mNum.substring(0,mNum.length()-1); // remove extension char\n } else {\n if (gender.equalsIgnoreCase(\"M\")) {\n mtype = \"Primary Male\";\n } else {\n mtype = \"Primary Female\";\n }\n }\n }\n\n } // end of IF club = stclaircc\n\n\n //******************************************************************\n // The Trophy Club Country Club\n //******************************************************************\n //\n if (club.equals( \"trophyclubcc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n\n } else {\n\n useWebid = true;\n webid = memid;\n posid = mNum;\n\n mship = \"Golf\";\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n }\n } // end of IF club = trophyclubcc\n\n\n\n //******************************************************************\n // Pelican Marsh Golf Club\n //******************************************************************\n //\n if (club.equals( \"pmarshgc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true;\n webid = memid;\n memid = mNum;\n\n mNum = stripDash(mNum); // remove the -00 etc from end of mNums\n\n posid = mNum;\n\n // check for proper membership types\n if (mtype.equalsIgnoreCase(\"Equity Golf\") || mtype.equalsIgnoreCase(\"Non-Equity Golf\") ||\n mtype.equalsIgnoreCase(\"Trial Golf\")) {\n mship = \"Golf\";\n } else if (mtype.equalsIgnoreCase(\"Equity Social\")) {\n mship = \"Social\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n }\n } // end of IF club is pmarshgc\n\n\n //******************************************************************\n // Silver Lake Country Club\n //******************************************************************\n //\n if (club.equals( \"silverlakecc\" )) {\n\n found = true; // club found\n\n //\n // Make sure this is ok\n //\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum;\n mNum = remZeroS(mNum);\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n if (mtype.startsWith(\"Social\")) {\n mship = \"Social Elite\";\n } else {\n mship = \"Full Golf\";\n }\n\n //Will need to add \"Social Elite\" eventually!\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n memid = mNum + \"A\";\n } else {\n mtype = \"Adult Male\";\n memid = mNum;\n }\n\n }\n } // end of IF club is silverlakecc\n\n\n //******************************************************************\n // Edina Country Club\n //******************************************************************\n //\n if (club.equals(\"edina\") || club.equals(\"edina2010\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n StringTokenizer tempTok = new StringTokenizer(mNum, \"-\");\n String suf = \"0\";\n\n if (tempTok.countTokens() > 1){ // if mNum contains a - then it is a spouse\n mNum = stripDash(mNum);\n suf = \"1\";\n }\n\n posid = mNum; // set posid before zeros are removed\n\n while (mNum.startsWith(\"0\")) {\n mNum = remZeroS(mNum);\n }\n\n memid = mNum + suf; // set memid\n\n // ignore specific membership types\n if (mship.equalsIgnoreCase(\"Other Clubs\") || mship.equalsIgnoreCase(\"Party Account\") ||\n mship.equalsIgnoreCase(\"Resigned with Balance Due\")) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (mship.equalsIgnoreCase(\"Social\") || mship.equalsIgnoreCase(\"Honorary Social\") || mship.equalsIgnoreCase(\"Clergy\") || mship.equalsIgnoreCase(\"Social Widow\")) {\n\n mship = \"Social\";\n\n } else if (mship.equalsIgnoreCase(\"Pool/Tennis\")) {\n\n mship = \"Pool/Tennis\";\n\n } else { // leave these two as they are, everything else = golf\n \n mship = \"Golf\";\n }\n\n // set member type based on gender\n if (primary.equalsIgnoreCase(\"P\") || primary.equalsIgnoreCase(\"S\")) {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n } else {\n mtype = \"Dependent\";\n }\n \n \n //\n // Custom to filter out a member's 2nd email address - she doesn't want ForeTees emails on this one, but wants it in MF\n //\n if (webid.equals(\"2720159\")) {\n \n email2 = \"\";\n }\n \n }\n\n } // end if edina\n\n //******************************************************************\n // Seville Golf & Country Club\n //******************************************************************\n //\n if (club.equals(\"sevillegcc\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // set posid before zeros are removed\n\n while (mNum.startsWith(\"0\")) {\n mNum = remZeroS(mNum);\n }\n\n // ignore specific membership types\n if (mtype.startsWith(\"Sports\")) {\n mship = \"Sports Golf\";\n } else {\n mship = \"Full Golf\";\n }\n\n // set member type and memid based on gender\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n memid = mNum + \"A\";\n } else {\n mtype = \"Adult Male\";\n memid = mNum;\n }\n }\n\n } // end if sevillegcc\n\n\n //******************************************************************\n // Royal Oaks CC - Dallas\n //******************************************************************\n //\n if (club.equals(\"roccdallas\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mship.equalsIgnoreCase(\"Tennis Member\") || mship.equalsIgnoreCase(\"Tennis Special Member\") ||\n mship.equalsIgnoreCase(\"Junior Tennis Member\") || mship.equalsIgnoreCase(\"Social Member\") ||\n mship.equalsIgnoreCase(\"Dining Member\")) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // set posid before zeros are removed\n // memid = mNum; // user mNum as memid, mNums ARE UNIQUE! - USE MF's ID !!!!\n\n if (!mNum.endsWith( \"0\" ) && !mNum.endsWith( \"1\" ) && !mNum.endsWith( \"2\" ) && !mNum.endsWith( \"3\" ) &&\n !mNum.endsWith( \"4\" ) && !mNum.endsWith( \"5\" ) && !mNum.endsWith( \"6\" ) && !mNum.endsWith( \"7\" ) &&\n !mNum.endsWith( \"8\" ) && !mNum.endsWith( \"9\" )) {\n\n mNum = stripA(mNum); // remove trailing alpha\n }\n\n\n // handle 'Spouse of member' membership type\n if (mship.equalsIgnoreCase(\"Spouse of member\")) {\n\n primary = \"S\"; // they are a Spouse\n\n // if Spouse: determine mship from 2nd character of mNum\n if (!mNum.equals(\"\")) {\n\n if (mNum.charAt(1) == 'P') {\n mship = \"Golf Associate Member\";\n } else if (mNum.charAt(1) == 'E') {\n mship = \"Special Member\";\n } else if (mNum.charAt(1) == 'G') {\n mship = \"Senior Member\";\n } else if (mNum.charAt(1) == 'J') {\n mship = \"Junior Member\";\n } else if (mNum.charAt(1) == 'N') {\n mship = \"Non Resident Member\";\n } else if (mNum.charAt(1) == 'F') {\n mship = \"Temp Non Certificate\";\n } else if (mNum.charAt(1) == 'L') {\n mship = \"Ladies Member\";\n } else if (mNum.charAt(1) == 'K') {\n mship = \"Associate Resident Member\";\n } else if (mNum.charAt(1) == 'H') {\n mship = \"Honorary\";\n } else if (mNum.charAt(1) == 'B') {\n mship = \"Tennis with Golf\";\n } else if (mNum.charAt(1) == 'D' || mNum.charAt(1) == 'T' || mNum.charAt(1) == 'R' || mNum.charAt(1) == 'S') {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n } else { // no letter for 2nd char of mNum\n mship = \"Resident Member\";\n }\n } else {\n\n skip = true;\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE could not be determined! (mNum missing)\";\n }\n }\n\n // set member type based on gender\n // blank gender and mNum ending with 'A' = female, otherwise male\n if (gender.equalsIgnoreCase(\"F\") || (gender.equalsIgnoreCase(\"\") && mNum.toLowerCase().endsWith(\"a\"))) {\n\n gender = \"F\";\n mtype = \"Adult Female\";\n } else {\n\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n }\n } // end if roccdallas\n\n\n //******************************************************************\n // Hackberry Creek CC - hackberrycreekcc\n //******************************************************************\n //\n if (club.equals(\"hackberrycreekcc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // set posid in case we need it in the future\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n mship = \"Golf\"; // everyone changed to \"Golf\"\n\n // set member type and memid based on gender\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n memid = mNum + \"A\";\n } else {\n mtype = \"Adult Male\";\n memid = mNum;\n }\n }\n } // end if hackberrycreekcc\n\n //******************************************************************\n // Brookhaven CC - brookhavenclub\n //******************************************************************\n //\n if (club.equals(\"brookhavenclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // set posid in case we need it in the future\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n\n if (mtype.startsWith(\"DFW\")) {\n mship = \"DFWY\";\n } else {\n mship = \"Golf\"; // everyone changed to \"Golf\"\n }\n\n // set member type and memid based on gender\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n memid = mNum + \"A\";\n } else {\n mtype = \"Adult Male\";\n memid = mNum;\n }\n }\n } // end if brookhavenclub\n\n //******************************************************************\n // Stonebridge Ranch CC - stonebridgeranchcc\n //******************************************************************\n //\n if (club.equals(\"stonebridgeranchcc\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // set posid in case we need it in the future\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n if (mtype.equalsIgnoreCase(\"Dual Club\") || mtype.equalsIgnoreCase(\"Dual Club Distant\") || mtype.equalsIgnoreCase(\"Dual Club Society\") ||\n mtype.equalsIgnoreCase(\"Honorary\") || mtype.equalsIgnoreCase(\"Honorary Society\") || mtype.equalsIgnoreCase(\"Prem Charter Select\") ||\n mtype.equalsIgnoreCase(\"Prem Chrtr Sel Scty\") || mtype.equalsIgnoreCase(\"Prem Club Corp Scty\") || mtype.equalsIgnoreCase(\"Prem Mbr Sel Society\") ||\n mtype.equalsIgnoreCase(\"Prem Member Charter\") || mtype.equalsIgnoreCase(\"Prem Member Select\") || mtype.equalsIgnoreCase(\"Prem Mbrshp Society\") ||\n mtype.equalsIgnoreCase(\"Premier Club Corp D\") || mtype.equalsIgnoreCase(\"Premier Club Jr\") || mtype.equalsIgnoreCase(\"Premier Corporate\") ||\n mtype.equalsIgnoreCase(\"Premier Membership\") || mtype.equalsIgnoreCase(\"Premier Nr\") || mtype.equalsIgnoreCase(\"Prem Mbr Chrtr Scty\") ||\n mtype.equalsIgnoreCase(\"Premier Club Jr Scty\") || mtype.equalsIgnoreCase(\"Westerra\") || mtype.equalsIgnoreCase(\"Premier Club C Ppd\") ||\n mtype.equalsIgnoreCase(\"Premier Club Corp Ds\") || mtype.equalsIgnoreCase(\"Preview\")) {\n\n mship = \"Dual\";\n\n } else if (mtype.equalsIgnoreCase(\"Pr SB Sel Scty\") || mtype.equalsIgnoreCase(\"Prem Stnbrdge Select\") || mtype.equalsIgnoreCase(\"Prem Stonbrdg Scty \") ||\n mtype.equalsIgnoreCase(\"Premier Stonebridge\") || mtype.equalsIgnoreCase(\"Stonebridge Assoc.\") || mtype.equalsIgnoreCase(\"Stonebridge Charter\") ||\n mtype.equalsIgnoreCase(\"Stonebridge Golf\") || mtype.equalsIgnoreCase(\"Stonebridge Golf Soc\") || mtype.equalsIgnoreCase(\"Options II\") ||\n mtype.equalsIgnoreCase(\"Options II Society\") || mtype.equalsIgnoreCase(\"Options I \") || mtype.equalsIgnoreCase(\"Options I Society\") ||\n mtype.equalsIgnoreCase(\"Stonebridge Distn Gf\") || mtype.equalsIgnoreCase(\"Sb Premier Nr\") || mtype.equalsIgnoreCase(\"Prem Stonbrdg Scty\") ||\n mtype.equalsIgnoreCase(\"Stonebridge Soc Scty\") || mtype.equalsIgnoreCase(\"Stnbrdge Assoc Scty\") || mtype.equalsIgnoreCase(\"Sb Golf Legacy Soc.\")) {\n\n mship = \"Dye\";\n\n } else if (mtype.equalsIgnoreCase(\"Pr Rcc Pr 6/96 Scty\") || mtype.equalsIgnoreCase(\"Pr Rnch Aft 6/96 Sct\") || mtype.equalsIgnoreCase(\"Prem Rcc Jr Select\") ||\n mtype.equalsIgnoreCase(\"Prem Rcc Prior 6/96\") || mtype.equalsIgnoreCase(\"Prem Rnch After 6/96\") || mtype.equalsIgnoreCase(\"Prem Rnch Select Sty\") ||\n mtype.equalsIgnoreCase(\"Premier Ranch Select\") || mtype.equalsIgnoreCase(\"Prm Rcc Sel Aft\") || mtype.equalsIgnoreCase(\"Prm Rcc Sel Aft 96st\") ||\n mtype.equalsIgnoreCase(\"Ranch Charter\") || mtype.equalsIgnoreCase(\"Ranch Golf\") || mtype.equalsIgnoreCase(\"Ranch Golf Legacy\") ||\n mtype.equalsIgnoreCase(\"Ranch Golf Non-Res\") || mtype.equalsIgnoreCase(\"Ranch Golf Society\") || mtype.equalsIgnoreCase(\"Special Golf\") ||\n mtype.equalsIgnoreCase(\"Prem Rcc Pr Nr\") || mtype.equalsIgnoreCase(\"Prem Rnch Sports Sty\") || mtype.equalsIgnoreCase(\"Ranch Nr Society\") ||\n mtype.equalsIgnoreCase(\"Pr Rcc Aft799 Society\") || mtype.equalsIgnoreCase(\"Ranch Non Resident\") || mtype.equalsIgnoreCase(\"Ranch Ppd Rcc Golf\")) {\n\n mship = \"Hills\";\n\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n // set member type and memid based on gender\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n }\n\n } // end if stonebridgeranchcc\n\n\n //******************************************************************\n // Charlotte CC - charlottecc\n //******************************************************************\n //\n if (club.equals(\"charlottecc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n memid = mNum.toUpperCase(); // use mNum for memid, they are unique\n\n // Set primary/spouse value\n if (mNum.toUpperCase().endsWith(\"S\")) {\n primary = \"S\";\n mNum = stripA(mNum);\n } else {\n primary = \"P\";\n }\n\n posid = mNum; // set posid in case it's ever needed\n\n // set mtype based on gender\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n // if mship starts with 'Spousal-surviving' or 'Spousal', remove the prefix\n if (mship.equalsIgnoreCase(\"Spousal-surviving Resident\")) {\n mship = \"Dependent Spouse\";\n } else {\n if (mship.startsWith(\"Spousal-surviving\")) {\n mship = mship.substring(18, mship.length() - 1);\n }\n if (mship.startsWith(\"Spousal\") && !mship.equalsIgnoreCase(\"Spousal Member\")) {\n mship = mship.substring(8, mship.length() - 1);\n }\n\n // set mship\n if (mship.startsWith(\"Resident\") || mship.equalsIgnoreCase(\"Ministerial-NM\")) {\n mship = \"Resident\";\n } else if (mship.startsWith(\"Non-Resident\")) {\n mship = \"Non Resident\";\n } else if (mship.startsWith(\"Dependant\")) {\n mship = \"Dependent Spouse\";\n } else if (mship.startsWith(\"Honorary\")) {\n mship = \"Honorary\";\n } else if (mship.startsWith(\"Lady\") || mship.equalsIgnoreCase(\"Spousal Member\")) {\n mship = \"Lady\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n }\n } // end if charlottecc\n\n\n //******************************************************************\n // Gleneagles CC - gleneaglesclub\n //******************************************************************\n //\n if (club.equals(\"gleneaglesclub\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // set posid in case we need it in the future\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n mship = \"Golf\"; // everyone changed to \"Golf\"\n\n // set member type and memid based on gender\n if (primary.equalsIgnoreCase(\"S\")) {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n memid = mNum + \"A\";\n\n } else if (primary.equalsIgnoreCase(\"P\")) {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Member Female\";\n } else {\n mtype = \"Member Male\";\n }\n memid = mNum;\n } else { // Dependent\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n // use provided memid\n }\n }\n\n } // end if gleneaglesclub\n\n\n\n\n //******************************************************************\n // Portland CC - portlandgc\n //******************************************************************\n //\n if (club.equals(\"portlandgc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n if (mNum.length() == 6) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Female Spouse\";\n } else {\n mtype = \"Male Spouse\";\n }\n\n mNum = mNum.substring(0, mNum.length() - 1); // get rid of extra number on end of spouse mNums\n primary = \"S\";\n\n memid = mNum;\n\n while (memid.startsWith(\"0\")) { // strip leading zeros\n memid = remZeroS(memid);\n }\n memid = memid + \"A\";\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Female Member\";\n } else {\n mtype = \"Male Member\";\n }\n\n primary = \"P\";\n\n memid = mNum;\n\n while (memid.startsWith(\"0\")) { // strip leading zeros\n memid = remZeroS(memid);\n }\n }\n\n posid = mNum; // set posid in case we need it in the future\n\n if (mship.equalsIgnoreCase(\"AAR-FG\") || mship.equalsIgnoreCase(\"NON-RES\") ||\n mship.equalsIgnoreCase(\"REGULAR\") || mship.equalsIgnoreCase(\"TEMPORARY\")) { mship = \"Regular\"; }\n else if (mship.equalsIgnoreCase(\"30YEARS\")) { mship = \"30 Year Social\"; }\n else if (mship.equalsIgnoreCase(\"EMPLOYEE\")) { mship = \"Employee\"; }\n else if (mship.equalsIgnoreCase(\"HONORARY\")) { mship = \"Honorary\"; }\n else if (mship.equalsIgnoreCase(\"JUNIOR\")) { mship = \"Junior Associate\"; }\n else if (mship.equalsIgnoreCase(\"SOCIAL\")) { mship = \"Social\"; }\n else if (mship.startsWith(\"L\")) { mship = \"Leave of Absence\"; }\n else if (mship.equalsIgnoreCase(\"SPOUSE\")) { mship = \"Spouse Associate\"; }\n else if (mship.equalsIgnoreCase(\"Member Status:SENIOR\")) { mship = \"Senior\"; }\n else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n } // end if portlandgc\n\n\n //******************************************************************\n // Quechee Club\n //******************************************************************\n //\n if (club.equals(\"quecheeclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n memid = mNum;\n\n\n mNum = mNum.substring(0, mNum.length() - 1); // get rid of trailing primary indicator # on mNum\n\n if (memid.endsWith(\"0\")) { // Primary\n primary = \"P\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n } else if (memid.endsWith(\"1\")) { // Spouse\n primary = \"S\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else { // Dependent\n primary = \"D\";\n mtype = \"Dependent\";\n }\n\n // Set the posid\n if (primary.equals(\"S\")) {\n posid = mNum + \"1\"; // set posid in case we need it in the future\n } else {\n posid = mNum + \"0\";\n }\n\n if (mship.equalsIgnoreCase(\"ALL-F\")) {\n mship = \"ALL Family\";\n } else if (mship.equalsIgnoreCase(\"ALL-S\")) {\n mship = \"ALL Single\";\n } else if (mship.equalsIgnoreCase(\"GAP-F\")) {\n mship = \"GAP Family\";\n } else if (mship.equalsIgnoreCase(\"GAP-S\")) {\n mship = \"GAP Single\";\n } else if (mship.equalsIgnoreCase(\"GAPM-F\")) {\n mship = \"GAPM Family\";\n } else if (mship.equalsIgnoreCase(\"GAPM-S\")) {\n mship = \"GAPM Single\";\n } else if (mship.equalsIgnoreCase(\"NON-GAP\")) {\n mship = \"NON-GAP\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n } // end if quecheeclub\n\n\n\n //******************************************************************\n // Quechee Club - Tennis\n //******************************************************************\n //\n if (club.equals(\"quecheeclubtennis\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n memid = mNum;\n\n\n mNum = mNum.substring(0, mNum.length() - 1); // get rid of trailing primary indicator # on mNum\n\n if (memid.endsWith(\"0\")) { // Primary\n primary = \"P\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n } else if (memid.endsWith(\"1\")) { // Spouse\n primary = \"S\";\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else { // Dependent\n primary = \"D\";\n mtype = \"Dependent\";\n }\n\n // Set the posid\n if (primary.equals(\"S\")) {\n posid = mNum + \"1\"; // set posid in case we need it in the future\n } else {\n posid = mNum + \"0\";\n }\n\n if (mship.equalsIgnoreCase(\"ALL-F\")) {\n mship = \"ALL Family\";\n } else if (mship.equalsIgnoreCase(\"ALL-S\")) {\n mship = \"ALL Single\";\n } else if (custom1.equalsIgnoreCase(\"Tennis-F\")) {\n mship = \"TAP Family\";\n } else if (custom1.equalsIgnoreCase(\"Tennis-S\")) {\n mship = \"TAP Single\";\n } else if (custom1.equals(\"?\") || custom1.equals(\"\")) {\n mship = \"NON-TAP\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n } // end if quecheeclubtennis\n\n //******************************************************************\n // The Oaks Club\n //******************************************************************\n //\n if (club.equals(\"theoaksclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n memid = mNum;\n\n if (mNum.endsWith(\"-1\")) {\n\n primary = \"S\";\n gender = \"F\";\n mtype = \"Spouse Female\";\n\n mNum = mNum.substring(0, mNum.length() - 2);\n\n if (mship.startsWith(\"Dependent\")) { // Use the primary's mship\n try {\n ResultSet oaksRS = null;\n PreparedStatement oaksStmt = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE username = ?\");\n oaksStmt.clearParameters();\n oaksStmt.setString(1, mNum);\n oaksRS = oaksStmt.executeQuery();\n\n if (oaksRS.next()) {\n mship = oaksRS.getString(\"m_ship\");\n } else {\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SPOUSE with DEPENDENT membership type - NO PRIMARY FOUND!\";\n }\n\n oaksStmt.close();\n\n } catch (Exception exc) { }\n }\n\n } else if (mNum.endsWith(\"-2\") || mNum.endsWith(\"-3\") || mNum.endsWith(\"-4\") || mNum.endsWith(\"-5\") ||\n mNum.endsWith(\"-6\") || mNum.endsWith(\"-7\") || mNum.endsWith(\"-8\") || mNum.endsWith(\"-9\")) {\n\n primary = \"D\";\n mtype = \"Dependent\";\n mNum = mNum.substring(0, mNum.length() - 2);\n\n } else {\n\n primary = \"P\";\n gender = \"M\";\n mtype = \"Primary Male\";\n }\n\n posid = mNum; // set posid in case we need it in the future\n\n if (mship.equalsIgnoreCase(\"Regular Equity\") || mship.equalsIgnoreCase(\"Member Type:001\")) {\n mship = \"Regular Equity\";\n } else if (mship.equalsIgnoreCase(\"Golf\") || mship.equalsIgnoreCase(\"Member Type:010\")) {\n mship = \"Golf\";\n } else if (mship.equalsIgnoreCase(\"Social Property Owner\") || mship.equalsIgnoreCase(\"Member Type:002\")) {\n mship = \"Social Property Owner\";\n } else if (mship.equalsIgnoreCase(\"Tennis Associate\") || mship.equalsIgnoreCase(\"Member Type:020\")) {\n mship = \"Tennis Associate\";\n } else if (mship.equalsIgnoreCase(\"Member Type:022\")) {\n mship = \"Jr Tennis Associate\";\n } else if (mship.startsWith(\"Dependent\")) {\n mship = \"Dependent\";\n } else if (mship.equalsIgnoreCase(\"Member Type:085\")) {\n mship = \"General Manager\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n }\n } // end if theoaksclub\n\n\n //******************************************************************\n // Admirals Cove\n //******************************************************************\n //\n if (club.equals(\"admiralscove\")) {\n\n found = true; // club found\n\n if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\")) {\n\n primary = \"S\";\n mNum = mNum.substring(0, mNum.length() - 1);\n\n } else {\n primary = \"P\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n if (mship.equals( \"\" )) {\n //\n // Spouse or Dependent - look for Primary mship type and use that\n //\n try {\n pstmt2 = con.prepareStatement (\n \"SELECT m_ship FROM member2b WHERE username != ? AND m_ship != '' AND memNum = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, memid);\n pstmt2.setString(2, mNum);\n rs = pstmt2.executeQuery();\n\n if(rs.next()) {\n mship = rs.getString(\"m_ship\"); // use primary mship type\n } else { //\n skip = true; // skip this one\n mship = \"\";\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n }\n\n pstmt2.close();\n\n } catch (Exception e1) { }\n\n }\n\n posid = mNum; // set posid in case we need it in the future\n\n if (!mship.equals(\"\")) {\n\n if (mship.startsWith(\"Golf\") || mship.equals(\"Full Golf\")) {\n mship = \"Full Golf\";\n } else if (mship.startsWith(\"Sports\")) {\n mship = \"Sports\";\n } else if (!mship.equals(\"Social\") && !mship.equals(\"Marina\") && !mship.equals(\"Tennis\")) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n }\n } // end if admiralscove\n\n\n //******************************************************************\n // Ozaukee CC\n //******************************************************************\n //\n if (club.equals(\"ozaukeecc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n if (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\") || mNum.endsWith(\"a\") || mNum.endsWith(\"B\") || mNum.endsWith(\"C\") || mNum.endsWith(\"D\")) {\n\n primary = \"S\";\n mNum = mNum.substring(0, mNum.length() - 1); // strip trailing 'A'\n\n } else {\n primary = \"P\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n if (mship.equalsIgnoreCase(\"EM\")) {\n mship = \"Emeritus\";\n }\n\n if (mship.equalsIgnoreCase(\"Curler\") || mship.equalsIgnoreCase(\"Resigned\") ||\n mship.equalsIgnoreCase(\"Social\") || mship.equalsIgnoreCase(\"Summer Social\")) {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n posid = mNum; // set posid in case we need it in the future\n }\n } // end if ozaukeecc\n\n //******************************************************************\n // Palo Alto Hills G&CC - paloaltohills\n //******************************************************************\n //\n if (club.equals(\"paloaltohills\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) { // this club has its mship values in mtype field!!\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n // trim off leading zeroes\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (gender.equals(\"F\")) {\n primary = \"S\";\n //mtype = \"Secondary Female\"; // no longer setting mtype with roster sync\n } else {\n primary = \"P\";\n //mtype = \"Primary Male\"; // no longer setting mtype with roster sync\n gender = \"M\";\n }\n\n if (mNum.endsWith(\"A\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (memid.startsWith(\"1\") || memid.startsWith(\"4\") || memid.startsWith(\"6\") || memid.startsWith(\"8\")) {\n mship = \"Golf\";\n } else if (memid.startsWith(\"2\")) {\n mship = \"Social\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n }\n\n } // end if paloaltohills\n\n\n //******************************************************************\n // Woodside Plantation CC - wakefieldplantation\n //******************************************************************\n //\n if (club.equals(\"woodsideplantation\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n posid = mNum; // set posid in case we need it in the future\n\n\n if (memid.equals(\"399609\")) { // Marvin Cross has an invalid email address ([email protected]) - belongs to a church in FL\n email2 = \"\";\n }\n\n\n if (primary.equalsIgnoreCase(\"P\")) {\n memid = mNum;\n } else {\n memid = mNum + \"A\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Adult Female\";\n } else {\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n\n }\n } // end if woodsideplantation\n\n //******************************************************************\n // Timarron CC - timarroncc\n //******************************************************************\n //\n if (club.equals(\"timarroncc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n posid = mNum; // set posid in case we need it in the future\n\n mship = \"Golf\";\n\n if (primary.equalsIgnoreCase(\"S\")) {\n memid = mNum + \"A\";\n } else {\n memid = mNum;\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Adult Female\";\n } else {\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n }\n } // end if timarroncc\n\n //******************************************************************\n // Fountaingrove Golf & Athletic Club - fountaingrovegolf\n //******************************************************************\n //\n if (club.equals(\"fountaingrovegolf\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n String posSuffix = \"\";\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n posid = mNum;\n \n if (mNum.endsWith(\"A\")) {\n primary = \"P\";\n mNum = mNum.substring(0, mNum.length() - 1);\n memid = mNum;\n } else {\n primary = \"S\";\n mNum = mNum.substring(0, mNum.length() - 1);\n memid = mNum + \"A\";\n }\n\n if (mship.equalsIgnoreCase(\"Golf\") || mship.equalsIgnoreCase(\"Employee\")) {\n mship = \"Golf\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Adult Female\";\n } else {\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n }\n } // end if fountaingrovegolf\n\n\n/* Disabled, left ForeTees\n //******************************************************************\n // Austin Country Club - austincountryclub\n //******************************************************************\n //\n if (club.equals(\"austincountryclub\")) {\n\n found = true; // club found\n\n if (primary.equalsIgnoreCase(\"P\") && mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n if (mNum.toUpperCase().endsWith(\"A\")) {\n mNum = stripA(mNum);\n }\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n posid = mNum; // set posid in case we need it in the future\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Adult Female\";\n } else {\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n\n // If a spouse member, retrieve the primary user's membership type to use for them\n if (primary.equalsIgnoreCase(\"S\")) {\n try {\n PreparedStatement pstmtAus = null;\n ResultSet rsAus = null;\n\n pstmtAus = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE memNum = ? AND m_ship<>''\");\n pstmtAus.clearParameters();\n pstmtAus.setString(1, mNum);\n\n rsAus = pstmtAus.executeQuery();\n\n if (rsAus.next()) {\n mship = rsAus.getString(\"m_ship\");\n } else {\n mship = \"\";\n }\n\n pstmtAus.close();\n\n } catch (Exception ignore) {\n\n mship = \"\";\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Membership Type could not be retrieved from Primary Member record!\";\n }\n }\n\n if (mship.equalsIgnoreCase(\"JRF\") || mship.equalsIgnoreCase(\"Former Junior\")) {\n mship = \"Former Junior\";\n } else if (mship.equalsIgnoreCase(\"HON\") || mship.equalsIgnoreCase(\"Honorary\")) {\n mship = \"Honorary\";\n } else if (mship.equalsIgnoreCase(\"JR\") || mship.equalsIgnoreCase(\"Junior\")) {\n mship = \"Junior\";\n } else if (mship.equalsIgnoreCase(\"N-R\") || mship.equalsIgnoreCase(\"Non-Resident\")) {\n mship = \"Non-Resident\";\n } else if (mship.equalsIgnoreCase(\"RES\") || mship.equalsIgnoreCase(\"Resident\")) {\n mship = \"Resident\";\n } else if (mship.equalsIgnoreCase(\"SR\") || mship.equalsIgnoreCase(\"SRD\") || mship.equalsIgnoreCase(\"Senior\")) {\n mship = \"Senior\";\n } else {\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n\n }\n } // end if austincountryclub\n */\n\n //******************************************************************\n // Treesdale Golf & Country Club - treesdalegolf\n //******************************************************************\n //\n if (club.equals(\"treesdalegolf\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n posid = mNum; // set posid in case we need it in the future\n\n if (primary.equalsIgnoreCase(\"P\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Primary Female\";\n } else {\n gender = \"M\";\n mtype = \"Primary Male\";\n }\n\n } else if (primary.equalsIgnoreCase(\"S\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Spouse Female\";\n } else {\n gender = \"M\";\n mtype = \"Spouse Male\";\n }\n\n memid += \"A\";\n\n } else {\n mtype = \"Junior\";\n }\n\n mship = \"Golf\";\n\n }\n } // end if treesdalegolf\n\n //******************************************************************\n // Sawgrass Country Club - sawgrass\n //******************************************************************\n //\n if (club.equals(\"sawgrass\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n if (mNum.endsWith(\"-1\")) {\n mNum = mNum.substring(0, mNum.length() - 2);\n }\n\n posid = mNum; // set posid in case we need it in the future\n\n // Still filter on given mships even though using mtype field to determine what mship will be set to\n if (mship.equalsIgnoreCase(\"Associate Member\") || mship.equalsIgnoreCase(\"Complimentary Employee\") || mship.equalsIgnoreCase(\"Complimentary Other\") ||\n mship.startsWith(\"House\")) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE! (mship)\";\n }\n\n if (mtype.equalsIgnoreCase(\"7DAY\")) {\n mship = \"Sports\";\n } else if (mtype.equalsIgnoreCase(\"3DAY\")) {\n mship = \"Social\";\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE! (mtype)\";\n }\n\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Member Female\";\n } else {\n mtype = \"Member Male\";\n }\n\n }\n } // end if sawgrass\n\n /*\n //******************************************************************\n // TPC at SnoaQualmie Ridge\n //******************************************************************\n //\n if (club.equals(\"snoqualmieridge\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n posid = mNum; // set posid in case it's ever needed\n\n // Set primary/spouse value\n if (mNum.toUpperCase().endsWith(\"A\")) {\n primary = \"P\";\n mNum = stripA(mNum);\n } else {\n if (mNum.toUpperCase().endsWith(\"B\")) {\n primary = \"S\";\n mNum = stripA(mNum);\n } else {\n if (mNum.toUpperCase().endsWith(\"C\") || mNum.toUpperCase().endsWith(\"D\") ||\n mNum.toUpperCase().endsWith(\"E\") || mNum.toUpperCase().endsWith(\"F\") ||\n mNum.toUpperCase().endsWith(\"G\") || mNum.toUpperCase().endsWith(\"H\") ||\n mNum.toUpperCase().endsWith(\"I\") || mNum.toUpperCase().endsWith(\"J\")) {\n primary = \"D\";\n\n memid = mNum.toUpperCase(); // use mNum for memid, they are unique\n\n mNum = stripA(mNum);\n\n } else {\n primary = \"P\"; // if no alpha - assume primary\n }\n }\n }\n\n // set mtype based on gender and relationship\n if (gender.equalsIgnoreCase(\"F\")) {\n\n if (primary.equals(\"P\") || primary.equals(\"S\")) {\n\n mtype = \"Adult Female\";\n\n memid = mNum + \"F\"; // memid for Adult Females\n\n } else {\n\n mtype = \"Dependent Female\";\n }\n\n } else { // Male\n\n if (primary.equals(\"P\") || primary.equals(\"S\")) {\n mtype = \"Adult Male\";\n\n memid = mNum + \"M\"; // memid for Adult Males\n\n } else {\n\n mtype = \"Dependent Male\";\n }\n }\n\n // mships ?????????????\n\n }\n } // end if snoqualmieridge\n */\n\n //******************************************************************\n // Druid Hills Golf Club - dhgc\n //******************************************************************\n //\n if (club.equals(\"dhgc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n\n posid = mNum; // set posid in case we need it in the future\n\n // Remove leading zeroes\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mship.equalsIgnoreCase(\"House\")) {\n\n skip = true;\n errCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF MEMBERSHIP TYPE!\";\n }\n\n if (primary.equalsIgnoreCase(\"S\")) {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n }\n } // end if dhgc\n\n //******************************************************************\n // The Reserve Club - thereserveclub\n //******************************************************************\n //\n if (club.equals(\"thereserveclub\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n useWebid = true; // use webid for this club\n webid = memid; // use memid for webid\n memid = mNum;\n\n if (mNum.endsWith(\"-1\")) {\n mNum = mNum.substring(0, mNum.length() - 2);\n }\n\n posid = mNum; // set posid in case we need it in the future\n\n mship = mtype;\n\n if (mship.endsWith(\" - Spouse\")) {\n mship = mship.substring(0, mship.length() - 9);\n }\n\n if (mship.startsWith(\"Social\")) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE! (mtype)\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n }\n } // end if thereserveclub\n\n\n //******************************************************************\n // Robert Trent Jones - rtjgc\n //******************************************************************\n //\n if (club.equals(\"rtjgc\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n //\n // use the mnum for memid\n //\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n if (mNum.endsWith(\"-1\")) {\n\n memid = mNum;\n\n while (memid.length() < 5) {\n memid = \"0\" + memid;\n }\n\n if (gender.equals(\"F\")) {\n memid += \"A\"; // spouse or female\n }\n } else {\n memid = mNum; // primary males\n }\n\n\n //\n // Set the member type\n //\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n\n }\n\n } // end if rtjgc\n\n\n //******************************************************************\n // Morgan Run - morganrun\n //******************************************************************\n //\n if (club.equals(\"morganrun\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n \n if (primary.equalsIgnoreCase(\"S\")) {\n memid += \"A\";\n }\n\n mship = \"Golf\";\n\n //\n // Set the member type\n //\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n }\n\n } // end if morganrun\n\n\n //******************************************************************\n // CC at DC Ranch - ccdcranch\n //******************************************************************\n //\n if (club.equals(\"ccdcranch\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n //\n // use memid as webid !!\n //\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (mship.equalsIgnoreCase(\"COR\") || mship.equalsIgnoreCase(\"GOLF\")) {\n mship = \"Full Golf\";\n } else if (mship.equalsIgnoreCase(\"SPS\")) {\n mship = \"Sports/Social\";\n } else if (mship.equalsIgnoreCase(\"SECONDARY\")) {\n if (mNum.startsWith(\"1\") || mNum.startsWith(\"5\")) {\n mship = \"Full Golf\";\n } else if (mNum.startsWith(\"3\")) {\n mship = \"Sports/Social\";\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP TYPE!\";\n }\n\n //\n // Set the member type\n //\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n }\n\n } // end if ccdcranch\n\n\n //******************************************************************\n // Oakley CC - oakleycountryclub\n //******************************************************************\n //\n if (club.equals(\"oakleycountryclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (!mtype.equals(\"\")) {\n mship = mtype;\n }\n\n // Set the member type\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n\n }\n\n } // end if oakleycountryclub\n\n\n //******************************************************************\n // Black Rock CC - blackrockcountryclub\n //******************************************************************\n //\n if (club.equals(\"blackrockcountryclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\") || mNum.endsWith(\"D\") || mNum.endsWith(\"Z\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (primary.equalsIgnoreCase(\"S\")) {\n if (gender.equalsIgnoreCase(\"M\")) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n gender = \"F\";\n }\n } else {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n gender = \"M\";\n }\n }\n\n }\n\n } // end if blackrockcountryclub\n\n/*\n //******************************************************************\n // The Edison Club - edisonclub\n //******************************************************************\n //\n if (club.equals(\"edisonclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n while (posid.startsWith(\"0\")) {\n posid = posid.substring(1);\n }\n\n // use memid as webid\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (primary.equalsIgnoreCase(\"S\")) {\n if (gender.equalsIgnoreCase(\"M\")) {\n mtype = \"Spouse Male\";\n } else {\n mtype = \"Spouse Female\";\n gender = \"F\";\n }\n } else {\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n gender = \"M\";\n }\n } \n\n }\n\n } // end if edisonclub\n */\n\n\n //******************************************************************\n // Longue Vue Club - longuevueclub\n //******************************************************************\n //\n if (club.equals(\"longuevueclub\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n if (mtype.equals(\"\")) {\n mtype = \"Adult Male\";\n }\n\n if (mtype.endsWith(\" Female\")) {\n gender = \"F\";\n } else {\n gender = \"M\";\n }\n }\n } // end if longuevueclub\n\n\n //******************************************************************\n // Happy Hollow Club - happyhollowclub\n //******************************************************************\n //\n if (club.equals(\"happyhollowclub\")) {\n\n found = true; // club found\n\n if (mtype.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing! (*NOTE* mship located in mtype field)\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid to locate member\n\n webid = memid; // use webid for this club\n\n memid = mNum;\n\n while (memid.startsWith(\"0\")) {\n memid = memid.substring(1);\n }\n\n // If member number does not end with the first letter of member's last name, strip off the last character\n if (!mNum.endsWith(lname.substring(0,1))) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n // Add leading zeroes until mNum has a length of 5\n while (mNum.length() < 5) {\n mNum = \"0\" + mNum;\n }\n\n\n // Remove \"Member Status:\" from beginning of mship\n if (mtype.startsWith(\"Member Status:\")) {\n mtype = mtype.replace(\"Member Status:\", \"\");\n }\n\n // Filter mtypes and mships\n if (mtype.equalsIgnoreCase(\"DEPEND A\") || mtype.equalsIgnoreCase(\"DEPEND B\") || mtype.equalsIgnoreCase(\"DEPEND SOC\")) {\n\n if (mtype.equalsIgnoreCase(\"DEPEND A\") || mtype.equalsIgnoreCase(\"DEPEND B\")) {\n mship = \"Golf\";\n } else if (mtype.equalsIgnoreCase(\"DEPEND SOC\")) {\n mship = \"Social\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Dependent Female\";\n } else {\n mtype = \"Dependent Male\";\n }\n\n } else if (mtype.equalsIgnoreCase(\"EMPLOYEE\") || mtype.equalsIgnoreCase(\"GOLF A\") || mtype.equalsIgnoreCase(\"GOLF B\") || mtype.equalsIgnoreCase(\"SOCIAL\")) {\n\n if (mtype.equalsIgnoreCase(\"EMPLOYEE\")) {\n mship = \"Employee\";\n } else if (mtype.equalsIgnoreCase(\"GOLF A\") || mtype.equalsIgnoreCase(\"GOLF B\")) {\n mship = \"Golf\";\n } else if (mtype.equalsIgnoreCase(\"SOCIAL\")) {\n mship = \"Social\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n \n } else if (mtype.equalsIgnoreCase(\"SPOUSE A\") || mtype.equalsIgnoreCase(\"SPOUSE B\") || mtype.equalsIgnoreCase(\"SPOUSE SOC\")) {\n\n if (mtype.equalsIgnoreCase(\"SPOUSE A\") || mtype.equalsIgnoreCase(\"SPOUSE B\")) {\n mship = \"Golf\";\n } else if (mtype.equalsIgnoreCase(\"SPOUSE SOC\")) {\n mship = \"Social\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP/MEMBER TYPE!\";\n }\n\n }\n } // end if happyhollowclub\n\n \n \n //******************************************************************\n // CC of Castle Pines\n //******************************************************************\n //\n if (club.equals(\"castlepines\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid for member\n useWebidQuery = true; // use webid to locate member in Query\n\n webid = memid; // use webid for this club\n\n while (mNum.startsWith(\"0\")) { // strip any leading zeros\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n // Isolate the member number\n StringTokenizer tok9 = new StringTokenizer( mNum, \"-\" ); // look for a dash (i.e. 1234-1)\n\n if ( tok9.countTokens() > 1 ) { \n\n mNum = tok9.nextToken(); // get just the mNum if it contains an extension\n }\n\n // Filter mtypes and mships\n if (mship.equalsIgnoreCase(\"golf\") || mship.equalsIgnoreCase(\"corporate\")) {\n\n if (mship.equalsIgnoreCase(\"Corporate\")) {\n mship = \"Corporate\";\n } else {\n mship = \"Regular Member\"; // convert Golf to Regular Member\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP/MEMBER TYPE!\";\n }\n\n }\n } // end if castlepines\n\n\n\n //******************************************************************\n // Golf Club at Turner Hill - turnerhill\n //******************************************************************\n //\n if (club.equals(\"turnerhill\")) {\n\n found = true; // club found\n\n if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid for member\n useWebidQuery = true; // use webid to locate member in Query\n\n webid = memid; // use webid for this club\n\n memid = mNum;\n\n mship = \"Golf\";\n\n if (!gender.equalsIgnoreCase(\"F\")) {\n gender = \"M\";\n }\n\n if (mNum.endsWith(\"A\")) {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Spouse Female\";\n } else {\n mtype = \"Spouse Male\";\n }\n\n mNum = mNum.substring(0, mNum.length() - 1);\n\n } else {\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Primary Female\";\n } else {\n mtype = \"Primary Male\";\n }\n }\n\n }\n } // end if turnerhill\n\n\n //******************************************************************\n // The Club at Mediterra - mediterra\n //******************************************************************\n //\n if (club.equals(\"mediterra\")) {\n\n found = true; // club found\n\n if (mship.equals( \"\" )) {\n\n skip = true; // skip this one\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBERSHIP TYPE missing!\";\n\n } else if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid for member\n useWebidQuery = true; // use webid to locate member in Query\n\n webid = memid; // use webid for this club\n\n // Get ride of all leading zeroes.\n while (mNum.startsWith(\"0\")) {\n mNum = mNum.substring(1);\n }\n\n memid = mNum;\n\n // Strip off special character\n if (mNum.endsWith(\"A\") || mNum.endsWith(\"a\") || mNum.endsWith(\"B\") || mNum.endsWith(\"b\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (mship.equalsIgnoreCase(\"G\") || mship.equalsIgnoreCase(\"GNF\")) {\n mship = \"Golf\";\n } else if (mship.equalsIgnoreCase(\"S\")) {\n mship = \"Sports\";\n } else if (mship.equalsIgnoreCase(\"D\")) {\n\n try {\n\n pstmt2 = con.prepareStatement(\"SELECT m_ship FROM member2b WHERE username = ?\");\n pstmt2.clearParameters();\n pstmt2.setString(1, mNum);\n\n rs = pstmt2.executeQuery();\n\n if (rs.next()) {\n mship = rs.getString(\"m_ship\");\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NO PRIMARY MEMBERSHIP TYPE!\";\n }\n\n pstmt2.close();\n\n } catch (Exception exc) {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: ERROR WHILE LOOKING UP MEMBERSHIP TYPE!\";\n }\n\n } else {\n\n skip = true;\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: NON-GOLF or UNKNOWN MEMBERSHIP/MEMBER TYPE!\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n mtype = \"Adult Female\";\n } else {\n mtype = \"Adult Male\";\n }\n }\n } // end if mediterra\n\n\n //******************************************************************\n // Hideaway Beach Club - hideawaybeachclub\n //******************************************************************\n //\n if (club.equals(\"hideawaybeachclub\")) {\n\n found = true; // club found\n\n if (mNum.equals( \"\" )) {\n\n skip = true; // skip this one\n warnCount++;\n warnMsg = warnMsg + \"\\n\" +\n \" -SKIPPED: Member Number Missing!\";\n\n } else {\n\n posid = mNum; // use their member numbers as their posid\n\n // use memid as webid\n useWebid = true; // use webid for member\n useWebidQuery = true; // use webid to locate member in Query\n\n webid = memid; // use webid for this club\n\n memid = mNum;\n\n if (mNum.endsWith(\"A\") || mNum.endsWith(\"a\")) {\n mNum = mNum.substring(0, mNum.length() - 1);\n }\n\n if (mNum.startsWith(\"7\")) {\n mship = \"Renter\";\n } else {\n mship = \"Golf\";\n }\n\n if (gender.equalsIgnoreCase(\"F\")) {\n gender = \"F\";\n mtype = \"Adult Female\";\n } else {\n gender = \"M\";\n mtype = \"Adult Male\";\n }\n\n }\n } // end if hideawaybeachclub\n\n\n \n //******************************************************************\n // All clubs\n //******************************************************************\n //\n if (skip == false && found == true && !fname.equals(\"\") && !lname.equals(\"\") && !memid.equals(\"\")) {\n\n //\n // now determine if we should update an existing record or add the new one\n //\n fname_old = \"\";\n lname_old = \"\";\n mi_old = \"\";\n mship_old = \"\";\n mtype_old = \"\";\n email_old = \"\";\n mNum_old = \"\";\n ghin_old = \"\";\n bag_old = \"\";\n posid_old = \"\";\n email2_old = \"\";\n phone_old = \"\";\n phone2_old = \"\";\n suffix_old = \"\";\n u_hcap_old = 0;\n c_hcap_old = 0;\n birth_old = 0;\n msub_type_old = \"\";\n email_bounce1 = 0;\n email_bounce2 = 0;\n\n\n //\n // Truncate the string values to avoid sql error\n //\n if (!mi.equals( \"\" )) { // if mi specified\n\n mi = truncate(mi, 1); // make sure it is only 1 char\n }\n if (!memid.equals( \"\" )) {\n\n memid = truncate(memid, 15);\n }\n if (!password.equals( \"\" )) {\n\n password = truncate(password, 15);\n }\n if (!lname.equals( \"\" )) {\n\n lname = truncate(lname, 20);\n }\n if (!fname.equals( \"\" )) {\n\n fname = truncate(fname, 20);\n }\n if (!mship.equals( \"\" )) {\n\n mship = truncate(mship, 30);\n }\n if (!mtype.equals( \"\" )) {\n\n mtype = truncate(mtype, 30);\n }\n if (!email.equals( \"\" )) {\n\n email = truncate(email, 50);\n }\n if (!email2.equals( \"\" )) {\n\n email2 = truncate(email2, 50);\n }\n if (!mNum.equals( \"\" )) {\n\n mNum = truncate(mNum, 10);\n }\n if (!ghin.equals( \"\" )) {\n\n ghin = truncate(ghin, 16);\n }\n if (!bag.equals( \"\" )) {\n\n bag = truncate(bag, 12);\n }\n if (!posid.equals( \"\" )) {\n\n posid = truncate(posid, 15);\n }\n if (!phone.equals( \"\" )) {\n\n phone = truncate(phone, 24);\n }\n if (!phone2.equals( \"\" )) {\n\n phone2 = truncate(phone2, 24);\n }\n if (!suffix.equals( \"\" )) {\n\n suffix = truncate(suffix, 4);\n }\n if (!webid.equals( \"\" )) {\n\n webid = truncate(webid, 15);\n }\n if (!msub_type.equals( \"\" )) {\n\n msub_type = truncate(msub_type, 30);\n }\n\n //\n // Set Gender and Primary values\n //\n if (!gender.equalsIgnoreCase( \"M\" ) && !gender.equalsIgnoreCase( \"F\" )) {\n\n gender = \"\";\n }\n\n pri_indicator = 0; // default = Primary\n\n if (primary.equalsIgnoreCase( \"S\" )) { // Spouse\n\n pri_indicator = 1;\n }\n if (primary.equalsIgnoreCase( \"D\" )) { // Dependent\n\n pri_indicator = 2;\n }\n\n\n //\n // See if a member already exists with this id (username or webid)\n //\n // **** NOTE: memid and webid MUST be set to their proper values before we get here!!!!!!!!!!!!!!!\n //\n //\n // 4/07/2010\n // We now use 2 booleans to indicate what to do with the webid field.\n // useWebid is the original boolean that was used to indicate that we should use the webid to identify the member.\n // We lost track of when this flag was used and why. It was no longer used to indicate the webid should be \n // used in the query, so we don't know what its real purpose is. We don't want to disrupt any clubs that are\n // using it, so we created a new boolean for the query.\n // useWebidQuery is the new flag to indicate that we should use the webid when searching for the member. You should use\n // both flags if you want to use this one.\n //\n try {\n \n if (useWebid == true) { // use webid to locate member?\n\n webid_new = webid; // yes, set new ids\n memid_new = \"\";\n\n } else { // DO NOT use webid\n\n webid_new = \"\"; // set new ids\n memid_new = memid;\n }\n\n if (useWebidQuery == false) {\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n\n } else { // use the webid field\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE webid = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, webid); // put the parm in stmt\n }\n\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n memid = rs.getString(\"username\"); // get username in case we used webid (use this for existing members)\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n ghin_old = rs.getString(\"ghin\");\n bag_old = rs.getString(\"bag\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n msub_type_old = rs.getString(\"msub_type\");\n email2_old = rs.getString(\"email2\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n suffix_old = rs.getString(\"name_suf\");\n email_bounce1 = rs.getInt(\"email_bounced\");\n email_bounce2 = rs.getInt(\"email2_bounced\");\n\n if (useWebid == true) { // use webid to locate member?\n memid_new = memid; // yes, get this username\n } else {\n webid_new = rs.getString(\"webid\"); // no, get current webid\n }\n }\n pstmt2.close(); // close the stmt\n\n\n //\n // If member NOT found, then check if new member OR id has changed\n //\n boolean memFound = false;\n boolean dup = false;\n boolean userChanged = false;\n boolean nameChanged = false;\n String dupmship = \"\";\n\n if (fname_old.equals( \"\" )) { // if member NOT found\n\n //\n // New member - first check if name already exists\n //\n pstmt2 = con.prepareStatement (\n \"SELECT username, m_ship, memNum, webid FROM member2b WHERE name_last = ? AND name_first = ? AND name_mi = ?\");\n\n pstmt2.clearParameters();\n pstmt2.setString(1, lname);\n pstmt2.setString(2, fname);\n pstmt2.setString(3, mi);\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next() && !club.equals(\"longcove\")) { // Allow duplicate names for Long Cove for members owning two properties at once\n\n dupuser = rs.getString(\"username\"); // get this username\n dupmship = rs.getString(\"m_ship\");\n dupmnum = rs.getString(\"memNum\");\n dupwebid = rs.getString(\"webid\"); // get this webid\n\n //\n // name already exists - see if this is the same member\n //\n sendemail = true; // send a warning email to us and MF\n\n if ((!dupmnum.equals( \"\" ) && dupmnum.equals( mNum )) || club.equals(\"imperialgc\")) { // if name and mNum match, then memid or webid must have changed\n\n if (useWebid == true) { // use webid to locate member?\n\n webid_new = webid; // set new ids\n memid_new = dupuser;\n memid = dupuser; // update this record\n\n } else {\n\n webid_new = dupwebid; // set new ids\n memid_new = memid;\n memid = dupuser; // update this record\n userChanged = true; // indicate the username has changed\n }\n\n memFound = true; // update the member\n\n pstmt2 = con.prepareStatement (\n \"SELECT * FROM member2b WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n rs = pstmt2.executeQuery(); // execute the prepared stmt\n\n if (rs.next()) {\n\n lname_old = rs.getString(\"name_last\");\n fname_old = rs.getString(\"name_first\");\n mi_old = rs.getString(\"name_mi\");\n mship_old = rs.getString(\"m_ship\");\n mtype_old = rs.getString(\"m_type\");\n email_old = rs.getString(\"email\");\n mNum_old = rs.getString(\"memNum\");\n ghin_old = rs.getString(\"ghin\");\n bag_old = rs.getString(\"bag\");\n birth_old = rs.getInt(\"birth\");\n posid_old = rs.getString(\"posid\");\n msub_type_old = rs.getString(\"msub_type\");\n email2_old = rs.getString(\"email2\");\n phone_old = rs.getString(\"phone1\");\n phone2_old = rs.getString(\"phone2\");\n suffix_old = rs.getString(\"name_suf\");\n email_bounce1 = rs.getInt(\"email_bounced\");\n email_bounce2 = rs.getInt(\"email2_bounced\");\n }\n\n //\n // Add this info to the email message text\n //\n emailMsg1 = emailMsg1 + \"Name = \" +fname+ \" \" +mi+ \" \" +lname+ \", ForeTees Member Id has been updated to that received.\\n\\n\";\n\n } else {\n\n //\n // Add this info to the email message text\n //\n emailMsg1 = emailMsg1 + \"Name = \" +fname+ \" \" +mi+ \" \" +lname+ \", ForeTees username = \" +dupuser+ \", ForeTees webid = \" +dupwebid+ \", MF id = \" +memid+ \"\\n\\n\";\n\n dup = true; // dup member - do not add\n }\n\n }\n pstmt2.close(); // close the stmt\n\n } else { // member found\n\n memFound = true;\n }\n\n //\n // Now, update the member record if existing member\n //\n if (memFound == true) { // if member exists\n\n changed = false; // init change indicator\n\n lname_new = lname_old;\n\n // do not change lname for Saucon Valley if lname_old ends with '_*'\n if (club.equals( \"sauconvalleycc\" ) && lname_old.endsWith(\"_*\")) {\n\n lname = lname_old;\n\n } else if (!lname.equals( \"\" ) && !lname_old.equals( lname )) {\n\n lname_new = lname; // set value from MFirst record\n changed = true;\n nameChanged = true;\n }\n\n fname_new = fname_old;\n\n //\n // DO NOT change for select clubs\n //\n if (club.equals( \"pinery\" ) || club.equals( \"bellerive\" ) || club.equals( \"greenhills\" ) || club.equals( \"fairbanksranch\" ) ||\n club.equals( \"baltusrolgc\" ) || club.equals(\"charlottecc\") || club.equals(\"castlepines\")) {\n\n fname = fname_old; // do not change fnames\n\n } else {\n\n if (!fname.equals( \"\" ) && !fname_old.equals( fname )) {\n\n fname_new = fname; // set value from MFirst record\n changed = true;\n nameChanged = true;\n }\n }\n\n mi_new = mi_old;\n\n //\n // DO NOT change middle initial for ClubCorp clubs\n //\n if (clubcorp) {\n\n mi = mi_old;\n\n } else {\n if (!mi_old.equals( mi )) {\n\n mi_new = mi; // set value from MFirst record\n changed = true;\n nameChanged = true;\n }\n }\n\n mship_new = mship_old;\n\n if (!mship.equals( \"\" ) && !mship_old.equals( mship )) {\n\n mship_new = mship; // set value from MFirst record\n changed = true;\n }\n\n mtype_new = mtype_old;\n\n if (club.equals( \"greenhills\" ) || club.equals(\"paloaltohills\") ||\n (club.equals(\"navesinkcc\") && mtype_old.equals(\"Primary Male GP\"))) { // Green Hills - do not change the mtype\n\n mtype = mtype_old;\n\n } else {\n\n if (!mtype.equals( \"\" ) && !mtype_old.equals( mtype )) {\n\n mtype_new = mtype; // set value from MFirst record\n changed = true;\n }\n }\n\n mNum_new = mNum_old;\n\n if (!mNum.equals( \"\" ) && !mNum_old.equals( mNum )) {\n\n mNum_new = mNum; // set value from MFirst record\n changed = true;\n }\n\n ghin_new = ghin_old;\n\n if (!ghin.equals( \"\" ) && !ghin_old.equals( ghin )) {\n\n ghin_new = ghin; // set value from MFirst record\n changed = true;\n }\n\n bag_new = bag_old;\n\n if (!club.equals(\"edina\") && !club.equals(\"edina2010\")) { // never change for Edina\n\n if (!bag.equals( \"\" ) && !bag_old.equals( bag )) {\n\n bag_new = bag; // set value from MFirst record\n changed = true;\n }\n }\n\n posid_new = posid_old;\n\n if (!posid.equals( \"\" ) && !posid_old.equals( posid )) {\n\n posid_new = posid; // set value from MFirst record\n changed = true;\n }\n\n email_new = email_old;\n\n if (!club.equals(\"mesaverdecc\")) { // never change for Mesa Verde CC\n\n if (!email_old.equals( email )) { // if MF's email changed or was removed\n\n email_new = email; // set value from MFirst record\n changed = true;\n email_bounce1 = 0; // reset bounced flag\n }\n }\n\n email2_new = email2_old;\n\n if (!club.equals(\"mesaverdecc\")) { // never change for Mesa Verde CC\n\n if (!email2_old.equals( email2 )) { // if MF's email changed or was removed\n\n email2_new = email2; // set value from MFirst record\n changed = true;\n email_bounce2 = 0; // reset bounced flag\n }\n }\n\n phone_new = phone_old;\n\n if (!phone.equals( \"\" ) && !phone_old.equals( phone )) {\n\n phone_new = phone; // set value from MFirst record\n changed = true;\n }\n\n phone2_new = phone2_old;\n\n if (!phone2.equals( \"\" ) && !phone2_old.equals( phone2 )) {\n\n phone2_new = phone2; // set value from MFirst record\n changed = true;\n }\n\n suffix_new = suffix_old;\n\n if (!suffix.equals( \"\" ) && !suffix_old.equals( suffix )) {\n\n suffix_new = suffix; // set value from MFirst record\n changed = true;\n }\n\n birth_new = birth_old;\n\n if (!club.equals(\"fountaingrovegolf\")) { // Don't update birthdates for Fountain Grove\n\n if (birth > 0 && birth != birth_old) {\n\n birth_new = birth; // set value from MFirst record\n changed = true;\n }\n }\n\n if (!mobile.equals( \"\" )) { // if mobile phone provided\n\n if (phone_new.equals( \"\" )) { // if phone1 is empty\n\n phone_new = mobile; // use mobile number\n changed = true;\n\n } else {\n\n if (phone2_new.equals( \"\" )) { // if phone2 is empty\n\n phone2_new = mobile; // use mobile number\n changed = true;\n }\n }\n }\n\n msub_type_new = msub_type_old;\n\n if (!msub_type.equals( \"\" ) && !msub_type_old.equals( msub_type )) {\n\n msub_type_new = msub_type; // set value from MFirst record\n changed = true;\n }\n\n // don't allow both emails to be the same\n if (email_new.equalsIgnoreCase(email2_new)) email2_new = \"\";\n\n //\n // Update our record (always now to set the last_sync_date)\n //\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET username = ?, name_last = ?, name_first = ?, \" +\n \"name_mi = ?, m_ship = ?, m_type = ?, email = ?, \" +\n \"memNum = ?, ghin = ?, bag = ?, birth = ?, posid = ?, msub_type = ?, email2 = ?, phone1 = ?, \" +\n \"phone2 = ?, name_suf = ?, webid = ?, inact = 0, last_sync_date = now(), gender = ?, pri_indicator = ?, \" +\n \"email_bounced = ?, email2_bounced = ? \" +\n \"WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid_new);\n pstmt2.setString(2, lname_new);\n pstmt2.setString(3, fname_new);\n pstmt2.setString(4, mi_new);\n pstmt2.setString(5, mship_new);\n pstmt2.setString(6, mtype_new);\n pstmt2.setString(7, email_new);\n pstmt2.setString(8, mNum_new);\n pstmt2.setString(9, ghin_new);\n pstmt2.setString(10, bag_new);\n pstmt2.setInt(11, birth_new);\n pstmt2.setString(12, posid_new);\n pstmt2.setString(13, msub_type_new);\n pstmt2.setString(14, email2_new);\n pstmt2.setString(15, phone_new);\n pstmt2.setString(16, phone2_new);\n pstmt2.setString(17, suffix_new);\n pstmt2.setString(18, webid_new);\n pstmt2.setString(19, gender);\n pstmt2.setInt(20, pri_indicator);\n pstmt2.setInt(21, email_bounce1);\n pstmt2.setInt(22, email_bounce2);\n\n pstmt2.setString(23, memid);\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n\n } else { // member NOT found - add it if we can\n\n if (dup == false) { // if not duplicate member\n\n //\n // New member is ok - add it\n //\n pstmt2 = con.prepareStatement (\n \"INSERT INTO member2b (username, password, name_last, name_first, name_mi, \" +\n \"m_ship, m_type, email, count, c_hancap, g_hancap, wc, message, emailOpt, memNum, \" +\n \"ghin, locker, bag, birth, posid, msub_type, email2, phone1, phone2, name_pre, name_suf, webid, \" +\n \"last_sync_date, gender, pri_indicator) \" +\n \"VALUES (?,?,?,?,?,?,?,?,0,?,?,'','',1,?,?,'',?,?,?,?,?,?,?,'',?,?, now(),?,?)\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // put the parm in stmt\n pstmt2.setString(2, password);\n pstmt2.setString(3, lname);\n pstmt2.setString(4, fname);\n pstmt2.setString(5, mi);\n pstmt2.setString(6, mship);\n pstmt2.setString(7, mtype);\n pstmt2.setString(8, email);\n pstmt2.setFloat(9, c_hcap);\n pstmt2.setFloat(10, u_hcap);\n pstmt2.setString(11, mNum);\n pstmt2.setString(12, ghin);\n pstmt2.setString(13, bag);\n pstmt2.setInt(14, birth);\n pstmt2.setString(15, posid);\n pstmt2.setString(16, msub_type);\n pstmt2.setString(17, email2);\n pstmt2.setString(18, phone);\n pstmt2.setString(19, phone2);\n pstmt2.setString(20, suffix);\n pstmt2.setString(21, webid);\n pstmt2.setString(22, gender);\n pstmt2.setInt(23, pri_indicator);\n pstmt2.executeUpdate(); // execute the prepared stmt\n\n pstmt2.close(); // close the stmt\n\n } else { // this member not found, but name already exists\n\n if (dup) {\n errCount++;\n errMsg = errMsg + \"\\n -Dup user found:\\n\" +\n \" new: memid = \" + memid + \" : cur: \" + dupuser + \"\\n\" +\n \" webid = \" + webid + \" : \" + dupwebid + \"\\n\" +\n \" mNum = \" + mNum + \" : \" + dupmnum;\n }\n\n if (club.equals( \"bentwaterclub\" ) && !dupuser.equals(\"\")) {\n\n //\n // Bentwater CC - Duplicate member name found. This is not uncommon for this club.\n // We must accept the member record with the highest priority mship type.\n // Members are property owners and can own multiple properties, each with a\n //\n // Order of Priority:\n // GPM\n // DOP\n // DCC\n // DOC\n // DGC\n // MGM\n // DOM\n // SCM\n // EMP\n // DSS\n // DCL\n // VSG\n // S\n //\n boolean switchMship = false;\n\n if (mship.equals(\"GPM\")) { // if new record has highest mship value\n\n switchMship = true; // update existing record to this mship\n\n } else {\n\n if (mship.equals(\"DOP\")) {\n\n if (!dupmship.equals(\"GPM\")) { // if existing mship is lower than new one\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"DCC\")) {\n\n if (!dupmship.equals(\"GPM\") && !dupmship.equals(\"DOP\")) { // if existing mship is lower than new one\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"DOC\")) {\n\n if (!dupmship.equals(\"GPM\") && !dupmship.equals(\"DOP\") && !dupmship.equals(\"DCC\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"DGC\")) {\n\n if (!dupmship.equals(\"GPM\") && !dupmship.equals(\"DOP\") && !dupmship.equals(\"DCC\") &&\n !dupmship.equals(\"DOC\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"MGM\")) {\n\n if (!dupmship.equals(\"GPM\") && !dupmship.equals(\"DOP\") && !dupmship.equals(\"DCC\") &&\n !dupmship.equals(\"DOC\") && !dupmship.equals(\"DGC\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"DOM\")) {\n\n if (!dupmship.equals(\"GPM\") && !dupmship.equals(\"DOP\") && !dupmship.equals(\"DCC\") &&\n !dupmship.equals(\"DOC\") && !dupmship.equals(\"DGC\") && !dupmship.equals(\"MGM\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"SCM\")) {\n\n if (dupmship.equals(\"EMP\") || dupmship.equals(\"DSS\") || dupmship.equals(\"DCL\") ||\n dupmship.equals(\"VSG\") || dupmship.equals(\"S\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"EMP\")) {\n\n if (dupmship.equals(\"DSS\") || dupmship.equals(\"DCL\") ||\n dupmship.equals(\"VSG\") || dupmship.equals(\"S\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"DSS\")) {\n\n if (dupmship.equals(\"DCL\") ||\n dupmship.equals(\"VSG\") || dupmship.equals(\"S\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"DCL\")) {\n\n if (dupmship.equals(\"VSG\") || dupmship.equals(\"S\")) {\n\n switchMship = true; // update existing record to this mship\n }\n\n } else {\n\n if (mship.equals(\"VSG\")) {\n\n if (dupmship.equals(\"S\")) {\n\n switchMship = true; // update existing record to this mship\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n //\n // If we must switch the mship type, update the existing record to reflect the higher pri mship\n //\n if (switchMship == true) {\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET \" +\n \"username = ?, m_ship = ?, memNum = ?, posid = ?, webid = ? \" +\n \"WHERE username = ?\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.setString(1, memid); // use this username so record gets updated correctly next time\n pstmt2.setString(2, mship);\n pstmt2.setString(3, mNum);\n pstmt2.setString(4, posid);\n pstmt2.setString(5, webid);\n pstmt2.setString(6, dupuser); // update existing record - keep username, change others\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n\n userChanged = true; // indicate username changed\n\n memid_new = memid; // new username\n memid = dupuser; // old username\n fname_new = fname;\n mi_new = mi;\n lname_new = lname;\n }\n\n } // end of IF Bentwater Club and dup user\n }\n } // end of IF Member Found\n\n //\n // Member updated - now see if the username or name changed\n //\n if (userChanged == true || nameChanged == true) { // if username or name changed\n\n //\n // username or name changed - we must update other tables now\n //\n StringBuffer mem_name = new StringBuffer( fname_new ); // get the new first name\n\n if (!mi_new.equals( \"\" )) {\n mem_name.append(\" \" +mi_new); // new mi\n }\n mem_name.append(\" \" +lname_new); // new last name\n\n String newName = mem_name.toString(); // convert to one string\n\n Admin_editmem.updTeecurr(newName, memid_new, memid, con); // update teecurr with new values\n\n Admin_editmem.updTeepast(newName, memid_new, memid, con); // update teepast with new values\n\n Admin_editmem.updLreqs(newName, memid_new, memid, con); // update lreqs with new values\n\n Admin_editmem.updPartner(memid_new, memid, con); // update partner with new values\n\n Admin_editmem.updEvents(newName, memid_new, memid, con); // update evntSignUp with new values\n\n Admin_editmem.updLessons(newName, memid_new, memid, con); // update the lesson books with new values\n }\n }\n catch (Exception e3b) {\n errCount++;\n errMsg = errMsg + \"\\n -Error2 processing roster for \" +club+ \"\\n\" +\n \" line = \" +line+ \": \" + e3b.getMessage(); // build msg\n }\n\n } else {\n\n // Only report errors that AREN'T due to skip == true, since those were handled earlier!\n if (!found) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -MEMBER NOT FOUND!\";\n }\n if (fname.equals(\"\")) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -FIRST NAME missing!\";\n }\n if (lname.equals(\"\")) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -LAST NAME missing!\";\n }\n if (memid.equals(\"\")) {\n errCount++;\n errMsg = errMsg + \"\\n\" +\n \" -USERNAME missing!\";\n }\n } // end of IF skip\n\n } // end of IF minimum requirements\n\n } // end of IF tokens\n\n // log any errors and warnings that occurred\n if (errCount > 0) {\n totalErrCount += errCount;\n errList.add(errMemInfo + \"\\n *\" + errCount + \" error(s) found*\" + errMsg + \"\\n\");\n }\n if (warnCount > 0) {\n totalWarnCount += warnCount;\n warnList.add(errMemInfo + \"\\n *\" + warnCount + \" warning(s) found*\" + warnMsg + \"\\n\");\n }\n } // end of while (for each record in club's file)\n\n //\n // Done with this file for this club - now set any members that were excluded from this file inactive\n //\n if (found == true) { // if we processed this club\n\n pstmt2 = con.prepareStatement (\n \"UPDATE member2b SET inact = 1 \" +\n \"WHERE last_sync_date != now() AND last_sync_date != '0000-00-00'\");\n\n pstmt2.clearParameters(); // clear the parms\n pstmt2.executeUpdate();\n\n pstmt2.close(); // close the stmt\n \n \n //\n // Roster File Found for this club - make sure the roster sync indicator is set in the club table\n //\n setRSind(con, club);\n }\n\n\n //\n // Send an email to us and MF support if any dup names found\n //\n if (sendemail == true) {\n\n Properties properties = new Properties();\n properties.put(\"mail.smtp.host\", host); // set outbound host address\n properties.put(\"mail.smtp.port\", port); // set outbound port\n properties.put(\"mail.smtp.auth\", \"true\"); // set 'use authentication'\n\n Session mailSess = Session.getInstance(properties, SystemUtils.getAuthenticator()); // get session properties\n\n MimeMessage message = new MimeMessage(mailSess);\n\n try {\n\n message.setFrom(new InternetAddress(efrom)); // set from addr\n\n message.setSubject( subject ); // set subject line\n message.setSentDate(new java.util.Date()); // set date/time sent\n }\n catch (Exception ignore) {\n }\n\n //message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailFT)); // set our support email addr\n\n message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailMF)); // add MF email addr\n\n emailMsg1 = emailMsg1 + emailMsg2; // add trailer msg\n\n try {\n message.setText( emailMsg1 ); // put msg in email text area\n\n Transport.send(message); // send it!!\n }\n catch (Exception ignore) {\n }\n\n }\n\n }\n catch (Exception e3) {\n\n errorMsg = errorMsg + \" Error processing roster for \" +club+ \": \" + e3.getMessage() + \"\\n\"; // build msg\n SystemUtils.logError(errorMsg); // log it\n }\n\n // Print error and warning count totals to error log\n SystemUtils.logErrorToFile(\"\" +\n \"Total Errors Found: \" + totalErrCount + \"\\n\" +\n \"Total Warnings Found: \" + totalWarnCount + \"\\n\", club, true);\n\n // Print errors and warnings to error log\n if (totalErrCount > 0) {\n SystemUtils.logErrorToFile(\"\" +\n \"********************************************************************\\n\" +\n \"****ERRORS FOR \" + club + \" (Member WAS NOT synced!)\\n\" +\n \"********************************************************************\\n\", club, true);\n while (errList.size() > 0) {\n SystemUtils.logErrorToFile(errList.remove(0), club, true);\n }\n }\n if (totalWarnCount > 0) {\n SystemUtils.logErrorToFile(\"\" +\n \"********************************************************************\\n\" +\n \"****WARNINGS FOR \" + club + \" (Member MAY NOT have synced!)\\n\" +\n \"********************************************************************\\n\", club, true);\n while (warnList.size() > 0) {\n SystemUtils.logErrorToFile(warnList.remove(0), club, true);\n }\n }\n\n // Print end tiem to error log\n SystemUtils.logErrorToFile(\"End time: \" + new java.util.Date().toString() + \"\\n\", club, true);\n \n }", "int insert(InternalTradeEpa022016 record);", "public int saveAllSurchargePoint(RecordSet inputRecords);", "public void insertAED() throws IOException, ParserConfigurationException, SAXException {\n StringBuilder urlBuilder;\n StringBuilder sb = new StringBuilder();\n int pageNo = 0;\n\n // 읽고 쓰기가 가능하게 DB 열기\n SQLiteDatabase db = getWritableDatabase();\n\n while (true) {\n\n\n urlBuilder = new StringBuilder(\"http://apis.data.go.kr/B552657/AEDInfoInqireService/getEgytAedManageInfoInqire\"); /*URL*/\n urlBuilder.append(\"?\" + URLEncoder.encode(\"ServiceKey\", \"UTF-8\") + \"=QNUmjn16vY7tGSDfXBWh1seVyizuNDskzsx736v24kMgDvyp91Cljmc%2FoYu32I%2B4Z%2FMugV933PTH0mpzkqv6lg%3D%3D\"); /*Service Key*/\n urlBuilder.append(\"&\" + URLEncoder.encode(\"Q0\", \"UTF-8\") + \"=\" + URLEncoder.encode(\"서울특별시\", \"UTF-8\")); /**/\n urlBuilder.append(\"&\" + URLEncoder.encode(\"Q1\", \"UTF-8\") + \"=\" + URLEncoder.encode(\"서대문구\", \"UTF-8\")); /**/\n urlBuilder.append(\"&\" + URLEncoder.encode(\"pageNo\", \"UTF-8\") + \"=\" + URLEncoder.encode(Integer.toString(pageNo), \"UTF-8\")); /**/\n urlBuilder.append(\"&\" + URLEncoder.encode(\"numOfRows\", \"UTF-8\") + \"=\" + URLEncoder.encode(\"10\", \"UTF-8\")); /**/\n URL url = new URL(urlBuilder.toString());\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n conn.setRequestMethod(\"GET\");\n conn.setRequestProperty(\"Content-type\", \"application/json\");\n System.out.println(\"Response code: \" + conn.getResponseCode());\n BufferedReader rd;\n if (conn.getResponseCode() >= 200 && conn.getResponseCode() <= 300) {\n rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));\n } else {\n rd = new BufferedReader(new InputStreamReader(conn.getErrorStream()));\n break;\n }\n\n String line;\n while ((line = rd.readLine()) != null) {\n sb.append(line);\n }\n rd.close();\n conn.disconnect();\n }\n\n\n\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n DocumentBuilder builder = factory.newDocumentBuilder();\n\n Document document = builder.parse(new InputSource(new StringReader(sb.toString())));\n\n NodeList nodelist = document.getElementsByTagName(\"item\");\n\n double lon, lat;\n String org, build_place, sido, gugun, detailed_address;\n\n for(int i = 0; i< nodelist.getLength(); i++)\n {\n Node itemNode = nodelist.item(i);\n Element itemElement = (Element)itemNode;\n lat = Double.parseDouble(itemElement.getElementsByTagName(\"wgs84Lat\").item(0).getTextContent());\n lon = Double.parseDouble(itemElement.getElementsByTagName(\"wgs84Lon\").item(0).getTextContent());\n org = itemElement.getElementsByTagName(\"org\").item(0).getTextContent();\n build_place = itemElement.getElementsByTagName(\"buildPlace\").item(0).getTextContent();\n sido = itemElement.getElementsByTagName(\"sido\").item(0).getTextContent();\n gugun = itemElement.getElementsByTagName(\"gugun\").item(0).getTextContent();\n detailed_address = itemElement.getElementsByTagName(\"buildAddress\").item(0).getTextContent();\n\n // DB에 행 추가\n\n /*AED (aed_id INTEGER PRIMARY KEY, aed_lon REAL NOT NULL, aed_lat REAL NOT NULL,\n org TEXT NOT NULL, bulid_place TEXT NOT NULL, sido TEXT NOT NULL, gugun TEXT NOT NULL, detailed_address TEXT NOT NULL*/\n db.execSQL(\"INSERT INTO AED VALUES(null, \" + lat + \", \" + lon + \", '\" + org + \"', '\" + build_place\n + \"', '\"+ sido + \"', \"+ gugun + \", '\" + detailed_address +\"');\");\n\n }\n\n db.close();\n }", "public static void geoExport() throws ClassNotFoundException, SQLException, IOException{\n\t\t\n\t\tClass.forName(\"org.h2.Driver\");\n\t\tConnection conn = DriverManager.getConnection(DB, user, pass);\n\t\tGeoExport ge = new GeoExport(conn, \"/Users/Brian/Desktop/PreDeb1_Geo.csv\", \"SELECT * FROM TWEETS WHERE GEOLOCATION IS NOT NULL\");\n\t\tge.geoMake();\n\t\tconn.close();\n\t\t\n\t}", "public void store(DBConnection db) throws IOException;" ]
[ "0.58369553", "0.5667128", "0.5651794", "0.53085643", "0.52812356", "0.52638364", "0.5262393", "0.5256071", "0.5229187", "0.5204775", "0.5194696", "0.51594424", "0.5067997", "0.5025022", "0.50159353", "0.50154775", "0.49943158", "0.49706522", "0.49585888", "0.49437332", "0.49398655", "0.49355403", "0.49355403", "0.49254456", "0.4909678", "0.48797685", "0.4876488", "0.48666015", "0.48624277", "0.48612368", "0.48582146", "0.48509032", "0.483985", "0.48389772", "0.48346835", "0.4825235", "0.48230284", "0.48165166", "0.47953832", "0.47912654", "0.47902018", "0.47800803", "0.47717604", "0.47684914", "0.47657982", "0.47642708", "0.4753174", "0.47492108", "0.47463882", "0.47456837", "0.4743636", "0.47403622", "0.4738275", "0.4733377", "0.4723851", "0.47147286", "0.47111982", "0.47099635", "0.47000518", "0.46926457", "0.4687978", "0.46843997", "0.46798104", "0.46791208", "0.4678067", "0.4668993", "0.4660417", "0.46592396", "0.46564877", "0.4651094", "0.46499875", "0.4644967", "0.46342775", "0.46266255", "0.4625853", "0.46256635", "0.46197608", "0.4614864", "0.4602268", "0.4598564", "0.45976797", "0.4582428", "0.4581918", "0.45817804", "0.45720303", "0.45717338", "0.45697618", "0.4569055", "0.45631433", "0.45598346", "0.45509985", "0.4549042", "0.45490035", "0.45487544", "0.4547106", "0.45414725", "0.4538804", "0.4536248", "0.45321682", "0.4524672" ]
0.5795777
1
Get exchange rates by history filter
List<ExchangeRateDto> getHistoryRates(ExchangeRateHistoryFilter filter);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ExchangeRateDto getByDate(ExchangeRateDateFilter filter);", "ResponseEntity<List<TOURatesHistory>> getTouRatesHistory();", "ResponseEntity<List<GenericRatesHistory>> getGenericRatesHistory();", "ResponseEntity<List<TieredRatesHistory>> getTieredRatesHistory();", "hr.client.appuser.CouponCenter.ExchangeRecord getExchangeHistoryList(int index);", "private JsonObject getRatesFromApi(){\n try {\n // Setting URL\n String url_str = \"https://v6.exchangerate-api.com/v6/\"+ getApiKey() +\"/latest/\"+ Convert.getBaseCurrency();\n\n // Making Request\n URL url = new URL(url_str);\n HttpURLConnection request = (HttpURLConnection) url.openConnection();\n request.connect();\n\n // Return parsed JSON object\n return parseRequest(request);\n\n } catch (IOException e) {\n e.printStackTrace();\n return new JsonObject();\n }\n }", "java.util.List<hr.client.appuser.CouponCenter.ExchangeRecord> \n getExchangeHistoryListList();", "public static Collection getRatesForActivity(Activity activity,\n GlobalSightLocale sourceLocale, GlobalSightLocale targetLocale)\n\n throws EnvoyServletException\n {\n try\n {\n return ServerProxy.getCostingEngine().getRates(activity,\n sourceLocale, targetLocale);\n }\n catch (Exception e)\n {\n throw new EnvoyServletException(e);\n }\n }", "@GET(\"points-transaction-history?expand=translations&sort=-created_at\")\n Call<HistoryExchangeResponse> getTransactionHistoryAll();", "@Override\n public String get_rates(String betrag, String currency, List<String> targetcurrencies) {\n String api = null;\n try {\n api = new String(Files.readAllBytes(Paths.get(\"src/resources/OfflineData.json\")));\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n JSONObject obj = new JSONObject(api);\n ArrayList<String> calculatedrates = new ArrayList<>();\n if (currency.equals(\"EUR\")) {\n for (String targetcurrency : targetcurrencies) {\n float rate = obj.getJSONObject(\"rates\").getFloat(targetcurrency);\n calculatedrates.add((Float.parseFloat(betrag) * rate) + \" \" + targetcurrency + \" (Kurs: \" + rate + \")\");\n }\n } else {\n float currencyrate = obj.getJSONObject(\"rates\").getFloat(currency);\n for (String targetcurrency : targetcurrencies) {\n float rate = obj.getJSONObject(\"rates\").getFloat(targetcurrency);\n calculatedrates.add((Float.parseFloat(betrag) / currencyrate * rate) + \" \" + targetcurrency + \" (Kurs: \" + rate / currencyrate + \")\");\n }\n }\n return Data.super.display(betrag, currency, calculatedrates, obj.get(\"date\").toString());\n }", "ResponseEntity<List<TOURates>> getTouRates();", "List<Order> getHistoryOrders(HistoryOrderRequest orderRequest);", "public Map<String, Double> getAllExchangeRates() {\n init();\n return allExchangeRates;\n }", "String getExchangeRates(String currency) throws Exception\n\t{\n\t\tString[] rateSymbols = { \"CAD\", \"HKD\", \"ISK\", \"PHP\", \"DKK\", \"HUF\", \"CZK\", \"GBP\", \"RON\", \"HRK\", \"JPY\", \"THB\",\n\t\t\t\t\"CHF\", \"EUR\", \"TRY\", \"CNY\", \"NOK\", \"NZD\", \"ZAR\", \"USD\", \"MXN\", \"AUD\", };\n\n\t\tString rates = \"\";\n\n\t\tfinal String urlHalf1 = \"https://api.exchangeratesapi.io/latest?base=\";\n\n\t\tString url = urlHalf1 + currency.toUpperCase();\n\n\t\tJsonParser parser = new JsonParser();\n\n\t\tString hitUrl = url;\n\t\tString jsonData = getJsonData(hitUrl);\n\n\t\tJsonElement jsonTree = parser.parse(jsonData);\n\n\t\tif (jsonTree.isJsonObject())\n\t\t{\n\t\t\tJsonObject jObject = jsonTree.getAsJsonObject();\n\n\t\t\tJsonElement rateElement = jObject.get(\"rates\");\n\n\t\t\tif (rateElement.isJsonObject())\n\t\t\t{\n\t\t\t\tJsonObject rateObject = rateElement.getAsJsonObject();\n\n\t\t\t\tfor (int i = 0; i < rateSymbols.length; i++)\n\t\t\t\t{\n\t\t\t\t\tJsonElement currentExchangeElement = rateObject.get(rateSymbols[i]);\n\n\t\t\t\t\trates += rateSymbols[i] + \"=\" + currentExchangeElement.getAsDouble()\n\t\t\t\t\t\t\t+ (i < rateSymbols.length - 1 ? \" \" : \".\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn rates;\n\t}", "public List<ExchangeRate> parseRates(InputStream xml, String currency) {\n List<ExchangeRate> rates = new ArrayList<ExchangeRate>();\n\n try {\n XMLInputFactory factory = XMLInputFactory.newInstance();\n XMLStreamReader r = factory.createXMLStreamReader(xml);\n try {\n int event = r.getEventType();\n String date = null;\n boolean matchCurrency = false;\n boolean continueParse = true;\n while (continueParse) {\n if (event == XMLStreamConstants.START_ELEMENT) {\n // Both the date and rates use the Cube element\n if (r.getLocalName().equals(\"Cube\")) {\n for(int i = 0, n = r.getAttributeCount(); i < n; ++i) {\n // First mark the date\n if (r.getAttributeLocalName(i).equals(\"time\")) {\n date = r.getAttributeValue(i);\n }\n\n // Now get the currency\n if ((r.getAttributeLocalName(i).equals(\"currency\")) && r.getAttributeValue(i).equals(currency)) {\n matchCurrency = true;\n }\n\n // Finally, get the rate and add to the list\n if (r.getAttributeLocalName(i).equals(\"rate\")) {\n if (matchCurrency) {\n ExchangeRate rate = new ExchangeRate(date, currency, Double.parseDouble(r.getAttributeValue(i)));\n rates.add(rate);\n matchCurrency = false;\n }\n\n }\n }\n }\n }\n\n if (!r.hasNext()) {\n continueParse = false;\n } else {\n event = r.next();\n }\n }\n } finally {\n r.close();\n }\n } catch (Exception e) {\n Logger.error(\"Error parsing XML\", e);\n }\n\n\n return rates;\n }", "public static ArrayList<Integer> getRates(){\n\t\treturn heartRates;\n\t}", "public Collection getAllExchangeRates()\n throws RemoteException;", "public Rates getRates() throws RateQueryException {\n List<Rate> rates;\n\n try {\n HttpResponse response = this.bitPayClient.get(\"rates\");\n rates = Arrays.asList(\n JsonMapperFactory.create().readValue(this.bitPayClient.responseToJsonString(response), Rate[].class)\n );\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n\n return new Rates(rates);\n }", "public static Collection getCostingRates() throws EnvoyServletException\n {\n try\n {\n return ServerProxy.getCostingEngine().getRates();\n }\n catch (Exception e)\n {\n throw new EnvoyServletException(e);\n }\n }", "public Rates getRates(String baseCurrency) throws RateQueryException {\n List<Rate> rates;\n\n try {\n HttpResponse response = this.bitPayClient.get(\"rates/\" + baseCurrency);\n rates = Arrays.asList(\n JsonMapperFactory.create().readValue(this.bitPayClient.responseToJsonString(response), Rate[].class)\n );\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n\n return new Rates(rates);\n }", "@SuppressWarnings(\"unchecked\")\n\t@Override\n\tpublic GetRatesResult execute(final GetRatesAction action,\n\t\t\tfinal ExecutionContext ctx) throws ActionException {\n\t\tfinal List<Rate> recentRates = _recentRatesCache.getCachedResult();\n\t\tif (recentRates != null) {\n\t\t\treturn new GetRatesResult(recentRates);\n\t\t}\n\n\t\t// If not, we query the data store\n\t\tfinal PersistenceManager pm = _pmp.get();\n\n\t\ttry {\n\t\t\tfinal Query query = pm.newQuery(Rate.class);\n\t\t\tquery.setRange(0, 10);\n\t\t\tquery.setOrdering(\"timeFetched desc\");\n\n\t\t\t// The following is needed because of an issue\n\t\t\t// with the result of type StreamingQueryResult not\n\t\t\t// being serializable for GWT\n\t\t\t// See the discussion here:\n\t\t\t// http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/bce6630a3f01f23a/62cb1c4d38cc06c7?lnk=gst&q=com.google.gwt.user.client.rpc.SerializationException:+Type+'org.datanucleus.store.appengine.query.StreamingQueryResult'+was+not+included+in+the+set+of+types+which+can+be+serialized+by+this+SerializationPolicy\n\t\t\tfinal List queryResult = (List) query.execute();\n\t\t\tfinal List<Rate> rates = new ArrayList<Rate>(queryResult.size());\n\n\t\t\tfor (final Object rate : queryResult) {\n\t\t\t\trates.add((Rate) rate);\n\t\t\t}\n\n\t\t\t// Then update the memcache\n\t\t\t_recentRatesCache.setResult(rates);\n\t\t\treturn new GetRatesResult(rates);\n\t\t} finally {\n\t\t\tpm.close();\n\t\t}\n\t}", "public String exchangeRateList() {\r\n\t\tif (exRateS == null) {\r\n\t\t\texRateS = new ExchangeRate();\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\texchangeRateList = service.exchangeRateList(exRateS);\r\n\t\ttotalCount = ((PagenateList) exchangeRateList).getTotalCount();\r\n\t\t\r\n\t\treturn SUCCESS;\r\n\t}", "public static void conversionsummary (Date startdate, Date enddate, String currencyfrom, String currencyto, List<Time> times){\n List<Double> rates = new ArrayList<>(); // conversion rates of the 2 currencies in the period\n List<String> timesinp = new ArrayList<>(); // the date of those rates added within the period\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");\n if (times.size() != 0) {\n if (startdate.compareTo(enddate) <= 0) {\n times.sort((i, j) -> i.getDate().compareTo(j.getDate())); // sort the time arraylist according the date of time object from old to new\n try {\n for (int i = 0; i < times.size(); i += 1) {\n // only search time object in the period\n if (startdate.compareTo(sdf.parse(times.get(i).getDate())) <= 0 && enddate.compareTo(sdf.parse(times.get(i).getDate())) >= 0) {\n for (int j = 0; j < times.get(i).getExchanges().size(); j += 1) {\n // find exchange rate between the 2 currencies and put the date of the rate added and the rate to 2 lists.\n if (times.get(i).getExchanges().get(j).getFromCurrency().getName().equals(currencyfrom) && times.get(i).getExchanges().get(j).getToCurrency().getName().equals(currencyto)) {\n rates.add(times.get(i).getExchanges().get(j).getRate());\n timesinp.add(times.get(i).getDate());\n }\n }\n }\n }\n } catch (ParseException e) {\n System.out.println(e);\n }\n if (rates.size()==0){ // if there is no such rate during the period\n System.out.println(\"No exchange rate from \" + currencyfrom + \" to \" + currencyto + \" between \" + sdf.format(startdate) + \" and \" + sdf.format(enddate) + \".\");\n return;\n }\n\n for (int i = 0; i < rates.size(); i += 1) { // print conversion history of the 2 currencies\n System.out.println(timesinp.get(i) + \" \" + rates.get(i));\n }\n\n double mean = rates.stream().mapToDouble(i -> i).average().getAsDouble(); // calculate the mean of all exchange rate of the 2 currencies\n System.out.println(\"average rate: \" + String.format(\"%.2f\", mean));\n\n Collections.sort(rates);// sort by the rate\n if (rates.size() == 1) { // if there is only one exchange rate, this rate is the median\n System.out.println(\"median rate: \" + String.format(\"%.2f\", rates.get(0)));\n } else if (rates.size() % 2 != 0) { // if the number of exchange rate is odd, the n/2th rate is median\n System.out.println(\"median rate: \" + String.format(\"%.2f\", rates.get(rates.size() / 2)));\n } else { // if the number of exchange rate is even, the average of the n/2 th and n/2-1 th rate is the median\n System.out.println(\"median rate: \" + String.format(\"%.2f\", (rates.get(rates.size() / 2) + rates.get(rates.size() / 2 - 1)) / 2));\n }\n\n System.out.println(\"max rate: \" + String.format(\"%.2f\", rates.stream().mapToDouble(i -> i).max().getAsDouble())); // get the max\n System.out.println(\"min rate: \" + String.format(\"%.2f\", rates.stream().mapToDouble(i -> i).min().getAsDouble())); // get the min\n\n // calculate the standard deviation\n double variance = 0.0;\n for (int i = 0; i < rates.size(); i += 1) {\n variance += Math.pow((rates.get(i) - mean), 2);\n }\n double sd = Math.sqrt(variance / rates.size());\n System.out.println(\"standard deviation of rates: \" + String.format(\"%.2f\", sd));\n\n }else{\n System.out.println(\"The end date is earlier than start date, no such period exist, please enter correct period.\");\n }\n }else{\n System.out.println(\"No data in database, please contact admin for help.\");\n }\n\n }", "ResponseEntity<List<GenericRates>> getGenericRates();", "public Map<String, Double> getExchangeRates(String[] rates){\n Map<String, Double> map = new HashMap<>();\n\n JsonObject conversionRates = getRatesFromApi().getAsJsonObject(\"conversion_rates\");\n if (rates != null) {\n\n for (String temp :\n rates) {\n if (conversionRates.has(temp))\n map.put(temp, conversionRates.get(temp).getAsDouble());\n }\n } else {\n for (Map.Entry<String, JsonElement> element :\n conversionRates.entrySet()) {\n map.put(element.getKey(), element.getValue().getAsDouble());\n }\n }\n\n return map;\n }", "ResponseEntity<List<TieredRates>> getTieredRates();", "public ArrayList<History> getPriceHistory() { return priceHistory; }", "double requestCurrentRate(String fromCurrency,\n String toCurrency);", "private static void generic(Exchange exchange) throws IOException {\n MarketDataService marketDataService = exchange.getMarketDataService();\n\n // Get the latest trade data for BTC/EUR\n Trades trades = marketDataService.getTrades(CurrencyPair.BTC_EUR);\n\n System.out.println(trades.toString());\n }", "public float getExchangeRate(String fromCurrency, String toCurrency, int year, int month, int day) { \n\t\tfloat resultOne;\n\t\tfloat resultTwo;\n\t\tfloat result;\n\t\ttry{\n\t\t\tString url = urlBuilder(year, month, day);\n\t\t\tXML_Parser parser = new XML_Parser();\n\t\t\tresultOne = parser.processDocument(url, fromCurrency);\n\t\t\tresultTwo = parser.processDocument(url, toCurrency);\n\t\t\tresult = (resultOne/resultTwo); //Calculating the exchange rate\n\t\t}catch (UnsupportedOperationException | IOException | ParserConfigurationException | SAXException e){\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\t\t\n\t\treturn result;\n\t}", "public static JSONObject sendRequest(){\n \tJSONObject exchangeRates = null;\n \t \n try {\n \t stream = new URL(BASE_URL + \"?access_key=\" + ACCESS_KEY).openStream();\n \t BufferedReader rd = new BufferedReader(new InputStreamReader(stream, Charset.forName(\"UTF-8\")));\n \t exchangeRates = new JSONObject(streamToString(rd)).getJSONObject(\"rates\");;\n \n }catch(MalformedURLException e) {\n \t e.printStackTrace();\n \t \n }catch (IOException e) {\n \n e.printStackTrace();\n }catch (JSONException e) {\n \n e.printStackTrace();\n } \n\t\treturn exchangeRates;\n \n }", "Stream<DataPoint> getHistoryData(Symbol symbol, LocalDateTime startTime, LocalDateTime endTime, int numberOfPoints);", "public List<Order> getOrderHistory();", "@RequiresApi(api = Build.VERSION_CODES.N)\n private double GetIterativeConversion(List<RateModel> rates, String fromCurrency, String toCurrency) {\n int numberAttempts = 0;\n double result = 0;\n String filter = fromCurrency;\n double conversion = 1;\n do{\n String finalFilter = filter;\n List<RateModel> fromRates = rates.stream()\n .filter(rate -> rate.getFromCurrency().equals(finalFilter))\n .collect(Collectors.toList());\n\n Optional<RateModel> rate = fromRates.stream().\n filter(x -> x.getToCurrency().equals(toCurrency))\n .findFirst();\n if(rate.isPresent()){\n result = conversion * rate.get().getRate();\n }\n else {\n RateModel firstFromRates = fromRates.get(0);\n conversion = conversion * firstFromRates.getRate();\n filter = firstFromRates.getToCurrency();\n }\n numberAttempts++;\n }\n while (numberAttempts <20 && result == 0);\n\n Log.d(TAG, String.format(\"Looped %1%d times. Conversion: %2%s to %3$s x%4$f\", numberAttempts, fromCurrency, toCurrency, result));\n return result;\n }", "public hr.client.appuser.CouponCenter.ExchangeRecord getExchangeHistoryList(int index) {\n return exchangeHistoryList_.get(index);\n }", "@Override\r\n public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException {\n if (tickerRequestTimeStamp == 0L || System.currentTimeMillis() - tickerRequestTimeStamp >= getRefreshRate()) {\r\n\r\n logger.debug(\"requesting BitcoinCharts tickers\");\r\n tickerRequestTimeStamp = System.currentTimeMillis();\r\n\r\n // Request data\r\n cachedBitcoinChartsTickers = bitcoinCharts.getMarketData();\r\n }\r\n\r\n return BitcoinChartsAdapters.adaptTicker(cachedBitcoinChartsTickers, currencyPair);\r\n }", "public BigDecimal getHistoryPrice() {\n return historyPrice;\n }", "hr.client.appuser.CouponCenter.ExchangeRecordOrBuilder getExchangeHistoryListOrBuilder(\n int index);", "public ArrayList<AirTimeHistory> getAllHistory() {\n\t Cursor histories = db.query(TABLE_AIRTIME_HISTORY, null, null, null, null, null, KEY_ID + \" DESC\");\n\t \n\t ArrayList<AirTimeHistory> result = new ArrayList<AirTimeHistory>();\n\t if (histories.moveToFirst()){\n\t\t do {\n\t\t\t AirTimeHistory newItem = new AirTimeHistory();\n\t\t\t newItem.setID(histories.getString(0));\n\t\t\t newItem.setEmail(histories.getString(USER_EMAIL_COLUMN));\n\t\t\t newItem.setPhoneNumber(histories.getString(USER_NUMBER_COLUMN));\n\t\t\t newItem.setNetwork(histories.getString(NETWORK_COLUMN));\n\t\t\t newItem.setAmount(histories.getString(AMOUNT_COLUMN));\n\t\t\t newItem.setDateTime(histories.getString(DATE_TIME_COLUMN));\n\t\t\t newItem.setNetworkIndex(histories.getString(NETWORK_INDEX_COLUMN));\n\t\t\t newItem.setTransactionID(histories.getString(TRANSACTION_ID_COLUMN));\n\t\t\t newItem.setTransactionStatus(histories.getString(TRANSACTION_STATUS_COLUMN));\n\t\t\t newItem.setCountry(histories.getString(COUNTRY_COLUMN));\n\t\t\t newItem.setCountryIndex(histories.getString(COUNTRY_INDEX_COLUMN));\n\t\t\t newItem.setChosenAmountIndex(histories.getString(CHOSEN_AMOUNT_INDEX_COLUMN));\n\t\t\t newItem.setCurrency(histories.getString(CURRENCY_COLUMN));\n\t\t\t newItem.setTopupStatus(histories.getString(TOPUP_STATUS_COLUMN));\n\t\t\t newItem.setGatewayID(histories.getString(GATEWAY_ID3_COLUMN));\n\t\t\t newItem.setServerTime(histories.getString(SERVER_TIME_COLUMN));\n\t\t\t newItem.setAmountCharged(histories.getString(AMOUNT_CHARGED_COLUMN));\n\t\t\t newItem.setPayUrl(histories.getString(PAY_URL_COLUMN));\n\t\t\t \n\t\t\t result.add(newItem);\n\t\t } while(histories.moveToNext());\n\t }\n\t \n\t histories.close();\n\t \n\t return result;\n\t}", "public void testGetExchangeRateForCurrencyAndDate() {\n final String destinationCurrency = \"EUR\";\n final String sourceCurrency = \"GBP\";\n final Calendar conversionDate = Calendar.getInstance();\n conversionDate.set(Integer.valueOf(\"2005\"), Integer.valueOf(\"3\"), Integer.valueOf(\"2\"));\n \n final ExchangeRateUtil exchangeRateUtilities =\n new ExchangeRateUtil(true, destinationCurrency);\n exchangeRateUtilities.loadExchangeRatesFromCurrency(sourceCurrency);\n \n final double factor =\n exchangeRateUtilities.getExchangeRateForCurrencyAndDate(sourceCurrency,\n ExchangeRateType.BUDGET, conversionDate.getTime());\n \n assertEquals(\"1.41\", String.valueOf(factor));\n }", "public static double getValue(Exchange exchange, String name) {\n\n double rate = -1.0;\n\n switch (name) {\n case \"AUD\":\n rate = exchange.getRates().getAUD();\n break;\n case \"BGN\":\n rate = exchange.getRates().getBGN();\n break;\n case \"BRL\":\n rate = exchange.getRates().getBRL();\n break;\n case \"CAD\":\n rate = exchange.getRates().getCAD();\n break;\n case \"CHF\":\n rate = exchange.getRates().getCHF();\n break;\n case \"CNY\":\n rate = exchange.getRates().getCNY();\n break;\n case \"CZK\":\n rate = exchange.getRates().getCZK();\n break;\n case \"DKK\":\n rate = exchange.getRates().getDKK();\n break;\n case \"GBP\":\n rate = exchange.getRates().getGBP();\n break;\n case \"HKD\":\n rate = exchange.getRates().getHKD();\n break;\n case \"HRK\":\n rate = exchange.getRates().getHRK();\n break;\n case \"HUF\":\n rate = exchange.getRates().getHUF();\n break;\n case \"IDR\":\n rate = exchange.getRates().getIDR();\n break;\n case \"ILS\":\n rate = exchange.getRates().getILS();\n break;\n case \"INR\":\n rate = exchange.getRates().getINR();\n break;\n case \"JPY\":\n rate = exchange.getRates().getJPY();\n break;\n case \"KRW\":\n rate = exchange.getRates().getKRW();\n break;\n case \"MXN\":\n rate = exchange.getRates().getMXN();\n break;\n case \"MYR\":\n rate = exchange.getRates().getMYR();\n break;\n case \"NOK\":\n rate = exchange.getRates().getNOK();\n break;\n case \"NZD\":\n rate = exchange.getRates().getNZD();\n break;\n case \"PHP\":\n rate = exchange.getRates().getPHP();\n break;\n case \"PLN\":\n rate = exchange.getRates().getPLN();\n break;\n case \"RON\":\n rate = exchange.getRates().getRON();\n break;\n case \"RUB\":\n rate = exchange.getRates().getRUB();\n break;\n case \"SEK\":\n rate = exchange.getRates().getSEK();\n break;\n case \"SGD\":\n rate = exchange.getRates().getSGD();\n break;\n case \"THB\":\n rate = exchange.getRates().getTHB();\n break;\n case \"TRY\":\n rate = exchange.getRates().getTRY();\n break;\n case \"ZAR\":\n rate = exchange.getRates().getZAR();\n break;\n case \"EUR\":\n rate = exchange.getRates().getEUR();\n break;\n case \"USD\":\n rate = exchange.getRates().getUSD();\n break;\n default:\n break;\n }\n\n return rate;\n }", "public hr.client.appuser.CouponCenter.ExchangeRecord getExchangeHistoryList(int index) {\n if (exchangeHistoryListBuilder_ == null) {\n return exchangeHistoryList_.get(index);\n } else {\n return exchangeHistoryListBuilder_.getMessage(index);\n }\n }", "java.util.List<? extends hr.client.appuser.CouponCenter.ExchangeRecordOrBuilder> \n getExchangeHistoryListOrBuilderList();", "INexusFilterDescriptor[] getFilterDescriptorHistory();", "public String getWithdrawalHistory(String currency) {\n\n\t\tString method = \"getwithdrawalhistory\";\n\n\t\tif(currency.equals(\"\"))\n\n\t\t\treturn getJson(API_VERSION, ACCOUNT, method);\n\n\t\treturn getJson(API_VERSION, ACCOUNT, method, returnCorrectMap(\"currency\", currency));\n\t}", "@RequestMapping(value = \"${app.paths.historical-path}\",\n method = RequestMethod.GET,\n produces = MediaType.APPLICATION_JSON_VALUE)\n public ResponseEntity<Collection<Bitcoin>> getBitcoinHistoricalRatesInDateRange(\n @RequestParam(\"dateFrom\") String dateFromString, @RequestParam(\"dateTo\") String dateToString)\n throws InterruptedException, ExecutionException {\n log.info(\"> BitcoinController :: getBitcoinPricesInDateTimeRange\");\n ZonedDateTime dateTimeFrom = LocalDate.parse(dateFromString).atStartOfDay(ZoneId.systemDefault());\n ZonedDateTime dateTimeTo = LocalDate.parse(dateToString).atStartOfDay(ZoneId.systemDefault()).plusDays(1)\n .minusNanos(1);\n Collection<Bitcoin> response = service.findAllInRange(dateTimeFrom, dateTimeTo);\n log.info(\"< BitcoinController :: getBitcoinPricesInDateTimeRange\");\n return new ResponseEntity<Collection<Bitcoin>>(response, HttpStatus.OK);\n }", "private static void raw(Exchange exchange) throws IOException {\n WexMarketDataServiceRaw marketDataService =\n (WexMarketDataServiceRaw) exchange.getMarketDataService();\n\n // Get the latest trade data for BTC/USD\n Map<String, WexTrade[]> trades = marketDataService.getBTCETrades(\"btc_usd\", 7).getTradesMap();\n\n for (Map.Entry<String, WexTrade[]> entry : trades.entrySet()) {\n System.out.println(\"Pair: \" + entry.getKey() + \", Trades:\");\n for (WexTrade trade : entry.getValue()) {\n System.out.println(trade.toString());\n }\n }\n }", "@Override\r\n public ArrayList<CurrencyTuple> getSymbols() throws MalformedURLException, IOException{\r\n String symbolsUrl = \"https://api.binance.com/api/v1/ticker/24hr\";\r\n String charset = \"UTF-8\";\r\n String symbol = this.pair;\r\n URLConnection connection = new URL(symbolsUrl).openConnection();\r\n connection.setRequestProperty(\"Accept-Charset\", charset);\r\n InputStream stream = connection.getInputStream();\r\n ByteArrayOutputStream responseBody = new ByteArrayOutputStream();\r\n byte buffer[] = new byte[1024];\r\n int bytesRead = 0;\r\n while ((bytesRead = stream.read(buffer)) > 0) {\r\n responseBody.write(buffer, 0, bytesRead);\r\n }\r\n String responseString = responseBody.toString();\r\n int position = 0;\r\n ArrayList<CurrencyTuple> toReturn = new ArrayList<>();\r\n for (int i = 0; i < 100; i++){\r\n position = responseString.indexOf(\"symbol\", position + 6);\r\n String symbols = responseString.substring(position + 9, position + 15);\r\n String symbolOwned = symbols.substring(0, 3);\r\n String symbolNotOwned = symbols.substring(3, 6);\r\n if (responseString.substring(position+9, position + 16).contains(\"\\\"\")\r\n || responseString.substring(position+9, position + 16).contains(\"USD\")){\r\n if (symbolOwned.contains(\"USD\")) {\r\n symbolOwned = symbolOwned.concat(\"T\");\r\n }\r\n if (symbolNotOwned.contains(\"USD\")) {\r\n symbolOwned = symbolNotOwned.concat(\"T\");\r\n }\r\n Currency CurrencyOwned = new Currency(symbolOwned, 0.0);\r\n Currency CurrencyNotOwned = new Currency(symbolNotOwned, 0.0);\r\n CurrencyTuple tuple = new CurrencyTuple(CurrencyOwned, CurrencyNotOwned);\r\n System.out.println(CurrencyOwned.getName() + \" - \" + CurrencyNotOwned.getName());\r\n toReturn.add(tuple);\r\n }\r\n }\r\n return toReturn;\r\n }", "@RequestMapping(method = RequestMethod.GET, value = \"/{date}/{baseCurrency}/{targetCurrency}\")\n public ResponseEntity exchangeRate(@PathVariable String date, @PathVariable String baseCurrency,\n @PathVariable String targetCurrency) throws ParseException {\n Utils.validateDate(date);\n CurrentExchangeRate currentExchangeRate = exchangeService.getExchangeRate(Utils.parseDate(date),\n baseCurrency,\n targetCurrency);\n return ResponseEntity.ok(currentExchangeRate);\n }", "public List<CommissionDistribution> lookupHistory(Long sourceAccount) {\n throw new UnsupportedOperationException(\"Not Implemented yet.\");\n }", "@RequestMapping(method = RequestMethod.GET, value = \"/history/monthly/{yyyy}/{MM}\")\n public ResponseEntity getMothlyExchangeRateHistory(@PathVariable String yyyy, @PathVariable String MM) {\n\n Utils.validateYear(yyyy);\n Utils.validateMonth(MM);\n\n List<ExchangeRateHistoryResponse> exchangeRateHistoryObject =\n exchangeService.getMonthlyExchangeRateHistory(Integer.parseInt(yyyy), Integer.parseInt(MM));\n return ResponseEntity.ok(exchangeRateHistoryObject);\n }", "List<TradeHistoryItem> getTrades(String symbol, Integer limit);", "@PostMapping(\"/exchange\")\n public ResponseEntity<ExchangeResult> getExchangeRate(@RequestBody ExchangeRequest exchangeRequest) {\n\n ExchangeResult result = currencyExchangeService.calculate(exchangeRequest);\n\n\n// 4. do nbp exchange downoloaderprzekazujemy date i walute(wartosci nie bo jąliczymy w serwisie)\n// 5. w nbp exchange downoloader wstzukyjemy rest tempplate\n// 6. majac wynik wracamy do currency exchange servise(typem zwracamyn bedzie obiekt ktory bedzie zawierał rating i error message(typ string))\n// i w momencie jak nie bedzie błedu uzupełniamy rating lub error , dodac boolena ktory nam powie czy jest ok czy nie\n// jak jest ok to wyciagamy stawke rate i dzielimy ją\n// 7. nastepnie mamy wynik\n\n\n return new ResponseEntity<>(result, result.getStatus());\n }", "@RequestMapping(method = RequestMethod.GET, value = \"/history/daily/{year}/{month}/{day}\")\n public ResponseEntity getDailyExchangeRateHistory(@PathVariable String year, @PathVariable String month,\n @PathVariable String day) throws ParseException {\n Utils.validateDay(day);\n Utils.validateYear(year);\n Utils.validateMonth(month);\n\n List<ExchangeRateHistoryResponse> exchangeRateHistoryObject =\n exchangeService.getDailyExchangeRateHistory(\n Integer.parseInt(year),\n Integer.parseInt(month),\n Integer.parseInt(day)\n );\n return ResponseEntity.ok(exchangeRateHistoryObject);\n }", "public static List<OptionPricing> getPriceHistory(Date startTradeDate, Date endTradeDate, Date expiration, double strike, String callPut) {\r\n\t\t\r\n\t\tEntityManagerFactory emf = Persistence.createEntityManagerFactory(\"JPAOptionsTrader\");\r\n\t\tEntityManager em = emf.createEntityManager();\r\n\t\t\r\n\t\t// Note: table name refers to the Entity Class and is case sensitive\r\n\t\t// field names are property names in the Entity Class\r\n\t\tQuery query = em.createQuery(\"select opt from \" + TradeProperties.SYMBOL_FOR_QUERY + \" opt where \"\r\n\t\t\t\t+ \"opt.trade_date >= :startTradeDate \" \r\n\t\t\t\t+ \"and opt.trade_date <= :endTradeDate \" \r\n\t\t\t\t+ \"and opt.expiration=:expiration \"\t\r\n\t\t\t\t+ \"and opt.call_put = :call_put \"\r\n\t\t\t\t+ \"and opt.strike = :strike \"\r\n\t\t\t\t+ \" order by opt.trade_date\");\r\n\t\t\r\n\t\tquery.setParameter(\"startTradeDate\", startTradeDate);\r\n\t\tquery.setParameter(\"endTradeDate\", endTradeDate);\r\n\t\tquery.setParameter(\"expiration\", expiration);\r\n\t\tquery.setParameter(\"call_put\", callPut);\r\n\t\tquery.setParameter(\"strike\", strike);\r\n\t\t\r\n\t\tquery.setHint(\"odb.read-only\", \"true\");\r\n\r\n\t\t@SuppressWarnings(\"unchecked\")\r\n\t\tList<OptionPricing> options = query.getResultList();\r\n\t\t\r\n\t\tem.close();\r\n\t\t\r\n\t\treturn options;\r\n\t}", "public List<CurrencyExchangeRate> withExchangeRates(List<CurrencyExchangeRate> rates) {\n // TODO: return copy(rates = rates);\n return rates;\n }", "public java.util.List<hr.client.appuser.CouponCenter.ExchangeRecord> getExchangeHistoryListList() {\n return exchangeHistoryList_;\n }", "@Override\n\tpublic List<FilterStock> today() {\n\t\treturn filterStockRepo.findToday();\n\t}", "public Filter getFilter(final boolean isHistory) {\n\t\tisHistory_global = isHistory;\n\t\tFilter filter = new Filter() {\n\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\t@Override\n\t\t\tprotected void publishResults(CharSequence constraint,\n\t\t\t\t\tFilterResults results) {\n\n\t\t\t\tbookingsList = (List<Bookings>) results.values;\n\t\t\t\tnotifyDataSetChanged();\n\t\t\t\temptyviewHandler.sendEmptyMessage(0);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tprotected FilterResults performFiltering(CharSequence constraint) {\n\n\t\t\t\tFilterResults results = new FilterResults();\n\t\t\t\tfilteredBookingsList = new ArrayList<Bookings>();\n\n\t\t\t\tif (constraint == null || constraint.length() == 0) {\n\t\t\t\t\tresults.count = bookingsList.size();\n\t\t\t\t\tresults.values = bookingsList;\n\t\t\t\t} else {\n\t\t\t\t\tconstraint = constraint.toString().toLowerCase();\n\t\t\t\t\tfor (int i = 0; i < bookingsList.size(); i++) {\n\n\t\t\t\t\t\tif (isHistory) {\n\t\t\t\t\t\t\tif (bookingsList.get(i).getCompletedAt().equals(\"\")\n\t\t\t\t\t\t\t\t\t|| bookingsList.get(i).getStatus()\n\t\t\t\t\t\t\t\t\t\t\t.get(\"currentStatus\").toString()\n\t\t\t\t\t\t\t\t\t\t\t.equals(\"\")) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tString pickupAddress, dropoffAddress;\n\t\t\t\t\t\tpickupAddress = bookingsList.get(i).getPickupLocation()\n\t\t\t\t\t\t\t\t.getAddressLine1().toString();\n\n\t\t\t\t\t\tdropoffAddress = bookingsList.get(i).getDropLocation()\n\t\t\t\t\t\t\t\t.getAddressLine1().toString();\n\n\t\t\t\t\t\tif (pickupAddress.toLowerCase().contains(\n\t\t\t\t\t\t\t\tconstraint.toString())\n\t\t\t\t\t\t\t\t|| dropoffAddress.toLowerCase().contains(\n\t\t\t\t\t\t\t\t\t\tconstraint.toString())) {\n\t\t\t\t\t\t\tfilteredBookingsList.add(bookingsList.get(i));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\tresults.count = filteredBookingsList.size();\n\t\t\t\t\tresults.values = filteredBookingsList;\n\n\t\t\t\t}\n\n\t\t\t\treturn results;\n\t\t\t}\n\t\t};\n\n\t\treturn filter;\n\t}", "public interface ICurrencyExchangeService {\n/**\n * Requests the current exchange rate from one currency\n * to another.\n * @param fromCurrency the original Currency\n * @param toCurrency the 'destination' or final Currency\n * @return the currency exchange rate\n */\n\n double requestCurrentRate(String fromCurrency,\n String toCurrency);\n}", "private void fetchRatesData() {\r\n RequesterBean requesterBean = new RequesterBean();\r\n requesterBean.setFunctionType(GET_RATE_DATA);\r\n requesterBean.setDataObject(instituteRatesBean);\r\n \r\n AppletServletCommunicator appletServletCommunicator = new \r\n AppletServletCommunicator(CONNECTION_STRING, requesterBean);\r\n appletServletCommunicator.setRequest(requesterBean);\r\n appletServletCommunicator.send();\r\n ResponderBean responderBean = appletServletCommunicator.getResponse();\r\n \r\n if(responderBean == null) {\r\n //Could not contact server.\r\n CoeusOptionPane.showErrorDialog(COULD_NOT_CONTACT_SERVER);\r\n return;\r\n }\r\n \r\n if(responderBean.isSuccessfulResponse()) {\r\n Hashtable ratesData = (Hashtable)responderBean.getDataObject();\r\n hasMaintainCodeTablesRt = ((Boolean)ratesData.get(\"HAS_OSP_RIGHT\")).booleanValue();\r\n if( hasMaintainCodeTablesRt ){\r\n setFunctionType(TypeConstants.MODIFY_MODE);\r\n }else {\r\n setFunctionType(TypeConstants.DISPLAY_MODE);\r\n }\r\n //queryKey = RATES + ratesData.get(\"PARENT_UNIT_NUMBER\").toString();\r\n\r\n //Set title\r\n dlgRates.setTitle(RATES + \" for Unit \" + instituteRatesBean.getUnitNumber());\r\n queryEngine.addDataCollection(queryKey, ratesData);\r\n\r\n }else {\r\n //Server Error\r\n CoeusOptionPane.showErrorDialog(responderBean.getMessage());\r\n return;\r\n }\r\n }", "double getRate();", "public float[] getCountHistory() {\n return countMonitor.getHistory();\n }", "double getTransRate();", "private static String fetchElevHistory(){\n\t\tRequestData req = new RequestData(\"activities/elevation/date/today/max\");\t//make request\n\t\treq.sendRequest();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//send request\n\t\tJSONObject json1 = new JSONObject(req.getBody());\t\t\t\t\t\t\t//make json from response\n\t\tJSONArray json = json1.getJSONArray(\"activities-elevation\");\n\t\treturn json.toString();\t\t\t\t\t\t\t\t\t\t\t\t\t\t//return goals as json\n\t}", "private List<Performance> quizHistory(){\n\t\treturn history;\n\t}", "public HHisItem[] onHisRead(HDict rec, HDateTimeRange range)\r\n {\r\n if (!cache.initialized()) \r\n throw new IllegalStateException(Cache.NOT_INITIALIZED);\r\n\r\n if (LOG.isTraceOn())\r\n LOG.trace(\"onHisRead \" + rec.id() + \", \" + range);\r\n\r\n try\r\n {\r\n BHistoryConfig cfg = tagMgr.lookupHistoryConfig(rec.id());\r\n if (cfg == null) return new HHisItem[0];\r\n\r\n HStr unit = (HStr) rec.get(\"unit\", false);\r\n\r\n // ASSUMPTION: the tz in both ends of the range matches the \r\n // tz of the historized point, which in turn matches the \r\n // history's tz in its historyConfig.\r\n HTimeZone tz = range.start.tz;\r\n\r\n BAbsTime rangeStart = BAbsTime.make(range.start.millis(), cfg.getTimeZone());\r\n BAbsTime rangeEnd = BAbsTime.make(range.end.millis(), cfg.getTimeZone());\r\n\r\n // NOTE: be careful, timeQuery() is inclusive of both start and end\r\n BIHistory history = service.getHistoryDb().getHistory(cfg.getId());\r\n BITable table = (BITable) history.timeQuery(rangeStart, rangeEnd);\r\n ColumnList columns = table.getColumns();\r\n Column timestampCol = columns.get(\"timestamp\");\r\n\r\n // this will be null if its not a BTrendRecord\r\n boolean isTrendRecord = cfg.getRecordType().getResolvedType().is(BTrendRecord.TYPE);\r\n Column valueCol = isTrendRecord ? columns.get(\"value\") : null;\r\n\r\n Array arr = new Array(HHisItem.class, table.size());\r\n for (int i = 0; i < table.size(); i++)\r\n {\r\n BAbsTime timestamp = (BAbsTime) table.get(i, timestampCol);\r\n\r\n // ignore inclusive start value\r\n if (timestamp.equals(rangeStart)) continue;\r\n\r\n // create ts\r\n HDateTime ts = HDateTime.make(timestamp.getMillis(), tz);\r\n\r\n // create val\r\n HVal val = null;\r\n if (isTrendRecord)\r\n {\r\n // extract value from BTrendRecord\r\n BValue value = (BValue) table.get(i, valueCol);\r\n\r\n Type recType = cfg.getRecordType().getResolvedType();\r\n if (recType.is(BNumericTrendRecord.TYPE))\r\n {\r\n BNumber num = (BNumber) value;\r\n val = (unit == null) ? \r\n HNum.make(num.getDouble()) :\r\n HNum.make(num.getDouble(), unit.val);\r\n }\r\n else if (recType.is(BBooleanTrendRecord.TYPE))\r\n {\r\n BBoolean bool = (BBoolean) value;\r\n val = HBool.make(bool.getBoolean());\r\n }\r\n else if (recType.is(BEnumTrendRecord.TYPE))\r\n {\r\n BDynamicEnum dyn = (BDynamicEnum) value;\r\n BFacets facets = (BFacets) cfg.get(\"valueFacets\");\r\n BEnumRange er = (BEnumRange) facets.get(\"range\");\r\n val = HStr.make(SlotUtil.fromEnum(\r\n er.getTag(dyn.getOrdinal()),\r\n service.getTranslateEnums()));\r\n }\r\n else\r\n {\r\n val = HStr.make(value.toString());\r\n }\r\n }\r\n else\r\n {\r\n // if its not a BTrendRecord, just do a toString() \r\n // of the whole record\r\n val = HStr.make(table.get(i).toString());\r\n }\r\n\r\n // add item\r\n arr.add(HHisItem.make(ts, val));\r\n }\r\n\r\n // done\r\n return (HHisItem[]) arr.trim();\r\n }\r\n catch (RuntimeException e)\r\n {\r\n e.printStackTrace();\r\n throw e;\r\n }\r\n }", "public BigDecimal getExchangeRate() {\n return exchangeRate;\n }", "@GetMapping(\"/signalforbullish/{ticker}\")\n public List<String> getBullishEngulfingforstock(@PathVariable String ticker) {\n List<CandleModel> result = candleService.getCandleData(ticker);\n List<String> dates=candleService.getBullishEngulfingCandleSignal(result);\n System.out.println(dates);\n return dates;\n }", "@RequestMapping(value = \"/getRatesByDate\", method = RequestMethod.POST)\n public String getRatesByDate(@RequestParam(\"date\") String date, @ModelAttribute(\"model\") ModelMap model) {\n\n try {\n\n // validating date\n DateValidator dateValidator = new DateValidator();\n String error = dateValidator.validate(date);\n\n if (error != null){\n model.addAttribute(\"dateError\", error);\n return VIEW_INDEX;\n }\n\n model.addAttribute(\"dateVal\", date);\n\n //getting results from WS\n GetExchangeRatesByDateResponse.GetExchangeRatesByDateResult list = soapClient.getExchangeRatesByDate(date);\n\n //checking has server returned data\n if (list == null || list.getContent() == null || list.getContent().isEmpty()) {\n model.addAttribute(\"emptyList\", \"No data for date - \" + date);\n return VIEW_INDEX;\n }\n\n //as WS result is xml we need to parse it to Items object\n Node node = (Node) list.getContent().get(0);\n JAXBContext jaxbContext = JAXBContext.newInstance(ExchangeRates.class);\n Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();\n ExchangeRates exchangeRates = (ExchangeRates) unmarshaller.unmarshal(node);\n\n //checking data\n if (exchangeRates == null || exchangeRates.getItem() == null || exchangeRates.getItem().isEmpty()) {\n model.addAttribute(\"emptyList\", \"No data for date - \" + date);\n return VIEW_INDEX;\n }\n\n //sorting list by rates value\n List<ExchangeRates.Item> items = exchangeRates.getItem();\n Collections.sort(items, new RateComparator());\n Collections.reverse(items);\n\n model.addAttribute(\"itemsList\", items);\n\n } catch (Exception e) {\n logger.error(\"getRatesByDate error\", e);\n model.addAttribute(\"getRatesByDateError\", e.getLocalizedMessage());\n }\n\n return VIEW_INDEX;\n }", "@Scheduled(fixedRate = 8 * 1000 * 60 * 60)\n private void getRatesTask() {\n try {\n RestTemplate restTemplate = new RestTemplate();\n CurrencyDTO forObject = restTemplate.getForObject(fixerIoApiKey, CurrencyDTO.class);\n forObject.getRates().forEach((key, value) -> {\n Currency currency = new Currency(key, value);\n this.currencyRepository.save(currency);\n });\n } catch (RestClientException ex) {\n System.out.println(ex.getMessage());\n }\n }", "public String getCurrencies() {\n try {\n URLConnection connection = new URL(url).openConnection();\n connection.setConnectTimeout(30000);\n connection.setReadTimeout(60000);\n return inputStreamToString(connection.getInputStream());\n } catch (IOException ignored) {\n }\n return null;\n // return \"{\\\"success\\\":true,\\\"timestamp\\\":1522438448,\\\"base\\\":\\\"EUR\\\",\\\"date\\\":\\\"2018-03-30\\\",\\\"rates\\\":{\\\"AED\\\":4.525864,\\\"AFN\\\":85.161016,\\\"ALL\\\":129.713915,\\\"AMD\\\":591.02486,\\\"ANG\\\":2.194225,\\\"AOA\\\":263.604778,\\\"ARS\\\":24.782964,\\\"AUD\\\":1.603522,\\\"AWG\\\":2.193728,\\\"AZN\\\":2.094523,\\\"BAM\\\":1.959078,\\\"BBD\\\":2.464863,\\\"BDT\\\":102.168576,\\\"BGN\\\":1.956367,\\\"BHD\\\":0.464385,\\\"BIF\\\":2157.962929,\\\"BMD\\\":1.232432,\\\"BND\\\":1.622501,\\\"BOB\\\":8.454972,\\\"BRL\\\":4.072329,\\\"BSD\\\":1.232432,\\\"BTC\\\":0.000181,\\\"BTN\\\":80.292916,\\\"BWP\\\":11.742489,\\\"BYN\\\":2.403731,\\\"BYR\\\":24155.657915,\\\"BZD\\\":2.462157,\\\"CAD\\\":1.588901,\\\"CDF\\\":1929.376385,\\\"CHF\\\":1.174759,\\\"CLF\\\":0.027287,\\\"CLP\\\":743.649213,\\\"CNY\\\":7.730802,\\\"COP\\\":3437.005101,\\\"CRC\\\":692.811412,\\\"CUC\\\":1.232432,\\\"CUP\\\":32.659435,\\\"CVE\\\":110.314948,\\\"CZK\\\":25.337682,\\\"DJF\\\":217.930869,\\\"DKK\\\":7.455792,\\\"DOP\\\":60.88212,\\\"DZD\\\":140.270429,\\\"EGP\\\":21.66663,\\\"ERN\\\":18.474632,\\\"ETB\\\":33.546785,\\\"EUR\\\":1,\\\"FJD\\\":2.489994,\\\"FKP\\\":0.876387,\\\"GBP\\\":0.878367,\\\"GEL\\\":2.977929,\\\"GGP\\\":0.878427,\\\"GHS\\\":5.436305,\\\"GIP\\\":0.876757,\\\"GMD\\\":58.022879,\\\"GNF\\\":11085.722017,\\\"GTQ\\\":9.041167,\\\"GYD\\\":251.699486,\\\"HKD\\\":9.672744,\\\"HNL\\\":29.022579,\\\"HRK\\\":7.425898,\\\"HTG\\\":79.270474,\\\"HUF\\\":312.396738,\\\"IDR\\\":16958.257802,\\\"ILS\\\":4.30267,\\\"IMP\\\":0.878427,\\\"INR\\\":80.242385,\\\"IQD\\\":1459.198927,\\\"IRR\\\":46515.663531,\\\"ISK\\\":121.33288,\\\"JEP\\\":0.878427,\\\"JMD\\\":154.325077,\\\"JOD\\\":0.873183,\\\"JPY\\\":130.921205,\\\"KES\\\":124.16795,\\\"KGS\\\":84.307561,\\\"KHR\\\":4914.197347,\\\"KMF\\\":490.729577,\\\"KPW\\\":1109.188805,\\\"KRW\\\":1306.217196,\\\"KWD\\\":0.368748,\\\"KYD\\\":1.011066,\\\"KZT\\\":393.096349,\\\"LAK\\\":10204.533468,\\\"LBP\\\":1860.972035,\\\"LKR\\\":191.667756,\\\"LRD\\\":162.373324,\\\"LSL\\\":14.567811,\\\"LTL\\\":3.757319,\\\"LVL\\\":0.764786,\\\"LYD\\\":1.634332,\\\"MAD\\\":11.330857,\\\"MDL\\\":20.258758,\\\"MGA\\\":3919.132681,\\\"MKD\\\":61.251848,\\\"MMK\\\":1639.134357,\\\"MNT\\\":2940.582048,\\\"MOP\\\":9.954478,\\\"MRO\\\":432.583892,\\\"MUR\\\":41.29107,\\\"MVR\\\":19.189425,\\\"MWK\\\":879.265951,\\\"MXN\\\":22.379772,\\\"MYR\\\":4.759698,\\\"MZN\\\":75.486896,\\\"NAD\\\":14.553832,\\\"NGN\\\":438.746047,\\\"NIO\\\":38.143757,\\\"NOK\\\":9.665842,\\\"NPR\\\":128.377096,\\\"NZD\\\":1.702979,\\\"OMR\\\":0.474245,\\\"PAB\\\":1.232432,\\\"PEN\\\":3.975213,\\\"PGK\\\":3.925342,\\\"PHP\\\":64.28409,\\\"PKR\\\":142.185629,\\\"PLN\\\":4.210033,\\\"PYG\\\":6843.692686,\\\"QAR\\\":4.487658,\\\"RON\\\":4.655145,\\\"RSD\\\":118.061885,\\\"RUB\\\":70.335482,\\\"RWF\\\":1038.853498,\\\"SAR\\\":4.62113,\\\"SBD\\\":9.587829,\\\"SCR\\\":16.588987,\\\"SDG\\\":22.246869,\\\"SEK\\\":10.278935,\\\"SGD\\\":1.615324,\\\"SHP\\\":0.876757,\\\"SLL\\\":9588.317692,\\\"SOS\\\":693.859366,\\\"SRD\\\":9.145099,\\\"STD\\\":24512.446842,\\\"SVC\\\":10.784232,\\\"SYP\\\":634.677563,\\\"SZL\\\":14.552187,\\\"THB\\\":38.403022,\\\"TJS\\\":10.877199,\\\"TMT\\\":4.202592,\\\"TND\\\":2.98138,\\\"TOP\\\":2.726513,\\\"TRY\\\":4.874764,\\\"TTD\\\":8.17041,\\\"TWD\\\":35.851887,\\\"TZS\\\":2774.203779,\\\"UAH\\\":32.339456,\\\"UGX\\\":4541.510587,\\\"USD\\\":1.232432,\\\"UYU\\\":34.915237,\\\"UZS\\\":10007.344406,\\\"VEF\\\":60824.193529,\\\"VND\\\":28089.579347,\\\"VUV\\\":129.873631,\\\"WST\\\":3.158603,\\\"XAF\\\":655.530358,\\\"XAG\\\":0.075316,\\\"XAU\\\":0.00093,\\\"XCD\\\":3.33201,\\\"XDR\\\":0.847694,\\\"XOF\\\":655.530358,\\\"XPF\\\":119.368042,\\\"YER\\\":307.923024,\\\"ZAR\\\":14.559828,\\\"ZMK\\\":11093.367083,\\\"ZMW\\\":11.622277,\\\"ZWL\\\":397.280478}}\";\n }", "@GET\n @Path(\"quotes/{ticker}\")\n @Produces(MediaType.APPLICATION_JSON)\n public Quotes getPrice(@PathParam(\"ticker\") String ticker) {\n \tString url = \"http://download.finance.yahoo.com/d/quotes.csv?s=\"+ticker+\"&f=l1&e=.csv\";\n \t\t\t//\"http://www.google.com/finance/option_chain?q=ebay&output=json\";\n \tStringBuilder str = new StringBuilder();\n \tQuotes quotes = new Quotes();\n\t\t\n \t try {\n \t\t \tHttpClient httpClient = HttpClientBuilder.create().build();\n \t\t\tHttpGet getRequest = new HttpGet(url);\n \t\t\tHttpResponse response = httpClient.execute(getRequest);\n \t\t\tif (response.getStatusLine().getStatusCode() != 200) {\n \t\t\t\tthrow new RuntimeException(\"Failed : HTTP error code : \"\n \t\t\t\t + response.getStatusLine().getStatusCode());\n \t\t\t}\n \t\t\tBufferedReader br = new BufferedReader(\n \t new InputStreamReader((response.getEntity().getContent())));\n \t\t\tString output = null;\n \t\t\twhile ((output = br.readLine()) != null) {\n \t\t\t\tstr.append(output);\n \t\t\t}\n \t\t\tquotes.setPrice(str.toString());\n\t\t } catch (ClientProtocolException e) {\n\t\t\te.printStackTrace();\n\t\t } catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t }\n \t return quotes;\n }", "public List<Record> getAccountHistory(BigDecimal bankAccountID){\n String sql = \"SELECT * FROM history WHERE bankaccount_id = :bankaccount_id\";\n Map paramMap = new HashMap();\n paramMap.put(\"bankaccount_id\", bankAccountID);\n List<Record> result = jdbcTemplate.query(sql, paramMap, new HistoryRowMapper());\n return result;\n }", "public BigDecimal getHistoryMarketPrice() {\n return historyMarketPrice;\n }", "public static JsonObject updateRates() {\n\n try {\n URL fixerAPI = new URL(\"http://api.fixer.io/latest?base=AUD\");\n URLConnection urlConnect = fixerAPI.openConnection();\n InputStream is = urlConnect.getInputStream();\n\n //Parsing API in as string\n Scanner s = new Scanner(is).useDelimiter(\"\\\\A\");\n String stringRates = s.hasNext() ? s.next() : \"\";\n is.close();\n \n\n //Converting string to JsonObject\n JsonParser parser = new JsonParser();\n conversionRates = parser.parse(stringRates).getAsJsonObject();\n\n DateFormat df = new SimpleDateFormat(\"h:mm a\");\n updateTime = df.format(Calendar.getInstance().getTime());\n\n\n } catch (Exception e) {\n //Raised if there is an error retrieving data from the input stream\n e.printStackTrace();\n JsonParser parserException = new JsonParser();\n //Backup Rates to be used if the device has no internet connection\n String backupRates = \"{\\\"base\\\":\\\"AUD\\\",\\\"date\\\":\\\"2017-03-31\\\",\\\"rates\\\":{\\\"BGN\\\":1.3988,\\\"BRL\\\":2.4174,\\\"CAD\\\":1.0202,\\\"CHF\\\":0.76498,\\\"CNY\\\":5.2669,\\\"CZK\\\":19.332,\\\"DKK\\\":5.3196,\\\"GBP\\\":0.61188,\\\"HKD\\\":5.9415,\\\"HRK\\\":5.3258,\\\"HUF\\\":220.01,\\\"IDR\\\":10183.0,\\\"ILS\\\":2.7788,\\\"INR\\\":49.632,\\\"JPY\\\":85.503,\\\"KRW\\\":854.31,\\\"MXN\\\":14.317,\\\"MYR\\\":3.3839,\\\"NOK\\\":6.5572,\\\"NZD\\\":1.0949,\\\"PHP\\\":38.376,\\\"PLN\\\":3.0228,\\\"RON\\\":3.256,\\\"RUB\\\":43.136,\\\"SEK\\\":6.8175,\\\"SGD\\\":1.0685,\\\"THB\\\":26.265,\\\"TRY\\\":2.7817,\\\"USD\\\":0.76463,\\\"ZAR\\\":10.185,\\\"EUR\\\":0.71521}}\";\n conversionRates = parserException.parse(backupRates).getAsJsonObject();\n }\n\n return conversionRates;\n }", "public float[] getByteHistory() {\n return byteMonitor.getHistory();\n }", "public String getDepositHistory(String currency) {\n\n\t\tString method = \"getdeposithistory\";\n\n\t\tif(currency.equals(\"\"))\n\n\t\t\treturn getJson(API_VERSION, ACCOUNT, method);\n\n\t\treturn getJson(API_VERSION, ACCOUNT, method, returnCorrectMap(\"currency\", currency));\n\t}", "public interface CurrencyRatesUpdater {\n\n public static final String ERROR_CONNECTING = \"ERROR_CONNECTING\";\n public static final String ERROR_RESPONSE = \"ERROR_RESPONSE\";\n public static final String ERROR_UNKNOWN = \"ERROR_UNKNOWN\";\n\n public ResponseRateUpdate getRate(String fromCurrencyCode, String toCurrencyCode);\n\n public class ResponseRateUpdate {\n\n public ResponseRateUpdate() {\n }\n\n public ResponseRateUpdate(Double rateValue, Date rateDate) {\n this.rateValue = rateValue;\n this.rateDate = rateDate;\n }\n\n public ResponseRateUpdate(String error) {\n this.error = error;\n }\n\n private Double reverseRateValue;\n private Double rateValue;\n private Date rateDate;\n private String error;\n\n public Double getRateValue() {\n return rateValue;\n }\n\n public void setRateValue(Double rateValue) {\n this.rateValue = rateValue;\n }\n\n public Date getRateDate() {\n return rateDate;\n }\n\n public void setRateDate(Date rateDate) {\n this.rateDate = rateDate;\n }\n\n public Double getReverseRateValue() {\n return reverseRateValue;\n }\n\n public void setReverseRateValue(Double reverseRateValue) {\n this.reverseRateValue = reverseRateValue;\n }\n\n public String getError() {\n return error;\n }\n\n public void setError(String error) {\n this.error = error;\n }\n }\n}", "List<Trade> getMyTrades(MyTradeRequest request);", "public interface ApiService {\n\n @GET(\"/api/v1/rates/daily/\")\n Call<List<ExchangeRate>> getTodayExchangeRates();\n\n}", "public String getOrderHistory(String market) {\n\n\t\tString method = \"getorderhistory\";\n\n\t\tif(market.equals(\"\"))\n\n\t\t\treturn getJson(API_VERSION, ACCOUNT, method);\n\n\t\treturn getJson(API_VERSION, ACCOUNT, method, returnCorrectMap(\"market\", market));\n\t}", "int getExchangeHistoryListCount();", "public void receiveResultGetHistory(\r\n\t\t\tcom.autometrics.analytics.v9.j2ee.webservices.v1_0.GetHistoryResponse result) {\r\n\t}", "public BigDecimal getHistoryRebate() {\n return historyRebate;\n }", "public interface CryptoInterface {\n @GET(\"pricemulti?fsyms=\"+FROM_SYSM+\"&tsyms=\"+TO_SYSM)\n Observable<Crytocoin> getCompareRates();\n}", "public Rate get(\n String baseCurrency,\n String currency\n ) throws RateQueryException {\n try {\n HttpResponse response = this.bitPayClient.get(\"rates/\" + baseCurrency + \"/\" + currency);\n final String content = this.bitPayClient.responseToJsonString(response);\n return JsonMapperFactory.create().readValue(content, Rate.class);\n } catch (JsonProcessingException e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n } catch (Exception e) {\n throw new RateQueryException(null,\n \"failed to deserialize BitPay server response (Rates) : \" + e.getMessage());\n }\n }", "public void testGetExchangeRateForCurrency() {\n final String destinationCurrency = \"EUR\";\n final String sourceCurrency = \"GBP\";\n \n final ExchangeRateUtil exchangeRateUtilities =\n new ExchangeRateUtil(true, destinationCurrency);\n exchangeRateUtilities.loadExchangeRatesFromCurrency(sourceCurrency);\n \n final double factor =\n exchangeRateUtilities.getExchangeRateForCurrency(sourceCurrency,\n ExchangeRateType.BUDGET);\n \n assertEquals(\"1.18\", String.valueOf(factor));\n }", "List<CurrencyDTO> getCurrencies();", "public hr.client.appuser.CouponCenter.ExchangeRecordOrBuilder getExchangeHistoryListOrBuilder(\n int index) {\n return exchangeHistoryList_.get(index);\n }", "@GetMapping(\"/stockExchanges\")\n\tpublic ResponseEntity<List<StockExchange>> getStockExchanges() {\n\t\treturn new ResponseEntity<>(dataFetchService.getStockExchanges(), HttpStatus.OK);\n\t}", "@Override\n public void onResponse(String response) {\n Gson g = new Gson();\n CurrencyRates rates = g.fromJson(response, CurrencyRates.class);\n setRates(rates);\n }", "@Test\n public void destiny2GetHistoricalStatsTest() {\n Long characterId = null;\n Long destinyMembershipId = null;\n Integer membershipType = null;\n OffsetDateTime dayend = null;\n OffsetDateTime daystart = null;\n List<DestinyHistoricalStatsDefinitionsDestinyStatsGroupType> groups = null;\n List<DestinyHistoricalStatsDefinitionsDestinyActivityModeType> modes = null;\n Integer periodType = null;\n InlineResponse20051 response = api.destiny2GetHistoricalStats(characterId, destinyMembershipId, membershipType, dayend, daystart, groups, modes, periodType);\n\n // TODO: test validations\n }", "ObservableList<Revenue> getRevenueList();", "@JsonGetter(\"purchase_history\")\n public List<PurchaseInfo> getPurchaseHistory ( ) { \n return this.purchaseHistory;\n }", "List<Trade> getAllTrades();", "public hr.client.appuser.CouponCenter.ExchangeRecord.Builder addExchangeHistoryListBuilder() {\n return getExchangeHistoryListFieldBuilder().addBuilder(\n hr.client.appuser.CouponCenter.ExchangeRecord.getDefaultInstance());\n }", "public SubscriberNumberMgmtHistory getHistory()\r\n {\r\n return history_;\r\n }", "@ApiModelProperty(value = \"The total price of staying in this room from the given check-in date to the given check-out date\")\n public List<PeriodRate> getRates() {\n return rates;\n }", "public void getHistory() {\n List<Map<String, String>> HistoryList = null;\n HistoryList = getData();\n String[] fromwhere = {\"Line\", \"Station\", \"Repair_Time_Start\", \"Repair_Time_Finish\", \"Repair_Duration\"};\n int[] viewwhere = {R.id.Line, R.id.Station, R.id.RepairTimeStart, R.id.RepairTimeFinish, R.id.Duration};\n ABH = new SimpleAdapter(BreakdownHistory.this, HistoryList, R.layout.list_history, fromwhere, viewwhere);\n BreakdownHistory.setAdapter(ABH);\n }" ]
[ "0.6821366", "0.6791315", "0.6624119", "0.6512298", "0.59810275", "0.59669584", "0.5935001", "0.59272176", "0.59143925", "0.5909815", "0.5839644", "0.5833811", "0.5819845", "0.57868147", "0.5755736", "0.5700508", "0.5686016", "0.5639501", "0.5630625", "0.56195927", "0.5566618", "0.551439", "0.5412947", "0.54127574", "0.53728825", "0.53622264", "0.534987", "0.5288705", "0.528285", "0.5282073", "0.52604073", "0.5240616", "0.5205499", "0.5191309", "0.5180488", "0.5165515", "0.51407456", "0.51243526", "0.51176053", "0.51064545", "0.5093715", "0.5087357", "0.5075881", "0.50586784", "0.50435394", "0.50368273", "0.50322753", "0.5028572", "0.50258595", "0.5011547", "0.49985045", "0.49985018", "0.49945512", "0.49841782", "0.4982801", "0.49624735", "0.4952003", "0.49387127", "0.49027357", "0.489209", "0.48898745", "0.48892775", "0.48816526", "0.48775002", "0.4877495", "0.48618358", "0.4860832", "0.4853098", "0.4850333", "0.48495597", "0.48489875", "0.4845309", "0.48440632", "0.4836971", "0.48316717", "0.48295033", "0.48263955", "0.48259494", "0.48254687", "0.4819286", "0.481823", "0.4815185", "0.48125616", "0.4788943", "0.47812498", "0.47778663", "0.47729152", "0.47701597", "0.47647753", "0.4759456", "0.47551844", "0.47489065", "0.47473246", "0.47442967", "0.47426754", "0.47377175", "0.4737179", "0.472702", "0.4725508", "0.47088182" ]
0.8785819
0
Create an image file name
private File createImageFile() throws IOException { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA).format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; //.getExternalFilesDir()方法可以获取到 SDCard/Android/data/你的应用的包名/files/ 目录,一般放一些长时间保存的数据 File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); //创建临时文件,文件前缀不能少于三个字符,后缀如果为空默认未".tmp" File image = File.createTempFile( imageFileName, /* 前缀 */ ".jpg", /* 后缀 */ storageDir /* 文件夹 */ ); mCurrentPhotoPath = image.getAbsolutePath(); return image; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private File createImageFileName() throws IOException {\n String timestamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n //there are two types of SimpleDateFormat and Date()\n String prepend = \"JPEG_\" + timestamp + \"_\";\n File imageFile = File.createTempFile(prepend, \".jpg\", mImageFolder);\n mImageFileName = imageFile.getAbsolutePath();\n return imageFile;\n\n }", "public void createNewImageFile(){\n fillNewImage();\n\n try {\n ImageIO.write(newImage, imageFileType, new File(k + \"_Colored_\" + fileName.substring(0,fileName.length() - 4) + \".\" + imageFileType));\n } catch (IOException e){\n e.printStackTrace();\n }\n \n }", "private static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);\n return imageF;\n }", "private static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);\n return imageF;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"MAZE_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);\n return imageF;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\")\n .format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX,\n albumF);\n return imageF;\n }", "private File createImageFile() throws IOException{\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\"+timeStamp;\n File image = File.createTempFile(imageFileName, \".jpg\", this.savePath);\n \n return image;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "private File createImageFile() throws IOException{\n @SuppressLint(\"SimpleDateFormat\")\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"img_\"+timeStamp+\"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n return File.createTempFile(imageFileName,\".jpg\",storageDir);\n }", "private File createImageFile() throws IOException {\n @SuppressLint({\"NewApi\", \"LocalSuppress\"}) String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault()).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "public String createImageName(File imageFile)\n\t{\n\t\tString name = imageFile.getAbsolutePath();\n\t\t\n\t\t// remove the initial part of the path that is common among all images so that only the relative path within the image folder remains\n\t\t// also remove the file's extension\n\t\tname = name.substring(imageFolder.getAbsolutePath().length() + 1, name.lastIndexOf('.'));\t\t\n\t\treturn name;\n\t}", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(getString(R.string.day_format)).format(new Date());\n String imageFileName = getString(R.string.image_file_prefix) + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(imageFileName, getString(R.string.image_file_format),\n storageDir\n );\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.US).format(new Date());\n String imageFileName = \"perfil_\" + timeStamp + \"_\";\n String outputPath = PATH;\n File storageDir = new File(outputPath);\n if(!storageDir.exists())storageDir.mkdirs();\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException\n {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File imageFile = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return imageFile;\n }", "private String createFileName(){\n \t\n \tString state = Environment.getExternalStorageState();\n \tif(state.equals(Environment.MEDIA_MOUNTED)){ \t\t\n \t\tFile folder = new File(Environment.getExternalStorageDirectory() + \"/ArtCameraPro\");\n \t\tboolean success = true;\n \t\tif (!folder.exists()) {\n \t\t success = folder.mkdir();\n \t\t} \n \t\tString sFileName = Environment.getExternalStorageDirectory() + \"/ArtCameraPro\" + File.separator + System.currentTimeMillis() + \".jpg\";\n \t\treturn sFileName;\n \t\t\n \t}\n \treturn \"\";\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "private static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = MyApplication.getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return image;\n }", "public static String createFotoFileName(String prefix) {\n return prefix + \"_\" + DateUtil.getCurrentDateTimeAsString(\"yyyyMMdd_hhmmss\") + \".jpg\";\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File imageFile = File.createTempFile(imageFileName, \".jpg\", storageDir);\n return imageFile;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp;\n\n String folderName = context.getString(R.string.app_name).toLowerCase();\n\n File path = new File(ContextCompat.getExternalFilesDirs(getActivity(), null)[0]\n .getAbsolutePath() + \"/\" + folderName);\n\n //make sure folder exists\n path.mkdirs();\n\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n path /* directory */\n );\n\n return image;\n }", "private File createImageFile(String imgDir) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = imgDir + File.separator + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\n String mFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File mFile = File.createTempFile(mFileName, \".jpg\", storageDir);\n return mFile;\n }", "@SuppressLint(\"SimpleDateFormat\")\n public static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + JPEG_FILE_SUFFIX;\n String nameAlbum = Environment.getExternalStorageDirectory().getAbsolutePath() + \"/\" + nameDir;// getString(R.string.app_name);\n File albumF = new File(nameAlbum);\n if (!albumF.exists()) {\n albumF.mkdirs();\n File noMedia = new File(albumF, \".nomedia\");\n noMedia.createNewFile();\n }\n\n File imageF = new File(albumF, imageFileName);\n imageF.createNewFile();\n return imageF;\n }", "private String generateFilename() {\n UUID uuid = UUID.randomUUID();\n return uuid.toString();\n }", "private File createImageFile() throws IOException\n {\n String timeStamp = new SimpleDateFormat(\"yyyymmddHHmmss\").format(new Date());\n String imageFileName = timeStamp;\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n userCacheDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n return image;\n }", "private File createImageFile() {\n\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault()).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES + APP_PICTURE_DIRECTORY);\n storageDir.mkdirs();\n\n File imageFile = null;\n\n try {\n imageFile = File.createTempFile(\n imageFileName, /* prefix */\n FILE_SUFFIX_JPG, /* suffix */\n storageDir /* directory */\n );\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return imageFile;\n }", "private File createImageFile() {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"GIS\");\n File image = null;\n\n if(!storageDir.exists()){\n\n storageDir.mkdirs();\n\n }\n try {\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }catch (Exception e){\n\n e.printStackTrace();\n\n }\n // Save a file: path for use with ACTION_VIEW intents\n\n return image;\n }", "private String beautiplyFileNameGenerator() {\r\n\t\t// /randomvalue between 0 to 9\r\n\t\tString name = \"beautiply\" + new Random().nextInt(9) + \".png\";\r\n\r\n\t\treturn name;\r\n\t}", "private void createImage (String image_name, int filename){\n\n\t\tString image_folder = getLevelImagePatternFolder();\n\t\t\n\t\tString resource = filename+\".png\";\n\t\tImageIcon ii = new ImageIcon(this.getClass().getResource(image_folder + resource));\n images.put(image_name, ii.getImage());\n\t}", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File imageFile = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return imageFile;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n String z = image.getAbsolutePath();\n return image;\n }", "public String createImageName(String empName) {\n StringBuilder iN = new StringBuilder();\n\n String[] fnLn = empName.split(\" \");\n iN.append(fnLn[0]);\n iN.append(fnLn[fnLn.length-1].substring(0, 1));\n return iN.toString().trim();\n }", "public File createImageFile() {\n // the public picture director\n File picturesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); // To get pictures directory from android system\n\n // timestamp makes unique name.\n @SuppressLint(\"SimpleDateFormat\") SimpleDateFormat sdf = new SimpleDateFormat(\"yyyyMMdd_HHmmss\");\n String timestamp = sdf.format(new Date());\n\n // put together the directory and the timestamp to make a unique image location.\n File imageFile = new File(picturesDirectory, timestamp + \".jpg\");\n\n return imageFile;\n }", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = mContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat ( \"yyyyMMdd_HHmmss\" ).format ( new Date () );\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir ( Environment.DIRECTORY_PICTURES );\n File image = File.createTempFile (\n imageFileName , /* prefix */\n \".jpg\" , /* suffix */\n storageDir /* directory */\n );\n\n // luu file: su dung ACTION_VIEW\n pathToFile = image.getAbsolutePath ();\n return image;\n }", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getActivity().getFilesDir();\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "protected File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n strAbsolutePath = image.getAbsolutePath();\n Log.e(\"XpathX\", image.getAbsolutePath());\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\n String mFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File mFile = File.createTempFile(mFileName, \".jpg\", storageDir);\n pictureFilePath = mFile.getAbsolutePath();\n return mFile;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"1mind_\" + timeStamp + \".png\";\n File photo = new File(Environment.getExternalStorageDirectory(), imageFileName);\n mCurrentPhotoPath = photo.getAbsolutePath();\n return photo;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\r\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(\r\n imageFileName, // prefix //\r\n \".jpg\", // suffix //\r\n storageDir // directory //\r\n );\r\n\r\n // Save a file: path for use with ACTION_VIEW intents\r\n mPath = image.getAbsolutePath();\r\n return image;\r\n }", "private File createImageFile() throws IOException {\n String imageFileName = new SimpleDateFormat(\"yyyyMMdd-HHmmss\", Locale.ENGLISH).format(new Date());\n String storageDir = Environment.getExternalStorageDirectory() + \"/DokuChat\";\n File dir = new File(storageDir);\n if (!dir.exists())\n dir.mkdir();\n\n image = new File(storageDir + \"/\" + imageFileName + \".jpg\");\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n pictureImagePath = image.getAbsolutePath();\n return image;\n\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new java.util.Date());\n String imageFileName = \"WILDLIFE_JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n //Todo:Este sera el nombre que tendra el archivo\n String imageFileName = \"IMAGE_\" + timeStamp + \"_\";\n //Todo:Ruta donde se almacenara la imagen\n File storageDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n\n //Todo:El tipo de archivo que se almacenara en el directorio\n File image = File.createTempFile(imageFileName,\".jpg\",storageDirectory);\n //Todo: mImageFileLocation sera el valor que se\n mImageFileLocation = image.getAbsolutePath();\n\n return image;\n }", "private File createImageFile() throws IOException\r\n {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = \"MYAPPTEMP_\" + timeStamp + \"_\";\r\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(imageFileName, /* prefix */\r\n \".jpg\", /* suffix */\r\n storageDir /* directory */\r\n );\r\n\r\n return image;\r\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n pictureImagePath = image.getAbsolutePath();\n return image;\n }", "public abstract String getImageSuffix();", "private File createImageFile() {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = new File(utils.getSentImagesDirectory());\n\n File image = null;\n try {\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n // Save a file: path for use with ACTION_VIEW intents\n //LOG.info(\"test place3\");\n try {\n imageFilePath = image.getAbsolutePath();\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n //LOG.info(\"test place4\");\n if (image == null) {\n LOG.info(\"image file is null\");\n } else {\n LOG.info(\"image file is not null path is:\" + imageFilePath);\n }\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".png\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, // prefix\n \".jpg\", // suffix\n storageDir // directory\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = SettingsHelper.getPrivateImageFolder(this);\n if (!storageDir.exists()) {\n storageDir.mkdirs();\n }\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n imageUri = Uri.fromFile(image);\n return image;\n }", "private Image createImage(String image_file) {\n\t\tImage img = new Image(image_file);\n\t\treturn img;\n\t}", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.US).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(getPhotoLocation());\n File image = File.createTempFile(\n imageFileName,\n \".jpg\",\n storageDir\n );\n\n setCurrentPhotoFile(image.getAbsolutePath());\n return image;\n }", "private File createImageFile() throws IOException\n {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"Picko_JPEG\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DOCUMENTS),\"Whatsapp\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n String mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n\n\n }", "public static File createImageFile(Context context, String name) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = name + \"_\" + timeStamp + \"_\";\r\n File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(\r\n imageFileName, /* prefix */\r\n \".jpg\", /* suffix */\r\n storageDir /* directory */\r\n );\r\n return image;\r\n }", "public abstract String createFilename(Entity entity);", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //The directory where to save the file image\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n //The actual image file\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format( new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\" ;\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment. DIRECTORY_PICTURES);\n File image = File. createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private static File createImageFile(Activity activity) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n// File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n// File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n savePhotoPathToSharedPrefs();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n //galleryAddPic();\n return image;\n }", "private File createImageFile() throws IOException {\n Date d = new Date();\n String nameDate = new SimpleDateFormat(\"ddMMyyyy_HHmmss\").format(d);\n this.date = new SimpleDateFormat(\"dd/MM/yyyy\").format(d);\n String imageFileName = \"JPEG_\" + nameDate + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\r\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(\r\n imageFileName, /* prefix */\r\n \".jpg\", /* suffix */\r\n storageDir /* directory */\r\n );\r\n\r\n // Save a file: path for use with ACTION_VIEW intents\r\n mCurrentPhotoPath = image.getAbsolutePath();\r\n return image;\r\n\r\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n photosPaths.add(mCurrentPhotoPath);\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp;\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "public abstract FileName createName(String absolutePath, FileType fileType);", "public String getPhotoFileName() {\n return \"IMG_\" + getId().toString() + \".jpg\";\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(imageFileName, \".jpg\", storageDir);\n\n // Save a file: path for use with ACTION_VIEW intents\n this.currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.ENGLISH).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName,\n \".jpg\",\n storageDir\n );\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "public static File createImageFile(Context ctx) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = ctx.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(imageFileName, \".jpg\", storageDir);\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = imageFileName + \"camera.jpg\";\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));\n if (!storageDir.exists()){\n storageDir.mkdir();\n }\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n// File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }" ]
[ "0.7782615", "0.7292824", "0.6992056", "0.6992056", "0.6943564", "0.6911284", "0.68938434", "0.686538", "0.68592805", "0.68590325", "0.68580544", "0.68443614", "0.67711073", "0.67546785", "0.6751638", "0.6737171", "0.6726197", "0.67170936", "0.67068315", "0.6706409", "0.6694521", "0.6692518", "0.66892946", "0.6665624", "0.6658789", "0.66203934", "0.66164696", "0.6615736", "0.6610864", "0.66096437", "0.6604602", "0.66028416", "0.6600987", "0.65886337", "0.6579357", "0.6576186", "0.65653497", "0.65549564", "0.65421396", "0.65305394", "0.6530493", "0.6523718", "0.6517966", "0.65117127", "0.6505747", "0.6493113", "0.64924705", "0.6475854", "0.6471266", "0.6448684", "0.6419626", "0.64166796", "0.6413514", "0.640042", "0.63892233", "0.6379753", "0.6375813", "0.6375534", "0.6367382", "0.63566", "0.6355329", "0.6345687", "0.6332988", "0.6329631", "0.6329631", "0.6329631", "0.6329631", "0.6329631", "0.63276523", "0.63276523", "0.6326054", "0.6324831", "0.6323436", "0.63181776", "0.6311542", "0.63093704", "0.63077575", "0.630525", "0.6300038", "0.6297278", "0.6296964", "0.6294874", "0.6292948", "0.6289597", "0.62894386", "0.6282458", "0.6281662", "0.62706375", "0.6261314", "0.6258569", "0.62572557", "0.6256673", "0.62541807", "0.6251297", "0.6251297", "0.6251297", "0.6251297", "0.6251297", "0.6251297", "0.6251297", "0.6251297" ]
0.0
-1
If we get a bot or a nonmember, dip
@SubscribeEvent public void onMessageReceived(GuildMessageReceivedEvent event) { if (event.getAuthor().isBot() || event.getMember() == null) return; // Logic GuildUserModel guildUser = taules.dataManager.getGuildUserModel(event.getGuild().getIdLong(), event.getMember()); DB.save(new MessageLogModel(guildUser.getId())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isBot(){\n return false;\n }", "@Override\r\n public void notLeader() {\n }", "private void handleResponseIsOwner(Friends friends) {\n final Gson gson = new Gson();\n //Toast.makeText(_context, response.toString(), Toast.LENGTH_SHORT).show();\n Log.d(DEBUG, \"Owner: \" + friends.getFirstName() + friends.getLastName() + friends.getEmail());\n // debug only, can set invisible if needed\n if (friends.getPendingFriendList() != null) {\n for (String uid: friends.getPendingFriendList()){\n getSingleUser(uid, gson, false);\n }\n }\n else{\n Log.d(DEBUG,\"I am so lonely, i don't have any friends\");\n }\n }", "public void godNotAdded() {\n notifyGodNotAdded(this.getCurrentTurn().getCurrentPlayer().getNickname());\n }", "@Override\n public boolean isDM(Optional<BaseCharacter> inUser)\n {\n if(!inUser.isPresent())\n return false;\n\n return inUser.get().hasAccess(Group.DM);\n }", "private boolean inspect(Pinner pinner) {\n if (unfollowConfig.getUnfollowOnlyRecordedFollowings()) {\n if (pinbot3.PinBot3.dalMgr.containsObjectExternally(pinner, DALManager.TYPES.duplicates_unfollow_pinners, account)) {\n return false;\n }\n /*for (PinterestObject p : account.getDuplicates_follow()) {\n if (p instanceof Pinner && ((Pinner) p).equals(pinner)\n && (new Date()).getTime() - ((Pinner) p).getTimeFollow() <= unfollowConfig.getTimeBetweenFollowAndUnfollow()) {\n return false;\n }\n }*/\n }\n\n if (!unfollowConfig.getCriteria_Users()) {\n return true;\n }\n\n String url = \"/\" + pinner.getUsername() + \"/\";\n String referer = pinner.getBaseUsername();\n int pincount = pinner.getPinsCount();\n int followerscount = pinner.getFollowersCount();\n\n if (!(pincount >= unfollowConfig.getCriteria_UserPinsMin() && pincount <= unfollowConfig.getCriteria_UserPinsMax())) {\n return true;\n }\n if (!(followerscount >= unfollowConfig.getCriteria_UserFollowersMin() && followerscount <= unfollowConfig.getCriteria_UserFollowersMax())) {\n return true;\n }\n\n try {\n if (!Http.validUrl(base_url + url)) {\n return false;\n }\n\n String rs = MakeRequest(base_url + url, referer, Http.ACCEPT_HTML);\n if (rs == null) {\n return false;\n }\n\n Pattern pattern = Pattern.compile(\"name=\\\"pinterestapp:following\\\" content=\\\"(\\\\d+)\\\"\", Pattern.DOTALL | Pattern.CASE_INSENSITIVE & Pattern.MULTILINE);\n Matcher matcher = pattern.matcher(rs);\n if (matcher.find()) {\n int followingcount = Integer.parseInt(matcher.group(1));\n if (!(followingcount >= unfollowConfig.getCriteria_UserFollowingMin() && followingcount <= unfollowConfig.getCriteria_UserFollowingMax())) {\n return true;\n }\n }\n\n pattern = Pattern.compile(\"name=\\\"pinterestapp:boards\\\" content=\\\"(\\\\d+)\\\"\", Pattern.DOTALL | Pattern.CASE_INSENSITIVE & Pattern.MULTILINE);\n matcher = pattern.matcher(rs);\n if (matcher.find()) {\n int boardcount = Integer.parseInt(matcher.group(1));\n if (!(boardcount >= unfollowConfig.getCriteria_UserBoardsMin() && boardcount <= unfollowConfig.getCriteria_UserBoardsMax())) {\n return true;\n }\n }\n return true;\n } catch (InterruptedException ex) {\n //ignore\n config.isInterrupt = true;\n return false;\n } catch (Exception ex) {\n common.ExceptionHandler.reportException(ex);\n return false;\n }\n }", "void noFriendsRetrieved();", "public boolean getBot() {\n return bot;\n }", "private boolean checkDadBot(MessageReceivedEvent event) {\n String message = event.getMessage().getContentDisplay();\n\n // Ignore messages that are too short or long to be funny\n if (message.length() < 5 || message.length() > 40)\n return false;\n\n String name = null;\n\n if (message.toLowerCase(Locale.ROOT).startsWith(\"i'm \"))\n name = message.substring(4);\n else if (message.toLowerCase(Locale.ROOT).startsWith(\"im \"))\n name = message.substring(3);\n\n if (name != null && Math.random() < Setting.DAD_BOT_CHANCE) {\n event.getMessage().reply(\"Hi \" + name + \", I'm StatsBot!\").queue();\n return true;\n }\n\n return false;\n }", "public boolean isBot() {\n//\t\treturn this.getUserIO().checkConnection();\n\t\treturn false;\n\t}", "public boolean isBot() {\n \t\treturn (type == PLAYER_BOT);\n \t}", "boolean hasDonator();", "public static void neverJoined(Command command, String player) {\n\t\tString str = command.getSender().getAsMention() + \",\\n\";\n\t\t\n\t\tstr += ConfigManager.getMessage(\"never joined\").replace(\"%player%\", player);\n\t\tcommand.getChannel().sendMessage(str).complete();\n\t}", "private String notFound() {\n\t\tquestionBot.put(owner.id(), \"Desculpe, não entendi sua resposta\");\n\t\treturn buildMessage(questionBot.get(owner.id()));\n\t}", "public void NoGodHasSuchName() {\n notifyGodNotCorrect(this.getCurrentTurn().getCurrentPlayer().getNickname(), availableGods, chosenGodList);\n }", "@Override\r\n\tprotected void verificaUtentePrivilegiato() {\n\r\n\t}", "@Override\r\n\tpublic String say() {\n\t\tif(livingBy==LivingBy.CAT) {\r\n\t\t\treturn \"Me ow\";\r\n\t\t}else if(livingBy==LivingBy.ROOSTER) {\r\n\t\t\treturn \"Cock-a-doodle-doo\";\r\n\t\t\t\r\n\t\t}else {\r\n\t\t\treturn \"Woof, woof\";\r\n\t\t}\r\n\t\t\r\n\t}", "@Override\n public boolean isNeedShowBOTPRule() {\n \treturn true;\n }", "@Test\r\n public void lookProfileByOwner() {\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n\r\n // Our member looked at his own profile\r\n member.lookedBy(member);\r\n \r\n // Still no activity for member\r\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n }", "public boolean whoIsHere(){\r\n\t\treturn otherPlayer;\r\n\t}", "public boolean getNoFollow() {\n return noFollow;\n }", "boolean isMember();", "@Test\n void testGetRegistrarForUser_noAccess_isNotAdmin_notReal() {\n expectGetRegistrarFailure(\n OTE_CLIENT_ID_WITHOUT_CONTACT,\n USER,\n \"user [email protected] doesn't have access to registrar OteRegistrar\");\n verify(lazyGroupsConnection).get();\n }", "private void viewPlayer(Command command)\n { if(!command.hasSecondWord()) { \n // if there is no second word, we don't know where to go... \n Logger.Log(\"What do you want to view?\"); \n return; \n } \n \n String thingToView = command.getSecondWord();\n String inventory = \"inventory\";\n String companions = \"companions\";\n \n if (!thingToView.equals(inventory)&&!thingToView.equals(companions)){\n Logger.Log(\"You can only view your inventory or your current companions\");\n }\n else if (thingToView.equals(inventory)&&!player.inventory.isEmpty()) {\n Logger.Log(\"~*\" + player.playerName + \"'s Backpack *~\");\n player.viewInventory();\n Logger.Log(\"~*~*~*~*~*~\");\n }\n else if (thingToView.equals(inventory)&&player.inventory.isEmpty()){\n Logger.Log(\"There is nothing in your backpack...\");\n }\n else if (thingToView.equals(companions)&&!player.friends.isEmpty()) {\n Logger.Log(\"~*\" + player.playerName + \"'s Companions *~\");\n player.viewCompanions();\n Logger.Log(\"~*~*~*~*~*~\");\n }\n else if (thingToView.equals(companions)&&player.friends.isEmpty()) {\n Logger.Log(\"You don't have any companions at the moment :(\");\n }\n \n \n }", "boolean hasSendPlayerName();", "public boolean checkForUser(Player p) {\n\t\tif(p.getName(p).equals(\"user\")) {\n\t\t\treturn true;\t\t\t\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\n public boolean hasPermission(CommandSender sender, String pNode) {\n if (!(sender instanceof Player)) return true;\n return hasPermission((Player) sender, pNode);\n }", "static private void TalkTo() {\n if (BSChristiansen.getCurrentRoom() == currentRoom) {\n System.out.println(BSChristiansen.getDescription() + \", yet he still gives you good advice:\\n\");\n System.out.println(BSChristiansen.getDialog(0));\n System.out.println(\"\");\n woundedSurvivor();\n } else if (mysteriousCrab.getCurrentRoom() == currentRoom && inventory.getInventory().containsKey(\"Shroom\")) {\n System.out.println(mysteriousCrab.getDescription() + \"\\n\" + mysteriousCrab.getDialog(0));\n } else {\n System.out.println(\"There is nobody to communicate with in this Room\");\n }\n\n }", "@Override\n\tpublic boolean isOwnMessage() {\n\t\ttry {\n\t\t\treturn (this.user.id == AccountManager.current_account.getUser().id);\n\t\t} catch (Exception e) {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n void testGetRegistrarForUser_noAccess_isNotAdmin() {\n expectGetRegistrarFailure(\n REAL_CLIENT_ID_WITHOUT_CONTACT,\n USER,\n \"user [email protected] doesn't have access to registrar NewRegistrar\");\n verify(lazyGroupsConnection).get();\n }", "boolean hasUserMessage();", "private boolean isFriend() {\r\n\r\n return isContactableUser() && !StringUtils.isBlank(friendFeed.getContact().getContactId());\r\n }", "private static Player getThroughWhomSendMessage() {\n\t\treturn Remain.getOnlinePlayers().isEmpty() ? null : Remain.getOnlinePlayers().iterator().next();\n\t}", "public String checkMessage() {\n\t\tString userLatestStep = questionBot.get(owner.id());\n\n\t\t//se a amensagem comeca com '/', trata-se de um item de menu sendo acionado\n\t\tif(answerUser != null && answerUser.startsWith(\"/\"))\n\t\t\tuserLatestStep = answerUser;\n\n\t\t//busca no mapa de respostas as opcoes para o usuario\n\t\tObject options = response.get(userLatestStep);\n\n\t\t//obtem a mensagem a ser devolvida para o usuario\n\t\tString result = parseResult(options, answerUser);\n\n\t\t//mantem a ultima resposta do usuario\n\t\tuserLatestAnswer.put(owner.id(), answerUser);\n\n\t\treturn result;\n\t}", "public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {\n\t\tif (label.equalsIgnoreCase(\"truth\")) {\n\t\t\tif (sender instanceof Player) {\n\t\t\t\t//player (not console)\n\t\t\t\tPlayer player = (Player) sender;\n\t\t\t\tif (player.hasPermission(\"stinky.use\")) { \n\t\t\t\t\tplayer.sendMessage(ChatColor.LIGHT_PURPLE+\"\"+ChatColor.BOLD+\"Alex Stinks\");\n\t\t\t\t\tplayer.sendMessage(ChatColor.translateAlternateColorCodes('&', \"&ehe really Does\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tplayer.sendMessage(ChatColor.DARK_RED+\"\"+ChatColor.BOLD+\"You don't Have permission to use this!\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//console (not player)\n\t\t\t\tsender.sendMessage(\"hey Console\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "@Test\r\n\tpublic void testDenyFriendRequest() {\r\n\t\tPerson p1 = new Person(0);\r\n\t\tp1.receiveFriendRequest(\"JavaLord\", \"JavaLordDisplayName\");\r\n\t\tassertTrue(p1.hasFriendRequest(\"JavaLord\"));\r\n\t\tassertTrue(p1.denyFriendRequest(\"JavaLord\"));\r\n\t\tassertFalse(p1.denyFriendRequest(\"JavaLord\"));\r\n\t}", "public Boolean isFollowing() {\n Integer groupType = getGroupType();\n if (groupType != null && groupType == Group.DISCUSSION_KEY) {\n return isMember();\n } else {\n return isFollowing;\n }\n }", "protected boolean processPersonalTell(String username, String titles, String message){return false;}", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "@Override\n public boolean test(Status status) {\n User tweetPoster = status.getUser();\n\n if (followStatusChecker.isFollowedBy(tweetPoster)) {\n return true;\n }\n if (unfollowAutomatically && followStatusChecker.isFollowing(tweetPoster)) {\n try {\n System.out.println(\"I'm going to unfollow \" + status.getUser() + \" because he is not following us anymore\");\n followStatusChecker.unfollow(tweetPoster);\n } catch (TwitterException e) {\n e.printStackTrace();\n }\n }\n return false;\n }", "@Test\n\tpublic void testIsMember() {\n\t\tresetTestVars();\n\t\t\n\t\tassertFalse(\"Nothing in list\", sn.isMember(\"Hello\"));\n\t\tuser1.setID(\"1\");\n\t\tsn.addUser(user1);\n\t\tassertTrue(\"User with given ID exists\", sn.isMember(\"1\"));\n\t}", "public boolean isAlone() {\n\t\tif (getMateFollow() != null)\n\t\t\tif (!getMateFollow().isKO())// Checks if the support is dead\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\treturn true;\n\t\telse\n\t\t\treturn true;\n\t}", "public boolean isGivingInformation();", "public void checkIfUserIsSame(){\n if(!FirebaseAuth.getInstance().getCurrentUser().getUid().equals(getIntent().getStringExtra(\"uID\"))) {\n Log.i(\"XXX\", \"passed NOT SAME USER\");\n checkIfUserIsFriend();\n }else{\n userStatus = \"same user\";\n ((RelativeLayout) findViewById(R.id.loadingPanel)).setVisibility(View.GONE);\n }\n }", "public boolean request() {\n\t\tif (inAnySession()) {\n\t\t\tplayer.exchangeSession.reset();\n\t\t\treturn false;\n\t\t}\n\t\t\n if (!PlayerRight.isDeveloper(player) && !PlayerRight.isDeveloper(other)) {\n if (player.playTime < 3000) {\n player.message(\"You cannot trade until you have 30 minutes of playtime. \" + Utility.getTime(3000 - player.playTime) + \" minutes remaining.\");\n return false;\n }\n if (other.playTime < 3000) {\n player.message(other.getName() + \" cannot trade until they have 30 minutes of playtime.\");\n return false;\n }\n }\n\t\t \n\t\tif (getSession(other).isPresent() && getSession(other).get().inAnySession()) {\n\t\t\tplayer.message(\"This player is currently is a \" + type.name + \" with another player.\");\n\t\t\treturn false;\n\t\t}\n\t\tif (Objects.equals(player, other)) {\n\t\t\tplayer.message(\"You cannot \" + type.name + \" with yourself.\");\n\t\t\treturn false;\n\t\t}\n if (PlayerRight.isIronman(player) && !PlayerRight.isDeveloper(other)) {\n player.message(\"You can not \" + type.name + \" as you are an iron man.\");\n return false;\n }\n if (PlayerRight.isIronman(other) && !PlayerRight.isDeveloper(player)) {\n player.message(other.getName() + \" can not be \" + type.name + \"d as they are an iron man.\");\n return false;\n }\n\t\tif (player.exchangeSession.requested_players.contains(other)) {\n\t\t\tplayer.message(\"You have already sent a request to this player.\");\n\t\t\treturn false;\n\t\t}\n\t\tif (player.locking.locked()) {\n\t\t\tplayer.message(\"You cannot send a \" + type.name + \" request right now.\");\n\t\t\treturn false;\n\t\t}\n\t\tif (other.locking.locked()) {\n\t\t\tplayer.message(other.getName() + \" is currently busy.\");\n\t\t\treturn false;\n\t\t}\n\t\tif (player.playerAssistant.busy()) {\n\t\t\tplayer.message(\"Please finish what you are doing before you do that.\");\n\t\t\treturn false;\n\t\t}\n\t\tif (other.playerAssistant.busy()) {\n\t\t\tplayer.message(other.getName() + \" is currently busy.\");\n\t\t\treturn false;\n\t\t}\n\t\tif (player.inActivity(ActivityType.DUEL_ARENA)) {\n\t\t\tplayer.message(\"You can not do that whilst in a duel!\");\n\t\t\treturn false;\n\t\t}\n\t\tif (other.inActivity(ActivityType.DUEL_ARENA)) {\n\t\t\tother.message(\"You can not do that whilst in a duel!\");\n\t\t\treturn false;\n\t\t}\n\t\tif (!onRequest()) {\n\t\t\treturn false;\n\t\t}\n\t\treturn SESSIONS.add(this);\n\t}", "protected boolean processPlayerDeclined(int gameNum, String playerName, String offer){\n return false;\n }", "public static void unknownMember(Command command, String id) {\n\t\tString str = command.getSender().getAsMention() + \",\\n\";\n\t\t\n\t\tstr += ConfigManager.getMessage(\"unknown member\").replace(\"%id%\", id);\n\t\tcommand.getChannel().sendMessage(str).complete();\n\t}", "private boolean isFollowing(User user, String target)\n{\n \n DefaultListModel following = user.getFollowings();\n if (following.contains(target))\n {\n return true;\n }\n return false;\n}", "public boolean isNotComingToChurch(Member member) {\n int weekCounter = 4; //the default\n SystemVar var = (systemVarService.getSystemVarByNameUnique(Constants.NUMBER_OF_WEEKS_TO_RENDER_INACTIVE));\n if (var != null && !StringUtils.isEmpty(var.getValue())) {\n weekCounter = Integer.parseInt(var.getValue());\n logger.debug(\"using configured inactivity week counter : \" + weekCounter);\n }\n DateRange dateRange = Utils.goBackXWeeks(new Date(), weekCounter);\n //now check if this member has any event logs for him during this period\n List<EventLog> logs = eventService.getEventLogsByMemberandDateRange(member, dateRange);\n logger.debug(\"found \" + logs.size() + \" event logs for \" + member.getFullName());\n\n if (logs.isEmpty())\n return true;\n return false;\n\n }", "public Boolean isPrivado() {\n return privado;\n }", "private void showHelp(CommandSender sender) {\n StringBuilder user = new StringBuilder();\n StringBuilder admin = new StringBuilder();\n\n for (Command cmd : commands.values()) {\n CommandInfo info = cmd.getClass().getAnnotation(CommandInfo.class);\n if(!PermHandler.hasPerm(sender, info.permission())) continue;\n\n StringBuilder buffy;\n if (info.permission().startsWith(\"dar.admin\"))\n buffy = admin;\n else \n buffy = user;\n \n buffy.append(\"\\n\")\n .append(ChatColor.RESET).append(info.usage()).append(\" \")\n .append(ChatColor.YELLOW).append(info.desc());\n }\n\n if (admin.length() == 0) {\n \tMessenger.sendMessage(sender, \"Available Commands: \"+user.toString());\n } else {\n \tMessenger.sendMessage(sender, \"User Commands: \"+user.toString());\n \tMessenger.sendMessage(sender, \"Admin Commands: \"+admin.toString());\n }\n }", "@Override\r\n public void isLeader() {\n }", "@Override\n\tpublic boolean unfollowUser(Long us_id) {\n\t\treturn false;\n\t}", "protected boolean isValid(AccessUser obj)\n {\n return obj != null && obj.username != null && !getMembers().contains(obj);\n }", "String getResponsible();", "network.message.PlayerResponses.Command getCommand();", "public String getWhoseTurnDesc() {\n if (gameStatus == null || userId == null) return \"\";\n return userId.equals(gameStatus.getActivePlayer()) ? \"MY TURN\" : \"OPPONENT'S TURN\";\n }", "boolean hasChatType();", "@PermitAll\n public void cmdWho(User teller) {\n Formatter msg = new Formatter();\n Collection<Player> playersOnline = tournamentService.findOnlinePlayers();\n for (Player player : playersOnline) {\n msg.format(\" %s \\\\n\", player);\n }\n command.qtell(teller, msg);\n }", "boolean hasReply();", "void bot_check_on_user() { // using Watson Speech-to-Text and text-to-Speech functions\r\n String output;\r\n String input;\r\n output: \"Are you okay?\";\r\n input = get voice input;\r\n if (input = \"Yes I’m okay.\") {} // nothing to do\r\n else if (input = \"A bit unwell.\") {\r\n output = \"Please list your symptoms.\";\r\n String symptoms;\r\n symptoms = get voice input;\r\n CFR_check(symptoms);\r\n }\r\n else if (input = …(no sound)) {\r\n CFR_check(\"No response, might be unconscious.\");\r\n else output : \"Please repeat.\";\r\n }", "private static PluginMessageRecipient getThroughWhomSendMessage() {\n\t\treturn Remain.getOnlinePlayers().isEmpty() ? Bukkit.getServer() : Remain.getOnlinePlayers().iterator().next();\n\t}", "@Override\n public boolean shouldExecute(Guild guild, User author, MessageChannel channel, String message) {\n if (guild == null && author.getId().equals(Owner.USER)) {\n if (message.split(\" \").length != 2) {\n return false;\n }\n\n return (message.toLowerCase().startsWith(\"leave\"));\n }\n\n return false;\n }", "private void handleResponseNotOwner(Friends friends) {\n Log.d(DEBUG, \"friends: \" + friends.getFirstName() + friends.getLastName() + friends.getEmail());\n // debug only, can set invisible if needed\n pendingFriendList.add(friends);\n // NEED to notify the adapter that data has been changed!\n mAdapter.notifyDataSetChanged();\n }", "boolean isSetWhoOwnsWhom();", "@Test\n void testGetRegistrarForUser_notInContacts_isAdmin_notReal() throws Exception {\n expectGetRegistrarSuccess(\n OTE_CLIENT_ID_WITHOUT_CONTACT,\n GAE_ADMIN,\n \"admin [email protected] has [OWNER, ADMIN] access to registrar OteRegistrar.\");\n verifyNoInteractions(lazyGroupsConnection);\n }", "private boolean userNotAlreadyFollowing(String url) {\n mStatusTextView.setText(\"\");\n\n if (WearFeedEntry.isFollowingUrl(url)) {\n mStatusTextView.setText(getActivity().getString(R.string.already_following_feed));\n return false;\n }\n\n return true;\n }", "@Override\n public void logic() throws PogamutException {\n /*\n * Step:\n * 1. find the bot and approach him (get near him ... distance < 200)\n * 2. greet him by saying \"Hello!\"\n * 3. upon receiving reply \"Hello, my friend!\"\n * 4. answer \"I'm not your friend.\"\n * 5. and fire a bit at CheckerBot (do not kill him, just a few bullets)\n * 6. then CheckerBot should tell you \"COOL!\"\n * 7. then CheckerBot respawns itself\n * 8. repeat 1-6 until CheckerBot replies with \"EXERCISE FINISHED\"\n */\n Location loc = new Location(0, 0, 0);\n weaponry.changeWeapon(UT2004ItemType.ASSAULT_RIFLE);\n switch (state) {\n case 0: // navigate to random point\n if (!navigation.isNavigating())\n navigation.navigate(this.navPoints.getRandomNavPoint());\n if (players.canSeePlayers()) {\n loc = players.getNearestVisiblePlayer().getLocation();\n navigation.navigate(loc);\n log.info(\"Bot see player on \" + loc.toString());\n }\n if (loc.getDistance(bot.getLocation()) < 190) {\n navigation.stopNavigation();\n log.info(\"Bot is close enough\");\n state = 1;\n }\n if (congrats_receive) {\n log.info(\"Received info about success\");\n state = 7;\n }\n break;\n case 1: // nearby player\n this.sayGlobal(\"Hello!\");\n resetTimeout();\n state = 2;\n break;\n case 2: //waiting for answer\n tickTimeout();\n if (received.equals(\"Hello, my friend!\")) {\n log.info(\"Answer received\");\n state = 3;\n }\n else if (receiveTimeout) {\n log.warning(\"Answer didn't received, repeating.\");\n navigation.navigate(navPoints.getRandomNavPoint());\n state = 0;\n }\n break;\n case 3: // say back\n this.sayGlobal(\"I'm not your friend.\");\n state = 4;\n break;\n case 4:\n if (players.getNearestVisiblePlayer() == null) {\n log.warning(\"Resetting because no player in view\");\n state = 0;\n } else {\n shoot.shoot(players.getNearestVisiblePlayer());\n log.info(\"Start shooting at the enemy\");\n resetTimeout();\n state = 5;\n }\n break;\n case 5:\n tickTimeout();\n if (damaged) {\n shoot.stopShooting();\n damaged = false;\n resetTimeout();\n log.info(\"Enemy damaged\");\n state = 6;\n } else if (receiveTimeout) {\n log.warning(\"Resetting because not damage to the enemy\");\n state = 0;\n }\n break;\n case 6:\n tickTimeout();\n if (cool_received){\n log.info(\"Success in the turn, repeating\");\n cool_received = false;\n resetTimeout();\n state = 0;\n }\n else if(receiveTimeout) {\n log.warning(\"No final answer, repeating\");\n state = 0;\n }\n break;\n case 7:\n sayGlobal(\"I solved the exercise.\");\n }\n }", "void onPrivMsg(TwitchUser sender, TwitchMessage message);", "KingdomUser getUser(Player p);", "private boolean amIleader() {\n \t\treturn vs.getRank(myEndpt) == 0;\n \t}", "private void find_userand_sendnotifaction() {\r\n FirebaseDatabase.getInstance().getReference().child(DataManager.NotifactionUserRoot).child(FirebaseAuth.getInstance().getCurrentUser().getUid())\r\n .addValueEventListener(new ValueEventListener() {\r\n @Override\r\n public void onDataChange(DataSnapshot dataSnapshot) {\r\n if (dataSnapshot.exists()) {\r\n if (dataSnapshot.hasChild(DataManager.UserFullname)) {\r\n String name = dataSnapshot.child(DataManager.UserFullname).getValue().toString();\r\n if (!name.isEmpty()) {\r\n send_notfaction(name);\r\n\r\n\r\n }\r\n }\r\n }\r\n }\r\n\r\n @Override\r\n public void onCancelled(DatabaseError databaseError) {\r\n\r\n }\r\n });\r\n }", "public boolean hasFollowUp() \n {\n return followUp.equals(Constants.CLOSE);\n }", "@Override\n\tpublic boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {\n\n\t\tboolean playerCanDo = false;\n\t\tboolean isConsole = false;\n\t\tPlayer senderPlayer = null, targetPlayer = null;\n\t\tGroup senderGroup = null;\n\t\tUser senderUser = null;\n\t\tboolean isOpOverride = config.isOpOverride();\n\t\tboolean isAllowCommandBlocks = config.isAllowCommandBlocks();\n\t\t\n\t\t// PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS\n\t\tif (sender instanceof BlockCommandSender && !isAllowCommandBlocks) {\n\t\t\tBlock block = ((BlockCommandSender)sender).getBlock();\n\t\t\tGroupManager.logger.warning(ChatColor.RED + \"GM Commands can not be called from CommandBlocks\");\n\t\t\tGroupManager.logger.warning(ChatColor.RED + \"Location: \" + ChatColor.GREEN + block.getWorld().getName() + \", \" + block.getX() + \", \" + block.getY() + \", \" + block.getZ());\n\t\t \treturn true;\n\t\t}\n\n\t\t// DETERMINING PLAYER INFORMATION\n\t\tif (sender instanceof Player) {\n\t\t\tsenderPlayer = (Player) sender;\n\n\t\t\tif (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase(\"manload\")) {\n\t\t\t\tsender.sendMessage(ChatColor.RED + \"All commands are locked due to an error. \" + ChatColor.BOLD + \"\" + ChatColor.UNDERLINE + \"Check plugins/groupmanager/error.log or console\" + ChatColor.RESET + \"\" + ChatColor.RED + \" and then try a '/manload'.\");\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tsenderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getUniqueId().toString());\n\t\t\tsenderGroup = senderUser.getGroup();\n\t\t\tisOpOverride = (isOpOverride && (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, \"groupmanager.op\")));\n\n\t\t\tif (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, \"groupmanager.\" + cmd.getName())) {\n\t\t\t\tplayerCanDo = true;\n\t\t\t}\n\t\t} else {\n\n\t\t\tif (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase(\"manload\")) {\n\t\t\t\tsender.sendMessage(ChatColor.RED + \"All commands are locked due to an error. \" + ChatColor.BOLD + \"\" + ChatColor.UNDERLINE + \"Check plugins/groupmanager/error.log or console\" + ChatColor.RESET + \"\" + ChatColor.RED + \" and then try a '/manload'.\");\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tisConsole = true;\n\t\t}\n\n\t\t// PERMISSIONS FOR COMMAND BEING LOADED\n\t\tdataHolder = null;\n\t\tpermissionHandler = null;\n\n\t\tif (senderPlayer != null) {\n\t\t\tdataHolder = worldsHolder.getWorldData(senderPlayer);\n\t\t}\n\n\t\tString selectedWorld = selectedWorlds.get(sender.getName());\n\t\tif (selectedWorld != null) {\n\t\t\tdataHolder = worldsHolder.getWorldData(selectedWorld);\n\t\t}\n\n\t\tif (dataHolder != null) {\n\t\t\tpermissionHandler = dataHolder.getPermissionsHandler();\n\t\t}\n\n\t\t// VARIABLES USED IN COMMANDS\n\n\t\tint count;\n\t\tPermissionCheckResult permissionResult = null;\n\t\tArrayList<User> removeList = null;\n\t\tString auxString = null;\n\t\tList<String> match = null;\n\t\tUser auxUser = null;\n\t\tGroup auxGroup = null;\n\t\tGroup auxGroup2 = null;\n\n\t\tGroupManagerPermissions execCmd = null;\n\t\ttry {\n\t\t\texecCmd = GroupManagerPermissions.valueOf(cmd.getName());\n\t\t} catch (Exception e) {\n\t\t\t// this error happened once with someone. now im prepared... i think\n\t\t\tGroupManager.logger.severe(\"===================================================\");\n\t\t\tGroupManager.logger.severe(\"= ERROR REPORT START =\");\n\t\t\tGroupManager.logger.severe(\"===================================================\");\n\t\t\tGroupManager.logger.severe(\"= COPY AND PASTE THIS TO A GROUPMANAGER DEVELOPER =\");\n\t\t\tGroupManager.logger.severe(\"===================================================\");\n\t\t\tGroupManager.logger.severe(this.getDescription().getName());\n\t\t\tGroupManager.logger.severe(this.getDescription().getVersion());\n\t\t\tGroupManager.logger.severe(\"An error occured while trying to execute command:\");\n\t\t\tGroupManager.logger.severe(cmd.getName());\n\t\t\tGroupManager.logger.severe(\"With \" + args.length + \" arguments:\");\n\t\t\tfor (String ar : args) {\n\t\t\t\tGroupManager.logger.severe(ar);\n\t\t\t}\n\t\t\tGroupManager.logger.severe(\"The field '\" + cmd.getName() + \"' was not found in enum.\");\n\t\t\tGroupManager.logger.severe(\"And could not be parsed.\");\n\t\t\tGroupManager.logger.severe(\"FIELDS FOUND IN ENUM:\");\n\t\t\tfor (GroupManagerPermissions val : GroupManagerPermissions.values()) {\n\t\t\t\tGroupManager.logger.severe(val.name());\n\t\t\t}\n\t\t\tGroupManager.logger.severe(\"===================================================\");\n\t\t\tGroupManager.logger.severe(\"= ERROR REPORT ENDED =\");\n\t\t\tGroupManager.logger.severe(\"===================================================\");\n\t\t\tsender.sendMessage(\"An error occurred. Ask the admin to take a look at the console.\");\n\t\t}\n\n\t\tif (isConsole || playerCanDo) {\n\t\t\tswitch (execCmd) {\n\t\t\tcase manuadd:\n\n\t\t\t\t// Validating arguments\n\t\t\t\tif ((args.length != 2) && (args.length != 3)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manuadd <player> <group> | optional [world])\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Select the relevant world (if specified)\n\t\t\t\tif (args.length == 3) {\n\t\t\t\t\tdataHolder = worldsHolder.getWorldData(args[2]);\n\t\t\t\t\tpermissionHandler = dataHolder.getPermissionsHandler();\n\t\t\t\t}\n\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Players may not be members of GlobalGroups directly.\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Validating permissions\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Can't modify a player with the same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The destination group can't be the same as yours, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player involving a group that you don't inherit.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Seems OK\n\t\t\t\tauxUser.setGroup(auxGroup);\n\t\t\t\tif (!sender.hasPermission(\"groupmanager.notify.other\") || (isConsole))\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You changed player '\" + auxUser.getLastName() + \"' group to '\" + auxGroup.getName() + \"' in world '\" + dataHolder.getName() + \"'.\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase manudel:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manudel <player>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tdataHolder.removeUser(auxUser.getUUID());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You changed player '\" + auxUser.getLastName() + \"' to default settings.\");\n\n\t\t\t\t// If the player is online, this will create new data for the user.\n\t\t\t\tif(auxUser.getUUID() != null) {\n\t\t\t\t\ttargetPlayer = this.getServer().getPlayer(UUID.fromString(auxUser.getUUID()));\n\t\t\t\t\tif (targetPlayer != null)\n\t\t\t\t\t\tBukkitPermissions.updatePermissions(targetPlayer);\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase manuaddsub:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Couldn't retrieve your world. World selection is needed.\");\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Use /manselect <world>\");\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manuaddsub <player> <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The sub-group can't be the same as yours, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player involving a group that you don't inherit.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tif (auxUser.addSubGroup(auxGroup))\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You added subgroup '\" + auxGroup.getName() + \"' to player '\" + auxUser.getLastName() + \"'.\");\n\t\t\t\telse\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The subgroup '\" + auxGroup.getName() + \"' is already available to '\" + auxUser.getLastName() + \"'.\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase manudelsub:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manudelsub <user> <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxUser.removeSubGroup(auxGroup);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You removed subgroup '\" + auxGroup.getName() + \"' from player '\" + auxUser.getLastName() + \"' list.\");\n\n\t\t\t\t// targetPlayer = this.getServer().getPlayer(auxUser.getName());\n\t\t\t\t// if (targetPlayer != null)\n\t\t\t\t// BukkitPermissions.updatePermissions(targetPlayer);\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangadd:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangadd <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup != null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group already exists!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxGroup = dataHolder.createGroup(args[0]);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You created a group named: \" + auxGroup.getName());\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangdel:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangdel <group>)\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tdataHolder.removeGroup(auxGroup.getName());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You deleted a group named \" + auxGroup.getName() + \", it's users are default group now.\");\n\n\t\t\t\tBukkitPermissions.updateAllPlayers();\n\n\t\t\t\treturn true;\n\n\t\t\tcase manuaddp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length < 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manuaddp <player> <permission> [permission2] [permission3]...)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Validating your permissions\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Can't modify player with same group than you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (int i = 1; i < args.length; i++)\n\t\t\t\t{\n\t\t\t\t\tauxString = args[i].replace(\"'\", \"\");\n\t\t\t\t\n\t\t\t\t\tpermissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString);\n\t\t\t\t\tif (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't add a permission you don't have: '\" + auxString + \"'\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Validating permissions of user\n\t\t\t\t\tpermissionResult = permissionHandler.checkUserOnlyPermission(auxUser, auxString);\n\t\t\t\t\tif (checkPermissionExists(sender, auxString, permissionResult, \"user\")) \n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Seems Ok\n\t\t\t\t\tauxUser.addPermission(auxString);\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You added '\" + auxString + \"' to player '\" + auxUser.getLastName() + \"' permissions.\");\n\t\t\t\t}\n\n\n\t\t\t\ttargetPlayer = this.getServer().getPlayer(auxUser.getLastName());\n\t\t\t\tif (targetPlayer != null)\n\t\t\t\t\tBukkitPermissions.updatePermissions(targetPlayer);\n\n\t\t\t\treturn true;\n\n\t\t\tcase manudelp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length < 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manudelp <player> <permission> [permission2] [permission3]...)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (int i = 1; i < args.length; i++)\n\t\t\t\t{\n\t\t\t\t\tauxString = args[i].replace(\"'\", \"\");\n\t\t\t\t\n\t\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same group as you, or higher.\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Validating your permissions\n\t\t\t\t\tpermissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString);\n\t\t\t\t\tif (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't remove a permission you don't have: '\" + auxString + \"'\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Validating permissions of user\n\t\t\t\t\tpermissionResult = permissionHandler.checkUserOnlyPermission(auxUser, auxString);\n\t\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The user doesn't have direct access to that permission: '\" + auxString + \"'\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!auxUser.hasSamePermissionNode(auxString)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"This permission node doesn't match any node.\");\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"But might match node: \" + permissionResult.accessLevel);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tauxUser.removePermission(auxString);\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You removed '\" + auxString + \"' from player '\" + auxUser.getLastName() + \"' permissions.\");\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\n\t\t\t\ttargetPlayer = this.getServer().getPlayer(auxUser.getLastName());\n\t\t\t\tif (targetPlayer != null)\n\t\t\t\t\tBukkitPermissions.updatePermissions(targetPlayer);\n\n\t\t\t\treturn true;\n\t\t\t\t\n\t\t\tcase manuclearp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manuclearp <player>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating your permissions\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same group as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tfor (String perm : auxUser.getPermissionList()) {\n\t\t\t\t\tpermissionResult = permissionHandler.checkFullUserPermission(senderUser, perm);\n\t\t\t\t\tif (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't remove a permission you don't have: '\" + perm + \"'.\");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tauxUser.removePermission(perm);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You removed all permissions from player '\" + auxUser.getLastName() + \"'.\");\n\n\t\t\t\ttargetPlayer = this.getServer().getPlayer(auxUser.getLastName());\n\t\t\t\tif (targetPlayer != null)\n\t\t\t\t\tBukkitPermissions.updatePermissions(targetPlayer);\n\n\t\t\t\treturn true;\n\n\t\t\tcase manulistp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif ((args.length == 0) || (args.length > 2)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manulistp <player> (+))\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\t// Seems OK\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (String perm : auxUser.getPermissionList()) {\n\t\t\t\t\tauxString += perm + \", \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The player '\" + auxUser.getLastName() + \"' has following permissions: \" + ChatColor.WHITE + auxString);\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"And all permissions from group: \" + auxUser.getGroupName());\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (String subGroup : auxUser.subGroupListStringCopy()) {\n\t\t\t\t\t\tauxString += subGroup + \", \";\n\t\t\t\t\t}\n\t\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"And all permissions from subgroups: \" + auxString);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The player '\" + auxUser.getLastName() + \"' has no specific permissions.\");\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Only all permissions from group: \" + auxUser.getGroupName());\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (String subGroup : auxUser.subGroupListStringCopy()) {\n\t\t\t\t\t\tauxString += subGroup + \", \";\n\t\t\t\t\t}\n\t\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"And all permissions from subgroups: \" + auxString);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// bukkit perms\n\t\t\t\tif ((args.length == 2) && (args[1].equalsIgnoreCase(\"+\"))) {\n\t\t\t\t\ttargetPlayer = this.getServer().getPlayer(auxUser.getLastName());\n\t\t\t\t\tif (targetPlayer != null) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Superperms reports: \");\n\t\t\t\t\t\tfor (String line : BukkitPermissions.listPerms(targetPlayer))\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + line);\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase manucheckp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manucheckp <player> <permission>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxString = args[1].replace(\"'\", \"\");\n\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\ttargetPlayer = this.getServer().getPlayer(auxUser.getLastName());\n\t\t\t\t// Validating permission\n\t\t\t\tpermissionResult = permissionHandler.checkFullGMPermission(auxUser, auxString, false);\n\n\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {\n\t\t\t\t\t// No permissions found in GM so fall through and check Bukkit.\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The player doesn't have access to that permission\");\n\n\t\t\t\t} else {\n\t\t\t\t\t// This permission was found in groupmanager.\n\t\t\t\t\tif (permissionResult.owner instanceof User) {\n\t\t\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user has directly a negation node for that permission.\");\n\t\t\t\t\t\t} else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user has directly an Exception node for that permission.\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user has directly this permission.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Permission Node: \" + permissionResult.accessLevel);\n\t\t\t\t\t} else if (permissionResult.owner instanceof Group) {\n\t\t\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user inherits a negation permission from group: \" + permissionResult.owner.getLastName());\n\t\t\t\t\t\t} else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user inherits an Exception permission from group: \" + permissionResult.owner.getLastName());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user inherits the permission from group: \" + permissionResult.owner.getLastName());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Permission Node: \" + permissionResult.accessLevel);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// superperms\n\t\t\t\tif (targetPlayer != null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"SuperPerms reports Node: \" + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? \" (Negated)\": \"\"));\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangaddp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length < 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangaddp <group> <permission> [permission2] [permission3]...)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (int i = 1; i < args.length; i++)\n\t\t\t\t{\n\t\t\t\t\tauxString = args[i].replace(\"'\", \"\");\n\t\t\t\t\n\t\t\t\t\t// Validating your permissions\n\t\t\t\t\tpermissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString);\n\t\t\t\t\tif (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't add a permission you don't have: '\" + auxString + \"'\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Validating permissions of user\n\t\t\t\t\tpermissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString);\n\t\t\t\t\tif (checkPermissionExists(sender, auxString, permissionResult, \"group\")) \n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Seems OK\n\t\t\t\t\tauxGroup.addPermission(auxString);\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You added '\" + auxString + \"' to group '\" + auxGroup.getName() + \"' permissions.\");\n\t\t\t\t}\n\n\t\t\t\tBukkitPermissions.updateAllPlayers();\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangdelp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length < 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangdelp <group> <permission> [permission2] [permission3]...)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tfor (int i = 1; i < args.length; i++)\n\t\t\t\t{\n\t\t\t\t\tauxString = args[i].replace(\"'\", \"\");\n\t\t\t\t\n\t\t\t\t\t// Validating your permissions\n\t\t\t\t\tpermissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString);\n\t\t\t\t\tif (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Can't remove a permission you don't have: '\" + auxString + \"'\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Validating permissions of user\n\t\t\t\t\tpermissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString);\n\t\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group doesn't have direct access to that permission: '\" + auxString + \"'\");\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!auxGroup.hasSamePermissionNode(auxString)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"This permission node doesn't match any node.\");\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"But might match node: \" + permissionResult.accessLevel);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// Seems OK\n\t\t\t\t\tauxGroup.removePermission(auxString);\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You removed '\" + auxString + \"' from group '\" + auxGroup.getName() + \"' permissions.\");\n\t\t\t\t}\n\n\t\t\t\tBukkitPermissions.updateAllPlayers();\n\n\t\t\t\treturn true;\n\t\t\t\t\n\t\t\tcase mangclearp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangclearp <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (String perm : auxGroup.getPermissionList()) {\n\t\t\t\t\tpermissionResult = permissionHandler.checkFullUserPermission(senderUser, perm);\n\t\t\t\t\tif (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Can't remove a permission you don't have: '\" + perm + \"'.\");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tauxGroup.removePermission(perm);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You removed all permissions from group '\" + auxGroup.getName() + \"'.\");\n\n\t\t\t\tBukkitPermissions.updateAllPlayers();\n\n\t\t\t\treturn true;\n\n\t\t\tcase manglistp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manglistp <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\n\t\t\t\t// Seems OK\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (String perm : auxGroup.getPermissionList()) {\n\t\t\t\t\tauxString += perm + \", \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group '\" + auxGroup.getName() + \"' has following permissions: \" + ChatColor.WHITE + auxString);\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (String grp : auxGroup.getInherits()) {\n\t\t\t\t\t\tauxString += grp + \", \";\n\t\t\t\t\t}\n\t\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"And all permissions from groups: \" + auxString);\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group '\" + auxGroup.getName() + \"' has no specific permissions.\");\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (String grp : auxGroup.getInherits()) {\n\t\t\t\t\t\tauxString += grp + \", \";\n\t\t\t\t\t}\n\t\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Only all permissions from groups: \" + auxString);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\treturn true;\n\n\t\t\tcase mangcheckp:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangcheckp <group> <permission>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxString = args[1];\n\t\t\t\tif (auxString.startsWith(\"'\") && auxString.endsWith(\"'\"))\n\t\t\t\t{\n\t\t\t\t\tauxString = auxString.substring(1, auxString.length() - 1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tpermissionResult = permissionHandler.checkGroupPermissionWithInheritance(auxGroup, auxString);\n\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group doesn't have access to that permission\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\t// auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]);\n\t\t\t\tif (permissionResult.owner instanceof Group) {\n\t\t\t\t\tif (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group inherits the negation permission from group: \" + permissionResult.owner.getLastName());\n\t\t\t\t\t} else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group inherits an Exception permission from group: \" + permissionResult.owner.getLastName());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The group inherits the permission from group: \" + permissionResult.owner.getLastName());\n\t\t\t\t\t}\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Permission Node: \" + permissionResult.accessLevel);\n\n\t\t\t\t}\n\t\t\t\treturn true;\n\n\t\t\tcase mangaddi:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangaddi <group1> <group2>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup2 = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup2 == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"GlobalGroups do NOT support inheritance.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Validating permission\n\t\t\t\tif (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Group \" + auxGroup.getName() + \" already inherits \" + auxGroup2.getName() + \" (might not be directly)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxGroup.addInherits(auxGroup2);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Group \" + auxGroup2.getName() + \" is now in \" + auxGroup.getName() + \" inheritance list.\");\n\n\t\t\t\tBukkitPermissions.updateAllPlayers();\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangdeli:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangdeli <group1> <group2>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup2 = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup2 == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"GlobalGroups do NOT support inheritance.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Validating permission\n\t\t\t\tif (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Group \" + auxGroup.getName() + \" does not inherit \" + auxGroup2.getName() + \".\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!auxGroup.getInherits().contains(auxGroup2.getName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Group \" + auxGroup.getName() + \" does not inherit \" + auxGroup2.getName() + \" directly.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxGroup.removeInherits(auxGroup2.getName());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Group \" + auxGroup2.getName() + \" was removed from \" + auxGroup.getName() + \" inheritance list.\");\n\n\t\t\t\tBukkitPermissions.updateAllPlayers();\n\n\t\t\t\treturn true;\n\n\t\t\tcase manuaddv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length < 3) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manuaddv <user> <variable> <value>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\t// Seems OK\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (int i = 2; i < args.length; i++) {\n\t\t\t\t\tauxString += args[i];\n\t\t\t\t\tif ((i + 1) < args.length) {\n\t\t\t\t\t\tauxString += \" \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tauxString = auxString.replace(\"'\", \"\");\n\t\t\t\tauxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString));\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Variable \" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \":'\" + ChatColor.GREEN + auxString + ChatColor.YELLOW + \"' added to the user \" + auxUser.getLastName());\n\n\t\t\t\treturn true;\n\n\t\t\tcase manudelv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manudelv <user> <variable>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!auxUser.getVariables().hasVar(args[1])) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The user doesn't have directly that variable!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxUser.getVariables().removeVar(args[1]);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Variable \" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \" removed from the user \" + ChatColor.GREEN + auxUser.getLastName());\n\n\t\t\t\treturn true;\n\n\t\t\tcase manulistv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manulistv <user>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\t// Seems OK\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (String varKey : auxUser.getVariables().getVarKeyList()) {\n\t\t\t\t\tObject o = auxUser.getVariables().getVarObject(varKey);\n\t\t\t\t\tauxString += ChatColor.GOLD + varKey + ChatColor.WHITE + \":'\" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + \"', \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Variables of user \" + auxUser.getLastName() + \": \");\n\t\t\t\tsender.sendMessage(auxString + \".\");\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Plus all variables from group: \" + auxUser.getGroupName());\n\n\t\t\t\treturn true;\n\n\t\t\tcase manucheckv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manucheckv <user> <variable>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tauxGroup = auxUser.getGroup();\n\t\t\t\tauxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);\n\n\t\t\t\tif (!auxUser.getVariables().hasVar(args[1])) {\n\t\t\t\t\t// Check sub groups\n\t\t\t\t\tif (!auxUser.isSubGroupsEmpty() && auxGroup2 == null)\n\t\t\t\t\t\tfor (Group subGroup : auxUser.subGroupListCopy()) {\n\t\t\t\t\t\t\tauxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]);\n\t\t\t\t\t\t\tif (auxGroup2 != null)\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\tif (auxGroup2 == null) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The user doesn't have access to that variable!\");\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tif (auxUser.getVariables().hasVar(auxString)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The value of variable '\" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \"' is: '\" + ChatColor.GREEN + auxUser.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + \"'\");\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"This user own directly the variable\");\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The value of variable '\" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \"' is: '\" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + \"'\");\n\t\t\t\tif (!auxGroup.equals(auxGroup2)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"And the value was inherited from group: \" + ChatColor.GREEN + auxGroup2.getName());\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangaddv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length < 3) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangaddv <group> <variable> <value>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"GlobalGroups do NOT support Info Nodes.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\t// Seems OK\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (int i = 2; i < args.length; i++) {\n\t\t\t\t\tauxString += args[i];\n\t\t\t\t\tif ((i + 1) < args.length) {\n\t\t\t\t\t\tauxString += \" \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxString = auxString.replace(\"'\", \"\");\n\t\t\t\tauxGroup.getVariables().addVar(args[1], Variables.parseVariableValue(auxString));\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Variable \" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \":'\" + ChatColor.GREEN + auxString + ChatColor.YELLOW + \"' added to the group \" + auxGroup.getName());\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangdelv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangdelv <group> <variable>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"GlobalGroups do NOT support Info Nodes.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!auxGroup.getVariables().hasVar(args[1])) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The group doesn't have directly that variable!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxGroup.getVariables().removeVar(args[1]);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Variable \" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \" removed from the group \" + ChatColor.GREEN + auxGroup.getName());\n\n\t\t\t\treturn true;\n\n\t\t\tcase manglistv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manglistv <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"GlobalGroups do NOT support Info Nodes.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\t// Seems OK\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (String varKey : auxGroup.getVariables().getVarKeyList()) {\n\t\t\t\t\tObject o = auxGroup.getVariables().getVarObject(varKey);\n\t\t\t\t\tauxString += ChatColor.GOLD + varKey + ChatColor.WHITE + \":'\" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + \"', \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Variables of group \" + auxGroup.getName() + \": \");\n\t\t\t\tsender.sendMessage(auxString + \".\");\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (String grp : auxGroup.getInherits()) {\n\t\t\t\t\tauxString += grp + \", \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Plus all variables from groups: \" + auxString);\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase mangcheckv:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mangcheckv <group> <variable>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[0]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[0] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"GlobalGroups do NOT support Info Nodes.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tauxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);\n\t\t\t\tif (auxGroup2 == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The group doesn't have access to that variable!\");\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The value of variable '\" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + \"' is: '\" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + \"'\");\n\t\t\t\tif (!auxGroup.equals(auxGroup2)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"And the value was inherited from group: \" + ChatColor.GREEN + auxGroup2.getName());\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase manwhois:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manwhois <player>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Name: \" + ChatColor.GREEN + auxUser.getLastName());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Group: \" + ChatColor.GREEN + auxUser.getGroup().getName());\n\t\t\t\t// Compile a list of subgroups\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (String subGroup : auxUser.subGroupListStringCopy()) {\n\t\t\t\t\tauxString += subGroup + \", \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"subgroups: \" + auxString);\n\t\t\t\t}\n\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Overloaded: \" + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getUUID()));\n\t\t\t\tauxGroup = dataHolder.surpassOverload(auxUser.getUUID()).getGroup();\n\t\t\t\tif (!auxGroup.equals(auxUser.getGroup())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Original Group: \" + ChatColor.GREEN + auxGroup.getName());\n\t\t\t\t}\n\t\t\t\t// victim.permissions.add(args[1]);\n\t\t\t\treturn true;\n\n\t\t\tcase tempadd:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/tempadd <player>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Can't modify player with same permissions than you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tif (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {\n\t\t\t\t\toverloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());\n\t\t\t\t}\n\t\t\t\tdataHolder.overloadUser(auxUser.getUUID());\n\t\t\t\toverloadedUsers.get(dataHolder.getName().toLowerCase()).add(dataHolder.getUser(auxUser.getUUID()));\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Player set to overload mode!\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase tempdel:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/tempdel <player>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tif (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {\n\t\t\t\t\toverloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());\n\t\t\t\t}\n\t\t\t\tdataHolder.removeOverload(auxUser.getUUID());\n\t\t\t\tif (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) {\n\t\t\t\t\toverloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser);\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Player overload mode is now disabled.\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase templist:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// WORKING\n\t\t\t\tauxString = \"\";\n\t\t\t\tremoveList = new ArrayList<User>();\n\t\t\t\tcount = 0;\n\t\t\t\tfor (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) {\n\t\t\t\t\tif (!dataHolder.isOverloaded(u.getUUID())) {\n\t\t\t\t\t\tremoveList.add(u);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tauxString += u.getLastName() + \", \";\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (count == 0) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"There are no users in overload mode.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\tif (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {\n\t\t\t\t\toverloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());\n\t\t\t\t}\n\t\t\t\toverloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \" \" + count + \" Users in overload mode: \" + ChatColor.WHITE + auxString);\n\n\t\t\t\treturn true;\n\n\t\t\tcase tempdelall:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// WORKING\n\t\t\t\tremoveList = new ArrayList<User>();\n\t\t\t\tcount = 0;\n\t\t\t\tfor (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) {\n\t\t\t\t\tif (dataHolder.isOverloaded(u.getUUID())) {\n\t\t\t\t\t\tdataHolder.removeOverload(u.getUUID());\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (count == 0) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"There are no users in overload mode.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) {\n\t\t\t\t\toverloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>());\n\t\t\t\t}\n\t\t\t\toverloadedUsers.get(dataHolder.getName().toLowerCase()).clear();\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \" \" + count + \"All users in overload mode are now normal again.\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase mansave:\n\n\t\t\t\tboolean forced = false;\n\n\t\t\t\tif ((args.length == 1) && (args[0].equalsIgnoreCase(\"force\")))\n\t\t\t\t\tforced = true;\n\n\t\t\t\ttry {\n\t\t\t\t\tworldsHolder.saveChanges(forced);\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"All changes were saved.\");\n\t\t\t\t} catch (IllegalStateException ex) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + ex.getMessage());\n\t\t\t\t}\n\t\t\t\treturn true;\n\n\t\t\tcase manload:\n\n\t\t\t\t/**\n\t\t\t\t * Attempt to reload a specific world\n\t\t\t\t */\n\t\t\t\tif (args.length > 0) {\n\n\t\t\t\t\tif (!lastError.isEmpty()) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"All commands are locked due to an error. \" + ChatColor.BOLD + \"\" + ChatColor.UNDERLINE + \"Check plugins/groupmanager/error.log or console\" + ChatColor.RESET + \"\" + ChatColor.RED + \" and then try a '/manload'.\");\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (int i = 0; i < args.length; i++) {\n\t\t\t\t\t\tauxString += args[i];\n\t\t\t\t\t\tif ((i + 1) < args.length) {\n\t\t\t\t\t\t\tauxString += \" \";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tisLoaded = false; // Disable Bukkit Perms update and event triggers\n\n\t\t\t\t\tglobalGroups.load();\n\t\t\t\t\tworldsHolder.loadWorld(auxString);\n\n\t\t\t\t\tsender.sendMessage(\"The request to reload world '\" + auxString + \"' was attempted.\");\n\n\t\t\t\t\tisLoaded = true;\n\n\t\t\t\t\tBukkitPermissions.reset();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Reload all settings and data as no world was specified.\n\t\t\t\t\t */\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Attempting a fresh load.\n\t\t\t\t\t */\n\t\t\t\t\tonDisable(true);\n\t\t\t\t\tonEnable(true);\n\n\t\t\t\t\tsender.sendMessage(\"All settings and worlds were reloaded!\");\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Fire an event as none will have been triggered in the reload.\n\t\t\t\t */\n\t\t\t\tif (GroupManager.isLoaded())\n\t\t\t\t\tGroupManager.getGMEventHandler().callEvent(GMSystemEvent.Action.RELOADED);\n\n\t\t\t\treturn true;\n\n\t\t\tcase listgroups:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// WORKING\n\t\t\t\tauxString = \"\";\n\t\t\t\tString auxString2 = \"\";\n\t\t\t\tfor (Group g : dataHolder.getGroupList()) {\n\t\t\t\t\tauxString += g.getName() + \", \";\n\t\t\t\t}\n\t\t\t\tfor (Group g : getGlobalGroups().getGroupList()) {\n\t\t\t\t\tauxString2 += g.getName() + \", \";\n\t\t\t\t}\n\t\t\t\tif (auxString.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString = auxString.substring(0, auxString.lastIndexOf(\",\"));\n\t\t\t\t}\n\t\t\t\tif (auxString2.lastIndexOf(\",\") > 0) {\n\t\t\t\t\tauxString2 = auxString2.substring(0, auxString2.lastIndexOf(\",\"));\n\t\t\t\t}\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Groups Available: \" + ChatColor.WHITE + auxString);\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"GlobalGroups Available: \" + ChatColor.WHITE + auxString2);\n\n\t\t\t\treturn true;\n\n\t\t\tcase manpromote:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manpromote <player> <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Players may not be members of GlobalGroups directly.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The destination group can't be the same as yours, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player involving a group that you don't inherit.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player using groups with different heritage line.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The new group must be a higher rank.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxUser.setGroup(auxGroup);\n\t\t\t\tif (!sender.hasPermission(\"groupmanager.notify.other\") || (isConsole))\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You changed \" + auxUser.getLastName() + \" group to \" + auxGroup.getName() + \".\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase mandemote:\n\t\t\t\t// Validating state of sender\n\t\t\t\tif (dataHolder == null || permissionHandler == null) {\n\t\t\t\t\tif (!setDefaultWorldHandler(sender))\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating arguments\n\t\t\t\tif (args.length != 2) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mandemote <player> <group>)\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (match != null) {\n\t\t\t\t\tauxUser = dataHolder.getUser(match.get(0));\n\t\t\t\t} else {\n\t\t\t\t\tauxUser = dataHolder.getUser(args[0]);\n\t\t\t\t}\n\t\t\t\tauxGroup = dataHolder.getGroup(args[1]);\n\t\t\t\tif (auxGroup == null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"'\" + args[1] + \"' Group doesnt exist!\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (auxGroup.isGlobal()) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Players may not be members of GlobalGroups directly.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Validating permission\n\t\t\t\tif (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player with same permissions as you, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The destination group can't be the same as yours, or higher.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player involving a group that you don't inherit.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"You can't modify a player using groups with different inheritage line.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"The new group must be a lower rank.\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// Seems OK\n\t\t\t\tauxUser.setGroup(auxGroup);\n\t\t\t\tif (!sender.hasPermission(\"groupmanager.notify.other\") || (isConsole))\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You changed \" + auxUser.getLastName() + \" group to \" + auxGroup.getName() + \".\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase mantogglevalidate:\n\t\t\t\tvalidateOnlinePlayer = !validateOnlinePlayer;\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Validate if player is online, now set to: \" + Boolean.toString(validateOnlinePlayer));\n\t\t\t\tif (!validateOnlinePlayer) {\n\t\t\t\t\tsender.sendMessage(ChatColor.GOLD + \"From now on you can edit players that are not connected... BUT:\");\n\t\t\t\t\tsender.sendMessage(ChatColor.LIGHT_PURPLE + \"From now on you should type the whole name of the player, correctly.\");\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\tcase mantogglesave:\n\t\t\t\tif (scheduler == null) {\n\t\t\t\t\tenableScheduler();\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The auto-saving is enabled!\");\n\t\t\t\t} else {\n\t\t\t\t\tdisableScheduler();\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"The auto-saving is disabled!\");\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\tcase manworld:\n\t\t\t\tauxString = selectedWorlds.get(sender.getName());\n\t\t\t\tif (auxString != null) {\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You have the world '\" + dataHolder.getName() + \"' in your selection.\");\n\t\t\t\t} else {\n\t\t\t\t\tif (dataHolder == null) {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"There is no world selected. And no world is available now.\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You don't have a world in your selection..\");\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Working with the direct world where your player is.\");\n\t\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Your world now uses permissions of world name: '\" + dataHolder.getName() + \"' \");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\tcase manselect:\n\t\t\t\tif (args.length < 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/manselect <world>)\");\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Worlds available: \");\n\t\t\t\t\tArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (int i = 0; i < worlds.size(); i++) {\n\t\t\t\t\t\tauxString += worlds.get(i).getName();\n\t\t\t\t\t\tif ((i + 1) < worlds.size()) {\n\t\t\t\t\t\t\tauxString += \", \";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + auxString);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (int i = 0; i < args.length; i++) {\n\t\t\t\t\tif (args[i] == null) {\n\t\t\t\t\t\tlogger.warning(\"Bukkit gave invalid arguments array! Cmd: \" + cmd.getName() + \" args.length: \" + args.length);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tauxString += args[i];\n\t\t\t\t\tif (i < (args.length - 1)) {\n\t\t\t\t\t\tauxString += \" \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdataHolder = worldsHolder.getWorldData(auxString);\n\t\t\t\tpermissionHandler = dataHolder.getPermissionsHandler();\n\t\t\t\tselectedWorlds.put(sender.getName(), dataHolder.getName());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You have selected world '\" + dataHolder.getName() + \"'.\");\n\n\t\t\t\treturn true;\n\n\t\t\tcase manclear:\n\t\t\t\tif (args.length != 0) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count!\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tselectedWorlds.remove(sender.getName());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You have removed your world selection. Working with current world(if possible).\");\n\n\t\t\t\treturn true;\n\t\t\t\t\n\t\t\tcase mancheckw:\n\t\t\t\tif (args.length < 1) {\n\t\t\t\t\tsender.sendMessage(ChatColor.RED + \"Review your arguments count! (/mancheckw <world>)\");\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Worlds available: \");\n\t\t\t\t\tArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();\n\t\t\t\t\tauxString = \"\";\n\t\t\t\t\tfor (int i = 0; i < worlds.size(); i++) {\n\t\t\t\t\t\tauxString += worlds.get(i).getName();\n\t\t\t\t\t\tif ((i + 1) < worlds.size()) {\n\t\t\t\t\t\t\tauxString += \", \";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsender.sendMessage(ChatColor.YELLOW + auxString);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tauxString = \"\";\n\t\t\t\tfor (int i = 0; i < args.length; i++) {\n\t\t\t\t\tif (args[i] == null) {\n\t\t\t\t\t\tlogger.warning(\"Bukkit gave invalid arguments array! Cmd: \" + cmd.getName() + \" args.length: \" + args.length);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tauxString += args[i];\n\t\t\t\t\tif (i < (args.length - 1)) {\n\t\t\t\t\t\tauxString += \" \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdataHolder = worldsHolder.getWorldData(auxString);\n\t\t\t\t\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"You have selected world '\" + dataHolder.getName() + \"'.\");\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"This world is using the following data files..\");\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Groups:\" + ChatColor.GREEN + \" \" + dataHolder.getGroupsFile().getAbsolutePath());\n\t\t\t\tsender.sendMessage(ChatColor.YELLOW + \"Users:\" + ChatColor.GREEN + \" \" + dataHolder.getUsersFile().getAbsolutePath());\n\n\t\t\t\treturn true;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tsender.sendMessage(ChatColor.RED + \"You are not allowed to use that command.\");\n\t\treturn true;\n\t}", "private String getAttending()\n\t{\n\t\tif (mGuests.isEmpty())\n\t\t{\n\t\t\treturn \"None\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tString o = \"\";\n\t\t\tfor (ParseObject user : mGuests)\n\t\t\t{\n\t\t\t\to += user.getString(\"name\") + \"\\n\";\n\t\t\t}\n\t\t\treturn o.substring(0, o.length() - 1);\n\t\t}\n\t}", "int getWhoThisUserFollows(User user, AsyncResultHandler handler);", "protected void checkMember(final String dn) {\n\t\tCacheGroup group = cacheGroupRepository.findByNameExpected(\"ligoj-gStack\");\n\t\tList<CacheMembership> members = cacheMembershipRepository.findAllBy(\"group\", group);\n\t\tAssertions.assertEquals(1, members.size());\n\t\tAssertions.assertEquals(dn, members.get(0).getGroup().getDescription());\n\t}", "public abstract boolean isAdminPacket();", "@Test\n void testGetRegistrarForUser_inContacts_isNotAdmin() throws Exception {\n expectGetRegistrarSuccess(\n CLIENT_ID_WITH_CONTACT,\n USER,\n \"user [email protected] has [OWNER] access to registrar TheRegistrar\");\n verify(lazyGroupsConnection).get();\n }", "boolean hasSendPlayerId();", "private static boolean musicCommands(CommandContext context, Guild guild, Command invoked, TextChannel channel, Member invoker) {\n if ((invoked instanceof IMusicCommand || invoked instanceof AkinatorCommand) // the hate is real\n && guild.getId().equals(BotConstants.FREDBOAT_HANGOUT_ID)\n && guild.getJDA().getSelfUser().getId().equals(BotConstants.MUSIC_BOT_ID)) {\n if (!channel.getId().equals(\"174821093633294338\") // #spam_and_music\n && !channel.getId().equals(\"217526705298866177\") // #staff\n && !invoker.getUser().getId().equals(\"203330266461110272\")//Cynth\n && !invoker.getUser().getId().equals(\"81011298891993088\")) { // Fre_d\n context.deleteMessage();\n context.replyWithName(\"Please don't spam music commands outside of <#174821093633294338>.\",\n msg -> CentralMessaging.restService.schedule(() -> CentralMessaging.deleteMessage(msg),\n 5, TimeUnit.SECONDS));\n return true;\n }\n }\n return false;\n }", "public void sendNameInfoToAll(){\r\n\t\t\r\n\t\tVector<Player> players = lobby.getLobbyPlayers();\t\r\n\t\tString message = \"UDNM\" + lobby.getNameString();\r\n\t\t\r\n\t\tif(!players.isEmpty()){\r\n\t \tfor(int i=0; i<players.size(); i++){\t \t\t\r\n\t \t\tsendOnePlayer(players.get(i), message);\t \t\t\r\n\t \t}\r\n\t\t}\r\n\t}", "public boolean gotUserName(){return gotUserName;}", "void listBots( String className, String messager ) {\n Iterator<ChildBot> i;\n ChildBot bot;\n String rawClassName = className.toLowerCase();\n\n if( rawClassName.compareTo( \"hubbot\" ) == 0 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"There is only one true master, and that is me.\" );\n } else if( getNumberOfBots( className ) == 0 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"No bots of that type.\" );\n } else {\n m_botAction.sendSmartPrivateMessage( messager, className + \":\" );\n\n for( i = m_botStable.values().iterator(); i.hasNext(); ) {\n bot = i.next();\n\n if( bot != null )\n if( bot.getClassName().compareTo( className ) == 0 )\n m_botAction.sendSmartPrivateMessage( messager, bot.getBot().getBotName() + \" (in \" + bot.getBot().getBotAction().getArenaName() + \"), created by \" + bot.getCreator());\n }\n\n m_botAction.sendSmartPrivateMessage( messager, \"End of list\" );\n }\n }", "@Override\r\n\tpublic void notifyFriendship(String m, String d) throws RemoteException {\n\t\t\r\n\t\tif (d.equals(utente))\r\n\t\t\tres.append(\"Tu e \" + m + \" siete diventati amici\\n\");\r\n\t}", "private void checkForAndDisplayAlias() {\n if (groupMembership != null) {\n GroupService.getInstance().checkUserAlias(groupMembership.getGroupUid())\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Consumer<Boolean>() {\n @Override\n public void accept(@NonNull Boolean aBoolean) throws Exception {\n Log.e(TAG, \"returned from checking alias, result: \" + aBoolean);\n hasAlias = aBoolean;\n if (aBoolean && aliasNotice != null) {\n aliasNotice.setText(getString(R.string.group_alias_present,\n GroupService.getInstance().getUserAliasInGroup(groupMembership.getGroupUid())));\n aliasNotice.setVisibility(View.VISIBLE);\n } else if (aliasNotice != null) {\n aliasNotice.setVisibility(View.GONE);\n }\n }\n }, new Consumer<Throwable>() {\n @Override\n public void accept(@NonNull Throwable throwable) throws Exception {\n throwable.printStackTrace();\n }\n });\n }\n }", "public boolean hasUser(){\n return numUser < MAX_USER;\n }", "public static void sendNormalMOTD(Player target) {\n boolean somethingSent = false;\n\n //Send motd title\n if (motd.has(\"title\")) {\n target.sendMessage(ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n somethingSent = true;\n }\n\n //Send priority messages\n if (motd.has(\"priority\")) {\n String[] priority = new String[motd.getJSONArray(\"priority\").length()];\n for (int i = 0; i < priority.length; i++) {\n priority[i] = ChatColor.GOLD + \" > \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i));\n }\n target.sendMessage(priority);\n somethingSent = true;\n }\n\n //send a few random daily's\n if (motd.has(\"normal\") && !motd.getJSONArray(\"normal\").isEmpty()) {\n Random r = new Random();\n int totalNormalMessages;\n\n if (motdNormalCount > motd.getJSONArray(\"normal\").length()) {\n totalNormalMessages = motd.getJSONArray(\"normal\").length();\n } else {\n totalNormalMessages = motdNormalCount;\n }\n\n String[] normalMessages = new String[totalNormalMessages];\n JSONArray used = new JSONArray();\n int itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n normalMessages[0] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n used.put(itemNum);\n\n for (int i = 1; i < totalNormalMessages; i++) {\n while (used.toList().contains(itemNum)) {\n itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n }\n normalMessages[i] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n }\n\n target.sendMessage(normalMessages);\n somethingSent = true;\n }\n\n }", "public boolean isAdmissible();", "@Test\r\n public void lookProfileByNull() {\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n\r\n // A not connected user looked at member profile\r\n member.lookedBy(null);\r\n \r\n // Still no activity for member\r\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n }", "boolean hasDidcommInvitation();", "@Override\n public void onMemberUnreachable(final Member member) {\n if(clusterReadView.isLeader()){\n LOGGER.info(\"I AM the LEADER and I am notifying other Scoop aware clients about [unreachableMember={}]\", member);\n\n final Event event = new Event();\n event.setEventType(UNREACHABLE_MEMBER_EVENT_TYPE);\n event.setOrderingKey(\"scoop-system\"); // TODO better ordering key?\n\n final HashMap<String, Object> metadata = Maps.newHashMap();\n metadata.put(\"id\", UUID.randomUUID().toString());\n\n final Map<String, String> bodyMap = Maps.newHashMap();\n bodyMap.put(UNREACHABLE_MEMBER_EVENT_BODY_KEY, member.address().toString());\n event.setBody(bodyMap);\n\n postEvent(scoopTopic, event);\n }\n else {\n LOGGER.debug(\"received event about [unreachableMember={}] but I am NOT the LEADER -> ignored\", member);\n }\n }", "public boolean canRespawnHere()\n {\n return false;\n }", "boolean hasAvatar();", "boolean hasAvatar();", "public abstract void isUsedBy(Player player);" ]
[ "0.63491136", "0.5835367", "0.5813251", "0.57965785", "0.57769364", "0.5752415", "0.56810725", "0.56580514", "0.56538266", "0.56486607", "0.56268054", "0.5599753", "0.5533214", "0.54890174", "0.545979", "0.5446187", "0.54095787", "0.5403112", "0.53950495", "0.5378014", "0.5376064", "0.53643906", "0.5353218", "0.5336952", "0.5326961", "0.53239304", "0.53167534", "0.531283", "0.5312053", "0.52809715", "0.52760214", "0.5275999", "0.52743775", "0.5257589", "0.5251419", "0.52173316", "0.52144736", "0.5196217", "0.51881146", "0.51881146", "0.51881146", "0.51881146", "0.51881146", "0.51881146", "0.5182553", "0.5181739", "0.51809025", "0.51793784", "0.51789594", "0.5175704", "0.51732856", "0.5168915", "0.5165969", "0.5163901", "0.51486236", "0.5137399", "0.513686", "0.5132379", "0.51313645", "0.5130394", "0.51297235", "0.51270616", "0.51141405", "0.51092345", "0.5103677", "0.5083194", "0.5077229", "0.5070187", "0.5063182", "0.5061359", "0.5060727", "0.50591785", "0.5054456", "0.5053064", "0.5045433", "0.5040492", "0.5038646", "0.5020192", "0.50186056", "0.5014542", "0.50140035", "0.5013837", "0.5011717", "0.500674", "0.500656", "0.5005341", "0.5005264", "0.49894673", "0.4986253", "0.49829414", "0.4982893", "0.49821225", "0.49802727", "0.49783492", "0.49782062", "0.49779883", "0.4974634", "0.4969002", "0.49680537", "0.49680537", "0.49649164" ]
0.0
-1
If we get a bot, dip
@SubscribeEvent public void onVoiceJoined(GuildVoiceJoinEvent event) { if (event.getMember().getUser().isBot()) return; // Logic GuildUserModel guildUser = taules.dataManager.getGuildUserModel(event.getGuild().getIdLong(), event.getMember()); DB.save(new CallLogModel(guildUser.getId())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isBot(){\n return false;\n }", "public boolean isBot() {\n//\t\treturn this.getUserIO().checkConnection();\n\t\treturn false;\n\t}", "public boolean getBot() {\n return bot;\n }", "public boolean isBot() {\n \t\treturn (type == PLAYER_BOT);\n \t}", "@Override\n public boolean isNeedShowBOTPRule() {\n \treturn true;\n }", "static private void TalkTo() {\n if (BSChristiansen.getCurrentRoom() == currentRoom) {\n System.out.println(BSChristiansen.getDescription() + \", yet he still gives you good advice:\\n\");\n System.out.println(BSChristiansen.getDialog(0));\n System.out.println(\"\");\n woundedSurvivor();\n } else if (mysteriousCrab.getCurrentRoom() == currentRoom && inventory.getInventory().containsKey(\"Shroom\")) {\n System.out.println(mysteriousCrab.getDescription() + \"\\n\" + mysteriousCrab.getDialog(0));\n } else {\n System.out.println(\"There is nobody to communicate with in this Room\");\n }\n\n }", "private boolean checkDadBot(MessageReceivedEvent event) {\n String message = event.getMessage().getContentDisplay();\n\n // Ignore messages that are too short or long to be funny\n if (message.length() < 5 || message.length() > 40)\n return false;\n\n String name = null;\n\n if (message.toLowerCase(Locale.ROOT).startsWith(\"i'm \"))\n name = message.substring(4);\n else if (message.toLowerCase(Locale.ROOT).startsWith(\"im \"))\n name = message.substring(3);\n\n if (name != null && Math.random() < Setting.DAD_BOT_CHANCE) {\n event.getMessage().reply(\"Hi \" + name + \", I'm StatsBot!\").queue();\n return true;\n }\n\n return false;\n }", "public void executeBot(){\n if(botSignal){\n if(bot != null){\n bot.execute();\n }\n }\n botSignal=false;\n }", "public void playHoomans() {\r\n System.out.println(\"Thanks for killing each other, human!\");\r\n }", "@Override\n public void onMessageReceived(@NotNull MessageReceivedEvent event) {\n String message = event.getMessage().getContentRaw().toLowerCase();\n Commands commands = Main.getBOT().getCommands();\n\n // When message is intended for bob, check it\n if (message.startsWith(\"!bob\")) {\n commands.evaluateCommand(message.replace(\"!bob \", \"\"), event);\n } else if (message.contains(\"#blamekall\")) {\n event.getChannel().sendMessage(\"NO! BE NICE! GO TO NAUGHTY JAIL!\").queue();\n event.getChannel().sendMessage(\"https://tenor.com/view/bonk-gif-18805247\").queue();\n }\n\n }", "private void cs0() {\n\t\t\tif(!Method.isChatiing()){\n\t\t\t\tMethod.npcInteract(RUNESCAPEGUIDE, \"Talk-to\");\n\t\t\t}\n\t\t\t\n\t\t}", "private static void readIsPracticeBot() {\n isPracticeBot = !practiceInput.get();\n }", "public void playTopHat() {\n\t\tSystem.out.println(\"ding ding da-ding\");\n\t\t\n\t}", "@View( VIEW_BOT )\r\n public XPage viewBot( HttpServletRequest request )\r\n {\r\n String strBotKey = request.getParameter( PARAMETER_BOT );\r\n if ( strBotKey == null )\r\n {\r\n // assuming the bot is the current session bot\r\n if ( _strBotKey == null )\r\n {\r\n // session is closed\r\n return redirectView( request, VIEW_LIST );\r\n }\r\n }\r\n else\r\n {\r\n if ( !strBotKey.equals( _strBotKey ) )\r\n {\r\n // new bot or bot has changed\r\n initSessionParameters( request, strBotKey );\r\n }\r\n }\r\n if ( _bot == null )\r\n {\r\n return redirectView( request, VIEW_BOT_NOT_FOUND );\r\n }\r\n boolean bTypedScript = AppPropertiesService.getPropertyBoolean( PROPERTY_TYPED_SCRIPT, DEFAULT_TYPED_SCRIPT );\r\n List<Post> listPosts = ChatService.getConversation( _strConversationId, _bot, _locale );\r\n Map<String, Object> model = getModel( );\r\n model.put( MARK_POSTS_LIST, listPosts );\r\n model.put( MARK_BOT_AVATAR, _bot.getAvatarUrl( ) );\r\n model.put( MARK_BASE_URL, AppPathService.getBaseUrl( request ) );\r\n model.put( MARK_BOT, _strBotKey );\r\n model.put( MARK_LANGUAGE, _locale.getLanguage( ) );\r\n model.put( MARK_STANDALONE, ( _bStandalone ) ? \"true\" : \"false\" );\r\n model.put( MARK_TYPED_SCRIPT, bTypedScript );\r\n\r\n String strTemplate = ( _bStandalone ) ? TEMPLATE_BOT_STANDALONE : TEMPLATE_BOT;\r\n XPage xpage = getXPage( strTemplate, request.getLocale( ), model );\r\n xpage.setTitle( _bot.getName( _locale ) );\r\n xpage.setPathLabel( _bot.getName( _locale ) );\r\n xpage.setStandalone( _bStandalone );\r\n\r\n return xpage;\r\n }", "@Override\n public void logic() throws PogamutException {\n /*\n * Step:\n * 1. find the bot and approach him (get near him ... distance < 200)\n * 2. greet him by saying \"Hello!\"\n * 3. upon receiving reply \"Hello, my friend!\"\n * 4. answer \"I'm not your friend.\"\n * 5. and fire a bit at CheckerBot (do not kill him, just a few bullets)\n * 6. then CheckerBot should tell you \"COOL!\"\n * 7. then CheckerBot respawns itself\n * 8. repeat 1-6 until CheckerBot replies with \"EXERCISE FINISHED\"\n */\n Location loc = new Location(0, 0, 0);\n weaponry.changeWeapon(UT2004ItemType.ASSAULT_RIFLE);\n switch (state) {\n case 0: // navigate to random point\n if (!navigation.isNavigating())\n navigation.navigate(this.navPoints.getRandomNavPoint());\n if (players.canSeePlayers()) {\n loc = players.getNearestVisiblePlayer().getLocation();\n navigation.navigate(loc);\n log.info(\"Bot see player on \" + loc.toString());\n }\n if (loc.getDistance(bot.getLocation()) < 190) {\n navigation.stopNavigation();\n log.info(\"Bot is close enough\");\n state = 1;\n }\n if (congrats_receive) {\n log.info(\"Received info about success\");\n state = 7;\n }\n break;\n case 1: // nearby player\n this.sayGlobal(\"Hello!\");\n resetTimeout();\n state = 2;\n break;\n case 2: //waiting for answer\n tickTimeout();\n if (received.equals(\"Hello, my friend!\")) {\n log.info(\"Answer received\");\n state = 3;\n }\n else if (receiveTimeout) {\n log.warning(\"Answer didn't received, repeating.\");\n navigation.navigate(navPoints.getRandomNavPoint());\n state = 0;\n }\n break;\n case 3: // say back\n this.sayGlobal(\"I'm not your friend.\");\n state = 4;\n break;\n case 4:\n if (players.getNearestVisiblePlayer() == null) {\n log.warning(\"Resetting because no player in view\");\n state = 0;\n } else {\n shoot.shoot(players.getNearestVisiblePlayer());\n log.info(\"Start shooting at the enemy\");\n resetTimeout();\n state = 5;\n }\n break;\n case 5:\n tickTimeout();\n if (damaged) {\n shoot.stopShooting();\n damaged = false;\n resetTimeout();\n log.info(\"Enemy damaged\");\n state = 6;\n } else if (receiveTimeout) {\n log.warning(\"Resetting because not damage to the enemy\");\n state = 0;\n }\n break;\n case 6:\n tickTimeout();\n if (cool_received){\n log.info(\"Success in the turn, repeating\");\n cool_received = false;\n resetTimeout();\n state = 0;\n }\n else if(receiveTimeout) {\n log.warning(\"No final answer, repeating\");\n state = 0;\n }\n break;\n case 7:\n sayGlobal(\"I solved the exercise.\");\n }\n }", "protected void botAction(String lastAnswer){\n\t\tIdentifyResponse ir = new IdentifyResponse();\n\t\tint n = ir.getInt(lastAnswer);\n\t\t\n\t\tswitch (n){\n\t\t\tcase 1:\n\t\t\t\tresponseFail();\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tresponseSuccess();\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tresponseNothingToPickUp();\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tresponseSuccessPickUp();\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tresponseGold(lastAnswer);\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tresponseWelcome();\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tresponseEndGame();\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tresponseMap(lastAnswer);\n\t\t\t\tbreak;\n\t\t}\n\t}", "Bot getBotByBotId(String botId) throws CantGetBotException;", "@Test\n public void play() {\n System.out.println(client.botBegin());\n }", "@Override\n\tpublic boolean isReceiving() {\n\t\t// set remotely, so we need to call botinfo()\n\t\tif (botinfo().getLastReceivedMessage() < clock.currentTimeMillis() - 10000) {\n\t\t\tthrow new NotFoundException();\n\t\t}\n\t\treturn true;\n\t}", "public static void printGoodbye() {\n botSpeak(Message.GOODBYE);\n }", "@Test\n public void botPlay() {\n Bot.randomBot(0);\n }", "@Override\n\tpublic void doChat(LoginDetails loginDetails) {\n\tSystem.out.println(\"Boomer chat\");\t\n\t}", "private static void debugMessage(GuildMessageReceivedEvent event) {\n String preface = \"[Discord IDs] \";\n\n System.out.println(\"====== PING COMMAND ======\");\n System.out.println(preface + \"`!ping` SENDER:\");\n System.out.println(\n \"\\t{USER} ID: \" + event.getAuthor().getId() +\n \"\\tName: \" + event.getMember().getEffectiveName() +\n \" (\" + event.getAuthor().getAsTag() + \")\");\n\n System.out.println(preface + \"BOT ID:\\t\" + event.getJDA().getSelfUser().getId());\n System.out.println(preface + \"GUILD ID:\\t\" + event.getGuild().getId());\n\n System.out.println(preface + \"ROLES:\");\n event.getGuild().getRoles().forEach(role -> {\n System.out.println(\"\\t{ROLES} ID: \" + role.getId() + \"\\tName: \" + role.getName());\n });\n\n System.out.println(preface + \"MEMBERS:\");\n event.getGuild().getMembers().forEach(member -> {\n System.out.println(\n \"\\t{MEMEBERS} ID: \" + member.getUser().getId() +\n \"\\tName: \" + member.getEffectiveName() +\n \" (\" + member.getUser().getAsTag() + \")\");\n });\n\n System.out.println(preface + \"Categories:\");\n event.getGuild().getCategories().forEach(category -> {\n System.out.println(\"\\t{CATEGORY} ID: \" + category.getId() + \"\\tName: \" + category.getName());\n category.getChannels().forEach(guildChannel -> {\n System.out.println(\n \"\\t\\t:\" + guildChannel.getType().name().toUpperCase() + \":\" +\n \"\\tID: \" + guildChannel.getId() +\n \"\\tName: \" + guildChannel.getName() +\n \"\\tlink: \" + \"https://discord.com/channels/\" + Settings.GUILD_ID + \"/\" + guildChannel.getId());\n });\n });\n System.out.println(\"==== PING COMMAND END ====\");\n }", "public static void handleShowdownMeg(BufferedReader br) throws IOException {\n\t\twhile( !(rec = br.readLine()).equals(\"/showdown \") ){\n\t\t\tSystem.out.println(rec);\n\t\t}\n\t}", "public static void sendMOTDEdit(Player target) {\n if (motd.has(\"title\")){\n target.sendMessage(ChatColor.GREEN + \" > MOTD Title: \" + ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n }\n \n if (motd.has(\"priority\")) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.GOLD + \" Priority messages. These will always show to the player.\");\n for (int i = 0; i < motd.getJSONArray(\"priority\").length(); i++) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.AQUA + String.valueOf(i) + \" \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i)));\n }\n if (motd.has(\"normal\")) {\n target.sendMessage(ChatColor.GREEN + \"--------------------------------------------------\");\n }\n } else {\n target.sendMessage(ChatColor.GREEN + \" > There are no priority messages\");\n }\n\n if (motd.has(\"normal\")) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.GOLD + \" Normal messages. A random \" + motdNormalCount + \" will be show to players each time.\");\n for (int i = 0; i < motd.getJSONArray(\"normal\").length(); i++) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.AQUA + String.valueOf(i) + \" \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(i)));\n }\n } else {\n target.sendMessage(ChatColor.GREEN + \" > There are no normal messages\");\n }\n }", "public Chatbot getMySillyChatbot()\n\t{\n\t\treturn mySillyChatbot;\n\t}", "void spawnBot( String className, String login, String password, String messager ) {\n CoreData cdata = m_botAction.getCoreData();\n long currentTime;\n\n String rawClassName = className.toLowerCase();\n BotSettings botInfo = cdata.getBotConfig( rawClassName );\n\n if( botInfo == null ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn bot of type \" + className + \". Invalid bot type or missing CFG file.\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn bot of type \" + className + \". Invalid bot type or missing CFG file.\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"That bot type does not exist, or the CFG file for it is missing.\" );\n return;\n }\n\n Integer maxBots = botInfo.getInteger( \"Max Bots\" );\n Integer currentBotCount = m_botTypes.get( rawClassName );\n\n if( maxBots == null ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn bot of type \" + className + \". Invalid settings file. (MaxBots improperly defined)\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn bot of type \" + className + \". Invalid settings file. (MaxBots improperly defined)\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"The CFG file for that bot type is invalid. (MaxBots improperly defined)\" );\n return;\n }\n\n if( login == null && maxBots.intValue() == 0 ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn bot of type \" + className + \". Spawning for this type is disabled on this hub.\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn bot of type \" + className + \". Spawning for this type is disabled on this hub.\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"Bots of this type are currently disabled on this hub. If you are running another hub, please try from it instead.\" );\n return;\n }\n\n if( currentBotCount == null ) {\n currentBotCount = new Integer( 0 );\n m_botTypes.put( rawClassName, currentBotCount );\n }\n\n if( login == null && currentBotCount.intValue() >= maxBots.intValue() ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn a new bot of type \" + className + \". Maximum number already reached (\" + maxBots + \")\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn a new bot of type \" + className + \". Maximum number already reached (\" + maxBots + \")\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"Maximum number of bots of this type (\" + maxBots + \") has been reached.\" );\n return;\n }\n\n String botName, botPassword;\n currentBotCount = new Integer( getFreeBotNumber( botInfo ) );\n\n if( login == null || password == null ) {\n botName = botInfo.getString( \"Name\" + currentBotCount );\n botPassword = botInfo.getString( \"Password\" + currentBotCount );\n } else {\n botName = login;\n botPassword = password;\n }\n\n Session childBot = null;\n\n try {\n // FIXME: KNOWN BUG - sometimes, even when it detects that a class is updated, the loader\n // will load the old copy/cached class. Perhaps Java itself is caching the class on occasion?\n if( m_loader.shouldReload() ) {\n System.out.println( \"Reinstantiating class loader; cached classes are not up to date.\" );\n resetRepository();\n m_loader = m_loader.reinstantiate();\n }\n\n Class<? extends SubspaceBot> roboClass = m_loader.loadClass( \"twcore.bots.\" + rawClassName + \".\" + rawClassName ).asSubclass(SubspaceBot.class);\n String altIP = botInfo.getString(\"AltIP\" + currentBotCount);\n int altPort = botInfo.getInt(\"AltPort\" + currentBotCount);\n String altSysop = botInfo.getString(\"AltSysop\" + currentBotCount);\n\n if(altIP != null && altSysop != null && altPort > 0)\n childBot = new Session( cdata, roboClass, botName, botPassword, currentBotCount.intValue(), m_group, altIP, altPort, altSysop, true);\n else\n childBot = new Session( cdata, roboClass, botName, botPassword, currentBotCount.intValue(), m_group, true);\n } catch( ClassNotFoundException cnfe ) {\n Tools.printLog( \"Class not found: \" + rawClassName + \".class. Reinstall this bot?\" );\n return;\n }\n\n currentTime = System.currentTimeMillis();\n\n if( m_lastSpawnTime + SPAWN_DELAY > currentTime ) {\n m_botAction.sendSmartPrivateMessage( messager, \"Subspace only allows a certain amount of logins in a short time frame. Please be patient while your bot waits to be spawned.\" );\n\n if( m_spawnQueue.isEmpty() == false ) {\n int size = m_spawnQueue.size();\n\n if( size > 1 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"There are currently \" + m_spawnQueue.size() + \" bots in front of yours.\" );\n } else {\n m_botAction.sendSmartPrivateMessage( messager, \"There is only one bot in front of yours.\" );\n }\n } else {\n m_botAction.sendSmartPrivateMessage( messager, \"You are the only person waiting in line. Your bot will log in shortly.\" );\n }\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" in queue to spawn bot of type \" + className );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader in queue to spawn bot of type \" + className );\n }\n\n String creator;\n\n if(messager != null) creator = messager;\n else creator = \"AutoLoader\";\n\n ChildBot newChildBot = new ChildBot( rawClassName, creator, childBot );\n addToBotCount( rawClassName, 1 );\n m_botStable.put( botName, newChildBot );\n m_spawnQueue.add( newChildBot );\n }", "public void action(BotInstance bot, Message message);", "public final boolean hasHerochat()\n\t{\n\t\treturn herochat != null;\n\t}", "private void viewPlayer(Command command)\n { if(!command.hasSecondWord()) { \n // if there is no second word, we don't know where to go... \n Logger.Log(\"What do you want to view?\"); \n return; \n } \n \n String thingToView = command.getSecondWord();\n String inventory = \"inventory\";\n String companions = \"companions\";\n \n if (!thingToView.equals(inventory)&&!thingToView.equals(companions)){\n Logger.Log(\"You can only view your inventory or your current companions\");\n }\n else if (thingToView.equals(inventory)&&!player.inventory.isEmpty()) {\n Logger.Log(\"~*\" + player.playerName + \"'s Backpack *~\");\n player.viewInventory();\n Logger.Log(\"~*~*~*~*~*~\");\n }\n else if (thingToView.equals(inventory)&&player.inventory.isEmpty()){\n Logger.Log(\"There is nothing in your backpack...\");\n }\n else if (thingToView.equals(companions)&&!player.friends.isEmpty()) {\n Logger.Log(\"~*\" + player.playerName + \"'s Companions *~\");\n player.viewCompanions();\n Logger.Log(\"~*~*~*~*~*~\");\n }\n else if (thingToView.equals(companions)&&player.friends.isEmpty()) {\n Logger.Log(\"You don't have any companions at the moment :(\");\n }\n \n \n }", "private void logout(){\n player.setName(\"(bot) \" + player.getName());\n botMode = true;\n System.out.println(\"bot made\");\n login = false;\n }", "private static Player getThroughWhomSendMessage() {\n\t\treturn Remain.getOnlinePlayers().isEmpty() ? null : Remain.getOnlinePlayers().iterator().next();\n\t}", "public interface Bot extends Runnable {\r\n \r\n /** AOBot.State defines the various states that a bot can be in at any point in time. */\r\n public enum State {\r\n DISCONNECTED, CONNECTED, AUTHENTICATED, LOGGED_IN;\r\n } // end enum State\r\n \r\n /** Returns the current state of this bot. */\r\n State getState();\r\n \r\n /** \r\n * Returns the character that the bot is logged in as \r\n * (or null if the bot is not logged in).\r\n */\r\n CharacterInfo getCharacter();\r\n \r\n /** Returns the bot's current style sheet. */\r\n // AOBotStyleSheet getStyleSheet();\r\n \r\n /**\r\n * Reads the next packet from the server. \r\n * \r\n * @throws AOBotStateException if the bot is in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to read a packet\r\n */\r\n Packet nextPacket() throws IOException;\r\n /**\r\n * Sends a packet to the server. \r\n * \r\n * @throws AOBotStateException if the bot is in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to send a packet\r\n */\r\n void sendPacket(Packet packet) throws IOException;\r\n \r\n /**\r\n * Connects the bot to the server. This is simply a convience method,\r\n * {@code connect(server)} is equivalent to\r\n * {@code connect( server.getURL(), server.getPort() )}\r\n * \r\n * @throws NullPointerException if {@code server} is null\r\n * @throws AOBotStateException if the bot is not in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to connect to the server\r\n *\r\n * @see ao.protocol.AODimensionAddress\r\n */\r\n void connect(DimensionAddress server) throws IOException;\r\n /**\r\n * Connects the bot to the server. \r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to connect to the server\r\n */\r\n void connect(String server, int port) throws IOException;\r\n /**\r\n * Authenticates a user with the server.\r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#CONNECTED} state\r\n * @throws IOException if an error occured while attempting to authenticate the client with the server\r\n */\r\n void authenticate(String userName, String password) throws IOException;\r\n /**\r\n * Logs a character into the server. \r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#AUTHENTICATED} state\r\n * @throws IOException if an error occured while attempting to log the client into the server\r\n */\r\n void login(CharacterInfo character) throws IOException;\r\n /**\r\n * Starts the bot. \r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#LOGGED_IN} state\r\n */\r\n void start();\r\n /** \r\n * Disconnects the bot from the server. \r\n *\r\n * @throws IOException if an error occured while attempting to disconnect the client\r\n */\r\n void disconnect() throws IOException;\r\n \r\n /** Add a listener to this bot. */\r\n void addListener(BotListener l);\r\n /** Remove a listener from this bot. */\r\n void removeListener(BotListener l);\r\n /** Adds a logger to this bot. */\r\n void addLogger(BotLogger logger);\r\n /** Removes a logger from this bot. */\r\n void removeLogger(BotLogger logger);\r\n \r\n}", "public String getResponse(String statement)\r\n\t{\r\n\t\tstatement.toLowerCase();\r\n\t\tChatBotChen chatbot2 = new ChatBotChen();\r\n\t\tChatBotUsman chatbot3 = new ChatBotUsman();\r\n\t\tChatBotYaroslavsky chatbot4 = new ChatBotYaroslavsky();\r\n\t\t\r\n\t\tString[] animalArray = {\"hamster\",\"guinea pig\",\"tortoise\",\"frog\",\"tarantula\",\"snake\",\"dog\",\"cat\",\"fish\",\"seaweed\"};\r\n\t\tint animalPosArray = -1;\r\n\t\t{\r\n\t\t\tfor (String animal:animalArray)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, animal, 0)>=0)\r\n\t\t\t\t{\t\t\t\t\t\r\n\t\t\t\t\tanimalPosArray = Arrays.asList(animalArray).indexOf(animal);\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (animalPosArray< 2 && animalPosArray>-1)\r\n\t\t{\r\n\t\t\twhile (statement!=\"Bye\")\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(chatbot2.getResponse(statement));\r\n\t\t\t\tstatement = in.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\telse if (animalPosArray< 8 && animalPosArray>5)\r\n\t\t{\r\n\t\t\twhile (statement!=\"Bye\")\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(chatbot4.getResponse(statement));\r\n\t\t\t\tstatement = in.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (animalPosArray< 10 && animalPosArray>7)\r\n\t\t{\r\n\t\t\twhile (statement!=\"Bye\")\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(chatbot3.getResponse(statement));\r\n\t\t\t\tstatement = in.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tif (findKeyword(statement, \"tortoise\", 0)>=0)\r\n\t\t{\r\n\t\t\tpatience = patience +3;\r\n\t\t\tconvoTortoise = true;\r\n\t\t\tconvoFrog = false;\r\n\t\t\tconvoTarantula = false;\r\n\t\t\tconvoSnake = false;\r\n\t\t}\r\n\t\telse if (findKeyword(statement, \"frog\", 0)>=0)\r\n\t\t{\r\n\t\t\tpatience--;\r\n\t\t\tconvoTortoise = false;\r\n\t\t\tconvoFrog = true;\r\n\t\t\tconvoTarantula = false;\r\n\t\t\tconvoSnake = false;\r\n\t\t}\r\n\t\telse if (findKeyword(statement, \"tarantula\", 0)>=0)\r\n\t\t{\r\n\t\t\tpatience++;\r\n\t\t\tconvoTortoise = false;\r\n\t\t\tconvoFrog = false;\r\n\t\t\tconvoTarantula = true;\r\n\t\t\tconvoSnake = false;\r\n\t\t}\r\n\t\telse if (findKeyword(statement, \"snake\", 0)>=0)\r\n\t\t{\r\n\t\t\tconvoTortoise = false;\r\n\t\t\tconvoFrog = false;\r\n\t\t\tconvoTarantula = false;\r\n\t\t\tconvoSnake = true;\r\n\t\t}\r\n\t\tif (statement.length()==0)\r\n\t\t{\r\n\t\t\tString[] emptyResponses = {\"You're replying slower than a tortoise!!\",\"I know snakes that type faster than you./nThey don't even have fingers...\",\r\n\t\t\t\t\t\"Please say something.\",\"Hurry up and reply... I have other customers!\"};\r\n\t\t\tint i = (int)Math.random()*(emptyResponses.length);\r\n\t\t\tString answerEmpty = emptyResponses[i];\r\n\t\t\treturn answerEmpty;\r\n\t\t}\r\n\t\telse if (convoTortoise)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif ((findKeyword(statement, \"food\", 0)>=0)||(findKeyword(statement, \"eat\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise usually eat a lot of greens but they can feed on some insects and like fruits as a special treat.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise like habitats with a lot of hideaways and in certain places you should look into if you need special lights to regulate heat.\\nVisit this website to look into building the best habitat for your tortoise http://tortoisegroup.org/desert-tortoise-habitat-checklist/\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! http://www.vetstreet.com/our-pet-experts/tempted-to-get-a-pet-turtle-or-tortoise-read-this-first\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif ((findKeyword(statement, \"live\", 0)>=0)||(findKeyword(statement, \"years\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Depending on living conditions and health issues, tortoises usually live about 70-100 years.\\nThere is a lot of debate on an average life length though.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"We actually have a few Russian Tortoises that you can look at in our store!\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\\nYou can use this article to help answer your question! http://www.vetstreet.com/our-pet-experts/tempted-to-get-a-pet-turtle-or-tortoise-read-this-first\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"tortoise\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"I've always wanted to buy a tortoise!!\\nI encourage that you buy one of our Russian Tortoises.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\telse if (convoFrog)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"food\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise usually eat a lot of greens but they can feed on some insects and like fruits as a special treat.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise like habitats with a lot of hideaways and in certain places you should look into if you need special lights to regulate heat.\\nVisit this website to look into building the best habitat for your tortoise http://tortoisegroup.org/desert-tortoise-habitat-checklist/\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! https://www.wikihow.com/Take-Care-of-Frogs\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"live\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"There isn't a good answer for this but the average is in a range from about 4 to 15.\\nThere is a lot of debate on an average life length though.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"If you do want a frog (I recommend a tortoise), we have some of them available.\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\telse if (findKeyword(statement, \"frog\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"I've never really understood why people want pets as frogs.\\nI think you should buy one of our Russian Tortoises or Tarantulas but we have some frogs available.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\telse if (convoTarantula)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"food\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tarantulas are insectivorous so crickets are their favorite meal.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"People usually use aquarium-like tanks for habitats of tarantulas.\\nUse this website for help: http://www.tarantulaguide.com/pet-tarantula-cage-and-habitat/\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! http://www.tarantulaguide.com/\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"live\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Female Tarantulas can live up to 30 years while Male ones can only live up to 7 years.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"If you do want a tarantula, we only have one available.\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\\nYou can also check out this website to help you: http://www.tarantulaguide.com/\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse if (findKeyword(statement, \"tarantula\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"Tarantulas intimidate so many people but I think they are so cool.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\telse if (convoSnake)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"food\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Some species of snakes eat insects and reptiles like frogs, but others eat warm-blooded animals like mice.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"People usually use aquarium-like tanks for habitats of snakes.\\nThe size of it can depend on your snake.\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! http://www.petmd.com/reptile/care/evr_rp_snake_facts\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"live\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"There isn't a good answer for this but the average is in a range from about 4 to 15.\\nThere is a lot of debate on an average life length though.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"If you want to check out some snakes we have two ball pythons and a corn snake available.\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\\nYou can also check out this website to help you: http://www.petmd.com/reptile/care/evr_rp_snake_facts\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse if (findKeyword(statement, \"snake\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"There have been rumors of pet snakes choking their owners but they are pretty chill pets if you know how to take care of them.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treturn randomResponse();\r\n\t\t\r\n\t\t\r\n\t}", "network.message.PlayerResponses.Command getCommand();", "private void boom() {\n showMessage(\"BOOM! Reload to try again\", \"boom\");\n }", "void listBots( String className, String messager ) {\n Iterator<ChildBot> i;\n ChildBot bot;\n String rawClassName = className.toLowerCase();\n\n if( rawClassName.compareTo( \"hubbot\" ) == 0 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"There is only one true master, and that is me.\" );\n } else if( getNumberOfBots( className ) == 0 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"No bots of that type.\" );\n } else {\n m_botAction.sendSmartPrivateMessage( messager, className + \":\" );\n\n for( i = m_botStable.values().iterator(); i.hasNext(); ) {\n bot = i.next();\n\n if( bot != null )\n if( bot.getClassName().compareTo( className ) == 0 )\n m_botAction.sendSmartPrivateMessage( messager, bot.getBot().getBotName() + \" (in \" + bot.getBot().getBotAction().getArenaName() + \"), created by \" + bot.getCreator());\n }\n\n m_botAction.sendSmartPrivateMessage( messager, \"End of list\" );\n }\n }", "@Override\n public void viewWillAppear() throws InterruptedException {\n commandView.addLocalizedText(\"Vuoi essere scomunicato? 0: sì, 1:no\");\n int answ = commandView.getInt(0, 1);\n boolean answer = (answ == 0);\n clientNetworkOrchestrator.send(new PlayerChoiceExcommunication(answer));\n }", "public void onUnknown(String mes) {\n\t\tlong time = System.currentTimeMillis();\n\t\t//Ignores configuration messages\n\t\tif (mes.equals(\":tmi.twitch.tv CAP * ACK :twitch.tv/membership\")\n\t\t\t\t|| mes.equals(\":tmi.twitch.tv CAP * ACK :twitch.tv/tags\")\n\t\t\t\t|| mes.equals(\":tmi.twitch.tv CAP * ACK :twitch.tv/commands\"))\n\t\t\treturn;\n\t\tString tempChan = mes.substring(mes.indexOf(val) + count - 1);\n\t\tString channel = null;\n\t\tif(tempChan.indexOf(\" :\") == -1)\n\t\t\tchannel = tempChan;\n\t\telse\n\t\t\tchannel = tempChan.substring(0, tempChan.indexOf(\" :\"));\n\t\tChatConnection connection = ConnectionList.getChannel(channel);\n\t\tfinal String tags = mes.substring(1, mes.indexOf(\" \" + connection.getChannelName()) + (\" \" + connection.getChannelName()).length());\n\t\t// Private Message, Will implement later!\n\t\tif (mes.indexOf(\" \" + connection.getChannelName()) == -1) \n\t\t\treturn;\n\t\tHashMap<String, String> data = new HashMap<String, String>();\n\t\textractData(connection, data, tags);\n\t\t// ERROR PARSING MESSAGE\n\t\tif (data == null || !data.containsKey(\"tag\")) \n\t\t\treturn;\n\t\tString tag = data.get(\"tag\");\n\t\tString msgSplit = \":tmi.twitch.tv \" + tag + \" \" + connection.getChannelName();\n\t\tUser user = null;\n\t\tMessage message = null;\n\t\t/*\n\t\t * BAN TIMEOUT CLEAR CHAT\n\t\t */\n\t\tif (tag.equalsIgnoreCase(\"CLEARCHAT\")) {\n\t\t\tString username = null;\n\t\t\tif (mes.indexOf(msgSplit) + msgSplit.length() + 2 <= mes.length()) {\n\t\t\t\tusername = mes.substring(mes.indexOf(msgSplit) + msgSplit.length() + 2);\n\t\t\t\tuser = getUser(connection, username);\n\t\t\t}\n\t\t\tif (username != null && data.containsKey(\"ban-reason\")) {\n\t\t\t\tif (data.containsKey(\"ban-duration\") && data.get(\"ban-duration\").length() != 0) \n\t\t\t\t\tmessage = new BanMessage(connection, time, user, Integer.parseInt(data.get(\"ban-duration\")));\n\t\t\t\telse \n\t\t\t\t\tmessage = new BanMessage(connection, time, user);\n\t\t\t} else \n\t\t\t\tmessage = new ClearChatMessage(connection, time);\n\t\t\t\n\t\t}\n\t\t/*\n\t\t * CHANGE CHAT MODE\n\t\t */\n\t\telse if (tag.equalsIgnoreCase(\"NOTICE\")) {\n\t\t\tString messagePrint = mes.substring(mes.indexOf(msgSplit) + msgSplit.length());\n\t\t\tString id = data.get(\"msg-id\");\n\t\t\tboolean enabled = true;\n\t\t\tChatMode mode = ChatMode.OTHER;\n\t\t\tif (id.contains(\"off\")) \n\t\t\t\tenabled = false;\n\t\t\t\n\t\t\t// SUB MODE\n\t\t\tif (id.contains(\"subs_\")) \n\t\t\t\tmode = ChatMode.SUB_ONLY;\n\t\t\t\n\t\t\t// EMOTE ONLY MODE\n\t\t\telse if (id.contains(\"emote_only_\")) \n\t\t\t\tmode = ChatMode.EMOTE_ONLY;\n\t\t\t\n\t\t\t// FOLLOWERS ONLY MODE\n\t\t\telse if (id.contains(\"followers_\")) \n\t\t\t\tmode = ChatMode.FOLLOWER_ONLY;\n\t\t\t\n\t\t\t// SLOW MODE\n\t\t\telse if (id.contains(\"slow_\")) \n\t\t\t\tmode = ChatMode.SLOW;\n\t\t\t\n\t\t\t// R9K MODE\n\t\t\telse if (id.contains(\"r9k_\")) \n\t\t\t\tmode = ChatMode.R9K;\n\t\t\t\n\t\t\tmessage = new ChatModeMessage(connection, time, mode, messagePrint, enabled);\n\t\t}\n\t\t/*\n\t\t * NORMAL CHAT MESSAGE\n\t\t */\n\t\telse if (tag.equalsIgnoreCase(\"PRIVMSG\")) {\n\t\t\t// GETS SENDER\n\t\t\tString temp = \"\";\n\t\t\tString username = data.get(\"display-name\").toLowerCase();\n\t\t\t// no display name\n\t\t\tif (username == null || username.equals(\"\")) {\n\t\t\t\ttemp = data.get(\"user-type\");\n\t\t\t\tusername = temp.substring(temp.indexOf(':') + 1, temp.indexOf('!')).toLowerCase();\n\t\t\t}\n\t\t\tuser = getUser(connection, username);\n\n\t\t\t// BADGES\n\t\t\tString badges = data.get(\"badges\");\n\t\t\tif (!badges.equals(\"\")) {\n\t\t\t\tArrayList<String> badgeList = new ArrayList<String>(Arrays.asList(badges.split(\",\")));\n\t\t\t\tfor (String badge : badgeList) {\n\t\t\t\t\tint splitLoc = badge.indexOf('/');\n\t\t\t\t\tBadgeType type = connection.getBadge(badge.substring(0, splitLoc), badge.substring(splitLoc + 1));\n\t\t\t\t\tif (type == null) \n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tuser.addType(type);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// COLOR\n\t\t\tif (data.get(\"color\").length() != 0) \n\t\t\t\tuser.setDisplayColor(data.get(\"color\"));\n\t\t\t\n\t\t\t// DISPLAY NAME\n\t\t\tif (!data.get(\"display-name\").equals(\"\")) \n\t\t\t\tuser.setDisplayName(data.get(\"display-name\"));\n\t\t\t\n\t\t\t// USER ID\n\t\t\tif (!data.get(\"user-id\").equals(\"\")) \n\t\t\t\tuser.setUserID(Long.parseLong(data.get(\"user-id\")));\n\t\t\t\n\t\t\t// CHECKS IF BITS WERE SENT\n\t\t\tChatMessage finalMessage = null;\n\t\t\tif (data.containsKey(\"bits\")) \n\t\t\t\tfinalMessage = new BitMessage(connection, time, user, mes.substring(tags.length() + 3),\n\t\t\t\t\t\tInteger.parseInt(data.get(\"bits\")));\n\t\t\telse\n\t\t\t\tfinalMessage = new ChatMessage(connection, time, user, mes.substring(tags.length() + 3));\n\t\t\t\n\t\t\t// EMOTES\n\t\t\tHashSet<String> set = new HashSet<String>();\n\t\t\t//TWITCH\n\t\t\tif (!data.get(\"emotes\").equals(\"\")) {\n\t\t\t\tString[] emotes = data.get(\"emotes\").split(\"/\");\n\t\t\t\tfor (String emote : emotes) {\n\t\t\t\t\tint id = Integer.parseInt(emote.substring(0, emote.indexOf(\":\")));\n\t\t\t\t\tString[] occur = emote.substring(emote.indexOf(\":\") + 1).split(\",\");\n\t\t\t\t\tfor (String occure : occur) {\n\t\t\t\t\t\tString[] index = occure.split(\"-\");\n\t\t\t\t\t\tfinalMessage.addEmote(new ChatEmote(finalMessage.getMessage(), EmoteType.TWITCH, id+\"\", Integer.parseInt(index[0]), Integer.parseInt(index[1])));\n\t\t\t\t\t\tset.add(mes.substring(tags.length() + 3).substring(Integer.parseInt(index[0]), Integer.parseInt(index[1])+1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//OTHER\n\t\t\tfor(EmoteType type : EmoteType.values()){\n\t\t\t\tif(type!=EmoteType.TWITCH){\n\t\t\t\t\tfor(Emote emote : emoteManager.getEmoteList(type).values()){\n\t\t\t\t\t\tif(!set.contains(emote.getName())){\n\t\t\t\t\t\t\tfinalMessage.addEmotes(findChatEmote(mes.substring(tags.length() + 3), emote));\n\t\t\t\t\t\t\tset.add(emote.getName());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmessage = finalMessage;\n\t\t} else if (tag.equalsIgnoreCase(\"ROOMSTATE\")) {\n\n\t\t}\n\t\t// SUB NOTIFICATIONS\n\t\telse if (tag.equalsIgnoreCase(\"USERNOTICE\")) {\n\t\t\tString sys_msg = replaceSpaces(data.get(\"system-msg\"));\n\t\t\tString messagePrint = \"\", plan = data.get(\"msg-param-sub-plan\"), type = data.get(\"msg-id\");\n\t\t\tint loc = mes.indexOf(msgSplit) + msgSplit.length() + 2;\n\t\t\tif (loc < mes.length() && loc > 0) \n\t\t\t\tmessagePrint = mes.substring(loc);\n\t\t\tuser = getUser(connection, data.get(\"login\"));\n\t\t\tint length = -1;\n\t\t\tif (data.get(\"msg-param-months\").length() == 1) \n\t\t\t\tlength = Integer.parseInt(data.get(\"msg-param-months\"));\n\t\t\tmessage = new SubscriberMessage(connection, user, time, sys_msg, messagePrint, length, plan, type);\n\t\t} else if (tag.equalsIgnoreCase(\"USERSTATE\")) {\n\n\t\t} else {\n\n\t\t}\n\t\t//If message was successfully parsed, process the message too the GUI\n\t\tif (message != null) {\n\t\t\tconnection.getMessageProcessor().process(message);\n\t\t\tfinished(message);\n\t\t}\n\t}", "private void showDetectedPresence(){\n AlertDialog.Builder box = new AlertDialog.Builder(SecurityActivity.this);\n box.setTitle(\"Attention!\")\n .setMessage(\"Le robot a détecté une présence\");\n\n box.setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n\n public void onClick(DialogInterface dialog, int which) {\n presenceDetectee.setValue(false);\n Intent intent = new Intent(SecurityActivity.this, JeuActivity.class);\n intent.putExtra(\"ROBOT\", robotControle);\n startActivity(intent);\n }\n }\n );\n box.show();\n //J'ai un problème de permissions, je la demande mais Android ne la demande pas...\n //Vibrator vib=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);\n //vib.vibrate(10000);\n }", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n System.out.println(\"Would you like to talk to Bob? (Y/N)\");\n String userInput = scanner.next();\n boolean willTalk = userInput.equalsIgnoreCase(\"y\");\n scanner.nextLine();\n if (willTalk) {\n do {\n System.out.println(\"What do you want to say?\");\n String talkToBob = scanner.nextLine();\n\n if (talkToBob.endsWith(\"?\")) {\n System.out.println(\"Sure\");\n } else if (talkToBob.endsWith(\"!\")) {\n System.out.println(\"Whoa, chill out!\");\n } else if (talkToBob.equals(\"\")) {\n System.out.println(\"Fine, Be that way!\");\n } else {\n System.out.println(\"Whatever\");\n }\n\n System.out.println(\"Keep chatting? (Y/N)\");\n userInput = scanner.next();\n willTalk = userInput.equalsIgnoreCase(\"y\");\n scanner.nextLine();\n } while (willTalk);\n }\n }", "private void showHelp(CommandSender sender) {\n StringBuilder user = new StringBuilder();\n StringBuilder admin = new StringBuilder();\n\n for (Command cmd : commands.values()) {\n CommandInfo info = cmd.getClass().getAnnotation(CommandInfo.class);\n if(!PermHandler.hasPerm(sender, info.permission())) continue;\n\n StringBuilder buffy;\n if (info.permission().startsWith(\"dar.admin\"))\n buffy = admin;\n else \n buffy = user;\n \n buffy.append(\"\\n\")\n .append(ChatColor.RESET).append(info.usage()).append(\" \")\n .append(ChatColor.YELLOW).append(info.desc());\n }\n\n if (admin.length() == 0) {\n \tMessenger.sendMessage(sender, \"Available Commands: \"+user.toString());\n } else {\n \tMessenger.sendMessage(sender, \"User Commands: \"+user.toString());\n \tMessenger.sendMessage(sender, \"Admin Commands: \"+admin.toString());\n }\n }", "String removeBot( String name, String msg ) {\n if( name == null )\n return \"had no name associated; no removal action taken\";\n\n ChildBot deadBot = m_botStable.remove( name );\n\n if( deadBot != null ) {\n try {\n Session deadSesh = deadBot.getBot();\n\n if( deadSesh != null ) {\n if( deadSesh.getBotAction() != null ) {\n deadSesh.getBotAction().cancelTasks();\n }\n\n if( msg != null ) {\n if( !msg.equals(\"\") ) {\n deadSesh.disconnect( msg );\n } else {\n deadSesh.disconnect( \"(empty DC message)\" );\n }\n } else {\n deadSesh.disconnect( \"(null DC message)\" );\n }\n }\n\n // Decrement count for this type of bot\n addToBotCount( deadBot.getClassName(), (-1) );\n deadBot = null;\n return \"has disconnected normally\";\n } catch( NullPointerException e ) {\n Tools.printStackTrace(e);\n m_botAction.sendChatMessage( 1, name + \" had a disconnection problem/was already DC'd (null pointer exception thrown)\");\n }\n }\n\n return \"not found in bot stable (possibly already disconnected)\";\n }", "void bot_check_on_user() { // using Watson Speech-to-Text and text-to-Speech functions\r\n String output;\r\n String input;\r\n output: \"Are you okay?\";\r\n input = get voice input;\r\n if (input = \"Yes I’m okay.\") {} // nothing to do\r\n else if (input = \"A bit unwell.\") {\r\n output = \"Please list your symptoms.\";\r\n String symptoms;\r\n symptoms = get voice input;\r\n CFR_check(symptoms);\r\n }\r\n else if (input = …(no sound)) {\r\n CFR_check(\"No response, might be unconscious.\");\r\n else output : \"Please repeat.\";\r\n }", "static public void checkAndPrintIfLostDrone(Drone drone) {\n\n if (drone.isReturningToHome() && drone.getDistanceSource() == 0) {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Return to home completed successfully\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"] \" + \"Return to home completed successfully\");\n return;\n }\n if (drone.getDistanceDestiny() == 0) {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Arrived at destination\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"]\" + \"Arrived at destination\");\n return;\n }\n\n /* if(drone.isGoingManualToDestiny()){\n System.out.println(\"Drone[\"+getDroneLabel()+\"] \"+\"Arrived at destination\");\n loggerController.print(\"Drone[\"+getDroneLabel()+\"] \"+\"Arrived at destination\");\n return;\n }*/\n\n if (drone.isOnWater()) {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed on water\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed on water\");\n } else {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed successfully\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed successfully\");\n }\n\n\n }", "public static void botSpeak(String sentence) {\n printDivider();\n System.out.println(sentence);\n printDivider();\n }", "public void go(){\r\n\t\t\r\n\t\tif(position.go(b.getN())){\r\n\t\t\tElement e =b.getSection(position).giveMePitOrWumpus();\t\t\r\n\t\t\tif(e instanceof Wumpus){\r\n\t\t\t\tWumpus w = (Wumpus)e;\r\n\t\t\t\tif (w.isAlive()){\r\n\t\t\t\t\talive = false;\r\n\t\t\t\t\tSystem.out.println(\"Wumpus kills you without mercy.END.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(e instanceof Pit){\r\n\t\t\t\talive = false;\r\n\t\t\t\tSystem.out.println(\"You have fallen into an endless pit.END.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t\tSystem.out.println(\"Ooops, there is a wall on your way.\");\r\n\t}", "public boolean isChatEnabled();", "pb4server.WorldChatAskReq getWorldChatAskReq();", "public void print() {\n System.out.println(\"I am \" + status() + (muted ? \" and told to shut up *sadface*\" : \"\") + \" (\" + toString() + \")\");\n }", "public void announceWinner() {\r\n Piece winer;\r\n if (_board.piecesContiguous(_board.turn().opposite())) {\r\n winer = _board.turn().opposite();\r\n } else {\r\n winer = _board.turn();\r\n }\r\n if (winer == WP) {\r\n _command.announce(\"White wins.\", \"Game Over\");\r\n System.out.println(\"White wins.\");\r\n } else {\r\n _command.announce(\"Black wins.\", \"Game Over\");\r\n System.out.println(\"Black wins.\");\r\n }\r\n }", "boolean processChatCmd( String s )\n\t{\n\t\t\n\t\tman.getOpponent(this).out.println(s);\n\t\tman.getOpponent(this).out.flush();\n\t\tout.println(\"Message sent.\");\n\t\tout.flush();\n\t\treturn true;\n\t}", "@Override\r\n public void notLeader() {\n }", "private static void dealwithelp() {\r\n\t\tSystem.out.println(\"1 ) myip - to see your ip address.\");\r\n\t\tSystem.out.println(\"2 ) myport - to see your port number.\");\r\n\t\tSystem.out.println(\"3 ) connect <ip> <port> - connect to peer.\");\r\n\t\tSystem.out.println(\"4 ) list Command - list all the connected peer/peers.\");\r\n\t\tSystem.out.println(\"5 ) send <id> - to send message to peer.\");\r\n\t\tSystem.out.println(\"6 ) terminate <id> - terminate the connection\");\r\n\t\tSystem.out.println(\"7 ) exit - exit the program.\");\r\n\t}", "public void setBotNumber(int num) {\n botNum = num;\n }", "public void sendeLobby();", "public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {\n\t\tif (label.equalsIgnoreCase(\"truth\")) {\n\t\t\tif (sender instanceof Player) {\n\t\t\t\t//player (not console)\n\t\t\t\tPlayer player = (Player) sender;\n\t\t\t\tif (player.hasPermission(\"stinky.use\")) { \n\t\t\t\t\tplayer.sendMessage(ChatColor.LIGHT_PURPLE+\"\"+ChatColor.BOLD+\"Alex Stinks\");\n\t\t\t\t\tplayer.sendMessage(ChatColor.translateAlternateColorCodes('&', \"&ehe really Does\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tplayer.sendMessage(ChatColor.DARK_RED+\"\"+ChatColor.BOLD+\"You don't Have permission to use this!\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//console (not player)\n\t\t\t\tsender.sendMessage(\"hey Console\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public void requestBot(String s) {\n\t\tLEDManager.requestConnection(s);\n\t}", "@Override\n public void run() {\n if(!botMode && game.getPlayersConnected() < 4){\n login();\n out.println(\"waiting for players to connect...\\r\\n\");\n awaitT();\n }\n\n while(login && !botMode){\n try {\n synchronized (lock){nextRound();}\n if(round==6){\n exitGame();\n }else{\n display();\n// synchronized (lock){executeBot();} //let the bot thread perf\n\n out.println(\"\\r\\nList of commands: \\r\\n\" +\n \"vote (vote for the execution of an influence card)\\r\\n\" +\n \"trade (buy or sell shares)\\r\\n\" +\n \"next (proceed to next round)\\r\\n\" +\n \"logout (exit game)\\r\\n\"\n );\n command();\n }\n\n } catch (NoSuchElementException e) {\n login = false;\n }\n }\n\n //close session\n in.close();\n out.close();\n\n while(botMode && round !=6){ //move above close session\n botLogic();\n }\n\n }", "private static PluginMessageRecipient getThroughWhomSendMessage() {\n\t\treturn Remain.getOnlinePlayers().isEmpty() ? Bukkit.getServer() : Remain.getOnlinePlayers().iterator().next();\n\t}", "@Override\r\n\tpublic String say() {\n\t\tif(livingBy==LivingBy.CAT) {\r\n\t\t\treturn \"Me ow\";\r\n\t\t}else if(livingBy==LivingBy.ROOSTER) {\r\n\t\t\treturn \"Cock-a-doodle-doo\";\r\n\t\t\t\r\n\t\t}else {\r\n\t\t\treturn \"Woof, woof\";\r\n\t\t}\r\n\t\t\r\n\t}", "public void otherSentence()\n {\n // Receive the string from the other player\n if (other == 1)\n {\n record.append(\"Red: \" + theClientChat.recvString() + \"\\n\");\n }\n else\n {\n record.append(\"Yellow: \" + theClientChat.recvString() + \"\\n\");\n }\n }", "private void botLogic(){\n synchronized (lock){Collections.sort(playerList);}\n botTrading();\n botVoting();\n waitPrint();\n await();\n }", "private void pique() {\n\t\ttry {\n\t\t\tThread.sleep(5000); // espera, para dar tempo de ver as mensagens iniciais\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tint xInit = -38;\n\t\tint yInit = 0;\n\t\tEFieldSide side = selfPerception.getSide();\n\t\tVector2D initPos = new Vector2D(xInit * side.value(), yInit * side.value());\n\t\tplayerDeafaultPosition = initPos;\n\t\tVector2D ballPos;\n\t\tdouble ballX = 0, ballY = 0;\n\t\t\n\t\tRectangle area = side == EFieldSide.LEFT ? new Rectangle(-52, -25, 32, 50) : new Rectangle(25, -25, 32, 50);\n\t\t\n\t\twhile (commander.isActive()) {\n\t\t\tupdatePerceptions(); // deixar aqui, no começo do loop, para ler o resultado do 'move'\n\t\t\tballPos = fieldPerception.getBall().getPosition();\n\t\t\tswitch (matchPerception.getState()) {\n\t\t\tcase BEFORE_KICK_OFF:\t\t\t\t\n\t\t\t\tcommander.doMoveBlocking(-38, 0);\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase PLAY_ON:\n\t\t\t\tballX = fieldPerception.getBall().getPosition().getX();\n\t\t\t\tballY = fieldPerception.getBall().getPosition().getY();\n\t\t\t\tif (arrivedAtBall()) { // chutar\n\t\t\t\t\tcommander.doKickBlocking(100.0d, 0.0d);\n\t\t\t\t} else if (area.contains(ballX, ballY)) { // defender\n\t\t\t\t\tdashBall(ballPos);\n\t\t\t\t} else if (!isCloseTo(initPos)) { // recuar\t\t\t\t\t\n\t\t\t\t\tdash(initPos);\n\t\t\t\t} else { // olhar para a bola\n\t\t\t\t\tturnTo(ballPos);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_OFF_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_OFF_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CORNER_KICK_LEFT: // escanteio time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CORNER_KICK_RIGHT: // escanteio time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_IN_LEFT: // lateral time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\tcase KICK_IN_RIGHT: // lateal time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_LEFT: // Tiro livre time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_RIGHT: // Tiro Livre time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_FAULT_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_FAULT_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase GOAL_KICK_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase GOAL_KICK_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_LEFT:\n\t\t\t\tcommander.doMoveBlocking(-38, 0);\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_RIGHT:\n\t\t\t\tcommander.doMoveBlocking(-38, 0);\n\t\t\t\tbreak;\t\t\t\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public void godNotAdded() {\n notifyGodNotAdded(this.getCurrentTurn().getCurrentPlayer().getNickname());\n }", "@Override\n protected boolean isPersonalTell(ChatEvent evt){\n String type = evt.getType();\n return \"tell\".equals(type) || \"say\".equals(type) || \"ptell\".equals(type);\n }", "public void hideChat(){\n\t\tElement chat = nifty.getScreen(\"hud\").findElementByName(\"chatPanel\");\n\t\tchat.setVisible(false);\n\t}", "private void showFeedback(String message) {\n if (myHost != null) {\n myHost.showFeedback(message);\n } else {\n System.out.println(message);\n }\n }", "private void showFeedback(String message) {\n if (myHost != null) {\n myHost.showFeedback(message);\n } else {\n System.out.println(message);\n }\n }", "public boolean hasFollowUp() \n {\n return followUp.equals(Constants.CLOSE);\n }", "public void youWinByAbandonment() {\n try {\n if (getClientInterface() != null)\n getClientInterface().gameEndedByAbandonment(\"YOU WON BECAUSE YOUR OPPONENTS HAVE ABANDONED!!\");\n }\n catch (RemoteException e) {\n System.out.println(\"remote sending ended by abandonment error\");\n }\n }", "@PermitAll\n public void cmdWho(User teller) {\n Formatter msg = new Formatter();\n Collection<Player> playersOnline = tournamentService.findOnlinePlayers();\n for (Player player : playersOnline) {\n msg.format(\" %s \\\\n\", player);\n }\n command.qtell(teller, msg);\n }", "public boolean test(CommandSender sender, MCommand command);", "public static void continueChat()\r\n {\r\n do\r\n {\r\n NPCChat.clickContinue(true);\r\n General.sleep(300, 450);\r\n }\r\n while (NPCChat.getClickContinueInterface() != null);\r\n General.sleep(300, 350);\r\n }", "void spawnBot( String className, String messager ) {\n spawnBot( className, null, null, messager);\n }", "public void sendGameInfoToAll(){\r\n\t\t\r\n\t\tVector<Player> players = lobby.getLobbyPlayers();\t\r\n\t\tString message = \"UDGM\" + lobby.getGameString();\r\n\t\t\r\n\t\tif(!players.isEmpty()){\r\n\t \tfor(int i=0; i<players.size(); i++){\t \t\t\r\n\t \t\tsendOnePlayer(players.get(i), message);\t \t\t\r\n\t \t}\r\n\t\t}\r\n\t}", "public void run() {\n mOpponentEmoteBubble.setText(botEmotesArray[new Random().nextInt(botEmotesArray.length)]);\n showEmote(mOpponentEmoteBubble);\n\n }", "public static void sendNormalMOTD(Player target) {\n boolean somethingSent = false;\n\n //Send motd title\n if (motd.has(\"title\")) {\n target.sendMessage(ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n somethingSent = true;\n }\n\n //Send priority messages\n if (motd.has(\"priority\")) {\n String[] priority = new String[motd.getJSONArray(\"priority\").length()];\n for (int i = 0; i < priority.length; i++) {\n priority[i] = ChatColor.GOLD + \" > \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i));\n }\n target.sendMessage(priority);\n somethingSent = true;\n }\n\n //send a few random daily's\n if (motd.has(\"normal\") && !motd.getJSONArray(\"normal\").isEmpty()) {\n Random r = new Random();\n int totalNormalMessages;\n\n if (motdNormalCount > motd.getJSONArray(\"normal\").length()) {\n totalNormalMessages = motd.getJSONArray(\"normal\").length();\n } else {\n totalNormalMessages = motdNormalCount;\n }\n\n String[] normalMessages = new String[totalNormalMessages];\n JSONArray used = new JSONArray();\n int itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n normalMessages[0] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n used.put(itemNum);\n\n for (int i = 1; i < totalNormalMessages; i++) {\n while (used.toList().contains(itemNum)) {\n itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n }\n normalMessages[i] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n }\n\n target.sendMessage(normalMessages);\n somethingSent = true;\n }\n\n }", "private boolean isMentioned(MessageReceivedEvent event) {\n Message message = event.getMessage();\n\n if (message.getContentRaw().equals(\"<@!\" + ID.SELF + \">\")) {\n message.reply(\"Hi, my prefix is `\" + Setting.PREFIX + \"`. You can also use `/help` for more info.\").queue();\n return true;\n }\n\n return false;\n }", "private boolean m36043c(Throwable th) {\n return ((th instanceof ShareTextException) && ((ShareTextException) th).d() == ExceptionType.USER_IS_HIDDEN) ? true : null;\n }", "private void awaitT(){\n try {\n game.getBarrier().await(20, TimeUnit.SECONDS);\n } catch (InterruptedException e) {\n e.printStackTrace();\n } catch (BrokenBarrierException e) {\n e.printStackTrace();\n } catch (TimeoutException e) {\n trimBarrier();\n synchronized (lock){\n if(!botSignal){\n bot = new BotClient();\n new Thread(bot).start();\n botSignal = true;\n }\n\n }\n }\n }", "private void command(){\n out.println(\"Enter command: \");\n String comInput = in.nextLine();\n\n if (comInput.toLowerCase().equals(\"vote\")) {\n voteCommand();\n }else if (comInput.toLowerCase().equals(\"trade\")){\n tradeCommand();\n }else if (comInput.toLowerCase().equals(\"next\")){\n out.println(waitPrint());\n await();\n// nextRound();\n }else if(comInput.toLowerCase().equals(\"logout\")){\n// login = false;\n logout();\n }\n }", "private void announceWinner() {\n // FIXME\n if (_board.turn() == Piece.WP) {\n System.out.println(\"Black wins.\");\n } else {\n System.out.println(\"White wins.\");\n }\n }", "@Override\n public void onResponse(String response) {\n Log.i(\"Checking\", response + \" \");\n if(new ServerReply(response).getStatus())\n {\n Toast.makeText(context,new ServerReply(response).getReason(),Toast.LENGTH_LONG).show();\n }\n\n }", "public void talk() {\n\n\t}", "private boolean inspect(Pinner pinner) {\n if (unfollowConfig.getUnfollowOnlyRecordedFollowings()) {\n if (pinbot3.PinBot3.dalMgr.containsObjectExternally(pinner, DALManager.TYPES.duplicates_unfollow_pinners, account)) {\n return false;\n }\n /*for (PinterestObject p : account.getDuplicates_follow()) {\n if (p instanceof Pinner && ((Pinner) p).equals(pinner)\n && (new Date()).getTime() - ((Pinner) p).getTimeFollow() <= unfollowConfig.getTimeBetweenFollowAndUnfollow()) {\n return false;\n }\n }*/\n }\n\n if (!unfollowConfig.getCriteria_Users()) {\n return true;\n }\n\n String url = \"/\" + pinner.getUsername() + \"/\";\n String referer = pinner.getBaseUsername();\n int pincount = pinner.getPinsCount();\n int followerscount = pinner.getFollowersCount();\n\n if (!(pincount >= unfollowConfig.getCriteria_UserPinsMin() && pincount <= unfollowConfig.getCriteria_UserPinsMax())) {\n return true;\n }\n if (!(followerscount >= unfollowConfig.getCriteria_UserFollowersMin() && followerscount <= unfollowConfig.getCriteria_UserFollowersMax())) {\n return true;\n }\n\n try {\n if (!Http.validUrl(base_url + url)) {\n return false;\n }\n\n String rs = MakeRequest(base_url + url, referer, Http.ACCEPT_HTML);\n if (rs == null) {\n return false;\n }\n\n Pattern pattern = Pattern.compile(\"name=\\\"pinterestapp:following\\\" content=\\\"(\\\\d+)\\\"\", Pattern.DOTALL | Pattern.CASE_INSENSITIVE & Pattern.MULTILINE);\n Matcher matcher = pattern.matcher(rs);\n if (matcher.find()) {\n int followingcount = Integer.parseInt(matcher.group(1));\n if (!(followingcount >= unfollowConfig.getCriteria_UserFollowingMin() && followingcount <= unfollowConfig.getCriteria_UserFollowingMax())) {\n return true;\n }\n }\n\n pattern = Pattern.compile(\"name=\\\"pinterestapp:boards\\\" content=\\\"(\\\\d+)\\\"\", Pattern.DOTALL | Pattern.CASE_INSENSITIVE & Pattern.MULTILINE);\n matcher = pattern.matcher(rs);\n if (matcher.find()) {\n int boardcount = Integer.parseInt(matcher.group(1));\n if (!(boardcount >= unfollowConfig.getCriteria_UserBoardsMin() && boardcount <= unfollowConfig.getCriteria_UserBoardsMax())) {\n return true;\n }\n }\n return true;\n } catch (InterruptedException ex) {\n //ignore\n config.isInterrupt = true;\n return false;\n } catch (Exception ex) {\n common.ExceptionHandler.reportException(ex);\n return false;\n }\n }", "public void confusionIntent(View v){\n if(!MultiplayerManager.getInstance().enoughTimeBetweenCommands()){\n showToast(\"Please wait a second before issueing another command\");\n return;\n }\n\n if(!myTurn){\n showToast(\"Wait for your turn imbecile\");\n return;\n }\n if(powerup_confusion){\n showTimedAlertDialog(\"CONFUSION activated!\", \"Opponent will move randomley next round\", 5);\n powerup_confusion = false;\n ImageView img = findImageButton(\"confusion_container\");\n img.setImageDrawable(getResources().getDrawable(R.drawable.confusion_disabled));\n MultiplayerManager.getInstance().SendMessage(\"opponent_confusion\");\n }\n }", "@Override\r\n\tpublic void showPartner() {\n\t\tSystem.out.println(\"你的情侣是: \"+partner);\r\n\t}", "public void sendDirectedPresence() {\n Cursor cursor = getContentResolver().query(\n Roster.CONTENT_URI,\n new String[]{Roster.LAST_UPDATED},\n null, null, \"last_updated desc\"\n );\n if (cursor.moveToFirst()) {\n long after = cursor.getLong(\n cursor.getColumnIndex(Roster.LAST_UPDATED));\n Presence presence = new Presence(Type.available);\n presence.setTo(\"broadcaster.buddycloud.com\");\n client.sendFromAllResources(presence);\n }\n cursor.close();\n }", "public void showBreach();", "boolean hasChatType();", "private void sendGameCommand(){\n\n }", "public boolean chatEnabled();", "public void communicate() {\n // Send\n for (int i = 0; i < robots.length; i++) {\n if (i != this.id) {\n if (objectFound) {\n System.out.println(\"Robot \" + this.id + \": Telling everyone else...\");\n this.robots[i].mailbox[i] = new Message(this.id, this.objectFound, goal);\n } else {\n this.robots[i].mailbox[i] = new Message(this.id, this.objectFound, null);\n }\n }\n }\n // Read\n for (int i = 0; i < mailbox.length; i++) {\n if (i != this.id && mailbox[i] != null && mailbox[i].objectFound) {\n this.objectFound = true;\n this.goal = mailbox[i].objectLocation;\n }\n }\n }", "public void enableChat();", "public void whileChatting() throws IOException{\n\t\t\n\t\tString message = \"You are now connected. Gear up to chat like never before...\";\n\t\tsendMessage(message);\n\t\tableToType(true);\n\t\t\n\t\tdo {\n\t\t\t\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\tmessage = (String) input.readObject();\n\t\t\t\t//Anything coming in the input stream is treated as an object and then will be stored in the variable message as a string.\n\t\t\t\tshowMessage(\"\\n\" + message);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tcatch(ClassNotFoundException cnfException) {\n\t\t\t\t\n\t\t\t\tshowMessage (\"\\n An error occured with the message sent.\");\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\twhile (!message.equalsIgnoreCase(\"CLIENT - END\"));\n\t\t//While the client has not sent a message saying \"END\".\n\t\t\n\t}", "@Override\n public void help(CommandSender sender) {\n \n }", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();" ]
[ "0.7136602", "0.66668403", "0.653307", "0.65222085", "0.6414009", "0.61275935", "0.6111768", "0.59100777", "0.5899304", "0.5890466", "0.5775956", "0.5766269", "0.56567067", "0.5656332", "0.56318533", "0.56133467", "0.55975384", "0.5567454", "0.555606", "0.5522783", "0.549617", "0.54827064", "0.5477407", "0.54635644", "0.5443397", "0.54432315", "0.5437126", "0.54309136", "0.53909445", "0.53801596", "0.5379742", "0.5350204", "0.5343317", "0.53406066", "0.53175706", "0.5317369", "0.53143185", "0.5284579", "0.5283962", "0.5240115", "0.52332324", "0.5228347", "0.52050513", "0.5202682", "0.51986533", "0.519467", "0.5185177", "0.51814854", "0.517942", "0.51789623", "0.5176267", "0.5171339", "0.5165193", "0.51550514", "0.51452017", "0.51317024", "0.512941", "0.511998", "0.511929", "0.51157683", "0.5109501", "0.51041317", "0.51038796", "0.50901115", "0.508083", "0.50783545", "0.5074578", "0.5072518", "0.5072518", "0.5067537", "0.5065992", "0.50651765", "0.5061508", "0.50586015", "0.5057004", "0.5050879", "0.5047996", "0.5043591", "0.50401473", "0.5038222", "0.5037528", "0.5034151", "0.5021851", "0.50172347", "0.501452", "0.5008607", "0.5006807", "0.5006111", "0.49986136", "0.49977517", "0.49968773", "0.49959996", "0.49955854", "0.4989654", "0.49873894", "0.49755162", "0.49715582", "0.49680334", "0.49680334", "0.49680334", "0.49680334" ]
0.0
-1
If we get a bot, dip
@SubscribeEvent public void onVoiceLeft(GuildVoiceLeaveEvent event) { if (event.getMember().getUser().isBot()) return; // Logic GuildUserModel guildUser = taules.dataManager.getGuildUserModel(event.getGuild().getIdLong(), event.getMember()); List<CallLogModel> callLogs = new QCallLogModel() .guild_user.eq(guildUser.getId()) .time_left.eq(null) .order("time_joined DESC") .findList(); if (callLogs.size() >= 1) { callLogs.get(0).setTime_left(new java.sql.Timestamp(Calendar.getInstance().getTime().getTime())); DB.save(callLogs.get(0)); if (callLogs.size() > 1){ for(int i = 1; i < callLogs.size(); i++){ callLogs.get(i).setTime_left(callLogs.get(i).getTime_joined()); DB.save(callLogs.get(i)); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isBot(){\n return false;\n }", "public boolean isBot() {\n//\t\treturn this.getUserIO().checkConnection();\n\t\treturn false;\n\t}", "public boolean getBot() {\n return bot;\n }", "public boolean isBot() {\n \t\treturn (type == PLAYER_BOT);\n \t}", "@Override\n public boolean isNeedShowBOTPRule() {\n \treturn true;\n }", "static private void TalkTo() {\n if (BSChristiansen.getCurrentRoom() == currentRoom) {\n System.out.println(BSChristiansen.getDescription() + \", yet he still gives you good advice:\\n\");\n System.out.println(BSChristiansen.getDialog(0));\n System.out.println(\"\");\n woundedSurvivor();\n } else if (mysteriousCrab.getCurrentRoom() == currentRoom && inventory.getInventory().containsKey(\"Shroom\")) {\n System.out.println(mysteriousCrab.getDescription() + \"\\n\" + mysteriousCrab.getDialog(0));\n } else {\n System.out.println(\"There is nobody to communicate with in this Room\");\n }\n\n }", "private boolean checkDadBot(MessageReceivedEvent event) {\n String message = event.getMessage().getContentDisplay();\n\n // Ignore messages that are too short or long to be funny\n if (message.length() < 5 || message.length() > 40)\n return false;\n\n String name = null;\n\n if (message.toLowerCase(Locale.ROOT).startsWith(\"i'm \"))\n name = message.substring(4);\n else if (message.toLowerCase(Locale.ROOT).startsWith(\"im \"))\n name = message.substring(3);\n\n if (name != null && Math.random() < Setting.DAD_BOT_CHANCE) {\n event.getMessage().reply(\"Hi \" + name + \", I'm StatsBot!\").queue();\n return true;\n }\n\n return false;\n }", "public void executeBot(){\n if(botSignal){\n if(bot != null){\n bot.execute();\n }\n }\n botSignal=false;\n }", "public void playHoomans() {\r\n System.out.println(\"Thanks for killing each other, human!\");\r\n }", "@Override\n public void onMessageReceived(@NotNull MessageReceivedEvent event) {\n String message = event.getMessage().getContentRaw().toLowerCase();\n Commands commands = Main.getBOT().getCommands();\n\n // When message is intended for bob, check it\n if (message.startsWith(\"!bob\")) {\n commands.evaluateCommand(message.replace(\"!bob \", \"\"), event);\n } else if (message.contains(\"#blamekall\")) {\n event.getChannel().sendMessage(\"NO! BE NICE! GO TO NAUGHTY JAIL!\").queue();\n event.getChannel().sendMessage(\"https://tenor.com/view/bonk-gif-18805247\").queue();\n }\n\n }", "private void cs0() {\n\t\t\tif(!Method.isChatiing()){\n\t\t\t\tMethod.npcInteract(RUNESCAPEGUIDE, \"Talk-to\");\n\t\t\t}\n\t\t\t\n\t\t}", "private static void readIsPracticeBot() {\n isPracticeBot = !practiceInput.get();\n }", "public void playTopHat() {\n\t\tSystem.out.println(\"ding ding da-ding\");\n\t\t\n\t}", "@View( VIEW_BOT )\r\n public XPage viewBot( HttpServletRequest request )\r\n {\r\n String strBotKey = request.getParameter( PARAMETER_BOT );\r\n if ( strBotKey == null )\r\n {\r\n // assuming the bot is the current session bot\r\n if ( _strBotKey == null )\r\n {\r\n // session is closed\r\n return redirectView( request, VIEW_LIST );\r\n }\r\n }\r\n else\r\n {\r\n if ( !strBotKey.equals( _strBotKey ) )\r\n {\r\n // new bot or bot has changed\r\n initSessionParameters( request, strBotKey );\r\n }\r\n }\r\n if ( _bot == null )\r\n {\r\n return redirectView( request, VIEW_BOT_NOT_FOUND );\r\n }\r\n boolean bTypedScript = AppPropertiesService.getPropertyBoolean( PROPERTY_TYPED_SCRIPT, DEFAULT_TYPED_SCRIPT );\r\n List<Post> listPosts = ChatService.getConversation( _strConversationId, _bot, _locale );\r\n Map<String, Object> model = getModel( );\r\n model.put( MARK_POSTS_LIST, listPosts );\r\n model.put( MARK_BOT_AVATAR, _bot.getAvatarUrl( ) );\r\n model.put( MARK_BASE_URL, AppPathService.getBaseUrl( request ) );\r\n model.put( MARK_BOT, _strBotKey );\r\n model.put( MARK_LANGUAGE, _locale.getLanguage( ) );\r\n model.put( MARK_STANDALONE, ( _bStandalone ) ? \"true\" : \"false\" );\r\n model.put( MARK_TYPED_SCRIPT, bTypedScript );\r\n\r\n String strTemplate = ( _bStandalone ) ? TEMPLATE_BOT_STANDALONE : TEMPLATE_BOT;\r\n XPage xpage = getXPage( strTemplate, request.getLocale( ), model );\r\n xpage.setTitle( _bot.getName( _locale ) );\r\n xpage.setPathLabel( _bot.getName( _locale ) );\r\n xpage.setStandalone( _bStandalone );\r\n\r\n return xpage;\r\n }", "@Override\n public void logic() throws PogamutException {\n /*\n * Step:\n * 1. find the bot and approach him (get near him ... distance < 200)\n * 2. greet him by saying \"Hello!\"\n * 3. upon receiving reply \"Hello, my friend!\"\n * 4. answer \"I'm not your friend.\"\n * 5. and fire a bit at CheckerBot (do not kill him, just a few bullets)\n * 6. then CheckerBot should tell you \"COOL!\"\n * 7. then CheckerBot respawns itself\n * 8. repeat 1-6 until CheckerBot replies with \"EXERCISE FINISHED\"\n */\n Location loc = new Location(0, 0, 0);\n weaponry.changeWeapon(UT2004ItemType.ASSAULT_RIFLE);\n switch (state) {\n case 0: // navigate to random point\n if (!navigation.isNavigating())\n navigation.navigate(this.navPoints.getRandomNavPoint());\n if (players.canSeePlayers()) {\n loc = players.getNearestVisiblePlayer().getLocation();\n navigation.navigate(loc);\n log.info(\"Bot see player on \" + loc.toString());\n }\n if (loc.getDistance(bot.getLocation()) < 190) {\n navigation.stopNavigation();\n log.info(\"Bot is close enough\");\n state = 1;\n }\n if (congrats_receive) {\n log.info(\"Received info about success\");\n state = 7;\n }\n break;\n case 1: // nearby player\n this.sayGlobal(\"Hello!\");\n resetTimeout();\n state = 2;\n break;\n case 2: //waiting for answer\n tickTimeout();\n if (received.equals(\"Hello, my friend!\")) {\n log.info(\"Answer received\");\n state = 3;\n }\n else if (receiveTimeout) {\n log.warning(\"Answer didn't received, repeating.\");\n navigation.navigate(navPoints.getRandomNavPoint());\n state = 0;\n }\n break;\n case 3: // say back\n this.sayGlobal(\"I'm not your friend.\");\n state = 4;\n break;\n case 4:\n if (players.getNearestVisiblePlayer() == null) {\n log.warning(\"Resetting because no player in view\");\n state = 0;\n } else {\n shoot.shoot(players.getNearestVisiblePlayer());\n log.info(\"Start shooting at the enemy\");\n resetTimeout();\n state = 5;\n }\n break;\n case 5:\n tickTimeout();\n if (damaged) {\n shoot.stopShooting();\n damaged = false;\n resetTimeout();\n log.info(\"Enemy damaged\");\n state = 6;\n } else if (receiveTimeout) {\n log.warning(\"Resetting because not damage to the enemy\");\n state = 0;\n }\n break;\n case 6:\n tickTimeout();\n if (cool_received){\n log.info(\"Success in the turn, repeating\");\n cool_received = false;\n resetTimeout();\n state = 0;\n }\n else if(receiveTimeout) {\n log.warning(\"No final answer, repeating\");\n state = 0;\n }\n break;\n case 7:\n sayGlobal(\"I solved the exercise.\");\n }\n }", "protected void botAction(String lastAnswer){\n\t\tIdentifyResponse ir = new IdentifyResponse();\n\t\tint n = ir.getInt(lastAnswer);\n\t\t\n\t\tswitch (n){\n\t\t\tcase 1:\n\t\t\t\tresponseFail();\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tresponseSuccess();\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tresponseNothingToPickUp();\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tresponseSuccessPickUp();\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tresponseGold(lastAnswer);\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tresponseWelcome();\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tresponseEndGame();\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tresponseMap(lastAnswer);\n\t\t\t\tbreak;\n\t\t}\n\t}", "Bot getBotByBotId(String botId) throws CantGetBotException;", "@Test\n public void play() {\n System.out.println(client.botBegin());\n }", "@Override\n\tpublic boolean isReceiving() {\n\t\t// set remotely, so we need to call botinfo()\n\t\tif (botinfo().getLastReceivedMessage() < clock.currentTimeMillis() - 10000) {\n\t\t\tthrow new NotFoundException();\n\t\t}\n\t\treturn true;\n\t}", "public static void printGoodbye() {\n botSpeak(Message.GOODBYE);\n }", "@Test\n public void botPlay() {\n Bot.randomBot(0);\n }", "@Override\n\tpublic void doChat(LoginDetails loginDetails) {\n\tSystem.out.println(\"Boomer chat\");\t\n\t}", "private static void debugMessage(GuildMessageReceivedEvent event) {\n String preface = \"[Discord IDs] \";\n\n System.out.println(\"====== PING COMMAND ======\");\n System.out.println(preface + \"`!ping` SENDER:\");\n System.out.println(\n \"\\t{USER} ID: \" + event.getAuthor().getId() +\n \"\\tName: \" + event.getMember().getEffectiveName() +\n \" (\" + event.getAuthor().getAsTag() + \")\");\n\n System.out.println(preface + \"BOT ID:\\t\" + event.getJDA().getSelfUser().getId());\n System.out.println(preface + \"GUILD ID:\\t\" + event.getGuild().getId());\n\n System.out.println(preface + \"ROLES:\");\n event.getGuild().getRoles().forEach(role -> {\n System.out.println(\"\\t{ROLES} ID: \" + role.getId() + \"\\tName: \" + role.getName());\n });\n\n System.out.println(preface + \"MEMBERS:\");\n event.getGuild().getMembers().forEach(member -> {\n System.out.println(\n \"\\t{MEMEBERS} ID: \" + member.getUser().getId() +\n \"\\tName: \" + member.getEffectiveName() +\n \" (\" + member.getUser().getAsTag() + \")\");\n });\n\n System.out.println(preface + \"Categories:\");\n event.getGuild().getCategories().forEach(category -> {\n System.out.println(\"\\t{CATEGORY} ID: \" + category.getId() + \"\\tName: \" + category.getName());\n category.getChannels().forEach(guildChannel -> {\n System.out.println(\n \"\\t\\t:\" + guildChannel.getType().name().toUpperCase() + \":\" +\n \"\\tID: \" + guildChannel.getId() +\n \"\\tName: \" + guildChannel.getName() +\n \"\\tlink: \" + \"https://discord.com/channels/\" + Settings.GUILD_ID + \"/\" + guildChannel.getId());\n });\n });\n System.out.println(\"==== PING COMMAND END ====\");\n }", "public static void handleShowdownMeg(BufferedReader br) throws IOException {\n\t\twhile( !(rec = br.readLine()).equals(\"/showdown \") ){\n\t\t\tSystem.out.println(rec);\n\t\t}\n\t}", "public static void sendMOTDEdit(Player target) {\n if (motd.has(\"title\")){\n target.sendMessage(ChatColor.GREEN + \" > MOTD Title: \" + ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n }\n \n if (motd.has(\"priority\")) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.GOLD + \" Priority messages. These will always show to the player.\");\n for (int i = 0; i < motd.getJSONArray(\"priority\").length(); i++) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.AQUA + String.valueOf(i) + \" \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i)));\n }\n if (motd.has(\"normal\")) {\n target.sendMessage(ChatColor.GREEN + \"--------------------------------------------------\");\n }\n } else {\n target.sendMessage(ChatColor.GREEN + \" > There are no priority messages\");\n }\n\n if (motd.has(\"normal\")) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.GOLD + \" Normal messages. A random \" + motdNormalCount + \" will be show to players each time.\");\n for (int i = 0; i < motd.getJSONArray(\"normal\").length(); i++) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.AQUA + String.valueOf(i) + \" \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(i)));\n }\n } else {\n target.sendMessage(ChatColor.GREEN + \" > There are no normal messages\");\n }\n }", "public Chatbot getMySillyChatbot()\n\t{\n\t\treturn mySillyChatbot;\n\t}", "void spawnBot( String className, String login, String password, String messager ) {\n CoreData cdata = m_botAction.getCoreData();\n long currentTime;\n\n String rawClassName = className.toLowerCase();\n BotSettings botInfo = cdata.getBotConfig( rawClassName );\n\n if( botInfo == null ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn bot of type \" + className + \". Invalid bot type or missing CFG file.\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn bot of type \" + className + \". Invalid bot type or missing CFG file.\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"That bot type does not exist, or the CFG file for it is missing.\" );\n return;\n }\n\n Integer maxBots = botInfo.getInteger( \"Max Bots\" );\n Integer currentBotCount = m_botTypes.get( rawClassName );\n\n if( maxBots == null ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn bot of type \" + className + \". Invalid settings file. (MaxBots improperly defined)\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn bot of type \" + className + \". Invalid settings file. (MaxBots improperly defined)\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"The CFG file for that bot type is invalid. (MaxBots improperly defined)\" );\n return;\n }\n\n if( login == null && maxBots.intValue() == 0 ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn bot of type \" + className + \". Spawning for this type is disabled on this hub.\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn bot of type \" + className + \". Spawning for this type is disabled on this hub.\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"Bots of this type are currently disabled on this hub. If you are running another hub, please try from it instead.\" );\n return;\n }\n\n if( currentBotCount == null ) {\n currentBotCount = new Integer( 0 );\n m_botTypes.put( rawClassName, currentBotCount );\n }\n\n if( login == null && currentBotCount.intValue() >= maxBots.intValue() ) {\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" tried to spawn a new bot of type \" + className + \". Maximum number already reached (\" + maxBots + \")\" );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader tried to spawn a new bot of type \" + className + \". Maximum number already reached (\" + maxBots + \")\" );\n\n m_botAction.sendSmartPrivateMessage( messager, \"Maximum number of bots of this type (\" + maxBots + \") has been reached.\" );\n return;\n }\n\n String botName, botPassword;\n currentBotCount = new Integer( getFreeBotNumber( botInfo ) );\n\n if( login == null || password == null ) {\n botName = botInfo.getString( \"Name\" + currentBotCount );\n botPassword = botInfo.getString( \"Password\" + currentBotCount );\n } else {\n botName = login;\n botPassword = password;\n }\n\n Session childBot = null;\n\n try {\n // FIXME: KNOWN BUG - sometimes, even when it detects that a class is updated, the loader\n // will load the old copy/cached class. Perhaps Java itself is caching the class on occasion?\n if( m_loader.shouldReload() ) {\n System.out.println( \"Reinstantiating class loader; cached classes are not up to date.\" );\n resetRepository();\n m_loader = m_loader.reinstantiate();\n }\n\n Class<? extends SubspaceBot> roboClass = m_loader.loadClass( \"twcore.bots.\" + rawClassName + \".\" + rawClassName ).asSubclass(SubspaceBot.class);\n String altIP = botInfo.getString(\"AltIP\" + currentBotCount);\n int altPort = botInfo.getInt(\"AltPort\" + currentBotCount);\n String altSysop = botInfo.getString(\"AltSysop\" + currentBotCount);\n\n if(altIP != null && altSysop != null && altPort > 0)\n childBot = new Session( cdata, roboClass, botName, botPassword, currentBotCount.intValue(), m_group, altIP, altPort, altSysop, true);\n else\n childBot = new Session( cdata, roboClass, botName, botPassword, currentBotCount.intValue(), m_group, true);\n } catch( ClassNotFoundException cnfe ) {\n Tools.printLog( \"Class not found: \" + rawClassName + \".class. Reinstall this bot?\" );\n return;\n }\n\n currentTime = System.currentTimeMillis();\n\n if( m_lastSpawnTime + SPAWN_DELAY > currentTime ) {\n m_botAction.sendSmartPrivateMessage( messager, \"Subspace only allows a certain amount of logins in a short time frame. Please be patient while your bot waits to be spawned.\" );\n\n if( m_spawnQueue.isEmpty() == false ) {\n int size = m_spawnQueue.size();\n\n if( size > 1 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"There are currently \" + m_spawnQueue.size() + \" bots in front of yours.\" );\n } else {\n m_botAction.sendSmartPrivateMessage( messager, \"There is only one bot in front of yours.\" );\n }\n } else {\n m_botAction.sendSmartPrivateMessage( messager, \"You are the only person waiting in line. Your bot will log in shortly.\" );\n }\n\n if(messager != null)\n m_botAction.sendChatMessage( 1, messager + \" in queue to spawn bot of type \" + className );\n else\n m_botAction.sendChatMessage( 1, \"AutoLoader in queue to spawn bot of type \" + className );\n }\n\n String creator;\n\n if(messager != null) creator = messager;\n else creator = \"AutoLoader\";\n\n ChildBot newChildBot = new ChildBot( rawClassName, creator, childBot );\n addToBotCount( rawClassName, 1 );\n m_botStable.put( botName, newChildBot );\n m_spawnQueue.add( newChildBot );\n }", "public void action(BotInstance bot, Message message);", "public final boolean hasHerochat()\n\t{\n\t\treturn herochat != null;\n\t}", "private void viewPlayer(Command command)\n { if(!command.hasSecondWord()) { \n // if there is no second word, we don't know where to go... \n Logger.Log(\"What do you want to view?\"); \n return; \n } \n \n String thingToView = command.getSecondWord();\n String inventory = \"inventory\";\n String companions = \"companions\";\n \n if (!thingToView.equals(inventory)&&!thingToView.equals(companions)){\n Logger.Log(\"You can only view your inventory or your current companions\");\n }\n else if (thingToView.equals(inventory)&&!player.inventory.isEmpty()) {\n Logger.Log(\"~*\" + player.playerName + \"'s Backpack *~\");\n player.viewInventory();\n Logger.Log(\"~*~*~*~*~*~\");\n }\n else if (thingToView.equals(inventory)&&player.inventory.isEmpty()){\n Logger.Log(\"There is nothing in your backpack...\");\n }\n else if (thingToView.equals(companions)&&!player.friends.isEmpty()) {\n Logger.Log(\"~*\" + player.playerName + \"'s Companions *~\");\n player.viewCompanions();\n Logger.Log(\"~*~*~*~*~*~\");\n }\n else if (thingToView.equals(companions)&&player.friends.isEmpty()) {\n Logger.Log(\"You don't have any companions at the moment :(\");\n }\n \n \n }", "private void logout(){\n player.setName(\"(bot) \" + player.getName());\n botMode = true;\n System.out.println(\"bot made\");\n login = false;\n }", "private static Player getThroughWhomSendMessage() {\n\t\treturn Remain.getOnlinePlayers().isEmpty() ? null : Remain.getOnlinePlayers().iterator().next();\n\t}", "public interface Bot extends Runnable {\r\n \r\n /** AOBot.State defines the various states that a bot can be in at any point in time. */\r\n public enum State {\r\n DISCONNECTED, CONNECTED, AUTHENTICATED, LOGGED_IN;\r\n } // end enum State\r\n \r\n /** Returns the current state of this bot. */\r\n State getState();\r\n \r\n /** \r\n * Returns the character that the bot is logged in as \r\n * (or null if the bot is not logged in).\r\n */\r\n CharacterInfo getCharacter();\r\n \r\n /** Returns the bot's current style sheet. */\r\n // AOBotStyleSheet getStyleSheet();\r\n \r\n /**\r\n * Reads the next packet from the server. \r\n * \r\n * @throws AOBotStateException if the bot is in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to read a packet\r\n */\r\n Packet nextPacket() throws IOException;\r\n /**\r\n * Sends a packet to the server. \r\n * \r\n * @throws AOBotStateException if the bot is in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to send a packet\r\n */\r\n void sendPacket(Packet packet) throws IOException;\r\n \r\n /**\r\n * Connects the bot to the server. This is simply a convience method,\r\n * {@code connect(server)} is equivalent to\r\n * {@code connect( server.getURL(), server.getPort() )}\r\n * \r\n * @throws NullPointerException if {@code server} is null\r\n * @throws AOBotStateException if the bot is not in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to connect to the server\r\n *\r\n * @see ao.protocol.AODimensionAddress\r\n */\r\n void connect(DimensionAddress server) throws IOException;\r\n /**\r\n * Connects the bot to the server. \r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#DISCONNECTED} state\r\n * @throws IOException if an error occured while attempting to connect to the server\r\n */\r\n void connect(String server, int port) throws IOException;\r\n /**\r\n * Authenticates a user with the server.\r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#CONNECTED} state\r\n * @throws IOException if an error occured while attempting to authenticate the client with the server\r\n */\r\n void authenticate(String userName, String password) throws IOException;\r\n /**\r\n * Logs a character into the server. \r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#AUTHENTICATED} state\r\n * @throws IOException if an error occured while attempting to log the client into the server\r\n */\r\n void login(CharacterInfo character) throws IOException;\r\n /**\r\n * Starts the bot. \r\n * \r\n * @throws AOBotStateException if the bot is not in the {@link State#LOGGED_IN} state\r\n */\r\n void start();\r\n /** \r\n * Disconnects the bot from the server. \r\n *\r\n * @throws IOException if an error occured while attempting to disconnect the client\r\n */\r\n void disconnect() throws IOException;\r\n \r\n /** Add a listener to this bot. */\r\n void addListener(BotListener l);\r\n /** Remove a listener from this bot. */\r\n void removeListener(BotListener l);\r\n /** Adds a logger to this bot. */\r\n void addLogger(BotLogger logger);\r\n /** Removes a logger from this bot. */\r\n void removeLogger(BotLogger logger);\r\n \r\n}", "public String getResponse(String statement)\r\n\t{\r\n\t\tstatement.toLowerCase();\r\n\t\tChatBotChen chatbot2 = new ChatBotChen();\r\n\t\tChatBotUsman chatbot3 = new ChatBotUsman();\r\n\t\tChatBotYaroslavsky chatbot4 = new ChatBotYaroslavsky();\r\n\t\t\r\n\t\tString[] animalArray = {\"hamster\",\"guinea pig\",\"tortoise\",\"frog\",\"tarantula\",\"snake\",\"dog\",\"cat\",\"fish\",\"seaweed\"};\r\n\t\tint animalPosArray = -1;\r\n\t\t{\r\n\t\t\tfor (String animal:animalArray)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, animal, 0)>=0)\r\n\t\t\t\t{\t\t\t\t\t\r\n\t\t\t\t\tanimalPosArray = Arrays.asList(animalArray).indexOf(animal);\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (animalPosArray< 2 && animalPosArray>-1)\r\n\t\t{\r\n\t\t\twhile (statement!=\"Bye\")\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(chatbot2.getResponse(statement));\r\n\t\t\t\tstatement = in.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\telse if (animalPosArray< 8 && animalPosArray>5)\r\n\t\t{\r\n\t\t\twhile (statement!=\"Bye\")\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(chatbot4.getResponse(statement));\r\n\t\t\t\tstatement = in.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (animalPosArray< 10 && animalPosArray>7)\r\n\t\t{\r\n\t\t\twhile (statement!=\"Bye\")\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(chatbot3.getResponse(statement));\r\n\t\t\t\tstatement = in.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tif (findKeyword(statement, \"tortoise\", 0)>=0)\r\n\t\t{\r\n\t\t\tpatience = patience +3;\r\n\t\t\tconvoTortoise = true;\r\n\t\t\tconvoFrog = false;\r\n\t\t\tconvoTarantula = false;\r\n\t\t\tconvoSnake = false;\r\n\t\t}\r\n\t\telse if (findKeyword(statement, \"frog\", 0)>=0)\r\n\t\t{\r\n\t\t\tpatience--;\r\n\t\t\tconvoTortoise = false;\r\n\t\t\tconvoFrog = true;\r\n\t\t\tconvoTarantula = false;\r\n\t\t\tconvoSnake = false;\r\n\t\t}\r\n\t\telse if (findKeyword(statement, \"tarantula\", 0)>=0)\r\n\t\t{\r\n\t\t\tpatience++;\r\n\t\t\tconvoTortoise = false;\r\n\t\t\tconvoFrog = false;\r\n\t\t\tconvoTarantula = true;\r\n\t\t\tconvoSnake = false;\r\n\t\t}\r\n\t\telse if (findKeyword(statement, \"snake\", 0)>=0)\r\n\t\t{\r\n\t\t\tconvoTortoise = false;\r\n\t\t\tconvoFrog = false;\r\n\t\t\tconvoTarantula = false;\r\n\t\t\tconvoSnake = true;\r\n\t\t}\r\n\t\tif (statement.length()==0)\r\n\t\t{\r\n\t\t\tString[] emptyResponses = {\"You're replying slower than a tortoise!!\",\"I know snakes that type faster than you./nThey don't even have fingers...\",\r\n\t\t\t\t\t\"Please say something.\",\"Hurry up and reply... I have other customers!\"};\r\n\t\t\tint i = (int)Math.random()*(emptyResponses.length);\r\n\t\t\tString answerEmpty = emptyResponses[i];\r\n\t\t\treturn answerEmpty;\r\n\t\t}\r\n\t\telse if (convoTortoise)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif ((findKeyword(statement, \"food\", 0)>=0)||(findKeyword(statement, \"eat\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise usually eat a lot of greens but they can feed on some insects and like fruits as a special treat.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise like habitats with a lot of hideaways and in certain places you should look into if you need special lights to regulate heat.\\nVisit this website to look into building the best habitat for your tortoise http://tortoisegroup.org/desert-tortoise-habitat-checklist/\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! http://www.vetstreet.com/our-pet-experts/tempted-to-get-a-pet-turtle-or-tortoise-read-this-first\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif ((findKeyword(statement, \"live\", 0)>=0)||(findKeyword(statement, \"years\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Depending on living conditions and health issues, tortoises usually live about 70-100 years.\\nThere is a lot of debate on an average life length though.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"We actually have a few Russian Tortoises that you can look at in our store!\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\\nYou can use this article to help answer your question! http://www.vetstreet.com/our-pet-experts/tempted-to-get-a-pet-turtle-or-tortoise-read-this-first\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"tortoise\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"I've always wanted to buy a tortoise!!\\nI encourage that you buy one of our Russian Tortoises.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\telse if (convoFrog)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"food\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise usually eat a lot of greens but they can feed on some insects and like fruits as a special treat.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tortoise like habitats with a lot of hideaways and in certain places you should look into if you need special lights to regulate heat.\\nVisit this website to look into building the best habitat for your tortoise http://tortoisegroup.org/desert-tortoise-habitat-checklist/\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! https://www.wikihow.com/Take-Care-of-Frogs\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"live\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"There isn't a good answer for this but the average is in a range from about 4 to 15.\\nThere is a lot of debate on an average life length though.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"If you do want a frog (I recommend a tortoise), we have some of them available.\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\telse if (findKeyword(statement, \"frog\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"I've never really understood why people want pets as frogs.\\nI think you should buy one of our Russian Tortoises or Tarantulas but we have some frogs available.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\telse if (convoTarantula)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"food\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Tarantulas are insectivorous so crickets are their favorite meal.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"People usually use aquarium-like tanks for habitats of tarantulas.\\nUse this website for help: http://www.tarantulaguide.com/pet-tarantula-cage-and-habitat/\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! http://www.tarantulaguide.com/\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"live\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Female Tarantulas can live up to 30 years while Male ones can only live up to 7 years.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"If you do want a tarantula, we only have one available.\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\\nYou can also check out this website to help you: http://www.tarantulaguide.com/\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse if (findKeyword(statement, \"tarantula\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"Tarantulas intimidate so many people but I think they are so cool.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\telse if (convoSnake)\r\n\t\t{\r\n\t\t\tif (findKeyword(statement, \"what\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"food\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"Some species of snakes eat insects and reptiles like frogs, but others eat warm-blooded animals like mice.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if (findKeyword(statement, \"habitat\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"People usually use aquarium-like tanks for habitats of snakes.\\nThe size of it can depend on your snake.\";\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"What, what? You can ask about what food they eat or what habitat though.\\nYou can use this article to help answer your question! http://www.petmd.com/reptile/care/evr_rp_snake_facts\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (findKeyword(statement, \"how\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\tif (findKeyword(statement, \"live\", 0)>=0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"There isn't a good answer for this but the average is in a range from about 4 to 15.\\nThere is a lot of debate on an average life length though.\";\r\n\t\t\t\t}\r\n\t\t\t\telse if ((findKeyword(statement, \"buy\", 0)>=0)||(findKeyword(statement, \"get\", 0)>=0))\r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"If you want to check out some snakes we have two ball pythons and a corn snake available.\";\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\treturn \"How, what? You can ask how long they live or how to get one.\\nYou can also check out this website to help you: http://www.petmd.com/reptile/care/evr_rp_snake_facts\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse if (findKeyword(statement, \"snake\", 0)>=0)\r\n\t\t\t{\r\n\t\t\t\treturn \"There have been rumors of pet snakes choking their owners but they are pretty chill pets if you know how to take care of them.\\nIf you want you can ask about how long they live or the food or anything else concerning you and I'll see if I can answer it.\";\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treturn randomResponse();\r\n\t\t\r\n\t\t\r\n\t}", "network.message.PlayerResponses.Command getCommand();", "private void boom() {\n showMessage(\"BOOM! Reload to try again\", \"boom\");\n }", "void listBots( String className, String messager ) {\n Iterator<ChildBot> i;\n ChildBot bot;\n String rawClassName = className.toLowerCase();\n\n if( rawClassName.compareTo( \"hubbot\" ) == 0 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"There is only one true master, and that is me.\" );\n } else if( getNumberOfBots( className ) == 0 ) {\n m_botAction.sendSmartPrivateMessage( messager, \"No bots of that type.\" );\n } else {\n m_botAction.sendSmartPrivateMessage( messager, className + \":\" );\n\n for( i = m_botStable.values().iterator(); i.hasNext(); ) {\n bot = i.next();\n\n if( bot != null )\n if( bot.getClassName().compareTo( className ) == 0 )\n m_botAction.sendSmartPrivateMessage( messager, bot.getBot().getBotName() + \" (in \" + bot.getBot().getBotAction().getArenaName() + \"), created by \" + bot.getCreator());\n }\n\n m_botAction.sendSmartPrivateMessage( messager, \"End of list\" );\n }\n }", "@Override\n public void viewWillAppear() throws InterruptedException {\n commandView.addLocalizedText(\"Vuoi essere scomunicato? 0: sì, 1:no\");\n int answ = commandView.getInt(0, 1);\n boolean answer = (answ == 0);\n clientNetworkOrchestrator.send(new PlayerChoiceExcommunication(answer));\n }", "public void onUnknown(String mes) {\n\t\tlong time = System.currentTimeMillis();\n\t\t//Ignores configuration messages\n\t\tif (mes.equals(\":tmi.twitch.tv CAP * ACK :twitch.tv/membership\")\n\t\t\t\t|| mes.equals(\":tmi.twitch.tv CAP * ACK :twitch.tv/tags\")\n\t\t\t\t|| mes.equals(\":tmi.twitch.tv CAP * ACK :twitch.tv/commands\"))\n\t\t\treturn;\n\t\tString tempChan = mes.substring(mes.indexOf(val) + count - 1);\n\t\tString channel = null;\n\t\tif(tempChan.indexOf(\" :\") == -1)\n\t\t\tchannel = tempChan;\n\t\telse\n\t\t\tchannel = tempChan.substring(0, tempChan.indexOf(\" :\"));\n\t\tChatConnection connection = ConnectionList.getChannel(channel);\n\t\tfinal String tags = mes.substring(1, mes.indexOf(\" \" + connection.getChannelName()) + (\" \" + connection.getChannelName()).length());\n\t\t// Private Message, Will implement later!\n\t\tif (mes.indexOf(\" \" + connection.getChannelName()) == -1) \n\t\t\treturn;\n\t\tHashMap<String, String> data = new HashMap<String, String>();\n\t\textractData(connection, data, tags);\n\t\t// ERROR PARSING MESSAGE\n\t\tif (data == null || !data.containsKey(\"tag\")) \n\t\t\treturn;\n\t\tString tag = data.get(\"tag\");\n\t\tString msgSplit = \":tmi.twitch.tv \" + tag + \" \" + connection.getChannelName();\n\t\tUser user = null;\n\t\tMessage message = null;\n\t\t/*\n\t\t * BAN TIMEOUT CLEAR CHAT\n\t\t */\n\t\tif (tag.equalsIgnoreCase(\"CLEARCHAT\")) {\n\t\t\tString username = null;\n\t\t\tif (mes.indexOf(msgSplit) + msgSplit.length() + 2 <= mes.length()) {\n\t\t\t\tusername = mes.substring(mes.indexOf(msgSplit) + msgSplit.length() + 2);\n\t\t\t\tuser = getUser(connection, username);\n\t\t\t}\n\t\t\tif (username != null && data.containsKey(\"ban-reason\")) {\n\t\t\t\tif (data.containsKey(\"ban-duration\") && data.get(\"ban-duration\").length() != 0) \n\t\t\t\t\tmessage = new BanMessage(connection, time, user, Integer.parseInt(data.get(\"ban-duration\")));\n\t\t\t\telse \n\t\t\t\t\tmessage = new BanMessage(connection, time, user);\n\t\t\t} else \n\t\t\t\tmessage = new ClearChatMessage(connection, time);\n\t\t\t\n\t\t}\n\t\t/*\n\t\t * CHANGE CHAT MODE\n\t\t */\n\t\telse if (tag.equalsIgnoreCase(\"NOTICE\")) {\n\t\t\tString messagePrint = mes.substring(mes.indexOf(msgSplit) + msgSplit.length());\n\t\t\tString id = data.get(\"msg-id\");\n\t\t\tboolean enabled = true;\n\t\t\tChatMode mode = ChatMode.OTHER;\n\t\t\tif (id.contains(\"off\")) \n\t\t\t\tenabled = false;\n\t\t\t\n\t\t\t// SUB MODE\n\t\t\tif (id.contains(\"subs_\")) \n\t\t\t\tmode = ChatMode.SUB_ONLY;\n\t\t\t\n\t\t\t// EMOTE ONLY MODE\n\t\t\telse if (id.contains(\"emote_only_\")) \n\t\t\t\tmode = ChatMode.EMOTE_ONLY;\n\t\t\t\n\t\t\t// FOLLOWERS ONLY MODE\n\t\t\telse if (id.contains(\"followers_\")) \n\t\t\t\tmode = ChatMode.FOLLOWER_ONLY;\n\t\t\t\n\t\t\t// SLOW MODE\n\t\t\telse if (id.contains(\"slow_\")) \n\t\t\t\tmode = ChatMode.SLOW;\n\t\t\t\n\t\t\t// R9K MODE\n\t\t\telse if (id.contains(\"r9k_\")) \n\t\t\t\tmode = ChatMode.R9K;\n\t\t\t\n\t\t\tmessage = new ChatModeMessage(connection, time, mode, messagePrint, enabled);\n\t\t}\n\t\t/*\n\t\t * NORMAL CHAT MESSAGE\n\t\t */\n\t\telse if (tag.equalsIgnoreCase(\"PRIVMSG\")) {\n\t\t\t// GETS SENDER\n\t\t\tString temp = \"\";\n\t\t\tString username = data.get(\"display-name\").toLowerCase();\n\t\t\t// no display name\n\t\t\tif (username == null || username.equals(\"\")) {\n\t\t\t\ttemp = data.get(\"user-type\");\n\t\t\t\tusername = temp.substring(temp.indexOf(':') + 1, temp.indexOf('!')).toLowerCase();\n\t\t\t}\n\t\t\tuser = getUser(connection, username);\n\n\t\t\t// BADGES\n\t\t\tString badges = data.get(\"badges\");\n\t\t\tif (!badges.equals(\"\")) {\n\t\t\t\tArrayList<String> badgeList = new ArrayList<String>(Arrays.asList(badges.split(\",\")));\n\t\t\t\tfor (String badge : badgeList) {\n\t\t\t\t\tint splitLoc = badge.indexOf('/');\n\t\t\t\t\tBadgeType type = connection.getBadge(badge.substring(0, splitLoc), badge.substring(splitLoc + 1));\n\t\t\t\t\tif (type == null) \n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tuser.addType(type);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// COLOR\n\t\t\tif (data.get(\"color\").length() != 0) \n\t\t\t\tuser.setDisplayColor(data.get(\"color\"));\n\t\t\t\n\t\t\t// DISPLAY NAME\n\t\t\tif (!data.get(\"display-name\").equals(\"\")) \n\t\t\t\tuser.setDisplayName(data.get(\"display-name\"));\n\t\t\t\n\t\t\t// USER ID\n\t\t\tif (!data.get(\"user-id\").equals(\"\")) \n\t\t\t\tuser.setUserID(Long.parseLong(data.get(\"user-id\")));\n\t\t\t\n\t\t\t// CHECKS IF BITS WERE SENT\n\t\t\tChatMessage finalMessage = null;\n\t\t\tif (data.containsKey(\"bits\")) \n\t\t\t\tfinalMessage = new BitMessage(connection, time, user, mes.substring(tags.length() + 3),\n\t\t\t\t\t\tInteger.parseInt(data.get(\"bits\")));\n\t\t\telse\n\t\t\t\tfinalMessage = new ChatMessage(connection, time, user, mes.substring(tags.length() + 3));\n\t\t\t\n\t\t\t// EMOTES\n\t\t\tHashSet<String> set = new HashSet<String>();\n\t\t\t//TWITCH\n\t\t\tif (!data.get(\"emotes\").equals(\"\")) {\n\t\t\t\tString[] emotes = data.get(\"emotes\").split(\"/\");\n\t\t\t\tfor (String emote : emotes) {\n\t\t\t\t\tint id = Integer.parseInt(emote.substring(0, emote.indexOf(\":\")));\n\t\t\t\t\tString[] occur = emote.substring(emote.indexOf(\":\") + 1).split(\",\");\n\t\t\t\t\tfor (String occure : occur) {\n\t\t\t\t\t\tString[] index = occure.split(\"-\");\n\t\t\t\t\t\tfinalMessage.addEmote(new ChatEmote(finalMessage.getMessage(), EmoteType.TWITCH, id+\"\", Integer.parseInt(index[0]), Integer.parseInt(index[1])));\n\t\t\t\t\t\tset.add(mes.substring(tags.length() + 3).substring(Integer.parseInt(index[0]), Integer.parseInt(index[1])+1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//OTHER\n\t\t\tfor(EmoteType type : EmoteType.values()){\n\t\t\t\tif(type!=EmoteType.TWITCH){\n\t\t\t\t\tfor(Emote emote : emoteManager.getEmoteList(type).values()){\n\t\t\t\t\t\tif(!set.contains(emote.getName())){\n\t\t\t\t\t\t\tfinalMessage.addEmotes(findChatEmote(mes.substring(tags.length() + 3), emote));\n\t\t\t\t\t\t\tset.add(emote.getName());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmessage = finalMessage;\n\t\t} else if (tag.equalsIgnoreCase(\"ROOMSTATE\")) {\n\n\t\t}\n\t\t// SUB NOTIFICATIONS\n\t\telse if (tag.equalsIgnoreCase(\"USERNOTICE\")) {\n\t\t\tString sys_msg = replaceSpaces(data.get(\"system-msg\"));\n\t\t\tString messagePrint = \"\", plan = data.get(\"msg-param-sub-plan\"), type = data.get(\"msg-id\");\n\t\t\tint loc = mes.indexOf(msgSplit) + msgSplit.length() + 2;\n\t\t\tif (loc < mes.length() && loc > 0) \n\t\t\t\tmessagePrint = mes.substring(loc);\n\t\t\tuser = getUser(connection, data.get(\"login\"));\n\t\t\tint length = -1;\n\t\t\tif (data.get(\"msg-param-months\").length() == 1) \n\t\t\t\tlength = Integer.parseInt(data.get(\"msg-param-months\"));\n\t\t\tmessage = new SubscriberMessage(connection, user, time, sys_msg, messagePrint, length, plan, type);\n\t\t} else if (tag.equalsIgnoreCase(\"USERSTATE\")) {\n\n\t\t} else {\n\n\t\t}\n\t\t//If message was successfully parsed, process the message too the GUI\n\t\tif (message != null) {\n\t\t\tconnection.getMessageProcessor().process(message);\n\t\t\tfinished(message);\n\t\t}\n\t}", "private void showDetectedPresence(){\n AlertDialog.Builder box = new AlertDialog.Builder(SecurityActivity.this);\n box.setTitle(\"Attention!\")\n .setMessage(\"Le robot a détecté une présence\");\n\n box.setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n\n public void onClick(DialogInterface dialog, int which) {\n presenceDetectee.setValue(false);\n Intent intent = new Intent(SecurityActivity.this, JeuActivity.class);\n intent.putExtra(\"ROBOT\", robotControle);\n startActivity(intent);\n }\n }\n );\n box.show();\n //J'ai un problème de permissions, je la demande mais Android ne la demande pas...\n //Vibrator vib=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);\n //vib.vibrate(10000);\n }", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n System.out.println(\"Would you like to talk to Bob? (Y/N)\");\n String userInput = scanner.next();\n boolean willTalk = userInput.equalsIgnoreCase(\"y\");\n scanner.nextLine();\n if (willTalk) {\n do {\n System.out.println(\"What do you want to say?\");\n String talkToBob = scanner.nextLine();\n\n if (talkToBob.endsWith(\"?\")) {\n System.out.println(\"Sure\");\n } else if (talkToBob.endsWith(\"!\")) {\n System.out.println(\"Whoa, chill out!\");\n } else if (talkToBob.equals(\"\")) {\n System.out.println(\"Fine, Be that way!\");\n } else {\n System.out.println(\"Whatever\");\n }\n\n System.out.println(\"Keep chatting? (Y/N)\");\n userInput = scanner.next();\n willTalk = userInput.equalsIgnoreCase(\"y\");\n scanner.nextLine();\n } while (willTalk);\n }\n }", "private void showHelp(CommandSender sender) {\n StringBuilder user = new StringBuilder();\n StringBuilder admin = new StringBuilder();\n\n for (Command cmd : commands.values()) {\n CommandInfo info = cmd.getClass().getAnnotation(CommandInfo.class);\n if(!PermHandler.hasPerm(sender, info.permission())) continue;\n\n StringBuilder buffy;\n if (info.permission().startsWith(\"dar.admin\"))\n buffy = admin;\n else \n buffy = user;\n \n buffy.append(\"\\n\")\n .append(ChatColor.RESET).append(info.usage()).append(\" \")\n .append(ChatColor.YELLOW).append(info.desc());\n }\n\n if (admin.length() == 0) {\n \tMessenger.sendMessage(sender, \"Available Commands: \"+user.toString());\n } else {\n \tMessenger.sendMessage(sender, \"User Commands: \"+user.toString());\n \tMessenger.sendMessage(sender, \"Admin Commands: \"+admin.toString());\n }\n }", "String removeBot( String name, String msg ) {\n if( name == null )\n return \"had no name associated; no removal action taken\";\n\n ChildBot deadBot = m_botStable.remove( name );\n\n if( deadBot != null ) {\n try {\n Session deadSesh = deadBot.getBot();\n\n if( deadSesh != null ) {\n if( deadSesh.getBotAction() != null ) {\n deadSesh.getBotAction().cancelTasks();\n }\n\n if( msg != null ) {\n if( !msg.equals(\"\") ) {\n deadSesh.disconnect( msg );\n } else {\n deadSesh.disconnect( \"(empty DC message)\" );\n }\n } else {\n deadSesh.disconnect( \"(null DC message)\" );\n }\n }\n\n // Decrement count for this type of bot\n addToBotCount( deadBot.getClassName(), (-1) );\n deadBot = null;\n return \"has disconnected normally\";\n } catch( NullPointerException e ) {\n Tools.printStackTrace(e);\n m_botAction.sendChatMessage( 1, name + \" had a disconnection problem/was already DC'd (null pointer exception thrown)\");\n }\n }\n\n return \"not found in bot stable (possibly already disconnected)\";\n }", "void bot_check_on_user() { // using Watson Speech-to-Text and text-to-Speech functions\r\n String output;\r\n String input;\r\n output: \"Are you okay?\";\r\n input = get voice input;\r\n if (input = \"Yes I’m okay.\") {} // nothing to do\r\n else if (input = \"A bit unwell.\") {\r\n output = \"Please list your symptoms.\";\r\n String symptoms;\r\n symptoms = get voice input;\r\n CFR_check(symptoms);\r\n }\r\n else if (input = …(no sound)) {\r\n CFR_check(\"No response, might be unconscious.\");\r\n else output : \"Please repeat.\";\r\n }", "static public void checkAndPrintIfLostDrone(Drone drone) {\n\n if (drone.isReturningToHome() && drone.getDistanceSource() == 0) {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Return to home completed successfully\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"] \" + \"Return to home completed successfully\");\n return;\n }\n if (drone.getDistanceDestiny() == 0) {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Arrived at destination\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"]\" + \"Arrived at destination\");\n return;\n }\n\n /* if(drone.isGoingManualToDestiny()){\n System.out.println(\"Drone[\"+getDroneLabel()+\"] \"+\"Arrived at destination\");\n loggerController.print(\"Drone[\"+getDroneLabel()+\"] \"+\"Arrived at destination\");\n return;\n }*/\n\n if (drone.isOnWater()) {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed on water\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed on water\");\n } else {\n System.out.println(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed successfully\");\n LoggerController.getInstance().print(\"Drone[\" + drone.getLabel() + \"] \" + \"Drone landed successfully\");\n }\n\n\n }", "public static void botSpeak(String sentence) {\n printDivider();\n System.out.println(sentence);\n printDivider();\n }", "public void go(){\r\n\t\t\r\n\t\tif(position.go(b.getN())){\r\n\t\t\tElement e =b.getSection(position).giveMePitOrWumpus();\t\t\r\n\t\t\tif(e instanceof Wumpus){\r\n\t\t\t\tWumpus w = (Wumpus)e;\r\n\t\t\t\tif (w.isAlive()){\r\n\t\t\t\t\talive = false;\r\n\t\t\t\t\tSystem.out.println(\"Wumpus kills you without mercy.END.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(e instanceof Pit){\r\n\t\t\t\talive = false;\r\n\t\t\t\tSystem.out.println(\"You have fallen into an endless pit.END.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t\tSystem.out.println(\"Ooops, there is a wall on your way.\");\r\n\t}", "public boolean isChatEnabled();", "pb4server.WorldChatAskReq getWorldChatAskReq();", "public void print() {\n System.out.println(\"I am \" + status() + (muted ? \" and told to shut up *sadface*\" : \"\") + \" (\" + toString() + \")\");\n }", "public void announceWinner() {\r\n Piece winer;\r\n if (_board.piecesContiguous(_board.turn().opposite())) {\r\n winer = _board.turn().opposite();\r\n } else {\r\n winer = _board.turn();\r\n }\r\n if (winer == WP) {\r\n _command.announce(\"White wins.\", \"Game Over\");\r\n System.out.println(\"White wins.\");\r\n } else {\r\n _command.announce(\"Black wins.\", \"Game Over\");\r\n System.out.println(\"Black wins.\");\r\n }\r\n }", "boolean processChatCmd( String s )\n\t{\n\t\t\n\t\tman.getOpponent(this).out.println(s);\n\t\tman.getOpponent(this).out.flush();\n\t\tout.println(\"Message sent.\");\n\t\tout.flush();\n\t\treturn true;\n\t}", "@Override\r\n public void notLeader() {\n }", "private static void dealwithelp() {\r\n\t\tSystem.out.println(\"1 ) myip - to see your ip address.\");\r\n\t\tSystem.out.println(\"2 ) myport - to see your port number.\");\r\n\t\tSystem.out.println(\"3 ) connect <ip> <port> - connect to peer.\");\r\n\t\tSystem.out.println(\"4 ) list Command - list all the connected peer/peers.\");\r\n\t\tSystem.out.println(\"5 ) send <id> - to send message to peer.\");\r\n\t\tSystem.out.println(\"6 ) terminate <id> - terminate the connection\");\r\n\t\tSystem.out.println(\"7 ) exit - exit the program.\");\r\n\t}", "public void setBotNumber(int num) {\n botNum = num;\n }", "public void sendeLobby();", "public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {\n\t\tif (label.equalsIgnoreCase(\"truth\")) {\n\t\t\tif (sender instanceof Player) {\n\t\t\t\t//player (not console)\n\t\t\t\tPlayer player = (Player) sender;\n\t\t\t\tif (player.hasPermission(\"stinky.use\")) { \n\t\t\t\t\tplayer.sendMessage(ChatColor.LIGHT_PURPLE+\"\"+ChatColor.BOLD+\"Alex Stinks\");\n\t\t\t\t\tplayer.sendMessage(ChatColor.translateAlternateColorCodes('&', \"&ehe really Does\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tplayer.sendMessage(ChatColor.DARK_RED+\"\"+ChatColor.BOLD+\"You don't Have permission to use this!\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//console (not player)\n\t\t\t\tsender.sendMessage(\"hey Console\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public void requestBot(String s) {\n\t\tLEDManager.requestConnection(s);\n\t}", "@Override\n public void run() {\n if(!botMode && game.getPlayersConnected() < 4){\n login();\n out.println(\"waiting for players to connect...\\r\\n\");\n awaitT();\n }\n\n while(login && !botMode){\n try {\n synchronized (lock){nextRound();}\n if(round==6){\n exitGame();\n }else{\n display();\n// synchronized (lock){executeBot();} //let the bot thread perf\n\n out.println(\"\\r\\nList of commands: \\r\\n\" +\n \"vote (vote for the execution of an influence card)\\r\\n\" +\n \"trade (buy or sell shares)\\r\\n\" +\n \"next (proceed to next round)\\r\\n\" +\n \"logout (exit game)\\r\\n\"\n );\n command();\n }\n\n } catch (NoSuchElementException e) {\n login = false;\n }\n }\n\n //close session\n in.close();\n out.close();\n\n while(botMode && round !=6){ //move above close session\n botLogic();\n }\n\n }", "private static PluginMessageRecipient getThroughWhomSendMessage() {\n\t\treturn Remain.getOnlinePlayers().isEmpty() ? Bukkit.getServer() : Remain.getOnlinePlayers().iterator().next();\n\t}", "@Override\r\n\tpublic String say() {\n\t\tif(livingBy==LivingBy.CAT) {\r\n\t\t\treturn \"Me ow\";\r\n\t\t}else if(livingBy==LivingBy.ROOSTER) {\r\n\t\t\treturn \"Cock-a-doodle-doo\";\r\n\t\t\t\r\n\t\t}else {\r\n\t\t\treturn \"Woof, woof\";\r\n\t\t}\r\n\t\t\r\n\t}", "public void otherSentence()\n {\n // Receive the string from the other player\n if (other == 1)\n {\n record.append(\"Red: \" + theClientChat.recvString() + \"\\n\");\n }\n else\n {\n record.append(\"Yellow: \" + theClientChat.recvString() + \"\\n\");\n }\n }", "private void botLogic(){\n synchronized (lock){Collections.sort(playerList);}\n botTrading();\n botVoting();\n waitPrint();\n await();\n }", "private void pique() {\n\t\ttry {\n\t\t\tThread.sleep(5000); // espera, para dar tempo de ver as mensagens iniciais\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tint xInit = -38;\n\t\tint yInit = 0;\n\t\tEFieldSide side = selfPerception.getSide();\n\t\tVector2D initPos = new Vector2D(xInit * side.value(), yInit * side.value());\n\t\tplayerDeafaultPosition = initPos;\n\t\tVector2D ballPos;\n\t\tdouble ballX = 0, ballY = 0;\n\t\t\n\t\tRectangle area = side == EFieldSide.LEFT ? new Rectangle(-52, -25, 32, 50) : new Rectangle(25, -25, 32, 50);\n\t\t\n\t\twhile (commander.isActive()) {\n\t\t\tupdatePerceptions(); // deixar aqui, no começo do loop, para ler o resultado do 'move'\n\t\t\tballPos = fieldPerception.getBall().getPosition();\n\t\t\tswitch (matchPerception.getState()) {\n\t\t\tcase BEFORE_KICK_OFF:\t\t\t\t\n\t\t\t\tcommander.doMoveBlocking(-38, 0);\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase PLAY_ON:\n\t\t\t\tballX = fieldPerception.getBall().getPosition().getX();\n\t\t\t\tballY = fieldPerception.getBall().getPosition().getY();\n\t\t\t\tif (arrivedAtBall()) { // chutar\n\t\t\t\t\tcommander.doKickBlocking(100.0d, 0.0d);\n\t\t\t\t} else if (area.contains(ballX, ballY)) { // defender\n\t\t\t\t\tdashBall(ballPos);\n\t\t\t\t} else if (!isCloseTo(initPos)) { // recuar\t\t\t\t\t\n\t\t\t\t\tdash(initPos);\n\t\t\t\t} else { // olhar para a bola\n\t\t\t\t\tturnTo(ballPos);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_OFF_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_OFF_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CORNER_KICK_LEFT: // escanteio time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CORNER_KICK_RIGHT: // escanteio time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_IN_LEFT: // lateral time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\tcase KICK_IN_RIGHT: // lateal time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_LEFT: // Tiro livre time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_RIGHT: // Tiro Livre time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_FAULT_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_FAULT_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase GOAL_KICK_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase GOAL_KICK_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_LEFT:\n\t\t\t\tcommander.doMoveBlocking(-38, 0);\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_RIGHT:\n\t\t\t\tcommander.doMoveBlocking(-38, 0);\n\t\t\t\tbreak;\t\t\t\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public void godNotAdded() {\n notifyGodNotAdded(this.getCurrentTurn().getCurrentPlayer().getNickname());\n }", "@Override\n protected boolean isPersonalTell(ChatEvent evt){\n String type = evt.getType();\n return \"tell\".equals(type) || \"say\".equals(type) || \"ptell\".equals(type);\n }", "public void hideChat(){\n\t\tElement chat = nifty.getScreen(\"hud\").findElementByName(\"chatPanel\");\n\t\tchat.setVisible(false);\n\t}", "private void showFeedback(String message) {\n if (myHost != null) {\n myHost.showFeedback(message);\n } else {\n System.out.println(message);\n }\n }", "private void showFeedback(String message) {\n if (myHost != null) {\n myHost.showFeedback(message);\n } else {\n System.out.println(message);\n }\n }", "public boolean hasFollowUp() \n {\n return followUp.equals(Constants.CLOSE);\n }", "public void youWinByAbandonment() {\n try {\n if (getClientInterface() != null)\n getClientInterface().gameEndedByAbandonment(\"YOU WON BECAUSE YOUR OPPONENTS HAVE ABANDONED!!\");\n }\n catch (RemoteException e) {\n System.out.println(\"remote sending ended by abandonment error\");\n }\n }", "@PermitAll\n public void cmdWho(User teller) {\n Formatter msg = new Formatter();\n Collection<Player> playersOnline = tournamentService.findOnlinePlayers();\n for (Player player : playersOnline) {\n msg.format(\" %s \\\\n\", player);\n }\n command.qtell(teller, msg);\n }", "public boolean test(CommandSender sender, MCommand command);", "public static void continueChat()\r\n {\r\n do\r\n {\r\n NPCChat.clickContinue(true);\r\n General.sleep(300, 450);\r\n }\r\n while (NPCChat.getClickContinueInterface() != null);\r\n General.sleep(300, 350);\r\n }", "void spawnBot( String className, String messager ) {\n spawnBot( className, null, null, messager);\n }", "public void sendGameInfoToAll(){\r\n\t\t\r\n\t\tVector<Player> players = lobby.getLobbyPlayers();\t\r\n\t\tString message = \"UDGM\" + lobby.getGameString();\r\n\t\t\r\n\t\tif(!players.isEmpty()){\r\n\t \tfor(int i=0; i<players.size(); i++){\t \t\t\r\n\t \t\tsendOnePlayer(players.get(i), message);\t \t\t\r\n\t \t}\r\n\t\t}\r\n\t}", "public void run() {\n mOpponentEmoteBubble.setText(botEmotesArray[new Random().nextInt(botEmotesArray.length)]);\n showEmote(mOpponentEmoteBubble);\n\n }", "public static void sendNormalMOTD(Player target) {\n boolean somethingSent = false;\n\n //Send motd title\n if (motd.has(\"title\")) {\n target.sendMessage(ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n somethingSent = true;\n }\n\n //Send priority messages\n if (motd.has(\"priority\")) {\n String[] priority = new String[motd.getJSONArray(\"priority\").length()];\n for (int i = 0; i < priority.length; i++) {\n priority[i] = ChatColor.GOLD + \" > \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i));\n }\n target.sendMessage(priority);\n somethingSent = true;\n }\n\n //send a few random daily's\n if (motd.has(\"normal\") && !motd.getJSONArray(\"normal\").isEmpty()) {\n Random r = new Random();\n int totalNormalMessages;\n\n if (motdNormalCount > motd.getJSONArray(\"normal\").length()) {\n totalNormalMessages = motd.getJSONArray(\"normal\").length();\n } else {\n totalNormalMessages = motdNormalCount;\n }\n\n String[] normalMessages = new String[totalNormalMessages];\n JSONArray used = new JSONArray();\n int itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n normalMessages[0] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n used.put(itemNum);\n\n for (int i = 1; i < totalNormalMessages; i++) {\n while (used.toList().contains(itemNum)) {\n itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n }\n normalMessages[i] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n }\n\n target.sendMessage(normalMessages);\n somethingSent = true;\n }\n\n }", "private boolean isMentioned(MessageReceivedEvent event) {\n Message message = event.getMessage();\n\n if (message.getContentRaw().equals(\"<@!\" + ID.SELF + \">\")) {\n message.reply(\"Hi, my prefix is `\" + Setting.PREFIX + \"`. You can also use `/help` for more info.\").queue();\n return true;\n }\n\n return false;\n }", "private boolean m36043c(Throwable th) {\n return ((th instanceof ShareTextException) && ((ShareTextException) th).d() == ExceptionType.USER_IS_HIDDEN) ? true : null;\n }", "private void awaitT(){\n try {\n game.getBarrier().await(20, TimeUnit.SECONDS);\n } catch (InterruptedException e) {\n e.printStackTrace();\n } catch (BrokenBarrierException e) {\n e.printStackTrace();\n } catch (TimeoutException e) {\n trimBarrier();\n synchronized (lock){\n if(!botSignal){\n bot = new BotClient();\n new Thread(bot).start();\n botSignal = true;\n }\n\n }\n }\n }", "private void command(){\n out.println(\"Enter command: \");\n String comInput = in.nextLine();\n\n if (comInput.toLowerCase().equals(\"vote\")) {\n voteCommand();\n }else if (comInput.toLowerCase().equals(\"trade\")){\n tradeCommand();\n }else if (comInput.toLowerCase().equals(\"next\")){\n out.println(waitPrint());\n await();\n// nextRound();\n }else if(comInput.toLowerCase().equals(\"logout\")){\n// login = false;\n logout();\n }\n }", "private void announceWinner() {\n // FIXME\n if (_board.turn() == Piece.WP) {\n System.out.println(\"Black wins.\");\n } else {\n System.out.println(\"White wins.\");\n }\n }", "@Override\n public void onResponse(String response) {\n Log.i(\"Checking\", response + \" \");\n if(new ServerReply(response).getStatus())\n {\n Toast.makeText(context,new ServerReply(response).getReason(),Toast.LENGTH_LONG).show();\n }\n\n }", "public void talk() {\n\n\t}", "private boolean inspect(Pinner pinner) {\n if (unfollowConfig.getUnfollowOnlyRecordedFollowings()) {\n if (pinbot3.PinBot3.dalMgr.containsObjectExternally(pinner, DALManager.TYPES.duplicates_unfollow_pinners, account)) {\n return false;\n }\n /*for (PinterestObject p : account.getDuplicates_follow()) {\n if (p instanceof Pinner && ((Pinner) p).equals(pinner)\n && (new Date()).getTime() - ((Pinner) p).getTimeFollow() <= unfollowConfig.getTimeBetweenFollowAndUnfollow()) {\n return false;\n }\n }*/\n }\n\n if (!unfollowConfig.getCriteria_Users()) {\n return true;\n }\n\n String url = \"/\" + pinner.getUsername() + \"/\";\n String referer = pinner.getBaseUsername();\n int pincount = pinner.getPinsCount();\n int followerscount = pinner.getFollowersCount();\n\n if (!(pincount >= unfollowConfig.getCriteria_UserPinsMin() && pincount <= unfollowConfig.getCriteria_UserPinsMax())) {\n return true;\n }\n if (!(followerscount >= unfollowConfig.getCriteria_UserFollowersMin() && followerscount <= unfollowConfig.getCriteria_UserFollowersMax())) {\n return true;\n }\n\n try {\n if (!Http.validUrl(base_url + url)) {\n return false;\n }\n\n String rs = MakeRequest(base_url + url, referer, Http.ACCEPT_HTML);\n if (rs == null) {\n return false;\n }\n\n Pattern pattern = Pattern.compile(\"name=\\\"pinterestapp:following\\\" content=\\\"(\\\\d+)\\\"\", Pattern.DOTALL | Pattern.CASE_INSENSITIVE & Pattern.MULTILINE);\n Matcher matcher = pattern.matcher(rs);\n if (matcher.find()) {\n int followingcount = Integer.parseInt(matcher.group(1));\n if (!(followingcount >= unfollowConfig.getCriteria_UserFollowingMin() && followingcount <= unfollowConfig.getCriteria_UserFollowingMax())) {\n return true;\n }\n }\n\n pattern = Pattern.compile(\"name=\\\"pinterestapp:boards\\\" content=\\\"(\\\\d+)\\\"\", Pattern.DOTALL | Pattern.CASE_INSENSITIVE & Pattern.MULTILINE);\n matcher = pattern.matcher(rs);\n if (matcher.find()) {\n int boardcount = Integer.parseInt(matcher.group(1));\n if (!(boardcount >= unfollowConfig.getCriteria_UserBoardsMin() && boardcount <= unfollowConfig.getCriteria_UserBoardsMax())) {\n return true;\n }\n }\n return true;\n } catch (InterruptedException ex) {\n //ignore\n config.isInterrupt = true;\n return false;\n } catch (Exception ex) {\n common.ExceptionHandler.reportException(ex);\n return false;\n }\n }", "public void confusionIntent(View v){\n if(!MultiplayerManager.getInstance().enoughTimeBetweenCommands()){\n showToast(\"Please wait a second before issueing another command\");\n return;\n }\n\n if(!myTurn){\n showToast(\"Wait for your turn imbecile\");\n return;\n }\n if(powerup_confusion){\n showTimedAlertDialog(\"CONFUSION activated!\", \"Opponent will move randomley next round\", 5);\n powerup_confusion = false;\n ImageView img = findImageButton(\"confusion_container\");\n img.setImageDrawable(getResources().getDrawable(R.drawable.confusion_disabled));\n MultiplayerManager.getInstance().SendMessage(\"opponent_confusion\");\n }\n }", "@Override\r\n\tpublic void showPartner() {\n\t\tSystem.out.println(\"你的情侣是: \"+partner);\r\n\t}", "public void sendDirectedPresence() {\n Cursor cursor = getContentResolver().query(\n Roster.CONTENT_URI,\n new String[]{Roster.LAST_UPDATED},\n null, null, \"last_updated desc\"\n );\n if (cursor.moveToFirst()) {\n long after = cursor.getLong(\n cursor.getColumnIndex(Roster.LAST_UPDATED));\n Presence presence = new Presence(Type.available);\n presence.setTo(\"broadcaster.buddycloud.com\");\n client.sendFromAllResources(presence);\n }\n cursor.close();\n }", "public void showBreach();", "boolean hasChatType();", "private void sendGameCommand(){\n\n }", "public boolean chatEnabled();", "public void communicate() {\n // Send\n for (int i = 0; i < robots.length; i++) {\n if (i != this.id) {\n if (objectFound) {\n System.out.println(\"Robot \" + this.id + \": Telling everyone else...\");\n this.robots[i].mailbox[i] = new Message(this.id, this.objectFound, goal);\n } else {\n this.robots[i].mailbox[i] = new Message(this.id, this.objectFound, null);\n }\n }\n }\n // Read\n for (int i = 0; i < mailbox.length; i++) {\n if (i != this.id && mailbox[i] != null && mailbox[i].objectFound) {\n this.objectFound = true;\n this.goal = mailbox[i].objectLocation;\n }\n }\n }", "public void enableChat();", "public void whileChatting() throws IOException{\n\t\t\n\t\tString message = \"You are now connected. Gear up to chat like never before...\";\n\t\tsendMessage(message);\n\t\tableToType(true);\n\t\t\n\t\tdo {\n\t\t\t\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\tmessage = (String) input.readObject();\n\t\t\t\t//Anything coming in the input stream is treated as an object and then will be stored in the variable message as a string.\n\t\t\t\tshowMessage(\"\\n\" + message);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tcatch(ClassNotFoundException cnfException) {\n\t\t\t\t\n\t\t\t\tshowMessage (\"\\n An error occured with the message sent.\");\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\twhile (!message.equalsIgnoreCase(\"CLIENT - END\"));\n\t\t//While the client has not sent a message saying \"END\".\n\t\t\n\t}", "@Override\n public void help(CommandSender sender) {\n \n }", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();" ]
[ "0.7136602", "0.66668403", "0.653307", "0.65222085", "0.6414009", "0.61275935", "0.6111768", "0.59100777", "0.5899304", "0.5890466", "0.5775956", "0.5766269", "0.56567067", "0.5656332", "0.56318533", "0.56133467", "0.55975384", "0.5567454", "0.555606", "0.5522783", "0.549617", "0.54827064", "0.5477407", "0.54635644", "0.5443397", "0.54432315", "0.5437126", "0.54309136", "0.53909445", "0.53801596", "0.5379742", "0.5350204", "0.5343317", "0.53406066", "0.53175706", "0.5317369", "0.53143185", "0.5284579", "0.5283962", "0.5240115", "0.52332324", "0.5228347", "0.52050513", "0.5202682", "0.51986533", "0.519467", "0.5185177", "0.51814854", "0.517942", "0.51789623", "0.5176267", "0.5171339", "0.5165193", "0.51550514", "0.51452017", "0.51317024", "0.512941", "0.511998", "0.511929", "0.51157683", "0.5109501", "0.51041317", "0.51038796", "0.50901115", "0.508083", "0.50783545", "0.5074578", "0.5072518", "0.5072518", "0.5067537", "0.5065992", "0.50651765", "0.5061508", "0.50586015", "0.5057004", "0.5050879", "0.5047996", "0.5043591", "0.50401473", "0.5038222", "0.5037528", "0.5034151", "0.5021851", "0.50172347", "0.501452", "0.5008607", "0.5006807", "0.5006111", "0.49986136", "0.49977517", "0.49968773", "0.49959996", "0.49955854", "0.4989654", "0.49873894", "0.49755162", "0.49715582", "0.49680334", "0.49680334", "0.49680334", "0.49680334" ]
0.0
-1
to be included in the next payload SecretServer sends
public SecretServer(boolean simMode) { this.simMode = simMode; secretsfn = "secrets.txt"; hashfn = "hashes.txt"; pubkeysfn = "publickeys.txt"; privkeysfn = "privatekeys.txt"; validusersfn = "validusers.txt"; validUsers = ComMethods.getValidUsers(); configureKeys(); userNum = -1; myNonce = null; currentUser = null; currentPassword = null; currentSessionKey = null; userSet = false; passVerified = false; activeSession = false; counter = -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private byte[] preparePayload(byte[] message) {\n\t\treturn ComMethods.preparePayload(\"SecretServer\".getBytes(), message, counter, currentSessionKey, simMode);\n\t}", "private byte[] handleView() {\n\t\tString secret = ComMethods.getValueFor(currentUser, secretsfn);\n\t\tif (secret.equals(\"\")) {\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\tbyte[] secretInBytes = DatatypeConverter.parseBase64Binary(secret);\n\n\t\t\tComMethods.report(\"SecretServer has retrieved \"+currentUser+\"'s secret and will now return it.\", simMode);\n\t\t\treturn preparePayload(secretInBytes);\n\t\t}\n\t}", "java.lang.String getServerSecret();", "private byte[] sendServerCoded(byte[] message) { \n\t\tbyte[] toPayload = SecureMethods.preparePayload(username.getBytes(), message, counter, sessionKey, simMode);\n\t\tbyte[] fromPayload = sendServer(toPayload, false);\n\n\t\tbyte[] response = new byte[0];\n\t\tif (checkError(fromPayload)) {\n\t\t\tresponse = \"error\".getBytes();\n\t\t} else {\n\t\t\tresponse = SecureMethods.processPayload(\"SecretServer\".getBytes(), fromPayload, counter+1, sessionKey, simMode);\n\t\t}\n\t\tcounter = counter + 2;\n\t\treturn response;\n\t}", "byte[] get_node_secret();", "public abstract String getSecret();", "public static byte[] stageAPacket(ServerValuesHolder values) {\t\t\n\t\tbyte[] payload = new byte[ServerValuesHolder.HEADER_LENGTH + 4]; \n\t\tSystem.arraycopy(values.getNum_byte(), 0, payload, 0, 4);\n\t\tSystem.arraycopy(values.getLen_byte(), 0, payload, 4, 4);\n\t\tSystem.arraycopy(values.getUdp_port_byte(), 0, payload, 8, 4); // udp_port\n\t\tSystem.arraycopy(values.getSecretA_byte(), 0, payload, 12, 4); // secretA\n\t\t\n\t\treturn createPacket(ServerValuesHolder.secretInit, 2, values.getStudentID(), payload);\n\t}", "public int getSecret() {\n return secret;\n }", "java.lang.String getSecret();", "@Override\n protected void prepareHandshakeMessageContents() {\n }", "private byte[] handleDelete() {\n\t\tboolean success = replaceSecretWith(currentUser, \"\");\n\n\t\tif (success) {\n\t\t\tComMethods.report(\"SecretServer has deleted \"+currentUser+\"'s secret.\", simMode);\n\t\t\treturn preparePayload(\"secretdeleted\".getBytes());\n\t\t} else {\n\t\t\tComMethods.report(\"SecretServer has FAILED to delete \"+currentUser+\"'s secret.\", simMode);\n\t\t\treturn preparePayload(\"writingfailure\".getBytes());\n\t\t}\n\t}", "void computeSecrets() {\n final Bytes agreedSecret =\n signatureAlgorithm.calculateECDHKeyAgreement(ephKeyPair.getPrivateKey(), partyEphPubKey);\n\n final Bytes sharedSecret =\n keccak256(\n concatenate(agreedSecret, keccak256(concatenate(responderNonce, initiatorNonce))));\n\n final Bytes32 aesSecret = keccak256(concatenate(agreedSecret, sharedSecret));\n final Bytes32 macSecret = keccak256(concatenate(agreedSecret, aesSecret));\n final Bytes32 token = keccak256(sharedSecret);\n\n final HandshakeSecrets secrets =\n new HandshakeSecrets(aesSecret.toArray(), macSecret.toArray(), token.toArray());\n\n final Bytes initiatorMac = concatenate(macSecret.xor(responderNonce), initiatorMsgEnc);\n final Bytes responderMac = concatenate(macSecret.xor(initiatorNonce), responderMsgEnc);\n\n if (initiator) {\n secrets.updateEgress(initiatorMac.toArray());\n secrets.updateIngress(responderMac.toArray());\n } else {\n secrets.updateIngress(initiatorMac.toArray());\n secrets.updateEgress(responderMac.toArray());\n }\n\n this.secrets = secrets;\n }", "private byte[] handleUpdate(byte[] message) {\n\t\tbyte[] newSecretBytes = Arrays.copyOfRange(message, \"update:\".getBytes().length, message.length);\n\n/*\n\t\tSystem.out.println(\"THIS IS A TEST:\");\n\t\tSystem.out.println(\"newSecretBytes:\");\n\t\tComMethods.charByChar(newSecretBytes, true);\n\t\tSystem.out.println(\"newSecretBytes, reversed:\");\n\t\tString toStr = DatatypeConverter.printBase64Binary(newSecretBytes);\n\t\tbyte[] fromStr = DatatypeConverter.parseBase64Binary(toStr);\n\t\tComMethods.charByChar(fromStr, true);\n*/\n\t\tString newSecret = DatatypeConverter.printBase64Binary(newSecretBytes);\n\t\tboolean success = replaceSecretWith(currentUser, newSecret);\n\t\t\n\t\tif (success) {\n\t\t\tComMethods.report(\"SecretServer has replaced \"+currentUser+\"'s secret with \"+newSecret+\".\", simMode);\n\t\t\treturn preparePayload(\"secretupdated\".getBytes());\n\t\t} else {\n\t\t\tComMethods.report(\"SecretServer has FAILED to replace \"+currentUser+\"'s secret with \"+newSecret+\".\", simMode);\n\t\t\treturn preparePayload(\"writingfailure\".getBytes());\n\t\t}\n\t}", "String getSecret();", "@Override\r\n protected String appSecret() {\r\n return \"\";\r\n }", "private byte[] sendServer(byte[] message, boolean partTwo) { \n\t\tComMethods.report(accountName+\" sending message to SecretServer now...\", simMode);\n\t\tbyte[] response = server.getMessage(message, partTwo);\n\t\tComMethods.report(accountName+\" has received SecretServer's response.\", simMode);\n\t\treturn response; \n\t}", "void touchSecret(Long secretId);", "private byte[] handleAuthPt1(byte[] payload) {\n\t\tboolean userIdentified = false;\n\t\tbyte[] supposedUser = null;\n\n//\n\t\tSystem.out.println(\"payload received by SecretServer:\");\n\t\tComMethods.charByChar(payload,true);\n//\n\n\t\tuserNum = -1;\n\t\twhile (userNum < validUsers.length-1 && !userIdentified) {\n\t\t\tuserNum++;\n\t\t\tsupposedUser = validUsers[userNum].getBytes();\n\t\t\tuserIdentified = Arrays.equals(Arrays.copyOf(payload, supposedUser.length), supposedUser);\n\n//\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"\\\"\"+validUsers[userNum]+\"\\\" in bytes:\");\n\t\t\tComMethods.charByChar(validUsers[userNum].getBytes(),true);\n\t\t\tSystem.out.println(\"\\\"Arrays.copyOf(payload, supposedUser.length\\\" in bytes:\");\n\t\t\tComMethods.charByChar(Arrays.copyOf(payload, supposedUser.length),true);\n\t\t\tSystem.out.println();\n//\n\t\t}\n\n\t\tif (!userIdentified) {\n\t\t\tComMethods.report(\"SecretServer doesn't recognize name of valid user.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Process second half of message, and verify format\n\t\t\tbyte[] secondHalf = Arrays.copyOfRange(payload, supposedUser.length, payload.length);\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tsecondHalf = ComMethods.decryptRSA(secondHalf, my_n, my_d);\n\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tComMethods.report(\"SecretServer has decrypted the second half of the User's message using SecretServer's private RSA key.\", simMode);\n\n\t\t\tif (!Arrays.equals(Arrays.copyOf(secondHalf, supposedUser.length), supposedUser)) {\n\t\t\t\t// i.e. plaintext name doesn't match the encrypted bit\n\t\t\t\tComMethods.report(\"ERROR ~ invalid first message in protocol.\", simMode);\t\t\t\t\n\t\t\t\treturn \"error\".getBytes();\n\t\t\t} else {\n\t\t\t\t// confirmed: supposedUser is legit. user\n\t\t\t\tcurrentUser = new String(supposedUser); \n\t\t\t\tuserSet = true;\n\t\t\t\tbyte[] nonce_user = Arrays.copyOfRange(secondHalf, supposedUser.length, secondHalf.length);\n\n\t\t\t\t// Second Message: B->A: E_kA(nonce_A || Bob || nonce_B)\n\t\t\t\tmyNonce = ComMethods.genNonce();\n\t\t\t\tComMethods.report(\"SecretServer has randomly generated a 128-bit nonce_srvr = \"+myNonce+\".\", simMode);\n\t\t\t\n\t\t\t\tbyte[] response = ComMethods.concatByteArrs(nonce_user, \"SecretServer\".getBytes(), myNonce);\n\t\t\t\tbyte[] responsePayload = ComMethods.encryptRSA(response, usersPubKeys1[userNum], BigInteger.valueOf(usersPubKeys2[userNum]));\n\t\t\t\treturn responsePayload;\n\t\t\t}\n\t\t}\n\t}", "protected byte[] engineSharedSecret() throws KeyAgreementException {\n return Util.trim(ZZ);\n }", "private String prepareSecurityToken() {\r\n\t\tint time = ((int) System.currentTimeMillis() % SECURITY_TOKEN_TIMESTAMP_RANGE);\r\n\t\treturn String.valueOf(time + (new Random().nextLong() - SECURITY_TOKEN_TIMESTAMP_RANGE));\r\n\t}", "private String key() {\n return \"secret\";\n }", "public void run(){\n\t\t\t\t\t\taddToHashmap(key, timestamp);\r\n\r\n\t\t\t\t\t\treq.response().putHeader(\"Content-Type\", \"text/plain\");\r\n\t\t\t\t\t\treq.response().end();\r\n\t\t\t\t\t\treq.response().close();\r\n\t\t\t\t\t}", "private String generateSecretKey(){\n SecureRandom random = new SecureRandom();\n byte[] bytes = new byte[20];\n\n random.nextBytes(bytes);\n Base32 base32 = new Base32();\n return base32.encodeToString(bytes);\n }", "ManagedEndpoint next();", "protected void updateNextLifeSign() {\n nextLifeSignToSend = System.currentTimeMillis() + NotEOFConstants.LIFE_TIME_INTERVAL_CLIENT;\n }", "private byte[] handleAuthPt2(byte[] payload) { \n\t\tbyte[] message = ComMethods.decryptRSA(payload, my_n, my_d);\n\t\tComMethods.report(\"SecretServer has decrypted the User's message using SecretServer's private RSA key.\", simMode);\n\t\t\n\t\tif (!Arrays.equals(Arrays.copyOf(message, myNonce.length), myNonce)) {\n\t\t\tComMethods.report(\"ERROR ~ invalid third message in protocol.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Authentication done!\n\t\t\tcurrentSessionKey = Arrays.copyOfRange(message, myNonce.length, message.length);\n\t\t\tactiveSession = true;\n\t\t\tcounter = 11;\n\n\t\t\t// use \"preparePayload\" from now on for all outgoing messages\n\t\t\tbyte[] responsePayload = preparePayload(\"understood\".getBytes());\n\t\t\tcounter = 13;\n\t\t\treturn responsePayload;\n\t\t} \n\t}", "@Test\n public void setSecretsRequest_identicalSecrets() throws IOException {\n assertThat(this.secretRepository.count()).isEqualTo(2);\n\n final Resource request = new ClassPathResource(\"test-requests/storeSecrets.xml\");\n final Resource expectedResponse = new ClassPathResource(\"test-responses/storeSecrets.xml\");\n //Store secrets\n this.mockWebServiceClient.sendRequest(withPayload(request)).andExpect(ResponseMatchers.noFault()).andExpect(\n ResponseMatchers.payload(expectedResponse));\n //Store identical secrets again\n final String errorMessage = \"Secret is identical to current secret (\" + DEVICE_IDENTIFICATION + \", \"\n + \"E_METER_AUTHENTICATION_KEY)\";\n this.mockWebServiceClient.sendRequest(withPayload(request)).andExpect(\n ResponseMatchers.serverOrReceiverFault(errorMessage));\n }", "com.google.protobuf.ByteString getSecretBytes();", "int getServerPayloadSizeBytes();", "com.google.protobuf.ByteString\n getServerSecretBytes();", "public final void mo16236a() throws Exception {\n Map b = C1744eg.m890b(C1744eg.this.f1002b);\n C1691dd ddVar = new C1691dd();\n ddVar.f897f = \"https://api.login.yahoo.com/oauth2/device_session\";\n ddVar.f898g = C1699a.kPost;\n ddVar.mo16403a(\"Content-Type\", \"application/json\");\n ddVar.f883b = new JSONObject(b).toString();\n ddVar.f885d = new C1725dt();\n ddVar.f884c = new C1725dt();\n ddVar.f882a = new C1693a<String, String>() {\n /* renamed from: a */\n public final /* synthetic */ void mo16300a(C1691dd ddVar, Object obj) {\n String str = \"PrivacyManager\";\n String str2 = (String) obj;\n try {\n int i = ddVar.f904m;\n if (i == 200) {\n JSONObject jSONObject = new JSONObject(str2);\n C1744eg.m888a(C1744eg.this, new C1477a(jSONObject.getString(\"device_session_id\"), jSONObject.getLong(\"expires_in\"), C1744eg.this.f1002b));\n C1744eg.this.f1002b.callback.success();\n return;\n }\n C1685cy.m769e(str, \"Error in getting privacy dashboard url. Error code = \".concat(String.valueOf(i)));\n C1744eg.this.f1002b.callback.failure();\n } catch (JSONException e) {\n C1685cy.m763b(str, \"Error in getting privacy dashboard url. \", (Throwable) e);\n C1744eg.this.f1002b.callback.failure();\n }\n }\n };\n C1675ct.m738a().mo16389a(C1744eg.this, ddVar);\n }", "@Override\n\tpublic void challenge16() {\n\n\t}", "public static String streamingEnabledToken() {\n return \"{\" +\n \" \\\"pushEnabled\\\": true,\" +\n \" \\\"token\\\": \\\"eyJhbGciOiJIUzI1NiIsImtpZCI6IjVZOU05US45QnJtR0EiLCJ0eXAiOiJKV1QifQ.eyJ4LWFibHktY2FwYWJpbGl0eSI6IntcIk16TTVOamMwT0RjeU5nPT1fTVRFeE16Z3dOamd4X01UY3dOVEkyTVRNME1nPT1fbXlTZWdtZW50c1wiOltcInN1YnNjcmliZVwiXSxcIk16TTVOamMwT0RjeU5nPT1fTVRFeE16Z3dOamd4X3NwbGl0c1wiOltcInN1YnNjcmliZVwiXSxcImNvbnRyb2xfcHJpXCI6W1wic3Vic2NyaWJlXCIsXCJjaGFubmVsLW1ldGFkYXRhOnB1Ymxpc2hlcnNcIl0sXCJjb250cm9sX3NlY1wiOltcInN1YnNjcmliZVwiLFwiY2hhbm5lbC1tZXRhZGF0YTpwdWJsaXNoZXJzXCJdfSIsIngtYWJseS1jbGllbnRJZCI6ImNsaWVudElkIiwiZXhwIjoyMjA4OTg4ODAwLCJpYXQiOjE1ODc0MDQzODh9.LcKAXnkr-CiYVxZ7l38w9i98Y-BMAv9JlGP2i92nVQY\\\"\" +\n \"}\";\n\n }", "public static byte[] getSecret()\r\n/* 136: */ {\r\n/* 137: */ try\r\n/* 138: */ {\r\n/* 139:122 */ return getPropertyBytes(\"secret\");\r\n/* 140: */ }\r\n/* 141: */ catch (Exception e)\r\n/* 142: */ {\r\n/* 143:124 */ log.warning(\"Error getting secret: \" + e.getMessage());\r\n/* 144: */ }\r\n/* 145:126 */ return new byte[0];\r\n/* 146: */ }", "public final void mo16236a() throws Exception {\n Map b = C1744eg.m890b(C1744eg.this.f1002b);\n C1691dd ddVar = new C1691dd();\n ddVar.f897f = \"https://api.login.yahoo.com/oauth2/device_session\";\n ddVar.f898g = C1699a.kPost;\n ddVar.mo16403a(\"Content-Type\", \"application/json\");\n ddVar.f883b = new JSONObject(b).toString();\n ddVar.f885d = new C1725dt();\n ddVar.f884c = new C1725dt();\n ddVar.f882a = new C1693a<String, String>() {\n /* renamed from: a */\n public final /* synthetic */ void mo16300a(C1691dd ddVar, Object obj) {\n String str = \"PrivacyManager\";\n String str2 = (String) obj;\n try {\n int i = ddVar.f904m;\n if (i == 200) {\n JSONObject jSONObject = new JSONObject(str2);\n C1744eg.m888a(C1744eg.this, new C1477a(jSONObject.getString(\"device_session_id\"), jSONObject.getLong(\"expires_in\"), C1744eg.this.f1002b));\n C1744eg.this.f1002b.callback.success();\n return;\n }\n C1685cy.m769e(str, \"Error in getting privacy dashboard url. Error code = \".concat(String.valueOf(i)));\n C1744eg.this.f1002b.callback.failure();\n } catch (JSONException e) {\n C1685cy.m763b(str, \"Error in getting privacy dashboard url. \", (Throwable) e);\n C1744eg.this.f1002b.callback.failure();\n }\n }\n };\n C1675ct.m738a().mo16389a(C1744eg.this, ddVar);\n }", "protected abstract void encode(ChannelHandlerContext paramChannelHandlerContext, I paramI, List<Object> paramList)\r\n/* 111: */ throws Exception;", "@ReactMethod\n public void sendRandom() {\n long maxPayloadLength = chirpConnect.maxPayloadLength();\n long size = (long) new Random().nextInt((int) maxPayloadLength) + 1;\n byte[] payload = chirpConnect.randomPayload((byte)size);\n\n ChirpError error = chirpConnect.send(payload);\n if (error.getCode() > 0) {\n onError(context, error.getMessage());\n }\n }", "@Override\n protected Boolean doInBackground(Void... params) {\n SecureRandom sr = new SecureRandom();\n sr.nextBytes(phonepartBytes);\n\n String server_secret_hex = byteArrayToHexString(token.getSecret());\n char[] ch = server_secret_hex.toCharArray();\n byte[] completesecretBytes = new byte[(output_size_bit / 8)];\n\n // 2. PBKDF2 with the specified parameters\n try {\n completesecretBytes = OTPGenerator.generatePBKDFKey(ch, phonepartBytes, iterations, output_size_bit);\n } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {\n e.printStackTrace();\n }\n token.setSecret(completesecretBytes);\n return true;\n }", "void generateSecretKey() {\n\n Random rand = new Random();\n \n // randomly generate alphabet chars\n this.secretKey.setCharAt(0, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(1, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(4, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(5, (char) (rand.nextInt(26) + 'a'));\n\n // randomly generate special chars\n // special chars are between 33-47 and 58-64 on ASCII table\n if (rand.nextBoolean()) {\n this.secretKey.setCharAt(3, (char) (rand.nextInt(15) + '!'));\n this.secretKey.setCharAt(8, (char) (rand.nextInt(15) + '!'));\n } else {\n this.secretKey.setCharAt(3, (char) (rand.nextInt(7) + ':'));\n this.secretKey.setCharAt(8, (char) (rand.nextInt(7) + ':'));\n }\n \n // randomly generate int between 2 and 5\n this.secretKey.setCharAt(7, (char) (rand.nextInt(4) + '2'));\n }", "@Override\n protected void readAdditionalFields(final UnsafeBufferSerializer buffer)\n {\n final int encodedSessionKeySize = buffer.readInt();\n\n // If the internal byte array for they key don't have the right size, create it again\n if (this.encodedSessionKey.length != encodedSessionKeySize)\n {\n this.encodedSessionKey = new byte[encodedSessionKeySize];\n }\n\n // Read the session key\n buffer.readBytes(this.encodedSessionKey);\n }", "java.lang.String getSaltData();", "public EchoClientHandler()\n {\n String data = \"hello zhang kylin \" ;\n firstMessage = Unpooled.buffer(2914) ;\n firstMessage.writeBytes(data.getBytes()) ;\n }", "private void sendRegistrationToServer(String token) {\n }", "private void sendRegistrationToServer(String token) {\n }", "private void sendRegistrationToServer(String token) {\n }", "private void sendRegistrationToServer(String token) {\n }", "public void sendAuthPackge() throws IOException {\n // 生成认证数据\n byte[] rand1 = RandomUtil.randomBytes(8);\n byte[] rand2 = RandomUtil.randomBytes(12);\n\n // 保存认证数据\n byte[] seed = new byte[rand1.length + rand2.length];\n System.arraycopy(rand1, 0, seed, 0, rand1.length);\n System.arraycopy(rand2, 0, seed, rand1.length, rand2.length);\n this.seed = seed;\n\n // 发送握手数据包\n HandshakePacket hs = new HandshakePacket();\n hs.packetId = 0;\n hs.protocolVersion = Versions.PROTOCOL_VERSION;\n hs.serverVersion = Versions.SERVER_VERSION;\n hs.threadId = id;\n hs.seed = rand1;\n hs.serverCapabilities = getServerCapabilities();\n // hs.serverCharsetIndex = (byte) (charsetIndex & 0xff);\n hs.serverStatus = 2;\n hs.restOfScrambleBuff = rand2;\n hs.write(this);\n\n // asynread response\n // 这里阻塞了不好\n this.asynRead();\n }", "@Override\n public void handle(AuthDataEvent event, Channel channel)\n {\n PacketReader reader = new PacketReader(event.getBuffer());\n ChannelBuffer buffer =ChannelBuffers.buffer(ByteOrder.LITTLE_ENDIAN, 1024);\n buffer.writeBytes(event.getBuffer());\n \n int ptype = buffer.readUnsignedShort();\n \n //Skip over the length field since it's checked in decoder\n reader.setOffset(2);\n\n int packetType = reader.readUnSignedShort();\n\n switch (packetType)\n {\n /*\n * Auth Request\n * 0\t ushort 52\n * 2\t ushort 1051\n * 4\t string[16]\t Account_Name\n * 20\t string[16]\t Account_Password\n * 36\t string[16]\t GameServer_Name\n */\n case PacketTypes.AUTH_REQUEST:\n String username = reader.readString(16).trim();\n String password = reader.readString(16).trim();\n String server = reader.readString(16).trim();\n\n //If valid forward to game server else boot them\n if (db.isUserValid(username, \"root\"))\n {\n byte []packet = AuthResponse.build(db.getAcctId(username), \"127.0.0.1\", 8080);\n \n event.getClient().getClientCryptographer().Encrypt(packet);\n \n ChannelBuffer buf = ChannelBuffers.buffer(packet.length);\n \n buf.writeBytes(packet);\n \n ChannelFuture complete = channel.write(buf);\n \n //Close the channel once packet is sent\n complete.addListener(new ChannelFutureListener() {\n\n @Override\n public void operationComplete(ChannelFuture arg0) throws Exception {\n arg0.getChannel().close();\n }\n });\n \n } else\n channel.close();\n \n \n MyLogger.appendLog(Level.INFO, \"Login attempt from \" + username + \" => \" + password + \" Server => \" + server);\n break;\n \n default:\n MyLogger.appendLog(Level.INFO, \"Unkown packet: ID = \" + packetType + new String(event.getBuffer())); \n break;\n }\n }", "@Override\n public void run() {\n String domain = Constant.BASE_URL + Constant.TICKER;\n String params = Constant.OPER + \"=\" + Constant.TICK_CORP + \"&\" + Constant.LOGIN_TOKEN + \"=\" + token + \"&\" + \"p=1\";\n String json = GetSession.post(domain, params);\n if (!json.equals(\"+ER+\")){\n try {\n if (json.equals(\"[]\")) {\n Message message = new Message();\n message.what = NODATASHOW;\n handler.sendMessage(message);\n }\n JSONArray jsonArray = new JSONArray(json);\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n }\n\n }", "public interface Secret extends ModelEntity, Buildable<SecretCreateBuilder> {\n\n /**\n * @return algorithm.\n */\n String getAlgorithm();\n\n /**\n * @return bit length of the secret. Must be greater than zero.\n */\n Integer getBitLength();\n\n /**\n * @return content type of the secret.\n */\n Map<String, String> getContentTypes();\n\n /**\n * @return system generated creation time.\n */\n Date getCreateTime();\n\n /**\n * @return system generated last update time.\n */\n Date getUpdateTime();\n\n /**\n * @return user uuid of the creator of this secret.\n */\n String getCreatorId();\n\n /**\n * @return expiration of the secret.\n */\n Date getExpiration();\n\n /**\n * @return mode of the secret.\n */\n String getMode();\n\n /**\n * @return name of the secret.\n */\n String getName();\n\n /**\n * @return URL reference to the secret.\n */\n String getSecretReference();\n\n /**\n * @return secret type.\n */\n String getSecretType();\n\n /**\n * @return current status of the secret.\n */\n String getStatus();\n\n /**\n * @return stored secret data.\n */\n String getPayload();\n\n /**\n * @return content type of the secret data.\n */\n String getPayloadContentType();\n\n /**\n * @return encoding used for the data.\n */\n String getPayloadContentEncoding();\n}", "public void register() throws JSONException, IOException {\n\t\tJSONObject obj = new JSONObject();\n\t\tobj.put(\"register\",keyPublic);\n\t\tidentifiant = keyPublic.substring(keyPublic.length()-6, keyPublic.length());\n\t\toutchan.writeLong(obj.toString().length());\n\t\toutchan.write(obj.toString().getBytes(StandardCharsets.UTF_8));\n\t}", "private ResponseEntity<?> onPost(RequestEntity<String> requestEntity)\n throws IOException, ExecutionException, InterruptedException, InvalidKeyException,\n BadPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException,\n NoSuchPaddingException, ShortBufferException, InvalidKeySpecException,\n InvalidAlgorithmParameterException, NoSuchProviderException {\n\n getLogger().info(requestEntity.toString());\n\n final String authorization = requestEntity.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);\n final UUID sessionId;\n final To2DeviceSessionInfo session;\n final AuthToken authToken;\n\n try {\n authToken = new AuthToken(authorization);\n sessionId = authToken.getUuid();\n session = getSessionStorage().load(sessionId);\n\n } catch (IllegalArgumentException | NoSuchElementException e) {\n return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();\n }\n\n // if any instance is corrupted/absent, the session data is unavailable, so terminate the\n // connection.\n if (null != session && (!(session.getMessage41Store() instanceof Message41Store)\n || (null == session.getMessage41Store())\n || !(session.getMessage45Store() instanceof Message45Store)\n || (null == session.getMessage45Store())\n || !(session.getDeviceCryptoInfo() instanceof DeviceCryptoInfo)\n || null == session.getDeviceCryptoInfo())) {\n return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();\n }\n\n final String requestBody = null != requestEntity.getBody() ? requestEntity.getBody() : \"\";\n\n final ByteBuffer xb =\n new KexParamCodec().decoder().apply(CharBuffer.wrap(session.getMessage45Store().getXb()));\n final To2CipherContext cipherContext =\n new To2CipherContextFactory(getKeyExchangeDecoder(), getSecureRandom())\n .build(session.getMessage41Store(), xb.duplicate());\n\n final EncryptedMessageCodec encryptedMessageCodec = new EncryptedMessageCodec();\n final EncryptedMessage deviceEncryptedMessage =\n encryptedMessageCodec.decoder().apply(CharBuffer.wrap(requestBody));\n final ByteBuffer decryptedBytes = cipherContext.read(deviceEncryptedMessage);\n final CharBuffer decryptedText = US_ASCII.decode(decryptedBytes);\n getLogger().info(decryptedText.toString());\n\n final To2NextDeviceServiceInfo nextDeviceServiceInfo =\n new To2NextDeviceServiceInfoCodec().decoder().apply(decryptedText);\n\n final OwnershipProxy proxy = new OwnershipProxyCodec.OwnershipProxyDecoder()\n .decode(CharBuffer.wrap(session.getMessage41Store().getOwnershipProxy()));\n if (null == proxy) {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"OwnershipVoucher must not be null\"));\n }\n\n for (Object serviceInfoObject : getServiceInfoModules()) {\n\n if (serviceInfoObject instanceof ServiceInfoSink) {\n final ServiceInfoSink sink = (ServiceInfoSink) serviceInfoObject;\n\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n sink.putServiceInfo(entry);\n }\n\n } else if (serviceInfoObject instanceof ServiceInfoMultiSink) {\n final ServiceInfoMultiSink sink = (ServiceInfoMultiSink) serviceInfoObject;\n final ServiceInfo serviceInfos = new ServiceInfo();\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n serviceInfos.add(entry);\n }\n sink.putServiceInfo(proxy.getOh().getG(), serviceInfos);\n\n }\n }\n\n String responseBody;\n final OwnershipProxy newProxy;\n int nn = nextDeviceServiceInfo.getNn() + 1;\n if (nn < session.getMessage45Store().getNn()) {\n final StringWriter writer = new StringWriter();\n final To2GetNextDeviceServiceInfo getNextDeviceServiceInfo =\n new To2GetNextDeviceServiceInfo(nn, new PreServiceInfo());\n new To2GetNextDeviceServiceInfoCodec().encoder().apply(writer, getNextDeviceServiceInfo);\n newProxy = null;\n responseBody = writer.toString();\n\n } else {\n\n final OwnershipProxy currentProxy = proxy;\n final Setup devSetup =\n setupDeviceService.setup(currentProxy.getOh().getG(), currentProxy.getOh().getR());\n final To2SetupDeviceNoh setupDeviceNoh = new To2SetupDeviceNoh(devSetup.r3(), devSetup.g3(),\n new Nonce(CharBuffer.wrap(session.getMessage45Store().getN7())));\n\n final StringWriter bo = new StringWriter();\n new To2SetupDeviceNohCodec().encoder().apply(bo, setupDeviceNoh);\n\n final SignatureBlock noh =\n signatureServiceFactory.build(proxy.getOh().getG()).sign(bo.toString()).get();\n\n final OwnerServiceInfoHandler ownerServiceInfoHandler =\n new OwnerServiceInfoHandler(getServiceInfoModules(), proxy.getOh().getG());\n final int osinn = ownerServiceInfoHandler.getOwnerServiceInfoEntryCount();\n\n final To2SetupDevice setupDevice = new To2SetupDevice(osinn, noh);\n final StringWriter writer = new StringWriter();\n final PublicKeyCodec.Encoder pkEncoder =\n new PublicKeyCodec.Encoder(currentProxy.getOh().getPe());\n final SignatureBlockCodec.Encoder sgEncoder = new SignatureBlockCodec.Encoder(pkEncoder);\n new To2SetupDeviceCodec.Encoder(sgEncoder).encode(writer, setupDevice);\n responseBody = writer.toString();\n\n final OwnershipProxyHeader currentOh = currentProxy.getOh();\n final OwnershipProxyHeader newOh = new OwnershipProxyHeader(currentOh.getPe(), devSetup.r3(),\n devSetup.g3(), currentOh.getD(), noh.getPk(), currentOh.getHdc());\n newProxy = new OwnershipProxy(newOh, new HashMac(MacType.NONE, ByteBuffer.allocate(0)),\n currentProxy.getDc(), new LinkedList<>());\n }\n getLogger().info(responseBody);\n\n // if the CTR nonce is null, it means that the session's IV has been lost/corrupted. For CBC, it\n // should have been all 0s, while for CTR, it should contain the current nonce.\n if (null != session.getDeviceCryptoInfo().getCtrNonce()) {\n final ByteBuffer nonce = new ByteArrayCodec().decoder()\n .apply(CharBuffer.wrap(session.getDeviceCryptoInfo().getCtrNonce()));\n cipherContext.setCtrNonce(nonce.array());\n cipherContext.setCtrCounter(session.getDeviceCryptoInfo().getCtrCounter());\n } else {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"no cipher initialization vector found\"));\n }\n final ByteBuffer responseBodyBuf = US_ASCII.encode(responseBody);\n final EncryptedMessage ownerEncryptedMessage = cipherContext.write(responseBodyBuf);\n\n final StringWriter writer = new StringWriter();\n encryptedMessageCodec.encoder().apply(writer, ownerEncryptedMessage);\n responseBody = writer.toString();\n\n final StringWriter opWriter = new StringWriter();\n if (null != newProxy) {\n new OwnershipProxyCodec.OwnershipProxyEncoder().encode(opWriter, newProxy);\n }\n final StringWriter ctrNonceWriter = new StringWriter();\n new ByteArrayCodec().encoder().apply(ctrNonceWriter,\n ByteBuffer.wrap(cipherContext.getCtrNonce()));\n\n final DeviceCryptoInfo deviceCryptoInfo =\n new DeviceCryptoInfo(ctrNonceWriter.toString(), cipherContext.getCtrCounter());\n final Message47Store message47Store = new Message47Store(opWriter.toString());\n final To2DeviceSessionInfo to2DeviceSessionInfo = new To2DeviceSessionInfo();\n to2DeviceSessionInfo.setMessage47Store(message47Store);\n to2DeviceSessionInfo.setDeviceCryptoInfo(deviceCryptoInfo);\n getSessionStorage().store(sessionId, to2DeviceSessionInfo);\n\n ResponseEntity<?> responseEntity =\n ResponseEntity.ok().header(HttpHeaders.AUTHORIZATION, authorization)\n .contentType(MediaType.APPLICATION_JSON).body(responseBody);\n\n getLogger().info(responseEntity.toString());\n return responseEntity;\n }", "Long payloadLength();", "byte[] generateMasterSecret(String type, byte[]secret, int[]clientRandom, int[]serverRandom) throws NoSuchAlgorithmException, IOException{\n byte[] part1 = md5andshaprocessing(\"AA\", secret, clientRandom, serverRandom);\r\n byte[] part2 = md5andshaprocessing(\"BB\", secret, clientRandom, serverRandom);\r\n byte[] part3 = md5andshaprocessing(\"CCC\", secret, clientRandom, serverRandom);\r\n \r\n /* using ByteArrayOutputStream to concatenate the 3 parts */\r\n \r\n baos.write(part1);\r\n baos.write(part2);\r\n baos.write(part3);\r\n \r\n byte[] result = baos.toByteArray();\r\n\r\n System.out.println(\"The \" + type + \" is indeed 48 bytes: \" + result.length);\r\n System.out.println(type + \" to string: \" + Base64.getEncoder().encodeToString(result) + \"\\n\");\r\n \r\n baos.reset();\r\n \r\n return result;\r\n }", "private final static void doRegenerateSecretKey1(SwiftConnections conn, SwiftConnectionResultHandler fileHandler)\n throws IOException {\n conn.generate_account_meta_temp_url_key(fileHandler);\n }", "@Override\n public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {\n String body = (String) msg;\n System.out.println(body);\n System.out.println(\"第\"+ ++count + \"次收到服务器回应\");\n }", "public IntegrationRuntimeRegenerateKeyParameters() {\n }", "public final void mo16236a() throws Exception {\n if (C1948n.m1229a().f1421g.mo16247c()) {\n C1744eg.this.runAsync(new C1738eb() {\n /* renamed from: a */\n public final void mo16236a() throws Exception {\n Map b = C1744eg.m890b(C1744eg.this.f1002b);\n C1691dd ddVar = new C1691dd();\n ddVar.f897f = \"https://api.login.yahoo.com/oauth2/device_session\";\n ddVar.f898g = C1699a.kPost;\n ddVar.mo16403a(\"Content-Type\", \"application/json\");\n ddVar.f883b = new JSONObject(b).toString();\n ddVar.f885d = new C1725dt();\n ddVar.f884c = new C1725dt();\n ddVar.f882a = new C1693a<String, String>() {\n /* renamed from: a */\n public final /* synthetic */ void mo16300a(C1691dd ddVar, Object obj) {\n String str = \"PrivacyManager\";\n String str2 = (String) obj;\n try {\n int i = ddVar.f904m;\n if (i == 200) {\n JSONObject jSONObject = new JSONObject(str2);\n C1744eg.m888a(C1744eg.this, new C1477a(jSONObject.getString(\"device_session_id\"), jSONObject.getLong(\"expires_in\"), C1744eg.this.f1002b));\n C1744eg.this.f1002b.callback.success();\n return;\n }\n C1685cy.m769e(str, \"Error in getting privacy dashboard url. Error code = \".concat(String.valueOf(i)));\n C1744eg.this.f1002b.callback.failure();\n } catch (JSONException e) {\n C1685cy.m763b(str, \"Error in getting privacy dashboard url. \", (Throwable) e);\n C1744eg.this.f1002b.callback.failure();\n }\n }\n };\n C1675ct.m738a().mo16389a(C1744eg.this, ddVar);\n }\n });\n return;\n }\n C1685cy.m754a(3, \"PrivacyManager\", \"Waiting for ID provider.\");\n C1948n.m1229a().f1421g.subscribe(C1744eg.this.f1003d);\n }", "public void allinfo()\n\t\t{\n\t\t\tsendBroadcast(new Intent(\"android.provider.Telephony.SECRET_CODE\", Uri.parse(\"android_secret_code://4636\")));\n\n\n\t\t}", "@Override\n\tprotected void encode(ChannelHandlerContext ctx, RPCResponse msg, ByteBuf out) throws Exception {\n\t\tbyte[] data = SerializationUtils.serialize(msg);\n\t\tout.writeInt(data.length);\n\t\tout.writeBytes( data );\n\t}", "@Override\n\tpublic void visit(SendSymmetricKey ssyk) {\n\t\t\n\t}", "@Override\n\tpublic void challenge12() {\n\n\t}", "public String getSecretKey();", "@Override\n protected byte[] getClientData() {\n return (clientData + \" individual\").getBytes(StandardCharsets.UTF_8);\n }", "public String getSecretWord()\n {\n return OriginSecretWord;\n }", "private synchronized void zzlx() {\n try {\n JSONObject jSONObject = new JSONObject();\n jSONObject.put(\"castSessionId\", this.zzTp);\n jSONObject.put(\"playerTokenMap\", new JSONObject(this.zzTn));\n this.zztB.edit().putString(\"save_data\", jSONObject.toString()).commit();\n } catch (JSONException e) {\n zzQW.zzf(\"Error while saving data: %s\", e.getMessage());\n }\n return;\n }", "public static void setSecret(byte[] bytes)\r\n/* 149: */ {\r\n/* 150: */ try\r\n/* 151: */ {\r\n/* 152:131 */ setPropertyBytes(\"secret\", bytes);\r\n/* 153: */ }\r\n/* 154: */ catch (Exception e)\r\n/* 155: */ {\r\n/* 156:133 */ log.warning(\"Error setting secret: \" + e.getMessage());\r\n/* 157: */ }\r\n/* 158: */ }", "private final void configureKeys() {\n\t\t// SecretServer's public key\n\t\tString line = ComMethods.getValueFor(\"SecretServer\", pubkeysfn);\n\t\tint x = line.indexOf(',');\n\t\tmy_n = new BigInteger(line.substring(0,x));\n\t\tmy_e = new Integer(line.substring(x+1,line.length()));\n\n\t\t// SecretServer's private key\n\t\tline = ComMethods.getValueFor(\"SecretServer\", privkeysfn);\n\t\tx = line.indexOf(',');\n\t\tmy_d = new BigInteger(line.substring(x+1,line.length()));\n\n\t\t// Public keys for all registered Users\n\t\tusersPubKeys1 = new BigInteger[validUsers.length];\n\t\tusersPubKeys2 = new int[validUsers.length];\n\t\tfor (int i=0; i<validUsers.length; i++) {\n\t\t\tline = ComMethods.getValueFor(validUsers[i], pubkeysfn);\n\t\t\tx = line.indexOf(',');\n\t\t\tusersPubKeys1[i] = new BigInteger(line.substring(0,x));\n\t\t\tusersPubKeys2[i] = new Integer(line.substring(x+1,line.length()));\n\t\t}\n\t}", "@Override\n\tprotected void encode(ChannelHandlerContext ctx, Envelope env, ByteBuf out) throws Exception {\n\t\t// (1) header (48 bytes)\n\t\t// --------------------------------------------------------------------\n\t\tout.writeInt(MAGIC_NUMBER); // 4 bytes\n\n\t\tif (out.getInt(out.writerIndex()-4) != MAGIC_NUMBER) {\n\t\t\tthrow new RuntimeException();\n\t\t}\n\n\t\tout.writeInt(env.getSequenceNumber()); // 4 bytes\n\t\tenv.getJobID().writeTo(out); // 16 bytes\n\t\tenv.getSource().writeTo(out); // 16 bytes\n\t\tout.writeInt(env.getEventsSerialized() != null ? env.getEventsSerialized().remaining() : 0); // 4 bytes\n\t\tout.writeInt(env.getBuffer() != null ? env.getBuffer().size() : 0); // 4 bytes\n\t\t// --------------------------------------------------------------------\n\t\t// (2) events (var length)\n\t\t// --------------------------------------------------------------------\n\t\tif (env.getEventsSerialized() != null) {\n\t\t\tout.writeBytes(env.getEventsSerialized());\n\t\t}\n\n\t\t// --------------------------------------------------------------------\n\t\t// (3) buffer (var length)\n\t\t// --------------------------------------------------------------------\n\t\tif (env.getBuffer() != null) {\n\t\t\tBuffer buffer = env.getBuffer();\n\t\t\tout.writeBytes(buffer.getMemorySegment().wrap(0, buffer.size()));\n\n\t\t\t// Recycle the buffer from OUR buffer pool after everything has been\n\t\t\t// copied to Nettys buffer space.\n\t\t\tbuffer.recycleBuffer();\n\t\t}\n\t}", "@Override\n\tpublic void challenge15() {\n\n\t}", "private byte[] getTokenKey() throws InternalSkiException {\n return sysKey(TOKEN_KEY);\n }", "private void send() {\n vertx.eventBus().publish(GeneratorConfigVerticle.ADDRESS, toJson());\n }", "public void generateHashFromServer(PaymentParams mPaymentParams) {\n //nextButton.setEnabled(false); // lets not allow the user to click the button again and again.\n\n // lets create the post params\n StringBuffer postParamsBuffer = new StringBuffer();\n postParamsBuffer.append(concatParams(PayuConstants.KEY, mPaymentParams.getKey()));\n postParamsBuffer.append(concatParams(PayuConstants.AMOUNT, mPaymentParams.getAmount()));\n postParamsBuffer.append(concatParams(PayuConstants.TXNID, mPaymentParams.getTxnId()));\n postParamsBuffer.append(concatParams(PayuConstants.EMAIL, null == mPaymentParams.getEmail() ? \"\" : mPaymentParams.getEmail()));\n postParamsBuffer.append(concatParams(PayuConstants.PRODUCT_INFO, mPaymentParams.getProductInfo()));\n postParamsBuffer.append(concatParams(PayuConstants.FIRST_NAME, null == mPaymentParams.getFirstName() ? \"\" : mPaymentParams.getFirstName()));\n postParamsBuffer.append(concatParams(PayuConstants.UDF1, mPaymentParams.getUdf1() == null ? \"\" : mPaymentParams.getUdf1()));\n postParamsBuffer.append(concatParams(PayuConstants.UDF2, mPaymentParams.getUdf2() == null ? \"\" : mPaymentParams.getUdf2()));\n postParamsBuffer.append(concatParams(PayuConstants.UDF3, mPaymentParams.getUdf3() == null ? \"\" : mPaymentParams.getUdf3()));\n postParamsBuffer.append(concatParams(PayuConstants.UDF4, mPaymentParams.getUdf4() == null ? \"\" : mPaymentParams.getUdf4()));\n postParamsBuffer.append(concatParams(PayuConstants.UDF5, mPaymentParams.getUdf5() == null ? \"\" : mPaymentParams.getUdf5()));\n postParamsBuffer.append(concatParams(PayuConstants.USER_CREDENTIALS, mPaymentParams.getUserCredentials() == null ? PayuConstants.DEFAULT : mPaymentParams.getUserCredentials()));\n\n // for offer_key\n if (null != mPaymentParams.getOfferKey())\n postParamsBuffer.append(concatParams(PayuConstants.OFFER_KEY, mPaymentParams.getOfferKey()));\n\n String postParams = postParamsBuffer.charAt(postParamsBuffer.length() - 1) == '&' ? postParamsBuffer.substring(0, postParamsBuffer.length() - 1).toString() : postParamsBuffer.toString();\n\n // lets make an api call\n GetHashesFromServerTask getHashesFromServerTask = new GetHashesFromServerTask();\n getHashesFromServerTask.execute(postParams);\n }", "private int spreadWriteRequests() {\n return RANDOM.nextInt(MAX_SLEEP_TIME);\n }", "private byte[] execHandlerWrite( Message msg ) {\n\t\tbyte[] bytes = (byte[]) msg.obj;\n \tString data = mByteUtility.bytesToHexString( bytes ); \n\t\tlog_d( \"EventWrite \" + data );\n\t\treturn bytes;\n\t}", "private IdServer() {\n\t\t//System.out.println(\"Creating new instance of ID Server!\");\n\t\tclientIDCounter = 1;\n\t\tmemberIDCounter = 1;\n\t\tticketIdCounter = 1;\n\t}", "@DSGenerator(tool_name = \"Doppelganger\", tool_version = \"2.0\", generated_on = \"2013-12-30 12:55:06.831 -0500\", hash_original_method = \"E7A2FB4AC135D29D78CE09D5448C290F\", hash_generated_method = \"74B066602ECC20A74FD97E770D65E8BD\")\n \npublic String encodeBody() {\n return encodeBody(new StringBuffer()).toString();\n }", "void setMySecret() {\n mySecretShortString = randomString (6);\n mySecretLongString = randomString (14);\n mySecretShort.setText(\"your short secret: \" + mySecretShortString);\n mySecretLong.setText(\"or your long secret: \" + mySecretLongString);\n }", "@Override\n public void testConnection() {\n\n String in = posId + \"|\" + crc;\n String sig = DigestUtils.md5Digest(in);\n\n logger.debug(in);\n logger.debug(sig);\n\n MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();\n\n map.add(\"p24_merchant_id\", String.valueOf(merchantId));\n map.add(\"p24_pos_id\", String.valueOf(posId));\n map.add(\"p24_sign\", sig);\n\n String res = restTemplate.postForObject(url + \"/testConnection\", map, String.class);\n\n logger.debug(res);\n\n }", "public void createValue() {\n value = new AES_GetBusa_Lib_1_0.AES_GetBusa_Request();\n }", "public String getSecretKey() {\n return secretKey;\n }", "@Override\n public void channelActive(ChannelHandlerContext ctx) throws Exception {\n super.channelActive(ctx);\n \n }", "public void generateNewSecret() {\r\n \r\n //Get Random Number With Correct Digits\r\n int intRand = randomNumberGenerator.nextInt((int)(Math.pow(10, numDigits) - Math.pow(10, numDigits - 1))) + (int)Math.pow(10, numDigits - 1);\r\n \r\n //Set To String\r\n String strRand = String.valueOf(intRand);\r\n \r\n //Set Value\r\n secretNumber = convertNumToDigitArray(strRand);\r\n \r\n }", "void addSecretKey(InputStream secretKey) throws IOException, PGPException;", "public void run() {\n uploadManager.put(f, expectKey, TestConfig.token_z0, new UpCompletionHandler() {\n public void complete(String k, ResponseInfo rinfo, JSONObject response) {\n Log.i(\"qiniutest\", k + rinfo);\n key = k;\n info = rinfo;\n resp = response;\n signal.countDown();\n }\n }, null);\n }", "public EnScrypt() {}", "public interface Constants {\n String SERVER_ADDRESS = \"http://10.21.238.153:8080/encryptvideoweb\";\n String PUBLISH_ADDRESS = \"rtmp://10.21.238.153/live/[stream_name]\";\n //replace [stream_name] with real stream name\n String UPLOAD_ADDRESS = \"http://10.21.238.153/upload.php\";\n String EXECUTE_ADDRESS = \"http://10.21.238.153/execute_enc.php\";\n String ECCURVE_NAME = \"secp256k1\";\n SecP256K1Curve ECCURVE = new SecP256K1Curve();\n String SHARED_PREFERENCES = \"cookiework.encryptedvideopublish.sp\";\n int CONNECT_TIMEOUT = 8000;\n int READ_TIMEOUT = 8000;\n String DB_NAME = \"publisher_db\";\n int DB_VERSION = 2;\n String TIME_LOG_TAG = \"TIME_LOG\";\n}", "private String getServerStatusData() throws IOException {\r\n File keyFile = resources.ResourceLoader.getFile(\"key.txt\");\r\n String key = new Scanner(keyFile).nextLine();\r\n\r\n URLConnection conn = new URL(baseURL).openConnection();\r\n conn.setDoOutput(true);\r\n conn.setRequestProperty(\"X-Riot-Token\", key);\r\n\r\n try(BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {\r\n String line = in.readLine();\r\n in.close();\r\n return line.replace(\"\\\\r\\\\n\", \"\");\r\n }\r\n catch(UnknownHostException e) {\r\n System.out.println(e);\r\n throw e;\r\n }\r\n }", "Pokemon.RequestEnvelop.AuthInfo.JWT getToken();", "private void setupNextEncoder() {\n channel.outboundPipeline().replace(this, outboundHandlers);\n }", "public void generateAroundPlayer() {\n try {\n DataOutputStream dataOutputStream = new DataOutputStream(SixEngineClient.client.socket.getOutputStream());\n\n dataOutputStream.writeByte(5);\n dataOutputStream.writeInt(getChunkX());\n dataOutputStream.writeInt(getChunkY());\n dataOutputStream.writeInt(getChunkZ());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void getAUTH_REQUEST() throws Exception {\n\t\t\n\t\tboolean status = true;\n\t\tboolean status2 = false;\n\t\tString msg = \"\";\n\t\t\n\t\t//File filePK = new File(\"identity\");\n\t\n\t\ttry {\n\t\t\t\n\t\t\tmsg = br.readLine();\n\t\t\tGetTimestamp(\"Received Authorization Request from Client: \" + msg);\n\t\t\t\n\t\t\tJSONObject REQUEST = (JSONObject) parser.parse(msg);\n\t String identity = REQUEST.get(\"identity\").toString();\n\t\t\t\n\t\t\t\n\t if((identity.contains(\"aaron@krusty\"))) {\n\n\t \tGetTimestamp(\"Authorization Request from Client is approved: \");\n\n\t \tGetTimestamp(\"Client Publickey is stored: \" ) ;\n\n\t \tString tosend = encrypt1(getSharedKey(), getClientPublicKey());\n\n\t \tGetTimestamp(\"Server sharedkey is being encrypted with Client's publickey to be sent: \") ;\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"AES128\", tosend);\n\t \tRESPONSE.put(\"status\", status);\n\t \tRESPONSE.put(\"message\", \"public key found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tGetTimestamp(\"Sending Authorization Response to Client: \");\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\n\n\t }\n\t else {\n\n\t \tSystem.out.println(\"Client \" + REQUEST.get(\"identity\") + \" has been rejected\");\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"status\", status2);\n\t \tRESPONSE.put(\"message\", \"public key not found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\t \tcloseConnection();\n\t }\n\t\t\t\t\n\t\t\t\n\t\t} catch (IOException ex) {\n\t\t\tLogger.getLogger(ServerTCP.class.getName()).log(Level.SEVERE, null, ex);\n\t\t}\n\t\tif (msg.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"Client has signed out!\");\n\t\t\tcloseConnection();\n\n\t\t} else {\t\n\t\t\tgetMessage();\n\t\t}\n\t}", "public static byte[] createPacket(int psecret, int step, int studentID, byte[] payload) {\n\t\tbyte[] data = new byte[(int) (4*(Math.ceil((ServerValuesHolder.HEADER_LENGTH + payload.length)/4.0)))];\n\t\tbyte[] header = createHeader(payload.length, psecret, step, studentID);\n\t\t\n\t\tSystem.arraycopy(header, 0, data, 0, header.length);\n\t\tSystem.arraycopy(payload, 0, data, header.length, payload.length);\n\t\t\n\t\treturn data;\n\t}", "void processMessage(NettyCorfuMsg msg, ChannelHandlerContext ctx)\n {\n switch (msg.getMsgType())\n {\n case TOKEN_REQ: {\n NettyStreamingServerTokenRequestMsg req = (NettyStreamingServerTokenRequestMsg) msg;\n if (req.getNumTokens() == 0)\n {\n long max = 0L;\n for (UUID id : req.getStreamIDs()) {\n Long lastIssued = lastIssuedMap.get(id);\n max = Math.max(max, lastIssued == null ? Long.MIN_VALUE: lastIssued);\n }\n NettyStreamingServerTokenResponseMsg resp = new NettyStreamingServerTokenResponseMsg(max);\n sendResponse(resp, msg, ctx);\n }\n else {\n long thisIssue = globalIndex.getAndAdd(req.getNumTokens());\n for (UUID id : req.getStreamIDs()) {\n lastIssuedMap.compute(id, (k, v) -> v == null ? thisIssue + req.getNumTokens() :\n Math.max(thisIssue + req.getNumTokens(), v));\n }\n NettyStreamingServerTokenResponseMsg resp = new NettyStreamingServerTokenResponseMsg(thisIssue);\n sendResponse(resp, msg, ctx);\n }\n }\n break;\n default:\n log.warn(\"Unknown message type {} passed to handler!\", msg.getMsgType());\n throw new RuntimeException(\"Unsupported message passed to handler!\");\n }\n }", "public final byte[] secret() {\n try {\n ByteSequence seq = new ByteSequence(this.sequence());\n seq.append(this._domainNameSeq);\n seq.append(this._creatorCert.getEncoded());\n return seq.sequence();\n } catch (Exception ex) {\n ex.printStackTrace();\n return null;\n }\n }", "private byte[] createSignatureBase() {\n final Charset utf8 = StandardCharsets.UTF_8;\n byte[] urlBytes = url.getBytes(utf8);\n byte[] timeStampBytes = Long.toString(timestamp).getBytes(utf8);\n byte[] secretBytes = secret.getBytes(utf8);\n\n // concatenate\n ByteArrayOutputStream stream = new ByteArrayOutputStream();\n try {\n stream.write(urlBytes);\n stream.write(body);\n stream.write(timeStampBytes);\n stream.write(secretBytes);\n } catch (IOException ex){\n logger.error(\"Could not create signature base\", ex);\n return new byte[0];\n }\n\n return stream.toByteArray();\n }", "@Override\n\tprotected void channelRead0(ChannelHandlerContext ctx, WsClientMessage msg) throws Exception {\n\t}", "@Override\n\t\t\t\t\tpublic void onReqStart() {\n\t\t\t\t\t}", "public void sendKeys() throws Exception{\n ATMMessage atmMessage = (ATMMessage)is.readObject();\r\n System.out.println(\"\\nGot response\");\r\n \r\n //System.out.println(\"Received second message from the client with below details \");\r\n //System.out.println(\"Response Nonce value : \"+atmMessage.getResponseNonce());\r\n \r\n if(!verifyMessage(atmMessage))error(\" Nonce or time stamp does not match\") ;\r\n kSession = crypto.makeRijndaelKey();\r\n \r\n Key kRandom = crypto.makeRijndaelKey();\r\n byte [] cipherText = crypto.encryptRSA(kRandom,kPubClient);\r\n os.writeObject((Serializable)cipherText);\r\n System.out.println(\"\\nSending Accept and random key\");\r\n \r\n \r\n cipherText = crypto.encryptRSAPrivateKey(kSession,kPrivBank);\r\n atmMessage = new ATMMessage(); \r\n atmMessage.setEncryptedSessionKey(cipherText);\r\n cipherText = crypto.encryptRijndael(atmMessage,kRandom);\r\n currTimeStamp = System.currentTimeMillis();\r\n os.writeObject((Serializable)cipherText);\r\n //System.out.println(\"Session Key send to the client \");\r\n \r\n //SecondServerMessage secondServerMessage = new SecondServerMessage();\r\n //secondServerMessage.setSessionKey(kSession);\r\n \r\n //byte [] cipherText1;\r\n //cipherText = crypto.encryptRSAPrivateKey(kSession,kPrivBank);\r\n //cipherText1 = crypto.encryptRSA(cipherText,clientPublicKey);\r\n //os.writeObject((Serializable)cipherText1);\r\n \r\n //System.out.println(\"Second message send by the server which contains the session key. \");\r\n //System.out.println(\"\\n\\n\\n\");\r\n \r\n \r\n }", "private void processDeviceStream(SelectionKey key, byte[] data) throws IOException{\n\t\tSocketChannel channel = (SocketChannel)key.channel();\n\t\tString sDeviceID = \"\";\n\t\t// Initial call where the device sends it's IMEI# - Sarat\n\t\tif ((data.length >= 10) && (data.length <= 17)) {\n\t\t\tint ii = 0;\n\t\t\tfor (byte b : data)\n\t\t\t{\n\t\t\t\tif (ii > 1) { // skipping first 2 bytes that defines the IMEI length. - Sarat\n\t\t\t\t\tchar c = (char)b;\n\t\t\t\t\tsDeviceID = sDeviceID + c;\n\t\t\t\t}\n\t\t\t\tii++;\n\t\t\t}\n\t\t\t// printing the IMEI #. - Sarat\n\t\t\tSystem.out.println(\"IMEI#: \"+sDeviceID);\n\n\t\t\tLinkedList<String> lstDevice = new LinkedList<String>();\n\t\t\tlstDevice.add(sDeviceID);\n\t\t\tdataTracking.put(channel, lstDevice);\n\n\t\t\t// send message to module that handshake is successful - Sarat\n\t\t\ttry {\n\t\t\t\tsendDeviceHandshake(key, true);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t// second call post handshake where the device sends the actual data. - Sarat\n\t\t}else if(data.length > 17){\n\t\t\tmClientStatus.put(channel, System.currentTimeMillis());\n\t\t\tList<?> lst = (List<?>)dataTracking.get(channel);\n\t\t\tif (lst.size() > 0)\n\t\t\t{\n\t\t\t\t//Saving data to database\n\t\t\t\tsDeviceID = lst.get(0).toString();\n\t\t\t\tDeviceState.put(channel, sDeviceID);\n\n\t\t\t\t//String sData = org.bson.internal.Base64.encode(data);\n\n\t\t\t\t// printing the data after it has been received - Sarat\n\t\t\t\tStringBuilder deviceData = byteToStringBuilder(data);\n\t\t\t\tSystem.out.println(\" Data received from device : \"+deviceData);\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\t//publish device IMEI and packet data to Nats Server\n\t\t\t\t\tnatsPublisher.publishMessage(sDeviceID, deviceData);\n\t\t\t\t} catch(Exception nexp) {\n\t\t\t\t\tnexp.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\t//sending response to device after processing the AVL data. - Sarat\n\t\t\t\ttry {\n\t\t\t\t\tsendDataReceptionCompleteMessage(key, data);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\t//storing late timestamp of device\n\t\t\t\tDeviceLastTimeStamp.put(sDeviceID, System.currentTimeMillis());\n\n\t\t\t}else{\n\t\t\t\t// data not good.\n\t\t\t\ttry {\n\t\t\t\t\tsendDeviceHandshake(key, false);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new IOException(\"Bad data received\");\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t// data not good.\n\t\t\ttry {\n\t\t\t\tsendDeviceHandshake(key, false);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new IOException(\"Bad data received\");\n\t\t\t}\n\t\t}\n\t}", "public SecretKey getSecretKey() {\n return secretKey;\n }" ]
[ "0.6827598", "0.6190681", "0.59548855", "0.592717", "0.59256625", "0.5797804", "0.57361996", "0.56002754", "0.55888635", "0.55541223", "0.5550802", "0.55310625", "0.552865", "0.5498099", "0.54952693", "0.5449761", "0.5424309", "0.54165417", "0.5404438", "0.5402851", "0.5375329", "0.5335604", "0.5320374", "0.5319056", "0.52935386", "0.52759117", "0.5218091", "0.52058744", "0.518556", "0.5180916", "0.5176421", "0.51560056", "0.51424456", "0.5130795", "0.51191366", "0.51034015", "0.5083963", "0.50817025", "0.5066279", "0.5065569", "0.50651777", "0.5061701", "0.5046898", "0.5046898", "0.5046898", "0.5046898", "0.5036423", "0.5036019", "0.5035725", "0.5034748", "0.5015258", "0.5013402", "0.4998281", "0.4994914", "0.4988112", "0.49850592", "0.4983594", "0.4975683", "0.4972745", "0.49665377", "0.49476865", "0.49431217", "0.49415895", "0.49408385", "0.49404487", "0.49357468", "0.49296695", "0.4929454", "0.49260274", "0.49256945", "0.49222776", "0.49213848", "0.4920458", "0.49188456", "0.4918179", "0.49167457", "0.49158776", "0.4911901", "0.49060878", "0.4897997", "0.489752", "0.48720786", "0.4870247", "0.48659727", "0.4861664", "0.48600143", "0.48599347", "0.48590717", "0.4855829", "0.4851496", "0.48419404", "0.48383772", "0.48341992", "0.483263", "0.48317668", "0.48289633", "0.482846", "0.48271823", "0.4824181", "0.48236963", "0.48230967" ]
0.0
-1
Interprets input payloads and returns appropriate responses 'partTwo' differentiates messages for auth. part 1 and auth. part 2
public byte[] getMessage(byte[] payload, boolean partTwo) { ComMethods.report("SecretServer received payload and will now process it.", simMode); byte[] resp = new byte[0]; if (activeSession) { // Extract message from active session payload byte[] message = processPayload(payload); switch (getSessionCommand(message)) { case "password": resp = handlePassword(message); break; case "view": resp = handleView(); break; case "update": resp = handleUpdate(message); break; case "delete": resp = handleDelete(); break; default: ComMethods.handleBadResp(); break; } counter = counter + 2; } else if (!partTwo) { resp = handleAuthPt1(payload); } else if (userSet && partTwo) { resp = handleAuthPt2(payload); } else { // Something's wrong ComMethods.handleBadResp(); } return resp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private byte[] handleAuthPt2(byte[] payload) { \n\t\tbyte[] message = ComMethods.decryptRSA(payload, my_n, my_d);\n\t\tComMethods.report(\"SecretServer has decrypted the User's message using SecretServer's private RSA key.\", simMode);\n\t\t\n\t\tif (!Arrays.equals(Arrays.copyOf(message, myNonce.length), myNonce)) {\n\t\t\tComMethods.report(\"ERROR ~ invalid third message in protocol.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Authentication done!\n\t\t\tcurrentSessionKey = Arrays.copyOfRange(message, myNonce.length, message.length);\n\t\t\tactiveSession = true;\n\t\t\tcounter = 11;\n\n\t\t\t// use \"preparePayload\" from now on for all outgoing messages\n\t\t\tbyte[] responsePayload = preparePayload(\"understood\".getBytes());\n\t\t\tcounter = 13;\n\t\t\treturn responsePayload;\n\t\t} \n\t}", "private byte[] handleAuthPt1(byte[] payload) {\n\t\tboolean userIdentified = false;\n\t\tbyte[] supposedUser = null;\n\n//\n\t\tSystem.out.println(\"payload received by SecretServer:\");\n\t\tComMethods.charByChar(payload,true);\n//\n\n\t\tuserNum = -1;\n\t\twhile (userNum < validUsers.length-1 && !userIdentified) {\n\t\t\tuserNum++;\n\t\t\tsupposedUser = validUsers[userNum].getBytes();\n\t\t\tuserIdentified = Arrays.equals(Arrays.copyOf(payload, supposedUser.length), supposedUser);\n\n//\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"\\\"\"+validUsers[userNum]+\"\\\" in bytes:\");\n\t\t\tComMethods.charByChar(validUsers[userNum].getBytes(),true);\n\t\t\tSystem.out.println(\"\\\"Arrays.copyOf(payload, supposedUser.length\\\" in bytes:\");\n\t\t\tComMethods.charByChar(Arrays.copyOf(payload, supposedUser.length),true);\n\t\t\tSystem.out.println();\n//\n\t\t}\n\n\t\tif (!userIdentified) {\n\t\t\tComMethods.report(\"SecretServer doesn't recognize name of valid user.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Process second half of message, and verify format\n\t\t\tbyte[] secondHalf = Arrays.copyOfRange(payload, supposedUser.length, payload.length);\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tsecondHalf = ComMethods.decryptRSA(secondHalf, my_n, my_d);\n\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tComMethods.report(\"SecretServer has decrypted the second half of the User's message using SecretServer's private RSA key.\", simMode);\n\n\t\t\tif (!Arrays.equals(Arrays.copyOf(secondHalf, supposedUser.length), supposedUser)) {\n\t\t\t\t// i.e. plaintext name doesn't match the encrypted bit\n\t\t\t\tComMethods.report(\"ERROR ~ invalid first message in protocol.\", simMode);\t\t\t\t\n\t\t\t\treturn \"error\".getBytes();\n\t\t\t} else {\n\t\t\t\t// confirmed: supposedUser is legit. user\n\t\t\t\tcurrentUser = new String(supposedUser); \n\t\t\t\tuserSet = true;\n\t\t\t\tbyte[] nonce_user = Arrays.copyOfRange(secondHalf, supposedUser.length, secondHalf.length);\n\n\t\t\t\t// Second Message: B->A: E_kA(nonce_A || Bob || nonce_B)\n\t\t\t\tmyNonce = ComMethods.genNonce();\n\t\t\t\tComMethods.report(\"SecretServer has randomly generated a 128-bit nonce_srvr = \"+myNonce+\".\", simMode);\n\t\t\t\n\t\t\t\tbyte[] response = ComMethods.concatByteArrs(nonce_user, \"SecretServer\".getBytes(), myNonce);\n\t\t\t\tbyte[] responsePayload = ComMethods.encryptRSA(response, usersPubKeys1[userNum], BigInteger.valueOf(usersPubKeys2[userNum]));\n\t\t\t\treturn responsePayload;\n\t\t\t}\n\t\t}\n\t}", "@Override\n protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response,\n AuthenticationContext context) throws AuthenticationFailedException {\n Map<String, String> authenticatorProperties = context.getAuthenticatorProperties();\n String apiKey = authenticatorProperties.get(Token2Constants.APIKEY);\n String userToken = request.getParameter(Token2Constants.CODE);\n String id = getUserId(context);\n String json = validateToken(Token2Constants.TOKEN2_VALIDATE_ENDPOINT, apiKey, id, Token2Constants.JSON_FORMAT,\n userToken);\n Map<String, Object> userClaims;\n userClaims = JSONUtils.parseJSON(json);\n if (userClaims != null) {\n String validation = String.valueOf(userClaims.get(Token2Constants.VALIDATION));\n if (validation.equals(\"true\")) {\n context.setSubject(AuthenticatedUser\n .createLocalAuthenticatedUserFromSubjectIdentifier(\"an authorised user\"));\n } else {\n throw new AuthenticationFailedException(\"Given hardware token has been expired or is not a valid token\");\n }\n } else {\n throw new AuthenticationFailedException(\"UserClaim object is null\");\n }\n }", "@Test\n public void testSuccessfulMultipleParBySameClient() throws Exception {\n // create client dynamically\n String clientId = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.FALSE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation oidcCRep = getClientDynamically(clientId);\n String clientSecret = oidcCRep.getClientSecret();\n assertEquals(Boolean.FALSE, oidcCRep.getRequirePushedAuthorizationRequests());\n assertTrue(oidcCRep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, oidcCRep.getTokenEndpointAuthMethod());\n\n // Pushed Authorization Request #1\n oauth.clientId(clientId);\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n ParResponse pResp = oauth.doPushedAuthorizationRequest(clientId, clientSecret);\n assertEquals(201, pResp.getStatusCode());\n String requestUriOne = pResp.getRequestUri();\n\n // Pushed Authorization Request #2\n oauth.clientId(clientId);\n oauth.scope(\"microprofile-jwt\" + \" \" + \"profile\");\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n pResp = oauth.doPushedAuthorizationRequest(clientId, clientSecret);\n assertEquals(201, pResp.getStatusCode());\n String requestUriTwo = pResp.getRequestUri();\n\n // Authorization Request with request_uri of PAR #2\n // remove parameters as query strings of uri\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUriTwo);\n String state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n OAuthClient.AuthorizationEndpointResponse loginResponse = oauth.doLogin(TEST_USER2_NAME, TEST_USER2_PASSWORD);\n assertEquals(state, loginResponse.getState());\n String code = loginResponse.getCode();\n String sessionId =loginResponse.getSessionState();\n\n // Token Request #2\n oauth.redirectUri(CLIENT_REDIRECT_URI); // get tokens, it needed. https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3\n OAuthClient.AccessTokenResponse res = oauth.doAccessTokenRequest(code, clientSecret);\n assertEquals(200, res.getStatusCode());\n\n AccessToken token = oauth.verifyToken(res.getAccessToken());\n String userId = findUserByUsername(adminClient.realm(REALM_NAME), TEST_USER2_NAME).getId();\n assertEquals(userId, token.getSubject());\n assertEquals(sessionId, token.getSessionState());\n // The following check is not valid anymore since file store does have the same ID, and is redundant due to the previous line\n // Assert.assertNotEquals(TEST_USER2_NAME, token.getSubject());\n assertEquals(clientId, token.getIssuedFor());\n assertTrue(token.getScope().contains(\"openid\"));\n assertTrue(token.getScope().contains(\"microprofile-jwt\"));\n assertTrue(token.getScope().contains(\"profile\"));\n\n // Logout\n oauth.doLogout(res.getRefreshToken(), clientSecret); // same oauth instance is used so that this logout is needed to send authz request consecutively.\n\n // Authorization Request with request_uri of PAR #1\n // remove parameters as query strings of uri\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUriOne);\n state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n loginResponse = oauth.doLogin(TEST_USER_NAME, TEST_USER_PASSWORD);\n assertEquals(state, loginResponse.getState());\n code = loginResponse.getCode();\n sessionId =loginResponse.getSessionState();\n\n // Token Request #1\n oauth.redirectUri(CLIENT_REDIRECT_URI); // get tokens, it needed. https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3\n res = oauth.doAccessTokenRequest(code, clientSecret);\n assertEquals(200, res.getStatusCode());\n\n token = oauth.verifyToken(res.getAccessToken());\n userId = findUserByUsername(adminClient.realm(REALM_NAME), TEST_USER_NAME).getId();\n assertEquals(userId, token.getSubject());\n assertEquals(sessionId, token.getSessionState());\n // The following check is not valid anymore since file store does have the same ID, and is redundant due to the previous line\n // Assert.assertNotEquals(TEST_USER_NAME, token.getSubject());\n assertEquals(clientId, token.getIssuedFor());\n assertFalse(token.getScope().contains(\"microprofile-jwt\"));\n assertTrue(token.getScope().contains(\"openid\"));\n }", "private static AuthorizationInfo digest_fixup(AuthorizationInfo authorizationInfo, RoRequest roRequest, AuthorizationInfo authorizationInfo2, RoResponse roResponse, boolean bl) throws AuthSchemeNotImplException {\n String[] arrstring;\n Object object;\n Object object2;\n String string;\n NVPair[] arrnVPair;\n int n;\n int n2 = -1;\n int n3 = -1;\n int n4 = -1;\n int n5 = -1;\n int n6 = -1;\n int n7 = -1;\n int n8 = -1;\n NVPair[] arrnVPair2 = null;\n if (authorizationInfo2 != null) {\n arrnVPair2 = authorizationInfo2.getParams();\n for (n = 0; n < arrnVPair2.length; ++n) {\n String string2 = arrnVPair2[n].getName().toLowerCase();\n if (string2.equals(\"domain\")) {\n n2 = n;\n continue;\n }\n if (string2.equals(\"nonce\")) {\n n3 = n;\n continue;\n }\n if (string2.equals(\"opaque\")) {\n n5 = n;\n continue;\n }\n if (string2.equals(\"algorithm\")) {\n n4 = n;\n continue;\n }\n if (string2.equals(\"stale\")) {\n n6 = n;\n continue;\n }\n if (string2.equals(\"digest-required\")) {\n n7 = n;\n continue;\n }\n if (!string2.equals(\"qop\")) continue;\n n8 = n;\n }\n }\n n = -1;\n int n9 = -1;\n int n10 = -1;\n int n11 = -1;\n int n12 = -1;\n int n13 = -1;\n int n14 = -1;\n int n15 = -1;\n int n16 = -1;\n int n17 = -1;\n int n18 = -1;\n Object object3 = authorizationInfo;\n synchronized (object3) {\n arrnVPair = authorizationInfo.getParams();\n for (int i = 0; i < arrnVPair.length; ++i) {\n String string3 = arrnVPair[i].getName().toLowerCase();\n if (string3.equals(\"uri\")) {\n n = i;\n continue;\n }\n if (string3.equals(\"username\")) {\n n9 = i;\n continue;\n }\n if (string3.equals(\"algorithm\")) {\n n10 = i;\n continue;\n }\n if (string3.equals(\"nonce\")) {\n n12 = i;\n continue;\n }\n if (string3.equals(\"cnonce\")) {\n n13 = i;\n continue;\n }\n if (string3.equals(\"nc\")) {\n n14 = i;\n continue;\n }\n if (string3.equals(\"response\")) {\n n11 = i;\n continue;\n }\n if (string3.equals(\"opaque\")) {\n n15 = i;\n continue;\n }\n if (string3.equals(\"digest\")) {\n n16 = i;\n continue;\n }\n if (string3.equals(\"digest-required\")) {\n n17 = i;\n continue;\n }\n if (!string3.equals(\"qop\")) continue;\n n18 = i;\n }\n if (n10 != -1 && !arrnVPair[n10].getValue().equalsIgnoreCase(\"MD5\") && !arrnVPair[n10].getValue().equalsIgnoreCase(\"MD5-sess\")) {\n throw new AuthSchemeNotImplException(\"Digest auth scheme: Algorithm \" + arrnVPair[n10].getValue() + \" not implemented\");\n }\n if (n4 != -1 && !arrnVPair2[n4].getValue().equalsIgnoreCase(\"MD5\") && !arrnVPair2[n4].getValue().equalsIgnoreCase(\"MD5-sess\")) {\n throw new AuthSchemeNotImplException(\"Digest auth scheme: Algorithm \" + arrnVPair2[n4].getValue() + \" not implemented\");\n }\n arrnVPair[n] = new NVPair(\"uri\", roRequest.getRequestURI());\n string = arrnVPair[n12].getValue();\n if (n3 != -1 && !string.equals(arrnVPair2[n3].getValue())) {\n arrnVPair[n12] = arrnVPair2[n3];\n }\n if (n5 != -1) {\n if (n15 == -1) {\n arrnVPair = Util.resizeArray(arrnVPair, arrnVPair.length + 1);\n n15 = arrnVPair.length - 1;\n }\n arrnVPair[n15] = arrnVPair2[n5];\n }\n if (n4 != -1) {\n if (n10 == -1) {\n arrnVPair = Util.resizeArray(arrnVPair, arrnVPair.length + 1);\n n10 = arrnVPair.length - 1;\n }\n arrnVPair[n10] = arrnVPair2[n4];\n }\n if (n8 != -1 || n4 != -1 && arrnVPair2[n4].getValue().equalsIgnoreCase(\"MD5-sess\")) {\n if (n13 == -1) {\n arrnVPair = Util.resizeArray(arrnVPair, arrnVPair.length + 1);\n n13 = arrnVPair.length - 1;\n }\n if (digest_secret == null) {\n digest_secret = DefaultAuthHandler.gen_random_bytes(20);\n }\n long l = System.currentTimeMillis();\n byte[] arrby = new byte[]{(byte)(l & 0xFFL), (byte)(l >> 8 & 0xFFL), (byte)(l >> 16 & 0xFFL), (byte)(l >> 24 & 0xFFL), (byte)(l >> 32 & 0xFFL), (byte)(l >> 40 & 0xFFL), (byte)(l >> 48 & 0xFFL), (byte)(l >> 56 & 0xFFL)};\n object2 = new MD5(digest_secret);\n ((MD5)object2).Update(arrby);\n arrnVPair[n13] = new NVPair(\"cnonce\", ((MD5)object2).asHex());\n }\n if (n8 != -1) {\n int n19;\n if (n18 == -1) {\n arrnVPair = Util.resizeArray(arrnVPair, arrnVPair.length + 1);\n n18 = arrnVPair.length - 1;\n }\n String[] arrstring2 = Util.splitList(arrnVPair2[n8].getValue(), \",\");\n object = null;\n for (n19 = 0; n19 < arrstring2.length; ++n19) {\n if (arrstring2[n19].equalsIgnoreCase(\"auth-int\") && roRequest.getStream() == null) {\n object = \"auth-int\";\n break;\n }\n if (!arrstring2[n19].equalsIgnoreCase(\"auth\")) continue;\n object = \"auth\";\n }\n if (object == null) {\n for (n19 = 0; n19 < arrstring2.length; ++n19) {\n if (!arrstring2[n19].equalsIgnoreCase(\"auth-int\")) continue;\n throw new AuthSchemeNotImplException(\"Digest auth scheme: Can't comply with qop option 'auth-int' because data not available\");\n }\n throw new AuthSchemeNotImplException(\"Digest auth scheme: None of the available qop options '\" + arrnVPair2[n8].getValue() + \"' implemented\");\n }\n arrnVPair[n18] = new NVPair(\"qop\", (String)object, false);\n }\n if (n18 != -1) {\n if (n14 == -1) {\n arrnVPair = Util.resizeArray(arrnVPair, arrnVPair.length + 1);\n n14 = arrnVPair.length - 1;\n arrnVPair[n14] = new NVPair(\"nc\", \"00000001\", false);\n } else if (string.equals(arrnVPair[n12].getValue())) {\n String string4 = Long.toHexString(Long.parseLong(arrnVPair[n14].getValue(), 16) + 1L);\n arrnVPair[n14] = new NVPair(\"nc\", \"00000000\".substring(string4.length()) + string4, false);\n } else {\n arrnVPair[n14] = new NVPair(\"nc\", \"00000001\", false);\n }\n }\n arrstring = (String[])authorizationInfo.getExtraInfo();\n if (authorizationInfo2 != null && (n6 == -1 || !arrnVPair2[n6].getValue().equalsIgnoreCase(\"true\")) && n10 != -1 && arrnVPair[n10].getValue().equalsIgnoreCase(\"MD5-sess\")) {\n arrstring[1] = new MD5(arrstring[0] + \":\" + arrnVPair[n12].getValue() + \":\" + arrnVPair[n13].getValue()).asHex();\n authorizationInfo.setExtraInfo(arrstring);\n }\n authorizationInfo.setParams(arrnVPair);\n }\n object3 = n10 != -1 && arrnVPair[n10].getValue().equalsIgnoreCase(\"MD5-sess\") ? arrstring[1] : arrstring[0];\n string = roRequest.getMethod() + \":\" + arrnVPair[n].getValue();\n if (n18 != -1 && arrnVPair[n18].getValue().equalsIgnoreCase(\"auth-int\")) {\n object = new MD5();\n ((MD5)object).Update(roRequest.getData() == null ? NUL : roRequest.getData());\n string = string + \":\" + ((MD5)object).asHex();\n }\n string = new MD5(string).asHex();\n String string5 = n18 == -1 ? new MD5((String)object3 + \":\" + arrnVPair[n12].getValue() + \":\" + string).asHex() : new MD5((String)object3 + \":\" + arrnVPair[n12].getValue() + \":\" + arrnVPair[n14].getValue() + \":\" + arrnVPair[n13].getValue() + \":\" + arrnVPair[n18].getValue() + \":\" + string).asHex();\n arrnVPair[n11] = new NVPair(\"response\", string5);\n boolean bl2 = false;\n if (n7 != -1 && (arrnVPair2[n7].getValue() == null || arrnVPair2[n7].getValue().equalsIgnoreCase(\"true\"))) {\n bl2 = true;\n }\n if ((bl2 || n16 != -1) && roRequest.getStream() == null) {\n if (n16 == -1) {\n object2 = Util.resizeArray(arrnVPair, arrnVPair.length + 1);\n n16 = arrnVPair.length;\n } else {\n object2 = arrnVPair;\n }\n object2[n16] = new NVPair(\"digest\", DefaultAuthHandler.calc_digest(roRequest, arrstring[0], arrnVPair[n12].getValue()));\n if (n17 == -1) {\n n17 = ((NVPair[])object2).length;\n object2 = Util.resizeArray((NVPair[])object2, ((Object)object2).length + 1);\n object2[n17] = new NVPair(\"digest-required\", \"true\");\n }\n object = new AuthorizationInfo(authorizationInfo.getHost(), authorizationInfo.getPort(), authorizationInfo.getScheme(), authorizationInfo.getRealm(), (NVPair[])object2, arrstring);\n } else {\n object = bl2 ? null : new AuthorizationInfo(authorizationInfo.getHost(), authorizationInfo.getPort(), authorizationInfo.getScheme(), authorizationInfo.getRealm(), arrnVPair, arrstring);\n }\n if (n2 != -1) {\n object2 = null;\n try {\n object2 = new URI(roRequest.getConnection().getProtocol(), roRequest.getConnection().getHost(), roRequest.getConnection().getPort(), roRequest.getRequestURI());\n }\n catch (ParseException parseException) {\n // empty catch block\n }\n StringTokenizer stringTokenizer = new StringTokenizer(arrnVPair2[n2].getValue());\n while (stringTokenizer.hasMoreTokens()) {\n URI uRI;\n try {\n uRI = new URI((URI)object2, stringTokenizer.nextToken());\n }\n catch (ParseException parseException) {\n continue;\n }\n AuthorizationInfo authorizationInfo3 = AuthorizationInfo.getAuthorization(uRI.getHost(), uRI.getPort(), authorizationInfo.getScheme(), authorizationInfo.getRealm(), roRequest.getConnection().getContext());\n if (authorizationInfo3 == null) {\n arrnVPair[n] = new NVPair(\"uri\", uRI.getPath());\n authorizationInfo3 = new AuthorizationInfo(uRI.getHost(), uRI.getPort(), authorizationInfo.getScheme(), authorizationInfo.getRealm(), arrnVPair, arrstring);\n AuthorizationInfo.addAuthorization(authorizationInfo3);\n }\n if (bl) continue;\n authorizationInfo3.addPath(uRI.getPath());\n }\n } else if (!bl && authorizationInfo2 != null && (object2 = AuthorizationInfo.getAuthorization(authorizationInfo2.getHost(), authorizationInfo2.getPort(), authorizationInfo.getScheme(), authorizationInfo.getRealm(), roRequest.getConnection().getContext())) != null) {\n ((AuthorizationInfo)object2).addPath(\"/\");\n }\n return object;\n }", "public interface AuthService {\n @Multipart\n @POST(\"login\")\n Call<AuthResponse> getAuthFromLogin(@Part(\"email\") String email, @Part(\"password\") String password);\n @Multipart\n @POST(\"dev/register\")\n Call<AuthResponse> getAuthFromRegistration(@Part(\"email\") String email, @Part(\"password\") String password, @Part(\"nickname\") String nickname);\n}", "public void Transaction_Phase_Two_Remainder() {\n executeController.execute(\n new Thread(() -> {\n try {\n System.out.println(\"Sending remainder to participant\");\n writer.println(\"REMAINDER: Participant is required to send DONE\");\n reader.readLine();\n sent_done = true;\n } catch (IOException ignored) {\n }\n }),\n TIMEOUT_PERIOD,\n 2, this\n );\n }", "public static void example2(ApiEndpoint apiEndpoint, String email, String password) {\n System.out.println(\"--- EXAMPLE 2 ---\");\n try {\n HashMap<String, String> params = new HashMap<>();\n\n System.out.print(\"Retrieving authToken...\");\n AuthToken authToken = AuthService.getAuthToken(apiEndpoint, email, password);\n System.out.println(\"Done!\");\n\n System.out.print(\"Retrieving Vehicle List...\");\n // Uncomment following line, if you want to include the vehicles the user has been granted read rights to.\n //params.put(\"includeAccessGrantVehicles\", \"true\");\n ActionResponse vResp = AuthService.runAction(apiEndpoint, authToken, \"v1/vehicle\", ActionTypes.GET, params, null);\n System.out.println(\"Done!\");\n System.out.println(\"Response \"+vResp.httpCode+\": \"+vResp.jsonArray.toJSONString());\n\n System.out.print(\"Retrieving first vehicle(including all vehicle states) from previous response...\");\n JSONObject firstV = (JSONObject)(vResp.jsonArray.get(0));\n params.clear();\n // we are settings all 'with*' to true here in order to retrieve all vehicle information and not just basic meta data\n params.put(\"withBase\", \"true\");\n params.put(\"withRemoteFunctionsState\", \"true\");\n params.put(\"withLockState\", \"true\");\n params.put(\"withClimaState\", \"true\");\n params.put(\"withDrivingState\", \"true\");\n params.put(\"withGeoState\", \"true\");\n params.put(\"withBatteryState\", \"true\");\n params.put(\"includeAccessGrantVehicles\", \"true\");\n ActionResponse singlevResp = AuthService.runAction(apiEndpoint, authToken, \"v1/vehicle/\"+firstV.get(\"id\"), ActionTypes.GET, params, null);\n System.out.println(\"Done!\");\n System.out.println(\"Response \"+singlevResp.httpCode+\": \"+singlevResp.jsonObject.toJSONString());\n\n // Print out SoC\n JSONObject baseState = (JSONObject)(singlevResp.jsonObject.get(\"base\"));\n if(baseState != null) {\n System.out.println(\"Vehicle SoC: \" + baseState.get(\"soc\"));\n }\n\n } catch (RcmsClientException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n System.out.println(\"--- END OF EXAMPLE 2 ---\");\n }", "protected void testAuthnResponseProcessingScenario1(final Resource resourceMessage) throws Exception {\n\t\t// POST binding\n\t\tthis.testAuthnResponseProcessingScenario1(SamlBindingEnum.SAML_20_HTTP_POST, \"/cas/Shibboleth.sso/SAML2/POST\",\n\t\t\t\tresourceMessage);\n\t\t// Redirect binding\n\t\tthis.testAuthnResponseProcessingScenario1(SamlBindingEnum.SAML_20_HTTP_REDIRECT,\n\t\t\t\t\"/cas/Shibboleth.sso/SAML2/Redirect\", resourceMessage);\n\t}", "private void hanleOkData(String[] messageParts) {\r\n\t\tswitch (messageParts.length) {\r\n\t\tcase 4:\r\n\r\n\t\t\t// Processing Public messages\r\n\t\t\tprocessPublicMessages(messageParts);\r\n\r\n\t\tcase 3:\r\n\r\n\t\t\t// Processing Private messages\r\n\t\t\tprocessMessages(messageParts);\r\n\r\n\t\tcase 2:\r\n\r\n\t\t\t// Processing online users\r\n\t\t\tprocessUsers(messageParts);\r\n\r\n\t\t}\t\t\t\t\r\n\t}", "private void getAUTH_REQUEST() throws Exception {\n\t\t\n\t\tboolean status = true;\n\t\tboolean status2 = false;\n\t\tString msg = \"\";\n\t\t\n\t\t//File filePK = new File(\"identity\");\n\t\n\t\ttry {\n\t\t\t\n\t\t\tmsg = br.readLine();\n\t\t\tGetTimestamp(\"Received Authorization Request from Client: \" + msg);\n\t\t\t\n\t\t\tJSONObject REQUEST = (JSONObject) parser.parse(msg);\n\t String identity = REQUEST.get(\"identity\").toString();\n\t\t\t\n\t\t\t\n\t if((identity.contains(\"aaron@krusty\"))) {\n\n\t \tGetTimestamp(\"Authorization Request from Client is approved: \");\n\n\t \tGetTimestamp(\"Client Publickey is stored: \" ) ;\n\n\t \tString tosend = encrypt1(getSharedKey(), getClientPublicKey());\n\n\t \tGetTimestamp(\"Server sharedkey is being encrypted with Client's publickey to be sent: \") ;\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"AES128\", tosend);\n\t \tRESPONSE.put(\"status\", status);\n\t \tRESPONSE.put(\"message\", \"public key found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tGetTimestamp(\"Sending Authorization Response to Client: \");\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\n\n\t }\n\t else {\n\n\t \tSystem.out.println(\"Client \" + REQUEST.get(\"identity\") + \" has been rejected\");\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"status\", status2);\n\t \tRESPONSE.put(\"message\", \"public key not found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\t \tcloseConnection();\n\t }\n\t\t\t\t\n\t\t\t\n\t\t} catch (IOException ex) {\n\t\t\tLogger.getLogger(ServerTCP.class.getName()).log(Level.SEVERE, null, ex);\n\t\t}\n\t\tif (msg.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"Client has signed out!\");\n\t\t\tcloseConnection();\n\n\t\t} else {\t\n\t\t\tgetMessage();\n\t\t}\n\t}", "@Test\n public void testSuccessfulMultipleParByMultipleClients() throws Exception {\n // create client dynamically\n String clientId = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.FALSE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation oidcCRep = getClientDynamically(clientId);\n String clientSecret = oidcCRep.getClientSecret();\n assertEquals(Boolean.FALSE, oidcCRep.getRequirePushedAuthorizationRequests());\n assertTrue(oidcCRep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, oidcCRep.getTokenEndpointAuthMethod());\n\n authManageClients(); // call it when several clients are created consecutively.\n\n String client2Id = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.TRUE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation oidcC2Rep = getClientDynamically(client2Id);\n String client2Secret = oidcC2Rep.getClientSecret();\n assertEquals(Boolean.TRUE, oidcC2Rep.getRequirePushedAuthorizationRequests());\n assertTrue(oidcC2Rep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, oidcC2Rep.getTokenEndpointAuthMethod());\n\n // Pushed Authorization Request #1\n oauth.clientId(clientId);\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n ParResponse pResp = oauth.doPushedAuthorizationRequest(clientId, clientSecret);\n assertEquals(201, pResp.getStatusCode());\n String requestUriOne = pResp.getRequestUri();\n\n // Pushed Authorization Request #2\n oauth.clientId(client2Id);\n oauth.scope(\"microprofile-jwt\" + \" \" + \"profile\");\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n pResp = oauth.doPushedAuthorizationRequest(client2Id, client2Secret);\n assertEquals(201, pResp.getStatusCode());\n String requestUriTwo = pResp.getRequestUri();\n\n // Authorization Request with request_uri of PAR #2\n // remove parameters as query strings of uri\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUriTwo);\n String state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n OAuthClient.AuthorizationEndpointResponse loginResponse = oauth.doLogin(TEST_USER2_NAME, TEST_USER2_PASSWORD);\n assertEquals(state, loginResponse.getState());\n String code = loginResponse.getCode();\n String sessionId =loginResponse.getSessionState();\n\n // Token Request #2\n oauth.redirectUri(CLIENT_REDIRECT_URI); // get tokens, it needed. https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3\n OAuthClient.AccessTokenResponse res = oauth.doAccessTokenRequest(code, client2Secret);\n assertEquals(200, res.getStatusCode());\n\n AccessToken token = oauth.verifyToken(res.getAccessToken());\n String userId = findUserByUsername(adminClient.realm(REALM_NAME), TEST_USER2_NAME).getId();\n assertEquals(userId, token.getSubject());\n assertEquals(sessionId, token.getSessionState());\n // The following check is not valid anymore since file store does have the same ID, and is redundant due to the previous line\n // Assert.assertNotEquals(TEST_USER_NAME, token.getSubject());\n assertEquals(client2Id, token.getIssuedFor());\n assertTrue(token.getScope().contains(\"openid\"));\n assertTrue(token.getScope().contains(\"microprofile-jwt\"));\n assertTrue(token.getScope().contains(\"profile\"));\n\n // Logout\n oauth.doLogout(res.getRefreshToken(), client2Secret); // same oauth instance is used so that this logout is needed to send authz request consecutively.\n\n // Authorization Request with request_uri of PAR #1\n // remove parameters as query strings of uri\n oauth.clientId(clientId);\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUriOne);\n state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n loginResponse = oauth.doLogin(TEST_USER_NAME, TEST_USER_PASSWORD);\n assertEquals(state, loginResponse.getState());\n code = loginResponse.getCode();\n sessionId =loginResponse.getSessionState();\n\n // Token Request #1\n oauth.redirectUri(CLIENT_REDIRECT_URI); // get tokens, it needed. https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3\n res = oauth.doAccessTokenRequest(code, clientSecret);\n assertEquals(200, res.getStatusCode());\n\n token = oauth.verifyToken(res.getAccessToken());\n userId = findUserByUsername(adminClient.realm(REALM_NAME), TEST_USER_NAME).getId();\n assertEquals(userId, token.getSubject());\n assertEquals(sessionId, token.getSessionState());\n // The following check is not valid anymore since file store does have the same ID, and is redundant due to the previous line\n // Assert.assertNotEquals(TEST_USER_NAME, token.getSubject());\n assertEquals(clientId, token.getIssuedFor());\n assertFalse(token.getScope().contains(\"microprofile-jwt\"));\n assertTrue(token.getScope().contains(\"openid\"));\n }", "protected void testAuthnResponseProcessingScenario1(final SamlBindingEnum binding, final String endpointUri,\n\t\t\tfinal Resource resourceMessage) throws Exception {\n\n\t\tfinal Response openSamlAuthnResponse = (Response) SamlTestResourcesHelper\n\t\t\t\t.buildOpenSamlXmlObjectFromResource(resourceMessage);\n\t\tfinal HttpServletRequest mockHttpRequest = this.managePostMessage(binding, endpointUri, resourceMessage);\n\n\t\tthis.processor.initialize(this.factory, openSamlAuthnResponse, mockHttpRequest, this.spProcessor);\n\n\t\tfinal IIncomingSaml incomingSaml = this.processor.processIncomingSamlMessage();\n\n\t\tAssert.assertNotNull(\"Incoming SAML is null !\", incomingSaml);\n\n\t\tfinal IQuery samlQuery = incomingSaml.getSamlQuery();\n\t\tAssert.assertNotNull(\"SAML query !\", samlQuery);\n\t\tAssert.assertEquals(\"Wrong type for SAML query !\", QueryAuthnResponse.class, samlQuery.getClass());\n\n\t\tfinal QueryAuthnResponse authnQuery = (QueryAuthnResponse) samlQuery;\n\n\t\tfinal List<IAuthentication> samlAuthns = authnQuery.getSamlAuthentications();\n\t\tAssert.assertNotNull(\"List of Authentications is null !\", samlAuthns);\n\t\tAssert.assertEquals(\"Number of authentications in response is bad !\", 1, samlAuthns.size());\n\n\t\tfinal List<String> samlAttributeValues = samlAuthns.iterator().next()\n\t\t\t\t.getAttribute(AuthnResponseQueryProcessorTest.SAML_ATTRIBUTE_KEY_SCENARIO_1);\n\t\tAssert.assertEquals(\"SAML attributes list size is incorrect !\", 1, samlAttributeValues.size());\n\t\tAssert.assertEquals(\"SAML attribute value is incorrect !\",\n\t\t\t\tAuthnResponseQueryProcessorTest.SAML_ATTRIBUTE_VALUE_SCENARIO_1, samlAttributeValues.iterator().next());\n\t}", "public void Getbookingscall(String s1,String s2)\r\n\t{\r\n\t\tkeytype = s1;\r\n\t\t\r\n\t\tSystem.out.println(\"keytype:\"+s1);\r\n\t\t\r\n\t\tresstatus = s2;\r\n\t\tSystem.out.println(\"resstatus:\"+s2);\r\n\t\t\r\n\t\tif(keytype == \"wsauth\")\r\n\t\t{\r\n\t\t\tWsauth objwsauth = new Wsauth();\r\n\t\t\tobjwsauth.Wsauthcall();\r\n\t\t\tString keyw = objwsauth.extractingWsauthKey();\r\n\t\t\taccesskey = keyw;\r\n\t\t\tSystem.out.println(\"hello if\"+ accesskey);\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\telse if(keytype == \"login\")\r\n\t\t{\r\n\t\t\t/*Login objlogin = new Login();\r\n\t\t\tobjlogin.Logincall();\r\n\t\t\tString keyl = objlogin.extractingLoginKey();\r\n\t\t\tSystem.out.println(\"login key in gethousestatus:\"+keyl);\r\n\t\t\taccesskey = keyl;*/\r\n\t\t\t\r\n\t\t\tString keyl = Login.finalloginaccesskey;\r\n\t\t\tSystem.out.println(\"login key in getbookings:\"+keyl);\r\n\t\t\taccesskey = keyl;\r\n\t\t}\r\n\t\t\r\n\t\ttry\r\n\t\t{\r\n\t\t\tserverurl = CommonConfig.serverurl;\r\n\t\t\tnightauditdate1 = CommonConfig.nightauditdate1;\r\n\t\t\t\r\n\t\t\tHttpResponse<JsonNode> responsegetbookings = Unirest.post(\"\"+serverurl+\"/ws/web/getbookings\")\r\n\t\t\t\t\t .header(\"content-type\", \"application/json\")\r\n\t\t\t\t\t .header(\"x-ig-sg\", \"D_gg%fkl85_j\")\r\n\t\t\t\t\t .header(\"cache-control\", \"no-cache\")\r\n\t\t\t\t\t .header(\"postman-token\", \"442ccdd8-438b-68ed-d7c1-0aaed145ef9b\")\r\n\t\t\t\t\t .body(\"{\\r\\n \\\"hotelogix\\\": {\\r\\n \\\"version\\\": \\\"1.0\\\",\\r\\n \\\"datetime\\\": \\\"2012-01-16T10:10:15\\\",\\r\\n \\\"request\\\": {\\r\\n \\\"method\\\": \\\"getbookings\\\",\\r\\n \\\"key\\\": \\\"\"+accesskey+\"\\\",\\r\\n \\\"data\\\": {\\r\\n \\\"fromDate\\\": \\\"\"+nightauditdate1+\"\\\",\\r\\n \\\"toDate\\\": \\\"\"+nightauditdate1+\"\\\",\\r\\n \\\"searchBy\\\": \\\"STAYDATE\\\",\\r\\n \\\"reservationStatus\\\":[\\\"\"+resstatus+\"\\\"]\\r\\n }\\r\\n }\\r\\n }\\r\\n }\")\r\n\t\t\t\t\t .asJson();\r\n\t\t\tJsonNode body = responsegetbookings.getBody();\r\n\t\t\tresponseJSONString = body.toString();\r\n\t\t\tSystem.out.println(responseJSONString);\r\n\t\t}\r\n\t\tcatch(UnirestException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t}", "public byte[] unwrap(byte[] incoming, int start, int len) throws SaslException {\n if (len == 0) {\n return EMPTY_BYTE_ARRAY;\n }\n byte[] mac = new byte[10];\n byte[] msg = new byte[len - 16];\n byte[] msgType = new byte[2];\n byte[] seqNum = new byte[4];\n System.arraycopy(incoming, start, msg, 0, msg.length);\n System.arraycopy(incoming, start + msg.length, mac, 0, 10);\n System.arraycopy(incoming, start + msg.length + 10, msgType, 0, 2);\n System.arraycopy(incoming, start + msg.length + 12, seqNum, 0, 4);\n byte[] expectedMac = getHMAC(peerKi, seqNum, msg, 0, msg.length);\n if (logger.isLoggable(Level.FINEST)) {\n traceOutput(DI_CLASS_NAME, \"unwrap\", \"DIGEST18:incoming: \", msg);\n traceOutput(DI_CLASS_NAME, \"unwrap\", \"DIGEST19:MAC: \", mac);\n traceOutput(DI_CLASS_NAME, \"unwrap\", \"DIGEST20:messageType: \", msgType);\n traceOutput(DI_CLASS_NAME, \"unwrap\", \"DIGEST21:sequenceNum: \", seqNum);\n traceOutput(DI_CLASS_NAME, \"unwrap\", \"DIGEST22:expectedMAC: \", expectedMac);\n }\n if (!Arrays.equals(mac, expectedMac)) {\n logger.log(Level.INFO, \"DIGEST23:Unmatched MACs\");\n return EMPTY_BYTE_ARRAY;\n }\n if (peerSeqNum != networkByteOrderToInt(seqNum, 0, 4)) {\n throw new SaslException(\"DIGEST-MD5: Out of order \" + \"sequencing of messages from server. Got: \" + networkByteOrderToInt(seqNum, 0, 4) + \" Expected: \" + peerSeqNum);\n }\n if (!Arrays.equals(messageType, msgType)) {\n throw new SaslException(\"DIGEST-MD5: invalid message type: \" + networkByteOrderToInt(msgType, 0, 2));\n }\n peerSeqNum++;\n return msg;\n }", "public void receiveResultsub2(\n loadbalance.LoadBalanceStub.Sub2Response result\n ) {\n }", "private ResponseEntity<?> onPost(RequestEntity<String> requestEntity)\n throws IOException, ExecutionException, InterruptedException, InvalidKeyException,\n BadPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException,\n NoSuchPaddingException, ShortBufferException, InvalidKeySpecException,\n InvalidAlgorithmParameterException, NoSuchProviderException {\n\n getLogger().info(requestEntity.toString());\n\n final String authorization = requestEntity.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);\n final UUID sessionId;\n final To2DeviceSessionInfo session;\n final AuthToken authToken;\n\n try {\n authToken = new AuthToken(authorization);\n sessionId = authToken.getUuid();\n session = getSessionStorage().load(sessionId);\n\n } catch (IllegalArgumentException | NoSuchElementException e) {\n return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();\n }\n\n // if any instance is corrupted/absent, the session data is unavailable, so terminate the\n // connection.\n if (null != session && (!(session.getMessage41Store() instanceof Message41Store)\n || (null == session.getMessage41Store())\n || !(session.getMessage45Store() instanceof Message45Store)\n || (null == session.getMessage45Store())\n || !(session.getDeviceCryptoInfo() instanceof DeviceCryptoInfo)\n || null == session.getDeviceCryptoInfo())) {\n return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();\n }\n\n final String requestBody = null != requestEntity.getBody() ? requestEntity.getBody() : \"\";\n\n final ByteBuffer xb =\n new KexParamCodec().decoder().apply(CharBuffer.wrap(session.getMessage45Store().getXb()));\n final To2CipherContext cipherContext =\n new To2CipherContextFactory(getKeyExchangeDecoder(), getSecureRandom())\n .build(session.getMessage41Store(), xb.duplicate());\n\n final EncryptedMessageCodec encryptedMessageCodec = new EncryptedMessageCodec();\n final EncryptedMessage deviceEncryptedMessage =\n encryptedMessageCodec.decoder().apply(CharBuffer.wrap(requestBody));\n final ByteBuffer decryptedBytes = cipherContext.read(deviceEncryptedMessage);\n final CharBuffer decryptedText = US_ASCII.decode(decryptedBytes);\n getLogger().info(decryptedText.toString());\n\n final To2NextDeviceServiceInfo nextDeviceServiceInfo =\n new To2NextDeviceServiceInfoCodec().decoder().apply(decryptedText);\n\n final OwnershipProxy proxy = new OwnershipProxyCodec.OwnershipProxyDecoder()\n .decode(CharBuffer.wrap(session.getMessage41Store().getOwnershipProxy()));\n if (null == proxy) {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"OwnershipVoucher must not be null\"));\n }\n\n for (Object serviceInfoObject : getServiceInfoModules()) {\n\n if (serviceInfoObject instanceof ServiceInfoSink) {\n final ServiceInfoSink sink = (ServiceInfoSink) serviceInfoObject;\n\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n sink.putServiceInfo(entry);\n }\n\n } else if (serviceInfoObject instanceof ServiceInfoMultiSink) {\n final ServiceInfoMultiSink sink = (ServiceInfoMultiSink) serviceInfoObject;\n final ServiceInfo serviceInfos = new ServiceInfo();\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n serviceInfos.add(entry);\n }\n sink.putServiceInfo(proxy.getOh().getG(), serviceInfos);\n\n }\n }\n\n String responseBody;\n final OwnershipProxy newProxy;\n int nn = nextDeviceServiceInfo.getNn() + 1;\n if (nn < session.getMessage45Store().getNn()) {\n final StringWriter writer = new StringWriter();\n final To2GetNextDeviceServiceInfo getNextDeviceServiceInfo =\n new To2GetNextDeviceServiceInfo(nn, new PreServiceInfo());\n new To2GetNextDeviceServiceInfoCodec().encoder().apply(writer, getNextDeviceServiceInfo);\n newProxy = null;\n responseBody = writer.toString();\n\n } else {\n\n final OwnershipProxy currentProxy = proxy;\n final Setup devSetup =\n setupDeviceService.setup(currentProxy.getOh().getG(), currentProxy.getOh().getR());\n final To2SetupDeviceNoh setupDeviceNoh = new To2SetupDeviceNoh(devSetup.r3(), devSetup.g3(),\n new Nonce(CharBuffer.wrap(session.getMessage45Store().getN7())));\n\n final StringWriter bo = new StringWriter();\n new To2SetupDeviceNohCodec().encoder().apply(bo, setupDeviceNoh);\n\n final SignatureBlock noh =\n signatureServiceFactory.build(proxy.getOh().getG()).sign(bo.toString()).get();\n\n final OwnerServiceInfoHandler ownerServiceInfoHandler =\n new OwnerServiceInfoHandler(getServiceInfoModules(), proxy.getOh().getG());\n final int osinn = ownerServiceInfoHandler.getOwnerServiceInfoEntryCount();\n\n final To2SetupDevice setupDevice = new To2SetupDevice(osinn, noh);\n final StringWriter writer = new StringWriter();\n final PublicKeyCodec.Encoder pkEncoder =\n new PublicKeyCodec.Encoder(currentProxy.getOh().getPe());\n final SignatureBlockCodec.Encoder sgEncoder = new SignatureBlockCodec.Encoder(pkEncoder);\n new To2SetupDeviceCodec.Encoder(sgEncoder).encode(writer, setupDevice);\n responseBody = writer.toString();\n\n final OwnershipProxyHeader currentOh = currentProxy.getOh();\n final OwnershipProxyHeader newOh = new OwnershipProxyHeader(currentOh.getPe(), devSetup.r3(),\n devSetup.g3(), currentOh.getD(), noh.getPk(), currentOh.getHdc());\n newProxy = new OwnershipProxy(newOh, new HashMac(MacType.NONE, ByteBuffer.allocate(0)),\n currentProxy.getDc(), new LinkedList<>());\n }\n getLogger().info(responseBody);\n\n // if the CTR nonce is null, it means that the session's IV has been lost/corrupted. For CBC, it\n // should have been all 0s, while for CTR, it should contain the current nonce.\n if (null != session.getDeviceCryptoInfo().getCtrNonce()) {\n final ByteBuffer nonce = new ByteArrayCodec().decoder()\n .apply(CharBuffer.wrap(session.getDeviceCryptoInfo().getCtrNonce()));\n cipherContext.setCtrNonce(nonce.array());\n cipherContext.setCtrCounter(session.getDeviceCryptoInfo().getCtrCounter());\n } else {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"no cipher initialization vector found\"));\n }\n final ByteBuffer responseBodyBuf = US_ASCII.encode(responseBody);\n final EncryptedMessage ownerEncryptedMessage = cipherContext.write(responseBodyBuf);\n\n final StringWriter writer = new StringWriter();\n encryptedMessageCodec.encoder().apply(writer, ownerEncryptedMessage);\n responseBody = writer.toString();\n\n final StringWriter opWriter = new StringWriter();\n if (null != newProxy) {\n new OwnershipProxyCodec.OwnershipProxyEncoder().encode(opWriter, newProxy);\n }\n final StringWriter ctrNonceWriter = new StringWriter();\n new ByteArrayCodec().encoder().apply(ctrNonceWriter,\n ByteBuffer.wrap(cipherContext.getCtrNonce()));\n\n final DeviceCryptoInfo deviceCryptoInfo =\n new DeviceCryptoInfo(ctrNonceWriter.toString(), cipherContext.getCtrCounter());\n final Message47Store message47Store = new Message47Store(opWriter.toString());\n final To2DeviceSessionInfo to2DeviceSessionInfo = new To2DeviceSessionInfo();\n to2DeviceSessionInfo.setMessage47Store(message47Store);\n to2DeviceSessionInfo.setDeviceCryptoInfo(deviceCryptoInfo);\n getSessionStorage().store(sessionId, to2DeviceSessionInfo);\n\n ResponseEntity<?> responseEntity =\n ResponseEntity.ok().header(HttpHeaders.AUTHORIZATION, authorization)\n .contentType(MediaType.APPLICATION_JSON).body(responseBody);\n\n getLogger().info(responseEntity.toString());\n return responseEntity;\n }", "@Test(expected = SamlProcessingException.class)\n\tpublic void testAuthnResponseAttacked2() throws Exception {\n\t\tthis.testAuthnResponseProcessingScenario1(this.responseAttacked2);\n\t}", "private byte[] sendServer(byte[] message, boolean partTwo) { \n\t\tComMethods.report(accountName+\" sending message to SecretServer now...\", simMode);\n\t\tbyte[] response = server.getMessage(message, partTwo);\n\t\tComMethods.report(accountName+\" has received SecretServer's response.\", simMode);\n\t\treturn response; \n\t}", "protected abstract RS deserializeTokenResponse(String body) throws JsonDeserializationException, OAuthException;", "@Test\n public void shouldGiveTwoElementsWithOneColonString() {\n String decodeString = \"Q3Jhc2ggT3ZlcnJpZGU6SSBsb3ZlIEFjaWQgQnVybg==\";\n assertThat(\"Two elements is present\", BasicAuth.decode(decodeString), is(arrayWithSize(2)));\n assertThat(\"Username is contained\", BasicAuth.decode(decodeString), is(hasItemInArray(\"Crash Override\")));\n assertThat(\"Password is contained\", BasicAuth.decode(decodeString), is(hasItemInArray(\"I love Acid Burn\")));\n assertThat(\"Username is first\", BasicAuth.decode(decodeString)[0], is(\"Crash Override\"));\n assertThat(\"Password is last\", BasicAuth.decode(decodeString)[1], is(\"I love Acid Burn\"));\n }", "@POST\n\t@Path(\"/routingComplete\")\n\tpublic Response getB2bAfterRoutingComplete(EFmFmEmployeeTravelRequestPO travelRequestPO) throws ParseException{\t\t\n\t\tIUserMasterBO userMasterBO = (IUserMasterBO) ContextLoader.getContext().getBean(\"IUserMasterBO\");\n\t\tMap<String, Object> responce = new HashMap<String, Object>();\n\t\t\n\t\t \t\t\n\t\t log.info(\"Logged In User IP Adress\"+token.getClientIpAddr(httpRequest));\n\t\t try{\n\t\t \tif(!(userMasterBO.checkTokenValidOrNot(httpRequest.getHeader(\"authenticationToken\"),travelRequestPO.getUserId()))){\n\n\t\t \t\tresponce.put(\"status\", \"invalidRequest\");\n\t\t \t\treturn Response.ok(responce, MediaType.APPLICATION_JSON).build();\n\t\t \t}}catch(Exception e){\n\t\t \t\tlog.info(\"authentication error\"+e);\n\t\t\t\tresponce.put(\"status\", \"invalidRequest\");\n\t\t\t\treturn Response.ok(responce, MediaType.APPLICATION_JSON).build();\n\n\t\t \t}\n\t\t \n\t\t List<EFmFmUserMasterPO> userDetailToken = userMasterBO.getUserDetailFromUserId(travelRequestPO.getUserId());\n\t\t if (!(userDetailToken.isEmpty())) {\n\t\t String jwtToken = \"\";\n\t\t try {\n\t\t JwtTokenGenerator token = new JwtTokenGenerator();\n\t\t jwtToken = token.generateToken();\n\t\t userDetailToken.get(0).setAuthorizationToken(jwtToken);\n\t\t userDetailToken.get(0).setTokenGenerationTime(new Date());\n\t\t userMasterBO.update(userDetailToken.get(0));\n\t\t } catch (Exception e) {\n\t\t log.info(\"error\" + e);\n\t\t }\n\t\t }\n\n ICabRequestBO iCabRequestBO = (ICabRequestBO) ContextLoader.getContext().getBean(\"ICabRequestBO\");\n IAssignRouteBO iAssignRouteBO = (IAssignRouteBO) ContextLoader.getContext().getBean(\"IAssignRouteBO\");\n log.info(\"serviceStart -UserId :\" + travelRequestPO.getUserId());\n DateFormat shiftTimeFormat = new SimpleDateFormat(\"HH:mm:ss\");\n SimpleDateFormat dateformate = new SimpleDateFormat(\"dd-MM-yyyy\");\n DateFormat shiftTimeFormate = new SimpleDateFormat(\"HH:mm\");\n String shiftTime = travelRequestPO.getTime();\n Date shift = shiftTimeFormate.parse(shiftTime);\n java.sql.Time dateShiftTime = new java.sql.Time(shift.getTime());\n Date excutionDate = dateformate.parse(travelRequestPO.getExecutionDate());\n\t\tCalculateDistance calculateDistance = new CalculateDistance();\n List<EFmFmAssignRoutePO> activeRoutes = iAssignRouteBO.getAllRoutesForPrintForParticularShift(excutionDate, excutionDate,\n travelRequestPO.getTripType(), shiftTimeFormat.format(dateShiftTime), travelRequestPO.getCombinedFacility());\n log.info(\"Shift Size\"+activeRoutes.size());\n if (!(activeRoutes.isEmpty())) { \t\n \tfor(EFmFmAssignRoutePO assignRoute:activeRoutes){\n \t\ttry{\n\t\t\t\tList<EFmFmEmployeeTripDetailPO> employeeTripDetailPO = null;\n \t\t\t\tStringBuffer empWayPoints = new StringBuffer();\n \t\t\t\tif (assignRoute.getTripType().equalsIgnoreCase(\"PICKUP\")) {\n\t\t\t\t\temployeeTripDetailPO = iCabRequestBO.getParticularTripAllEmployees(assignRoute.getAssignRouteId());\n\t\t\t\t} else {\n\t\t\t\t\temployeeTripDetailPO = iCabRequestBO.getDropTripAllSortedEmployees(assignRoute.getAssignRouteId());\n\t\t\t\t}\n\n \t\t\t\tif (!(employeeTripDetailPO.isEmpty())) {\n\t\t\t\t\tfor (EFmFmEmployeeTripDetailPO employeeTripDetail : employeeTripDetailPO) {\n\t\t\t \tempWayPoints.append(employeeTripDetail.geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude()+\"|\"); \n\t\t\t\t\t}\n \t\t\t\t} \n \t\t\t\tString plannedETAAndDistance =\"\";\n \t\t\t\tif (assignRoute.getTripType().equalsIgnoreCase(\"PICKUP\")) {\n \t\t\t\t\tplannedETAAndDistance= calculateDistance.getPlannedDistanceaAndETAForRoute(\n \t \t\t\t\tassignRoute.geteFmFmClientBranchPO().getLatitudeLongitude(),\n \t \t\t\t\tassignRoute.geteFmFmClientBranchPO().getLatitudeLongitude(), empWayPoints.toString().replaceAll(\"\\\\s+\",\"\"));\t\t \t\t\n \t\t\t\t}\n\n \t\t\t\telse{\n \t\t\t\t\tplannedETAAndDistance= calculateDistance.getPlannedDistanceaAndETAForRoute(\n \t \t\t\t\tassignRoute.geteFmFmClientBranchPO().getLatitudeLongitude(),\n \t \t\t\t\temployeeTripDetailPO.get(employeeTripDetailPO.size()-1).geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude(), empWayPoints.toString().replaceAll(\"\\\\s+\",\"\"));\t\t \t\t\t\n \t\t\t\t}\n \t\t\t\t\n \t\tlog.info(\"plannedETAAndDistance\"+plannedETAAndDistance+\" \"+empWayPoints.toString().replaceAll(\"\\\\s+\",\"\")+\"assignRoute Id\"+assignRoute.getAssignRouteId());\n try{\n \t\tassignRoute.setPlannedTravelledDistance(Math.round(Double.parseDouble(plannedETAAndDistance.split(\"-\")[0])+(assignRoute.geteFmFmClientBranchPO().getAddingGeoFenceDistanceIntrip())));\n assignRoute.setPlannedDistance(Math.round(Double.parseDouble(plannedETAAndDistance.split(\"-\")[0])+(assignRoute.geteFmFmClientBranchPO().getAddingGeoFenceDistanceIntrip())));\n assignRoute.setPlannedTime(Math.round(Long.parseLong(plannedETAAndDistance.split(\"-\")[1])));\t\t\n }catch(Exception e){\n \tlog.info(\"plannedETAAndDistance\"+plannedETAAndDistance+\" \"+empWayPoints.toString().replaceAll(\"\\\\s+\",\"\")+\"assignRoute Id\"+assignRoute.getAssignRouteId());\n log.info(\"Error\"+e);\n \n }\n assignRoute.setPlannedReadFlg(\"N\");\t\n assignRoute.setRoutingCompletionStatus(\"completed\");\n assignRoute.setScheduleReadFlg(\"Y\"); \n \t\t\t\tif (assignRoute.getTripType().equalsIgnoreCase(\"DROP\")) {\n \t\t\t\t\ttry{\n \t\t\t\t\t\tif(assignRoute.getIsBackTwoBack().equalsIgnoreCase(\"N\")){\n \t\t\t\t\t\t//Back to back check any pickup is there with this route end drop location. \n \t\t\t\t List<EFmFmAssignRoutePO> b2bPickupDetails=iAssignRouteBO.getBackToBackTripDetailFromTripTypeANdShiftTime(\"PICKUP\", assignRoute.getShiftTime(),assignRoute.getCombinedFacility());\t\t\t\t\t\n \t\t\t\t log.info(\"b2bDetails\"+b2bPickupDetails.size());\n \t\t\t \tif(!(b2bPickupDetails.isEmpty())){\n \t\t\t\t\t\tfor (EFmFmAssignRoutePO assignPickupRoute : b2bPickupDetails) {\n \t \t\t\t\t List<EFmFmAssignRoutePO> b2bPickupDetailsAlreadyDone=iAssignRouteBO.getBackToBackTripDetailFromb2bId(assignPickupRoute.getAssignRouteId(), \"DROP\",assignRoute.getCombinedFacility());\t\t\t\t\n \t\t\t\t\t\t\tif(b2bPickupDetailsAlreadyDone.isEmpty()){\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t//get first pickup employee\n \t\t\t\t \tList<EFmFmEmployeeTripDetailPO> employeeTripData = iCabRequestBO.getParticularTripAllEmployees(assignPickupRoute.getAssignRouteId()); \t\t\t\t \t\n \t\t\t\t \tif(!(employeeTripData.isEmpty())){\n \t\t\t\t\t \tString lastDropLattilongi=employeeTripDetailPO.get(employeeTripDetailPO.size()-1).geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude();\t\t\t\t\t \t \t\n \t\t\t\t\t \tString firstPickupLattilongi=employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude(); \t\n \t\t\t\t\t \tlog.info(\"lastDropLattilongi\"+lastDropLattilongi);\n \t\t\t\t\t \tlog.info(\"firstPickupLattilongi\"+firstPickupLattilongi);\n \t\t\t\t\t \tCalculateDistance empDistance=new CalculateDistance();\n \t\t\t\t\t \tif(assignRoute.geteFmFmClientBranchPO().getSelectedB2bType().equalsIgnoreCase(\"distance\") && (empDistance.employeeDistanceCalculation(lastDropLattilongi, firstPickupLattilongi) < (assignRoute.geteFmFmClientBranchPO().getB2bByTravelDistanceInKM()))){\t\t \t\t\n \t\t\t\t\t \t\t//Current Drop B2B route Assign route Date\n \t\t\t\t\t \t\tString currentDropRouteAssignDate=dateFormat.format(assignRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate currentDropRouteDate=dateFormat.parse(currentDropRouteAssignDate);\n \t\t\t\t\t \t\tlong totalCurrentDropAssignDateAndShiftTime=getDisableTime(assignRoute.getShiftTime().getHours(), assignRoute.getShiftTime().getMinutes(), currentDropRouteDate);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Drop Route Complete Time\n \t\t\t\t\t \t\tlong totalRouteTime=totalCurrentDropAssignDateAndShiftTime+TimeUnit.SECONDS.toMillis(assignRoute.getPlannedTime());\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Total time for Drop back2back trip\n \t\t\t\t\t \t\tlong totalB2bTimeForCuurentDrop=totalRouteTime+(TimeUnit.HOURS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getHours())+TimeUnit.MINUTES.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getMinutes())+TimeUnit.SECONDS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getSeconds()));\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Pickup B2B route Assign route Date\n \t\t\t\t\t \t\tString pickupRouteCurrentAssignDate=dateFormat.format(assignPickupRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate pickupRouteCurrentAssign=dateFormat.parse(pickupRouteCurrentAssignDate);\n \t\t\t\t\t \t\t\t\n \t\t\t\t\t \t\t//Pickup backtoback Route PickUpTime \n \t\t\t\t\t \t\tlong totalAssignDateAndPickUpTime=getDisableTime(employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getHours(),employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getMinutes(), pickupRouteCurrentAssign);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tif((totalRouteTime < totalAssignDateAndPickUpTime) && totalB2bTimeForCuurentDrop > totalAssignDateAndPickUpTime){\t\t \t\t\t\n \t\t\t\t\t \t\t\tassignRoute.setIsBackTwoBack(\"Y\");\n \t\t\t\t\t \t\t\tassignRoute.setBackTwoBackRouteId(assignPickupRoute.getAssignRouteId());\n \t\t\t\t\t \t\t\tiAssignRouteBO.update(assignRoute);\t\t\t\t\t\t\t\n \t\t\t\t\t \t\t\tbreak;\n \t\t\t\t\t \t\t}\n \t\t\t\t\t \t\telse{\n \t\t\t\t\t iAssignRouteBO.update(assignRoute);\n\n \t\t\t\t\t \t\t}\n \t\t\t\t\t \t}\n \t\t\t\t\t \telse if(assignRoute.geteFmFmClientBranchPO().getSelectedB2bType().equalsIgnoreCase(\"time\") && (TimeUnit.SECONDS.toMillis(empDistance.employeeETACalculation(lastDropLattilongi, firstPickupLattilongi)) < (TimeUnit.HOURS.toMillis(assignRoute.geteFmFmClientBranchPO().getB2bByTravelTime().getHours())+TimeUnit.MINUTES.toMillis(assignRoute.geteFmFmClientBranchPO().getB2bByTravelTime().getMinutes())+TimeUnit.SECONDS.toMillis(assignRoute.geteFmFmClientBranchPO().getB2bByTravelTime().getSeconds())))){\t\t \t\t\n \t\t\t\t\t \t\t//Current Drop B2B route Assign route Date\n \t\t\t\t\t \t\tString currentDropRouteAssignDate=dateFormat.format(assignRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate currentDropRouteDate=dateFormat.parse(currentDropRouteAssignDate);\n \t\t\t\t\t \t\tlong totalCurrentDropAssignDateAndShiftTime=getDisableTime(assignRoute.getShiftTime().getHours(),assignRoute.getShiftTime().getMinutes(), currentDropRouteDate);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Drop Route Complete Time\n \t\t\t\t\t \t\tlong totalRouteTime=totalCurrentDropAssignDateAndShiftTime+TimeUnit.SECONDS.toMillis(assignRoute.getPlannedTime());\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Total time for Drop back2back trip\n \t\t\t\t\t \t\tlong totalB2bTimeForCuurentDrop=totalRouteTime+(TimeUnit.HOURS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getHours())+TimeUnit.MINUTES.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getMinutes())+TimeUnit.SECONDS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getSeconds()));\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Pickup B2B route Assign route Date\n \t\t\t\t\t \t\tString pickupRouteCurrentAssignDate=dateFormat.format(assignPickupRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate pickupRouteCurrentAssign=dateFormat.parse(pickupRouteCurrentAssignDate);\n \t\t\t\t\t \t\t\t\n \t\t\t\t\t \t\t//Pickup backtoback Route PickUpTime \n \t\t\t\t\t \t\tlong totalAssignDateAndPickUpTime=getDisableTime(employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getHours(),employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getMinutes(), pickupRouteCurrentAssign);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tlog.info(\"totalRouteTime\"+new Date(totalRouteTime));\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tlog.info(\"totalAssignDateAndPickUpTime\"+new Date(totalAssignDateAndPickUpTime));\n \t\t\t\t\t \t\tlog.info(\"totalB2bTimeForCuurentDrop\"+new Date(totalB2bTimeForCuurentDrop));\n\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tif((totalRouteTime < totalAssignDateAndPickUpTime) && totalB2bTimeForCuurentDrop > totalAssignDateAndPickUpTime){\t\t \t\t\t\n \t\t\t\t\t \t\t\tassignRoute.setIsBackTwoBack(\"Y\");\n \t\t\t\t\t \t\t\tassignRoute.setBackTwoBackRouteId(assignPickupRoute.getAssignRouteId());\n \t\t\t\t\t \t\t\tiAssignRouteBO.update(assignRoute);\t\t\t\t\t\t\t\n \t\t\t\t\t \t\t\tbreak;\n \t\t\t\t\t \t\t}\t\n \t\t\t\t\t \t\telse{\n \t\t\t\t\t iAssignRouteBO.update(assignRoute);\n\n \t\t\t\t\t \t\t}\n \t\t\t\t\t \t}\n \t\t\t\t\t \telse{\n \t\t\t\t\t iAssignRouteBO.update(assignRoute);\n \t\t\t\t\t \t}\n \t\t\t\t \t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\n\t\t\t iAssignRouteBO.update(assignRoute);\n \t\t\t\t\t\t}\n \t\t\t \t\n \t\t\t \telse{\n \t\t\t iAssignRouteBO.update(assignRoute);\n \t\t\t \t}\n \t\t\t \t}\n \t\t\t\t\t\t}catch(Exception e){\n \t\t\t\t\t\t\tlog.info(\"Error\"+e);\n \t\t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\telse{\n \t iAssignRouteBO.update(assignRoute);\n \t\t\t\t}\n \t }catch(Exception e){\n \t\t log.info(\"error - :\" + e);\n assignRoute.setPlannedReadFlg(\"N\");\t\n assignRoute.setRoutingCompletionStatus(\"completed\");\n assignRoute.setScheduleReadFlg(\"Y\"); \n\t iAssignRouteBO.update(assignRoute);\n } \n \n \t} \n \n }\n\t\t log.info(\"serviceEnd -UserId :\" + travelRequestPO.getUserId());\n\t\treturn Response.ok(\"Success\", MediaType.APPLICATION_JSON).build();\n\t\t\n\t}", "private AuthenticatorFlowStatus initiateAuthRequest(HttpServletResponse response, AuthenticationContext context,\n String errorMessage)\n throws AuthenticationFailedException {\n\n // Find the authenticated user.\n AuthenticatedUser authenticatedUser = getUser(context);\n\n if (authenticatedUser == null) {\n throw new AuthenticationFailedException(\"Authentication failed!. \" +\n \"Cannot proceed further without identifying the user\");\n }\n\n String tenantDomain = authenticatedUser.getTenantDomain();\n String username = authenticatedUser.getAuthenticatedSubjectIdentifier();\n String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username);\n\n /*\n In here we do the redirection to the termsAndConditionForm.jsp page.\n If you need to do any api calls and pass any information to the custom page you can do it here and pass\n them as query parameters or else best way is to do the api call using a javascript function within the\n custom page.\n */\n\n try {\n String loginPage = ConfigurationFacade.getInstance().getAuthenticationEndpointURL().\n replace(\"login.do\", \"termsAndConditionForm.jsp\");\n String queryParams = FrameworkUtils.getQueryStringWithFrameworkContextId(context.getQueryParams(),\n context.getCallerSessionKey(), context.getContextIdentifier());\n String retryParam = \"\";\n if (context.isRetrying()) {\n retryParam = \"&authFailure=true\" +\n \"&authFailureMsg=\" + URLEncoder.encode(errorMessage, StandardCharsets.UTF_8.name());\n }\n String fullyQualifiedUsername = UserCoreUtil.addTenantDomainToEntry(tenantAwareUsername,\n tenantDomain);\n String encodedUrl =\n (loginPage + (\"?\" + queryParams\n + \"&username=\" + URLEncoder.encode(fullyQualifiedUsername, StandardCharsets.UTF_8.name())))\n + \"&authenticators=\" + getName() + \":\" + AUTHENTICATOR_TYPE\n + retryParam;\n response.sendRedirect(encodedUrl);\n } catch (IOException e) {\n throw new AuthenticationFailedException(e.getMessage(), e);\n }\n context.setCurrentAuthenticator(getName());\n context.setRetrying(false);\n return AuthenticatorFlowStatus.INCOMPLETE;\n\n }", "private String getTokenV2(TokenRequestBody tokenRequestBody, String tokenEndPoint) throws Exception {\n log.info(\"Entering getTokenV2\");\n String message = null;\n HttpStatus status = null;\n try {\n\n MultiValueMap<String, String> map = new LinkedMultiValueMap<>();\n map.add(GRANT_TYPE, tokenRequestBody.getGrantType());\n map.add(CODE, tokenRequestBody.getCode());\n map.add(CLIENT_ID, tokenRequestBody.getClientId());\n map.add(REDIRECT_URI, tokenRequestBody.getRedirectUri());\n map.add(CLIENT_ASSERTION_TYPE, tokenRequestBody.getClientAssertionType());\n map.add(CLIENT_ASSERTION, tokenRequestBody.getClientAssertion());\n log.info(\"Just created token request map\");\n\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);\n Object loggedHeader = headers.remove(HttpHeaders.AUTHORIZATION);\n\n HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);\n log.info(\"User Token v2>>Carrier endpoint: {}\", tokenEndPoint);\n log.info(\"User Token v2>>Carrier Request: {}\", loggedHeader);\n log.info(\"User Token v2>>Carrier Body: {}\", map);\n log.info(\"User Token v2>>Request: {}\", request);\n log.info(\"tokenEndPoint: {}\", tokenEndPoint);\n\n ResponseEntity<String> response = restTemplate.exchange(tokenEndPoint, HttpMethod.POST, request,\n String.class);\n log.info(\"Just made carrier token endpoint REST call\");\n if (!response.getStatusCode().equals(HttpStatus.OK)) {\n throw new OauthException(\"Carrier thrown Exception: \" + response.getStatusCodeValue());\n }\n message = response.getBody();\n log.info(\"User Token2 Response: {}\", message);\n } catch (RestClientResponseException ex) {\n String returnedMessage = \"\";\n if (ex.getRawStatusCode() == 401) {\n returnedMessage = String.format(\"Error getTokenV2: HTTP 401: Unauthorized token: %s\", ex.getMessage());\n log.error(returnedMessage);\n throw new Exception(returnedMessage);\n }\n if (ex.getResponseBodyAsByteArray().length > 0)\n returnedMessage = new String(ex.getResponseBodyAsByteArray());\n else\n returnedMessage = ex.getMessage();\n status = HttpStatus.BAD_REQUEST;\n log.error(\"HTTP 400: \" + returnedMessage);\n throw new OauthException(returnedMessage, status);\n } catch (Exception ex) {\n String returnedMessage = String.format(\"Error getTokenV2: Error in calling Token end point: %s\", ex.getMessage());\n log.error(returnedMessage);\n throw new Exception(returnedMessage);\n }\n log.info(\"Leaving getTokenV2\");\n return message;\n }", "private static Object doAuth(Request req, Response res) {\n \n HashMap<String, String> response = new HashMap<>();\n\t\t \n String email = Jsoup.parse(req.queryParams(\"email\")).text();\n\t\t String password = Jsoup.parse(req.queryParams(\"password\")).text();\n\t\t\n res.type(Path.Web.JSON_TYPE);\n \t\t\n\t\t\n\t\tif(email != null && !email.isEmpty() && password != null && !password.isEmpty() ) {\n \n authenticate = new Authenticate(password);\n\t\t\t//note that the server obj has been created during call to login()\n\t\t\tString M2 = authenticate.getM2(server);\n\t\t\t\n if(M2 != null || !M2.isEmpty()) {\n \n \n\t\t\tSession session = req.session(true);\n\t\t\tsession.maxInactiveInterval(Path.Web.SESSION_TIMEOUT);\n\t\t\tUser user = UserController.getUserByEmail(email);\n\t\t\tsession.attribute(Path.Web.ATTR_USER_NAME, user.getUsername());\n session.attribute(Path.Web.ATTR_USER_ID, user.getId().toString()); //saves the id as String\n\t\t\tsession.attribute(Path.Web.AUTH_STATUS, authenticate.authenticated);\n\t\t\tsession.attribute(Path.Web.ATTR_EMAIL, user.getEmail());\n logger.info(user.toString() + \" Has Logged In Successfully\");\n \n response.put(\"M2\", M2);\n response.put(\"code\", \"200\");\n response.put(\"status\", \"success\");\n response.put(\"target\", Path.Web.DASHBOARD);\n \n String respjson = gson.toJson(response);\n logger.info(\"Final response sent By doAuth to client = \" + respjson);\n res.status(200);\n return respjson;\n }\n\t\t\t\t\n\t\t} \n \n res.status(401);\n response.put(\"code\", \"401\");\n response.put(\"status\", \"Error! Invalid Login Credentials\");\n \n return gson.toJson(response);\n }", "private void getExchangeDetails(RoutingContext routingContext) {\n LOGGER.debug(\"Info: getExchange method started;\");\n JsonObject requestJson = new JsonObject();\n HttpServerRequest request = routingContext.request();\n JsonObject authenticationInfo = new JsonObject();\n authenticationInfo.put(API_ENDPOINT, \"/management/exchange\");\n LOGGER.debug(\"Info: request :: ;\" + request);\n LOGGER.debug(\"Info: request json :: ;\" + requestJson);\n String exchangeId = request.getParam(EXCHANGE_ID);\n String instanceID = request.getHeader(HEADER_HOST);\n requestJson.put(JSON_INSTANCEID, instanceID);\n HttpServerResponse response = routingContext.response();\n if (request.headers().contains(HEADER_TOKEN)) {\n authenticationInfo.put(HEADER_TOKEN, request.getHeader(HEADER_TOKEN));\n authenticator.tokenInterospect(requestJson, authenticationInfo, authHandler -> {\n if (authHandler.succeeded()) {\n Future<JsonObject> brokerResult =\n managementApi.getExchangeDetails(exchangeId, databroker);\n brokerResult.onComplete(brokerResultHandler -> {\n if (brokerResultHandler.succeeded()) {\n LOGGER.info(\"Success: Getting exchange details\");\n handleSuccessResponse(response, ResponseType.Ok.getCode(),\n brokerResultHandler.result().toString());\n } else if (brokerResultHandler.failed()) {\n LOGGER.error(\"Fail: Bad request\" + brokerResultHandler.cause().getMessage());\n processBackendResponse(response, brokerResultHandler.cause().getMessage());\n }\n });\n } else if (authHandler.failed()) {\n LOGGER.error(\"Fail: Unauthorized\" + authHandler.cause().getMessage());\n handleResponse(response, ResponseType.AuthenticationFailure);\n }\n });\n } else {\n LOGGER.error(\"Fail: Unauthorized\");\n handleResponse(response, ResponseType.AuthenticationFailure);\n }\n }", "@Override\n\tprotected ErrorCode mapMyMessage(Message msg) {\n\t\t\t\t\t\n\t\tint newECRs = 0;\n\t\tint totalRepPatientResult;\n\t\tif (getMyParser().getMyVersion().equalsIgnoreCase(\"2.3.1\"))\n\t\t\ttotalRepPatientResult = ((ca.uhn.hl7v2.model.v231.message.ORU_R01)msg).getPIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTIReps();\n\t\telse\n\t\t\ttotalRepPatientResult = ((ca.uhn.hl7v2.model.v251.message.ORU_R01)msg).getPATIENT_RESULTReps();\n\t\t\t\n\t\tfor (int i=0; i<totalRepPatientResult; i++) {\n\t\t\t// Create a new empty ECR JSON.\n\t\t\tJSONObject ecr_json = new JSONObject();\n\t\t\t\n\t\t\t// Set sending application.\n\t\t\tint res = getMyParser().map_provider_from_appfac ((Object) msg, ecr_json);\n\t\t\tif (res != 0) {\n\t\t\t\treturn ErrorCode.MSH;\n\t\t\t}\n\n\t\t\t// Patient specific information\n\t\t\tObject patient;\n\t\t\tif (getMyParser().getMyVersion().equalsIgnoreCase(\"2.3.1\")) {\n\t\t\t\tORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI patient_result = ((ca.uhn.hl7v2.model.v231.message.ORU_R01)msg).getPIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI(i);\n\t\t\t\tpatient = patient_result.getPIDPD1NK1NTEPV1PV2();\n\t\t\t} else {\n\t\t\t\tORU_R01_PATIENT_RESULT patient_result = ((ca.uhn.hl7v2.model.v251.message.ORU_R01)msg).getPATIENT_RESULT(i);\n\t\t\t\tpatient = patient_result.getPATIENT();\n\t\t\t}\n\t\t\t\n\t\t\tint result = getMyParser().map_patient (patient, ecr_json);\n\t\t\tif (result == 0) {\n\t\t\t\tnewECRs++;\n\t\t\t} else {\n\t\t\t\t// return ErrorCode.PID;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t// We should have the patient populated.\n\t\t\tJSONObject patient_json;\n\t\t\tif (ecr_json.isNull(\"Patient\")) {\n\t\t\t\t// This means the HL7v2 message has no patient demographic information.\n\t\t\t\t// This shouldn't happen. But, anything can happen in the real world. So,\n\t\t\t\t// we don't stop here. We are moving on.\n\t\t\t\tpatient_json = new JSONObject();\n\t\t\t\tecr_json.put(\"Patient\", patient_json);\n\t\t\t} else {\n\t\t\t\tpatient_json = ecr_json.getJSONObject(\"Patient\");\n\t\t\t}\n\n\t\t\t// ORC/OBR Parsing\n\t\t\tJSONArray laborders_json = new JSONArray();\n\t\t\t\n\t\t\t// This is a new JSON Array object. Put it in the patient section.\n\t\t\tpatient_json.put(\"Lab_Order_Code\", laborders_json);\n\n\t\t\tint totalOrderObs;\n\t\t\tif (getMyParser().getMyVersion().equalsIgnoreCase(\"2.3.1\")) {\n\t\t\t\tORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI patient_result = ((ca.uhn.hl7v2.model.v231.message.ORU_R01)msg).getPIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI(i);\n\t\t\t\ttotalOrderObs = patient_result.getORCOBRNTEOBXNTECTIReps();\n\t\t\t} else {\n\t\t\t\tORU_R01_PATIENT_RESULT patient_result = ((ca.uhn.hl7v2.model.v251.message.ORU_R01)msg).getPATIENT_RESULT(i);\n\t\t\t\ttotalOrderObs = patient_result.getORDER_OBSERVATIONReps();\n\t\t\t}\n\t\t\tfor (int j=0; j<totalOrderObs; j++) {\n\t\t\t\tObject orderObs;\n\t\t\t\tif (getMyParser().getMyVersion().equalsIgnoreCase(\"2.3.1\")) {\n\t\t\t\t\tORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI patient_result = ((ca.uhn.hl7v2.model.v231.message.ORU_R01)msg).getPIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI(i);\n\t\t\t\t\torderObs = patient_result.getORCOBRNTEOBXNTECTI(j);\n\t\t\t\t} else {\n\t\t\t\t\tORU_R01_PATIENT_RESULT patient_result = ((ca.uhn.hl7v2.model.v251.message.ORU_R01)msg).getPATIENT_RESULT(i);\n\t\t\t\t\torderObs = patient_result.getORDER_OBSERVATION(j);\n\t\t\t\t}\n\n\t\t\t\tJSONObject laborder_json = getMyParser().map_order_observation (orderObs);\n\t\t\t\tif (laborder_json == null) {\n\t\t\t\t\treturn ErrorCode.ORDER_OBSERVATION;\n\t\t\t\t}\n\t\t\t\tlaborders_json.put(laborder_json);\n\t\t\t\t\n\t\t\t\t// We add lab results to lab order.\n\t\t\t\tJSONArray labresults_json = new JSONArray();\n\t\t\t\tlaborder_json.put(\"Laboratory_Results\", labresults_json);\n\t\t\t\t\n\t\t\t\tint totalObservations;\n\t\t\t\tif (getMyParser().getMyVersion().equalsIgnoreCase(\"2.3.1\")) {\n\t\t\t\t\ttotalObservations = ((ORU_R01_ORCOBRNTEOBXNTECTI)orderObs).getOBXNTEReps();\n\t\t\t\t} else {\n\t\t\t\t\ttotalObservations = ((ORU_R01_ORDER_OBSERVATION)orderObs).getOBSERVATIONReps();\n\t\t\t\t}\n\t\t\t\tfor (int k=0; k<totalObservations; k++) {\n\t\t\t\t\tObject obsResult;\n\t\t\t\t\tif (getMyParser().getMyVersion().equalsIgnoreCase(\"2.3.1\")) {\n\t\t\t\t\t\tobsResult = ((ORU_R01_ORCOBRNTEOBXNTECTI)orderObs).getOBXNTE(k).getOBX();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tobsResult = ((ORU_R01_ORDER_OBSERVATION)orderObs).getOBSERVATION(k).getOBX();\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tJSONObject labresult_json = getMyParser().map_lab_result (obsResult);\n\t\t\t\t\tif (labresult_json == null) {\n\t\t\t\t\t\treturn ErrorCode.LAB_RESULTS;\n\t\t\t\t\t}\n\t\t\t\t\tlabresults_json.put(labresult_json);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// For each order, we have provider, facility, order date and reason information.\n\t\t\t\t// We put this information in the high level.\n\t\t\t\t//\n\t\t\t\t// Provider and Facility at Top ECR level.\n\t\t\t\t// Order Date and Reason at Patient level.\n\t\t\t\t//\n\t\t\t\t// Provider and Facility: \n\t\t\t\t// We are in the Order Loop. So, we will come back. However, \n\t\t\t\t// ECR allows only one provider and facility. So, this can be overwritten\n\t\t\t\t// by next order if provider info exists.\n\t\t\t\tif (!laborder_json.isNull(\"Provider\")) {\n\t\t\t\t\tJSONObject provider_json = laborder_json.getJSONObject(\"Provider\");\n\t\t\t\t\tif (provider_json != null) \n\t\t\t\t\t\tgetMyParser().add_provider (provider_json, ecr_json);\n\t\t\t\t}\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (!laborder_json.isNull(\"Facility\")) {\n\t\t\t\t\tJSONObject facility_json = laborder_json.getJSONObject(\"Facility\");\n\t\t\t\t\tif (facility_json != null) ecr_json.put(\"Facility\", facility_json);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Order Date and Reason. \n\t\t\t\t// We have Visit DateTime in ECR. We will put order date as a visit date\n\t\t\t\t// as the order usually made when a patient visits a clinic.\n\t\t\t\tif (!laborder_json.isNull(\"DateTime\")) {\n\t\t\t\t\tString orderDate_json = laborder_json.getString(\"DateTime\");\n\t\t\t\t\tif (orderDate_json != null) patient_json.put(\"Visit_DateTime\", orderDate_json);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// We have reasons in lab order. We put this in the trigger code.\n\t\t\t\tif (!laborder_json.isNull(\"Reasons\")) {\n\t\t\t\t\tJSONArray reasons_json = laborder_json.getJSONArray(\"Reasons\");\n\t\t\t\t\tJSONArray triggercode_json;\n\t\t\t\t\tif (patient_json.isNull(\"Tigger_Code\")) {\n\t\t\t\t\t\ttriggercode_json = new JSONArray();\n\t\t\t\t\t\tpatient_json.put(\"Trigger_Code\", triggercode_json);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttriggercode_json = patient_json.getJSONArray(\"Trigger_Code\");\n\t\t\t\t\t}\n\t\t\t\t\tif (reasons_json != null) {\n\t\t\t\t\t\tfor (int c=0; c<reasons_json.length(); c++) {\n\t\t\t\t\t\t\ttriggercode_json.put(reasons_json.get(c));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tsendEcr (ecr_json);\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn ErrorCode.INTERNAL;\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t\tif (newECRs == 0) {\n\t\t\treturn ErrorCode.PID;\n\t\t}\n\t\t\n\t\treturn ErrorCode.NOERROR;\n\t}", "public void receiveResultdivide2(\n loadbalance.LoadBalanceStub.Divide2Response result\n ) {\n }", "@Override\n protected void processAuthenticationResponse(HttpServletRequest request,\n HttpServletResponse response, AuthenticationContext context) {\n AuthenticatedUser authenticatedUser = getUser(context);\n\n String input = request.getParameter(\"tcInput\");\n if (\"on\".equals(input)) {\n /*\n logic when user accept terms and condition\n */\n log.info(\"user accepted terms and condition\");\n updateAuthenticatedUserInStepConfig(context, authenticatedUser);\n } else {\n /*\n logic when user rejects terms and condition\n */\n log.info(\"user rejected terms and condition\");\n updateAuthenticatedUserInStepConfig(context, authenticatedUser);\n\n }\n }", "public Message processAndReply(Message inMessage) throws MessageException {\n Message outMessage = null;\n\n switch(inMessage.getMessageType()) {\n case 4:\n if(inMessage.isThereNoFirstArgument())\n throw new MessageException(\"Argument \\\"passengersThatArrived\\\" not supplied.\", inMessage);\n if(((int) inMessage.getFirstArgument()) < 1)\n throw new MessageException(\"Argument \\\"passengersThatArrived\\\" was given an incorrect value.\",\n inMessage);\n if(inMessage.isThereNoSecondArgument())\n throw new MessageException(\"Argument \\\"flightNumber\\\" not supplied.\", inMessage);\n if(((int) inMessage.getSecondArgument()) < 0)\n throw new MessageException(\"Argument \\\"flightNumber\\\" was given an incorrect value.\", inMessage);\n break;\n case 5:\n case 29:\n case 61:\n break;\n case 14:\n if(inMessage.isThereNoFirstArgument())\n throw new MessageException(\"Argument \\\"seat\\\" not supplied.\", inMessage);\n if(((int) inMessage.getFirstArgument()) < 0)\n throw new MessageException(\"Argument \\\"seat\\\" was given an incorrect value.\", inMessage);\n break;\n default:\n throw new MessageException(\"Invalid message type: \" + inMessage.getMessageType());\n }\n\n switch(inMessage.getMessageType()) {\n case 4:\n int result4 = departureTerminalTransferQuay.parkTheBusAndLetPassOff((int) inMessage.getFirstArgument(),\n (int) inMessage.getSecondArgument());\n outMessage = new Message(Message.MessageType.BD_DTTQ_PARK_THE_BUS_AND_LET_PASS_OFF.getMessageCode(),\n (Object) result4);\n break;\n case 5:\n departureTerminalTransferQuay.goToArrivalTerminal();\n outMessage = new Message(Message.MessageType.BD_DTTQ_GO_TO_ARRIVAL_TERMINAL.getMessageCode(), null);\n break;\n case 14:\n departureTerminalTransferQuay.leaveTheBus(inMessage.getPassengerID(),\n (int) inMessage.getFirstArgument());\n outMessage = new Message(Message.MessageType.PA_DTTQ_LEAVE_THE_BUS.getMessageCode(), null);\n break;\n case 29:\n departureTerminalTransferQuay.prepareForNextFlight();\n outMessage = new Message(Message.MessageType.DTTQ_PREPARE_FOR_NEXT_FLIGHT.getMessageCode(), null);\n break;\n case 61:\n DepartureTerminalTransferQuayServer.running = false;\n (((DepartureTerminalTransferQuayProxy) (Thread.currentThread ())).getServerCom()).setTimeout(10);\n outMessage = new Message (Message.MessageType.EVERYTHING_FINISHED.getMessageCode(), null);\n }\n return (outMessage);\n }", "@Test\n\tpublic void testFullSignedAuthnResponseProcessing() throws Exception {\n\t\tthis.initStorageWithAuthnRequest();\n\t\tthis.testAuthnResponseProcessingScenario1(this.responseFullSigned);\n\t}", "public void receiveData(DataFrame dummy1, Participant dummy2) {\n\t}", "public static void processOIDCresp(HttpServletRequest req,HttpServletResponse resp) throws IOException, InterruptedException, NoSuchAlgorithmException, InvalidKeySpecException, ClassNotFoundException, SQLException\n\t{\n\t\tHttpSession session=req.getSession();\n\t\t//check the state parameters from the response with state parameter in the session,saved during authorization request\n\t\tString state=(String)req.getParameter(\"state\");\n\t\t\n\t\tif(state!=null)\n\t\t{\n\t\t //Pick up the response type associated with the state parameters\n\t\t String response_type=(String)session.getAttribute(state);\n\t\t if(response_type!=null)\n\t\t {\n\t\t\t if(response_type.contains(\"id_token\"))\n\t\t\t {\n\t\t\t\t//If the response type contains id_token(validate the ID Token create one cookie for authenticated users and send to user agent(browser)\n\t\t\t\t//If the response type contains id_token token(validate the ID Token create one cookie for authenticated users and send to user agent(browser) \n\t\t\t\t//and when users needs to access more profile info using access token we can get it.\n\t\t\t\t \n\t\t\t\t //Decode the ID Token(headers and payload)\n\t\t\t\tArrayList<String>decodeParams=decodeIDTokeheadPay(req.getParameter(\"id_token\"));\n\t\t\t\t//Convert the JSON into key value pairs\n\t\t\t Map<String,Object> headers=processJSON(decodeParams.get(0));\n\t\t\t\tMap<String,Object> payloads=processJSON(decodeParams.get(1));\n\t\t\t\t\n\t\t\t\t//Validate the public key by sending request to issuer(URL) by passing clientid and kid as header parameters\n\t\t\t\tif(ValidateIDissuerKey((String) payloads.get(\"iss\"),(String) headers.get(\"kid\"),resp))\n\t\t\t\t {\n\t\t\t\t\t //Decoded the public key from the encoded kid for signature verifications \n\t\t\t\t\t PublicKey pubkeys=pubkeyEncoder(Base64.getDecoder().decode((String) headers.get(\"kid\")));\n\t\t\t\t\t if(ValidateTokenSignature(req.getParameter(\"id_token\"),pubkeys))\n\t\t\t\t\t {\n\t\t\t\t\t\t responseFormat(payloads,resp);\n\t\t\t\t\t\t \n\t\t\t\t\t\t //another flow of implicit(id_token token)\n\t\t\t\t\t\t if(response_type.contains(\"token\"))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t//save the token in cookie\n\t\t\t\t\t\t\t//Create one session for that authenticated users and redirected to Home Page\n\t\t\t\t\t\t\t Cookie auth_uesr = new Cookie(\"access_token\",req.getParameter(\"access_token\"));\n\t\t\t\t\t\t\t resp.addCookie(auth_uesr);\n\t\t\t\t\t\t }\n\t\t\t\t\t\t //Redirected to Home Page\n\t\t\t\t\t\t //if(!response_type.contains(\"code\"))\n\t\t\t\t\t\t\t//resp.sendRedirect(\"http://localhost:8080/OPENID/phoneBookHome.jsp\");\n\t\t\t\t\t }\n\t\t\t\t\t else\n\t\t\t\t\t {\n\t\t\t\t\t\t //Signature Invalid and Token become Invalid and reauthenticate again\n\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t else\n\t\t\t\t {\n\t\t\t\t\t //issuer invalid\n\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t }\n\t\t\t }\n\t\t\t //Token Endpoint request for authorization code Flow\n\t\t /* if(response_type.contains(\"code\"))\n\t\t {\n\t\t \t authCodeProcessModel authModel=new authCodeProcessModel();\n\t\t \t authModel.setClientid(\"mano.lmfsktkmyj\");\n\t\t \t authModel.setClientsecret(\"mano.tpeoeothyc\");\n\t\t \t authModel.setCode((String)req.getParameter(\"code\"));\n\t\t \t authModel.setRedirecturi(\"http://localhost:8080/OPENID/msPhoneBook/response1\");\n\t\t \t \n\t\t \t //Get response from the token endpoint\n\t\t \t Map<String,Object> tokenResp=authCodeProcess(authModel,resp);\n\t\t \t //Check if the response returned any error\n\t\t \t if(tokenResp.containsKey(\"error\"))\n\t\t \t {\n\t\t \t //Token response made error redirected to signin with mano page again\n\t\t \t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t \t }\n\t\t \t else\n\t\t \t {\n\t\t \t\t responseFormat(tokenResp,resp);\n\t\t \t\t //Validate ID Token\n\t\t \t\t ArrayList<String>decodeParams=decodeIDTokeheadPay((String) tokenResp.get(\"id_token\"));\n\t\t\t\t\t\t//Convert the JSON into key value pairs\n\t\t\t\t\t Map<String,Object> headers=processJSON(decodeParams.get(0));\n\t\t\t\t\t Map<String,Object> payloads=processJSON(decodeParams.get(1));\n\t\t\t\t\t \n\t\t\t\t\t//Validate the public key by sending request to issuer(URL) by passing clientid and kid as header parameters\n\t\t\t\t\t if(ValidateIDissuerKey((String) payloads.get(\"iss\"),(String) headers.get(\"kid\"),resp))\n\t\t\t\t\t {\n\t\t\t\t\t\t //true check signature\n\t\t\t\t\t\t PublicKey pubkeys=pubkeyEncoder(Base64.getDecoder().decode((String) headers.get(\"kid\")));\n\t\t\t\t\t\t //Validate the signature using public key\n\t\t\t\t\t\t if(ValidateTokenSignature((String) tokenResp.get(\"id_token\"),pubkeys))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t //Valid the access token with the at_hash values in the ID Token\n\t\t\t\t\t\t\t //First hash the access token and compared with at_hash value in the ID Token\n\t\t\t\t\t\t\t if(payloads.get(\"at_hash\").equals(hashPass((String)tokenResp.get(\"access_token\"))))\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t //save access token along with refresh token to client database used when acces token get expired\n\t\t\t\t\t\t\t\t PhoneBookDAO.saveTokens((String)tokenResp.get(\"access_token\"),(String)tokenResp.get(\"refresh_token\"));\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t//Create one cookie for that authenticated users and redirected to Home Page and send cookie to browser\n\t\t\t\t\t\t\t\t session.setAttribute(\"enduser_name\",payloads.get(\"sub\"));\n\t\t\t\t\t\t\t\t Cookie auth_uesr = new Cookie(\"access_token\",(String) tokenResp.get(\"access_token\"));\n\t\t\t\t\t\t\t\t resp.addCookie(auth_uesr);\n\t\t\t\t\t\t\t\t //Redirected to Home Page\n\t\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/phoneBookHome.jsp\");\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t //Invalid Access Token(Reauthenticate again)\n\t\t\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t\t\t\t } \n\t\t\t\t\t\t }\n\t\t\t\t\t\t else\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t //Signature invalid\n\t\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t\t\t }\n\t\t \t }\n\t\t\t else\n\t\t\t {\n\t\t\t\t //Invalid issuers or public key(reauthenticate again)\n\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t }\n\t\t }\n\t\t }*/\n\t\t }\n\t\t else\n\t\t {\n\t\t\t//If the state value is not matched with the state value generated during authorization request CSRF attack\n\t\t\t//sign up again\n\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//state missing from server,response may be from unknown server,so sign up again\n\t\t\tresp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t}\n\t}", "@Test\n public void authentication2() \n {\n\t Response resp = RestAssured.given().auth().oauth2(\"accessTokenToPass\").post(\"URL/URL\");\n\t resp.getStatusCode();\n\t \n\t //Getting entire data value\n\t System.out.println(\"Content is :\" +resp.getBody().asString());\n\t \n\t //Converting in to Json path value\n\t JsonPath json = resp.getBody().jsonPath();\n\t \n\t //Printing in JSON value\n\t System.out.println(\"Json Value are :\" +json);\n }", "private AuthenticationResult processTokenResponse(HttpWebResponse webResponse, final HttpEvent httpEvent)\n throws AuthenticationException {\n final String methodName = \":processTokenResponse\";\n AuthenticationResult result;\n String correlationIdInHeader = null;\n String speRing = null;\n if (webResponse.getResponseHeaders() != null) {\n if (webResponse.getResponseHeaders().containsKey(\n AuthenticationConstants.AAD.CLIENT_REQUEST_ID)) {\n // headers are returning as a list\n List<String> listOfHeaders = webResponse.getResponseHeaders().get(\n AuthenticationConstants.AAD.CLIENT_REQUEST_ID);\n if (listOfHeaders != null && listOfHeaders.size() > 0) {\n correlationIdInHeader = listOfHeaders.get(0);\n }\n }\n\n if (webResponse.getResponseHeaders().containsKey(AuthenticationConstants.AAD.REQUEST_ID_HEADER)) {\n // headers are returning as a list\n List<String> listOfHeaders = webResponse.getResponseHeaders().get(\n AuthenticationConstants.AAD.REQUEST_ID_HEADER);\n if (listOfHeaders != null && listOfHeaders.size() > 0) {\n Logger.v(TAG + methodName, \"Set request id header. \" + \"x-ms-request-id: \" + listOfHeaders.get(0));\n httpEvent.setRequestIdHeader(listOfHeaders.get(0));\n }\n }\n\n if (null != webResponse.getResponseHeaders().get(X_MS_CLITELEM) && !webResponse.getResponseHeaders().get(X_MS_CLITELEM).isEmpty()) {\n final CliTelemInfo cliTelemInfo =\n TelemetryUtils.parseXMsCliTelemHeader(\n webResponse.getResponseHeaders()\n .get(X_MS_CLITELEM).get(0)\n );\n\n if (null != cliTelemInfo) {\n httpEvent.setXMsCliTelemData(cliTelemInfo);\n speRing = cliTelemInfo.getSpeRing();\n }\n }\n }\n\n final int statusCode = webResponse.getStatusCode();\n\n if (statusCode == HttpURLConnection.HTTP_OK\n || statusCode == HttpURLConnection.HTTP_BAD_REQUEST\n || statusCode == HttpURLConnection.HTTP_UNAUTHORIZED) {\n try {\n result = parseJsonResponse(webResponse.getBody());\n if (result != null) {\n if (null != result.getErrorCode()) {\n result.setHttpResponse(webResponse);\n }\n\n final CliTelemInfo cliTelemInfo = new CliTelemInfo();\n cliTelemInfo._setSpeRing(speRing);\n result.setCliTelemInfo(cliTelemInfo);\n httpEvent.setOauthErrorCode(result.getErrorCode());\n }\n } catch (final JSONException jsonException) {\n throw new AuthenticationException(ADALError.SERVER_INVALID_JSON_RESPONSE,\n \"Can't parse server response. \" + webResponse.getBody(),\n webResponse, jsonException);\n }\n } else if (statusCode >= HttpURLConnection.HTTP_INTERNAL_ERROR && statusCode <= MAX_RESILIENCY_ERROR_CODE) {\n throw new ServerRespondingWithRetryableException(\"Server Error \" + statusCode + \" \"\n + webResponse.getBody(), webResponse);\n } else {\n throw new AuthenticationException(ADALError.SERVER_ERROR,\n \"Unexpected server response \" + statusCode + \" \" + webResponse.getBody(),\n webResponse);\n }\n\n // Set correlationId in the result\n if (correlationIdInHeader != null && !correlationIdInHeader.isEmpty()) {\n try {\n UUID correlation = UUID.fromString(correlationIdInHeader);\n if (!correlation.equals(mRequest.getCorrelationId())) {\n Logger.w(TAG + methodName, \"CorrelationId is not matching\", \"\",\n ADALError.CORRELATION_ID_NOT_MATCHING_REQUEST_RESPONSE);\n }\n\n Logger.v(TAG + methodName, \"Response correlationId:\" + correlationIdInHeader);\n } catch (IllegalArgumentException ex) {\n Logger.e(TAG + methodName, \"Wrong format of the correlation ID:\" + correlationIdInHeader, \"\",\n ADALError.CORRELATION_ID_FORMAT, ex);\n }\n }\n\n if (null != webResponse.getResponseHeaders()) {\n final List<String> xMsCliTelemValues = webResponse.getResponseHeaders().get(X_MS_CLITELEM);\n if (null != xMsCliTelemValues && !xMsCliTelemValues.isEmpty()) {\n // Only one value is expected to be present, so we'll grab the first element...\n final String speValue = xMsCliTelemValues.get(0);\n final CliTelemInfo cliTelemInfo = TelemetryUtils.parseXMsCliTelemHeader(speValue);\n if (result != null) {\n result.setCliTelemInfo(cliTelemInfo);\n }\n }\n }\n\n return result;\n }", "public void alg_REQ(){\nSystem.out.println(\"3LastTokenIn, TokenIn, TokenOut:\" + lastTokenIn.value + TokenIn.value + TokenOut.value);\n\nif(lastTokenIn.value) {\nif (TokenChanged.value) {\n if (!PERequest.value) {\n Block.value = false;\n TokenOut.value = false;\n System.out.println(\"Conv 3: I just got token, request is coming let bag go and keep token\");\n } else {\n Block.value = false;\n TokenOut.value = true;\n System.out.println(\"Conv 3: I just got token, no request so run conveyer but let token go\");\n }\n} else {\n if (!PERequest.value) {\n System.out.println(\"Conv 3: I had token for a while, request here and bag passed eye, keep running conv and keep token\");\n Block.value = false;\n TokenOut.value = false;\n } else {\n if (PEExit.value) {\n Block.value = false;\n TokenOut.value = true;\n System.out.println(\"Conv 3: I had token for a while, no requests and bag passed eye, let token go\");\n } else {\n Block.value = false;\n TokenOut.value = false;\n System.out.println(\"Conv 3: I have token, no requests and bag not passed eye yet, keep token\");\n }\n }\n}\n}\n\nelse {\n if (!PERequest.value) {\n Block.value = true;\nTokenOut.value = true;\n System.out.println(\"Conv 3: No token, rquest here. Wait\");\n }\nelse {\nBlock.value = false;\nTokenOut.value = false;\nSystem.out.println(\"Conv 3: No token no request\");\n}\n}\n\nif(lastTokenIn.value != TokenIn.value) {\n TokenChanged.value = true;\n}\nelse {\n TokenChanged.value = false;\n}\nlastTokenIn.value = TokenIn.value;\n\n}", "@Override\n public void copyMessageToExchange(CamelMediationMessage ssoOut, Exchange exchange) {\n\n try {\n\n MediationMessage out = ssoOut.getMessage();\n\n // If ed is available, redirect to that URL, attaching the json object.\n EndpointDescriptor ed = out.getDestination();\n\n // ------------------------------------------------------------\n // Validate received message\n // ------------------------------------------------------------\n\n\n // ------------------------------------------------------------\n // Create HTML Form for response body\n // ------------------------------------------------------------\n if (logger.isDebugEnabled())\n logger.debug(\"Creating HTML Redirect to \" + ed.getLocation());\n\n if (logger.isDebugEnabled())\n logger.debug(\"Creating HTML Form for action \" + ed.getLocation());\n\n Message httpOut = exchange.getOut();\n Message httpIn = exchange.getIn();\n\n // TODO : Add 'Ajax' support\n /*\n\n HTTP Post binding ...\n\n Html post = this.createHtmlPostMessage(this.buildHttpTargetLocation(httpIn, ed),\n out.getRelayState(),\n \"JOSSOMessage\",\n \"\");\n\n\n String marshalledHttpResponseBody = XmlUtils.marshal(post, \"http://www.w3.org/1999/xhtml\", \"html\",\n new String[]{\"org.w3._1999.xhtml\"});\n */\n\n String marshalledJSONResponseBody = null;\n try {\n ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);\n mapper.writeValue(baos, out.getContent());\n marshalledJSONResponseBody = new String(baos.toByteArray(), \"UTF-8\");\n } catch (IOException e) {\n logger.error(e.getMessage(), e);\n throw new RuntimeException(e);\n }\n\n\n // ------------------------------------------------------------\n // Prepare HTTP Response\n // ------------------------------------------------------------\n copyBackState(out.getState(), exchange);\n\n httpOut.getHeaders().put(\"Cache-Control\", \"no-cache, no-store\");\n httpOut.getHeaders().put(\"Pragma\", \"no-cache\");\n httpOut.getHeaders().put(\"http.responseCode\", 200);\n httpOut.getHeaders().put(\"Content-Type\", \"application/json\");\n handleCrossOriginResourceSharing(exchange);\n\n ByteArrayInputStream baos = new ByteArrayInputStream(marshalledJSONResponseBody.getBytes(\"UTF-8\"));\n httpOut.setBody(baos);\n\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n\n }", "public interface ReceiveThirdDataService {\n\n /**\n * 解析第三数据,每叫号业务推送\n *\n * @param courtTakeNumPojo\n * @return\n */\n RestApiMsg<String> transferThirdData(CourtTakeNumPojo courtTakeNumPojo, HttpServletRequest request);\n}", "@Test\n\tpublic void testSimpleSignedAuthnResponseProcessing() throws Exception {\n\t\tthis.initStorageWithAuthnRequest();\n\t\tthis.testAuthnResponseProcessingScenario1(this.responseSimpleSigned);\n\t}", "private void processMessages(String[] messageParts) {\r\n\r\n\t\tboolean add = true;\r\n\t\tUser fromUser = null;\r\n\r\n\t\tString[] messages = messageParts[2].split(SEPARATOR2);\r\n\r\n\t\t// Check if there is any message\r\n\t\tif(!messages[0].equals(\"\")){\r\n\r\n\t\t\tfor (int i = 0; i < messages.length; i++) {\r\n\t\t\t\t// Separate message USERNAME+MESSAGE\r\n\t\t\t\tString[] aMessage = messages[i].split(SEPARATOR3);\r\n\t\t\t\tadd = true;\r\n\t\t\t\tfor (User user: controller.getModel().getUsers()) {\t\t\t\t\t\r\n\t\t\t\t\tif(user.getUserName().equals(aMessage[0])) {\r\n\t\t\t\t\t\tadd = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\tif (add){\r\n\r\n\t\t\t\t\t// if user doesn't exist already create it\r\n\t\t\t\t\tSystem.out.println(\"ADD USER \"+ aMessage[0]);\r\n\t\t\t\t\tfromUser = new User(aMessage[0]);\r\n\t\t\t\t\tcontroller.getModel().addUser(fromUser);\r\n\t\t\t\t}else{\r\n\r\n\t\t\t\t\t// If user exist store it in the fromUser variable\r\n\t\t\t\t\tfor (User user: controller.getModel().getUsers()) {\t\t\t\t\t\r\n\t\t\t\t\t\tif(user.getUserName().equals(aMessage[0])) {\r\n\t\t\t\t\t\t\tfromUser = user;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Add message to user \r\n\t\t\t\tfromUser.addMessage(new Message(fromUser.getUserName(),aMessage[1]));\r\n\r\n\t\t\t\t// Print message to users Document\r\n\t\t\t\tfromUser.update();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "String login(String string2, String string3) throws IOException {\n Protocol protocol = this;\n synchronized (protocol) {\n Response response;\n String string4 = this.apopChallenge;\n String string5 = null;\n if (string4 != null) {\n string5 = this.getDigest(string3);\n }\n if (this.apopChallenge != null && string5 != null) {\n response = this.simpleCommand(\"APOP \" + string2 + \" \" + string5);\n } else {\n Response response2 = this.simpleCommand(\"USER \" + string2);\n if (!response2.ok) {\n if (response2.data == null) return \"USER command failed\";\n return response2.data;\n }\n response = this.simpleCommand(\"PASS \" + string3);\n }\n if (response.ok) return null;\n if (response.data == null) return \"login failed\";\n return response.data;\n }\n }", "@Override\r\n\tpublic int challengeTwo(String[] arr, String query) {\n\t\treturn 0;\r\n\t}", "@Override\r\n\tpublic int jumble(int leftOne, int rightOne, int leftTwo, int rightTwo) {\n\t\tString serviceCclientId = \"f3e5071e-c778-4754-8641-c682be436367\";\r\n\r\n\t\t//String url = \"https://api.apim.ibmcloud.com/bluemixtraininganzgmailcom-dev/sb\";\r\n\t\tString url = \"https://api.apim.ibmcloud.com/strichykyahoocomau-dev/sb\";\r\n\t\tSystem.out.println(url + \"/ServiceAService\");\r\n\t\tLOGGER.info(url + \"/ServiceAService\");\r\n\t\t\r\n\t\tMap<String, List<String>> serviceARequestHeaders = new HashMap<String, List<String>>();\r\n\t\tserviceARequestHeaders.put(\"X-IBM-Client-Id\", Collections.singletonList(serviceCclientId));\r\n\r\n\t\tIServiceA serviceA = new ServiceAService().getServiceAPort();\r\n\t\t((BindingProvider)serviceA).getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, serviceARequestHeaders);\r\n\t\tSystem.out.println(BindingProvider.ENDPOINT_ADDRESS_PROPERTY +\":\" + url + \"/ServiceAService\");\r\n\t\t((BindingProvider)serviceA).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url + \"/ServiceAService\");\r\n\t\t\r\n\t\tIServiceB serviceB = new ServiceBService().getServiceBPort();\r\n\t\t((BindingProvider)serviceB).getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, serviceARequestHeaders);\r\n\t\t((BindingProvider)serviceB).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url + \"/ServiceBService\");\r\n\r\n\t\tint result = serviceB.minus(serviceA.plus(leftOne, rightOne),serviceA.plus(leftTwo, rightTwo));\r\n\t\t\r\n\t\tLOGGER.info(\"leftOne=\"+leftOne + \", rightOne=\" + rightOne + \",leftTwo=\"+leftTwo + \", rightTwo=\" + rightTwo + \", result=\" + result);\r\n\r\n\t\treturn result;\t\t\r\n\t}", "@POST\n\t @Consumes(MediaType.MULTIPART_FORM_DATA)\n\t @Produces(MediaType.APPLICATION_JSON)\n\t @Path(\"/Login\")\n\t public Response Login(@FormDataParam(\"Email\") String Email,\n\t\t\t @FormDataParam(\"Password\") String Password){\n\t\t int statusCode=400;\n\t\t int memberID=0;\n\t\t String memberRole=\"Visitor\";\n\t\t String result;\n\t\t TokenFactory tokens= listBook.tokens;\n\t\t JSONObject jsonObject= new JSONObject();\n\t\t \n\t\t HashMap<String,String> memberData = new HashMap<String,String>();\n\t\t if(Email.equals(\"\")) return listBook.makeCORS(Response.status(statusCode), \"\");\n\t\t\t memberData.put(\"Email\", Email);\n\t\t if(Password.equals(\"\")) return listBook.makeCORS(Response.status(statusCode), \"\");\n\t\t\t memberData.put(\"Password\", Password);\n\t\t \n\t\t jsonObject=retrieveMember(memberData);\n\t\t if(jsonObject.length()>0){\n\t\t\t\t try {\n\t\t\t\t\tmemberID=jsonObject.getInt(\"ID\");\n\t\t\t\t\tmemberRole=jsonObject.getString(\"Role\");\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t }\n\t\t\t \n\t\t if(memberID==0){\n\t\t\t\t try {\n\t\t\t\t\tstatusCode=404;\n\t\t\t\t\tjsonObject.put(\"msg\", \"Member not found\");\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t }\t\t \n\t\t else {\n\t\t\t\t try {\n\t\t\t\t\t String token= tokens.tokenProduce(memberID, memberRole);\n\t\t\t\t\t statusCode=200;\n\t\t\t\t\t JSONObject verifyToken =tokens.tokenConsume(token);\n\t\t\t\t\t if(verifyToken.length()<1) return listBook.makeCORS(Response.status(401), \"\"); \n\t\t\t\t\t if(verifyToken.getInt(\"ID\")<1) return listBook.makeCORS(Response.status(401), \"\"); \n\t\t\t\t\t memberRole=verifyToken.getString(\"Role\");\n\t\t\t\t\t jsonObject.put(\"msg\", \"Logged in!\");\n\t\t\t\t\t jsonObject.put(\"token\", token);\n\t\t\t\t\t jsonObject.put(\"role\", memberRole);\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t }\n\t\t result = \"\"+jsonObject;\n\t\t\n\t\treturn listBook.makeCORS(Response.status(statusCode), result);\t\t\t \t\t \n\t }", "public boolean doAuthenticatePlainTextPassword(Request request, String pass) {\n AuthorizationHeader authHeader = (AuthorizationHeader) request.getHeader(AuthorizationHeader.NAME);\n if ( authHeader == null ) return false;\n String realm = authHeader.getRealm().trim();\n String username = authHeader.getUsername().trim();\n\n if ( username == null || realm == null ) {\n return false;\n }\n\n String nonce = authHeader.getNonce();\n URI uri = authHeader.getURI();\n if (uri == null) {\n return false;\n }\n // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略\n String qop = authHeader.getQop();\n\n // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。\n // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护\n //String cNonce = authHeader.getCNonce();\n\n // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量\n int nc = authHeader.getNonceCount();\n String ncStr = new DecimalFormat(\"00000000\").format(nc);\n// String ncStr = new DecimalFormat(\"00000000\").format(Integer.parseInt(nc + \"\", 16));\n\n String A1 = username + \":\" + realm + \":\" + pass;\n String A2 = request.getMethod().toUpperCase() + \":\" + uri.toString();\n byte mdbytes[] = messageDigest.digest(A1.getBytes());\n String HA1 = toHexString(mdbytes);\n System.out.println(\"A1: \" + A1);\n System.out.println(\"A2: \" + A2);\n\n mdbytes = messageDigest.digest(A2.getBytes());\n String HA2 = toHexString(mdbytes);\n System.out.println(\"HA1: \" + HA1);\n System.out.println(\"HA2: \" + HA2);\n String cnonce = authHeader.getCNonce();\n System.out.println(\"nonce: \" + nonce);\n System.out.println(\"nc: \" + ncStr);\n System.out.println(\"cnonce: \" + cnonce);\n System.out.println(\"qop: \" + qop);\n String KD = HA1 + \":\" + nonce;\n\n if (qop != null && qop.equals(\"auth\") ) {\n if (nc != -1) {\n KD += \":\" + ncStr;\n }\n if (cnonce != null) {\n KD += \":\" + cnonce;\n }\n KD += \":\" + qop;\n }\n KD += \":\" + HA2;\n System.out.println(\"KD: \" + KD);\n mdbytes = messageDigest.digest(KD.getBytes());\n String mdString = toHexString(mdbytes);\n System.out.println(\"mdString: \" + mdString);\n String response = authHeader.getResponse();\n System.out.println(\"response: \" + response);\n return mdString.equals(response);\n\n }", "@ApiOperation(\"동시에 3개의 요청을 호출하고 개별로 진행한다.\")\n\t@ApiResponses(value = { @ApiResponse(code = 200, message = \"Success\", response = ResponseInfo.class) })\n\t@GetMapping(value = \"/test2\")\n\tpublic Map<String, Object> test2() {\n\t\tlog.info(\"async start\");\n\t\tCompletableFuture.supplyAsync(() -> this.buildMessage(2)).thenApply(finalResult -> printMessage(\"[thenApply] \" + finalResult));\n\t\tCompletableFuture.supplyAsync(() -> this.buildMessage(3)).thenApply(finalResult -> printMessage(\"[thenApply] \" + finalResult));\n\t\tCompletableFuture.supplyAsync(() -> this.buildMessage(4)).thenApply(finalResult -> printMessage(\"[thenApply] \" + finalResult));\n\t\tlog.info(\"async end\");\n\n\t\tMap<String, Object> obj = new HashMap<String, Object>();\n\t\tobj.put(\"code\", \"100200\");\n\t\tobj.put(\"msg\", \"success\");\n\t\tobj.put(\"data\", \"\");\n\t\treturn obj;\n\t}", "public sample.ws.HelloWorldWSStub.HelloAuthenticatedWithEntitlementPrecheckResponse helloAuthenticatedWithEntitlementPrecheck(\n\n sample.ws.HelloWorldWSStub.HelloAuthenticatedWithEntitlementPrecheck helloAuthenticatedWithEntitlementPrecheck2)\n \n\n throws java.rmi.RemoteException\n \n {\n org.apache.axis2.context.MessageContext _messageContext = null;\n try{\n org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());\n _operationClient.getOptions().setAction(\"helloAuthenticatedWithEntitlementPrecheck\");\n _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);\n\n \n \n addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,\"&\");\n \n\n // create a message context\n _messageContext = new org.apache.axis2.context.MessageContext();\n\n \n\n // create SOAP envelope with that payload\n org.apache.axiom.soap.SOAPEnvelope env = null;\n \n \n env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),\n helloAuthenticatedWithEntitlementPrecheck2,\n optimizeContent(new javax.xml.namespace.QName(\"http://ws.sample/\",\n \"helloAuthenticatedWithEntitlementPrecheck\")));\n \n //adding SOAP soap_headers\n _serviceClient.addHeadersToEnvelope(env);\n // set the message context with that soap envelope\n _messageContext.setEnvelope(env);\n\n // add the message contxt to the operation client\n _operationClient.addMessageContext(_messageContext);\n\n //execute the operation client\n _operationClient.execute(true);\n\n \n org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(\n org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);\n org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();\n \n \n java.lang.Object object = fromOM(\n _returnEnv.getBody().getFirstElement() ,\n sample.ws.HelloWorldWSStub.HelloAuthenticatedWithEntitlementPrecheckResponse.class,\n getEnvelopeNamespaces(_returnEnv));\n\n \n return (sample.ws.HelloWorldWSStub.HelloAuthenticatedWithEntitlementPrecheckResponse)object;\n \n }catch(org.apache.axis2.AxisFault f){\n\n org.apache.axiom.om.OMElement faultElt = f.getDetail();\n if (faultElt!=null){\n if (faultExceptionNameMap.containsKey(faultElt.getQName())){\n //make the fault by reflection\n try{\n java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());\n java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);\n java.lang.Exception ex=\n (java.lang.Exception) exceptionClass.newInstance();\n //message class\n java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());\n java.lang.Class messageClass = java.lang.Class.forName(messageClassName);\n java.lang.Object messageObject = fromOM(faultElt,messageClass,null);\n java.lang.reflect.Method m = exceptionClass.getMethod(\"setFaultMessage\",\n new java.lang.Class[]{messageClass});\n m.invoke(ex,new java.lang.Object[]{messageObject});\n \n\n throw new java.rmi.RemoteException(ex.getMessage(), ex);\n }catch(java.lang.ClassCastException e){\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.ClassNotFoundException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n }catch (java.lang.NoSuchMethodException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.reflect.InvocationTargetException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.IllegalAccessException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.InstantiationException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n }\n }else{\n throw f;\n }\n }else{\n throw f;\n }\n } finally {\n _messageContext.getTransportOut().getSender().cleanup(_messageContext);\n }\n }", "private static String doLogin(Request req, Response res) {\n HashMap<String, String> respMap;\n \n res.type(Path.Web.JSON_TYPE);\n \n \n\t String email = Jsoup.parse(req.queryParams(\"email\")).text();\n \n logger.info(\"email from the client = \" + email);\n \n if(email != null && !email.isEmpty()) { \n \n\t server = new SRP6JavascriptServerSessionSHA256(CryptoParams.N_base10, CryptoParams.g_base10);\n\t \t\t\n\t gen = new ChallengeGen(email);\n\t\t\n\t respMap = gen.getChallenge(server);\n \n if(respMap != null) {\n\t\t logger.info(\"JSON RESP SENT TO CLIENT = \" + respMap.toString());\n res.status(200);\n respMap.put(\"code\", \"200\");\n respMap.put(\"status\", \"success\");\n return gson.toJson(respMap);\n }\n }\n respMap = new HashMap<>();\n \n res.status(401);\n respMap.put(\"status\", \"Invalid User Credentials\");\n respMap.put(\"code\", \"401\");\n logger.error(\"getChallenge() return null map most likely due to null B value and Invalid User Credentials\");\n \treturn gson.toJson(respMap);\n}", "private String getHeaderValueImpl(String paramString1, String paramString2) {\n/* */ String str1, str8, str9;\n/* 351 */ char[] arrayOfChar = this.pw.getPassword();\n/* 352 */ boolean bool = this.params.authQop();\n/* 353 */ String str2 = this.params.getOpaque();\n/* 354 */ String str3 = this.params.getCnonce();\n/* 355 */ String str4 = this.params.getNonce();\n/* 356 */ String str5 = this.params.getAlgorithm();\n/* 357 */ this.params.incrementNC();\n/* 358 */ int i = this.params.getNCCount();\n/* 359 */ String str6 = null;\n/* */ \n/* 361 */ if (i != -1) {\n/* 362 */ str6 = Integer.toHexString(i).toLowerCase();\n/* 363 */ int j = str6.length();\n/* 364 */ if (j < 8) {\n/* 365 */ str6 = zeroPad[j] + str6;\n/* */ }\n/* */ } \n/* */ try {\n/* 369 */ str1 = computeDigest(true, this.pw.getUserName(), arrayOfChar, this.realm, paramString2, paramString1, str4, str3, str6);\n/* */ }\n/* 371 */ catch (NoSuchAlgorithmException noSuchAlgorithmException) {\n/* 372 */ return null;\n/* */ } \n/* */ \n/* 375 */ String str7 = \"\\\"\";\n/* 376 */ if (bool) {\n/* 377 */ str7 = \"\\\", nc=\" + str6;\n/* */ }\n/* */ \n/* */ \n/* */ \n/* 382 */ if (delimCompatFlag) {\n/* */ \n/* 384 */ str8 = \", algorithm=\\\"\" + str5 + \"\\\"\";\n/* 385 */ str9 = \", qop=\\\"auth\\\"\";\n/* */ } else {\n/* */ \n/* 388 */ str8 = \", algorithm=\" + str5;\n/* 389 */ str9 = \", qop=auth\";\n/* */ } \n/* */ \n/* */ \n/* 393 */ String str10 = this.authMethod + \" username=\\\"\" + this.pw.getUserName() + \"\\\", realm=\\\"\" + this.realm + \"\\\", nonce=\\\"\" + str4 + str7 + \", uri=\\\"\" + paramString1 + \"\\\", response=\\\"\" + str1 + \"\\\"\" + str8;\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 400 */ if (str2 != null) {\n/* 401 */ str10 = str10 + \", opaque=\\\"\" + str2 + \"\\\"\";\n/* */ }\n/* 403 */ if (str3 != null) {\n/* 404 */ str10 = str10 + \", cnonce=\\\"\" + str3 + \"\\\"\";\n/* */ }\n/* 406 */ if (bool) {\n/* 407 */ str10 = str10 + str9;\n/* */ }\n/* 409 */ return str10;\n/* */ }", "@Override\n\tpublic void processRequest(HttpRequest request, HttpResponse response) throws Exception {\n\t\tresponse.setHeaderField( \"Server-Name\", \"Las2peer 0.1\" );\n\t\tresponse.setContentType( \"text/xml\" );\n\t\t\n\t\t\n\t\t\n\t\tif(authenticate(request,response))\n\t\t\tif(invoke(request,response));\n\t\t\t\t//logout(_currentUserId);\n\t \n\t\n\t\t//connector.logMessage(request.toString());\n\t\t\n\t\t\n\t}", "public interface MiscEncoderDecoder {\n\n public Object encodeAuthResult(boolean authResult) throws Exception;\n\n public AuthResult decodeAuthResult(String authResultString) throws Exception;\n\n public Object encodeChallengeMessage(String trackingID, String challengeString) throws Exception;\n\n public ProofInfo decodeChallengeMessage(String challengeMessage) throws Exception;\n}", "@Test\n public void testSuccessfulSinglePar() throws Exception {\n try {\n // setup PAR realm settings\n int requestUriLifespan = 45;\n setParRealmSettings(requestUriLifespan);\n\n // create client dynamically\n String clientId = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.TRUE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation oidcCRep = getClientDynamically(clientId);\n String clientSecret = oidcCRep.getClientSecret();\n assertEquals(Boolean.TRUE, oidcCRep.getRequirePushedAuthorizationRequests());\n assertTrue(oidcCRep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, oidcCRep.getTokenEndpointAuthMethod());\n\n // Pushed Authorization Request\n oauth.clientId(clientId);\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n ParResponse pResp = oauth.doPushedAuthorizationRequest(clientId, clientSecret);\n assertEquals(201, pResp.getStatusCode());\n String requestUri = pResp.getRequestUri();\n assertEquals(requestUriLifespan, pResp.getExpiresIn());\n\n // Authorization Request with request_uri of PAR\n // remove parameters as query strings of uri\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUri);\n String state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n OAuthClient.AuthorizationEndpointResponse loginResponse = oauth.doLogin(TEST_USER_NAME, TEST_USER_PASSWORD);\n assertEquals(state, loginResponse.getState());\n String code = loginResponse.getCode();\n String sessionId =loginResponse.getSessionState();\n\n // Token Request\n oauth.redirectUri(CLIENT_REDIRECT_URI); // get tokens, it needed. https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3\n OAuthClient.AccessTokenResponse res = oauth.doAccessTokenRequest(code, clientSecret);\n assertEquals(200, res.getStatusCode());\n\n AccessToken token = oauth.verifyToken(res.getAccessToken());\n String userId = findUserByUsername(adminClient.realm(REALM_NAME), TEST_USER_NAME).getId();\n assertEquals(userId, token.getSubject());\n assertEquals(sessionId, token.getSessionState());\n // The following check is not valid anymore since file store does have the same ID, and is redundant due to the previous line\n // Assert.assertNotEquals(TEST_USER_NAME, token.getSubject());\n assertEquals(clientId, token.getIssuedFor());\n\n // Token Refresh\n String refreshTokenString = res.getRefreshToken();\n RefreshToken refreshToken = oauth.parseRefreshToken(refreshTokenString);\n assertEquals(sessionId, refreshToken.getSessionState());\n assertEquals(clientId, refreshToken.getIssuedFor());\n\n OAuthClient.AccessTokenResponse refreshResponse = oauth.doRefreshTokenRequest(refreshTokenString, clientSecret);\n assertEquals(200, refreshResponse.getStatusCode());\n\n AccessToken refreshedToken = oauth.verifyToken(refreshResponse.getAccessToken());\n RefreshToken refreshedRefreshToken = oauth.parseRefreshToken(refreshResponse.getRefreshToken());\n assertEquals(sessionId, refreshedToken.getSessionState());\n assertEquals(sessionId, refreshedRefreshToken.getSessionState());\n assertEquals(findUserByUsername(adminClient.realm(REALM_NAME), TEST_USER_NAME).getId(), refreshedToken.getSubject());\n\n // Logout\n oauth.doLogout(refreshResponse.getRefreshToken(), clientSecret);\n refreshResponse = oauth.doRefreshTokenRequest(refreshResponse.getRefreshToken(), clientSecret);\n assertEquals(400, refreshResponse.getStatusCode());\n\n } finally {\n restoreParRealmSettings();\n }\n }", "public static CommandResponse lookupMultipleFields(InternalRequestHeader header, CommandPacket commandPacket,\n String guid, ArrayList<String> fields,\n String reader, String signature, String message, Date timestamp,\n ClientRequestHandlerInterface handler) {\n ResponseCode errorCode = signatureAndACLCheckForRead(header, commandPacket, guid,\n null, //field\n fields,\n reader, signature, message, timestamp, handler.getApp());\n if (errorCode.isExceptionOrError()) {\n return new CommandResponse(errorCode, GNSProtocol.BAD_RESPONSE.toString() + \" \" + errorCode.getProtocolCode());\n }\n ValuesMap valuesMap;\n try {\n valuesMap = NSFieldAccess.lookupFieldsLocalNoAuth(header, guid, fields, ColumnFieldType.USER_JSON, handler);\n // note: reader can also be null here\n if (!header.verifyInternal()) {\n // don't strip internal fields when doing a read for other servers\n valuesMap = valuesMap.removeInternalFields();\n }\n return new CommandResponse(ResponseCode.NO_ERROR, valuesMap.toString()); // multiple field return\n } catch (FailedDBOperationException e) {\n return new CommandResponse(ResponseCode.DATABASE_OPERATION_ERROR, GNSProtocol.BAD_RESPONSE.toString()\n + \" \" + GNSProtocol.DATABASE_OPERATION_ERROR.toString() + \" \" + e);\n }\n\n }", "public interface NetworkAPI {\n //Login Screen\n @Multipart\n @POST(\"/doLogin\")\n void doLogin(@Part(\"email\") TypedString api,\n @Part(\"password\") TypedString password,\n @Part(\"action\") TypedString action,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n Callback<JsonObject> response);\n\n //Add services Screen\n @Multipart\n @POST(\"/getServices\")\n void getAllServices(@Part(\"action\") TypedString action,\n @Part(\"tabella\") TypedString tabella,\n @Part(\"user_id\") TypedString user_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n Callback<JsonObject> response);\n\n //Service details\n @Multipart\n @POST(\"/getServiceDetails\")\n void getServicesDetails(@Part(\"action\") TypedString action,\n @Part(\"tabella\") TypedString tabella,\n @Part(\"user_id\") TypedString user_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"service_id\") TypedString service_id,\n Callback<JsonObject> response);\n\n //Save service request\n @Multipart\n @POST(\"/SaveServiceRequest\")\n void saveServicesDetails(@Part(\"tabella\") TypedString tabella,\n @Part(\"action\") TypedString action,\n @Part(\"idDIP\") TypedString idDIP,\n @Part(\"campiSezD\") TypedString campiSezD,//static and mandatory\n @Part(\"bpAnnoMese\") TypedString bpAnnoMese,\n @Part(\"testiSezD\") TypedString testiSezD,//static and mandatory\n @Part(\"allegati\") TypedString allegati,//static and mandatory\n @Part(\"IBAN\") TypedString IBAN,\n @Part(\"IDServizio\") TypedString IDServizio,\n @Part(\"privacy1\") TypedString privacy1,\n @Part(\"privacy2\") TypedString privacy2,\n @Part(\"idBenef2\") TypedString company_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"bpFile\") TypedFile bpFile,\n @Part(\"stato_di_famiglia_o_certificato_di_paternitmaternit\") TypedFile stato_di_famiglia_o_certificato_di_paternitmaternit,\n @Part(\"rimborso_1\") TypedFile rimborso_1,\n @Part(\"rimborso_2\") TypedFile rimborso_2,\n @Part(\"rimborso_3\") TypedFile rimborso_3,\n @Part(\"rimborso_4\") TypedFile rimborso_4,\n @Part(\"rimborso_5\") TypedFile rimborso_5,\n @Part(\"rimborso_6\") TypedFile rimborso_6,\n @Part(\"rimborso_7\") TypedFile rimborso_7,\n @Part(\"rimborso_8\") TypedFile rimborso_8,\n @Part(\"rimborso_9\") TypedFile rimborso_9,\n @Part(\"rimborso_10\") TypedFile rimborso10,\n @Part(\"countAz\") TypedString countAz,\n @Part(\"parente\") TypedString parente,\n @Part(\"tipoParente\") TypedString tipoParente,\n @Part(\"cognomeParente\") TypedString cognomeParente,\n @Part(\"nomeParente\") TypedString nomeParente,\n @Part(\"luogoNascitaParente\") TypedString luogoNascitaParente,\n @Part(\"dtNascitaParente\") TypedString dtNascitaParente,\n @Part(\"certificato_medico_pediatra_o_ospedale\") TypedFile certificato_medico_pediatra_o_ospedale,\n @Part(\"attestazione_assenza_da_lavoro\") TypedFile attestazione_assenza_da_lavoro,\n @Part(\"cfParente\") TypedString cfParente,\n @Part(\"ProvNascita\") TypedString ProvNascita,\n @Part(\"lista_dipendenti\") TypedFile lista_dipendenti,\n @Part(\"stato_di_famiglia\") TypedFile stato_di_famiglia,\n @Part(\"ciFile\") TypedFile ciFile,\n @Part(\"ciScadenza\") TypedString ciScadenza,\n @Part(\"VisuraFile\") TypedFile VisuraFile,\n @Part(\"visuraData\") TypedString visuraData,\n @Part(\"stato_di_famiglia_o_attestazione_di_paternitmaternit\") TypedFile stato_di_famiglia_o_attestazione_di_paternitmaternit,\n @Part(\"elenco_libri_di_testo_certificato_dalla_scuola\") TypedFile elenco_libri_di_testo_certificato_dalla_scuola,\n @Part(\"certificato_di_nascita\")TypedFile certificato_di_nascita,\n @Part(\"certificato_di_invalidit_grave\")TypedFile certificato_di_invalidit_grave,\n @Part(\"certificato_di_nascita_o_di_adozione_del_figlio\")TypedFile certificato_di_nascita_o_di_adozione_del_figlio,\n @Part(\"stato_di_famiglia_o_attestazione_paternitmaternit\")TypedFile stato_di_famiglia_o_attestazione_paternitmaternit,\n @Part(\"attestato_di_iscrizione_a_scuola\")TypedFile attestato_di_iscrizione_a_scuola,\n @Part(\"stato_di_faiimglia_o_attestazione_paternitmaternit\")TypedFile stato_di_faiimglia_o_attestazione_paternitmaternit,\n @Part(\"elenco_di_dipendenti_per_i_quali_si_richiede_rimborso\")TypedFile elenco_di_dipendenti_per_i_quali_si_richiede_rimborso,\n @Part(\"elenco_allievi_in_formazione\")TypedFile elenco_allievi_in_formazione,\n @Part(\"verbale_accordo_sindacale\")TypedFile verbale_accordo_sindacale,\n @Part(\"attestazione_pagamento_dellultima_quota\")TypedFile attestazione_pagamento_dellultima_quota,\n @Part(\"elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"elenco_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"frontespizio_dvr_con_evidenza_data_certa\")TypedFile frontespizio_dvr_con_evidenza_data_certa,\n @Part(\"file_immagine_del_banner_promozionale_o_del_logo\")TypedFile file_immagine_del_banner_promozionale_o_del_logo,\n @Part(\"progetto_formativo_finanziato\")TypedFile progetto_formativo_finanziato,\n @Part(\"delibera_di_approvazione_del_progetto\")TypedFile delibera_di_approvazione_del_progetto,\n @Part(\"elenco_partecipanti_al_corso_cognome_nome_e_c_f_\")TypedFile elenco_partecipanti_al_corso_cognome_nome_e_c,\n\n @Part(\"certificazione_accreditamento_dellorganismo_di_formazione\")TypedFile certificazione_accreditamento_dellorganismo_di_formazione,\n @Part(\"cv_formatori\")TypedFile cv_formatori,\n @Part(\"calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti\")TypedFile calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti,\n @Part(\"allegatiDesc\")TypedString allegatiDesc,\n\n @Part(\"GIORNIASSENZA\")TypedString GIORNIASSENZA,\n @Part(\"corsoTitolo\")TypedString corsoTitolo,\n @Part(\"corsoOre\") TypedString corsoOre,\n @Part(\"RIMBORSO\")TypedString RIMBORSO,\n @Part(\"corsoImportoAllievo\") TypedString corsoImportoAllievo, // added by Mayur for the request which needs this parametr\n @Part(\"NALLIEVI\")TypedString NALLIEVI,\n @Part(\"ANNOISCRIZIONESCUOLA\") TypedString ANNOISCRIZIONESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"NOMESCUOLA\")TypedString NOMESCUOLA, // added by Mayur for the request which needs this parametr\n // @Part(\"codice_fiscale\")TypedFile codice_fiscale, //// added by Sanket for the request which needs this parametr\n Callback<JsonObject> response);\n\n//elenco_partecipanti_al_corso_cognome_nome_e_c_f_\n //Save service request without bp file\n @Multipart\n @POST(\"/SaveServiceRequest\")\n void saveServicesDetailsWithoutbpFile(@Part(\"tabella\") TypedString tabella,\n @Part(\"action\") TypedString action,\n @Part(\"idDIP\") TypedString idDIP,\n @Part(\"campiSezD\") TypedString campiSezD,//static and mandatory\n @Part(\"testiSezD\") TypedString testiSezD,//static and mandatory\n @Part(\"allegati\") TypedString allegati,//static and mandatory\n @Part(\"IBAN\") TypedString IBAN,\n @Part(\"IDServizio\") TypedString IDServizio,\n @Part(\"privacy1\") TypedString privacy1,\n @Part(\"privacy2\") TypedString privacy2,\n @Part(\"idBenef2\") TypedString company_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"bpFile\") TypedFile bpFile,\n @Part(\"stato_di_famiglia_o_certificato_di_paternitmaternit\") TypedFile stato_di_famiglia_o_certificato_di_paternitmaternit,\n @Part(\"rimborso_1\") TypedFile rimborso_1,\n @Part(\"rimborso_2\") TypedFile rimborso_2,\n @Part(\"rimborso_3\") TypedFile rimborso_3,\n @Part(\"rimborso_4\") TypedFile rimborso_4,\n @Part(\"rimborso_5\") TypedFile rimborso_5,\n @Part(\"rimborso_6\") TypedFile rimborso_6,\n @Part(\"rimborso_7\") TypedFile rimborso_7,\n @Part(\"rimborso_8\") TypedFile rimborso_8,\n @Part(\"rimborso_9\") TypedFile rimborso_9,\n @Part(\"rimborso_10\") TypedFile rimborso10,\n @Part(\"countAz\") TypedString countAz,\n @Part(\"parente\") TypedString parente,\n @Part(\"tipoParente\") TypedString tipoParente,\n @Part(\"cognomeParente\") TypedString cognomeParente,\n @Part(\"nomeParente\") TypedString nomeParente,\n @Part(\"luogoNascitaParente\") TypedString luogoNascitaParente,\n @Part(\"dtNascitaParente\") TypedString dtNascitaParente,\n @Part(\"certificato_medico_pediatra_o_ospedale\") TypedFile certificato_medico_pediatra_o_ospedale,\n @Part(\"attestazione_assenza_da_lavoro\") TypedFile attestazione_assenza_da_lavoro,\n @Part(\"cfParente\") TypedString cfParente,\n @Part(\"ProvNascita\") TypedString ProvNascita,\n @Part(\"lista_dipendenti\") TypedFile lista_dipendenti,\n @Part(\"stato_di_famiglia\") TypedFile stato_di_famiglia,\n @Part(\"ciFile\") TypedFile ciFile,\n @Part(\"ciScadenza\") TypedString ciScadenza,\n @Part(\"VisuraFile\") TypedFile VisuraFile,\n @Part(\"visuraData\") TypedString visuraData,\n @Part(\"stato_di_famiglia_o_attestazione_di_paternitmaternit\") TypedFile stato_di_famiglia_o_attestazione_di_paternitmaternit,\n @Part(\"elenco_libri_di_testo_certificato_dalla_scuola\") TypedFile elenco_libri_di_testo_certificato_dalla_scuola,\n @Part(\"certificato_di_nascita\")TypedFile certificato_di_nascita,\n @Part(\"certificato_di_invalidit_grave\")TypedFile certificato_di_invalidit_grave,\n @Part(\"certificato_di_nascita_o_di_adozione_del_figlio\")TypedFile certificato_di_nascita_o_di_adozione_del_figlio,\n @Part(\"stato_di_famiglia_o_attestazione_paternitmaternit\")TypedFile stato_di_famiglia_o_attestazione_paternitmaternit,\n @Part(\"attestato_di_iscrizione_a_scuola\")TypedFile attestato_di_iscrizione_a_scuola,\n @Part(\"stato_di_faiimglia_o_attestazione_paternitmaternit\")TypedFile stato_di_faiimglia_o_attestazione_paternitmaternit,\n @Part(\"elenco_di_dipendenti_per_i_quali_si_richiede_rimborso\")TypedFile elenco_di_dipendenti_per_i_quali_si_richiede_rimborso,\n @Part(\"elenco_allievi_in_formazione\")TypedFile elenco_allievi_in_formazione,\n @Part(\"verbale_accordo_sindacale\")TypedFile verbale_accordo_sindacale,\n @Part(\"attestazione_pagamento_dellultima_quota\")TypedFile attestazione_pagamento_dellultima_quota,\n @Part(\"elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"elenco_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"frontespizio_dvr_con_evidenza_data_certa\")TypedFile frontespizio_dvr_con_evidenza_data_certa,\n @Part(\"file_immagine_del_banner_promozionale_o_del_logo\")TypedFile file_immagine_del_banner_promozionale_o_del_logo,\n @Part(\"progetto_formativo_finanziato\")TypedFile progetto_formativo_finanziato,\n @Part(\"delibera_di_approvazione_del_progetto\")TypedFile delibera_di_approvazione_del_progetto,\n @Part(\"elenco_partecipanti_al_corso_cognome_nome_e_c_f_\")TypedFile elenco_partecipanti_al_corso_cognome_nome_e_c,\n\n @Part(\"certificazione_accreditamento_dellorganismo_di_formazione\")TypedFile certificazione_accreditamento_dellorganismo_di_formazione,\n @Part(\"cv_formatori\")TypedFile cv_formatori,\n @Part(\"calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti\")TypedFile calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti,\n @Part(\"allegatiDesc\")TypedString allegatiDesc,\n\n\n @Part(\"GIORNIASSENZA\")TypedString GIORNIASSENZA,\n @Part(\"corsoTitolo\")TypedString corsoTitolo,\n @Part(\"corsoOre\") TypedString corsoOre,\n @Part(\"RIMBORSO\")TypedString RIMBORSO,\n @Part(\"corsoImportoAllievo\") TypedString corsoImportoAllievo, // added by Mayur for the request which needs this parametr\n @Part(\"NALLIEVI\")TypedString NALLIEVI,\n @Part(\"ANNOISCRIZIONESCUOLA\") TypedString ANNOISCRIZIONESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"NOMESCUOLA\")TypedString NOMESCUOLA, // added by Mayur for the request which needs this parametr\n // @Part(\"codice_fiscale\")TypedFile codice_fiscale,\n Callback<JsonObject> response);\n\n\n\n //User Selection Screen\n @Multipart\n @POST(\"/doLogin\")\n void getUserType(@Part(\"email\") TypedString api,\n @Part(\"password\") TypedString password,\n @Part(\"action\") TypedString action,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"tipout\") TypedString user_type,\n Callback<JsonObject> response);\n\n //For company data without bpfile\n @Multipart\n @POST(\"/SaveServiceRequest\")\n void saveServicesDetailsForCompanyWithoutBpFile(@Part(\"tabella\") TypedString tabella,\n @Part(\"action\") TypedString action,\n @Part(\"idAZ\") TypedString idDIP,\n @Part(\"campiSezD\") TypedString campiSezD,//static and mandatory\n @Part(\"testiSezD\") TypedString testiSezD,//static and mandatory\n @Part(\"allegati\") TypedString allegati,//static and mandatory\n @Part(\"IBAN\") TypedString IBAN,\n @Part(\"IDServizio\") TypedString IDServizio,\n @Part(\"privacy1\") TypedString privacy1,\n @Part(\"privacy2\") TypedString privacy2,\n @Part(\"idBenef2\") TypedString company_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"bpFile\") TypedFile bpFile,\n @Part(\"stato_di_famiglia_o_certificato_di_paternitmaternit\") TypedFile stato_di_famiglia_o_certificato_di_paternitmaternit,\n @Part(\"rimborso_1\") TypedFile rimborso_1,\n @Part(\"rimborso_2\") TypedFile rimborso_2,\n @Part(\"rimborso_3\") TypedFile rimborso_3,\n @Part(\"rimborso_4\") TypedFile rimborso_4,\n @Part(\"rimborso_5\") TypedFile rimborso_5,\n @Part(\"rimborso_6\") TypedFile rimborso_6,\n @Part(\"rimborso_7\") TypedFile rimborso_7,\n @Part(\"rimborso_8\") TypedFile rimborso_8,\n @Part(\"rimborso_9\") TypedFile rimborso_9,\n @Part(\"rimborso_10\") TypedFile rimborso10,\n @Part(\"countAz\") TypedString countAz,\n @Part(\"parente\") TypedString parente,\n @Part(\"tipoParente\") TypedString tipoParente,\n @Part(\"cognomeParente\") TypedString cognomeParente,\n @Part(\"nomeParente\") TypedString nomeParente,\n @Part(\"luogoNascitaParente\") TypedString luogoNascitaParente,\n @Part(\"dtNascitaParente\") TypedString dtNascitaParente,\n @Part(\"certificato_medico_pediatra_o_ospedale\") TypedFile certificato_medico_pediatra_o_ospedale,\n @Part(\"attestazione_assenza_da_lavoro\") TypedFile attestazione_assenza_da_lavoro,\n @Part(\"cfParente\") TypedString cfParente,\n @Part(\"ProvNascita\") TypedString ProvNascita,\n @Part(\"lista_dipendenti\") TypedFile lista_dipendenti,\n @Part(\"stato_di_famiglia\") TypedFile stato_di_famiglia,\n @Part(\"ciFile\") TypedFile ciFile,\n @Part(\"ciScadenza\") TypedString ciScadenza,\n @Part(\"VisuraFile\") TypedFile VisuraFile,\n @Part(\"visuraData\") TypedString visuraData,\n @Part(\"stato_di_famiglia_o_attestazione_di_paternitmaternit\") TypedFile stato_di_famiglia_o_attestazione_di_paternitmaternit,\n @Part(\"elenco_libri_di_testo_certificato_dalla_scuola\") TypedFile elenco_libri_di_testo_certificato_dalla_scuola,\n @Part(\"certificato_di_nascita\")TypedFile certificato_di_nascita,\n @Part(\"certificato_di_invalidit_grave\")TypedFile certificato_di_invalidit_grave,\n @Part(\"certificato_di_nascita_o_di_adozione_del_figlio\")TypedFile certificato_di_nascita_o_di_adozione_del_figlio,\n @Part(\"stato_di_famiglia_o_attestazione_paternitmaternit\")TypedFile stato_di_famiglia_o_attestazione_paternitmaternit,\n @Part(\"attestato_di_iscrizione_a_scuola\")TypedFile attestato_di_iscrizione_a_scuola,\n @Part(\"stato_di_faiimglia_o_attestazione_paternitmaternit\")TypedFile stato_di_faiimglia_o_attestazione_paternitmaternit,\n @Part(\"elenco_di_dipendenti_per_i_quali_si_richiede_rimborso\")TypedFile elenco_di_dipendenti_per_i_quali_si_richiede_rimborso,\n @Part(\"elenco_allievi_in_formazione\")TypedFile elenco_allievi_in_formazione,\n @Part(\"verbale_accordo_sindacale\")TypedFile verbale_accordo_sindacale,\n @Part(\"attestazione_pagamento_dellultima_quota\")TypedFile attestazione_pagamento_dellultima_quota,\n @Part(\"elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"elenco_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"frontespizio_dvr_con_evidenza_data_certa\")TypedFile frontespizio_dvr_con_evidenza_data_certa,\n @Part(\"file_immagine_del_banner_promozionale_o_del_logo\")TypedFile file_immagine_del_banner_promozionale_o_del_logo,\n @Part(\"progetto_formativo_finanziato\")TypedFile progetto_formativo_finanziato,\n @Part(\"delibera_di_approvazione_del_progetto\")TypedFile delibera_di_approvazione_del_progetto,\n @Part(\"elenco_partecipanti_al_corso_cognome_nome_e_c_f_\")TypedFile elenco_partecipanti_al_corso_cognome_nome_e_c,\n\n @Part(\"certificazione_accreditamento_dellorganismo_di_formazione\")TypedFile certificazione_accreditamento_dellorganismo_di_formazione,\n @Part(\"cv_formatori\")TypedFile cv_formatori,\n @Part(\"calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti\")TypedFile calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti,\n @Part(\"allegatiDesc\")TypedString allegatiDesc,\n\n @Part(\"GIORNIASSENZA\")TypedString GIORNIASSENZA,\n @Part(\"corsoTitolo\")TypedString corsoTitolo,\n @Part(\"corsoOre\") TypedString corsoOre,\n @Part(\"RIMBORSO\")TypedString RIMBORSO,\n @Part(\"corsoImportoAllievo\") TypedString corsoImportoAllievo, // added by Mayur for the request which needs this parametr\n @Part(\"NALLIEVI\")TypedString NALLIEVI, // added by Mayur for the request which needs this parametr\n @Part(\"ANNOISCRIZIONESCUOLA\") TypedString ANNOISCRIZIONESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"NOMESCUOLA\")TypedString NOMESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"codice_fiscale\")TypedFile codice_fiscale,\n Callback<JsonObject> response);\n\n //For company data with bp file\n @Multipart\n @POST(\"/SaveServiceRequest\")\n void saveServicesDetailsForCompanyWithBpFile(@Part(\"tabella\") TypedString tabella,\n @Part(\"action\") TypedString action,\n @Part(\"idAZ\") TypedString idDIP,\n @Part(\"campiSezD\") TypedString campiSezD,//static and mandatory\n @Part(\"bpAnnoMese\") TypedString bpAnnoMese,\n @Part(\"testiSezD\") TypedString testiSezD,//static and mandatory\n @Part(\"allegati\") TypedString allegati,//static and mandatory\n @Part(\"IBAN\") TypedString IBAN,\n @Part(\"IDServizio\") TypedString IDServizio,\n @Part(\"privacy1\") TypedString privacy1,\n @Part(\"privacy2\") TypedString privacy2,\n @Part(\"idBenef2\") TypedString company_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"bpFile\") TypedFile bpFile,\n @Part(\"stato_di_famiglia_o_certificato_di_paternitmaternit\") TypedFile stato_di_famiglia_o_certificato_di_paternitmaternit,\n @Part(\"rimborso_1\") TypedFile rimborso_1,\n @Part(\"rimborso_2\") TypedFile rimborso_2,\n @Part(\"rimborso_3\") TypedFile rimborso_3,\n @Part(\"rimborso_4\") TypedFile rimborso_4,\n @Part(\"rimborso_5\") TypedFile rimborso_5,\n @Part(\"rimborso_6\") TypedFile rimborso_6,\n @Part(\"rimborso_7\") TypedFile rimborso_7,\n @Part(\"rimborso_8\") TypedFile rimborso_8,\n @Part(\"rimborso_9\") TypedFile rimborso_9,\n @Part(\"rimborso_10\") TypedFile rimborso10,\n @Part(\"countAz\") TypedString countAz,\n @Part(\"parente\") TypedString parente,\n @Part(\"tipoParente\") TypedString tipoParente,\n @Part(\"cognomeParente\") TypedString cognomeParente,\n @Part(\"nomeParente\") TypedString nomeParente,\n @Part(\"luogoNascitaParente\") TypedString luogoNascitaParente,\n @Part(\"dtNascitaParente\") TypedString dtNascitaParente,\n @Part(\"certificato_medico_pediatra_o_ospedale\") TypedFile certificato_medico_pediatra_o_ospedale,\n @Part(\"attestazione_assenza_da_lavoro\") TypedFile attestazione_assenza_da_lavoro,\n @Part(\"cfParente\") TypedString cfParente,\n @Part(\"ProvNascita\") TypedString ProvNascita,\n @Part(\"lista_dipendenti\") TypedFile lista_dipendenti,\n @Part(\"stato_di_famiglia\") TypedFile stato_di_famiglia,\n @Part(\"ciFile\") TypedFile ciFile,\n @Part(\"ciScadenza\") TypedString ciScadenza,\n @Part(\"VisuraFile\") TypedFile VisuraFile,\n @Part(\"visuraData\") TypedString visuraData,\n @Part(\"stato_di_famiglia_o_attestazione_di_paternitmaternit\") TypedFile stato_di_famiglia_o_attestazione_di_paternitmaternit,\n @Part(\"elenco_libri_di_testo_certificato_dalla_scuola\") TypedFile elenco_libri_di_testo_certificato_dalla_scuola,\n @Part(\"certificato_di_nascita\")TypedFile certificato_di_nascita,\n @Part(\"certificato_di_invalidit_grave\")TypedFile certificato_di_invalidit_grave,\n @Part(\"certificato_di_nascita_o_di_adozione_del_figlio\")TypedFile certificato_di_nascita_o_di_adozione_del_figlio,\n @Part(\"stato_di_famiglia_o_attestazione_paternitmaternit\")TypedFile stato_di_famiglia_o_attestazione_paternitmaternit,\n @Part(\"attestato_di_iscrizione_a_scuola\")TypedFile attestato_di_iscrizione_a_scuola,\n @Part(\"stato_di_faiimglia_o_attestazione_paternitmaternit\")TypedFile stato_di_faiimglia_o_attestazione_paternitmaternit,\n @Part(\"elenco_di_dipendenti_per_i_quali_si_richiede_rimborso\")TypedFile elenco_di_dipendenti_per_i_quali_si_richiede_rimborso,\n @Part(\"elenco_allievi_in_formazione\")TypedFile elenco_allievi_in_formazione,\n @Part(\"verbale_accordo_sindacale\")TypedFile verbale_accordo_sindacale,\n @Part(\"attestazione_pagamento_dellultima_quota\")TypedFile attestazione_pagamento_dellultima_quota,\n @Part(\"elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dei_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"elenco_dipendenti_che_hanno_sostenuto_la_visita_medica\")TypedFile elenco_dipendenti_che_hanno_sostenuto_la_visita_medica,\n @Part(\"frontespizio_dvr_con_evidenza_data_certa\")TypedFile frontespizio_dvr_con_evidenza_data_certa,\n @Part(\"file_immagine_del_banner_promozionale_o_del_logo\")TypedFile file_immagine_del_banner_promozionale_o_del_logo,\n @Part(\"progetto_formativo_finanziato\")TypedFile progetto_formativo_finanziato,\n @Part(\"delibera_di_approvazione_del_progetto\")TypedFile delibera_di_approvazione_del_progetto,\n @Part(\"elenco_partecipanti_al_corso_cognome_nome_e_c_f_\")TypedFile elenco_partecipanti_al_corso_cognome_nome_e_c,\n\n @Part(\"certificazione_accreditamento_dellorganismo_di_formazione\")TypedFile certificazione_accreditamento_dellorganismo_di_formazione,\n @Part(\"cv_formatori\")TypedFile cv_formatori,\n @Part(\"calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti\")TypedFile calendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti,\n @Part(\"allegatiDesc\")TypedString allegatiDesc,\n\n @Part(\"GIORNIASSENZA\")TypedString GIORNIASSENZA,\n @Part(\"corsoTitolo\")TypedString corsoTitolo,\n @Part(\"corsoOre\") TypedString corsoOre,\n @Part(\"RIMBORSO\")TypedString RIMBORSO,\n @Part(\"corsoImportoAllievo\") TypedString corsoImportoAllievo, // added by Mayur for the request which needs this parametr\n @Part(\"NALLIEVI\")TypedString NALLIEVI,\n @Part(\"ANNOISCRIZIONESCUOLA\") TypedString ANNOISCRIZIONESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"NOMESCUOLA\")TypedString NOMESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"codice_fiscale\")TypedFile codice_fiscale, // added by Sanket for the request which needs this parametr\n Callback<JsonObject> response);\n/*certificazione_accreditamento_dellorganismo_di_formazione,\ncv_formatori,\ncalendario_attivit_formativa_con_date_ora_sede_formatori_e_contenuti\nallegatiDesc*/\n\n //Service details\n /*@Multipart\n @POST(\"/changePassword\")\n void changePassword(@Part(\"action\") TypedString action,\n @Part(\"tabella\") TypedString tabella,\n @Part(\"existing_password\") TypedString existing_password,\n @Part(\"new_password\") TypedString new_password,\n @Part(\"confirm_password\") TypedString confirm_password,\n Callback<JsonObject> response);*/\n\n @GET(\"/index_production.php\")\n void changePassword(@Query(\"action\") String action,\n @Query(\"tabella\") String tabella,\n @Query(\"existing_password\") String existing_password,\n @Query(\"new_password\") String new_password,\n @Query(\"confirm_password\") String confirm_password,\n @Query(\"user_id\") String user_id,\n Callback<JsonObject> response);\n\n //@Query(\"action\") String action,\n\n @GET(\"/getUserServices\")\n void requestService(@Query(\"action\") String action,\n @Query(\"tabella\") String tabella,\n @Query(\"user_id\") String user_id,\n Callback<JsonObject> response);\n\n\n @GET(\"/getVersionList\")\n // @GET(\"/index_new.php\")\n void getVersameti(@Query(\"action\") String action,\n @Query(\"tabella\") String tabella,\n @Query(\"user_id\") String user_id,\n Callback<JsonObject> response);\n\n @GET(\"/updateVersionList\")\n void editVersameti(@Query(\"action\") String action,\n @Query(\"tabella\") String tabella,\n @Query(\"user_id\") String user_id,\n @Query(\"AzNome\") String AzNome,\n @Query(\"AnnoComp\") String AnnoComp,\n @Query(\"cf\") String cf,\n @Query(\"piva\") String piva,\n @Query(\"ebv_ver\") String ebv_ver,\n @Query(\"INPS\") String INPS,\n @Query(\"GEN\") String GEN,\n @Query(\"FEB\") String FEB,\n @Query(\"MAR\") String MAR,\n @Query(\"APR\") String APR,\n @Query(\"MAG\") String MAG,\n @Query(\"GIU\") String GIU,\n @Query(\"LUG\") String LUG,\n @Query(\"AGO\") String AGO,\n @Query(\"SET\") String SET,\n @Query(\"OTT\") String OTT,\n @Query(\"NOV\") String NOV,\n @Query(\"DIC\") String DIC,\n Callback<JsonObject> response);\n\n @GET(\"/getSeatList\")\n void getSedi(@Query(\"action\") String action,\n @Query(\"tabella\") String tabella,\n @Query(\"user_id\") String user_id,\n Callback<JsonObject> response);\n\n /* http://www.ebveneto.it/web_services/index_new.php?action=updateSeatList&tabella=Aziende&user_id=00097A&idSede=&\n // Nome=&Via=&Cap=&Comune=&Frazione=&Prov=&Tipo=&fonte=*/\n\n @GET(\"/updateSeatList\")\n void editSedi(@Query(\"action\") String action,\n @Query(\"tabella\") String tabella,\n @Query(\"user_id\") String user_id,\n @Query(\"idSede\") String idSede,\n @Query(\"Nome\") String Nome,\n @Query(\"Via\") String Via,\n @Query(\"Cap\") String Cap,\n @Query(\"Comune\") String Comune,\n @Query(\"Frazione\") String Frazione,\n @Query(\"Prov\") String Prov,\n @Query(\"Tipo\") String Tipo,\n @Query(\"fonte\") String fonte,\n Callback<JsonObject> response);\n\n\n @Multipart\n @POST(\"/updateUserConsent\")\n void updateUserConsent(@Part(\"tabella\") TypedString tabella,\n @Part(\"id\") TypedString user_id,\n @Part(\"action\") TypedString action,\n Callback<JsonObject> response);\n\n\n //Save service request\n @Multipart\n @POST(\"/SaveServiceRequest\")\n void saveServicesDetails(@Part(\"tabella\") TypedString tabella,\n @Part(\"action\") TypedString action,\n @PartMap Map<String, TypedString> userId,\n @Part(\"campiSezD\") TypedString campiSezD,//static and mandatory\n // @Part(\"bpAnnoMese\") TypedString bpAnnoMese,\n @Part(\"testiSezD\") TypedString testiSezD,//static and mandatory\n @Part(\"allegati\") TypedString allegati,//static and mandatory\n @Part(\"IBAN\") TypedString IBAN,\n @Part(\"IDServizio\") TypedString IDServizio,\n @Part(\"privacy1\") TypedString privacy1,\n @Part(\"privacy2\") TypedString privacy2,\n @Part(\"idBenef2\") TypedString company_id,\n @Part(\"is_mobile_request\") TypedString is_mobile_request,\n @Part(\"countAz\") TypedString countAz,\n @Part(\"parente\") TypedString parente,\n @Part(\"tipoParente\") TypedString tipoParente,\n @Part(\"cognomeParente\") TypedString cognomeParente,\n @Part(\"nomeParente\") TypedString nomeParente,\n @Part(\"luogoNascitaParente\") TypedString luogoNascitaParente,\n @Part(\"dtNascitaParente\") TypedString dtNascitaParente,\n @Part(\"cfParente\") TypedString cfParente,\n @Part(\"ProvNascita\") TypedString ProvNascita,\n @Part(\"ciScadenza\") TypedString ciScadenza,\n @Part(\"visuraData\") TypedString visuraData,\n @Part(\"allegatiDesc\")TypedString allegatiDesc,\n @Part(\"GIORNIASSENZA\")TypedString GIORNIASSENZA,\n @Part(\"corsoTitolo\")TypedString corsoTitolo,\n @Part(\"corsoOre\") TypedString corsoOre,\n @Part(\"RIMBORSO\")TypedString RIMBORSO,\n @Part(\"corsoImportoAllievo\") TypedString corsoImportoAllievo, // added by Mayur for the request which needs this parametr\n @Part(\"NALLIEVI\")TypedString NALLIEVI,\n @Part(\"ANNOISCRIZIONESCUOLA\") TypedString ANNOISCRIZIONESCUOLA, // added by Mayur for the request which needs this parametr\n @Part(\"NOMESCUOLA\")TypedString NOMESCUOLA, // added by Mayur for the request which needs this parametr\n @PartMap Map<String, TypedFile> dynamicFiles,\n Callback<JsonObject> response);\n\n @GET(\"/index_production_march19.php?action=getAppVersion&type=android\")\n void updateAvailable(Callback<JsonObject> response);\n\n @Multipart\n @POST(\"/uploadAttach\")\n void uploadAttachment(\n @Part(\"user_id\") TypedString user_id,\n @Part(\"ids\") TypedString ids,\n @PartMap Map<String, TypedFile> dynamicFiles,\n @Part(\"action\") TypedString action,\n Callback<JsonObject> response);\n\n}", "public void handlePost( HttpExchange exchange ) throws IOException {\n switch( exchange.getRequestURI().toString().replace(\"%20\", \" \") ) {\n // the web client wants to submit a log in request\n case \"/log-in\":\n // get the body of the HttpExchange\n String body = getBody(exchange);\n print(\"BODY: \\n\" + body);\n if ( body.equals(\"-1\") == true) { // if the body is empty\n sendResponse(exchange, new byte[0], 204);\n // HTTP Response code 204 - no content\n } else {\n\n String[] content = body.split(\"&\");\n //pos 0 : username=<content>; pos 1 : password=<content>; pos 2 : <submit type>\n\n String username = content[0].split(\"=\")[1];\n String password = content[1].split(\"=\")[1];\n\n //check database\n if( username.equals(\"james\") && password.equals(\"123\")) {\n print(\"Username and Password Match\");\n sendResponse(exchange, getHTMLPage(\"/home.html\"), 200); // this will be changed to a redirect notice\n // set client as logged in\n logged_in = true;\n\n// sendResponse(exchange, getPanel(exchange, \"home.html\"), 200);\n } else {\n sendResponse(exchange, new byte[0], 406);\n // send HTTP Response code 406 - Not acceptable\n }\n }\n\n break;\n case \"/home\":\n\n default:\n print(\"Body:\");\n print( getBody(exchange) );\n sendResponse(exchange, htmlBuilder( \"Not Implemented\", \"Http Error 501: Not Implemented\").getBytes(), 501);\n break;\n }\n // got body response .. check form sending to - if form is login then get username and password combo\n }", "private void parseCompleteReqMessage() {\r\n byte result = _partialMessage.get(0);\r\n byte opCode = _partialMessage.get(1);\r\n byte numberOfParams = _partialMessage.get(2);\r\n\r\n /* cursor of bytes within 'message'. Parameters start at position 2 */\r\n int messageIndex = 3;\r\n int availableChars = (int) _partialMessage.size();\r\n\r\n List<String> paramList = new ArrayList<>();\r\n String param;\r\n\r\n for (byte i = 0; (i < numberOfParams) && (messageIndex < availableChars); i++) {\r\n param = \"\";\r\n\r\n /* collect data up to terminator */\r\n while ((messageIndex < availableChars) &&\r\n (_partialMessage.get(messageIndex) != '\\0')) {\r\n param += (char)((byte)(_partialMessage.get(messageIndex)));\r\n ++ messageIndex;\r\n }\r\n\r\n /* skip after terminator */\r\n if (messageIndex < availableChars) {\r\n ++ messageIndex;\r\n }\r\n\r\n paramList.add( param);\r\n }\r\n\r\n _replyDispatcher.onReplyReceivedForRequest(opCode, result, paramList);\r\n }", "@Test\n public void testFailureParUsedTwice() throws Exception {\n // create client dynamically\n String clientId = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.TRUE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation oidcCRep = getClientDynamically(clientId);\n String clientSecret = oidcCRep.getClientSecret();\n assertEquals(Boolean.TRUE, oidcCRep.getRequirePushedAuthorizationRequests());\n assertTrue(oidcCRep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, oidcCRep.getTokenEndpointAuthMethod());\n\n // Pushed Authorization Request\n oauth.clientId(clientId);\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n ParResponse pResp = oauth.doPushedAuthorizationRequest(clientId, clientSecret);\n assertEquals(201, pResp.getStatusCode());\n String requestUri = pResp.getRequestUri();\n\n // Authorization Request with request_uri of PAR\n // remove parameters as query strings of uri\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUri);\n String state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n OAuthClient.AuthorizationEndpointResponse loginResponse = oauth.doLogin(TEST_USER_NAME, TEST_USER_PASSWORD);\n assertEquals(state, loginResponse.getState());\n String code = loginResponse.getCode();\n\n // Token Request\n oauth.redirectUri(CLIENT_REDIRECT_URI); // get tokens, it needed. https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3\n OAuthClient.AccessTokenResponse res = oauth.doAccessTokenRequest(code, clientSecret);\n assertEquals(200, res.getStatusCode());\n\n // Authorization Request with request_uri of PAR\n // use same redirect_uri\n state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n UriBuilder b = UriBuilder.fromUri(oauth.getLoginFormUrl());\n driver.navigate().to(b.build().toURL());\n OAuthClient.AuthorizationEndpointResponse errorResponse = new OAuthClient.AuthorizationEndpointResponse(oauth);\n Assert.assertFalse(errorResponse.isRedirected());\n }", "@Override\n public AuthenticatorFlowStatus process(HttpServletRequest request, HttpServletResponse response,\n AuthenticationContext context) throws AuthenticationFailedException {\n if (context.isLogoutRequest()) {\n return AuthenticatorFlowStatus.SUCCESS_COMPLETED;\n }\n\n if (StringUtils.isNotEmpty(request.getParameter(\"tcParam\"))) {\n try {\n processAuthenticationResponse(request, response, context);\n } catch (Exception e) {\n context.setRetrying(true);\n context.setCurrentAuthenticator(getName());\n return initiateAuthRequest(response, context, e.getMessage());\n }\n return AuthenticatorFlowStatus.SUCCESS_COMPLETED;\n } else {\n return initiateAuthRequest(response, context, null);\n }\n }", "interface PodAuthService {\n @FormUrlEncoded\n @POST(\"/oauth/token\")\n Observable<Auth> authenticate(\n @Field(\"grant_type\") String grantType,\n @Field(\"username\") String username,\n @Field(\"password\") String password,\n @Field(\"client_id\") String clientId,\n @Field(\"client_secret\") String clientSecret\n );\n\n @FormUrlEncoded\n @POST(\"/oauth/token\")\n Observable<Auth> refreshToken(\n @Field(\"grant_type\") String grantType,\n @Field(\"client_id\") String clientId,\n @Field(\"client_secret\") String clientSecret,\n @Field(\"refresh_token\") String refreshToken\n );\n}", "public interface getAuth {\n @FormUrlEncoded\n @POST(\"auth/facebook\")\n Call<AuthResponse> facebookUserAuth(\n @Field(\"access_token\") String access_token,\n @Field(\"user_id\") String user_id,\n @Field(\"firebase_token\") String firebase_token\n );\n @FormUrlEncoded\n @POST(\"auth/fbUpdateAcessToken\")\n Call<AuthResponse> facebookTokenUpdate(\n @Field(\"access_token\") String access_token,\n @Field(\"user_id\") String user_id\n );\n\n @FormUrlEncoded\n @POST(\"auth/updateFcmToken\")\n Call<AuthResponse> fcmTokenUpdate(\n @Field(\"token\") String fcmToken,\n @Field(\"user_id\") String userId\n );\n\n @FormUrlEncoded\n @POST(\"auth/updateTopics\")\n Call<AuthResponse> updateUserTopics(\n @Field(\"user_topics\") String user_topics,\n @Field(\"user_id\") String user_id\n );\n\n @FormUrlEncoded\n @POST(\"auth/updateNotification\")\n Call<AuthResponse> updateNotification(\n @Field(\"user_id\") String user_id,\n @Field(\"notification\") Boolean notification\n );\n\n @FormUrlEncoded\n @POST(\"auth/saveFcm\")\n Call<FcmKey> saveFcm(\n @Field(\"fcmToken\") String fcmToken\n );\n\n}", "public void handle(PBFTMetaData receivedMD) {\n if(isValid(receivedMD)){\n MetaDataSubject mds = getDecision(receivedMD);\n if(mds != null){\n /* update the partition table with all received and certified subpartitions. */\n PartList subparts = (PartList) mds.getInfo(MetaDataSubject.SUBPARTS);\n \n updateParttable(subparts);\n \n try{\n doStepNextStateTransfer(receivedMD.getReplicaID(), null);\n }catch(Exception except){\n except.printStackTrace();\n }\n \n }//end received meta-data is certificated\n }//end received meta-data is validated\n }", "public String[] submissionResponse(String input)\n\t{\n\t\tinput = tselDecrypt(key,input);\n\n\t\tsubmissionResponse=input.split(\"@~|\");\n\n\t\treturn submissionResponse;\n\t}", "@Test\n public void shouldIgnoreMoreThanOneColon() {\n String decodeString = \"U2VyZ2VhbnQgQ29sb246b3dlZCB0aGlydHkgeWVhcnMgb2YgaGFwcHkgbWFycmlhZ2UgdG8gdGhlIGZhY3QgdGhhdCBNcnMuIENvbG9uOndvcmtlZCBhbGwgZGF5IGFuZCBTYXJnZW50IENvbG9uIHdvcmtlZCBhbGwgbmlnaHQu\";\n assertThat(\"Two elements is present\", BasicAuth.decode(decodeString), is(arrayWithSize(2)));\n assertThat(\"Username is contained\", BasicAuth.decode(decodeString), is(hasItemInArray(\"Sergeant Colon\")));\n assertThat(\"Password is contained\", BasicAuth.decode(decodeString), is(hasItemInArray(\"owed thirty years of happy marriage to the fact that Mrs. Colon:worked all day and Sargent Colon worked all night.\")));\n\n // Encoded \"They:communicated:by:means:of:notes.:They:had:three:grown-up:children,:all:born,:Vimes:had:assumed,:as:a:result:of:extremely:persuasive:handwriting.\" as Base64\n decodeString = \"VGhleTpjb21tdW5pY2F0ZWQ6Ynk6bWVhbnM6b2Y6bm90ZXMuOlRoZXk6aGFkOnRocmVlOmdyb3duLXVwOmNoaWxkcmVuLDphbGw6Ym9ybiw6VmltZXM6aGFkOmFzc3VtZWQsOmFzOmE6cmVzdWx0Om9mOmV4dHJlbWVseTpwZXJzdWFzaXZlOmhhbmR3cml0aW5nLg==\";\n assertThat(\"Two elements is present\", BasicAuth.decode(decodeString), is(arrayWithSize(2)));\n assertThat(\"Username is contained\", BasicAuth.decode(decodeString), is(hasItemInArray(\"They\")));\n assertThat(\"Password is contained\", BasicAuth.decode(decodeString), is(hasItemInArray(\"communicated:by:means:of:notes.:They:had:three:grown-up:children,:all:born,:Vimes:had:assumed,:as:a:result:of:extremely:persuasive:handwriting.\")));\n }", "private void trappingResponse(ComputingResponse resp, long sourceIF, long destIF){\n\n\t\tlog.info(\"First ERO SubObject type \"+resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().getFirst().getClass());\n\t\tlog.info(\"Second ERO SubObject type \"+resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().get(1).getClass());\n\t\tlog.info(\"Last ERO SubObject type \"+resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().getLast().getClass());\n\t\tInet4Address firstIP=((UnnumberIfIDEROSubobject)resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().getFirst()).getRouterID();\n\n\t\tEROSubobject label= resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().get(1);\n\t\tresp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().add(0, label);\n\n\t\tUnnumberIfIDEROSubobject firsteroso= new UnnumberIfIDEROSubobject();\n\t\tfirsteroso.setRouterID(firstIP);\n\t\tfirsteroso.setInterfaceID(sourceIF);\n\t\tfirsteroso.setLoosehop(false);\n\t\tresp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().add(0, firsteroso);\n\n\n\t\tint size=resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().size();\n\t\tInet4Address lastIP=((IPv4prefixEROSubobject)resp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().getLast()).getIpv4address();\n\t\tresp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().removeLast();\n\t\tUnnumberIfIDEROSubobject lasteroso= new UnnumberIfIDEROSubobject();\n\t\tlasteroso.setRouterID(lastIP);\n\t\tlasteroso.setInterfaceID(destIF);\n\t\tlasteroso.setLoosehop(false);\n\t\tresp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().add(lasteroso);\n\t\tresp.getResponseList().get(0).getPath(0).geteRO().getEROSubobjectList().add(label);\n\t}", "@Test\n public void useTwiceTheSameToken() throws IOException {\n tokenConsumption();\n // then set the password for the user (and so valid the token)\n String userTokenPath = getPath(\"/api/users/token/{token}\");\n UserPasswordDTO dto = new UserPasswordDTO();\n dto.setPassword(\"test\");\n JsonNode json = objectMapper.valueToTree(dto);\n\n HttpEntity<JsonNode> requestEntity = new HttpEntity<>(json);\n ResponseEntity<String> userResponseEntity =\n rest.exchange(userTokenPath, HttpMethod.PATCH, requestEntity, String.class, token.getToken());\n assertEquals(userResponseEntity.getStatusCode(), HttpStatus.OK);\n // second time KO\n ResponseEntity<String> responseEntity = rest.getForEntity(apiPath, String.class, token.getToken());\n\n assertEquals(HttpStatus.GONE, responseEntity.getStatusCode());\n\n ErrorResponse errorResponse = objectMapper.readValue(responseEntity.getBody(), ErrorResponse.class);\n assertEquals(HttpStatus.GONE.value(), errorResponse.getStatus());\n }", "@Override\n protected CommonResponse doAuthentication(MultifactorStartRegistrationResponseData startRegistrationData, MultifactorStartAuthenticationResponseData startAuthenticationData) throws ApiException {\n return finishAuthentication(BACKUP_STRING_PROVIDER,\n startRegistrationData.getDeviceId(),\n startRegistrationData.getChallenge().getSharedSecret(),\n null,\n null,\n null);\n }", "public interface AuthAdapter {\n\n @POST(AUTH + \"signin\")\n @Headers(\"Content-type: application/json\")\n Call<LoginResponse> login(@Body LoginRequest request);\n\n @POST(AUTH + \"signup\")\n @Headers(\"Content-type: application/json; charset=UTF-8\")\n Call<RegistrationResponse> registration(@Body RegistrationRequest request);\n\n}", "public void handleResponse(final Message message, HttpStatus status, JSONArray results) {\n // check for the simplest mistake\n if (status == HttpStatus.BAD_REQUEST) {\n // the request json was malformed\n logger.error(\"The JSON message was ill-formed\");\n logger.error(\"Request: \" + message.generateRequest());\n return;\n } else if (status == HttpStatus.UNAUTHORIZED) {\n logger.error(\"Server Key was incorrect.\");\n return;\n }\n\n String[] registrationIds = message.getRecipientTokens();\n if (registrationIds == null) {\n logger.error(\"The registration ids were null for customer: \" + message.getUsername());\n logger.error(\"With message: \" + message.generateRequest());\n return;\n }\n\n if (registrationIds.length != results.length()) {\n // The mismatch between the request and the response\n logger.error(\"Mismatched request and response\");\n logger.error(\"Request: \" + message.generateRequest());\n logger.error(\"Response: \" + results.toString());\n return;\n }\n\n // everything okay, start processing the response\n try {\n for (int i = 0; i < results.length(); i++) {\n JSONObject result = results.getJSONObject(i);\n if (result.has(\"error\")) {\n // the result has an error\n String error = result.getString(\"error\");\n if (status == HttpStatus.OK) {\n if (error.equals(\"MissingRegistration\")) {\n logger.error(\"The request was missing registration id\");\n logger.error(message.generateRequest());\n } else if (error.equals(\"InvalidRegistration\")) {\n // the registration id sent was invalid, may be due\n // to\n // added characters\n logger.error(\"The registration token was invalid:\");\n logger.error(\n \"Customer ID: \" + message.getUsername() + \" Message: \" + message.generateRequest());\n logger.error(\"Removed the token from the database\");\n removeToken(message.getUsername(), registrationIds[i]);\n } else if (error.equals(\"NotRegistered\")) {\n // existing token is invalid due to\n // 1. app unregistered with fcm\n // 2. uninstalled application\n // 3. token expires\n // 4. app updated but the updated app is not\n // configured\n // to receive messages\n // remove the token from the database\n removeToken(message.getUsername(), registrationIds[i]);\n } else if (error.equals(\"InvalidPackageName\")) {\n // the package name was invalid\n logger.error(\"The package name was found to be invalid\");\n logger.error(message.generateRequest());\n } else if (error.equals(\"MismatchSenderId\")) {\n // the sender id was invalid to send messages\n logger.error(\"The Sender Id was invalid\");\n logger.error(message.generateRequest());\n } else if (error.equals(\"MessageTooBig\")) {\n logger.error(\"Message Body found to be too big\");\n } else if (error.equals(\"InvalidTtl\")) {\n logger.error(\"TTL was invalid\");\n logger.error(message.generateRequest());\n } else if (error.equals(\"InvalidDataKey\")) {\n logger.error(\"The message contains invalid keys\");\n logger.error(message.generateRequest());\n } else if (error.equals(\"DeviceMessageRateExceeded\")) {\n // the device message rate has been exceeded\n } else if (error.equals(\"TopicsMessageRateExceeded\")) {\n // the topic has exceeded its message rate\n logger.error(\"The Topic has exceeded its message rate\");\n }\n }\n // these errors are common to multiple types of statuses\n if (error.equals(\"Unavailable\") || error.equals(\"InternalServerError\")) {\n // TODO retry exponentially\n delayScheduler.schedule(new TimerTask() {\n\n @Override\n public void run() {\n sendMessage(message);\n\n }\n }, delayGenerator.nextInt(50000) + 10000);\n // delay of random to 10000 to 50000 milli seconds\n }\n } else if (result.has(\"registration_id\")) {\n // the message sent was successful but need to update the\n // key\n replaceToken(message.getUsername(), result.getString(\"registration_id\"), registrationIds[i]);\n }\n }\n } catch (JSONException e) {\n // log error could not parse the result\n logger.error(\"The response message could not be parsed: \");\n logger.error(Arrays.toString(e.getStackTrace()));\n }\n }", "public static HelloAuthenticatedResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n HelloAuthenticatedResponse object =\n new HelloAuthenticatedResponse();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"helloAuthenticatedResponse\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (HelloAuthenticatedResponse)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://ws.sample\",\"return\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.set_return(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "@Test\n\tpublic void testAssertSignedAuthnResponseProcessing() throws Exception {\n\t\tthis.initStorageWithAuthnRequest();\n\t\tthis.testAuthnResponseProcessingScenario1(this.responseAssertSigned);\n\t}", "protected void handleRequest(dk.i1.diameter.Message request, ConnectionKey connkey, Peer peer) {\n\n String log = \"\";\n Message answer = new Message();\n answer.prepareResponse(request);\n AVP avp;\n avp = request.find(ProtocolConstants.DI_SESSION_ID);\n if (avp != null)\n answer.add(avp);\n node().addOurHostAndRealm(answer);\n //avp = request.find(ProtocolConstants.DI_CC_REQUEST_TYPE); DIAMETER_COMMAND_AA\n avp = request.find(ProtocolConstants.DI_AUTH_REQUEST_TYPE);\n if (avp == null) {\n answerError(answer, connkey, ProtocolConstants.DIAMETER_RESULT_MISSING_AVP,\n new AVP[]{new AVP_Grouped(ProtocolConstants.DI_FAILED_AVP, new AVP[]{new AVP(ProtocolConstants.DI_AUTH_REQUEST_TYPE, new byte[]{})})});\n return;\n }\n\n\n int aa_request_type = -1;\n try {\n aa_request_type = new AVP_Unsigned32(avp).queryValue();\n } catch (InvalidAVPLengthException ex) {\n }\n if (aa_request_type != ProtocolConstants.DI_AUTH_REQUEST_TYPE_AUTHENTICATE &&\n aa_request_type != ProtocolConstants.DI_AUTH_REQUEST_TYPE_AUTHENTICATE_ONLY &&\n aa_request_type != ProtocolConstants.DI_AUTH_REQUEST_TYPE_AUTHORIZE_ONLY) {\n answerError(answer, connkey, ProtocolConstants.DIAMETER_RESULT_INVALID_AVP_VALUE,\n new AVP[]{new AVP_Grouped(ProtocolConstants.DI_FAILED_AVP, new AVP[]{avp})});\n return;\n }\n\n\n\n avp = request.find(ProtocolConstants.DI_AUTH_APPLICATION_ID);\n if (avp != null)\n answer.add(avp);\n avp = request.find(ProtocolConstants.DI_AUTH_REQUEST_TYPE);\n if (avp != null)\n answer.add(avp);\n\n\n switch (aa_request_type) {\n case ProtocolConstants.DI_AUTH_REQUEST_TYPE_AUTHENTICATE_ONLY:\n case ProtocolConstants.DI_AUTH_REQUEST_TYPE_AUTHENTICATE:\n //grant whatever is requested\n avp = request.find(ProtocolConstants.DI_USER_NAME);\n answer.add(avp);\n String userName = new AVP_UTF8String(avp).queryValue();\n avp = request.find(ProtocolConstants.DI_USER_PASSWORD);\n String userPassword = new AVP_UTF8String(avp).queryValue();\n\n\n synchronized (PrintedStrings.stringsToPrint) {\n System.out.println(log = \"UserName: \" + userName);\n PrintedStrings.stringsToPrint.add(log);\n System.out.println(log = \"password: \" + userPassword);\n PrintedStrings.stringsToPrint.add(log);\n\n //TODO Sprawdzic to jesli nie ma z w slowniku\n String pass = userToPasswordDict.get(userName);\n if (pass == null) {\n System.out.println(log=\"nie ma takiego uzytkownika\");\n\n PrintedStrings.stringsToPrint.add(log);\n }\n if (userPassword.equals(pass)) {\n\n avp = request.find(ProtocolConstants.DI_CHAP_AUTH);\n if (avp != null) {\n try {\n AVP_Grouped chapAuth = new AVP_Grouped(avp);\n AVP[] elements = chapAuth.queryAVPs();\n byte[] idBytes = new AVP_OctetString(elements[1]).queryValue();\n char id = (char) idBytes[0];\n System.out.println(log = \"id: \" + id);\n PrintedStrings.stringsToPrint.add(log);\n\n byte[] chapResponseBytes = new AVP_OctetString(elements[2]).queryValue();\n printBytesAsString(chapResponseBytes, \"odebrane rozwiazanie \");\n log = getBytesAsString(chapResponseBytes, \"odebrane rozwiazanie \");\n PrintedStrings.stringsToPrint.add(log);\n\n byte[] chapChallengeBytes = new AVP_OctetString(elements[3]).queryValue();\n printBytesAsString(chapChallengeBytes, \"odebrane zadanie \");\n log = getBytesAsString(chapResponseBytes, \"odebrane zadanie \");\n PrintedStrings.stringsToPrint.add(log);\n\n //sprawdzenie czy nie ma ataku przez odtwarzanie\n ServicingUserEntry sessionEntry = curentlyServicing.get(userName);\n if (sessionEntry == null) {\n System.out.println(log = \"Atak/ pakiet dotarl po upłynieciu czasu oczekiwania/ pakiet został powtórzony\");\n //w takiej sytuacji nie odpowiadamy wcale\n PrintedStrings.stringsToPrint.add(log);\n return;\n }\n Date now = new Date();\n if (id != sessionEntry.getId() ||\n !Arrays.equals(chapChallengeBytes, sessionEntry.getChallenge()) ||\n (now.getTime() - sessionEntry.getTime().getTime()) > 5000) {\n\n System.out.println(log = \"Atak/ pakiet dotarl po upłynieciu czasu oczekiwania/ przekłamanie pakietu\");\n //w takiej sytuacji nie odpowiadamy wcale\n PrintedStrings.stringsToPrint.add(log);\n return;\n }\n curentlyServicing.remove(userName);\n byte[] md5 = caluculateMD5(idBytes, userToSecretDict.get(userName).getBytes(\"ASCII\"), chapChallengeBytes);\n printBytesAsString(chapResponseBytes, \"obliczone rozwiazanie \");\n log = getBytesAsString(chapResponseBytes, \"obliczone rozwiazanie \");\n PrintedStrings.stringsToPrint.add(log);\n\n if (Arrays.equals(chapResponseBytes, md5)) {\n\n answer.add(new AVP_OctetString(ProtocolConstants.DI_FRAMED_IP_ADDRESS, clusterAddress.getBytes()));\n answer.add(new AVP_Unsigned32(ProtocolConstants.DI_RESULT_CODE, ProtocolConstants.DIAMETER_RESULT_SUCCESS));\n System.out.println(log = \"Uwierzytelnionio, pozwalam na dołaczenie do klastra\");\n PrintedStrings.stringsToPrint.add(log);\n } else {\n answer.add(new AVP_Unsigned32(ProtocolConstants.DI_RESULT_CODE, ProtocolConstants.DIAMETER_RESULT_AUTHENTICATION_REJECTED));\n System.out.println(log = \"Błędnie rozwiązane zadanie\");\n PrintedStrings.stringsToPrint.add(log);\n }\n } catch (InvalidAVPLengthException e) {\n e.printStackTrace();\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n\n } else {\n answer.add(new AVP_Unsigned32(ProtocolConstants.DI_RESULT_CODE, ProtocolConstants.DIAMETER_RESULT_MULTI_ROUND_AUTH));\n //zwiekszamy ostatnio uzywany index o 1 i korzystamy z niego\n incrementIndex();\n byte[] ind = new byte[]{(byte) lastId};\n byte[] challenge = generateChallenge();\n printBytesAsString(challenge, \"wygenerowane zadanie \");\n log = getBytesAsString(challenge, \"wygenerowane zadanie \");\n PrintedStrings.stringsToPrint.add(log);\n\n\n curentlyServicing.put(userName, new ServicingUserEntry(userName, challenge, lastId));\n //System.out.println(\"generated chalenge : \" + challenge.toString());\n answer.add(new AVP_Grouped(ProtocolConstants.DI_CHAP_AUTH,\n new AVP_Integer32(ProtocolConstants.DI_CHAP_ALGORITHM, 5),\n new AVP_OctetString(ProtocolConstants.DI_CHAP_IDENT, ind),\n new AVP_OctetString(ProtocolConstants.DI_CHAP_CHALLENGE, challenge)));\n\n\n if(lastId==34)\n serverGUIController.firstInClaster = true; //TODO obsluz wszsytkich\n if(lastId==35)\n serverGUIController.secondInClaster = true;\n if(lastId==36)\n serverGUIController.thirdInClaster = true;\n if(lastId==37)\n serverGUIController.fourthInClaster = true;\n }\n } else {\n answer.add(new AVP_Unsigned32(ProtocolConstants.DI_RESULT_CODE, ProtocolConstants.DIAMETER_RESULT_AUTHENTICATION_REJECTED));\n log=\"podane hasło jest niepoprawne\";\n PrintedStrings.stringsToPrint.add(log);\n }\n }\n case ProtocolConstants.DI_AUTH_REQUEST_TYPE_AUTHORIZE_ONLY:\n break;\n }\n\n Utils.setMandatory_RFC3588(answer);\n\n try {\n answer(answer, connkey);\n } catch (dk.i1.diameter.node.NotAnAnswerException ex) {\n }\n\n switch (lastId) {\n case 34: {\n serverGUIController.firstConnected = true;\n serverGUIController.firstTextClear = true;\n break;\n }\n case 35:{\n serverGUIController.secondConnected = true;\n serverGUIController.secondTextClear = true;\n break;\n }\n case 36:{\n serverGUIController.thirdConnected = true;\n serverGUIController.thirdTextClear = true;\n break;\n }\n case 37:{\n serverGUIController.fourthCOnnected = true;\n serverGUIController.fourthTextClear = true;\n break;\n }\n\n }\n\n }", "@Test\n public void destiny2AwaProvideAuthorizationResultTest() {\n InlineResponse20019 response = api.destiny2AwaProvideAuthorizationResult();\n\n // TODO: test validations\n }", "public void handleAuthenticationRequest(RoutingContext context) {\n\n final HttpServerRequest request = context.request();\n\n final String basicAuthentication = request.getHeader(AUTHORIZATION_HEADER);\n\n try {\n\n final String[] auth =\n BasicAuthEncoder.decodeBasicAuthentication(basicAuthentication).split(\":\");\n\n if (auth.length < 2) {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, HTML_CONTENT_TYPE)\n .end(Json.encode(Errors.CREDENTIAL_ERROR.error()));\n\n } else {\n\n final Credential credential = new Credential(auth[0], auth[1]);\n\n authenticationService.authenticate(credential, user -> {\n\n if (null != user) {\n\n tokenService.generateToken(user, token -> {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, HTML_CONTENT_TYPE).end(token);\n\n }, err -> {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(Errors.INTERNAL_ERROR.error()));\n\n });\n\n } else {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(Errors.CREDENTIAL_ERROR.error()));\n\n }\n\n }, err -> {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(err.toError()));\n\n });\n\n\n }\n\n } catch (final Exception e) {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(Errors.INVALID_AUTHENTICATION_TOKEN.error()));\n\n\n }\n\n\n\n }", "@Test\n\tpublic void testDecodeFromStreamWithPauseInTheMiddleOfMessage() throws Exception {\n\n\t\tByteArrayOutputStream bos = new ByteArrayOutputStream();\n\t\tString msg = \"POST /AppName HTTP/1.1\\r\\n\" + \"Content-Type: application/hl7-v2; charset=ISO-8859-2\\r\\n\" + \"Content-Length: \" + ourSampleMessage.getBytes(StandardCharsets.ISO_8859_1).length + \"\\r\\n\" + \"Authorization: Basic aGVsbG86d29ybGQ=\\r\\n\" + \"\\r\\n\";\n\t\tbos.write(msg.getBytes(StandardCharsets.ISO_8859_1));\n\t\tbos.write(ourSampleMessage.getBytes(\"ISO-8859-2\"));\n\t\tAbstractHl7OverHttpDecoder d = new Hl7OverHttpRequestDecoder();\n\n\t\tByteArrayInputStream bais = new ByteArrayInputStream(bos.toByteArray());\n\t\tSplitInputStream is = new SplitInputStream(bais, msg.length() + 10);\n\n\t\td.readHeadersAndContentsFromInputStreamAndDecode(is);\n\n\t\tassertEquals(0, bais.available());\n\t\tassertTrue(d.getConformanceProblems().toString(), d.getConformanceProblems().isEmpty());\n\t\tassertEquals(Charset.forName(\"ISO-8859-2\"), d.getCharset());\n\t\tassertTrue(d.isCharsetExplicitlySet());\n\t\tassertEquals(\"application/hl7-v2\", d.getContentType());\n\t\tassertEquals(ourSampleMessage, d.getMessage());\n\t\tassertEquals(\"hello\", d.getUsername());\n\t\tassertEquals(\"world\", d.getPassword());\n\t\tassertEquals(\"/AppName\", d.getPath());\n\n\t}", "public void authSucess(BundleDescriptor desc, Endpoint ep, Principal principal) {\n // all the data is collected by Message listener for the success case\n }", "public static void main(String[] args) {\n\n V2Grpc.V2BlockingStub stub = V2Grpc.newBlockingStub(ClarifaiChannel.INSTANCE.getGrpcChannel())\n .withCallCredentials(new ClarifaiCallCredentials(PAT));\n\n // To start from beginning, do not provide the last ID parameter.\n MultiInputResponse firstStreamInputsResponse = stub.streamInputs(\n StreamInputsRequest.newBuilder()\n .setUserAppId(UserAppIDSet.newBuilder().setUserId(USER_ID).setAppId(APP_ID))\n .setPerPage(10)\n .build()\n );\n\n if (firstStreamInputsResponse.getStatus().getCode() != StatusCode.SUCCESS) {\n throw new RuntimeException(\"Stream inputs failed, status: \" + firstStreamInputsResponse.getStatus());\n }\n\n System.out.println(\"First response (starting from the first input):\");\n List < Input > inputs = firstStreamInputsResponse.getInputsList();\n for (Input input: inputs) {\n System.out.println(\"\\t\" + input.getId());\n }\n\n String lastId = inputs.get(inputs.size() - 1).getId();\n\n // Set last ID to get the next set of inputs. The returned inputs will not include the last ID input.\n MultiInputResponse secondStreamInputsResponse = stub.streamInputs(\n StreamInputsRequest.newBuilder()\n .setUserAppId(UserAppIDSet.newBuilder().setUserId(USER_ID).setAppId(APP_ID))\n .setLastId(lastId)\n .setPerPage(10)\n .build()\n );\n\n if (secondStreamInputsResponse.getStatus().getCode() != StatusCode.SUCCESS) {\n throw new RuntimeException(\"Stream inputs failed, status: \" + secondStreamInputsResponse.getStatus());\n }\n\n System.out.println(String.format(\"Second response (first input is the one following input ID %s)\", lastId));\n for (Input input: secondStreamInputsResponse.getInputsList()) {\n System.out.println(\"\\t\" + input.getId());\n }\n\n }", "@Test\r\n\tpublic void testB() {\r\n\t\t\r\n\t\tObjectHandshake h = new ObjectHandshake();\r\n\t\th.setUuid( UuidTool.getOne() );\r\n\t\t\r\n\t\tRunProtocol run = new RunProtocol(h, IHandshake.PARTNER_A, 100, 200, false, true);\r\n\t\t\r\n\t\tassertTrue(run.beginA());\r\n\t\tassertTrue(run.commitA());\r\n\t\t\r\n\t\tassertTrue(run.beginB());\r\n\t\tassertTrue(run.commitB());\r\n\t}", "public interface RequestServer {\n\n @GET(\"caseplatform/mobile/system-eventapp!register.action\")\n Call<StringResult> register(@Query(\"account\") String account, @Query(\"password\") String password, @Query(\"name\") String name,\n @Query(\"mobilephone\") String mobilephone, @Query(\"identityNum\") String identityNum);\n\n @GET(\"caseplatform/mobile/login-app!login.action\")\n Call<String> login(@Query(\"name\") String username, @Query(\"password\") String password);\n\n @GET(\"caseplatform/mobile/system-eventapp!setUserPassword.action\")\n Call<StringResult> setPassword(@Query(\"account\") String account,\n @Query(\"newPassword\") String newPassword,\n @Query(\"oldPassword\") String oldPassword);\n\n @GET(\"caseplatform/mobile/system-eventapp!getEventInfo.action\")\n Call<Event> getEvents(@Query(\"account\") String account, @Query(\"eventType\") String eventType);\n\n @GET(\"caseplatform/mobile/system-eventapp!reportEventInfo.action \")\n Call<EventUpload> reportEvent(\n @Query(\"account\") String account,\n @Query(\"eventType\") String eventType,\n @Query(\"address\") String address,\n @Query(\"eventX\") String eventX,\n @Query(\"eventY\") String eventY,\n @Query(\"eventMs\") String eventMs,\n @Query(\"eventMc\") String eventMc,\n @Query(\"eventId\") String eventId,\n @Query(\"eventClyj\") String eventClyj,\n @Query(\"eventImg\") String eventImg,\n @Query(\"eventVideo\") String eventVideo,\n @Query(\"eventVoice\") String eventVoice\n );\n\n @GET(\"caseplatform/mobile/system-eventapp!getUserInfo.action\")\n Call<UserInfo> getUserInfo(@Query(\"orgNo\") String orgNo, @Query(\"account\") String account);\n\n @GET(\"caseplatform/mobile/system-eventapp!getOrgDataInfo.action\")\n Call<OrgDataInfo> getOrgData(@Query(\"orgNo\") String orgNo, @Query(\"account\") String account);\n\n @Multipart\n @POST(\"caseplatform/mobile/video-upload!uplodVideo.action\")\n Call<FileUpload> uploadVideo(@Part(\"video\") File video, @Part(\"videoFileName\") String videoFileName);\n\n @POST(\"caseplatform/mobile/video-upload!uplodVideo.action\")\n Call<FileUpload> uploadVideo(@Body RequestBody requestBody);\n\n @GET(\"caseplatform/mobile/video-upload!uplodAudio.action\")\n Call<FileUpload> uploadAudio(@Query(\"audio\") File audio, @Query(\"audioFileName\") String audioFileName);\n\n @POST(\"caseplatform/mobile/video-upload!uplodAudio.action\")\n Call<FileUpload> uploadAudio(@Body RequestBody requestBody);\n\n @GET(\"caseplatform/mobile/file-upload!uplodFile.action\")\n Call<FileUpload> uploadImage(@Query(\"img\") File img, @Query(\"imgFileName\") String imgFileName);\n\n @POST(\"caseplatform/mobile/file-upload!uplodFile.action\")\n Call<FileUpload> uploadImage(@Body RequestBody requestBody);\n\n @GET(\"caseplatform/mobile/system-eventapp!jobgps.action\")\n Call<StringResult> setCoordinate(@Query(\"account\") String account,\n @Query(\"address\") String address,\n @Query(\"x\") String x,\n @Query(\"y\") String y,\n @Query(\"coordsType\") String coordsType,\n @Query(\"device_id\") String device_id\n );\n\n @GET(\"caseplatform/mobile/system-eventapp!Mbtrajectory.action\")\n Call<Task> getTask(@Query(\"account\") String account);\n\n}", "private void validaciónDeRespuesta()\n\t{\n\t\ttry {\n\n\t\t\tString valorCifrado = in.readLine();\n\t\t\tString hmacCifrado = in.readLine();\n\t\t\tbyte[] valorDecifrado = decriptadoSimetrico(parseBase64Binary(valorCifrado), llaveSecreta, algSimetrica);\n\t\t\tString elString = printBase64Binary(valorDecifrado);\n\t\t\tbyte[] elByte = parseBase64Binary(elString);\n\n\t\t\tSystem.out.println( \"Valor decifrado: \"+elString + \"$\");\n\n\t\t\tbyte[] hmacDescifrado = decriptarAsimetrico(parseBase64Binary(hmacCifrado), llavePublica, algAsimetrica);\n\n\t\t\tString hmacRecibido =printBase64Binary(hmacDescifrado);\n\t\t\tbyte[] hmac = hash(elByte, llaveSecreta, HMACSHA512);\n\t\t\tString hmacGenerado = printBase64Binary(hmac);\n\n\n\n\n\t\t\tboolean x= hmacRecibido.equals(hmacGenerado);\n\t\t\tif(x!=true)\n\t\t\t{\n\t\t\t\tout.println(ERROR);\n\t\t\t\tSystem.out.println(\"Error, no es el mismo HMAC\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"Se confirmo que el mensaje recibido proviene del servidor mediante el HMAC\");\n\t\t\t\tout.println(OK);\n\t\t\t}\n\n\n\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Error con el hash\");\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public interface NotificationsSectionSplitter {\n Pair<List<Object>, List<NotificationsEdgeFields>> mo469a(List<Object> list, List<NotificationsEdgeFields> list2);\n\n void mo470a(Bundle bundle);\n}", "public void testBODY_PART2() throws Exception {\n\t\tObject retval = execLexer(\"BODY_PART\", 154, \"armed\", false);\n\t\tObject actual = examineExecResult(org.antlr.gunit.gUnitParser.OK, retval);\n\t\tObject expecting = \"OK\";\n\n\t\tassertEquals(\"testing rule \"+\"BODY_PART\", expecting, actual);\n\t}", "private TOMMessage[] deserializeTOMMessages(byte[] playload) {\n\n ByteArrayInputStream bis;\n ObjectInputStream ois;\n\n TOMMessage[] requests = null;\n\n try { // deserialize the content of the STOP message\n\n bis = new ByteArrayInputStream(playload);\n ois = new ObjectInputStream(bis);\n\n boolean hasReqs = ois.readBoolean();\n\n if (hasReqs) {\n\n // Store requests that the other replica did not manage to order\n //TODO: The requests have to be verified!\n byte[] temp = (byte[]) ois.readObject();\n BatchReader batchReader = new BatchReader(temp,\n controller.getStaticConf().getUseSignatures() == 1);\n requests = batchReader.deserialiseRequests(controller);\n } else {\n \n requests = new TOMMessage[0];\n }\n\n ois.close();\n bis.close();\n\n } catch (IOException | ClassNotFoundException ex) {\n logger.error(\"Could not serialize requests\", ex);\n }\n\n return requests;\n\n }", "@Given(\"^I'm on \\\"([^\\\"]*)\\\" page of GetGo pay with valid \\\"([^\\\"]*)\\\" and \\\"([^\\\"]*)\\\"$\")\n public void i_m_on_page_of_GetGo_pay_with_valid_and(String arg1, String arg2, String arg3) throws Throwable {\n passworddetails=arg3;\n email=PropertyReader.testDataOf(arg2);\n if(Device.isAndroid()) {\n welcome.clickLogin();\n login.enterEmail(PropertyReader.testDataOf(arg2));\n login.clickNext();\n login.enterPassword(PropertyReader.testDataOf(arg3));\n //login.enterPassword(PropertyReader.dynamicReadTestDataOf(arg3));\n\n login.clickLogin();\n //dashboard.\n }\n else\n {\n login.iOSLoginFlow(PropertyReader.testDataOf(arg2),PropertyReader.testDataOf(arg3));\n }\n\n }", "public ArrayList<String> combineDataOpsAndIntents(String p1, String p2) {\n\t\tArrayList<String> logics1 = QueryStream.getLogic(p1);\n\t\tArrayList<String> terms1 = QueryStream.getTerms(p1);\n\t\t//Get logic statements from p2\n\t\tArrayList<String> logics2 = QueryStream.getLogic(p2);\n\t\tArrayList<String> terms2 = QueryStream.getTerms(p2);\n\t\t\n\t\tArrayList<String> result_logics = new ArrayList<String>();\n\t\tArrayList<String> result_terms = new ArrayList<String>();\n\t\t\n\t\t//Iterate through logic for p1. If it matches anything in p2,\n\t\t// we add the terms from p1 and p2 together.\n\t\tfor(int i = 0; i < logics1.size(); ++i) {\n\t\t\t\n\t\t\tString result_term = \"\";\n\t\t\t//If any logic matches, we combine the corresponding terms together\n\t\t\tif(logics2.contains(logics1.get(i))) {\n\t\t\t\tresult_term = terms1.get(i) + \" \" + terms2.get(i);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresult_term = terms1.get(i);\n\t\t\t}\n\t\t\tresult_logics.add(logics1.get(i));\n\t\t\tresult_terms.add(result_term);\n\t\t}\n\t\t//Iterate through the logic for p2. If it includes any logic not\n\t\t// in the results, then add it in.\n\t\tfor(int i = 0; i < logics2.size(); ++i) {\n\t\t\t\n\t\t\tString result_term = \"\";\n\t\t\t//If any logic matches, we combine the corresponding terms together\n\t\t\tif(!result_logics.contains(logics2.get(i))) {\n\t\t\t\tresult_logics.add(logics2.get(i));\n\t\t\t\tresult_term = terms2.get(i);\n\t\t\t\tresult_terms.add(result_term);\n\t\t\t}\n\t\t}\n\t\t\n//\t\tfor(String l : result_logics) {\n//\t\t\tSystem.out.println(l);\n//\t\t}\n\t\t\n\t\t//Now we can create a new policy given the two strings\n\t\treturn produceDataOpsIntentsPolicy(result_logics, result_terms);\n\t}", "protected abstract T extractClaims(BearerTokenAuthenticationToken bearer);", "@Test\n public void testFailureParUsedByOtherClient() throws Exception {\n // create client dynamically\n String victimClientId = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.FALSE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation victimOidcCRep = getClientDynamically(victimClientId);\n String victimClientSecret = victimOidcCRep.getClientSecret();\n assertEquals(Boolean.FALSE, victimOidcCRep.getRequirePushedAuthorizationRequests());\n assertTrue(victimOidcCRep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, victimOidcCRep.getTokenEndpointAuthMethod());\n\n authManageClients();\n\n String attackerClientId = createClientDynamically(generateSuffixedName(CLIENT_NAME), (OIDCClientRepresentation clientRep) -> {\n clientRep.setRequirePushedAuthorizationRequests(Boolean.TRUE);\n clientRep.setRedirectUris(new ArrayList<String>(Arrays.asList(CLIENT_REDIRECT_URI)));\n });\n OIDCClientRepresentation attackerOidcCRep = getClientDynamically(attackerClientId);\n assertEquals(Boolean.TRUE, attackerOidcCRep.getRequirePushedAuthorizationRequests());\n assertTrue(attackerOidcCRep.getRedirectUris().contains(CLIENT_REDIRECT_URI));\n assertEquals(OIDCLoginProtocol.CLIENT_SECRET_BASIC, attackerOidcCRep.getTokenEndpointAuthMethod());\n\n // Pushed Authorization Request\n oauth.clientId(victimClientId);\n oauth.redirectUri(CLIENT_REDIRECT_URI);\n ParResponse pResp = oauth.doPushedAuthorizationRequest(victimClientId, victimClientSecret);\n assertEquals(201, pResp.getStatusCode());\n String requestUri = pResp.getRequestUri();\n\n // Authorization Request with request_uri of PAR\n // remove parameters as query strings of uri\n // used by other client\n oauth.clientId(attackerClientId);\n oauth.redirectUri(null);\n oauth.scope(null);\n oauth.responseType(null);\n oauth.requestUri(requestUri);\n String state = oauth.stateParamRandom().getState();\n oauth.stateParamHardcoded(state);\n UriBuilder b = UriBuilder.fromUri(oauth.getLoginFormUrl());\n driver.navigate().to(b.build().toURL());\n OAuthClient.AuthorizationEndpointResponse errorResponse = new OAuthClient.AuthorizationEndpointResponse(oauth);\n Assert.assertFalse(errorResponse.isRedirected());\n }", "public void extractParameters() {\n\t\tString[] parameters = body.split(\"&\");\n\n\n\n\t\t//If there is a value given for every parameter, we extract them\n\t\tString[] huh = parameters[0].split(\"=\");\n\t\tif(huh.length>1) {\n\t\t\tusername = huh[1];\n\t\t}else{allParametersGiven=false;}\t\n\n\t\tString[] hoh = parameters[1].split(\"=\");\n\t\tif(hoh.length>1) {\n\t\t\tpassword = hoh[1];\n\t\t}else{allParametersGiven=false;}\n\n\t}", "void processMessage(NettyCorfuMsg msg, ChannelHandlerContext ctx)\n {\n switch (msg.getMsgType())\n {\n case TOKEN_REQ: {\n NettyStreamingServerTokenRequestMsg req = (NettyStreamingServerTokenRequestMsg) msg;\n if (req.getNumTokens() == 0)\n {\n long max = 0L;\n for (UUID id : req.getStreamIDs()) {\n Long lastIssued = lastIssuedMap.get(id);\n max = Math.max(max, lastIssued == null ? Long.MIN_VALUE: lastIssued);\n }\n NettyStreamingServerTokenResponseMsg resp = new NettyStreamingServerTokenResponseMsg(max);\n sendResponse(resp, msg, ctx);\n }\n else {\n long thisIssue = globalIndex.getAndAdd(req.getNumTokens());\n for (UUID id : req.getStreamIDs()) {\n lastIssuedMap.compute(id, (k, v) -> v == null ? thisIssue + req.getNumTokens() :\n Math.max(thisIssue + req.getNumTokens(), v));\n }\n NettyStreamingServerTokenResponseMsg resp = new NettyStreamingServerTokenResponseMsg(thisIssue);\n sendResponse(resp, msg, ctx);\n }\n }\n break;\n default:\n log.warn(\"Unknown message type {} passed to handler!\", msg.getMsgType());\n throw new RuntimeException(\"Unsupported message passed to handler!\");\n }\n }", "public void testUnpack() throws InvalidAdviceException {\n {\n String bag = \"bag1\";\n Object[][] packedTuple = {{\"dsifji2oj\", \"23498ngnjs\"}};\n BaggageAPIForTest baggage = new BaggageAPIForTest().put(bag, packedTuple);\n EmitAPIForTest results = new EmitAPIForTest();\n Advice advice = AdviceTestUtils.newAdvice().observe(\"oa\", \"ob\").unpack(bag, \"pa\", \"pb\").emit(\"test1\", \"oa\", \"pb\", \"pa\", \"ob\").build(baggage, results);\n \n assertTrue(\"Expect nothing emitted yet\", results.emitted.size() == 0);\n advice.advise(\"d8jdj2\", \"ooowoowq\");\n results.expectTuple(\"d8jdj2\", \"23498ngnjs\", \"dsifji2oj\", \"ooowoowq\");\n results.check();\n assertTrue(\"Expect 1 output tuple emitted\", results.emitted.size() == 1);\n }\n {\n String bag = \"bag7\";\n Object[][] packedTuple = {{\"dsifji2oj\", \"23498ngnjs\"}};\n BaggageAPIForTest baggage = new BaggageAPIForTest().put(bag, packedTuple);\n EmitAPIForTest results = new EmitAPIForTest();\n Advice advice = AdviceTestUtils.newAdvice().observe(\"oa\", \"ob\").unpack(bag, \"pa\", \"pb\").emit(\"test1\", \"oa\").build(baggage, results);\n \n assertTrue(\"Expect nothing emitted yet\", results.emitted.size() == 0);\n advice.advise(\"d8jdj2\", \"ooowoowq\");\n results.expectTuple(\"d8jdj2\");\n results.check();\n assertTrue(\"Expect 1 output tuple emitted\", results.emitted.size() == 1);\n }\n {\n String bag = \"bag4\";\n Object[][] packedTuple = {{\"dsifji2oj\", \"23498ngnjs\"}};\n BaggageAPIForTest baggage = new BaggageAPIForTest().put(bag, packedTuple);\n EmitAPIForTest results = new EmitAPIForTest();\n Advice advice = AdviceTestUtils.newAdvice().observe(\"oa\", \"ob\").unpack(bag, \"pa\", \"pb\").emit(\"test1\", \"pb\").build(baggage, results);\n \n assertTrue(\"Expect nothing emitted yet\", results.emitted.size() == 0);\n advice.advise(\"d8jdj2\", \"ooowoowq\");\n results.expectTuple(\"23498ngnjs\");\n results.check();\n assertTrue(\"Expect 1 output tuple emitted\", results.emitted.size() == 1);\n }\n }", "private void decodeMultipartFormData(String boundary, String encoding, ByteBuffer fbuf,\n\t\t\t\tMap<String, String> parms, Map<String, String> files) throws ResponseException {\n\t\t\ttry {\n\t\t\t\tint[] boundary_idxs = getBoundaryPositions(fbuf, boundary.getBytes());\n\t\t\t\tif (boundary_idxs.length < 2) {\n\t\t\t\t\tthrow new ResponseException(Response.Status.BAD_REQUEST,\n\t\t\t\t\t\t\t\"BAD REQUEST: Content type is multipart/form-data but contains less than two boundary strings.\");\n\t\t\t\t}\n\n\t\t\t\tbyte[] part_header_buff = new byte[MAX_HEADER_SIZE];\n\t\t\t\tfor (int bi = 0; bi < boundary_idxs.length - 1; bi++) {\n\t\t\t\t\tfbuf.position(boundary_idxs[bi]);\n\t\t\t\t\tint len = (fbuf.remaining() < MAX_HEADER_SIZE) ? fbuf.remaining()\n\t\t\t\t\t\t\t: MAX_HEADER_SIZE;\n\t\t\t\t\tfbuf.get(part_header_buff, 0, len);\n\t\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(\n\t\t\t\t\t\t\tnew ByteArrayInputStream(part_header_buff, 0, len),\n\t\t\t\t\t\t\tCharset.forName(encoding)), len);\n\n\t\t\t\t\tint headerLines = 0;\n\t\t\t\t\t// First line is boundary string\n\t\t\t\t\tString mpline = in.readLine();\n\t\t\t\t\theaderLines++;\n\t\t\t\t\tif (mpline == null || !mpline.contains(boundary)) {\n\t\t\t\t\t\tthrow new ResponseException(Response.Status.BAD_REQUEST,\n\t\t\t\t\t\t\t\t\"BAD REQUEST: Content type is multipart/form-data but chunk does not start with boundary.\");\n\t\t\t\t\t}\n\n\t\t\t\t\tString part_name = null, file_name = null, content_type = null;\n\t\t\t\t\t// Parse the reset of the header lines\n\t\t\t\t\tmpline = in.readLine();\n\t\t\t\t\theaderLines++;\n\t\t\t\t\twhile (mpline != null && mpline.trim().length() > 0) {\n\t\t\t\t\t\tMatcher matcher = CONTENT_DISPOSITION_PATTERN.matcher(mpline);\n\t\t\t\t\t\tif (matcher.matches()) {\n\t\t\t\t\t\t\tString attributeString = matcher.group(2);\n\t\t\t\t\t\t\tmatcher = CONTENT_DISPOSITION_ATTRIBUTE_PATTERN\n\t\t\t\t\t\t\t\t\t.matcher(attributeString);\n\t\t\t\t\t\t\twhile (matcher.find()) {\n\t\t\t\t\t\t\t\tString key = matcher.group(1);\n\t\t\t\t\t\t\t\tif (\"name\".equalsIgnoreCase(key)) {\n\t\t\t\t\t\t\t\t\tpart_name = matcher.group(2);\n\t\t\t\t\t\t\t\t} else if (\"filename\".equalsIgnoreCase(key)) {\n\t\t\t\t\t\t\t\t\tfile_name = matcher.group(2);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatcher = CONTENT_TYPE_PATTERN.matcher(mpline);\n\t\t\t\t\t\tif (matcher.matches()) {\n\t\t\t\t\t\t\tcontent_type = matcher.group(2).trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmpline = in.readLine();\n\t\t\t\t\t\theaderLines++;\n\t\t\t\t\t}\n\t\t\t\t\tint part_header_len = 0;\n\t\t\t\t\twhile (headerLines-- > 0) {\n\t\t\t\t\t\tpart_header_len = scipOverNewLine(part_header_buff, part_header_len);\n\t\t\t\t\t}\n\t\t\t\t\t// Read the part data\n\t\t\t\t\tif (part_header_len >= len - 4) {\n\t\t\t\t\t\tthrow new ResponseException(Response.Status.INTERNAL_ERROR,\n\t\t\t\t\t\t\t\t\"Multipart header size exceeds MAX_HEADER_SIZE.\");\n\t\t\t\t\t}\n\t\t\t\t\tint part_data_start = boundary_idxs[bi] + part_header_len;\n\t\t\t\t\tint part_data_end = boundary_idxs[bi + 1] - 4;\n\n\t\t\t\t\tfbuf.position(part_data_start);\n\t\t\t\t\tif (content_type == null) {\n\t\t\t\t\t\t// Read the part into a string\n\t\t\t\t\t\tbyte[] data_bytes = new byte[part_data_end - part_data_start];\n\t\t\t\t\t\tfbuf.get(data_bytes);\n\t\t\t\t\t\tparms.put(part_name, new String(data_bytes, encoding));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Read it into a file\n\t\t\t\t\t\tString path = saveTmpFile(fbuf, part_data_start, part_data_end\n\t\t\t\t\t\t\t\t- part_data_start, file_name);\n\t\t\t\t\t\tif (!files.containsKey(part_name)) {\n\t\t\t\t\t\t\tfiles.put(part_name, path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tint count = 2;\n\t\t\t\t\t\t\twhile (files.containsKey(part_name + count)) {\n\t\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfiles.put(part_name + count, path);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparms.put(part_name, file_name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (ResponseException re) {\n\t\t\t\tthrow re;\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new ResponseException(Response.Status.INTERNAL_ERROR, e.toString());\n\t\t\t}\n\t\t}", "PToP.AS2Req getAS2Req();", "public void handle(Exchange exchange) {\n Map<String, String> pathTokens = exchange.getPathTokens();\n exchange.getResponse().send(\"from the nested handler, var1: \" + pathTokens.get(\"var1\") + \", \" + pathTokens.get(\"var2\"));\n }", "@Path(\"Private\")\n@Produces(MediaType.APPLICATION_JSON)\npublic interface IndependentReserveAuthenticated {\n\n @POST\n @Path(\"GetAccounts\")\n @Consumes(MediaType.APPLICATION_JSON)\n public IndependentReserveBalance getBalance(AuthAggregate authAggregate) throws IndependentReserveHttpStatusException, IOException;\n\n @POST\n @Path(\"GetOpenOrders\")\n @Consumes(MediaType.APPLICATION_JSON)\n public IndependentReserveOpenOrdersResponse getOpenOrders(IndependentReserveOpenOrderRequest independentReserveOpenOrderRequest) throws IndependentReserveHttpStatusException, IOException;\n\n @POST\n @Path(\"GetTrades\")\n @Consumes(MediaType.APPLICATION_JSON)\n public IndependentReserveTradeHistoryResponse getTradeHistory(IndependentReserveTradeHistoryRequest independentReserveTradeHistoryRequest) throws IndependentReserveHttpStatusException, IOException;\n\n @POST\n @Path(\"PlaceLimitOrder\")\n @Consumes(MediaType.APPLICATION_JSON)\n public IndependentReservePlaceLimitOrderResponse placeLimitOrder(IndependentReservePlaceLimitOrderRequest independentReservePlaceLimitOrderRequest) throws IndependentReserveHttpStatusException, IOException;\n\n @POST\n @Path(\"CancelOrder\")\n @Consumes(MediaType.APPLICATION_JSON)\n public IndependentReserveCancelOrderResponse cancelOrder(IndependentReserveCancelOrderRequest independentReserveCancelOrderRequest) throws IndependentReserveHttpStatusException, IOException;\n}", "public String[] inquiryResponse(String input)\n\t{\n\t\tinput = tselDecrypt(key,input);\n\t\t\n\t\tinquiryResponseTemp=input.split(\"@~|\");\n\n\t\tinquiryResponse[0]=inquiryResponseTemp[0];\n\t\tinquiryResponse[1]=inquiryResponseTemp[1];\n\t\tinquiryResponse[2]=inquiryResponseTemp[2];\n\t\tinquiryResponse[3]=inquiryResponseTemp[3];\n\n\t\tinquiryResponseTemp2=inquiryResponseTemp[4].split(\"|\");\n\n\t\tfor(int i=0;i<inquiryResponseTemp2.length;i++)\n\t\t{\n\t\t\tinquiryResponse[i+4]=inquiryResponseTemp2[i];\n\t\t}\n\n\t\tinquiryResponse[4+inquiryResponseTemp2.length]=inquiryResponseTemp[5];\n\n\t\treturn inquiryResponse;\n\t}", "private static boolean isSpecialPair(AnalyzedTokenReadings[] tokens, int first, int second) {\n if(first + 3 >= second && tokens[first].matchesPosTagRegex(\"VER:.*INF.*\")\n && StringUtils.equalsAny(tokens[first+1].getToken(), \"als\", \"noch\")\n && tokens[first + 2].matchesPosTagRegex(\"VER:.*INF.*\")) {\n if(first + 2 == second) {\n return true;\n }\n return isTwoCombinedVerbs(tokens[second - 1], tokens[second]);\n }\n return false;\n }", "protected Response checkResponse(Response plainAnswer) throws WSException{\n if(plainAnswer!=null)\n switch(plainAnswer.getStatus()){\n //good answers\n case 200: {\n return plainAnswer;\n }//OK\n case 202: {\n return plainAnswer;\n }//ACCEPTED \n case 201: {\n return plainAnswer;\n }//CREATED\n //To be evaluate\n case 204: {\n return plainAnswer;\n }//NO_CONTENT\n //bad answers\n case 400: {\n throw new WSException400(\"BAD REQUEST! The action can't be completed\");\n }//BAD_REQUEST \n case 409: {\n throw new WSException409(\"CONFLICT! The action can't be completed\");\n }//CONFLICT \n case 403: {\n throw new WSException403(\"FORBIDDEN!The action can't be completed\");\n }//FORBIDDEN \n case 410: {\n throw new WSException410(\"GONE! The action can't be completed\");\n }//GONE\n case 500: {\n throw new WSException500(\"INTERNAL_SERVER_ERROR! The action can't be completed\");\n }//INTERNAL_SERVER_ERROR \n case 301: {\n throw new WSException301(\"MOVED_PERMANENTLY! The action can't be completed\");\n }//MOVED_PERMANENTLY \n case 406: {\n throw new WSException406(\"NOT_ACCEPTABLE! The action can't be completed\");\n }//NOT_ACCEPTABLE\n case 404: {\n throw new WSException404(\"NOT_FOUND! The action can't be completed\");\n }//NOT_FOUND\n case 304: {\n throw new WSException304(\"NOT_MODIFIED! The action can't be completed\");\n }//NOT_MODIFIED \n case 412: {\n throw new WSException412(\"PRECONDITION_FAILED! The action can't be completed\");\n }//PRECONDITION_FAILED \n case 303: {\n throw new WSException303(\"SEE_OTHER! The action can't be completed\");\n }//SEE_OTHER\n case 503: {\n throw new WSException503(\"SERVICE_UNAVAILABLE! The action can't be completed\");\n }//SERVICE_UNAVAILABLE\n case 307: {\n throw new WSException307(\"TEMPORARY_REDIRECT! The action can't be completed\");\n }//TEMPORARY_REDIRECT \n case 401: {\n throw new WSException401(\"UNAUTHORIZED! The action can't be completed\");\n }//UNAUTHORIZED \n case 415: {\n throw new WSException415(\"UNSUPPORTED_MEDIA_TYPE! The action can't be completed\");\n }//UNSUPPORTED_MEDIA_TYPE \n }\n return plainAnswer;\n }", "static @NonNull ByteBuffer getMsg(int typ, int len) {\n ByteBuffer res = ByteBuffer.wrap(new byte[len]); // Create Authentication Request template\n res.put((byte)((ATH_VER << 4) | typ)); // Set the Qi-Authentication version and the Request type\n return res; // Return the Authentication Request template\n }", "public com.outlook.octavio.armenta.ws.SOAPServiceStub.LoginResponse login(\n com.outlook.octavio.armenta.ws.SOAPServiceStub.Login login2)\n throws java.rmi.RemoteException {\n org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();\n\n try {\n org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());\n _operationClient.getOptions()\n .setAction(\"http://tempuri.org/ISOAPService/Login\");\n _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);\n\n addPropertyToOperationClient(_operationClient,\n org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,\n \"&\");\n\n // create SOAP envelope with that payload\n org.apache.axiom.soap.SOAPEnvelope env = null;\n\n env = toEnvelope(getFactory(_operationClient.getOptions()\n .getSoapVersionURI()),\n login2,\n optimizeContent(\n new javax.xml.namespace.QName(\"http://tempuri.org/\",\n \"login\")),\n new javax.xml.namespace.QName(\"http://tempuri.org/\", \"Login\"));\n\n //adding SOAP soap_headers\n _serviceClient.addHeadersToEnvelope(env);\n // set the message context with that soap envelope\n _messageContext.setEnvelope(env);\n\n // add the message contxt to the operation client\n _operationClient.addMessageContext(_messageContext);\n\n //execute the operation client\n _operationClient.execute(true);\n\n org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);\n org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();\n\n java.lang.Object object = fromOM(_returnEnv.getBody()\n .getFirstElement(),\n com.outlook.octavio.armenta.ws.SOAPServiceStub.LoginResponse.class);\n\n return (com.outlook.octavio.armenta.ws.SOAPServiceStub.LoginResponse) object;\n } catch (org.apache.axis2.AxisFault f) {\n org.apache.axiom.om.OMElement faultElt = f.getDetail();\n\n if (faultElt != null) {\n if (faultExceptionNameMap.containsKey(\n new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"Login\"))) {\n //make the fault by reflection\n try {\n java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"Login\"));\n java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);\n java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);\n java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());\n\n //message class\n java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"Login\"));\n java.lang.Class messageClass = java.lang.Class.forName(messageClassName);\n java.lang.Object messageObject = fromOM(faultElt,\n messageClass);\n java.lang.reflect.Method m = exceptionClass.getMethod(\"setFaultMessage\",\n new java.lang.Class[] { messageClass });\n m.invoke(ex, new java.lang.Object[] { messageObject });\n\n throw new java.rmi.RemoteException(ex.getMessage(), ex);\n } catch (java.lang.ClassCastException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.ClassNotFoundException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.NoSuchMethodException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.reflect.InvocationTargetException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.IllegalAccessException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.InstantiationException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n }\n } else {\n throw f;\n }\n } else {\n throw f;\n }\n } finally {\n if (_messageContext.getTransportOut() != null) {\n _messageContext.getTransportOut().getSender()\n .cleanup(_messageContext);\n }\n }\n }", "private static Object doMpesa(Request req, Response res){\n System.out.println(\"Here is the confirmation: \" + req.body());\n\n Mpesa received = new Gson().fromJson(req.body(),Mpesa.class);\n System.out.println();\n System.out.println();\n System.out.println();\n System.out.println();\n System.out.println(\"Payment Status: \"+ received.getStatus());\n publisher send_0k = new publisher();\n send_0k.setContent(received.getStatus());\n send_0k.publish();\n return received;\n }", "public void usersUserIdMessagesDeliveredGet (String userId, final Response.Listener<InlineResponse2002> responseListener, final Response.ErrorListener errorListener) {\n Object postBody = null;\n\n // verify the required parameter 'userId' is set\n if (userId == null) {\n VolleyError error = new VolleyError(\"Missing the required parameter 'userId' when calling usersUserIdMessagesDeliveredGet\",\n new ApiException(400, \"Missing the required parameter 'userId' when calling usersUserIdMessagesDeliveredGet\"));\n }\n\n // create path and map variables\n String path = \"/users/{userId}/messages/delivered\".replaceAll(\"\\\\{format\\\\}\",\"json\").replaceAll(\"\\\\{\" + \"userId\" + \"\\\\}\", apiInvoker.escapeString(userId.toString()));\n\n // query params\n List<Pair> queryParams = new ArrayList<Pair>();\n // header params\n Map<String, String> headerParams = new HashMap<String, String>();\n // form params\n Map<String, String> formParams = new HashMap<String, String>();\n\n\n\n String[] contentTypes = {\n \n };\n String contentType = contentTypes.length > 0 ? contentTypes[0] : \"application/json\";\n\n if (contentType.startsWith(\"multipart/form-data\")) {\n // file uploading\n MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();\n \n\n HttpEntity httpEntity = localVarBuilder.build();\n postBody = httpEntity;\n } else {\n // normal form params\n }\n\n String[] authNames = new String[] { \"Authorization\" };\n\n try {\n apiInvoker.invokeAPI(basePath, path, \"GET\", queryParams, postBody, headerParams, formParams, contentType, authNames,\n new Response.Listener<String>() {\n @Override\n public void onResponse(String localVarResponse) {\n try {\n responseListener.onResponse((InlineResponse2002) ApiInvoker.deserialize(localVarResponse, \"\", InlineResponse2002.class));\n } catch (ApiException exception) {\n errorListener.onErrorResponse(new VolleyError(exception));\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n errorListener.onErrorResponse(error);\n }\n });\n } catch (ApiException ex) {\n errorListener.onErrorResponse(new VolleyError(ex));\n }\n }" ]
[ "0.65013623", "0.62273544", "0.54584926", "0.52568525", "0.52176505", "0.5108147", "0.50562215", "0.49881497", "0.49756855", "0.49504998", "0.4922494", "0.48442864", "0.4842459", "0.47618484", "0.47577137", "0.47312438", "0.47232386", "0.4702486", "0.47001067", "0.4645752", "0.4641747", "0.46403226", "0.4634071", "0.4628207", "0.46012902", "0.45826778", "0.4580774", "0.4565739", "0.4564229", "0.45641598", "0.4556136", "0.4547648", "0.4546621", "0.4545678", "0.4543655", "0.45198357", "0.45069557", "0.44981045", "0.44914252", "0.44829234", "0.44784716", "0.44598117", "0.44571897", "0.44411623", "0.4439411", "0.44392106", "0.44341603", "0.44284132", "0.44269785", "0.44171488", "0.44167075", "0.44165298", "0.4396373", "0.43891993", "0.43742535", "0.43636736", "0.43592343", "0.4358851", "0.43571168", "0.43418968", "0.43367586", "0.43354887", "0.43338746", "0.43296525", "0.43244186", "0.43185696", "0.4314265", "0.4313405", "0.4310128", "0.43097502", "0.43026134", "0.43022195", "0.42979077", "0.42970935", "0.42918035", "0.42854354", "0.42766967", "0.42751098", "0.42733997", "0.4268594", "0.42643976", "0.42619598", "0.42586723", "0.4258227", "0.42567784", "0.4256567", "0.42549032", "0.42547628", "0.42511517", "0.4249556", "0.42480797", "0.42455667", "0.42442778", "0.42403415", "0.42401913", "0.423856", "0.42363122", "0.42361078", "0.42348456", "0.42348197" ]
0.6658454
0
Determines the type of command in the encrypted payload This method is called during a session, after the authentication protocol
private String getSessionCommand(byte[] message) { // Various accepted options byte[] pw = "password:".getBytes(); byte[] view = "view".getBytes(); byte[] update = "update:".getBytes(); byte[] delete = "delete".getBytes(); String resp; if (Arrays.equals(Arrays.copyOf(message, pw.length), pw) && !passVerified) { resp = "password"; } else if (passVerified) { if (Arrays.equals(Arrays.copyOf(message, view.length), view)) { resp = "view"; } else if (Arrays.equals(Arrays.copyOf(message, update.length), update)) { resp = "update"; } else if (Arrays.equals(Arrays.copyOf(message, delete.length), delete)) { resp = "delete"; } else { resp = "BAD INPUT ERROR"; } } else { ComMethods.report("ERROR ~~ password already set.",simMode); resp = "BAD INPUT ERROR"; } // ComMethods.report("SecretServer has understood User's message of \""+resp+"\".", simMode); // return resp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getCommandType() {\n return commandType;\n }", "private byte[] handleAuthPt2(byte[] payload) { \n\t\tbyte[] message = ComMethods.decryptRSA(payload, my_n, my_d);\n\t\tComMethods.report(\"SecretServer has decrypted the User's message using SecretServer's private RSA key.\", simMode);\n\t\t\n\t\tif (!Arrays.equals(Arrays.copyOf(message, myNonce.length), myNonce)) {\n\t\t\tComMethods.report(\"ERROR ~ invalid third message in protocol.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Authentication done!\n\t\t\tcurrentSessionKey = Arrays.copyOfRange(message, myNonce.length, message.length);\n\t\t\tactiveSession = true;\n\t\t\tcounter = 11;\n\n\t\t\t// use \"preparePayload\" from now on for all outgoing messages\n\t\t\tbyte[] responsePayload = preparePayload(\"understood\".getBytes());\n\t\t\tcounter = 13;\n\t\t\treturn responsePayload;\n\t\t} \n\t}", "public int getPasswordType() throws RemoteException;", "@gw.internal.gosu.parser.ExtendedProperty\n public typekey.LoadCommandType getCommandType();", "public CommandType commandType() {\n // Logik: Deal with the specific types first, then assume that whatever's left is arithmetic\n\n // Default case\n CommandType type = CommandType.C_ARITHMETIC;\n // Deal with instruction\n switch (instructionChunks[0]) {\n case \"push\":\n type = CommandType.C_PUSH;\n break;\n case \"pop\":\n type = CommandType.C_POP;\n }\n return type;\n }", "@Override\n public void handle(AuthDataEvent event, Channel channel)\n {\n PacketReader reader = new PacketReader(event.getBuffer());\n ChannelBuffer buffer =ChannelBuffers.buffer(ByteOrder.LITTLE_ENDIAN, 1024);\n buffer.writeBytes(event.getBuffer());\n \n int ptype = buffer.readUnsignedShort();\n \n //Skip over the length field since it's checked in decoder\n reader.setOffset(2);\n\n int packetType = reader.readUnSignedShort();\n\n switch (packetType)\n {\n /*\n * Auth Request\n * 0\t ushort 52\n * 2\t ushort 1051\n * 4\t string[16]\t Account_Name\n * 20\t string[16]\t Account_Password\n * 36\t string[16]\t GameServer_Name\n */\n case PacketTypes.AUTH_REQUEST:\n String username = reader.readString(16).trim();\n String password = reader.readString(16).trim();\n String server = reader.readString(16).trim();\n\n //If valid forward to game server else boot them\n if (db.isUserValid(username, \"root\"))\n {\n byte []packet = AuthResponse.build(db.getAcctId(username), \"127.0.0.1\", 8080);\n \n event.getClient().getClientCryptographer().Encrypt(packet);\n \n ChannelBuffer buf = ChannelBuffers.buffer(packet.length);\n \n buf.writeBytes(packet);\n \n ChannelFuture complete = channel.write(buf);\n \n //Close the channel once packet is sent\n complete.addListener(new ChannelFutureListener() {\n\n @Override\n public void operationComplete(ChannelFuture arg0) throws Exception {\n arg0.getChannel().close();\n }\n });\n \n } else\n channel.close();\n \n \n MyLogger.appendLog(Level.INFO, \"Login attempt from \" + username + \" => \" + password + \" Server => \" + server);\n break;\n \n default:\n MyLogger.appendLog(Level.INFO, \"Unkown packet: ID = \" + packetType + new String(event.getBuffer())); \n break;\n }\n }", "TransmissionProtocol.Type getType();", "public boolean auth(boolean reauth) throws IOException {\r\n log.debug(\"auth Authentication method starts\");\r\n if(alreadyAuthorized && !reauth) {\r\n \tlog.debug(\"auth Already Authorized.\");\r\n \treturn true;\r\n }\r\n\r\n AuthCmdPayload sendPayload = new AuthCmdPayload();\r\n log.debug(\"auth Sending CmdPacket with AuthCmdPayload: cmd=\" + Integer.toHexString(sendPayload.getCommand())\r\n + \" len=\" + sendPayload.getPayload().getData().length);\r\n\r\n log.debug(\"auth AuthPayload initial bytes to send: {}\", DatatypeConverter.printHexBinary(sendPayload.getPayload().getData()));\r\n\r\n DatagramPacket recvPack = sendCmdPkt(10000, 2048, sendPayload);\r\n\r\n byte[] data = recvPack.getData();\r\n \r\n if(data.length <= 0) {\r\n log.error(\"auth Received 0 bytes on initial request.\");\r\n alreadyAuthorized = false;\r\n return false;\r\n }\r\n\r\n log.debug(\"auth recv encrypted data bytes (\" + data.length +\") after initial req: {}\", DatatypeConverter.printHexBinary(data));\r\n\r\n byte[] payload = null;\r\n try {\r\n log.debug(\"auth Decrypting encrypted data\");\r\n\r\n payload = decryptFromDeviceMessage(data);\r\n\r\n log.debug(\"auth Decrypted. len=\" + payload.length);\r\n\r\n } catch (Exception e) {\r\n log.error(\"auth Received datagram decryption error. Aborting method\", e);\r\n alreadyAuthorized = false;\r\n return false;\r\n }\r\n\r\n log.debug(\"auth Packet received payload bytes: \" + DatatypeConverter.printHexBinary(payload));\r\n\r\n key = subbytes(payload, 0x04, 0x14);\r\n\r\n log.debug(\"auth Packet received key bytes: \" + DatatypeConverter.printHexBinary(key));\r\n\r\n if (key.length % 16 != 0) {\r\n log.error(\"auth Received key len is not a multiple of 16! Aborting\");\r\n alreadyAuthorized = false;\r\n return false;\r\n }\r\n\r\n // recreate AES object with new key\r\n aes = new AES(iv, key);\r\n\r\n id = subbytes(payload, 0x00, 0x04);\r\n\r\n log.debug(\"auth Packet received id bytes: \" + DatatypeConverter.printHexBinary(id) + \" with ID len=\" + id.length);\r\n\r\n log.debug(\"auth End of authentication method\");\r\n alreadyAuthorized = true;\r\n\r\n return true;\r\n }", "public Command commandType() {\r\n if (command.startsWith(\"push\")) {\r\n return Command.C_PUSH;\r\n } else if (command.startsWith(\"pop\")) {\r\n return Command.C_POP;\r\n } else if (isArithmeticCmd()) {\r\n return Command.C_ARITHMETIC;\r\n } else if (command.startsWith(\"label\")) {\r\n return Command.C_LABEL;\r\n } else if (command.startsWith(\"goto\")) {\r\n return Command.C_GOTO;\r\n } else if (command.startsWith(\"if-goto\")) {\r\n return Command.C_IF;\r\n } else if (command.startsWith(\"function\")) {\r\n return Command.C_FUNCTION;\r\n } else if (command.startsWith(\"call\")) {\r\n return Command.C_CALL;\r\n } else if (command.startsWith(\"return\")) {\r\n return Command.C_RETURN;\r\n } else {\r\n return null;\r\n }\r\n }", "private boolean readCommand() {\n\n\t\ttry {\n\t\t\ttab = (String[]) is.readObject();\n\t\t} \n\t\tcatch (Exception e){ // catch a general exception\n\t\t\tthis.closeSocket();\n\t\t\treturn false;\n\t\t}\n\t\tSystem.out.println(\"01. <- Received a String object from the client (\" + tab + \").\");\n\n\t\t// At this point there is a valid String object\n\t\t// invoke the appropriate function based on the command \n\n\t\tString s=tab[0];\n\n\t\t// Connexion of the Client to the Server\n\t\tif (s.equalsIgnoreCase(\"connexion\")){ \n\t\t\tthis.connexion(); \n\t\t} \n\n\t\t// Case of Send New Message\n\t\tif (s.equalsIgnoreCase(\"remplirTabNewMess\")){\n\t\t\tthis.remplirTabNewMess();\n\t\t}\n\n\t\t// Recuperation of all messages\n\t\tif (s.equalsIgnoreCase(\"RecupArray\")){\n\t\t\tthis.RecupArray();\n\t\t}\n\n\n\t\treturn true;\n\t}", "public String getUserCommand();", "switch (buffer[ISO7816.OFFSET_CDATA + 4]) {\r\n\t\tcase BASIC:\r\n\t\t\tsetSignatureType(BASIC);\r\n\t\t\tbreak;\r\n\t\tcase AUTHENTICATION: // use authentication private key\r\n\t\t\tsetSignatureType(AUTHENTICATION);\r\n\t\t\tbreak;\r\n\t\tcase NON_REPUDIATION: // use non repudiation private key\r\n\t\t\tsetSignatureType(NON_REPUDIATION);\r\n\t\t\tbreak;\r\n\t\tcase CA_ROLE:\r\n\t\t\tsetSignatureType(NO_SIGNATURE);\r\n\t\t\tISOException.throwIt(ISO7816.SW_WRONG_DATA);\r\n\t\t\tbreak; //~allow_dead_code\r\n\t\tdefault:\r\n\t\t\tsetSignatureType(NO_SIGNATURE);\r\n\t\t\tISOException.throwIt(SW_REFERENCE_DATA_NOT_FOUND);\r\n\t\t\tbreak; //~allow_dead_code\r\n\t\t}", "public byte[] getMessage(byte[] payload, boolean partTwo) {\n\t\tComMethods.report(\"SecretServer received payload and will now process it.\", simMode);\n\t\tbyte[] resp = new byte[0];\n\t\tif (activeSession) {\n\t\t\t// Extract message from active session payload\n\t\t\tbyte[] message = processPayload(payload);\n\n\t\t\tswitch (getSessionCommand(message)) {\n\t\t\t\tcase \"password\":\n\t\t\t\t\tresp = handlePassword(message);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"view\":\n\t\t\t\t\tresp = handleView();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"update\":\n\t\t\t\t\tresp = handleUpdate(message);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"delete\":\n\t\t\t\t\tresp = handleDelete();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tComMethods.handleBadResp();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcounter = counter + 2;\n\t\t} else if (!partTwo) {\n\t\t\tresp = handleAuthPt1(payload);\n\t\t} else if (userSet && partTwo) {\n\t\t\tresp = handleAuthPt2(payload);\n\t\t} else {\n\t\t\t// Something's wrong\n\t\t\tComMethods.handleBadResp();\n\t\t}\n\t\treturn resp;\n\t}", "private void extractCommand() throws IllegalCommandException {\n if (userInput.contentEquals(COMMAND_WORD_BYE)) {\n commandType = CommandType.BYE;\n } else if (userInput.startsWith(COMMAND_WORD_LIST)) {\n commandType = CommandType.LIST;\n } else if (userInput.startsWith(COMMAND_WORD_DONE)) {\n commandType = CommandType.DONE;\n } else if (userInput.startsWith(COMMAND_WORD_TODO)) {\n commandType = CommandType.TODO;\n } else if (userInput.startsWith(COMMAND_WORD_DEADLINE)) {\n commandType = CommandType.DEADLINE;\n } else if (userInput.startsWith(COMMAND_WORD_EVENT)) {\n commandType = CommandType.EVENT;\n } else if (userInput.startsWith(COMMAND_WORD_DELETE)) {\n commandType = CommandType.DELETE;\n } else if (userInput.startsWith(COMMAND_WORD_FIND)) {\n commandType = CommandType.FIND;\n } else if (userInput.contentEquals(COMMAND_WORD_HELP)) {\n commandType = CommandType.HELP;\n } else {\n throw new IllegalCommandException();\n }\n }", "public Binder command(Binder params) throws ClientError, EncryptionError {\n Binder result = null;\n try {\n result = Binder.fromKeysValues(\n \"result\",\n executeAuthenticatedCommand(\n Boss.unpack(\n (version >= 2) ?\n sessionKey.etaDecrypt(params.getBinaryOrThrow(\"params\")) :\n sessionKey.decrypt(params.getBinaryOrThrow(\"params\"))\n )\n )\n );\n } catch (Exception e) {\n ErrorRecord r = (e instanceof ClientError) ? ((ClientError) e).getErrorRecord() :\n new ErrorRecord(Errors.COMMAND_FAILED, \"\", e.getMessage());\n result = Binder.fromKeysValues(\n \"error\", r\n );\n }\n // encrypt and return result\n return Binder.fromKeysValues(\n \"result\",\n (version >= 2) ? sessionKey.etaEncrypt(Boss.pack(result)) : sessionKey.encrypt(Boss.pack(result))\n );\n }", "private byte[] handleAuthPt1(byte[] payload) {\n\t\tboolean userIdentified = false;\n\t\tbyte[] supposedUser = null;\n\n//\n\t\tSystem.out.println(\"payload received by SecretServer:\");\n\t\tComMethods.charByChar(payload,true);\n//\n\n\t\tuserNum = -1;\n\t\twhile (userNum < validUsers.length-1 && !userIdentified) {\n\t\t\tuserNum++;\n\t\t\tsupposedUser = validUsers[userNum].getBytes();\n\t\t\tuserIdentified = Arrays.equals(Arrays.copyOf(payload, supposedUser.length), supposedUser);\n\n//\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"\\\"\"+validUsers[userNum]+\"\\\" in bytes:\");\n\t\t\tComMethods.charByChar(validUsers[userNum].getBytes(),true);\n\t\t\tSystem.out.println(\"\\\"Arrays.copyOf(payload, supposedUser.length\\\" in bytes:\");\n\t\t\tComMethods.charByChar(Arrays.copyOf(payload, supposedUser.length),true);\n\t\t\tSystem.out.println();\n//\n\t\t}\n\n\t\tif (!userIdentified) {\n\t\t\tComMethods.report(\"SecretServer doesn't recognize name of valid user.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Process second half of message, and verify format\n\t\t\tbyte[] secondHalf = Arrays.copyOfRange(payload, supposedUser.length, payload.length);\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tsecondHalf = ComMethods.decryptRSA(secondHalf, my_n, my_d);\n\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tComMethods.report(\"SecretServer has decrypted the second half of the User's message using SecretServer's private RSA key.\", simMode);\n\n\t\t\tif (!Arrays.equals(Arrays.copyOf(secondHalf, supposedUser.length), supposedUser)) {\n\t\t\t\t// i.e. plaintext name doesn't match the encrypted bit\n\t\t\t\tComMethods.report(\"ERROR ~ invalid first message in protocol.\", simMode);\t\t\t\t\n\t\t\t\treturn \"error\".getBytes();\n\t\t\t} else {\n\t\t\t\t// confirmed: supposedUser is legit. user\n\t\t\t\tcurrentUser = new String(supposedUser); \n\t\t\t\tuserSet = true;\n\t\t\t\tbyte[] nonce_user = Arrays.copyOfRange(secondHalf, supposedUser.length, secondHalf.length);\n\n\t\t\t\t// Second Message: B->A: E_kA(nonce_A || Bob || nonce_B)\n\t\t\t\tmyNonce = ComMethods.genNonce();\n\t\t\t\tComMethods.report(\"SecretServer has randomly generated a 128-bit nonce_srvr = \"+myNonce+\".\", simMode);\n\t\t\t\n\t\t\t\tbyte[] response = ComMethods.concatByteArrs(nonce_user, \"SecretServer\".getBytes(), myNonce);\n\t\t\t\tbyte[] responsePayload = ComMethods.encryptRSA(response, usersPubKeys1[userNum], BigInteger.valueOf(usersPubKeys2[userNum]));\n\t\t\t\treturn responsePayload;\n\t\t\t}\n\t\t}\n\t}", "public NettyDecodedRequestMessage(String handlerUuid, ChannelHandlerContext channelContext,\n AbstractOperationsCommand<SpecificRecordBase, SpecificRecordBase> command, ChannelType channelType) {\n super(handlerUuid, channelContext, command, channelType);\n }", "public void setCommandType(CommandType commandType) {\n this.commandType = commandType;\n }", "public int getPayloadType() {\n return (buffer.get(1) & 0xff & 0x7f);\n }", "@Override\n public AuthData authenticate(AuthData commandData) throws AuthenticationException {\n // init\n if (Arrays.equals(commandData.getBytes(), AuthData.INIT_AUTH_DATA)) {\n if (pulsarSaslClient.hasInitialResponse()) {\n return pulsarSaslClient.evaluateChallenge(AuthData.of(new byte[0]));\n }\n return AuthData.of(new byte[0]);\n }\n\n return pulsarSaslClient.evaluateChallenge(commandData);\n }", "private ResponseEntity<?> onPost(RequestEntity<String> requestEntity)\n throws IOException, ExecutionException, InterruptedException, InvalidKeyException,\n BadPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException,\n NoSuchPaddingException, ShortBufferException, InvalidKeySpecException,\n InvalidAlgorithmParameterException, NoSuchProviderException {\n\n getLogger().info(requestEntity.toString());\n\n final String authorization = requestEntity.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);\n final UUID sessionId;\n final To2DeviceSessionInfo session;\n final AuthToken authToken;\n\n try {\n authToken = new AuthToken(authorization);\n sessionId = authToken.getUuid();\n session = getSessionStorage().load(sessionId);\n\n } catch (IllegalArgumentException | NoSuchElementException e) {\n return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();\n }\n\n // if any instance is corrupted/absent, the session data is unavailable, so terminate the\n // connection.\n if (null != session && (!(session.getMessage41Store() instanceof Message41Store)\n || (null == session.getMessage41Store())\n || !(session.getMessage45Store() instanceof Message45Store)\n || (null == session.getMessage45Store())\n || !(session.getDeviceCryptoInfo() instanceof DeviceCryptoInfo)\n || null == session.getDeviceCryptoInfo())) {\n return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();\n }\n\n final String requestBody = null != requestEntity.getBody() ? requestEntity.getBody() : \"\";\n\n final ByteBuffer xb =\n new KexParamCodec().decoder().apply(CharBuffer.wrap(session.getMessage45Store().getXb()));\n final To2CipherContext cipherContext =\n new To2CipherContextFactory(getKeyExchangeDecoder(), getSecureRandom())\n .build(session.getMessage41Store(), xb.duplicate());\n\n final EncryptedMessageCodec encryptedMessageCodec = new EncryptedMessageCodec();\n final EncryptedMessage deviceEncryptedMessage =\n encryptedMessageCodec.decoder().apply(CharBuffer.wrap(requestBody));\n final ByteBuffer decryptedBytes = cipherContext.read(deviceEncryptedMessage);\n final CharBuffer decryptedText = US_ASCII.decode(decryptedBytes);\n getLogger().info(decryptedText.toString());\n\n final To2NextDeviceServiceInfo nextDeviceServiceInfo =\n new To2NextDeviceServiceInfoCodec().decoder().apply(decryptedText);\n\n final OwnershipProxy proxy = new OwnershipProxyCodec.OwnershipProxyDecoder()\n .decode(CharBuffer.wrap(session.getMessage41Store().getOwnershipProxy()));\n if (null == proxy) {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"OwnershipVoucher must not be null\"));\n }\n\n for (Object serviceInfoObject : getServiceInfoModules()) {\n\n if (serviceInfoObject instanceof ServiceInfoSink) {\n final ServiceInfoSink sink = (ServiceInfoSink) serviceInfoObject;\n\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n sink.putServiceInfo(entry);\n }\n\n } else if (serviceInfoObject instanceof ServiceInfoMultiSink) {\n final ServiceInfoMultiSink sink = (ServiceInfoMultiSink) serviceInfoObject;\n final ServiceInfo serviceInfos = new ServiceInfo();\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n serviceInfos.add(entry);\n }\n sink.putServiceInfo(proxy.getOh().getG(), serviceInfos);\n\n }\n }\n\n String responseBody;\n final OwnershipProxy newProxy;\n int nn = nextDeviceServiceInfo.getNn() + 1;\n if (nn < session.getMessage45Store().getNn()) {\n final StringWriter writer = new StringWriter();\n final To2GetNextDeviceServiceInfo getNextDeviceServiceInfo =\n new To2GetNextDeviceServiceInfo(nn, new PreServiceInfo());\n new To2GetNextDeviceServiceInfoCodec().encoder().apply(writer, getNextDeviceServiceInfo);\n newProxy = null;\n responseBody = writer.toString();\n\n } else {\n\n final OwnershipProxy currentProxy = proxy;\n final Setup devSetup =\n setupDeviceService.setup(currentProxy.getOh().getG(), currentProxy.getOh().getR());\n final To2SetupDeviceNoh setupDeviceNoh = new To2SetupDeviceNoh(devSetup.r3(), devSetup.g3(),\n new Nonce(CharBuffer.wrap(session.getMessage45Store().getN7())));\n\n final StringWriter bo = new StringWriter();\n new To2SetupDeviceNohCodec().encoder().apply(bo, setupDeviceNoh);\n\n final SignatureBlock noh =\n signatureServiceFactory.build(proxy.getOh().getG()).sign(bo.toString()).get();\n\n final OwnerServiceInfoHandler ownerServiceInfoHandler =\n new OwnerServiceInfoHandler(getServiceInfoModules(), proxy.getOh().getG());\n final int osinn = ownerServiceInfoHandler.getOwnerServiceInfoEntryCount();\n\n final To2SetupDevice setupDevice = new To2SetupDevice(osinn, noh);\n final StringWriter writer = new StringWriter();\n final PublicKeyCodec.Encoder pkEncoder =\n new PublicKeyCodec.Encoder(currentProxy.getOh().getPe());\n final SignatureBlockCodec.Encoder sgEncoder = new SignatureBlockCodec.Encoder(pkEncoder);\n new To2SetupDeviceCodec.Encoder(sgEncoder).encode(writer, setupDevice);\n responseBody = writer.toString();\n\n final OwnershipProxyHeader currentOh = currentProxy.getOh();\n final OwnershipProxyHeader newOh = new OwnershipProxyHeader(currentOh.getPe(), devSetup.r3(),\n devSetup.g3(), currentOh.getD(), noh.getPk(), currentOh.getHdc());\n newProxy = new OwnershipProxy(newOh, new HashMac(MacType.NONE, ByteBuffer.allocate(0)),\n currentProxy.getDc(), new LinkedList<>());\n }\n getLogger().info(responseBody);\n\n // if the CTR nonce is null, it means that the session's IV has been lost/corrupted. For CBC, it\n // should have been all 0s, while for CTR, it should contain the current nonce.\n if (null != session.getDeviceCryptoInfo().getCtrNonce()) {\n final ByteBuffer nonce = new ByteArrayCodec().decoder()\n .apply(CharBuffer.wrap(session.getDeviceCryptoInfo().getCtrNonce()));\n cipherContext.setCtrNonce(nonce.array());\n cipherContext.setCtrCounter(session.getDeviceCryptoInfo().getCtrCounter());\n } else {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"no cipher initialization vector found\"));\n }\n final ByteBuffer responseBodyBuf = US_ASCII.encode(responseBody);\n final EncryptedMessage ownerEncryptedMessage = cipherContext.write(responseBodyBuf);\n\n final StringWriter writer = new StringWriter();\n encryptedMessageCodec.encoder().apply(writer, ownerEncryptedMessage);\n responseBody = writer.toString();\n\n final StringWriter opWriter = new StringWriter();\n if (null != newProxy) {\n new OwnershipProxyCodec.OwnershipProxyEncoder().encode(opWriter, newProxy);\n }\n final StringWriter ctrNonceWriter = new StringWriter();\n new ByteArrayCodec().encoder().apply(ctrNonceWriter,\n ByteBuffer.wrap(cipherContext.getCtrNonce()));\n\n final DeviceCryptoInfo deviceCryptoInfo =\n new DeviceCryptoInfo(ctrNonceWriter.toString(), cipherContext.getCtrCounter());\n final Message47Store message47Store = new Message47Store(opWriter.toString());\n final To2DeviceSessionInfo to2DeviceSessionInfo = new To2DeviceSessionInfo();\n to2DeviceSessionInfo.setMessage47Store(message47Store);\n to2DeviceSessionInfo.setDeviceCryptoInfo(deviceCryptoInfo);\n getSessionStorage().store(sessionId, to2DeviceSessionInfo);\n\n ResponseEntity<?> responseEntity =\n ResponseEntity.ok().header(HttpHeaders.AUTHORIZATION, authorization)\n .contentType(MediaType.APPLICATION_JSON).body(responseBody);\n\n getLogger().info(responseEntity.toString());\n return responseEntity;\n }", "public byte [] GetPayload_Generic(int cmd ) {\n // Construct payload as series of delimited strings\n List<Byte> payload = new ArrayList<Byte>();\n payload.add((byte)cmd);\n payload.add((byte)0);\n return makeTransportPacket_Generic(payload);\n }", "CommandTypes(String command) {\n this.command = command;\n }", "public String getToken_type() {\r\n\t\treturn token_type;\r\n\t}", "public char message_type_GET()\n { return (char)((char) get_bytes(data, 0, 2)); }", "private boolean readCommand() {\r\n String s = null;\r\n try {\r\n s = (String) is.readObject();\r\n } \r\n catch (Exception e){ // catch a general exception\r\n \tthis.closeSocket();\r\n return false;\r\n }\r\n System.out.println(\"01. <- Received a String object from the client (\" + s + \").\");\r\n \r\n // At this point there is a valid String object\r\n // invoke the appropriate function based on the command \r\n if (s.equalsIgnoreCase(\"GetDate\")){ \r\n this.getDate(); \r\n } else if (s.equalsIgnoreCase(\"GetTemperature\")) {\r\n \t\r\n \tthis.getTemperature();\r\n \t\r\n }\r\n \r\n else { \r\n this.sendError(\"Invalid command: \" + s); \r\n }\r\n return true;\r\n }", "@Override\n\tpublic void interpretBytes() {\n\t\tuserSession.getUser().setMagicIndex(input.getInt(0x14));\n\t\tuserSession.getUser().setWeaponIndex(input.getInt(0x18));\n\t\tuserSession.getUser().setAccessoryIndex(input.getInt(0x1C));\n\t\tuserSession.getUser().setPetIndex(input.getInt(0x20));\n\t\tuserSession.getUser().setFootIndex(input.getInt(0x24));\n\t\tuserSession.getUser().setBodyIndex(input.getInt(0x28));\n\t\tuserSession.getUser().setHand1Index(input.getInt(0x2C));\n\t\tuserSession.getUser().setHand2Index(input.getInt(0x30));\n\t\tuserSession.getUser().setFaceIndex(input.getInt(0x34));\n\t\tuserSession.getUser().setHairIndex(input.getInt(0x38));\n\t\tuserSession.getUser().setHeadIndex(input.getInt(0x3C));\n\t}", "@Override\n public void channelRead(ChannelHandlerContext ctx, Object msg) {\n if (ctx.channel().attr(AUTH).get() != AuthStep.STEP_AUTHED) {\n return;\n }\n\n AbstractRealmClientPacket request = (AbstractRealmClientPacket) msg;\n\n AbstractRealmServerPacket response = null;\n\n logger.info(msg.toString());\n\n switch (request.getOpcode()) {\n case CMSG_PING:\n response = new SMSG_PING(Opcodes.SMSG_PING);\n\n int ping = ((CMSG_PING) request).getPing();\n\n ((SMSG_PING) response).setPing(ping);\n\n break;\n case CMSG_CHAR_ENUM:\n response = new SMSG_CHAR_ENUM(Opcodes.SMSG_CHAR_ENUM);\n\n // Adding character list.\n ((SMSG_CHAR_ENUM) response).addCharacters(characterService.getCharactersForAccount(ctx.channel().attr(ACCOUNT).get()));\n\n break;\n case CMSG_CHAR_CREATE:\n response = new SMSG_CHAR_CREATE(Opcodes.SMSG_CHAR_CREATE);\n\n ((SMSG_CHAR_CREATE) response).setResult(\n characterService.createChar(\n ((CMSG_CHAR_CREATE) request).getName(),\n ((CMSG_CHAR_CREATE) request).getRace(),\n ((CMSG_CHAR_CREATE) request).getCharClass(),\n ((CMSG_CHAR_CREATE) request).getGender(),\n ((CMSG_CHAR_CREATE) request).getSkin(),\n ((CMSG_CHAR_CREATE) request).getFace(),\n ((CMSG_CHAR_CREATE) request).getHairStyle(),\n ((CMSG_CHAR_CREATE) request).getHairColor(),\n ((CMSG_CHAR_CREATE) request).getFacialHair(),\n ctx.pipeline().get(RealmAuthHandler.class).getAccount()\n )\n );\n\n break;\n case CMSG_CHAR_DELETE:\n response = new SMSG_CHAR_DELETE(Opcodes.SMSG_CHAR_DELETE);\n\n ((SMSG_CHAR_DELETE) response).setResult(\n characterService.deleteChar(\n ((CMSG_CHAR_DELETE) request).getId(),\n ctx.pipeline().get(RealmAuthHandler.class).getAccount(),\n false\n )\n );\n\n break;\n\n case CMSG_PLAYER_LOGIN:\n if (characterService.loginChar(((CMSG_PLAYER_LOGIN) request).getId(), \n ctx.pipeline().get(RealmAuthHandler.class).getAccount())) {\n SMSG_LOGIN_VERIFY_WORLD packet = new SMSG_LOGIN_VERIFY_WORLD();\n \n /**packet.setMap(characterService.getLoggedCharacter().getFkDbcMap());\n packet.setPosX(characterService.getLoggedCharacter().getPositionX());\n packet.setPosY(characterService.getLoggedCharacter().getPositionY());\n packet.setPosZ(characterService.getLoggedCharacter().getPositionZ());\n packet.setOrientation(characterService.getLoggedCharacter().getOrientation());*/\n \n ctx.write(packet);\n \n SMSG_ACCOUNT_DATA_TIMES data = new SMSG_ACCOUNT_DATA_TIMES();\n \n ctx.write(data);\n \n \n } else {\n // Kick unknown client. \n ctx.close();\n }\n\n break;\n\n default:\n logger.error(\"Packet received, opcode not handled: \" + request.getOpcode());\n break;\n }\n\n if(response != null){ \n ctx.writeAndFlush(response);\n } else {\n // Let pass this to other handlers.\n ctx.fireChannelRead(msg);\n }\n }", "@Override\n\tpublic void interpretBytes() {\n\t\telementType = input.getInt(0x14);\n\t\tcardLevel = input.getInt(0x18);\n\t\tcardType = input.getInt(0x1C); // first digit - item type (weapon/accessory/magic/...). second digit - subtype (axe/sword/...). 0 for elements\n\t\t\n\t\tSystem.out.println(elementType);\n\t\tSystem.out.println(cardLevel);\n\t\tSystem.out.println(cardType);\n\t}", "private DecoderState readCommand(ByteBuf in) {\n\n DecoderState nextState = DecoderState.READ_COMMAND;\n String line = readLine(in);\n\n if (line != null) {\n command = Command.valueOf(line);\n nextState = DecoderState.READ_HEADERS;\n }\n\n return nextState;\n }", "byte getCommand(int n) {\r\n return command_journal[n];\r\n }", "network.message.PlayerResponses.Command getCommand();", "public int getPayloadType() {\n return _payload;\n }", "public void onCommandReceived(AbstractCommand command) {\n\t\t\t\t\t\tif (command instanceof GrantedSessionCommand) {\n\t\t\t\t\t\t\t// Print our our unique key, this will be used for\n\t\t\t\t\t\t\t// subsequent connections\n\t\t\t\t\t\t\tUtilities.log(\"Your instanceId is \" + ((GrantedSessionCommand) command).getInstanceId());\n\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t//let's make the dock show up on the TV\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_yahoo\"));\n\n\t\t\t\t\t\t\t\tThread.sleep(2000); //sleep for 2 seconds so the animation to dock finishes\n\n\t\t\t\t\t\t\t\t// Lets do something cool, like tell the TV to navigate to the right. Then do a little dance\n\t\t\t\t\t\t\t\t// This is the same as pressing \"right\" on your remote\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_right\"));\n\n\t\t\t\t\t\t\t\tThread.sleep(1000);\n\n\t\t\t\t\t\t\t\t// slide to the left\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_left\"));\n\n\t\t\t\t\t\t\t\tThread.sleep(1000);\n\n\t\t\t\t\t\t\t\t//slide to the right\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_right\"));\n\n\t\t\t\t\t\t\t\tThread.sleep(1000);\n\n\t\t\t\t\t\t\t\t//take it back now, y'all\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_left\"));\n\n\t\t\t\t\t\t\t\t//cha cha cha\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_up\"));\n\t\t\t\t\t\t\t\tThread.sleep(1000);\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_down\"));\n\t\t\t\t\t\t\t\tThread.sleep(1000);\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_up\"));\n\t\t\t\t\t\t\t\tThread.sleep(1000);\n\t\t\t\t\t\t\t\trouter.publishCommand(new NavigationInputCommand(\"press_down\"));\n\t\t\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t\t\tUtilities.log(\"Problem writing to the network connection\");\n\t\t\t\t\t\t\t\tconn.close();\n\t\t\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Notify the main thread that everything we wanted to\n\t\t\t\t\t\t\t// do is done.\n\t\t\t\t\t\t\tsynchronized (conn) {\n\t\t\t\t\t\t\t\tconn.notifyAll();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { // print out the others for educational purposes\n\t\t\t\t\t\t\tUtilities.log(\"Received: \" + command.toString());\n\t\t\t\t\t\t}\n\t\t\t\t\t}", "public Global.CommandType determineCommandType(String userCommand) {\n\t\tif (userCommand == null || userCommand.equals(\"\")) {\n\t\t\tlogger.log(Level.WARNING, Global.MESSAGE_ILLEGAL_ARGUMENTS);\n\t\t\treturn Global.CommandType.INVALID;\n\t\t}\n\n\t\tString commandTypeString;\n\n\t\ttry {\n\t\t\tcommandTypeString = getFirstWord(userCommand);\n\t\t} catch (Exception e) {\n\t\t\tlogger.log(Level.INFO, MESSAGE_NO_COMMANDTYPE);\n\t\t\treturn Global.CommandType.INVALID;\n\t\t}\n\n\t\tif (commandTypeString.equalsIgnoreCase(\"add\")) {\n\t\t\treturn Global.CommandType.ADD;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"update\")) {\n\t\t\treturn Global.CommandType.UPDATE;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"done\")) {\n\t\t\treturn Global.CommandType.DONE;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"open\")) {\n\t\t\treturn Global.CommandType.OPEN;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"delete\")) {\n\t\t\treturn Global.CommandType.DELETE;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"clear\")) {\n\t\t\treturn Global.CommandType.CLEAR;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"display\")) {\n\t\t\treturn Global.CommandType.DISPLAY;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"search\")) {\n\t\t\treturn Global.CommandType.SEARCH;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"sync\")) {\n\t\t\treturn Global.CommandType.SYNC;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"undo\")) {\n\t\t\treturn Global.CommandType.UNDO;\n\t\t} else if (commandTypeString.equalsIgnoreCase(\"exit\")) {\n\t\t\treturn Global.CommandType.EXIT;\n\t\t} else {\n\t\t\treturn Global.CommandType.INVALID;\n\t\t}\n\t}", "public byte [] GetPayload_Generic(byte cmd, byte [] data) {\n // Construct payload as series of delimited stringsƒsƒs\n List<Byte> payload = new ArrayList<Byte>();\n payload.add((byte)cmd);\n for (int i =0; i != data.length; i++)\n payload.add(data[i]);\n return makeTransportPacket_Generic(payload);\n }", "protected abstract InGameServerCommand getCommandOnConfirm();", "public abstract void setDecryptMode();", "public org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type getType() {\n org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type result = org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type.valueOf(type_);\n return result == null ? org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type.AUTH_QUERY : result;\n }", "static @NonNull ByteBuffer getMsg(int typ, int len) {\n ByteBuffer res = ByteBuffer.wrap(new byte[len]); // Create Authentication Request template\n res.put((byte)((ATH_VER << 4) | typ)); // Set the Qi-Authentication version and the Request type\n return res; // Return the Authentication Request template\n }", "public java.lang.Long getOpckeytype() {\n\t\treturn getValue(test.generated.pg_catalog.tables.PgOpclass.PG_OPCLASS.OPCKEYTYPE);\n\t}", "int getLoginType();", "public SatelCommandBase(byte commandCode, byte[] payload) {\n super(commandCode, payload);\n }", "public String getOriginalInput() {\n\t\treturn commandString;\n\t}", "private @NonNull ByteBuffer sndMsg(final @NonNull ByteBuffer req, int typ) throws IOException {\n final @NonNull byte[] ba = req.array(); // Get request\n WpcLog.log(WpcLog.EvtTyp.REQ, ba); // Log request\n ByteBuffer res = ByteBuffer.wrap(mCom.sndMsg(ba)); // Send the Qi Authentication Request\n WpcLog.log(WpcLog.EvtTyp.RES, res.array()); // Log response\n if ((res.get() & AppLib.BYT_UNS) != ((ATH_VER << 4) | typ)) { // Unexpected type\n throw new IOException(); // Raise error\n }\n return res; // Return the Qi Authentication Response\n }", "public String getCommand() { return command; }", "@JsonIgnore\n\tdefault short getCmd() {\n\t\tMessageMeta annotation = getClass().getAnnotation(MessageMeta.class);\n\t\tif (annotation != null) {\n\t\t\treturn annotation.cmd();\n\t\t}\n\t\treturn 0;\n\t}", "public abstract String decryptMsg(String msg);", "public int getType() {\n return Command.TYPE_STORED_PROCEDURE;\n }", "public String getCryptoOperation() {\r\n\t\treturn this.cryptoOperation;\r\n\t}", "public EncryptorReturn decrytp(String in) throws CustomizeEncryptorException;", "public Byte getUserType() {\r\n return userType;\r\n }", "protected abstract DispatchOutcome dispatchCommand(CommandEnvelope cmd);", "private void command(){\n out.println(\"Enter command: \");\n String comInput = in.nextLine();\n\n if (comInput.toLowerCase().equals(\"vote\")) {\n voteCommand();\n }else if (comInput.toLowerCase().equals(\"trade\")){\n tradeCommand();\n }else if (comInput.toLowerCase().equals(\"next\")){\n out.println(waitPrint());\n await();\n// nextRound();\n }else if(comInput.toLowerCase().equals(\"logout\")){\n// login = false;\n logout();\n }\n }", "public byte[] GetPayload_Generic(int cmd, String [] data){\n // Construct payload as series of delimited strings\n List<Byte> payload = new ArrayList<Byte>();\n payload.add((byte)cmd);\n if (data.length == 0) {\n payload.add((byte)0);\n } else {\n int cc = 0;\n for(int i =0; i != data.length; i++){\n String item = data[i];\n for(int j=0; j!= item.length(); j++){\n char c = item.charAt(j);\n byte b = (byte)c;\n payload.add(b);\n }\n if (cc < data.length - 1) {\n payload.add((byte)DELIMITER);\n }\n cc = cc+ 1;\n }\n payload.add((byte)0);\n }\n\n return makeTransportPacket_Generic(payload);\n }", "public void setCommandType(String commandType) {\n this.commandType = commandType == null ? null : commandType.trim();\n }", "com.google.protobuf.ByteString\n getCommandBytes();", "public String getCommand() {\r\n return command;\r\n }", "NegotiationTransmissionType getTransmissionType();", "java.lang.String getCommand();", "public org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type getType() {\n org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type result = org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type.valueOf(type_);\n return result == null ? org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message.Type.AUTH_QUERY : result;\n }", "public void setCommandType(typekey.LoadCommandType value);", "protected String getAuthMethod() {\n return \"Token\" ;// TODO this.conf.getAuthMethod();\n }", "org.hyperledger.fabric.protos.token.Transaction.PlainTokenAction getPlainAction();", "private String getTypeOfTransaction(String transact) {\n\t\tif ( transact.indexOf(\"w\") != -1 ) {\n\t\t\treturn TRANSTYPE_WRITABLE;\n\t\t} \n\t\treturn TRANSTYPE_READABLE;\n\t}", "private void getAUTH_REQUEST() throws Exception {\n\t\t\n\t\tboolean status = true;\n\t\tboolean status2 = false;\n\t\tString msg = \"\";\n\t\t\n\t\t//File filePK = new File(\"identity\");\n\t\n\t\ttry {\n\t\t\t\n\t\t\tmsg = br.readLine();\n\t\t\tGetTimestamp(\"Received Authorization Request from Client: \" + msg);\n\t\t\t\n\t\t\tJSONObject REQUEST = (JSONObject) parser.parse(msg);\n\t String identity = REQUEST.get(\"identity\").toString();\n\t\t\t\n\t\t\t\n\t if((identity.contains(\"aaron@krusty\"))) {\n\n\t \tGetTimestamp(\"Authorization Request from Client is approved: \");\n\n\t \tGetTimestamp(\"Client Publickey is stored: \" ) ;\n\n\t \tString tosend = encrypt1(getSharedKey(), getClientPublicKey());\n\n\t \tGetTimestamp(\"Server sharedkey is being encrypted with Client's publickey to be sent: \") ;\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"AES128\", tosend);\n\t \tRESPONSE.put(\"status\", status);\n\t \tRESPONSE.put(\"message\", \"public key found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tGetTimestamp(\"Sending Authorization Response to Client: \");\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\n\n\t }\n\t else {\n\n\t \tSystem.out.println(\"Client \" + REQUEST.get(\"identity\") + \" has been rejected\");\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"status\", status2);\n\t \tRESPONSE.put(\"message\", \"public key not found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\t \tcloseConnection();\n\t }\n\t\t\t\t\n\t\t\t\n\t\t} catch (IOException ex) {\n\t\t\tLogger.getLogger(ServerTCP.class.getName()).log(Level.SEVERE, null, ex);\n\t\t}\n\t\tif (msg.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"Client has signed out!\");\n\t\t\tcloseConnection();\n\n\t\t} else {\t\n\t\t\tgetMessage();\n\t\t}\n\t}", "public String getEncryptionScheme() {\n return encrypted;\n }", "public Byte getUserType() {\n return userType;\n }", "public interface PacketFormatKeyContext {\n\n}", "org.openxmlformats.schemas.presentationml.x2006.main.STAlgType.Enum getCryptAlgorithmType();", "public int getPayloadType() {\n return this.payloadType;\n }", "public String getAuthenticationType() {\n return this.authenticationType;\n }", "public String getEncryptionMode() {\n return this.encryptionMode;\n }", "public String getCommand()\r\n\t{\r\n\t\treturn command;\r\n\t}", "public void parseCommand(byte command) throws Exception {\r\n\r\n\t switch(command){\r\n\t case Constants.ROTATE_LEFT:\r\n\t rotateLeft();\r\n\t break;\r\n\t case Constants.ROTATE_RIGHT:\r\n\t rotateRight();\r\n\t break;\r\n\t case Constants.MOVE:\r\n\t move();\r\n\t break;\r\n\t default:\r\n\t throw new Exception(\"Invalid signal\");\r\n\t }\r\n\t }", "void decryptMessage(String Password);", "@Override\r\n\tpublic String getCOMMAND() {\n\t\treturn COMMAND;\r\n\t}", "@Override\n protected void channelRead0(ChannelHandlerContext ctx, Map<String, Object> msg) throws Exception {\n Object id = msg.get(IAdapter.TEMPLATE_ID);\n Validate.notNull(id);\n if ((int)id == SyncMessageDecoder.TEMPLATE_ID){\n //TODO do some business ,For example printout\n Object o = msg.get(SyncInfo.class.getSimpleName());\n Validate.notNull(o);\n if (o instanceof SyncInfo){\n System.out.println(((SyncInfo)o).toString());\n }\n }\n }", "public int getCommand() {\n return command_;\n }", "long getCryptProviderTypeExt();", "boolean transactTo_installCertificateWithType(int code, String transactName, ComponentName who, int type, byte[] certBuffer, String name, String password, int flag, boolean requestAccess, int userId) {\n Parcel _data = Parcel.obtain();\n Parcel _reply = Parcel.obtain();\n boolean bDisabled = false;\n try {\n IBinder binder = ServiceManager.getService(\"device_policy\");\n if (binder != null) {\n if (HWFLOW) {\n Log.i(TAG, \"Transact:\" + transactName + \" to device policy manager service.\");\n }\n _data.writeInterfaceToken(ConstantValue.DESCRIPTOR);\n if (who != null) {\n _data.writeInt(1);\n who.writeToParcel(_data, 0);\n } else {\n _data.writeInt(0);\n }\n _data.writeInt(type);\n _data.writeInt(certBuffer.length);\n _data.writeByteArray(certBuffer);\n _data.writeString(name);\n _data.writeString(password);\n _data.writeInt(flag);\n _data.writeInt(requestAccess ? 1 : 0);\n _data.writeInt(userId);\n binder.transact(code, _data, _reply, 0);\n _reply.readException();\n bDisabled = _reply.readInt() == 1;\n }\n _reply.recycle();\n _data.recycle();\n } catch (RemoteException localRemoteException) {\n Log.e(TAG, \"transactTo \" + transactName + \" failed: \" + localRemoteException.getMessage());\n } catch (Throwable th) {\n _reply.recycle();\n _data.recycle();\n }\n return bDisabled;\n }", "public void printProtocol()\n\t{\n\t\tString commands[] = {\"A\", \"UID\", \"S\", \"F\"};\n\t\t\n\t\tHashtable<String, String> commandDescription = new Hashtable<String, String>();\n\t\tHashtable<String, String> subStringCommands = new Hashtable<String, String>();\n\t\tcommandDescription.put(\"A\", \"Sends audio data using _ as a regex\");\n\t\tcommandDescription.put(\"UID\", \"Specifies the user's id so that the Network.Server may verify it\");\n\t\tcommandDescription.put(\"S\", \"Specifies server commands.\");\n\t\tcommandDescription.put(\"F\", \"Specifies audio format.\");\n\t\tsubStringCommands.put(\"A\", \"No commands\");\n\t\tsubStringCommands.put(\"UID\", \"No sub commands\");\n\t\tsubStringCommands.put(\"S\", \"Sub commands are: \\nclose - Closes the server.\\ndisconnect - Disconnects the client from the server.\\nclumpSize {int}\");\n\t\tsubStringCommands.put(\"F\", \"Split Audio specifications between spaces. The ordering is {float SampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate\");\n\t\t\n\t\tfor (String str: commands)\n\t\t{\n\t\t\tSystem.out.printf(\"Command format:\\n %s.xxxxxxx\\n\", str);\n\t\t\tSystem.out.printf(\"Command %s\\n Description: %s \\n sub commands %s\\n\", str, commandDescription.get(str),subStringCommands.get(str));\n\t\t\t\n\t\t}\n\t}", "org.openxmlformats.schemas.presentationml.x2006.main.STCryptProv.Enum getCryptProviderType();", "@Override\n\tpublic boolean isCommandAuthorized(){\n\t\treturn true;\n\t}", "void processGameCommand(String command, ClientSocket socket) {\n \n if(!command.contains(\":\")) return;\n\n String substring = command.substring(0, command.indexOf(\":\")+1); //should be fold:, check:, call:, or raise:\n //System.out.println(substring);\n \n String upperString = command.substring(substring.length());\n \n //System.out.println(substring);\n \n if(substring.equals(\"fold:\")) {\n Integer index = Integer.parseInt(upperString);\n //System.out.println(\"fold \"+index);\n if(dat.seatIsOccupied(index) && dat.playerOnSeat(index).getSocket().equals(socket) && dat.playerOnSeat(index).isInHand()) {\n dat.playerOnSeat(index).setAction(PokerAction.FOLD);\n }\n return;\n }\n if(substring.equals(\"check:\")) {\n Integer index = Integer.parseInt(upperString);\n //System.out.println(\"check \"+ index);\n if(dat.seatIsOccupied(index) && dat.playerOnSeat(index).getSocket().equals(socket) && dat.playerOnSeat(index).isInHand()) {\n dat.playerOnSeat(index).setAction(PokerAction.CHECK);\n }\n return;\n }\n \n if(substring.equals(\"call:\")) {\n Integer index = Integer.parseInt(upperString);\n //System.out.println(\"call \"+index);\n //System.out.println(\"call, \"+index);\n //System.out.println(dat.seatIsOccupied(index)+\", \"+dat.playerOnSeat(index).getSocket().equals(socket)+\", \"+dat.playerOnSeat(index).isInHand());\n if(dat.seatIsOccupied(index) && dat.playerOnSeat(index).getSocket().equals(socket) && dat.playerOnSeat(index).isInHand()) {\n //System.out.println(\"Setting action\");\n dat.playerOnSeat(index).setAction(PokerAction.CALL);\n }\n return;\n }\n \n if(!upperString.contains(\":\")) return;\n \n if(substring.equals(\"raise:\")) {\n substring = upperString.substring(0, upperString.indexOf(\":\")); \n upperString = upperString.substring(substring.length()+1);\n Integer index = Integer.parseInt(substring);\n Integer amount = Integer.parseInt(upperString);\n if(dat.seatIsOccupied(index) && dat.playerOnSeat(index).getSocket().equals(socket) && dat.playerOnSeat(index).isInHand()) {\n dat.playerOnSeat(index).setAction(PokerAction.RAISE);\n dat.playerOnSeat(index).raise = amount;\n }\n //return;\n } \n }", "String getPublicKeyActorReceive();", "private void handleInvocationCommand() throws IOException, ClassNotFoundException {\r\n final Object context = m_in.readObject();\r\n final String handle = (String) m_in.readObject();\r\n final String methodName = (String) m_in.readObject();\r\n final Class[] paramTypes = (Class[]) m_in.readObject();\r\n final Object[] args = (Object[]) m_in.readObject();\r\n Object result = null;\r\n try {\r\n result = m_invoker.invoke(handle, methodName, paramTypes, args, context);\r\n } catch (Exception e) {\r\n result = e;\r\n }\r\n m_out.writeObject(result);\r\n m_out.flush();\r\n }", "public interface OperationType {\n char getOperationType();\n}", "public String get_snmpauthprotocol()\r\n\t{\r\n\t\treturn this.snmpauthprotocol;\r\n\t}", "public Binder proxyCommand(Binder params) throws ClientError, EncryptionError {\n Binder result = null;\n try {\n result = Binder.fromKeysValues(\n \"result\",\n executeAuthenticatedProxyCommand(\n Boss.unpack(\n (version >= 2) ?\n sessionKey.etaDecrypt(params.getBinaryOrThrow(\"params\")) :\n sessionKey.decrypt(params.getBinaryOrThrow(\"params\"))\n )\n )\n );\n } catch (Exception e) {\n ErrorRecord r = (e instanceof ClientError) ? ((ClientError) e).getErrorRecord() :\n new ErrorRecord(Errors.COMMAND_FAILED, \"\", e.getMessage());\n result = Binder.fromKeysValues(\n \"error\", r\n );\n }\n // encrypt and return result\n return Binder.fromKeysValues(\n \"result\",\n (version >= 2) ? sessionKey.etaEncrypt(Boss.pack(result)) : sessionKey.encrypt(Boss.pack(result))\n );\n }", "public abstract void setEncryptMode();", "public String getCommand() {\n return command;\n }", "public String getCommand() {\n return command;\n }", "@Override \n public void commandLogin(String userName, String password)\n {\n }", "private CmtRCommitPhaseOutput receiveTrapFromProver() throws ClassNotFoundException, IOException {\n\t\tSerializable msg = null;\n\t\ttry {\n\t\t\t//receive the mesage.\n\t\t\tmsg = channel.receive();\n\t\t} catch (IOException e) {\n\t\t\tthrow new IOException(\"failed to receive the a message. The thrown message is: \" + e.getMessage());\n\t\t}\n\t\t//If the given message is not an instance of ReceiverCommitPhaseOutput, throw exception.\n\t\tif (!(msg instanceof CmtRCommitPhaseOutput)){\n\t\t\tthrow new IllegalArgumentException(\"the given message should be an instance of CmtRCommitPhaseOutput\");\n\t\t}\n\t\t//Return the given message.\n\t\treturn (CmtRCommitPhaseOutput) msg;\n\t}", "@Override\n protected void processTileEntityMessage(LogicalSide sourceSide, TileEntity tileEntity) {\n\n if (tileEntity instanceof AbstractModBlockEntity) {\n ((AbstractModBlockEntity)tileEntity).handleCommand(sourceSide, this._name, this._parameters);\n } else {\n Log.LOGGER.error(Log.NETWORK, \"No command-aware Tile Entity found while processing a command message: skipping\");\n }\n }", "public Packet06Interact(byte data[]) {\n\n\t\tsuper(06);\n\n\t\t// Having commas in the byte array makes it easier to read the\n\t\t// information off it\n\t\tString[] dataArray = readData(data).split(\",\");\n\n\t\t// Read the information\n\t\tthis.username = dataArray[0];\n\t\tthis.objectID = Integer.parseInt(dataArray[1]);\n\t}", "public abstract byte getType();", "public int getCommand() {\n return command_;\n }", "public abstract String encryptMsg(String msg);" ]
[ "0.53337264", "0.525629", "0.52288985", "0.520663", "0.5197447", "0.51185507", "0.50729465", "0.5006362", "0.49181762", "0.48829457", "0.48745", "0.48393625", "0.4823772", "0.4820301", "0.48127788", "0.47824505", "0.47613105", "0.47230417", "0.47093818", "0.46976644", "0.46910238", "0.4687923", "0.46877703", "0.46861035", "0.4682668", "0.46779725", "0.46696377", "0.46685988", "0.46570262", "0.4652184", "0.46503982", "0.4639503", "0.4638245", "0.46222532", "0.4586497", "0.457826", "0.45778024", "0.45759633", "0.45660782", "0.45648423", "0.45637542", "0.4562797", "0.4554834", "0.45547172", "0.45491192", "0.4546733", "0.45351896", "0.4526927", "0.45247006", "0.45205683", "0.45166817", "0.45155856", "0.4504751", "0.45031813", "0.45023218", "0.44969785", "0.44949245", "0.44939002", "0.44900274", "0.44882745", "0.4486965", "0.44842118", "0.44827196", "0.4472022", "0.44685274", "0.4467629", "0.44625878", "0.44612896", "0.44466245", "0.44423112", "0.4438579", "0.44327858", "0.44310588", "0.44292256", "0.4429138", "0.4428159", "0.44273463", "0.44257504", "0.44209236", "0.4419263", "0.44106618", "0.44070348", "0.44008136", "0.4399915", "0.43956688", "0.43937257", "0.43930003", "0.43893176", "0.43890297", "0.43864176", "0.43837962", "0.43835434", "0.43835434", "0.43793207", "0.4379286", "0.43790427", "0.4377654", "0.4377279", "0.43761656", "0.4372799" ]
0.5752967
0
Handles password verif., returns "accepted" or "rejected"
private byte[] handlePassword(byte[] message) { byte[] password = Arrays.copyOfRange(message, "password:".getBytes().length, message.length); // Check hash of password against user's value in the digest text file passVerified = checkHash(password, ComMethods.getValueFor(currentUser, hashfn)); // Respond to user if (passVerified) { currentPassword = password; // store pw for session return preparePayload("accepted".getBytes()); } else { return preparePayload("rejected".getBytes()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getPasswordValid();", "private void validatePassword() {\n mPassWordValidator.processResult(\n mPassWordValidator.apply(binding.registerPassword.getText().toString()),\n this::verifyAuthWithServer,\n result -> binding.registerPassword.setError(\"Please enter a valid Password.\"));\n }", "boolean hasPassword2();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean isMatchPassword(Password toCheck) throws NoUserSelectedException;", "@When(\"^user should enter the valid password in the loginpage$\")\n\tpublic void user_should_enter_the_valid_password_in_the_loginpage() throws Throwable {\n\t\tinputValuestoElement(pa.getAp().getPasswordinput(), \"superman@1010\");\n\t\n\t \n\t}", "public void showPasswordPrompt();", "@Override\r\n\tpublic boolean validatePassword(String arg0, String arg1) {\n\t\treturn false;\r\n\t}", "void onChangePasswordSuccess(ConformationRes data);", "public void confirmPasswordRequest() {\n\t\tStreamObserver<BoolValue> responseObserver = new StreamObserver<BoolValue>() {\t//\tUsed for sending orreceiving stream messages\n\t\t\t\n\t\t\t//\tStreamObserver methods\n\t\t\tpublic void onNext(BoolValue boolValue) {\t//\tReceives value from stream\n\t\t\t\tif (boolValue.getValue()) {\n\t\t\t\t\tlogger.info(\"Entered password is correct\");\n\t\t\t\t} else {\n\t\t\t\t\tlogger.info(\"Entered password is incorrect\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tpublic void onError(Throwable throwable) {\n\t\t\t\tlogger.info(throwable.getLocalizedMessage());\n\t\t\t}\n\n\t\t\tpublic void onCompleted() {\n\t\t\t\tlogger.info(\"Completed\");\n\t\t\t}\n\t\t};\n\n\t\t\tasyncPasswordStub.validate(ConfirmPasswordRequest.newBuilder()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .setPassword(password)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .setSalt(salt)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .setHashedPassword(hashedPassword)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .build(), responseObserver);\t\n\t}", "public boolean verifyPassword(int input){\n return input==password;\n }", "private boolean validatePassword() {\n\t\tEditText pw = (EditText)view.findViewById(R.id.et_enter_new_password);\n\t\tEditText confPW = (EditText)view.findViewById(R.id.et_reenter_new_password);\n\t\t\t\n\t\tString passwd = pw.getText().toString();\n\t\tString confpw = confPW.getText().toString();\n\t\t\n\t\t// Check for nulls\n\t\tif (passwd == null || confpw == null) {\n\t\t\tToast.makeText(view.getContext(), \"Passwords are required\", Toast.LENGTH_LONG).show();\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// Ensure password and retypted passwords match\n\t\tif (!passwd.contentEquals(confpw)) {\n\t\t\tToast.makeText(view.getContext(), \"Passwords must match\", Toast.LENGTH_LONG).show();\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// Ensure password meets complexity\n\t\tif (passwd.length() < 7) { // min length of 7 chars\n\t\t\tToast.makeText(view.getContext(), \"Password must be at least 7 characters long\", \n\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// Not really sure what the requirements are for private key password complexity yet\n\t\tnewPassword = passwd; // Set class variable with new password\n\t\treturn true;\n\t}", "void onPasswordSuccess();", "public boolean changePassword(HttpServletRequest request, HttpServletResponse response);", "@Override\r\n\t\tpublic boolean promptPassword(String message) {\n\t\t\treturn false;\r\n\t\t}", "private boolean checkPassword() {\n String password = getPassword.getText();\n \n if(password.compareTo(\"\") == 0) {\n errorMessage.setText(\"Please enter a password.\");\n return false;\n }\n else if(password.compareTo(getConfirmPassword.getText()) == 0) {\n //Password must be min of 8 characters max of 16\n if((8 > password.length()) || (\n password.length() > 16)) {\n errorMessage.setText(\"Password must be 8-16 characters long.\");\n return false;\n }\n \n boolean upperFlag = false;\n boolean lowerFlag = false;\n boolean numFlag = false;\n boolean charFlag = false;\n \n for(int i = 0; i < password.length(); ++i) {\n String sp = \"/*!@#$%^&*()\\\\\\\"{}_[]|\\\\\\\\?/<>,.\";\n char ch = password.charAt(i);\n \n if(Character.isUpperCase(ch)) { upperFlag = true; }\n if(Character.isLowerCase(ch)) { lowerFlag = true; }\n if(Character.isDigit(ch)) { numFlag = true; }\n if(sp.contains(password.substring(i, i))) { charFlag = true; }\n } \n //Password must contain 1 uppercase letter\n if(!upperFlag) {\n errorMessage.setText(\"Password must contain at least one uppercase letter.\");\n return false;\n }\n //Password must contain 1 lowercase letter\n if(!lowerFlag) {\n errorMessage.setText(\"Password must contain at least one lowercase letter.\");\n return false;\n }\n //Password must contain 1 number\n if(!numFlag) {\n errorMessage.setText(\"Password must contain at least one digit.\");\n return false;\n }\n //Password must contain 1 special character\n if(!charFlag) {\n errorMessage.setText(\"Password must contain at least one special character.\");\n return false;\n }\n return true;\n }\n else {\n errorMessage.setText(\"The entered passwords do not match.\");\n return false; \n }\n }", "@When(\"^password$\")\n public void password() throws Throwable {\n \tSystem.out.println(\"input password\");\n \t//Assert.assertEquals(34, 40);\n \t\n \t\n \n }", "public boolean promptPassword(String message) \r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}", "private String confirmPassword()\n {\n JPasswordField tf_password = new JPasswordField();\n int response = JOptionPane.showConfirmDialog(null,\n tf_password, \"Confirm Password: \",\n JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);\n\n // Debug: System.out.println(\"Dialog\" + tf_password.getPassword());\n if (response == JOptionPane.OK_OPTION)\n {\n return new String(tf_password.getPassword());\n }\n return null;\n }", "void validatePassword(String usid, String password) throws Exception;", "private boolean checkPassword(){\n Pattern p = Pattern.compile(\"^[A-z0-9]*$\");\n Matcher m = p.matcher(newPass.getText());\n boolean b = m.matches();\n if(newPass.getText().compareTo(repeatPass.getText()) != 0 || newPass.getText().isEmpty() || repeatPass.getText().isEmpty()){\n repeatPass.setBackground(Color.red);\n JOptionPane.showMessageDialog(null, \"Password Error\");\n return false;\n }\n else if(newPass.getText().length() > 10 || b == false){\n newPass.setBackground(Color.red);\n JOptionPane.showMessageDialog(null, \"Password Error\");\n return false;\n }\n newPass.setBackground(Color.green);\n repeatPass.setBackground(Color.green);\n return true;\n }", "Password getPsw();", "public boolean validatePassword() {\r\n\t\tif (txtPassword.getValue() == null || txtPassword.getValue().length() == 0 || !txtPassword.getValue().equals(txtRetypePassword.getValue()))\r\n\t\t\treturn false;\r\n\t\treturn true;\r\n\t}", "Boolean isValidUserPassword(String username, String password);", "protected void validatePassword(){\n //Only Checking For Word Type Password With Minimum Of 8 Digits, At Least One Capital Letter,At Least One Number,At Least One Special Character\n Boolean password = Pattern.matches(\"^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9](?=.*[!@#$%^&*()])).{8,}$\",getPassword());\n System.out.println(passwordResult(password));\n }", "public boolean isPassword() {\n/* 968 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@VisibleForTesting\n int validatePassword(byte[] password) {\n int errorCode = NO_ERROR;\n final PasswordMetrics metrics = PasswordMetrics.computeForPassword(password);\n mergeMinComplexityAndDpmRequirements(metrics.quality);\n\n if (password == null || password.length < mPasswordMinLength) {\n if (mPasswordMinLength > mPasswordMinLengthToFulfillAllPolicies) {\n errorCode |= TOO_SHORT;\n }\n } else if (password.length > mPasswordMaxLength) {\n errorCode |= TOO_LONG;\n } else {\n // The length requirements are fulfilled.\n if (!mPasswordNumSequenceAllowed\n && !requiresLettersOrSymbols()\n && metrics.numeric == password.length) {\n // Check for repeated characters or sequences (e.g. '1234', '0000', '2468')\n // if DevicePolicyManager or min password complexity requires a complex numeric\n // password. There can be two cases in the UI: 1. User chooses to enroll a\n // PIN, 2. User chooses to enroll a password but enters a numeric-only pin. We\n // should carry out the sequence check in both cases.\n //\n // Conditions for the !requiresLettersOrSymbols() to be necessary:\n // - DPM requires NUMERIC_COMPLEX\n // - min complexity not NONE, user picks PASSWORD type so ALPHABETIC or\n // ALPHANUMERIC is required\n // Imagine user has entered \"12345678\", if we don't skip the sequence check, the\n // validation result would show both \"requires a letter\" and \"sequence not\n // allowed\", while the only requirement the user needs to know is \"requires a\n // letter\" because once the user has fulfilled the alphabetic requirement, the\n // password would not be containing only digits so this check would not be\n // performed anyway.\n final int sequence = PasswordMetrics.maxLengthSequence(password);\n if (sequence > PasswordMetrics.MAX_ALLOWED_SEQUENCE) {\n errorCode |= CONTAIN_SEQUENTIAL_DIGITS;\n }\n }\n // Is the password recently used?\n if (mLockPatternUtils.checkPasswordHistory(password, getPasswordHistoryHashFactor(),\n mUserId)) {\n errorCode |= RECENTLY_USED;\n }\n }\n\n // Allow non-control Latin-1 characters only.\n for (int i = 0; i < password.length; i++) {\n char c = (char) password[i];\n if (c < 32 || c > 127) {\n errorCode |= CONTAIN_INVALID_CHARACTERS;\n break;\n }\n }\n\n // Ensure no non-digits if we are requesting numbers. This shouldn't be possible unless\n // user finds some way to bring up soft keyboard.\n if (mRequestedQuality == PASSWORD_QUALITY_NUMERIC\n || mRequestedQuality == PASSWORD_QUALITY_NUMERIC_COMPLEX) {\n if (metrics.letters > 0 || metrics.symbols > 0) {\n errorCode |= CONTAIN_NON_DIGITS;\n }\n }\n\n if (metrics.letters < mPasswordMinLetters) {\n errorCode |= NOT_ENOUGH_LETTER;\n }\n if (metrics.upperCase < mPasswordMinUpperCase) {\n errorCode |= NOT_ENOUGH_UPPER_CASE;\n }\n if (metrics.lowerCase < mPasswordMinLowerCase) {\n errorCode |= NOT_ENOUGH_LOWER_CASE;\n }\n if (metrics.symbols < mPasswordMinSymbols) {\n errorCode |= NOT_ENOUGH_SYMBOLS;\n }\n if (metrics.numeric < mPasswordMinNumeric) {\n errorCode |= NOT_ENOUGH_DIGITS;\n }\n if (metrics.nonLetter < mPasswordMinNonLetter) {\n errorCode |= NOT_ENOUGH_NON_LETTER;\n }\n return errorCode;\n }", "private void handlePass(String password) {\n // User has entered a valid username and password is correct\n if (currentUserStatus == userStatus.ENTEREDUSERNAME && password.equals(validPassword)) {\n currentUserStatus = userStatus.LOGGEDIN;\n sendMsgToClient(\"230-Welcome to HKUST\");\n sendMsgToClient(\"230 User logged in successfully\");\n }\n\n // User is already logged in\n else if (currentUserStatus == userStatus.LOGGEDIN) {\n sendMsgToClient(\"530 User already logged in\");\n }\n\n // Wrong password\n else {\n sendMsgToClient(\"530 Not logged in\");\n }\n }", "@Test(priority=1)\n\tpublic void testPasswordValidity() {\n\t\tsignup.clearAllFields();\n\t\tsignup.enterId(\"[email protected]\");\n\t\tsignup.enterPassword(\"1234567\");\n\t\tsignup.reenterPassword(\"1234567\");\n\t\tsignup.clickSubmit();\n\t\tList<String> errors = signup.getErrors();\n\t\t\n\t\t// is String Present looks for the presence of expected error message from all of errors present on current screen. \n\t\tAssert.assertTrue(TestHelper.isStringPresent(errors, \"Passwords do not match; please enter a password and reenter to confirm.\\nPasswords must contain at least 6 characters and no spaces.\"));\n\t}", "java.lang.String getPassword();", "java.lang.String getPassword();", "java.lang.String getPassword();", "java.lang.String getPassword();", "java.lang.String getPassword();", "java.lang.String getPassword();", "java.lang.String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "@Test(priority=1)\n\tpublic void verifyPasswordsMatch() {\n\t\tsignup.clearAllFields();\n\t\tsignup.enterId(\"[email protected]\");\n\t\tsignup.enterPassword(\"abcd\");\n\t\tsignup.reenterPassword(\"1235\");\n\t\tsignup.clickSubmit();\n\t\tList<String> errors = signup.getErrors();\n\t\tAssert.assertTrue(TestHelper.isStringPresent(errors, \"Passwords do not match; please enter a password and reenter to confirm.\\nPasswords must contain at least 6 characters and no spaces.\"));\n\t}", "public void handleForgotPassword() {\n\t\tAlert alert = new Alert(AlertType.WARNING);\n\t\talert.initOwner(mainApp.getPrimaryStage());\n\t\talert.setTitle(\"Under building\");\n\t\talert.setHeaderText(\"Under construction.\");\n\t\talert.setContentText(\"At the moment you can not get your password. Thanks for being patient.\");\n\t\talert.showAndWait();\n\t}", "private void validatePasswordField() {\n userPassword = passwordEditText.getText().toString();\n if (!isPasswordValid()) {\n passwordEditText.setTextColor(getResources().getColor(R.color.colorWrongText));\n loginButton.setEnabled(false);\n } else {\n passwordEditText.setTextColor(getResources().getColor(R.color.colorRightText));\n loginButton.setEnabled(true);\n }\n }", "private boolean isPasswordValid(String password) {\n return true;\n }", "private boolean isPasswordValid(String password) {\n return true;\n }", "public static Boolean checkPass(String password) {\n // TODO: integrate with scs.ubbcluj.ro, send a dummy POST and check the response code\n return true;\n }", "private boolean doGetConfirmPassword() {\n\t\tcurrentStep = OPERATION_NAME+\": getting confirm password\";\n\t\tif (!_atmssHandler.doDisDisplayUpper(PROMPT_FOR_CONFIRM_PASSWORD)) {\n\t\t\trecord(\"Dis\");\n\t\t\treturn false;\n\t\t}\n\t\tconfirmPassword = _atmssHandler.doKPGetPasswd(TIME_LIMIT);\n\t\tif (confirmPassword == null) {\n\t\t\trecord(\"KP\");\n\t\t\tif (!_atmssHandler.doDisDisplayUpper(FAILED_FROM_KEYPAD)) {\n\t\t\t\trecord(\"Dis\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tpause(3);\n\t\t\treturn false;\n\t\t} else if (confirmPassword.equals(KP_CANCEL)) {\n\t\t\trecord(\"USER\");\n\t\t\tif (!_atmssHandler.doDisDisplayUpper(FAILED_FROM_USER_CANCELLING)) {\n\t\t\t\trecord(\"Dis\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tpause(3);\n\t\t\treturn false;\n\t\t}\n\t\trecord(\"confirm password typed\");\n\t\treturn true;\n\t}", "@Test\n\t\tvoid givenPassword_CheckForValidationForPasswordRule4_RetrunTrue() {\n\t\t\tboolean result =ValidateUserDetails.validatePassword(\"Srewoirfjkbh#3\");\n\t\t\tAssertions.assertTrue(result);\n\t\t}", "private boolean isPasswordValid(String password){\n return password.length() > 2; //mot de passe de longueur sup à 2\n }", "public Boolean comprovaLoginPW(String pw) {\n\t\treturn (loginValidator.validatePasswordFormat(pw));\n\t}", "private boolean isPasswordValid(String password) {\n if(password.length() < 4){\n TextView tv = findViewById(R.id.wrongPassError);\n tv.setText(getResources().getString(R.string.error_invalid_password));\n return false;\n }\n return true;\n }", "@Test\r\n\tpublic void testIsValidPasswordSuccessful()\r\n\t{\r\n\t\tassertTrue(PasswordCheckerUtility.isValidPassword(\"#SuperMan1\"));\r\n\t}", "public boolean mustChangePassword() {\n\t\t\t\t\n\t\t\t\t\tPasswordStatus.Value v = getPasswordStatus();\n\t\t\t\t\tif (v == DatabasePasswordComposite.INVALID || v == DatabasePasswordComposite.FIRST) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tHash algorithm = getAlgorithm();\n\t\t\t\t\tif( CHANGE_OLD_HASH.isEnabled(getContext()) && ( algorithm == null || algorithm.isDeprecated(getContext()))) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif( periodicResetRequired()) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif( passwordFailsExceeded()) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}", "void setErrorPassword();", "private boolean doCheckNewPassword() {\n\t\tif (!newPassword.equals(confirmPassword)) return false;\n\t\trecord(\"new password checked\");\n\t\treturn true;\n\t}", "private boolean isPasswordValid(String password) {\n return password.length() > 4;\r\n }", "private boolean isPasswordValid(String password) {\n return password.length() > 4;\r\n }", "private boolean isPasswordValid(String password) {\n return password.length() > 4;\r\n }", "public boolean checkPass(String password){\r\n if (password.equals(this.password)){\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public void testIncorrectPassword() {\n Password p = new Password(\"jesus\".toCharArray());\n assertFalse(p.checkPassword(\"buddha\".toCharArray()));\n }", "String getUserPassword();", "private boolean valPassword(String pass){\n if (usuario.getPassword().equals(pass)){\n return true;\n }\n return false;\n }", "public String getPassword();", "public String getPassword();", "private boolean checkPassword() {\n String password = Objects.requireNonNull(password1.getEditText()).getText().toString();\n\n return password.length() >= 8 && ContainSpecial(password) && noUpper(password);\n }", "private boolean checkValidation(Reset reset, String confirmPassword) {\n if (reset.getPassword().isEmpty()) {\n mValidateLiveData.setValue(new FailureResponse(\n AppConstants.UIVALIDATIONS.NEW_PASSWORD_EMPTY, ResourceUtils.getInstance()\n .getString(R.string.new_password_empty)\n ));\n return false;\n } else if (reset.getPassword().length() < 6) {\n mValidateLiveData.setValue(new FailureResponse(\n AppConstants.UIVALIDATIONS.INVALID_PASSWORD, ResourceUtils.getInstance()\n .getString(R.string.enter_valid_password)\n ));\n return false;\n } else if (confirmPassword.isEmpty()) {\n mValidateLiveData.setValue(new FailureResponse(\n AppConstants.UIVALIDATIONS.CONFIRM_PASSWORD_EMPTY, ResourceUtils.getInstance()\n .getString(R.string.confirm_password_empty)\n ));\n return false;\n } else if (confirmPassword.length() < 6) {\n mValidateLiveData.setValue(new FailureResponse(\n AppConstants.UIVALIDATIONS.INVALID_PASSWORD, ResourceUtils.getInstance()\n .getString(R.string.enter_valid_password)\n ));\n return false;\n\n } else if (!reset.getPassword().equals(confirmPassword)) {\n mValidateLiveData.setValue(new FailureResponse(\n AppConstants.UIVALIDATIONS.PASSWORD_NOT_MATCHED, ResourceUtils.getInstance()\n .getString(R.string.password_not_matched)\n ));\n return false;\n }\n return true;\n }", "@When(\"^The user enters the password$\")\n\tpublic void the_user_enters_the_password() throws Throwable {\n\t\t\n\t lpw.password_textbox();\n\t}", "private static boolean isValid(String passWord) {\n\t\tString password = passWord;\n\t\tboolean noWhite = noWhiteSpace(password);\n\t\tboolean isOver = isOverEight(password);\n\t\tif (noWhite && isOver) {\n\t\t\tSystem.out.println(\"Password accepted!\");\n\t\t\treturn true;\n\t\t} else return false;\n\t}", "private boolean cekPassword(String password){\n return password.equals(Preferences.getRegisteredPass(getBaseContext()));\n }", "public static Boolean checkPassowd(String password){\n\t\t//String password = txtPassword.getText();\n\t\t//System.out.println(password);\n\t\treturn password.equals(\"password\");\n\t}", "@Test\n public void testGetPassword() {\n System.out.println(\"getPassword Test (Passing value)\");\n String expResult = \"$2a$10$EblZqNptyYvcLm/VwDCVAuBjzZOI7khzdyGPBr08PpIi0na624b8.\";\n String result = user.getPassword();\n // Check for and print any violations of validation annotations\n Set<ConstraintViolation<User>> violations = validator.validate(user);\n String message =\n violations.iterator().hasNext() ? violations.iterator().next().getMessage() : \"\";\n if (!violations.isEmpty()) {\n System.out.println(\"Violation caught: \" + message);\n }\n // Test method\n assertEquals(expResult, result);\n }", "public java.lang.String getPassword();", "@Override\n\tpublic void validatePassword(String password) throws UserException {\n\t\t\n\t}", "public static boolean password() \n\t{\n\t\tScanner keyboard = new Scanner(System.in);\n\n\t\tboolean isCorrect = false;\n\t\tint tryCounter = 3;\n\t\tSystem.out.print(\"Please enter your password to continue: \");\n\t\tString myPassword = keyboard.nextLine().toLowerCase();\n\t\tfor (int tries = 1; tries <= 3; ++tries)\n\t\t{\n\t\t\tif (myPassword.equals(\"deluxepizza\"))\n\t\t\t{\n\t\t\t\tisCorrect = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(tries == 3)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"It seems you're having trouble typing your password... returning to main menu.\");\n\t\t\t\treturn isCorrect;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t--tryCounter;\n\t\t\t\tSystem.out.println(\"Oops, did your finger slip? Please try again. You have \" + tryCounter + \" tries remaining!\");\n\t\t\t\tmyPassword = keyboard.next().toLowerCase();\n\t\t\t}\t\n\t\t}\n\t\treturn isCorrect;\n\t}", "public boolean passwordCheck(String password) {\n\t\treturn true;\n\t\t\n\t}", "public void testCorrectPassword() {\n Password p = new Password(\"jesus\".toCharArray());\n assertTrue(p.checkPassword(\"jesus\".toCharArray()));\n }", "@Override\n public void onClick(View v) {\n String newPass=et_newPassword.getText().toString().trim();\n String oldPass=et_oldPassword.getText().toString().trim();\n String prefpass=SharedPrefManager.getInstance(getApplicationContext()).getPass();\n if(newPass.equals(\"\")||oldPass.equals(\"\"))\n {\n Toast.makeText(MainActivity.this, \"Enter All Fields\", Toast.LENGTH_SHORT).show();\n }\n else if(!prefpass.equals(oldPass))\n {\n Toast.makeText(MainActivity.this, \"Incorrect Old Password\", Toast.LENGTH_SHORT).show();\n }\n else\n {\n repo.updatePass(oldPass,newPass,\"User\");\n Toast.makeText(MainActivity.this, \"Password Successfully Changed\", Toast.LENGTH_SHORT).show();\n logout();\n dialog.dismiss();\n }\n }", "public boolean checkPasswordStatusAction(){\n mPasswordStatus = !mPasswordStatus;\n return mPasswordStatus;\n }", "private boolean isPasswordValid(String password) {\n return password.length() > 4;\n }", "public static boolean checkPassword()\n {\n String pw = SmartDashboard.getString(\"Password\");\n SmartDashboard.putString(\"Password\", \"\"); //Clear the password field so that it must be reentered\n\n if(pw.equals(ADMIN_PASSWORD))\n return true;\n else\n {\n log(\"Password invalid\"); //The user gave an incorrect password, inform them.\n return false;\n }\n }", "@Test\n\t void testPassword() {\n\t\tString expected=passwordEncoder.encode(\"faizan@123\");\n\t\tString actual=user.getPassword();\n\t\tassertNotEquals(expected, actual);\n\t}", "public boolean isPasswordCorrect() {\n return (CustomerModel.passwordTest(new String(newPasswordTextField.getPassword())));\n }", "@Override\r\n\tpublic void onClick(View v) {\n\t\tswitch(v.getId()){\r\n\t\t case R.id.modifypwd_ensure:\r\n\t\t \tstrNewPasswd = CEnewPasswd.getText().toString();\r\n\t\t \tstrRenewPasswd = CErenewPasswd.getText().toString();\r\n\t\t \t\r\n\t\t \tif (strOldPasswd == null || strNewPasswd == null || strRenewPasswd == null){\r\n\t\t \t\tToast.makeText(ModifyPassword.this, \"请输入密码!\", Toast.LENGTH_SHORT).show();\r\n\t\t \t\treturn;\r\n\t\t \t}\r\n\t\t \tif (!strNewPasswd.equals(strRenewPasswd)){\r\n\t\t \t\tToast.makeText(ModifyPassword.this, \"两次输入的密码不一致,请重新输入!\", Toast.LENGTH_SHORT).show();\r\n\t\t \t\treturn;\r\n\t\t \t}\r\n\t\t \tif (strOldPasswd.equals(strNewPasswd)){\r\n\t\t \t\tToast.makeText(ModifyPassword.this, \"新旧密码一样,请重新输入!\", Toast.LENGTH_SHORT).show();\r\n\t\t \t\treturn;\r\n\t\t \t}\r\n\t\t \t\r\n\t\t \tif ((strNewPasswd.length() < 6) || (strNewPasswd.length() > 16)){\r\n\t\t\t\t\tToast.makeText(ModifyPassword.this, \"密码应为6-16位字母和数字组合!\", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t} else{\r\n\t\t\t\t\tPattern pN = Pattern.compile(\"[0-9]{6,16}\");\r\n\t\t\t\t Matcher mN = pN.matcher(strNewPasswd);\r\n\t\t\t\t Pattern pS = Pattern.compile(\"[a-zA-Z]{6,16}\");\r\n\t\t\t\t Matcher mS = pS.matcher(strNewPasswd);\r\n\t\t\t\t if((mN.matches()) || (mS.matches())){\r\n\t\t\t\t Toast.makeText(ModifyPassword.this,\"密码应为6-16位字母和数字组合!\", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t return;\r\n\t\t\t\t }\r\n\t\t\t\t}\r\n\r\n\t\t \tif (new ConnectionDetector(ModifyPassword.this).isConnectingTOInternet()) {\r\n\t\t \t\tpd = ProgressDialog.show(ModifyPassword.this, \"\", \"正在加载....\");\r\n\t\t \t\tnew RequestTask().execute();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tToast.makeText(ModifyPassword.this, \"网络连接不可用,请检查网络后再试\", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t}\r\n\t\t \tbreak;\r\n\t\t case R.id.modify_pwd_back:\r\n\t\t \tstartActivity(new Intent(ModifyPassword.this, ShowUserMessage.class));\r\n\t\t \tthis.finish();\r\n\t\t \tbreak;\r\n\t\t default:\r\n\t\t \tbreak;\r\n\t\t}\r\n\t}", "public boolean verifyPassword() {\n\t\tString hash = securePassword(password);\r\n\t\t\r\n\t\tif(!isPasswordSet()) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tString currentPass = getPassword();\r\n\t\tif(hash.equals(currentPass)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "private Boolean checkPasswordForm(HttpServletRequest request) {\r\n Boolean validForm = true;\r\n lockout = false;\r\n \r\n if(oldPassword.equals(\"\")) {//if old password is blank\r\n validForm = false;\r\n request.setAttribute(\"oldPassError\",\"Old password must be provided.\");\r\n } else if (lockout) {\r\n validForm = false;\r\n } else if (!authenticate(user_id, oldPassword)) {//if old password is incorrect\r\n validForm = false;\r\n request.setAttribute(\"oldPassError\",\"Old password is incorrect.\");\r\n }\r\n \r\n //check if password field is empty first, then validate for the password rules\r\n Pattern passwordRegEx = Pattern.compile(PASSWORD_REGEX);\r\n Matcher passwordCheck = passwordRegEx.matcher(newPassword);\r\n if(newPassword.equals(\"\")) {\r\n validForm = false;\r\n request.setAttribute(\"newPassError\",\"New password must be provided.\");\r\n } else if (!passwordCheck.matches()) {\r\n validForm = false;\r\n request.setAttribute(\"newPassError\",\"New password must contain at least 8 characters,</br>\"\r\n +\"an upper case and lower case letter, a number,</br>\"\r\n +\"a special character, and no whitespace.\");\r\n }\r\n \r\n if(newPasswordConfirm.equals(\"\")) {//if new password confirmation is blank\r\n validForm = false;\r\n request.setAttribute(\"newPassConfirmError\",\"New password confirmation must not be blank.\");\r\n } else if(!newPasswordConfirm.equals(newPassword)) { //if new pass confirmation does not match\r\n validForm = false;\r\n request.setAttribute(\"newPassConfirmError\",\"New passwords must match.\");\r\n }\r\n return validForm;\r\n }", "@Override\n public void onClick(View v) {\n String newPass=et_newPassword.getText().toString().trim();\n String oldPass=et_oldPassword.getText().toString().trim();\n String prefpass=SharedPrefManager.getInstance(getApplicationContext()).getPass();\n if(newPass.equals(\"\")||oldPass.equals(\"\"))\n {\n Toast.makeText(AdminHomeActivity.this, \"Enter All Fields\", Toast.LENGTH_SHORT).show();\n }\n else if(!prefpass.equals(oldPass))\n {\n Toast.makeText(AdminHomeActivity.this, \"Incorrect Old Password\", Toast.LENGTH_SHORT).show();\n }\n else\n {\n repo.updatePass(oldPass,newPass,\"Admin\");\n Toast.makeText(AdminHomeActivity.this, \"Password Successfully Changed\", Toast.LENGTH_SHORT).show();\n logout();\n dialog.dismiss();\n }\n }", "private String getPassword() {\n String Password = \"\";\n while (true) {\n System.out.println(\"Please, Enter Password : \");\n Password = scanner.nextLine();\n System.out.println(\"Please, Enter confirm Password : \");\n if (!Password.equals(scanner.nextLine())) {\n System.out.println(\"Error: Password doesn't match.\");\n } else {\n break;\n }\n }\n return Password;\n }", "public boolean reconcilePassword(){\r\n if((signup.getFirstPassword()).equals(signup.getSecondPassword())){\r\n \r\n return true;\r\n \r\n }\r\n else{\r\n \r\n return false;\r\n }\r\n }" ]
[ "0.7063271", "0.6969024", "0.69282115", "0.68776935", "0.68776935", "0.68776935", "0.68776935", "0.68776935", "0.68776935", "0.68776935", "0.68776935", "0.6834036", "0.673624", "0.6709019", "0.66799647", "0.6679823", "0.6675946", "0.6648876", "0.66206765", "0.6576792", "0.6529712", "0.65294176", "0.6528021", "0.64860326", "0.64823246", "0.6475203", "0.64697903", "0.6468399", "0.64188695", "0.6408168", "0.63979137", "0.6395106", "0.63894063", "0.6385656", "0.638222", "0.63404906", "0.6315651", "0.6315651", "0.6315651", "0.6315651", "0.6315651", "0.6315651", "0.6315651", "0.63137734", "0.63137734", "0.63137734", "0.63137734", "0.63137734", "0.63137734", "0.63137734", "0.63137734", "0.63137734", "0.6287078", "0.62672323", "0.62555915", "0.62477213", "0.62477213", "0.62404436", "0.6226229", "0.6203168", "0.6190709", "0.6175772", "0.6173895", "0.6172875", "0.6171169", "0.6170575", "0.61700505", "0.6167444", "0.6167444", "0.6167444", "0.61673856", "0.61597437", "0.61591786", "0.615435", "0.61523086", "0.61523086", "0.6140658", "0.6131836", "0.61290365", "0.6128962", "0.61268675", "0.6106776", "0.6106669", "0.6104977", "0.6104747", "0.60967183", "0.60936356", "0.60928285", "0.60739076", "0.6071873", "0.60623294", "0.6059493", "0.604838", "0.60450214", "0.6036125", "0.60334384", "0.60042286", "0.5998342", "0.598361", "0.59809786" ]
0.7001681
1
Handles view requests, returns the deciphered secret
private byte[] handleView() { String secret = ComMethods.getValueFor(currentUser, secretsfn); if (secret.equals("")) { return "error".getBytes(); } else { byte[] secretInBytes = DatatypeConverter.parseBase64Binary(secret); ComMethods.report("SecretServer has retrieved "+currentUser+"'s secret and will now return it.", simMode); return preparePayload(secretInBytes); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String requestView() { \n\t\tbyte[] userMessage = \"view\".getBytes();\n\t\tbyte[] srvrResponse = sendServerCoded(userMessage);\n\t\t\n\t\tif (!checkError(srvrResponse)) {\n\t\t\tbyte[] encryptedSecret = srvrResponse;\n\t\t\tbyte[] decryptedSecret = SecureMethods.decryptRSA(encryptedSecret, my_n, my_d, simMode);\n\t\t\treturn new String(decryptedSecret);\n\t\t} else {\n\t\t\treturn \"error\";\n\t\t}\n\t}", "java.lang.String getSecret();", "String getSecret();", "public abstract String getSecret();", "java.lang.String getServerSecret();", "@RequestMapping(value = \"/decrypt\", method = RequestMethod.POST)\n\t@ResponseBody\n\tpublic String Decrypt(@RequestParam String url) {\n\t\tString keypath = VerifyCodeController.class.getResource(\"/\").getPath()+\"public.key\";\n\t\treturn mc.isVerifySign(url, keypath)+\"\";\n\t}", "public int getSecret() {\n return secret;\n }", "private String key() {\n return \"secret\";\n }", "public String getAppsecret() {\n return appsecret;\n }", "@GetMapping(\"/decrypt\")\n public String decrypt(String uid, String data) {\n return \"\";\n }", "String decryptHiddenField(String encrypted);", "public String getSecretKey();", "Map<String, String> decryptStateFromCookie(HttpServletRequest request) throws EncryptionException;", "public String getSecretWord()\n {\n return OriginSecretWord;\n }", "String getSecretByKey(String key);", "public String getAppSecret() {\r\n return appSecret;\r\n }", "public String getAccessSecret () {\n\t\treturn this.accessSecret;\n\t}", "byte[] get_node_secret();", "void encryptStateInCookie(HttpServletResponse response, Map<String, String> cleartext) throws EncryptionException;", "public String getSecret(String key) throws ClassicDatabaseException,ClassicNotFoundException;", "public String getSecretKey() {\n return secretKey;\n }", "public SecretKey getSecretKey() {\n return secretKey;\n }", "private String getTOTPCode(String secretKey){\n Base32 base32 = new Base32();\n byte[] bytes = base32.decode(secretKey);\n String hexKey = Hex.encodeHexString(bytes);\n\n return TOTP.getOTP(hexKey);\n }", "Map<String, String> decryptQueryString(String encrypted) throws EncryptionException;", "@Override\r\n protected String appSecret() {\r\n return \"\";\r\n }", "String getComponentAppSecret();", "public void decryptMessageClick(View view) {\n\n String receivedMessage = mMessageContentEditText.getText().toString();\n mMessage.extractEncryptedMessageAndKey(receivedMessage);\n\n if(!decryptMessage()) showToast(\"Error! failed to decrypt text.\");\n\n else{\n\n showDecryptedMessage();\n }\n }", "void decryptCode() {\n StringBuilder temp = new StringBuilder(\"\");\n\n // go through entire phrase\n for (int i = 0; i < this.getText().length(); ++i) {\n\n // append char to temp if char at i is not a multiple of z\n if (!(i % Character.getNumericValue(this.secretKey.charAt(7)) == 0) || i == 0)\n temp.append(this.getText().charAt(i));\n }\n\n this.setText(temp);\n\n \n // Step 2:\n\n // split phrase up into words\n ArrayList<String> words = new ArrayList<>(Arrays.asList(this.text.toString().split(\" \")));\n\n for (int i = 0; i < words.size(); ++i) {\n\n // if y1x3x4 is at the end of the word, remove it from word\n \n if (words.get(i).substring(words.get(i).length() - 3, words.get(i).length())\n .equals(this.getSecretKey().substring(3, 6)))\n words.set(i, words.get(i).substring(0, words.get(i).length() - 3));\n\n // if x1x2 is at the end of the word\n else {\n // remove x1x2 from end\n words.set(i, words.get(i).substring(0, words.get(i).length() - 2));\n \n // move last char to beginning\n words.set(i, words.get(i).charAt(words.get(i).length() - 1) + words.get(i).substring(0, words.get(i).length() - 1));\n }\n }\n\n temp = new StringBuilder(\"\");\n\n for (String word : words)\n temp.append(word + \" \");\n\n this.setText(temp);\n }", "@Override\n public void onClick(View v) {\n String secretPass2 = edt.getText().toString().trim();\n String msg = message;\n // originalMessage = msg.replace(User.CHAT_WITH_NAME + \":-\", \"\").trim();\n\n String decryptMessage = AES.decrypt(msg, secretPass2);\n textView.setText(Html.fromHtml(title));\n textView.append(\"\\n\");\n if (decryptMessage != null && !decryptMessage.isEmpty()) {\n\n try {\n textView.append(\" \" + decryptMessage + \" \\n\");\n\n // delay 10 second\n Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n public void run() {\n // Actions to do after 10 seconds\n textView.setText(Html.fromHtml(title));\n textView.append(\"\\n\");\n textView.append(\" \" + message + \" \\n\");\n }\n }, 10000);\n\n // end of delay\n } catch (Exception e) {\n textView.append(\" \" + message + \" \\n\");\n }\n } else {\n textView.append(\" \" + message + \" \\n\");\n Toast.makeText(ChatActivity.this, \"Wrong Key\", Toast.LENGTH_SHORT).show();\n }\n\n b.dismiss();\n }", "@RequestMapping(value = \"/gw/oauth/token/{version}/get\", method = RequestMethod.POST, produces = \"application/json;charset=utf-8\")\n public Object entry_token(HttpServletRequest request)\n throws URISyntaxException, OAuthSystemException, OAuthProblemException {\n return this.password(request);\n }", "String encryptHiddenField(String value) throws EncryptionException;", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view= inflater.inflate(R.layout.fragment_cha_cha_fragment, container, false);\n initview();\n chachakey.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n @Override\n public void onFocusChange(View v, boolean hasFocus) {\n if(!hasFocus){\n String tkey=chachakey.getText().toString();\n if(tkey.getBytes().length==0)\n Snackbar.make(v,\"密钥格式错误\",Snackbar.LENGTH_INDEFINITE)\n .setAction(\"确认\", new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n chachakey.setFocusable(true);\n }\n })\n .addCallback(callback).show();\n key=tkey.getBytes();\n }\n }\n });\n button.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if(!check()){\n Snackbar.make(getActivity().findViewById(android.R.id.content), \"密钥为空\", Snackbar.LENGTH_INDEFINITE)\n .setAction(\"确定\", new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n chachakey.setFocusable(true);\n }\n })\n .show();\n return;\n }\n// Log.i(\"teSt\",GetChachaKeyandIV.sha(chachakey.getText().toString()));\n// Log.i(\"teSt\",String.valueOf(GetChachaKeyandIV.sha(chachakey.getText().toString()).length()));\n key=GetChachaKeyandIV.sha(chachakey.getText().toString()).substring(0, 32).getBytes();\n iv=GetChachaKeyandIV.sha(chachakey.getText().toString()).substring(32, 40).getBytes();\n// Log.i(\"teSt\",new String(key));\n// Log.i(\"teSt\",String.valueOf(key.length));\n// Log.i(\"teSt\",new String(iv));\n// Log.i(\"teSt\",String.valueOf(iv.length));\n ChachaThread chachaThread=new ChachaThread();\n output.setText(\"结果:\");\n Toast.makeText(getContext(),\"正在加密解密测试,请稍等....\",Toast.LENGTH_SHORT).show();\n chachaThread.execute();\n button.setEnabled(false);\n }\n });\n return view;\n }", "public static byte[] getSecret()\r\n/* 136: */ {\r\n/* 137: */ try\r\n/* 138: */ {\r\n/* 139:122 */ return getPropertyBytes(\"secret\");\r\n/* 140: */ }\r\n/* 141: */ catch (Exception e)\r\n/* 142: */ {\r\n/* 143:124 */ log.warning(\"Error getting secret: \" + e.getMessage());\r\n/* 144: */ }\r\n/* 145:126 */ return new byte[0];\r\n/* 146: */ }", "public String getChiffreSecret() {\r\n\t\treturn this.chiffreSecret;\r\n\t}", "public final byte[] secret() {\n try {\n ByteSequence seq = new ByteSequence(this.sequence());\n seq.append(this._domainNameSeq);\n seq.append(this._creatorCert.getEncoded());\n return seq.sequence();\n } catch (Exception ex) {\n ex.printStackTrace();\n return null;\n }\n }", "public void get_password(View view) {\n forgot_pass_textView.setVisibility(View.VISIBLE);\n submit_btn.setVisibility(View.VISIBLE);\n\n password.setVisibility(View.GONE);\n forgot_pass_textView.setVisibility(View.GONE);\n login_btn.setVisibility(View.GONE);\n }", "com.google.protobuf.ByteString getSecretBytes();", "@Override\n protected Boolean doInBackground(Void... params) {\n SecureRandom sr = new SecureRandom();\n sr.nextBytes(phonepartBytes);\n\n String server_secret_hex = byteArrayToHexString(token.getSecret());\n char[] ch = server_secret_hex.toCharArray();\n byte[] completesecretBytes = new byte[(output_size_bit / 8)];\n\n // 2. PBKDF2 with the specified parameters\n try {\n completesecretBytes = OTPGenerator.generatePBKDFKey(ch, phonepartBytes, iterations, output_size_bit);\n } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {\n e.printStackTrace();\n }\n token.setSecret(completesecretBytes);\n return true;\n }", "public ResourceReference secret() {\n return this.secret;\n }", "@Test public void useAppContext() throws Exception {\n Endecrypt test = new Endecrypt();\r\n String oldString = \"lingyang1218yj@\";\r\n System.out.println(\"1、SPKEY为: \" + SPKEY);\r\n System.out.println(\"2、明文密码为: \" + oldString);\r\n String reValue = test.get3DESEncrypt(oldString, SPKEY);\r\n reValue = reValue.trim().intern();\r\n System.out.println(\"3、进行3-DES加密后的内容: \" + reValue);\r\n String reValue2 = test.get3DESDecrypt(reValue, SPKEY);\r\n System.out.println(\"4、进行3-DES解密后的内容: \" + reValue2);\r\n }", "public EncryptorReturn decrytp(String in) throws CustomizeEncryptorException;", "private String getSecretValue(String secretOcid) throws IOException {\n GetSecretBundleRequest getSecretBundleRequest = GetSecretBundleRequest\n .builder()\n .secretId(secretOcid)\n .stage(GetSecretBundleRequest.Stage.Current)\n .build();\n\n // get the secret\n GetSecretBundleResponse getSecretBundleResponse = secretsClient.\n getSecretBundle(getSecretBundleRequest);\n\n // get the bundle content details\n Base64SecretBundleContentDetails base64SecretBundleContentDetails =\n (Base64SecretBundleContentDetails) getSecretBundleResponse.\n getSecretBundle().getSecretBundleContent();\n\n // decode the encoded secret\n byte[] secretValueDecoded = Base64.decodeBase64(base64SecretBundleContentDetails.getContent());\n\n return new String(secretValueDecoded);\n }", "protected void doGet(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response) throws ServletException, IOException {\r\n\r\n\t\tObject twoByteArrays = findUserAndGetIdentityToken(request);\r\n\t\ttry {\r\n\r\n\t\t\tObjectOutputStream oos = new ObjectOutputStream(\r\n\t\t\t\t\tresponse.getOutputStream());\r\n\t\t\toos.writeObject(twoByteArrays);\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace(response.getWriter());\r\n\t\t}\r\n\r\n\t}", "@GetMapping(\"/encrypt-decrypt/{smallMsg}\")\n\tpublic String encryptDecrypt(@PathVariable String password, @RequestParam(\"message\") String message) {\n\t\tSystem.out.println(\"IN CONTROLLER KEY IS : \"+password);\n String response = service1.authenticateUser(password, message);\n return \"RESPONSE AFTER DECRYPTION : \"+response;\n\t}", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n String signature = request.getParameter(\"signature\");\n String timestamp = request.getParameter(\"timestamp\");\n String nonce = request.getParameter(\"nonce\");\n String echostr = request.getParameter(\"echostr\");\n\n // 调用逻辑验证\n PrintWriter out = response.getWriter();\n if (ChecktUtil.checkSignature(signature, timestamp, nonce)) {\n System.out.println(\"check ok!\");\n out.println(echostr);\n }\n out.close();\n }", "public Object invoke() {\n \t\tString plaintxt = plaintext;\n \t\treturn md5 != null ? md5.digest( plaintxt != null ? plaintxt.getBytes() : null ) : null;\n }", "private static String generateSecret(Accessor accessor, Consumer consumer) {\n return generateHash(accessor.getToken() + consumer.getSecret() + System.nanoTime());\n }", "String key(R request);", "public String getClientSecret() {\n return clientSecret;\n }", "private void getSecret() {\n\t\tAWSSecretsManager client = AWSSecretsManagerClientBuilder.standard().withRegion(region).build();\n\n\t\t// In this sample we only handle the specific exceptions for the\n\t\t// 'GetSecretValue' API.\n\t\t// See\n\t\t// https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html\n\t\t// We rethrow the exception by default.\n\n\t\tGetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest().withSecretId(secretName);\n\t\tGetSecretValueResult getSecretValueResult = null;\n\n\t\ttry {\n\t\t\tgetSecretValueResult = client.getSecretValue(getSecretValueRequest);\n\t\t}\n\t\t// @TODO: Figure out what I should do here. Generic exception?.\n\t\tcatch (DecryptionFailureException e) {\n\t\t\t// Secrets Manager can't decrypt the protected secret text using the provided\n\t\t\t// KMS key.\n\t\t\t// Deal with the exception here, and/or rethrow at your discretion.\n\t\t\te.printStackTrace();\n\t\t} catch (InternalServiceErrorException e) {\n\t\t\t// An error occurred on the server side.\n\t\t\t// Deal with the exception here, and/or rethrow at your discretion.\n\t\t\te.printStackTrace();\n\t\t} catch (InvalidParameterException e) {\n\t\t\t// You provided an invalid value for a parameter.\n\t\t\t// Deal with the exception here, and/or rethrow at your discretion.\n\t\t\te.printStackTrace();\n\t\t} catch (InvalidRequestException e) {\n\t\t\t// You provided a parameter value that is not valid for the current state of the\n\t\t\t// resource.\n\t\t\t// Deal with the exception here, and/or rethrow at your discretion.\n\t\t\te.printStackTrace();\n\t\t} catch (ResourceNotFoundException e) {\n\t\t\t// We can't find the resource that you asked for.\n\t\t\t// Deal with the exception here, and/or rethrow at your discretion.\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tif (getSecretValueResult.getSecretString() != null) {\n\t\t\ttry {\n\t\t\t\tresult = new ObjectMapper().readValue(getSecretValueResult.getSecretString(), HashMap.class);\n\t\t\t} catch (JsonMappingException e) {\n\t\t\t\tlogger.error(\"ERROR :\", e);\n\t\t\t\te.printStackTrace();\n\t\t\t} catch (JsonProcessingException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t}\n\t\t// AWS defualt else, unsure why it is in the default. Need to check.\n\t\t//Maybe encryption not setup right?\n\t\telse {\n\t\t\tdecodedBinarySecret = new String(\n\t\t\t\t\tBase64.getDecoder().decode(getSecretValueResult.getSecretBinary()).array());\n\t\t}\n\t}", "public synchronized String getDecryptedText() {\n String text;\n try {\n text = ContentCrypto.decrypt(mText, getSalt(), Passphrase.INSTANCE.getPassPhrase().toCharArray());\n } catch (Exception e) {\n e.printStackTrace();\n text = \"Bad Decrypt\";\n }\n return text;\n }", "public void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n \n response.setContentType(\"text/html;charset=UTF-8\");\n \n try(PrintWriter out = response.getWriter()){\n \n String user = request.getParameter(\"text\");\n String pass = request.getParameter(\"password\");\n \n Cookie ck = new Cookie(\"auth\", user);\n ck.setMaxAge(600);\n \n DbConnect dbCon = new DbConnect();\n Connection connect = dbCon.getCon();\n \n PreparedStatement pst = connect.prepareStatement\n (\"SELECT Username, UserSecretCode FROM break.Users where Username=? and UserSecretCode=?\");\n \n pst.setString(1, user);\n pst.setString(2, pass);\n \n ResultSet rs = pst.executeQuery();\n \n if (rs.next()) {\n response.addCookie(ck);\n response.sendRedirect(\"index.html\");\n } else {\n RequestDispatcher rd = request.getRequestDispatcher(\"login.html\");\n rd.include(request, response);\n }\n } catch (SQLException ex) {\n \n Logger.getLogger(LoginServlet.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "@GetMapping(\"/here\")\n public String getHereKey() {\n return properties.getHereApiKey();\n }", "public static String getRequestTokenSecret(Context context){\n\t\t\tSharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);\n\t\t\treturn prefs.getString(TWITTER_REQUEST_TOKEN_SECRET, null);\n\t\t}", "@Override\r\n\tpublic void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {\r\n\t\tOAuthConsumer consumer = null;\r\n\t\t//log.info(\" MineTwitterConsumer START\");\r\n\t\tthis.setRedirectUrl(request.getParameter(JpSocialSystemConstants.TW_REDIRECT_URL));\r\n\t\tConfigInterface configInterface = (ConfigInterface) ApsWebApplicationUtils.getBean(\"BaseConfigManager\", request);\r\n\t\tString devMode = configInterface.getParam(JpSocialSystemConstants.DEV_MODE_PARAM_NAME);\r\n\t\tString loginrequest = request.getParameter(\"loginrequest\");\r\n\t\tif (\"true\".equalsIgnoreCase(devMode)) {\r\n\t\t\t_logger.info(\" DEV MODE :: {} - auth url {}\", devMode, this.getDevLoginUrl());\r\n\t\t\tthis.setRedirectUrl(this.getDevLoginUrl());\r\n\t\t\tif (this.getDomain().equals(loginrequest)) {\r\n\t\t\t\tUserDetails userDetails = this.getFakeUser();\r\n\t\t\t\trequest.getSession().setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, userDetails);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tITwitterCookieConsumer twitterConsumerManager =\r\n\t\t\t\t\t(ITwitterCookieConsumer) ApsWebApplicationUtils.getBean(JpSocialSystemConstants.TWITTER_CONSUMER_MANAGER, request);\r\n\t\t\ttry {\r\n\t\t\t\tconsumer = twitterConsumerManager.getTwitterConsumer(request);\r\n\t\t\t\tOAuthAccessor accessor = twitterConsumerManager.getAccessor(request, response, consumer);\r\n\t\t\t\tOAuthClient client = new OAuthClient(new TwitterHttpClient());\r\n\t\t\t\tOAuthResponseMessage result = client.access(accessor.newRequestMessage(OAuthMessage.GET,\r\n\t\t\t\t\t\t\"https://api.twitter.com/1.1/account/verify_credentials.json\", null), ParameterStyle.AUTHORIZATION_HEADER);\r\n\t\t\t\tint status = result.getHttpResponse().getStatusCode();\r\n\t\t\t\tif (status != HttpResponseMessage.STATUS_OK) {\r\n\t\t\t\t\tOAuthProblemException problem = result.toOAuthProblemException();\r\n\t\t\t\t\tif (problem.getProblem() != null) {\r\n\t\t\t\t\t\tthrow problem;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tMap<String, Object> dump = problem.getParameters();\r\n\t\t\t\t\tresponse.setContentType(\"text/plain\");\r\n\t\t\t\t\tPrintWriter out = response.getWriter();\r\n\t\t\t\t\tout.println(dump.get(HttpMessage.REQUEST));\r\n\t\t\t\t\tout.println(\"----------------------\");\r\n\t\t\t\t\tout.println(dump.get(HttpMessage.RESPONSE));\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Simply pass the data through to the browser:\r\n\t\t\t\t\tString json = twitterConsumerManager.copyResponse(result);\r\n//\t\t\t\tSystem.out.println(\"****************************************\");\r\n//\t\t\t\tSystem.out.println(json);\r\n//\t\t\t\tSystem.out.println(\"****************************************\");\r\n\t\t\t\t\tJSONObject jsonObject = new JSONObject(json);\r\n\t\t\t\t\tString id = jsonObject.getString(\"id\");\r\n\t\t\t\t\t//String id_str = jsonObject.getString(\"id_str\");\t\t\t\t\r\n\t\t\t\t\tString name = jsonObject.getString(\"name\");\r\n\t\t\t\t\t//log.info(\" id \" + jsonObject.getString(\"id\"));\r\n\t\t\t\t\t//log.info(\" id_str \" + jsonObject.getString(\"id_str\"));\r\n// log.info(\" name \" + jsonObject.getString(\"name\"));\r\n\t\t\t\t\tITwitterManager twitterManager = (ITwitterManager) ApsWebApplicationUtils.getBean(JpSocialSystemConstants.TWITTER_CLIENT_MANAGER, request);\r\n\t\t\t\t\tTwitterCredentials credentials = (TwitterCredentials) twitterManager.createSocialCredentials(accessor.accessToken, accessor.tokenSecret);\r\n//\t\t\t\t\t((HttpServletRequest) request).getSession().setAttribute(JpSocialSystemConstants.SESSION_PARAM_TWITTER, credentials);\r\n\t\t\t\t\tString currentAction = getAndRemoveNoLoginAction(request);\r\n\t\t\t\t\tURI uri = new URI(this.getRedirectUrl());\r\n\t\t\t\t\tList<NameValuePair> urlMap = URLEncodedUtils.parse(uri, \"UTF-8\");\r\n\t\t\t\t\tboolean login = true;\r\n\t\t\t\t\tfor (int i = 0; i < urlMap.size(); i++) {\r\n\t\t\t\t\t\tNameValuePair nameValuePair = urlMap.get(i);\r\n\t\t\t\t\t\tString namePair = nameValuePair.getName();\r\n\t\t\t\t\t\tif(null != namePair && namePair.endsWith(\"login\")){\r\n\t\t\t\t\t\t\tlogin = Boolean.parseBoolean(nameValuePair.getValue());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!JpSocialSystemConstants.NO_LOGIN.equals(currentAction) && login){\r\n\t\t\t\t\t\tUserDetails userDetails = new TwitterUser(id + this.getDomain(), name);\r\n\t\t\t\t\t\trequest.getSession().setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, userDetails);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tJpSocialSystemUtils.saveTwitterCredentialsCookie(credentials, response, request);\r\n\t\t\t\t\t//log.info(\" MineTwitterConsumer REDIRECT URL \" + redirectUrl);\r\n\t\t\t\t\tif (null != this.getRedirectUrl() && this.getRedirectUrl().length() > 0) {\r\n\t\t\t\t\t\t//log.info(\" MineTwitterConsumer REDIRECT\");\r\n\t\t\t\t\t\tresponse.sendRedirect(this.getRedirectUrl());\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//log.info(\" MineTwitterConsumer END \");\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\ttwitterConsumerManager.handleException(e, request, response, consumer);\r\n\t\t\t} \r\n\t\t}\r\n\t\t\r\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);\n\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n // kontrole\n final Button btnDecipher = findViewById(R.id.btnDecipher);\n final Button btnGen = findViewById(R.id.genKeys);\n final TextView txt = findViewById(R.id.editText);\n final Button btnSend = findViewById(R.id.btnSend);\n final TextView labelGAB = findViewById(R.id.labelGAB);\n final Button btnUcitaj = findViewById(R.id.btnUcitaj);\n\n gab = null;\n\n // ne dozvoljamo sifrovanje/desifrovanje pre razmene kljuceva\n btnDecipher.setEnabled(false);\n btnSend.setEnabled(false);\n\n // handler za slanje sifrovanje poruke\n btnSend.setOnClickListener(new View.OnClickListener() {\n public void onClick(View v) {\n try {\n String text = txt.getText().toString();\n txt.setText(\"\");\n share(\"Пошаљи шифровано користећи\", AES.encrypt(text, gab.toString()));\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n });\n\n // handler za generisanje p, g, a, g^a\n btnGen.setOnClickListener(new View.OnClickListener() {\n public void onClick(View v) {\n Pair<BigInteger, BigInteger> pair = findPrimeAndPrimeRoot();\n rand = new Random();\n\n a = BigInteger.valueOf(rand.nextInt() & Integer.MAX_VALUE);\n _public = new PublicInfo(pair.p, pair.g, pair.g.modPow(a, pair.p));\n\n String text = _public.p.toString(16)\n + \"\\n\" + _public.g.toString(16)\n + \"\\n\" + _public.ga.toString(16);\n\n share(\"Пошаљи p, g, g^a користећи\", text);\n }\n });\n\n // handler za ucitavanje kljuca (ili p, g, g^a, ili g^b, zavisno od toga do kojeg smo koraka)\n btnUcitaj.setOnClickListener(new View.OnClickListener() {\n public void onClick(View v) {\n String data = getClipboard(\"Нисте копирали кључ.\");\n\n if (data == null)\n return;\n\n String[] d = data.split(\"\\n\");\n\n // primili smo p, g, g^a\n if (d.length == 3)\n {\n _public = new PublicInfo(new BigInteger(d[0], 16), new BigInteger(d[1], 16), new BigInteger(d[2], 16));\n\n rand = new Random();\n b = BigInteger.valueOf(rand.nextInt() & Integer.MAX_VALUE);\n\n _public.gb = _public.g.modPow(b, _public.p);\n gab = _public.ga.modPow(b, _public.p);\n\n labelGAB.setText(gab.toString());\n\n btnDecipher.setEnabled(true);\n btnSend.setEnabled(true);\n\n share(\"Пошаљи g^b користећи\", _public.gb.toString(16));\n return;\n }\n // primili smo g^b\n else if (d.length == 1)\n {\n gab = (new BigInteger(d[0], 16)).modPow(a, _public.p);\n\n labelGAB.setText(gab.toString());\n\n btnDecipher.setEnabled(true);\n btnSend.setEnabled(true);\n\n toastr(\"Кључеви учитани!\");\n }\n else\n {\n toastr(\"Ти не знаш шта радиш!\");\n }\n }\n });\n\n // handler za desifrovanje\n btnDecipher.setOnClickListener(new View.OnClickListener() {\n public void onClick(View v) {\n String data = getClipboard(\"Нисте копирали поруку.\");\n\n if (data != null) {\n try {\n String dec = AES.decrypt(data, gab.toString());\n toastr(dec);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }\n });\n }", "void generateSecretKey() {\n\n Random rand = new Random();\n \n // randomly generate alphabet chars\n this.secretKey.setCharAt(0, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(1, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(4, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(5, (char) (rand.nextInt(26) + 'a'));\n\n // randomly generate special chars\n // special chars are between 33-47 and 58-64 on ASCII table\n if (rand.nextBoolean()) {\n this.secretKey.setCharAt(3, (char) (rand.nextInt(15) + '!'));\n this.secretKey.setCharAt(8, (char) (rand.nextInt(15) + '!'));\n } else {\n this.secretKey.setCharAt(3, (char) (rand.nextInt(7) + ':'));\n this.secretKey.setCharAt(8, (char) (rand.nextInt(7) + ':'));\n }\n \n // randomly generate int between 2 and 5\n this.secretKey.setCharAt(7, (char) (rand.nextInt(4) + '2'));\n }", "Encryption encryption();", "String getCiphersPassphrase();", "public String getClientSecret() {\n return clientSecret;\n }", "protected static boolean[] generateSecretKey() {\n\n\t\t//Creating the key generator\n\n\t\tKeyGenerator gen = null;\n\t\ttry {\n\t\t gen = KeyGenerator.getInstance(\"AES\");\n\t\t} catch (NoSuchAlgorithmException e1) {\n\t\t System.out.println(\"Algoritmo non supportato\");\n\t\t System.exit(1);\n\t\t}\n\n\t\t//Generating the secret key\n\n\t\tgen.init(new SecureRandom());\n\n\t\tKey k = gen.generateKey();\n\t\tbyte[] key = k.getEncoded();\n\t\t\n\t\tString stringKey = Base64.getEncoder().encodeToString(key);\n\t\t\n\t\tJTextArea textarea= new JTextArea(stringKey);\n\t\ttextarea.setEditable(false);\n\t\tJOptionPane.showMessageDialog(null, textarea, \"This is your SECRET KEY, keep it safe!\", JOptionPane.WARNING_MESSAGE);\n\t\t\n\t\tStego_Model\tmodel = new Stego_Model();\n\t\tboolean[] boolSecretKey = model.bytesToBooleans(key);\n\t\treturn boolSecretKey;\n\t\t}", "public String getSecretKey() {\n return properties.getProperty(SECRET_KEY);\n }", "private int generateSecret() {\n int secret = secretGenerator.nextInt();\n while (secretToNumber.containsKey(secret)) {\n secret = secretGenerator.nextInt();\n }\n return secret;\n }", "void touchSecret(Long secretId);", "public String getResult(){\n MCrypt mcrypt = new MCrypt();\n try {\n String s = new String( mcrypt.decrypt( result ));\n return s;\n //return result;\n } catch (Exception e) {\n e.printStackTrace();\n return e.toString();\n }\n }", "public void sendMessage(View view) {\n \tString ownFingerprint = PreferenceManager\n \t\t\t.getDefaultSharedPreferences(getBaseContext())\n \t\t\t.getString(\"KEY_FINGERPRINT\", \"Key not found\");\n \tEditText editText = (EditText)findViewById(R.id.edit_message);\n \tEncryptedMessage em = new EncryptedMessage(\n \t\t\tfingerprint, editText.getText().toString(), this);\n \t\n \tLog.d(\"MESSAGE submitter\", ownFingerprint);\n \tLog.d(\"MESSAGE destination\", em.getDestination());\n \tLog.d(\"MESSAGE key\", em.getEncryptedAesKey());\n \tLog.d(\"MESSAGE encrypted\", em.getEncryptedMessage());\n \tLog.d(\"MESSAGE IV\", em.getIv());\n \t\n \t\n \tthis.adapter.add(editText.getText().toString());\n \t\n \t// Creating HTTP client\n DefaultHttpClient httpClient = new DefaultHttpClient();\n // Creating HTTP Post\n HttpPost httpPost = new HttpPost(sendMessageURL);\n \n // Building post parameters\n // key and value pair\n List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>(2);\n nameValuePair.add(new BasicNameValuePair(\"origin\", ownFingerprint));\n nameValuePair.add(new BasicNameValuePair(\"destination\", em.getDestination()));\n nameValuePair.add(new BasicNameValuePair(\"key\", em.getEncryptedAesKey()));\n nameValuePair.add(new BasicNameValuePair(\"vector\", em.getIv()));\n nameValuePair.add(new BasicNameValuePair(\"message\", em.getEncryptedMessage()));\n \n // Url Encoding the POST parameters\n try {\n httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));\n } catch (UnsupportedEncodingException e) {\n // writing error to Log\n e.printStackTrace();\n }\n \n // Making HTTP Request\n try {\n HttpResponse response = httpClient.execute(httpPost);\n \n // writing response to log\n Log.d(\"Http Response:\", response.toString());\n } catch (ClientProtocolException e) {\n // writing exception to log\n e.printStackTrace();\n } catch (IOException e) {\n // writing exception to log\n e.printStackTrace();\n \n }\n \t\n \teditText.setText(\"\");\n }", "public char getSecretPassage() {\n\t\treturn secretPassage; \n\t}", "public String Decrypt(String s);", "@RequestMapping(value = \"/token\", method = RequestMethod.GET)\n\t@ResponseBody\n\tpublic String home(@RequestParam(\"signature\") String signature,\n\t\t\t@RequestParam(\"echostr\") String echostr,\n\t\t\t@RequestParam(\"timestamp\") String timestamp,\n\t\t\t@RequestParam(\"nonce\") String nonce, \n\t\t\tHttpServletResponse res,Model model) throws IOException {\n\t String signatureb = signature;\n \t\tString echostrb = echostr;\n \t String timestampb = timestamp;\n \t String nonceb = nonce;\n \t Boolean istrue = false;\n \t istrue = checkSecret.CheckSignatureb(signatureb, timestampb, nonceb);\n \t if(istrue) {\n \t \t return echostrb;\n \t }\n \t \n\t\t return \"home\";\n\t}", "public static byte[] getIv()\r\n/* 161: */ {\r\n/* 162: */ try\r\n/* 163: */ {\r\n/* 164:139 */ return getPropertyBytes(\"aesiv\");\r\n/* 165: */ }\r\n/* 166: */ catch (Exception e)\r\n/* 167: */ {\r\n/* 168:141 */ log.warning(\"Error getting secret: \" + e.getMessage());\r\n/* 169: */ }\r\n/* 170:143 */ return new byte[0];\r\n/* 171: */ }", "private String pswd(){\n try{\n PBEKeySpec spec = new PBEKeySpec(this.Creator.toUpperCase().toCharArray(), this.Time.getBytes(), 100, 512);\n SecretKeyFactory skf = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\n //System.out.println(\"pswd=\"+this.toHex(skf.generateSecret(spec).getEncoded()));\n return this.toHex(skf.generateSecret(spec).getEncoded());\n }catch(InvalidKeySpecException | NoSuchAlgorithmException e){\n e.printStackTrace();\n }\n return null;\n }", "public void test() {\n\t\t// super.onCreate(savedInstanceState);\n\t\t// setContentView(R.layout.main);\n\t\tString masterPassword = \"abcdefghijklmn\";\n\t\tString originalText = \"i see qinhubao eat milk!\";\n\t\tbyte[] text = new byte[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };\n\t\tbyte[] password = new byte[] { 'a' };\n\t\ttry {\n\t\t\tString encryptingCode = encrypt(masterPassword, originalText);\n\t\t\t// System.out.println(\"加密结果为 \" + encryptingCode);\n\t\t\tLog.i(\"加密结果为 \", encryptingCode);\n\t\t\tString decryptingCode = decrypt(masterPassword, encryptingCode);\n\t\t\tSystem.out.println(\"解密结果为 \" + decryptingCode);\n\t\t\tLog.i(\"解密结果\", decryptingCode);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\t\n\t\t // configures upload settings\n DiskFileItemFactory factory = new DiskFileItemFactory();\n // sets memory threshold - beyond which files are stored in disk\n factory.setSizeThreshold(MEMORY_THRESHOLD);\n // sets temporary location to store files\n factory.setRepository(new File(System.getProperty(\"java.io.tmpdir\")));\n\n ServletFileUpload upload = new ServletFileUpload(factory);\n \n \n // constructs the directory path to store upload file\n // this path is relative to application's directory\n String uploadPath = getServletContext().getRealPath(\"\") + File.separator + UPLOAD_DIRECTORY;\n // creates the directory if it does not exist\n File uploadDir = new File(uploadPath);\n if (!uploadDir.exists()) {\n uploadDir.mkdir();\n }\n int keySize= 0,iterationCount=0;\n String salt =\"\",passphrase=\"\",ciphertext=\"\",iv=\"\",fileData=\"\",Cdata=\"\",plainTextArea1=\"\";\n List<FileItem> formItems;\n String fileName =\"\";\n\t\ttry {\n\t\t\tformItems = upload.parseRequest(request);\n\t\t\tfor (FileItem item : formItems) {\n\t\t\t // processes only fields that are not form fields\n\t\t\t if (!item.isFormField()) {\n\t\t\t fileName = new File(item.getName()).getName();\n\t\t\t try {\n\t\t\t\t\t\tfileData = item.getString();\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t } else {\n\t\t\t //here...\n\t\t\t String fieldname = item.getFieldName();\n\t\t\t String fieldvalue = item.getString();\n\t\t\t \n\t\t\t if (fieldname.equals(\"passphrase\")) {\n\t\t\t \tpassphrase = fieldvalue;\n\t\t\t } else if (fieldname.equals(\"plainTextArea\")) {\n\t\t\t \tciphertext = fieldvalue;\n\t\t\t }else if (fieldname.equals(\"plainTextArea1\")) {\n\t\t\t \tplainTextArea1 = fieldvalue;\n\t\t\t }else if (fieldname.equals(\"secretKeys\")) {\n\t\t\t \tCdata = fieldvalue;\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t} catch (FileUploadException e) {\n\t\t\te.printStackTrace();\n\t\t}\n \n\t\ttry {\n\t\t\tSystem.out.println(Cdata);\n\t\t\tString keysData = RSACryptoUtil.decryptWebPIN(Cdata);\n\t\t\tSystem.out.println(keysData);\n\t\t\tString[] dataAry = keysData.split(\"@@@\"); \n\t\t\tkeySize = Integer.valueOf(dataAry[4]);\n\t\t\titerationCount = Integer.valueOf(dataAry[3]);\n\t\t\tsalt = String.valueOf(dataAry[0]);\n\t\t\tiv = String.valueOf(dataAry[1]);\n\t\t\tpassphrase = String.valueOf(dataAry[2]);\n\t\t}catch (Exception e) {\n\t response.setStatus(HttpServletResponse.SC_OK);\n\t response.getWriter().print(\"Security keys tampered!\");\n\t\t}\n\t\t\t\t\n\t AesUtil aesUtil = new AesUtil(keySize, iterationCount);\n\t String plaintext = aesUtil.decrypt(salt, iv, passphrase, ciphertext);\n\t String fileDataIs = aesUtil.decrypt(salt, iv, passphrase, fileData);\n\t String replaceStr = \"\";\n\t if(fileName.endsWith(\".txt\"))\n\t \treplaceStr =\"data:text/plain;base64,\";\n\t else if(fileName.endsWith(\".js\"))\n\t \treplaceStr =\"data:application/javascript;base64,\";\n\t else if(fileName.endsWith(\".jpeg\") || fileName.endsWith(\".jpg\") )\n\t \treplaceStr=\"data:image/jpeg;base64,\";\n\t else if(fileName.endsWith(\".png\"))\n\t \treplaceStr=\"data:image/png;base64,\";\n\t \n\t \n\t if(!fileName.endsWith(\".jpeg\") && !fileName.endsWith(\".jpg\") && !fileName.endsWith(\".png\"))\n\t FileUtils.writeStringToFile(new File(uploadPath+File.separator+fileName), new String(Base64.decodeBase64(fileDataIs.replaceAll(replaceStr, \"\").getBytes())));\n\t else{\n\t \tbyte[] data = Base64.decodeBase64(fileDataIs.replaceAll(replaceStr, \"\"));\n\t try (OutputStream stream = new FileOutputStream(\"D:/sudhakar/eclipse-jee-luna-R-win32-x86_64/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Encryption/image_upload/\"+fileName)) {\n\t \t\tstream.write(data);\n\t \t}\n\t }\n \n response.setStatus(HttpServletResponse.SC_OK);\n response.getWriter().print(plaintext+\":\"+plainTextArea1);\n }", "DBOOtpSecret activateSecret(Long userId, Long secretId);", "void computeSecrets() {\n final Bytes agreedSecret =\n signatureAlgorithm.calculateECDHKeyAgreement(ephKeyPair.getPrivateKey(), partyEphPubKey);\n\n final Bytes sharedSecret =\n keccak256(\n concatenate(agreedSecret, keccak256(concatenate(responderNonce, initiatorNonce))));\n\n final Bytes32 aesSecret = keccak256(concatenate(agreedSecret, sharedSecret));\n final Bytes32 macSecret = keccak256(concatenate(agreedSecret, aesSecret));\n final Bytes32 token = keccak256(sharedSecret);\n\n final HandshakeSecrets secrets =\n new HandshakeSecrets(aesSecret.toArray(), macSecret.toArray(), token.toArray());\n\n final Bytes initiatorMac = concatenate(macSecret.xor(responderNonce), initiatorMsgEnc);\n final Bytes responderMac = concatenate(macSecret.xor(initiatorNonce), responderMsgEnc);\n\n if (initiator) {\n secrets.updateEgress(initiatorMac.toArray());\n secrets.updateIngress(responderMac.toArray());\n } else {\n secrets.updateIngress(initiatorMac.toArray());\n secrets.updateEgress(responderMac.toArray());\n }\n\n this.secrets = secrets;\n }", "public Encryption(View v) {\n initComponents();\n this.view = v;\n }", "DBOOtpSecret storeSecret(Long userId, String secret);", "public void doPost(HttpServletRequest request, HttpServletResponse response)\n\t\t\tthrows ServletException, IOException {\n\n\t\trequest.setCharacterEncoding(\"GBK\");\n\t\tresponse.setContentType(\"text/html;charset=GBK\");\n\t\tPrintWriter out = response.getWriter();\n\t\tString keyWord = request.getParameter(\"keyWord\");\n\n\t\tShowBean show = new ShowBean();\n\t\tshow.setKeyword(keyWord);\n\t\tList<Map> list = show.ListInit(request, response);\n\t\trequest.setAttribute(\"list\", list);\n\t\trequest.getRequestDispatcher(\"../main.jsp\").forward(request, response);\n\t}", "@GetMapping(\"/encrypt\")\n public String encrypt(String uid, String data) {\n return \"\";\n }", "public String getIdentityCardSecret() {\n return identityCardSecret;\n }", "public String decrypt(String key);", "protected void setDecripted() {\n content = this.aesKey.decrypt(this.content);\n }", "private byte[] handleDelete() {\n\t\tboolean success = replaceSecretWith(currentUser, \"\");\n\n\t\tif (success) {\n\t\t\tComMethods.report(\"SecretServer has deleted \"+currentUser+\"'s secret.\", simMode);\n\t\t\treturn preparePayload(\"secretdeleted\".getBytes());\n\t\t} else {\n\t\t\tComMethods.report(\"SecretServer has FAILED to delete \"+currentUser+\"'s secret.\", simMode);\n\t\t\treturn preparePayload(\"writingfailure\".getBytes());\n\t\t}\n\t}", "public static String decrypt(String input) {\n\t\t Base64.Decoder decoder = Base64.getMimeDecoder();\n\t String key = new String(decoder.decode(input));\n\t return key;\n\t}", "public void updateContent(View theView) {\n if (getArguments() != null) {\n Credentials credentials = (Credentials) getArguments().get(\"key\");\n EditText etEmail = theView.findViewById(R.id.edit_text_email);\n etEmail.setText(credentials.getEmail());\n\n EditText etPass = theView.findViewById(R.id.edit_text_password);\n etPass.setText(credentials.getPassword());\n }\n }", "void setMySecret() {\n mySecretShortString = randomString (6);\n mySecretLongString = randomString (14);\n mySecretShort.setText(\"your short secret: \" + mySecretShortString);\n mySecretLong.setText(\"or your long secret: \" + mySecretLongString);\n }", "public static Result login() {\n String csrfToken = \"\";\n return serveAsset(\"\");\n }", "public void displayData(View view){\n SharedPreferences sharedPref = getSharedPreferences(\"userInfo\", Context.MODE_PRIVATE); //This means the info is private and hence secured\n\n String name = sharedPref.getString(\"username\", \"\"); //The second parameter contains the value that we are going to get, so we leave it blank.\n String pw = sharedPref.getString(\"password\", \"\");\n yashwinText.setText(name + \"\" + pw);\n }", "public final String getClientSecret() {\n return clientSecret;\n }", "public String getSecretKey() {\n return getProperty(SECRET_KEY);\n }", "@Override\n public void onClick(final View arg0) {\n if (key != null) {\n if (encrypt != null) {\n decrypt = key.decrypt(encrypt);\n messageTxt.setText(new String(decrypt.toByteArray()));\n } else if (messageTxt.getText().length() > 0\n && !messageTxt.getText().equals(\"\")) {\n String encryptedMessage = messageTxt.getText().toString();\n encryptedMessage = encryptedMessage.replace(\" \", \"\");\n encryptedMessage = encryptedMessage.trim();\n Log.i(\"encryptedMessage\", encryptedMessage);\n try {\n decrypt = (BigInteger) key.decrypt(new BigInteger(\n encryptedMessage));\n messageTxt.setText(new String(decrypt.toByteArray()));\n } catch (Exception e) {\n e.printStackTrace();\n Toast.makeText(ShhActivity.this, \"Your text cannot be decrypted\",\n Toast.LENGTH_SHORT).show();\n }\n } else {\n Toast.makeText(ShhActivity.this, \"Your text cannot be decrypted\",\n Toast.LENGTH_SHORT).show();\n }\n }\n }", "PasswordProtection protection();", "public String entschlüsseln(SecretKey key, String nachricht) throws Exception{\n BASE64Decoder myDecoder2 = new BASE64Decoder();\n byte[] crypted2 = myDecoder2.decodeBuffer(nachricht);\n\n // Entschluesseln\n Cipher cipher2 = Cipher.getInstance(\"AES\");\n cipher2.init(Cipher.DECRYPT_MODE, key);\n byte[] cipherData2 = cipher2.doFinal(crypted2);\n String erg = new String(cipherData2);\n\n // Klartext\n return(erg);\n\n}", "protected void doHandle(HttpServletRequest rq, HttpServletResponse rspn) throws ServletException, IOException {\n\t\tSystem.out.println(\"doHandle 메서드 호출\");\n\t\trq.setCharacterEncoding(\"utf-8\");\n\t\tString user_id = rq.getParameter(\"user_id\");\n\t\tString user_pw = rq.getParameter(\"user_pw\");\n\t\tSystem.out.println(\"아이디: \"+user_id);\n\t\tSystem.out.println(\"비밀번호: \"+user_pw);\n\t}", "String selectRandomSecretWord();", "String getPass();", "private String generateSecretKey(){\n SecureRandom random = new SecureRandom();\n byte[] bytes = new byte[20];\n\n random.nextBytes(bytes);\n Base32 base32 = new Base32();\n return base32.encodeToString(bytes);\n }", "private static String m5297cj() {\n try {\n KeyGenerator instance = KeyGenerator.getInstance(\"AES\");\n instance.init(128);\n return Base64.encodeToString(instance.generateKey().getEncoded(), 0);\n } catch (Throwable unused) {\n return null;\n }\n }", "Binder getToken(Binder data) {\n byte[] signedAnswer = data.getBinaryOrThrow(\"data\");\n try {\n if (publicKey.verify(signedAnswer, data.getBinaryOrThrow(\"signature\"), HashType.SHA512)) {\n Binder params = Boss.unpack(signedAnswer);\n // now we can check the results\n if (!Arrays.equals(params.getBinaryOrThrow(\"server_nonce\"), serverNonce))\n addError(Errors.BAD_VALUE, \"server_nonce\", \"does not match\");\n else {\n // Nonce is ok, we can return session token\n createSessionKey();\n Binder result = Binder.fromKeysValues(\n \"client_nonce\", params.getBinaryOrThrow(\"client_nonce\"),\n \"encrypted_token\", encryptedAnswer\n );\n\n version = Math.min(SERVER_VERSION, params.getInt(\"client_version\", 1));\n\n byte[] packed = Boss.pack(result);\n return Binder.fromKeysValues(\n \"data\", packed,\n \"signature\", myKey.sign(packed, HashType.SHA512)\n );\n }\n }\n } catch (Exception e) {\n addError(Errors.BAD_VALUE, \"signed_data\", \"wrong or tampered data block:\" + e.getMessage());\n }\n return null;\n }", "protected byte[] engineSharedSecret() throws KeyAgreementException {\n return Util.trim(ZZ);\n }" ]
[ "0.66294324", "0.61125475", "0.6093254", "0.59644616", "0.594161", "0.5838609", "0.58312947", "0.580048", "0.5666834", "0.5579912", "0.5552612", "0.55482566", "0.5492081", "0.5428448", "0.54057837", "0.5396968", "0.53733647", "0.5262724", "0.52485555", "0.52413416", "0.51792645", "0.50926286", "0.50646913", "0.50429094", "0.50406176", "0.5020424", "0.5009522", "0.49825984", "0.49677894", "0.49470958", "0.49356645", "0.49234226", "0.4912043", "0.48900107", "0.4886554", "0.4878438", "0.48472032", "0.48467338", "0.48432833", "0.48128185", "0.4804682", "0.48040122", "0.479872", "0.47972906", "0.4781856", "0.4780623", "0.47790346", "0.4775461", "0.4767631", "0.47592375", "0.47560272", "0.474784", "0.4747042", "0.4736374", "0.4736", "0.4726276", "0.47251576", "0.47218984", "0.47063488", "0.47029513", "0.4694558", "0.46852005", "0.46837512", "0.46801493", "0.4671044", "0.46684247", "0.46624893", "0.4648979", "0.46468508", "0.46449453", "0.46446046", "0.46402517", "0.46379083", "0.4636004", "0.46259624", "0.46255156", "0.46210566", "0.46195546", "0.46143627", "0.46099868", "0.46083093", "0.46035993", "0.4595496", "0.45926487", "0.45826128", "0.45765185", "0.45687073", "0.45630562", "0.45624712", "0.45590913", "0.45573494", "0.45554358", "0.45554265", "0.4546221", "0.45385566", "0.45357615", "0.4535671", "0.45343396", "0.45328707", "0.4532757" ]
0.7773103
0
Handles update requests, returns "secretupdated" when done
private byte[] handleUpdate(byte[] message) { byte[] newSecretBytes = Arrays.copyOfRange(message, "update:".getBytes().length, message.length); /* System.out.println("THIS IS A TEST:"); System.out.println("newSecretBytes:"); ComMethods.charByChar(newSecretBytes, true); System.out.println("newSecretBytes, reversed:"); String toStr = DatatypeConverter.printBase64Binary(newSecretBytes); byte[] fromStr = DatatypeConverter.parseBase64Binary(toStr); ComMethods.charByChar(fromStr, true); */ String newSecret = DatatypeConverter.printBase64Binary(newSecretBytes); boolean success = replaceSecretWith(currentUser, newSecret); if (success) { ComMethods.report("SecretServer has replaced "+currentUser+"'s secret with "+newSecret+".", simMode); return preparePayload("secretupdated".getBytes()); } else { ComMethods.report("SecretServer has FAILED to replace "+currentUser+"'s secret with "+newSecret+".", simMode); return preparePayload("writingfailure".getBytes()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void receivedUpdateFromServer();", "@Override\r\n\tpublic void doUpdate(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {\n\t\t\r\n\t}", "public void doPost(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n\r\n String apikey = (String) request.getSession().getAttribute(\"apikey\");\r\n String oldPass = request.getParameter(\"oldPassword\");\r\n String newPass = request.getParameter(\"newPassword\");\r\n String confirmation = request.getParameter(\"confirmation\");\r\n \r\n if (!newPass.equals(confirmation)) {\r\n request.setAttribute(\"error\", \"The new password and the confirmation don't match.\");\r\n this.getServletContext().getRequestDispatcher(\"/WEB-INF/change.jsp\").forward(request, response);\r\n }\r\n boolean passwordUpdated = false;\r\n try {\r\n YamDatabaseConnector dbConnector = new YamDatabaseConnector();\r\n passwordUpdated = dbConnector.updatePassword(apikey, oldPass, newPass);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(ChangePassword.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n\r\n if (passwordUpdated) {\r\n request.setAttribute(\"success\", \"Password successfully updated.\");\r\n } else {\r\n request.setAttribute(\"error\", \"Error updating the password.\");\r\n }\r\n // send response\r\n this.getServletContext().getRequestDispatcher(\"/WEB-INF/sign.jsp\").forward(request, response);\r\n }", "Long getUserUpdated();", "public String doUpdate(HttpServletRequest request,\n HttpServletResponse response) {\n return null;\n }", "public abstract Response update(Request request, Response response);", "public boolean updateSecret(String newSecret) {\n\t\tbyte[] encryptedNewSecret = SecureMethods.encryptRSA(newSecret.getBytes(), my_n, BigInteger.valueOf(my_e), simMode);\n\t\tbyte[] userMessage = ComMethods.concatByteArrs(\"update:\".getBytes(), encryptedNewSecret);\n\t\treturn sendAndCheckResp(userMessage, \"secretupdated\", \"writingfailure\");\n\t}", "Integer updateUserInfo(UpdateEntry updateEntry);", "public abstract void update(@Nonnull Response response);", "void filterUpdate(ServerContext context, UpdateRequest request,\n ResultHandler<Resource> handler, RequestHandler next);", "protected void doPost(HttpServletRequest request, HttpServletResponse response)\n\t\t\tthrows ServletException, IOException {\n\n\t\tif (!isLoggedIn(request)) {\n\t\t\twriteLoginNeededInfo(response);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tJSONObject status = new JSONObject();\n\t\tPrintWriter out = response.getWriter();\n\t\t\n\t\ttry {\n\t\t\tIdentity id = parseIdentity(request);\n\t\t\tdao.update(id);\n\n\t\t\tstatus.put(\"status\", Integer.toString(HttpURLConnection.HTTP_OK));\n\t\t\tstatus.put(\"msg\", \"Identity updated! :)\");\n\t\t} catch (JSONException ex) {\n\t\t\tlogger.error(ex.toString());\n\t\t\t\n\t\t\tstatus.put(\"status\", Integer.toString(HttpURLConnection.HTTP_BAD_REQUEST));\n\t\t\tstatus.put(\"msg\", ex.toString());\n\t\t}\n\t\t\n\t\tout.print(status);\n\t}", "long getUpdated();", "String getUpdated();", "public int updateUser(Candidat c) {\n String url = StaticVars.baseURL + \"/updateuser\";\n System.out.println(url);\n ConnectionRequest req = new ConnectionRequest();\n\n req.setUrl(url);\n req.setPost(true);\n\nreq.setHttpMethod(\"PUT\"); \n\n\n String can = String.valueOf(currentCandidat.getId());\n req.addArgument(\"id\", can);\n String login =String .valueOf(currentCandidat.getLogin());\n req.addArgument(\"login\",login);\n req.addArgument(\"email\", String .valueOf(currentCandidat.getEmail()));\n req.addArgument(\"pays\", String .valueOf(currentCandidat.getPays()));\n req.addArgument(\"ville\", String .valueOf(currentCandidat.getVille()));\n req.addArgument(\"tel\", Integer.toString(currentCandidat.getTel()));\n req.addArgument(\"domaine\", String .valueOf(currentCandidat.getDomaine()));\n\n req.addResponseListener(new ActionListener<NetworkEvent>() {\n @Override\n public void actionPerformed(NetworkEvent evt) {\n result = req.getResponseCode();\n \n System.out.println(result);\n }\n });\n NetworkManager.getInstance().addToQueueAndWait(req);\n\n return result;\n }", "public void update()\n {\n this.controller.updateAll();\n theLogger.info(\"Update request recieved from UI\");\n }", "@Override\n public MockResponse handleUpdate(RecordedRequest request) {\n return process(request, putHandler);\n }", "public void update(){}", "public void update(){}", "boolean update();", "@Override\r\n\tpublic void update(HttpServletResponse paramHttpServletResponse) {\n\t\t\r\n\t}", "private void updateFromProvider() {\n if(isUpdating.get()){\n isHaveUpdateRequest.set(true);\n return;\n }\n mUpdateExecutorService.execute(new UpdateThread());\n }", "public void update() {}", "@Override\n\tprotected String onUpdate(HttpServletRequest req, HttpServletResponse resp, FunctionItem fi,\n\t\t\tHashtable<String, String> params, String action, L l, S s) throws Exception {\n\t\treturn null;\n\t}", "public void attemptToUpdate();", "Account.Update update();", "public User update(User updatedInfo);", "private int update(surfstore.SurfStoreBasic.FileInfo request, String method) {\n int updated = 0;\n for (int i = 0; i < metadataStubList.size(); i++) {\n MetadataStoreGrpc.MetadataStoreBlockingStub metaStub = metadataStubList.get(i);\n metaStub.ping(Empty.newBuilder().build());\n // 1st phase\n\t\t\tif (metaStub.updateLog(LogInfo.newBuilder().setLog(method).setFilename(request.getFilename()).build()).getAnswer() == false) { // not crashed\n\t\t\t\t// 2nd phase\n\t\t\t\tif (metaStub.updateFollower(request).getResult() == WriteResult.Result.OK) {\n\t\t\t\t\tfollowerMapList.get(i).put(request.getFilename(), request.getVersion());\n\t\t\t\t\tupdated++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlogger.info(\"heartbeat update follower numbers \" + Integer.toString(updated));\n\t\treturn updated;\n\t}", "private void checkForUpdates(){\n\t\tlong now = System.currentTimeMillis();\r\n\t\tif(propertiesMemento.getProperty(PropertiesMemento.UPDATE_STRING) != null){\r\n\t\t\tlong lastUpdateTime = Long.parseLong(propertiesMemento.getProperty(PropertiesMemento.UPDATE_STRING));\r\n\t\t\tlong day = 86400000; // milli-seconds in a day\r\n\t\t\tif((now - lastUpdateTime) < day){\r\n\t\t\t\treturn; // Don't need to check as a check has been made in the last 24hrs. \r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsetStatusBarText(\"Checking for updates...\"); \r\n\t\t\r\n HttpClient webConnection = new HttpClient();\r\n \t\tProperties webSideProps; \r\n \t\ttry{\r\n \t\t\twebSideProps = webConnection.getProperties(\"http://www.zygomeme.com/version_prop.txt\");\r\n \t\t}\r\n \t\tcatch(SocketTimeoutException ste){\r\n \t\t\tlogger.debug(\"Can't connect to internet:\" + ste);\r\n \t\t\tsetStatusBarText(\"Unable to connect to internet to check for updates\");\r\n \t\t\treturn;\r\n \t\t}\r\n \t\tcatch(UnknownHostException uhe){\r\n \t\t\tlogger.debug(\"Can't connect to internet:\" + uhe);\r\n \t\t\tsetStatusBarText(\"Unable to connect to internet to check for updates\");\r\n \t\t\treturn;\r\n \t\t}\r\n \t\t\r\n \t\tif(webSideProps == null || webSideProps.isEmpty()){\r\n \t\t\treturn;\r\n \t\t}\r\n \t\t\r\n \t\tint latestVersionAvailable = Integer.parseInt(webSideProps.get(\"version_number\").toString());\r\n \t\tif(latestVersionAvailable > PropertiesMemento.APP_VERSION_NUMBER){\r\n \t\t\tsetStatusBarText(\"A new version of ZygoMeme York is now available. You can now upgrade to Version \" + webSideProps.getProperty(\"version_string\") + \" \" + \r\n \t\t\t\t\twebSideProps.get(\"stage\")); \r\n \t\t}\r\n \t\telse{\r\n \t\t\tsetStatusBarText(\"Update check has been made - application is up to date.\"); \r\n \t\t}\r\n\r\n \t\t// To get here the properties will have been updated\r\n\t\tpropertiesMemento.setProperty(PropertiesMemento.UPDATE_STRING, \"\" + now);\r\n\r\n\t\t// Save the properties straight away so that the new last \"check for update\" time is recorded\r\n\t\ttry {\r\n\t\t\tpropertiesMemento.saveProperties(this);\t\t\t\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.warn(\"Unable to save properties\");\r\n\t\t}\r\n\t}", "public void handleUpdate(){\n increaseDecrease(\"i\");\n action=\"update\";\n buttonSave.setVisible(true);\n admission.setEditable(false);\n\n }", "public void willbeUpdated() {\n\t\t\n\t}", "public String update(String id, String datetime, String description, String request, String status);", "boolean adminUpdate(int userId, int statusId, int reimbId);", "private byte[] handleDelete() {\n\t\tboolean success = replaceSecretWith(currentUser, \"\");\n\n\t\tif (success) {\n\t\t\tComMethods.report(\"SecretServer has deleted \"+currentUser+\"'s secret.\", simMode);\n\t\t\treturn preparePayload(\"secretdeleted\".getBytes());\n\t\t} else {\n\t\t\tComMethods.report(\"SecretServer has FAILED to delete \"+currentUser+\"'s secret.\", simMode);\n\t\t\treturn preparePayload(\"writingfailure\".getBytes());\n\t\t}\n\t}", "@ResponseStatus(code=HttpStatus.OK)\r\n\t@RequestMapping(value=\"/update\", method=RequestMethod.GET)\r\n\tpublic void update() {\r\n\t\tSystem.out.println(\"StudentRestController.Update()_________\");\r\n\t}", "public boolean onUpdate(Session s) throws CallbackException;", "protected PoxPayloadOut update(String csid,\r\n PoxPayloadIn theUpdate,\r\n ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx)\r\n throws Exception {\r\n DocumentHandler handler = createDocumentHandler(ctx);\r\n getRepositoryClient(ctx).update(ctx, csid, handler);\r\n return ctx.getOutput();\r\n }", "public void update() {\n \t\tissueHandler.checkAllIssues();\n \t\tlastUpdate = System.currentTimeMillis();\n \t}", "@Test\r\n\tpublic void updateUpdate() throws InterruptedException, ExecutionException {\r\n\t\tLOGGER.debugf(\"BEGINN\");\r\n\t\t\r\n\t\t// Given\r\n\t\tfinal Long zahlId = ZAHLUNGSINFORMATION_ID_UPDATE;\r\n \tfinal String neuerKontoinhaber = NEUER_KONTOINHABER;\r\n \tfinal String neuerKontoinhaber2 = NEUER_KONTOINHABER_2;\r\n\t\tfinal String username = USERNAME_ADMIN;\r\n\t\tfinal String password = PASSWORD_ADMIN;\r\n\t\t\r\n\t\t// When\r\n\t\tResponse response = given().header(ACCEPT, APPLICATION_JSON)\r\n\t\t\t\t .pathParameter(ZAHLUNGSINFORMATIONEN_ID_PATH_PARAM, zahlId)\r\n .get(ZAHLUNGSINFORMATIONEN_ID_PATH);\r\n\t\tJsonObject jsonObject;\r\n\t\ttry (final JsonReader jsonReader =\r\n\t\t\t\t getJsonReaderFactory().createReader(new StringReader(response.asString()))) {\r\n\t\t\tjsonObject = jsonReader.readObject();\r\n\t\t}\r\n\r\n \t// Konkurrierendes Update\r\n\t\t// Aus den gelesenen JSON-Werten ein neues JSON-Objekt mit neuem Nachnamen bauen\r\n \tfinal JsonObjectBuilder job2 = getJsonBuilderFactory().createObjectBuilder();\r\n \tSet<String> keys = jsonObject.keySet();\r\n \tfor (String k : keys) {\r\n \t\tif (\"kontoinhaber\".equals(k)) {\r\n \t\t\tjob2.add(\"kontoinhaber\", neuerKontoinhaber2);\r\n \t\t}\r\n \t\telse {\r\n \t\t\tjob2.add(k, jsonObject.get(k));\r\n \t\t}\r\n \t}\r\n \tfinal JsonObject jsonObject2 = job2.build();\r\n \tfinal ConcurrentUpdate concurrentUpdate = new ConcurrentUpdate(jsonObject2, ZAHLUNGSINFORMATIONEN_PATH,\r\n \t\t\t username, password);\r\n \tfinal ExecutorService executorService = Executors.newSingleThreadExecutor();\r\n\t\tfinal Future<Response> future = executorService.submit(concurrentUpdate);\r\n\t\tresponse = future.get(); // Warten bis der \"parallele\" Thread fertig ist\r\n\t\tassertThat(response.getStatusCode(), is(HTTP_NO_CONTENT));\r\n\t\t\r\n \t// Fehlschlagendes Update\r\n\t\t// Aus den gelesenen JSON-Werten ein neues JSON-Objekt mit neuem Nachnamen bauen\r\n\t\tfinal JsonObjectBuilder job1 = getJsonBuilderFactory().createObjectBuilder();\r\n \tkeys = jsonObject.keySet();\r\n \tfor (String k : keys) {\r\n \t\tif (\"kontoinhaber\".equals(k)) {\r\n \t\t\tjob1.add(\"kontoinhaber\", neuerKontoinhaber);\r\n \t\t}\r\n \t\telse {\r\n \t\t\tjob1.add(k, jsonObject.get(k));\r\n \t\t}\r\n \t}\r\n \tjsonObject = job1.build();\r\n\t\tresponse = given().contentType(APPLICATION_JSON)\r\n\t\t\t\t .body(jsonObject.toString())\r\n\t\t .auth()\r\n\t\t .basic(username, password)\r\n\t\t .put(ZAHLUNGSINFORMATIONEN_PATH);\r\n \t\r\n\t\t// Then\r\n\t\tassertThat(response.getStatusCode(), is(HTTP_CONFLICT));\r\n\t\t\r\n\t\tLOGGER.debugf(\"ENDE\");\r\n\t}", "abstract public String updateData(String userId, String resourceName, long lastUpdate) throws IOException;", "public void requestUpdate(){\n shouldUpdate = true;\n }", "Future<UpdateBackendResponse> updateBackend(\n UpdateBackendRequest request,\n AsyncHandler<UpdateBackendRequest, UpdateBackendResponse> handler);", "public void checkForUpdates(final ResponseHandler responseHandler) {\r\n\t\tThread updaterThread = new Thread(new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\r\n\t\t\t\ttry {\r\n\r\n\t\t\t\t\tJSONArray filesArray = (JSONArray) readJson(\"https://api.curseforge.com/servermods/files?projectIds=\" + projectId);\r\n\r\n\t\t\t\t\tif (filesArray.size() == 0) {\r\n\t\t\t\t\t\t// The array cannot be empty, there must be at least one file. The project ID is not valid or curse returned a wrong response.\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tString updateName = (String) ((JSONObject) filesArray.get(filesArray.size() - 1)).get(\"name\");\r\n\t\t\t\t\tfinal String newVersion = extractVersion(updateName);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (newVersion == null) {\r\n\t\t\t\t\t\tthrow new NumberFormatException();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (isNewerVersion(newVersion)) {\r\n\t\t\t\t\t\tBukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {\r\n\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\t\t\tresponseHandler.onUpdateFound(newVersion);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tplugin.getLogger().warning(\"Could not contact BukkitDev to check for updates.\");\r\n\t\t\t\t} catch (NumberFormatException e) {\r\n\t\t\t\t\tplugin.getLogger().warning(\"The author of this plugin has misconfigured the Updater system.\");\r\n\t\t\t\t\tplugin.getLogger().warning(\"File versions should follow the format 'PluginName vVERSION'\");\r\n\t\t plugin.getLogger().warning(\"Please notify the author of this error.\");\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\tplugin.getLogger().warning(\"Unable to check for updates: unhandled exception.\");\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t});\r\n\t\tupdaterThread.start();\r\n\t}", "public void checkForUpdate();", "Future<UpdateListenerResponse> updateListener(\n UpdateListenerRequest request,\n AsyncHandler<UpdateListenerRequest, UpdateListenerResponse> handler);", "void update(User user);", "void update(User user);", "@Override\n\tpublic Integer update(Map<String, Object> params) throws Exception {\n\t\treturn bankService.update(params);\n\t}", "private void updateProductHandler(RoutingContext routingContext) {\n\n HttpServerResponse httpServerResponse = routingContext.response();\n\n try {\n Long productId = Long.parseLong(routingContext.request().getParam(\"productId\"));\n Instant start = Instant.now();\n\n logger.info(\"Received the update request for the productid \" + productId + \" at \" + start);\n\n JsonObject productJson = routingContext.getBodyAsJson();\n Product inputProduct = new Product(productJson);\n inputProduct.setId(productId);\n\n logger.info(\"The input product \" + inputProduct.toString());\n\n // Create future for DB call\n Future<Product> productDBPromise =\n Future.future(promise -> callDBService(promise, inputProduct, DBAction.UPDATE));\n\n productDBPromise.setHandler(\n dbResponse -> {\n if (dbResponse.succeeded()) {\n\n Product updatedProduct = dbResponse.result();\n logger.info(\"The updated product is \" + updatedProduct.toString());\n Gson gson = new GsonBuilder().create();\n String json = gson.toJson(updatedProduct);\n\n Long duration = Duration.between(start, Instant.now()).toMillis();\n logger.info(\"Total time taken to process the request \" + duration + \" milli-seconds\");\n\n httpServerResponse.setStatusCode(SUCCESS_CODE);\n httpServerResponse.end(new JsonObject(json).encodePrettily());\n } else {\n logger.error(dbResponse.cause());\n httpServerResponse.setStatusCode(INTERNAL_SERVER_ERROR);\n httpServerResponse.end(\n \"Error due to \"\n + dbResponse.cause().getMessage()\n + \". Please try again after sometime.\");\n }\n });\n\n } catch (Exception e) {\n\n logger.error(e);\n httpServerResponse.setStatusCode(INTERNAL_SERVER_ERROR);\n httpServerResponse.end(\n \"Error due to \" + e.getMessage() + \". Please try again after sometime.\");\n }\n }", "void updateInformation();", "void touchSecret(Long secretId);", "private void updateProfile(final boolean interestsChanged, final boolean moreChanged, final boolean pictureChanged){\n\n String url = base_url+\"/users/\"+profileData.getAsString(\"user_id\");\n\n\n StringRequest postRequest = new StringRequest(Request.Method.PUT, url,\n new Response.Listener<String>() {\n @Override\n public void onResponse(String response) {\n\n /* Bei Erfolgreicher Response des Servers */\n if(response.contains(\"success_message\")) {\n\n /* Daten in den SharedPrefs aktualisieren */\n new SharedPrefsManager(getApplicationContext()).setEditProfileSharedPrefs(newPicture, _interests.getText().toString(), _more.getText().toString());\n\n /* Den Benutzer durch eine positive Snackbar darauf hinweisen, dass sein Profil aktualisiert wurde */\n Snackbar snackbar = Snackbar.make(_mainContent, \"Profil wurde aktualisiert\", Snackbar.LENGTH_LONG)\n .setAction(\"Action\", null);\n View snackBarView = snackbar.getView();\n snackBarView.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.positive));\n TextView textView = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_text);\n textView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));\n snackbar.show();\n }\n }\n }, new Response.ErrorListener() {\n\n @Override\n public void onErrorResponse(VolleyError error) {\n\n error.printStackTrace();\n\n }\n })\n {\n /*Daten welche der PUT-Request mitgegeben werden*/\n @Override\n protected Map<String, String> getParams()\n {\n Map<String, String> params = new HashMap<>();\n // the POST parameters:\n if (interestsChanged) params.put(\"interests\", _interests.getText().toString());\n if (moreChanged) params.put(\"more\", _more.getText().toString());\n if (pictureChanged) params.put(\"picture\", newPicture);\n Log.d(\"EditProfileActivity\", \"Parameter: \"+params);\n return params;\n }\n\n };\n\n /* Request wird der Volley Queue angehangen und ausgeführt */\n Volley.newRequestQueue(getApplicationContext()).add(postRequest);\n\n }", "@PUT\n @Path(\"/update\")\n public void put() {\n System.out.println(\"PUT invoked\");\n }", "void updateAccount();", "@Override\r\n\tpublic int update() throws Exception {\n\t\treturn 0;\r\n\t}", "JobResponse.Update update();", "protected void updateTokens(){}", "public void update() {\n user.setNewPassword(newPassword.getText().toString());\n user.setPassword(password.getText().toString());\n reauthenticate();\n }", "protected PoxPayloadOut update(String csid,\r\n MultipartInput theUpdate,\r\n ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,\r\n DocumentHandler handler)\r\n throws Exception {\r\n getRepositoryClient(ctx).update(ctx, csid, handler);\r\n return ctx.getOutput();\r\n }", "void setUserUpdated(final Long userUpdated);", "@Override\n\t\tpublic void update() throws IOException {\n\t\t}", "Future<UpdateHealthCheckerResponse> updateHealthChecker(\n UpdateHealthCheckerRequest request,\n AsyncHandler<UpdateHealthCheckerRequest, UpdateHealthCheckerResponse> handler);", "public void update() {\n\t\tif (this.currentLoginState == LoginState.READY_TO_ACCEPT) {\n\t\t\tthis.tryAcceptPlayer();\n\t\t}\n\n\t\tif (this.connectionTimer++ == 600) {\n\t\t\tthis.closeConnection(\"Took too long to log in\");\n\t\t}\n\t}", "java.util.concurrent.Future<UpdateApplicationResult> updateApplicationAsync(UpdateApplicationRequest updateApplicationRequest);", "java.util.concurrent.Future<UpdateApplicationResult> updateApplicationAsync(UpdateApplicationRequest updateApplicationRequest);", "public void update() {\n\t\t\n\t}", "@PutMapping(\"/password\")\n @CrossOrigin\n public ResponseEntity<?> updatePassword(@RequestParam String oldPassword, @RequestParam String newPassword, @RequestHeader String accessToken) {\n //Converting oldPassword and newPassword into Sha 256\n String oldPwdSha = Hashing.sha256()\n .hashString(oldPassword, Charsets.US_ASCII)\n .toString();\n String newPwdSha = Hashing.sha256()\n .hashString(newPassword, Charsets.US_ASCII)\n .toString();\n if (userAuthTokenService.isUserLoggedIn(accessToken) == null) {\n return new ResponseEntity<>(\"Please Login first to access this endpoint!\", HttpStatus.UNAUTHORIZED);\n } else if (userAuthTokenService.isUserLoggedIn(accessToken).getLogoutAt() != null) {\n return new ResponseEntity<>(\"You have already logged out. Please Login first to access this endpoint!\", HttpStatus.UNAUTHORIZED);\n } else {\n int userId = userAuthTokenService.getUserId(accessToken);\n if (!userService.getUserById(userId).getPassword().equalsIgnoreCase(oldPwdSha)) {\n return new ResponseEntity<>(\"Your password did not match to your old password!\", HttpStatus.BAD_REQUEST);\n } else if (!isPasswordStrong(newPassword)) { \n return new ResponseEntity<>(\"Weak password!\", HttpStatus.BAD_REQUEST);\n } else { \n userService.updatePwd(newPwdSha, userId);\n return new ResponseEntity<>(\"Password updated successfully!\", HttpStatus.OK);\n }\n }\n }", "protected void doPost(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n response.setContentType(\"text/html;charset=UTF-8\");\r\n \r\n //grab form and session variables\r\n session = request.getSession(false);\r\n email = (String) session.getAttribute(\"email\");\r\n user_id = (int) session.getAttribute(\"user_id\");\r\n oldPassword = request.getParameter(\"oldPass\");\r\n newPassword = request.getParameter(\"newPass\");\r\n newPasswordConfirm = request.getParameter(\"newPassConfirm\");\r\n \r\n if(checkPasswordForm(request)) {//check if inputs are good\r\n if(changePassword()) { //if password updates successfully\r\n message = \"Password updated successfully.\";\r\n messageType = \"SystemMessage\";\r\n redirectPage = \"account.jsp\";\r\n } else { //if password fails to update\r\n message = \"Password failed to update. Try again later.\";\r\n messageType = \"ErrorMessage\";\r\n redirectPage = \"account.jsp\";\r\n }\r\n } else if (lockout) {\r\n message = \"You have been locked out of your account.\";\r\n messageType = \"ErrorMessage\";\r\n redirectPage = \"logout.jsp\";\r\n } else {\r\n message = \"Bad form input detected. Correct all fields and try again.\";\r\n messageType = \"ErrorMessage\";\r\n redirectPage = \"account.jsp\";\r\n }\r\n redirectUser(request, response, messageType, redirectPage, message); \r\n }", "public void update() {\n }", "public void update() {\n\t}", "public void update() {\n\t}", "public void update() {\n\t}", "public void update() {\n\t}", "public void updated(ServerList list);", "public void sendUpdate() {\n JSONObject obj = new JSONObject();\n String url = (\"http://coms-309-hv-3.cs.iastate.edu:8080/user/update\");\n RequestQueue queue = Volley.newRequestQueue(this);\n\n try {\n obj.put(\"email\", emailEdit.getText()); //string\n obj.put(\"name\", nameEdit.getText()); //string\n obj.put(\"age\", Integer.parseInt(ageEdit.getText().toString())); //int\n obj.put(\"height\", Integer.parseInt(heightEdit.getText().toString())); //int\n obj.put(\"weight\", Integer.parseInt(weightEdit.getText().toString())); //int\n obj.put(\"lifestyle\", lifestyleString(activityEdit)); //string\n obj.put(\"gender\", genderEdit.getSelectedItem().toString()); //string\n\n } catch (JSONException ex) {\n ex.printStackTrace();\n }\n\n JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url, obj,\n new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n int responseCode = 1;\n String responseMessage = \"\";\n try {\n responseCode = response.getInt(\"response\");\n responseMessage = response.getString(\"message\");\n } catch (JSONException e) {\n e.printStackTrace();\n }\n toastKickoff(\"User Updated: \" + responseCode + \" \" + responseMessage);\n }\n },\n new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n Log.e(\"HttpClient\", \"error: \" + error.toString());\n toastKickoff(\"Internal Error\");\n }\n });\n\n queue.add(request);\n\n }", "private void updateResorce() {\n }", "public void update(int updateType);", "Status updateStatus(StatusUpdate latestStatus) throws TwitterException;", "private byte[] handleView() {\n\t\tString secret = ComMethods.getValueFor(currentUser, secretsfn);\n\t\tif (secret.equals(\"\")) {\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\tbyte[] secretInBytes = DatatypeConverter.parseBase64Binary(secret);\n\n\t\t\tComMethods.report(\"SecretServer has retrieved \"+currentUser+\"'s secret and will now return it.\", simMode);\n\t\t\treturn preparePayload(secretInBytes);\n\t\t}\n\t}", "public void launchUpdate() {\n\n\t\tif (checkRegister() == true && psw.getText() != newpsw.getText()) {\n\t\t\tDatabase.getInstance().updateUser(newpsw.getText(), username.getText());\n\t\t\tstatus.setText(\"Account updated\");\n\t\t} else {\n\t\t\tstatus.setText(\"Password already exist or this account doesn't exist\");\n\t\t}\n\n\t}", "private void updateSubscription(RoutingContext routingContext) {\n LOGGER.debug(\"Info: updateSubscription method started\");\n HttpServerRequest request = routingContext.request();\n HttpServerResponse response = routingContext.response();\n String domain = request.getParam(JSON_DOMAIN);\n String usersha = request.getParam(JSON_USERSHA);\n String alias = request.getParam(JSON_ALIAS);\n String subsId = domain + \"/\" + usersha + \"/\" + alias;\n JsonObject requestJson = routingContext.getBodyAsJson();\n String instanceID = request.getHeader(HEADER_HOST);\n String subHeader = request.getHeader(HEADER_OPTIONS);\n String subscrtiptionType =\n subHeader != null && subHeader.contains(SubsType.STREAMING.getMessage())\n ? SubsType.STREAMING.getMessage()\n : SubsType.CALLBACK.getMessage();\n requestJson.put(SUB_TYPE, subscrtiptionType);\n JsonObject authInfo = (JsonObject) routingContext.data().get(\"authInfo\");\n if (requestJson != null && requestJson.containsKey(SUB_TYPE)) {\n if (requestJson.getString(JSON_NAME).equalsIgnoreCase(alias)) {\n JsonObject jsonObj = requestJson.copy();\n jsonObj.put(SUBSCRIPTION_ID, subsId);\n jsonObj.put(JSON_INSTANCEID, instanceID);\n jsonObj.put(JSON_CONSUMER, authInfo.getString(JSON_CONSUMER));\n Future<JsonObject> subsReq = subsService.updateSubscription(jsonObj, databroker, database);\n subsReq.onComplete(subsRequestHandler -> {\n if (subsRequestHandler.succeeded()) {\n handleSuccessResponse(response, ResponseType.Created.getCode(),\n subsRequestHandler.result().toString());\n } else {\n LOGGER.error(\"Fail: Bad request\");\n processBackendResponse(response, subsRequestHandler.cause().getMessage());\n }\n });\n } else {\n LOGGER.error(\"Fail: Bad request\");\n handleResponse(response, ResponseType.BadRequestData, MSG_INVALID_NAME);\n }\n } else {\n LOGGER.error(\"Fail: Bad request\");\n handleResponse(response, ResponseType.BadRequestData, MSG_SUB_TYPE_NOT_FOUND);\n }\n\n\n }", "@Override\r\n public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {\n switch (updateStatus) {\r\n case UpdateStatus.Yes: // has update\r\n UmengUpdateAgent.showUpdateDialog(mContext, updateInfo);\r\n break;\r\n case UpdateStatus.No: // has no update\r\n Toast.makeText(mContext, \"没有更新\", Toast.LENGTH_SHORT).show();\r\n break;\r\n case UpdateStatus.NoneWifi: // none wifi\r\n Toast.makeText(mContext, \"没有wifi连接, 只在wifi下更新\", Toast.LENGTH_SHORT).show();\r\n break;\r\n case UpdateStatus.Timeout: // time out\r\n Toast.makeText(mContext, \"请检查网络\", Toast.LENGTH_SHORT).show();\r\n break;\r\n }\r\n }", "@RolesAllowed(\"admin\")\n @PUT\n @Consumes({\"application/atom+xml\",\n \"application/atom+xml;type=entry\",\n \"application/xml\",\n \"text/xml\"})\n public Response put(Entry entry) {\n\n // Validate the incoming user information independent of the database\n User user = contentHelper.getContentEntity(entry, MediaType.APPLICATION_XML_TYPE, User.class);\n StringBuilder errors = new StringBuilder();\n if ((user.getPassword() == null) || (user.getPassword().length() < 1)) {\n errors.append(\"Missing 'password' property\\r\\n\");\n }\n\n if (errors.length() > 0) {\n return Response.status(400).\n type(\"text/plain\").\n entity(errors.toString()).build();\n }\n\n // Validate conditions that require locking the database\n synchronized (Database.users) {\n\n // Look up the original user information\n User original = Database.users.get(username);\n if (original == null) {\n return Response.status(404).\n type(\"text/plain\").\n entity(\"User '\" + username + \"' does not exist\\r\\n\").\n build();\n }\n\n // Update the original user information\n original.setPassword(user.getPassword());\n original.setUpdated(new Date());\n Database.usersUpdated = new Date();\n return Response.\n ok().\n build();\n\n }\n\n }", "public void actionPerformed(ActionEvent e) {\n if(e.getActionCommand().equals(\"Update\")){\n httpmethods httpmethods = new httpmethods();\n\n //Store textfield text in string\n String itemID = txtItemID.getText();\n String itemName = txtItemName.getText();\n String itemType = txtItemType.getText();\n String itemPrice = txtItemPrice.getText();\n String itemStock = txtItemStock.getText();\n\n //Read method\n Item it = httpmethods.findItem(itemID);\n\n //booleans for checking valid input\n boolean nameCheck, priceCheck, stockCheck, typecheck;\n\n if(itemType==null || !itemType.matches(\"[a-zA-Z]+\")){\n typecheck = false;\n txtItemType.setText(\"Invalid Type Input\");\n }\n else{\n typecheck = true;\n }\n\n if(!itemName.matches(\"[a-zA-Z0-9]+\")){\n nameCheck = false;\n txtItemName.setText(\"Invalid Name Input\");\n }\n else{\n nameCheck = true;\n }\n\n if(GenericHelper.validNumber(itemPrice)){\n priceCheck = true;\n }\n else{\n priceCheck = false;\n txtItemPrice.setText(\"Invalid Price Input\");\n }\n\n if(GenericHelper.validNumber(itemStock)){\n stockCheck = true;\n }\n else{\n stockCheck = false;\n txtItemStock.setText(\"Invalid Stock Input\");\n }\n\n //If all are valid then call update httpmethod\n if(nameCheck && typecheck && priceCheck && stockCheck){\n double ditemPrice = Double.parseDouble(itemPrice);\n double ditemStock = Double.parseDouble(itemStock);\n item = new Item.Builder().copy(it).itemName(itemName).itemType(itemType).itemPrice(ditemPrice).itemStock(ditemStock).builder();\n httpmethods.updateItem(item);\n txtItemName.setText(\"\");\n txtItemType.setText(\"\");\n txtItemPrice.setText(\"\");\n txtItemStock.setText(\"\");\n JOptionPane.showMessageDialog(null, \"Item Updated\");\n }\n\n\n }\n\n //When Get Info Button is clicked\n if(e.getActionCommand().equals(\"Get Info\")){\n boolean idCheck;\n\n //Use read method of readitemgui\n String id = txtItemID.getText();\n httpmethods httpmethods = new httpmethods();\n Item it = httpmethods.findItem(id);\n txtItemName.setText(it.getItemName());\n txtItemType.setText(it.getItemType());\n\n //Doubles are stored in string without decimals\n String price = String.valueOf(it.getItemPrice()).split(\"\\\\.\")[0];;\n String stock = String.valueOf(it.getItemStock()).split(\"\\\\.\")[0];\n txtItemPrice.setText(price);\n txtItemStock.setText(stock);\n }\n\n //When Clear Button is clicked\n if(e.getActionCommand().equals(\"Clear\")){\n txtItemID.setText(\"\");\n txtItemName.setText(\"\");\n txtItemType.setText(\"\");\n txtItemPrice.setText(\"\");\n txtItemStock.setText(\"\");\n }\n\n //When Exit Button is clicked\n if(e.getActionCommand().equals(\"Exit\")){\n UpdateItemFrame.dispose();\n }\n }", "boolean requestRemoteUpdate(ITemplateKey key);", "public void onUpdate(int actiontype, NetworkEventsEnum networkevent,\n\t\t\tObject request, Object response, Exception excption) {\n\t\tsuper.onUpdate(actiontype, networkevent, request, response, excption);\n\t\t\n\t\tswitch (networkevent) {\n\t\tcase SUCCESS:\n\t\t\tif(actiontype==ActionType.FORGOTPASSWORDUSER.getActionType())\n\t\t\t{\n\t\t\t\tForgotPasswordResponse forgotPasswordResponse=(ForgotPasswordResponse)response;\n\t\t\t\tif(forgotPasswordResponse.isResp())\n\t\t\t\t{\n\t\t\t\t\t//ToastCustom.makeText(ForgotPasswordActivity.this, forgotPasswordResponse.getDesc(), Toast.LENGTH_SHORT);\n\t\t\t\t\tIntent intent= new Intent(ForgotPasswordActivity.this, SentLinkForgetActivity.class);\n\t\t\t\t\tstartActivityForResult(intent,FORGET);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tToastCustom.makeText(ForgotPasswordActivity.this, forgotPasswordResponse.getDesc(), Toast.LENGTH_SHORT);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tAppCollageLogger.d(TAG, \"Web service ON UPdate\"+response+\",\"+ActionType.getDescriptionFromActionType(actiontype));\n\t}", "@Override\n protected void doUpdate(long now) {\n eyeCandy.update();\n }", "@RequestMapping(value = \"/gw/oauth/token/{version}/refresh\", method = RequestMethod.POST, produces = \"application/json;charset=utf-8\")\n public Object entry2(HttpServletRequest request)\n throws URISyntaxException, OAuthSystemException, OAuthProblemException {\n return this.refresh(request);\n }", "void statusUpdate(boolean invalid);", "private CommandResult updateLesson() throws KolinuxException {\n timetable.executeUpdate(parsedArguments);\n logger.log(Level.INFO, \"User has updated the timetable.\");\n return new CommandResult(parsedArguments[0].toUpperCase() + \" \"\n +\n parsedArguments[1].toUpperCase() + \" has been updated\");\n }", "public String updateUser(){\n\t\tusersservice.update(usersId, username, password, department, role, post, positionId);\n\t\treturn \"Success\";\n\t}", "public void executeUpdate(String request) {\n try {\r\n st.executeUpdate(request);\r\n } catch (SQLException ex) {\r\n Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }", "public void update() throws VcsException;", "boolean updateTask(Task updatedTask);", "public void update(User user);", "public responseConversation processUpdate(Update update){\n LOGGER.info(\"Receiving an update from user {}\",update);\n int response = 0;\n List<String> options = new ArrayList<>();\n List<String> messages = new ArrayList<>();\n if(isNewUser(update)){\n LOGGER.info(\"First time using app for: {} \",update.getMessage().getFrom() );\n response = 1;\n }\n else{\n List<CpCar> allCars;\n List<CpTravelSearch> allSearch;\n Boolean validation;\n String newLastName,newFirstName,newCellphone,newCI,newBrand,newModel,newEnrollmentNumber,newPassenger, newStartPlace, newPlace, newTravelRider;\n Integer idUser;\n CpCar newCar;\n CpTravelRider confirm;\n CpPerson cpPerson;\n CpUser cpUser;\n CpTravel currentTravel = new CpTravel();\n CpTravelSearch search;\n cpUser = cpUserRepository.findByBotUserId(update.getMessage().getFrom().getId().toString());\n\n int last_conversation = cpUser.getConversationId();\n //What happens when chatbot receives a response to a conversation \"last conversation\"\n switch (last_conversation){\n //****************************************\\\\\n //Here is the initial registering\\\\\n //****************************************\\\\\n case 1:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n newLastName = update.getMessage().getText();\n //See if the Last name only has alphabetical Letters and spaces\n validation = isOnlyAlphabeticalCharacters(newLastName);\n if(validation){\n cpPerson.setLastName(newLastName);\n cpPersonRepository.save(cpPerson);\n response = 2;\n }\n else{\n response = 4;\n }\n\n break;\n case 2:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n newFirstName = update.getMessage().getText();\n validation = isOnlyAlphabeticalCharacters(newFirstName);\n if(validation){\n cpPerson.setFirstName(newFirstName);\n cpPersonRepository.save(cpPerson);\n response = 3;\n }\n else{\n response = 5;\n }\n break;\n case 3:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n response = 3;\n if(update.getMessage().getText().equals(\"Carpooler\")){\n //When a user is not a carpooler in the chatbot\n if(cpPerson.getCarpool()==0){\n response = 6;\n }\n //When a user is a carpooler in the chatbot\n else{\n response = 10;\n }\n cpPerson.setCarpool(1);\n cpPersonRepository.save(cpPerson);\n }\n if(update.getMessage().getText().equals(\"Rider\")){\n response=20;\n }\n if(update.getMessage().getText().equals(\"Corregir registro\")){\n response = 4;\n }\n break;\n //****************************************\\\\\n //Here the user can correct its mistakes on the registering\\\\\n //****************************************\\\\\n case 4:\n //Try again to enter Last Name\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n newLastName = update.getMessage().getText();\n validation = isOnlyAlphabeticalCharacters(newLastName);\n if(validation){\n cpPerson.setLastName(newLastName);\n cpPersonRepository.save(cpPerson);\n response = 2;\n }\n else{\n\n response = 4;\n }\n break;\n case 5:\n //Try again to enter First Name\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n newFirstName = update.getMessage().getText();\n validation = isOnlyAlphabeticalCharacters(newFirstName);\n if(validation){\n cpPerson.setFirstName(newFirstName);\n cpPersonRepository.save(cpPerson);\n response = 3;\n }\n else{\n response = 5;\n }\n break;\n //****************************************\\\\\n //Here starts the carpooler part\\\\\n //****************************************\\\\\n case 6:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n newCellphone = update.getMessage().getText();\n if(isValidCellphone(newCellphone)){\n cpPerson.setCellphoneNumber(newCellphone);\n cpPersonRepository.save(cpPerson);\n response = 7;\n }\n else{\n response = 8;\n }\n break;\n case 7:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n newCI = update.getMessage().getText();\n if(isValidCI(newCI)){\n cpPerson.setCiNumber(newCI);\n cpPersonRepository.save(cpPerson);\n response = 10;\n }\n else{\n response = 9;\n }\n break;\n case 8:\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n newCellphone = update.getMessage().getText();\n if(isValidCellphone(newCellphone)){\n cpPerson.setCellphoneNumber(newCellphone);\n cpPersonRepository.save(cpPerson);\n response = 7;\n }\n else{\n response = 8;\n }\n break;\n case 9:\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n newCI = update.getMessage().getText();\n if(isValidCI(newCI)){\n cpPerson.setCiNumber(newCI);\n cpPersonRepository.save(cpPerson);\n response = 10;\n }\n else{\n response = 9;\n }\n break;\n //****************************************\\\\\n //Here is the Menu for Carpooler\\\\\n //****************************************\\\\\n case 10:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n response = 10;\n //Here is the menu for the carpooler\n if(update.getMessage().getText().equals(\"Registrar Vehículo\")){\n response = 11;\n }\n if(update.getMessage().getText().equals(\"Ver Vehículos\")){\n response = 19;\n }\n if(update.getMessage().getText().equals(\"Registrar Viaje\")){\n LOGGER.info(\"Registrar Viaje\");\n response = 27;\n }\n if(update.getMessage().getText().equals(\"Cancelar Viaje\")){\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n List<CpTravel> activeTravels = travelBl.findActiveTravels(cpPerson);\n if(activeTravels.size()>0){\n int a=1;\n for(CpTravel c: activeTravels){\n messages.add(\"Viaje \"+a+\"\\n\"+travelBl.toStringOption(c));\n options.add(\"Viaje \"+a);\n a++;\n }\n response = 38;\n }\n else{\n options.add(\"Ok\");\n response = 40;\n }\n\n }\n if(update.getMessage().getText().equals(\"Volver al Menú Principal\")){\n response = 3;\n }\n break;\n //****************************************\\\\\n //Here is the registering for the car\\\\\n //****************************************\\\\\n case 11:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n newBrand = update.getMessage().getText();\n if(isOnlyAlphaNumeric(newBrand)){\n newCar = new CpCar();\n newCar.setPersonId(cpUser.getPersonId());\n newCar.setBrand(newBrand);\n newCar.setEnrollmentNumber(\"NULL\");\n newCar.setModel(\"NULL\");\n newCar.setCapacity(0);\n newCar.setStatus(1);\n newCar.setTxHost(\"localhost\");\n newCar.setTxUser(\"admin\");\n newCar.setTxDate(new Date());\n cpCarRepository.save(newCar);\n response = 12;\n }\n else{\n response = 15;\n }\n break;\n case 12:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n newModel = update.getMessage().getText();\n if(isOnlyAlphaNumeric(newModel)){\n allCars = cpCarRepository.findAll();\n newCar = getLastCar(allCars,idUser);\n newCar.setModel(newModel);\n cpCarRepository.save(newCar);\n response = 13;\n }\n else{\n response = 16;\n }\n break;\n case 13:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n newEnrollmentNumber = update.getMessage().getText();\n if(isEnrollmentNumberValid(newEnrollmentNumber)){\n allCars = cpCarRepository.findAll();\n newCar = getLastCar(allCars,idUser);\n newCar.setEnrollmentNumber(newEnrollmentNumber);\n cpCarRepository.save(newCar);\n response = 14;\n }\n else{\n response = 17;\n }\n break;\n case 14:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n newPassenger = update.getMessage().getText();\n if(isOnlyNumbers(newPassenger)) {\n allCars = cpCarRepository.findAll();\n newCar = getLastCar(allCars, idUser);\n newCar.setCapacity(Integer.parseInt(newPassenger));\n cpCarRepository.save(newCar);\n response = 10;\n }\n else{\n response = 18;\n }\n break;\n case 15:\n idUser = cpUser.getPersonId().getPersonId();\n newBrand = update.getMessage().getText();\n if(isOnlyAlphaNumeric(newBrand)){\n newCar = new CpCar();\n newCar.setPersonId(cpUser.getPersonId());\n newCar.setBrand(newBrand);\n newCar.setEnrollmentNumber(\"NULL\");\n newCar.setModel(\"NULL\");\n newCar.setCapacity(0);\n newCar.setStatus(1);\n newCar.setTxHost(\"localhost\");\n newCar.setTxUser(\"admin\");\n newCar.setTxDate(new Date());\n cpCarRepository.save(newCar);\n response = 12;\n }\n else{\n response = 15;\n }\n break;\n case 16:\n idUser = cpUser.getPersonId().getPersonId();\n newModel = update.getMessage().getText();\n if(isOnlyAlphaNumeric(newModel)){\n allCars = cpCarRepository.findAll();\n newCar = getLastCar(allCars,idUser);\n newCar.setModel(newModel);\n cpCarRepository.save(newCar);\n response = 13;\n }\n else{\n response = 16;\n }\n break;\n case 17:\n idUser = cpUser.getPersonId().getPersonId();\n newEnrollmentNumber = update.getMessage().getText();\n if(isEnrollmentNumberValid(newEnrollmentNumber)){\n allCars = cpCarRepository.findAll();\n newCar = getLastCar(allCars,idUser);\n newCar.setEnrollmentNumber(newEnrollmentNumber);\n cpCarRepository.save(newCar);\n response = 14;\n }\n else{\n response = 17;\n }\n break;\n case 18:\n idUser = cpUser.getPersonId().getPersonId();\n newPassenger = update.getMessage().getText();\n if(isOnlyNumbers(newPassenger)) {\n allCars = cpCarRepository.findAll();\n newCar = getLastCar(allCars, idUser);\n newCar.setCapacity(Integer.parseInt(newPassenger));\n cpCarRepository.save(newCar);\n response = 10;\n }\n else{\n response = 18;\n }\n break;\n case 19:\n response = 10;\n break;\n case 20:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n response = 20;\n //Here is the menu for the carpooler\n if(update.getMessage().getText().equals(\"Buscar Viaje\")){\n response = 21;\n }\n if(update.getMessage().getText().equals(\"Ver Viaje\")){\n //CpTravelRider myTravels;\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n List<CpTravel> activeTravels = travelBl.findActiveTravels(cpPerson);\n if(activeTravels.size()>0){\n int a=1;\n for(CpTravel c: activeTravels){\n messages.add(\"Viaje \"+a+\"\\n\"+travelBl.toStringOption(c));\n options.add(\"Viaje \"+a);\n a++;\n }\n response = 38;\n }\n\n response = 22;\n }\n if(update.getMessage().getText().equals(\"Cancelar Viajes\")){\n response = 23;\n }\n if(update.getMessage().getText().equals(\"Volver al Menú Principal\")){\n response = 3;\n }\n break;\n case 21:\n CpZone selectedZone1 = zoneBl.findByName(update.getMessage().getText());\n List<CpPlace> placesZone1 = placeBl.findByZone(selectedZone1);\n for(CpPlace place:placesZone1){\n options.add(place.toStringOption());\n }\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n search = new CpTravelSearch();\n search.setIdPerson(cpUser.getPersonId().getPersonId());\n search.setPlaceStart(\"NULL\");\n search.setPlaceFinish(\"NULL\");\n search.setDepartureTime(\"NULL\");\n LOGGER.info(search.toString());\n LOGGER.info(idUser.toString());\n cpTravelSearchRepository.save(search);\n response = 23;\n break;\n case 22:\n response = 20;\n break;\n case 23:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n newPlace = update.getMessage().getText();\n allSearch = cpTravelSearchRepository.findAll();\n search = getLastSearch(allSearch,idUser);\n search.setPlaceStart(newPlace);\n cpTravelSearchRepository.save(search);\n response = 42;\n break;\n case 24:\n idUser = cpUser.getPersonId().getPersonId();\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n cpPerson = cpPersonRepository.findById(idUser).get();\n response = 30;\n\n if(update.getMessage().getText().equals(\"Si\")){\n allSearch = cpTravelSearchRepository.findAll();\n search = getLastSearch(allSearch,idUser);\n cpTravelSearchRepository.save(search);\n\n cpPerson = cpPersonRepository.findById(idUser).get();\n CpTravel cancel = travelBl.getActiveCanceledTravel(cpPerson);\n //MULTICAST TO DO\n options.add(\"Ok\");\n\n String travelid=update.getMessage().getText();\n\n\n List<CpTravel> travels = cpTravelRepository.findAll();\n CpTravel currenTravel = travelBl.getLastTravel(travels,cpPerson);\n\n LOGGER.info(\"Buscando el id {} en CpPerson\",idUser);\n confirm = new CpTravelRider();\n confirm.setPersonId(cpPerson);\n confirm.setTravelId(currenTravel);\n LOGGER.info(confirm.toString());\n LOGGER.info(idUser.toString());\n\n confirm.setStatus(1);\n confirm.setTxHost(\"localhost\");\n confirm.setTxUser(\"admin\");\n confirm.setTxDate(new Date());\n cpTravelRiderRepository.save(confirm);\n response = 25;\n }\n if(update.getMessage().getText().equals(\"No\")){\n response=26;\n }\n break;\n case 25:\n LOGGER.info(\"Se confirme el viaje y se vuelve al menu\");\n response = 20;\n break;\n case 26:\n LOGGER.info(\"Se cancela el viaje y se vuelve al menu\");\n response = 20;\n break;\n case 27:\n LOGGER.info(\"Registering an empty travel\");\n //Set carName without spaces to search this in DB\n String carName = update.getMessage().getText();\n carName = carName.replace(\" \",\"\");\n cpUser = userBl.findUserByTelegramUserId(update);\n cpPerson = personBl.findPersonById(cpUser.getPersonId().getPersonId());\n List<CpCar> allCarsList = carBl.all();\n CpCar carForTravel = null;\n for(CpCar car: allCarsList){\n if(car.getPersonId().getPersonId() == cpPerson.getPersonId()){\n String probCar = car.toStringOption().replace(\" \",\"\");\n if(probCar.equals(carName)){\n carForTravel = carBl.findById(car.getCarId());\n }\n }\n }\n if(carForTravel == null){\n response = 27;\n }\n else{\n CpTravel cpTravel = new CpTravel();\n cpTravel.setCarId(carForTravel);\n cpTravel.setDepartureTime(\"-\");\n cpTravel.setCost(new BigDecimal(\"0.00\"));\n cpTravel.setNumberPassengers(0);\n cpTravel.setPetFriendly(0);\n cpTravel.setStatus(1);\n cpTravel.setTxUser(\"admin\");\n cpTravel.setTxHost(\"localhost\");\n cpTravel.setTxDate(new Date());\n cpTravelRepository.save(cpTravel);\n response = 28;\n }\n break;\n case 28:\n CpZone selectedZone = zoneBl.findByName(update.getMessage().getText());\n List<CpPlace> placesZone = placeBl.findByZone(selectedZone);\n for(CpPlace place:placesZone){\n options.add(place.toStringOption());\n }\n response = 31;\n break;\n case 29:\n\n response = 10;\n break;\n case 30:\n LOGGER.info(\"Se notifica Entrada no valida y se vuelve al menu\");\n response = 20;\n break;\n case 31:\n CpPlace startPlace = placeBl.getPlaceByName(update.getMessage().getText());\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n List<CpTravel> travels = cpTravelRepository.findAll();\n CpTravel currenTravel = travelBl.getLastTravel(travels,cpPerson);\n for(CpPlace place:placeBl.all()){\n options.add(place.toStringOption());\n }\n if(startPlace!=null && currenTravel!=null) {\n CpTravelPlace cpTravelPlace = new CpTravelPlace();\n cpTravelPlace.setPlaceId(startPlace);\n cpTravelPlace.setTravelId(currenTravel);\n cpTravelPlace.setposition(1);\n cpTravelPlace.setStatus(1);\n cpTravelPlace.setTxHost(\"localhost\");\n cpTravelPlace.setTxUser(\"admin\");\n cpTravelPlace.setTxDate(new Date());\n cpTravelPlaceRepository.save(cpTravelPlace);\n options.add(\"Terminar\");\n response=32;\n }\n //LIST ALL PLACES WITHOUT ORDER\n else{\n response = 31;\n }\n break;\n case 32:\n options.clear();\n CpPlace placeSelected = placeBl.getPlaceByName(update.getMessage().getText());\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n List<CpTravel> travelList = cpTravelRepository.findAll();\n CpTravel lastTravel = travelBl.getLastTravel(travelList,cpPerson);\n int lastPosition = travelPlaceBl.getLastPosition(lastTravel);\n if(update.getMessage().getText().equals(\"Terminar\")){\n response = 33;\n }\n else{\n for(CpPlace place:placeBl.all()){\n options.add(place.toStringOption());\n }\n options.add(\"Terminar\");\n response = 32;\n //STORE IN DB a new stop\n CpTravelPlace travelPlace = new CpTravelPlace();\n travelPlace.setposition(lastPosition);\n travelPlace.setTxUser(\"admin\");\n travelPlace.setTxHost(\"localhost\");\n travelPlace.setTxDate(new Date());\n travelPlace.setTravelId(lastTravel);\n travelPlace.setPlaceId(placeSelected);\n travelPlace.setStatus(1);\n cpTravelPlaceRepository.save(travelPlace);\n }\n break;\n case 33:\n if(validator.isValidDate(update.getMessage().getText())){\n LOGGER.info(\"Fecha Valida\");\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n currentTravel = travelBl.getLastTravel(cpTravelRepository.findAll(),cpPerson);\n currentTravel.setDepartureTime(update.getMessage().getText());\n cpTravelRepository.save(currentTravel);\n response = 34;\n }\n else{\n LOGGER.info(\"Fecha Invalida\");\n response = 33;\n }\n break;\n case 34:\n if(validator.isCorrectCurrency(update.getMessage().getText())){\n LOGGER.info(\"Correct currency\");\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n currentTravel = travelBl.getLastTravel(cpTravelRepository.findAll(),cpPerson);\n currentTravel.setCost(new BigDecimal(update.getMessage().getText()));\n cpTravelRepository.save(currentTravel);\n response = 35;\n }\n else{\n LOGGER.info(\"Incorrect currency\");\n response = 34;\n }\n break;\n case 35:\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n currentTravel = travelBl.getLastTravel(cpTravelRepository.findAll(),cpPerson);\n CpCar carTravel = currentTravel.getCarId();\n LOGGER.info(carTravel.toStringOption());\n if(validator.isOnlyNumbers(update.getMessage().getText())){\n if(carTravel.getCapacity()>=Integer.parseInt(update.getMessage().getText())){\n currentTravel.setNumberPassengers(Integer.parseInt(update.getMessage().getText()));\n cpTravelRepository.save(currentTravel);\n LOGGER.info(\"Capacidad aceptada\");\n options.clear();\n options.add(\"Si\");\n options.add(\"No\");\n response = 36;\n }\n else{\n LOGGER.info(\"Capacidad Excedida\");\n response = 35;\n }\n }\n else{\n LOGGER.info(\"Not Only numbers in Capacity\");\n response = 35;\n }\n break;\n case 36:\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n currentTravel = travelBl.getLastTravel(cpTravelRepository.findAll(),cpPerson);\n String message = update.getMessage().getText();\n if(message.equals(\"Si\")){\n currentTravel.setPetFriendly(1);\n cpTravelRepository.save(currentTravel);\n response=37;\n }\n else{\n if(message.equals(\"No\")){\n currentTravel.setPetFriendly(0);\n cpTravelRepository.save(currentTravel);\n response=37;\n }\n else{\n response = 36;\n }\n }\n break;\n case 37:\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n currentTravel = travelBl.getLastTravel(cpTravelRepository.findAll(),cpPerson);\n currentTravel.setDescription(update.getMessage().getText());\n cpTravelRepository.save(currentTravel);\n response = 10;\n break;\n case 38:\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n CpTravel travelToCancel = travelBl.getTravelByInfo(update.getMessage().getText(),cpPerson);\n if(travelToCancel!=null) {\n travelToCancel.setStatus(2);\n cpTravelRepository.save(travelToCancel);\n options.add(\"Si\");\n options.add(\"No\");\n response = 39;\n }\n else{\n response = 10;\n }\n break;\n case 39:\n response = 10;\n if(update.getMessage().getText().equals(\"Si\")){\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n CpTravel cancel = travelBl.getActiveCanceledTravel(cpPerson);\n LOGGER.info(cancel.getTravelId().toString());\n cancel.setStatus(0);\n cpTravelRepository.save(cancel);\n //MULTICAST TO DO\n options.add(\"Ok\");\n response = 41;\n }\n if(update.getMessage().getText().equals(\"No\")){\n idUser = cpUser.getPersonId().getPersonId();\n cpPerson = cpPersonRepository.findById(idUser).get();\n CpTravel cancel = travelBl.getActiveCanceledTravel(cpPerson);\n LOGGER.info(cancel.getTravelId().toString());\n cancel.setStatus(1);\n cpTravelRepository.save(cancel);\n }\n break;\n case 40:\n LOGGER.info(\"No active travels\");\n response = 10;\n break;\n case 41:\n LOGGER.info(\"Travel Cancel Confirmation NO\");\n response = 10;\n break;\n case 42:\n LOGGER.info(\"Fecha Valida\");\n idUser = cpUser.getPersonId().getPersonId();\n allSearch = cpTravelSearchRepository.findAll();\n search = getLastSearch(allSearch,idUser);\n search.setDepartureTime(update.getMessage().getText());\n cpTravelSearchRepository.save(search);\n\n List<CpTravel> selectTravel = travelBl.findActiveTravelsAll();\n LOGGER.info(\"Numero de viajes encontrados: {}\", selectTravel.size());\n List<CpTravel> travelsFound = travelBl.selectTravels(selectTravel, search);\n LOGGER.info(\"Numero de viajes con filtro: {}\", travelsFound.size());\n for(CpTravel travel:travelsFound){\n options.add((travel.toStringInfo()));\n }\n\n response = 43;\n break;\n case 43:\n\n response = 24;\n break;\n }\n cpUser.setConversationId(response);\n cpUserRepository.save(cpUser);\n }\n responseConversation result = new responseConversation(response,options,messages);\n return result;\n }", "public String update() {\r\n\t\tuserService.update(userEdit);\r\n\t\tusers.setWrappedData(userService.list());\r\n\t\treturn \"update\";\r\n\t}", "public void testUpdate() {\n TUpdate_Input[] PriceLists_update_in = new TUpdate_Input[] { PriceList_update };\n TUpdate_Return[] PriceLists_update_out = priceListService.update(PriceLists_update_in);\n // test if update was successful\n assertEquals(\"update result set\", 1, PriceLists_update_out.length);\n\n TUpdate_Return PriceList_update_out = PriceLists_update_out[0];\n assertNoError(PriceList_update_out.getError());\n assertEquals(\"updated?\", true, PriceList_update_out.getUpdated());\n }", "@Override\n protected String doInBackground(String[] params) {\n String handle = params[0];\n String old_password = params[1];\n String new_name = params[2];\n String new_password = params[3];\n can_send_request = false;\n\n // Creating a socket\n try {\n SocketStation ss = new SocketStation(Config.SERVER_IP, Config.SERVER_PORT);\n\n // Sending QueryType\n ss.send(Flags.QueryType.UPDATE_ACCOUNT);\n // Sending handle\n ss.send(handle);\n // Sending password\n ss.send(old_password);\n // Sending new name\n ss.send(new_name);\n // Sending new password\n ss.send(new_password);\n\n // Receive Response\n String response = ss.receive();\n\n // EOL Exception (Server dies in middle)\n if (response == null) {\n return null;\n }\n // If update account success store new name, handle, new password\n else if (response.equals(Flags.ResponseType.SUCCESS)) {\n SharedPreferences.Editor shEditor = shp.edit();\n shEditor.putString(Keys.SHARED_PREFERENCES.NAME, new_name);\n shEditor.putString(Keys.SHARED_PREFERENCES.HANDLE, handle);\n shEditor.putString(Keys.SHARED_PREFERENCES.PASSWORD, new_password);\n shEditor.commit();\n } else if (response.equals(Flags.ResponseType.INVALID_CREDENTIALS)) {\n SharedPreferences.Editor shEditor = shp.edit();\n shEditor.putString(Keys.SHARED_PREFERENCES.NAME, null);\n shEditor.putString(Keys.SHARED_PREFERENCES.HANDLE, null);\n shEditor.putString(Keys.SHARED_PREFERENCES.PASSWORD, null);\n shEditor.commit();\n }\n\n return response;\n\n } catch (IOException e) {\n e.printStackTrace();\n return \"Server connection refused\";\n }\n }", "protected abstract void update();", "protected abstract void update();" ]
[ "0.6422012", "0.6155503", "0.61474085", "0.60197407", "0.6018589", "0.59517586", "0.5934363", "0.58612555", "0.5849229", "0.5838154", "0.58267915", "0.57246995", "0.5661651", "0.56489956", "0.5640602", "0.5613496", "0.56081945", "0.56081945", "0.55824786", "0.55351573", "0.5497345", "0.5486228", "0.548171", "0.54612476", "0.54535484", "0.5432659", "0.5421603", "0.54203874", "0.541322", "0.5401063", "0.5397539", "0.53910893", "0.53883797", "0.53770626", "0.53603005", "0.5346357", "0.5341556", "0.5327453", "0.5316101", "0.5311107", "0.5309316", "0.5303794", "0.5286504", "0.52632624", "0.5256086", "0.5256086", "0.5250873", "0.52476376", "0.5234606", "0.52339506", "0.5233615", "0.5229043", "0.52270424", "0.5223844", "0.5216826", "0.5214499", "0.5207704", "0.519857", "0.5195981", "0.51896846", "0.51854897", "0.5184827", "0.51806635", "0.51806635", "0.51772624", "0.51762944", "0.51759523", "0.5174078", "0.5165151", "0.5165151", "0.5165151", "0.5165151", "0.51636857", "0.5153388", "0.51460046", "0.5145264", "0.51452065", "0.5140945", "0.5140271", "0.5138155", "0.51326525", "0.51283216", "0.5127848", "0.51189053", "0.5118052", "0.5117955", "0.51073456", "0.51058817", "0.5105283", "0.5104651", "0.5103767", "0.5102697", "0.50999963", "0.5096843", "0.5095817", "0.50932413", "0.5088402", "0.50867456", "0.50851965", "0.50851965" ]
0.68871886
0
Handles delete requests, returns "secretdeleted" when done
private byte[] handleDelete() { boolean success = replaceSecretWith(currentUser, ""); if (success) { ComMethods.report("SecretServer has deleted "+currentUser+"'s secret.", simMode); return preparePayload("secretdeleted".getBytes()); } else { ComMethods.report("SecretServer has FAILED to delete "+currentUser+"'s secret.", simMode); return preparePayload("writingfailure".getBytes()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void delete(SecretIdentifier secretIdentifier);", "public boolean deleteSecret() {\n\t\tbyte[] userMessage = \"delete\".getBytes();\n\t\treturn sendAndCheckResp(userMessage, \"secretdeleted\", \"writingfailure\");\n\t}", "@Override\n\tpublic void doDelete(HttpRequest request, AbstractHttpResponse response)\n\t\t\tthrows IOException {\n\t\t\n\t}", "void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;", "public abstract Response delete(Request request, Response response);", "@DELETE\n\tResponse delete();", "@Override\n public CompletableFuture<Void> delete() {\n return delete(false);\n }", "void onDELETEFinish(String result, int requestCode, boolean isSuccess);", "void filterDelete(ServerContext context, DeleteRequest request,\n ResultHandler<Resource> handler, RequestHandler next);", "int delete(String clientId);", "WriteRequest delete(PiHandle handle);", "public boolean onDelete(Session s) throws CallbackException;", "String delete(String request) throws RemoteException;", "public void handleDel( HttpExchange exchange ) throws IOException {\n\n }", "private void deleteRequest() {\n\t\tboolean res = false;\n\t\tMessage messageToServer = new Message();\n\t\tmessageToServer.setMsg(req.getEcode());\n\t\tmessageToServer.setOperation(\"DeleteRequest\");\n\t\tmessageToServer.setControllerName(\"PrincipalController\");\n\t\tres = (boolean) ClientUI.client.handleMessageFromClientUI(messageToServer);\n\t\tif (res) {\n\t\t\t// success pop up\n\t\t\tTheRequestWasHandledSuccessfullyWindowController popUp = new TheRequestWasHandledSuccessfullyWindowController();\n\t\t\ttry {\n\t\t\t\tpopUp.start(new Stage());\n\t\t\t} catch (Exception e) {\n\t\t\t\tUsefulMethods.instance().printException(e);\n\t\t\t}\n\t\t} else {\n\t\t\tUsefulMethods.instance().display(\"error in deleting request!\");\n\t\t}\n\t}", "@Override\r\n\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tString key = request.getParameter(\"key\");\r\n\t\tJSONObject json = services.Authentification.logout(key);\r\n\t\tresponse.setContentType(\"json\");\r\n\t\tresponse.getWriter().print(json.toString());\r\n\t}", "Boolean delete(HttpServletRequest request, Long id);", "private void discoverDelete(RoutingContext rctx) {\n rctx.response().end(new ObjectBuilder().build());\n }", "@Override\n protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n String urisToDelete = req.getPathInfo();\n\n if(logger.isDebugEnabled()){\n logger.debug(\"delete uris: \"+urisToDelete);\n }\n\n FileDAO fileDao;\n try {\n fileDao = createFileDao(req);\n fileDao.delete(Arrays.asList(urisToDelete.split(\" \")));\n fileDao.commit();\n } catch (Exception e) {\n throw new IOException(\"an exception stopped us\", e);\n }\n }", "protected abstract void doDelete();", "void deleteSecret(Long userId, Long secretId);", "private void delete() {\n\n\t}", "public static int doDelete(String id) {\n int status = 0;\n try {\n // pass the id on the URL line\n URL url = new URL(\"https://intense-lake-93564.herokuapp.com/menusection/\" + \"//\"+id);\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n conn.setRequestMethod(\"DELETE\");\n status = conn.getResponseCode();\n String output = \"\";\n String response = \"\";\n // things went well so let's read the response\n BufferedReader br = new BufferedReader(new InputStreamReader(\n (conn.getInputStream())));\n while ((output = br.readLine()) != null) {\n response += output; \n }\n conn.disconnect(); \n }\n catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return status;\n }", "protected Response delete(String csid, ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx)\r\n throws Exception {\r\n getRepositoryClient(ctx).delete(ctx, csid);\r\n return Response.status(HttpResponseCodes.SC_OK).build();\r\n }", "public ResponseTranslator delete() {\n setMethod(\"DELETE\");\n return doRequest();\n }", "@Test\n void deleteTest() {\n URI uri = URI.create(endBody + \"/delete\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.delete(uri);\n\n assertEquals(200, response.statusCode());\n }", "@Override\r\n\tpublic int delete(ActionContext arg0) throws Exception {\n\t\treturn 0;\r\n\t}", "@Override\n\tprotected String onDelete(HttpServletRequest req, HttpServletResponse resp, FunctionItem fi,\n\t\t\tHashtable<String, String> params, String action, L l, S s) throws Exception {\n\t\treturn null;\n\t}", "@Override\n\tprotected void handleDeleteBody(HashMap<String, HashMap<String, String>> params, DataFormat format) throws Exception {\n\t}", "protected boolean afterDelete() throws DBSIOException{return true;}", "public void delete() throws NotAuthorizedException, ConflictException,\n\t\t\tBadRequestException {\n\t}", "private Delete() {}", "private Delete() {}", "void deleteChallenge();", "public abstract void delete(Context context);", "private ArrayList<String> doDelete(){\n \t\tUserBean user = (UserBean) Util.loadDataFromLocate(this.getContext(), \"user\");\n \t\tString mobile = user.getPhone();\n \t\tString password = user.getPassword();\n \n \t\tjson = \"\";\n //\t\tString apiName = \"ad_delete\";\n \t\tArrayList<String> list = new ArrayList<String>();\n \t\tlist.add(\"mobile=\" + mobile);\n \t\tString password1 = Communication.getMD5(password);\n \t\tpassword1 += Communication.apiSecret;\n \t\tString userToken = Communication.getMD5(password1);\n \t\tlist.add(\"userToken=\" + userToken);\n \t\tlist.add(\"adId=\" + detail.getValueByKey(GoodsDetail.EDATAKEYS.EDATAKEYS_ID));\n \t\tlist.add(\"rt=1\");\n \t\t\n \t\treturn list;\t\t\n \t}", "private void deleteOrder(HttpServletRequest request, HttpServletResponse response) {\n\t\t\n\t}", "<K, V, R extends IResponse> R delete(IDeletionRequest<K, V> deletionRequest);", "@PreAuthorize(\"hasAnyRole('ADMIN')\") // PERMISSÃO APENAS DO ADMIN\n\t@RequestMapping(value = \"/{id}\", method = RequestMethod.DELETE)\n\tpublic ResponseEntity<Void> delete(@PathVariable Integer id) {\n\t\tservice.delete(id);\n\t\treturn ResponseEntity.noContent().build(); // RESPOSTA 204\n\t}", "private void delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tString string = request.getParameter(\"id\");\r\n\t\tservice.delete(Integer.valueOf(string));\r\n\t\trequest.getRequestDispatcher(\"NoticeServlet?service=NoticeGuanLi\").forward(request, response);\r\n\r\n\t}", "public void delete(String so_cd);", "public void delete() {\n\t\tdeleted = true;\n\t}", "public abstract void delete(int msg);", "public void delete() {\n\n\t}", "void delete() throws ClientException;", "public boolean canDelete() throws GTClientException\n {\n return false;\n }", "private void deleteExchange(RoutingContext routingContext) {\n LOGGER.debug(\"Info: deleteExchange method started;\");\n JsonObject requestJson = new JsonObject();\n HttpServerRequest request = routingContext.request();\n HttpServerResponse response = routingContext.response();\n String instanceID = request.getHeader(HEADER_HOST);\n JsonObject authenticationInfo = new JsonObject();\n authenticationInfo.put(API_ENDPOINT, \"/management/exchange\");\n String exchangeId = request.getParam(EXCHANGE_ID);\n requestJson.put(JSON_INSTANCEID, instanceID);\n if (request.headers().contains(HEADER_TOKEN)) {\n authenticationInfo.put(HEADER_TOKEN, request.getHeader(HEADER_TOKEN));\n authenticator.tokenInterospect(requestJson, authenticationInfo, authHandler -> {\n if (authHandler.succeeded()) {\n Future<JsonObject> brokerResult = managementApi.deleteExchange(exchangeId, databroker);\n brokerResult.onComplete(brokerResultHandler -> {\n if (brokerResultHandler.succeeded()) {\n LOGGER.info(\"Success: Deleting exchange\");\n handleSuccessResponse(response, ResponseType.Ok.getCode(),\n brokerResultHandler.result().toString());\n } else if (brokerResultHandler.failed()) {\n LOGGER.error(\"Fail: Bad request;\" + brokerResultHandler.cause().getMessage());\n processBackendResponse(response, brokerResultHandler.cause().getMessage());\n }\n });\n } else if (authHandler.failed()) {\n LOGGER.error(\"Fail: Unauthorized;\" + authHandler.cause().getMessage());\n handleResponse(response, ResponseType.AuthenticationFailure);\n }\n });\n } else {\n LOGGER.error(\"Fail: Unauthorized\");\n handleResponse(response, ResponseType.AuthenticationFailure);\n }\n\n }", "@Override\r\n\tpublic String delete() {\n\t\treturn \"delete\";\r\n\t}", "@Override\r\n\tpublic int delete() throws Exception {\n\t\treturn 0;\r\n\t}", "public int handleDelete(String requestURL) throws ClientProtocolException, IOException{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\tinputsource=null;\r\n\t\r\n\t\tHttpDelete del=new HttpDelete(requestURL);\t\t\t\t//initialising delete object\r\n\t\tresponse=httpclient.execute(del);\t\t\t\t\t\t//executing deletion operation on url\r\n\t\t\r\n\t\tstatusLine= response.getStatusLine().toString();\t\t//status line\r\n\t\t\r\n\t\tHttpEntity entity1 = response.getEntity();\t\t\t\t//getting response entity from server response \t\r\n\t\t\r\n\t\t//getting content from entity of response.\r\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(entity1.getContent()));\r\n\t\t\r\n\t\tString line;\r\n\t\twhile((line=br.readLine())!=null)\r\n\t\t{\r\n\t\t\toutputString=outputString+line.toString();\r\n }\r\n\t\t\r\n\t\t//removing spaces around server response string.\r\n\t\toutputString.trim();\r\n\t\t\r\n\t\t//converting server response string into InputSource.\r\n\t\tinputsource = new InputSource(new StringReader(outputString));\r\n\t\t\r\n\t\t// and ensure it is fully consumed\r\n\t\tEntityUtils.consume(entity1);\t\t\t//consuming entity.\r\n\t\tbr.close();\t\t\t\t\t\t\t\t//closing buffered reader\r\n\t\t\r\n\t\treturn response.getStatusLine().getStatusCode();\r\n\t}", "@Override\r\n\tpublic void doDel(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {\n\t\t\r\n\t}", "public void delete()\n {\n call(\"Delete\");\n }", "public void delete() {\n\n }", "@Override\n public int delete(Uri uri, String selection, String[] selectionArgs) {\n while(flag)\n {}\n if(selection.equals(\"@\")) {\n myKeys.clear();\n return 0;\n }\n else\n {\n HandleDeleteQuery(selection);\n }\n return 0;\n }", "public abstract boolean delete(String oid) throws OIDDoesNotExistException, LockNotAvailableException;", "@Override\n public CompletableFuture<Void> deleteForcefully() {\n return delete(true);\n }", "com.google.spanner.v1.Mutation.Delete getDelete();", "HttpDelete deleteRequest(HttpServletRequest request, String address) throws IOException;", "boolean delete();", "@Override\n public DataObjectResponse<T> handleDELETE(DataObjectRequest<T> request)\n {\n if(getRequestValidator() != null) getRequestValidator().validateDELETE(request);\n try\n {\n DefaultDataObjectResponse<T> response = new DefaultDataObjectResponse<>();\n if(request.getId() != null)\n {\n T object = objectPersister.retrieve(request.getId());\n if(object != null)\n {\n if(! visibilityFilterMap.get(VisibilityMethod.DELETE).isVisible(request, object))\n return new DefaultDataObjectResponse<>(\n ErrorResponseFactory.unauthorized(\n String.format(AUTHORIZATION_EXCEPTION, object.getCustomerId()), request.getCID()));\n\n objectPersister.delete(request.getId());\n response.add(object);\n }\n }\n return response;\n }\n catch(PersistenceException e)\n {\n return new DefaultDataObjectResponse<>(ErrorResponseFactory.badRequest(\n new BadRequestException(String.format(UNABLE_TO_DELETE_EXCEPTION, request.getId()), e), request.getCID()));\n }\n }", "Boolean isConsumeDelete();", "@Override\n\tpublic String delete() throws Exception {\n\t\treturn null;\n\t}", "String deleteENH(String request) throws RemoteException;", "@Override\n\tpublic void delete(HttpServletRequest request,HttpServletResponse response) {\n\t\tint id=Integer.parseInt(request.getParameter(\"id\"));\n\t\tcd.delete(id);\n\t\ttry{\n\t\t\tresponse.sendRedirect(request.getContextPath()+\"/CTServlet?type=question&operation=view&id=123\");\n\t\t\t}\n\t\t\tcatch(Exception e){}\n\t\t\n\t}", "WriteRequest delete(Iterable<? extends PiHandle> handles);", "public void delete(){\r\n\r\n }", "@RequestMapping(value = \"/presencerequests/{id}\",\n method = RequestMethod.DELETE,\n produces = MediaType.APPLICATION_JSON_VALUE)\n @Timed\n public ResponseEntity<Void> deletePresencerequest(@PathVariable Long id) {\n log.debug(\"REST request to delete Presencerequest : {}\", id);\n presencerequestRepository.delete(id);\n return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(\"presencerequest\", id.toString())).build();\n }", "public void test_03() {\n\n\t\tResponse reponse = given().\n\t\t\t\twhen().\n\t\t\t\tdelete(\"http://localhost:3000/posts/_3cYk0W\");\n\n\t\tSystem.out.println(\"updated response data \"+ reponse.asString());\t\t\n\t}", "Future<DeleteBackendResponse> deleteBackend(\n DeleteBackendRequest request,\n AsyncHandler<DeleteBackendRequest, DeleteBackendResponse> handler);", "@DISPID(13)\n\t// = 0xd. The runtime will prefer the VTID if present\n\t@VTID(23)\n\tboolean deleted();", "@Override\n\tprotected void doDelete(Session session) {\n\n\t}", "public void delete();", "public void delete();", "public void delete();", "public void delete();", "public void delete();", "public void delete();", "@DeleteMapping(KekMappingValues.GUID)\n @PreAuthorize(KekRoles.TENANT_USER_ADMIN)\n public ResponseEntity deleteData(@PathVariable String guid) {\n logger.info(\"Accepted request to delete the data from Google Cloud Storage bucket by guid {}\", guid);\n\n cloudStorageService.deleteByGuid(guid);\n\n logger.info(\"Data ({}) successfully deleted\", guid);\n return ResponseEntity\n .status(HttpStatus.ACCEPTED)\n .build();\n }", "@Override\n\tpublic ActionForward delete(HttpServletRequest request, HttpServletResponse response) {\n\t\treturn null;\n\t}", "@Override\n\tpublic ActionForward delete(HttpServletRequest request, HttpServletResponse response) {\n\t\treturn null;\n\t}", "public void deleteRequest(Request request) {\n String title = \"Confirm delete of request(Y/N): \";\n if (Validation.confirmAction(title)) {\n if (Database.deleteRequest(request)) System.out.println(\"Request deleted successfully\");\n else System.out.println(\"Failed to delete request\");\n }else System.out.println(\"Delete of request aborted\");\n }", "@DeleteMapping(\"/produtos/{id}\")\n @Timed\n public ResponseEntity<Void> deleteProduto(@PathVariable Long id) {\n log.debug(\"REST request to delete Produto : {}\", id);\n\n//////////////////////////////////REQUER PRIVILEGIOS\n if (PrivilegioService.podeDeletar(cargoRepository, ENTITY_NAME)) {\n produtoRepository.delete(id);\n } else {\n log.error(\"TENTATIVA DE EXCUIR SEM PERMISSÃO BLOQUEADA! \" + ENTITY_NAME + \" : {}\", id);\n return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, \"privilegios insuficientes.\", \"Este usuario não possui privilegios sufuentes para deletar esta entidade.\")).body(null);\n }\n//////////////////////////////////REQUER PRIVILEGIOS\n return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();\n }", "void onDelete();", "public boolean delete();", "public void operationDelete() {\n\r\n\t\tstatusFeldDelete();\r\n\t}", "public void deleteRequest() {\n assertTrue(true);\n }", "@Override\n public final void doDelete() {\n try {\n checkPermissions(getRequest());\n final List<APIID> ids = new ArrayList<APIID>();\n\n // Using ids in json input stream\n if (id == null) {\n final String inputStream = getInputStream();\n if (inputStream.length() == 0) {\n throw new APIMissingIdException(\"Id of the element to delete is missing [\" + inputStream + \"]\");\n }\n\n // Parsing ids in Json input stream\n final AbstractTreeNode<String> tree = JSonSimpleDeserializer.unserializeTree(inputStream);\n\n if (tree instanceof Tree<?>) {\n final List<AbstractTreeNode<String>> nodes = ((Tree<String>) tree).getNodes();\n\n for (final AbstractTreeNode<String> node : nodes) {\n if (node instanceof Tree<?>) {\n ids.add(APIID.makeAPIID(((Tree<String>) node).getValues()));\n } else if (node instanceof TreeLeaf<?>) {\n ids.add(APIID.makeAPIID(((TreeLeaf<String>) node).getValue()));\n } else {\n throw new APIMissingIdException(\"Id of the elements to delete are missing or misswritten \\\"\" + inputStream + \"\\\"\");\n }\n }\n } else {\n throw new APIMissingIdException(\"Id of the elements to delete are missing or misswritten \\\"\" + inputStream + \"\\\"\");\n }\n }\n\n // Using id in URL\n else {\n ids.add(id);\n }\n\n api.runDelete(ids);\n } catch (final APIException e) {\n e.setApi(apiName);\n e.setResource(resourceName);\n throw e;\n\n }\n }", "void deleteSecrets(Long userId);", "void afterDelete(T resource);", "private void handleDeletePressed() {\n if (mCtx == Context.CREATE) {\n finish();\n return;\n }\n\n DialogFactory.deletion(this, getString(R.string.dialog_note), () -> {\n QueryService.awaitInstance(service -> deleteNote(service, mNote.id()));\n }).show();\n }", "@Override\n\tpublic void delete(String code) {\n\n\t}", "@Override\n\tpublic void delete() {\n\t\t\n\t}", "@Override\n\tpublic void delete() {\n\t\t\n\t}", "public String doDeleteById(HttpServletRequest request,\n HttpServletResponse response) {\n return null;\n }", "@Override\n\tpublic void delete() {\n\n\t}", "public void delete(RequestBean request) {\n\t\t\r\n\t}", "private void deleteFun() throws IOException {\n String jsonObject = \"{\\\"age\\\":10,\\\"dateOfBirth\\\":1471455886564,\\\"fullName\\\":\\\"Johan Doe\\\"}\";\n IndexRequest indexRequest = new IndexRequest(\"people\");\n indexRequest.source(jsonObject, XContentType.JSON);\n\n IndexResponse response = client.index(indexRequest, RequestOptions.DEFAULT);\n String id = response.getId();\n\t System.out.println(\"id = \" + id);\n\n GetRequest getRequest = new GetRequest(\"people\");\n getRequest.id(id);\n\n GetResponse getResponse = client.get(getRequest, RequestOptions.DEFAULT);\n System.out.println(getResponse.getSourceAsString());\n\n DeleteRequest deleteRequest = new DeleteRequest(\"people\");\n deleteRequest.id(id);\n\n DeleteResponse deleteResponse = client.delete(deleteRequest, RequestOptions.DEFAULT);\n\t System.out.println(\"deleteResponse = \" + deleteResponse.toString());\n }", "void deleteByIdWithResponse(String id, String referer, Context context);", "@Override\n protected Response doDelete(Long id) {\n return null;\n }", "@Override\n protected Response doDelete(Long id) {\n return null;\n }" ]
[ "0.71510565", "0.7043786", "0.6854052", "0.6759992", "0.6594905", "0.6519541", "0.64781517", "0.6473071", "0.6463454", "0.64301807", "0.6428172", "0.63991106", "0.63818", "0.63378745", "0.63358855", "0.6333542", "0.6325902", "0.63176596", "0.6310722", "0.62977505", "0.6277089", "0.627634", "0.6223911", "0.620206", "0.61988384", "0.61984557", "0.6195838", "0.61893624", "0.61876005", "0.61476636", "0.6116255", "0.6089817", "0.6089817", "0.60860586", "0.6076515", "0.6065408", "0.6061467", "0.6054054", "0.60535383", "0.60497606", "0.60409296", "0.6023552", "0.6012144", "0.60096776", "0.6008314", "0.5999173", "0.59903765", "0.5981676", "0.5975935", "0.5964727", "0.5953591", "0.5944811", "0.5936656", "0.5932419", "0.5923845", "0.5918706", "0.5911603", "0.58952564", "0.5893783", "0.5892149", "0.58830816", "0.5881677", "0.5871295", "0.5860714", "0.58604413", "0.58589125", "0.58495957", "0.5849543", "0.584809", "0.5842134", "0.5840642", "0.5836801", "0.5836801", "0.5836801", "0.5836801", "0.5836801", "0.5836801", "0.5834907", "0.58312523", "0.58312523", "0.5809868", "0.5803395", "0.5802988", "0.58023375", "0.5800622", "0.58000046", "0.5796293", "0.57883906", "0.5776561", "0.57730263", "0.57711846", "0.5766591", "0.5766591", "0.5764726", "0.5763177", "0.57631487", "0.576198", "0.57605004", "0.5758591", "0.5758591" ]
0.8339784
0
Handles second transaction of Bilateral Auth. Protocol Given encrypted first message, identifies User, verifies proper formatting of message, generates a nonce, and sends the User a payload in response
private byte[] handleAuthPt1(byte[] payload) { boolean userIdentified = false; byte[] supposedUser = null; // System.out.println("payload received by SecretServer:"); ComMethods.charByChar(payload,true); // userNum = -1; while (userNum < validUsers.length-1 && !userIdentified) { userNum++; supposedUser = validUsers[userNum].getBytes(); userIdentified = Arrays.equals(Arrays.copyOf(payload, supposedUser.length), supposedUser); // System.out.println(); System.out.println("\""+validUsers[userNum]+"\" in bytes:"); ComMethods.charByChar(validUsers[userNum].getBytes(),true); System.out.println("\"Arrays.copyOf(payload, supposedUser.length\" in bytes:"); ComMethods.charByChar(Arrays.copyOf(payload, supposedUser.length),true); System.out.println(); // } if (!userIdentified) { ComMethods.report("SecretServer doesn't recognize name of valid user.", simMode); return "error".getBytes(); } else { // Process second half of message, and verify format byte[] secondHalf = Arrays.copyOfRange(payload, supposedUser.length, payload.length); // System.out.println("secondHalf = "+secondHalf); // secondHalf = ComMethods.decryptRSA(secondHalf, my_n, my_d); // System.out.println("secondHalf = "+secondHalf); // ComMethods.report("SecretServer has decrypted the second half of the User's message using SecretServer's private RSA key.", simMode); if (!Arrays.equals(Arrays.copyOf(secondHalf, supposedUser.length), supposedUser)) { // i.e. plaintext name doesn't match the encrypted bit ComMethods.report("ERROR ~ invalid first message in protocol.", simMode); return "error".getBytes(); } else { // confirmed: supposedUser is legit. user currentUser = new String(supposedUser); userSet = true; byte[] nonce_user = Arrays.copyOfRange(secondHalf, supposedUser.length, secondHalf.length); // Second Message: B->A: E_kA(nonce_A || Bob || nonce_B) myNonce = ComMethods.genNonce(); ComMethods.report("SecretServer has randomly generated a 128-bit nonce_srvr = "+myNonce+".", simMode); byte[] response = ComMethods.concatByteArrs(nonce_user, "SecretServer".getBytes(), myNonce); byte[] responsePayload = ComMethods.encryptRSA(response, usersPubKeys1[userNum], BigInteger.valueOf(usersPubKeys2[userNum])); return responsePayload; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private byte[] handleAuthPt2(byte[] payload) { \n\t\tbyte[] message = ComMethods.decryptRSA(payload, my_n, my_d);\n\t\tComMethods.report(\"SecretServer has decrypted the User's message using SecretServer's private RSA key.\", simMode);\n\t\t\n\t\tif (!Arrays.equals(Arrays.copyOf(message, myNonce.length), myNonce)) {\n\t\t\tComMethods.report(\"ERROR ~ invalid third message in protocol.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Authentication done!\n\t\t\tcurrentSessionKey = Arrays.copyOfRange(message, myNonce.length, message.length);\n\t\t\tactiveSession = true;\n\t\t\tcounter = 11;\n\n\t\t\t// use \"preparePayload\" from now on for all outgoing messages\n\t\t\tbyte[] responsePayload = preparePayload(\"understood\".getBytes());\n\t\t\tcounter = 13;\n\t\t\treturn responsePayload;\n\t\t} \n\t}", "public boolean connectAs(String uname) {\n\t\tboolean noProblems = true; // no problems have been encountered\n \n\t\t// First Message: A->B: Alice || E_kB(Alice || nonce_A)\n\t\tbyte[] nonce_user = ComMethods.genNonce();\n\t\tComMethods.report(accountName+\" has randomly generated a 128-bit nonce_user = \"+(new String(nonce_user))+\".\",simMode);\n\n\t\tbyte[] unameBytes = uname.getBytes();\n\t\tbyte[] srvrNameBytes = \"SecretServer\".getBytes();\n\n\t\tbyte[] pload = ComMethods.concatByteArrs(unameBytes, nonce_user);\n\t\tpload = SecureMethods.encryptRSA(pload, serv_n, BigInteger.valueOf(serv_e), simMode);\n\n\t\tbyte[] message1 = ComMethods.concatByteArrs(unameBytes,pload);\n\n\t\tComMethods.report(accountName+\" is sending SecretServer the name \"+uname+\", concatenated with '\"+uname+\" || nonce_user' encrypted under RSA with the SecretServer's public key.\", simMode);\t\t\n\t\tbyte[] response1 = sendServer(message1,false);\n\n\t\tif (!checkError(response1)) {\n\t\t\tresponse1 = SecureMethods.decryptRSA(response1, my_n, my_d, simMode);\n\t\t\tComMethods.report(accountName+\" has decrypted the SecretServer's message using \"+accountName+\"'s private RSA key.\", simMode);\n\t\t} else {\n\t\t\tComMethods.report(accountName+\" has received the SecretServer's error message.\", simMode);\n\t\t}\n\n\t\t// Test for proper formatting of the second message in the protocol\n\t\tif (!Arrays.equals(Arrays.copyOf(response1,nonce_user.length), nonce_user) || !Arrays.equals(Arrays.copyOfRange(response1, nonce_user.length, nonce_user.length+srvrNameBytes.length), srvrNameBytes)) {\n\n\t\t\tnoProblems = false;\n\t\t\tSystem.out.println(\"ERROR ~ something went wrong.\");\n\t\t} else {\n\t\t\tbyte[] nonce_srvr = Arrays.copyOfRange(response1, nonce_user.length + srvrNameBytes.length, response1.length);\n\t\t\tComMethods.report(accountName+\" now has nonce_srvr.\", simMode);\n\n\t\t\t// Third Message: A->B: E_kB(nonce_B || kS)\n\t\t\tsessionKey = ComMethods.genNonce();\n\t\t\tComMethods.report(accountName+\" has generated a random 128-bit session key.\", simMode);\n\t\t\t\n\t\t\tbyte[] message2 = ComMethods.concatByteArrs(nonce_srvr, sessionKey);\n\t\t\tmessage2 = SecureMethods.encryptRSA(message2, serv_n, BigInteger.valueOf(serv_e), simMode);\n\t\t\tComMethods.report(accountName+\" is sending the SecretServer the concatenation of nonce_srvr and the session key, encrypted under RSA using the SecretServer's public key.\", simMode);\n\n\t\t\tbyte[] response2 = sendServer(message2, true);\n\t\t\tif (!checkError(response2)) {\n\t\t\t\tresponse2 = SecureMethods.processPayload(srvrNameBytes, response2, 11, sessionKey, simMode);\n\t\t\t\tComMethods.report(accountName+\" has decrypted the SecretServer's message using the symmetric session key that \"+accountName+\" just generated.\", simMode);\t\t\t\t\n\t\t\t} else {\n\t\t\t\tComMethods.report(accountName+\" has received the SecretServer's error message.\", simMode);\n\t\t\t}\n\n\t\t\t// Test formatting of the 4th message in the protocol\n\t\t\tbyte[] expected = \"understood\".getBytes();\n\t\t\tif (!Arrays.equals(Arrays.copyOf(response2, expected.length), expected)) {\n\t\t\t\tnoProblems = false;\n\t\t\t\tComMethods.report(\"ERROR ~ something went wrong with the fourth message in the Bilateral Authentication Protocol.\", simMode);\n\t\t\t} else {\n\t\t\t\tcounter = 12; // counter to be used in future messages\n\t\t\t}\n\t\t}\n\n\t\tif (noProblems) {\n\t\t\tusername = uname;\n\t\t}\n\n\t\treturn noProblems; \n\t}", "public void sendKeys() throws Exception{\n ATMMessage atmMessage = (ATMMessage)is.readObject();\r\n System.out.println(\"\\nGot response\");\r\n \r\n //System.out.println(\"Received second message from the client with below details \");\r\n //System.out.println(\"Response Nonce value : \"+atmMessage.getResponseNonce());\r\n \r\n if(!verifyMessage(atmMessage))error(\" Nonce or time stamp does not match\") ;\r\n kSession = crypto.makeRijndaelKey();\r\n \r\n Key kRandom = crypto.makeRijndaelKey();\r\n byte [] cipherText = crypto.encryptRSA(kRandom,kPubClient);\r\n os.writeObject((Serializable)cipherText);\r\n System.out.println(\"\\nSending Accept and random key\");\r\n \r\n \r\n cipherText = crypto.encryptRSAPrivateKey(kSession,kPrivBank);\r\n atmMessage = new ATMMessage(); \r\n atmMessage.setEncryptedSessionKey(cipherText);\r\n cipherText = crypto.encryptRijndael(atmMessage,kRandom);\r\n currTimeStamp = System.currentTimeMillis();\r\n os.writeObject((Serializable)cipherText);\r\n //System.out.println(\"Session Key send to the client \");\r\n \r\n //SecondServerMessage secondServerMessage = new SecondServerMessage();\r\n //secondServerMessage.setSessionKey(kSession);\r\n \r\n //byte [] cipherText1;\r\n //cipherText = crypto.encryptRSAPrivateKey(kSession,kPrivBank);\r\n //cipherText1 = crypto.encryptRSA(cipherText,clientPublicKey);\r\n //os.writeObject((Serializable)cipherText1);\r\n \r\n //System.out.println(\"Second message send by the server which contains the session key. \");\r\n //System.out.println(\"\\n\\n\\n\");\r\n \r\n \r\n }", "public byte[] getMessage(byte[] payload, boolean partTwo) {\n\t\tComMethods.report(\"SecretServer received payload and will now process it.\", simMode);\n\t\tbyte[] resp = new byte[0];\n\t\tif (activeSession) {\n\t\t\t// Extract message from active session payload\n\t\t\tbyte[] message = processPayload(payload);\n\n\t\t\tswitch (getSessionCommand(message)) {\n\t\t\t\tcase \"password\":\n\t\t\t\t\tresp = handlePassword(message);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"view\":\n\t\t\t\t\tresp = handleView();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"update\":\n\t\t\t\t\tresp = handleUpdate(message);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"delete\":\n\t\t\t\t\tresp = handleDelete();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tComMethods.handleBadResp();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcounter = counter + 2;\n\t\t} else if (!partTwo) {\n\t\t\tresp = handleAuthPt1(payload);\n\t\t} else if (userSet && partTwo) {\n\t\t\tresp = handleAuthPt2(payload);\n\t\t} else {\n\t\t\t// Something's wrong\n\t\t\tComMethods.handleBadResp();\n\t\t}\n\t\treturn resp;\n\t}", "@Override\n public void a(yt yt2, int n2, boolean bl2) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n IBinder iBinder = yt2 != null ? yt2.asBinder() : null;\n parcel.writeStrongBinder(iBinder);\n parcel.writeInt(n2);\n int n3 = 0;\n if (bl2) {\n n3 = 1;\n }\n parcel.writeInt(n3);\n this.a.transact(9, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "@Override\r\n\tpublic void messageReceived( IoSession session, Object message ) throws Exception\r\n\t{\r\n\t\t//\t\tSystem.out.println(\"data \" + (byte[])message);\r\n\t\t//\t\tfor(byte b : (byte[])message){\r\n\t\t//\t\t\tSystem.out.print(b + \" \");\r\n\t\t//\t\t}\r\n\t\t//\t\tSystem.out.println();\r\n\r\n\r\n\r\n\t\tif(message instanceof ClientMessage)\t\t// Application\r\n\t\t\treceivedClientMessage = (ClientMessage) message;\r\n\t\telse{ \t\t\t\t\t\t\t\t\t\t// OBU\r\n\t\t\tinterpretData((byte[]) message, session);\r\n\t\t\t//\t\t\tboolean transactionState = obuHandlers.get(session).addData((byte[])message); \r\n\t\t\t//\t\t\tif(transactionState){\r\n\t\t\t//\t\t\t\tbyte[] b = {(byte)0x01};\r\n\t\t\t//\t\t\t\tsession.write(new OBUMessage(OBUMessage.REQUEST_TELEMETRY, b).request);\r\n\t\t\t//\t\t\t}\r\n\t\t\t//\r\n\t\t\t//\t\t\tThread.sleep(200);\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tRunnable run = new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tswitch(receivedClientMessage.getId()){\r\n\t\t\t\tcase LOGIN_CHECK:\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\t//\t\t\t\tlock.lock();\r\n\t\t\t\t\t\tint user_id = (int)receivedClientMessage.getContent();\r\n\t\t\t\t\t\tUserData response = null;\r\n\t\t\t\t\t\tif(user_id == -1){\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tboolean isOnline = AmberServer.getDatabase().checkOnline(user_id);\r\n\t\t\t\t\t\tif(isOnline){\r\n\t\t\t\t\t\t\tsession.setAttribute(\"user\", user_id);\r\n\t\t\t\t\t\t\tcancelTimeout(user_id);\r\n\t\t\t\t\t\t\tresponse = new UserData().prepareUserData(user_id);\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t\t\tServerLogger.log(\"Login succeeded: \" + user_id, Constants.DEBUG);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfinally{\r\n\t\t\t\t\t\t//\t\t\t\tlock.unlock();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LOGIN:\r\n\t\t\t\t\tClientMessage responseMessage = null;\r\n\t\t\t\t\tString usernameLogin = ((User)receivedClientMessage.getContent()).getName();\r\n\t\t\t\t\tbyte[] passLogin = ((User)receivedClientMessage.getContent()).getPass();\r\n\t\t\t\t\tString regID = ((User)receivedClientMessage.getContent()).getRegistationID();\r\n\t\t\t\t\t// Database validation\r\n\t\t\t\t\t// Check for User and Password\r\n\t\t\t\t\tint userID = AmberServer.getDatabase().login(usernameLogin, passLogin);\r\n\t\t\t\t\tif(userID == -1){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_LOGIN);\r\n\t\t\t\t\t\tServerLogger.log(\"Login failed: \" + usernameLogin, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Check for GCM Registration\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tAmberServer.getDatabase().registerGCM(userID, regID);\r\n\t\t\t\t\t\tUserData response = new UserData();\r\n\t\t\t\t\t\tresponse = response.prepareUserData(userID);\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.LOGIN, response);\r\n\t\t\t\t\t\tsession.setAttribute(\"user\", userID);\r\n\t\t\t\t\t\tServerLogger.log(\"Login success: \" + usernameLogin, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LOGOUT:\r\n\t\t\t\t\tint user_id = (int)receivedClientMessage.getContent();\r\n\t\t\t\t\tAmberServer.getDatabase().logout(user_id);\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.LOGOUT, Constants.SUCCESS_LOGOUT);\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase REGISTER:\r\n\t\t\t\t\tString usernameRegister = ((User)receivedClientMessage.getContent()).getName();\r\n\t\t\t\t\tbyte[] passRegister = ((User)receivedClientMessage.getContent()).getPass();\r\n\t\t\t\t\tboolean queryRegister = AmberServer.getDatabase().addUser(usernameRegister, passRegister, 0);\r\n\t\t\t\t\t// Registration failed\r\n\t\t\t\t\tif(!queryRegister){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_REGISTER);\r\n\t\t\t\t\t\tServerLogger.log(\"Registration failed: \" + usernameRegister, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Registration succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.REGISTER, Constants.SUCCESS_REGISTER);\r\n\t\t\t\t\t\tServerLogger.log(\"Registration success: \" + usernameRegister, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EVENT_DETAIL:\r\n\t\t\t\tcase EVENT_REQUEST:\r\n\t\t\t\t\tObject[] request = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tint eventID = (int) request[0];\r\n\t\t\t\t\tint obuID = (int) request[1];\r\n\t\t\t\t\tObject[] eventData = AmberServer.getDatabase().getEventData(eventID);\r\n\t\t\t\t\tString vehicleName = AmberServer.getDatabase().getVehicleName(obuID);\r\n\t\t\t\t\tString eventType = (String)eventData[1];\r\n\t\t\t\t\tString eventTime = (String)eventData[2];\r\n\t\t\t\t\tdouble eventLat = (double)eventData[3];\r\n\t\t\t\t\tdouble eventLon = (double)eventData[4];\r\n\t\t\t\t\tbyte[] eventImage = (byte[]) eventData[5];\t// EventImage\r\n\t\t\t\t\tEvent event = new Event(eventType, eventTime, eventLat, eventLon, eventImage, vehicleName);\r\n\t\t\t\t\tevent.setVehicleID(obuID);\r\n\t\t\t\t\tsession.write(new ClientMessage(receivedClientMessage.getId(), event));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase REGISTER_VEHICLE:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tint vehicleID = (int) request[1];\r\n\r\n\t\t\t\t\tSystem.out.println(\"VEHICLE ID \" + vehicleID);\r\n\r\n\t\t\t\t\tVehicle vehicle = AmberServer.getDatabase().registerVehicle(userID, vehicleID);\r\n\t\t\t\t\tSystem.out.println(vehicle);\r\n\t\t\t\t\tif(vehicle == null){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_REGISTER_VEHICLE);\r\n\t\t\t\t\t\tServerLogger.log(\"Add Vehicle failed: \" + userID, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Add Vehicle succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tvehicle = vehicle.prepareVehicle(vehicleID);\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.REGISTER_VEHICLE, vehicle);\r\n\t\t\t\t\t\tServerLogger.log(\"Add Vehicle succeeded: \" + userID, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase UNREGISTER_VEHICLE:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tvehicleID = (int) request[1];\r\n\t\t\t\t\tint position = (int) request[2];\r\n\t\t\t\t\tboolean queryUnregisterVehicle = AmberServer.getDatabase().unregisterVehicle(userID, vehicleID);\r\n\t\t\t\t\tif(!queryUnregisterVehicle){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.UNREGISTER_VEHICLE, -1);\r\n\t\t\t\t\t\tServerLogger.log(\"Unregister Vehicle failed for User: \" + userID, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Unregister Vehicle succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.UNREGISTER_VEHICLE, position);\r\n\t\t\t\t\t\tServerLogger.log(\"Unregister Vehicle succeeded for User: \" + userID, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TOGGLE_ALARM:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tvehicleID = (int) request[1];\r\n\t\t\t\t\tboolean status = (boolean) request[2];\r\n\t\t\t\t\tposition = (int) request[3];\r\n\t\t\t\t\tboolean queryToggleAlarm = AmberServer.getDatabase().toggleAlarm(userID, vehicleID, status);\r\n\t\t\t\t\tObject[] responseData = {queryToggleAlarm, position};\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.TOGGLE_ALARM, responseData);\r\n\t\t\t\t\tServerLogger.log(\"Toggle Alarm for User: \" + userID + \" \" + queryToggleAlarm, Constants.DEBUG);\t\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase GET_EVENTLIST_BACKPRESS:\r\n\t\t\t\tcase GET_EVENTLIST:\r\n\t\t\t\t\tvehicleID = (int) receivedClientMessage.getContent();\r\n\t\t\t\t\tvehicleName = AmberServer.getDatabase().getVehicleName(vehicleID);\r\n\t\t\t\t\tArrayList<Event> events = Vehicle.prepareEventList(vehicleID);\r\n\t\t\t\t\tObject[] eventResponse = {events, vehicleName};\r\n\t\t\t\t\tresponseMessage = new ClientMessage(receivedClientMessage.getId(), eventResponse);\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase GET_VEHICLELIST_BACKPRESS:\r\n\t\t\t\t\tuserID = (int) receivedClientMessage.getContent();\r\n\t\t\t\t\tUserData response = new UserData();\r\n\t\t\t\t\tresponse = response.prepareUserData(userID);\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.GET_VEHICLELIST_BACKPRESS, response.getVehicles());\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tnew Thread(run).start();\r\n\t}", "private void getAUTH_REQUEST() throws Exception {\n\t\t\n\t\tboolean status = true;\n\t\tboolean status2 = false;\n\t\tString msg = \"\";\n\t\t\n\t\t//File filePK = new File(\"identity\");\n\t\n\t\ttry {\n\t\t\t\n\t\t\tmsg = br.readLine();\n\t\t\tGetTimestamp(\"Received Authorization Request from Client: \" + msg);\n\t\t\t\n\t\t\tJSONObject REQUEST = (JSONObject) parser.parse(msg);\n\t String identity = REQUEST.get(\"identity\").toString();\n\t\t\t\n\t\t\t\n\t if((identity.contains(\"aaron@krusty\"))) {\n\n\t \tGetTimestamp(\"Authorization Request from Client is approved: \");\n\n\t \tGetTimestamp(\"Client Publickey is stored: \" ) ;\n\n\t \tString tosend = encrypt1(getSharedKey(), getClientPublicKey());\n\n\t \tGetTimestamp(\"Server sharedkey is being encrypted with Client's publickey to be sent: \") ;\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"AES128\", tosend);\n\t \tRESPONSE.put(\"status\", status);\n\t \tRESPONSE.put(\"message\", \"public key found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tGetTimestamp(\"Sending Authorization Response to Client: \");\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\n\n\t }\n\t else {\n\n\t \tSystem.out.println(\"Client \" + REQUEST.get(\"identity\") + \" has been rejected\");\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"status\", status2);\n\t \tRESPONSE.put(\"message\", \"public key not found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\t \tcloseConnection();\n\t }\n\t\t\t\t\n\t\t\t\n\t\t} catch (IOException ex) {\n\t\t\tLogger.getLogger(ServerTCP.class.getName()).log(Level.SEVERE, null, ex);\n\t\t}\n\t\tif (msg.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"Client has signed out!\");\n\t\t\tcloseConnection();\n\n\t\t} else {\t\n\t\t\tgetMessage();\n\t\t}\n\t}", "public boolean doTransaction() {\r\n int nonce = -1;\r\n TransactionOperation transactionOperation = null;\r\n try {\r\n double balance;\r\n \r\n //read the stream for requests from client\r\n byte[] cipherText = (byte [])is.readObject();\r\n \r\n // decrypt the ciphertext to obtain the signed message\r\n ATMSessionMessage atmSessionMessage = (ATMSessionMessage) crypto.decryptRijndael(cipherText, kSession);\r\n if(!(currTimeStamp < atmSessionMessage.getTimeStamp())) error (\"Time stamp does not match\");\r\n \r\n //interpret the transaction operation in the request\r\n SignedMessage signedMessage = atmSessionMessage.getSignedMessage();\r\n \r\n \r\n \t\t//verify signature\r\n \t\ttry {\r\n \t\t\tif(!crypto.verify(signedMessage.msg, signedMessage.signature, currAcct.kPub))\r\n \t\t\t{\r\n \t\t\t\tSystem.out.println(\"Digital signature failed...\");\r\n \t\t\t}\r\n \t\t\tSystem.out.println(\"Message signature valid...\");\r\n \t\t} catch (SignatureException e2) {\r\n \t\t\te2.printStackTrace();\r\n \t\t\treturn false;\r\n \t\t} catch (KeyException e2) {\r\n \t\t\te2.printStackTrace();\r\n \t\t\treturn false;\r\n \t\t}\r\n \t\t\r\n TransactionMessage transactionMessage = (TransactionMessage)signedMessage.getObject();\r\n transactionOperation = transactionMessage.getOperation();\r\n \r\n //print the signed message\r\n System.out.println(\"\\n\" + (new Date()).toString());\r\n System.out.println(signedMessage.toString());\r\n \r\n //strip out the parameters embedded \r\n nonce = atmSessionMessage.getNonce();\r\n double value = transactionMessage.getValue();\r\n \r\n //print the timestamp when the transaction takes place\r\n Date now = new Date();\r\n System.out.println(\"\\n\" + now.toString());\r\n \r\n //re-route the request to the appropriate handling function\r\n if(transactionOperation == TransactionOperation.Deposit) {\r\n \t System.out.println(\"ACCT #:\" + currAcct.getNumber() + \" DEPOSIT: \" + value);\r\n currAcct.deposit(value);\r\n \r\n System.out.println(\"\\n\" + (now).toString());\r\n System.out.println(\"Deposit Complete. BALANCE:\" + currAcct.getBalance());\r\n }\r\n else if(transactionOperation == TransactionOperation.Withdraw) {\r\n \t System.out.println(\"ACCT #:\" + currAcct.getNumber() + \" WITHDRAW: \" + value);\r\n \t currAcct.withdraw(value);\r\n \t \r\n System.out.println(\"\\n\" + (now).toString());\r\n System.out.println(\"Withdrawal Complete. BALANCE:\" + currAcct.getBalance());\r\n }\r\n else if(transactionOperation == TransactionOperation.EndSession) \r\n \t {\r\n \t \tSystem.out.println(\"\\nTerminating session with ACCT#: \" + currAcct.getNumber());\r\n \t \treturn false;\r\n \t \t\r\n \t }\r\n \r\n accts.save();\r\n //create a successful reply Success and set the balance\r\n balance = currAcct.getBalance(); \r\n transactionMessage = new TransactionMessage(MessageType.ResponseSuccess,transactionOperation,balance);\r\n atmSessionMessage = new ATMSessionMessage(transactionMessage);\r\n \r\n //set the nonce \r\n atmSessionMessage.setNonce(nonce);\r\n currTimeStamp = atmSessionMessage.getTimeStamp();\r\n //encrypt the response and send it\r\n cipherText = crypto.encryptRijndael(atmSessionMessage, kSession);\r\n os.writeObject((Serializable)cipherText);\r\n \r\n //Logging.....\r\n //get the signed message and encrypt it\r\n \r\n signedMessage.encryptMessage(this.kLog);\r\n \r\n //encrypt the action\r\n //archive the signed message for logging and non-repudiation purposes \r\n SignedAction signedAction = new SignedAction(currAcct.getNumber(), atmSessionMessage.getTimeStamp(), signedMessage);\r\n \r\n //flush out transaction record to the audit file\r\n BankServer.log.write(signedAction);\r\n \r\n\t return true;\r\n }\r\n catch(Exception e){\r\n if(e instanceof TransException) replyFailure(transactionOperation,nonce);\r\n System.out.println(\"Terminating session with ACCT#: \" + currAcct.getNumber());\r\n \t//e.printStackTrace();\r\n \r\n return true;\r\n }\r\n }", "@Override\n public void a(ahp ahp2) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n IBinder iBinder = ahp2 != null ? ahp2.asBinder() : null;\n parcel.writeStrongBinder(iBinder);\n this.a.transact(11, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "public void Transaction_Phase_Two_Remainder() {\n executeController.execute(\n new Thread(() -> {\n try {\n System.out.println(\"Sending remainder to participant\");\n writer.println(\"REMAINDER: Participant is required to send DONE\");\n reader.readLine();\n sent_done = true;\n } catch (IOException ignored) {\n }\n }),\n TIMEOUT_PERIOD,\n 2, this\n );\n }", "@Override\n protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response,\n AuthenticationContext context) throws AuthenticationFailedException {\n Map<String, String> authenticatorProperties = context.getAuthenticatorProperties();\n String apiKey = authenticatorProperties.get(Token2Constants.APIKEY);\n String userToken = request.getParameter(Token2Constants.CODE);\n String id = getUserId(context);\n String json = validateToken(Token2Constants.TOKEN2_VALIDATE_ENDPOINT, apiKey, id, Token2Constants.JSON_FORMAT,\n userToken);\n Map<String, Object> userClaims;\n userClaims = JSONUtils.parseJSON(json);\n if (userClaims != null) {\n String validation = String.valueOf(userClaims.get(Token2Constants.VALIDATION));\n if (validation.equals(\"true\")) {\n context.setSubject(AuthenticatedUser\n .createLocalAuthenticatedUserFromSubjectIdentifier(\"an authorised user\"));\n } else {\n throw new AuthenticationFailedException(\"Given hardware token has been expired or is not a valid token\");\n }\n } else {\n throw new AuthenticationFailedException(\"UserClaim object is null\");\n }\n }", "@Override\n\tpublic synchronized Result transferGood(String userId, String goodId, String cnonce,\n\t\tbyte[] signature) throws TransferException, InvalidSignatureException {\n\n\t\t//verify message received from other user\n\t\tString toVerify = nonceList.get(userId) + cnonce + userId + goodId;\n\t\tif (!cryptoUtils.verifySignature(userId, toVerify, signature)) {\n\t\t\tthrow new InvalidSignatureException(userId);\n\t\t}\n\n\t\tGood goodToSell = goods.get(goodId);\n\n\t\t//writer increment timestamp\n\t\tfinal int writeTimeStamp = goodToSell.getWriteTimestamp() + 1;\n\t\tif (verbose) {\n\t\t\tSystem.out.println(\"--> WriteTimeStamp sent: \" + writeTimeStamp);\n\t\t}\n\n\t\tConcurrentHashMap<String, Result> acksList = new ConcurrentHashMap<>();\n\t\tConcurrentHashMap<String, Result> failedAcksList = new ConcurrentHashMap<>();\n\n\t\tCountDownLatch awaitSignal = new CountDownLatch((NUM_NOTARIES + NUM_FAULTS) / 2 + 1);\n\n\t\tfor (String notaryID : notaryServers.keySet()) {\n\t\t\tservice.execute(() -> {\n\t\t\t\ttry {\n\n\t\t\t\t\tNotaryInterface notary = notaryServers.get(notaryID);\n\n\t\t\t\t\t//anti-spam mechanism\n\t\t\t\t\tString nonceToNotary = cryptoUtils.generateCNonce();\n\t\t\t\t\tMessageDigest md = MessageDigest.getInstance(\"SHA-256\");\n\t\t\t\t\tString hashed = \"\";\n\t\t\t\t\tString data = \"\";\n\t\t\t\t\twhile (!Pattern.matches(\"000.*\", hashed)) {\n\t\t\t\t\t\tnonceToNotary = ((new BigInteger(nonceToNotary)).add(BigInteger.ONE))\n\t\t\t\t\t\t\t.toString();\n\t\t\t\t\t\tdata = notary.getNonce(this.id) + nonceToNotary + this.id + userId + goodId;\n\t\t\t\t\t\tbyte[] messageDigest = md.digest(data.getBytes());\n\t\t\t\t\t\thashed = cryptoUtils.byteArrayToHex(messageDigest);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (verbose) {\n\t\t\t\t\t\tSystem.out.println(\"--> hash generated: \" + nonceToNotary);\n\t\t\t\t\t}\n\n\t\t\t\t\t//send signed message to notary\n\t\t\t\t\tTransfer transfer = notary\n\t\t\t\t\t\t.transferGood(this.getId(), userId, goodId, writeTimeStamp, nonceToNotary,\n\t\t\t\t\t\t\tcryptoUtils.signMessage(data));\n\n\t\t\t\t\t//verify signature with CC\n\t\t\t\t\tString transferVerify =\n\t\t\t\t\t\ttransfer.getId() + transfer.getBuyerId() + transfer.getSellerId() + transfer\n\t\t\t\t\t\t\t.getGood().getGoodId();\n\t\t\t\t\tif (verifyCC) {\n\t\t\t\t\t\tif (!cryptoUtils.verifySignature(NOTARY_CC, transferVerify,\n\t\t\t\t\t\t\ttransfer.getNotarySignature(),\n\t\t\t\t\t\t\tnotaryServers.get(notaryID).getCertificateCC())) {\n\t\t\t\t\t\t\tthrow new InvalidSignatureException(NOTARY_CC);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (transfer.getGood().getWriteTimestamp() == writeTimeStamp) {\n\t\t\t\t\t\tString toSign = toVerify + transfer.hashCode();\n\t\t\t\t\t\tResult resultClient = new Result(transfer, writeTimeStamp,\n\t\t\t\t\t\t\tcryptoUtils.signMessage(toSign));\n\n\t\t\t\t\t\tacksList.put(notaryID, resultClient);\n\t\t\t\t\t\tawaitSignal.countDown();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new TransferException(\"ERROR: Timestamp does not match\");\n\t\t\t\t\t}\n\n\t\t\t\t\tif (verbose) {\n\t\t\t\t\t\tSystem.out.println(\"--> CC Signature verified! Notary confirmed buy good\");\n\t\t\t\t\t}\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\trebind();\n\t\t\t\t} catch (InvalidSignatureException | TransferException e) {\n\t\t\t\t\tSystem.err.println(e.getMessage());\n\t\t\t\t\tfailedAcksList.put(notaryID,\n\t\t\t\t\t\tnew Result(new Boolean(false), cryptoUtils.signMessage(\"false\")));\n\t\t\t\t\tawaitSignal.countDown();\n\t\t\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\t\t\tfailedAcksList.put(notaryID,\n\t\t\t\t\t\tnew Result(new Boolean(false), cryptoUtils.signMessage(\"false\")));\n\t\t\t\t\tawaitSignal.countDown();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tawaitSignal.await(TIMEOUT, TimeUnit.SECONDS);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t\tthrow new TransferException(\"ERROR: quorum waiting failed\");\n\t\t}\n\n\t\t//checks if enough notaries respond\n\t\tif (acksList.size() + failedAcksList.size() > (NUM_NOTARIES + NUM_FAULTS) / 2) {\n\t\t\tSystem.out.println(\"--> Quorum reached\");\n\t\t\tif (verbose) {\n\t\t\t\tSystem.out.println(\"--> Removing good \" + goodId + \" from my list\");\n\t\t\t}\n\t\t\tif (acksList.size() > failedAcksList.size()) {\n\t\t\t\tgoods.remove(goodId);\n\t\t\t\treturn (Result) acksList.values().toArray()[0];\n\t\t\t} else {\n\t\t\t\tthrow new TransferException(\"ERROR: transfer not possible\");\n\t\t\t}\n\t\t} else {\n\t\t\tSystem.out.println(\"--> Quorum not reached... :(\");\n\t\t\tthrow new TransferException(\"ERROR: quorum not reached\");\n\t\t}\n\t}", "void confirmRealWorldTrade(IUserAccount user, ITransaction trans);", "public void send(String user, String msgToSend, String userFrom){\n\t\ttry{\n\t\t\tif(sock.isConnected()){\n\t\t\t\tOutputStream sout = sock.getOutputStream();\n\t\t\t\tByteArrayOutputStream out = new ByteArrayOutputStream();\n\t\t\t\tCryptoHelper ch = new CryptoHelper();\n\t\t\t\t\n\t\t\t\t// send KAS{Key_Req+Username}\n\t\t\t\tHashHelper.WriteInt(out, KEY_REQ);\n\t\t\t\tout.write(user.getBytes());\n\t\t\t\tbyte[] msg = ch.symEncrypt(symK, out.toByteArray());\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(out, msg.length);\n\t\t\t\tout.write(msg);\n\t\t\t\tsout.write(out.toByteArray());\n\t\t\t\t\n\t\t\t\t// receive KAS{B,ttB,KAB}\n\t\t\t\tDataInputStream dis = new DataInputStream(sock.getInputStream());\n\t\t\t\t\n\t\t\t\t// read the message encrypted with the symmetric key\n\t\t\t\tbyte[] msgiv = new byte[HashHelper.ReadInt(dis)];\n\t\t\t\tdis.readFully(msgiv);\n\t\t\t\t\n\t\t\t\t// Decrypt the message\n\t\t\t\tByteArrayInputStream bais = new ByteArrayInputStream(msgiv);\n\t\t\t\tDataInputStream dis2 = new DataInputStream(bais);\n\t\t\t\tbyte[] iv = new byte[HashHelper.ReadInt(dis2)];\n\t\t\t\tdis2.readFully(iv);\n\t\t\t\tbyte[] msg_en = new byte[HashHelper.ReadInt(dis2)]; \n\t\t\t\tdis2.readFully(msg_en);\n\t\t\t\tbyte[] msg1 = ch.symDecrypt(symK, iv, msg_en);\n\n\t\t\t\t// Separate B,ttB and KAB\n\t\t\t\tByteArrayInputStream bin = new ByteArrayInputStream(msg1);\n\t\t\t\tObjectInputStream deserializer = new ObjectInputStream(bin);\n\t\t\t\tString userTo = (String) deserializer.readObject();\n\t\t\t\tInetAddress sockB = (InetAddress) deserializer.readObject();\n\t\t\t\tint portB = deserializer.readInt();\n\t\t\t\tint len = deserializer.readInt();\n\t\t\t\tbyte[] ttB = new byte[len];\n\t\t\t\tdeserializer.readFully(ttB);\n\t\t\t\tSecretKey KAB = (SecretKey) deserializer.readObject();\n\t\t\t\t\n\t\t\t\t// Connecting to the intended online user\n\t\t\t\tSocket socB = new Socket(sockB, portB);\n\t\t\t\tdis = new DataInputStream(socB.getInputStream());\n\t\t\t\tsout = socB.getOutputStream();\n\t\t\t\t\n\t\t\t\t// create Diffie-Hellman part g^a modp\n\t\t\t\tDHHelper dh = new DHHelper();\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tObjectOutputStream serializer = new ObjectOutputStream(out);\n\t\t\t\tDHParameterSpec spec = dh.getParameterSpec();\n\t\t\t\tserializer.writeObject(spec.getP());\n\t\t\t\tserializer.writeObject(spec.getG());\n\t\t\t\tserializer.writeInt(spec.getL());\n\t\t\t\tserializer.writeObject(dh.getPublicKey());\n\t\t\t\tserializer.flush();\n\t\t\t\tbyte[] gamodp = out.toByteArray();\n\t\t\t\t\n\t\t\t\t// Creating KAB{chat_msg,A,N1} to be sent over to the other user\n\t\t\t\tSecureRandom rand = new SecureRandom();\n\t\t\t\tbyte[] N1 = new byte[32];\n\t\t\t\trand.nextBytes(N1);\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tout.write(MESSAGE);\n\t\t\t\tbyte[] userFromB = userFrom.getBytes();\n\t\t\t\tHashHelper.WriteInt(out, userFromB.length);\n\t\t\t\tout.write(userFromB);\n\t\t\t\tout.write(N1);\n\t\t\t\tbyte[] encMsg = ch.symEncrypt(KAB, out.toByteArray());\n\t\t\t\t\n\t\t\t\t// Send ttB, g^a modp and KAB{chat_msg,A,N1} to the intended receiver\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(out, ttB.length);\n\t\t\t\tout.write(ttB);\n\t\t\t\tHashHelper.WriteInt(out, gamodp.length);\n\t\t\t\tout.write(gamodp);\n\t\t\t\tHashHelper.WriteInt(out, encMsg.length);\n\t\t\t\tout.write(encMsg);\n\t\t\t\tsout.write(out.toByteArray());\n\t\t\t\t\n\t\t\t\t// Receiving g^b modp and KAB{N1,N2}\n\t\t\t\t// Read Diffie-Hellman part of client B\n\t\t\t\tdeserializer = new ObjectInputStream(dis);\n\t\t\t\tPublicKey pkB = (PublicKey) deserializer.readObject();\n\t\t\t\t\n\t\t\t\t// Create key KABN\n\t\t\t\tSecretKey KABN = dh.doFinal(pkB, \"AES\");\n\t\t\t\t\n\t\t\t\t// Receive KAB{N1,N2}\n\t\t\t\tlen = HashHelper.ReadInt(dis);\n\t\t\t\tmsgiv = new byte[len];\n\t\t\t\tdis.readFully(msgiv);\n\t\t\t\t\n\t\t\t\t// Decrypt the message\n\t\t\t\tbais = new ByteArrayInputStream(msgiv);\n\t\t\t\tdis2 = new DataInputStream(bais);\n\t\t\t\tiv = new byte[HashHelper.ReadInt(dis2)];\n\t\t\t\tdis2.readFully(iv);\n\t\t\t\tmsg_en = new byte[HashHelper.ReadInt(dis2)]; \n\t\t\t\tdis2.readFully(msg_en);\n\t\t\t\tmsg1 = ch.symDecrypt(KAB, iv, msg_en);\n\t\t\t\t\n\t\t\t\tbyte[] N1_received = Arrays.copyOfRange(msg1, 0, 32);\n\t\t\t\tbyte[] N2 = Arrays.copyOfRange(msg1, 32, msg1.length);\n\t\t\t\t\n\t\t\t\t// Validate N1\n\t\t\t\tif(!Arrays.equals(N1, N1_received)){\n\t\t\t\t\tSystem.out.println(\"N1 nonce is not equal...\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Send KAB{N2} to B\n\t\t\t\tbyte[] N2enc = ch.symEncrypt(KAB, N2); // Encrypting N2 with the symmetric key KAB\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(out, N2enc.length);\n\t\t\t\tout.write(N2enc);\n\t\t\t\tsout.write(out.toByteArray());\n\t\t\t\t\n\t\t\t\t// For sending the message to B - KABN{message,HMAC}\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tserializer = new ObjectOutputStream(out);\n\n\t\t\t\t// Encrypting the message to be sent to B\n\t\t\t\tserializer.writeObject(msgToSend);\n\t\t\t\tserializer.flush();\n\n\t\t\t\t// Create HMAC\n\t\t\t\tMessageDigest msgDigest = MessageDigest.getInstance(\"SHA-256\");\n\t\t\t\tbyte[] mac = msgDigest.digest(msgToSend.getBytes());\n\t\t\t\tHashHelper.WriteInt(out, mac.length);\n\t\t\t\tout.write(mac);\n\t\t\t\tmsg_en = ch.symEncrypt(KABN, out.toByteArray());\n\t\t\t\t\n\t\t\t\t// Send KABN{message,HMAC}\n\t\t\t\tout = new ByteArrayOutputStream(); \n\t\t\t\tHashHelper.WriteInt(out, msg_en.length);\n\t\t\t\tout.write(msg_en);\n\t\t\t\tsout.write(out.toByteArray());\n\t\t\t\n\t\t\t\tSystem.out.println(\"Message sent...\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(\"Connection lost...\");\n\t\t\t}\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void handleTransaction() throws Exception {\r\n\t\tString receiver;\r\n\t\tString amount;\r\n\t\tMessage sendTransaction = new Message().addData(\"task\", \"transaction\").addData(\"message\", \"do_transaction\");\r\n\t\tMessage response;\r\n\r\n\t\tthis.connectionData.getTerminal().write(\"enter receiver\");\r\n\t\treceiver = this.connectionData.getTerminal().read();\r\n\r\n\t\t// tries until a amount is typed that's between 1 and 10 (inclusive)\r\n\t\tdo {\r\n\t\t\tthis.connectionData.getTerminal().write(\"enter amount (1-10)\");\r\n\t\t\tamount = this.connectionData.getTerminal().read();\r\n\t\t} while (!amount.matches(\"[0-9]|10\"));\r\n\r\n\t\t// does the transaction\r\n\t\tsendTransaction.addData(\"receiver\", this.connectionData.getAes().encode(receiver)).addData(\"amount\",\r\n\t\t\t\tthis.connectionData.getAes().encode(amount));\r\n\r\n\t\tthis.connectionData.getConnection().write(sendTransaction);\r\n\r\n\t\tresponse = this.connectionData.getConnection().read();\r\n\t\tif (response.getData(\"message\").equals(\"success\")) {\r\n\t\t\tthis.connectionData.getTerminal().write(\"transaction done\");\r\n\t\t} else {\r\n\t\t\tthis.connectionData.getTerminal().write(\"transaction failed. entered correct username?\");\r\n\t\t}\r\n\t}", "@Test\n public void TxHandlerTestSecond() throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {\n // generate key pairs, simulate initial tx from scrooge to alice\n System.out.println(\"-----------------------------------------------------------------\");\n System.out.println(\"Test if the TxHandler can reject the double spending\");\n KeyPair pkScrooge = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkAlice = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkBob = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n\n Transaction tx0 = new Transaction();\n tx0.addOutput(25, pkScrooge.getPublic());\n\n byte[] initHash = null;\n tx0.addInput(initHash, 0);\n tx0.signTx(pkScrooge.getPrivate(), 0);\n\n UTXOPool utxoPool = new UTXOPool();\n UTXO utxo = new UTXO(tx0.getHash(), 0);\n utxoPool.addUTXO(utxo, tx0.getOutput(0));\n\n // tx 1\n Transaction tx1 = new Transaction();\n tx1.addInput(tx0.getHash(), 0);\n tx1.addOutput(25, pkAlice.getPublic());\n tx1.signTx(pkScrooge.getPrivate(), 0);\n\n TxHandler txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx1) returns: \" + txHandler.isValidTx(tx1));\n assertTrue(\"tx1:One valid transaction\", txHandler.handleTxs(new Transaction[]{tx1}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx1: one UTXO's created.\", utxoPool.getAllUTXO().size() == 1);\n\n // tx 2:Scrooge --> Bob 20coins [*Double-spending*]\n Transaction tx2 = new Transaction();\n tx2.addInput(tx0.getHash(), 0);\n tx2.addOutput(25, pkBob.getPublic());\n tx2.signTx(pkScrooge.getPrivate(), 0);\n\n txHandler = new TxHandler(utxoPool);\n System.out.println(\"txHandler.isValidTx(tx2) returns: \" + txHandler.isValidTx(tx2));\n assertTrue(\"tx2:no valid transaction\", txHandler.handleTxs(new Transaction[]{tx2}).length == 0);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx2:no UTXO's created.\", utxoPool.getAllUTXO().size() == 1);\n\n// System.out.println(\"tx1.hashCode returns: \" + tx1.hashCode());\n// System.out.println(\"tx2.hashCode returns: \" + tx2.hashCode());\n\n }", "private static String signSecondTime(String transactionString)\n {\n Transaction spendTx = new Transaction(params, hexStringToByteArray(transactionString));\n\n // Get the input chunks\n Script inputScript = spendTx.getInput(0).getScriptSig();\n List<ScriptChunk> scriptChunks = inputScript.getChunks();\n\n // Create a list of all signatures. Start by extracting the existing ones from the list of script schunks.\n // The last signature in the script chunk list is the redeemScript\n List<TransactionSignature> signatureList = new ArrayList<TransactionSignature>();\n Iterator<ScriptChunk> iterator = scriptChunks.iterator();\n Script redeemScript = null;\n\n while (iterator.hasNext())\n {\n ScriptChunk chunk = iterator.next();\n\n if (iterator.hasNext() && chunk.opcode != 0)\n {\n TransactionSignature transactionSignarture = TransactionSignature.decodeFromBitcoin(chunk.data, false);\n signatureList.add(transactionSignarture);\n } else\n {\n redeemScript = new Script(chunk.data);\n }\n }\n\n // Create the sighash using the redeem script\n Sha256Hash sighash = spendTx.hashForSignature(0, redeemScript, Transaction.SigHash.ALL, false);\n ECKey.ECDSASignature secondSignature;\n\n // Take out the key and sign the signhash\n //ECKey key2 = createKeyFromSha256Passphrase(\"Super secret key 2\");\n ECKey key2 = ECKey.fromPrivate(new BigInteger(\"68123968917867656952640885027449260190826636504009580537802764798766700329220\"));\n// ECKey key2 = ECKey.fromPrivate(new BigInteger(\"64102401986961187973900162212679081334328198710146539384491794427145725009072\"));\n secondSignature = key2.sign(sighash);\n\n // Add the second signature to the signature list\n TransactionSignature transactionSignarture = new TransactionSignature(secondSignature, Transaction.SigHash.ALL, false);\n signatureList.add(transactionSignarture);\n\n // Rebuild p2sh multisig input script\n inputScript = ScriptBuilder.createP2SHMultiSigInputScript(signatureList, redeemScript);\n spendTx.getInput(0).setScriptSig(inputScript);\n\n //System.out.println(byteArrayToHex(spendTx.bitcoinSerialize()));\n\n return byteArrayToHex(spendTx.bitcoinSerialize());\n }", "@Override\n public void onSuccess(CognitoUserSession userSession, CognitoDevice newDevice) {\n Handler.Callback bayunAuthSuccess = msg -> {\n String bucketName = \"bayun-test-\" + companyName;\n bucketName = bucketName.toLowerCase();\n BayunApplication.tinyDB.putString(Constants.S3_BUCKET_NAME, bucketName);\n\n BayunApplication.tinyDB\n .putString(Constants.SHARED_PREFERENCES_IS_BAYUN_LOGGED_IN,\n Constants.YES);\n authenticationHandler.onSuccess(userSession, newDevice);\n return false;\n };\n\n // Bayun login failure Callback\n Handler.Callback bayunAuthFailure = msg -> {\n Exception exception = new Exception(msg.getData().getString(Constants.ERROR));\n user.signOut();\n authenticationHandler.onFailure(exception);\n return false;\n };\n\n // Bayun login authorizeEmployeeCallback Callback\n Handler.Callback authorizeEmployeeCallback = msg -> {\n String employeePublicKey = msg.getData().getString(Constants.EMPLOYEE_PUBLICKEY);\n Exception exception = new Exception(\"Employee Authorization is Pending\");\n authenticationHandler.onFailure(exception);\n return false;\n };\n\n // login with Bayun\n BayunApplication.bayunCore.loginWithPassword(activity,companyName,username,\n password,false,authorizeEmployeeCallback,null,null,bayunAuthSuccess, bayunAuthFailure);\n }", "private byte[] sendServerCoded(byte[] message) { \n\t\tbyte[] toPayload = SecureMethods.preparePayload(username.getBytes(), message, counter, sessionKey, simMode);\n\t\tbyte[] fromPayload = sendServer(toPayload, false);\n\n\t\tbyte[] response = new byte[0];\n\t\tif (checkError(fromPayload)) {\n\t\t\tresponse = \"error\".getBytes();\n\t\t} else {\n\t\t\tresponse = SecureMethods.processPayload(\"SecretServer\".getBytes(), fromPayload, counter+1, sessionKey, simMode);\n\t\t}\n\t\tcounter = counter + 2;\n\t\treturn response;\n\t}", "@Override\n public void onSuccess() {\n Handler.Callback bayunAuthSuccess = msg -> {\n confirmHandler.onSuccess();\n return false;\n };\n\n\n // Bayun Registration failure Callback\n Handler.Callback bayunAuthFailure = msg -> {\n Exception exception = new Exception(msg.getData().getString(Constants.ERROR));\n confirmHandler.onFailure(exception);\n return false;\n };\n\n // Bayun Registration authorizeEmployeeCallback Callback\n Handler.Callback authorizeEmployeeCallback = msg -> {\n String employeePublicKey = msg.getData().getString(Constants.EMPLOYEE_PUBLICKEY);\n Exception exception = new Exception(\"Employee Authorization is Pending\");\n confirmHandler.onFailure(exception);\n return false;\n };\n\n // Registration with Bayun\n BasicBayunCredentials basicBayunCredentials = new BasicBayunCredentials\n (appId, companyName, user.getUserId(), signUpPassword.toCharArray(),\n appSecret, applicationKeySalt);\n\n\n if(signUpIsRegisterWithPwd){\n BayunApplication.bayunCore.registerEmployeeWithPassword\n (activity,companyName,user.getUserId(),signUpPassword, authorizeEmployeeCallback, bayunAuthSuccess, bayunAuthFailure);\n }else {\n BayunApplication.bayunCore.registerEmployeeWithoutPassword(activity,companyName,user.getUserId()\n ,signUpEmail,false, authorizeEmployeeCallback,\n null,null,null, bayunAuthSuccess, bayunAuthFailure);\n\n }\n// BayunApplication.bayunCore.registerEmployeeWithPassword\n// (activity,companyName,user.getUserId(),signUpPassword, authorizeEmployeeCallback, bayunAuthSuccess, bayunAuthFailure);\n\n\n }", "@Override\n public void a(int n2, Account account, ahp ahp2) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n parcel.writeInt(n2);\n if (account != null) {\n parcel.writeInt(1);\n account.writeToParcel(parcel, 0);\n } else {\n parcel.writeInt(0);\n }\n IBinder iBinder = ahp2 != null ? ahp2.asBinder() : null;\n parcel.writeStrongBinder(iBinder);\n this.a.transact(8, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "@Override\n public void a(boolean bl2) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n int n2 = 0;\n if (bl2) {\n n2 = 1;\n }\n parcel.writeInt(n2);\n this.a.transact(4, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "@Override\n public void process(Message message) {\n short opCode = message.getOpcode();\n switch (opCode){\n // REGISTER - implement after\n case 1:\n REGISTERmessage regMsg = (REGISTERmessage) message;\n // if the user is not registered - put it in the map between name and password - the\n // registered map, If he is registered - returned an error - for opcode 1 which is the\n // opcode of REGISTER\n if(!networkDatabase.isRegistered(regMsg.getName())){\n networkDatabase.registerUser(regMsg.getName(), regMsg.getPassword());\n connections.send(this.connectionId, new ACKmessage((short)1));\n }\n else{\n connections.send(this.connectionId, new ERRORmessage((short) 1));\n }\n\n\n break;\n //********************************************************************************\n // LOGING\n case 2:\n LOGINmessage loginMsg = (LOGINmessage) message;\n // checks\n // 1.Is he in registered users - if he's not can't connect\n // 2.Is he already connected - checked by id - if he is can't connect\n // 3.Is the password correspond to the registered password\n // If checks are ok - put connection Id in the loggedInUsers map\n //check\n if(networkDatabase.isRegistered(loginMsg.getName()) &&\n !networkDatabase.isLoggedIn(this.connectionId) &&\n networkDatabase.isPasswordCorrect(loginMsg.getName(), loginMsg.getPassword())){\n networkDatabase.logInUser(this.connectionId, loginMsg.getName());\n }\n else{\n connections.send(this.connectionId, new ERRORmessage((short) 2));\n }\n break;\n //********************************************************************************\n // LOGOUT\n case 3:\n LOGOUTmessage logoutMsg = (LOGOUTmessage) message;\n // Is the user logged in?\n if(networkDatabase.isLoggedIn(this.connectionId)) {\n connections.send(this.connectionId, new ACKmessage((short) 3));\n // remove from map by connectionId\n networkDatabase.logoutUser(this.connectionId);\n // Acknowledge the user that the disconnec was done\n connections.disconnect(this.connectionId);\n\n\n }\n else{\n connections.send(this.connectionId, new ERRORmessage((short) 3));\n }\n break;\n //********************************************************************************\n // I think that what I did here is wrong - its not suppose to be here - it suppose to\n // be in the server implementation - the data -\n // FOLLOW\n case 4:\n // If all users failed - Error\n FOLLOWmessage followMsg = (FOLLOWmessage) message;\n\n // String to put in Ack message\n String usersSucceedsString = new String();\n // number of succeeded actionss\n short numSucceeds = 0;\n\n\n if(networkDatabase.isLoggedIn(this.connectionId)) {\n // List to follow/unfollow\n ArrayList<String> userTodoList = convertStringToUserList(followMsg.getUserNameList());\n // if the byte of follow is for following\n if (followMsg.getFollowByte()== 0) {\n // go over the users in list\n for(String userToAdd: userTodoList){\n // If the user is not already following them\n if(!networkDatabase.doesFollow(this.connectionId, userToAdd)) {\n // add the user to the list of users the user is following\n networkDatabase.addFollowing(this.connectionId, userToAdd);\n\n // add zero byte in the end\n usersSucceedsString = usersSucceedsString.concat(userToAdd + \"\\0\");\n // increase the counter of operations succeeded by 1\n numSucceeds++;\n }\n }\n }\n // If the byte of follow is for unfollow\n else{\n // go over userss in list\n for(String userToRemove: userTodoList){\n // If the user is following them\n if(networkDatabase.doesFollow(this.connectionId, userToRemove)) {\n // remove it from the list of followings\n networkDatabase.unfollow(this.connectionId, userToRemove);\n // add zero bytes in the end\n usersSucceedsString.concat(userToRemove + \"\\0\");\n // increase the counter of operations succeeded by 1\n numSucceeds++;\n }\n }\n }\n // add zero byte to the end of the string\n// usersSucceedsString.concat(\"0\");\n\n // If number of operations succeeded is 0 than no operation succeeded - results in an Error\n if(numSucceeds == 0){\n connections.send(this.connectionId, new ERRORmessage((short) 4));\n }\n // If at leat one operation succeeded\n else{\n // There should be optional field in this acknowledge which\n // I am not sure how to implement yet\n connections.send(this.connectionId, new ACKmessage(followMsg.getFollowByte(), numSucceeds, usersSucceedsString));\n }\n }\n // user is not logged in\n else{\n connections.send(this.connectionId, new ERRORmessage((short) 4));\n }\n\n break;\n //********************************************************************************\n // POST\n case 5:\n POSTmessage postMsg = (POSTmessage) message;\n String post = postMsg.getContents();\n UserList userFollows = networkDatabase.getUserByConnId(this.connectionId).getFollowers();\n String[] splitByShtrudle = postMsg.getContents().split(\"@\");\n\n String postingUser = networkDatabase.getUserByConnId(this.connectionId).getName();\n String postConent = postMsg.getContents();\n String username;\n // find all users mentioned with '@'\n boolean pastFirst = false;\n for(String oneline: splitByShtrudle){\n if(pastFirst) {\n if (oneline.indexOf(' ') == -1) {\n username = oneline;\n } else {\n username = oneline.substring(0, oneline.indexOf(' '));\n }\n connections.send(networkDatabase.getConnIdByName(username).getConnId(),\n new NOTIFICATIONmessage('1', postingUser, postConent));\n }\n pastFirst = true;\n }\n networkDatabase.addMessage(networkDatabase.getUserByConnId(this.connectionId).getName(), postMsg);\n break;\n //********************************************************************************\n // PM\n // problem: if there is more than one user with the name? In the protocol\n // specification there\n case 6:\n PMmessage pmMsg = (PMmessage) message;\n String userToSend = pmMsg.getUserName();\n String sendingUser = networkDatabase.getUserByConnId(this.connectionId).getName();\n String pmContent = pmMsg.getContent();\n // need to send notification\n// connections.send(Message.Notification)\n int toSendConnId = networkDatabase.getConnIdByName(userToSend).getConnId();\n connections.send(toSendConnId, new NOTIFICATIONmessage('0', sendingUser, pmContent));\n networkDatabase.addMessage(userToSend, pmMsg);\n break;\n //********************************************************************************\n // USERLIST\n case 7:\n //check\n System.out.println(\"got into user list in protocol\");\n USERLISTmessage userLstMsg = (USERLISTmessage) message;\n String userlistLine = \"\";\n if(networkDatabase.isLoggedIn(this.connectionId)){\n //check\n System.out.println(\"user is logged in and trying to get user list\");\n if(networkDatabase.getFollowings(this.connectionId) != null) {\n for (User current : networkDatabase.getFollowings(this.connectionId).getUserlist()) {\n //check\n System.out.println(\"going over the ones he follows\");\n userlistLine.concat(\" \" + current.getName());\n }\n }\n //check\n System.out.println(\"sending acknowledge with the userlist it follows \" + networkDatabase.getNumFollowings(this.connectionId));\n connections.send(connectionId, new ACKmessage((byte)networkDatabase.getNumFollowings(this.connectionId),\n userlistLine ));\n }\n else\n connections.send(this.connectionId, new ERRORmessage((short) 7));\n\n break;\n //********************************************************************************\n // STAT\n case 8:\n STATmessage statMsg = (STATmessage) message;\n if(networkDatabase.isLoggedIn(this.connectionId)){\n // I am not sure that this conversion is fine - and I did it few times\n short numOfFollowing = (short)networkDatabase.getFollowings(this.connectionId).size();\n short numOfPosts = (short)networkDatabase.getPostsByConnId(this.connectionId).size();\n connections.send(this.connectionId, new ACKmessage(numOfPosts,numOfFollowing));\n }\n else\n connections.send(this.connectionId, new ERRORmessage((short) 7));\n break;\n //********************************************************************************\n // I think that notification is not dealt by the protocol it is only sent after other messages\n // NOTIFICATION\n case 9:\n break;\n //********************************************************************************\n // ****************special treat************************************************\n // I think that acknowledge is like ERROR message - probably will be deleted in the future\n // ACK\n case 10:\n //for checks purpuses\n //checks\n System.out.println(\"I am inside acknowledge....\");\n connections.send(this.connectionId, new ACKmessage((short) 1));\n\n break;\n // I think that the server doesn't get error message - it only sends them\n // for now I leave this here - probably will be deleted in the future\n // ERROR\n case 11:\n break;\n }\n }", "@Test\n public void testHandleTxs() {\n\n // Creates 100 coins to Alice\n Transaction createCoinTx = new Transaction();\n createCoinTx.addOutput(100, kpAlice.getPublic());\n createCoinTx.finalize();\n // Output of createCoinTx is put in UTXO pool\n UTXOPool utxoPool = new UTXOPool();\n UTXO utxo = new UTXO(createCoinTx.getHash(), 0);\n utxoPool.addUTXO(utxo, createCoinTx.getOutput(0));\n TxHandler txHandler = new TxHandler(utxoPool);\n\n // Alice transfers 10 coins to Bob, 20 to Cal\n Transaction tx1 = new Transaction();\n tx1.addInput(createCoinTx.getHash(), 0);\n tx1.addOutput(10, kpBob.getPublic());\n tx1.addOutput(20, kpCal.getPublic());\n\n // Sign for tx1\n byte[] sig1 = null;\n try {\n Signature sig = Signature.getInstance(\"SHA256withRSA\");\n sig.initSign(kpAlice.getPrivate());\n sig.update(tx1.getRawDataToSign(0));\n sig1 = sig.sign();\n } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {\n e.printStackTrace();\n }\n tx1.getInput(0).addSignature(sig1);\n tx1.finalize();\n\n // Cal transfers 5 coins to Bob, Bob transfers 2 coins to Alice\n Transaction tx2 = new Transaction();\n tx2.addInput(tx1.getHash(), 0); // index 0 refers to output 1 of tx1\n tx2.addInput(tx1.getHash(), 1); // index 1 refers to output 1 of tx1\n tx2.addOutput(2, kpAlice.getPublic());\n tx2.addOutput(5, kpBob.getPublic());\n\n // Sign for tx2\n byte[] sig2 = null;\n try {\n Signature sig = Signature.getInstance(\"SHA256withRSA\");\n sig.initSign(kpBob.getPrivate());\n sig.update(tx2.getRawDataToSign(0));\n sig2 = sig.sign();\n } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {\n e.printStackTrace();\n }\n tx2.getInput(0).addSignature(sig2);\n\n byte[] sig3 = null;\n try {\n Signature sig = Signature.getInstance(\"SHA256withRSA\");\n sig.initSign(kpCal.getPrivate());\n sig.update(tx2.getRawDataToSign(1));\n sig3 = sig.sign();\n } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {\n e.printStackTrace();\n }\n tx2.getInput(1).addSignature(sig3);\n tx2.finalize();\n\n // Alice transfers 3 coins to Cal\n Transaction tx3 = new Transaction();\n tx3.addInput(tx2.getHash(), 0);\n tx3.addOutput(3, kpCal.getPublic());\n\n // Sign for tx3\n byte[] sig4 = null;\n try {\n Signature sig = Signature.getInstance(\"SHA256withRSA\");\n sig.initSign(kpAlice.getPrivate());\n sig.update(tx3.getRawDataToSign(0));\n sig4 = sig.sign();\n } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {\n e.printStackTrace();\n }\n tx3.getInput(0).addSignature(sig4);\n tx3.finalize();\n\n Transaction[] acceptedTx = txHandler.handleTxs(new Transaction[] {tx1, tx2, tx3});\n // tx1, tx2 supposed to be valid, tx3 supposed to be invalid\n assertEquals(acceptedTx.length, 2);\n // assertFalse(txHandler.isValidTx(tx3));\n }", "void sendTransaction(IUserAccount target, ITransaction trans, IUserAccount user);", "@Override\n public void execute(OctopusPacketRequest request, OctopusPacketResponse response) throws Exception {\n OctopusRawMessage rawMessage = request.getMessage().getRawMessage();\n Common.LoginRequestMsg loginRequest = Common.LoginRequestMsg.parseFrom(rawMessage.getBody());\n int userInGatewayId = request.getMessage().getDataId();\n int gatewayServerId = request.getMessage().getSourceServerId();\n String openId = loginRequest.getOpenId();\n String code = loginRequest.getCode();\n int type = loginRequest.getType();\n UserLoginRetInfo loginRetInfo = null;\n try {\n loginRetInfo = userService.loginByOpenId(type, openId, code);\n } catch (UserAndPasswordIsNotRightException ex) {\n anyClientManager.sendErrorMessageToUser(userInGatewayId, gatewayServerId, Integer.parseInt(ErrorCodes\n .userAndPasswordIncorrect));\n return;\n }\n if (loginRetInfo != null) {\n UserLocationInfo userLocationInfo = new UserLocationInfo()\n .setUserId(loginRetInfo.getId()).setUserIdInGateway(request.getMessage().getDataId())\n .setUserName(loginRetInfo.getName())\n .setOpenId(loginRetInfo.getOpenId())\n .setServerId(request.getMessage().getSourceServerId());\n UserCacheInfo userCacheInfo = new UserCacheInfo();\n BeanUtils.copyProperties(loginRetInfo.getUserEntity(), userCacheInfo);\n userLocationService.cacheUserLocation(userLocationInfo);\n userCacheService.cacheUserInfo(userCacheInfo);\n String roomCheckId = roomDomainService.loadUnEndRoomCheckId(loginRetInfo.getId());\n //发送用户成功消息\n Common.LoginResponseMsg.Builder builder = Common.LoginResponseMsg.newBuilder();\n builder.setId(loginRetInfo.getId())\n .setName(loginRetInfo.getName())\n .setOpenId(loginRetInfo.getOpenId())\n .setUuid(loginRetInfo.getUuid())\n .setAvatar(loginRetInfo.getAvatar())\n .setSex(loginRetInfo.getSex())\n .setRoomCheckId(loginRetInfo.getRoomCheckId())\n .setGold(loginRetInfo.getGold())\n .setLoginToken(loginRetInfo.getLoginToken())\n .setIp(loginRetInfo.getIp());\n if (roomCheckId != null) {\n builder.setRoomCheckId(roomCheckId);\n }\n Common.LoginResponseMsg loginResponseMsg = builder.build();\n// OctopusPacketMessage toUserPacketMessage = MessageFactory.createToUserPacketMessage(\n// request.getMessage().getDataId(),\n// serverConfigProperties.getServerId(),\n// request.getMessage().getSourceServerId(),\n// Commands.loginRet,\n// loginResponseMsg.toByteArray());\n //anyClientManager.forwardMessageThroughInnerGateway(toUserPacketMessage);\n anyClientManager.sendMessageToUser(request.getMessage().getDataId(), request.getMessage()\n .getSourceServerId(), Commands.loginRet, loginResponseMsg.toByteArray());\n\n }\n// OctopusPacketMessage toSystemMessage = MessageFactory.createToSystemPacketJsonBodyMessage(-1,\n// serverConfigProperties\n// .getServerId(), Commands.loginSuccessEvent, new LoginSuccessEventInfo().setUserIdInGateway(request\n// .getMessage()\n// .getDataId()).setGatewayServerId(request.getMessage().getSourceServerId()).setUserName(openId));\n //anyClientManager.forwardMessageThroughInnerGateway(toSystemMessage);\n }", "private void internalAuthenticate(APDU apdu, byte[] buffer) \r\n \t //@ requires current_applet(this) &*& [1/2]valid() &*& APDU(apdu, buffer) &*& array_slice(buffer, 0, buffer.length, _);\r\n \t //@ ensures current_applet(this) &*& [1/2]valid() &*& APDU(apdu, buffer) &*& array_slice(buffer, 0, buffer.length, _);\r\n\t{\r\n\t\t// check P1 and P2\r\n\t\tif ((buffer[ISO7816.OFFSET_P1] != ALG_SHA1_PKCS1) || buffer[ISO7816.OFFSET_P2] != BASIC)\r\n\t\t\tISOException.throwIt(ISO7816.SW_WRONG_P1P2);\r\n\t\t// receive the data that needs to be signed\r\n\t\tshort byteRead = apdu.setIncomingAndReceive();\r\n\t\t// check Lc\r\n\t\tshort lc = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF);\r\n\t\t// we do not support Lc=0x97, only Lc=0x16\r\n\t\tif ((lc == 0x97) || (byteRead == 0x97))\r\n\t\t\tISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED);\r\n\t\tif ((lc != 0x16) || (byteRead != 0x16))\r\n\t\t\tISOException.throwIt(ISO7816.SW_WRONG_LENGTH);\r\n\t\t// the first data byte must be \"94\" and the second byte is the length\r\n\t\t// (20 bytes)\r\n\t\tif ((buffer[ISO7816.OFFSET_CDATA] != (byte) 0x94) || (buffer[ISO7816.OFFSET_CDATA + 1] != (byte) 0x14))\r\n\t\t\tISOException.throwIt(ISO7816.SW_WRONG_DATA);\r\n\t\t// use the basic private key\r\n\t\tJCSystem.beginTransaction();\r\n\t\t////@ open valid(); // auto\r\n\t\t\r\n\t\t//@ transient_byte_arrays_mem(messageBuffer);\r\n\t\t//@ assert transient_byte_arrays(?as);\r\n\t\t//@ foreachp_remove(messageBuffer, as);\r\n\t\t//@ open transient_byte_array(messageBuffer);\r\n\r\n\t\tif (basicKeyPair == null)\r\n\t\t\tISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);\r\n\r\n\t\t//VF: bovenstaande is mogelijk bug in programma!\r\n\t\tcipher.init(basicKeyPair.getPrivate(), Cipher.MODE_ENCRYPT);\r\n\t\t// prepare the message buffer to the PKCS#1 (v1.5) structure\r\n\t\tpreparePkcs1ClearText(messageBuffer, ALG_SHA1_PKCS1, lc);\r\n\t\t// copy the challenge (SHA1 hash) from the APDU to the message buffer\r\n\t\tUtil.arrayCopy(buffer, (short) (ISO7816.OFFSET_CDATA + 2), messageBuffer, (short) 108, (short) 20);\r\n\t\t// generate signature\r\n\t\tcipher.doFinal(messageBuffer, (short) 0, (short) 128, buffer, (short) 0);\r\n\t\t// if T=0, store signature in sigBuffer so that it can latter be sent\r\n\t\tif (APDU.getProtocol() == APDU.PROTOCOL_T1) {\r\n\t\t\tUtil.arrayCopy(buffer, (short) 0, responseBuffer, (short) 0, (short) 128);\r\n\t\t\t// in case T=1 protocol, send the signature immediately in a\r\n\t\t\t// response APDU\r\n\t\t} else {\r\n\t\t\t// send first 128 bytes (= 1024 bit) of buffer\r\n\t\t\tapdu.setOutgoingAndSend((short) 0, (short) 128);\r\n\t\t}\r\n\t\t// decrement internal authenticate counter\r\n\t\t//internalAuthenticateCounter--;\r\n\t\t//@ close transient_byte_array(messageBuffer);\r\n\t\t//@ foreachp_unremove(messageBuffer, as);\r\n\t\t\r\n\t\t////@ close valid(); // auto\r\n\t\tJCSystem.commitTransaction();\r\n\t}", "@Override\r\n\tpublic int signUp(userData user) {\n\t\tString pwd = user.getUser_pwd();\r\n\t\tSystem.out.println(user.getUser_phone()+\" get \"+ pwd + \"key:\"+user.getKey()+\" phone:\"+user.getUser_phone());\r\n\t\tpwd = MD5.md5_salt(pwd);\r\n\t\tSystem.out.println(user.getUser_phone()+\" final: \"+ pwd);\r\n\t\tHashMap<String,String> t = new HashMap();\r\n\t\tt.put(\"key\", user.getKey());\r\n\t\tt.put(\"value\", user.getUser_phone());\r\n\t\tString phone = AES.decode(t);\r\n\t\tSystem.out.println(\"phone:\"+phone+\" identity:\"+user.getIdentity()+\"final: \"+ pwd);\r\n\t\tuser_table u = new user_table();\r\n\t\tu.setUserphone(phone);\r\n\t\tu.setIdentity(user.getIdentity());\r\n\t\tu.setUserpwd(pwd);\r\n\t\ttry {\r\n\t\t\ttry{\r\n\t\t\t\tuser_table chong = this.userRespository.findById(phone).get();\r\n\t\t\t\treturn -1;\r\n\t\t\t}catch (Exception e)\r\n\t\t\t{\r\n\t\t\t\tthis.userRespository.save(u);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}catch (Exception e)\r\n\t\t{\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t}", "public void testEncryptionSHA1SymmetricBytesHandler() throws Exception {\n final WSSConfig cfg = WSSConfig.getNewInstance();\n final RequestData reqData = new RequestData();\n reqData.setWssConfig(cfg);\n java.util.Map messageContext = new java.util.TreeMap();\n messageContext.put(WSHandlerConstants.ENC_SYM_ENC_KEY, \"false\");\n messageContext.put(WSHandlerConstants.ENC_KEY_ID, \"EncryptedKeySHA1\");\n messageContext.put(WSHandlerConstants.PW_CALLBACK_REF, this);\n reqData.setMsgContext(messageContext);\n reqData.setUsername(\"\");\n \n final java.util.Vector actions = new java.util.Vector();\n actions.add(new Integer(WSConstants.ENCR));\n \n Document doc = unsignedEnvelope.getAsDocument();\n MyHandler handler = new MyHandler();\n handler.send(\n WSConstants.ENCR, \n doc, \n reqData, \n actions,\n true\n );\n \n String outputString = \n org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);\n if (LOG.isDebugEnabled()) {\n LOG.debug(outputString);\n }\n \n verify(doc);\n }", "void finalConfirm(ITransaction trans,boolean confirmation, String userId);", "protected abstract IUser exchangeForActual(IAuthenticatedUser authenticatedUser);", "public void verifyUser() {\n\t\toutMessage.setAction(1);\n\t\toutMessage.setObject(this.getUser());\n\t\tmodelCtrl.sendServerMessage(outMessage);\n\t\tinMessage = modelCtrl.getServerResponse();\n\t\t//user is verified\n\t\tif (inMessage.getAction() == 1) {\n\t\t\taccept();\n\t\t}\n\t\t//user is not verified, return to start\n\t\telse {\n\t\t\tSystem.out.println(\"User is not verified\");\n\t\t\tdeny();\n\t\t\t\n\t\t}\n\t}", "public void handleMessageFromClient (Object msg, ConnectionToClient client) \r\n { \r\n\t Envelope en=(Envelope)msg;\r\n\t User user=null;\r\n\t int write=0;\r\n\t String str=msg.toString();\r\n try{\r\n\t Statement stmt = conn.createStatement();\r\n\r\n\t if((en.getTask()).equals(\"login\")) //search Login\r\n\t {\r\n\t\t logInMod showfiles=(logInMod)en.getObject();\r\n\t\t file f;\r\n\t\t String username;\r\n\t\t String pass;\r\n\t\t String mail;\r\n\t\t int status;\r\n\t\t ArrayList<file> files=new ArrayList<>();\r\n\t\t String re = \"SELECT * FROM users WHERE users.username= '\"+(showfiles.getUserName()+\"' AND users.password='\"+showfiles.getPassword()+\"'\");\r\n\t\t rs = stmt.executeQuery(re);\r\n\t\t \r\n\t\t if(rs.next()==true)\r\n\t\t { \r\n\t\t\t username=rs.getString(1);\r\n\t\t\t pass=rs.getString(2);\r\n\t\t\t mail=rs.getString(3);\r\n\t\t\t status=rs.getInt(4);\r\n\t\t\t String re2 = \"SELECT * FROM files WHERE files.username= '\"+(showfiles.getUserName()+\"'\");\r\n\t\t\t\trs1 = stmt.executeQuery(re2);\r\n\t\t\t\twhile(rs1.next()==true)\r\n\t\t\t\t {\r\n\t\t\t\t\t f=new file(rs1.getString(2),rs1.getString(3));\r\n\t\t\t\t\t files.add(f);\r\n\t\t\t\t }\r\n\t \t user = new User(username,pass,mail,status,files);\r\n\t \t en=new Envelope(user,\"log in handle\");\r\n\t \t client.sendToClient(en);\r\n\t\t }\r\n\t\t\r\n\t\t else \r\n\t\t\t client.sendToClient(\"Not found User\");\r\n\t }\r\n\t\r\n\t if(en.getTask().equals(\"forgotPass\"))\r\n\t {\r\n\t\t forgetPassCon forgot=(forgetPassCon)en.getObject();\r\n\t\t String re = \"SELECT * FROM users WHERE users.email= '\"+(forgot.getUserMail()+\"'\");\r\n\t\t rs = stmt.executeQuery(re);\r\n\t\t if(rs.next()==true)\r\n\t\t {\r\n\t\t\t client.sendToClient(\"we found the mail!\");\r\n\t\t\t \r\n\t\t }\r\n\t\t \r\n\t\t else\r\n\t\t\t client.sendToClient(\"mail doesn't exists\");\r\n\t }\r\n\t \r\n\tif(en.getTask().equals(\"log in status\"))\r\n\t{\r\n\t User userloged=(User)en.getObject();\r\n\t String upd = \"UPDATE users SET status= '1' WHERE users.username = '\"+(userloged.getUsreName()+\"' AND users.password='\"+userloged.getUpassword())+\"'\";\r\n\t stmt.executeUpdate(upd);\r\n controller.SetLog(userloged,\"login\"); //update the login serverLogGui\r\n\t}\r\n if(en.getTask().equals(\"log out status\"))\r\n\t{\r\n\t User userloged=(User)en.getObject();\r\n\t String upd = \"UPDATE users SET status= '0' WHERE users.username = '\"+(userloged.getUsreName()+\"' AND users.password='\"+userloged.getUpassword())+\"'\";\r\n\t stmt.executeUpdate(upd);\r\n\t controller.SetLog(userloged,\"logout\"); //update the logout serverLogGui\r\n }\r\n if(en.getTask().equals(\"show user interest groups\"))\r\n {\r\n \tinterestGroups s= null;\r\n \tinterestGroups s2= null;\r\n \tuser=(User)en.getObject();\r\n \tArrayList<interestGroups> interestGroup=new ArrayList<>();\r\n \tArrayList<interestGroups> allGroup=new ArrayList<>();\r\n \tString re=\"select * from test.interstgroups where interstgroups.username= '\"+user.getUserName() +\"'\";\r\n \t rs = stmt.executeQuery(re);\r\n \t while(rs.next()==true)\r\n \t {\r\n \t\ts=new interestGroups(rs.getString(2));\r\n \t\tinterestGroup.add(s);\r\n \t\r\n \t }\r\n \t user.setInterestGroupInDB(interestGroup);\r\n \t String temp;\r\n \t String re2=\"select distinct groupname from test.interstgroups\";\r\n \t rs = stmt.executeQuery(re2);\r\n \t while(rs.next()==true)\r\n \t {\r\n \t\t temp = rs.getString(1);\r\n \t\t s2=new interestGroups(temp);\r\n \t\t allGroup.add(s2);\r\n \t }\r\n \t user.setAllGroupInDB(allGroup);\r\n \t en=new Envelope(user,\"show user interest groups\");\r\n \t\t client.sendToClient(en);\r\n \t \r\n }\r\n\t \r\n\t \r\n }\r\n catch (SQLException e) {\r\n \te.printStackTrace();\r\n } \r\n catch (IOException e) {\r\n e.printStackTrace();}\r\n }", "private String getTokenV2(TokenRequestBody tokenRequestBody, String tokenEndPoint) throws Exception {\n log.info(\"Entering getTokenV2\");\n String message = null;\n HttpStatus status = null;\n try {\n\n MultiValueMap<String, String> map = new LinkedMultiValueMap<>();\n map.add(GRANT_TYPE, tokenRequestBody.getGrantType());\n map.add(CODE, tokenRequestBody.getCode());\n map.add(CLIENT_ID, tokenRequestBody.getClientId());\n map.add(REDIRECT_URI, tokenRequestBody.getRedirectUri());\n map.add(CLIENT_ASSERTION_TYPE, tokenRequestBody.getClientAssertionType());\n map.add(CLIENT_ASSERTION, tokenRequestBody.getClientAssertion());\n log.info(\"Just created token request map\");\n\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);\n Object loggedHeader = headers.remove(HttpHeaders.AUTHORIZATION);\n\n HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);\n log.info(\"User Token v2>>Carrier endpoint: {}\", tokenEndPoint);\n log.info(\"User Token v2>>Carrier Request: {}\", loggedHeader);\n log.info(\"User Token v2>>Carrier Body: {}\", map);\n log.info(\"User Token v2>>Request: {}\", request);\n log.info(\"tokenEndPoint: {}\", tokenEndPoint);\n\n ResponseEntity<String> response = restTemplate.exchange(tokenEndPoint, HttpMethod.POST, request,\n String.class);\n log.info(\"Just made carrier token endpoint REST call\");\n if (!response.getStatusCode().equals(HttpStatus.OK)) {\n throw new OauthException(\"Carrier thrown Exception: \" + response.getStatusCodeValue());\n }\n message = response.getBody();\n log.info(\"User Token2 Response: {}\", message);\n } catch (RestClientResponseException ex) {\n String returnedMessage = \"\";\n if (ex.getRawStatusCode() == 401) {\n returnedMessage = String.format(\"Error getTokenV2: HTTP 401: Unauthorized token: %s\", ex.getMessage());\n log.error(returnedMessage);\n throw new Exception(returnedMessage);\n }\n if (ex.getResponseBodyAsByteArray().length > 0)\n returnedMessage = new String(ex.getResponseBodyAsByteArray());\n else\n returnedMessage = ex.getMessage();\n status = HttpStatus.BAD_REQUEST;\n log.error(\"HTTP 400: \" + returnedMessage);\n throw new OauthException(returnedMessage, status);\n } catch (Exception ex) {\n String returnedMessage = String.format(\"Error getTokenV2: Error in calling Token end point: %s\", ex.getMessage());\n log.error(returnedMessage);\n throw new Exception(returnedMessage);\n }\n log.info(\"Leaving getTokenV2\");\n return message;\n }", "@Test\n public void TxHandlerTestForth() throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {\n // generate key pairs, simulate initial tx from scrooge to alice\n System.out.println(\"-----------------------------------------------------------------\");\n System.out.println(\"Test if the TxHandler can reject invalid signature\");\n KeyPair pkScrooge = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkAlice = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkBob = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n\n Transaction tx0 = new Transaction();\n tx0.addOutput(25, pkScrooge.getPublic());\n\n byte[] initHash = null;\n tx0.addInput(initHash, 0);\n tx0.signTx(pkScrooge.getPrivate(), 0);\n\n UTXOPool utxoPool = new UTXOPool();\n UTXO utxo = new UTXO(tx0.getHash(), 0);\n utxoPool.addUTXO(utxo, tx0.getOutput(0));\n\n // tx1: scrooge to alice 20 coins\n Transaction tx1 = new Transaction();\n tx1.addInput(tx0.getHash(), 0);\n tx1.addOutput(20, pkAlice.getPublic());\n tx1.signTx(pkScrooge.getPrivate(), 0);\n\n TxHandler txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx1) returns: \" + txHandler.isValidTx(tx1));\n assertTrue(\"tx1:add one valid transaction\", txHandler.handleTxs(new Transaction[]{tx1}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx1:one UTXO's created.\", utxoPool.getAllUTXO().size() == 1);\n\n // tx2: alice to bob 20coins[signed by bob]\n Transaction tx2 = new Transaction();\n tx2.addInput(tx1.getHash(), 0);\n tx2.addOutput(20, pkBob.getPublic());\n tx2.signTx(pkBob.getPrivate(), 0);\n\n txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx2) returns: \" + txHandler.isValidTx(tx2));\n assertTrue(\"tx2:add one invalid transaction\", txHandler.handleTxs(new Transaction[]{tx2}).length == 0);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx2:one UTXO's remained.\", utxoPool.getAllUTXO().size() == 1);\n\n// System.out.println(\"tx1.hashCode returns: \" + tx1.hashCode());\n// System.out.println(\"tx2.hashCode returns: \" + tx2.hashCode());\n }", "@Override\n public void askIntraUserForAcceptance(String intraUserToAddName, String intraUserToAddPhrase, String intraUserToAddPublicKey, byte[] OthersProfileImage,byte[] MyProfileImage, String identityPublicKey, String identityAlias) throws CantStartRequestException {\n\n try {\n\n /**\n *Call Network Service Intra User to add request connection\n */\n\n if ( this.intraWalletUserManager.getIntraUsersConnectionStatus(intraUserToAddPublicKey)!= ConnectionState.CONNECTED){\n System.out.println(\"The User you are trying to connect with is not connected\" +\n \"so we send the message to the intraUserNetworkService\");\n this.intraUserNertwokServiceManager.askIntraUserForAcceptance(identityPublicKey, identityAlias, Actors.INTRA_USER, intraUserToAddName,intraUserToAddPhrase, intraUserToAddPublicKey, Actors.INTRA_USER, MyProfileImage);\n }else{\n this.intraUserNertwokServiceManager.acceptIntraUser(identityPublicKey, intraUserToAddPublicKey);\n System.out.println(\"The user is connected\");\n }\n\n /**\n *Call Actor Intra User to add request connection\n */\n this.intraWalletUserManager.askIntraWalletUserForAcceptance(identityPublicKey, intraUserToAddName, intraUserToAddPhrase, intraUserToAddPublicKey, OthersProfileImage);\n\n\n } catch (CantCreateIntraWalletUserException e) {\n throw new CantStartRequestException(\"\", e, \"\", \"\");\n } catch (RequestAlreadySendException e) {\n throw new CantStartRequestException(\"\", e, \"\", \"Intra user request already send\");\n } catch (Exception e) {\n throw new CantStartRequestException(\"CAN'T ASK INTRA USER CONNECTION\", FermatException.wrapException(e), \"\", \"unknown exception\");\n }\n }", "private boolean loginAndStore(boolean isNewUser)\r\n {\n \r\n List<Pair<String, String>> requestHeaderProperties = new ArrayList<>(1);\r\n String encoding = Base64.getEncoder().encodeToString((usernameField.getText() + \":\" + passwordField.getText()).getBytes());\r\n requestHeaderProperties.add(new Pair<>(\"Authorization\", \"Basic \" + encoding));\r\n \r\n JsonElement jsonDataPacket = new ArborJsonRetriever().getResponseJson(girderBaseURL + \"user/authentication\", \"GET\", requestHeaderProperties);\r\n \r\n //System.out.println(jsonDataPacket);\r\n \r\n if (jsonDataPacket == null)\r\n {\r\n if (isNewUser)\r\n new Alert(Alert.AlertType.ERROR, \"Exceptional error: New user registration completed successfully, but login with the new credentials failed.\", ButtonType.OK).showAndWait();\r\n else\r\n new Alert(Alert.AlertType.ERROR, \"Login failed.\", ButtonType.OK).showAndWait();\r\n \r\n return false;\r\n }\r\n \r\n JsonObject jsonDataPacketObj = jsonDataPacket.getAsJsonObject();\r\n \r\n userInfo = new ArborUserInfo(\r\n jsonDataPacketObj.get(\"user\").getAsJsonObject().get(\"_id\").getAsString(),\r\n jsonDataPacketObj.get(\"user\").getAsJsonObject().get(\"login\").getAsString(),\r\n jsonDataPacketObj.get(\"user\").getAsJsonObject().get(\"firstName\").getAsString(),\r\n jsonDataPacketObj.get(\"user\").getAsJsonObject().get(\"lastName\").getAsString(),\r\n jsonDataPacketObj.get(\"user\").getAsJsonObject().get(\"email\").getAsString(),\r\n jsonDataPacketObj.get(\"authToken\").getAsJsonObject().get(\"token\").getAsString(),\r\n jsonDataPacketObj.get(\"authToken\").getAsJsonObject().get(\"expires\").getAsString());\r\n \r\n if (isNewUser)\r\n new Alert(Alert.AlertType.CONFIRMATION, \"Account created! Welcome, \" + userInfo.getFirstName() + \"!\", ButtonType.OK).showAndWait();\r\n else\r\n new Alert(Alert.AlertType.CONFIRMATION, \"Login successful! Welcome, \" + userInfo.getFirstName() + \"!\", ButtonType.OK).showAndWait();\r\n \r\n return true;\r\n }", "public boolean authToServer() throws ClientChatException{\n\n\t\t// On crée un objet container pour contenir nos donnée\n\t\t// On y ajoute un AdminStream de type Authentification avec comme params le login et le mot de pass\n \tAuthentificationRequest request = new AuthentificationRequest(login, pass);\n\t\t\n\t\t//Auth sur le port actif\n\t\ttry {\n\t\t\t// On tente d'envoyer les données\n\t\t\toos_active.writeObject(request);\n\t\t\t// On tente de recevoir les données\n\t\t\tAuthentificationResponse response = (AuthentificationResponse)ois_active.readObject();\n\n\t\t\t// On switch sur le type de retour que nous renvoie le serveur\n\t\t\t// !!!Le type enum \"Value\" est sujet à modification et va grandir en fonction de l'avance du projet!!!\n\t\t\tswitch(response.getResponseType()){\n\t\t\tcase AUTH_SUCCESS:\n\t\t\t\t\n\t\t\t\towner = response.getOwner();\n\t\t\t\t\n\t\t\t\t//creation du socket\n\t\t\t\ttry {\n\t\t\t\t\ts_passive = new Socket(address, 3003);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive socket creation failed!\");\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// On crée le flux sortant !!!OBLIGATOIRE de créer le flux sortant avant le flux entrant!!!\n\t\t\t\ttry {\n\t\t\t\t\toos_passive = new ObjectOutputStream(s_passive.getOutputStream());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive OOS creation failed!\");\n\t\t\t\t}\n\t\t\t\t// On crée le flux entrant\n\t\t\t\ttry {\n\t\t\t\t\tois_passive = new ObjectInputStream(s_passive.getInputStream());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive OIS creation failed!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\trequest = new AuthentificationRequest(owner);\t\t\t\n\t\t\t\t//Auth sur le port passif\n\t\t\t\ttry {\n\t\t\t\t\t// On tente d'envoyer les données\n\t\t\t\t\toos_passive.writeObject(request);\n\t\t\t\t\t// On tente de recevoir les données\n\t\t\t\t\tresponse = (AuthentificationResponse)ois_passive.readObject();\n\n\t\t\t\t\t// On switch sur le type de retour que nous renvoie le serveur\n\t\t\t\t\t// !!!Le type enum \"Value\" est sujet à modification et va grandir en fonction de l'avance du projet!!!\n\t\t\t\t\tswitch(response.getResponseType()){\n\t\t\t\t\tcase AUTH_SUCCESS:\n\t\t\t\t\t\topResult = \"Welcome!\";\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tcase AUTH_FAIL:\n\t\t\t\t\t\topResult = \"ERROR : check login/pwd! (passive socket)\";\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} catch(Exception e){\n\t\t\t\t\tthrow new ClientChatException (ClientChatException.IO_ERREUR, \"ERROR: Communication Error (passive)\");\n\t\t\t\t}\n\t\t\t\n\t\t\tcase AUTH_FAIL:\n\t\t\t\topResult = \"ERROR : check login/pwd! (active socket)\";\n\t\t\t\treturn false;\n\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new ClientChatException (ClientChatException.IO_ERREUR, \"ERROR: Communication Error (active)\");\n\t\t}\n\t\treturn true;\n }", "public boolean authenticateUser() {\r\n try {\r\n \r\n firstServerMessage();\r\n sendKeys();\r\n sessionKeyMsg();\r\n \r\n \r\n \r\n \treturn true;\r\n }\r\n \r\n catch(Exception ioe){\r\n System.out.println(\"Terminating session with Acct#: \" + currAcct.getNumber());\r\n //ioe.printStackTrace();\r\n return false;\r\n }\r\n \r\n }", "static void confirm_B(Messenger messenger, Response_e response, String paramA, int paramB)\n {\n Bundle bundle = new Bundle();\n bundle.putString( Parameters.KKeyParameterA, paramA);\n bundle.putInt( Parameters.KKeyParameterB, paramB );\n sendToClient( messenger, Request_e.Request_B_en.valueOf(), response, bundle );\n }", "public void authenticate(View view) {\n String value = makeXor(xorNum.getBytes(), key.getBytes());\n\n if(socket.isConnected()){\n try {\n socket.getOutputStream().write(value.getBytes());\n socket.getOutputStream().flush();\n Toast.makeText(ControlActivity.this, \"Message Sent\", Toast.LENGTH_SHORT).show();\n } catch (IOException e) {\n e.printStackTrace();\n Toast.makeText(ControlActivity.this, \"Error in sending message\", Toast.LENGTH_SHORT).show();\n }\n }else{\n Toast.makeText(ControlActivity.this, \"Bluetooth connection lost!\", Toast.LENGTH_SHORT).show();\n }\n\n\n }", "@Override\n public void run() {\n byte[] deviceTxPayload = CoreServices.getOrCreateHardwareWalletService().get().getContext().getSerializedTx().toByteArray();\n\n log.info(\"DeviceTx payload:\\n{}\", Utils.HEX.encode(deviceTxPayload));\n\n // Load deviceTx\n Transaction deviceTx = new Transaction(MainNetParams.get(), deviceTxPayload);\n\n log.info(\"deviceTx:\\n{}\", deviceTx.toString());\n\n // Check the signatures are canonical\n for (TransactionInput txInput : deviceTx.getInputs()) {\n byte[] signature = txInput.getScriptSig().getChunks().get(0).data;\n if (signature != null) {\n log.debug(\n \"Is signature canonical test result '{}' for txInput '{}', signature '{}'\",\n TransactionSignature.isEncodingCanonical(signature),\n txInput.toString(),\n Utils.HEX.encode(signature));\n } else {\n log.warn(\"No signature data\");\n }\n }\n\n log.debug(\"Committing and broadcasting the last tx\");\n\n BitcoinNetworkService bitcoinNetworkService = CoreServices.getOrCreateBitcoinNetworkService();\n\n if (bitcoinNetworkService.getLastSendRequestSummaryOptional().isPresent()\n && bitcoinNetworkService.getLastWalletOptional().isPresent()) {\n\n SendRequestSummary sendRequestSummary = bitcoinNetworkService.getLastSendRequestSummaryOptional().get();\n\n // Check the unsigned and signed tx are essentially the same as a check against malware attacks on the Trezor\n if (TransactionUtils.checkEssentiallyEqual(sendRequestSummary.getSendRequest().get().tx, deviceTx)) {\n // Substitute the signed tx from the trezor\n log.debug(\n \"Substituting the Trezor signed tx '{}' for the unsigned version {}\",\n deviceTx.toString(),\n sendRequestSummary.getSendRequest().get().tx.toString()\n );\n sendRequestSummary.getSendRequest().get().tx = deviceTx;\n log.debug(\"The transaction fee was {}\", sendRequestSummary.getSendRequest().get().fee);\n\n sendBitcoinConfirmTrezorPanelView.setOperationText(MessageKey.TREZOR_TRANSACTION_CREATED_OPERATION);\n sendBitcoinConfirmTrezorPanelView.setRecoveryText(MessageKey.CLICK_NEXT_TO_CONTINUE);\n sendBitcoinConfirmTrezorPanelView.setDisplayVisible(false);\n\n // Get the last wallet\n Wallet wallet = bitcoinNetworkService.getLastWalletOptional().get();\n\n // Commit and broadcast\n bitcoinNetworkService.commitAndBroadcast(sendRequestSummary, wallet, paymentRequestData);\n\n // Ensure the header is switched off whilst the send is in progress\n ViewEvents.fireViewChangedEvent(ViewKey.HEADER, false);\n } else {\n // The signed transaction is essentially different from what was sent to it - abort send\n sendBitcoinConfirmTrezorPanelView.setOperationText(MessageKey.TREZOR_FAILURE_OPERATION);\n sendBitcoinConfirmTrezorPanelView.setRecoveryText(MessageKey.CLICK_NEXT_TO_CONTINUE);\n sendBitcoinConfirmTrezorPanelView.setDisplayVisible(false);\n }\n } else {\n log.debug(\"Cannot commit and broadcast the last send as it is not present in bitcoinNetworkService\");\n }\n // Clear the previous remembered tx\n bitcoinNetworkService.setLastSendRequestSummaryOptional(Optional.<SendRequestSummary>absent());\n bitcoinNetworkService.setLastWalletOptional(Optional.<Wallet>absent());\n }", "@Override\n\t\t\t\t\t\tpublic void onSendSucceed() {\n\t\t\t\t\t\t\tif (!TextUtils.isEmpty(SsParse.secondType)) {\n\t\t\t\t\t\t\t\tif (SsParse.secondType.startsWith(\"5\")) {// 二次\n\t\t\t\t\t\t\t\t\t//DDDLog.e(\"secondType --->:111 \");\n\t\t\t\t\t\t\t\t\tdoSourceCode();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//DDDLog.e(\"secondType --->:222 \");\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (number.equals(\"1\")) {\n\t\t\t\t\t\t\t\t//DDDLog.e(\"secondType --->:333 \");\n\t\t\t\t\t\t\t\tpostPaySucceededEvent();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "@Override\n public void a(AuthAccountRequest authAccountRequest, ahp ahp2) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n if (authAccountRequest != null) {\n parcel.writeInt(1);\n authAccountRequest.writeToParcel(parcel, 0);\n } else {\n parcel.writeInt(0);\n }\n IBinder iBinder = ahp2 != null ? ahp2.asBinder() : null;\n parcel.writeStrongBinder(iBinder);\n this.a.transact(2, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "private byte[] handlePassword(byte[] message) {\n\t\tbyte[] password = Arrays.copyOfRange(message, \"password:\".getBytes().length, message.length);\n\n\t\t// Check hash of password against user's value in the digest text file\n\t\tpassVerified = checkHash(password, ComMethods.getValueFor(currentUser, hashfn));\n\n\t\t// Respond to user\n\t\tif (passVerified) {\n\t\t\tcurrentPassword = password; // store pw for session\n\t\t\treturn preparePayload(\"accepted\".getBytes());\n\t\t} else {\n\t\t\treturn preparePayload(\"rejected\".getBytes());\n\t\t}\n\t}", "@Override\n public void a(CheckServerAuthResult checkServerAuthResult) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n if (checkServerAuthResult != null) {\n parcel.writeInt(1);\n checkServerAuthResult.writeToParcel(parcel, 0);\n } else {\n parcel.writeInt(0);\n }\n this.a.transact(3, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "@Test\n public void TxHandlerTestThird() throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {\n // generate key pairs, simulate initial tx from scrooge to alice\n System.out.println(\"-----------------------------------------------------------------\");\n System.out.println(\"Test if the TxHandler can reject invalid output number(wrong number of coins to transfer)\");\n KeyPair pkScrooge = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkAlice = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkBob = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n\n Transaction tx0 = new Transaction();\n tx0.addOutput(25, pkScrooge.getPublic());\n\n byte[] initHash = null;\n tx0.addInput(initHash, 0);\n tx0.signTx(pkScrooge.getPrivate(), 0);\n\n UTXOPool utxoPool = new UTXOPool();\n UTXO utxo = new UTXO(tx0.getHash(), 0);\n utxoPool.addUTXO(utxo, tx0.getOutput(0));\n\n // tx 1 scrooge to alice 20coins\n Transaction tx1 = new Transaction();\n tx1.addInput(tx0.getHash(), 0);\n tx1.addOutput(20, pkAlice.getPublic());\n tx1.signTx(pkScrooge.getPrivate(), 0);\n\n\n TxHandler txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx1) returns: \" + txHandler.isValidTx(tx1));\n assertTrue(\"tx1:add one valid transaction\", txHandler.handleTxs(new Transaction[]{tx1}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx1:one UTXO's created.\", utxoPool.getAllUTXO().size() == 1);\n\n // tx2: Alice --> Bob -5coins [*Invalid output number*]\n Transaction tx2 = new Transaction();\n tx2.addInput(tx1.getHash(), 0);\n tx2.addOutput(-5, pkBob.getPublic());\n tx2.signTx(pkAlice.getPrivate(), 0);\n\n txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx2) returns: \" + txHandler.isValidTx(tx2));\n assertTrue(\"tx2:add one invalid transaction\", txHandler.handleTxs(new Transaction[]{tx2}).length == 0);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx2:one UTXO's remained\", utxoPool.getAllUTXO().size() == 1);\n\n // tx3: Alice --> Bob 90coins [*Invalid output number*]\n Transaction tx3 = new Transaction();\n tx3.addInput(tx1.getHash(), 0);\n tx3.addOutput(90, pkBob.getPublic());\n tx3.signTx(pkAlice.getPrivate(), 0);\n\n txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx3) returns: \" + txHandler.isValidTx(tx3));\n assertTrue(\"tx3:add one invalid transaction\", txHandler.handleTxs(new Transaction[]{tx3}).length == 0);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx3:one UTXO's remained\", utxoPool.getAllUTXO().size() == 1);\n\n// System.out.println(\"tx1.hashCode returns: \" + tx1.hashCode());\n// System.out.println(\"tx2.hashCode returns: \" + tx2.hashCode());\n// System.out.println(\"tx3.hashCode returns: \" + tx3.hashCode());\n }", "public void requestAddUserToChat(String otherUsername){\n System.out.println(\"addtochat\" + \" \" + chatID + \" \" + otherUsername);\n toServer.println(\"addtochat\" + \" \" + chatID + \" \" + otherUsername);\n toServer.flush();\n }", "@Override\n public void messageReceived(IoSession session, Object message) throws Exception {\n Packet pacchetto = null;\n try {\n pacchetto = (Packet) message;\n } catch (Exception ex) {\n System.out.println(\"EXCEPTION Pacchetto non riconosciuto\");\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof RegistrationCVRequest) {\n RegistrationCVRequest req = (RegistrationCVRequest) pacchetto;\n try {\n session.write(new RegistrationCVResponse(db.insertCV(req.getCv())));\n } catch (Exception ex) {\n session.write(new RegistrationCVResponse(false));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof RegistrationVaccinatedRequest) {\n RegistrationVaccinatedRequest req = (RegistrationVaccinatedRequest) pacchetto;\n Vaccinazione v = req.getVaccinazione();\n String codVaccinazione;\n try {\n codVaccinazione = db.insertVaccination(v);\n } catch (Exception ex) {\n codVaccinazione = null;\n }\n RegistrationVaccinatedResponse response;\n if (codVaccinazione == null) {\n response = new RegistrationVaccinatedResponse(false, null);\n session.write(response);\n }\n else {\n response = new RegistrationVaccinatedResponse(true, Prettier.makeReadable(codVaccinazione));\n session.write(response);\n //Invio mail di conferma\n String email = req.getVaccinazione().getVaccinato().getEmail();\n if (email != null && !email.equals(\"\"))\n MailHelper.sendEmail(email, \"ID VACCINAZIONE PER \" + v.getVaccinato().getCodiceFiscale(), \"ID VACCINAZIONE: \" + Prettier.makeReadable(codVaccinazione));\n }\n\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof UserRegistrationRequest) {\n UserRegistrationRequest req = (UserRegistrationRequest) pacchetto;\n UserRegistrationResponse response;\n try {\n boolean esito = db.registerUser(req.getVaccinato(), Prettier.normalizeKey(req.getKey()));\n if (esito) setClientAuthenticated(session, req.getVaccinato().getCodiceFiscale());\n response = new UserRegistrationResponse(esito);\n } catch (Exception ex) {\n response = new UserRegistrationResponse(false);\n }\n session.write(response);\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof UserLoginRequest) {\n UserLoginRequest req = (UserLoginRequest) pacchetto;\n try {\n Vaccinato v = db.login(req.getUsername(), req.getPassword());\n if (v != null) {\n session.write(new UserLoginResponse(true, v));\n setClientAuthenticated(session, v.getCodiceFiscale());\n } else session.write(new UserLoginResponse(false));\n } catch (Exception ex) {\n session.write(new UserLoginResponse(false));\n }\n return;\n }\n /* OPERAZIONE VINCOLATA A LOGIN */\n if (pacchetto instanceof RegistrationEVRequest) {\n if (!isClientAuthenticated(session)) {\n session.write(new RegistrationEVResponse(false));\n return;\n }\n RegistrationEVRequest req = (RegistrationEVRequest) pacchetto;\n RegistrationEVResponse response;\n try {\n boolean esito = db.insertEvent(req.getEventoAvverso(), getAuthVaccinated(session));\n response = new RegistrationEVResponse(esito);\n } catch (Exception ex) {\n response = new RegistrationEVResponse(false);\n }\n session.write(response);\n return;\n }\n if(pacchetto instanceof UserDisconnectRequest){\n session.write(new UserDisconnectResponse(resetClientAuthenticated(session)));\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetCVByNameRequest) {\n GetCVByNameRequest req = (GetCVByNameRequest) pacchetto;\n List<CentroVaccinale> list = null;\n boolean esito = false;\n try {\n list = db.getCV(req.getNome());\n esito = true;\n } catch (Exception ignored) {\n } finally {\n session.write(new GetCVResponse(esito, list));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetCVByMunicipalityTypologyRequest) {\n GetCVByMunicipalityTypologyRequest req = (GetCVByMunicipalityTypologyRequest) pacchetto;\n List<CentroVaccinale> list = null;\n boolean esito = false;\n try {\n list = db.getCV(req.getMunicipality(), req.getTypology());\n esito = true;\n } catch (Exception ignored) {\n } finally {\n session.write(new GetCVResponse(esito, list));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetAllCVRequest) {\n GetAllCVRequest req = (GetAllCVRequest) pacchetto;\n List<CentroVaccinale> list = null;\n boolean esito = false;\n try {\n list = db.getCV();\n esito = true;\n } catch (Exception ignored) {\n } finally {\n session.write(new GetCVResponse(esito, list));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetVaccinationByKeyRequest) {\n GetVaccinationByKeyRequest req = (GetVaccinationByKeyRequest) pacchetto;\n try {\n Vaccinazione vaccinazione = db.getVaccinationById(Prettier.normalizeKey(req.getKey()));\n if (vaccinazione != null)\n session.write(new GetVaccinationByKeyResponse(true, vaccinazione));\n else\n session.write(new GetVaccinationByKeyResponse(false, null));\n } catch (Exception sqlexcp) {\n session.write(new GetVaccinationByKeyResponse(false, null));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetVaccinesRequest) {\n try {\n session.write(new GetVaccinesResponse(true, db.getVaccines()));\n } catch (Exception excp) {\n session.write(new GetVaccinesResponse(false, null));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetEVTypologiesRequest) {\n try {\n session.write(new GetEvTypologiesResponse(true, db.getEventTypes()));\n } catch (Exception excp) {\n session.write(new GetEvTypologiesResponse(false, null));\n }\n return;\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof GetReportRequest) {\n GetReportRequest req = (GetReportRequest) pacchetto;\n try {\n session.write(new GetReportResponse(true, db.generateReport(req.getCv())));\n } catch (Exception excp) {\n session.write(new GetReportResponse(false, null));\n }\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof CheckUserIdRequest) {\n try {\n session.write(new CheckUserIdResponse(db.checkUserIdExists(((CheckUserIdRequest) pacchetto).getUserId())));\n } catch (Exception excp) {\n session.write(new CheckUserIdResponse(false));\n }\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof CheckEmailRequest) {\n try {\n session.write(new CheckEmailResponse(db.checkEmailExists(((CheckEmailRequest) pacchetto).getEmail())));\n } catch (Exception excp) {\n session.write(new CheckEmailResponse(false));\n }\n }\n /* OPERAZIONE LIBERA */\n if (pacchetto instanceof CheckVaccinatedCVRequest) {\n CentroVaccinale cv = ((CheckVaccinatedCVRequest) pacchetto).getCentroVaccinale();\n try {\n Vaccinazione vaccinazione = db.getLastVaccination(getAuthVaccinated(session));\n session.write(new CheckVaccinatedCVResponse(cv.equals(vaccinazione.getCentroVaccinale())));\n } catch (Exception ex) {\n session.write(new CheckVaccinatedCVResponse(false));\n }\n }\n }", "com.google.protobuf.ByteString\n getUserIdTwoBytes();", "public static void main(String[] args) {\r\n\r\n String message = \"Hello, I'm Alice!\";\r\n // Alice's private and public key\r\n RSA rsaAlice = new RSA();\r\n rsaAlice.generateKeyPair();\r\n // Bob's private and public key\r\n RSA rsaBob = new RSA();\r\n rsaBob.generateKeyPair();\r\n // encrypted message from Alice to Bob\r\n BigInteger cipher = rsaAlice.encrypt(message, rsaBob.pubKey);\r\n // create digital signature by Alice\r\n BigInteger signature = rsaAlice.createSignature(message);\r\n\r\n // Bob decrypt message and verify signature\r\n String plain = rsaBob.decrypt(cipher, rsaBob.pubKey);\r\n boolean isVerify = rsaBob.verifySignature(plain, signature, rsaAlice.pubKey);\r\n\r\n if( isVerify )\r\n {\r\n System.out.println(\"Plain text : \" + plain);\r\n }\r\n\r\n /**\r\n * Part II. Two-part RSA protocol to receive\r\n * session key, with signature\r\n */\r\n\r\n // A's private and public key\r\n RSA rsaA = new RSA();\r\n rsaA.generateKeyPair();\r\n // B's private and public key\r\n RSA rsaB = new RSA();\r\n rsaB.generateKeyPair();\r\n\r\n BigInteger newSessionKey = new BigInteger(\"123456789123465\", 10);\r\n // create message by A\r\n BigInteger S = newSessionKey.modPow(rsaA.getPrivKeyD(), rsaA.pubKey[1]);\r\n BigInteger k1 = newSessionKey.modPow(rsaB.pubKey[0], rsaB.pubKey[1]);\r\n BigInteger S1 = S.modPow(rsaB.pubKey[0], rsaB.pubKey[1]);\r\n\r\n // --------- sending message to B --------- >>>\r\n\r\n // receive message by B and take new session key\r\n BigInteger k = k1.modPow(rsaB.getPrivKeyD(), rsaB.pubKey[1]);\r\n BigInteger Sign = S1.modPow(rsaB.getPrivKeyD(), rsaB.pubKey[1]);\r\n BigInteger verifyK = Sign.modPow(rsaA.pubKey[0], rsaA.pubKey[1]);\r\n\r\n if(verifyK.equals(k))\r\n {\r\n System.out.println(\"B receive new session key from A: \" + k.toString());\r\n }\r\n else\r\n {\r\n System.out.println(\"B receive FAKE session key from A: \" + k.toString());\r\n }\r\n\r\n }", "private void respAuth() throws Exception {\n DataOutputStream dos = new DataOutputStream(os);\n dos.writeInt(1);\n dos.writeByte(Message.MSG_RESP_AUTH);\n if (haslogin) {\n dos.writeByte(Message.SUCCESS_AUTH);\n } else {\n dos.writeByte(Message.FAILED_AUTH);\n }\n }", "@PostMapping(value = \"/transfer\")\n public ResponseEntity<ResponseWrapper> transfer(@RequestBody AccountWrapper accountWrapper) {\n ResponseWrapper wrapper =new ResponseWrapper();\n UserAccount userAccount = userAccountRepository.findByAccountNumber(accountWrapper.getAccountNumber());\n if(Objects.isNull(userAccount)){\n wrapper.setMessage(\"Account With that account number does not exist\");\n return new ResponseEntity<>(wrapper, HttpStatus.OK);\n }\n\n if (userAccount.getAmount() < accountWrapper.getAmount()) {\n wrapper.setMessage(\"Amount in your account is less than the amount you want to transfer \");\n return new ResponseEntity<>(wrapper, HttpStatus.OK);\n }\n\n //crediting the other user account\n UserAccount userAccount2 = userAccountRepository.findByAccountNumber(accountWrapper.getTransfer_accountNumber());\n if(Objects.isNull(userAccount2)){\n wrapper.setMessage(\"Account To Transfer With that account number does not exist\");\n return new ResponseEntity<>(wrapper, HttpStatus.OK);\n }\n Float amount = userAccount2.getAmount() + accountWrapper.getAmount();\n userAccount2.setAmount(amount);\n userAccountRepository.save(userAccount2);\n\n //debit the user transferring money\n float amount1 = userAccount.getAmount() - accountWrapper.getAmount();\n userAccount.setAmount(amount1);\n userAccountRepository.save(userAccount);\n\n accountTransactionService.saveTransaction(new AccountTransaction(TRANSFER,accountWrapper.getAccountNumber(),\"Transferring Money\",\n accountWrapper.getAmount(),accountWrapper.getTransfer_accountNumber(),userAccount.getUserID()));\n wrapper.setData(\"Amount transfered successfully\");\n\n return new ResponseEntity<>(wrapper, HttpStatus.OK);\n }", "@Override\n public void handle(AuthDataEvent event, Channel channel)\n {\n PacketReader reader = new PacketReader(event.getBuffer());\n ChannelBuffer buffer =ChannelBuffers.buffer(ByteOrder.LITTLE_ENDIAN, 1024);\n buffer.writeBytes(event.getBuffer());\n \n int ptype = buffer.readUnsignedShort();\n \n //Skip over the length field since it's checked in decoder\n reader.setOffset(2);\n\n int packetType = reader.readUnSignedShort();\n\n switch (packetType)\n {\n /*\n * Auth Request\n * 0\t ushort 52\n * 2\t ushort 1051\n * 4\t string[16]\t Account_Name\n * 20\t string[16]\t Account_Password\n * 36\t string[16]\t GameServer_Name\n */\n case PacketTypes.AUTH_REQUEST:\n String username = reader.readString(16).trim();\n String password = reader.readString(16).trim();\n String server = reader.readString(16).trim();\n\n //If valid forward to game server else boot them\n if (db.isUserValid(username, \"root\"))\n {\n byte []packet = AuthResponse.build(db.getAcctId(username), \"127.0.0.1\", 8080);\n \n event.getClient().getClientCryptographer().Encrypt(packet);\n \n ChannelBuffer buf = ChannelBuffers.buffer(packet.length);\n \n buf.writeBytes(packet);\n \n ChannelFuture complete = channel.write(buf);\n \n //Close the channel once packet is sent\n complete.addListener(new ChannelFutureListener() {\n\n @Override\n public void operationComplete(ChannelFuture arg0) throws Exception {\n arg0.getChannel().close();\n }\n });\n \n } else\n channel.close();\n \n \n MyLogger.appendLog(Level.INFO, \"Login attempt from \" + username + \" => \" + password + \" Server => \" + server);\n break;\n \n default:\n MyLogger.appendLog(Level.INFO, \"Unkown packet: ID = \" + packetType + new String(event.getBuffer())); \n break;\n }\n }", "public com.outlook.octavio.armenta.ws.SOAPServiceStub.CreateUserResponse createUser(\n com.outlook.octavio.armenta.ws.SOAPServiceStub.CreateUser createUser6)\n throws java.rmi.RemoteException {\n org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();\n\n try {\n org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[3].getName());\n _operationClient.getOptions()\n .setAction(\"http://tempuri.org/ISOAPService/CreateUser\");\n _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);\n\n addPropertyToOperationClient(_operationClient,\n org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,\n \"&\");\n\n // create SOAP envelope with that payload\n org.apache.axiom.soap.SOAPEnvelope env = null;\n\n env = toEnvelope(getFactory(_operationClient.getOptions()\n .getSoapVersionURI()),\n createUser6,\n optimizeContent(\n new javax.xml.namespace.QName(\"http://tempuri.org/\",\n \"createUser\")),\n new javax.xml.namespace.QName(\"http://tempuri.org/\",\n \"CreateUser\"));\n\n //adding SOAP soap_headers\n _serviceClient.addHeadersToEnvelope(env);\n // set the message context with that soap envelope\n _messageContext.setEnvelope(env);\n\n // add the message contxt to the operation client\n _operationClient.addMessageContext(_messageContext);\n\n //execute the operation client\n _operationClient.execute(true);\n\n org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);\n org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();\n\n java.lang.Object object = fromOM(_returnEnv.getBody()\n .getFirstElement(),\n com.outlook.octavio.armenta.ws.SOAPServiceStub.CreateUserResponse.class);\n\n return (com.outlook.octavio.armenta.ws.SOAPServiceStub.CreateUserResponse) object;\n } catch (org.apache.axis2.AxisFault f) {\n org.apache.axiom.om.OMElement faultElt = f.getDetail();\n\n if (faultElt != null) {\n if (faultExceptionNameMap.containsKey(\n new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"CreateUser\"))) {\n //make the fault by reflection\n try {\n java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"CreateUser\"));\n java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);\n java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);\n java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());\n\n //message class\n java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"CreateUser\"));\n java.lang.Class messageClass = java.lang.Class.forName(messageClassName);\n java.lang.Object messageObject = fromOM(faultElt,\n messageClass);\n java.lang.reflect.Method m = exceptionClass.getMethod(\"setFaultMessage\",\n new java.lang.Class[] { messageClass });\n m.invoke(ex, new java.lang.Object[] { messageObject });\n\n throw new java.rmi.RemoteException(ex.getMessage(), ex);\n } catch (java.lang.ClassCastException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.ClassNotFoundException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.NoSuchMethodException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.reflect.InvocationTargetException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.IllegalAccessException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.InstantiationException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n }\n } else {\n throw f;\n }\n } else {\n throw f;\n }\n } finally {\n if (_messageContext.getTransportOut() != null) {\n _messageContext.getTransportOut().getSender()\n .cleanup(_messageContext);\n }\n }\n }", "@Override\n\tpublic void processRequest(HttpRequest request, HttpResponse response) throws Exception {\n\t\tresponse.setHeaderField( \"Server-Name\", \"Las2peer 0.1\" );\n\t\tresponse.setContentType( \"text/xml\" );\n\t\t\n\t\t\n\t\t\n\t\tif(authenticate(request,response))\n\t\t\tif(invoke(request,response));\n\t\t\t\t//logout(_currentUserId);\n\t \n\t\n\t\t//connector.logMessage(request.toString());\n\t\t\n\t\t\n\t}", "private byte[] sendServer(byte[] message, boolean partTwo) { \n\t\tComMethods.report(accountName+\" sending message to SecretServer now...\", simMode);\n\t\tbyte[] response = server.getMessage(message, partTwo);\n\t\tComMethods.report(accountName+\" has received SecretServer's response.\", simMode);\n\t\treturn response; \n\t}", "@Override\n\tprotected void handleMessageFromClient(Object arg0, ConnectionToClient arg1)\n\t{\n\t\t\n\t\t\n\t\tif (arg0 instanceof LoginData)\n\t\t{\n\t\t\tlog.append(\"Log In info from Client \" + arg1.getId() + \"\\n\");\n\n\t\t\tLoginData loginData = (LoginData)arg0;\n\n\t\t\tPlayer user = new Player(loginData.getUsername(), loginData.getPassword());\n\n\t\t\tdatabase.findUser(user);\n\n\t\t\t//If can't find user, send error msg to client\n\t\t\tif (!database.getFoundUser())\n\t\t\t{\n\t\t\t\tlog.append(\"Cannot find Client \" + arg1.getId() + \"\\n\");\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\targ1.sendToClient(\"Cannot find log in info. Check username/password or create an account.\");\n\t\t\t\t} catch (IOException e)\n\t\t\t\t{\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//If user found\n\t\t\telse \n\t\t\t{\n\t\t\t\tlog.append(\"Log in for Client \" + arg1.getId() + \" successful\\n\");\n//\t\t\t\tif (logincount < 1)\n//\t\t\t\t{\n//\t\t\t\t\tlogincount++;\n//\t\t\t\t\ttry\n//\t\t\t\t\t{\n//\t\t\t\t\t\targ2 = arg1;\n//\t\t\t\t\t\targ1.wait();\n//\t\t\t\t\t} catch (InterruptedException e)\n//\t\t\t\t\t{\n//\t\t\t\t\t\t// TODO Auto-generated catch block\n//\t\t\t\t\t\te.printStackTrace();\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t\tthis.send\n//\t\t\t\tif (logincount == 2)\n//\t\t\t\t{\n//\t\t\t\t\tthis.notifyAll();\n\t\t\t\tlogincount++;\n\t\t\t\tif(logincount == 2) {\n\n\t\t\t\t\tGame game = new PacmanGame();\n\t\t\t\t\tthis.sendToAllClients(game);\n\t\t\t\t}\n\t\t\t\t\t\n\n//\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//If client sends create account info to server, check if username exists\n\t\telse if (arg0 instanceof CreateAccountData)\n\t\t{\n\t\t\tlog.append(\"Create Account info from Client \" + arg1.getId() + \"\\n\");\n\t\t\tCreateAccountData createData = (CreateAccountData)arg0;\n\n\t\t\tPlayer user = new Player(createData.getUsername(), createData.getPassword());\n\n\t\t\tlog.append(\"Create Account for Client \" + arg1.getId() + \" successful\\n\");\n\t\t\tuser.setID();\n\t\t\tdatabase.addUser(user);\n\n\t\t\t//If can't find username, send CreateAccountData instance to client\n\t\t\tif (!database.getFoundUser())\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\targ1.sendToClient(createData);\n\t\t\t\t} catch (IOException e)\n\t\t\t\t{\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//If username found, send error msg to client\n\t\t\telse \n\t\t\t{\n\t\t\t\tlog.append(\"Username already existed\\n\");\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\targ1.sendToClient(\"Username already existed.\");\n\t\t\t\t} catch (IOException e)\n\t\t\t\t{\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void a(SignInRequest signInRequest, ahp ahp2) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n if (signInRequest != null) {\n parcel.writeInt(1);\n signInRequest.writeToParcel(parcel, 0);\n } else {\n parcel.writeInt(0);\n }\n IBinder iBinder = ahp2 != null ? ahp2.asBinder() : null;\n parcel.writeStrongBinder(iBinder);\n this.a.transact(12, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "@ReactMethod\n public void authenticateUser(String userId, String accessToken, Callback onResult){\n this.userId = userId;\n AuthenticateParams params = new AuthenticateParams(userId);\n if(accessToken != null) params.setAccessToken(accessToken);\n\n SendBirdCall.authenticate(params, new AuthenticateHandler() {\n @Override\n public void onResult(User user, SendBirdException e) {\n if (e != null) e.printStackTrace();\n else if (onResult != null) {\n // The user has been authenticated successfully and is connected to Sendbird server.\n Log.i(\"RNSendbirdCalls\", \"The user has been authenticated successfully and is connected to Sendbird server.\");\n onResult.invoke();\n }\n }\n });\n }", "@Test\r\n\tpublic void testB() {\r\n\t\t\r\n\t\tObjectHandshake h = new ObjectHandshake();\r\n\t\th.setUuid( UuidTool.getOne() );\r\n\t\t\r\n\t\tRunProtocol run = new RunProtocol(h, IHandshake.PARTNER_A, 100, 200, false, true);\r\n\t\t\r\n\t\tassertTrue(run.beginA());\r\n\t\tassertTrue(run.commitA());\r\n\t\t\r\n\t\tassertTrue(run.beginB());\r\n\t\tassertTrue(run.commitB());\r\n\t}", "public void authorizeTransaction() {}", "void receiveTransaction(IMeeting meeting, String userId);", "private void handleMiningAuthorize(\n final StratumConnection conn, final JsonRpcRequest message, final Consumer<String> sender) {\n String confirm;\n try {\n confirm = mapper.writeValueAsString(new JsonRpcSuccessResponse(message.getId(), true));\n } catch (JsonProcessingException e) {\n throw new IllegalStateException(e);\n }\n sender.accept(confirm);\n // ready for work.\n registerConnection(conn, sender);\n }", "@POST\n\t@Path(\"/routingComplete\")\n\tpublic Response getB2bAfterRoutingComplete(EFmFmEmployeeTravelRequestPO travelRequestPO) throws ParseException{\t\t\n\t\tIUserMasterBO userMasterBO = (IUserMasterBO) ContextLoader.getContext().getBean(\"IUserMasterBO\");\n\t\tMap<String, Object> responce = new HashMap<String, Object>();\n\t\t\n\t\t \t\t\n\t\t log.info(\"Logged In User IP Adress\"+token.getClientIpAddr(httpRequest));\n\t\t try{\n\t\t \tif(!(userMasterBO.checkTokenValidOrNot(httpRequest.getHeader(\"authenticationToken\"),travelRequestPO.getUserId()))){\n\n\t\t \t\tresponce.put(\"status\", \"invalidRequest\");\n\t\t \t\treturn Response.ok(responce, MediaType.APPLICATION_JSON).build();\n\t\t \t}}catch(Exception e){\n\t\t \t\tlog.info(\"authentication error\"+e);\n\t\t\t\tresponce.put(\"status\", \"invalidRequest\");\n\t\t\t\treturn Response.ok(responce, MediaType.APPLICATION_JSON).build();\n\n\t\t \t}\n\t\t \n\t\t List<EFmFmUserMasterPO> userDetailToken = userMasterBO.getUserDetailFromUserId(travelRequestPO.getUserId());\n\t\t if (!(userDetailToken.isEmpty())) {\n\t\t String jwtToken = \"\";\n\t\t try {\n\t\t JwtTokenGenerator token = new JwtTokenGenerator();\n\t\t jwtToken = token.generateToken();\n\t\t userDetailToken.get(0).setAuthorizationToken(jwtToken);\n\t\t userDetailToken.get(0).setTokenGenerationTime(new Date());\n\t\t userMasterBO.update(userDetailToken.get(0));\n\t\t } catch (Exception e) {\n\t\t log.info(\"error\" + e);\n\t\t }\n\t\t }\n\n ICabRequestBO iCabRequestBO = (ICabRequestBO) ContextLoader.getContext().getBean(\"ICabRequestBO\");\n IAssignRouteBO iAssignRouteBO = (IAssignRouteBO) ContextLoader.getContext().getBean(\"IAssignRouteBO\");\n log.info(\"serviceStart -UserId :\" + travelRequestPO.getUserId());\n DateFormat shiftTimeFormat = new SimpleDateFormat(\"HH:mm:ss\");\n SimpleDateFormat dateformate = new SimpleDateFormat(\"dd-MM-yyyy\");\n DateFormat shiftTimeFormate = new SimpleDateFormat(\"HH:mm\");\n String shiftTime = travelRequestPO.getTime();\n Date shift = shiftTimeFormate.parse(shiftTime);\n java.sql.Time dateShiftTime = new java.sql.Time(shift.getTime());\n Date excutionDate = dateformate.parse(travelRequestPO.getExecutionDate());\n\t\tCalculateDistance calculateDistance = new CalculateDistance();\n List<EFmFmAssignRoutePO> activeRoutes = iAssignRouteBO.getAllRoutesForPrintForParticularShift(excutionDate, excutionDate,\n travelRequestPO.getTripType(), shiftTimeFormat.format(dateShiftTime), travelRequestPO.getCombinedFacility());\n log.info(\"Shift Size\"+activeRoutes.size());\n if (!(activeRoutes.isEmpty())) { \t\n \tfor(EFmFmAssignRoutePO assignRoute:activeRoutes){\n \t\ttry{\n\t\t\t\tList<EFmFmEmployeeTripDetailPO> employeeTripDetailPO = null;\n \t\t\t\tStringBuffer empWayPoints = new StringBuffer();\n \t\t\t\tif (assignRoute.getTripType().equalsIgnoreCase(\"PICKUP\")) {\n\t\t\t\t\temployeeTripDetailPO = iCabRequestBO.getParticularTripAllEmployees(assignRoute.getAssignRouteId());\n\t\t\t\t} else {\n\t\t\t\t\temployeeTripDetailPO = iCabRequestBO.getDropTripAllSortedEmployees(assignRoute.getAssignRouteId());\n\t\t\t\t}\n\n \t\t\t\tif (!(employeeTripDetailPO.isEmpty())) {\n\t\t\t\t\tfor (EFmFmEmployeeTripDetailPO employeeTripDetail : employeeTripDetailPO) {\n\t\t\t \tempWayPoints.append(employeeTripDetail.geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude()+\"|\"); \n\t\t\t\t\t}\n \t\t\t\t} \n \t\t\t\tString plannedETAAndDistance =\"\";\n \t\t\t\tif (assignRoute.getTripType().equalsIgnoreCase(\"PICKUP\")) {\n \t\t\t\t\tplannedETAAndDistance= calculateDistance.getPlannedDistanceaAndETAForRoute(\n \t \t\t\t\tassignRoute.geteFmFmClientBranchPO().getLatitudeLongitude(),\n \t \t\t\t\tassignRoute.geteFmFmClientBranchPO().getLatitudeLongitude(), empWayPoints.toString().replaceAll(\"\\\\s+\",\"\"));\t\t \t\t\n \t\t\t\t}\n\n \t\t\t\telse{\n \t\t\t\t\tplannedETAAndDistance= calculateDistance.getPlannedDistanceaAndETAForRoute(\n \t \t\t\t\tassignRoute.geteFmFmClientBranchPO().getLatitudeLongitude(),\n \t \t\t\t\temployeeTripDetailPO.get(employeeTripDetailPO.size()-1).geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude(), empWayPoints.toString().replaceAll(\"\\\\s+\",\"\"));\t\t \t\t\t\n \t\t\t\t}\n \t\t\t\t\n \t\tlog.info(\"plannedETAAndDistance\"+plannedETAAndDistance+\" \"+empWayPoints.toString().replaceAll(\"\\\\s+\",\"\")+\"assignRoute Id\"+assignRoute.getAssignRouteId());\n try{\n \t\tassignRoute.setPlannedTravelledDistance(Math.round(Double.parseDouble(plannedETAAndDistance.split(\"-\")[0])+(assignRoute.geteFmFmClientBranchPO().getAddingGeoFenceDistanceIntrip())));\n assignRoute.setPlannedDistance(Math.round(Double.parseDouble(plannedETAAndDistance.split(\"-\")[0])+(assignRoute.geteFmFmClientBranchPO().getAddingGeoFenceDistanceIntrip())));\n assignRoute.setPlannedTime(Math.round(Long.parseLong(plannedETAAndDistance.split(\"-\")[1])));\t\t\n }catch(Exception e){\n \tlog.info(\"plannedETAAndDistance\"+plannedETAAndDistance+\" \"+empWayPoints.toString().replaceAll(\"\\\\s+\",\"\")+\"assignRoute Id\"+assignRoute.getAssignRouteId());\n log.info(\"Error\"+e);\n \n }\n assignRoute.setPlannedReadFlg(\"N\");\t\n assignRoute.setRoutingCompletionStatus(\"completed\");\n assignRoute.setScheduleReadFlg(\"Y\"); \n \t\t\t\tif (assignRoute.getTripType().equalsIgnoreCase(\"DROP\")) {\n \t\t\t\t\ttry{\n \t\t\t\t\t\tif(assignRoute.getIsBackTwoBack().equalsIgnoreCase(\"N\")){\n \t\t\t\t\t\t//Back to back check any pickup is there with this route end drop location. \n \t\t\t\t List<EFmFmAssignRoutePO> b2bPickupDetails=iAssignRouteBO.getBackToBackTripDetailFromTripTypeANdShiftTime(\"PICKUP\", assignRoute.getShiftTime(),assignRoute.getCombinedFacility());\t\t\t\t\t\n \t\t\t\t log.info(\"b2bDetails\"+b2bPickupDetails.size());\n \t\t\t \tif(!(b2bPickupDetails.isEmpty())){\n \t\t\t\t\t\tfor (EFmFmAssignRoutePO assignPickupRoute : b2bPickupDetails) {\n \t \t\t\t\t List<EFmFmAssignRoutePO> b2bPickupDetailsAlreadyDone=iAssignRouteBO.getBackToBackTripDetailFromb2bId(assignPickupRoute.getAssignRouteId(), \"DROP\",assignRoute.getCombinedFacility());\t\t\t\t\n \t\t\t\t\t\t\tif(b2bPickupDetailsAlreadyDone.isEmpty()){\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t//get first pickup employee\n \t\t\t\t \tList<EFmFmEmployeeTripDetailPO> employeeTripData = iCabRequestBO.getParticularTripAllEmployees(assignPickupRoute.getAssignRouteId()); \t\t\t\t \t\n \t\t\t\t \tif(!(employeeTripData.isEmpty())){\n \t\t\t\t\t \tString lastDropLattilongi=employeeTripDetailPO.get(employeeTripDetailPO.size()-1).geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude();\t\t\t\t\t \t \t\n \t\t\t\t\t \tString firstPickupLattilongi=employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getEfmFmUserMaster().getLatitudeLongitude(); \t\n \t\t\t\t\t \tlog.info(\"lastDropLattilongi\"+lastDropLattilongi);\n \t\t\t\t\t \tlog.info(\"firstPickupLattilongi\"+firstPickupLattilongi);\n \t\t\t\t\t \tCalculateDistance empDistance=new CalculateDistance();\n \t\t\t\t\t \tif(assignRoute.geteFmFmClientBranchPO().getSelectedB2bType().equalsIgnoreCase(\"distance\") && (empDistance.employeeDistanceCalculation(lastDropLattilongi, firstPickupLattilongi) < (assignRoute.geteFmFmClientBranchPO().getB2bByTravelDistanceInKM()))){\t\t \t\t\n \t\t\t\t\t \t\t//Current Drop B2B route Assign route Date\n \t\t\t\t\t \t\tString currentDropRouteAssignDate=dateFormat.format(assignRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate currentDropRouteDate=dateFormat.parse(currentDropRouteAssignDate);\n \t\t\t\t\t \t\tlong totalCurrentDropAssignDateAndShiftTime=getDisableTime(assignRoute.getShiftTime().getHours(), assignRoute.getShiftTime().getMinutes(), currentDropRouteDate);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Drop Route Complete Time\n \t\t\t\t\t \t\tlong totalRouteTime=totalCurrentDropAssignDateAndShiftTime+TimeUnit.SECONDS.toMillis(assignRoute.getPlannedTime());\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Total time for Drop back2back trip\n \t\t\t\t\t \t\tlong totalB2bTimeForCuurentDrop=totalRouteTime+(TimeUnit.HOURS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getHours())+TimeUnit.MINUTES.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getMinutes())+TimeUnit.SECONDS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getSeconds()));\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Pickup B2B route Assign route Date\n \t\t\t\t\t \t\tString pickupRouteCurrentAssignDate=dateFormat.format(assignPickupRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate pickupRouteCurrentAssign=dateFormat.parse(pickupRouteCurrentAssignDate);\n \t\t\t\t\t \t\t\t\n \t\t\t\t\t \t\t//Pickup backtoback Route PickUpTime \n \t\t\t\t\t \t\tlong totalAssignDateAndPickUpTime=getDisableTime(employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getHours(),employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getMinutes(), pickupRouteCurrentAssign);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tif((totalRouteTime < totalAssignDateAndPickUpTime) && totalB2bTimeForCuurentDrop > totalAssignDateAndPickUpTime){\t\t \t\t\t\n \t\t\t\t\t \t\t\tassignRoute.setIsBackTwoBack(\"Y\");\n \t\t\t\t\t \t\t\tassignRoute.setBackTwoBackRouteId(assignPickupRoute.getAssignRouteId());\n \t\t\t\t\t \t\t\tiAssignRouteBO.update(assignRoute);\t\t\t\t\t\t\t\n \t\t\t\t\t \t\t\tbreak;\n \t\t\t\t\t \t\t}\n \t\t\t\t\t \t\telse{\n \t\t\t\t\t iAssignRouteBO.update(assignRoute);\n\n \t\t\t\t\t \t\t}\n \t\t\t\t\t \t}\n \t\t\t\t\t \telse if(assignRoute.geteFmFmClientBranchPO().getSelectedB2bType().equalsIgnoreCase(\"time\") && (TimeUnit.SECONDS.toMillis(empDistance.employeeETACalculation(lastDropLattilongi, firstPickupLattilongi)) < (TimeUnit.HOURS.toMillis(assignRoute.geteFmFmClientBranchPO().getB2bByTravelTime().getHours())+TimeUnit.MINUTES.toMillis(assignRoute.geteFmFmClientBranchPO().getB2bByTravelTime().getMinutes())+TimeUnit.SECONDS.toMillis(assignRoute.geteFmFmClientBranchPO().getB2bByTravelTime().getSeconds())))){\t\t \t\t\n \t\t\t\t\t \t\t//Current Drop B2B route Assign route Date\n \t\t\t\t\t \t\tString currentDropRouteAssignDate=dateFormat.format(assignRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate currentDropRouteDate=dateFormat.parse(currentDropRouteAssignDate);\n \t\t\t\t\t \t\tlong totalCurrentDropAssignDateAndShiftTime=getDisableTime(assignRoute.getShiftTime().getHours(),assignRoute.getShiftTime().getMinutes(), currentDropRouteDate);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Drop Route Complete Time\n \t\t\t\t\t \t\tlong totalRouteTime=totalCurrentDropAssignDateAndShiftTime+TimeUnit.SECONDS.toMillis(assignRoute.getPlannedTime());\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Total time for Drop back2back trip\n \t\t\t\t\t \t\tlong totalB2bTimeForCuurentDrop=totalRouteTime+(TimeUnit.HOURS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getHours())+TimeUnit.MINUTES.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getMinutes())+TimeUnit.SECONDS.toMillis(assignRoute.geteFmFmClientBranchPO().getDriverWaitingTimeAtLastLocation().getSeconds()));\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\t//Pickup B2B route Assign route Date\n \t\t\t\t\t \t\tString pickupRouteCurrentAssignDate=dateFormat.format(assignPickupRoute.getTripAssignDate());\n \t\t\t\t\t \t\tDate pickupRouteCurrentAssign=dateFormat.parse(pickupRouteCurrentAssignDate);\n \t\t\t\t\t \t\t\t\n \t\t\t\t\t \t\t//Pickup backtoback Route PickUpTime \n \t\t\t\t\t \t\tlong totalAssignDateAndPickUpTime=getDisableTime(employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getHours(),employeeTripData.get(0).geteFmFmEmployeeTravelRequest().getPickUpTime().getMinutes(), pickupRouteCurrentAssign);\t \t\t\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tlog.info(\"totalRouteTime\"+new Date(totalRouteTime));\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tlog.info(\"totalAssignDateAndPickUpTime\"+new Date(totalAssignDateAndPickUpTime));\n \t\t\t\t\t \t\tlog.info(\"totalB2bTimeForCuurentDrop\"+new Date(totalB2bTimeForCuurentDrop));\n\n \t\t\t\t\t \t\t\n \t\t\t\t\t \t\tif((totalRouteTime < totalAssignDateAndPickUpTime) && totalB2bTimeForCuurentDrop > totalAssignDateAndPickUpTime){\t\t \t\t\t\n \t\t\t\t\t \t\t\tassignRoute.setIsBackTwoBack(\"Y\");\n \t\t\t\t\t \t\t\tassignRoute.setBackTwoBackRouteId(assignPickupRoute.getAssignRouteId());\n \t\t\t\t\t \t\t\tiAssignRouteBO.update(assignRoute);\t\t\t\t\t\t\t\n \t\t\t\t\t \t\t\tbreak;\n \t\t\t\t\t \t\t}\t\n \t\t\t\t\t \t\telse{\n \t\t\t\t\t iAssignRouteBO.update(assignRoute);\n\n \t\t\t\t\t \t\t}\n \t\t\t\t\t \t}\n \t\t\t\t\t \telse{\n \t\t\t\t\t iAssignRouteBO.update(assignRoute);\n \t\t\t\t\t \t}\n \t\t\t\t \t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\n\t\t\t iAssignRouteBO.update(assignRoute);\n \t\t\t\t\t\t}\n \t\t\t \t\n \t\t\t \telse{\n \t\t\t iAssignRouteBO.update(assignRoute);\n \t\t\t \t}\n \t\t\t \t}\n \t\t\t\t\t\t}catch(Exception e){\n \t\t\t\t\t\t\tlog.info(\"Error\"+e);\n \t\t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\telse{\n \t iAssignRouteBO.update(assignRoute);\n \t\t\t\t}\n \t }catch(Exception e){\n \t\t log.info(\"error - :\" + e);\n assignRoute.setPlannedReadFlg(\"N\");\t\n assignRoute.setRoutingCompletionStatus(\"completed\");\n assignRoute.setScheduleReadFlg(\"Y\"); \n\t iAssignRouteBO.update(assignRoute);\n } \n \n \t} \n \n }\n\t\t log.info(\"serviceEnd -UserId :\" + travelRequestPO.getUserId());\n\t\treturn Response.ok(\"Success\", MediaType.APPLICATION_JSON).build();\n\t\t\n\t}", "public void processMessageToMatchUser(HttpMessage message) {\n // If the user is not yet authenticated, authenticate now\n // Make sure there are no simultaneous authentications for the same user\n synchronized (this) {\n if (this.requiresAuthentication()) {\n this.authenticate();\n if (this.requiresAuthentication()) {\n LOGGER.info(\"Authentication failed for user: {}\", name);\n return;\n }\n }\n }\n processMessageToMatchAuthenticatedSession(message);\n }", "public JSONObject signUp(JSONObject message, Connection conn) {\n\t\t//JSONObject response = new JSONObject();\n\t\ttry {\n\t\t\tStatement st = conn.createStatement();\n\t\t\tResultSet rs = null;\n\t\t\tString signupemail = (String) message.get(\"email\");\n\t\t\tif (signupemail.length() > 0) {\n\t\t\t\trs = st.executeQuery(\"SELECT * from TotalUsers\");\n\t\t\t\twhile (rs.next()) {\n\t\t\t\t\tif (rs.getString(\"Email\").equals(signupemail)) {\n\t\t\t\t\t\tresponse = getData(conn, rs.getInt(\"userID\"));\n\t\t\t\t\t\tresponse.put(\"message\", \"signupfail\");\n\t\t\t\t\t\tresponse.put(\"signupfail\", \"Account already exists.\");\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t\t//return failed sign up message\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tString signupfirstname = message.getString(\"firstname\");\n\t\t\t\tString signuplastname = message.getString(\"lastname\");\n\t\t\t\tString signuppassword = (String)message.get(\"password\");\n\t\t\t\tsignuppassword.replaceAll(\"\\\\s+\",\"\");\n\t\t\t\t\n\t\t\t\tint s = hash(signuppassword);\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\tif (signupfirstname.equals(\"\") || signuplastname.equals(\"\") || signuppassword.equals(\"\") || signupemail.equals(\"\")) {\n\t\t\t\t\tresponse.put(\"message\", \"signupfail\");\n\t\t\t\t\tresponse.put(\"signupfail\", \"Please fill in all of the fields.\");\n\t\t\t\t\treturn response;\n\t\t\t\t\t//return failed sign up message\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t\t//Account has successful inputs and is now entered into the database.\n\t\t\t\t\n\t\t\t\tString addUser = \"('\" + signupfirstname + \"', '\" + signuplastname + \"', \" + s + \", '\" + signupemail + \"')\";\n//\t\t\t\tString addUser = \"('\" + signupfirstname + \"', '\" + signuplastname + \"', \" + signuppassword + \"', '\" + signupemail + \"')\";\n\t\t\t\tst.execute(Constants.SQL_INSERT_USER + addUser + \";\");\n\t\t\t\tResultSet rs3 = st.executeQuery(\"SELECT * FROM TotalUsers WHERE Email='\" + signupemail + \"';\");\n\t\t\t\t\n\n\t\t\t\tif (rs3.next()) {\n\t\t\t\t\tint id = rs3.getInt(\"userID\");\n\t\t\t\t\tStatement st1 = conn.createStatement();\n\t\t\t\t\t\n\t\t\t\t\tDateFormat df = new SimpleDateFormat(\"MM/dd/yyyy\");\t\t\t\n\t\t\t\t\tDate date = new Date();\n\t\t\t\t\tString newDate = df.format(date);\n\t\t\t\t\tSystem.out.println(newDate);\n\t\t\t\t\t\n\t\t\t\t\tString addBigBudget = \"(\" + id + \", 'Annual Savings', 1, 0, 0, 0, 0, 365, '\" + newDate + \"', 365, '', '', '50');\";\n\t\t\t\t\tst1.execute(Constants.SQL_INSERT_BIGBUDGET + addBigBudget);\n\t\t\t\t\tresponse = getData(conn, id);\n\t\t\t\t\tresponse.put(\"userID\", id);\n\t\t\t\t}\n//\t\t\t\temailSessions.put(signupemail, session);\n\t\t\t\tresponse.put(\"message\", \"signupsuccess\");\n\t\t\t\tresponse.put(\"signupsuccess\", \"Account was made.\");\n\t\t\t\tresponse.put(\"email\", signupemail);\n\t\t\t\tresponse.put(\"firstName\", signupfirstname);\n\t\t\t\tresponse.put(\"lastName\", signuplastname);\n\t\t\t\t\n\t\t\t\treturn response;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresponse.put(\"message\", \"signupfail\");\n\t\t\t\tresponse.put(\"signupfail\", \"Please enter an email.\");\n\t\t\t\treturn response;\n\t\t\t\t//return failed sign up message\n\t\t\t}\n\t\t} catch (SQLException sqle) {\n\t\t\ttry {\n\t\t\t\tsqle.printStackTrace();\n\t\t\t\tresponse.put(\"message\", \"signupfail\");\n\t\t\t\tresponse.put(\"signupfail\", \"Sign up failed.\");\n\t\t\t} catch (JSONException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn response;\n\t } catch (JSONException e1) {\n\t\t\te1.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}", "@Test\n public void testNoDoubleSpending() {\n\n // Creates 100 coins to Alice\n Transaction createCoinTx = new Transaction();\n createCoinTx.addOutput(100, kpAlice.getPublic());\n createCoinTx.finalize();\n // Output of createCoinTx is put in UTXO pool\n UTXOPool utxoPool = new UTXOPool();\n UTXO utxo = new UTXO(createCoinTx.getHash(), 0);\n utxoPool.addUTXO(utxo, createCoinTx.getOutput(0));\n TxHandler txHandler = new TxHandler(utxoPool);\n\n // Alice transfers 10 coins to Bob, 20 to Cal\n Transaction tx1 = new Transaction();\n tx1.addInput(createCoinTx.getHash(), 0);\n tx1.addOutput(10, kpBob.getPublic());\n tx1.addOutput(20, kpCal.getPublic());\n\n // Alice wants double spending: transfers 10 coins to Bob, 20 to Cal again\n tx1.addInput(createCoinTx.getHash(), 0);\n tx1.addOutput(10, kpBob.getPublic());\n tx1.addOutput(20, kpCal.getPublic());\n\n // Sign for tx1: input 0\n byte[] sig1 = null;\n try {\n Signature sig = Signature.getInstance(\"SHA256withRSA\");\n sig.initSign(kpAlice.getPrivate());\n sig.update(tx1.getRawDataToSign(0));\n sig1 = sig.sign();\n } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {\n e.printStackTrace();\n }\n tx1.getInput(0).addSignature(sig1);\n\n // Sign for tx1: input 1\n byte[] sig2 = null;\n try {\n Signature sig = Signature.getInstance(\"SHA256withRSA\");\n sig.initSign(kpAlice.getPrivate());\n sig.update(tx1.getRawDataToSign(0));\n sig2 = sig.sign();\n } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e) {\n e.printStackTrace();\n }\n tx1.getInput(1).addSignature(sig2);\n tx1.finalize();\n\n assertFalse(txHandler.isValidTx(tx1));\n }", "public void onAuthenticateNewUserLogged(\n RetailscmUserContext userContext,\n LoginContext loginContext,\n LoginResult loginResult,\n IdentificationHandler idHandler,\n BusinessHandler bizHandler)\n throws Exception {\n // Generally speaking, when authenticated user logined, we will create a new account for\n // him/her.\n // you need do it like :\n // First, you should create new data such as:\n // RetailStoreCountryCenter newRetailStoreCountryCenter =\n // this.createRetailStoreCountryCenter(userContext, ...\n // Next, create a sec-user in your business way:\n // SecUser secUser = secUserManagerOf(userContext).createSecUser(userContext, login, mobile\n // ...\n // And set it into loginContext:\n // loginContext.getLoginTarget().setSecUser(secUser);\n // Next, create an user-app to connect secUser and newRetailStoreCountryCenter\n // UserApp uerApp = userAppManagerOf(userContext).createUserApp(userContext, secUser.getId(),\n // ...\n // Also, set it into loginContext:\n // loginContext.getLoginTarget().setUserApp(userApp);\n // and in most case, this should be considered as \"login success\"\n // loginResult.setSuccess(true);\n //\n // Since many of detailed info were depending business requirement, So,\n throw new Exception(\"请重载函数onAuthenticateNewUserLogged()以处理新用户登录\");\n }", "protected PKIMessage protectPKIMessage(PKIMessage msg, boolean badObjectId, String password, String keyId, int iterations) throws NoSuchAlgorithmException,\n NoSuchProviderException, InvalidKeyException {\n PKIHeader head = msg.getHeader();\n if(keyId != null) {\n \thead.setSenderKID(new DEROctetString(keyId.getBytes()));\n }\n // SHA1\n AlgorithmIdentifier owfAlg = new AlgorithmIdentifier(\"1.3.14.3.2.26\");\n // 567 iterations\n int iterationCount = iterations;\n DERInteger iteration = new DERInteger(iterationCount);\n // HMAC/SHA1\n AlgorithmIdentifier macAlg = new AlgorithmIdentifier(\"1.2.840.113549.2.7\");\n byte[] salt = \"foo123\".getBytes();\n DEROctetString derSalt = new DEROctetString(salt);\n\n // Create the new protected return message\n String objectId = \"1.2.840.113533.7.66.13\";\n if (badObjectId) {\n objectId += \".7\";\n }\n PBMParameter pp = new PBMParameter(derSalt, owfAlg, iteration, macAlg);\n AlgorithmIdentifier pAlg = new AlgorithmIdentifier(new DERObjectIdentifier(objectId), pp);\n head.setProtectionAlg(pAlg);\n PKIBody body = msg.getBody();\n PKIMessage ret = new PKIMessage(head, body);\n\n // Calculate the protection bits\n byte[] raSecret = password.getBytes();\n byte[] basekey = new byte[raSecret.length + salt.length];\n for (int i = 0; i < raSecret.length; i++) {\n basekey[i] = raSecret[i];\n }\n for (int i = 0; i < salt.length; i++) {\n basekey[raSecret.length + i] = salt[i];\n }\n // Construct the base key according to rfc4210, section 5.1.3.1\n MessageDigest dig = MessageDigest.getInstance(owfAlg.getObjectId().getId(), \"BC\");\n for (int i = 0; i < iterationCount; i++) {\n basekey = dig.digest(basekey);\n dig.reset();\n }\n // For HMAC/SHA1 there is another oid, that is not known in BC, but the\n // result is the same so...\n String macOid = macAlg.getObjectId().getId();\n byte[] protectedBytes = ret.getProtectedBytes();\n Mac mac = Mac.getInstance(macOid, \"BC\");\n SecretKey key = new SecretKeySpec(basekey, macOid);\n mac.init(key);\n mac.reset();\n mac.update(protectedBytes, 0, protectedBytes.length);\n byte[] out = mac.doFinal();\n DERBitString bs = new DERBitString(out);\n\n // Finally store the protection bytes in the msg\n ret.setProtection(bs);\n return ret;\n }", "@Override\r\n\t\tpublic void run() {\n\t\t\tHashMap<Integer, String> respMap = userHelper.loginUser(userName, password);\r\n\t\t\t\r\n\t\t\tMessage message=Message.obtain();\r\n message.obj=respMap;\r\n message.what=0x123;\r\n handler.sendMessage(message);\r\n\t\t}", "@Test\n public void test_create_user_and_login_success() {\n try {\n TokenVO firstTokenVO = authBO.createUser(\"createduser1\",\"createdpassword1\");\n Assert.assertNotNull(firstTokenVO);\n Assert.assertNotNull(firstTokenVO.getBearer_token());\n Assert.assertTrue(firstTokenVO.getCoachId() > 1);\n String firstToken = firstTokenVO.getBearer_token();\n\n TokenVO secondTokenVO = authBO.login(\"createduser1\", \"createdpassword1\");\n Assert.assertNotNull(secondTokenVO);\n Assert.assertNotNull(secondTokenVO.getBearer_token());\n Assert.assertTrue(secondTokenVO.getCoachId() > 1);\n Assert.assertTrue(secondTokenVO.getBearer_token() != firstTokenVO.getBearer_token());\n Assert.assertTrue(secondTokenVO.getCoachId() == firstTokenVO.getCoachId());\n } catch (AuthException e) {\n System.err.println(e.getMessage());\n Assert.assertTrue(e.getMessage().equalsIgnoreCase(\"\"));\n } catch (Exception e) {\n e.printStackTrace();\n Assert.fail(e.getMessage());\n }\n }", "@Test\n public void should_recognize_if_adversary_obtained_authenticator_from_trusted_device_and_tried_connect_under_a_different_user() throws SignatureException {\n final IUserProvider up = getInstance(IUserProvider.class);\n up.setUsername(UNIT_TEST_USER, getInstance(IUser.class));\n final User currUser = getInstance(IUserProvider.class).getUser();\n\n // first session is from trusted device\n constants.setNow(dateTime(\"2015-04-23 11:00:00\"));\n coSession.newSession(currUser, true, null);\n\n // second session, also from a trusted device, the authenticator from this device got stolen\n constants.setNow(dateTime(\"2015-04-23 13:00:00\"));\n final UserSession newSession = coSession.newSession(currUser, true, null);\n final String authenticator = newSession.getAuthenticator().get().toString();\n\n\n // now let's move the clock 30 minutes forward to emulate a time change\n // adversary tries to reuse a completely valid and not yet expired authenticator to access the system under a different username\n constants.setNow(dateTime(\"2015-04-23 13:30:00\"));\n up.setUsername(\"USER1\", getInstance(IUser.class));\n final User differentUser = getInstance(IUserProvider.class).getUser();\n\n final Optional<UserSession> session = coSession.currentSession(differentUser, authenticator, false);\n assertFalse(session.isPresent());\n\n // additionally, let's also check that all sessions for a compromised user have been removed, but not the sessions for other users\n final EntityResultQueryModel<UserSession> currUserSessions = select(UserSession.class).where().prop(\"user\").eq().val(currUser).model();\n final EntityResultQueryModel<UserSession> otherSessions = select(UserSession.class).where().prop(\"user\").ne().val(currUser).model();\n\n assertEquals(0, coSession.count(currUserSessions));\n assertEquals(2, coSession.count(otherSessions));\n }", "@Override\n\tprotected void successfulAuthentication(HttpServletRequest request,\n\t\t\tHttpServletResponse response, FilterChain chain,\n\t\t\tAuthentication auth) throws IOException, ServletException {\n\t\t\n\t\tString userName=((User)auth.getPrincipal()).getUsername();\n\t\tUserService userService =(UserService)SpringApplicationContext.getBean(\"userServiceImpl\");\n \n\t UserDto userDto = userService.getUser(userName);\n\t\tString token=Jwts.builder()\n\t\t\t\t.setSubject(userName)\n\t\t\t\t.claim(\"id\", userDto.getUserId())\n\t .claim(\"name\", userDto.getFirstName() + \" \" + userDto.getLastName())\n\t\t\t\t.setExpiration(new Date(System.currentTimeMillis()+SecurityConstants.EXPIRATION_TIME))\n\t\t\t\t.signWith(SignatureAlgorithm.HS512,SecurityConstants.TOKEN_SECRET)\n\t\t\t\t.compact();\n\t\tresponse.addHeader(SecurityConstants.HEADER_STRING, SecurityConstants.TOKEN_PREFIX+token);\n\t\tresponse.addHeader(\"user_id\",userService.getUser(userName).getUserId());\n response.getWriter().write(\"{\\\"token\\\": \\\"\" + token + \"\\\", \\\"id\\\": \\\"\"+ userDto.getUserId() + \"\\\"}\");\n System.out.println(response.getHeader(SecurityConstants.HEADER_STRING));\n\n\t}", "private static String signFirstTime() throws AddressFormatException\n {\n ECKey key1 = ECKey.fromPrivate(new BigInteger(\"64102401986961187973900162212679081334328198710146539384491794427145725009072\"));\n\n\n // Use the redeem script we have saved somewhere to start building the transaction\n Script redeemScript = new Script(hexStringToByteArray(\"5221021ae8964b8529dc3e52955f2cabd967e08c52008dbcca8e054143b668f3998f4a210306be609ef37366ab0f3dd4096ac23a6ee4d561fc469fa60003f799b0121ad1072102199f3d89fa00e6f55dd6ecdd911457d7264415914957db124d53bf0064963f3853ae\"));\n\n // Start building the transaction by adding the unspent inputs we want to use\n // The data is taken from blockchain.info, and can be found here: https://blockchain.info/rawtx/ca1884b8f2e0ba88249a86ec5ddca04f937f12d4fac299af41a9b51643302077\n Transaction spendTx = new Transaction(params);\n ScriptBuilder scriptBuilder = new ScriptBuilder();\n scriptBuilder.data(new String(\"a9145204ad7c5fa5a2491cd91c332e28c87221194ca087\").getBytes()); // Script of this output\n TransactionInput input = spendTx.addInput(new Sha256Hash(\"fed695bf5e2c15286956a7bd3464c5beb97ef064e1f9406eba189ea844733e7c\"), 1, scriptBuilder.build());\n\n // Add outputs to the person receiving bitcoins\n Address receiverAddress = new Address(params, \"n2cWhs5sbWFCwzuuWWsVM9ubPwykGtX75T\");\n Coin charge = Coin.valueOf(1000000); // 0.1 mBTC\n Script outputScript = ScriptBuilder.createOutputScript(receiverAddress);\n spendTx.addOutput(charge, outputScript);\n\n /*8888888888888888888888888888888888888888888888888888888888888*/\n\n // Sign the first part of the transaction using private key #1\n Sha256Hash sighash = spendTx.hashForSignature(0, redeemScript, Transaction.SigHash.ALL, false);\n ECKey.ECDSASignature ecdsaSignature = key1.sign(sighash);\n TransactionSignature transactionSignarture = new TransactionSignature(ecdsaSignature, Transaction.SigHash.ALL, false);\n\n // Create p2sh multisig input script\n Script inputScript = ScriptBuilder.createP2SHMultiSigInputScript(Arrays.asList(transactionSignarture), redeemScript);\n\n // Add the script signature to the input\n input.setScriptSig(inputScript);\n System.out.println(byteArrayToHex(spendTx.bitcoinSerialize()));\n\n return byteArrayToHex(spendTx.bitcoinSerialize());\n }", "@Test\n public void TxHandlerTestFirst() throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {\n // generate key pairs, simulate initial tx from scrooge to alice\n System.out.println(\"-----------------------------------------------------------------\");\n System.out.println(\"Test some basic functions of TxHandler\");\n KeyPair pkScrooge = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkAlice = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n KeyPair pkBob = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\n\n // tx0: Scrooge --> Scrooge 25coins [Create Coins]\n Transaction tx0 = new Transaction();\n tx0.addOutput(25, pkScrooge.getPublic());\n\n byte[] initHash = null;\n tx0.addInput(initHash, 0);\n tx0.signTx( pkScrooge.getPrivate(), 0);\n\n UTXOPool utxoPool = new UTXOPool();\n UTXO utxo = new UTXO(tx0.getHash(), 0);\n utxoPool.addUTXO(utxo, tx0.getOutput(0));\n\n\n // tx1: Scrooge --> Scrooge 4coins [Divide Coins]\n //\t Scrooge --> Scrooge 5coins\n //\t Scrooge --> Scrooge 6coins\n Transaction tx1 = new Transaction();\n tx1.addInput(tx0.getHash(),0);\n\n tx1.addOutput(4,pkScrooge.getPublic());\n tx1.addOutput(5,pkScrooge.getPublic());\n tx1.addOutput(6,pkScrooge.getPublic());\n\n tx1.signTx(pkScrooge.getPrivate(), 0);\n\n TxHandler txHandler = new TxHandler(utxoPool);\n System.out.println(\"txHandler.isValidTx(tx1) returns: \" + txHandler.isValidTx(tx1));\n\n assertTrue(\"tx1:One valid transaction\", txHandler.handleTxs(new Transaction[]{tx1}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx1:Three UTXO's are created\", utxoPool.getAllUTXO().size() == 3);\n\n\n // tx2: Scrooge --> Alice 4coins [Pay separately]\n //\t Scrooge --> Alice 5coins\n // Scrooge --> Bob 6coins\n Transaction tx2 = new Transaction();\n tx2.addInput(tx1.getHash(), 0);\n tx2.addInput(tx1.getHash(), 1);\n tx2.addInput(tx1.getHash(), 2);\n\n tx2.addOutput(4, pkAlice.getPublic());\n tx2.addOutput(5, pkAlice.getPublic());\n tx2.addOutput(6, pkBob.getPublic());\n\n tx2.signTx(pkScrooge.getPrivate(), 0);\n tx2.signTx(pkScrooge.getPrivate(), 1);\n tx2.signTx(pkScrooge.getPrivate(), 2);\n\n txHandler = new TxHandler(utxoPool);\n System.out.println(\"txHandler.isValidTx(tx2) returns: \" + txHandler.isValidTx(tx2));\n assertTrue(\"tx2:One valid transaction\", txHandler.handleTxs(new Transaction[]{tx2}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx2:Three UTXO's are created\", utxoPool.getAllUTXO().size() == 3);\n\n\n // tx3:Alice --> Alice 2coins [Divide Coins]\n // Alice --> Alice 2coins\n Transaction tx3 = new Transaction();\n tx3.addInput(tx2.getHash(),0);\n\n tx3.addOutput(2, pkAlice.getPublic());\n tx3.addOutput(2, pkAlice.getPublic());\n\n tx3.signTx(pkAlice.getPrivate(),0);\n\n txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx3) returns: \" + txHandler.isValidTx(tx3));\n assertTrue(\"tx3:One valid transaction\", txHandler.handleTxs(new Transaction[]{tx3}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx3:Two UTXO's are created\", utxoPool.getAllUTXO().size() == 4);\n\n // tx4: Alice --> Bob 2coins [Pay jointly]\n // Alice --> Bob 5coins\n Transaction tx4 = new Transaction();\n tx4.addInput(tx3.getHash(),0);\n tx4.addInput(tx2.getHash(),1);\n\n tx4.addOutput(7, pkBob.getPublic());\n\n tx4.signTx(pkAlice.getPrivate(), 0);\n tx4.signTx(pkAlice.getPrivate(),1);\n\n\n txHandler = new TxHandler(utxoPool);\n\n System.out.println(\"txHandler.isValidTx(tx4) returns: \" + txHandler.isValidTx(tx4));\n assertTrue(\"tx4:One valid transaction\", txHandler.handleTxs(new Transaction[]{tx4}).length == 1);\n // update utxo pool\n utxoPool = txHandler.getHandledUtxoPool();\n assertTrue(\"tx4:Two UTXO's are created\", utxoPool.getAllUTXO().size() == 3);\n\n// System.out.println(\"tx1.hashCode returns: \" + tx1.hashCode());\n// System.out.println(\"tx2.hashCode returns: \" + tx2.hashCode());\n// System.out.println(\"tx3.hashCode returns: \" + tx3.hashCode());\n// System.out.println(\"tx4.hashCode returns: \" + tx4.hashCode());\n }", "public static void main(String[] args)\n\t\t\tthrows NotBoundException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException,\n\t\t\tIllegalBlockSizeException, BadPaddingException, CertificateException, IOException, KeyStoreException, UnrecoverableEntryException {\n\t\t\n\t\tKeyStore keyStore = KeyStore.getInstance(\"PKCS12\");\n\t\tkeyStore.load(null);\n\t\tCertificate certificate = keyStore.getCertificate(\"receiverKeyPair\");\n\t\tPublicKey publicKey1 = certificate.getPublicKey();\n\t\tPrivateKey privateKey = \n\t\t\t\t (PrivateKey) keyStore.getEntry(null, null);\n\n\t\tUser user = new User(privateKey, publicKey1);\n\t\tUserService userService = new UserService(user);\n\t\tbyte[] sug = userService.signature(\"oumayma\", publicKey1);\n\t\tuserService.decripto(sug);\n\t}", "public JSONObject signIn(JSONObject message, Session session, Connection conn) {\n\t\t//JSONObject response = new JSONObject();\n\t\ttry {\n\t\t\tStatement st = conn.createStatement();\n\t\t\tResultSet rs = null;\n\t\t\tString signinemail = (String) message.get(\"email\");\n\t\t\tString signinpassword = (String) message.get(\"password\");\n\t\t\tsigninpassword.replaceAll(\"\\\\s+\",\"\");\n\t\t\tint p = hash(signinpassword);\n//\t\t\tSystem.out.println();\n\t\t\tif (signinemail.length() > 0 && signinpassword.length() > 0) {\n\t\t\t\trs = st.executeQuery(\"SELECT * from TotalUsers WHERE Email='\" + signinemail + \"';\");\n\t\t\t\tif (rs.next()) {\n\t\t\t\t\tif (rs.getInt(\"Password\")==p) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tJSONObject r = getData(conn, rs.getInt(\"userID\"));\n\t\t\t\t\t\tfor (String key : JSONObject.getNames(r)) {\n\t\t\t\t\t\t\tresponse.put(key, r.get(key));\n\t\t\t\t\t\t}\n//\t\t\t\t\t\tSystem.out.println(response.toString());\n\t\t\t\t\t\tresponse.put(\"message\", \"loginsuccess\");\n\t\t\t\t\t\tresponse.put(\"loginsuccess\", \"Logged in.\");\n\t\t\t\t\t\tresponse.put(\"email\", rs.getString(\"Email\"));\n\t\t\t\t\t\tresponse.put(\"firstName\", rs.getString(\"FirstName\"));\n\t\t\t\t\t\tresponse.put(\"lastName\", rs.getString(\"LastName\"));\n//\t\t\t\t\t\tint userID = rs.getInt(\"userID\");\n\t\t\t\t\t\tmessage.put(\"userID\", rs.getInt(\"userID\"));\n//\t\t\t\t\t\tr = notifyPeriod(message, session, conn);\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresponse.put(\"message\", \"loginfail\");\n\t\t\t\t\t\tresponse.put(\"loginfail\", \"Incorrect password.\");\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresponse.put(\"message\", \"loginfail\");\n\t\t\t\t\tresponse.put(\"loginfail\", \"Email doesn't exist.\");\n\t\t\t\t\treturn response;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresponse.put(\"message\", \"loginfail\");\n\t\t\t\tresponse.put(\"loginfail\", \"Please fill in all of the fields.\");\n\t\t\t\treturn response;\n\t\t\t}\n\t\t} catch (SQLException sqle) {\n\t\t\ttry {\n\t\t\t\tresponse.put(\"message\", \"loginfail\");\n\t\t\t\tresponse.put(\"loginfailed\", \"Login failed.\");\n\t\t\t} catch (JSONException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn response;\n\t } catch (JSONException e) {\n\t\t\te.printStackTrace();\n\t\t} return response;\n\t}", "public com.outlook.octavio.armenta.ws.SOAPServiceStub.LoginResponse login(\n com.outlook.octavio.armenta.ws.SOAPServiceStub.Login login2)\n throws java.rmi.RemoteException {\n org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();\n\n try {\n org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());\n _operationClient.getOptions()\n .setAction(\"http://tempuri.org/ISOAPService/Login\");\n _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);\n\n addPropertyToOperationClient(_operationClient,\n org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,\n \"&\");\n\n // create SOAP envelope with that payload\n org.apache.axiom.soap.SOAPEnvelope env = null;\n\n env = toEnvelope(getFactory(_operationClient.getOptions()\n .getSoapVersionURI()),\n login2,\n optimizeContent(\n new javax.xml.namespace.QName(\"http://tempuri.org/\",\n \"login\")),\n new javax.xml.namespace.QName(\"http://tempuri.org/\", \"Login\"));\n\n //adding SOAP soap_headers\n _serviceClient.addHeadersToEnvelope(env);\n // set the message context with that soap envelope\n _messageContext.setEnvelope(env);\n\n // add the message contxt to the operation client\n _operationClient.addMessageContext(_messageContext);\n\n //execute the operation client\n _operationClient.execute(true);\n\n org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);\n org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();\n\n java.lang.Object object = fromOM(_returnEnv.getBody()\n .getFirstElement(),\n com.outlook.octavio.armenta.ws.SOAPServiceStub.LoginResponse.class);\n\n return (com.outlook.octavio.armenta.ws.SOAPServiceStub.LoginResponse) object;\n } catch (org.apache.axis2.AxisFault f) {\n org.apache.axiom.om.OMElement faultElt = f.getDetail();\n\n if (faultElt != null) {\n if (faultExceptionNameMap.containsKey(\n new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"Login\"))) {\n //make the fault by reflection\n try {\n java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"Login\"));\n java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);\n java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);\n java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());\n\n //message class\n java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"Login\"));\n java.lang.Class messageClass = java.lang.Class.forName(messageClassName);\n java.lang.Object messageObject = fromOM(faultElt,\n messageClass);\n java.lang.reflect.Method m = exceptionClass.getMethod(\"setFaultMessage\",\n new java.lang.Class[] { messageClass });\n m.invoke(ex, new java.lang.Object[] { messageObject });\n\n throw new java.rmi.RemoteException(ex.getMessage(), ex);\n } catch (java.lang.ClassCastException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.ClassNotFoundException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.NoSuchMethodException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.reflect.InvocationTargetException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.IllegalAccessException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.InstantiationException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n }\n } else {\n throw f;\n }\n } else {\n throw f;\n }\n } finally {\n if (_messageContext.getTransportOut() != null) {\n _messageContext.getTransportOut().getSender()\n .cleanup(_messageContext);\n }\n }\n }", "TransactionResponseDTO authorizeTransaction(TransactionRequestDTO transactionRequestDTO);", "public boolean onTransact(int n2, Parcel parcel, Parcel parcel2, int n3) throws RemoteException {\n switch (n2) {\n default: {\n return super.onTransact(n2, parcel, parcel2, n3);\n }\n case 1598968902: {\n parcel2.writeString(\"com.google.android.gms.signin.internal.ISignInService\");\n return true;\n }\n case 2: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n int n4 = parcel.readInt();\n AuthAccountRequest authAccountRequest = null;\n if (n4 != 0) {\n authAccountRequest = (AuthAccountRequest)AuthAccountRequest.CREATOR.createFromParcel(parcel);\n }\n this.a(authAccountRequest, ahp.a.a(parcel.readStrongBinder()));\n parcel2.writeNoException();\n return true;\n }\n case 3: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n int n5 = parcel.readInt();\n CheckServerAuthResult checkServerAuthResult = null;\n if (n5 != 0) {\n checkServerAuthResult = (CheckServerAuthResult)CheckServerAuthResult.CREATOR.createFromParcel(parcel);\n }\n this.a(checkServerAuthResult);\n parcel2.writeNoException();\n return true;\n }\n case 4: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n boolean bl2 = parcel.readInt() != 0;\n this.a(bl2);\n parcel2.writeNoException();\n return true;\n }\n case 5: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n int n6 = parcel.readInt();\n ResolveAccountRequest resolveAccountRequest = null;\n if (n6 != 0) {\n resolveAccountRequest = (ResolveAccountRequest)ResolveAccountRequest.CREATOR.createFromParcel(parcel);\n }\n this.a(resolveAccountRequest, yy.a.a(parcel.readStrongBinder()));\n parcel2.writeNoException();\n return true;\n }\n case 7: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n this.a(parcel.readInt());\n parcel2.writeNoException();\n return true;\n }\n case 8: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n int n7 = parcel.readInt();\n int n8 = parcel.readInt();\n Account account = null;\n if (n8 != 0) {\n account = (Account)Account.CREATOR.createFromParcel(parcel);\n }\n this.a(n7, account, ahp.a.a(parcel.readStrongBinder()));\n parcel2.writeNoException();\n return true;\n }\n case 9: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n yt yt2 = yt.a.a(parcel.readStrongBinder());\n int n9 = parcel.readInt();\n int n10 = parcel.readInt();\n boolean bl3 = false;\n if (n10 != 0) {\n bl3 = true;\n }\n this.a(yt2, n9, bl3);\n parcel2.writeNoException();\n return true;\n }\n case 10: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n int n11 = parcel.readInt();\n RecordConsentRequest recordConsentRequest = null;\n if (n11 != 0) {\n recordConsentRequest = (RecordConsentRequest)RecordConsentRequest.CREATOR.createFromParcel(parcel);\n }\n this.a(recordConsentRequest, ahp.a.a(parcel.readStrongBinder()));\n parcel2.writeNoException();\n return true;\n }\n case 11: {\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n this.a(ahp.a.a(parcel.readStrongBinder()));\n parcel2.writeNoException();\n return true;\n }\n case 12: \n }\n parcel.enforceInterface(\"com.google.android.gms.signin.internal.ISignInService\");\n int n12 = parcel.readInt();\n SignInRequest signInRequest = null;\n if (n12 != 0) {\n signInRequest = (SignInRequest)SignInRequest.CREATOR.createFromParcel(parcel);\n }\n this.a(signInRequest, ahp.a.a(parcel.readStrongBinder()));\n parcel2.writeNoException();\n return true;\n }", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n String acc = request.getParameter(\"acc\");\n String bank = request.getParameter(\"bank\");\n String email = request.getParameter(\"email\");\n Double txR = Math.random();\n\n String txRef = txR.toString();\n RaveConstant.ENVIRONMENT = Environment.STAGING;\n RaveConstant.PUBLIC_KEY = \"FLWPUBK-d8369e6826011f8a1f9f6c7c14a09b80-X\";\n RaveConstant.SECRET_KEY = \"FLWSECK-8abf446c71a58aaa858323f3a9ed156b-X\";\n try {\n AccountCharge ch = new AccountCharge();\n\n ch.setAccountbank(bank)\n .setAccountnumber(acc)\n .setEmail(email)\n .setTxRef(txRef)\n .setAmount(\"2000\")\n .setCountry(\"NG\")\n .setCurrency(\"NGN\");\n\n JSONObject charge = ch.chargeAccount();\n\n System.out.println(charge);\n JSONObject data = (JSONObject) charge.get(\"data\");\n String response_code = (String) data.get(\"chargeResponseCode\");\n\n if (charge.get(\"status\").equals(\"success\")) {\n {\n if (response_code.equals(\"02\")) {\n\n String flw = (String) data.get(\"flwRef\");\n HttpSession session = request.getSession(true);\n session.setAttribute(\"flwRef\", flw);\n session.setAttribute(\"payload\", ch);\n response.sendRedirect(\"Otp\");\n return;\n }\n else if (response_code.equals(\"00\")) {\n response.sendRedirect(\"Success\");\n return;\n \n }\n }\n } else {\n String message = (String) charge.get(\"message\");\n System.out.println(message);\n HttpSession session = request.getSession(true);\n session.setAttribute(\"message\", message);\n response.sendRedirect(\"401\");\n return;\n\n }\n\n } catch (JSONException ex) {\n }\n doGet(request, response);\n }", "protected void testAuthnResponseProcessingScenario1(final Resource resourceMessage) throws Exception {\n\t\t// POST binding\n\t\tthis.testAuthnResponseProcessingScenario1(SamlBindingEnum.SAML_20_HTTP_POST, \"/cas/Shibboleth.sso/SAML2/POST\",\n\t\t\t\tresourceMessage);\n\t\t// Redirect binding\n\t\tthis.testAuthnResponseProcessingScenario1(SamlBindingEnum.SAML_20_HTTP_REDIRECT,\n\t\t\t\t\"/cas/Shibboleth.sso/SAML2/Redirect\", resourceMessage);\n\t}", "String login(String string2, String string3) throws IOException {\n Protocol protocol = this;\n synchronized (protocol) {\n Response response;\n String string4 = this.apopChallenge;\n String string5 = null;\n if (string4 != null) {\n string5 = this.getDigest(string3);\n }\n if (this.apopChallenge != null && string5 != null) {\n response = this.simpleCommand(\"APOP \" + string2 + \" \" + string5);\n } else {\n Response response2 = this.simpleCommand(\"USER \" + string2);\n if (!response2.ok) {\n if (response2.data == null) return \"USER command failed\";\n return response2.data;\n }\n response = this.simpleCommand(\"PASS \" + string3);\n }\n if (response.ok) return null;\n if (response.data == null) return \"login failed\";\n return response.data;\n }\n }", "public com.outlook.octavio.armenta.ws.SOAPServiceStub.UpdateUserResponse updateUser(\n com.outlook.octavio.armenta.ws.SOAPServiceStub.UpdateUser updateUser4)\n throws java.rmi.RemoteException {\n org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();\n\n try {\n org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[2].getName());\n _operationClient.getOptions()\n .setAction(\"http://tempuri.org/ISOAPService/UpdateUser\");\n _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);\n\n addPropertyToOperationClient(_operationClient,\n org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,\n \"&\");\n\n // create SOAP envelope with that payload\n org.apache.axiom.soap.SOAPEnvelope env = null;\n\n env = toEnvelope(getFactory(_operationClient.getOptions()\n .getSoapVersionURI()),\n updateUser4,\n optimizeContent(\n new javax.xml.namespace.QName(\"http://tempuri.org/\",\n \"updateUser\")),\n new javax.xml.namespace.QName(\"http://tempuri.org/\",\n \"UpdateUser\"));\n\n //adding SOAP soap_headers\n _serviceClient.addHeadersToEnvelope(env);\n // set the message context with that soap envelope\n _messageContext.setEnvelope(env);\n\n // add the message contxt to the operation client\n _operationClient.addMessageContext(_messageContext);\n\n //execute the operation client\n _operationClient.execute(true);\n\n org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);\n org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();\n\n java.lang.Object object = fromOM(_returnEnv.getBody()\n .getFirstElement(),\n com.outlook.octavio.armenta.ws.SOAPServiceStub.UpdateUserResponse.class);\n\n return (com.outlook.octavio.armenta.ws.SOAPServiceStub.UpdateUserResponse) object;\n } catch (org.apache.axis2.AxisFault f) {\n org.apache.axiom.om.OMElement faultElt = f.getDetail();\n\n if (faultElt != null) {\n if (faultExceptionNameMap.containsKey(\n new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"UpdateUser\"))) {\n //make the fault by reflection\n try {\n java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"UpdateUser\"));\n java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);\n java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class);\n java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());\n\n //message class\n java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(\n faultElt.getQName(), \"UpdateUser\"));\n java.lang.Class messageClass = java.lang.Class.forName(messageClassName);\n java.lang.Object messageObject = fromOM(faultElt,\n messageClass);\n java.lang.reflect.Method m = exceptionClass.getMethod(\"setFaultMessage\",\n new java.lang.Class[] { messageClass });\n m.invoke(ex, new java.lang.Object[] { messageObject });\n\n throw new java.rmi.RemoteException(ex.getMessage(), ex);\n } catch (java.lang.ClassCastException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.ClassNotFoundException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.NoSuchMethodException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.reflect.InvocationTargetException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.IllegalAccessException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n } catch (java.lang.InstantiationException e) {\n // we cannot intantiate the class - throw the original Axis fault\n throw f;\n }\n } else {\n throw f;\n }\n } else {\n throw f;\n }\n } finally {\n if (_messageContext.getTransportOut() != null) {\n _messageContext.getTransportOut().getSender()\n .cleanup(_messageContext);\n }\n }\n }", "private ResponseEntity<?> onPost(RequestEntity<String> requestEntity)\n throws IOException, ExecutionException, InterruptedException, InvalidKeyException,\n BadPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException,\n NoSuchPaddingException, ShortBufferException, InvalidKeySpecException,\n InvalidAlgorithmParameterException, NoSuchProviderException {\n\n getLogger().info(requestEntity.toString());\n\n final String authorization = requestEntity.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);\n final UUID sessionId;\n final To2DeviceSessionInfo session;\n final AuthToken authToken;\n\n try {\n authToken = new AuthToken(authorization);\n sessionId = authToken.getUuid();\n session = getSessionStorage().load(sessionId);\n\n } catch (IllegalArgumentException | NoSuchElementException e) {\n return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();\n }\n\n // if any instance is corrupted/absent, the session data is unavailable, so terminate the\n // connection.\n if (null != session && (!(session.getMessage41Store() instanceof Message41Store)\n || (null == session.getMessage41Store())\n || !(session.getMessage45Store() instanceof Message45Store)\n || (null == session.getMessage45Store())\n || !(session.getDeviceCryptoInfo() instanceof DeviceCryptoInfo)\n || null == session.getDeviceCryptoInfo())) {\n return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();\n }\n\n final String requestBody = null != requestEntity.getBody() ? requestEntity.getBody() : \"\";\n\n final ByteBuffer xb =\n new KexParamCodec().decoder().apply(CharBuffer.wrap(session.getMessage45Store().getXb()));\n final To2CipherContext cipherContext =\n new To2CipherContextFactory(getKeyExchangeDecoder(), getSecureRandom())\n .build(session.getMessage41Store(), xb.duplicate());\n\n final EncryptedMessageCodec encryptedMessageCodec = new EncryptedMessageCodec();\n final EncryptedMessage deviceEncryptedMessage =\n encryptedMessageCodec.decoder().apply(CharBuffer.wrap(requestBody));\n final ByteBuffer decryptedBytes = cipherContext.read(deviceEncryptedMessage);\n final CharBuffer decryptedText = US_ASCII.decode(decryptedBytes);\n getLogger().info(decryptedText.toString());\n\n final To2NextDeviceServiceInfo nextDeviceServiceInfo =\n new To2NextDeviceServiceInfoCodec().decoder().apply(decryptedText);\n\n final OwnershipProxy proxy = new OwnershipProxyCodec.OwnershipProxyDecoder()\n .decode(CharBuffer.wrap(session.getMessage41Store().getOwnershipProxy()));\n if (null == proxy) {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"OwnershipVoucher must not be null\"));\n }\n\n for (Object serviceInfoObject : getServiceInfoModules()) {\n\n if (serviceInfoObject instanceof ServiceInfoSink) {\n final ServiceInfoSink sink = (ServiceInfoSink) serviceInfoObject;\n\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n sink.putServiceInfo(entry);\n }\n\n } else if (serviceInfoObject instanceof ServiceInfoMultiSink) {\n final ServiceInfoMultiSink sink = (ServiceInfoMultiSink) serviceInfoObject;\n final ServiceInfo serviceInfos = new ServiceInfo();\n for (ServiceInfoEntry entry : nextDeviceServiceInfo.getDsi()) {\n serviceInfos.add(entry);\n }\n sink.putServiceInfo(proxy.getOh().getG(), serviceInfos);\n\n }\n }\n\n String responseBody;\n final OwnershipProxy newProxy;\n int nn = nextDeviceServiceInfo.getNn() + 1;\n if (nn < session.getMessage45Store().getNn()) {\n final StringWriter writer = new StringWriter();\n final To2GetNextDeviceServiceInfo getNextDeviceServiceInfo =\n new To2GetNextDeviceServiceInfo(nn, new PreServiceInfo());\n new To2GetNextDeviceServiceInfoCodec().encoder().apply(writer, getNextDeviceServiceInfo);\n newProxy = null;\n responseBody = writer.toString();\n\n } else {\n\n final OwnershipProxy currentProxy = proxy;\n final Setup devSetup =\n setupDeviceService.setup(currentProxy.getOh().getG(), currentProxy.getOh().getR());\n final To2SetupDeviceNoh setupDeviceNoh = new To2SetupDeviceNoh(devSetup.r3(), devSetup.g3(),\n new Nonce(CharBuffer.wrap(session.getMessage45Store().getN7())));\n\n final StringWriter bo = new StringWriter();\n new To2SetupDeviceNohCodec().encoder().apply(bo, setupDeviceNoh);\n\n final SignatureBlock noh =\n signatureServiceFactory.build(proxy.getOh().getG()).sign(bo.toString()).get();\n\n final OwnerServiceInfoHandler ownerServiceInfoHandler =\n new OwnerServiceInfoHandler(getServiceInfoModules(), proxy.getOh().getG());\n final int osinn = ownerServiceInfoHandler.getOwnerServiceInfoEntryCount();\n\n final To2SetupDevice setupDevice = new To2SetupDevice(osinn, noh);\n final StringWriter writer = new StringWriter();\n final PublicKeyCodec.Encoder pkEncoder =\n new PublicKeyCodec.Encoder(currentProxy.getOh().getPe());\n final SignatureBlockCodec.Encoder sgEncoder = new SignatureBlockCodec.Encoder(pkEncoder);\n new To2SetupDeviceCodec.Encoder(sgEncoder).encode(writer, setupDevice);\n responseBody = writer.toString();\n\n final OwnershipProxyHeader currentOh = currentProxy.getOh();\n final OwnershipProxyHeader newOh = new OwnershipProxyHeader(currentOh.getPe(), devSetup.r3(),\n devSetup.g3(), currentOh.getD(), noh.getPk(), currentOh.getHdc());\n newProxy = new OwnershipProxy(newOh, new HashMac(MacType.NONE, ByteBuffer.allocate(0)),\n currentProxy.getDc(), new LinkedList<>());\n }\n getLogger().info(responseBody);\n\n // if the CTR nonce is null, it means that the session's IV has been lost/corrupted. For CBC, it\n // should have been all 0s, while for CTR, it should contain the current nonce.\n if (null != session.getDeviceCryptoInfo().getCtrNonce()) {\n final ByteBuffer nonce = new ByteArrayCodec().decoder()\n .apply(CharBuffer.wrap(session.getDeviceCryptoInfo().getCtrNonce()));\n cipherContext.setCtrNonce(nonce.array());\n cipherContext.setCtrCounter(session.getDeviceCryptoInfo().getCtrCounter());\n } else {\n throw new SdoProtocolException(new SdoError(SdoErrorCode.MessageRefused,\n nextDeviceServiceInfo.getType(), \"no cipher initialization vector found\"));\n }\n final ByteBuffer responseBodyBuf = US_ASCII.encode(responseBody);\n final EncryptedMessage ownerEncryptedMessage = cipherContext.write(responseBodyBuf);\n\n final StringWriter writer = new StringWriter();\n encryptedMessageCodec.encoder().apply(writer, ownerEncryptedMessage);\n responseBody = writer.toString();\n\n final StringWriter opWriter = new StringWriter();\n if (null != newProxy) {\n new OwnershipProxyCodec.OwnershipProxyEncoder().encode(opWriter, newProxy);\n }\n final StringWriter ctrNonceWriter = new StringWriter();\n new ByteArrayCodec().encoder().apply(ctrNonceWriter,\n ByteBuffer.wrap(cipherContext.getCtrNonce()));\n\n final DeviceCryptoInfo deviceCryptoInfo =\n new DeviceCryptoInfo(ctrNonceWriter.toString(), cipherContext.getCtrCounter());\n final Message47Store message47Store = new Message47Store(opWriter.toString());\n final To2DeviceSessionInfo to2DeviceSessionInfo = new To2DeviceSessionInfo();\n to2DeviceSessionInfo.setMessage47Store(message47Store);\n to2DeviceSessionInfo.setDeviceCryptoInfo(deviceCryptoInfo);\n getSessionStorage().store(sessionId, to2DeviceSessionInfo);\n\n ResponseEntity<?> responseEntity =\n ResponseEntity.ok().header(HttpHeaders.AUTHORIZATION, authorization)\n .contentType(MediaType.APPLICATION_JSON).body(responseBody);\n\n getLogger().info(responseEntity.toString());\n return responseEntity;\n }", "java.lang.String getUserIdTwo();", "private void validateUser(user theUserOfThisAccount2) {\n\t\tboolean ok=false;\n\n\t\t\t\n\t\tif(passwordOfRegisteration.equals(passwordConfirm)&&!passwordOfRegisteration.equals(\"\")&&passwordOfRegisteration!=null){\n\t\t\tok=true;\n\t\t}\n\t\t\n\t\t\n\t\tif(ok){\n\t\t\t\n\t\t\t\ttheUserOfThisAccount2.setPassword(new Md5PasswordEncoder().encodePassword(passwordOfRegisteration,theUserOfThisAccount2.getUserName()));\n\t\t\t\tuserDataFacede.adduser(theUserOfThisAccount2);\n\t\t\t\tPrimeFaces.current().executeScript(\"new PNotify({\\r\\n\" + \n\t\t\t\t\t\t\"\t\t\ttitle: 'Success',\\r\\n\" + \n\t\t\t\t\t\t\"\t\t\ttext: 'Your data has been changed.',\\r\\n\" + \n\t\t\t\t\t\t\"\t\t\ttype: 'success'\\r\\n\" + \n\t\t\t\t\t\t\"\t\t});\");\n\t\t\t\n\t\t\t\n\t\t}else{\n\t\t\tpleaseCheck();\n\t\t\t\n\t\t}\n\t}", "public void onAuthenticateNewUserLogged(\n RetailscmUserContext userContext,\n LoginContext loginContext,\n LoginResult loginResult,\n IdentificationHandler idHandler,\n BusinessHandler bizHandler)\n throws Exception {\n // Generally speaking, when authenticated user logined, we will create a new account for\n // him/her.\n // you need do it like :\n // First, you should create new data such as:\n // OccupationType newOccupationType = this.createOccupationType(userContext, ...\n // Next, create a sec-user in your business way:\n // SecUser secUser = secUserManagerOf(userContext).createSecUser(userContext, login, mobile\n // ...\n // And set it into loginContext:\n // loginContext.getLoginTarget().setSecUser(secUser);\n // Next, create an user-app to connect secUser and newOccupationType\n // UserApp uerApp = userAppManagerOf(userContext).createUserApp(userContext, secUser.getId(),\n // ...\n // Also, set it into loginContext:\n // loginContext.getLoginTarget().setUserApp(userApp);\n // and in most case, this should be considered as \"login success\"\n // loginResult.setSuccess(true);\n //\n // Since many of detailed info were depending business requirement, So,\n throw new Exception(\"请重载函数onAuthenticateNewUserLogged()以处理新用户登录\");\n }", "@Override\n public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {\n super.onCodeSent(s, forceResendingToken);\n // when we receive the OTP it\n // contains a unique id which\n // we are storing in our string\n // which we have already created.\n verificationId = s;\n }", "public boolean signIn(final SimpleJsonCallback callBack) {\n ChatUser user = db.getUser();\n JSONObject jsonParameter = new JSONObject();\n try {\n jsonParameter.put(\"phone_number\", user.getPhone());\n jsonParameter.put(\"password\", user.getLinkaiPassword());\n } catch (JSONException e) {\n e.printStackTrace();\n }\n String url = Const.LINKAI_SIGNIN_URL;\n RequestQueue requestQueue = Volley.newRequestQueue(context);\n// run signin process asynchronous\n JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url, jsonParameter, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n setAccessToken(response);\n// calling get balance after each signing in\n getBalance();\n callBack.onSuccess(response);\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n error.printStackTrace();\n JSONObject errorObj=new JSONObject();\n try {\n errorObj.put(\"error\",error.networkResponse.data);\n } catch (Exception e) {\n e.printStackTrace();\n }\n callBack.onError(errorObj);\n }\n }) {\n @Override\n public Map<String, String> getHeaders() throws AuthFailureError {\n LinkaiRequestHeader linkaiRequestHeader = new LinkaiRequestHeader(context);\n return linkaiRequestHeader.getRequestHeaders();\n }\n };\n requestQueue.add(request);\n return true;\n }", "public static void main(String[] args) throws IOException,\n UnsupportedEncodingException, NoSuchAlgorithmException {\n boolean debug = false;\n String username, password, instruct, amount;\n String rawHash, authenRequest, challString, response;\n\n\n // handle illegal arguments\n if (args.length != 5) {\n if (args.length != 6 || !args[5].equals(\"-d\")) {\n throw new IllegalArgumentException(\"Parameter(s): <Server:Port> \" + \n \"<Username> <Password> <Action> <Amount> [<Debug>]\");\n } else {\n debug = true;\n }\n }\n\n // get all info from command line, handle invalid input\n String server = args[0].split(\":\")[0];\n int servPort;\n try {\n servPort = Integer.parseInt(args[0].split(\":\")[1]);\n }\n catch(NumberFormatException e) {\n System.out.println(\"Invalid Port #\");\n return;\n }\n if(servPort < 1024 || servPort > 9999){\n System.out.println(\"Invalid port number. Only 1024-9999.\");\n return;\n }\n username = args[1];\n password = args[2];\n instruct = args[3];\n if (!instruct.equalsIgnoreCase(\"deposit\") && !instruct.equalsIgnoreCase(\"withdraw\")) {\n System.out.println(\"Invalid Operation!\");\n return;\n }\n amount = args[4].trim();\n try {\n Double.valueOf(amount);\n }\n catch(NumberFormatException e) {\n System.out.println(\"Invalid Amount of Money\");\n return;\n }\n\n // Create socket that is connected to server on specified port\n Socket socket;\n try {\n socket = new Socket(server, servPort);\n } catch(UnknownHostException e) {\n System.out.println(\"Invalid server address\");\n return;\n }\n if (debug) System.out.println(\"Connected to server \" + server + \" at port #\" + servPort);\n\n InputStream in = socket.getInputStream();\n OutputStream out = socket.getOutputStream();\n DataOutputStream sendTo = new DataOutputStream(out);\n BufferedReader recevFrom = new BufferedReader(new InputStreamReader(in));\n\n //authentication request\n if (debug) System.out.println(\"Sending Authentication Request to Server\");\n authenRequest = \"Request for Authentication\";\n sendTo.writeBytes(authenRequest + \"\\n\");\n\n //get challenge string from server\n if (debug) System.out.println(\"Getting challenge...\");\n challString = recevFrom.readLine();\n if (debug) System.out.println(\"Challenge is \" + challString);\n\n // send username to server\n if (debug) System.out.println(\"Send Username to Server\");\n sendTo.writeBytes(username + \"\\n\");\n\n //concatenating username + password + challenge\n if (debug) System.out.println(\"Compute Hash Using MD5\");\n rawHash = username + password + challString;\n byte[] hash = generateMD5(rawHash);\n StringBuffer sb = new StringBuffer();\n for (byte b : hash) {\n sb.append(String.format(\"%02x\", b & 0xff));\n }\n if (debug) System.out.println(\"Hash is: \" + sb.toString());\n\n // send hash to server\n sendTo.writeBytes(sb.toString() + \"\\n\");\n if (debug) System.out.println(\"Sending Hash to Server\");\n\n // server's response about the request\n response = recevFrom.readLine();\n System.out.println(response);\n if (!response.equals(\"Verified\")) {\n System.out.println(\"Not Verified\");\n socket.close(); // Close the socket and its streams\n return;\n }\n\n // send action(deposit or withdraw)\n if(debug) System.out.println(\"Sending Action to Server...\");\n sendTo.writeBytes(instruct + \"\\n\");\n\n // send the amount of money\n if(debug) System.out.println(\"Sending Amount to Server...\");\n sendTo.writeBytes(amount + \"\\n\");\n\n // get how much money remains in the bank from server's response\n if(debug) System.out.println(\"Get Remain Money From Server\");\n System.out.println(recevFrom.readLine());\n if(debug) System.out.println(\"Finished, Close Server\");\n\n socket.close(); // Close the socket and its streams\n }", "private boolean autoAuthenticateDevice(String nonce) {\r\n\t\tString devCode = \"\";\r\n\t\tString authCode = \"\";\r\n\t\tString cr = \"\";\r\n\t\tMessage autoAuthenticate = new Message().addData(\"task\", \"transaction\").addData(\"message\",\r\n\t\t\t\t\"authenticate_device\");\r\n\t\tMessage reply;\r\n\r\n\t\ttry {\r\n\t\t\t// checks if file is existant and reads the device code\r\n\t\t\tFile device = new File(\"resources/device_\" + this.connectionData.getUsername());\r\n\t\t\tif (!device.exists()) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(device));\r\n\t\t\tdevCode = br.readLine();\r\n\t\t\tbr.close();\r\n\t\t\t// generated authcode\r\n\t\t\tauthCode = devCode.split(\";\")[1];\r\n\t\t\tdevCode = devCode.split(\";\")[0];\r\n\r\n\t\t\tdevCode = this.connectionData.getAes().encode(devCode);\r\n\r\n\t\t\t// generate chalange-response\r\n\r\n\t\t\tcr = new Hash(authCode + nonce).toString();\r\n\t\t\tautoAuthenticate.addData(\"device\", devCode);\r\n\t\t\tautoAuthenticate.addData(\"cr\", cr);\r\n\t\t\tthis.connectionData.getConnection().write(autoAuthenticate);\r\n\t\t\treply = this.connectionData.getConnection().read();\r\n\t\t\tif (reply.getData(\"message\").equals(\"failed\")) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "public static void anothertransaction(){\n\t\tSystem.out.println(\"Do you want to Continue ?Press \\n1 for another transaction\\n5 To exit\");\n\t\tanothertransaction=in.nextInt();\n\t\tif(anothertransaction == 1){\n transaction(); // call transaction method\n } else if(anothertransaction == 5){\n System.out.println(\"Thanks for choosing us. Good Bye!\");\n } else {\n System.out.println(\"Invalid choice\\n\\n\");\n anothertransaction();\n }\n }", "public void confirmSignUp(Activity activity, CognitoUser user, String confirmCode,\n boolean forcedAliasCreation, GenericHandler confirmHandler) {\n // Callback for Cognito sign up confirmation\n GenericHandler wrapperConfirmHandler = new GenericHandler() {\n @Override\n public void onSuccess() {\n // Bayun Registration success Callback\n Handler.Callback bayunAuthSuccess = msg -> {\n confirmHandler.onSuccess();\n return false;\n };\n\n\n // Bayun Registration failure Callback\n Handler.Callback bayunAuthFailure = msg -> {\n Exception exception = new Exception(msg.getData().getString(Constants.ERROR));\n confirmHandler.onFailure(exception);\n return false;\n };\n\n // Bayun Registration authorizeEmployeeCallback Callback\n Handler.Callback authorizeEmployeeCallback = msg -> {\n String employeePublicKey = msg.getData().getString(Constants.EMPLOYEE_PUBLICKEY);\n Exception exception = new Exception(\"Employee Authorization is Pending\");\n confirmHandler.onFailure(exception);\n return false;\n };\n\n // Registration with Bayun\n BasicBayunCredentials basicBayunCredentials = new BasicBayunCredentials\n (appId, companyName, user.getUserId(), signUpPassword.toCharArray(),\n appSecret, applicationKeySalt);\n\n\n if(signUpIsRegisterWithPwd){\n BayunApplication.bayunCore.registerEmployeeWithPassword\n (activity,companyName,user.getUserId(),signUpPassword, authorizeEmployeeCallback, bayunAuthSuccess, bayunAuthFailure);\n }else {\n BayunApplication.bayunCore.registerEmployeeWithoutPassword(activity,companyName,user.getUserId()\n ,signUpEmail,false, authorizeEmployeeCallback,\n null,null,null, bayunAuthSuccess, bayunAuthFailure);\n\n }\n// BayunApplication.bayunCore.registerEmployeeWithPassword\n// (activity,companyName,user.getUserId(),signUpPassword, authorizeEmployeeCallback, bayunAuthSuccess, bayunAuthFailure);\n\n\n }\n\n @Override\n public void onFailure(Exception exception) {\n confirmHandler.onFailure(exception);\n }\n };\n\n // Confirmation call with Cognito\n user.confirmSignUpInBackground(confirmCode, forcedAliasCreation, wrapperConfirmHandler);\n }", "@Test\n public void testGetUser2F() throws Exception {\n User user = newUser();\n TwoFactorInfo tfi = new TwoFactorInfo(user.getIdentifier(), getRandomString(256));\n get2FStore().save(tfi);\n XMLMap m = getDBSClient().getUser(user.getIdentifier());\n checkUserAgainstMap(m, user);\n TwoFactorSerializationKeys t2k = new TwoFactorSerializationKeys();\n assert m.get(t2k.info()).toString().equals(tfi.getInfo());\n\n // API dictates that any call for the user that does not just use the id requires all 6 parameters\n m = getDBSClient().getUser(user);\n assert m.containsKey(t2k.info()) : \"Getting user with remote-user that has two factor does not return two factor information.\";\n checkUserAgainstMap(m, user, true);\n assert m.get(t2k.info()).toString().equals(tfi.getInfo());\n\n // Next test gets a user via the servlet and checks it was updated in the store\n m = getDBSClient().getUser(user.getUserMultiKey(), user.getIdP(),\n user.getIDPName() + \"foo1\",\n user.getFirstName() + \"foo2\",\n user.getLastName() + \"foo3\",\n user.getEmail() + \"foo4\",\n user.getAffiliation() + \"foo\",\n user.getDisplayName() + \"foo\",\n user.getOrganizationalUnit() + \"foo\");\n user = getUserStore().get(user.getIdentifier());\n checkUserAgainstMap(m, user);\n assert m.get(t2k.info()).toString().equals(tfi.getInfo());\n\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] server_response) {\n try {\n String response = String.valueOf(new String(server_response, \"UTF-8\"));\n login_progress.dismiss();\n /* parse xml response */\n XMLParser parser = new XMLParser();\n Document doc = parser.getDomElement(response, url);\n\n if (doc == null) {\n Dialog.simpleWarning(Lang.get(\"returned_xml_failed\"), context);\n } else {\n NodeList accountNode = doc.getElementsByTagName(\"account\");\n Element element = (Element) accountNode.item(0);\n\n /* list of status to offer \"Contact Us\" page */\n String status = Utils.getNodeByName(element, \"status\");\n String[] tmp_status = {\"approval\", \"pending\", \"trash\"};\n List<String> contact_status = Utils.string2list(tmp_status);\n\n /* error */\n if (status.equals(\"error\")) {\n Dialog.simpleWarning(Lang.get(\"dialog_login_error\"), context);\n password.setText(\"\");\n } else if (status.equals(\"incomplete\")) {\n Dialog.simpleWarning(Lang.get(\"dialog_login_\" + status + \"_info\"), context);\n }\n /* status matched contact us message logic */\n else if (contact_status.indexOf(status) >= 0) {\n DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n Intent intent = new Intent(Config.context, SendFeedbackActivity.class);\n intent.putExtra(\"selection\", \"contact_us\");\n Config.context.startActivity(intent);\n }\n };\n\n Dialog.CustomDialog(Lang.get(\"dialog_login_\" + status), Lang.get(\"dialog_login_\" + status + \"_info\"), context, listener);\n }\n\n /* do login if account */\n if (!Utils.getNodeByName(element, \"id\").isEmpty()) {\n /* hide keyboard */\n Utils.hideKeyboard(login_form.findFocus());\n\n confirmLogin(accountNode);\n }\n }\n\n } catch (UnsupportedEncodingException e1) {\n\n }\n }", "@Test\n public void SameTokenNameOpenSuccessExchangeWithdraw2() {\n dbManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);\n InitExchangeSameTokenNameActive();\n long exchangeId = 2;\n String firstTokenId = \"_\";\n long firstTokenQuant = 1_000_000_000000L;\n String secondTokenId = \"456\";\n long secondTokenQuant = 4_000_000L;\n\n byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_FIRST);\n AccountCapsule accountCapsule = dbManager.getAccountStore().get(ownerAddress);\n Map<String, Long> assetV2Map = accountCapsule.getAssetMapV2();\n Assert.assertEquals(10000_000000L, accountCapsule.getBalance());\n Assert.assertEquals(null, assetV2Map.get(secondTokenId));\n\n ExchangeWithdrawActuator actuator = new ExchangeWithdrawActuator(getContract(\n OWNER_ADDRESS_FIRST, exchangeId, firstTokenId, firstTokenQuant),\n dbManager);\n TransactionResultCapsule ret = new TransactionResultCapsule();\n\n try {\n actuator.validate();\n actuator.execute(ret);\n Assert.assertEquals(ret.getInstance().getRet(), code.SUCESS);\n // V1,Data is no longer update\n Assert.assertFalse(dbManager.getExchangeStore().has(ByteArray.fromLong(exchangeId)));\n //V2\n ExchangeCapsule exchangeCapsuleV2 = dbManager.getExchangeV2Store()\n .get(ByteArray.fromLong(exchangeId));\n Assert.assertNotNull(exchangeCapsuleV2);\n Assert.assertEquals(ByteString.copyFrom(ownerAddress), exchangeCapsuleV2.getCreatorAddress());\n Assert.assertEquals(exchangeId, exchangeCapsuleV2.getID());\n Assert.assertEquals(1000000, exchangeCapsuleV2.getCreateTime());\n Assert\n .assertTrue(Arrays.equals(firstTokenId.getBytes(), exchangeCapsuleV2.getFirstTokenId()));\n Assert.assertEquals(firstTokenId, ByteArray.toStr(exchangeCapsuleV2.getFirstTokenId()));\n Assert.assertEquals(0L, exchangeCapsuleV2.getFirstTokenBalance());\n Assert.assertEquals(secondTokenId, ByteArray.toStr(exchangeCapsuleV2.getSecondTokenId()));\n Assert.assertEquals(0L, exchangeCapsuleV2.getSecondTokenBalance());\n\n accountCapsule = dbManager.getAccountStore().get(ownerAddress);\n assetV2Map = accountCapsule.getAssetMapV2();\n Assert.assertEquals(firstTokenQuant + 10000_000000L, accountCapsule.getBalance());\n Assert.assertEquals(10_000_000L, assetV2Map.get(secondTokenId).longValue());\n\n } catch (ContractValidateException e) {\n logger.info(e.getMessage());\n Assert.assertFalse(e instanceof ContractValidateException);\n } catch (ContractExeException e) {\n Assert.assertFalse(e instanceof ContractExeException);\n } catch (ItemNotFoundException e) {\n Assert.assertFalse(e instanceof ItemNotFoundException);\n } finally {\n dbManager.getExchangeStore().delete(ByteArray.fromLong(1L));\n dbManager.getExchangeStore().delete(ByteArray.fromLong(2L));\n dbManager.getExchangeV2Store().delete(ByteArray.fromLong(1L));\n dbManager.getExchangeV2Store().delete(ByteArray.fromLong(2L));\n }\n }", "private void lookupUserAccount() {\n String userId = tokens.getString(\"principalID\", \"\");\n String accessToken = tokens.getString(\"authorisationToken\", \"\");\n\n if (!\"\".equals(userId) && !\"\".equals(accessToken)) {\n // Make new json request\n String url = String.format(Constants.APIUrls.lookupUserAccount, userId);\n JsonRequest jsonRequest = new JsonObjectRequest(Request.Method.GET, url, null,\n new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n String email;\n try {\n email = response.getString(\"email\");\n } catch (JSONException ex){\n email = \"unknown\";\n }\n String name;\n try{\n JSONObject nameObject = response.getJSONObject(\"name\");\n String firstName = nameObject.getString(\"givenName\");\n String lastName = nameObject.getString(\"familyName\");\n name = firstName + \" \" + lastName;\n } catch (JSONException ex){\n name = \"unknown\";\n }\n Boolean accountBlocked;\n try{\n JSONObject accountInfo = response.getJSONObject(\"urn:mace:oclc.org:eidm:schema:persona:wmscircselfinfo:20180101\").getJSONObject(\"circulationInfo\");\n accountBlocked = accountInfo.getBoolean(\"isCircBlocked\");\n } catch (JSONException ex){\n ex.printStackTrace();\n accountBlocked = true;\n }\n String borrowerCategory;\n try {\n JSONObject accountInfo = response.getJSONObject(\"urn:mace:oclc.org:eidm:schema:persona:wmscircselfinfo:20180101\").getJSONObject(\"circulationInfo\");\n borrowerCategory = accountInfo.getString(\"borrowerCategory\");\n } catch (JSONException ex){\n borrowerCategory = \"\";\n }\n String userBarcode;\n try {\n JSONObject accountInfo = response.getJSONObject(\"urn:mace:oclc.org:eidm:schema:persona:wmscircselfinfo:20180101\").getJSONObject(\"circulationInfo\");\n userBarcode = accountInfo.getString(\"barcode\");\n } catch (JSONException ex){\n userBarcode = \"\";\n }\n tokens.edit().putString(\"name\", name).apply();\n tokens.edit().putString(\"email\", email).apply();\n tokens.edit().putBoolean(\"accountBlocked\", accountBlocked).apply();\n tokens.edit().putString(\"borrowerCategory\", borrowerCategory).apply();\n tokens.edit().putString(\"userBarcode\", userBarcode).apply();\n sendBroadcast(new Intent(Constants.IntentActions.LOOKUP_USER_ACCOUNT_RESPONSE));\n LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(new Intent(Constants.IntentActions.LOOKUP_USER_ACCOUNT_RESPONSE));\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n sendBroadcast(new Intent(Constants.IntentActions.LOOKUP_USER_ACCOUNT_ERROR));\n }\n }\n ){\n @Override\n public Map<String, String> getHeaders() {\n Map<String, String> headers = new HashMap<>();\n headers.put(\"Authorization\", accessToken);\n return headers;\n }\n };\n\n requestQueue.add(jsonRequest);\n\n\n Log.e(TAG, \"user response sent\");\n }\n\n }", "@BodyParser.Of(BodyParser.Json.class)\n @Transactional\n public static Result add(String accessToken) {\n AccessToken access = AccessTokens.access(accessToken);\n Result error = Access.checkAuthentication(access, Access.AuthenticationType.NOT_CONNECTED_USER);\n if (error != null) {\n \treturn error;\n }\n\n JsonNode root = request().body().asJson();\n\n if (root == null) {\n \treturn new errors.Error(errors.Error.Type.JSON_REQUIRED).toResponse();\n }\n\n errors.Error parametersErrors = new errors.Error(Type.PARAMETERS_ERROR);\n String email = root.path(\"email\").textValue();\n String password = root.path(\"password\").textValue();\n String firstname = root.path(\"first_name\").textValue();\n String lastname = root.path(\"last_name\").textValue();\n checkParams(true, email, password, firstname, lastname, parametersErrors);\n \n if (parametersErrors.isParameterError())\n \treturn parametersErrors.toResponse();\n \n // Beta Handling\n BetaInvitation betaInvitation = BetaInvitation.find.where().eq(\"email\", email).findUnique();\n if (betaInvitation == null) {\n \tbetaInvitation = new BetaInvitation(null, email, password, firstname, lastname, State.REQUESTING);\n \tbetaInvitation.lang = access.lang;\n \tbetaInvitation.save();\n \tMailer.get().sendMail(EmailType.BETA_REQUEST_SENT, access.getLang(), email, ImmutableMap.of(\"FIRSTNAME\", firstname, \"LASTNAME\", lastname));\n \treturn status(ACCEPTED);\n } else if (betaInvitation.state == State.INVITED) { \n\t User newUser = new User(email, password, firstname, lastname);\n\t updateOneUser(newUser, root);\n\t newUser.save();\n\t \n\t // Beta Handling\n\t betaInvitation.createdUser = newUser;\n\t betaInvitation.state = State.CREATED;\n\t betaInvitation.save();\n\t return created(getUserObjectNode(newUser));\n } else {\n \treturn new errors.Error(errors.Error.Type.BETA_PROCESSING).toResponse();\n }\n }" ]
[ "0.7057637", "0.55897385", "0.5484281", "0.5354397", "0.53484404", "0.5212885", "0.5170457", "0.5116293", "0.5080429", "0.5041548", "0.5012382", "0.50091034", "0.49850976", "0.49397478", "0.49281457", "0.48945698", "0.48843488", "0.48729706", "0.48687753", "0.48681888", "0.48657718", "0.48469317", "0.48384237", "0.48379079", "0.4830391", "0.48297703", "0.48070794", "0.4792326", "0.47911042", "0.47910807", "0.47906268", "0.476441", "0.47571495", "0.4754754", "0.47383034", "0.47324052", "0.47258636", "0.4722554", "0.46928698", "0.4682092", "0.46772963", "0.46769366", "0.46758077", "0.46599466", "0.46576312", "0.465196", "0.46498135", "0.46416727", "0.46392286", "0.46336484", "0.46328393", "0.46187064", "0.46144536", "0.46135885", "0.4609288", "0.46064985", "0.46006814", "0.4600059", "0.45884755", "0.4587866", "0.4583267", "0.4577308", "0.45762885", "0.4565834", "0.45655242", "0.45510086", "0.45484456", "0.45374754", "0.45341158", "0.4526702", "0.45229265", "0.45214003", "0.45202103", "0.45199975", "0.45190853", "0.45171294", "0.45158172", "0.45147794", "0.4505634", "0.45031682", "0.45007768", "0.44868854", "0.44858524", "0.44847986", "0.44847322", "0.44798067", "0.44793838", "0.44729722", "0.44683322", "0.44645298", "0.44583097", "0.44545996", "0.44542974", "0.4448663", "0.4448247", "0.44407406", "0.44396883", "0.44378343", "0.44360065", "0.44358963" ]
0.65908694
1
Handles fourth transaction of Bilateral Auth. Protocol Verifies Server's nonce, stores value of sessionKey, and sends a response to the User
private byte[] handleAuthPt2(byte[] payload) { byte[] message = ComMethods.decryptRSA(payload, my_n, my_d); ComMethods.report("SecretServer has decrypted the User's message using SecretServer's private RSA key.", simMode); if (!Arrays.equals(Arrays.copyOf(message, myNonce.length), myNonce)) { ComMethods.report("ERROR ~ invalid third message in protocol.", simMode); return "error".getBytes(); } else { // Authentication done! currentSessionKey = Arrays.copyOfRange(message, myNonce.length, message.length); activeSession = true; counter = 11; // use "preparePayload" from now on for all outgoing messages byte[] responsePayload = preparePayload("understood".getBytes()); counter = 13; return responsePayload; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] server_response) {\n try {\n String response = String.valueOf(new String(server_response, \"UTF-8\"));\n Log.e(TAG, \"response login=>\" + response);\n /* hide progressbar */\n progress.dismiss();\n\n /* parse xml response */\n XMLParser parser = new XMLParser();\n Document doc = parser.getDomElement(response, url);\n\n if (doc == null) {\n Dialog.simpleWarning(Lang.get(\"returned_xml_failed\"), context);\n } else {\n NodeList errorsNode = doc.getElementsByTagName(\"errors\");\n\n /* handle errors */\n if (errorsNode.getLength() > 0) {\n Element element = (Element) errorsNode.item(0);\n NodeList errors = element.getChildNodes();\n\n if (errors.getLength() > 0) {\n Element error = (Element) errors.item(0);\n String key_error = error.getTextContent();\n Dialog.simpleWarning(Lang.get(key_error), context);\n }\n }\n /* process login */\n else {\n NodeList accountNode = doc.getElementsByTagName(\"account\");\n confirmLogin(accountNode);\n alertDialog.dismiss();\n }\n }\n\n } catch (UnsupportedEncodingException e1) {\n\n }\n }", "private boolean autoAuthenticateDevice(String nonce) {\r\n\t\tString devCode = \"\";\r\n\t\tString authCode = \"\";\r\n\t\tString cr = \"\";\r\n\t\tMessage autoAuthenticate = new Message().addData(\"task\", \"transaction\").addData(\"message\",\r\n\t\t\t\t\"authenticate_device\");\r\n\t\tMessage reply;\r\n\r\n\t\ttry {\r\n\t\t\t// checks if file is existant and reads the device code\r\n\t\t\tFile device = new File(\"resources/device_\" + this.connectionData.getUsername());\r\n\t\t\tif (!device.exists()) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(device));\r\n\t\t\tdevCode = br.readLine();\r\n\t\t\tbr.close();\r\n\t\t\t// generated authcode\r\n\t\t\tauthCode = devCode.split(\";\")[1];\r\n\t\t\tdevCode = devCode.split(\";\")[0];\r\n\r\n\t\t\tdevCode = this.connectionData.getAes().encode(devCode);\r\n\r\n\t\t\t// generate chalange-response\r\n\r\n\t\t\tcr = new Hash(authCode + nonce).toString();\r\n\t\t\tautoAuthenticate.addData(\"device\", devCode);\r\n\t\t\tautoAuthenticate.addData(\"cr\", cr);\r\n\t\t\tthis.connectionData.getConnection().write(autoAuthenticate);\r\n\t\t\treply = this.connectionData.getConnection().read();\r\n\t\t\tif (reply.getData(\"message\").equals(\"failed\")) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "private void getAUTH_REQUEST() throws Exception {\n\t\t\n\t\tboolean status = true;\n\t\tboolean status2 = false;\n\t\tString msg = \"\";\n\t\t\n\t\t//File filePK = new File(\"identity\");\n\t\n\t\ttry {\n\t\t\t\n\t\t\tmsg = br.readLine();\n\t\t\tGetTimestamp(\"Received Authorization Request from Client: \" + msg);\n\t\t\t\n\t\t\tJSONObject REQUEST = (JSONObject) parser.parse(msg);\n\t String identity = REQUEST.get(\"identity\").toString();\n\t\t\t\n\t\t\t\n\t if((identity.contains(\"aaron@krusty\"))) {\n\n\t \tGetTimestamp(\"Authorization Request from Client is approved: \");\n\n\t \tGetTimestamp(\"Client Publickey is stored: \" ) ;\n\n\t \tString tosend = encrypt1(getSharedKey(), getClientPublicKey());\n\n\t \tGetTimestamp(\"Server sharedkey is being encrypted with Client's publickey to be sent: \") ;\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"AES128\", tosend);\n\t \tRESPONSE.put(\"status\", status);\n\t \tRESPONSE.put(\"message\", \"public key found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tGetTimestamp(\"Sending Authorization Response to Client: \");\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\n\n\t }\n\t else {\n\n\t \tSystem.out.println(\"Client \" + REQUEST.get(\"identity\") + \" has been rejected\");\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"status\", status2);\n\t \tRESPONSE.put(\"message\", \"public key not found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\t \tcloseConnection();\n\t }\n\t\t\t\t\n\t\t\t\n\t\t} catch (IOException ex) {\n\t\t\tLogger.getLogger(ServerTCP.class.getName()).log(Level.SEVERE, null, ex);\n\t\t}\n\t\tif (msg.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"Client has signed out!\");\n\t\t\tcloseConnection();\n\n\t\t} else {\t\n\t\t\tgetMessage();\n\t\t}\n\t}", "@Override\n public void handle(AuthDataEvent event, Channel channel)\n {\n PacketReader reader = new PacketReader(event.getBuffer());\n ChannelBuffer buffer =ChannelBuffers.buffer(ByteOrder.LITTLE_ENDIAN, 1024);\n buffer.writeBytes(event.getBuffer());\n \n int ptype = buffer.readUnsignedShort();\n \n //Skip over the length field since it's checked in decoder\n reader.setOffset(2);\n\n int packetType = reader.readUnSignedShort();\n\n switch (packetType)\n {\n /*\n * Auth Request\n * 0\t ushort 52\n * 2\t ushort 1051\n * 4\t string[16]\t Account_Name\n * 20\t string[16]\t Account_Password\n * 36\t string[16]\t GameServer_Name\n */\n case PacketTypes.AUTH_REQUEST:\n String username = reader.readString(16).trim();\n String password = reader.readString(16).trim();\n String server = reader.readString(16).trim();\n\n //If valid forward to game server else boot them\n if (db.isUserValid(username, \"root\"))\n {\n byte []packet = AuthResponse.build(db.getAcctId(username), \"127.0.0.1\", 8080);\n \n event.getClient().getClientCryptographer().Encrypt(packet);\n \n ChannelBuffer buf = ChannelBuffers.buffer(packet.length);\n \n buf.writeBytes(packet);\n \n ChannelFuture complete = channel.write(buf);\n \n //Close the channel once packet is sent\n complete.addListener(new ChannelFutureListener() {\n\n @Override\n public void operationComplete(ChannelFuture arg0) throws Exception {\n arg0.getChannel().close();\n }\n });\n \n } else\n channel.close();\n \n \n MyLogger.appendLog(Level.INFO, \"Login attempt from \" + username + \" => \" + password + \" Server => \" + server);\n break;\n \n default:\n MyLogger.appendLog(Level.INFO, \"Unkown packet: ID = \" + packetType + new String(event.getBuffer())); \n break;\n }\n }", "@Override\n public void onLoginRequired() throws RemoteException {\n final PoyntError error = new PoyntError(PoyntError.CODE_API_ERROR);\n listener.onResponse(transaction, requestId, error);\n }", "private byte[] handleAuthPt1(byte[] payload) {\n\t\tboolean userIdentified = false;\n\t\tbyte[] supposedUser = null;\n\n//\n\t\tSystem.out.println(\"payload received by SecretServer:\");\n\t\tComMethods.charByChar(payload,true);\n//\n\n\t\tuserNum = -1;\n\t\twhile (userNum < validUsers.length-1 && !userIdentified) {\n\t\t\tuserNum++;\n\t\t\tsupposedUser = validUsers[userNum].getBytes();\n\t\t\tuserIdentified = Arrays.equals(Arrays.copyOf(payload, supposedUser.length), supposedUser);\n\n//\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"\\\"\"+validUsers[userNum]+\"\\\" in bytes:\");\n\t\t\tComMethods.charByChar(validUsers[userNum].getBytes(),true);\n\t\t\tSystem.out.println(\"\\\"Arrays.copyOf(payload, supposedUser.length\\\" in bytes:\");\n\t\t\tComMethods.charByChar(Arrays.copyOf(payload, supposedUser.length),true);\n\t\t\tSystem.out.println();\n//\n\t\t}\n\n\t\tif (!userIdentified) {\n\t\t\tComMethods.report(\"SecretServer doesn't recognize name of valid user.\", simMode);\n\t\t\treturn \"error\".getBytes();\n\t\t} else {\n\t\t\t// Process second half of message, and verify format\n\t\t\tbyte[] secondHalf = Arrays.copyOfRange(payload, supposedUser.length, payload.length);\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tsecondHalf = ComMethods.decryptRSA(secondHalf, my_n, my_d);\n\n//\n\tSystem.out.println(\"secondHalf = \"+secondHalf);\n//\n\t\t\tComMethods.report(\"SecretServer has decrypted the second half of the User's message using SecretServer's private RSA key.\", simMode);\n\n\t\t\tif (!Arrays.equals(Arrays.copyOf(secondHalf, supposedUser.length), supposedUser)) {\n\t\t\t\t// i.e. plaintext name doesn't match the encrypted bit\n\t\t\t\tComMethods.report(\"ERROR ~ invalid first message in protocol.\", simMode);\t\t\t\t\n\t\t\t\treturn \"error\".getBytes();\n\t\t\t} else {\n\t\t\t\t// confirmed: supposedUser is legit. user\n\t\t\t\tcurrentUser = new String(supposedUser); \n\t\t\t\tuserSet = true;\n\t\t\t\tbyte[] nonce_user = Arrays.copyOfRange(secondHalf, supposedUser.length, secondHalf.length);\n\n\t\t\t\t// Second Message: B->A: E_kA(nonce_A || Bob || nonce_B)\n\t\t\t\tmyNonce = ComMethods.genNonce();\n\t\t\t\tComMethods.report(\"SecretServer has randomly generated a 128-bit nonce_srvr = \"+myNonce+\".\", simMode);\n\t\t\t\n\t\t\t\tbyte[] response = ComMethods.concatByteArrs(nonce_user, \"SecretServer\".getBytes(), myNonce);\n\t\t\t\tbyte[] responsePayload = ComMethods.encryptRSA(response, usersPubKeys1[userNum], BigInteger.valueOf(usersPubKeys2[userNum]));\n\t\t\t\treturn responsePayload;\n\t\t\t}\n\t\t}\n\t}", "private static boolean handle_nextnonce(AuthorizationInfo authorizationInfo, RoRequest roRequest, HttpHeaderElement httpHeaderElement) {\n AuthorizationInfo authorizationInfo2;\n if (authorizationInfo == null || httpHeaderElement == null || httpHeaderElement.getValue() == null) {\n return false;\n }\n try {\n authorizationInfo2 = AuthorizationInfo.getAuthorization(authorizationInfo, roRequest, null, false, false);\n }\n catch (AuthSchemeNotImplException authSchemeNotImplException) {\n authorizationInfo2 = authorizationInfo;\n }\n AuthorizationInfo authorizationInfo3 = authorizationInfo2;\n synchronized (authorizationInfo3) {\n NVPair[] arrnVPair = authorizationInfo2.getParams();\n arrnVPair = Util.setValue(arrnVPair, \"nonce\", httpHeaderElement.getValue());\n arrnVPair = Util.setValue(arrnVPair, \"nc\", \"00000000\", false);\n authorizationInfo2.setParams(arrnVPair);\n }\n return true;\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] server_response) {\n try {\n String response = String.valueOf(new String(server_response, \"UTF-8\"));\n /* hide progressbar */\n progress.dismiss();\n\n /* parse xml response */\n XMLParser parser = new XMLParser();\n Document doc = parser.getDomElement(response, url);\n\n if (doc == null) {\n Dialog.simpleWarning(Lang.get(\"returned_xml_failed\"), context);\n } else {\n NodeList errorsNode = doc.getElementsByTagName(\"errors\");\n\n /* handle errors */\n if (errorsNode.getLength() > 0) {\n Element element = (Element) errorsNode.item(0);\n NodeList errors = element.getChildNodes();\n\n if (errors.getLength() > 0) {\n Element error = (Element) errors.item(0);\n String key_error = error.getTextContent();\n if (key_error.equals(\"fb_email_exists\")) {\n checkFbPassword(formData, context);\n } else {\n Dialog.simpleWarning(Lang.get(key_error), context);\n }\n LoginManager.getInstance().logOut();\n }\n }\n /* process login */\n else {\n NodeList accountNode = doc.getElementsByTagName(\"account\");\n confirmLogin(accountNode);\n }\n }\n\n } catch (UnsupportedEncodingException e1) {\n\n }\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] server_response) {\n try {\n String response = String.valueOf(new String(server_response, \"UTF-8\"));\n login_progress.dismiss();\n /* parse xml response */\n XMLParser parser = new XMLParser();\n Document doc = parser.getDomElement(response, url);\n\n if (doc == null) {\n Dialog.simpleWarning(Lang.get(\"returned_xml_failed\"), context);\n } else {\n NodeList accountNode = doc.getElementsByTagName(\"account\");\n Element element = (Element) accountNode.item(0);\n\n /* list of status to offer \"Contact Us\" page */\n String status = Utils.getNodeByName(element, \"status\");\n String[] tmp_status = {\"approval\", \"pending\", \"trash\"};\n List<String> contact_status = Utils.string2list(tmp_status);\n\n /* error */\n if (status.equals(\"error\")) {\n Dialog.simpleWarning(Lang.get(\"dialog_login_error\"), context);\n password.setText(\"\");\n } else if (status.equals(\"incomplete\")) {\n Dialog.simpleWarning(Lang.get(\"dialog_login_\" + status + \"_info\"), context);\n }\n /* status matched contact us message logic */\n else if (contact_status.indexOf(status) >= 0) {\n DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n Intent intent = new Intent(Config.context, SendFeedbackActivity.class);\n intent.putExtra(\"selection\", \"contact_us\");\n Config.context.startActivity(intent);\n }\n };\n\n Dialog.CustomDialog(Lang.get(\"dialog_login_\" + status), Lang.get(\"dialog_login_\" + status + \"_info\"), context, listener);\n }\n\n /* do login if account */\n if (!Utils.getNodeByName(element, \"id\").isEmpty()) {\n /* hide keyboard */\n Utils.hideKeyboard(login_form.findFocus());\n\n confirmLogin(accountNode);\n }\n }\n\n } catch (UnsupportedEncodingException e1) {\n\n }\n }", "@Override\n public void onSuccess(CognitoUserSession userSession, CognitoDevice newDevice) {\n Handler.Callback bayunAuthSuccess = msg -> {\n String bucketName = \"bayun-test-\" + companyName;\n bucketName = bucketName.toLowerCase();\n BayunApplication.tinyDB.putString(Constants.S3_BUCKET_NAME, bucketName);\n\n BayunApplication.tinyDB\n .putString(Constants.SHARED_PREFERENCES_IS_BAYUN_LOGGED_IN,\n Constants.YES);\n authenticationHandler.onSuccess(userSession, newDevice);\n return false;\n };\n\n // Bayun login failure Callback\n Handler.Callback bayunAuthFailure = msg -> {\n Exception exception = new Exception(msg.getData().getString(Constants.ERROR));\n user.signOut();\n authenticationHandler.onFailure(exception);\n return false;\n };\n\n // Bayun login authorizeEmployeeCallback Callback\n Handler.Callback authorizeEmployeeCallback = msg -> {\n String employeePublicKey = msg.getData().getString(Constants.EMPLOYEE_PUBLICKEY);\n Exception exception = new Exception(\"Employee Authorization is Pending\");\n authenticationHandler.onFailure(exception);\n return false;\n };\n\n // login with Bayun\n BayunApplication.bayunCore.loginWithPassword(activity,companyName,username,\n password,false,authorizeEmployeeCallback,null,null,bayunAuthSuccess, bayunAuthFailure);\n }", "public boolean authenticateUser() {\r\n try {\r\n \r\n firstServerMessage();\r\n sendKeys();\r\n sessionKeyMsg();\r\n \r\n \r\n \r\n \treturn true;\r\n }\r\n \r\n catch(Exception ioe){\r\n System.out.println(\"Terminating session with Acct#: \" + currAcct.getNumber());\r\n //ioe.printStackTrace();\r\n return false;\r\n }\r\n \r\n }", "public boolean doTransaction() {\r\n int nonce = -1;\r\n TransactionOperation transactionOperation = null;\r\n try {\r\n double balance;\r\n \r\n //read the stream for requests from client\r\n byte[] cipherText = (byte [])is.readObject();\r\n \r\n // decrypt the ciphertext to obtain the signed message\r\n ATMSessionMessage atmSessionMessage = (ATMSessionMessage) crypto.decryptRijndael(cipherText, kSession);\r\n if(!(currTimeStamp < atmSessionMessage.getTimeStamp())) error (\"Time stamp does not match\");\r\n \r\n //interpret the transaction operation in the request\r\n SignedMessage signedMessage = atmSessionMessage.getSignedMessage();\r\n \r\n \r\n \t\t//verify signature\r\n \t\ttry {\r\n \t\t\tif(!crypto.verify(signedMessage.msg, signedMessage.signature, currAcct.kPub))\r\n \t\t\t{\r\n \t\t\t\tSystem.out.println(\"Digital signature failed...\");\r\n \t\t\t}\r\n \t\t\tSystem.out.println(\"Message signature valid...\");\r\n \t\t} catch (SignatureException e2) {\r\n \t\t\te2.printStackTrace();\r\n \t\t\treturn false;\r\n \t\t} catch (KeyException e2) {\r\n \t\t\te2.printStackTrace();\r\n \t\t\treturn false;\r\n \t\t}\r\n \t\t\r\n TransactionMessage transactionMessage = (TransactionMessage)signedMessage.getObject();\r\n transactionOperation = transactionMessage.getOperation();\r\n \r\n //print the signed message\r\n System.out.println(\"\\n\" + (new Date()).toString());\r\n System.out.println(signedMessage.toString());\r\n \r\n //strip out the parameters embedded \r\n nonce = atmSessionMessage.getNonce();\r\n double value = transactionMessage.getValue();\r\n \r\n //print the timestamp when the transaction takes place\r\n Date now = new Date();\r\n System.out.println(\"\\n\" + now.toString());\r\n \r\n //re-route the request to the appropriate handling function\r\n if(transactionOperation == TransactionOperation.Deposit) {\r\n \t System.out.println(\"ACCT #:\" + currAcct.getNumber() + \" DEPOSIT: \" + value);\r\n currAcct.deposit(value);\r\n \r\n System.out.println(\"\\n\" + (now).toString());\r\n System.out.println(\"Deposit Complete. BALANCE:\" + currAcct.getBalance());\r\n }\r\n else if(transactionOperation == TransactionOperation.Withdraw) {\r\n \t System.out.println(\"ACCT #:\" + currAcct.getNumber() + \" WITHDRAW: \" + value);\r\n \t currAcct.withdraw(value);\r\n \t \r\n System.out.println(\"\\n\" + (now).toString());\r\n System.out.println(\"Withdrawal Complete. BALANCE:\" + currAcct.getBalance());\r\n }\r\n else if(transactionOperation == TransactionOperation.EndSession) \r\n \t {\r\n \t \tSystem.out.println(\"\\nTerminating session with ACCT#: \" + currAcct.getNumber());\r\n \t \treturn false;\r\n \t \t\r\n \t }\r\n \r\n accts.save();\r\n //create a successful reply Success and set the balance\r\n balance = currAcct.getBalance(); \r\n transactionMessage = new TransactionMessage(MessageType.ResponseSuccess,transactionOperation,balance);\r\n atmSessionMessage = new ATMSessionMessage(transactionMessage);\r\n \r\n //set the nonce \r\n atmSessionMessage.setNonce(nonce);\r\n currTimeStamp = atmSessionMessage.getTimeStamp();\r\n //encrypt the response and send it\r\n cipherText = crypto.encryptRijndael(atmSessionMessage, kSession);\r\n os.writeObject((Serializable)cipherText);\r\n \r\n //Logging.....\r\n //get the signed message and encrypt it\r\n \r\n signedMessage.encryptMessage(this.kLog);\r\n \r\n //encrypt the action\r\n //archive the signed message for logging and non-repudiation purposes \r\n SignedAction signedAction = new SignedAction(currAcct.getNumber(), atmSessionMessage.getTimeStamp(), signedMessage);\r\n \r\n //flush out transaction record to the audit file\r\n BankServer.log.write(signedAction);\r\n \r\n\t return true;\r\n }\r\n catch(Exception e){\r\n if(e instanceof TransException) replyFailure(transactionOperation,nonce);\r\n System.out.println(\"Terminating session with ACCT#: \" + currAcct.getNumber());\r\n \t//e.printStackTrace();\r\n \r\n return true;\r\n }\r\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] response) {\n Toast.makeText(getApplicationContext(), new String(response),\n Toast.LENGTH_SHORT).show();\n pDialog.dismiss();\n Log.e(\"response\", new String(response));\n\n SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();\n editor.putString(\"user\", user);\n editor.putString(\"pass\", pass);\n editor.putBoolean(\"done\", true);\n editor.commit();\n\n startActivity(new Intent(LoginActivity.this, MainActivity.class));\n\n finish();\n }", "private void respAuth() throws Exception {\n DataOutputStream dos = new DataOutputStream(os);\n dos.writeInt(1);\n dos.writeByte(Message.MSG_RESP_AUTH);\n if (haslogin) {\n dos.writeByte(Message.SUCCESS_AUTH);\n } else {\n dos.writeByte(Message.FAILED_AUTH);\n }\n }", "@Override\n /**\n * Handles a HTTP GET request. This implements obtaining an authentication token from the server.\n */\n protected void handleGet(Request request, Response response) throws IllegalStateException {\n String username = String.valueOf(request.getAttributes().get(\"username\"));\n String password = String.valueOf(request.getAttributes().get(\"password\"));\n /* Construct MySQL Query. */\n String query = \"SELECT COUNT(id) AS `CNT`, `authToken` FROM accounts WHERE `username` = '\" + username + \"' AND \" +\n \"`password` = '\" + password + \"' LIMIT 0,1;\";\n /* Obtain the account count and existing token pair, as object array. */\n Object[] authenticationArray = dataHandler.handleAuthentication(database.ExecuteQuery(query,\n new ArrayList<String>()));\n int cnt = (int) authenticationArray[0];\n String existingToken = (String) authenticationArray[1];\n String authenticationToken = null;\n if (cnt == 1) { // There is exactly one account matching the parameterised username and password.\n if (existingToken == null) { // No token yet existed, generate one.\n authenticationToken = TokenGenerator.getInstance().generateAuthenticationToken(TOKEN_LENGTH);\n } else {\n authenticationToken = existingToken;\n }\n } else {\n this.returnStatus(response, new IllegalArgumentStatus(null));\n }\n if (!(authenticationToken == null || authenticationToken == \"\")) { // Update the database with the new token.\n Database.getInstance().ExecuteUpdate(\"UPDATE `accounts` SET `authToken` = '\" + authenticationToken +\n \"', `authTokenCreated` = CURRENT_TIMESTAMP WHERE `username` = '\" + username + \"';\",\n new ArrayList<String>());\n this.returnResponse(response, authenticationToken, new TokenSerializer());\n } else {\n this.returnStatus(response, new IllegalArgumentStatus(null));\n }\n }", "@Override\n public void onSuccess() {\n Handler.Callback bayunAuthSuccess = msg -> {\n confirmHandler.onSuccess();\n return false;\n };\n\n\n // Bayun Registration failure Callback\n Handler.Callback bayunAuthFailure = msg -> {\n Exception exception = new Exception(msg.getData().getString(Constants.ERROR));\n confirmHandler.onFailure(exception);\n return false;\n };\n\n // Bayun Registration authorizeEmployeeCallback Callback\n Handler.Callback authorizeEmployeeCallback = msg -> {\n String employeePublicKey = msg.getData().getString(Constants.EMPLOYEE_PUBLICKEY);\n Exception exception = new Exception(\"Employee Authorization is Pending\");\n confirmHandler.onFailure(exception);\n return false;\n };\n\n // Registration with Bayun\n BasicBayunCredentials basicBayunCredentials = new BasicBayunCredentials\n (appId, companyName, user.getUserId(), signUpPassword.toCharArray(),\n appSecret, applicationKeySalt);\n\n\n if(signUpIsRegisterWithPwd){\n BayunApplication.bayunCore.registerEmployeeWithPassword\n (activity,companyName,user.getUserId(),signUpPassword, authorizeEmployeeCallback, bayunAuthSuccess, bayunAuthFailure);\n }else {\n BayunApplication.bayunCore.registerEmployeeWithoutPassword(activity,companyName,user.getUserId()\n ,signUpEmail,false, authorizeEmployeeCallback,\n null,null,null, bayunAuthSuccess, bayunAuthFailure);\n\n }\n// BayunApplication.bayunCore.registerEmployeeWithPassword\n// (activity,companyName,user.getUserId(),signUpPassword, authorizeEmployeeCallback, bayunAuthSuccess, bayunAuthFailure);\n\n\n }", "private static String doLogin(Request req, Response res) {\n HashMap<String, String> respMap;\n \n res.type(Path.Web.JSON_TYPE);\n \n \n\t String email = Jsoup.parse(req.queryParams(\"email\")).text();\n \n logger.info(\"email from the client = \" + email);\n \n if(email != null && !email.isEmpty()) { \n \n\t server = new SRP6JavascriptServerSessionSHA256(CryptoParams.N_base10, CryptoParams.g_base10);\n\t \t\t\n\t gen = new ChallengeGen(email);\n\t\t\n\t respMap = gen.getChallenge(server);\n \n if(respMap != null) {\n\t\t logger.info(\"JSON RESP SENT TO CLIENT = \" + respMap.toString());\n res.status(200);\n respMap.put(\"code\", \"200\");\n respMap.put(\"status\", \"success\");\n return gson.toJson(respMap);\n }\n }\n respMap = new HashMap<>();\n \n res.status(401);\n respMap.put(\"status\", \"Invalid User Credentials\");\n respMap.put(\"code\", \"401\");\n logger.error(\"getChallenge() return null map most likely due to null B value and Invalid User Credentials\");\n \treturn gson.toJson(respMap);\n}", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n String acc = request.getParameter(\"acc\");\n String bank = request.getParameter(\"bank\");\n String email = request.getParameter(\"email\");\n Double txR = Math.random();\n\n String txRef = txR.toString();\n RaveConstant.ENVIRONMENT = Environment.STAGING;\n RaveConstant.PUBLIC_KEY = \"FLWPUBK-d8369e6826011f8a1f9f6c7c14a09b80-X\";\n RaveConstant.SECRET_KEY = \"FLWSECK-8abf446c71a58aaa858323f3a9ed156b-X\";\n try {\n AccountCharge ch = new AccountCharge();\n\n ch.setAccountbank(bank)\n .setAccountnumber(acc)\n .setEmail(email)\n .setTxRef(txRef)\n .setAmount(\"2000\")\n .setCountry(\"NG\")\n .setCurrency(\"NGN\");\n\n JSONObject charge = ch.chargeAccount();\n\n System.out.println(charge);\n JSONObject data = (JSONObject) charge.get(\"data\");\n String response_code = (String) data.get(\"chargeResponseCode\");\n\n if (charge.get(\"status\").equals(\"success\")) {\n {\n if (response_code.equals(\"02\")) {\n\n String flw = (String) data.get(\"flwRef\");\n HttpSession session = request.getSession(true);\n session.setAttribute(\"flwRef\", flw);\n session.setAttribute(\"payload\", ch);\n response.sendRedirect(\"Otp\");\n return;\n }\n else if (response_code.equals(\"00\")) {\n response.sendRedirect(\"Success\");\n return;\n \n }\n }\n } else {\n String message = (String) charge.get(\"message\");\n System.out.println(message);\n HttpSession session = request.getSession(true);\n session.setAttribute(\"message\", message);\n response.sendRedirect(\"401\");\n return;\n\n }\n\n } catch (JSONException ex) {\n }\n doGet(request, response);\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] server_response) {\n try {\n progress.dismiss();\n String response = String.valueOf(new String(server_response, \"UTF-8\"));\n // parse response\n XMLParser parser = new XMLParser();\n Document doc = parser.getDomElement(response, url);\n\n if (doc == null) {\n Dialog.simpleWarning(Lang.get(\"returned_xml_failed\"));\n } else {\n NodeList successNode = doc.getElementsByTagName(\"success\");\n if (successNode.getLength() > 0) {\n Element success = (Element) successNode.item(0);\n Config.context.setTitle(Title);\n\n login_form.setVisibility(View.VISIBLE);\n profile_layer.setVisibility(View.GONE);\n\n Account.logout();\n\n Dialog.toast(success.getTextContent());\n\n menu_logout.setVisible(false);\n menu_remove_account.setVisible(false);\n\n if (Config.activeInstances.contains(\"MyListings\")) {\n Config.activeInstances.remove(\"MyListings\");\n MyListings.removeInstance();\n\n Utils.removeContentView(\"MyListings\");\n }\n loginForm(login_form, Config.context);\n\n LoginManager.getInstance().logOut();\n dialog.dismiss();\n } else {\n NodeList errorNode = doc.getElementsByTagName(\"error\");\n\n if (errorNode.getLength() > 0) {\n // handle errors\n Element error = (Element) errorNode.item(0);\n Dialog.simpleWarning(Lang.get(error.getTextContent()));\n }\n }\n }\n\n } catch (UnsupportedEncodingException e1) {\n\n }\n }", "public static void handleSuccess(final RpcResponse resultData, final Activity activity, final LoginCallback loginCallback) {\n LoginReturnData returnValue = (LoginReturnData) resultData.returnValue;\n final int code = resultData.code;\n SDKLogger.d(TAG, \"asyncExecute code = \" + code);\n if (code == 3000) {\n Session session = null;\n try {\n if (resultData.returnValue != null) {\n SDKLogger.d(TAG, \"asyncExecute returnValue not null \");\n if (!TbAuthContext.needSession || TextUtils.equals(TbAuthContext.sSceneCode, \"10010\")) {\n session = SessionConvert.convertLoginDataToSeesion(returnValue);\n } else {\n ((SessionService) AliMemberSDK.getService(SessionService.class)).refreshWhenLogin(Site.TAOBAO, returnValue);\n session = ((SessionService) AliMemberSDK.getService(SessionService.class)).getSession();\n }\n }\n final Session finalSession = session;\n ((MemberExecutorService) AliMemberSDK.getService(MemberExecutorService.class)).postUITask(new Runnable() {\n public void run() {\n RpcPresenter.doWhenResultOk(activity, loginCallback, finalSession);\n }\n });\n } catch (Exception e) {\n e.printStackTrace();\n }\n } else if (code == 13060) {\n String doubleCheckUrl = returnValue.h5Url;\n SDKLogger.d(TAG, \"asyncExecute doubleCheckUrl = \" + doubleCheckUrl);\n if (!TextUtils.isEmpty(doubleCheckUrl) && activity != null) {\n Activity startFrom = activity;\n CallbackContext.setActivity(startFrom);\n Intent intent = new Intent(startFrom, TbAuthWebViewActivity.class);\n intent.putExtra(\"url\", doubleCheckUrl);\n intent.putExtra(\"token\", returnValue.token);\n intent.putExtra(\"scene\", returnValue.scene);\n TbAuthWebViewActivity.token = returnValue.token;\n TbAuthWebViewActivity.scene = returnValue.scene;\n activity.startActivityForResult(intent, RequestCode.OPEN_DOUBLE_CHECK);\n }\n } else {\n ((MemberExecutorService) AliMemberSDK.getService(MemberExecutorService.class)).postUITask(new Runnable() {\n public void run() {\n SDKLogger.d(RpcPresenter.TAG, \"15 : \" + resultData.message);\n RpcPresenter.doWhenResultFail(activity, loginCallback, 15, \"login:code \" + code + \" \" + resultData.message);\n }\n });\n }\n }", "@Override\n\tpublic void processRequest(HttpRequest request, HttpResponse response) throws Exception {\n\t\tresponse.setHeaderField( \"Server-Name\", \"Las2peer 0.1\" );\n\t\tresponse.setContentType( \"text/xml\" );\n\t\t\n\t\t\n\t\t\n\t\tif(authenticate(request,response))\n\t\t\tif(invoke(request,response));\n\t\t\t\t//logout(_currentUserId);\n\t \n\t\n\t\t//connector.logMessage(request.toString());\n\t\t\n\t\t\n\t}", "@Override\n public void execute(OctopusPacketRequest request, OctopusPacketResponse response) throws Exception {\n OctopusRawMessage rawMessage = request.getMessage().getRawMessage();\n Common.LoginRequestMsg loginRequest = Common.LoginRequestMsg.parseFrom(rawMessage.getBody());\n int userInGatewayId = request.getMessage().getDataId();\n int gatewayServerId = request.getMessage().getSourceServerId();\n String openId = loginRequest.getOpenId();\n String code = loginRequest.getCode();\n int type = loginRequest.getType();\n UserLoginRetInfo loginRetInfo = null;\n try {\n loginRetInfo = userService.loginByOpenId(type, openId, code);\n } catch (UserAndPasswordIsNotRightException ex) {\n anyClientManager.sendErrorMessageToUser(userInGatewayId, gatewayServerId, Integer.parseInt(ErrorCodes\n .userAndPasswordIncorrect));\n return;\n }\n if (loginRetInfo != null) {\n UserLocationInfo userLocationInfo = new UserLocationInfo()\n .setUserId(loginRetInfo.getId()).setUserIdInGateway(request.getMessage().getDataId())\n .setUserName(loginRetInfo.getName())\n .setOpenId(loginRetInfo.getOpenId())\n .setServerId(request.getMessage().getSourceServerId());\n UserCacheInfo userCacheInfo = new UserCacheInfo();\n BeanUtils.copyProperties(loginRetInfo.getUserEntity(), userCacheInfo);\n userLocationService.cacheUserLocation(userLocationInfo);\n userCacheService.cacheUserInfo(userCacheInfo);\n String roomCheckId = roomDomainService.loadUnEndRoomCheckId(loginRetInfo.getId());\n //发送用户成功消息\n Common.LoginResponseMsg.Builder builder = Common.LoginResponseMsg.newBuilder();\n builder.setId(loginRetInfo.getId())\n .setName(loginRetInfo.getName())\n .setOpenId(loginRetInfo.getOpenId())\n .setUuid(loginRetInfo.getUuid())\n .setAvatar(loginRetInfo.getAvatar())\n .setSex(loginRetInfo.getSex())\n .setRoomCheckId(loginRetInfo.getRoomCheckId())\n .setGold(loginRetInfo.getGold())\n .setLoginToken(loginRetInfo.getLoginToken())\n .setIp(loginRetInfo.getIp());\n if (roomCheckId != null) {\n builder.setRoomCheckId(roomCheckId);\n }\n Common.LoginResponseMsg loginResponseMsg = builder.build();\n// OctopusPacketMessage toUserPacketMessage = MessageFactory.createToUserPacketMessage(\n// request.getMessage().getDataId(),\n// serverConfigProperties.getServerId(),\n// request.getMessage().getSourceServerId(),\n// Commands.loginRet,\n// loginResponseMsg.toByteArray());\n //anyClientManager.forwardMessageThroughInnerGateway(toUserPacketMessage);\n anyClientManager.sendMessageToUser(request.getMessage().getDataId(), request.getMessage()\n .getSourceServerId(), Commands.loginRet, loginResponseMsg.toByteArray());\n\n }\n// OctopusPacketMessage toSystemMessage = MessageFactory.createToSystemPacketJsonBodyMessage(-1,\n// serverConfigProperties\n// .getServerId(), Commands.loginSuccessEvent, new LoginSuccessEventInfo().setUserIdInGateway(request\n// .getMessage()\n// .getDataId()).setGatewayServerId(request.getMessage().getSourceServerId()).setUserName(openId));\n //anyClientManager.forwardMessageThroughInnerGateway(toSystemMessage);\n }", "public static void main(String[] args) throws IOException,\n UnsupportedEncodingException, NoSuchAlgorithmException {\n boolean debug = false;\n String username, password, instruct, amount;\n String rawHash, authenRequest, challString, response;\n\n\n // handle illegal arguments\n if (args.length != 5) {\n if (args.length != 6 || !args[5].equals(\"-d\")) {\n throw new IllegalArgumentException(\"Parameter(s): <Server:Port> \" + \n \"<Username> <Password> <Action> <Amount> [<Debug>]\");\n } else {\n debug = true;\n }\n }\n\n // get all info from command line, handle invalid input\n String server = args[0].split(\":\")[0];\n int servPort;\n try {\n servPort = Integer.parseInt(args[0].split(\":\")[1]);\n }\n catch(NumberFormatException e) {\n System.out.println(\"Invalid Port #\");\n return;\n }\n if(servPort < 1024 || servPort > 9999){\n System.out.println(\"Invalid port number. Only 1024-9999.\");\n return;\n }\n username = args[1];\n password = args[2];\n instruct = args[3];\n if (!instruct.equalsIgnoreCase(\"deposit\") && !instruct.equalsIgnoreCase(\"withdraw\")) {\n System.out.println(\"Invalid Operation!\");\n return;\n }\n amount = args[4].trim();\n try {\n Double.valueOf(amount);\n }\n catch(NumberFormatException e) {\n System.out.println(\"Invalid Amount of Money\");\n return;\n }\n\n // Create socket that is connected to server on specified port\n Socket socket;\n try {\n socket = new Socket(server, servPort);\n } catch(UnknownHostException e) {\n System.out.println(\"Invalid server address\");\n return;\n }\n if (debug) System.out.println(\"Connected to server \" + server + \" at port #\" + servPort);\n\n InputStream in = socket.getInputStream();\n OutputStream out = socket.getOutputStream();\n DataOutputStream sendTo = new DataOutputStream(out);\n BufferedReader recevFrom = new BufferedReader(new InputStreamReader(in));\n\n //authentication request\n if (debug) System.out.println(\"Sending Authentication Request to Server\");\n authenRequest = \"Request for Authentication\";\n sendTo.writeBytes(authenRequest + \"\\n\");\n\n //get challenge string from server\n if (debug) System.out.println(\"Getting challenge...\");\n challString = recevFrom.readLine();\n if (debug) System.out.println(\"Challenge is \" + challString);\n\n // send username to server\n if (debug) System.out.println(\"Send Username to Server\");\n sendTo.writeBytes(username + \"\\n\");\n\n //concatenating username + password + challenge\n if (debug) System.out.println(\"Compute Hash Using MD5\");\n rawHash = username + password + challString;\n byte[] hash = generateMD5(rawHash);\n StringBuffer sb = new StringBuffer();\n for (byte b : hash) {\n sb.append(String.format(\"%02x\", b & 0xff));\n }\n if (debug) System.out.println(\"Hash is: \" + sb.toString());\n\n // send hash to server\n sendTo.writeBytes(sb.toString() + \"\\n\");\n if (debug) System.out.println(\"Sending Hash to Server\");\n\n // server's response about the request\n response = recevFrom.readLine();\n System.out.println(response);\n if (!response.equals(\"Verified\")) {\n System.out.println(\"Not Verified\");\n socket.close(); // Close the socket and its streams\n return;\n }\n\n // send action(deposit or withdraw)\n if(debug) System.out.println(\"Sending Action to Server...\");\n sendTo.writeBytes(instruct + \"\\n\");\n\n // send the amount of money\n if(debug) System.out.println(\"Sending Amount to Server...\");\n sendTo.writeBytes(amount + \"\\n\");\n\n // get how much money remains in the bank from server's response\n if(debug) System.out.println(\"Get Remain Money From Server\");\n System.out.println(recevFrom.readLine());\n if(debug) System.out.println(\"Finished, Close Server\");\n\n socket.close(); // Close the socket and its streams\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n PrintWriter out = response.getWriter();\n\n if (request.getSession().getAttribute(\"order\") == null) {\n out.println(\"Session expired\");\n out.close();\n return;\n }\n String order = (String) request.getSession().getAttribute(\"order\");\n\n\n try {\n /*\n * TODO output your page here. You may use following sample code.\n */\n String mcode = request.getServletContext().getInitParameter(\"merchantcode\");\n String authcode = request.getServletContext().getInitParameter(\"authcode\");\n String sp = request.getServletContext().getInitParameter(\"servicepoint\");\n policlient.MerchantAPIServiceStub stub = new policlient.MerchantAPIServiceStub(sp);\n if (request.getParameter(\"CurrencyCode\") == null || request.getParameter(\"PaymentAmount\") == null) {\n out.print(\"amount and currency code missing\");\n out.close();\n return;\n }\n if (request.getSession().getAttribute(\"order\") == null) { /*\n * you may also check if transaction is already initiated and pending\n */\n out.print(\"Session Expired\");\n out.close();\n }\n\n InitiateTransactionDocument doc = InitiateTransactionDocument.Factory.newInstance();\n InitiateTransactionRequest itr = InitiateTransactionRequest.Factory.newInstance();\n itr.setAuthenticationCode(authcode);\n InitiateTransactionInput input = InitiateTransactionInput.Factory.newInstance();\n input.setMerchantCode(mcode);\n\n\n\n input.setCurrencyAmount(BigDecimal.valueOf(new Double(request.getParameter(\"PaymentAmount\").toString()).doubleValue()));\n input.setCurrencyCode(request.getParameter(\"CurrencyCode\").toString());\n input.setUserIPAddress(request.getRemoteAddr());\n input.setMerchantData(request.getSession().getId());\n input.setMerchantCode(mcode);\n\n input.setMerchantRef(request.getSession().getAttribute(\"order\").toString());//put order id \n\n\n /*\n * build your own host url, you may use constants here\n */\n String urlm = request.getScheme() + \"://\" + request.getServerName();\n if (request.getServerPort() != 80) {\n urlm += \":\" + request.getServerPort();\n }\n urlm += request.getContextPath() + \"/\";\n input.setMerchantCheckoutURL(urlm);\n input.setMerchantHomePageURL(urlm); //use your own values here and other urls.\n input.setNotificationURL(urlm + \"notify\");//nudge url\n input.setUnsuccessfulURL(urlm);\n input.setSuccessfulURL(urlm + \"receipt\");//page printed on success \n\n if (request.getParameter(\"FinancialInstitutionCode\") != null) {\n input.setSelectedFICode(request.getParameter(\"FinancialInstitutionCode\").toString());\n } else {\n input.setNilSelectedFICode();\n }\n\n\n input.setMerchantDateTime(java.util.Calendar.getInstance());\n input.setTimeout(1000);\n\n\n\n\n itr.setTransaction(input);\n\n\n doc.addNewInitiateTransaction().setRequest(itr);\n\n InitiateTransactionResponseDocument initiateTransaction = stub.initiateTransaction(doc);\n\n\n\n\n if (initiateTransaction.getInitiateTransactionResponse().isNilInitiateTransactionResult()) {\n out.println(\"Failed to initiate transaction\");\n out.close();\n return;\n }\n\n /*\n * print error message\n */\n if (initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getErrors().sizeOfErrorArray() > 0) {\n\n for (org.datacontract.schemas._2004._07.centricom_poli_services_merchantapi_dco.Error e : initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getErrors().getErrorArray()) {\n\n out.println(\"Error Code:\" + e.getCode() + \" Message: \" + e.getMessage());\n\n }\n\n out.close();\n\n }\n//FinancialInstitutionSelected\n if (initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getTransactionStatusCode().equalsIgnoreCase(\"initiated\")||initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getTransactionStatusCode().equalsIgnoreCase(\"FinancialInstitutionSelected\")) {\n String url = initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getTransaction().getNavigateURL();\n String token = initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getTransaction().getTransactionToken();\n String tref = initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getTransaction().getTransactionRefNo();\n\n\n\n /*\n * save the transaction values for later reference in notify\n */\n TransactionsPK pk = new TransactionsPK(order, tref);\n\n Transactions t = new Transactions(pk, new Float(request.getParameter(\"PaymentAmount\").toString()).floatValue(), request.getParameter(\"CurrencyCode\").toString(), Short.parseShort(\"0\"), token);\n EntityManagerFactory emf = PersistenceManager.getInstance().getEntityManagerFactory();\n EntityManager em = emf.createEntityManager();\n EntityTransaction tx = em.getTransaction();\n tx.begin();\n em.persist(t);\n tx.commit();\n em.close();\n request.getSession().setAttribute(\"tref\", tref);//save the transaction ref for additional safety if needed.\n\n response.sendRedirect(url);\n\n } else {\n out.print(\"invalid code\"+initiateTransaction.getInitiateTransactionResponse().getInitiateTransactionResult().getTransactionStatusCode());\n }\n\n\n\n\n } catch (MerchantAPIService_InitiateTransaction_MerchantApiFaultFault_FaultMessage ex) {\n Logger.getLogger(initiatetransaction.class.getName()).log(Level.SEVERE, null, ex);\n } finally {\n out.close();\n }\n }", "@Override\n\t\t\tpublic void handlerSuccess(String response) {\n\t\t\t\t Log.d(TAG, response); \n\t\t\t\t isStart = false;\n\t\t\t\t try {\n\t\t\t\t\tif(!TextUtils.isEmpty(response)){\n\t\t\t\t\t\t JSONObject obj = new JSONObject(response);\n\t\t\t\t\t\t if(obj.has(\"code\")){\n\t\t\t\t\t\t\tString code = obj.getString(\"code\");\n\t\t\t\t\t\t\t if(\"10006\".equals(code)){\n\t\t\t\t\t\t\t\t final String msg = obj.getString(\"message\");\n\t\t\t\t\t\t\t\t runOnUiThread(new Runnable() {\n\t\t\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t\t\tToast.makeText(context, msg+\"\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t }else if(\"0\".equals(code)){\n\t\t\t\t\t\t\t\t JSONObject json2 = obj.getJSONObject(\"data\");\n\t\t\t\t\t\t\t\t Config.setUserId(context, json2.getString(\"user_id\"));\n\t\t\t\t\t\t\t\t Config.setUserToken(context, json2.getString(\"token\"));\n\t\t\t\t\t\t\t\t runOnUiThread(new Runnable() {\n\t\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t\ttoLoginActivity();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t}", "@Override\n protected void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int error) {\n }", "@Override\r\n protected void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int error) {\r\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {\n String resp_content = \"\";\n\n try {\n resp_content = new String(responseBody,\"UTF-8\");\n\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n\n try {\n\n displayLogin(view,resp_content);\n\n } catch (Throwable e) {\n Toast.makeText(LoginActivity.this, \"Koneksi Gagal ! 1\", Toast.LENGTH_LONG).show();\n }\n }", "@Override\r\n\tpublic void messageReceived( IoSession session, Object message ) throws Exception\r\n\t{\r\n\t\t//\t\tSystem.out.println(\"data \" + (byte[])message);\r\n\t\t//\t\tfor(byte b : (byte[])message){\r\n\t\t//\t\t\tSystem.out.print(b + \" \");\r\n\t\t//\t\t}\r\n\t\t//\t\tSystem.out.println();\r\n\r\n\r\n\r\n\t\tif(message instanceof ClientMessage)\t\t// Application\r\n\t\t\treceivedClientMessage = (ClientMessage) message;\r\n\t\telse{ \t\t\t\t\t\t\t\t\t\t// OBU\r\n\t\t\tinterpretData((byte[]) message, session);\r\n\t\t\t//\t\t\tboolean transactionState = obuHandlers.get(session).addData((byte[])message); \r\n\t\t\t//\t\t\tif(transactionState){\r\n\t\t\t//\t\t\t\tbyte[] b = {(byte)0x01};\r\n\t\t\t//\t\t\t\tsession.write(new OBUMessage(OBUMessage.REQUEST_TELEMETRY, b).request);\r\n\t\t\t//\t\t\t}\r\n\t\t\t//\r\n\t\t\t//\t\t\tThread.sleep(200);\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tRunnable run = new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tswitch(receivedClientMessage.getId()){\r\n\t\t\t\tcase LOGIN_CHECK:\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\t//\t\t\t\tlock.lock();\r\n\t\t\t\t\t\tint user_id = (int)receivedClientMessage.getContent();\r\n\t\t\t\t\t\tUserData response = null;\r\n\t\t\t\t\t\tif(user_id == -1){\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tboolean isOnline = AmberServer.getDatabase().checkOnline(user_id);\r\n\t\t\t\t\t\tif(isOnline){\r\n\t\t\t\t\t\t\tsession.setAttribute(\"user\", user_id);\r\n\t\t\t\t\t\t\tcancelTimeout(user_id);\r\n\t\t\t\t\t\t\tresponse = new UserData().prepareUserData(user_id);\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t\t\tServerLogger.log(\"Login succeeded: \" + user_id, Constants.DEBUG);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfinally{\r\n\t\t\t\t\t\t//\t\t\t\tlock.unlock();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LOGIN:\r\n\t\t\t\t\tClientMessage responseMessage = null;\r\n\t\t\t\t\tString usernameLogin = ((User)receivedClientMessage.getContent()).getName();\r\n\t\t\t\t\tbyte[] passLogin = ((User)receivedClientMessage.getContent()).getPass();\r\n\t\t\t\t\tString regID = ((User)receivedClientMessage.getContent()).getRegistationID();\r\n\t\t\t\t\t// Database validation\r\n\t\t\t\t\t// Check for User and Password\r\n\t\t\t\t\tint userID = AmberServer.getDatabase().login(usernameLogin, passLogin);\r\n\t\t\t\t\tif(userID == -1){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_LOGIN);\r\n\t\t\t\t\t\tServerLogger.log(\"Login failed: \" + usernameLogin, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Check for GCM Registration\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tAmberServer.getDatabase().registerGCM(userID, regID);\r\n\t\t\t\t\t\tUserData response = new UserData();\r\n\t\t\t\t\t\tresponse = response.prepareUserData(userID);\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.LOGIN, response);\r\n\t\t\t\t\t\tsession.setAttribute(\"user\", userID);\r\n\t\t\t\t\t\tServerLogger.log(\"Login success: \" + usernameLogin, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LOGOUT:\r\n\t\t\t\t\tint user_id = (int)receivedClientMessage.getContent();\r\n\t\t\t\t\tAmberServer.getDatabase().logout(user_id);\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.LOGOUT, Constants.SUCCESS_LOGOUT);\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase REGISTER:\r\n\t\t\t\t\tString usernameRegister = ((User)receivedClientMessage.getContent()).getName();\r\n\t\t\t\t\tbyte[] passRegister = ((User)receivedClientMessage.getContent()).getPass();\r\n\t\t\t\t\tboolean queryRegister = AmberServer.getDatabase().addUser(usernameRegister, passRegister, 0);\r\n\t\t\t\t\t// Registration failed\r\n\t\t\t\t\tif(!queryRegister){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_REGISTER);\r\n\t\t\t\t\t\tServerLogger.log(\"Registration failed: \" + usernameRegister, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Registration succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.REGISTER, Constants.SUCCESS_REGISTER);\r\n\t\t\t\t\t\tServerLogger.log(\"Registration success: \" + usernameRegister, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EVENT_DETAIL:\r\n\t\t\t\tcase EVENT_REQUEST:\r\n\t\t\t\t\tObject[] request = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tint eventID = (int) request[0];\r\n\t\t\t\t\tint obuID = (int) request[1];\r\n\t\t\t\t\tObject[] eventData = AmberServer.getDatabase().getEventData(eventID);\r\n\t\t\t\t\tString vehicleName = AmberServer.getDatabase().getVehicleName(obuID);\r\n\t\t\t\t\tString eventType = (String)eventData[1];\r\n\t\t\t\t\tString eventTime = (String)eventData[2];\r\n\t\t\t\t\tdouble eventLat = (double)eventData[3];\r\n\t\t\t\t\tdouble eventLon = (double)eventData[4];\r\n\t\t\t\t\tbyte[] eventImage = (byte[]) eventData[5];\t// EventImage\r\n\t\t\t\t\tEvent event = new Event(eventType, eventTime, eventLat, eventLon, eventImage, vehicleName);\r\n\t\t\t\t\tevent.setVehicleID(obuID);\r\n\t\t\t\t\tsession.write(new ClientMessage(receivedClientMessage.getId(), event));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase REGISTER_VEHICLE:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tint vehicleID = (int) request[1];\r\n\r\n\t\t\t\t\tSystem.out.println(\"VEHICLE ID \" + vehicleID);\r\n\r\n\t\t\t\t\tVehicle vehicle = AmberServer.getDatabase().registerVehicle(userID, vehicleID);\r\n\t\t\t\t\tSystem.out.println(vehicle);\r\n\t\t\t\t\tif(vehicle == null){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_REGISTER_VEHICLE);\r\n\t\t\t\t\t\tServerLogger.log(\"Add Vehicle failed: \" + userID, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Add Vehicle succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tvehicle = vehicle.prepareVehicle(vehicleID);\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.REGISTER_VEHICLE, vehicle);\r\n\t\t\t\t\t\tServerLogger.log(\"Add Vehicle succeeded: \" + userID, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase UNREGISTER_VEHICLE:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tvehicleID = (int) request[1];\r\n\t\t\t\t\tint position = (int) request[2];\r\n\t\t\t\t\tboolean queryUnregisterVehicle = AmberServer.getDatabase().unregisterVehicle(userID, vehicleID);\r\n\t\t\t\t\tif(!queryUnregisterVehicle){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.UNREGISTER_VEHICLE, -1);\r\n\t\t\t\t\t\tServerLogger.log(\"Unregister Vehicle failed for User: \" + userID, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Unregister Vehicle succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.UNREGISTER_VEHICLE, position);\r\n\t\t\t\t\t\tServerLogger.log(\"Unregister Vehicle succeeded for User: \" + userID, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TOGGLE_ALARM:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tvehicleID = (int) request[1];\r\n\t\t\t\t\tboolean status = (boolean) request[2];\r\n\t\t\t\t\tposition = (int) request[3];\r\n\t\t\t\t\tboolean queryToggleAlarm = AmberServer.getDatabase().toggleAlarm(userID, vehicleID, status);\r\n\t\t\t\t\tObject[] responseData = {queryToggleAlarm, position};\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.TOGGLE_ALARM, responseData);\r\n\t\t\t\t\tServerLogger.log(\"Toggle Alarm for User: \" + userID + \" \" + queryToggleAlarm, Constants.DEBUG);\t\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase GET_EVENTLIST_BACKPRESS:\r\n\t\t\t\tcase GET_EVENTLIST:\r\n\t\t\t\t\tvehicleID = (int) receivedClientMessage.getContent();\r\n\t\t\t\t\tvehicleName = AmberServer.getDatabase().getVehicleName(vehicleID);\r\n\t\t\t\t\tArrayList<Event> events = Vehicle.prepareEventList(vehicleID);\r\n\t\t\t\t\tObject[] eventResponse = {events, vehicleName};\r\n\t\t\t\t\tresponseMessage = new ClientMessage(receivedClientMessage.getId(), eventResponse);\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase GET_VEHICLELIST_BACKPRESS:\r\n\t\t\t\t\tuserID = (int) receivedClientMessage.getContent();\r\n\t\t\t\t\tUserData response = new UserData();\r\n\t\t\t\t\tresponse = response.prepareUserData(userID);\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.GET_VEHICLELIST_BACKPRESS, response.getVehicles());\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tnew Thread(run).start();\r\n\t}", "public void authenticate(View view) {\n String value = makeXor(xorNum.getBytes(), key.getBytes());\n\n if(socket.isConnected()){\n try {\n socket.getOutputStream().write(value.getBytes());\n socket.getOutputStream().flush();\n Toast.makeText(ControlActivity.this, \"Message Sent\", Toast.LENGTH_SHORT).show();\n } catch (IOException e) {\n e.printStackTrace();\n Toast.makeText(ControlActivity.this, \"Error in sending message\", Toast.LENGTH_SHORT).show();\n }\n }else{\n Toast.makeText(ControlActivity.this, \"Bluetooth connection lost!\", Toast.LENGTH_SHORT).show();\n }\n\n\n }", "public void authorizeTransaction() {}", "@Override\n public void onResponse(String response) {\n editor.putBoolean(\"credentials_validity\", true);\n editor.putInt(\"last_login_method\", Constants.USER_PASS_LOGIN);\n editor.commit();\n saveCredentials(email, password);\n onLoginFinished(false);\n }", "private static Object doAuth(Request req, Response res) {\n \n HashMap<String, String> response = new HashMap<>();\n\t\t \n String email = Jsoup.parse(req.queryParams(\"email\")).text();\n\t\t String password = Jsoup.parse(req.queryParams(\"password\")).text();\n\t\t\n res.type(Path.Web.JSON_TYPE);\n \t\t\n\t\t\n\t\tif(email != null && !email.isEmpty() && password != null && !password.isEmpty() ) {\n \n authenticate = new Authenticate(password);\n\t\t\t//note that the server obj has been created during call to login()\n\t\t\tString M2 = authenticate.getM2(server);\n\t\t\t\n if(M2 != null || !M2.isEmpty()) {\n \n \n\t\t\tSession session = req.session(true);\n\t\t\tsession.maxInactiveInterval(Path.Web.SESSION_TIMEOUT);\n\t\t\tUser user = UserController.getUserByEmail(email);\n\t\t\tsession.attribute(Path.Web.ATTR_USER_NAME, user.getUsername());\n session.attribute(Path.Web.ATTR_USER_ID, user.getId().toString()); //saves the id as String\n\t\t\tsession.attribute(Path.Web.AUTH_STATUS, authenticate.authenticated);\n\t\t\tsession.attribute(Path.Web.ATTR_EMAIL, user.getEmail());\n logger.info(user.toString() + \" Has Logged In Successfully\");\n \n response.put(\"M2\", M2);\n response.put(\"code\", \"200\");\n response.put(\"status\", \"success\");\n response.put(\"target\", Path.Web.DASHBOARD);\n \n String respjson = gson.toJson(response);\n logger.info(\"Final response sent By doAuth to client = \" + respjson);\n res.status(200);\n return respjson;\n }\n\t\t\t\t\n\t\t} \n \n res.status(401);\n response.put(\"code\", \"401\");\n response.put(\"status\", \"Error! Invalid Login Credentials\");\n \n return gson.toJson(response);\n }", "protected void doPost(HttpServletRequest request,\n\t\t\tHttpServletResponse response) throws ServletException, IOException \n\t{\n\t\tif(AntiXss.isUsername(request.getParameter(\"username\")) == false){\n\t\t\tresponse.sendRedirect(\"error.jsp\");\n\t\t}\n\t\tif(AntiXss.isCodeZip(request.getParameter(\"code\")) == false){\n\t\t\tresponse.sendRedirect(\"error.jsp\");\n\t\t}\n\t\tString username = request.getParameter(\"username\");\n\t\tint code = Integer.parseInt(request.getParameter(\"code\"));\n\t\tRequestDispatcher rd = null;\n\t\tAuthenticator authenticator = new Authenticator();\n\t\tString result = authenticator.verification(username, code);\n\t\t\n\t\tif (result.equals(\"success\")) \n\t\t{\n\t\t\trd = request.getRequestDispatcher(\"VerficationConfirm.html\");\n\t\t} \n\t\telse\n\t\t{\n\t\t\trd = request.getRequestDispatcher(\"error.jsp\");\t\n\t\t}\n\t\t\n\t\trd.forward(request, response);\n\t}", "@Override\n\tpublic void handle(Session session, Player player, HandshakePacket message) {\n\t\tif (!session.isCompat()) {\n\t\t\tsession.setClientVersion(message.protocolVersion == 4 ? \"1.7.2\" : message.protocolVersion == 5 ? \"1.7.6\" : message.protocolVersion == 12 ? \"1.8\" : \"unsure\", message.protocolVersion);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(message.getProtocolVer() < 78) {\n\t\t\tsession.disconnect(\"Outdated client! (Connect with 1.6.4)\");\n\t\t\treturn;\n\t\t} else if (message.getProtocolVer() > 78) {\n\t\t\tsession.disconnect(\"Outdated server!\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tSession.State state = session.getState();\n\t\t\n\t\tif (state == Session.State.EXCHANGE_HANDSHAKE) {\n\t\t\tsession.setState(State.EXCHANGE_IDENTIFICATION);\n\n\t\t\tif(session.getServer().getProperties().onlineMode) {\n\t\t\t\tnew ThreadLoginVerifier(session, message).start();\n\t\t\t} else {\n\t\t\t\tServerProperties prop = session.getServer().getProperties();\n\t\t\t\tsession.send(new LoginPacket(0, prop.levelType, prop.gamemode, Dimension.NORMAL, prop.difficulty, prop.maxBuildHeight, prop.maxPlayers, prop.hardcore));\n\t\t\t\tsession.setPlayer(new Player(session, message.getUsername()));\n\t\t\t}\n\n\t\t} else {\n\t\t\tsession.disconnect(\"Handshake already exchanged.\");\n\t\t}\n\t}", "@Override\n\tpublic void processResponse(ResponseEvent responseEvent) {\n\t\tResponse response = responseEvent.getResponse();\n\t\ttry {\n\t\t\t// Display the response message in the text area.\n\t\t\t//printMessage(\"\\nReceived response: \" + response.toString());\n\n\t\t\tClientTransaction tid = responseEvent.getClientTransaction();\n\t\t\tCSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);\n\t\t\tif (response.getStatusCode() == Response.OK) {\n\t\t\t\tif (cseq.getMethod().equals(Request.REGISTER)) {\n\t\t\t\t\tSystem.out.println(\"regist ACK OK\");\n\t\t\t\t\t//onInvite();\n\t\t\t\t} else if (cseq.getMethod().equals(Request.INVITE)) {\n\t\t\t\t\tDialog dialog = inviteTid.getDialog();\n\t\t\t\t\tRequest ackRequest = dialog.createAck(cseq.getSeqNumber());\n\t\t\t\t\tdialog.sendAck(ackRequest);\n\t\t\t\t\tSystem.out.println(\"Sending ACK\");\n\t\t\t\t} else if (cseq.getMethod().equals(Request.MESSAGE)) {\n\t\t\t\t\tSystem.out.println(\"Send OK !\");\n\t\t\t\t} else if (cseq.getMethod().equals(Request.CANCEL)) {\n\t\t\t\t\tSystem.out.println(\"Sending BYE -- cancel went in too late !!\");\n\t\t\t\t}\n\t\t\t} else if (response.getStatusCode() == Response.PROXY_AUTHENTICATION_REQUIRED\n\t\t\t\t\t|| response.getStatusCode() == Response.UNAUTHORIZED) {\n\t\t\t\tauthenticationHelper = ((SipStackExt) sipStack)\n\t\t\t\t\t\t.getAuthenticationHelper(new AccountManagerImpl(),\n\t\t\t\t\t\t\t\theaderFactory);\n\t\t\t\tinviteTid = authenticationHelper.handleChallenge(response, tid,\n\t\t\t\t\t\tsipProvider, 5);\n\t\t\t\tinviteTid.getRequest().addHeader(\n\t\t\t\t\t\theaderFactory.createExpiresHeader(3600));\n\t\t\t\tinviteTid.getRequest().setMethod(Request.REGISTER);\n\t\t\t\tinviteTid.sendRequest();\n\t\t\t\tinvco++;\n\t\t\t\tprintMessage(\"[processResponse] Request sent:\\n\" + inviteTid.getRequest().toString() + \"\\n\\n\");\n\t\t\t}\n\t\t} catch (Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "boolean completeTransaction(String amount) throws PreAuthFailure {\n String store_id = \"store5\"; // TestAPI, switch when in production\n String api_token = \"yesguy\";// TestAPI, switch when in production.\n String crypt = \"7\"; //TODO: Check if right crypt to be using.\n String storeName = \"PayGuard\"; // Must be <= 13 char.\n String processing_country_code = \"CA\";\n boolean status_check = false; //TODO: Should change this to true and test.\n\n Completion completion = new Completion();\n completion.setOrderId(orderId);\n completion.setCompAmount(amount);\n completion.setTxnNumber(token.getTxnNumber());\n completion.setCryptType(crypt);\n completion.setDynamicDescriptor(storeName);\n\n HttpsPostRequest mpgReq = new HttpsPostRequest();\n mpgReq.setProcCountryCode(processing_country_code);\n mpgReq.setTestMode(true); //false or comment out this line for production transactions\n mpgReq.setStoreId(store_id);\n mpgReq.setApiToken(api_token);\n mpgReq.setTransaction(completion);\n mpgReq.setStatusCheck(status_check);\n mpgReq.send();\n\n try\n {\n Receipt receipt = mpgReq.getReceipt();\n if(receipt.getComplete().equalsIgnoreCase(\"false\")){\n throw new PreAuthFailure(\"Token failed completion: \" + receipt.getMessage());\n }\n return true;\n }\n catch (Exception e)\n {\n throw new PreAuthFailure(\"Token failed completion: \" + e.toString());\n }\n }", "private void handleMiningAuthorize(\n final StratumConnection conn, final JsonRpcRequest message, final Consumer<String> sender) {\n String confirm;\n try {\n confirm = mapper.writeValueAsString(new JsonRpcSuccessResponse(message.getId(), true));\n } catch (JsonProcessingException e) {\n throw new IllegalStateException(e);\n }\n sender.accept(confirm);\n // ready for work.\n registerConnection(conn, sender);\n }", "@Override\n public void onErrorResponse(VolleyError error) {\n Log.i(\"TAG\", \"网络错误,response+登录失败!\"+error.toString());\n Log.i(\"TAG\", application.username+\" \"+application.password);\n handler.sendMessage(handler\n .obtainMessage(NETWORK_ERROR));\n }", "public static void processOIDCresp(HttpServletRequest req,HttpServletResponse resp) throws IOException, InterruptedException, NoSuchAlgorithmException, InvalidKeySpecException, ClassNotFoundException, SQLException\n\t{\n\t\tHttpSession session=req.getSession();\n\t\t//check the state parameters from the response with state parameter in the session,saved during authorization request\n\t\tString state=(String)req.getParameter(\"state\");\n\t\t\n\t\tif(state!=null)\n\t\t{\n\t\t //Pick up the response type associated with the state parameters\n\t\t String response_type=(String)session.getAttribute(state);\n\t\t if(response_type!=null)\n\t\t {\n\t\t\t if(response_type.contains(\"id_token\"))\n\t\t\t {\n\t\t\t\t//If the response type contains id_token(validate the ID Token create one cookie for authenticated users and send to user agent(browser)\n\t\t\t\t//If the response type contains id_token token(validate the ID Token create one cookie for authenticated users and send to user agent(browser) \n\t\t\t\t//and when users needs to access more profile info using access token we can get it.\n\t\t\t\t \n\t\t\t\t //Decode the ID Token(headers and payload)\n\t\t\t\tArrayList<String>decodeParams=decodeIDTokeheadPay(req.getParameter(\"id_token\"));\n\t\t\t\t//Convert the JSON into key value pairs\n\t\t\t Map<String,Object> headers=processJSON(decodeParams.get(0));\n\t\t\t\tMap<String,Object> payloads=processJSON(decodeParams.get(1));\n\t\t\t\t\n\t\t\t\t//Validate the public key by sending request to issuer(URL) by passing clientid and kid as header parameters\n\t\t\t\tif(ValidateIDissuerKey((String) payloads.get(\"iss\"),(String) headers.get(\"kid\"),resp))\n\t\t\t\t {\n\t\t\t\t\t //Decoded the public key from the encoded kid for signature verifications \n\t\t\t\t\t PublicKey pubkeys=pubkeyEncoder(Base64.getDecoder().decode((String) headers.get(\"kid\")));\n\t\t\t\t\t if(ValidateTokenSignature(req.getParameter(\"id_token\"),pubkeys))\n\t\t\t\t\t {\n\t\t\t\t\t\t responseFormat(payloads,resp);\n\t\t\t\t\t\t \n\t\t\t\t\t\t //another flow of implicit(id_token token)\n\t\t\t\t\t\t if(response_type.contains(\"token\"))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t//save the token in cookie\n\t\t\t\t\t\t\t//Create one session for that authenticated users and redirected to Home Page\n\t\t\t\t\t\t\t Cookie auth_uesr = new Cookie(\"access_token\",req.getParameter(\"access_token\"));\n\t\t\t\t\t\t\t resp.addCookie(auth_uesr);\n\t\t\t\t\t\t }\n\t\t\t\t\t\t //Redirected to Home Page\n\t\t\t\t\t\t //if(!response_type.contains(\"code\"))\n\t\t\t\t\t\t\t//resp.sendRedirect(\"http://localhost:8080/OPENID/phoneBookHome.jsp\");\n\t\t\t\t\t }\n\t\t\t\t\t else\n\t\t\t\t\t {\n\t\t\t\t\t\t //Signature Invalid and Token become Invalid and reauthenticate again\n\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t else\n\t\t\t\t {\n\t\t\t\t\t //issuer invalid\n\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t }\n\t\t\t }\n\t\t\t //Token Endpoint request for authorization code Flow\n\t\t /* if(response_type.contains(\"code\"))\n\t\t {\n\t\t \t authCodeProcessModel authModel=new authCodeProcessModel();\n\t\t \t authModel.setClientid(\"mano.lmfsktkmyj\");\n\t\t \t authModel.setClientsecret(\"mano.tpeoeothyc\");\n\t\t \t authModel.setCode((String)req.getParameter(\"code\"));\n\t\t \t authModel.setRedirecturi(\"http://localhost:8080/OPENID/msPhoneBook/response1\");\n\t\t \t \n\t\t \t //Get response from the token endpoint\n\t\t \t Map<String,Object> tokenResp=authCodeProcess(authModel,resp);\n\t\t \t //Check if the response returned any error\n\t\t \t if(tokenResp.containsKey(\"error\"))\n\t\t \t {\n\t\t \t //Token response made error redirected to signin with mano page again\n\t\t \t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t \t }\n\t\t \t else\n\t\t \t {\n\t\t \t\t responseFormat(tokenResp,resp);\n\t\t \t\t //Validate ID Token\n\t\t \t\t ArrayList<String>decodeParams=decodeIDTokeheadPay((String) tokenResp.get(\"id_token\"));\n\t\t\t\t\t\t//Convert the JSON into key value pairs\n\t\t\t\t\t Map<String,Object> headers=processJSON(decodeParams.get(0));\n\t\t\t\t\t Map<String,Object> payloads=processJSON(decodeParams.get(1));\n\t\t\t\t\t \n\t\t\t\t\t//Validate the public key by sending request to issuer(URL) by passing clientid and kid as header parameters\n\t\t\t\t\t if(ValidateIDissuerKey((String) payloads.get(\"iss\"),(String) headers.get(\"kid\"),resp))\n\t\t\t\t\t {\n\t\t\t\t\t\t //true check signature\n\t\t\t\t\t\t PublicKey pubkeys=pubkeyEncoder(Base64.getDecoder().decode((String) headers.get(\"kid\")));\n\t\t\t\t\t\t //Validate the signature using public key\n\t\t\t\t\t\t if(ValidateTokenSignature((String) tokenResp.get(\"id_token\"),pubkeys))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t //Valid the access token with the at_hash values in the ID Token\n\t\t\t\t\t\t\t //First hash the access token and compared with at_hash value in the ID Token\n\t\t\t\t\t\t\t if(payloads.get(\"at_hash\").equals(hashPass((String)tokenResp.get(\"access_token\"))))\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t //save access token along with refresh token to client database used when acces token get expired\n\t\t\t\t\t\t\t\t PhoneBookDAO.saveTokens((String)tokenResp.get(\"access_token\"),(String)tokenResp.get(\"refresh_token\"));\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t//Create one cookie for that authenticated users and redirected to Home Page and send cookie to browser\n\t\t\t\t\t\t\t\t session.setAttribute(\"enduser_name\",payloads.get(\"sub\"));\n\t\t\t\t\t\t\t\t Cookie auth_uesr = new Cookie(\"access_token\",(String) tokenResp.get(\"access_token\"));\n\t\t\t\t\t\t\t\t resp.addCookie(auth_uesr);\n\t\t\t\t\t\t\t\t //Redirected to Home Page\n\t\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/phoneBookHome.jsp\");\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t else\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t //Invalid Access Token(Reauthenticate again)\n\t\t\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t\t\t\t } \n\t\t\t\t\t\t }\n\t\t\t\t\t\t else\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t //Signature invalid\n\t\t\t\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t\t\t\t }\n\t\t \t }\n\t\t\t else\n\t\t\t {\n\t\t\t\t //Invalid issuers or public key(reauthenticate again)\n\t\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t\t }\n\t\t }\n\t\t }*/\n\t\t }\n\t\t else\n\t\t {\n\t\t\t//If the state value is not matched with the state value generated during authorization request CSRF attack\n\t\t\t//sign up again\n\t\t\t resp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//state missing from server,response may be from unknown server,so sign up again\n\t\t\tresp.sendRedirect(\"http://localhost:8080/OPENID/PhoneBookLogin.jsp\");\n\t\t}\n\t}", "@Override\n public void execute(Server server, int threadID) {\n ClientMessage clientMessage;\n try {\n clientMessage = new UpdateSignInPageMessage(server.getAccountManager().addAccount(username, password), server.getChatManager().getThreads());\n } catch (Exception e) {\n clientMessage = new ClientErrorMessage(e.getMessage());\n }\n server.sendMessage(clientMessage, threadID);\n }", "@Override\r\n\t\tpublic void run() {\n\t\t\tHashMap<Integer, String> respMap = userHelper.loginUser(userName, password);\r\n\t\t\t\r\n\t\t\tMessage message=Message.obtain();\r\n message.obj=respMap;\r\n message.what=0x123;\r\n handler.sendMessage(message);\r\n\t\t}", "@Override\n public void onLoginConfirmation(int success) {\n if (success == 5) {\n dialog.dismiss();\n saveToSharedPreferences();\n Intent in = new Intent(LoginActivity.this, UserProfileActivity.class);\n startActivity(in);\n }\n\n // User is found on server but not activated\n if (success == 4) {\n dialog.dismiss();\n Toast.makeText(LoginActivity.this, R.string.activate_your_account,Toast.LENGTH_SHORT).show();\n Intent in = new Intent(LoginActivity.this, ConfirmationActivity.class);\n startActivity(in);\n }\n // User, pass is incorrect\n else if (success == 3) {\n dialog.dismiss();\n Toast.makeText(LoginActivity.this, R.string.wrong_user_pass,Toast.LENGTH_SHORT).show();\n }\n // There is no such user\n else if(success == 2) {\n dialog.dismiss();\n Toast.makeText(LoginActivity.this, R.string.not_signup,Toast.LENGTH_SHORT).show();\n\n }\n // Server error\n else {\n dialog.dismiss();\n Toast.makeText(LoginActivity.this,R.string.server_failure,Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {\n CustomDialog.closeProgressDialog();\n JSONObject jsonObject;\n try {\n postState = true;\n jsonObject = new JSONObject(new String(arg2));\n String code = (String) jsonObject.get(\"code\");\n String str = (String) jsonObject.get(\"retinfo\");\n if (Constant.RESULT_CODE.equals(code)) {\n CustomToast.showShortToast(mContext, str);\n Intent i = new Intent();\n i.putExtra(\"flage\", true);\n setResult(2016, i);\n CrmVisitorSignAddInfoActivity.this.finish();\n } else {\n CustomToast.showShortToast(mContext, str);\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "void finalConfirm(ITransaction trans,boolean confirmation, String userId);", "public boolean connectAs(String uname) {\n\t\tboolean noProblems = true; // no problems have been encountered\n \n\t\t// First Message: A->B: Alice || E_kB(Alice || nonce_A)\n\t\tbyte[] nonce_user = ComMethods.genNonce();\n\t\tComMethods.report(accountName+\" has randomly generated a 128-bit nonce_user = \"+(new String(nonce_user))+\".\",simMode);\n\n\t\tbyte[] unameBytes = uname.getBytes();\n\t\tbyte[] srvrNameBytes = \"SecretServer\".getBytes();\n\n\t\tbyte[] pload = ComMethods.concatByteArrs(unameBytes, nonce_user);\n\t\tpload = SecureMethods.encryptRSA(pload, serv_n, BigInteger.valueOf(serv_e), simMode);\n\n\t\tbyte[] message1 = ComMethods.concatByteArrs(unameBytes,pload);\n\n\t\tComMethods.report(accountName+\" is sending SecretServer the name \"+uname+\", concatenated with '\"+uname+\" || nonce_user' encrypted under RSA with the SecretServer's public key.\", simMode);\t\t\n\t\tbyte[] response1 = sendServer(message1,false);\n\n\t\tif (!checkError(response1)) {\n\t\t\tresponse1 = SecureMethods.decryptRSA(response1, my_n, my_d, simMode);\n\t\t\tComMethods.report(accountName+\" has decrypted the SecretServer's message using \"+accountName+\"'s private RSA key.\", simMode);\n\t\t} else {\n\t\t\tComMethods.report(accountName+\" has received the SecretServer's error message.\", simMode);\n\t\t}\n\n\t\t// Test for proper formatting of the second message in the protocol\n\t\tif (!Arrays.equals(Arrays.copyOf(response1,nonce_user.length), nonce_user) || !Arrays.equals(Arrays.copyOfRange(response1, nonce_user.length, nonce_user.length+srvrNameBytes.length), srvrNameBytes)) {\n\n\t\t\tnoProblems = false;\n\t\t\tSystem.out.println(\"ERROR ~ something went wrong.\");\n\t\t} else {\n\t\t\tbyte[] nonce_srvr = Arrays.copyOfRange(response1, nonce_user.length + srvrNameBytes.length, response1.length);\n\t\t\tComMethods.report(accountName+\" now has nonce_srvr.\", simMode);\n\n\t\t\t// Third Message: A->B: E_kB(nonce_B || kS)\n\t\t\tsessionKey = ComMethods.genNonce();\n\t\t\tComMethods.report(accountName+\" has generated a random 128-bit session key.\", simMode);\n\t\t\t\n\t\t\tbyte[] message2 = ComMethods.concatByteArrs(nonce_srvr, sessionKey);\n\t\t\tmessage2 = SecureMethods.encryptRSA(message2, serv_n, BigInteger.valueOf(serv_e), simMode);\n\t\t\tComMethods.report(accountName+\" is sending the SecretServer the concatenation of nonce_srvr and the session key, encrypted under RSA using the SecretServer's public key.\", simMode);\n\n\t\t\tbyte[] response2 = sendServer(message2, true);\n\t\t\tif (!checkError(response2)) {\n\t\t\t\tresponse2 = SecureMethods.processPayload(srvrNameBytes, response2, 11, sessionKey, simMode);\n\t\t\t\tComMethods.report(accountName+\" has decrypted the SecretServer's message using the symmetric session key that \"+accountName+\" just generated.\", simMode);\t\t\t\t\n\t\t\t} else {\n\t\t\t\tComMethods.report(accountName+\" has received the SecretServer's error message.\", simMode);\n\t\t\t}\n\n\t\t\t// Test formatting of the 4th message in the protocol\n\t\t\tbyte[] expected = \"understood\".getBytes();\n\t\t\tif (!Arrays.equals(Arrays.copyOf(response2, expected.length), expected)) {\n\t\t\t\tnoProblems = false;\n\t\t\t\tComMethods.report(\"ERROR ~ something went wrong with the fourth message in the Bilateral Authentication Protocol.\", simMode);\n\t\t\t} else {\n\t\t\t\tcounter = 12; // counter to be used in future messages\n\t\t\t}\n\t\t}\n\n\t\tif (noProblems) {\n\t\t\tusername = uname;\n\t\t}\n\n\t\treturn noProblems; \n\t}", "public void setNonce(long nonce) {\n this.nonce = nonce;\n }", "private boolean authenticate (HttpRequest request, HttpResponse response) throws UnsupportedEncodingException\n\t{\n\t\tString[] requestSplit=request.getPath().split(\"/\",3);\n\t\tif(requestSplit.length<2)\n\t\t\treturn false;\n\t\tString serviceName=requestSplit[1];\n\t\tfinal int BASIC_PREFIX_LENGTH=\"BASIC \".length();\n\t\tString userPass=\"\";\n\t\tString username=\"\";\n\t\tString password=\"\";\n\t\t\n\t\t//Check for authentication information in header\n\t\tif(request.hasHeaderField(AUTHENTICATION_FIELD)\n\t\t\t\t&&(request.getHeaderField(AUTHENTICATION_FIELD).length()>BASIC_PREFIX_LENGTH))\n\t\t{\n\t\t\tuserPass=request.getHeaderField(AUTHENTICATION_FIELD).substring(BASIC_PREFIX_LENGTH);\n\t\t\tuserPass=new String(Base64.decode(userPass), \"UTF-8\");\n\t\t\tint separatorPos=userPass.indexOf(':');\n\t\t\t//get username and password\n\t\t\tusername=userPass.substring(0,separatorPos);\n\t\t\tpassword=userPass.substring(separatorPos+1);\n\t\t\t\n\t\t\t\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tlong userId;\n\t\t\t\tAgent userAgent;\n\t\t\t\t\n\t\t\t\tif ( username.matches (\"-?[0-9].*\") ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tuserId = Long.valueOf(username);\n\t\t\t\t\t} catch ( NumberFormatException e ) {\n\t\t\t\t\t\tthrow new L2pSecurityException (\"The given user does not contain a valid agent id!\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tuserId = l2pNode.getAgentIdForLogin(username);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tuserAgent = l2pNode.getAgent(userId);\n\t\t\t\t\n\t\t\t\tif ( ! (userAgent instanceof PassphraseAgent ))\n\t\t\t\t\tthrow new L2pSecurityException (\"Agent is not passphrase protected!\");\n\t\t\t\t((PassphraseAgent)userAgent).unlockPrivateKey(password);\n\t\t\t\t_currentUserId=userId;\n\t\t\t\t\n\t\t\t\tif(!_userSessions.containsKey(userId))//if user not registered\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\tMediator mediator = l2pNode.getOrRegisterLocalMediator(userAgent);\n\t\t\t\t\t_userSessions.put(userId, new UserSession(mediator));\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t_userSessions.get(userId).updateServiceTime(serviceName,new Date().getTime());//update last access time for service\n\t\t\t\t\n\t\t\t\tconnector.logMessage(\"Login: \"+username);\n\t\t\t\tconnector.logMessage(\"Sessions: \"+Integer.toString(_userSessions.size()));\n\t\t\t\t\n\t\t\t\treturn true;\n\t\t\t\t\n\t\t\t}catch (AgentNotKnownException e) {\n\t\t\t\tsendUnauthorizedResponse(response, null, request.getRemoteAddress() + \": login denied for user \" + username);\n\t\t\t} catch (L2pSecurityException e) {\n\t\t\t\tsendUnauthorizedResponse( response, null, request.getRemoteAddress() + \": unauth access - prob. login problems\");\n\t\t\t} catch (Exception e) {\n\t\t\t\t\n\t\t\t\tsendInternalErrorResponse(\n\t\t\t\t\t\tresponse, \n\t\t\t\t\t\t\"The server was unable to process your request because of an internal exception!\", \n\t\t\t\t\t\t\"Exception in processing create session request: \" + e);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresponse.setStatus ( HttpResponse.STATUS_BAD_REQUEST );\n\t\t\tresponse.setContentType( \"text/plain\" );\n\t\t\tresponse.print ( \"No authentication provided!\" );\n\t\t\tconnector.logError( \"No authentication provided!\" );\n\t\t}\n\t\treturn false;\n\t}", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n try {\n String bsn = request.getParameter(\"bsn\");\n String uuid = request.getParameter(\"uuid\");\n if (service.ActivateUser(bsn, uuid)) { \n PrintWriter out = response.getWriter();\n out.println(\"Uw account is succesvol geregistreerd. U kunt nu inloggen op de website van de Rekeningrijder.\");\n }\n else {\n PrintWriter out = response.getWriter();\n out.println(\"Registratie is mislukt. Mogelijk is de link verlopen of is de account al geactiveerd.\");\n }\n } catch (Exception ex) {\n PrintWriter out = response.getWriter();\n out.println(\"Er is een fout opgetreden: \" + ex.toString());\n }\n }", "public void signIn(Activity activity, String username, String password, CognitoUser user,\n AuthenticationHandler authenticationHandler) {\n // AuthenticationHandler for Cognito Signin\n AuthenticationHandler wrapperAuthHandler = new AuthenticationHandler() {\n @Override\n public void onSuccess(CognitoUserSession userSession, CognitoDevice newDevice) {\n\n // Bayun login success Callback\n Handler.Callback bayunAuthSuccess = msg -> {\n String bucketName = \"bayun-test-\" + companyName;\n bucketName = bucketName.toLowerCase();\n BayunApplication.tinyDB.putString(Constants.S3_BUCKET_NAME, bucketName);\n\n BayunApplication.tinyDB\n .putString(Constants.SHARED_PREFERENCES_IS_BAYUN_LOGGED_IN,\n Constants.YES);\n authenticationHandler.onSuccess(userSession, newDevice);\n return false;\n };\n\n // Bayun login failure Callback\n Handler.Callback bayunAuthFailure = msg -> {\n Exception exception = new Exception(msg.getData().getString(Constants.ERROR));\n user.signOut();\n authenticationHandler.onFailure(exception);\n return false;\n };\n\n // Bayun login authorizeEmployeeCallback Callback\n Handler.Callback authorizeEmployeeCallback = msg -> {\n String employeePublicKey = msg.getData().getString(Constants.EMPLOYEE_PUBLICKEY);\n Exception exception = new Exception(\"Employee Authorization is Pending\");\n authenticationHandler.onFailure(exception);\n return false;\n };\n\n // login with Bayun\n BayunApplication.bayunCore.loginWithPassword(activity,companyName,username,\n password,false,authorizeEmployeeCallback,null,null,bayunAuthSuccess, bayunAuthFailure);\n }\n\n @Override\n public void getAuthenticationDetails(\n AuthenticationContinuation authenticationContinuation, String UserId) {\n authenticationHandler.getAuthenticationDetails(authenticationContinuation, UserId);\n }\n\n @Override\n public void getMFACode(MultiFactorAuthenticationContinuation continuation) {\n authenticationHandler.getMFACode(continuation);\n }\n\n @Override\n public void authenticationChallenge(ChallengeContinuation continuation) {\n authenticationHandler.authenticationChallenge(continuation);\n }\n\n @Override\n public void onFailure(Exception exception) {\n authenticationHandler.onFailure(exception);\n }\n };\n\n // Cognito call for authentication\n user.getSessionInBackground(wrapperAuthHandler);\n\n\n\n }", "private void handleBlockOkProxyEvent(BlockOkProxyEvent event) throws AppiaEventException {\n \t\tevent.loadMessage();\n \t\tSystem.out.println(\"Received a BlockOkProxyEvent from: \" + event.getServerThatShutUpEndpt());\n \n \t\t//Get the arguments\n \t\tString groupId = event.getGroupId();\n \t\tEndpt serverThatShupUp = event.getServerThatShutUpEndpt();\n \t\tint remoteViewVersion = event.getViewVersion();\n \n \t\t//Check if it is a blockOk from a view already decided\n \t\t//This means the decide event has already come and the block oks were late to me\n \t\tint localViewVersion = VsClientManagement.getVsGroup(groupId).getCurrentVersion();\n \t\tif(remoteViewVersion < localViewVersion ){\n \t\t\treturn; //Discard this event\n \t\t}\n \n \t\t//Mark the server as already sent the block ok\n \t\tControlManager.addControlMessageReceived(groupId, serverThatShupUp);\n \n \t\t//Ask if all the other servers are quiet\n \t\tboolean allMuted = ControlManager.receivedFromAllLiveServers(groupId, vs.view);\n \n \t\t//If all the servers present in the current view are blocked\n \t\tif(allMuted){\n \t\t\tSystem.out.println(\"All servers have responded to me that they are quiet\");\n \n \t\t\t//Check if I am the leader\n \t\t\tif(amIleader()){\n \t\t\t\tSystem.out.println(\"I am the leader so I will decide the view on group:\" + groupId);\n \t\t\t\tVsGroup group = VsClientManagement.getVsGroup(groupId);\n \n \t\t\t\t//Lets increment the version\n \t\t\t\tgroup.incrementGroupViewVersion();\n \n \t\t\t\t//And some clients (if they exist)\n \t\t\t\tgroup.insertFutureClientsIntoPresent();\n \n \t\t\t\t//Send the Decide message to the other servers\n \t\t\t\tDecidedProxyEvent decidedEvent = new DecidedProxyEvent(group);\n \t\t\t\tsendToOtherServers(decidedEvent);\n \n \t\t\t\t//Sent to me also\n \t\t\t\tsendToMyself(decidedEvent);\n \t\t\t}\n \t\t}\n \n \t\telse{\n \t\t\tSystem.out.println(\"There are still server to whom I didn't receive no blockOK\");\n \t\t}\n \t}", "void confirmRealWorldTrade(IUserAccount user, ITransaction trans);", "void onSuccess(long ssl, T result);", "@Override\r\n public void onModuleLoad() {\r\n //register auto refreshing timer\r\n// autoRefresh = new Timer() {\r\n// @Override\r\n// public void run() {\r\n// Shared.EVENT_BUS.fireEvent(new UIRefreshEvent());\r\n// }\r\n// };\r\n// autoRefresh.scheduleRepeating(AUTO_REFRESH_INTERVAL);\r\n \r\n \r\n //read cookies to recover previous session\r\n if (cookie.getSeesionID().isEmpty()) {\r\n //create new session\r\n newSession();\r\n }else{\r\n //try to rebind the old session\r\n Shared.RPC.getSession(cookie.getSeesionID(), new AsyncCallback<Session>() {\r\n @Override\r\n public void onSuccess(Session s) {\r\n if (s == null){\r\n //the session is absent on server\r\n Info.display(\"Expired\", \"Your session is expired, please sign in again\");\r\n newSession();\r\n }else{\r\n Shared.MY_SESSION = s; \r\n //try to auto sign in using saved accountKey\r\n if (cookie.getAccountKey(s).isEmpty() || s.getAccount() == null){\r\n //not to keep signed in / or not yet signed in\r\n //do nothing, wait for signing in\r\n }else{\r\n //try to sign in\r\n Shared.EVENT_BUS.fireEvent(new SignEvent(SignEvent.Action.SIGN_IN)); //didn't set the account key because setting it result in overwrite the cookies\r\n Shared.RPC.signInAndBindSession(s.getAccount(), s, cookie.getAccountKey(s), new AsyncCallback<Session>() {\r\n @Override\r\n public void onSuccess(Session s) {\r\n if (s != null) {\r\n //login successful\r\n Shared.MY_SESSION = s;\r\n //dispatch sign in event\r\n Shared.EVENT_BUS.fireEvent(new SignEvent(SignEvent.Action.SIGNED_IN));\r\n } else {\r\n Info.display(\"Incorrect\", \"Please check your password and try again\");\r\n }\r\n }\r\n\r\n @Override\r\n public void onFailure(Throwable caught) {\r\n Info.display(\"Error\", caught.getMessage());\r\n }\r\n }); \r\n }\r\n }\r\n }\r\n @Override\r\n public void onFailure(Throwable caught) {\r\n Info.display(\"Error\", caught.getMessage());\r\n }\r\n });\r\n }\r\n \r\n\r\n\r\n \r\n \r\n res.common_css().ensureInjected(); \r\n Widget loginpage = new LoginPage();\r\n RootPanel.get().add(loginpage);\r\n\r\n //add event handler for SignEvent event\r\n Shared.EVENT_BUS.addHandler(SignEvent.TYPE, new SignEvent.SignEventHandler(){\r\n @Override\r\n public void onSign(SignEvent event){\r\n //process sign_in\r\n //process signed_in\r\n if (event.getAction().equals(SignEvent.Action.SIGNED_IN)) {\r\n //write cookies if keep signed in\r\n if (event.getAccountKey() != null && !event.getAccountKey().isEmpty()) {\r\n cookie.setAccountKey(Shared.MY_SESSION, event.getAccountKey());\r\n }\r\n //already signed in, load workspace\r\n RootPanel.get().clear();\r\n Widget workspace = new Workspace().asWidget();\r\n RootPanel.get().add(workspace); \r\n Info.display(\"Welcome\", \"Signed in as \" + Shared.MY_SESSION.getAccount().getFullName());\r\n }\r\n //process sign_out\r\n if (event.getAction().equals(SignEvent.Action.SIGN_OUT)){\r\n String accountKey = cookie.getAccountKey(Shared.MY_SESSION);\r\n Shared.RPC.signOutAndDetachSession(Shared.MY_SESSION, accountKey, new AsyncCallback<Session>() {\r\n @Override\r\n public void onSuccess(Session s) {\r\n if (s != null) {\r\n Shared.MY_SESSION = s;\r\n //sign out seems OK on server side, dispatch SIGNED_OUT event\r\n Shared.EVENT_BUS.fireEvent(new SignEvent(SignEvent.Action.SIGNED_OUT)); //WARN: don't dispatch SIGN_OUT avoiding deadlock call\r\n } else {\r\n Info.display(\"Error\", \"Account is already signed out or database error\");\r\n }\r\n }\r\n\r\n @Override\r\n public void onFailure(Throwable caught) {\r\n Info.display(\"Error\", caught.getMessage());\r\n }\r\n });\r\n }\r\n //process signed_out\r\n if (event.getAction().equals(SignEvent.Action.SIGNED_OUT)){\r\n //delete cookies\r\n cookie.discardCookie(Shared.MY_SESSION); \r\n //return UI to welcome status\r\n RootPanel.get().clear();\r\n RootPanel.get().add(new LoginPage()); \r\n Info.display(\"See you\", \"You are now signed out!\");\r\n }\r\n }\r\n });\r\n \r\n \r\n }", "@Override\r\n\t\t\tpublic void onSuccess(Void result) {\n\t\t\t\tsynAlert.clear();\r\n\t\t\t\tauthenticationController.initializeFromExistingAccessTokenCookie(new AsyncCallback<UserProfile>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void onFailure(Throwable caught) {\r\n\t\t\t\t\t\tsynAlert.handleException(caught);\r\n\t\t\t\t\t\tview.showLogin();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void onSuccess(UserProfile result) {\r\n\t\t\t\t\t\t// Signed ToU. Check for temp username, passing record, and then forward\r\n\t\t\t\t\t\tuserAuthenticated();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}", "@Test\n\tpublic void testAssertSignedAuthnResponseProcessing() throws Exception {\n\t\tthis.initStorageWithAuthnRequest();\n\t\tthis.testAuthnResponseProcessingScenario1(this.responseAssertSigned);\n\t}", "public boolean signIn(final SimpleJsonCallback callBack) {\n ChatUser user = db.getUser();\n JSONObject jsonParameter = new JSONObject();\n try {\n jsonParameter.put(\"phone_number\", user.getPhone());\n jsonParameter.put(\"password\", user.getLinkaiPassword());\n } catch (JSONException e) {\n e.printStackTrace();\n }\n String url = Const.LINKAI_SIGNIN_URL;\n RequestQueue requestQueue = Volley.newRequestQueue(context);\n// run signin process asynchronous\n JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url, jsonParameter, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n setAccessToken(response);\n// calling get balance after each signing in\n getBalance();\n callBack.onSuccess(response);\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n error.printStackTrace();\n JSONObject errorObj=new JSONObject();\n try {\n errorObj.put(\"error\",error.networkResponse.data);\n } catch (Exception e) {\n e.printStackTrace();\n }\n callBack.onError(errorObj);\n }\n }) {\n @Override\n public Map<String, String> getHeaders() throws AuthFailureError {\n LinkaiRequestHeader linkaiRequestHeader = new LinkaiRequestHeader(context);\n return linkaiRequestHeader.getRequestHeaders();\n }\n };\n requestQueue.add(request);\n return true;\n }", "Binder getToken(Binder data) {\n byte[] signedAnswer = data.getBinaryOrThrow(\"data\");\n try {\n if (publicKey.verify(signedAnswer, data.getBinaryOrThrow(\"signature\"), HashType.SHA512)) {\n Binder params = Boss.unpack(signedAnswer);\n // now we can check the results\n if (!Arrays.equals(params.getBinaryOrThrow(\"server_nonce\"), serverNonce))\n addError(Errors.BAD_VALUE, \"server_nonce\", \"does not match\");\n else {\n // Nonce is ok, we can return session token\n createSessionKey();\n Binder result = Binder.fromKeysValues(\n \"client_nonce\", params.getBinaryOrThrow(\"client_nonce\"),\n \"encrypted_token\", encryptedAnswer\n );\n\n version = Math.min(SERVER_VERSION, params.getInt(\"client_version\", 1));\n\n byte[] packed = Boss.pack(result);\n return Binder.fromKeysValues(\n \"data\", packed,\n \"signature\", myKey.sign(packed, HashType.SHA512)\n );\n }\n }\n } catch (Exception e) {\n addError(Errors.BAD_VALUE, \"signed_data\", \"wrong or tampered data block:\" + e.getMessage());\n }\n return null;\n }", "private void handleTransaction() throws Exception {\r\n\t\tString receiver;\r\n\t\tString amount;\r\n\t\tMessage sendTransaction = new Message().addData(\"task\", \"transaction\").addData(\"message\", \"do_transaction\");\r\n\t\tMessage response;\r\n\r\n\t\tthis.connectionData.getTerminal().write(\"enter receiver\");\r\n\t\treceiver = this.connectionData.getTerminal().read();\r\n\r\n\t\t// tries until a amount is typed that's between 1 and 10 (inclusive)\r\n\t\tdo {\r\n\t\t\tthis.connectionData.getTerminal().write(\"enter amount (1-10)\");\r\n\t\t\tamount = this.connectionData.getTerminal().read();\r\n\t\t} while (!amount.matches(\"[0-9]|10\"));\r\n\r\n\t\t// does the transaction\r\n\t\tsendTransaction.addData(\"receiver\", this.connectionData.getAes().encode(receiver)).addData(\"amount\",\r\n\t\t\t\tthis.connectionData.getAes().encode(amount));\r\n\r\n\t\tthis.connectionData.getConnection().write(sendTransaction);\r\n\r\n\t\tresponse = this.connectionData.getConnection().read();\r\n\t\tif (response.getData(\"message\").equals(\"success\")) {\r\n\t\t\tthis.connectionData.getTerminal().write(\"transaction done\");\r\n\t\t} else {\r\n\t\t\tthis.connectionData.getTerminal().write(\"transaction failed. entered correct username?\");\r\n\t\t}\r\n\t}", "@Override\n public void onResponse(String response) {\n Log.i(\"TAG\", \"---\" + response);\n if (action.equals(\"login\")) {\n if (response.contains(\"login_ok\")) {\n Log.i(\"TAG\", response + \"login_ok\" + application.password);\n handler.sendMessage(handler\n .obtainMessage(LOGIN_OK));\n } else if (response.contains(\"Password is error\")) {\n handler.sendMessage(handler\n .obtainMessage(PASSWORD_ERROR));\n } else {\n handler.sendMessage(handler\n .obtainMessage(LOGIN_FAILED));\n }\n } else {\n handler.sendMessage(handler\n .obtainMessage(LOGOUT_OK));\n }\n\n }", "private void loginHandler(RoutingContext context) {\n JsonObject creds = new JsonObject()\n .put(\"username\", context.getBodyAsJson().getString(\"username\"))\n .put(\"password\", context.getBodyAsJson().getString(\"password\"));\n\n // TODO : Authentication\n context.response().setStatusCode(500).end();\n }", "private static void postLoginPage() {\n post(\"/login\", \"application/json\", (req, res) -> {\n HomerAccount loggedInAccount = homerAuth.login(req.body());\n if(loggedInAccount != null) {\n req.session().attribute(\"account\", loggedInAccount);\n res.redirect(\"/team\");\n } else {\n res.redirect(\"/login\");\n }\n return null;\n });\n }", "public void increaseNonce() {\n this.index++;\n }", "public void loginSuccess(String response) {\n \ttry {\n \t\t// Parse the json data and create a json object.\n \t\tJSONObject jsonRes = new JSONObject(response);\n \t\tJSONObject data = jsonRes.getJSONObject(\"data\");\n \t\t\n \t\t// Now add the token into the shared preferences file.\n \t\tContext context = getApplicationContext();\n \t\tSharedPreferences sharedPref = context.getSharedPreferences(\n \t\t\t\"com.example.traffic.pref_file\", \n \t\t\tContext.MODE_PRIVATE\n \t\t);\n \t\t\n \t\t// Now get the editor to the file and add the token \n \t\t// recieved as a response.\n \t\tSharedPreferences.Editor editor = sharedPref.edit();\n \t\teditor.putString(\"token\" , data.getString(\"token\"));\n \t\teditor.commit();\n \tToast toast = Toast.makeText(getApplicationContext(),\n \t\t\t\"Logged in.\", \n \t\t\tToast.LENGTH_SHORT \n \t);\n \ttoast.show();\n \t} catch(Exception e) {\n \t\te.printStackTrace();\n \t}\n \t\n }", "@Override\n public void onResponse(JSONObject response) {\n\n loginWithNetworkFaster(userName, password);\n }", "@Override\n public void onResponseRecieved(String reply) {\n\n if(!reply.equals(\"error\")) {\n Context context = getApplicationContext();\n CharSequence text = reply;\n int duration = Toast.LENGTH_LONG;\n Toast toast = Toast.makeText(context, text, duration);\n toast.show();\n EditText serverReply = (EditText) findViewById(R.id.editTextServerReply);\n serverReply.setText((CharSequence) serverReply, EditText.BufferType.NORMAL);\n\n //Deserializing response and pulling session data out\n Response r = new Gson().fromJson(reply, Response.class);\n\n account.sessionID = r.result.session_id;\n\n AccountMan.AccountMan a = new AccountMan.AccountMan();\n a.AddAccount(account);\n }\n\n }", "@Override\n public void a(CheckServerAuthResult checkServerAuthResult) throws RemoteException {\n Parcel parcel = Parcel.obtain();\n Parcel parcel2 = Parcel.obtain();\n try {\n parcel.writeInterfaceToken(\"com.google.android.gms.signin.internal.ISignInService\");\n if (checkServerAuthResult != null) {\n parcel.writeInt(1);\n checkServerAuthResult.writeToParcel(parcel, 0);\n } else {\n parcel.writeInt(0);\n }\n this.a.transact(3, parcel, parcel2, 0);\n parcel2.readException();\n return;\n }\n finally {\n parcel2.recycle();\n parcel.recycle();\n }\n }", "private void checkCredentials(final String username, final String password){\n JSONObject obj = new JSONObject();\n\n try {\n //obj.put(\"moments\",\"h\");\n //obj.put(\"email\", \"[email protected]\");\n //obj.put(\"password\", \"passwurd\");\n obj.put(\"email\", username);\n obj.put(\"password\", password);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n Log.v(\"uploadresponse\",obj.toString());\n String url = serverURL+\"/v1/auth_user\";\n\n user_ID = \"unset\";\n\n JsonObjectRequest jsObjRequest = new JsonObjectRequest\n (Request.Method.POST, url, obj, new Response.Listener<JSONObject>() {\n\n\n @Override\n public void onResponse(JSONObject response) {\n //mTxtDisplay.setText(\"Response: \" + response.toString());\n //\n Log.v(\"uploadresponse\", response.toString());\n\n try {\n if (response.getBoolean(\"success\") == true){\n Toast.makeText(getApplicationContext(), \"Login Success\", Toast.LENGTH_LONG).show();\n\n user_ID = response.getString(\"id\");\n\n saveLogin(username,password,user_ID);\n\n\n\n //save ID here\n\n }else{\n\n Toast.makeText(getApplicationContext(), \"Login Fail\", Toast.LENGTH_LONG).show();\n }\n } catch (JSONException e) {\n e.printStackTrace();\n Toast.makeText(getApplicationContext(), \"Login Fail\", Toast.LENGTH_LONG).show();\n }\n\n\n\n }\n }, new Response.ErrorListener() {\n\n @Override\n public void onErrorResponse(VolleyError error) {\n // TODO Auto-generated method stub\n Log.v(\"tag\", \"request fail\");\n error.printStackTrace();\n Toast.makeText(getApplicationContext(), \"Login Request Fail\", Toast.LENGTH_LONG).show();\n\n }\n });\n\n // Add the request to the RequestQueue.\n SnapApplication.getInstance().getRequestQueue().add(jsObjRequest);\n //super.queue.add(jsObjRequest);\n\n saveLogin(username,password,user_ID);\n\n\n\n }", "@Override\n public void run() {\n byte[] deviceTxPayload = CoreServices.getOrCreateHardwareWalletService().get().getContext().getSerializedTx().toByteArray();\n\n log.info(\"DeviceTx payload:\\n{}\", Utils.HEX.encode(deviceTxPayload));\n\n // Load deviceTx\n Transaction deviceTx = new Transaction(MainNetParams.get(), deviceTxPayload);\n\n log.info(\"deviceTx:\\n{}\", deviceTx.toString());\n\n // Check the signatures are canonical\n for (TransactionInput txInput : deviceTx.getInputs()) {\n byte[] signature = txInput.getScriptSig().getChunks().get(0).data;\n if (signature != null) {\n log.debug(\n \"Is signature canonical test result '{}' for txInput '{}', signature '{}'\",\n TransactionSignature.isEncodingCanonical(signature),\n txInput.toString(),\n Utils.HEX.encode(signature));\n } else {\n log.warn(\"No signature data\");\n }\n }\n\n log.debug(\"Committing and broadcasting the last tx\");\n\n BitcoinNetworkService bitcoinNetworkService = CoreServices.getOrCreateBitcoinNetworkService();\n\n if (bitcoinNetworkService.getLastSendRequestSummaryOptional().isPresent()\n && bitcoinNetworkService.getLastWalletOptional().isPresent()) {\n\n SendRequestSummary sendRequestSummary = bitcoinNetworkService.getLastSendRequestSummaryOptional().get();\n\n // Check the unsigned and signed tx are essentially the same as a check against malware attacks on the Trezor\n if (TransactionUtils.checkEssentiallyEqual(sendRequestSummary.getSendRequest().get().tx, deviceTx)) {\n // Substitute the signed tx from the trezor\n log.debug(\n \"Substituting the Trezor signed tx '{}' for the unsigned version {}\",\n deviceTx.toString(),\n sendRequestSummary.getSendRequest().get().tx.toString()\n );\n sendRequestSummary.getSendRequest().get().tx = deviceTx;\n log.debug(\"The transaction fee was {}\", sendRequestSummary.getSendRequest().get().fee);\n\n sendBitcoinConfirmTrezorPanelView.setOperationText(MessageKey.TREZOR_TRANSACTION_CREATED_OPERATION);\n sendBitcoinConfirmTrezorPanelView.setRecoveryText(MessageKey.CLICK_NEXT_TO_CONTINUE);\n sendBitcoinConfirmTrezorPanelView.setDisplayVisible(false);\n\n // Get the last wallet\n Wallet wallet = bitcoinNetworkService.getLastWalletOptional().get();\n\n // Commit and broadcast\n bitcoinNetworkService.commitAndBroadcast(sendRequestSummary, wallet, paymentRequestData);\n\n // Ensure the header is switched off whilst the send is in progress\n ViewEvents.fireViewChangedEvent(ViewKey.HEADER, false);\n } else {\n // The signed transaction is essentially different from what was sent to it - abort send\n sendBitcoinConfirmTrezorPanelView.setOperationText(MessageKey.TREZOR_FAILURE_OPERATION);\n sendBitcoinConfirmTrezorPanelView.setRecoveryText(MessageKey.CLICK_NEXT_TO_CONTINUE);\n sendBitcoinConfirmTrezorPanelView.setDisplayVisible(false);\n }\n } else {\n log.debug(\"Cannot commit and broadcast the last send as it is not present in bitcoinNetworkService\");\n }\n // Clear the previous remembered tx\n bitcoinNetworkService.setLastSendRequestSummaryOptional(Optional.<SendRequestSummary>absent());\n bitcoinNetworkService.setLastWalletOptional(Optional.<Wallet>absent());\n }", "public void sendKeys() throws Exception{\n ATMMessage atmMessage = (ATMMessage)is.readObject();\r\n System.out.println(\"\\nGot response\");\r\n \r\n //System.out.println(\"Received second message from the client with below details \");\r\n //System.out.println(\"Response Nonce value : \"+atmMessage.getResponseNonce());\r\n \r\n if(!verifyMessage(atmMessage))error(\" Nonce or time stamp does not match\") ;\r\n kSession = crypto.makeRijndaelKey();\r\n \r\n Key kRandom = crypto.makeRijndaelKey();\r\n byte [] cipherText = crypto.encryptRSA(kRandom,kPubClient);\r\n os.writeObject((Serializable)cipherText);\r\n System.out.println(\"\\nSending Accept and random key\");\r\n \r\n \r\n cipherText = crypto.encryptRSAPrivateKey(kSession,kPrivBank);\r\n atmMessage = new ATMMessage(); \r\n atmMessage.setEncryptedSessionKey(cipherText);\r\n cipherText = crypto.encryptRijndael(atmMessage,kRandom);\r\n currTimeStamp = System.currentTimeMillis();\r\n os.writeObject((Serializable)cipherText);\r\n //System.out.println(\"Session Key send to the client \");\r\n \r\n //SecondServerMessage secondServerMessage = new SecondServerMessage();\r\n //secondServerMessage.setSessionKey(kSession);\r\n \r\n //byte [] cipherText1;\r\n //cipherText = crypto.encryptRSAPrivateKey(kSession,kPrivBank);\r\n //cipherText1 = crypto.encryptRSA(cipherText,clientPublicKey);\r\n //os.writeObject((Serializable)cipherText1);\r\n \r\n //System.out.println(\"Second message send by the server which contains the session key. \");\r\n //System.out.println(\"\\n\\n\\n\");\r\n \r\n \r\n }", "static void storeStateAndNonceInSession(HttpSession session, String state, String nonce) {\n if (session.getAttribute(STATES) == null) {\n session.setAttribute(STATES, new HashMap<String, StateData>());\n }\n ((Map<String, StateData>) session.getAttribute(STATES)).put(state, new StateData(nonce, new Date()));\n }", "private byte[] sendServerCoded(byte[] message) { \n\t\tbyte[] toPayload = SecureMethods.preparePayload(username.getBytes(), message, counter, sessionKey, simMode);\n\t\tbyte[] fromPayload = sendServer(toPayload, false);\n\n\t\tbyte[] response = new byte[0];\n\t\tif (checkError(fromPayload)) {\n\t\t\tresponse = \"error\".getBytes();\n\t\t} else {\n\t\t\tresponse = SecureMethods.processPayload(\"SecretServer\".getBytes(), fromPayload, counter+1, sessionKey, simMode);\n\t\t}\n\t\tcounter = counter + 2;\n\t\treturn response;\n\t}", "@Override\n\tpublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)\n\t\t\tthrows Exception {\n\t\t System.err.println(\"URI -- \"+request.getRequestURL());\n\t\t if(request.getRequestURI()!=null &&\n\t\t (request.getRequestURI().contains(\"/self/login\"))) return true;\n\t\t \n\t\t \n\t\t String authHeader = request.getHeader(AUTH_HEADER);\n\t\t \n\t\t if (authHeader == null) { \n\t\t\t response.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t\t response.getOutputStream().write(TOKEN_EXPIRE_MSG.getBytes()); return false;\n\t\t }\n\t\t \n\t\t if (authHeader.contains(\"Basic \")) {\n\t\t \n\t\t String encodedUserNamePassword = authHeader.split(\"Basic \")[1]; String\n\t\t strValue = \"\";\n\t\t try\n\t\t { \n\t\t\t strValue = new String(java.util.Base64.getDecoder().decode(encodedUserNamePassword.getBytes(\n\t\t\t\t\t \t\t)), \"UTF-8\"); \n\t\t }\n\t\t catch (Exception e)\n\t\t { \n\t\t\t e.printStackTrace(); \n\t\t\t // TODO: handle exception return false; \n\t\t }\n\t\t \n\t\t String[] arrayOfString = strValue.split(\"\\\\:\");\n\t\t \n\t\t if (arrayOfString.length > 1) \n\t\t { \n\t\t\t \tString userName = arrayOfString[0]; String\n\t\t\t \tpassword = arrayOfString[1]; System.err.println(userName);\n\t\t\t \tSystem.err.println(password);\n\t\t \n\t\t\t \tpassword = Base64.getEncoder().encodeToString((password + \"\").getBytes(\"utf-8\")); \n\t\t\t \tUsernamePasswordAuthenticationToken\n\t\t\t \tusernamePasswordAuthenticationToken = new\n\t\t\t \tUsernamePasswordAuthenticationToken( userName, password);\n\t\t \n\t\t\t \tAuthentication authentication = null; \n\t\t\t \ttry { authentication =\n\t\t\t \t\t\tautheticationManager.authenticate(usernamePasswordAuthenticationToken);\n\t\t \n\t\t } catch (Exception ex) { \n\t\t\t ex.printStackTrace();\n\t\t\t response.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t\t response.getOutputStream().write(UNAUTHORISED_ACCESS_MSG.getBytes());\n\t\t \n\t\t\t return false; \n\t\t } \n\t\t if (authentication.isAuthenticated()) {\n\t\t\t SecurityContextHolder.getContext().setAuthentication(authentication);\n\t\t\t return true; \n\t\t } else { \n\t\t\t\n\t\t\tresponse.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t\t response.getOutputStream().write(UNAUTHORISED_ACCESS_MSG.getBytes()); \n\t\t\t return false; \n\t\t\t } \n\t\t } else { \n\t\t\t String encodedValue = authHeader.split(\"Basic \")[1];\n\t\t \n\t\t\t if (isValidToken(encodedValue)) return true;\n\t\t \n\t\t \tresponse.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t \tresponse.getOutputStream().write(TOKEN_EXPIRE_MSG.getBytes()); return false;\n\t\t }\n\t\t \n\t\t } \n\t\t response.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t response.getOutputStream().write(UNAUTHORISED_ACCESS_MSG.getBytes()); return\n\t\t false;\n\t\t \n\t\t\n\t}", "@SuppressWarnings(\"unchecked\")\r\n\tpublic void execute() {\r\n\t\tlong startTime = System.currentTimeMillis();\r\n\r\n\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\tLOG.debug(String.format(\"Entering AbstractAuthenticator, userid: %s\", ssoUser!=null?ssoUser.getUserName():\"null\"));\r\n\t\t}\r\n\t\tmapHeaderToUserProfileMap();\r\n\r\n\t\tif (AuthenticatorHelper.isVAPLoggedIn(request)) {\r\n\t\t\tString userIdentifier = (String)userProfile.get(AuthenticationConsts.KEY_USER_NAME);\r\n\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\tLOG.debug(String.format(\"User is Logged in, user: %s\", userIdentifier));\r\n\t\t\t}\r\n\t\t\tif (AuthenticatorHelper.isForceCleanupSession(request)) {\r\n\t\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\t\tLOG.debug(String.format(\"Force session clean up, userid: %s\", userIdentifier));\r\n\t\t\t\t}\r\n\t\t\t\tAuthenticatorHelper.cleanupSession(request);\r\n\t\t\t} else if (isDiffUser()) {\r\n\t\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\t\tLOG.debug(String.format(\"Different User, userid: %s\", userIdentifier));\r\n\t\t\t\t}\r\n\t\t\t\tuserProfile.put(AuthenticationConsts.KEY_LAST_LOGIN_DATE,\r\n\t\t\t\t\t\t\t\tnew Date());\r\n\t\t\t\tAuthenticatorHelper.cleanupSession(request);\r\n\t\t\t} else if (isUserRecentUpdated()) {\r\n\t\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\t\tLOG.debug(String.format(\"User is updated, userid: %s\", userIdentifier));\r\n\t\t\t\t}\r\n\t\t\t\t// not cleanup session per CR 86\r\n\t\t\t\t//AuthenticatorHelper.cleanupSession(request);\r\n\t\t\t} else if (AuthenticatorHelper.isForceInitSession(request)) {\r\n\t\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\t\tLOG.debug(String.format(\"Force initSession tag found, userid: %s\", userIdentifier));\r\n\t\t\t\t}\r\n\t\t\t\t// not cleanup session per CR 86\r\n\t\t\t\t//AuthenticatorHelper.cleanupSession(request);\r\n\t\t\t} else if (AuthenticatorHelper.isSiteChanged(request)) {\r\n\t\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\t\tLOG.debug(String.format(\"Site is changed, userid: %s\", userIdentifier));\r\n\t\t\t\t}\r\n\t\t\t\t// not cleanup session per CR 86\r\n\t\t\t\t//AuthenticatorHelper.cleanupSession(request);\r\n\t\t\t} else {\r\n\t\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\t\tLOG.debug(String.format(\"Other Cases, userid: %s\", userIdentifier));\r\n\t\t\t\t}\r\n\t\t\t\t// keep the current HTTP header user profile\r\n\t\t\t\tMap httpHeaderUserProfile = userProfile;\r\n\r\n\t\t\t\t// fetch userProfile from session, only need to refresh this user profile map\r\n\t\t\t\tuserProfile = (Map)request.getSession()\r\n\t\t\t\t\t\t\t\t\t\t .getAttribute(AuthenticationConsts.USER_PROFILE_KEY);\r\n\t\t\t\t// get groups from userProfile\r\n\t\t\t\tList<String> sessionGroups = (List<String>)userProfile.get(AuthenticationConsts.KEY_USER_GROUPS);\r\n\t\t\t\trefreshLocaleRelatedGroups(sessionGroups);\r\n\r\n\t\t\t\t// refresh user timezone\r\n\t\t\t\trefreshUserTimezone(userProfile, httpHeaderUserProfile);\r\n\r\n\t\t\t\tuserName = (String)userProfile.get(AuthenticationConsts.KEY_USER_NAME);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\t\tLOG.debug(String.format(\"User is logging in as: %s\", ssoUser!=null?ssoUser.getUserName():\"null\"));\r\n\t\t\t}\r\n\t\t\tuserProfile.put(AuthenticationConsts.KEY_LAST_LOGIN_DATE,\r\n\t\t\t\t\t\t\tnew Date());\r\n\t\t}\r\n\r\n\r\n\t\t// Set the SPFAuthType attribute before calling group service so the group definitions can\r\n\t\t// use its value.\r\n\t\tsetAuthTypeProfileAttribute();\r\n\r\n\t\ttry {\r\n\t\t\t// Retrieve user group from UGS to SSOUser\r\n\t\t\t// and synchronous to VAP user, and return the\r\n\t\t\t// updated vap user\r\n\t\t\tUser updatedVAPUser = syncVAPUser();\r\n\t\t\tsaveUserProfile2Session(updatedVAPUser);\r\n\t\t\tuserName = ssoUser.getUserName();\r\n\t\t} catch (Exception ex) {\r\n\t\t\tuserName = null;\r\n\t\t\tLOG.error(\"Invoke Authenticator.execute error: \" + ex.getMessage(),\r\n\t\t\t\t\t ex);\r\n\t\t\trequest.getSession()\r\n\t\t\t\t .setAttribute(AuthenticationConsts.SESSION_ATTR_SSO_ERROR,\r\n \"1\");\r\n\t\t\tRequestContext.getThreadInstance()\r\n\t\t\t\t\t\t .getDiagnosticContext()\r\n\t\t\t\t\t\t .setError(ErrorCode.AUTH001, ex.toString());\r\n\t\t}\r\n\t\tif (LOG.willLogAtLevel(LogConfiguration.DEBUG)) {\r\n\t\t\tLOG.debug(String.format(\"Time spent on AbstractAuthenticator.execute (sec): %s for user: %s\", (System.currentTimeMillis()-startTime)/1000, userName));\r\n\t\t}\r\n\t}", "public void Connection(String email, String password) {\n RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());\n\n String URL = \"http://\"+ SessionManager.IPSERVER + \"/RestFullTEST-1.0-SNAPSHOT/account/signIn\";\n\n JSONObject jsonBody = new JSONObject();\n try {\n jsonBody.put(\"mail\", email);\n jsonBody.put(\"password\", password);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n\n Log.d(\"test\", jsonBody.toString());\n // Enter the correct url for your api service site\n JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, URL, jsonBody,\n new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n try {\n uuidUser = response.getString(\"uuid\");\n sessionManager.Logout();\n\n //-----------if good account---------//\n if(!uuidUser.equals(\"0\")){\n\n SessionManager.age = response.getInt(\"age\");\n SessionManager.name = response.getString(\"name\");\n SessionManager.firstname = response.getString(\"firstname\");\n sessionManager.CreateSession(email, password);\n SessionManager.uuid = uuidUser;\n SignIn();\n }\n } catch (JSONException e) {\n e.printStackTrace();\n mail.setText(\"Error Json\");\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n error.printStackTrace();\n mail.setText(\"Error getting response\");\n }\n });\n requestQueue.add(jsonObjectRequest);\n }", "@Override\r\n\tpublic boolean handleEvent(Event e) {\n\t\tConnection connection = (Connection) e.get(\"connection\");\r\n\t\tClient client = (Client) connection.getService();\r\n\t\tclient.clientTimeout.interrupt();\r\n\t\tString response = (String) e.get(\"response\");\r\n\r\n\t\tswitch (response) {\r\n\t\tcase \"blank_user\":\r\n\t\t\tService.logInfo(\"Please enter a username\");\r\n\t\t\tbreak;\r\n\t\tcase \"login_success\":\r\n\t\t\tclient.setPerson((Voter) e.get(\"person\"));\r\n\t\t\tclient.setCandidates((ArrayList<Candidate>) e.get(\"candidates\"));\r\n\t\t\tclient.vote();\r\n\t\t\tbreak;\r\n\t\tcase \"incorrect_password\":\r\n\t\t\tService.logInfo(\"Bad password\");\r\n\t\t\tbreak;\r\n\t\tcase \"registered_user\":\r\n\t\t\tService.logInfo(\"registered with server.\");\r\n\t\t\tbreak;\r\n\t\tcase \"user_unregistered\":\r\n\t\t\tService.logInfo(\"Please register with server.\");\r\n\t\t\tclient.enableReg();\r\n\t\t\tbreak;\r\n\t\tcase \"already_voted\":\r\n\t\t\tService.logInfo(\"You have already voted.\");\r\n\t\t\tbreak;\n\t\tcase \"district_mismatch\":\r\n\t\t\tService.logInfo(\"Attempt to log into incorrect district\");\r\n\t\t\tbreak;\n\t\tcase \"election_not_started\":\r\n\t\t\tService.logInfo(\"Election has not started\");\r\n\t\t\tbreak;\r\n\t\tcase \"election_ended\":\r\n\t\t\tService.logInfo(\"Election has ended\");\r\n\t\t\tbreak;\t\n\t\tdefault:\r\n\t\t\tService.logWarn(\"Unknown Login Response: \" + response);\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));\n //read the client \n String XMLdata = br.readLine();\n boolean isSignatureVerified = parseXMLData(XMLdata);\n //set the client status based on the signature verification\n if (isSignatureVerified) {\n response.setStatus(200);\n } else {\n response.setStatus(401);\n }\n }", "@Override\r\n public void handle(HttpExchange exchange) throws IOException {\r\n\r\n // This handler returns a list of \"Ticket to Ride\" games that\r\n // are (ficticiously) currently running in the server.\r\n // The game list is returned to the client in JSON format inside\r\n // the HTTP response body.\r\n // This implementation is clearly unrealistic, because it\r\n // always returns the same hard-coded list of games.\r\n // It is also unrealistic in that it accepts only one specific\r\n // hard-coded auth token.\r\n // However, it does demonstrate the following:\r\n // 1. How to get the HTTP request type (or, \"method\")\r\n // 2. How to access HTTP request headers\r\n // 3. How to return the desired status code (200, 404, etc.)\r\n //\t\tin an HTTP response\r\n // 4. How to write JSON data to the HTTP response body\r\n // 5. How to check an incoming HTTP request for an auth token\r\n\r\n boolean success = false;\r\n\r\n try {\r\n // Determine the HTTP request type (GET, POST, etc.).\r\n // Only allow GET requests for this operation.\r\n // This operation requires a GET request, because the\r\n // client is \"getting\" information from the server, and\r\n // the operation is \"read only\" (i.e., does not modify the\r\n // state of the server).\r\n if (exchange.getRequestMethod().toLowerCase().equals(\"post\")) {\r\n String str = readString(exchange.getRequestBody());\r\n Gson gson = new Gson();\r\n RegisterRequest rRequest = gson.fromJson(str, RegisterRequest.class);\r\n RegisterResult rResult = RegisterService.register(rRequest);\r\n if(rResult.isSuccess()) {\r\n exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, 0);\r\n // Now that the status code and headers have been sent to the client,\r\n // next we send the JSON data in the HTTP response body.\r\n // Get the response body output stream.\r\n OutputStream respBody = Encoder.toJsonEncoded(rResult, exchange.getResponseBody());\r\n // Close the output stream. This is how Java knows we are done\r\n // sending data and the response is complete/\r\n respBody.close();\r\n success = true;\r\n }\r\n else {\r\n exchange.sendResponseHeaders(HttpURLConnection.HTTP_BAD_REQUEST, 0);\r\n // Now that the status code and headers have been sent to the client,\r\n // next we send the JSON data in the HTTP response body.\r\n // Get the response body output stream.\r\n OutputStream respBody = Encoder.toJsonEncoded(rResult, exchange.getResponseBody());\r\n // Close the output stream. This is how Java knows we are done\r\n // sending data and the response is complete/\r\n respBody.close();\r\n success = true;\r\n }\r\n }\r\n if (!success) {\r\n // The HTTP request was invalid somehow, so we return a \"bad request\"\r\n // status code to the client.\r\n exchange.sendResponseHeaders(HttpURLConnection.HTTP_BAD_REQUEST, 0);\r\n\r\n // Since the client request was invalid, they will not receive the\r\n // list of games, so we close the response body output stream,\r\n // indicating that the response is complete.\r\n exchange.getResponseBody().close();\r\n }\r\n }\r\n catch (IOException e) {\r\n // Some kind of internal error has occurred inside the server (not the\r\n // client's fault), so we return an \"internal server error\" status code\r\n // to the client.\r\n exchange.sendResponseHeaders(HttpURLConnection.HTTP_SERVER_ERROR, 0);\r\n // Since the server is unable to complete the request, the client will\r\n // not receive the list of games, so we close the response body output stream,\r\n // indicating that the response is complete.\r\n exchange.getResponseBody().close();\r\n\r\n // Display/log the stack trace\r\n e.printStackTrace();\r\n }\r\n }", "@Override\n public void onResponse(final Transaction transaction, final String requestId, final PoyntError poyntError) throws RemoteException {\n transaction.setAction(TransactionAction.VOID);\n\n final ElavonTransactionRequest request = convergeMapper.getTransactionVoidRequest(\n transaction.getFundingSource(),\n transaction.getProcessorResponse().getRetrievalRefNum());\n convergeService.update(request, new ConvergeCallback<ElavonTransactionResponse>() {\n @Override\n public void onResponse(final ElavonTransactionResponse elavonResponse) {\n Log.d(TAG, elavonResponse != null ? elavonResponse.toString() : \"n/a\");\n if (elavonResponse.isSuccess()) {\n Log.i(TAG, \"voidTransaction: \" + transaction.getId() + \" SUCCESS\");\n if (listener != null) {\n convergeMapper.mapTransactionResponse(elavonResponse, transaction);\n try {\n // update the transactionId w/ new void txn Id and set parent\n transaction.setParentId(transaction.getId());\n transaction.setId(UUID.randomUUID());\n listener.onResponse(transaction, requestId, null);\n } catch (RemoteException e) {\n e.printStackTrace();\n }\n }\n } else {\n Log.e(TAG, \"voidTransaction: \" + transaction.getId() + \" FAILED\");\n if (listener != null) {\n try {\n // TODO need better error mapping\n PoyntError error = new PoyntError(PoyntError.CODE_API_ERROR);\n listener.onResponse(transaction, requestId, error);\n } catch (RemoteException e) {\n e.printStackTrace();\n }\n }\n }\n }\n\n @Override\n public void onFailure(final Throwable t) {\n t.printStackTrace();\n Log.e(TAG, \"voidTransaction: \" + transaction.getId() + \" FAILED\");\n if (listener != null) {\n // TODO need better error mapping\n final PoyntError error = new PoyntError(PoyntError.CHECK_CARD_FAILURE);\n error.setThrowable(t);\n try {\n listener.onResponse(transaction, requestId, error);\n } catch (RemoteException e) {\n e.printStackTrace();\n }\n }\n }\n });\n }", "@Override\r\n public void onSign(SignEvent event){\n if (event.getAction().equals(SignEvent.Action.SIGNED_IN)) {\r\n //write cookies if keep signed in\r\n if (event.getAccountKey() != null && !event.getAccountKey().isEmpty()) {\r\n cookie.setAccountKey(Shared.MY_SESSION, event.getAccountKey());\r\n }\r\n //already signed in, load workspace\r\n RootPanel.get().clear();\r\n Widget workspace = new Workspace().asWidget();\r\n RootPanel.get().add(workspace); \r\n Info.display(\"Welcome\", \"Signed in as \" + Shared.MY_SESSION.getAccount().getFullName());\r\n }\r\n //process sign_out\r\n if (event.getAction().equals(SignEvent.Action.SIGN_OUT)){\r\n String accountKey = cookie.getAccountKey(Shared.MY_SESSION);\r\n Shared.RPC.signOutAndDetachSession(Shared.MY_SESSION, accountKey, new AsyncCallback<Session>() {\r\n @Override\r\n public void onSuccess(Session s) {\r\n if (s != null) {\r\n Shared.MY_SESSION = s;\r\n //sign out seems OK on server side, dispatch SIGNED_OUT event\r\n Shared.EVENT_BUS.fireEvent(new SignEvent(SignEvent.Action.SIGNED_OUT)); //WARN: don't dispatch SIGN_OUT avoiding deadlock call\r\n } else {\r\n Info.display(\"Error\", \"Account is already signed out or database error\");\r\n }\r\n }\r\n\r\n @Override\r\n public void onFailure(Throwable caught) {\r\n Info.display(\"Error\", caught.getMessage());\r\n }\r\n });\r\n }\r\n //process signed_out\r\n if (event.getAction().equals(SignEvent.Action.SIGNED_OUT)){\r\n //delete cookies\r\n cookie.discardCookie(Shared.MY_SESSION); \r\n //return UI to welcome status\r\n RootPanel.get().clear();\r\n RootPanel.get().add(new LoginPage()); \r\n Info.display(\"See you\", \"You are now signed out!\");\r\n }\r\n }", "private void verifyAuthWithServer() {\n mRegisterModel.connect(binding.personFirstName.getText().toString(),\n binding.personLastName.getText().toString(),\n binding.registerEmail.getText().toString(),\n binding.registerPassword.getText().toString());\n //this is an Asynchronous call no statements after should rely on the result of connect\n }", "public boolean login(String user, String pwd){\n\t\ttry\n\t\t{\n\t\t\tCryptoHelper ch = new CryptoHelper();\n\t\t\tMessageDigest msgDigest = MessageDigest.getInstance(\"SHA-256\"); \n\t\t\tbyte[] userHash = msgDigest.digest(user.getBytes(\"UTF-16\")); // generating hash of the user\n\t\t\t\n\t\t\tif(sock.isConnected())\n\t\t\t{\n\t\t\t\t// send msg {Login+Hash(User)}serverPublickey to the server\n\t\t\t\tOutputStream sout = sock.getOutputStream();\t\t\t\t\n\t\t\t\tByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\t\t\t\toutputStream.write((byte)LOGIN); // send login signal to the server\n\t\t\t\tHashHelper.WriteInt(outputStream, userHash.length);\n\t\t\t\toutputStream.write(userHash);\n\t\t\t\tHashHelper.WriteInt(outputStream, clientPort);\n\t\t\t\tbyte msg[] = outputStream.toByteArray();\n\t\t\t\tmsg = ch.asymEncrypt(serverPubKey, msg); // Asymmetric encrypting the message\n\t\t\t\toutputStream = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(outputStream, msg.length);\n\t\t\t\toutputStream.write(msg);\n\t\t\t\tsout.write(outputStream.toByteArray()); // sending the message to the server\n\t\t\t\t\n\t\t\t\t// read server response\n\t\t\t\tDataInputStream sin = new DataInputStream(sock.getInputStream());\n\t\t\t\tint response = HashHelper.ReadInt(sin);\n\t\t\t\t\n\t\t\t\t// Any error is handled in the following condition\n\t\t\t\tif (response == ERROR){\n\t\t\t\t\tSystem.out.println(\"User already logged in or doesn't exist...\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// if nonce and salt are received then read nonce\n\t\t\t\tbyte[] nonce = new byte[response];\n\t\t\t\tsin.readFully(nonce);\n\t\t\t\t\n\t\t\t\t// Read the salt for the password\n\t\t\t\tbyte[] salt = new byte[HashHelper.ReadInt(sin)];\n\t\t\t\tsin.readFully(salt);\n\t\t\t\t\n\t\t\t\t// Send nonce+hash(salt||password) to server encrypted with server's public key\n\t\t\t\tbyte[] passwordByte = pwd.getBytes(\"UTF-16\");\n\t\t\t\tbyte[] saltedPassword = new byte[salt.length + passwordByte.length];\n\t\t\t\tSystem.arraycopy(salt, 0, saltedPassword, 0, salt.length);\n\t\t\t\tSystem.arraycopy(passwordByte, 0, saltedPassword, salt.length, passwordByte.length);\n\t\t\t\tbyte[] saltedHash = msgDigest.digest(saltedPassword);\n\t\t\t\toutputStream = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(outputStream, nonce.length);\n\t\t\t\toutputStream.write(nonce);\n\t\t\t\tHashHelper.WriteInt(outputStream, saltedHash.length);\n\t\t\t\toutputStream.write(saltedHash);\n\t\t\t\t// Asymmetric encrypting the salted hash with the server's public key.\n\t\t\t\tbyte[] message = ch.asymEncrypt(serverPubKey, outputStream.toByteArray());\n\t\t\t\toutputStream = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(outputStream, message.length);\n\t\t\t\toutputStream.write(message);\n\t\t\t\tsout.write(outputStream.toByteArray()); // sending the message to the server.\n\t\t\t\t\n\t\t\t\t// Generate Client's Diffie-Hellman Part\n\t\t\t\tDHHelper dh = new DHHelper();\n\t\t\t\tByteArrayOutputStream out = new ByteArrayOutputStream();\n\t\t\t\tObjectOutputStream serializer = new ObjectOutputStream(sout);\n\t\t\t\tDHParameterSpec spec = dh.getParameterSpec();\n\t\t\t\tserializer.writeObject(spec.getP());\n\t\t\t\tserializer.writeObject(spec.getG());\n\t\t\t\tserializer.writeInt(spec.getL());\n\t\t\t\tserializer.writeObject(dh.getPublicKey());\n\t\t\t\tserializer.flush();\n\t\t\t\t\n\t\t\t\t//read the server's response\n\t\t\t\tresponse = HashHelper.ReadInt(sin);\n\t\t\t\t\n\t\t\t\t// Errors are handled by the following condition.\n\t\t\t\tif (response == ERROR){\n\t\t\t\t\tSystem.out.println(\"Incorrect password...\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//else read Diffie-Hellman part of server\n\t\t\t\tbyte[] serverDH = new byte[response];\n\t\t\t\tsin.readFully(serverDH);\n\t\t\t\tByteArrayInputStream in = new ByteArrayInputStream(serverDH);\n\t\t\t\tObjectInputStream deserializer = new ObjectInputStream(in);\n\t\t\t\tPublicKey pubkey = (PublicKey)deserializer.readObject();\n\t\t\t\t\n\t\t\t\t// Obtain the symmetric key.\n\t\t\t\tSecretKey symKey = dh.doFinal(pubkey, \"AES\");\n\t\t\t\tsymK = symKey;\n\t\t\t\t\n\t\t\t\t// reading c1 received from server\n\t\t\t\tbyte[] c1iv = new byte[HashHelper.ReadInt(sin)];\n\t\t\t\tsin.readFully(c1iv);\n\t\t\t\tByteArrayInputStream bais = new ByteArrayInputStream(c1iv);\n\t\t\t\tDataInputStream dis = new DataInputStream(bais);\n\t\t\t\tint len = HashHelper.ReadInt(dis);\n\t\t\t\tbyte[] iv = new byte[len];\n\t\t\t\tdis.readFully(iv);\n\t\t\t\tbyte[] c1 = new byte[HashHelper.ReadInt(dis)]; \n\t\t\t\tdis.readFully(c1);\n\t\t\t\tbyte[] c1_dec = ch.symDecrypt(symKey, iv, c1);\n\t\t\t\t\n\t\t\t\t// Generate C2 to be appended with C1\n\t\t\t\tSecureRandom rand = new SecureRandom();\n\t\t\t\tbyte[] c2 = new byte[32];\n\t\t\t\trand.nextBytes(c2);\n\t\t\t\t\n\t\t\t\t// encrypt c1+c2 with symmetric key \n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tout.write(c1_dec);\n\t\t\t\tout.write(c2);\n\t\t\t\tbyte[] c1c2enc = ch.symEncrypt(symKey, out.toByteArray());\n\t\t\t\t\n\t\t\t\t// send K{c1+c2} to server\n\t\t\t\tout = new ByteArrayOutputStream();\n\t\t\t\tHashHelper.WriteInt(out, c1c2enc.length);\n\t\t\t\tout.write(c1c2enc);\n\t\t\t\tsout.write(out.toByteArray());\n\t\t\t\t\n\t\t\t\t// receive c2 from server and decrypt\n\t\t\t\tbyte[] c2iv = new byte[HashHelper.ReadInt(sin)];\n\t\t\t\tsin.readFully(c2iv);\n\t\t\t\tbais = new ByteArrayInputStream(c2iv);\n\t\t\t\tdis = new DataInputStream(bais);\n\t\t\t\tlen = HashHelper.ReadInt(dis);\n\t\t\t\tiv = new byte[len];\n\t\t\t\tdis.readFully(iv);\n\t\t\t\tbyte[] c2_received = new byte[HashHelper.ReadInt(dis)]; \n\t\t\t\tdis.readFully(c2_received);\n\t\t\t\tbyte[] c2_dec = ch.symDecrypt(symKey, iv, c2_received);\n\t\t\t\t\n\t\t\t\t// compare received and sent c2\n\t\t\t\tif (!Arrays.equals(c2_dec, c2)){\n\t\t\t\t\tSystem.out.println(\"Login failed as c2!=c2\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Logged in successfully...\");\n\t\t\t\treturn true;\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(\"Socket not connected\");\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\tSystem.out.println(\"Login failed\");\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\n\tpublic void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,\n\t\t\tException ex) {\n\t\tSystem.out.println(\"after handshake\");\n\n\t\tHttpServletRequest rq = ((ServletServerHttpRequest) request).getServletRequest();\n\t\tHttpSession session = rq.getSession();\n\t\tsuper.afterHandshake(request, response, wsHandler, ex);\n\n\t}", "private boolean handleLogin(String serverMessage){\r\n\t\t// Separating the message STATUS + TOKEN\r\n\t\tString[] messageParts = serverMessage.split(SEPARATOR);\r\n\r\n\t\t// Get status code from message\r\n\t\tint messageStatus = Integer.parseInt(messageParts[0]);\r\n\r\n\t\t//Process status\r\n\t\tswitch (messageStatus) {\r\n\t\tcase REQUEST_OK:\r\n\r\n\t\t\t// Status OK set TOKEN to Authenticated User\r\n\t\t\tSystem.out.println(\"Login request OK\");\r\n\t\t\tcontroller.getModel().getAuthUser().setToken(messageParts[1]);\r\n\t\t\treturn true;\r\n\r\n\t\tcase INCORRECT_REQUEST_FORMAT:\r\n\r\n\t\t\tSystem.err.println(\"Oups! \\nSomethin went wrong!\\n Request format was invalid\");\r\n\t\t\tbreak;\r\n\r\n\t\tcase INCORRECT_USER_OR_PASSWOROD:\r\n\r\n\t\t\tJOptionPane.showMessageDialog(null,\"Username or password is incorrect!\", \"Error\",\r\n\t\t\t\t\tJOptionPane.ERROR_MESSAGE);\r\n\t\t\tbreak;\r\n\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}", "@Override \n public void run() {\n\t\tString path = Urls.URL_32;\n\t\t\n\t\tMap<String, String> map = new HashMap<String, String>();\n\t\tmap.put(\"login-name-or-mobile\", username);\n\t\tmap.put(\"pwd\", password);\n\t \tList<BasicNameValuePair> params = HttpUtils.setParams(map);\n\t \t\n\t\tMap<String, String> map2 = new HashMap<String, String>();\n\t \tmap2.put(\"Accept-Encoding\", \"gzip, deflate\");\n\t \tmap2.put(\"Accept\", \"application/json\");\n\n\t \tMap<String,String> info = new HashMap<String,String>();\n\t\tString jsonStr = \"\";\n\t\ttry {\n\t\t\tjsonStr = RequestService.getInstance().getRequest(params, path, map2);\n\t\t\t\n\t\t\tif(jsonStr==null || \"null\".equals(jsonStr) || \"\".equals(jsonStr)){\n\t\t\t\tinfo.put(\"available\", \"0\");\n\t\t\t}else{\n\t\t\t\tHttpUtils.parseJson(jsonStr, info, null);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tMessage msg = new Message(); \n\t msg.what = Constants.NETWORK_ERROR;\n\t handler.sendMessage(msg); \n\t return;\n\t\t}\n\t\t\n Message msg = new Message(); \n msg.obj = info;\n msg.what = Constants.GET_BALANCE_SUCCESS;\n handler.sendMessage(msg); \n }", "public void afterLogin(LfwSessionBean userVO)\n/* */ {\n/* 276 */ HttpServletRequest request = LfwRuntimeEnvironment.getWebContext().getRequest();\n/* */ try {\n/* 278 */ LfwRuntimeEnvironment.setLfwSessionBean(userVO);\n/* 279 */ LfwRuntimeEnvironment.setClientIP(HttpUtil.getIp());\n/* 280 */ LfwRuntimeEnvironment.setDatasource(userVO.getDatasource());\n/* 281 */ if (!\"annoyuser\".equals(userVO.getUser_code()))\n/* 282 */ changeSessionIdentifier(request);\n/* 283 */ request.getSession().setAttribute(\"LOGIN_SESSION_BEAN\", userVO);\n/* 284 */ initUser(userVO);\n/* 285 */ regOnlineUser(userVO, request);\n/* 286 */ ILoginSsoService<PtSessionBean> ssoService = getLoginSsoService();\n/* 287 */ ssoService.addSsoSign((PtSessionBean)userVO, getSysType());\n/* 288 */ UFBoolean loginResult = UFBoolean.TRUE;\n/* */ \n/* */ \n/* */ \n/* 292 */ loginPluginExecutor(userVO, \"after\");\n/* 293 */ getUserBill().doLoginLog(userVO, loginResult, LfwResBundle.getInstance().getStrByID(\"pserver\", \"PortalLoginHandler-000023\"));\n/* */ }\n/* */ catch (BusinessException e) {\n/* 296 */ PortalLogger.error(e.getMessage(), e);\n/* */ }\n/* */ }", "public void handlePost( HttpExchange exchange ) throws IOException {\n switch( exchange.getRequestURI().toString().replace(\"%20\", \" \") ) {\n // the web client wants to submit a log in request\n case \"/log-in\":\n // get the body of the HttpExchange\n String body = getBody(exchange);\n print(\"BODY: \\n\" + body);\n if ( body.equals(\"-1\") == true) { // if the body is empty\n sendResponse(exchange, new byte[0], 204);\n // HTTP Response code 204 - no content\n } else {\n\n String[] content = body.split(\"&\");\n //pos 0 : username=<content>; pos 1 : password=<content>; pos 2 : <submit type>\n\n String username = content[0].split(\"=\")[1];\n String password = content[1].split(\"=\")[1];\n\n //check database\n if( username.equals(\"james\") && password.equals(\"123\")) {\n print(\"Username and Password Match\");\n sendResponse(exchange, getHTMLPage(\"/home.html\"), 200); // this will be changed to a redirect notice\n // set client as logged in\n logged_in = true;\n\n// sendResponse(exchange, getPanel(exchange, \"home.html\"), 200);\n } else {\n sendResponse(exchange, new byte[0], 406);\n // send HTTP Response code 406 - Not acceptable\n }\n }\n\n break;\n case \"/home\":\n\n default:\n print(\"Body:\");\n print( getBody(exchange) );\n sendResponse(exchange, htmlBuilder( \"Not Implemented\", \"Http Error 501: Not Implemented\").getBytes(), 501);\n break;\n }\n // got body response .. check form sending to - if form is login then get username and password combo\n }", "@Override\n\t\t\tpublic void onSuccess(JSONObject response) {\n\t\t\t\ttry {\n\t\t\t\t\tint code = response.getInt(\"code\");\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tList<List<Boolean>> chekbleData = myadapter.getChekbleData();\n\t\t\t\t\t\tfor (int i = 0; i < chekbleData.size(); i++) {\n\t\t\t\t\t\t\tfor (int j = 0; j < chekbleData.get(i).size(); j++) {\n\t\t\t\t\t\t\t\tif(chekbleData.get(i).get(j)){\n\t\t\t\t\t\t\t\t\tKeyInfo keyInfo = data.get(i);\n\t\t\t\t\t\t\t\t\tList<Key> keys = keyInfo.getKeys();\n\t\t\t\t\t\t\t\t\tKey key = keys.get(j);\n\t\t\t\t\t\t\t\t\tIntent chatIntent = new Intent();\n\t\t\t\t\t\t\t\t\tchatIntent.putExtra(\"zoneName\", keyInfo.getAddress());\n\t\t\t\t\t\t\t\t\tchatIntent.putExtra(\"zoneType\", getString(R.string.doorType2));\n\t\t\t\t\t\t\t\t\tsetResult(Activity.RESULT_OK, chatIntent); \n\t\t\t\t\t finish(); \n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tshowToast(R.string.auth_key_success);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase -101:\n\t\t\t\t\t\tshowToast(R.string.auth_key_car_Fail1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase -102:\n\t\t\t\t\t\tshowToast(R.string.auth_key_car_Fail2);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase -103:\n\t\t\t\t\t\tshowToast(R.string.auth_key_car_Fail3);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase -104:\n\t\t\t\t\t\tshowToast(R.string.auth_key_car_Fail4);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase -105:\n\t\t\t\t\t\tshowToast(R.string.auth_key_car_Fail5);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase -106:\n\t\t\t\t\t\tshowToast(R.string.auth_key_car_Fail6);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tshowToast(R.string.auth_key_Fail);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}", "@Override\n protected Boolean doInBackground(Void... params) {\n try {\n OkHttpClient client = new OkHttpClient();\n RequestBody body = new FormBody.Builder()\n .add(\"Token\",session.get(\"Token\"))\n .add(\"User\",ruser)\n .build();\n\n okhttp3.Request request = new okhttp3.Request.Builder()\n .url(\"http://donationearners.net/cab_token/lobscab_tokenphp.php\")\n .post(body)\n .build();\n try {\n client.newCall(request).execute();\n } catch (IOException e) {\n\n e.printStackTrace();\n return false;\n }\n // TODO: register the new account here.\n return true;\n }catch (Exception er){\n return false;\n }\n\n }", "private void sendAuthenticationResponse(Session userSession, boolean authenticated) {\n\t\tsend(userSession, new AuthenticationResponse(authenticated));\n\t}", "@Override\n public AuthenticatorFlowStatus process(HttpServletRequest request, HttpServletResponse response,\n AuthenticationContext context) throws AuthenticationFailedException {\n if (context.isLogoutRequest()) {\n return AuthenticatorFlowStatus.SUCCESS_COMPLETED;\n }\n\n if (StringUtils.isNotEmpty(request.getParameter(\"tcParam\"))) {\n try {\n processAuthenticationResponse(request, response, context);\n } catch (Exception e) {\n context.setRetrying(true);\n context.setCurrentAuthenticator(getName());\n return initiateAuthRequest(response, context, e.getMessage());\n }\n return AuthenticatorFlowStatus.SUCCESS_COMPLETED;\n } else {\n return initiateAuthRequest(response, context, null);\n }\n }", "public boolean authToServer() throws ClientChatException{\n\n\t\t// On crée un objet container pour contenir nos donnée\n\t\t// On y ajoute un AdminStream de type Authentification avec comme params le login et le mot de pass\n \tAuthentificationRequest request = new AuthentificationRequest(login, pass);\n\t\t\n\t\t//Auth sur le port actif\n\t\ttry {\n\t\t\t// On tente d'envoyer les données\n\t\t\toos_active.writeObject(request);\n\t\t\t// On tente de recevoir les données\n\t\t\tAuthentificationResponse response = (AuthentificationResponse)ois_active.readObject();\n\n\t\t\t// On switch sur le type de retour que nous renvoie le serveur\n\t\t\t// !!!Le type enum \"Value\" est sujet à modification et va grandir en fonction de l'avance du projet!!!\n\t\t\tswitch(response.getResponseType()){\n\t\t\tcase AUTH_SUCCESS:\n\t\t\t\t\n\t\t\t\towner = response.getOwner();\n\t\t\t\t\n\t\t\t\t//creation du socket\n\t\t\t\ttry {\n\t\t\t\t\ts_passive = new Socket(address, 3003);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive socket creation failed!\");\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// On crée le flux sortant !!!OBLIGATOIRE de créer le flux sortant avant le flux entrant!!!\n\t\t\t\ttry {\n\t\t\t\t\toos_passive = new ObjectOutputStream(s_passive.getOutputStream());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive OOS creation failed!\");\n\t\t\t\t}\n\t\t\t\t// On crée le flux entrant\n\t\t\t\ttry {\n\t\t\t\t\tois_passive = new ObjectInputStream(s_passive.getInputStream());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive OIS creation failed!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\trequest = new AuthentificationRequest(owner);\t\t\t\n\t\t\t\t//Auth sur le port passif\n\t\t\t\ttry {\n\t\t\t\t\t// On tente d'envoyer les données\n\t\t\t\t\toos_passive.writeObject(request);\n\t\t\t\t\t// On tente de recevoir les données\n\t\t\t\t\tresponse = (AuthentificationResponse)ois_passive.readObject();\n\n\t\t\t\t\t// On switch sur le type de retour que nous renvoie le serveur\n\t\t\t\t\t// !!!Le type enum \"Value\" est sujet à modification et va grandir en fonction de l'avance du projet!!!\n\t\t\t\t\tswitch(response.getResponseType()){\n\t\t\t\t\tcase AUTH_SUCCESS:\n\t\t\t\t\t\topResult = \"Welcome!\";\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tcase AUTH_FAIL:\n\t\t\t\t\t\topResult = \"ERROR : check login/pwd! (passive socket)\";\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} catch(Exception e){\n\t\t\t\t\tthrow new ClientChatException (ClientChatException.IO_ERREUR, \"ERROR: Communication Error (passive)\");\n\t\t\t\t}\n\t\t\t\n\t\t\tcase AUTH_FAIL:\n\t\t\t\topResult = \"ERROR : check login/pwd! (active socket)\";\n\t\t\t\treturn false;\n\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new ClientChatException (ClientChatException.IO_ERREUR, \"ERROR: Communication Error (active)\");\n\t\t}\n\t\treturn true;\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n \n String token = request.getParameter(\"token\");\n String fbref = request.getParameter(\"fbref\");\n String uxt = request.getParameter(\"uxt\");\n String callback = request.getParameter(\"callback\");\n \n response.setContentType(\"application/json;charset=UTF-8\");\n PrintWriter out = response.getWriter();\n \n DbApis dbApis = new DbApis();\n dbApis.connect();\n \n try {\n \n if(token != null && fbref != null && uxt != null){\n \n boolean accepted = dbApis.authorizedAckRequest(token);\n \n if(accepted){\n Helpers helpers = new Helpers();\n String code = helpers.randomString();\n code = helpers.generateToken(code);\n\n dbApis.createFbOTP(code, token, fbref);\n\n // force check a NULL callback\n try{\n if(callback.equals(\"SIGNAL\"));\n }catch(Exception e){\n callback = \"\";\n }\n \n // 200\n if(callback.startsWith(\"jQuery\"))\n out.println(callback+\"({\"\n + \"\\\"status\\\":200,\"\n + \"\\\"message\\\":\\\"OTP Access code has been generated\\\",\"\n + \"\\\"code\\\":\\\"\"+code+\"\\\"\"\n + \"})\");\n else\n out.println(\"{\"\n + \"\\\"status\\\":200,\"\n + \"\\\"message\\\":\\\"OTP Access code has been generated\\\",\"\n + \"\\\"code\\\":\\\"\"+code+\"\\\"\"\n + \"}\");\n }else{\n // 401\n out.println(\"{\"\n + \"\\\"status\\\":401,\"\n + \"\\\"message\\\":\\\"Unauthorized token, fbref, or unix time\\\"\"\n + \"}\");\n }\n }else{\n // 500\n out.println(\"{\"\n + \"\\\"status\\\":500,\"\n + \"\\\"message\\\":\\\"Requires 3 params such token, fbref, and unix time\\\"\"\n + \"}\");\n }\n \n } finally { \n out.close();\n dbApis.disconnect();\n }\n \n }", "@Override\n public void onSuccess(SafetyNetApi.RecaptchaTokenResponse response) {\n userResponseToken = response.getTokenResult();\n if (!userResponseToken.isEmpty()) {\n // Validate the user response token using the\n // reCAPTCHA siteverify API.\n // new SendPostRequest().execute();\n sendRequest();\n }\n }", "@Override\n public void onResponse(String response) {\n if (response.equalsIgnoreCase(\"success\")) {\n //dismissing the progressbar\n //pDialog.dismiss();\n //Starting a new activity\n startActivity(new Intent(SignUpNewActivity.this, LoginActivity.class));\n\n } if (response.equalsIgnoreCase(\"failed\")){\n //Displaying a toast if the otp entered is wrong\n Toast.makeText(SignUpNewActivity.this, \"Wrong Code Please Try Again\", Toast.LENGTH_LONG).show();\n\n }\n }", "@Override\n public void onSuccess(int statusCode, Header[] headers, byte[] response) {\n // Hide Progress Dialog\n prgDialog.hide();\n // try {\n // JSON Object\n// String str=new String(response);\n// JSONObject obj = new JSONObject(str);\n // When the JSON response has status boolean value assigned with true\n if(statusCode==200){\n\n // Display successfully registered message using Toast\n Toast.makeText(getApplicationContext(), \"Thanks for the Donation.Our representative will contact you shortly :)\", Toast.LENGTH_LONG).show();\n navigateToHomeActivity();\n }\n\n }", "public void login(){\n JSONObject clientInfo = new JSONObject();\n try{\n clientInfo.put(\"username\", mUsername);\n clientInfo.put(\"password\", mPassword);\n clientInfo.put(\"deviceID\", getDeviceID());\n clientInfo.put(\"ipAddress\", getClientIP());\n mSocket.emit(\"login\", clientInfo);\n }catch(JSONException ex){\n throw new RuntimeException(ex);\n }\n }", "private Object authenticate(Invocation invocation, HttpServletRequest request,\r\n HttpServletResponse response) throws IOException {\r\n\r\n Object[] args = invocation.getArgs();\r\n if (args.length != 2) {\r\n throw new RuntimeException(\"The authenticate call must have two arguments\");\r\n }\r\n\r\n String user = (String) args[0];\r\n String password = (String) args[1];\r\n\r\n //We can make the remote call\r\n Object result = invoke(invocation);\r\n\r\n //If the authentification failed we finish the execution\r\n if (result instanceof LoginContext) {\r\n LoginContext loginContext = (LoginContext) result;\r\n if (loginContext == null) {\r\n throw new RuntimeException(\"Login failed!!\");\r\n }\r\n \r\n HttpSession session = request.getSession(false);\r\n String sessionId = session.getId();\r\n response.addHeader(\"jsessionid\", sessionId);\r\n\r\n \r\n session.setAttribute(User.USER_KEY, loginContext.getUser());\r\n\r\n session.setAttribute(RhSessionContext.CLIENT_ID, loginContext.getClient_id());\r\n session.setAttribute(RhSessionContext.ORG_ID, loginContext.getOrg_id());\r\n session.setAttribute(RhSessionContext.DUTY_ID, loginContext.getDutyId());\r\n\r\n Map attrs = loginContext.getAttributes();\r\n Set<Map.Entry> entries = attrs.entrySet();\r\n for (Map.Entry entry : entries) {\r\n session.setAttribute((String) entry.getKey(), entry.getValue());\r\n }\r\n\r\n // 创建login session\r\n LoginSession loginSession = new LoginSession();\r\n loginSession.setLoginName(loginContext.getUser().getUsername());\r\n loginSession.setIp(request.getRemoteHost());\r\n loginSession.setLoginDate(new Date(session.getCreationTime()));\r\n loginSession.setSessionId(session.getId());\r\n loginSession.setLiving(true);\r\n\r\n //Session hibernateSession = RhinoCtx.instance().getHibernate().getSession();\r\n try {\r\n \r\n ServiceBase serviceBase = (ServiceBase) ServiceFactory.getService(ServiceBase.NAME);\r\n //ServiceBase serviceBase = (ServiceBase) RhinoCtx.getBean(\"serviceBase\");\r\n //hibernateSession.beginTransaction();\r\n serviceBase.save(loginSession);\r\n //hibernateSession.getTransaction().commit();\r\n session.setAttribute(\"loginSession\", loginSession);\r\n\r\n } catch (Exception ex) {\r\n ex.printStackTrace();\r\n //hibernateSession.getTransaction().rollback();\r\n } finally {\r\n //hibernateSession.close();\r\n }\r\n }\r\n return result;\r\n }", "void onChallengeResponseReceived(@NonNull final RawAuthorizationResult response);", "public abstract boolean login(String email, String passwaord) throws CouponSystemException;" ]
[ "0.5550596", "0.5548175", "0.55179745", "0.5413751", "0.5372323", "0.53552336", "0.5328489", "0.5327486", "0.5319623", "0.5299686", "0.5277595", "0.526636", "0.52416605", "0.52338386", "0.52145314", "0.52114844", "0.5202655", "0.5155323", "0.51240534", "0.51226735", "0.5103989", "0.5081234", "0.49958813", "0.4966508", "0.4946241", "0.4934808", "0.49245703", "0.4905815", "0.48907942", "0.48893332", "0.48763865", "0.48719376", "0.48686472", "0.4861924", "0.48617437", "0.4839491", "0.4838692", "0.48354718", "0.48349857", "0.48341355", "0.4822337", "0.48112288", "0.4800393", "0.47961986", "0.47961366", "0.47944817", "0.47849116", "0.4781126", "0.4770936", "0.4758557", "0.47580782", "0.47536266", "0.47529107", "0.47485986", "0.47401735", "0.47375038", "0.4729447", "0.472769", "0.47272554", "0.4725414", "0.47214147", "0.47147653", "0.46894693", "0.46870053", "0.46865758", "0.4684086", "0.4682109", "0.467878", "0.46638086", "0.46597517", "0.46518537", "0.46460193", "0.4638484", "0.46333766", "0.46150938", "0.46068498", "0.46008697", "0.4592755", "0.45884153", "0.45871454", "0.45837498", "0.45771274", "0.45759043", "0.45722583", "0.45686314", "0.45592067", "0.45583385", "0.45579022", "0.4553852", "0.45538", "0.45519328", "0.45479432", "0.45471606", "0.4535329", "0.45333385", "0.45246586", "0.45232397", "0.45205328", "0.45189053", "0.451814" ]
0.6118821
0
Determines whether a password matches up to the hashed value (digest), using knowledge of the hash function and of times the hash was stretched
private boolean checkHash(byte[] password, String hashValue) { int hashReps = 1000; // stretch the hash this many times String hashAlgorithm = "MD5"; String endValue = new String(); try { MessageDigest md = MessageDigest.getInstance(hashAlgorithm); byte[] value = password; for (int i=0; i<hashReps; i++) { value = md.digest(value); } endValue = DatatypeConverter.printBase64Binary(value); } catch (Exception e) { e.printStackTrace(); System.exit(0); } ComMethods.report("Digest calculated is "+endValue+".", simMode); ComMethods.report("Actual digest associated with username is "+hashValue+".", simMode); return (endValue.equals(hashValue)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean comparePasswordHash(String password, String salt, String destinationHash);", "private boolean givenPassword_whenHashing_thenVerifying(String hashPwd, String inputPwd){\n MessageDigest md;\r\n\t\ttry {\r\n\t\t\tmd = MessageDigest.getInstance(\"MD5\");\r\n\t\t\t//Add password bytes to digest\r\n\t md.update(inputPwd.getBytes());\r\n\t //Get the hash's bytes \r\n\t byte[] bytes = md.digest();\r\n\t //This bytes[] has bytes in decimal format;\r\n\t //Convert it to hexadecimal format\r\n\t StringBuilder sb = new StringBuilder();\r\n\t for(int i=0; i< bytes.length ;i++)\r\n\t {\r\n\t sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));\r\n\t }\r\n\t\t \r\n\t return (sb.toString().equals(hashPwd) ) ;\r\n\t\t} catch (NoSuchAlgorithmException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n return false;\r\n\t}", "private static Boolean checkingPassword(String passwordHash, String Salt, String tryingPassword) throws NoSuchAlgorithmException, InvalidKeySpecException {\n //stores the old salt an hash\n byte[] salt = fromHex(Salt);\n byte[] hash = fromHex(passwordHash);\n //makes a new has for the trying password with the old salt\n PBEKeySpec spec = new PBEKeySpec(tryingPassword.toCharArray(), salt, 1000, hash.length * 8);\n SecretKeyFactory skf = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\n byte[] testHash = skf.generateSecret(spec).getEncoded();\n //checking for differences\n int differece = hash.length ^ testHash.length;\n for(int i = 0; i < hash.length && i < testHash.length; i++)\n {\n differece |= hash[i] ^ testHash[i];\n }\n //returns if they are different\n return differece == 0;\n }", "public boolean checkPassword(String plainTextPassword, String hashedPassword);", "String hashPassword(String password);", "public String hashPassword(String plainTextPassword);", "public boolean matchWithHash(String password, String hash) {\n String newHash = getHash(password);\n return newHash.equals(hash);\n }", "String hashPassword(String salt, String password);", "@Test\n\t\tpublic void testhashPassword() {\n\t\t\tString actual = Professor.hashPassword(\"thePassword\");\n\t\t\tString expected = Professor.hashPassword(\"thePassword\");\n\t\t\t\n\t\t\tassertEquals(expected, actual);\n\t\t}", "private static boolean validatePassword(String originalPassword, String storedPassword) throws NoSuchAlgorithmException, InvalidKeySpecException\n {\n String[] parts = storedPassword.split(\":\");\n int iterations = Integer.parseInt(parts[0]);\n byte[] salt = fromHex(parts[1]);\n byte[] hash = fromHex(parts[2]);\n\n PBEKeySpec spec = new PBEKeySpec(originalPassword.toCharArray(), salt, iterations, hash.length * 8);\n SecretKeyFactory skf = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\n byte[] testHash = skf.generateSecret(spec).getEncoded();\n\n int diff = hash.length ^ testHash.length;\n for(int i = 0; i < hash.length && i < testHash.length; i++)\n {\n diff |= hash[i] ^ testHash[i];\n }\n return diff == 0;\n }", "boolean checkPasswordMatch(PGPSecretKey secretKey, String password);", "String getUserPasswordHash();", "boolean isMatchPassword(Password toCheck) throws NoUserSelectedException;", "private boolean validatePassword() throws NoSuchAlgorithmException, NoSuchProviderException \n {\n String passwordToHash = Password.getText(); \n\t\t\n \tString securePassword = null;\n \tString testPass;\n \tBoolean success=false;\n \tbyte[] salt = null;\n\n\t \n\t \n\t \n try{ \n \t\tmycon=connect.getConnect();\n \t\t \n \t\t \n String query;\n\t query =\"select password, salt\\n\" + \n\t \t\t\"from employee\\n\" + \n\t \t\t\"where userName= ?;\";\n\t \n\t PreparedStatement pstm= mycon.prepareStatement(query);\n\t pstm.setString(1, Username.getText());\n\t ResultSet rs = pstm.executeQuery();\n\t \n\t if(rs.next()) {\n\t \tsecurePassword =rs.getString(1);\n\t \t\n\t \tBlob blob = rs.getBlob(2);\n\t \t int bloblen= (int) blob.length();\n\t \t salt = blob.getBytes(1, bloblen);\n\t \t blob.free();\n\t \t\n\t \t\n\t \n\t }\n\t \n\t \n\t testPass=SecurePass.getSecurePassword(passwordToHash, salt);\n \n \t if(securePassword.equals(testPass)) {\n \t success=true;\n \t this.ActiveUser=Username.getText();\n \t }\n \t\n \t\t\n \t\t\n \t\t\n \t\t} catch (SQLException e ) {\n \t\t\te.printStackTrace(); \t\n \t\t\t\n \t\t}\n\t\treturn success;\n \n\t \t \n \n \n\t\t\n \n }", "boolean hasSufficientEntropy(String password);", "public static boolean checkPassword(String username, String hashedPassword) throws IOException, SQLException, NoSuchAlgorithmException {\n ArrayList<String> user = retrieveUser(username);\n System.out.println(\"This was received: \" + user.toString());\n System.out.println(\"Hashed password from CP: \" + hashedPassword);\n String saltString = user.get(2); // Retrieve salt from database\n String cpSaltedHashedPassword = hash(hashedPassword + saltString);\n String dbSaltedHashedPassword = user.get(1); // Get complete password from database\n System.out.println(\"Salted, hashed password from CP: \" + cpSaltedHashedPassword);\n System.out.println(\"Salted, hashed password from DB: \" + dbSaltedHashedPassword);\n if (dbSaltedHashedPassword.equals(cpSaltedHashedPassword)) { // If password matches the password in the database\n System.out.println(\"Password matches\");\n return true;\n } else { // Password does not match\n System.out.println(\"Password mismatch\");\n return false;\n }\n }", "public static boolean validatePassword(char[] password, String correctHash)\r\n throws NoSuchAlgorithmException, InvalidKeySpecException , NumberFormatException{\r\n // Decode the hash into its parameters\r\n \r\n String[] params = correctHash.split(\":\");\r\n int iterations = Integer.parseInt(params[ITERATION_INDEX]);\r\n byte[] salt = fromHex(params[SALT_INDEX]);\r\n byte[] hash = fromHex(params[PBKDF2_INDEX]);\r\n // Compute the hash of the provided password, using the same salt, \r\n // iteration count, and hash length\r\n byte[] testHash = pbkdf2(password, salt, iterations, hash.length);\r\n // Compare the hashes in constant time. The password is correct if\r\n // both hashes match.\r\n return slowEquals(hash, testHash);\r\n }", "int getPasswordHashLength();", "boolean hasDigest();", "public static boolean verifyPasswordStrength(String password) {\n int howManyDigits = 0; \n int howManyUpperLetters = 0;\n int howManyLowerLetters = 0;\n \n final int cofficientForDigits = THREE;\n final int cofficientForUpperLetters = TWO;\n final int cofficientForLowerLetters = ONE;\n \n int resultPoints;\n final int pointsForStrongPassword = TWENTY;\n \n for (final Character ch : password.toCharArray()) {\n if (Character.isDigit(ch)) {\n howManyDigits++;\n } else if (Character.isUpperCase(ch)) {\n howManyUpperLetters++;\n } else if (Character.isLowerCase(ch)) {\n howManyLowerLetters++;\n }\n }\n \n resultPoints = howManyDigits * cofficientForDigits +\n howManyUpperLetters * cofficientForUpperLetters +\n howManyLowerLetters * cofficientForLowerLetters;\n \n final String output = \"Got points: \" + resultPoints + \"; needed points: \" + pointsForStrongPassword + \".\\n\";\n Main.LOGGER.info(output);\n \n return resultPoints >= pointsForStrongPassword;\n }", "boolean hasPassword2();", "boolean compare(String hash, String input) throws IllegalArgumentException, EncryptionException;", "@Override\r\n\tpublic boolean validatePassword(String hash)\r\n\t{\r\n\r\n\t\tif (hm.containsKey(hash))\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Authentication OK.\");\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Authentication fail.\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t}", "public boolean validatePassword(char[] password, String salt1, String orgPass)\n throws NoSuchAlgorithmException, InvalidKeySpecException\n {\n // Decode the hash into its parameters\n \t\n \tbyte[] salt = fromHex(salt1);\n byte[] oldPass = fromHex(orgPass);\n \n // Compute the hash of the provided password, using the same salt, \n // iteration count, and hash length\n \n byte[] currentPass = pbkdf2(password, salt, PBKDF2_ITERATIONS, HASH_BYTES);\n \n // Compare the hashes in constant time. The password is correct if\n // both hashes match.\n \n return slowEquals(oldPass, currentPass);\n }", "private boolean checkPass(String enterPass) {\n JdbcConnection connection = JdbcConnection.getInstance();\n DaoFactory daoFactory = new RealDaoFactory(connection);\n List<User> users = daoFactory.createUserDao().findAll();\n for (User user : users) {\n if (user.getPasswordHash() == enterPass.hashCode()) {\n return true;\n }\n }\n return false;\n }", "public boolean verifyPassword() {\n\t\tString hash = securePassword(password);\r\n\t\t\r\n\t\tif(!isPasswordSet()) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tString currentPass = getPassword();\r\n\t\tif(hash.equals(currentPass)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "@Test\n public void testHashingAvPassord() {\n String passordTilHash = \"passord\";\n String salt = null;\n String salt2 = null;\n try{\n salt = HashPassord.getSalt();\n salt2 = HashPassord.getSalt();\n }catch(NoSuchAlgorithmException | NoSuchProviderException | java.security.NoSuchProviderException e){\n e.printStackTrace();\n }\n String sikkertPassord = getSecurePassword(passordTilHash, salt);\n String sikkertPassord2 = getSecurePassword(passordTilHash, salt2);\n String regenerertPassordVerifisering = getSecurePassword(passordTilHash, salt);\n \n System.out.println( sikkertPassord+ \":\" + salt); //skriver 83ee5baeea20b6c21635e4ea67847f66\n System.out.println( sikkertPassord2+ \":\" + salt2);\n System.out.println(regenerertPassordVerifisering + \":\" + salt); //skriver 83ee5baeea20b6c21635e4ea67847f66\n \n assertEquals(sikkertPassord, regenerertPassordVerifisering);\n assertNotSame(salt, salt2);\n assertNotSame(sikkertPassord, sikkertPassord2);\n System.out.println(\"//TEST//: testHashingAvPassord() = funker!\");\n \n }", "String generateHashFromPassword(String password, byte[] salt);", "private String bruteForceSeachForPassword(String test, int len) {\n\t\tif (Cracker.determineHashCode(test).equals(hashValue)) {\n\t\t\treturn test;\n\t\t} else if (len > 1){\n\t\t\tfor (int i = 0; i < Cracker.CHARS.length; i++) {\n\t\t\t\tString result = bruteForceSeachForPassword(test+Cracker.CHARS[i], len-1);\n\t\t\t\tif (!result.equals(\"\")) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn \"\";\n\t}", "private boolean checkVersion3(String password) throws CheckPasswordException {\n \n \tboolean lengthOK = checkLength(password);\n \tif(!lengthOK)\n \t\treturn false;\n \t\n \tString hash = sha1Hex(password);\n \n \tURL url;\n try{\n \turl = new URL(baseUrlv3 + hash.substring(0, 5));\n } catch(MalformedURLException e) {\n \t// This shouldn't happen in production: this URL is hardcoded.\n \tthrow new CheckPasswordException(\"API URL was malformed\", CheckPasswordErrorCode.BadConfiguration);\n }\n\n String hashEnd = hash.substring(5);\n \n\n String response = requestGet(url);\n String[] commonHashes = response.split(\"\\\\r?\\\\n\");\n\n // Hash values are in alphabetical order. There may be a clever\n // way to search that determines if our hash is present in\n // log(n) average time. A linear search was easier to implement.\n for(int i=0; i < commonHashes.length; i++){\n \t\n \t// API should respond with HASHHEX:number\n \t// Any line that can't be split like that\n \t// doesn't follow API v3 spec\n String[] pieces = commonHashes[i].split(\":\");\n if(pieces.length != 2){\n throw new CheckPasswordException(\"API Returned malformed response\", CheckPasswordErrorCode.APICallFailure);\n }\n \n \n String testHashEnd = pieces[0];\n //String popularity = pieces[1];\n\n if(hashEnd.equals(testHashEnd)){\n // Our password was found in the list of compromised hashes\n return false;\n }\n }\n\n // If we reach here, the API did not list the hash as a compromised password\n return true;\n }", "private static boolean comparePlaneTextAndEncryptedText(final char[] password, final String correctHash) {\n final String[] params = correctHash.split(\":\");\n final int iterations = Integer.parseInt(params[ITERATION_INDEX]);\n final byte[] salt = fromHex(params[SALT_INDEX]);\n final byte[] hash = fromHex(params[PBKDF2_INDEX]);\n // Compute the hash of the provided password, using the same salt,\n // iteration count, and hash length\n final byte[] testHash = pbkdf2(password, salt, iterations, hash.length);\n\n // Compare the hashes in constant time. The password is correct if\n // both hashes match.\n return slowEquals(hash, testHash);\n }", "@Override\r\n\tpublic String hashFunction(String saltedPass) throws NoSuchAlgorithmException\r\n\t{\r\n\t\tMessageDigest digest = MessageDigest.getInstance(\"SHA-256\");\r\n\t\tbyte[] byteHash = digest.digest(saltedPass.getBytes(StandardCharsets.UTF_8));\r\n\t\thash = DatatypeConverter.printBase64Binary(byteHash);\r\n\t\treturn hash;\r\n\t}", "private boolean isSamePass(byte[] saved) {\n\t\t// They must have the same length.\n\t\tif ( generatedHash.length != saved.length ) return false;\n\n\t\t// Get the index where the salt starts for this user.\n\t\tint saltStart = getSaltStartIndex();\n\t\tint saltEnd = saltStart + SALT_LENGTH;\n\n\t\tfor ( int i = 0 ; i < generatedHash.length; i++ ) {\n\t\t\t// Before the salt, indexes must match up\n\t\t\tif ( i < saltStart ) if ( generatedHash[i] != saved[i] ) return false;\n\t\t\telse if ( i < saltEnd ) continue; // ignore the salt\n\t\t\telse if ( saved[i] != saved[i] ) return false;\n\t\t}\n\t\treturn true;\n\t}", "private String hashPass(String password, String salt)\r\n {\r\n String oldpass = (password + salt);\r\n String hashedPass = null;\r\n StringBuilder sb = new StringBuilder();\r\n\r\n try\r\n {\r\n MessageDigest md = MessageDigest.getInstance(\"SHA-256\");\r\n md.update(oldpass.getBytes(\"UTF-8\"));\r\n\r\n byte[] hash = md.digest();\r\n\r\n for (int i = 0; i < hash.length; i++)\r\n {\r\n sb.append(Integer.toString((hash[i] & 0xff) + 0x100, 16).substring(1));\r\n }\r\n\r\n hashedPass = sb.toString();\r\n }\r\n catch (NoSuchAlgorithmException | UnsupportedEncodingException ex)\r\n {\r\n Logger.getLogger(AuthModel.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n\r\n return hashedPass;\r\n }", "public static void main(String[] args) throws Exception {\r\n\t\tSystem.out.println(\"Test ist bestanden, wenn es keine false-Ausgaben gibt:\");\r\n\t\tString masterPassword = \"myMasterPassword\";\r\n\t\tString passwordInput1 = \"myPassword123\";\r\n\r\n\t\tString hashValue = new HashString(masterPassword).hashString(passwordInput1);\r\n\t\tSystem.out.println(hashValue);\r\n\r\n\t\tString passwordInput2 = \"myPassword123\";\r\n\r\n\t\tSystem.out.println(hashValue.equals(new HashString(masterPassword).hashString(passwordInput2)));\r\n\r\n\t\tSystem.out.println(!hashValue.equals(new HashString(masterPassword + \"asdf\").hashString(passwordInput2)));\r\n\t\tSystem.out.println(!hashValue.equals(new HashString(masterPassword).hashString(passwordInput2 + \"asdf\")));\r\n\r\n\t}", "protected boolean doAuthenticate(String password, String challenge)\r\n {\r\n return digest(MD5, challenge).equals(password);\r\n }", "@Test(priority=1)\n\tpublic void verifyPasswordsMatch() {\n\t\tsignup.clearAllFields();\n\t\tsignup.enterId(\"[email protected]\");\n\t\tsignup.enterPassword(\"abcd\");\n\t\tsignup.reenterPassword(\"1235\");\n\t\tsignup.clickSubmit();\n\t\tList<String> errors = signup.getErrors();\n\t\tAssert.assertTrue(TestHelper.isStringPresent(errors, \"Passwords do not match; please enter a password and reenter to confirm.\\nPasswords must contain at least 6 characters and no spaces.\"));\n\t}", "public boolean testPassword(String hashed_password) {\n return BCrypt.checkpw(this.password, hashed_password);\n }", "public static boolean validateHash(byte [] expectedHash, byte [] passPhrase){\r\n\t\ttry {\r\n\t\t\tMessageDigest digest = MessageDigest.getInstance(digestAlgorithm);\r\n\t\t\tbyte [] seed = Arrays.copyOfRange(expectedHash, 0, SEED_LENGTH);\r\n\t\t\tdigest.update(seed);\r\n\t\t\tdigest.update(passPhrase);\r\n\t\t\tbyte [] d = digest.digest();\r\n\t\t\tif(d.length+SEED_LENGTH != expectedHash.length) return false;\r\n\t\t\tfor(int i = 0; i < d.length; i++) {\r\n\t\t\t\tif(expectedHash[i+SEED_LENGTH] != d[i]) return false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t} catch (NoSuchAlgorithmException e) {\r\n\t\t\t// should not happen\r\n\t\t\tthrow new ModelException(\"Internal Error - Unknown algorithm \"+EncryptionUtility.digestAlgorithm);\r\n\t\t}\r\n\t}", "public static String hashPassword(String password) {\n\n MessageDigest md;\n StringBuffer sb = new StringBuffer();\n String hexString = null;\n try {\n md = MessageDigest.getInstance(\"MD5\");\n\n md.update(password.getBytes());\n byte[] digest = md.digest();\n\n for (byte b : digest) {\n sb.append(String.format(\"%02x\", b & 0xff));\n }\n } catch (NoSuchAlgorithmException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n\n Logger.debug(\"Hash For Password - \" + sb.toString());\n return sb.toString();\n }", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "boolean hasPassword();", "public static boolean validatePassword(String password, String correctHash)\r\n {\r\n boolean validate=false;\r\n try {\r\n validate=validatePassword(password.toCharArray(), correctHash);\r\n } catch (NoSuchAlgorithmException ex) {\r\n Logger.getLogger(PasswordHash.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (InvalidKeySpecException ex) {\r\n Logger.getLogger(PasswordHash.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (NumberFormatException ex){}\r\n return validate;\r\n }", "private String getOldPasswordHash(String password) {\n\t\tWhirlpool hasher = new Whirlpool();\n hasher.NESSIEinit();\n\n // add the plaintext password to it\n hasher.NESSIEadd(password);\n\n // create an array to hold the hashed bytes\n byte[] hashed = new byte[64];\n\n // run the hash\n hasher.NESSIEfinalize(hashed);\n\n // this stuff basically turns the byte array into a hexstring\n java.math.BigInteger bi = new java.math.BigInteger(hashed);\n String hashedStr = bi.toString(16); // 120ff0\n if (hashedStr.length() % 2 != 0) {\n // Pad with 0\n hashedStr = \"0\"+hashedStr;\n }\n return hashedStr;\n\t}", "public String hashfunction(String password)\r\n\t{\r\n\t\t\r\n\t\tMessageDigest md=null;\r\n\t\ttry {\r\n\t\t\tmd = MessageDigest.getInstance(\"SHA-1\");\r\n\t\t} catch (NoSuchAlgorithmException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tmd.update(password.getBytes());\r\n\t\tbyte[] hash=md.digest();\r\n\t\tchar[] hexArray = \"0123456789ABCDEF\".toCharArray();\r\n\t\tchar[] hexChars = new char[hash.length * 2];\r\n\t for ( int j = 0; j < hash.length; j++ ) \r\n\t {\r\n\t int v = hash[j] & 0xFF;\r\n\t hexChars[j * 2] = hexArray[v >>> 4];\r\n\t hexChars[j * 2 + 1] = hexArray[v & 0x0F];\r\n\t }\r\n\t String hash_password=new String(hexChars);\r\n\t hash_password=hash_password.toLowerCase();\r\n\t return hash_password;\r\n\t}", "private boolean checkPassword(){\n Pattern p = Pattern.compile(\"^[A-z0-9]*$\");\n Matcher m = p.matcher(newPass.getText());\n boolean b = m.matches();\n if(newPass.getText().compareTo(repeatPass.getText()) != 0 || newPass.getText().isEmpty() || repeatPass.getText().isEmpty()){\n repeatPass.setBackground(Color.red);\n JOptionPane.showMessageDialog(null, \"Password Error\");\n return false;\n }\n else if(newPass.getText().length() > 10 || b == false){\n newPass.setBackground(Color.red);\n JOptionPane.showMessageDialog(null, \"Password Error\");\n return false;\n }\n newPass.setBackground(Color.green);\n repeatPass.setBackground(Color.green);\n return true;\n }", "@Override\n\tpublic boolean confirmPassword(Password password) {\n\t\tString sqlString = \"SELECT user.PASSWORD FROM user WHERE user.USER_ID=:userId\";\n\t\tMap<String, Object> params = new HashMap<>();\n\t\tparams.put(\"userId\", password.getUserId());\n// LogUtils.systemLogger.info(LogUtils.buildStringForSystemLog(sqlString, params));\n\t\tString hash = this.namedParameterJdbcTemplate.queryForObject(sqlString, params, String.class);\n\t\tPasswordEncoder encoder = new BCryptPasswordEncoder();\n\t\tif (encoder.matches(password.getOldPassword(), hash)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "private static boolean isPasswordStrong(String password) {\n String passwordRegex = \"^(?=.*[0-9])(?=.*[A-Z])(?=.*[#@$%&*!^]).{8,}$\";\n Pattern pat = Pattern.compile(passwordRegex);\n if (password == null)\n return false;\n\n return pat.matcher(password).matches();\n }", "public static boolean pwMatch(String text, SystemUser person, jcrypt checker) {\n\t\tString enc = jcrypt.crypt(person.salt, text);\n\t\tif(enc.equals(person.encField)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private String hashPassword(String password) {\n \t\tif (StringUtils.isNotBlank(password)) {\n \t\t\treturn new ShaPasswordEncoder().encodePassword(password, null);\n \t\t}\n \t\treturn null;\n \t}", "public boolean isPassword(String guess) {\n\t return password.equals(guess);\n }", "public boolean comparePassword(String username, String password) {\n boolean matchedPass = false;\n try {\n conn = dao.getConnection();\n ps = conn.prepareStatement(\"SELECT * FROM USERS WHERE USERNAME=? AND PASSWORD=?\");\n ps.setString(1, username);\n ps.setString(2, password);\n\n ResultSet rs = ps.executeQuery();\n\n // rs.next() is not empty if both user and pass are in the same row\n matchedPass = rs.next();\n\n // close stuff\n ps.close();\n conn.close();\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n return matchedPass;\n }", "public boolean comparePassword(String pass) {\n //TODO: Compare hashed and salted password instead of plaintext\n return this.password.equals(pass);\n }", "Boolean isValidUserPassword(String username, String password);", "public boolean passwordMatches(String password) {\r\n\t\tif (this.password == null | password == null ) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\treturn (this.password.equals(password));\r\n\t\t}\r\n\t}", "public boolean passwordCheck(String password) {\n\t\treturn true;\n\t\t\n\t}", "private static void checksha(String filePath) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tSystem.out.printf(\"Please provide password as hex-encoded text (16 bytes, i.e. 32 hex-digits):%n> \");\n\t\tString expectedDigest = sc.nextLine();\n\n\t\tsc.close();\n\n\t\tMessageDigest sha = null;\n\n\t\t// Get the digest\n\t\ttry {\n\t\t\tsha = MessageDigest.getInstance(\"SHA-256\");\n\n\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\tSystem.out.println(\"Exception while obtaining message digest: \" + e.getMessage());\n\t\t\tSystem.exit(1);\n\t\t}\n\n\t\tPath p = Paths.get(filePath);\n\n\t\t// Open the file input stream\n\t\ttry (InputStream is = Files.newInputStream(p)) {\n\t\t\tbyte[] buff = new byte[4096];\n\t\t\twhile (true) {\n\t\t\t\tint r = is.read(buff);\n\t\t\t\tif (r == -1)\n\t\t\t\t\tbreak;\n\n\t\t\t\t// Update digest\n\t\t\t\tsha.update(buff, 0, r);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Exception while opening the file: \" + e.getMessage());\n\t\t\tsc.close();\n\t\t\tSystem.exit(1);\n\n\t\t}\n\n\t\t// Return the digest and turn to hex string\n\t\tbyte[] hash = sha.digest();\n\t\tString actualDigest = Util.bytetohex(hash);\n\n\t\t// Compare digests\n\t\tif (expectedDigest.equals(actualDigest)) {\n\t\t\tSystem.out.println(\"Digesting completed. Digest of \" + filePath + \" matches expected digest.\");\n\n\t\t} else {\n\t\t\tSystem.out.println(\"Digesting completed. Digest of \" + filePath\n\t\t\t\t\t+ \" does not match the expected digest. Digest was: \" + actualDigest);\n\n\t\t}\n\n\t}", "public static boolean passwordVerification(String dbPassword, String hospitalPassword, String dynamicSalt) {\n\t\tString securePassword = getSha512(dbPassword + dynamicSalt);\n\t\tif (hospitalPassword.equals(securePassword)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public static String hash(String password){\r\n\t\t try {\r\n\t MessageDigest md = MessageDigest.getInstance(\"SHA-256\");\r\n\t md.update(password.getBytes(\"UTF-8\")); \r\n\t byte[] digest = md.digest();\r\n\t \r\n\t BigInteger bigInt = new BigInteger(1, digest);\r\n\t StringBuffer sb = new StringBuffer();\r\n\t for (int i = 0; i < digest.length; i++) {\r\n\t String hex = Integer.toHexString(0xff & digest[i]);\r\n\t if (hex.length() == 1) sb.append('0');\r\n\t sb.append(hex);\r\n\t }\r\n\t System.out.println(sb.toString());\r\n\t return sb.toString();\r\n\t \r\n\t } catch (Exception ex) {\r\n\t System.out.println(ex.getMessage());\r\n\t \r\n\t }\r\n\t\t return null;\r\n\t}", "public boolean reconcilePassword(){\r\n if((signup.getFirstPassword()).equals(signup.getSecondPassword())){\r\n \r\n return true;\r\n \r\n }\r\n else{\r\n \r\n return false;\r\n }\r\n }", "public static boolean checkPassword(final byte[] password, final byte[] salt, final byte[] secret) {\n MessageDigest md = null;\n try {\n md = MessageDigest.getInstance(\"SHA-1\");\n byte[] buffer = new byte[salt.length + password.length];\n System.arraycopy(password, 0, buffer, 0, password.length);\n System.arraycopy(salt, 0, buffer, password.length, salt.length);\n byte[] digest = md.digest(buffer);\n if (secret.length != digest.length) {\n return false;\n }\n for (int i = 0; i < secret.length; ++i) {\n if (secret[i] != digest[i]) {\n return false;\n }\n }\n return true;\n } catch (NoSuchAlgorithmException e) {\n throw new Error(e);\n }\n }", "public static String getHashed_pw(String password) {\r\n\t\tbyte[] plainText = password.getBytes();\r\n MessageDigest md = null;\r\n try {\r\n md = MessageDigest.getInstance(\"MD5\");\r\n } \r\n catch (Exception e) {\r\n System.err.println(e.toString());\r\n }\r\n \tmd.reset();\r\n\t\tmd.update(plainText);\r\n\t\tbyte[] encodedPassword = md.digest();\r\n\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tfor (int i = 0; i < encodedPassword.length; i++) {\r\n\t\t\tif ((encodedPassword[i] & 0xff) < 0x10) {\r\n\t\t\t\tsb.append(\"0\");\r\n\t\t\t}\r\n\t\t\tsb.append(Long.toString(encodedPassword[i] & 0xff, 16));\r\n\t\t}\r\n\t\treturn sb.toString();\r\n\t}", "public static boolean check(User user, String password)\n {\n try\n {\n MessageDigest digest = MessageDigest.getInstance(\"SHA-256\");\n digest.reset();\n digest.update(Base64.getDecoder().decode(user.salt));\n byte[] out = digest.digest(password.getBytes());\n byte[] check = Base64.getDecoder().decode(user.password);\n\n if (out.length != check.length)\n return false;\n\n for (int i = 0; i < out.length; i++)\n {\n if (out[i] != check[i])\n return false;\n }\n\n return true;\n }\n catch (NoSuchAlgorithmException e)\n {\n throw new RuntimeException(e.getMessage(), e);\n }\n }", "private String computeDigest(boolean paramBoolean, String paramString1, char[] paramArrayOfchar, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7) throws NoSuchAlgorithmException {\n/* 470 */ String str1, str3, str5, str2 = this.params.getAlgorithm();\n/* 471 */ boolean bool = str2.equalsIgnoreCase(\"MD5-sess\");\n/* */ \n/* 473 */ MessageDigest messageDigest = MessageDigest.getInstance(bool ? \"MD5\" : str2);\n/* */ \n/* 475 */ if (bool) {\n/* 476 */ if ((str1 = this.params.getCachedHA1()) == null) {\n/* 477 */ str3 = paramString1 + \":\" + paramString2 + \":\";\n/* 478 */ String str7 = encode(str3, paramArrayOfchar, messageDigest);\n/* 479 */ String str6 = str7 + \":\" + paramString5 + \":\" + paramString6;\n/* 480 */ str1 = encode(str6, (char[])null, messageDigest);\n/* 481 */ this.params.setCachedHA1(str1);\n/* */ } \n/* */ } else {\n/* 484 */ String str = paramString1 + \":\" + paramString2 + \":\";\n/* 485 */ str1 = encode(str, paramArrayOfchar, messageDigest);\n/* */ } \n/* */ \n/* */ \n/* 489 */ if (paramBoolean) {\n/* 490 */ str3 = paramString3 + \":\" + paramString4;\n/* */ } else {\n/* 492 */ str3 = \":\" + paramString4;\n/* */ } \n/* 494 */ String str4 = encode(str3, (char[])null, messageDigest);\n/* */ \n/* */ \n/* 497 */ if (this.params.authQop()) {\n/* 498 */ str5 = str1 + \":\" + paramString5 + \":\" + paramString7 + \":\" + paramString6 + \":auth:\" + str4;\n/* */ }\n/* */ else {\n/* */ \n/* 502 */ str5 = str1 + \":\" + paramString5 + \":\" + str4;\n/* */ } \n/* */ \n/* */ \n/* 506 */ return encode(str5, (char[])null, messageDigest);\n/* */ }", "public boolean authenticate(Connection con, String userid, String password)\n throws SQLException, NoSuchAlgorithmException{\n PreparedStatement ps = null;\n ResultSet rs = null;\n try {\n boolean userExist = true;\n // INPUT VALIDATION\n if (userid==null||password==null){\n // TIME RESISTANT ATTACK\n // Computation time is equal to the time needed by a legitimate user\n userExist = false;\n userid=\"\";\n password=\"\";\n }\n\n ps = con.prepareStatement(\"select password, extra FROM login where User_ID = ?\");\n ps.setString(1, userid);\n rs = ps.executeQuery();\n String digest, extra;\n if (rs.next()) {\n digest = rs.getString(\"password\");\n extra = rs.getString(\"extra\");\n // DATABASE VALIDATION\n if (digest == null || extra == null) {\n throw new SQLException(\"Database inconsistant Salt or Digested Password altered\");\n }\n if (rs.next()) { // Should not append, because login is the primary key\n throw new SQLException(\"Database inconsistent two CREDENTIALS with the same LOGIN\");\n }\n } else { // TIME RESISTANT ATTACK (Even if the user does not exist the\n // Computation time is equal to the time needed for a legitimate user\n digest = \"000000000000000000000000000=\";\n extra = \"00000000000=\";\n userExist = false;\n }\n\n byte[] bDigest = base64ToByte(digest);\n byte[] bExtra = base64ToByte(extra);\n\n // Compute the new DIGEST\n byte[] proposedDigest = getHash(ITERATION_NUMBER, password, bExtra);\n\n return Arrays.equals(proposedDigest, bDigest) && userExist;\n } catch (IOException ex){\n throw new SQLException(\"Database inconsistant Salt or Digested Password altered\");\n }\n finally{\n close(rs);\n close(ps);\n }\n }", "public boolean doAuthenticateHashedPassword(Request request, String hashedPassword) {\n AuthorizationHeader authHeader = (AuthorizationHeader) request.getHeader(AuthorizationHeader.NAME);\n if ( authHeader == null ) return false;\n String realm = authHeader.getRealm();\n String username = authHeader.getUsername();\n\n if ( username == null || realm == null ) {\n return false;\n }\n\n String nonce = authHeader.getNonce();\n URI uri = authHeader.getURI();\n if (uri == null) {\n return false;\n }\n\n\n\n String A2 = request.getMethod().toUpperCase() + \":\" + uri.toString();\n String HA1 = hashedPassword;\n\n\n byte[] mdbytes = messageDigest.digest(A2.getBytes());\n String HA2 = toHexString(mdbytes);\n\n String cnonce = authHeader.getCNonce();\n String KD = HA1 + \":\" + nonce;\n if (cnonce != null) {\n KD += \":\" + cnonce;\n }\n KD += \":\" + HA2;\n mdbytes = messageDigest.digest(KD.getBytes());\n String mdString = toHexString(mdbytes);\n String response = authHeader.getResponse();\n\n\n return mdString.equals(response);\n }", "boolean hasHash();", "public boolean isBothPasswordCorrect() { \n String pass1 = new String(newPasswordTextField.getPassword());\n String pass2 = new String(repeatPasswordTextField.getPassword()); \n \n return (pass1.equals(pass2) && isPasswordCorrect());\n }", "public static String hash_password(String password) throws Exception\r\n\t{\r\n\t\t// Digest the password with MD5 algorithm\r\n\t\tMessageDigest md = MessageDigest.getInstance(\"MD5\");\r\n\t\tmd.update(password.getBytes());\r\n\t\t \r\n\t\tbyte byte_data[] = md.digest();\r\n\t\t \r\n\t\t//convert the bytes to hex format \r\n\t\tStringBuffer sb = new StringBuffer();\r\n\t\t \r\n\t\tfor (int i = 0; i < byte_data.length; i++) \r\n\t\t{\r\n\t\t\tsb.append(Integer.toString((byte_data[i] & 0xff) + 0x100, 16).substring(1));\r\n\t\t}\r\n\t\t \r\n\t\t//System.out.println(\"Hashed password: \" + sb.toString());\r\n\t\treturn sb.toString();\r\n\t}", "public boolean authenticate(String attemptedPassword, byte[] encryptedPassword, byte[] salt)\n\t\t\t throws NoSuchAlgorithmException, InvalidKeySpecException {\n\t\t\t byte[] encryptedAttemptedPassword = getEncryptedPassword(attemptedPassword, salt);\n\n\t\t\t // Authentication succeeds if encrypted password that the user entered\n\t\t\t // is equal to the stored hash\n\t\t\t return Arrays.equals(encryptedPassword, encryptedAttemptedPassword);\n\t\t\t }", "public static String hashPassword(String password) {\n String passwordHash = null;\n try {\n // Calculate hash on the given password.\n MessageDigest sha256 = MessageDigest.getInstance(\"SHA-256\");\n byte[] hash = sha256.digest(password.getBytes());\n\n // Transform the bytes (8 bit signed) into a hexadecimal format.\n StringBuilder hashString = new StringBuilder();\n for (int i = 0; i < hash.length; i++) {\n /*\n Format parameters: %[flags][width][conversion]\n Flag '0' - The result will be zero padded.\n Width '2' - The width is 2 as 1 byte is represented by two hex characters.\n Conversion 'x' - Result is formatted as hexadecimal integer, uppercase.\n */\n hashString.append(String.format(\"%02x\", hash[i]));\n }\n passwordHash = hashString.toString();\n Log.d(TAG, \"Password hashed to \" + passwordHash);\n } catch (NoSuchAlgorithmException e) {\n Log.d(TAG, \"Couldn't hash password. The expected digest algorithm is not available.\");\n }\n return passwordHash;\n }", "public String hashing(String password) {\n\n\t\tString hashedPassword = null;\n\n\t\tMessageDigest md;\n\t\ttry {\n\t\t\tmd = MessageDigest.getInstance(\"MD5\");\n\t\t\tmd.update(password.getBytes());\n\t\t\tbyte[] digest = md.digest();\n\t\t\tStringBuffer sb = new StringBuffer();\n\t\t\tfor (byte b : digest) {\n\t\t\t\tsb.append(String.format(\"%02x\", b & 0xff));\n\t\t\t}\n\t\t\thashedPassword = sb.toString();\n\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\treturn hashedPassword;\n\t}", "protected String hashPassword(String passwordToHash, String salt) {\n\t\tString hash = null;\n\t try {\n\t MessageDigest md = MessageDigest.getInstance(\"SHA-512\");\n\t md.update(salt.getBytes(\"UTF-8\"));\n\t byte[] bytes = md.digest(passwordToHash.getBytes(\"UTF-8\"));\n\t StringBuilder sb = new StringBuilder();\n\t for (int i = 0; i < bytes.length ; ++i){\n\t sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));\n\t }\n\t hash = sb.toString();\n\t } \n\t catch (NoSuchAlgorithmException e){\n\t e.printStackTrace();\n\t } catch (UnsupportedEncodingException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t return hash;\n\t}", "protected String digestPassword(String pwd, String passwordDigestAlgoritm, String encoding) throws IllegalArgumentException, NoSuchAlgorithmException, UnsupportedEncodingException {\n StringBuffer password = new StringBuffer();\n password.append(\"{\").append(passwordDigestAlgoritm).append(\"}\");\n password.append(Text.digest(passwordDigestAlgoritm, pwd.getBytes(encoding)));\n return password.toString();\n }", "public boolean checkpassword(String uname,String uhash)\r\n\t{\r\n\t\tboolean attempt=false;\r\n\t\tint index=user_index(uname);\r\n\t\tif(((User)user_records.get(index)).get_hash_password().equals(uhash))\r\n\t\t{\r\n\t\t\tattempt=true;\r\n\t\t}\r\n\t\treturn attempt;\r\n\t}", "private static String hashPassword(String password) throws NoSuchAlgorithmException, InvalidKeySpecException {\n\n char[] passwordChar = password.toCharArray();\n byte[] salt = getSalt();\n PBEKeySpec spec = new PBEKeySpec(passwordChar, salt, 1000, 64 * 8);\n SecretKeyFactory skf = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\n byte[] hash = skf.generateSecret(spec).getEncoded();\n return toHex(salt) + \":\" + toHex(hash);\n }", "void setUserPasswordHash(String passwordHash);", "public PwHash(String password, boolean isRawPassword) {\n valid = new ReadOnlyBooleanWrapper(false);\n encodedHash = new NonNullableStringProperty();\n salt = new ReadOnlyObjectWrapper<>(null);\n hash = new ReadOnlyObjectWrapper<>(null);\n encodedHash.addListener((ObservableValue<? extends String> observable, String oldValue, String newValue) -> {\n if (newValue.length() == HASHED_STRING_LENGTH) {\n Base64.Decoder dec = Base64.getDecoder();\n try {\n byte[] saltBytes = dec.decode(newValue.substring(0, SALT_STRING_LENGTH));\n byte[] hashBytes = dec.decode(newValue.substring(SALT_STRING_LENGTH) + \"==\");\n ObservableByteArrayList b = salt.get();\n if (null != b) {\n boolean notChanged = true;\n for (int i = 0; i < SALT_LENGTH; i++) {\n if (saltBytes[i] != b.get(i)) {\n notChanged = false;\n break;\n }\n }\n if (notChanged) {\n b = hash.get();\n for (int i = 0; i < hashBytes.length; i++) {\n if (hashBytes[i] != b.get(i)) {\n notChanged = false;\n break;\n }\n }\n if (notChanged) {\n return;\n }\n }\n }\n salt.set(new ObservableByteArrayList(saltBytes));\n hash.set(new ObservableByteArrayList(hashBytes));\n valid.set(true);\n return;\n } catch (Exception ex) {\n LOG.log(Level.SEVERE, \"Error decoding hash\", ex);\n }\n }\n salt.set(null);\n hash.set(null);\n valid.set(false);\n });\n if (isRawPassword) {\n setFromRawPassword(password, false);\n } else {\n encodedHash.set(password);\n }\n }", "@Test\n public void testHash() {\n // the hash function does sha256, but I guess I don't care about implementation\n // test if two things hash to same value\n logger.trace(\"Equal strings hash to same value\");\n String hash1 = Util.hash(\"foobar\");\n String hash2 = Util.hash(\"foobar\");\n Assert.assertEquals(hash1, hash2);\n\n // test if different things hash to different value\n logger.trace(\"Unequal strings hash to different value\");\n hash1 = Util.hash(\"foobar\");\n hash2 = Util.hash(\"barfoo\");\n Assert.assertNotEquals(hash1, hash2);\n\n // test if hash length > 5 (arbitrary)\n logger.trace(\"Hash is of sufficient length to avoid collisions\");\n hash1 = Util.hash(\"baz\");\n final int length = hash1.length();\n Assert.assertTrue(length > 5);\n }", "public void testUnmatchedPassword() {\n\n // unmatched length\n boolean test1 = UserService.checkPasswordMatch(\"password123\", \"ppassword123\");\n assertFalse(test1);\n\n boolean test2 = UserService.checkPasswordMatch(\"ppassword123\", \"password123\");\n assertFalse(test2);\n\n // unmatched number\n boolean test3 = UserService.checkPasswordMatch(\"password123\", \"password124\");\n assertFalse(test3);\n\n // unmatched letter (case sensitive)\n boolean test4 = UserService.checkPasswordMatch(\"123password\", \"123Password\");\n assertFalse(test4);\n\n // unmatched letter\n boolean test5 = UserService.checkPasswordMatch(\"123password\", \"123passward\");\n assertFalse(test5);\n\n // unmatched letter/number\n boolean test6 = UserService.checkPasswordMatch(\"123password\", \"12password3\");\n assertFalse(test6);\n }", "boolean getPasswordValid();", "@Test\n public void testMatch()\n {\n\n List<Match> matches;\n String password;\n PasswordMatcher matcher = new SpacialMatcher();\n\n password = \"aw3ennbft6y\";\n matches = matcher.match(configuration, password);\n\n assert matches.get(0).getToken().equals(\"aw3e\");\n assert matches.get(1).getToken().equals(\"ft6y\");\n assert SpacialMatch.class.cast(matches.get(0)).getShiftedNumber() == 0;\n assert SpacialMatch.class.cast(matches.get(1)).getShiftedNumber() == 0;\n assert SpacialMatch.class.cast(matches.get(0)).getTurns() == 2;\n assert SpacialMatch.class.cast(matches.get(1)).getTurns() == 2;\n\n\n password = \"aW3ennbfT6y\";\n matches = matcher.match(configuration, password);\n\n assert matches.get(0).getToken().equals(\"aW3e\");\n assert matches.get(1).getToken().equals(\"fT6y\");\n assert SpacialMatch.class.cast(matches.get(0)).getShiftedNumber() == 1;\n assert SpacialMatch.class.cast(matches.get(1)).getShiftedNumber() == 1;\n assert SpacialMatch.class.cast(matches.get(0)).getTurns() == 2;\n assert SpacialMatch.class.cast(matches.get(1)).getTurns() == 2;\n\n\n password = \"h\";\n matches = matcher.match(configuration, password);\n\n assert matches.isEmpty();\n\n\n password = \"hl5ca\";\n matches = matcher.match(configuration, password);\n\n assert matches.isEmpty();\n }", "public void updatePasswordHashMethod() {\n\t\tm_tcpSession.write(\"c\" + lastUsername + \",\" + (getPasswordHash(lastUsername, lastPassword)) + \",\" + (getOldPasswordHash(lastPassword)));\n\t\tupdatePasswordHashMethod = true;\n\t}", "public void testCorrectPassword() {\n Password p = new Password(\"jesus\".toCharArray());\n assertTrue(p.checkPassword(\"jesus\".toCharArray()));\n }", "public static String hashPassword(String password) {\n byte salt[] = DeriveKey.getRandomByte(Crypt.KEY_BITS);\n\n // generate Hash\n PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, PASSWORD_ITERATIONS, PASSWORD_BITS);\n // we would like this to be \"PBKDF2WithHmacSHA512\" instead? which version of Android\n // Provider implements it?\n SecretKeyFactory skf;\n try {\n skf = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\n } catch (NoSuchAlgorithmException e) {\n e.printStackTrace();\n throw new RuntimeException(\"impossible\", e);\n }\n byte[] hash;\n try {\n hash = skf.generateSecret(spec).getEncoded();\n } catch (InvalidKeySpecException e) {\n e.printStackTrace();\n throw new RuntimeException(\"wrong key\", e);\n }\n return Crypt.toBase64(salt) + Crypt.CHAR_NOT_BASE64 + Crypt.toBase64(hash);\n }", "public static String hashPassword( String hashMe ) {\n final byte[] unhashedBytes = hashMe.getBytes();\n try {\n final MessageDigest algorithm = MessageDigest.getInstance( \"MD5\" );\n algorithm.reset();\n algorithm.update( unhashedBytes );\n final byte[] hashedBytes = algorithm.digest();\n \n final StringBuffer hexString = new StringBuffer();\n for ( final byte element : hashedBytes ) {\n final String hex = Integer.toHexString( 0xFF & element );\n if ( hex.length() == 1 ) {\n hexString.append( 0 );\n }\n hexString.append( hex );\n }\n return hexString.toString();\n } catch ( final NoSuchAlgorithmException e ) {\n e.printStackTrace();\n return null;\n }\n }", "public boolean checkPassword(String password) throws AutoDeployException {\n String crypt = User.md5PasswordCrypt(password);\n if (this.getPassword().equals(crypt)) {\n return true;\n } else {\n return false;\n }\n }", "public boolean isPassword(String plaintextPassword) {\n\t\tvar verifyer = BCrypt.verifyer(Version.VERSION_2A, LongPasswordStrategies.truncate(Version.VERSION_2A));\n\t\treturn this.getPasswordHash() != null && verifyer.verify(plaintextPassword.toCharArray(), this.getPasswordHash()).verified;\n\t}", "public static String hashPass(String value) throws NoSuchAlgorithmException\n\t{\n\t\t//There are many algos are available for hashing i)MD5(message digest) ii)SHA(Secured hash algo)\n\t\tMessageDigest md=MessageDigest.getInstance(\"MD5\");\n\t md.update(value.getBytes());\n\t \n\t byte[] hashedpass=md.digest();\n\t StringBuilder hashpass=new StringBuilder();\n\t for(byte b:hashedpass)\n\t {\n\t \t//Convert to hexadecimal format\n\t hashpass.append(String.format(\"%02x\",b));\n\t }\n\t return hashpass.toString();\n\t}", "public static String computePasswordSHAHash(String password) {\n MessageDigest mdSha1 = null;\n String SHAHash = \"\";\n\n try\n {\n mdSha1 = MessageDigest.getInstance(\"SHA-512\");\n } catch (NoSuchAlgorithmException e1) {\n e1.printStackTrace();\n }\n try {\n mdSha1.update(password.getBytes(\"ASCII\"));\n } catch (UnsupportedEncodingException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n byte[] data = mdSha1.digest();\n try {\n SHAHash = convertToHex(data);\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n\n return SHAHash;\n }", "public static void main(String[] args) {\n\t\tPassword p = new Password();\n\t\tString epassword = \"ff6b6db0b2f4506c074343f20805a39ca856bf3a\";\n\t\tString passText = \"123456\";\n\t\tString id = \"371328198106084016\";\n\t\tString salt = p.getSalt(id);\n\t\tString sp = p.getPassphrase(salt, passText);\n\t\tSystem.out.println(\"salt : +\" + salt +\" passphrase: \"+sp);\n\t\tSystem.out.println(p.matchPassphrase(sp, salt, passText) + \"--------------- for real :\");\n\t\tsalt =\"SjZ1MmwxIDIzMiw2IDEyOTA5MTE1MSAxNDE6ODE2NjEgM1A4TQ==\";\n\t\tsp = \"11895b3270e3fd9038252d4fd45400b6fa30de4f\";\n\t\tSystem.out.println(p.matchPassphrase(sp, salt, \"123456\"));\n\t}", "public String CheckPassword(String Password)\n\t{\n\t\tif(Pattern.matches(\"(?=.*[$#@!%^&*])(?=.*[0-9])(?=.*[A-Z]).{8,20}$\",Password))\n\t\treturn \"HAPPY\";\n\t\telse \n\t\treturn \"SAD\";\n\t}", "private boolean cekPassword(String password){\n return password.equals(Preferences.getRegisteredPass(getBaseContext()));\n }", "public boolean checkPass(String password){\r\n if (password.equals(this.password)){\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }" ]
[ "0.7972828", "0.71898115", "0.711146", "0.70647234", "0.7018148", "0.69811094", "0.6931412", "0.68383604", "0.67881715", "0.6746574", "0.6663387", "0.66140294", "0.6607884", "0.65194285", "0.64699805", "0.6436773", "0.6432171", "0.63749945", "0.6372761", "0.63263154", "0.6285054", "0.6266573", "0.62547505", "0.6247517", "0.6236541", "0.6233794", "0.6205273", "0.61842036", "0.61164415", "0.6107376", "0.609768", "0.6095119", "0.6060578", "0.6060469", "0.60331094", "0.6022831", "0.60198987", "0.5996439", "0.59839636", "0.5977603", "0.5964044", "0.5964044", "0.5964044", "0.5964044", "0.5964044", "0.5964044", "0.5964044", "0.5964044", "0.5920937", "0.5888098", "0.5870105", "0.58682346", "0.58569324", "0.585159", "0.5826735", "0.582136", "0.5820605", "0.58023447", "0.5802298", "0.58009875", "0.5800221", "0.5786287", "0.57840216", "0.578243", "0.577181", "0.5770456", "0.57630706", "0.57580644", "0.5743818", "0.57416195", "0.5741601", "0.5739819", "0.57326037", "0.5730889", "0.5727843", "0.57143265", "0.5711954", "0.57111", "0.5707406", "0.57071286", "0.5706633", "0.5705315", "0.5703195", "0.5701412", "0.5681714", "0.56816024", "0.5668994", "0.56654215", "0.56572163", "0.56491065", "0.56479007", "0.56476146", "0.56454295", "0.5645202", "0.56309694", "0.5627945", "0.5623282", "0.56218225", "0.56217766", "0.56204754" ]
0.77490366
1
Writes to file, replacing user's existing secret with newSecret Returns true if new file was created properly with appropriate contents
private boolean replaceSecretWith(String user, String newSecret) { // System.out.println(); System.out.println(); System.out.println(); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println("WRITING TO FILE"); System.out.println("encryptedSecret = "+newSecret); System.out.println("-------------------"); System.out.println("encryptedSecret in bytes:"); ComMethods.charByChar(newSecret.getBytes(), true); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println(); System.out.println(); System.out.println(); // try { File oldFile = new File(secretsfn); if (!oldFile.isFile()) { System.out.println("ERROR ~~ "+secretsfn+" is not the name of an existing file."); return false; } // Build up new secrets file in a temp file, will rename later File newFile = File.createTempFile("secretstmp", ""); BufferedReader br = new BufferedReader(new FileReader(oldFile)); BufferedWriter bw = new BufferedWriter(new FileWriter(newFile)); // System.out.println("User is "+user+"."); // String l; while (null != (l = br.readLine())) { bw.write(String.format("%s%n", l)); // System.out.println("Wrote line "+l+" to newFile."); // if (l.equals(user)) { l = br.readLine(); bw.write(String.format("%s%n", newSecret)); // System.out.println("Condition Triggered: l.equals(user)."); System.out.println("Wrote "+newSecret+" to newFile."); // } } br.close(); bw.close(); // Delete original file if (!oldFile.delete()) { System.out.println("Could not delete file."); return false; } // Rename temp file to name of original file if (!newFile.renameTo(oldFile)) { // Still a success, but change filename temporarily System.out.println("WARNING ~ Could not rename file."); System.out.println("WARNING ~ Secret file temporarily named: \""+newFile.getName()+"\"."); secretsfn = newFile.getName(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean updateSecret(String newSecret) {\n\t\tbyte[] encryptedNewSecret = SecureMethods.encryptRSA(newSecret.getBytes(), my_n, BigInteger.valueOf(my_e), simMode);\n\t\tbyte[] userMessage = ComMethods.concatByteArrs(\"update:\".getBytes(), encryptedNewSecret);\n\t\treturn sendAndCheckResp(userMessage, \"secretupdated\", \"writingfailure\");\n\t}", "public void writeFile() {\n try {\n FileWriter writer = new FileWriter(writeFile, true);\n writer.write(user + \" \" + password);\n writer.write(\"\\r\\n\"); // write new line\n writer.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n \n }", "public void addToFile(User newUser){\r\n //If the user name is not already in the file then we do not want to re-add the user.\r\n if (f.searchForUsername(newUser.getUsername()) == -1) {\r\n newUser.setPassword(encrypt(newUser.getPassword()));\r\n f.write(newUser);\r\n } else {\r\n System.err.println(\"User already exists\");\r\n }\r\n }", "public void rewritingHashedFile(File path) throws IOException {\n\t\tFileInputStream fis = new FileInputStream(path);\n\t\tbyte[] inputBytes = new byte[fis.available() - 64];\n\t\tfis.read(inputBytes);\n\t\tfis.close();\n\t\t\n\t\tFileOutputStream fos = new FileOutputStream(path);\n\t\tfos.write(inputBytes);\n\t\tfos.close();\n\t}", "void touchSecret(Long secretId);", "void writeFile(File file, String password, String cnt);", "DBOOtpSecret storeSecret(Long userId, String secret);", "void changeFile()\n {\n App app = new App();\n // Loop through the read File\n for (String s : readFile) {\n if (app.containsUtilize(s)) {\n // Changes the first use of utilize with use\n String newTemp = s.replaceFirst(\"utilize\", \"use\");\n // Writes to file\n this.writeFile.add(newTemp);\n } else {\n // not utilize\n this.writeFile.add(s);\n }\n }\n }", "public void write() throws IOException {\n // No pairs to write\n if(map.size() == 0 || !isDirty) {\n System.err.println(\"preferences is already updated..\");\n return;\n }\n\n try(BufferedWriter bufferedWriter = Files.newBufferedWriter(fileName,\n StandardOpenOption.TRUNCATE_EXISTING,\n StandardOpenOption.CREATE))\n {\n for(Map.Entry<String, String> entry : map.entrySet()) {\n String key = entry.getKey();\n String value = entry.getValue();\n\n // Writes the current pair value in the format of 'key=value'\n bufferedWriter.write(String.format(\"%s=%s\\n\", key, value));\n }\n }\n\n isDirty = false;\n }", "private void UpdateSeedFile(File targetFile) {\n String s = targetFile.read(targetFile);//TODO make this work lol\n assert s.length() = 64;\n reseed(s);\n targetFile.write(randomData(64));\n }", "private static void commit() throws IOException {\n java.io.File out = SessionService.getConfFileByPath(Const.FILE_CONFIGURATION + \".\"\n + Const.FILE_SAVING_FILE_EXTENSION);\n OutputStream str = new FileOutputStream(out);\n // Write the temporary file\n try {\n properties.store(str, \"User configuration\");\n } finally {\n str.flush();\n str.close();\n }\n // Commit with recovery support\n java.io.File finalFile = SessionService.getConfFileByPath(Const.FILE_CONFIGURATION);\n UtilSystem.saveFileWithRecoverySupport(finalFile);\n Log.debug(\"Conf commited to : \" + finalFile.getAbsolutePath());\n }", "public void writeDeviceLost(boolean status)\n\t{\n\t\tString writeStatement = (User + \", \" +\n\t\t\t\t\t\t\t UserPassword + \", \" +\n\t\t\t\t\t\t\t Device_ID + \", \");\n\t\t\n\t\t//System.out.println(\"\\nWRITE Statement: \" + writeStatement);\n\t\twriteStatement += (status) ? (1) : (0);\n\t\t// System.out.println(\"\\nWRITE Statement: \" + writeStatement);\n\n\t\t//Write Area Below Start\n\t\ttry {\n\t\t\t\n\t\t\t//THIS WORKS DONT TOUCH IT. or at least save copies.\n\t\t\tFile fileToBeModified = new File(filename);\n\t \n\t String oldContent = \"\";\n\t \n\t BufferedReader reader = null;\n\t \n\t FileWriter writer = null;\n\t \n reader = new BufferedReader(new FileReader(fileToBeModified));\n \n String line = reader.readLine();\n \n while (line != null) \n {\n oldContent = oldContent + line + System.lineSeparator();\n \n line = reader.readLine();\n }\n \n //Replacing oldString with newString in the oldContent\n \n String newContent = oldContent.replaceAll(user_line, writeStatement);\n \n //Rewriting the input text file with newContent\n \n writer = new FileWriter(fileToBeModified);\n \n writer.write(newContent);\n reader.close();\n \n writer.close();\n \n } catch (IOException e) \n\t\t{\n e.printStackTrace();\n }\n\t}", "public void userSettings(String userName, String password, File nameFile,File passFile, String fileadd) {\n try\n {\n \n if(!nameFile.exists())\n {\n nameFile.createNewFile();\n }\n if(!passFile.exists())\n {\n passFile.createNewFile();\n }\n \n FileReader ufr = new FileReader(nameFile);\n FileReader pfr = new FileReader(passFile);\n \n BufferedReader ubr = new BufferedReader(ufr);\n BufferedReader pbr = new BufferedReader(pfr);\n \n ArrayList<String> uName = new ArrayList<>();\n ArrayList<String> uPass = new ArrayList<>();\n for (int i = 0; i < lineNum(fileadd); i++) {\n uName.add(ubr.readLine());\n uPass.add(pbr.readLine());\n }\n for (int i = 0; i < lineNum(fileadd); i++) \n {\n if (userName.equals(uName.get(i)))\n {\n uPass.set(i, password);\n } \n }\n \n ufr.close();\n pfr.close();\n FileWriter fw = new FileWriter(passFile);\n PrintWriter pw = new PrintWriter(fw);\n pw.print(\"\");\n \n FileWriter fw2 = new FileWriter(passFile, true);\n PrintWriter pw2 = new PrintWriter(fw2, true);\n \n for (int j = 0; j < uPass.size() -1; j++)\n {\n \n pw.print(uPass.get(j));\n pw.println();\n \n }\n pw.close();\n }catch(Exception e)\n {\n e.printStackTrace();\n }\n \n }", "void updateFile() throws IOException;", "void addUserInfo(String user, String password) {\r\n if (!userInfo.containsKey(user)) {\r\n userInfo.put(user, password);\r\n } else {\r\n System.out.println(\"User already exist!\");\r\n }\r\n writeToFile(\"Password.bin\", userInfo);\r\n }", "private void updateFile() {\n\t\tPrintWriter outfile;\n\t\ttry {\n\t\t\toutfile = new PrintWriter(new BufferedWriter(new FileWriter(\"stats.txt\")));\n\t\t\toutfile.println(\"15\"); // this is the number\n\t\t\tfor (Integer i : storeInfo) {\n\t\t\t\toutfile.println(i); // we overwrite the existing files\n\t\t\t}\n\t\t\tfor (String s : charBought) {\n\t\t\t\toutfile.println(s); // overwrite the character\n\t\t\t}\n\t\t\tfor (String s : miscBought) {\n\t\t\t\toutfile.println(s);\n\t\t\t}\n\t\t\toutfile.close();\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tSystem.out.println(ex);\n\t\t}\n\t}", "boolean dealWithFileOverwrite(String filename);", "public void writeKeyData(File f) throws IOException;", "public static void createPassword(Login newEmp) throws FileNotFoundException, IOException {\n\t\tString employeePassword = \"\";\n\t\tdo {\n\t\t\temployeePassword = JOptionPane.showInputDialog(\"Please enter a password.\");\n\t\t\tif (!newEmp.setUsername(employeePassword)) {\n\t\t\t\tJOptionPane.showMessageDialog(null, \"Wrong password, please try again\");\n\t\t\t}\n\t\t} while (!newEmp.setUsername(employeePassword + \", \"));\n\t\t/*\n\t\t Text file is stored in a source folder.\n\t\t */\n\t\tFileOutputStream fstream = new FileOutputStream(\"./src/Phase5/password.txt\", true);\n\t\tDataOutputStream outputFile = new DataOutputStream(fstream);\n\t\toutputFile.writeUTF(employeePassword + \", \");\n\t\toutputFile.close();\n\t}", "public boolean saveMapAs(File newFile)\n {\n this.file = newFile;\n \n return saveMap();\n }", "void addSecretKey(InputStream secretKey) throws IOException, PGPException;", "@Test\n public void setSecretsRequest_identicalSecrets() throws IOException {\n assertThat(this.secretRepository.count()).isEqualTo(2);\n\n final Resource request = new ClassPathResource(\"test-requests/storeSecrets.xml\");\n final Resource expectedResponse = new ClassPathResource(\"test-responses/storeSecrets.xml\");\n //Store secrets\n this.mockWebServiceClient.sendRequest(withPayload(request)).andExpect(ResponseMatchers.noFault()).andExpect(\n ResponseMatchers.payload(expectedResponse));\n //Store identical secrets again\n final String errorMessage = \"Secret is identical to current secret (\" + DEVICE_IDENTIFICATION + \", \"\n + \"E_METER_AUTHENTICATION_KEY)\";\n this.mockWebServiceClient.sendRequest(withPayload(request)).andExpect(\n ResponseMatchers.serverOrReceiverFault(errorMessage));\n }", "private void registerUser() throws FileNotFoundException, IOException\r\n\t{\r\n\t\tString username;\r\n\t\tString password;\r\n\t\tString fname;\r\n\t\tString lname;\r\n\t\tint attempt = 0;\r\n\t\tScanner input = new Scanner(System.in);\r\n\t\tRandom random = new Random();\r\n\t\t\r\n\t\t//PrintWriter wrapped around a BufferedWriter that is wrapped around a FileWriter\r\n\t\t//used to write on a file\r\n\t\tPrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(\"UserAccount.txt\", true)));\t//true allows appending\r\n\t\t\r\n\t\t//gets user's first and last name\r\n\t\tSystem.out.println(\"Enter your first name: \");\r\n\t\tfname = input.nextLine();\r\n\t\tSystem.out.println(\"Enter your last name: \");\r\n\t\tlname = input.nextLine();\r\n\t\t\r\n\t\t//gets user's desired username\r\n\t\tSystem.out.println(\"Enter desired username: \");\r\n\t\tusername = input.nextLine();\r\n\t\tattempt++;\r\n\t\twhile (checkUserExists(username) != -1)\t\t//username already exists\r\n\t\t{\r\n\t\t\tSystem.out.println(\"\\nThat username already exists\");\r\n\t\t\tif (attempt == 2)\t\t//generate random username with 8 characters after 2 attempts\r\n\t\t\t{\r\n\t\t\t\tif (lname.length() < 6)\t\t\t\t//if last name has less than six characters\r\n\t\t\t\t\tusername = lname;\r\n\t\t\t\telse\t\t\t\t\t\t\t\t//else if last name has six characters or greater\r\n\t\t\t\t\tusername = lname.substring(0, 6);\r\n\t\t\t\tfor (int i = username.length(); i < 8; i++)\t\t\t//loop runs until username has 8 characters\r\n\t\t\t\t\tusername += random.nextInt(9) + 1;\t\t\t\t//concatenate random number between 0 - 9 to the username\r\n\t\t\t\tSystem.out.println(\"A randomly generated username has been chosen for you.\");\r\n\t\t\t\tSystem.out.println(\"Your username is \" + username);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"Enter desired username: \");\r\n\t\t\t\tusername = input.nextLine();\r\n\t\t\t\tattempt++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpw.println(username);\r\n\t\tuserAccounts[0][numOfUsers] = username;\r\n\t\tSystem.out.println(\"\");\r\n\t\t\r\n\t\t//get user's password\r\n\t\tSystem.out.println(\"Enter password (Must be 8 characters long): \");\r\n\t\tpassword = input.nextLine();\r\n\t\twhile (password.length() < 8)\t\t\t//continues to loop until pass is at least 8 characters long\r\n\t\t{\r\n\t\t\tSystem.out.println(\"\\nPassword must be at least eight characters long\");\r\n\t\t\tSystem.out.println(\"Enter password (Must be 8 characters long): \");\r\n\t\t\tpassword = input.nextLine();\r\n\t\t}\r\n\t\tpw.println(password);\r\n\t\tuserAccounts[1][numOfUsers] = password;\r\n\t\tnumOfUsers++;\r\n\t\tpw.close();\r\n\t}", "public static boolean check() throws FileNotFoundException, IOException{\n File user = new File(userTf.getText().toUpperCase()+\".txt\");\n \n if(user.exists()){\n \n BufferedReader br = new BufferedReader(new FileReader(user));\n String pass = br.readLine();\n br.close();\n pass = FileWriting.decryption(pass);\n if(pass.equals(passPf.getText())){\n \n return true; \n \n }\n \n \n }\n \n return false;\n }", "private void saveLicenseFile(long renewalDate, boolean pBogus)\n{\n\n FileOutputStream fileOutputStream = null;\n OutputStreamWriter outputStreamWriter = null;\n BufferedWriter out = null;\n\n try{\n\n fileOutputStream = new FileOutputStream(licenseFilename);\n outputStreamWriter = new OutputStreamWriter(fileOutputStream);\n out = new BufferedWriter(outputStreamWriter);\n\n //if the number is to purposely invalid, add junk to the encoded value\n int bogusModifier = 0;\n if (pBogus) {bogusModifier = 249872349;}\n\n //save the renewal date followed by the same value encoded\n\n out.write(\"\" + renewalDate); out.newLine();\n out.write(\"\" + encodeDecode(renewalDate + bogusModifier));\n out.newLine();\n\n }\n catch(IOException e){\n logSevere(e.getMessage() + \" - Error: 274\");\n }\n finally{\n\n try{if (out != null) {out.close();}}\n catch(IOException e){}\n try{if (outputStreamWriter != null) {outputStreamWriter.close();}}\n catch(IOException e){}\n try{if (fileOutputStream != null) {fileOutputStream.close();}}\n catch(IOException e){}\n }\n\n}", "public static void randomAccessWrite() {\n try {\n RandomAccessFile f = new RandomAccessFile(FILES_TEST_PATH, \"rw\");\n f.writeInt(10);\n f.writeChars(\"test line\");\n f.close();\n } catch(Exception e) {\n e.printStackTrace();\n }\n }", "public void save() throws FileNotFoundException, IOException\n {\n settings.store(new FileOutputStream(FILE), \"N3TPD Config File\");\n }", "public boolean deleteSecret() {\n\t\tbyte[] userMessage = \"delete\".getBytes();\n\t\treturn sendAndCheckResp(userMessage, \"secretdeleted\", \"writingfailure\");\n\t}", "public void atualiza_ficheiro_user(){//Atualiza o ficheiro users\n File f1 = new File(\"users.txt\");\n String pesq = \"\";\n if (f1.exists() && f1.isFile()){\n try{\n FileWriter fw = new FileWriter(f1);\n BufferedWriter bw = new BufferedWriter(fw);\n // 0 1 2 3 4 5 6 7\n // ':id:admin:nome:username:password:notificacoes:pesquisas'\n for(int i=0; i< lista_utilizadores.size();i++){\n int aux = 0;\n int aux_ativo = 0;\n if(lista_utilizadores.get(i).get_administrador()){\n aux = 1;\n }\n pesq = \"\";\n for(int j = 0; j < lista_utilizadores.get(i).get_pesquisas().size(); j++){\n\n pesq = pesq.concat(lista_utilizadores.get(i).get_pesquisas().get(j));\n pesq = pesq.concat(\"-\");\n }\n //System.out.println(\"pesq de = \" + i + \"| Pesquisa = \" + pesq);\n\n bw.append(\":\"+lista_utilizadores.get(i).get_id()+\":\"+aux+\":\"+lista_utilizadores.get(i).get_nome()+\":\"+lista_utilizadores.get(i).get_username()+\":\"+lista_utilizadores.get(i).get_password()+\":\"+lista_utilizadores.get(i).get_notificacoes()+\":\"+pesq+\":\");\n bw.newLine();\n }\n bw.close();\n\n fw.close();\n }\n catch (IOException ex) {\n System.out.println(\"Erro a escrever no ficheiro.\");\n }\n }\n else {\n System.out.println(\"Ficheiro nao existe.\");\n }\n }", "public void addKeySecretPair(String key, String secret) throws ClassicDatabaseException;", "private static void addUser(String filename, String username, String userkey) {\n\t\ttry {\n\t\t\t// Open the user file, create new one if not exists\n\t\t\tFileWriter fileWriterUser = new FileWriter(filename, true);\n\t\t\t// User BufferedWriter to add new line\n\t\t\tBufferedWriter bufferedWriterdUser = new BufferedWriter(fileWriterUser);\n\n\t\t\t// Concatenate user name and key with a space\n\t\t\tbufferedWriterdUser.write(username + \" \" + userkey);\n\t\t\t// One user one line\n\t\t\tbufferedWriterdUser.newLine();\n\n\t\t\t// Always close files.\n\t\t\tbufferedWriterdUser.close();\n\t\t}\n\t\tcatch(FileNotFoundException ex) {\n\t\t\tSystem.out.println(\"Unable to open file '\" + filename + \"'\");\n\t\t}\n\t\tcatch(IOException ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t}", "public static void writePasswdFile (Map<String, String> users, File dst) throws Exception{\n\t\tStringBuffer s = new StringBuffer(\"# Passwords for edu.ucar.dls.schemedit.security.login.FileLogin\");\n\t\tfor (String username : users.keySet() ) {\n\t\t\tString password = users.get(username);\n\t\t\tString passwdFileEntry = username + \":\" + Encrypter.encryptBaseSHA164(password);\n\t\t\ts.append(\"\\n\" + passwdFileEntry);\n\t\t}\n\t\tprtln(\"writing \" + users.size() + \" users to \" + dst);\n\t\t\n\t\tFiles.writeFile(s + \"\\n\", dst);\n\t\t// prtln (s.toString());\n\t}", "public void saveFile(String newFile) {\n try {\n FileWriter writer = new FileWriter(this.file, false);\n writer.write(newFile);\n writer.close();\n } catch (IOException e) {\n System.out.println(e.getMessage());\n }\n }", "public static boolean writePreferences(final Context context,\n\t\t\tfinal String key, final String value) {\n\t\tboolean result = false;\n\t\tfinal SharedPreferences sharedPreferences = PreferenceManager\n\t\t\t\t.getDefaultSharedPreferences(context);\n\t\tfinal Editor editor = sharedPreferences.edit();\n\t\tif (editor != null) {\n\t\t\teditor.putString(key, value);\n\t\t\teditor.commit();\n\t\t\tresult = true;\n\t\t}\n\n\t\treturn result;\n\t}", "public static void saveNewConfig() throws IOException {\n\t\tOutputStream os = new FileOutputStream(fileLocation);\n\t\tconfigurationFile.store(os, \"\");\n\t\tos.flush();\n\t\tos.close();\n\t\tupdateConfigFile();\n\t}", "public boolean setRememberMe()\n {\n try \n {\n File file = new File(System.getProperty(\"user.home\")+\"\\\\remember.ser\");\n FileOutputStream fout = new FileOutputStream(file);\n fout.write(1);\n fout.close();\n }\n catch (IOException ex) {ex.printStackTrace(); return false; }\n return true;\n }", "void writeFile(PasswordDatabase passwordDatabase) throws JsonConversionException;", "public boolean isSecret(final String inSecret) {\n return this.secret.equals(inSecret);\n }", "public static void writeUserFile(String fileToWriteTo, String info) throws IOException\n\t{\n\t\tFileWriter write = new FileWriter(fileToWriteTo, true);\n\t\twrite.write(info);\n\t\twrite.close();\n\t}", "void setNewFile(File file);", "public boolean createNewFile(File file) throws IOException {\n if (\"/probes/.ready\".equals(file.getPath())) {\n return true;\n }\n return file.createNewFile();\n }", "public void secretMode()\n {\n \tsecret = true;\n \ttry {\n\t\t\timg = ImageIO.read(new File(\"DatBoi.png\"));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n }", "private byte[] handleUpdate(byte[] message) {\n\t\tbyte[] newSecretBytes = Arrays.copyOfRange(message, \"update:\".getBytes().length, message.length);\n\n/*\n\t\tSystem.out.println(\"THIS IS A TEST:\");\n\t\tSystem.out.println(\"newSecretBytes:\");\n\t\tComMethods.charByChar(newSecretBytes, true);\n\t\tSystem.out.println(\"newSecretBytes, reversed:\");\n\t\tString toStr = DatatypeConverter.printBase64Binary(newSecretBytes);\n\t\tbyte[] fromStr = DatatypeConverter.parseBase64Binary(toStr);\n\t\tComMethods.charByChar(fromStr, true);\n*/\n\t\tString newSecret = DatatypeConverter.printBase64Binary(newSecretBytes);\n\t\tboolean success = replaceSecretWith(currentUser, newSecret);\n\t\t\n\t\tif (success) {\n\t\t\tComMethods.report(\"SecretServer has replaced \"+currentUser+\"'s secret with \"+newSecret+\".\", simMode);\n\t\t\treturn preparePayload(\"secretupdated\".getBytes());\n\t\t} else {\n\t\t\tComMethods.report(\"SecretServer has FAILED to replace \"+currentUser+\"'s secret with \"+newSecret+\".\", simMode);\n\t\t\treturn preparePayload(\"writingfailure\".getBytes());\n\t\t}\n\t}", "void saveKeys(String publicKeyFileLocation, String secretKeyFileLocation) throws IOException;", "private static void saveTemplateFile(File file, Template newTemp) {\n String string = newTemp.toString();\n\n //Save File\n try {\n FileOutputStream fos = new FileOutputStream(file);\n fos.write(string.getBytes());\n fos.flush();\n fos.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n //Read back file and check against original.\n try {\n FileInputStream fis = new FileInputStream(file);\n byte[] data = new byte[(int)file.length()];\n\n fis.read(data);\n String tmpIN = new String(data,\"UTF-8\");\n Log.d(\"Behave\",\"Read Back Template: \"+ tmpIN);\n Log.d(\"Behave\",\"Template Saved Correctly: \"+tmpIN.equals(string));\n } catch (FileNotFoundException | UnsupportedEncodingException e) {\n e.printStackTrace();\n } catch (IOException e) {\n // Separate catch block for IOException because other exceptions are encapsulated by it.\n Log.e(\"Behave\", \"IOException not otherwise caught\");\n e.printStackTrace();\n }\n }", "public boolean Save(String szFileName )\n throws NullPointerException, IllegalStateException, IOException\n {\n FileOutputStream fs = null;\n File f = null;\n boolean bRetcode = false;\n boolean bExist;\n\n if( m_Template == null || m_UserName == null || m_UserName.length() == 0 )\n throw new IllegalStateException();\n\n try\n {\n f = new File( szFileName );\n fs = new FileOutputStream( f );\n\n CharsetEncoder utf8Encoder = Charset.forName( \"UTF-8\" ).newEncoder();\n byte[] Data = null;\n\n // Save user name\n ByteBuffer bBuffer = utf8Encoder.encode( CharBuffer.wrap( m_UserName.toCharArray() ) );\n Data = new byte[ bBuffer.limit()];\n bBuffer.get( Data );\n fs.write( ((Data.length >>> 8) & 0xFF) );\n fs.write( (Data.length & 0xFF) );\n fs.write(Data);\n\n // Save user unique ID\n fs.write( m_Key );\n\n // Save user template\n fs.write( ((m_Template.length >>> 8) & 0xFF) );\n fs.write( (m_Template.length & 0xFF) );\n fs.write( m_Template );\n fs.close();\n \n // JOptionPane.showConfirmDialog(\"Cadastro feito!\");\n bRetcode = true;\n \n }\n finally\n {\n if( !bRetcode && f != null )\n f.delete();\n }\n\n return bRetcode;\n }", "public void makeSettingsFile() {\n settingsData = new File (wnwData,\"settings.dat\");\n try {\n if (!settingsData.exists()) {\n settingsData.createNewFile();\n BufferedWriter bufferedWriter = new BufferedWriter(\n new FileWriter(settingsData));\n bufferedWriter.write(\"1 0\");\n bufferedWriter.close();\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n settingsData.setWritable(true);\n }", "public void testKeyGeneratedFromUserPassword() {\n final String prefFileName = generatePrefFileNameForTest();\n\n SecurePreferences securePrefs = new SecurePreferences(getContext(), \"password\", prefFileName);\n SharedPreferences normalPrefs = getContext().getSharedPreferences(prefFileName, Context.MODE_PRIVATE);\n\n Map<String, ?> allTheSecurePrefs = securePrefs.getAll();\n Map<String, ?> allThePrefs = normalPrefs.getAll();\n\n assertTrue(\n \"the preference file should not contain any enteries as the key is generated via user password.\",\n allThePrefs.isEmpty());\n\n\n //clean up here as pref file created for each test\n deletePrefFile(prefFileName);\n }", "public void createFile() throws IOException {\n String newName = input.getText();\n File user = new File(\"SaveData\\\\UserData\\\\\" + newName + \".txt\");\n\n if (user.exists() && !user.isDirectory()) {\n input.setStyle(\"-fx-border-color: red\");\n }\n if (user.exists() && !user.isDirectory() || newName.isEmpty()) {\n input.setStyle(\"-fx-border-color: red\");\n ERROR_AUDIO.play(Double.parseDouble(getInitData().get(\"SFXVol\")));\n\n }\n else {\n input.setStyle(\"-fx-border-color: default\");\n playerList.getItems().addAll(newName);\n PrintWriter newUser = new PrintWriter(new FileWriter(\"SaveData\\\\UserData\\\\\" + newName + \".txt\"));\n newUser.write(\"0 0 0 0 icon0 car\");\n newUser.close();\n MAIN_MENU_AUDIO.play(Double.parseDouble(getInitData().get(\"SFXVol\")));\n }\n }", "public boolean writeDataFile();", "public static boolean writeToFile()\n\t{\n\t\ttry (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(SAVE_LOCATION)))\n\t\t{\n\t\t\t// Write lines from the header\n\t\t\t// Writes information about the mod\n\t\t\tfor (String line : HEADER)\n\t\t\t{\n\t\t\t\tbufferedWriter.write(line);\n\t\t\t\tbufferedWriter.newLine();\n\t\t\t}\n\t\t\t\n\t\t\t// Writes lines for each of the properties\n\t\t\t// Formats the key and value of the properties separated by a \":\"\n\t\t\tfor (Entry entry: CustomCrosshairMod.INSTANCE.getCrosshair().properties.getList())\n\t\t\t{\n\t\t\t\tbufferedWriter.write(String.format(\"%s:%s\", entry.getKey(), entry.getValue()));\n\t\t\t\tbufferedWriter.newLine();\n\t\t\t}\n\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "private final synchronized void writePreferencesImpl() {\n if ( LOGD ) { Log.d( TAG, \"writePreferencesImpl \" + mPrefFile + \" \" + mPrefKey ); }\n\n mForcePreferenceWrite = false;\n\n SharedPreferences pref =\n Utilities.getContext().getSharedPreferences( mPrefFile, Context.MODE_PRIVATE );\n SharedPreferences.Editor edit = pref.edit();\n edit.putString( mPrefKey, getSerializedString() );\n Utilities.commitNoCrash(edit);\n }", "public void save(File configFile) {\n configFile.getParentFile().mkdirs();\n\n try {\n this.getProperties().store(new FileWriter(configFile), \"Redis Credentials\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public boolean isSecret() {\r\n \treturn false;\r\n }", "protected boolean registerInfo(String username, String secretcode) {\n\t\tboolean isSuccess = true;\n\t\tString sql = \"update Google_Auth set secretcode = ?, username = ? where rowid = 1\";\n\t\tresettable();\n\t\ttry {\n\t\t\tSystem.out.println(sql);\n\t\t\tstmt = conn.prepareStatement(sql);\n\t\t\tstmt.setString(1, aria.Encrypt(secretcode));\n\t\t\tstmt.setString(2, username);\n\t\t\tstmt.executeUpdate();\n\t\t}catch(SQLException e) {\n\t\t\tSystem.err.println(\"Error : Can't update otp info\\n\");\n\t\t\tSystem.out.println(e.getMessage());\n\t\t\tisSuccess = false;\n\t\t}\n\t\treturn isSuccess;\n }", "public static void writeTo(String filename, List<User> users){\r\n\t\tPrintWriter pw=null;\r\n\t\ttry{\r\n\t\t\tpw=new PrintWriter(new FileOutputStream(new File(filename),false));//false because don't append,\r\n\t\t\tfor(User user : users){//it replaces all with new updated data\r\n\t\t\t\tpw.write(user+\"\\n\");\r\n\t\t\t}\t\t\t\r\n\t\t}catch(IOException e){\r\n\t\t\te.printStackTrace();\r\n\t\t}finally{\r\n\t\t\tpw.close();\r\n\t\t}\r\n\t}", "private void createAccount(User user) throws IOException {\n File accounts = new File(\"accounts.txt\");\n if (!accounts.exists()) {\n accounts.createNewFile();\n }\n\n FileOutputStream fileOutputStream = new FileOutputStream(accounts, true);\n BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream));\n\n bufferedWriter.write(user.getUserName() + \":\" + user.getUserPass());\n bufferedWriter.newLine();\n bufferedWriter.flush();\n }", "private static void persistSettings() {\n\t\ttry {\n\t\t\tBufferedWriter userConf = new BufferedWriter(new FileWriter(\n\t\t\t\t\tconf.getAbsolutePath()));\n\t\t\tproperties.store(userConf, null);\n\t\t\t// flush and close streams\n\t\t\tuserConf.flush();\n\t\t\tuserConf.close();\n\t\t} catch (IOException e) {\n\t\t\tlog.severe(\"Couldn't save config file.\");\n\t\t}\n\t}", "@Test\n\tpublic void testGenerateCodeAndOverwriteFormattedButUnchangedFile() throws IOException {\n\t\tFile tmpFile = File.createTempFile(\"junit\", \".tmp\");\n\t\ttmpFile.deleteOnExit();\n\n\t\tFile tmpDir = new File(tmpFile.getParentFile(), UUID.randomUUID().toString());\n\t\ttry {\n\t\t\tString filename = \"sample.xml\";\n\t\t\tFile realDir = new File(tmpDir, \"real\");\n\t\t\tFile targetDir = new File(tmpDir, \"target\");\n\t\t\tFile realFile = new File(realDir, filename);\n\n\t\t\t// generate sample1\n\t\t\tcodeGenerator.generateCode(CodeOverwritePolicy.OVERWRITE_IF_UNCHANGED, new HashMap<String, Object>(),\n\t\t\t\t\trealDir, targetDir, \"sample1.vm\", filename);\n\n\t\t\t// assert that sample1 was written\n\t\t\tAssert.assertTrue(FileUtils.readFileToString(realFile).contains(\"This is sample1\"),\n\t\t\t\t\t\"Sample 1 was not written successfully, expected text not found in the written file\");\n\n\t\t\tlong creationTime = realFile.lastModified();\n\n\t\t\tcodeGenerator.generateCode(CodeOverwritePolicy.OVERWRITE_IF_UNCHANGED, new HashMap<String, Object>(),\n\t\t\t\t\trealDir, targetDir, \"sample1-formatted.vm\", filename);\n\n\t\t\tlong lastModified = realFile.lastModified();\n\n\t\t\t// assert that sample1 was not written\n\t\t\tAssert.assertTrue(lastModified == creationTime,\n\t\t\t\t\t\"File should not have been changed because only formatting changed\");\n\t\t} finally {\n\t\t\tFileUtils.deleteDirectory(tmpDir);\n\t\t}\n\t}", "public static void createNewUserPreference(Context context) {\r\n\t\tString newUserId = generateNewUserId();\r\n\t\tString userConfigKey = getUserConfigFileNameKey(newUserId);\r\n\t\tString userDbKey = getUserDatabaseFileNameKey(newUserId);\r\n\t\tString userConfigFileName = getUserConfigFileName(context, newUserId);\r\n\t\tString userDbFileName = getUserDatabaseFileName(context, newUserId);\r\n\r\n\t\tSharedPreferences prefs = PreferenceManager\r\n\t\t\t\t.getDefaultSharedPreferences(context);\r\n\t\tif (prefs != null) {\r\n\t\t\tEditor editor = prefs.edit();\r\n\t\t\tif (editor != null) {\r\n\t\t\t\teditor.putString(\"user-\" + newUserId, newUserId);\r\n\t\t\t\teditor.putString(userConfigKey, userConfigFileName);\r\n\t\t\t\teditor.putString(userDbKey, userDbFileName);\r\n\t\t\t}\r\n\r\n\t\t\teditor.commit();\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic void changePassword() throws NoSuchAlgorithmException\r\n\t{\r\n\t\tSystem.out.print(\"Enter user ID you wish to change: \");\r\n\t\tString idInput = scan.next();\r\n\t\tboolean isUnique = isUniqueID(idInput);\r\n\t\tif (isUnique == false)\r\n\t\t{\r\n\t\t\tSystem.out.print(\"Enter password for \" + idInput + \": \");\r\n\t\t\tString oldPassInput = scan.next();\r\n\t\t\tString oldHash = hashFunction(oldPassInput + database.get(idInput));\r\n\t\t\tboolean isValidated = validatePassword(oldHash);\r\n\t\t\tif (isValidated == true)\r\n\t\t\t{\r\n\t\t\t\thm.remove(oldHash);\r\n\t\t\t\tSystem.out.print(\"Enter new password for \" + idInput + \": \");\r\n\t\t\t\tmakePassword(idInput, scan.next());\r\n\t\t\t\tSystem.out.println(\"The password for \" + idInput + \" was successfully changed.\");\r\n\t\t\t}\r\n\t\t\telse if (isValidated == false)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"The ID or password you entered does not exist in the database.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (isUnique == true)\r\n\t\t{\r\n\t\t\tSystem.out.print(\"Enter password for \" + idInput + \": \");\r\n\t\t\tscan.next();\r\n\t\t\tSystem.out.println(\"Authentication fail\");\r\n\t\t\tSystem.out.println(\"The ID or password you entered does not exist in the database.\");\r\n\t\t}\r\n\t}", "void addNewAccountToFile(Account newAccount);", "public void writeToFile(File file) {\n\n\t}", "public void writeFile(Context context){\n Writer writer = null;\n\n try {\n OutputStream out = context.openFileOutput(filename, Context.MODE_PRIVATE);\n writer = new OutputStreamWriter(out);\n writer.write(userName + \"~\" + color + \"~\" + level);\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n\n } catch (IOException e) {\n e.printStackTrace();\n\n } finally {\n if (writer != null) {\n try {\n writer.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n }", "public void createSecret(final ArtifactVersion version, final Secret secret);", "private void writeToDictionary() throws IOException {\n\n File file = new File(filePathDictionaryAuto);\n\n if (file.delete()) {\n file.createNewFile();\n Enumeration e = dictionaryTerms.keys();\n while (e.hasMoreElements()) {\n String word = (String) e.nextElement();\n if (word.length() != 1) {\n writePrintStream(dictionaryTerms.get(word) + \" \" + word, filePathDictionaryAuto);\n }\n }\n } else {\n System.out.println(\"Error in dictionary file\");\n }\n System.out.println(\"Dictionary updated\");\n\n }", "private void updateDatabaseFile() {\n Log.i(\"updateDatabaseFile\", \"Updating server app database\");\n try {\n FileInputStream inputStream = new FileInputStream(databaseFile);\n DropboxAPI.Entry response = MainActivity.mDBApi.putFileOverwrite(databaseFile.getName(), inputStream,\n databaseFile.length(), null);\n Log.i(\"updateDatabaseFile\", \"The uploaded file's rev is: \" + response.rev);\n } catch (Exception e) {\n Log.e(\"updateDatabaseFile\", e.toString(), e);\n }\n }", "public void save(String dataname, String username) throws IOException {\n List<String> outlines = newpairs.stream().map(p -> p.getFirst() + \"\\t\" + p.getSecond()).collect(toList());\n LineIO.write(getUserDictPath(dataname, username), outlines);\n }", "private void writeToFile() {\n try {\n FileOutputStream fos = new FileOutputStream(f);\n String toWrite = myJSON.toString(4);\n byte[] b = toWrite.getBytes();\n fos.write(b);\n fos.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static boolean writeFile(byte[] values, File fileName) {\n mkdirHwSecurity();\n try {\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n FileOutputStream fileOutputStream = new FileOutputStream(fileName);\n byteArrayOutputStream.write(values);\n byteArrayOutputStream.writeTo(fileOutputStream);\n fileOutputStream.flush();\n fileOutputStream.close();\n byteArrayOutputStream.close();\n return true;\n } catch (IOException e) {\n Log.e(TAG, \"write file exception! \" + fileName.getName() + e.getMessage());\n return false;\n }\n }", "private boolean UpdateToken()\n\t{\n\t\ttry\n\t\t{\n\t\t\tToken tempToken = scanner.GetNextToken();\n\t\t\tif(tempToken.GetTokenType() == TokenType.ERROR)\n\t\t\t{\n\t\t\t\tcurrentToken = tempToken;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(tempToken.GetTokenType() == TokenType.META)\n\t\t\t{\n\t\t\t\tnewFile.write(tempToken.GetTokenName() + \"\\n\");\n\t\t\t\treturn UpdateToken();\n\t\t\t}\n\t\t\tcurrentToken = tempToken;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\t\n\t\t}\n\t\treturn true;\n\t}", "void saveNewPassword(String userName, String hashedPassword) throws DatabaseException;", "@Override\n\tpublic File update(File file) {\n\t\treturn (File) this.getSession().merge(file);\n\t}", "public void writeIDfile(String ID,String password)throws IOException\n {\n\n\n List<String> lines = Files.readAllLines(Paths.get(\"idpassword.txt\"));\n /*write part*/\n\n BufferedWriter bw = null;\n FileWriter fw = null;\n try {\n int j=0;\n String content = \"\";\n while (j<lines.size())\n {\n content+= lines.get(j)+\"\\n\";\n j++;\n }\n content+=ID+\",\"+password;\n\n fw = new FileWriter(\"idpassword.txt\");\n bw = new BufferedWriter(fw);\n bw.write(content);\n\n bw.close();\n fw.close();\n\n } catch (IOException e) {\n\n e.printStackTrace();\n\n } finally {\n\n try {\n\n if (bw != null)\n bw.close();\n\n if (fw != null)\n fw.close();\n\n } catch (IOException ex) {\n\n ex.printStackTrace();\n\n }\n\n }\n }", "private boolean doCheckNewPassword() {\n\t\tif (!newPassword.equals(confirmPassword)) return false;\n\t\trecord(\"new password checked\");\n\t\treturn true;\n\t}", "public void saveFile(boolean answer) {\n if (answer) {\n userController.saveUserToFile();\n }\n }", "private void savingToConfigurationsFile(FileOutputStream configurationFileOutputStream, byte[] iv,\n\t\t\tbyte[] encryptedSymmetricKey, byte[] mySignature) throws IOException {\n\n\t\tconfigurationFileOutputStream = new FileOutputStream(localWorkingDirectoryPath + \"\\\\Config.txt\");\n\n\t\t// Saving the IV to the configuration file\n\t\tconfigurationFileOutputStream.write(iv);\n\n\t\t// Saving the encrypted symmetric key to the configuration file\n\t\tconfigurationFileOutputStream.write(encryptedSymmetricKey);\n\n\t\t// Saving the my signature to the configuration file\n\t\tconfigurationFileOutputStream.write(mySignature);\n\n\t\t// Closing the output stream\n\t\tconfigurationFileOutputStream.close();\n\n\t}", "void addSecretKey(PGPSecretKeyRing secretKey) throws IOException, PGPException;", "public abstract boolean writeDataToFile(String fileName, boolean overwrite);", "public boolean writeAttributeFile();", "private void updateCoins() {\r\n\t\tFile file = new File(\".coinSave\");\r\n\r\n\t\tPrintWriter pw;\r\n\t\ttry {\r\n\t\t\tpw = new PrintWriter(file);\r\n\t\t\tpw.close();\r\n\r\n\t\t\tFileWriter fw = new FileWriter(file);\r\n\t\t\tBufferedWriter bw = new BufferedWriter(fw);\r\n\r\n\t\t\tbw.write(_hiddenCoins + \"\\n\");\r\n\t\t\tbw.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "DBOOtpSecret activateSecret(Long userId, Long secretId);", "public void encryptChkFile(User user, String inputFile)\n\t\t\tthrows NoSuchAlgorithmException, NoSuchPaddingException,\n\t\t\tInvalidKeyException, InvalidAlgorithmParameterException,\n\t\t\tIOException, NoSuchProviderException {// same as above but for singular file, for creating\n\t\t\t\t\t\t\t// consistant files to check against\n\t\tFile ivread = new File(user.name + \"_iv\");\n\t\tboolean exists = ivread.exists();\n\t\tCipher cipher = generateCipher();\n\t\tif (exists) {\n\t\t\tFileInputStream in = new FileInputStream(ivread);\n\t\t\tbyte[] iv = new byte[(int) ivread.length()];\n\t\t\tin.read(iv);\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, user.passwordKey,\n\t\t\t\t\tnew IvParameterSpec(iv));\n\t\t\tin.close();\n\t\t} else {\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, user.passwordKey);\n\t\t\tbyte[] iv = cipher.getIV();\n\t\t\tFileOutputStream ivout = new FileOutputStream(user.configDirectory + \"\\\\\" + user.name + \"_iv\");\n\t\t\tivout.write(iv);\n\t\t\tivout.close();\n\t\t}\n\t\tfinal Charset ENCODING = StandardCharsets.UTF_8;\n\t\tFile usersFile = user.referenceFile;// possibly gets sent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// to the wrong\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// directory, write\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// test to check\n\t\tBufferedWriter ow = Files.newBufferedWriter(usersFile.toPath(),//output stream is all wrong should be using cpher output stream/\n\t\t\t\tENCODING);\n\t\tow.write(inputFile);\n\t\tow.close();\n\t\t\n\t\tint i = cipher.getBlockSize();\n\t\tBufferedInputStream is = new BufferedInputStream(new FileInputStream(user.referenceFile));\n\t\tCipherOutputStream os = new CipherOutputStream(new FileOutputStream(user.referenceFile+\".out\"), cipher);\n\t\tcopy(is, os);\n\t\tis.close();\n\t\tos.close();\n\n\t\t// TODO insert code to create then encrypt a simple phrase e.g. 1234567\n\t}", "private void updateFile() {\n try {\n this.taskStorage.save(this.taskList);\n this.aliasStorage.save(this.parser);\n } catch (IOException e) {\n System.out.println(\"Master i am unable to save the file!\");\n }\n }", "private void storeKeys(String key, String secret) {\n\t\t// Save the access key for later\n\t\tSharedPreferences prefs = EReaderApplication.getAppContext()\n\t\t\t\t.getSharedPreferences(ACCOUNT_PREFS_NAME, 0);\n\t\tEditor edit = prefs.edit();\n\t\tedit.putString(ACCESS_KEY_NAME, key);\n\t\tedit.putString(ACCESS_SECRET_NAME, secret);\n\t\tedit.commit();\n\t}", "public void testAppendBytesSuccess() throws Exception {\r\n assertNotNull(\"setup fails\", filePersistence);\r\n String writeString = \"Hello World\";\r\n String fileCreationId = filePersistence.createFile(VALID_FILELOCATION, FILENAME);\r\n filePersistence.appendBytes(fileCreationId, writeString.getBytes());\r\n filePersistence.closeFile(fileCreationId);\r\n File file = new File(VALID_FILELOCATION, FILENAME);\r\n assertTrue(\"the file should exist\", file.exists());\r\n assertEquals(\"the current file size not correct\", file.length(), writeString.getBytes().length);\r\n filePersistence.deleteFile(VALID_FILELOCATION, FILENAME);\r\n }", "public static void createAccount()throws IOException{\n\t\ttry{\n\t\t\tFile accountInfo = new File(\"account.txt\");\n\t\t\tFile Information = new File(\"information.txt\");\n\t\t\tArrayList<String> temp = new ArrayList<String>();\n\t\t\tArrayList<String> info = new ArrayList<String>();\n\t\t\tScanner inputFromInformation = new Scanner(Information);\n\t\t\tScanner inputFromAccount = new Scanner(accountInfo);\n\t\t\twhile (inputFromAccount.hasNextLine()){\n\t\t\t\ttemp.add(inputFromAccount.nextLine());\n\t\t\t}\n\t\t\tScanner input = new Scanner(System.in);\n\t\t\t// This is where we will start the new account process\n\t\t\t// first by telling us who you are.\n\t\t\tSystem.out.println(\"Enter your First Name\");\n\t\t\tString firstName = input.next();\n\t\t\t\n\t\t\tSystem.out.println(\"Enter your Last Name\");\n\t\t\tString lastName = input.next();\n\t\t\t// This will give the user recommended\n\t\t\t// user names if they cannot think of one.\n\t\t\tRecommendedUserNames(firstName,lastName);\n\t\t\t// here they will be prompt to enter their preferred user name\n\t\t\tSystem.out.println(\"Enter your preferred username\");\n\t\t\tString UserName = input.next();\n\t\t\t// This will prompt the user for a password\n\t\t\t// The password will have to meet these requirements\n\t\t\tSystem.out.println(\"Your password should meet the following requirements:\");\n\t\t\tSystem.out.println(\"-It must have at least eight characters.\\n-It must consist of only letters and digits.\"\n\t\t\t\t\t\t\t+ \"\\n-It must contain more than two digits and two characters.\");\n\t\t\tSystem.out.println(\"\\nEnter your new Password\");\n\t\t\tString Password = input.next();\n\t\t\t\n\t\t\t// this is what will verify the user password and see if it meets the recommended requirements\n\t\t\t// for security reasons of course.\n\t\t\tString Pass;\n\n\t\t\tboolean check=false;\n\t\t\tif(validigits(Password)&&letter_digit_check(Password))check=true;\n\t\t\twhile(!check){\n\t\t\t\tSystem.out.println(\"Please recheck the password requirement and try again.\");\n\t\t\t\tPassword = input.next();\n\t\t\t\tif(validigits(Password)&&letter_digit_check(Password))check=true;\n\t\t\t}\n\t\t\tdo{\n\t\t\t\tSystem.out.println(\"\\nPlease re-enter the Password\");\n\t\t\t\tPass = input.next();\n\t\t\t\tif(!Pass.equals(Password))System.out.println(\"Passwords do not match!\");\n\t\t\t}while(!Pass.equals(Password));\n\t\t\tboolean CreateAccount = true;\n\t\t\tSystem.out.println(\"You need to fill the information for completion of your account registration\");\n\t\t\teditInfo(UserName,CreateAccount);\n\t\t\tPrintWriter output = new PrintWriter(accountInfo);\n\t\t\ttemp.add(UserName+\" \"+Password);\n\t\t\tfor (int i=0; i<temp.size(); i++){\n\t\t\t\toutput.println(temp.get(i));\n\t\t\t}\n\t\t\toutput.close();\n\t\t\tSystem.out.println(\"Your account has been created and your information has been saved\"\n\t\t\t\t\t+ \"\\nYou have been logged out for this session\\n\");\n\t\t\tstarter();\n\t\t}\n\t\tcatch (java.io.IOException ex){\n\t\t\tSystem.out.println(\"I/O Errors: File is not found\");\n\t\t}\t\n\t}", "boolean isUsedForWriting();", "public boolean updateLock(int n){\n\t\tFile file = new File(baseDir, constructFilename(n));\n\t\tif (!file.exists()) {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\tDataOutputStream daos = new DataOutputStream(new FileOutputStream(file));\n\t\t\tdaos.writeUTF(new TimeTool().toString(TimeTool.FULL_ISO));\n\t\t\tdaos.close();\n\t\t\treturn true;\n\t\t} catch (Exception ex) {\n\t\t\tExHandler.handle(ex);\n\t\t\treturn false;\n\t\t}\n\t}", "private static void checkPrefernceValue(File file) throws BackingStoreException {\n\t\tif(!file.exists()){\n\t\t\tSystem.out.println(\"In file\");\n\t\t\tTransactions.prefs.remove(Transactions.ID);\n\t\t\tTransactions.prefs.clear();\n\t\t}\n\t}", "public void save() {\n // Convert the settings to a string\n String output = readSettings();\n \n try {\n // Make sure the file exists\n if (!settingsFile.exists()) {\n File parent = settingsFile.getParentFile();\n parent.mkdirs();\n settingsFile.createNewFile(); \n }\n \n // Write the data into the file\n BufferedWriter writer = new BufferedWriter(new FileWriter(settingsFile));\n writer.write(output);\n writer.close(); \n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static void writeBoolean(Context context, String fileName, String key, boolean value) {\n if (context == null)\n return;\n SharedPreferences sharedPreferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE);\n Editor editor = sharedPreferences.edit();\n editor.putBoolean(key, value);\n editor.apply();\n }", "public void save(String newFilePath) {\r\n File deletedFile = new File(path);\r\n deletedFile.delete();\r\n path = newFilePath;\r\n File dataFile = new File(path);\r\n File tempFile = new File(path.substring(0, path.lastIndexOf(\"/\")) + \"/myTempFile.txt\");\r\n\r\n try {\r\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(\r\n new FileOutputStream(tempFile), \"UTF-8\"));\r\n\r\n for (String line : data) {\r\n bw.write(line);\r\n bw.newLine();\r\n }\r\n\r\n bw.close();\r\n dataFile.delete();\r\n tempFile.renameTo(dataFile);\r\n } catch (IOException ex) {\r\n System.out.println(\"IOException in save2 : FileData\");\r\n }\r\n }", "@Override\n public boolean setLoggedUser(User user) \n {\n try\n {\n File file = new File(System.getProperty(\"user.home\")+\"\\\\user.ser\");\n \n File file_remember_me = new File(System.getProperty(\"user.home\")+\"\\\\remember.ser\");\n if(!file_remember_me.exists()) file.deleteOnExit();\n \n FileOutputStream fout = new FileOutputStream(file);\n ObjectOutputStream oos = new ObjectOutputStream(fout); \n oos.writeObject(user);\n oos.close();\n\t}\n catch(Exception ex){ ex.printStackTrace();return false;}\n \n return true;\n }", "public void setZrtpSecretsFile(String file);", "public boolean save(File file) {\n\t\tboolean result;\n\t\tsynchronized (this) {\n\t\t\tresult = saveInternal(file, false);\n\t\t\t// TODO: Set only, when ok?\n\t\t\tif (result) {\n\t\t\t\tsetFileTime();\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "boolean isSecretValid();", "private void allowWalletFileAccess() {\n if (Constants.TEST) {\n Io.chmod(walletFile, 0777);\n }\n\n }", "public void save() {\n try {\n FileOutputStream fos = new FileOutputStream(file);\n properties.store(fos, \"Preferences\");\n } catch (FileNotFoundException e) {\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public static void writeToPassFile(String filepath) throws IOException {\r\n\r\n CSVWriter writer = new CSVWriter(new FileWriter(filepath), CSVWriter.DEFAULT_SEPARATOR,\r\n CSVWriter.NO_QUOTE_CHARACTER);\r\n for (Entry<String, String> entry : passMap.entrySet()) {\r\n // take password(key) and email(value) together as a string array.\r\n String [] record = (entry.getKey() + \",\" + entry.getValue()).split(\",\");\r\n writer.writeNext(record);\r\n }\r\n writer.close();\r\n\r\n\r\n }" ]
[ "0.62896043", "0.6116801", "0.59739006", "0.5660835", "0.56108266", "0.5585368", "0.53901476", "0.5378266", "0.5273952", "0.52615196", "0.5202774", "0.5192693", "0.5189641", "0.51043284", "0.5092826", "0.50829846", "0.5065624", "0.50420254", "0.50307983", "0.50177747", "0.49866298", "0.4968686", "0.4960733", "0.49504313", "0.49434802", "0.4913901", "0.4828887", "0.48209152", "0.48175997", "0.4814599", "0.481224", "0.48096508", "0.47855726", "0.47833186", "0.4783087", "0.47703955", "0.4769101", "0.4767094", "0.4756565", "0.4755419", "0.47364673", "0.47351748", "0.47293445", "0.47232765", "0.4723017", "0.4686478", "0.4675841", "0.4670733", "0.46573296", "0.4649672", "0.46467903", "0.46453744", "0.46399388", "0.46260208", "0.461931", "0.46143836", "0.46083796", "0.4595303", "0.4593987", "0.45915318", "0.45875823", "0.4586188", "0.45833236", "0.45806432", "0.45776898", "0.4575349", "0.45674205", "0.455845", "0.45563313", "0.4549605", "0.45431474", "0.4541927", "0.4541141", "0.45396307", "0.4538318", "0.4534155", "0.45294845", "0.45290107", "0.45235172", "0.4522682", "0.4521569", "0.45153478", "0.45093942", "0.4503153", "0.450047", "0.44961107", "0.44898525", "0.4487407", "0.44872245", "0.44852436", "0.4484512", "0.4482723", "0.44826403", "0.447294", "0.44709876", "0.44679913", "0.44660044", "0.4465089", "0.44644445", "0.4450585" ]
0.82464045
0
Takes "regular" payload and spits out enclosed message
private byte[] processPayload(byte[] message) { return ComMethods.processPayload(currentUser.getBytes(), message, counter-1, currentSessionKey, simMode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Payload getMsg();", "@Override\n\tpublic void onMessage(Message message) {\n\t\tSystem.out.println(message.getBody());\n\t}", "ByteBuf getMessageBody();", "String getRawMessage();", "public Payload.Inbound getInboundPayload();", "com.google.protobuf.ByteString getPayload();", "com.google.protobuf.ByteString getPayload();", "public Payload.Outbound getOutboundPayload();", "@AutoEscape\n\tpublic String getPayload();", "@Override\n public void payload(byte[] data) {\n \tmLastMessage.append(new String(data));\n Log.d(TAG, \"Payload received: \" + data);\n }", "public String getPayload() {\n return payload;\n }", "public String getPayload() {\n return payload;\n }", "public String getPayload() {\n return this.payload;\n }", "@Override\n\tpublic void handleDelivery(String arg0, Envelope arg1,\n\t\t\tBasicProperties arg2, byte[] arg3) throws IOException {\n\t\t Object msg;\n\t try {\n\t System.out.println(\"【body length:】\" + bytes2kb(arg3.length));\n\t msg = decodeMsg(arg3);\n\t //subImpl.handlerReceiveMsg(this, msg);\n\t System.out.println(msg);\n\t } catch (Exception e) {\n\t e.printStackTrace();\n\t }\n\t}", "public String getPayload() {\n return payload;\n }", "byte[] getStructuredData(String messageData);", "public java.lang.CharSequence getPayload() {\n return payload;\n }", "public byte[] getPayload();", "public Object getPayload() {\n return payload;\n }", "public Message processReadToMessage(Attachment attach){\n Message msg = Message.byteBufferToMsg(attach.buffer);\n System.out.format(\"Client at %s says: %s%n\", attach.clientAddr,\n msg.toString());\n return msg;\n }", "java.lang.String getBody();", "protected Object extractMessage(Message message) {\n\t\tif (serializer != null) {\n\t\t\treturn serializer.deserialize(message.getBody());\n\t\t}\n\t\treturn message.getBody();\n\t}", "@Override\n public void handleMessage(Message msg) {\n System.out.println(\"recibe mensajes ...\");\n System.out.println(msg.obj);\n }", "Object getMessage();", "@Override\n\tpublic Message getPayload() {\n\t\treturn null;\n\t}", "public String parsePayloadToJSON(ContrailMessage message) throws XMLStreamException, JsonProcessingException {\r\n\t\tLOGGER.info(\"Parsing payload\");\r\n\t\tif (CANDE_PAYLOAD_TYPE.equals(message.getPayloadType())) {\r\n\t\t\t// name of the file\r\n\t\t\tXMLString fileName = new XMLString();\r\n\t\t\t// Object URL in contentdelivery bucket\r\n\t\t\tXMLString s3Uri = new XMLString();\r\n\t\t\t// productId=LIVE to identify live feed or migration\r\n\t\t\tXMLString productId = new XMLString();\r\n\r\n\t\t\tnew XMLParser().getInnerTextFor(\"/ContentDeliveryData/fileTickets/fileTicket/fileName\", fileName::set)\r\n\t\t\t\t\t.getInnerTextFor(\"/ContentDeliveryData/fileTickets/fileTicket/s3Uri\", s3Uri::set)\r\n\t\t\t\t\t.getInnerTextFor(\"/ContentDeliveryData/fileTickets/fileTicket/directory\", productId::set)\r\n\t\t\t\t\t.parse((String) message.getPayloadData());\r\n\r\n\t\t\tthis.payloadMap.put(\"fileName\", fileName.get());\r\n\t\t\tthis.payloadMap.put(\"s3Uri\", s3Uri.get());\r\n\t\t\tthis.payloadMap.put(\"productId\", productId.get());\r\n\r\n\t\t\tString transformedPayload = new ObjectMapper().writeValueAsString(this.payloadMap);\r\n\t\t\tLOGGER.info(\"Parsed payload: \" + transformedPayload);\r\n\t\t\t// converts the map to json string\r\n\t\t\treturn transformedPayload;\r\n\r\n\t\t}\r\n\r\n\t\telse {\r\n\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\"Unidentified Message Payload: \" + Strings.nullToEmpty(message.getPayloadType()));\r\n\t\t}\r\n\r\n\t}", "private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) {\n String chStr = getChStr(ctx);\n String msgStr = String.valueOf(msg);\n StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());\n return buf.append(chStr).append(' ').append(eventName).append(\": \").append(msgStr).toString();\n }", "public java.lang.CharSequence getPayload() {\n return payload;\n }", "private void printEncodedMessage() {\n System.out.print(\"\\nPrinting the encoded message\");\n System.out.print(\"\\n\" + encodedMessage + \"\\n\");\n System.out.println();\n }", "@Override\n protected Message receiveMessage() throws IOException {\n String encoded = this.din.readUTF();\n this.lastMessage = new Date();\n String decodedXml = new String(\n DatatypeConverter.parseBase64Binary(encoded));\n\n return Message.msgFromXML(decodedXml);\n }", "@Override\r\n\tpublic void receiveMessage(Stanza stanza, Object payload) {\n\t\t\r\n\t}", "private void DisplayMessage(Message msg) {\r\n String marker = \"---------------\";\r\n\r\n // Synchronous\r\n if (Options.ReceiveMode.Value().equals(Literals.Sync)) {\r\n if (messagesInTotal.equals(Literals.Infinite)) {\r\n System.out.println(\"\\n\" + marker + \" Message \" + messagesReceived\r\n + \" received synchronously \" + marker);\r\n }\r\n else {\r\n System.out.println(\"\\n\" + marker + \" Message \" + messagesReceived + \" of \"\r\n + messagesInTotal + \" received synchronously \" + marker);\r\n }\r\n }\r\n\r\n // Asynchronous\r\n else if (Options.ReceiveMode.Value().equals(Literals.Async)) {\r\n if (messagesInTotal.equals(Literals.Infinite)) {\r\n System.out.println(\"\\n\" + marker + \" Message \" + messagesReceived\r\n + \" received asynchronously \" + marker);\r\n }\r\n else {\r\n System.out.println(\"\\n\" + marker + \" Message \" + messagesReceived + \" of \"\r\n + messagesInTotal + \" received asynchronously \" + marker);\r\n }\r\n }\r\n\r\n System.out.println(msg.toString());\r\n\r\n try {\r\n // Get values for custom properties, if available\r\n String property1 = msg.getStringProperty(\"MyStringProperty\");\r\n\r\n // Get value for an int property, store the result in long to validate\r\n // the get operation.\r\n long property2 = ((long) Integer.MAX_VALUE) + 1;\r\n property2 = msg.getIntProperty(\"MyIntProperty\");\r\n\r\n if ((property1 != null) && (property2 < Integer.MAX_VALUE)) {\r\n System.out.println(\"[Message has my custom properties]\");\r\n }\r\n else {\r\n System.out.println(\"[Hmm... my custom properties aren't there!]\");\r\n }\r\n }\r\n catch (Exception e) {\r\n // It appears that the received message was not created by the SampleProducerJava application,\r\n // as the expected properties are not available. This is a valid scenario, so suppress this\r\n // exception.\r\n }\r\n return;\r\n }", "public String readMessage() {\r\n return new String(readMessageAsByte());\r\n }", "@Override\n public byte[] getMessage() {\n jsonData = textPane.getText();\n return buildData();\n }", "public Payload getPayload() {\n return this.payload;\n }", "protected void readPayload() throws IOException {\n _dataStream.skipBytes(PushCacheProtocol.COMMAND_LEN);\n int rlen = _dataStream.readInt();\n if (rlen == 0) {\n return;\n }\n if (rlen > PushCacheProtocol.MAX_PAYLOAD_LEN) {\n throw new IOException(\"Payload length \" + rlen + \" exceeds maximum length \" + PushCacheProtocol.MAX_PAYLOAD_LEN);\n }\n _textBuffer = new byte[rlen];\n int sofar = 0;\n int toread = rlen;\n sofar = 0;\n toread = rlen;\n int rv = -1;\n edu.hkust.clap.monitor.Monitor.loopBegin(142);\nwhile (toread > 0) { \nedu.hkust.clap.monitor.Monitor.loopInc(142);\n{\n rv = _stream.read(_textBuffer, sofar, toread);\n if (rv < 0) {\n throw new IOException(\"read returned \" + rv + \" after reading \" + sofar + \" bytes\");\n }\n sofar += rv;\n toread -= rv;\n }} \nedu.hkust.clap.monitor.Monitor.loopEnd(142);\n\n _dataStream = new DataInputStream(new ByteArrayInputStream(_textBuffer));\n }", "private void displayMsg(Object o) {\n Message msg = ((Datapacket)o).getMsg();\n client.printMessage(msg);\n }", "@Override\n\tpublic MessageResponse processMessage(MessageTemplate template) {\n\n\t\tMessageResponse response = new MessageResponse();\n\t\tSystem.out.println(\"Processing slack message!!!\");\n\n\t\treturn response;\n\t}", "String getBody();", "String getBody();", "String getBody();", "String getBody();", "public static void any() {\n\t\tlong date = System.currentTimeMillis();\n\t\tString body = IO.readContentAsString(request.body);\n\t\tif (body == null) {\n\t\t\terror(StatusCode.INTERNAL_ERROR,\n\t\t\t\t\t\"Message is malformed (null body)...\");\n\t\t}\n\n\t\tDocument soapMessage = XML.getDocument(body);\n\t\tif (soapMessage == null) {\n\t\t\terror(StatusCode.INTERNAL_ERROR,\n\t\t\t\t\t\"Message is malformed (not XML)...\");\n\t\t}\n\n\t\t// parse the body and calculate required data...\n\t\tNode n = XPath.selectNode(\"//ReportListBean\", soapMessage);\n\t\tif (n == null) {\n\t\t\terror(StatusCode.INTERNAL_ERROR,\n\t\t\t\t\t\"Message is malformed (not a valid report)...\");\n\t\t}\n\n\t\t// can be optimized...\n\t\tString reportList = XMLHelper.createStringFromDOMNode(n, true);\n\t\tif (reportList == null) {\n\t\t\terror(StatusCode.INTERNAL_ERROR,\n\t\t\t\t\t\"Message is malformed (can not generate reportList)...\");\n\t\t}\n\n\t\tReportListBean reportListBean = null;\n\t\ttry {\n\t\t\treportListBean = JAXBHelper.unmarshall(new ByteArrayInputStream(\n\t\t\t\t\treportList.getBytes()));\n\t\t} catch (MessageExchangeException e) {\n\t\t\terror(StatusCode.INTERNAL_ERROR, e.getMessage());\n\t\t}\n\n\t\tMessage message = new Message();\n\t\tfor (ReportBean report : reportListBean.getReports()) {\n\t\t\tif (\"t1\".equalsIgnoreCase(report.getType())) {\n\t\t\t\tmessage.t1 = report.getDate();\n\t\t\t} else if (\"t2\".equalsIgnoreCase(report.getType())) {\n\t\t\t\tmessage.t2 = report.getDate();\n\t\t\t} else if (\"t3\".equalsIgnoreCase(report.getType())) {\n\t\t\t\tmessage.t3 = report.getDate();\n\t\t\t} else if (\"t4\".equalsIgnoreCase(report.getType())) {\n\t\t\t\tmessage.t4 = report.getDate();\n\t\t\t}\n\n\t\t\t// monitoring api needs to be fixed since all informations are the\n\t\t\t// same for the target\n\t\t\tmessage.endpoint = report.getEndpoint();\n\t\t\tmessage.itf = report.getItf();\n\t\t\tmessage.service = report.getServiceName();\n\t\t\tmessage.operation = report.getOperation();\n\t\t}\n\t\tmessage.date = date;\n\t\tmessage.exception = false;\n\t\tWebSocket.liveStream.publish(message);\n\t\t\n\t\trender(\"Services/MonitoringService_Response.xml\");\n\t}", "void mo23214a(Message message);", "protected void readPayload() throws IOException {\n _data_stream.skipBytes(PushCacheProtocol.COMMAND_LEN);\n int rlen = _data_stream.readInt();\n if (rlen == 0) {\n return;\n }\n _text_buffer = new byte[rlen];\n int sofar = 0;\n int toread = rlen;\n sofar = 0;\n toread = rlen;\n int rv = -1;\n edu.hkust.clap.monitor.Monitor.loopBegin(752);\nwhile (toread > 0) { \nedu.hkust.clap.monitor.Monitor.loopInc(752);\n{\n rv = _in.read(_text_buffer, sofar, toread);\n if (rv < 0) {\n throw new IOException(\"read returned \" + rv);\n }\n sofar += rv;\n toread -= rv;\n }} \nedu.hkust.clap.monitor.Monitor.loopEnd(752);\n\n _data_stream = new DataInputStream(new ByteArrayInputStream(_text_buffer));\n }", "private void processMessage(Message message, JsonObject payload) {\n switch(message.getEvent()) {\n case \"registerCustomer\":\n registerCustomer(message, payload);\n break;\n case \"removeCustomer\":\n removeCustomer(message, payload);\n break;\n case \"requestTokensResponse\":\n requestTokensResponse(message, payload);\n break;\n case \"getCustomerByID\":\n getCustomerById(message, payload);\n break;\n case \"receiveReport\":\n receiveReport(message, payload);\n break;\n case \"requestRefundResponse\":\n requestRefundResponse(message, payload);\n break;\n default:\n System.out.println(\"Event not handled: \" + message.getEvent());\n }\n\n }", "private byte[] consumePayload() throws IOException {\n byte[] payload = new byte[(int) payloadLength];\n int count = 0;\n while (payloadLength > 0L) {\n payload[count] = (byte) this.read();\n count++;\n }\n return payload;\n }", "protected Object readMessage(InputStream inputStream) throws IOException{\n PushbackInputStream pin = (PushbackInputStream)inputStream;\n StringBuffer buf = new StringBuffer();\n \n boolean lineStartsWithPrompt = false;\n while (true){\n int b = pin.read();\n \n if (b < 0){\n if (buf.length() == 0) // Clean disconnection\n return null;\n break;\n }\n \n // End of line\n if (b == '\\n'){\n // FICS uses \\n\\r for an end-of-line marker!?\n // Eat the following '\\r', if there is one\n b = pin.read();\n if ((b > 0) && (b != '\\r'))\n pin.unread(b);\n \n // Ignore all-prompt lines\n if (lineStartsWithPrompt && (buf.length() == 0)){\n lineStartsWithPrompt = false;\n continue;\n }\n else\n break;\n }\n \n buf.append((char)b);\n \n // Filter out the prompt\n if (buf.toString().equals(\"fics% \")){\n buf.setLength(0);\n lineStartsWithPrompt = true;\n }\n }\n \n return buf.toString();\n }", "@Override\r\n public void writeMessage(Message msg) throws IOException {\n final StringBuilder buf = new StringBuilder();\r\n msg.accept(new DefaultVisitor() {\r\n\r\n @Override\r\n public void visitNonlocalizableTextFragment(VisitorContext ctx,\r\n NonlocalizableTextFragment fragment) {\r\n buf.append(fragment.getText());\r\n }\r\n\r\n @Override\r\n public void visitPlaceholder(VisitorContext ctx, Placeholder placeholder) {\r\n buf.append(placeholder.getTextRepresentation());\r\n }\r\n\r\n @Override\r\n public void visitTextFragment(VisitorContext ctx, TextFragment fragment) {\r\n buf.append(fragment.getText());\r\n }\r\n });\r\n out.write(buf.toString().getBytes(UTF8));\r\n }", "DynamicMessage createDynamicMessage();", "private MqttPayload getPayload(String message) {\n MqttPayload payload = null;\n\n if (message.contains(\";\")) {\n try {\n String[] separatedMessage = message.split(\";\");\n\n if (separatedMessage.length >= 2) {\n payload = new MqttPayload(formatter.parse(separatedMessage[0]), separatedMessage[1]);\n }\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n } else {\n payload = new MqttPayload(Calendar.getInstance().getTime(), message);\n }\n\n return payload;\n }", "public ITCMessage readMessage() throws IOException;", "public String getMessage() {\r\n return getPayload().optString(\"message\");\r\n }", "public Source getPayload();", "private void processAndPublishMessage(byte[] body) {\n Map<String, Object> props = Maps.newHashMap();\n props.put(CORRELATION_ID, correlationId);\n MessageContext mc = new MessageContext(body, props);\n try {\n msgOutQueue.put(mc);\n String message = new String(body, \"UTF-8\");\n log.debug(\" [x] Sent '{}'\", message);\n } catch (InterruptedException | UnsupportedEncodingException e) {\n log.error(ExceptionUtils.getFullStackTrace(e));\n }\n manageSender.publish();\n }", "private String prettyMessage() {\n Map<String, Object> map = new LinkedHashMap<>(4);\n map.put(\"type\", getType());\n map.put(\"message\", this.message);\n map.put(\"code\", getCode());\n // TODO(\"need to optimize\")\n map.put(\"data\", getData().toString());\n return JsonUtils.getGson().toJson(map);\n }", "public void printMessages(){\n for(int i =0; i<msgCount;++i){\n System.out.printf(\"%s %s\\n\",messages[i].getRecipient()+\":\",messages[i].getDecodedMessage());\n }\n }", "@Override\n protected void channelRead0(ChannelHandlerContext ctx, Map<String, Object> msg) throws Exception {\n Object id = msg.get(IAdapter.TEMPLATE_ID);\n Validate.notNull(id);\n if ((int)id == SyncMessageDecoder.TEMPLATE_ID){\n //TODO do some business ,For example printout\n Object o = msg.get(SyncInfo.class.getSimpleName());\n Validate.notNull(o);\n if (o instanceof SyncInfo){\n System.out.println(((SyncInfo)o).toString());\n }\n }\n }", "void mo80456b(Message message);", "@Override\n public void handle(Message<JsonObject> message) {\n logger.info(\"Handling event conjoiner.simplevertical\");\n\n // Start by deserializing the message back into a Object\n try {\n TransponderMessage msg = new TransponderMessage().messageToObject(message);\n logger.info(\"Decoded message: \" + msg.toJsonString());\n\n } catch (DataFormatException e) {\n e.printStackTrace();\n logger.warning(\"Unable to deserialize this\");\n }\n\n }", "@Override\n\tpublic void readMessage(Message message) {\n\t\t\n\t}", "public static void main(String[] args) {\n RabbitTemplate template = new RabbitTemplate(Configuracao.getConnection());\n\n Message santos = template.receive(\"santos\");\n Message spfc = template.receive(\"spfc\");\n Message corinthians = template.receive(\"corinthians\");\n Message palmeiras = template.receive(\"palmeiras\");\n\n if(santos != null)\n System.out.println(new String(santos.getBody()));\n\n if(spfc != null)\n System.out.println(new String(spfc.getBody()));\n\n if(corinthians != null)\n System.out.println(new String(corinthians.getBody()));\n\n if(palmeiras != null)\n System.out.println(new String(palmeiras.getBody()));\n }", "Document getPayload();", "@Override\n public void process(Exchange exchange) throws Exception {\n Message message = exchange.getIn();\n String bodySerialized = message.getBody(String.class);\n message.setBody(bodySerialized);\n\n }", "java.lang.String getUserMessage();", "@Override\n\tpublic void processMessage(byte[] message) {\n\t}", "@Override\n\tpublic void messageReceived(Message message) {\n\t\tappend(String.format(\"<%s> %s\",message.getSource().getName(),message.getMessage().toString()));\n\t}", "public synchronized StompFrame nextMessage() {\n String message = null;\n int messageEnd = this._stringBuf.indexOf(this._messageSeparator);\n if (messageEnd > -1) {\n message = this._stringBuf.substring(0, messageEnd + this._messageSeparator.length());\n this._stringBuf.delete(0, messageEnd+this._messageSeparator.length());\n }\n System.out.println(\"Server recieved the following message: \" + message);\n return constructMessage(message);\n }", "@Override\n\tpublic void getMessage(TranObject msg) {\n\n\t}", "void mo80453a(Message message);", "@Override\n public String getMessage() {\n String result =\"Audio Message {\\n\";\n result +=\"\\tID: \"+ID+\"\\n\";\n result +=\"\\tBuffer Size: \"+bufferSize+\"\\n\";\n result +=\"}\";\n \n return result;\n }", "public String build() {\n this.message_string = \"{\";\n\n if (this.recipient_id != null) {\n this.message_string += \"\\\"recipient\\\": {\\\"id\\\": \\\"\" + this.recipient_id + \"\\\"},\";\n }\n\n if ((this.message_text != null)\n && !(this.message_text.equals(\"\"))\n && !(this.buttons.isEmpty())) {\n this.message_string += \"\\\"message\\\": {\";\n this.message_string += \"\\\"attachment\\\": {\";\n this.message_string += \"\\\"type\\\": \\\"template\\\",\";\n this.message_string += \"\\\"payload\\\": {\";\n this.message_string += \"\\\"template_type\\\": \\\"button\\\",\";\n this.message_string += \"\\\"text\\\": \\\"\" + this.message_text + \"\\\",\";\n this.message_string += \"\\\"buttons\\\":[\";\n for (int j = 0; j < this.buttons.size(); j++) {\n HashMap<String, String> button = this.buttons.get(j);\n this.message_string += \"{\";\n if (!button.get(\"type\").equals(\"\")) {\n this.message_string += \"\\\"type\\\":\\\"\" + button.get(\"type\") + \"\\\",\";\n }\n if (!button.get(\"title\").equals(\"\")) {\n this.message_string += \"\\\"title\\\":\\\"\" + button.get(\"title\") + \"\\\",\";\n }\n if (!button.get(\"url\").equals(\"\")) {\n this.message_string += \"\\\"url\\\":\\\"\" + button.get(\"url\") + \"\\\",\";\n }\n if (!button.get(\"payload\").equals(\"\")) {\n this.message_string += \"\\\"payload\\\":\\\"\" + button.get(\"payload\") + \"\\\",\";\n }\n if (!button.get(\"webview_height_ratio\").equals(\"\")) {\n this.message_string +=\n \"\\\"webview_height_ratio\\\":\\\"\"\n + button.get(\"webview_height_ratio\")\n + \"\\\",\";\n }\n this.message_string = this.message_string.replaceAll(\",$\", \"\");\n this.message_string += \"},\";\n }\n this.message_string = this.message_string.replaceAll(\",$\", \"\");\n this.message_string += \"]\";\n this.message_string += \"}\";\n this.message_string += \"}\";\n this.message_string += \"}\";\n }\n\n this.message_string = this.message_string.replaceAll(\",$\", \"\");\n\n this.message_string += \"}\";\n\n return this.message_string;\n }", "void processIntent(Intent intent) {\n Parcelable[] rawMsgs = intent.getParcelableArrayExtra(\n NfcAdapter.EXTRA_NDEF_MESSAGES);\n // only one message sent during the beam\n NdefMessage msg = (NdefMessage) rawMsgs[0];\n // record 0 contains the MIME type, record 1 is the AAR, if present\n String payload = new String(msg.getRecords()[0].getPayload());\n Toast.makeText(this, payload, Toast.LENGTH_LONG).show();\n Log.i(TAG, payload);\n }", "private static void print(Object msg){\n if (WAMClient.Debug){\n System.out.println(msg);\n }\n\n }", "java.lang.String getTheMessage();", "public String dump() {\n StringBuffer retVal = new StringBuffer();\n if(STRINGS.size() > 0) {\n Enumeration enumer = STRINGS.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectStringItem item = (SimpleMessageObjectStringItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".s = \");\n retVal.append(item.getValue());\n retVal.append(\"\\n\");\n }\n }\n \n if(INTS.size() > 0) {\n Enumeration enumer = INTS.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectIntItem item = (SimpleMessageObjectIntItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".i = \");\n retVal.append(item.getValue());\n retVal.append(\"\\n\");\n }\n }\n \n if(LONGS.size() > 0) {\n Enumeration enumer = LONGS.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectLongItem item = (SimpleMessageObjectLongItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".l = \");\n retVal.append(item.getValue());\n retVal.append(\"\\n\");\n }\n }\n \n if(DOUBLES.size() > 0) {\n Enumeration enumer = DOUBLES.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectDoubleItem item = (SimpleMessageObjectDoubleItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".d = \");\n retVal.append(item.getValue());\n retVal.append(\"\\n\");\n }\n }\n \n if(FLOATS.size() > 0) {\n Enumeration enumer = FLOATS.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectFloatItem item = (SimpleMessageObjectFloatItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".f = \");\n retVal.append(item.getValue());\n retVal.append(\"\\n\");\n }\n }\n \n if(CHARS.size() > 0) {\n Enumeration enumer = CHARS.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectCharItem item = (SimpleMessageObjectCharItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".c = \");\n retVal.append(item.getValue());\n retVal.append(\"\\n\");\n }\n }\n \n if(BYTES.size() > 0) {\n Enumeration enumer = BYTES.elements();\n while(enumer.hasMoreElements()) {\n SimpleMessageObjectByteArrayItem item = (SimpleMessageObjectByteArrayItem) enumer.nextElement();\n retVal.append(item.getName());\n retVal.append(\".b[] =\\n\");\n byte[] buffer = item.getValue();\n retVal.append(DataConversions.byteArrayToHexDump(buffer));\n\n }\n }\n \n return retVal.toString();\n }", "void consumeMessage(String message);", "public String fromPacketToString() {\r\n\t\tString message = Integer.toString(senderID) + PACKET_SEPARATOR + Integer.toString(packetID) + PACKET_SEPARATOR + type + PACKET_SEPARATOR;\r\n\t\tfor (String word:content) {\r\n\t\t\tmessage = message + word + PACKET_SEPARATOR;\r\n\t\t}\r\n\t\treturn message;\r\n\t}", "public void testParsing2() throws Exception {\n String data = \"8=FIX.4.2\\0019=76\\001\";\n data += \"35=6\\001\";\n data += \"23=IDENTIFIER\\001\";\n data += \"28=N\\001\";\n data += \"55=MSFT\\001\";\n data += \"54=1\\001\";\n data += \"711=2\\001\";\n data += \"311=DELL\\001\";\n data += \"318=USD\\001\";\n data += \"311=IBM\\001\";\n data += \"318=CAD\\001\";\n data += \"10=037\\001\";\n Message message = new Message(data, DataDictionaryTest.getDictionary());\n \n assertHeaderField(message, \"FIX.4.2\", BeginString.FIELD);\n assertHeaderField(message, \"76\", BodyLength.FIELD);\n assertHeaderField(message, MsgType.INDICATION_OF_INTEREST, MsgType.FIELD);\n assertBodyField(message, \"IDENTIFIER\", IOIid.FIELD);\n assertTrailerField(message, \"037\", CheckSum.FIELD);\n IndicationOfInterest.NoUnderlyings valueMessageType = new IndicationOfInterest.NoUnderlyings();\n message.getGroup(1, valueMessageType);\n assertEquals(\"wrong value\", \"DELL\", valueMessageType.getString(UnderlyingSymbol.FIELD));\n assertEquals(\"wrong value\", \"USD\", valueMessageType.getString(UnderlyingCurrency.FIELD));\n message.getGroup(2, valueMessageType);\n assertEquals(\"wrong value\", \"IBM\", valueMessageType.getString(UnderlyingSymbol.FIELD));\n assertEquals(\"wrong value\", \"CAD\", valueMessageType.getString(UnderlyingCurrency.FIELD));\n }", "@Override\n\tpublic void visit(Message message) {\n\t}", "org.graylog.plugins.dnstap.protos.DnstapOuterClass.Message getMessage();", "@Test\n public void testReadFromInputStream() throws IOException {\n SimpleBasicMessage msg = new SimpleBasicMessage(\"test-msg\", Collections.singletonMap(\"one\", \"111\"));\n\n String json = msg.toJSON();\n String extra = \"This is some extra data\";\n String jsonPlusExtra = json + extra;\n\n ByteArrayInputStream in = new UncloseableByteArrayInputStream(jsonPlusExtra.getBytes());\n\n BasicMessageWithExtraData<SimpleBasicMessage> fromJson = AbstractMessage.fromJSON(in, SimpleBasicMessage.class);\n SimpleBasicMessage msg2 = fromJson.getBasicMessage();\n BinaryData leftoverFromJsonParser = fromJson.getBinaryData();\n\n Assert.assertEquals(msg.getMessage(), msg2.getMessage());\n Assert.assertEquals(msg.getDetails(), msg2.getDetails());\n\n // now make sure the stream still has our extra data that we can read now\n byte[] leftoverBytes = new byte[leftoverFromJsonParser.available()];\n leftoverFromJsonParser.read(leftoverBytes);\n\n String totalRemaining = new String(leftoverBytes, \"UTF-8\");\n Assert.assertEquals(extra.length(), totalRemaining.length());\n Assert.assertEquals(extra, totalRemaining);\n }", "void onAnything(String unformatedMessage);", "private String parsePayLoad(DOMNotification notification) {\n\n final AnyXmlNode encapData = (AnyXmlNode) notification.getBody().getChild(PAYLOAD_ARG).get();\n final StringWriter writer = new StringWriter();\n final StreamResult result = new StreamResult(writer);\n final TransformerFactory tf = TransformerFactory.newInstance();\n try {\n final Transformer transformer = tf.newTransformer();\n transformer.transform(encapData.getValue(), result);\n } catch (TransformerException e) {\n LOG.error(\"Can not parse PayLoad data\", e);\n return null;\n }\n writer.flush();\n return writer.toString();\n }", "public String toString() {\n String s = \"Message <RxTxMonitoringMsg> \\n\";\n try {\n s += \" [infos.type=0x\"+Long.toHexString(get_infos_type())+\"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.log_src=0x\"+Long.toHexString(get_infos_log_src())+\"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.timestamp=0x\"+Long.toHexString(get_infos_timestamp())+\"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.seq_num=0x\"+Long.toHexString(get_infos_seq_num())+\"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.size_data=0x\"+Long.toHexString(get_infos_size_data())+\"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.valid_noise_samples=0x\"+Long.toHexString(get_infos_valid_noise_samples())+\"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.noise=\";\n for (int i = 0; i < 3; i++) {\n s += \"0x\"+Long.toHexString(getElement_infos_noise(i) & 0xffff)+\" \";\n }\n s += \"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [infos.metadata=\";\n for (int i = 0; i < 2; i++) {\n s += \"0x\"+Long.toHexString(getElement_infos_metadata(i) & 0xff)+\" \";\n }\n s += \"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n try {\n s += \" [data=\";\n for (int i = 0; i < 60; i++) {\n s += \"0x\"+Long.toHexString(getElement_data(i) & 0xff)+\" \";\n }\n s += \"]\\n\";\n } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }\n return s;\n }", "public String processMsg(RequestObject reqObj);", "public Object getPayload() {\r\n return null;\r\n }", "public static Object parse(Payload payload) {\n Class classType = PayloadRegistry.getClassByType(payload.getMetadata().getType());\n if (classType != null) {\n ByteString byteString = payload.getBody().getValue();\n ByteBuffer byteBuffer = byteString.asReadOnlyByteBuffer();\n Object obj = JacksonUtils.toObj(new ByteBufferBackedInputStream(byteBuffer), classType);\n if (obj instanceof Request) {\n ((Request) obj).putAllHeader(payload.getMetadata().getHeadersMap());\n }\n return obj;\n } else {\n throw new RemoteException(NacosException.SERVER_ERROR,\n \"Unknown payload type:\" + payload.getMetadata().getType());\n }\n \n }", "String formatMessage(LogMessage ioM);", "@Override\n public void handleDelivery(String consumerTag, Envelope envelope,\n AMQP.BasicProperties properties, byte[] body) throws IOException \n {\n try\n {\n Object obj = getObjectForBytes(body);\n json = returnJson(obj);\n System.out.println(\"The json is \"+json.toString());\n \n } catch (ClassNotFoundException ex)\n {\n Logger.getLogger(JsonTranslator.class.getName()).log(Level.SEVERE, null, ex);\n }finally \n {\n System.out.println(\" [x] Done\");\n publishJsonData();//VERY INOVATIVE\n //DDO NOT KILL THE \n // channel.basicAck(envelope.getDeliveryTag(), false);\n }\n \n }", "private PeerProtocolMessage readNormalMessage() throws IOException{\r\n\t\tbyte[]length=new byte[4];\r\n\t\tthis.inputStream.read(length);\r\n\t\tint lengthInt=ToolKit.bigEndianBytesToInt(length, 0);\r\n\t\tbyte[]message= new byte[lengthInt];\r\n\t\tthis.inputStream.read(message);\r\n\t\tbyte[]result=new byte[length.length+message.length];\r\n\t\tSystem.arraycopy(length, 0, result, 0, length.length);\r\n\t\tSystem.arraycopy(message, 0, result, length.length, message.length);\r\n\t\treturn PeerProtocolMessage.parseMessage(result);\r\n\t}", "protected final Object getPayload() {\r\n return this.payload;\r\n }", "Message getCurrentMessage();", "@Override\r\n\tpublic void receiveMessage(Stanza stanza, Object payload) {\r\n\t\t//CHECK WHICH END BUNDLE TO BE CALLED THAT I MANAGE\r\n\t\tif (payload instanceof CalcBean){ \r\n\t\t\tCalcBean messageBean = (CalcBean)payload;\r\n\t\t\tLOG.debug(\"*** Message Recieved by ExampleCommMgr: \" + messageBean.getMessage());\r\n\t\t}\r\n\t}", "public void setPayload(String payload) {\n this.payload = payload;\n }", "public byte [] GetPayload(byte [] data) {\n // Construct payload as series of delimited stringsƒsƒs\n List<Byte> payload = new ArrayList<Byte>();\n for (int i =0; i != data.length; i++)\n payload.add(data[i]);\n return makeTransportPacket(payload);\n }", "@Override\n\tpublic Exchange aggregate(Exchange original, Exchange resource) {\n\t\t\n\t\tif (original==null){\n\n\t\t\treturn resource;\n\t\t}\n\n\t\tString messageID=original.getIn().getHeader(\"MessageID\", String.class);\n\t\t\n\t\t//Body modification done here to pass the final body \n\t\t\n\t\tString originalBody=original.getIn().getBody(String.class); \n\t\tString newBody=resource.getIn().getBody(String.class);\n\t\tString finalBody=originalBody+newBody;\n\n\t\tdebugLogger.debug(LoggingKeys.Splitter_Msg_Body,messageID,originalBody);\n\t\t\n\t\toriginal.getIn().setBody(finalBody);\n\t\t\n\n\t\toriginal.getIn().setHeader(Exchange.HTTP_QUERY, finalBody);\n\t\tdebugLogger.debug(LoggingKeys.Splitter_Msg_Final_Body,messageID,finalBody);\n\n\t\treturn original;\t\n\t}", "@Override\n\tpublic void processMessage(Message message) {\n\t\t\n\t}", "protected void logging(Message message) throws Fault {\n\t\tif (message.containsKey(LoggingMessage.ID_KEY)) {\n return;\n }\n String id = (String)message.getExchange().get(LoggingMessage.ID_KEY);\n if (id == null) {\n id = LoggingMessage.nextId();\n message.getExchange().put(LoggingMessage.ID_KEY, id);\n }\n message.put(LoggingMessage.ID_KEY, id);\n final LoggingMessage buffer \n = new LoggingMessage(\"Inbound Message\\n--------------------------\", id);\n\n Integer responseCode = (Integer)message.get(Message.RESPONSE_CODE);\n if (responseCode != null) {\n buffer.getResponseCode().append(responseCode);\n }\n\n String encoding = (String)message.get(Message.ENCODING);\n\n if (encoding != null) {\n buffer.getEncoding().append(encoding);\n }\n String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);\n if (httpMethod != null) {\n buffer.getHttpMethod().append(httpMethod);\n }\n String ct = (String)message.get(Message.CONTENT_TYPE);\n if (ct != null) {\n buffer.getContentType().append(ct);\n }\n Object headers = message.get(Message.PROTOCOL_HEADERS);\n\n if (headers != null) {\n buffer.getHeader().append(headers);\n }\n String uri = (String)message.get(Message.REQUEST_URL);\n if (uri != null) {\n buffer.getAddress().append(uri);\n String query = (String)message.get(Message.QUERY_STRING);\n if (query != null) {\n buffer.getAddress().append(\"?\").append(query);\n }\n }\n \n if (!isShowBinaryContent() && isBinaryContent(ct)) {\n buffer.getMessage().append(BINARY_CONTENT_MESSAGE).append('\\n');\n log.handle(RequestLogController.getInstance().getRequestLogLevel(), \n \t\tbuffer.toString());\n return;\n }\n \n InputStream is = message.getContent(InputStream.class);\n if (is != null) {\n CachedOutputStream bos = new CachedOutputStream();\n if (threshold > 0) {\n bos.setThreshold(threshold);\n }\n try {\n // use the appropriate input stream and restore it later\n InputStream bis = is instanceof DelegatingInputStream \n ? ((DelegatingInputStream)is).getInputStream() : is;\n \n IOUtils.copyAndCloseInput(bis, bos);\n bos.flush();\n bis = bos.getInputStream();\n \n // restore the delegating input stream or the input stream\n if (is instanceof DelegatingInputStream) {\n ((DelegatingInputStream)is).setInputStream(bis);\n } else {\n message.setContent(InputStream.class, bis);\n }\n\n if (bos.getTempFile() != null) {\n //large thing on disk...\n buffer.getMessage().append(\"\\nMessage (saved to tmp file):\\n\");\n buffer.getMessage().append(\"Filename: \" + bos.getTempFile().getAbsolutePath() + \"\\n\");\n }\n if (bos.size() > limit) {\n buffer.getMessage().append(\"(message truncated to \" + limit + \" bytes)\\n\");\n }\n writePayload(buffer.getPayload(), bos, encoding, ct); \n \n bos.close();\n } catch (Exception e) {\n throw new Fault(e);\n }\n }\n log.handle(RequestLogController.getInstance().getRequestLogLevel(), \n \t\tbuffer.toString());\n\t}", "public static SimpleMessageObject createMessageObject(byte[] data) {\n SimpleMessageObject retVal = new SimpleMessageObject();\n \n // data is of the form:\n // byte(data type)|int(length of name)|name|int(length of value)|value\n boolean keepGoing = true;\n int currentPointer = 0;\n while(keepGoing) {\n int type = data[currentPointer];\n int bytesToRead = 0;\n String name;\n currentPointer++;\n switch(type) {\n //String\n case 0x73:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n String stringValue = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addString(name, stringValue);\n break;\n \n //int\n case 0x69:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n int intValue = DataConversions.getInt(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addInt(name, intValue); \n break;\n \n //long\n case 0x6c:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n long longValue = DataConversions.getLong(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addLong(name, longValue);\n break;\n \n //double\n case 0x64:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n double doubleValue = DataConversions.getDouble(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addDouble(name, doubleValue); \n break;\n \n //float\n case 0x66:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n float floatValue = DataConversions.getFloat(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addFloat(name, floatValue); \n break;\n \n //char\n case 0x63:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n char charValue = DataConversions.getChar(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addChar(name, charValue);\n break;\n \n //byte array\n case 0x62:\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n name = DataConversions.getString(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n bytesToRead = DataConversions.getInt(data, currentPointer, 4);\n currentPointer += 4;\n byte[] byteValue = DataConversions.getByteArray(data, currentPointer, bytesToRead);\n currentPointer += bytesToRead;\n retVal.addByteArray(name, byteValue);\n break;\n }\n \n if(currentPointer == data.length) {\n keepGoing = false;\n }\n }\n \n return retVal;\n }" ]
[ "0.6586933", "0.6399293", "0.6237906", "0.61751986", "0.6139362", "0.60157734", "0.60157734", "0.5973494", "0.5963404", "0.59203666", "0.58461493", "0.58461493", "0.5781827", "0.57644826", "0.57334036", "0.5728465", "0.57017064", "0.56962985", "0.56436884", "0.5634102", "0.56302404", "0.56226355", "0.5595657", "0.55795157", "0.5570541", "0.55653834", "0.55528575", "0.5544177", "0.55327696", "0.5518617", "0.5516412", "0.54760617", "0.5451422", "0.545134", "0.5447948", "0.54372364", "0.54353076", "0.5431819", "0.54309696", "0.54309696", "0.54309696", "0.54309696", "0.5425131", "0.54229486", "0.54221904", "0.54153824", "0.5408753", "0.5408751", "0.5403837", "0.5402615", "0.5390616", "0.538391", "0.53791744", "0.53781945", "0.53673285", "0.5360524", "0.53590107", "0.53558344", "0.5351729", "0.5344069", "0.533384", "0.53288907", "0.53269106", "0.5315246", "0.53069293", "0.53063923", "0.53042984", "0.530117", "0.52975905", "0.52922297", "0.52858686", "0.5284738", "0.5279822", "0.5279296", "0.5278066", "0.52747345", "0.5272606", "0.52704924", "0.5267534", "0.52635604", "0.52599967", "0.52576244", "0.5256083", "0.5255948", "0.5253284", "0.5239249", "0.52379525", "0.5237335", "0.52331287", "0.52319854", "0.5226563", "0.5216623", "0.5212317", "0.5209975", "0.52093345", "0.5206579", "0.520558", "0.519756", "0.5182103", "0.5176455" ]
0.5807027
12
Takes message and packages it in "regular" payload for active session
private byte[] preparePayload(byte[] message) { return ComMethods.preparePayload("SecretServer".getBytes(), message, counter, currentSessionKey, simMode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private byte[] processPayload(byte[] message) {\n\t\treturn ComMethods.processPayload(currentUser.getBytes(), message, counter-1, currentSessionKey, simMode);\n\t}", "@Override\n\tpublic void processMessage(byte[] message) {\n\t}", "private MessageType processMessage(MessageType message) {\n\t\tJSONObject messageJSON = (JSONObject) message;\n\t\tJSONObject timestamp = messageJSON.getJSONObject(\"timestamp\");\n\t\t\n\t\t//complete timestamp\n\t\tint globalState = messagequeue.size();\n\t\tDate nowDate = new Date();\n\t\tString globalClock = String.valueOf(nowDate.getTime());\n\t\ttimestamp.element(\"srn\", globalState);\n\t\ttimestamp.element(\"globalClock\", globalClock);\n\t\t\n\t\tmessageJSON.element(\"timestamp\", timestamp);\n\t\treturn (MessageType) messageJSON;\n\t}", "Payload getMsg();", "@Override\n public void fromApp(Message message, SessionID sessionID) throws UnsupportedMessageType {\n handleMessage(message, sessionID);\n }", "private MqttPayload getPayload(String message) {\n MqttPayload payload = null;\n\n if (message.contains(\";\")) {\n try {\n String[] separatedMessage = message.split(\";\");\n\n if (separatedMessage.length >= 2) {\n payload = new MqttPayload(formatter.parse(separatedMessage[0]), separatedMessage[1]);\n }\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n } else {\n payload = new MqttPayload(Calendar.getInstance().getTime(), message);\n }\n\n return payload;\n }", "@Override\r\n\tpublic void messageReceived( IoSession session, Object message ) throws Exception\r\n\t{\r\n\t\t//\t\tSystem.out.println(\"data \" + (byte[])message);\r\n\t\t//\t\tfor(byte b : (byte[])message){\r\n\t\t//\t\t\tSystem.out.print(b + \" \");\r\n\t\t//\t\t}\r\n\t\t//\t\tSystem.out.println();\r\n\r\n\r\n\r\n\t\tif(message instanceof ClientMessage)\t\t// Application\r\n\t\t\treceivedClientMessage = (ClientMessage) message;\r\n\t\telse{ \t\t\t\t\t\t\t\t\t\t// OBU\r\n\t\t\tinterpretData((byte[]) message, session);\r\n\t\t\t//\t\t\tboolean transactionState = obuHandlers.get(session).addData((byte[])message); \r\n\t\t\t//\t\t\tif(transactionState){\r\n\t\t\t//\t\t\t\tbyte[] b = {(byte)0x01};\r\n\t\t\t//\t\t\t\tsession.write(new OBUMessage(OBUMessage.REQUEST_TELEMETRY, b).request);\r\n\t\t\t//\t\t\t}\r\n\t\t\t//\r\n\t\t\t//\t\t\tThread.sleep(200);\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tRunnable run = new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tswitch(receivedClientMessage.getId()){\r\n\t\t\t\tcase LOGIN_CHECK:\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\t//\t\t\t\tlock.lock();\r\n\t\t\t\t\t\tint user_id = (int)receivedClientMessage.getContent();\r\n\t\t\t\t\t\tUserData response = null;\r\n\t\t\t\t\t\tif(user_id == -1){\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tboolean isOnline = AmberServer.getDatabase().checkOnline(user_id);\r\n\t\t\t\t\t\tif(isOnline){\r\n\t\t\t\t\t\t\tsession.setAttribute(\"user\", user_id);\r\n\t\t\t\t\t\t\tcancelTimeout(user_id);\r\n\t\t\t\t\t\t\tresponse = new UserData().prepareUserData(user_id);\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t\t\tServerLogger.log(\"Login succeeded: \" + user_id, Constants.DEBUG);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tsession.write(new ClientMessage(ClientMessage.Ident.LOGIN_CHECK, response));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfinally{\r\n\t\t\t\t\t\t//\t\t\t\tlock.unlock();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LOGIN:\r\n\t\t\t\t\tClientMessage responseMessage = null;\r\n\t\t\t\t\tString usernameLogin = ((User)receivedClientMessage.getContent()).getName();\r\n\t\t\t\t\tbyte[] passLogin = ((User)receivedClientMessage.getContent()).getPass();\r\n\t\t\t\t\tString regID = ((User)receivedClientMessage.getContent()).getRegistationID();\r\n\t\t\t\t\t// Database validation\r\n\t\t\t\t\t// Check for User and Password\r\n\t\t\t\t\tint userID = AmberServer.getDatabase().login(usernameLogin, passLogin);\r\n\t\t\t\t\tif(userID == -1){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_LOGIN);\r\n\t\t\t\t\t\tServerLogger.log(\"Login failed: \" + usernameLogin, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Check for GCM Registration\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tAmberServer.getDatabase().registerGCM(userID, regID);\r\n\t\t\t\t\t\tUserData response = new UserData();\r\n\t\t\t\t\t\tresponse = response.prepareUserData(userID);\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.LOGIN, response);\r\n\t\t\t\t\t\tsession.setAttribute(\"user\", userID);\r\n\t\t\t\t\t\tServerLogger.log(\"Login success: \" + usernameLogin, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LOGOUT:\r\n\t\t\t\t\tint user_id = (int)receivedClientMessage.getContent();\r\n\t\t\t\t\tAmberServer.getDatabase().logout(user_id);\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.LOGOUT, Constants.SUCCESS_LOGOUT);\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase REGISTER:\r\n\t\t\t\t\tString usernameRegister = ((User)receivedClientMessage.getContent()).getName();\r\n\t\t\t\t\tbyte[] passRegister = ((User)receivedClientMessage.getContent()).getPass();\r\n\t\t\t\t\tboolean queryRegister = AmberServer.getDatabase().addUser(usernameRegister, passRegister, 0);\r\n\t\t\t\t\t// Registration failed\r\n\t\t\t\t\tif(!queryRegister){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_REGISTER);\r\n\t\t\t\t\t\tServerLogger.log(\"Registration failed: \" + usernameRegister, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Registration succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.REGISTER, Constants.SUCCESS_REGISTER);\r\n\t\t\t\t\t\tServerLogger.log(\"Registration success: \" + usernameRegister, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase EVENT_DETAIL:\r\n\t\t\t\tcase EVENT_REQUEST:\r\n\t\t\t\t\tObject[] request = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tint eventID = (int) request[0];\r\n\t\t\t\t\tint obuID = (int) request[1];\r\n\t\t\t\t\tObject[] eventData = AmberServer.getDatabase().getEventData(eventID);\r\n\t\t\t\t\tString vehicleName = AmberServer.getDatabase().getVehicleName(obuID);\r\n\t\t\t\t\tString eventType = (String)eventData[1];\r\n\t\t\t\t\tString eventTime = (String)eventData[2];\r\n\t\t\t\t\tdouble eventLat = (double)eventData[3];\r\n\t\t\t\t\tdouble eventLon = (double)eventData[4];\r\n\t\t\t\t\tbyte[] eventImage = (byte[]) eventData[5];\t// EventImage\r\n\t\t\t\t\tEvent event = new Event(eventType, eventTime, eventLat, eventLon, eventImage, vehicleName);\r\n\t\t\t\t\tevent.setVehicleID(obuID);\r\n\t\t\t\t\tsession.write(new ClientMessage(receivedClientMessage.getId(), event));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase REGISTER_VEHICLE:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tint vehicleID = (int) request[1];\r\n\r\n\t\t\t\t\tSystem.out.println(\"VEHICLE ID \" + vehicleID);\r\n\r\n\t\t\t\t\tVehicle vehicle = AmberServer.getDatabase().registerVehicle(userID, vehicleID);\r\n\t\t\t\t\tSystem.out.println(vehicle);\r\n\t\t\t\t\tif(vehicle == null){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.ERROR, Constants.ERROR_REGISTER_VEHICLE);\r\n\t\t\t\t\t\tServerLogger.log(\"Add Vehicle failed: \" + userID, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Add Vehicle succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tvehicle = vehicle.prepareVehicle(vehicleID);\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.REGISTER_VEHICLE, vehicle);\r\n\t\t\t\t\t\tServerLogger.log(\"Add Vehicle succeeded: \" + userID, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase UNREGISTER_VEHICLE:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tvehicleID = (int) request[1];\r\n\t\t\t\t\tint position = (int) request[2];\r\n\t\t\t\t\tboolean queryUnregisterVehicle = AmberServer.getDatabase().unregisterVehicle(userID, vehicleID);\r\n\t\t\t\t\tif(!queryUnregisterVehicle){\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.UNREGISTER_VEHICLE, -1);\r\n\t\t\t\t\t\tServerLogger.log(\"Unregister Vehicle failed for User: \" + userID, Constants.DEBUG);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Unregister Vehicle succeeded\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.UNREGISTER_VEHICLE, position);\r\n\t\t\t\t\t\tServerLogger.log(\"Unregister Vehicle succeeded for User: \" + userID, Constants.DEBUG);\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase TOGGLE_ALARM:\r\n\t\t\t\t\trequest = (Object[]) receivedClientMessage.getContent();\r\n\t\t\t\t\tuserID = (int) request[0];\r\n\t\t\t\t\tvehicleID = (int) request[1];\r\n\t\t\t\t\tboolean status = (boolean) request[2];\r\n\t\t\t\t\tposition = (int) request[3];\r\n\t\t\t\t\tboolean queryToggleAlarm = AmberServer.getDatabase().toggleAlarm(userID, vehicleID, status);\r\n\t\t\t\t\tObject[] responseData = {queryToggleAlarm, position};\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.TOGGLE_ALARM, responseData);\r\n\t\t\t\t\tServerLogger.log(\"Toggle Alarm for User: \" + userID + \" \" + queryToggleAlarm, Constants.DEBUG);\t\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase GET_EVENTLIST_BACKPRESS:\r\n\t\t\t\tcase GET_EVENTLIST:\r\n\t\t\t\t\tvehicleID = (int) receivedClientMessage.getContent();\r\n\t\t\t\t\tvehicleName = AmberServer.getDatabase().getVehicleName(vehicleID);\r\n\t\t\t\t\tArrayList<Event> events = Vehicle.prepareEventList(vehicleID);\r\n\t\t\t\t\tObject[] eventResponse = {events, vehicleName};\r\n\t\t\t\t\tresponseMessage = new ClientMessage(receivedClientMessage.getId(), eventResponse);\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase GET_VEHICLELIST_BACKPRESS:\r\n\t\t\t\t\tuserID = (int) receivedClientMessage.getContent();\r\n\t\t\t\t\tUserData response = new UserData();\r\n\t\t\t\t\tresponse = response.prepareUserData(userID);\r\n\t\t\t\t\tresponseMessage = new ClientMessage(ClientMessage.Ident.GET_VEHICLELIST_BACKPRESS, response.getVehicles());\r\n\t\t\t\t\tsession.write(responseMessage);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tnew Thread(run).start();\r\n\t}", "@Override\n public void handleTextMessage(WebSocketSession session, TextMessage message) throws IOException{\n Map data = new Gson().fromJson(message.getPayload(),Map.class);\n\n // see what type of message\n final String type = getValueFromMessage(message,\"type\");\n\n switch (type){\n case \"name\":\n // payload from frontend\n String username = getValueFromMessage(message,\"payload\");\n\n log.info(\"receive name: \"+ username);\n\n // build message to json\n TextMessage retJson = setJson(\"name\", \"Hi, \"+username);\n\n session.sendMessage(retJson);\n }\n }", "@Override\n\tpublic void processMessage(Message message) {\n\t\t\n\t}", "protected Object extractMessage(Message message) {\n\t\tif (serializer != null) {\n\t\t\treturn serializer.deserialize(message.getBody());\n\t\t}\n\t\treturn message.getBody();\n\t}", "private void handleApplicationDataMessage(IOSMessage message) {\n }", "@Override\n\tpublic void readMessage(Message message) {\n\t\t\n\t}", "@Override\n public void payload(byte[] data) {\n \tmLastMessage.append(new String(data));\n Log.d(TAG, \"Payload received: \" + data);\n }", "@Override\r\n\tpublic void receiveMessage(Stanza stanza, Object payload) {\n\t\t\r\n\t}", "public void parseMessage(JSONObject message, Session session, WebSocketEndpoint wsep) {\n\t\tConnection conn = null;\n\t\tStatement st = null;\n\t\tResultSet rs = null;\n\t response = new JSONObject();\n//\t transNotif = new JSONObject();\n\t try {\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t\tconn = DriverManager.getConnection(\"jdbc:mysql://localhost/Sanity?user=root&password=root&useSSL=false\");\n\t\t\tst = conn.createStatement();\n\t\t\tJSONObject r = new JSONObject();\n\t\t\tif (!message.get(\"message\").equals(\"signup\") && !message.get(\"message\").equals(\"login\") && !message.get(\"message\").equals(\"changePassword\")) {\n\t\t\t\tr = notifyPeriod(message, session, conn);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tr = null;\n\t\t\t}\n\t\t\tif (r!=null) {\n\t\t\t\twsep.sendToSession(session, toBinary(r));\n\t\t\t}\n\t\t\tresponse = new JSONObject();\n//\t\t\tSystem.out.println(message.toString());\n\t if (message.get(\"message\").equals(\"signup\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(signUp(message, conn)));\n\t\t\t}\n\t else if (message.get(\"message\").equals(\"getHistory\")) {\n\t \twsep.sendToSession(session, toBinary(getHistory(message, session, conn)));\n\t }\n\t else if (message.get(\"message\").equals(\"editBigBudgetAttributes\")) {\n\t \twsep.sendToSession(session, toBinary(editBigBudgetAttributes(message, session, conn)));\n\t }\n\t else if (message.get(\"message\").equals(\"refreshdata\")) {\n\t \twsep.sendToSession(session, toBinary(refreshData(message, session, conn)));\n\t }\n\t else if (message.get(\"message\").equals(\"refreshdatacategory\")) {\n\t \twsep.sendToSession(session, toBinary(refreshDataCategory(message, session, conn)));\n\t }\n\t else if (message.get(\"message\").equals(\"refreshdatatransaction\")) {\n\t \twsep.sendToSession(session, toBinary(refreshDataTransaction(message, session, conn)));\n\t }\n\t else if (message.get(\"message\").equals(\"refreshdatahistory\")) {\n\t \twsep.sendToSession(session, toBinary(refreshDataHistory(message, session, conn)));\n\t }\n\t\t\telse if (message.get(\"message\").equals(\"login\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(signIn(message, session, conn)));\n//\t\t\t\tif (r!=null) {\n//\t\t\t\t\twsep.sendToSession(session, toBinary(r));\n//\t\t\t\t}\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"createBigBudget\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(createBigBudget(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"createBudget\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(createBudget(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"editBigBudget\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(editBigBudget(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"editCategory\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(editBudget(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"deleteBigBudget\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(deleteBigBudget(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"deleteCategory\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(deleteBudget(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"editUser\")) {\n//\t\t\t\twsep.sendToSession(session, toBinary(refreshData(message, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"changePassword\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(editProfile(message, session, conn)));\n//\t\t\t\twsep.sendToSession(session, toBinary(editProfile(message, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"addTransaction\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(addTransaction(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"editTransactionDescription\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(renameTransaction(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"deleteTransaction\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(deleteTransaction(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"deleteAllTransactions\")) {\n\t\t\t\twsep.sendToSession(session, toBinary(deleteAllTransactions(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"getAnalytics\")) {\n\t\t\t\t\n\t\t\t}\n\t \n\t //clear database in each test function before running it\n\t \n\t\t\telse if (message.get(\"message\").equals(\"logintest\")) {\n\t\t\t\t\n\t\t\t\twsep.sendToSession(session, toBinary(signInTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"signuptest\")) { //return signupsuccesstest, signupfailtest\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(signUpTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"changePasswordTest\")) { //return passwordSuccessTest, passwordFailTest\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(changePasswordTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"addToBudgetTest\")) { //return addToBudgetSuccessTest/fail\n\t\t\t\t//creates budget, category and adds transaction\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(addToBudgetTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"subtractFromBudgetTest\")) { //return subtractFromBudgetSuccessTest, success when category/budget amount has decreased\n\t\t\t\t//same as addToBudgetTest, sends -100 in amountToAdd\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(subtractFromBudgetTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"transactionHistoryTest\")) { //return transactionHistorySuccessTest if pull from transaction table is not 0\n\t\t\t\t//create budget, create category, add transaction, check that it is not empty\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(transactionHistoryTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"locationTest\")) { //return locationSuccessTest if pull from transaction table is not 0\n\t\t\t\t//create budget, create category, add transaction with location markerLatitude, markerLongitude\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(locationTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"limitNotificationTest\")) { //return limitNotificationSuccessTest if pull from transaction table is not 0\n\t\t\t\t//create budget, category, and transaction (if under 20% left, send successs notification message)\n\t\t\t\t//\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(limitNotificationTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"createBigBudgetTest\")) { //return createBigBudgetSuccessTest, passwordFailTest\n\t\t\t\t//return success if budget amount is negative, is over 1000000 and not created in database\n\t\t\t\t//success if exception caught\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(createBigBudgetTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"createBudgetTest\")) { //return createBudgetSuccessTest, passwordFailTest\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(createBudgetTest(message, session, conn)));\n\t\t\t}\n\t\t\telse if (message.get(\"message\").equals(\"deleteBigBudgetTest\")) { //return deleteBigBudgetSuccessTest, passwordFailTest\n//\t\t\t\tdeleteAll(conn);\n\t\t\t\tcreateUser(conn, session);\n\t\t\t\twsep.sendToSession(session, toBinary(deleteBigBudgetTest(message, session, conn)));\n\t\t\t}\n\t \n\t \n\t \n\t \n\t \n\t //budget: bigBudgetName, bigBudgetAmount, userID, totalAmountSpent, totalAmountAdded, resetFrequency, resetStartDate\n\t //category: budgetName, budgetAmount, bigBudgetID\n\t //transaction: amountToAdd, budgetID, markerLatitude, markerLongitude\n\t\t} catch (ClassNotFoundException | SQLException | JSONException e) {\n\t\t\t//JSONObject response = new JSONObject();\n\t\t\ttry {\n\t\t\t\tresponse.put(\"SQLFail\", \"SQL connection could not be made.\");\n\t\t\t} catch (JSONException e1) {\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\t\t\te.printStackTrace();\n\t\t\twsep.sendToSession(session, toBinary(response));\n\t\t} finally {\n\t \ttry {\n\t \t\tif (rs != null) {\n\t \t\t\trs.close();\n\t \t\t}\n\t \t\tif (st != null) {\n\t \t\t\tst.close();\n\t \t\t}\n\t \t\tif (conn != null) {\n\t \t\t\tconn.close();\n\t \t\t}\n\t \t} catch (SQLException sqle) {\n\t \t\tSystem.out.println(sqle.getMessage());\n\t \t}\n\t\t}\n\t}", "private void handleMessage(Message input, SessionID sessionID) throws UnsupportedMessageType {\n LOG.debug(\"type of message: \" + input.getClass().getSimpleName());\n String classSimpleName = input.getClass().getSimpleName();\n if (classSimpleName.equalsIgnoreCase(\"NewOrderSingle\")) {\n handleNewOrderSingle(input, sessionID);\n } else {\n throw new UnsupportedMessageType();\n }\n }", "@Override\n public Message<?> preSend(Message<?> message, MessageChannel channel){\n StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);\n StompCommand stc = accessor.getCommand();\n\n String session = accessor.getSessionId();\n String roomId, username, memberName;\n\n // System.out.println(accessor.getDestination());\n // System.out.println(session);\n \n // String token = accessor.getFirstNativeHeader(\"Authorization\");\n // String destination = accessor.getDestination();\n\n switch(stc) {\n case CONNECT :\n // 도저히 jwt 인증은 해결 안되네..\n // authentication 객체를 어디다 담아야 websocket security에서 통과시켜줄까?\n // String jwt = ju.parseJwt(token);\n // String validResult = \"\";\n // if(jwt != null){\n // validResult = ju.validateJwtToken(jwt);\n // }\n // if (validResult.equals(\"OK\")) {\n // try {\n \n // username = ju.getUserNameFromJwtToken(jwt);\n // roles = ju.getRolesFromJwtToken(jwt);\n // UserDetailsImpl userDetails = new UserDetailsImpl();\n // userDetails.setId(username);\n // userDetails.setRoles(roles);\n // UsernamePasswordAuthenticationToken authentication = \n // new UsernamePasswordAuthenticationToken(\n // userDetails, \n // null, \n // userDetails.getAuthorities()\n // );\n\n // SecurityContextHolder.getContext().setAuthentication(authentication);\n \n // accessor.setUser(authentication);\n // } catch (Exception e) {\n // e.printStackTrace();\n // }\n // }\n \n\n System.out.println(\"STOMP CONNECTED\");\n\n break;\n\n case SUBSCRIBE :\n\n roomId = chatService.getRoomId(accessor.getDestination());\n username = accessor.getFirstNativeHeader(\"username\");\n memberName = accessor.getFirstNativeHeader(\"memberName\");\n\n // System.out.println(session + \" : \" + roomId + \" : \" + username + \" : \" + memberName);\n //채팅방 접속일 경우\n if(roomId.equals(\"all\")){\n //세션 저장\n chatService.setSession(session, roomId, username, memberName);\n //접속 수 +1\n chatService.increaseUserCount(roomId);\n //입장 메세지 전송\n chatService.sendChatMessage(\n ChatMessage\n .builder()\n .roomId(roomId)\n .username(username)\n .memberName(memberName)\n .type(ChatMessage.MessageType.ENTER)\n .message(\"[시스템] \" + memberName + \"님이 입장하였습니다.\")\n .sendDate(\"\")\n .build()\n );\n }else if(roomId.equals(\"ccu\")){\n System.out.println(accessor.getDestination());\n System.out.println(session);\n }\n \n // System.out.println(\"STOMP SUBSCRIBED\");\n break;\n\n case DISCONNECT :\n\n // System.out.println(accessor.getDestination());\n // System.out.println(session);\n \n //채팅 세션 처리\n Optional\n .ofNullable(chatService.getSession(session))\n .ifPresent(\n chatSession -> {\n String innerRoomId = chatSession.getRoomId();\n String innerUsername = chatSession.getUsername();\n String innerMemberName = chatSession.getMemberName();\n \n //해당 세션 삭제\n chatService.deleteSession(session);\n //접속 수 -1\n chatService.decreaseUserCount(innerRoomId);\n \n //접속 인원 -, 해당 방 유저들에게 퇴장했다고 알려야 함. destination, memberName 필요.\n chatService.sendChatMessage(\n ChatMessage\n .builder()\n .roomId(innerRoomId)\n .username(innerUsername)\n .memberName(innerMemberName)\n .type(ChatMessage.MessageType.EXIT)\n .message(\"[시스템] \" + innerMemberName + \"님이 퇴장하였습니다.\")\n .sendDate(\"\")\n .build()\n );\n }\n );\n\n //세션 가져오기\n // ChatSession chatSession = chatService.getSession(session);\n // if(chatSession != null){\n // roomId = chatSession.getRoomId();\n // username = chatSession.getUsername();\n // memberName = chatSession.getMemberName();\n\n // //해당 세션 삭제\n // chatService.deleteSession(session);\n // //접속 수 -1\n // chatService.decreaseUserCount(roomId);\n\n // //접속 인원 -, 해당 방 유저들에게 퇴장했다고 알려야 함. destination, memberName 필요.\n // chatService.sendChatMessage(\n // ChatMessage\n // .builder()\n // .roomId(roomId)\n // .username(username)\n // .memberName(memberName)\n // .type(ChatMessage.MessageType.EXIT)\n // .message(\"[시스템] \" + memberName + \"님이 퇴장하였습니다.\")\n // .sendDate(\"\")\n // .build()\n // );\n // }\n\n // System.out.println(\"STOMP DISCONNECTED\");\n break;\n\n case SEND :\n\n // System.out.println(\"STOMP SEND\");\n break;\n\n default :\n\n break;\n }\n return message;\n }", "public String parsePayloadToJSON(ContrailMessage message) throws XMLStreamException, JsonProcessingException {\r\n\t\tLOGGER.info(\"Parsing payload\");\r\n\t\tif (CANDE_PAYLOAD_TYPE.equals(message.getPayloadType())) {\r\n\t\t\t// name of the file\r\n\t\t\tXMLString fileName = new XMLString();\r\n\t\t\t// Object URL in contentdelivery bucket\r\n\t\t\tXMLString s3Uri = new XMLString();\r\n\t\t\t// productId=LIVE to identify live feed or migration\r\n\t\t\tXMLString productId = new XMLString();\r\n\r\n\t\t\tnew XMLParser().getInnerTextFor(\"/ContentDeliveryData/fileTickets/fileTicket/fileName\", fileName::set)\r\n\t\t\t\t\t.getInnerTextFor(\"/ContentDeliveryData/fileTickets/fileTicket/s3Uri\", s3Uri::set)\r\n\t\t\t\t\t.getInnerTextFor(\"/ContentDeliveryData/fileTickets/fileTicket/directory\", productId::set)\r\n\t\t\t\t\t.parse((String) message.getPayloadData());\r\n\r\n\t\t\tthis.payloadMap.put(\"fileName\", fileName.get());\r\n\t\t\tthis.payloadMap.put(\"s3Uri\", s3Uri.get());\r\n\t\t\tthis.payloadMap.put(\"productId\", productId.get());\r\n\r\n\t\t\tString transformedPayload = new ObjectMapper().writeValueAsString(this.payloadMap);\r\n\t\t\tLOGGER.info(\"Parsed payload: \" + transformedPayload);\r\n\t\t\t// converts the map to json string\r\n\t\t\treturn transformedPayload;\r\n\r\n\t\t}\r\n\r\n\t\telse {\r\n\t\t\tthrow new IllegalStateException(\r\n\t\t\t\t\t\"Unidentified Message Payload: \" + Strings.nullToEmpty(message.getPayloadType()));\r\n\t\t}\r\n\r\n\t}", "private void processMessage(Message message, JsonObject payload) {\n switch(message.getEvent()) {\n case \"registerCustomer\":\n registerCustomer(message, payload);\n break;\n case \"removeCustomer\":\n removeCustomer(message, payload);\n break;\n case \"requestTokensResponse\":\n requestTokensResponse(message, payload);\n break;\n case \"getCustomerByID\":\n getCustomerById(message, payload);\n break;\n case \"receiveReport\":\n receiveReport(message, payload);\n break;\n case \"requestRefundResponse\":\n requestRefundResponse(message, payload);\n break;\n default:\n System.out.println(\"Event not handled: \" + message.getEvent());\n }\n\n }", "public Payload.Inbound getInboundPayload();", "@OnMessage\n\tpublic void handleMessage(String message, Session session) {\n\t\tSystem.out.println(\"Received: \" + message);\n\n\t\ttry{\n\t\t\t// We always expect a single json object - all our commands are routed in via this mechanism, with each command having a different root json object name\n\t\t\tJsonReader jsonReader = Json.createReader(new StringReader(message));\n\t\t\tJsonObject o = jsonReader.readObject();\n\t\t\t\n\t\t\t// Every command should have an auth value on it...\n\t\t\tString auth = o.getString(\"auth\");\n\t\t\t//System.out.println(\"Auth is \" + auth);\n\t\t\tif (!sessionHandler.validAccounts.contains(auth))\n\t\t\t{\n\t\t\t\tsession.getBasicRemote().sendText(\"{\\\"noauth\\\":true}\");\n\t\t\t\tthrow new Exception(\"Invalid auth\");\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t// See what command the client has sent me - the name of the object denotes the command\n\t\t\tJsonObject console = o.getJsonObject(\"console\");\n\t\t\tif (null != console)\n\t\t\t{\n\t\t\t\tConsoleInfo ci = new ConsoleInfo();\n\t\t\t\tci.name = console.getString(\"name\");\n\t\t\t\tsessionHandler.addConsoleInfo(session, ci);\n\t\t\t}\t\t\t\n\t\t\tJsonObject reset = o.getJsonObject(\"reset\");\n\t\t\tif (null != reset)\n\t\t\t{\n\t\t\t\tif (reset.getString(\"type\").equals(\"full\"))\n\t\t\t\t{\n\t\t\t\t\t// Clear out the registered devices\n\t\t\t\t\tDevices.d.removeAll();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tDevices.d.remove(reset.getString(\"number\"));\n\t\t\t\t}\n\t\t\t}\n\t\t\tJsonObject deleteaudio = o.getJsonObject(\"deleteaudio\");\n\t\t\tif (null != deleteaudio)\n\t\t\t{\n\t\t\t\t// remove this audio\n\t\t\t\tAudios.a.remove(deleteaudio.getString(\"name\"));\n\t\t\t}\n\t\t\tJsonObject addaudiofolder = o.getJsonObject(\"addfolder\");\n\t\t\tif (null != addaudiofolder)\n\t\t\t{\n\t\t\t\t// Create a folder on disk\n\t\t String folder = addaudiofolder.getString(\"folder\");\n\t\t String newName = addaudiofolder.getString(\"name\");\n\t\t File uploads = new File(Settings.s.uploadDiskPath + \"/\" + (folder.length()==0?\"\" : folder + \"/\") + newName);\n\t\t // Prevent traversals\n\t\t if (!uploads.getParentFile().toPath().startsWith(new File(Settings.s.uploadDiskPath).toPath()))\n\t\t {\n\t\t \t// Naughty!\n\t\t \tthrow new ServletException(\"Cannot save to \" + uploads.getParentFile().toPath()); \t\n\t\t }\n\t\t // Create the folder if necessary\n\t\t if (!uploads.exists())\n\t\t {\n\t\t \tuploads.mkdirs();\n\t\t }\n\t\t // And tell everyone about it...\n\t\t\t\tAudios.a.add(uploads.toString(), newName, folder, true);\n\t\t\t}\n\t\t\tJsonObject playaudio = o.getJsonObject(\"playaudio\");\n\t\t\tif (null != playaudio)\n\t\t\t{\n\t\t\t\t// Play this audio to the listed devices\n\t\t\t\tString audio = playaudio.getString(\"audio\");\n\t\t\t\tJsonArray devices = playaudio.getJsonArray(\"devices\");\n\t\t\t\tAudio a = Audios.a.get(audio);\n\t\t\t\tif (null != a)\n\t\t\t\t{\t\t\t\t\t\n\t\t\t\t\t// TODO - pass the array to Plivo instead of looping here, as I think the play API can take an array...\n\t\t\t\t\tfor (JsonValue device : devices)\n\t\t\t\t\t{\n\t\t\t\t\t\tDevice d = Devices.d.get(device.toString());\n\t\t\t\t\t\t// Is this a folder? If so, pick a random child audio, preferring one that this device has not had\n\t\t\t\t\t\tif (a.isFolder)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ta = Audios.a.getRandomChild(a, d);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// We should be able to handle ringing calls here\n\t\t\t\t\t\tif (null != d)\n\t\t\t\t\t\t\td.MakeCall(a);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tJsonObject patch = o.getJsonObject(\"patch\");\n\t\t\tif (null != patch)\n\t\t\t{\n\t\t\t\t// Connect this active device to an idle device, or connect 2 idle devices together\n\t\t\t\tJsonArray devices = patch.getJsonArray(\"devices\");\n\t\t\t\tDevices.patch(devices.get(0).toString(), devices.get(1).toString());\n\t\t\t}\n\t\t\t\n\t\t\tJsonObject playtext = o.getJsonObject(\"playtext\");\n\t\t\tif (null != playtext)\n\t\t\t{\n\t\t\t\t// As playAudio, but for sms - and the text can be edited in the console and not saved...\n\t\t\t\tString text = playtext.getString(\"text\");\n\t\t\t\tString activetext = playtext.getString(\"activetext\");\n\t\t\t\tText atext = Texts.t.get(activetext);\n\t\t\t\tJsonArray devices = playtext.getJsonArray(\"devices\");\n\t\t\t\tif (!text.isEmpty())\n\t\t\t\t{\n\t\t\t\t\tfor (JsonValue device : devices)\n\t\t\t\t\t{\n\t\t\t\t\t\tDevice d = Devices.d.get(device.toString());\n\t\t\t\t\t\tif (null != d)\n\t\t\t\t\t\t\td.Sms(text, atext);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tJsonObject ignore = o.getJsonObject(\"ignore\");\n\t\t\tif (null != ignore)\n\t\t\t{\n\t\t\t\tJsonArray devices = ignore.getJsonArray(\"devices\");\n\t\t\t\tfor (JsonValue device : devices)\n\t\t\t\t{\n\t\t\t\t\tDevices.hangup(device.toString(),\"failed\",\"Request from console\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tJsonObject deletetext = o.getJsonObject(\"deletetext\");\n\t\t\tif (null != deletetext)\n\t\t\t{\n\t\t\t\tTexts.t.remove(deletetext.getString(\"name\"));\n\t\t\t}\n\t\t\t\n\t\t\tJsonObject savetext = o.getJsonObject(\"savetext\");\n\t\t\tif (null != savetext)\n\t\t\t{\n\t\t\t\tTexts.t.add(savetext.getString(\"label\"),savetext.getString(\"name\"));\n\t\t\t}\n\t\t\t\n\t\t\tJsonObject updatestatus = o.getJsonObject(\"updatestatus\");\n\t\t\tif (null != updatestatus)\n\t\t\t{\n\t\t\t\tDevices.updateStatus();\n\t\t\t}\n\t\t\tJsonObject savedevice = o.getJsonObject(\"savedevice\");\n\t\t\tif (null != savedevice)\n\t\t\t{\n\t\t\t\tDevices.updateName(savedevice.getString(\"number\"), savedevice.getString(\"name\"));\n\t\t\t}\n\t\t\tJsonObject saveprogress = o.getJsonObject(\"saveprogress\");\n\t\t\tif (null != saveprogress)\n\t\t\t{\n\t\t\t\tDevices.updateProgress(saveprogress.getString(\"number\"), saveprogress.getString(\"progress\"));\n\t\t\t}\n\n\t\t\t\n\t\t\tJsonObject setmessagesread = o.getJsonObject(\"setmessagesread\");\n\t\t\tif (null != setmessagesread)\n\t\t\t{\n\t\t\t\tDevices.setMessagesRead(setmessagesread.getString(\"number\"));\n\t\t\t}\n\t\t\tJsonObject savegoal = o.getJsonObject(\"savegoal\");\n\t\t\tif (null != savegoal)\n\t\t\t{\n\t\t\t\tGoals.add(savegoal);\n\t\t\t}\n\t\t\tJsonObject deletegoal = o.getJsonObject(\"deletegoal\");\n\t\t\tif (null != deletegoal)\n\t\t\t{\n\t\t\t\tGoals.remove(deletegoal.getString(\"name\"));\n\t\t\t}\n\t\t\tJsonObject uncue = o.getJsonObject(\"uncue\");\n\t\t\tif (null != uncue)\n\t\t\t{\n\t\t\t\tDevices.uncue(uncue.getString(\"number\"));\n\t\t\t}\n\t\t\tJsonObject register = o.getJsonObject(\"register\");\n\t\t\tif (null != register)\n\t\t\t{\n\t\t\t\tDevices.d.add(register.getString(\"number\"),\"console\");\n\t\t\t}\n\t\t\t\n\t\t\t// IVR commands from the console\t\t\t\n\t\t\tJsonObject saveivrstep = o.getJsonObject(\"saveivrstep\");\n\t\t\tif (null != saveivrstep)\n\t\t\t{\n\t\t\t\tIvrSteps.i.add(saveivrstep).saveToDisk();\n\t\t\t}\n\t\t\tJsonObject deleteivrstep = o.getJsonObject(\"deleteivrstep\");\n\t\t\tif (null != deleteivrstep)\n\t\t\t{\n\t\t\t\tIvrSteps.i.remove(deleteivrstep.getString(\"name\"));\n\t\t\t}\n\t\t\t// System-wide settings\n\t\t\tJsonObject setting = o.getJsonObject(\"setting\");\n\t\t\tif (null != setting)\n\t\t\t{\n\t\t\t\tSwitchboard.s.parseJson(setting);\n\t\t\t\tSwitchboard.s.persist();\n\t\t\t\t\n\t\t\t\t// Tell everyone about this...\n\t\t\t\tsessionHandler.Broadcast(o);\n\t\t\t\t\n\t\t\t\t// And do any heartbeat changes that I need\n\t\t\t\tSwitchboard.s.setupHeartbeat(true);\n\t\t\t}\n\t\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tSystem.out.println(\"Failed to parse \" + message + \" with error \" + e.getMessage());\n\t\t}\n\t}", "@Handler\r\n public void onMessage(Message message, Session sessionI) throws Exception {\r\n log.info(\"inside generic message handler - message =: \" + message.toString());\r\n MsgType msgType = new MsgType();\r\n message.getHeader().getField(msgType);\r\n log.info(\"inside generic message handler - msgtype =: \" + msgType.toString());\r\n// log.info(\"inside generic message handler - message =: \"+ message.toString());\r\n }", "@Override\n\t\t\tpublic IAMQPPublishAction message(byte[] message) {\n\t\t\t\treturn null;\n\t\t\t}", "@Override\n\t\t\tpublic IAMQPPublishAction message(byte[] message) {\n\t\t\t\treturn null;\n\t\t\t}", "@Override\n\tpublic void encode() {\n\t\tbyte[] messageData = encodeStarsMessage(message);\n\t\t\n\t\t// Allocate\n byte[] res = new byte[10 + messageData.length];\n\n // Write members\n Util.write16(res, 0, unknownWord0);\n Util.write16(res, 2, unknownWord2);\n Util.write16(res, 4, senderId);\n Util.write16(res, 6, receiverId);\n Util.write16(res, 8, unknownWord8);\n \n // Copy in message data\n System.arraycopy(messageData, 0, res, 10, messageData.length);\n \n // Save as decrypted data\n setDecryptedData(res, res.length);\n\t}", "@Override\n protected Message receiveMessage() throws IOException {\n String encoded = this.din.readUTF();\n this.lastMessage = new Date();\n String decodedXml = new String(\n DatatypeConverter.parseBase64Binary(encoded));\n\n return Message.msgFromXML(decodedXml);\n }", "public pam_message(Pointer src) {\n useMemory(src);\n read();\n }", "void mo80456b(Message message);", "@Override\n public void onMessage(String channel, String message) {\n if (redisHandler.isAuth()) redisHandler.getJedisPool().getResource().auth(redisHandler.getPassword());\n if (!channel.equalsIgnoreCase(redisHandler.getChannel())) return;\n\n executor.execute(() -> {\n String[] strings = message.split(\"///\");\n\n System.out.println(strings[1]);\n System.out.println(strings[0]);\n\n Object jsonObject = null;\n try {\n jsonObject = redisHandler.getGson().fromJson(strings[0], Class.forName(strings[1]));\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }\n\n RedisPacket redisPacket = (RedisPacket) jsonObject;\n\n if (redisPacket == null) {\n System.out.println(\"The redis packet received seems to be null!\");\n return;\n }\n\n redisPacket.onReceived();\n });\n }", "@Override\n\tpublic void visit(Message message) {\n\t}", "public Object getPayload() {\n return payload;\n }", "public void dispatchMessage(KeyedMessage<byte[], byte[]> msg);", "@Override\n\tpublic void send(DuDuMessage message, Object sessionToken) {\n\t\t\n\t}", "void mo23214a(Message message);", "@Override\n public void handleMessage(Message message) {}", "protected abstract TMessage prepareMessage();", "void mo80453a(Message message);", "public void onMessage(Session session);", "void passMessageToReceiver(String ccid, byte[] serializedMessage);", "void consumeMessage(String message);", "@Override\n public void sendMessage(Message<JsonPayload> message) throws IOException {\n System.out.println(\"Trying to send a message...\");\n outputMessageStream.write(message.getContent().getJson());\n outputMessageStream.newLine();\n outputMessageStream.flush();\n socket.shutdownOutput();\n }", "@Override\n public void parseExtensionMessageContent(SessionTicketTLSExtensionMessage msg) {\n if (msg.getExtensionLength().getValue() > 65535) {\n LOGGER.warn(\"The SessionTLS ticket length shouldn't exceed 2 bytes as defined in RFC 4507. \" + \"Length was \"\n + msg.getExtensionLength().getValue());\n }\n if (msg.getExtensionLength().getValue() > 0) {\n LOGGER.debug(\"Parsing session ticket as resumption offer\");\n msg.getSessionTicket().setIdentityLength(msg.getExtensionLength().getValue());\n msg.getSessionTicket()\n .setIdentity(parseByteArrayField(msg.getSessionTicket().getIdentityLength().getValue()));\n SessionTicketParser ticketParser =\n new SessionTicketParser(0, msg.getSessionTicket().getIdentity().getValue(), msg.getSessionTicket(),\n configTicketKeyName, configCipherAlgorithm, configMacAlgorithm);\n ticketParser.parse();\n } else {\n LOGGER.debug(\"Parsing extension as indication for ticket support\");\n msg.getSessionTicket().setIdentity(new byte[0]);\n msg.getSessionTicket().setIdentityLength(0);\n LOGGER.debug(\"Parsed session ticket identity \" + bytesToHexString(msg.getSessionTicket().getIdentity()));\n }\n }", "public byte[] getPayload();", "@Override\r\n public void handleMessage(Message msg) {\n }", "public String getPayload() {\n return payload;\n }", "public String getPayload() {\n return payload;\n }", "public void sendMessage(WebSocketSession session, MessageEntity message) throws JsonProcessingException {\n\n ObjectMapper mapper = new ObjectMapper();\n String jsonStringMessage = mapper.writeValueAsString(message);\n TextMessage msg = new TextMessage(jsonStringMessage);\n\n try {\n\n session.sendMessage(msg);\n } catch (IOException e) {\n\n e.printStackTrace();\n }\n }", "@Override\n\tpublic void onMessage(Message message) {\n\t\tSystem.out.println(message.getBody());\n\t}", "public void processMessage(byte[] message) {\n try {\n Object receivedMessage = Serializer.deserialize(message);\n processMessage(receivedMessage);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }\n }", "public interface Message extends Serializable {\n\t/**\n\t * Kui server saab kliendi sõnumi vastu\n\t * @param s kliendi sessioon\n\t */\n\tvoid onReceive(ClientSession s);\n\t/**\n\t * Kui klient võtab serveri sõnumi\n\t * \n\t * @param c - Client\n\t */\n\tvoid onReceive(Client c);\n\t/**\n\t * Meetod tagastab adressaadi.\n\t * @return aadress, kellele sõnu saadetakse\n\t */\n\tString getAdress();\n}", "@Override\n public void onMessageReceived(String receivedMessage) {\n try {\n JSONObject jsonFromString = new JSONObject(receivedMessage);\n\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "void messageReceived(IMSession session, Message message);", "public interface Message extends Serializable {\n\t/**\n\t * set current message object\n\t * @param messageObject\n\t * @throws UtilsException\n\t */\n\tpublic void setObjet(Object messageObject) throws UtilsException;\n\t\n\t/**\n\t * return current's message object\n\t * @return\n\t */\n\tpublic Object getObject() ;\n\t\n\t/**\n\t * return true if this message match filter\n\t * @param filter\n\t * @return\n\t */\n\tpublic boolean matchFilter(Map<String,String> filter);\n\t\n\t/**\n\t * add a new text property to current message\n\t * @param propertyName\n\t * @param propertyValue\n\t * @throws UtilsException\n\t */\n\tpublic void setStringProperty(String propertyName,String propertyValue) throws UtilsException;\n\n\tvoid rewriteStringProperty(String propertyName,String propertyValue) throws UtilsException;\n\t\n\t/**\n\t * return value of property propertyName\n\t * @param propertyName\n\t * @return\n\t */\n\tpublic String getStringProperty(String propertyName) ;\n}", "default Message brokerMessageToRouterMessage(MessageBroker.ReceivedMessage message) {\n return new Message() {\n\n @Override\n public Map<String, Object> metadata() {\n return message.metadata();\n }\n\n @Override\n public Object body() {\n return message.body();\n }\n\n @Override\n public byte[] rawBody() {\n return message.rawBody();\n }\n\n @Override\n public MessageBroker.ReceivedMessage underlyingMessage() {\n return message;\n }\n };\n }", "void interpretMessage(final Message message);", "@Override\n\tpublic Message getPayload() {\n\t\treturn null;\n\t}", "void handleMessage(byte messageType, Object message);", "protected void handleInboundMessage(Object msg) {\n/* 748 */ inboundMessages().add(msg);\n/* */ }", "void storeDataFlow(DataFlow msg);", "abstract void onMessage(byte[] message);", "abstract public Object handleMessage(Object message) throws Exception;", "@Override\n public void receiveMessage(String message) {\n }", "@Override\n public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) {\n listener.update(String.valueOf(message.getPayload()));\n }", "public void newADMsg(OL_Message msg) {\n socket.appmsgArrived(msg, socket.callback);\n setADMsg(msg);\n myState = HavePayload;\n messageStore.setTimer(this, DELETE_TIMER_INDEX, delete);\n }", "@Override\n public void handle(Message<JsonObject> message) {\n logger.info(\"Handling event conjoiner.simplevertical\");\n\n // Start by deserializing the message back into a Object\n try {\n TransponderMessage msg = new TransponderMessage().messageToObject(message);\n logger.info(\"Decoded message: \" + msg.toJsonString());\n\n } catch (DataFormatException e) {\n e.printStackTrace();\n logger.warning(\"Unable to deserialize this\");\n }\n\n }", "public static Map<String, String> messageToMap(Message msg) {\n Map<String, String> map = new HashMap<>();\n if (msg == null) return map;\n\n if (msg.fixedHeader().messageType() == MqttMessageType.PUBLISH) {\n MqttPublishVariableHeader variableHeader = (MqttPublishVariableHeader) msg.variableHeader();\n MqttPublishPayload payload = (MqttPublishPayload) msg.payload();\n map.put(\"type\", String.valueOf(MqttMessageType.PUBLISH.value()));\n map.put(\"retain\", BooleanUtils.toString(msg.fixedHeader().retain(), \"1\", \"0\"));\n map.put(\"qos\", String.valueOf(msg.fixedHeader().qos().value()));\n map.put(\"dup\", BooleanUtils.toString(msg.fixedHeader().dup(), \"1\", \"0\"));\n map.put(\"version\", msg.additionalHeader().version().toString());\n if (!msg.fixedHeader().retain()) map.put(\"clientId\", msg.additionalHeader().clientId());\n map.put(\"userName\", msg.additionalHeader().userName());\n map.put(\"topicName\", variableHeader.topicName());\n if (!msg.fixedHeader().retain()) map.put(\"packetId\", String.valueOf(variableHeader.packetId()));\n if (payload != null && payload.bytes() != null && payload.bytes().length > 0) try {\n map.put(\"payload\", new String(payload.bytes(), \"ISO-8859-1\"));\n } catch (UnsupportedEncodingException ignore) {\n }\n return map;\n } else if (msg.fixedHeader().messageType() == MqttMessageType.PUBREL) {\n MqttPacketIdVariableHeader variableHeader = (MqttPacketIdVariableHeader) msg.variableHeader();\n map.put(\"type\", String.valueOf(MqttMessageType.PUBREL.value()));\n map.put(\"version\", msg.additionalHeader().version().toString());\n map.put(\"clientId\", msg.additionalHeader().clientId());\n map.put(\"userName\", msg.additionalHeader().userName());\n map.put(\"packetId\", String.valueOf(variableHeader.packetId()));\n return map;\n } else {\n throw new IllegalArgumentException(\"Invalid in-flight MQTT message type: \" + msg.fixedHeader().messageType());\n }\n }", "public String getPayload() {\n return this.payload;\n }", "public ParcelableMessage(Message message) {\n\t\tsuper(message);\n\t}", "public String getPayload() {\n return payload;\n }", "DynamicMessage createDynamicMessage();", "com.google.protobuf.ByteString getPayload();", "com.google.protobuf.ByteString getPayload();", "protected final Object getPayload() {\r\n return this.payload;\r\n }", "public void onMessage(Session session, Object message) throws IOException {\n\t}", "public synchronized StompFrame nextMessage() {\n String message = null;\n int messageEnd = this._stringBuf.indexOf(this._messageSeparator);\n if (messageEnd > -1) {\n message = this._stringBuf.substring(0, messageEnd + this._messageSeparator.length());\n this._stringBuf.delete(0, messageEnd+this._messageSeparator.length());\n }\n System.out.println(\"Server recieved the following message: \" + message);\n return constructMessage(message);\n }", "@Override\n\tprotected void doReceiveMessage(Message msg) {\n\t\tdeliverMessage(msg);\n\t}", "@OnWebSocketMessage\n public void recibiendoMensaje(Session usuario, String message) {\n\n\n System.out.println(\"Recibiendo del cliente: \"+usuario.getLocalAddress().getAddress().toString()+\" - Mensaje \"+message);\n try {\n\n String[] mensaje = message.split(\"~\") ;\n\n\n\n System.out.println(mensaje[0]);\n System.out.println(mensaje[1]);\n\n\n switch (mensaje[1]){\n\n case \"iniciarSesion\":\n usuarios.put(usuario, mensaje[0].trim());\n sesiones.put(mensaje[0].trim(), usuario);\n\n break;\n case \"iniciarSesionAdmin\":\n sesionAdmin = usuario;\n break;\n case \"mensajeNuevo\":\n\n if(sesionAdmin != null){\n System.out.println(mensaje[0]);\n sesionAdmin.getRemote().sendString(mensaje[0] +\"~\"+ usuarios.get(usuario) );\n }\n break;\n\n case \"mensajeNuevoAdmin\":\n String destino = mensaje[2];\n\n Session sesionDestino = sesiones.get(destino);\n if(sesionDestino != null){\n System.out.println(destino);\n sesionDestino.getRemote().sendString(mensaje[0] +\"~\"+sesiones.get(usuario));\n }\n break;\n\n\n }\n\n\n\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "protected void handleMessage(Message msg) {}", "@Override\n public void handleTextMessage(WebSocketSession session, TextMessage message) throws IOException {\n// \tlogger.info(\"Server received text: {}\", message.getPayload());\n \tMessage msg = messageEncoderDecoder.deserialize(message.getPayload(), Message.class);\n\t\tlogger.info(\"Message received: {}\", msg.getClass().getSimpleName());\n\n \tif (msg instanceof MapCreateRequested)\n \t{\n \t\tlogger.info(\"MapCreateRequested received!\");\n \t\tmaps.registerNewMap(new WebSocketClient(session), \"initName\");\n \t}\n \telse if (msg instanceof GenericMapUpdateRequested)\n \t{\n \t\tlogger.info(\"MapUpdateRequested received!\");\n \t\tGenericMapUpdateRequested msgMapUpdateRequested = (GenericMapUpdateRequested)msg;\n \t\tGenericUpdateBlockCompleted updateBlockCompleted = msgMapUpdateRequested.update();\n\n \t\tmaps.processMapUpdates(new WebSocketClient(session), updateBlockCompleted);\n \t}\n }", "public Payload.Outbound getOutboundPayload();", "@Override\n public void onMessage(String data) {\n\n log.e(\"ipcChannel received message: [\" + data + \"]\");\n\n try {\n JSONObject json = new JSONObject(data);\n\n onIpcMessage(json);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "@Override\n\tpublic void messageReceived(IoSession session, Object message) throws Exception {\n\t\t\n\t\tSmsObject sms = (SmsObject) message;\n\t\t//log.info(\"The message is [\" + sms.getMessage() + \"]\");\n\n\t\t/*\n\t\t * other operate\n\n\t\tSystem.out.println(\"================================================\");\n\t\tSystem.out.println(\"Data From : \" + session.getRemoteAddress());\n\t\tSystem.out.println(\"Receiver : [\" + sms.getReceiver() + \"]\");\n\t\tSystem.out.println(\"Data Type : [\" + sms.getDataType() + \"]\");\n\t\tSystem.out.println(\"Data Receiver : [\" + sms.getDataReceiver() + \"]\");\n\t\tSystem.out.println(\"Data Sender : [\" + sms.getDataSender() + \"]\");\n\t\tSystem.out.println(\"Data : [\" + sms.getData() + \"]\");\n\t\tSystem.out.println(\"================================================\");\n\t\t\n\t\t * */\t\n\t\t\n\t\t//The processing of registration information \n\t\tInteger i = new Integer(255);\n\t\tif( i.equals(sms.getReceiver()) &&\n\t\t\ti.equals(sms.getDataType()) &&\n\t\t\ti.equals(sms.getDataReceiver()) &&\n\t\t\ti.equals(sms.getDataSender())) {\n\t\t\t\n\t\t\tcli.addCli(session, sms.getData());\n\t\t\tSystem.out.println(\"Client : \" + session.getRemoteAddress() + \" DONE\");\n\t\t} else {\n\t\t\t//Forwarding\n\t\t\tArrayList<IoSession> tempList = new ArrayList<IoSession>();\n\t\t\ttempList = cli.getCli(sms.getReceiver());\n\t\t\t\n\t\t\tSystem.out.println(\"tempting=======>\" + session.getRemoteAddress() + \" with receiver : \" + sms.getReceiver());\n\t\t\tif(tempList != null) {\n\t\t\t\t//System.out.println(\"true\");\n\t\t\t\tfor (IoSession session1 : tempList){\n\t\t\t\t\tSystem.out.println(\"Send =========>\" + session1.getRemoteAddress());\n\t\t\t\t\tsession1.write(sms);\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"================================================\");\n\t\t\t}\n\t\t\telse System.out.println(\"forwarding false\");\n\t\t}\n\t\t\n\t\t//Trigger the client\n\t\tsms.setReceiver(i);\n\t\tsms.setDataType(i);\n\t\tsms.setDataReceiver(i);\n\t\tsms.setDataSender(i);\n\t\tsms.setData(\" \");\n\t\tsession.write(sms);\n\n\t}", "public byte[] fromMessage(Message message) throws IOException, JMSException;", "@Override\n protected void decode(ChannelHandlerContext ctx, Message msg, List<Object> out) throws Exception \n {\n GameAppContext context = ctx.channel().attr(GameAppContextKey.KEY).get();\n \n // and let the context decide what to do with the message\n context.handleMessage(msg);\n \n // we dont break the cycle here - maybe other handlers sit behind this one\n out.add(msg);\n }", "public abstract void stickerMessage(Message m);", "byte[] getStructuredData(String messageData);", "@Override\n protected void prepareHandshakeMessageContents() {\n }", "@Override\r\n\tpublic JT808ProtocalPack receive(String message) throws Exception {\n\t\treturn null;\r\n\t}", "public Message toMessage(Object message, Session session) throws JMSException, MessageConversionException {\r\n \t\tjavax.jms.Message jmsMessage = null;\r\n \t\tif (serializeToString){\r\n \t\t\tjmsMessage = session.createTextMessage(message.toString());\r\n \t\t} else if (message instanceof Serializable) {\r\n \t\t\tSerializable serializable = (Serializable) message;\r\n \t\t\tjmsMessage = session.createObjectMessage(serializable);\r\n \t\t}\r\n \t\treturn jmsMessage;\r\n \t}", "private void decode_message(String receivedMessage) {\n String[] messageComponents = receivedMessage.split(\"##\");\n String actionName = messageComponents[0];\n int actionType = caseMaps.get(actionName);\n\n switch (actionType) {\n case 1:\n String nodeToConnect = messageComponents[1];\n break;\n case 2:\n String receivedPrevNode = messageComponents[1].split(\"&&\")[0];\n String receivedNextNode = messageComponents[1].split(\"&&\")[1];\n break;\n case 3:\n String key = messageComponents[1].split(\"&&\")[0];\n String value = messageComponents[1].split(\"&&\")[1];\n insertIntoDB(key,value);\n break;\n case 4:\n String portRequested = messageComponents[1].split(\"&&\")[0];\n String AllMessages = messageComponents[1].split(\"&&\")[1];\n break;\n case 5:\n String portRequestedSelect = messageComponents[1].split(\"&&\")[0];\n String selection = messageComponents[1].split(\"&&\")[1];\n break;\n case 6:\n String selectionDelete = messageComponents[1];\n DeleteKeys(selectionDelete);\n break;\n default:\n }\n\n }", "private String getValueFromMessage(TextMessage message, String key){\n Map data = new Gson().fromJson(message.getPayload(),Map.class);\n return (String) data.get(key);\n }", "@MessageMapping(\"/chat.addUser\")\n @SendTo(\"/topic/publicChatRoom\")\n public Message addUser(@Payload Message chatMessage, SimpMessageHeaderAccessor headerAccessor) {\n headerAccessor.getSessionAttributes().put(\"username\", chatMessage.getSender());\n headerAccessor.getSessionAttributes().put(\"usercolor\", \"red\");\n\n return chatMessage;\n }", "@Override\n\tpublic void getMessage(TranObject msg) {\n\n\t}", "@Override\n\tpublic void msgReceived(Message msg) {\n\n\t}", "@Override\n\tpublic void onMessageRecieved(Message arg0) {\n\t\t\n\t}", "@Override\n\tpublic void process(MessageStream<ServerMessage> message)\n\t{\n\t\t\n\t}", "public void setInboundPayload(Payload.Inbound newInboundPayload);", "void systemMessageReceived(IMSession session, Message message);", "public String readMessage() {\r\n return new String(readMessageAsByte());\r\n }", "@MessageMapping(\"/chat.register\")\n @SendTo(\"/topic/public\")\n public Message register(@Payload Message message, SimpMessageHeaderAccessor simpMessageHeaderAccessor) {\n simpMessageHeaderAccessor.getSessionAttributes().put(\"username\", message.getAuthor());\n return message;\n }" ]
[ "0.71300435", "0.625361", "0.61412394", "0.6129184", "0.60249114", "0.6018496", "0.5986007", "0.5959021", "0.5942473", "0.59386796", "0.5924417", "0.5921824", "0.5905807", "0.5855329", "0.58498526", "0.5819122", "0.5797749", "0.5783391", "0.57650614", "0.57558537", "0.57118523", "0.57054365", "0.5702936", "0.5702936", "0.5700264", "0.569879", "0.56967336", "0.5690565", "0.5683017", "0.565342", "0.5650311", "0.56474626", "0.5645561", "0.5645486", "0.56353515", "0.5629634", "0.56245667", "0.5620195", "0.56148523", "0.55937636", "0.5581779", "0.5579435", "0.55777824", "0.55674905", "0.5546756", "0.5546756", "0.5545798", "0.5542609", "0.55425274", "0.5540341", "0.5535727", "0.5532518", "0.55140924", "0.55115765", "0.5507169", "0.5498655", "0.54978", "0.5493809", "0.5484304", "0.5482144", "0.54790795", "0.5478186", "0.5473617", "0.54602164", "0.54578114", "0.5457773", "0.54448205", "0.5440113", "0.5439476", "0.5436437", "0.54319435", "0.54319435", "0.5428272", "0.54262084", "0.5425304", "0.5421145", "0.541941", "0.54070705", "0.5397879", "0.5393546", "0.53896016", "0.53870225", "0.53639984", "0.53633374", "0.5358557", "0.53556097", "0.5348802", "0.5345257", "0.5334987", "0.5320259", "0.53199583", "0.53182125", "0.5308538", "0.530759", "0.53038585", "0.53013617", "0.529686", "0.5279831", "0.5279535", "0.5272146" ]
0.6458071
1
Sets the private and public keys of the SecretServer, which are found by parsing the relevant text files for public keys and private keys of registered users of this secret server storage service. Also sets up arrays of public keys for all registered users for efficient use and access. NOTE: This is a simulation. In a real setting, the private keys would be native to individuals' accounts and not stored together in a file.
private final void configureKeys() { // SecretServer's public key String line = ComMethods.getValueFor("SecretServer", pubkeysfn); int x = line.indexOf(','); my_n = new BigInteger(line.substring(0,x)); my_e = new Integer(line.substring(x+1,line.length())); // SecretServer's private key line = ComMethods.getValueFor("SecretServer", privkeysfn); x = line.indexOf(','); my_d = new BigInteger(line.substring(x+1,line.length())); // Public keys for all registered Users usersPubKeys1 = new BigInteger[validUsers.length]; usersPubKeys2 = new int[validUsers.length]; for (int i=0; i<validUsers.length; i++) { line = ComMethods.getValueFor(validUsers[i], pubkeysfn); x = line.indexOf(','); usersPubKeys1[i] = new BigInteger(line.substring(0,x)); usersPubKeys2[i] = new Integer(line.substring(x+1,line.length())); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void saveKeys(String publicKeyFileLocation, String secretKeyFileLocation) throws IOException;", "void saveKeys(PGPPublicKeyRingCollection publicKeyRings, PGPSecretKeyRingCollection secretKeyRings, String publicKeyFileLocation, String secretKeyFileLocation) throws IOException;", "public void generateKeys() {\r\n try {\r\n SecureRandom random = SecureRandom.getInstance(Constants.SECURE_RANDOM_ALGORITHM);\r\n KeyPairGenerator generator = KeyPairGenerator.getInstance(Constants.ALGORITHM);\r\n generator.initialize(Constants.KEY_BIT_SIZE, random);\r\n \r\n KeyPair keys = generator.genKeyPair();\r\n \r\n persistPrivateKey(keys.getPrivate().getEncoded());\r\n persistPublicKey(keys.getPublic().getEncoded());\r\n logger.log(Level.INFO, \"Done with generating persisting Public and Private Key.\");\r\n \r\n } catch (NoSuchAlgorithmException ex) {\r\n logger.log(Level.SEVERE, \"En error occured while generating the Public and Private Key\");\r\n }\r\n }", "public void setAuthKeysFromTextFile(String textFile) {\n\n\t\ttry (Scanner scan = new Scanner(getClass().getResourceAsStream(textFile))) {\n\n\t\t\tString apikeyLine = scan.nextLine(), secretLine = scan.nextLine();\n\n\t\t\tapikey = apikeyLine.substring(apikeyLine.indexOf(\"\\\"\") + 1, apikeyLine.lastIndexOf(\"\\\"\"));\n\t\t\tsecret = secretLine.substring(secretLine.indexOf(\"\\\"\") + 1, secretLine.lastIndexOf(\"\\\"\"));\n\n\t\t} catch (NullPointerException | IndexOutOfBoundsException e) {\n\n\t\t\tSystem.err.println(\"Text file not found or corrupted - please attach key & secret in the format provided.\");\n\t\t}\n\t}", "public void writeKeysToFile(){\n if(d == null){\n calculateKeypair();\n }\n FileHandler fh = new FileHandler();\n fh.writeFile(sbPrivate.toString(), \"sk.txt\");\n fh.writeFile(sbPublic.toString(), \"pk.txt\");\n }", "private void configureKeys(String accountName) {\n\t\t// accountName's public key\n\t\tString line = ComMethods.getValueFor(accountName, pubkeysfn);\n\t\tint x = line.indexOf(',');\n\t\tmy_n = new BigInteger(line.substring(0,x));\n\t\tmy_e = new Integer(line.substring(x+1,line.length()));\n\n\t\t// accountName's private key\n\t\tline = ComMethods.getValueFor(accountName, privkeysfn);\n\t\tx = line.indexOf(',');\n\t\tmy_d = new BigInteger(line.substring(x+1,line.length()));\n\t\t\t\n\t\t// SecretServer's public key\n\t\tline = ComMethods.getValueFor(\"SecretServer\", pubkeysfn);\n\t\tx = line.indexOf(',');\n\t\tserv_n = new BigInteger(line.substring(0,x));\n\t\tserv_e = new Integer(line.substring(x+1,line.length()));\n\t}", "Set getLocalKeySet();", "public static void publicAndPrivateKeys() throws Exception {\n Metered metered = new Metered();\n // Set public and private keys\n metered.setMeteredKey(\"your-public-key\", \"your-private-key\");\n // ExEnd:PublicAndPrivateKeys\n }", "private static void createKeyFiles(String pass, String publicKeyFilename, String privateKeyFilename) throws Exception {\n\t\tString password = null;\n\t\tif (pass.isEmpty()) {\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tSystem.out.print(\"Password to encrypt the private key: \");\n\t\t\tpassword = in.readLine();\n\t\t\tSystem.out.println(\"Generating an RSA keypair...\");\n\t\t} else {\n\t\t\tpassword = pass;\n\t\t}\n\t\t\n\t\t// Create an RSA key\n\t\tKeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(\"RSA\");\n\t\tkeyPairGenerator.initialize(1024);\n\t\tKeyPair keyPair = keyPairGenerator.genKeyPair();\n\n\t\tSystem.out.println(\"Done generating the keypair.\\n\");\n\n\t\t// Now we need to write the public key out to a file\n\t\tSystem.out.print(\"Public key filename: \");\n\n\t\t// Get the encoded form of the public key so we can\n\t\t// use it again in the future. This is X.509 by default.\n\t\tbyte[] publicKeyBytes = keyPair.getPublic().getEncoded();\n\n\t\t// Write the encoded public key out to the filesystem\n\t\tFileOutputStream fos = new FileOutputStream(publicKeyFilename);\n\t\tfos.write(publicKeyBytes);\n\t\tfos.close();\n\n\t\t// Now we need to do the same thing with the private key,\n\t\t// but we need to password encrypt it as well.\n\t\tSystem.out.print(\"Private key filename: \");\n \n\t\t// Get the encoded form. This is PKCS#8 by default.\n\t\tbyte[] privateKeyBytes = keyPair.getPrivate().getEncoded();\n\n\t\t// Here we actually encrypt the private key\n\t\tbyte[] encryptedPrivateKeyBytes = passwordEncrypt(password.toCharArray(), privateKeyBytes);\n\n\t\tfos = new FileOutputStream(privateKeyFilename);\n\t\tfos.write(encryptedPrivateKeyBytes);\n\t\tfos.close();\n\t}", "private void storeKeys(String key, String secret) {\n\t // Save the access key for later\n\t SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);\n\t Editor edit = prefs.edit();\n\t edit.putString(ACCESS_KEY_NAME, key);\n\t edit.putString(ACCESS_SECRET_NAME, secret);\n\t edit.commit();\n\t }", "public KeyGenerator() {\n this.publicList = new SinglyLinkedList();\n this.privateList = new PrivateKey();\n }", "public void setKeyEncode(byte[] keys) {\n\t\ttry {\n\t\t\tthis.key = (SecretKey) new SecretKeySpec(keys, algorithm);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void storeKeys(String key, String secret) {\n\t\t// Save the access key for later\n\t\tSharedPreferences prefs = EReaderApplication.getAppContext()\n\t\t\t\t.getSharedPreferences(ACCOUNT_PREFS_NAME, 0);\n\t\tEditor edit = prefs.edit();\n\t\tedit.putString(ACCESS_KEY_NAME, key);\n\t\tedit.putString(ACCESS_SECRET_NAME, secret);\n\t\tedit.commit();\n\t}", "public void setKeys(String keys) {\r\n this.keys = keys;\r\n }", "public void initializeKeys(@NonNull String serverToken, @NonNull String clientToken, @NonNull BinaryArray encKey, @NonNull BinaryArray macKey) {\n this.encKey(encKey)\n .macKey(macKey)\n .serverToken(serverToken)\n .clientToken(clientToken);\n serialize();\n }", "private static void setupKeysAndCertificates() throws Exception {\n // set up our certificates\n //\n KeyPairGenerator kpg = KeyPairGenerator.getInstance(\"RSA\", \"BC\");\n\n kpg.initialize(1024, new SecureRandom());\n\n String issueDN = \"O=Punkhorn Software, C=US\";\n issueKP = kpg.generateKeyPair();\n issueCert = Utils.makeCertificate(\n issueKP, issueDN, issueKP, issueDN);\n\n //\n // certificate we sign against\n //\n String signingDN = \"CN=William J. Collins, [email protected], O=Punkhorn Software, C=US\";\n signingKP = kpg.generateKeyPair();\n signingCert = Utils.makeCertificate(\n signingKP, signingDN, issueKP, issueDN);\n\n certList = new ArrayList<>();\n\n certList.add(signingCert);\n certList.add(issueCert);\n\n decryptingKP = signingKP;\n\n }", "public void storeKeys(String key, String secret) {\n // Save the access key for later\n SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);\n Editor edit = prefs.edit();\n edit.putString(ACCESS_KEY_NAME, key);\n edit.putString(ACCESS_SECRET_NAME, secret);\n edit.commit();\n }", "private static void keyPairGenerator() throws NoSuchAlgorithmException, IOException {\n KeyPairGenerator kpg = KeyPairGenerator.getInstance(\"RSA\");\n kpg.initialize(2048);\n KeyPair keyPair = kpg.generateKeyPair();\n\n //Get public and private keys\n Key publicKey = keyPair.getPublic();\n Key privateKey = keyPair.getPrivate();\n\n String outFile = files_path + \"/Client_public\";\n PrintStream out = null;\n out = new PrintStream(new FileOutputStream(outFile + \".key\"));\n out.write(publicKey.getEncoded());\n out.close();\n\n outFile = files_path + \"/Client_private\";\n out = new PrintStream(new FileOutputStream(outFile + \".key\"));\n out.write(privateKey.getEncoded());\n out.close();\n\n System.err.println(\"Private key format: \" + privateKey.getFormat());\n // prints \"Private key format: PKCS#8\" on my machine\n\n System.err.println(\"Public key format: \" + publicKey.getFormat());\n // prints \"Public key format: X.509\" on my machine\n\n }", "private static void initVoters() {\n\t\t try {\n\t\t\t FileWriter fw = new FileWriter(\"myfile.csv\");\n\t\t\t PrintWriter writer = new PrintWriter(fw);\n\t\t\t for(int i=0; i<10; i++) {\n\t\t\t \tKeyPair key = Crypto.generateKeys();\n\t\t\t \twriter.println(Crypto.getPrivateKeyasString(key)+\",\"+Crypto.getPublicKeyasString(key)+\"\\n\");\n\t\t\t }\n\t\t\t writer.close();\n\t\t\t}\n\t\t\tcatch (IOException ex) {\n\t\t\t System.out.println(\"An error occured :: \" + ex.getMessage());\n\t\t\t}\n\t\t }", "public Server(){\n\t\tusers = new HashMap<String, Vector<Integer>>();\n\t}", "public static void setSecret(byte[] bytes)\r\n/* 149: */ {\r\n/* 150: */ try\r\n/* 151: */ {\r\n/* 152:131 */ setPropertyBytes(\"secret\", bytes);\r\n/* 153: */ }\r\n/* 154: */ catch (Exception e)\r\n/* 155: */ {\r\n/* 156:133 */ log.warning(\"Error setting secret: \" + e.getMessage());\r\n/* 157: */ }\r\n/* 158: */ }", "void saveKeys() throws IOException;", "public void setSecretKey(byte[] secretKey) {\n this.secretKey = secretKey;\n }", "public static void setStaticKerbyProperties(String _user, String _pass) throws NoSuchAlgorithmException, InvalidKeySpecException {\r\n\t\tuser = _user;\r\n\t\tpass = SecurityHelper.generateKeyFromPassword(_pass);\r\n\t}", "ArrayList<ExportedKeyData> generatePublicKeyList(PGPPublicKeyRingCollection publicKeyRings, PGPSecretKeyRingCollection secretKeyRings);", "@Test\n\tpublic void testSecuirtyConfigsOperations() throws NoSuchAlgorithmException {\n\t\t// Generate and store keys for the first time\n\t\tServerKeyPairs serverKeyPairs1 = new ServerKeyPairs();\n\t\tKeyPair encryptionKeyPair1 = serverKeyPairs1.getEncryptionKeyPair();\n\t\tKeyPair signatureKeyPair1 = serverKeyPairs1.getSignatureKeyPair();\n\n\t\t// Initialize a new serverKeyPairs to test that it will only read\n\t\t// previously generated keys\n\t\tServerKeyPairs serverKeyPairs2 = new ServerKeyPairs();\n\t\tKeyPair encryptionKeyPair2 = serverKeyPairs2.getEncryptionKeyPair();\n\t\tKeyPair signatureKeyPair2 = serverKeyPairs2.getSignatureKeyPair();\n\n\t\tassertEquals(\"Wrong loaded encryption public key modulas parameter\",\n\t\t\t\t((RSAPublicKey) encryptionKeyPair1.getPublic()).getModulus(),\n\t\t\t\t((RSAPublicKey) encryptionKeyPair2.getPublic()).getModulus());\n\n\t\tassertEquals(\"Wrong loaded encryption public key exponent parameter\",\n\t\t\t\t((RSAPublicKey) encryptionKeyPair1.getPublic()).getPublicExponent(),\n\t\t\t\t((RSAPublicKey) encryptionKeyPair2.getPublic()).getPublicExponent());\n\n\t\tassertEquals(\"Wrong loaded encryption private key modulas parameter\",\n\t\t\t\t((RSAPrivateKey) encryptionKeyPair1.getPrivate()).getModulus(),\n\t\t\t\t((RSAPrivateKey) encryptionKeyPair2.getPrivate()).getModulus());\n\n\t\tassertEquals(\"Wrong loaded encryption private key exponent parameter\",\n\t\t\t\t((RSAPrivateKey) encryptionKeyPair1.getPrivate()).getPrivateExponent(),\n\t\t\t\t((RSAPrivateKey) encryptionKeyPair2.getPrivate()).getPrivateExponent());\n\n\t\tassertEquals(\"Wrong loaded signature public key modulas parameter\",\n\t\t\t\t((RSAPublicKey) signatureKeyPair1.getPublic()).getModulus(),\n\t\t\t\t((RSAPublicKey) signatureKeyPair2.getPublic()).getModulus());\n\n\t\tassertEquals(\"Wrong loaded signature public key exponent parameter\",\n\t\t\t\t((RSAPublicKey) signatureKeyPair1.getPublic()).getPublicExponent(),\n\t\t\t\t((RSAPublicKey) signatureKeyPair2.getPublic()).getPublicExponent());\n\n\t\tassertEquals(\"Wrong loaded signature private key modulas parameter\",\n\t\t\t\t((RSAPrivateKey) signatureKeyPair1.getPrivate()).getModulus(),\n\t\t\t\t((RSAPrivateKey) signatureKeyPair2.getPrivate()).getModulus());\n\n\t\tassertEquals(\"Wrong loaded signature private key exponent parameter\",\n\t\t\t\t((RSAPrivateKey) signatureKeyPair1.getPrivate()).getPrivateExponent(),\n\t\t\t\t((RSAPrivateKey) signatureKeyPair2.getPrivate()).getPrivateExponent());\n\t}", "public SecretServer(boolean simMode) {\n\t\tthis.simMode = simMode;\n\n\t\tsecretsfn = \"secrets.txt\";\n\t\thashfn = \"hashes.txt\";\n\t\tpubkeysfn = \"publickeys.txt\";\n\t\tprivkeysfn = \"privatekeys.txt\";\n\t\tvalidusersfn = \"validusers.txt\";\n\n\t\tvalidUsers = ComMethods.getValidUsers();\n\t\tconfigureKeys();\n\t\tuserNum = -1;\n\t\tmyNonce = null;\n\t\tcurrentUser = null;\n\t\tcurrentPassword = null;\n\t\tcurrentSessionKey = null;\n\t\tuserSet = false;\n\t\tpassVerified = false;\n\t\tactiveSession = false;\n\t\tcounter = -1;\t\t\n\t}", "static void saveAllPlayersToFiles(){\n \tfor( String playername : GoreaProtect.playersData.getKeys(false))\n \t{\n \t\tFile playerfile = new File(GoreaProtect.datafolder + File.separator + \"Protections\");\n \t\tFile fileplayer= new File(playerfile, playername + \".yml\");\n\n \t\tConfigurationSection playerdata = GoreaProtect.playersData.getConfigurationSection(playername);\n\n \t\tYamlConfiguration PlayersDatayml = new YamlConfiguration();\n\n \t\tfor (String aaa:playerdata.getKeys(false))\n \t\tPlayersDatayml.set(aaa, playerdata.get(aaa));\n \t\t\n \t\t\n \t\ttry {\n\t\t\t\tPlayersDatayml.save(fileplayer);\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t} \n \t} \n }", "public void generateKeys()\n\t{\n\t\tmyP = BigInteger.probablePrime(myView.getBitLength(), rand());\n\t\tmyQ = BigInteger.probablePrime(myView.getBitLength(), rand());\n\t\tif(confirmPrimes(myP, myQ))\n\t\t{\n\t\t\tpublicKey = myP.multiply(myQ);\n\t\t\tmyView.displayPublicKey(publicKey.toString());\n\t\t\tmyPhi = (myP.subtract(BigInteger.ONE).multiply(myQ.subtract(BigInteger.ONE)));\n\t\t\tprivateKey = E.modInverse(myPhi);\n\t\t\tmyView.displayPrivateKey(privateKey.toString());\n\t\t}\n\t\telse\n\t\t{\n\t\t\tgenerateKeys();\n\t\t}\n\t}", "private void getKeyAndCerts(String filePath, String pw)\n throws GeneralSecurityException, IOException {\n System.out\n .println(\"reading signature key and certificates from file \" + filePath + \".\");\n\n FileInputStream fis = new FileInputStream(filePath);\n KeyStore store = KeyStore.getInstance(\"PKCS12\", \"IAIK\");\n store.load(fis, pw.toCharArray());\n\n Enumeration<String> aliases = store.aliases();\n String alias = (String) aliases.nextElement();\n privKey_ = (PrivateKey) store.getKey(alias, pw.toCharArray());\n certChain_ = Util.convertCertificateChain(store.getCertificateChain(alias));\n fis.close();\n }", "public void setAPICredentials(String accessKey, String secretKey) {\n this.accessKey = accessKey;\n this.secretKey = secretKey;\n }", "public static void setServer(final MinecraftServer server) {\n synchronize();\n dataDirectory = server.func_240776_a_(BLOBS_FOLDER_NAME);\n try {\n Files.createDirectories(dataDirectory);\n } catch (final IOException e) {\n LOGGER.error(e);\n }\n }", "void computeSecrets() {\n final Bytes agreedSecret =\n signatureAlgorithm.calculateECDHKeyAgreement(ephKeyPair.getPrivateKey(), partyEphPubKey);\n\n final Bytes sharedSecret =\n keccak256(\n concatenate(agreedSecret, keccak256(concatenate(responderNonce, initiatorNonce))));\n\n final Bytes32 aesSecret = keccak256(concatenate(agreedSecret, sharedSecret));\n final Bytes32 macSecret = keccak256(concatenate(agreedSecret, aesSecret));\n final Bytes32 token = keccak256(sharedSecret);\n\n final HandshakeSecrets secrets =\n new HandshakeSecrets(aesSecret.toArray(), macSecret.toArray(), token.toArray());\n\n final Bytes initiatorMac = concatenate(macSecret.xor(responderNonce), initiatorMsgEnc);\n final Bytes responderMac = concatenate(macSecret.xor(initiatorNonce), responderMsgEnc);\n\n if (initiator) {\n secrets.updateEgress(initiatorMac.toArray());\n secrets.updateIngress(responderMac.toArray());\n } else {\n secrets.updateIngress(initiatorMac.toArray());\n secrets.updateEgress(responderMac.toArray());\n }\n\n this.secrets = secrets;\n }", "private void setServerList() {\n ArrayList<ServerObjInfo> _serverList =\n ServerConfigurationUtils.getServerListFromFile(mContext, ExoConstants.EXO_SERVER_SETTING_FILE);\n ServerSettingHelper.getInstance().setServerInfoList(_serverList);\n\n int selectedServerIdx = Integer.parseInt(mSharedPreference.getString(ExoConstants.EXO_PRF_DOMAIN_INDEX, \"-1\"));\n mSetting.setDomainIndex(String.valueOf(selectedServerIdx));\n mSetting.setCurrentServer((selectedServerIdx == -1) ? null : _serverList.get(selectedServerIdx));\n }", "protected void saveKeys()\r\n {\r\n try\r\n {\r\n log.info(\"{0}: Saving keys to: {1}, key count: {2}\",\r\n () -> logCacheName, () -> fileName, keyHash::size);\r\n\r\n keyFile.reset();\r\n\r\n final HashMap<K, IndexedDiskElementDescriptor> keys = new HashMap<>(keyHash);\r\n if (!keys.isEmpty())\r\n {\r\n keyFile.writeObject(keys, 0);\r\n }\r\n\r\n log.info(\"{0}: Finished saving keys.\", logCacheName);\r\n }\r\n catch (final IOException e)\r\n {\r\n log.error(\"{0}: Problem storing keys.\", logCacheName, e);\r\n }\r\n }", "@Test\n\tpublic void testServerManyClientsRegisterAllGetInnerWrite() throws Exception {\n\t\tKeyValueServer server = new KeyValueServer();\n\t\tArrayList<String> files = populateServer(server);\n\t\t//Set up fake clients\n\t\tKeyValueClient[] clients = new KeyValueClient[N_REPLICAS];\n\t\tString contentToWrite = \"testServerManyClientsRegisterAllGetInnerWrite.\" + System.currentTimeMillis() + \".\";\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tclients[i] = mock(KeyValueClient.class);\n\t\t\tfor (String p : files)\n\t\t\t\texpect(clients[i].innerWriteKey(eq(p.toString()), eq(contentToWrite + p.toString()), anyLong())).andReturn(true);\n\t\t\tclients[i].commitTransaction(anyLong());\n\t\t\texpectLastCall().anyTimes();\n\t\t\tclients[i].abortTransaction(anyLong());\n\t\t\texpectLastCall().anyTimes();\n\n\t\t\treplay(clients[i]);\n\t\t}\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tserver.registerClient(\"fake hostname\", 9000 + i, clients[i]);\n\t\t}\n\t\tfor (String p : files)\n\t\t\tserver.set(p.toString(), contentToWrite + p.toString());\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tserver.cacheDisconnect(\"fake hostname\", 9000 + i);\n\t\t}\n\t\tfor (KeyValueClient client : clients)\n\t\t\tverify(client);\n\n\t\t//Last, check that the server has all of the right files.\n\t\tKeyValueClient fake = mock(KeyValueClient.class);\n\t\tHashMap<String, String> endFiles = server.registerClient(\"fake\", 9, fake);\n\t\tfor (Map.Entry<String, String> e : endFiles.entrySet()) {\n\t\t\tString expected = contentToWrite + e.getKey();\n\t\t\tif (!e.getValue().equals(expected))\n\t\t\t\tfail(\"Writes were not saved on the server, expected file content \" + expected + \" but got \" + e.getValue());\n\t\t}\n\t}", "protected void loadKeys() {\n\t\tArrayList<String> lines = ContentLoader.getAllLinesOptList(this.keyfile);\n\t\tfor (String line : lines) {\n\t\t\tString[] parts = line.split(\"=\");\n\t\t\ttry {\n\t\t\t\tint fileID = Integer.parseInt(parts[0].trim());\n\t\t\t\tString restLine = parts[1].trim();\n\t\t\t\tString ccMethodName = restLine;\n\t\t\t\tif (restLine.indexOf('/') > 0) {\n\t\t\t\t\tint leftHashIndex = restLine.indexOf('/');\n\t\t\t\t\tccMethodName = restLine.substring(0, leftHashIndex).trim();\n\t\t\t\t}\n\t\t\t\t// String key = parts[0] + \".java\";\n\t\t\t\tkeyMap.put(fileID, ccMethodName);\n\t\t\t} catch (Exception exc) {\n\t\t\t\tSystem.err.println(line);\n\t\t\t}\n\t\t}\n\t}", "public void generateKeyPair() {\n\t\ttry {\n\t\t\tKeyPairGenerator keyGen = KeyPairGenerator.getInstance(\"DSA\", \"SUN\");\n\t\t\tSecureRandom random = SecureRandom.getInstance(\"SHA1PRNG\", \"SUN\");\n\t\t\tkeyGen.initialize(1024, random);\n\t\t\tKeyPair pair = keyGen.generateKeyPair();\n\t\t\tprivateKey = pair.getPrivate();\n\t\t\tpublicKey = pair.getPublic();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public String initAll(byte[] privateKeyFragment1, byte[] privateKeyFragment2, byte[] publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, Base64DecodingException, UnsupportedEncodingException, DestroyFailedException, DecoderException {\n initRsaOperations(privateKeyFragment1, privateKeyFragment2, publicKey);\n String preSharedKey = initAesOperations();\n initHmacOperations();\n return preSharedKey;\n }", "private void importKeyPair() {\n\t\t/*\n\t\t * Let the user choose a PKCS #12 file (keystore) containing a public\n\t\t * and private key pair to import\n\t\t */\n\t\tFile importFile = selectImportExportFile(\n\t\t\t\t\"PKCS #12 file to import from\", // title\n\t\t\t\tnew String[] { \".p12\", \".pfx\" }, // array of file extensions\n\t\t\t\t// for the file filter\n\t\t\t\t\"PKCS#12 Files (*.p12, *.pfx)\", // description of the filter\n\t\t\t\t\"Import\", // text for the file chooser's approve button\n\t\t\t\t\"keyPairDir\"); // preference string for saving the last chosen directory\n\n\t\tif (importFile == null)\n\t\t\treturn;\n\n\t\t// The PKCS #12 keystore is not a file\n\t\tif (!importFile.isFile()) {\n\t\t\tshowMessageDialog(this, \"Your selection is not a file\",\n\t\t\t\t\tALERT_TITLE, WARNING_MESSAGE);\n\t\t\treturn;\n\t\t}\n\n\t\t// Get the user to enter the password that was used to encrypt the\n\t\t// private key contained in the PKCS #12 file\n\t\tGetPasswordDialog getPasswordDialog = new GetPasswordDialog(this,\n\t\t\t\t\"Import key pair entry\", true,\n\t\t\t\t\"Enter the password that was used to encrypt the PKCS #12 file\");\n\t\tgetPasswordDialog.setLocationRelativeTo(this);\n\t\tgetPasswordDialog.setVisible(true);\n\n\t\tString pkcs12Password = getPasswordDialog.getPassword();\n\n\t\tif (pkcs12Password == null) // user cancelled\n\t\t\treturn;\n\t\telse if (pkcs12Password.isEmpty()) // empty password\n\t\t\t// FIXME: Maybe user did not have the password set for the private key???\n\t\t\treturn;\n\n\t\ttry {\n\t\t\t// Load the PKCS #12 keystore from the file\n\t\t\t// (this is using the BouncyCastle provider !!!)\n\t\t\tKeyStore pkcs12Keystore = credManager.loadPKCS12Keystore(importFile,\n\t\t\t\t\tpkcs12Password);\n\n\t\t\t/*\n\t\t\t * Display the import key pair dialog supplying all the private keys\n\t\t\t * stored in the PKCS #12 file (normally there will be only one\n\t\t\t * private key inside, but could be more as this is a keystore after\n\t\t\t * all).\n\t\t\t */\n\t\t\tNewKeyPairEntryDialog importKeyPairDialog = new NewKeyPairEntryDialog(\n\t\t\t\t\tthis, \"Credential Manager\", true, pkcs12Keystore, dnParser);\n\t\t\timportKeyPairDialog.setLocationRelativeTo(this);\n\t\t\timportKeyPairDialog.setVisible(true);\n\n\t\t\t// Get the private key and certificate chain of the key pair\n\t\t\tKey privateKey = importKeyPairDialog.getPrivateKey();\n\t\t\tCertificate[] certChain = importKeyPairDialog.getCertificateChain();\n\n\t\t\tif (privateKey == null || certChain == null)\n\t\t\t\t// User did not select a key pair for import or cancelled\n\t\t\t\treturn;\n\n\t\t\t/*\n\t\t\t * Check if a key pair entry with the same alias already exists in\n\t\t\t * the Keystore\n\t\t\t */\n\t\t\tif (credManager.hasKeyPair(privateKey, certChain)\n\t\t\t\t\t&& showConfirmDialog(this,\n\t\t\t\t\t\t\t\"The keystore already contains the key pair entry with the same private key.\\n\"\n\t\t\t\t\t\t\t\t\t+ \"Do you want to overwrite it?\",\n\t\t\t\t\t\t\tALERT_TITLE, YES_NO_OPTION) != YES_OPTION)\n\t\t\t\treturn;\n\n\t\t\t// Place the private key and certificate chain into the Keystore\n\t\t\tcredManager.addKeyPair(privateKey, certChain);\n\n\t\t\t// Display success message\n\t\t\tshowMessageDialog(this, \"Key pair import successful\", ALERT_TITLE,\n\t\t\t\t\tINFORMATION_MESSAGE);\n\t\t} catch (Exception ex) { // too many exceptions to catch separately\n\t\t\tString exMessage = \"Failed to import the key pair entry to the Keystore. \"\n\t\t\t\t\t+ ex.getMessage();\n\t\t\tlogger.error(exMessage, ex);\n\t\t\tshowMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);\n\t\t}\n\t}", "private void setPasswordFlags(IPSPubServer pubServer, PSPublishServerInfo serverInfo)\n {\n String passwordValue = pubServer.getPropertyValue(IPSPubServerDao.PUBLISH_PASSWORD_PROPERTY);\n PSPubServerProperty privateKeyProperty = pubServer.getProperty(IPSPubServerDao.PUBLISH_PRIVATE_KEY_PROPERTY);\n String privatekeyValue = EMPTY;\n if (privateKeyProperty != null)\n {\n privatekeyValue = pubServer.getProperty(IPSPubServerDao.PUBLISH_PRIVATE_KEY_PROPERTY).getValue();\n }\n\n if (isNotBlank(passwordValue))\n {\n if (equalsIgnoreCase(pubServer.getPublishType(), PublishType.database.toString()))\n {\n // Add the password property\n PSPublishServerProperty serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(IPSPubServerDao.PUBLISH_PASSWORD_PROPERTY);\n serverProperty.setValue(PASSWORD_ENTRY);\n serverInfo.getProperties().add(serverProperty);\n }\n else\n {\n // Add the password flag\n PSPublishServerProperty serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(PASSWORD_FLAG);\n serverProperty.setValue(\"true\");\n serverInfo.getProperties().add(serverProperty);\n\n // Add the password property\n serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(IPSPubServerDao.PUBLISH_PASSWORD_PROPERTY);\n // Do not send back real password but dummy value. If this is passed back we keep same password\n serverProperty.setValue(PASSWORD_ENTRY);\n serverInfo.getProperties().add(serverProperty);\n\n // Add the private key flag\n serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(PRIVATE_KEY_FLAG);\n serverProperty.setValue(\"false\");\n serverInfo.getProperties().add(serverProperty);\n\n // Add the private key property\n serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(IPSPubServerDao.PUBLISH_PRIVATE_KEY_PROPERTY);\n serverProperty.setValue(EMPTY);\n serverInfo.getProperties().add(serverProperty);\n }\n }\n\n if (isNotBlank(privatekeyValue))\n {\n // Add the password flag\n PSPublishServerProperty serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(PRIVATE_KEY_FLAG);\n serverProperty.setValue(\"true\");\n serverInfo.getProperties().add(serverProperty);\n\n // Add the private key property\n serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(IPSPubServerDao.PUBLISH_PRIVATE_KEY_PROPERTY);\n serverProperty.setValue(privatekeyValue);\n serverInfo.getProperties().add(serverProperty);\n\n // Add the password flag\n serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(PASSWORD_FLAG);\n serverProperty.setValue(\"false\");\n serverInfo.getProperties().add(serverProperty);\n\n // Add the password property\n serverProperty = new PSPublishServerProperty();\n serverProperty.setKey(IPSPubServerDao.PUBLISH_PASSWORD_PROPERTY);\n serverProperty.setValue(EMPTY);\n serverInfo.getProperties().add(serverProperty);\n }\n }", "protected void loadKeys()\r\n {\r\n log.debug(\"{0}: Loading keys for {1}\", () -> logCacheName, () -> keyFile.toString());\r\n\r\n storageLock.writeLock().lock();\r\n\r\n try\r\n {\r\n // clear a key map to use.\r\n keyHash.clear();\r\n\r\n final HashMap<K, IndexedDiskElementDescriptor> keys = keyFile.readObject(\r\n new IndexedDiskElementDescriptor(0, (int) keyFile.length() - IndexedDisk.HEADER_SIZE_BYTES));\r\n\r\n if (keys != null)\r\n {\r\n log.debug(\"{0}: Found {1} in keys file.\", logCacheName, keys.size());\r\n\r\n keyHash.putAll(keys);\r\n\r\n log.info(\"{0}: Loaded keys from [{1}], key count: {2}; up to {3} will be available.\",\r\n () -> logCacheName, () -> fileName, keyHash::size, () -> maxKeySize);\r\n }\r\n\r\n if (log.isTraceEnabled())\r\n {\r\n dump(false);\r\n }\r\n }\r\n catch (final Exception e)\r\n {\r\n log.error(\"{0}: Problem loading keys for file {1}\", logCacheName, fileName, e);\r\n }\r\n finally\r\n {\r\n storageLock.writeLock().unlock();\r\n }\r\n }", "private void setKeys(APDU apdu) {\r\n\t\tcheckState(STATE_PERSONALIZED);\r\n\t\t// Can't set keys while in active state\r\n\t\tif (image.isActive())\r\n\t\t\tISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);\r\n\t\tapdu.setIncomingAndReceive();\r\n\t\t// must be secured\r\n\t\tif (!apdu.isSecureMessagingCLA())\r\n\t\t\tISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED);\r\n\t\t// Secured\r\n\t\tprocessSecureMessage(apdu);\r\n\t\t// buffer contains unwrapped and decrypted data\r\n\t\tbyte buffer[] = apdu.getBuffer();\r\n\t\t// Data field should contain number of sector (1 byte), type of key (1\r\n\t\t// byte)\r\n\t\t// and key itself (KEY_LENGTH)\r\n\t\tif (apdu.getIncomingLength() < (byte) (MiFareImage.KEY_LENGTH + 0x02))\r\n\t\t\tISOException.throwIt(ISO7816.SW_DATA_INVALID);\r\n\t\toffset = apdu.getOffsetCdata();\r\n\t\t// Setting key\r\n\t\timage.setKey(buffer, (short) (offset + 0x02), buffer[offset],\r\n\t\t\t\tbuffer[(byte) (offset + 0x01)]);\r\n\t}", "private void initUserSetting() {\n\n List<String> instantly = new ArrayList<String>();\n instantly.add(PostActivityPlugin.ID);\n instantly.add(ActivityCommentPlugin.ID);\n instantly.add(ActivityMentionPlugin.ID);\n instantly.add(LikePlugin.ID);\n instantly.add(RequestJoinSpacePlugin.ID);\n instantly.add(SpaceInvitationPlugin.ID);\n instantly.add(RelationshipReceivedRequestPlugin.ID);\n instantly.add(PostActivitySpaceStreamPlugin.ID);\n \n List<String> daily = new ArrayList<String>();\n daily.add(PostActivityPlugin.ID);\n daily.add(ActivityCommentPlugin.ID);\n daily.add(ActivityMentionPlugin.ID);\n daily.add(LikePlugin.ID);\n daily.add(RequestJoinSpacePlugin.ID);\n daily.add(SpaceInvitationPlugin.ID);\n daily.add(RelationshipReceivedRequestPlugin.ID);\n daily.add(PostActivitySpaceStreamPlugin.ID);\n daily.add(NewUserPlugin.ID);\n \n List<String> weekly = new ArrayList<String>();\n weekly.add(PostActivityPlugin.ID);\n weekly.add(ActivityCommentPlugin.ID);\n weekly.add(ActivityMentionPlugin.ID);\n weekly.add(LikePlugin.ID);\n weekly.add(RequestJoinSpacePlugin.ID);\n weekly.add(SpaceInvitationPlugin.ID);\n weekly.add(RelationshipReceivedRequestPlugin.ID);\n weekly.add(PostActivitySpaceStreamPlugin.ID);\n \n List<String> webNotifs = new ArrayList<String>();\n webNotifs.add(NewUserPlugin.ID);\n webNotifs.add(PostActivityPlugin.ID);\n webNotifs.add(ActivityCommentPlugin.ID);\n webNotifs.add(ActivityMentionPlugin.ID);\n webNotifs.add(LikePlugin.ID);\n webNotifs.add(RequestJoinSpacePlugin.ID);\n webNotifs.add(SpaceInvitationPlugin.ID);\n webNotifs.add(RelationshipReceivedRequestPlugin.ID);\n webNotifs.add(PostActivitySpaceStreamPlugin.ID);\n \n // root\n saveSetting(instantly, daily, weekly, webNotifs, rootIdentity.getRemoteId());\n\n // mary\n saveSetting(instantly, daily, weekly, webNotifs, maryIdentity.getRemoteId());\n\n // john\n saveSetting(instantly, daily, weekly, webNotifs, johnIdentity.getRemoteId());\n\n // demo\n saveSetting(instantly, daily, weekly, webNotifs, demoIdentity.getRemoteId());\n }", "ArrayList<ExportedKeyData> generatePublicKeyList();", "private static void keyExchange() throws IOException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException {\r\n\t\t//receive from server\r\n\t\tPublicKey keyserver = cryptoMessaging.recvPublicKey(auctioneer.getInputStream());\r\n\t\t//receive from clients\r\n\t\tPublicKey keyclients[] = new PublicKey[3];\r\n\t\tbiddersigs = new PublicKey[3];\r\n\t\tInputStream stream;\r\n\t\tfor (int i=0; i < bidders.size(); i++) {\r\n\t\t\tstream=(bidders.get(i)).getInputStream();\r\n\t\t\tkeyclients[i] = cryptoMessaging.recvPublicKey(stream);\r\n\t\t\tbiddersigs[i] = keyclients[i];\r\n\t\t}\r\n\t\t//send to auctioneer\r\n\t\tcryptoMessaging.sendPublicKey(auctioneer.getOutputStream(), keyclients[0]); \r\n\t\tcryptoMessaging.sendPublicKey(auctioneer.getOutputStream(), keyclients[1]); \r\n\t\tcryptoMessaging.sendPublicKey(auctioneer.getOutputStream(), keyclients[2]); \r\n\t\t//send to clients\r\n\t\tcryptoMessaging.sendPublicKey((bidders.get(0)).getOutputStream(), keyserver); \r\n\t\tcryptoMessaging.sendPublicKey((bidders.get(1)).getOutputStream(), keyserver); \r\n\t\tcryptoMessaging.sendPublicKey((bidders.get(2)).getOutputStream(), keyserver); \r\n\t\t\r\n\t\t\r\n\t\t// now receive paillier public keys from bidders and auctioneer\r\n\t\tauctioneer_pk = cryptoMessaging.recvPaillier(auctioneer.getInputStream());\r\n\t\tpk[0] = cryptoMessaging.recvPaillier((bidders.get(0)).getInputStream());\r\n\t\tpk[1] = cryptoMessaging.recvPaillier((bidders.get(1)).getInputStream());\r\n\t\tpk[2] = cryptoMessaging.recvPaillier((bidders.get(2)).getInputStream());\r\n\t}", "private void initKey() {\n String del = \":\";\n byte[] key;\n if (MainGame.applicationType == Application.ApplicationType.Android) {\n key = StringUtils.rightPad(Build.SERIAL + del + Build.ID + del, 32, \"~\").getBytes();\n } else if (MainGame.applicationType == Application.ApplicationType.Desktop) {\n key = new byte[]{0x12, 0x2d, 0x2f, 0x6c, 0x1f, 0x7a, 0x4f, 0x10, 0x48, 0x56, 0x17, 0x4b, 0x4f, 0x48, 0x3c, 0x17, 0x04, 0x06, 0x4b, 0x6d, 0x1d, 0x68, 0x4b, 0x52, 0x50, 0x50, 0x1f, 0x06, 0x29, 0x68, 0x5c, 0x65};\n } else {\n key = new byte[]{0x77, 0x61, 0x6c, 0x0b, 0x04, 0x5a, 0x4f, 0x4b, 0x65, 0x48, 0x52, 0x68, 0x1f, 0x1d, 0x3c, 0x4a, 0x5c, 0x06, 0x1f, 0x2f, 0x12, 0x32, 0x50, 0x19, 0x3c, 0x52, 0x04, 0x17, 0x48, 0x4f, 0x6d, 0x4b};\n }\n for (int i = 0; i < key.length; ++i) {\n key[i] = (byte) ((key[i] << 2) ^ magic);\n }\n privateKey = key;\n }", "public void setSecurityKeys(IdentifierSearch securityKeys) {\n this._securityKeys = securityKeys;\n }", "private void loadUsers() throws IOException {\n File accounts = new File(\"accounts.txt\");\n if (!accounts.exists()) {\n accounts.createNewFile();\n }\n\n FileInputStream fileInputStream = new FileInputStream(accounts);\n BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));\n\n for (String line = bufferedReader.readLine(); line != null; line = bufferedReader.readLine()) {\n String[] pair = line.split(\":\");\n userAccounts.put(pair[0], pair[1]);\n }\n }", "ExportedKeyData makeKeyPairs(PGPKeyPair masterKey, PGPKeyPair subKey, String username, String email, String password) throws PGPException, IOException;", "public KeyManager() {\r\n keys = new boolean[256];\r\n }", "public void userSettings(String userName, String password, File nameFile,File passFile, String fileadd) {\n try\n {\n \n if(!nameFile.exists())\n {\n nameFile.createNewFile();\n }\n if(!passFile.exists())\n {\n passFile.createNewFile();\n }\n \n FileReader ufr = new FileReader(nameFile);\n FileReader pfr = new FileReader(passFile);\n \n BufferedReader ubr = new BufferedReader(ufr);\n BufferedReader pbr = new BufferedReader(pfr);\n \n ArrayList<String> uName = new ArrayList<>();\n ArrayList<String> uPass = new ArrayList<>();\n for (int i = 0; i < lineNum(fileadd); i++) {\n uName.add(ubr.readLine());\n uPass.add(pbr.readLine());\n }\n for (int i = 0; i < lineNum(fileadd); i++) \n {\n if (userName.equals(uName.get(i)))\n {\n uPass.set(i, password);\n } \n }\n \n ufr.close();\n pfr.close();\n FileWriter fw = new FileWriter(passFile);\n PrintWriter pw = new PrintWriter(fw);\n pw.print(\"\");\n \n FileWriter fw2 = new FileWriter(passFile, true);\n PrintWriter pw2 = new PrintWriter(fw2, true);\n \n for (int j = 0; j < uPass.size() -1; j++)\n {\n \n pw.print(uPass.get(j));\n pw.println();\n \n }\n pw.close();\n }catch(Exception e)\n {\n e.printStackTrace();\n }\n \n }", "public KeySet(int iterationNumber) {\n\n this.iterationNumber = iterationNumber;\n numKeys = Encryptor.getNumKeys()\n + IndexCurve.curve(iterationNumber, 0, 2);\n passwordHashAlpha = Encryptor.getPasswordHashAlpha();\n passwordHashBeta = Encryptor.getPasswordHashBeta();\n\n keys = new String[2][numKeys];\n\n for (int i = 0; i < numKeys; i++) {\n keys[0][i] = createKey(i, passwordHashAlpha);\n }\n for (int i = 0; i < numKeys; i++) {\n keys[1][i] = createKey(i, passwordHashBeta);\n }\n\n }", "protected void setProvider() {\n fs.getClient().setKeyProvider(cluster.getNameNode().getNamesystem()\n .getProvider());\n }", "private void storeProperties() {\n Path path = getSamplePropertiesPath();\n LOG.info(\"Storing Properties to {}\", path.toString());\n try {\n final FileOutputStream fos = new FileOutputStream(path.toFile());\n final Properties properties = new Properties();\n String privateKey = this.credentials.getEcKeyPair().getPrivateKey().toString(16);\n properties.setProperty(PRIVATE_KEY, privateKey);\n properties.setProperty(CONTRACT1_ADDRESS, this.contract1Address);\n properties.setProperty(CONTRACT2_ADDRESS, this.contract2Address);\n properties.setProperty(CONTRACT3_ADDRESS, this.contract3Address);\n properties.setProperty(CONTRACT4_ADDRESS, this.contract4Address);\n properties.setProperty(CONTRACT5_ADDRESS, this.contract5Address);\n properties.setProperty(CONTRACT6_ADDRESS, this.contract6Address);\n properties.store(fos, \"Sample code properties file\");\n\n } catch (IOException ioEx) {\n // By the time we have reached the loadProperties method, we should be sure the file\n // exists. As such, just throw an exception to stop.\n throw new RuntimeException(ioEx);\n }\n }", "public void MultiSend(KeyPair kp) {\n Socket sock;\n PrintStream toServer;\n try {\n for (int i = 0; i < numProcesses; i++) {\n sock = new Socket(serverName, Ports.KeyServerPortBase + i);\n toServer = new PrintStream(sock.getOutputStream()); \n toServer.println(kp.getPublic()); //sending our Public key to every process\n toServer.flush();\n sock.close();\n }\n \n Thread.sleep(1000); //wait for keys to settle\n long current_time = System.currentTimeMillis(); //current time for Timestamp field\n File f = new File(\"BlockInput\" + Blockchain.PID + \".txt\");\n FileReader fr = new FileReader(f);\n BufferedReader br = new BufferedReader(fr);\n \n //read each line into input and place it into a block\n String realBlockA = System.currentTimeMillis() + \" \" + br.readLine(); \n String realBlockB = System.currentTimeMillis() + \" \" + br.readLine();\n String realBlockC = System.currentTimeMillis() + \" \" + br.readLine();\n String realBlockD = System.currentTimeMillis() + \" \" + br.readLine();\n String toConvertA = realBlockA;\n BlockRecord A = new BlockRecord();\n BlockRecord B = new BlockRecord();\n BlockRecord C = new BlockRecord();\n BlockRecord D = new BlockRecord();\n //converting each String read in from input into a Block\n A = BlockProcessing.toXML(realBlockA, Blockchain.PID);\n B = BlockProcessing.toXML(realBlockB, Blockchain.PID);\n C = BlockProcessing.toXML(realBlockC, Blockchain.PID);\n D = BlockProcessing.toXML(realBlockD, Blockchain.PID);\n \n for (int i = 0; i < numProcesses; i++) { //send block A to each process\n sock = new Socket(serverName, Ports.UnverifiedBlockServerPortBase + i);\n toServer = new PrintStream(sock.getOutputStream());\n toServer.println(realBlockA);\n toServer.flush();\n sock.close();\n }\n \n for (int i = 0; i < numProcesses; i++) { //send block B to each process\n sock = new Socket(serverName, Ports.UnverifiedBlockServerPortBase + i);\n toServer = new PrintStream(sock.getOutputStream());\n toServer.println(realBlockB);\n toServer.flush();\n sock.close();\n }\n \n for (int i = 0; i < numProcesses; i++) { //send block C to each process\n sock = new Socket(serverName, Ports.UnverifiedBlockServerPortBase + i);\n toServer = new PrintStream(sock.getOutputStream());\n toServer.println(realBlockC);\n toServer.flush();\n sock.close();\n }\n \n for (int i = 0; i < numProcesses; i++) { //send block D to each process\n sock = new Socket(serverName, Ports.UnverifiedBlockServerPortBase + i);\n toServer = new PrintStream(sock.getOutputStream());\n toServer.println(realBlockD);\n toServer.flush();\n sock.close();\n }\n \n } \n catch (Exception x) {\n x.printStackTrace();\n }\n }", "@Inject\n public EncryptionUtil(@Named(\"Server\")PrivateKey serverPrivateKey){\n this.serverPrivateKey = serverPrivateKey;\n }", "void init(){\n \tRootServers = new String[15];\r\n RootServers[0] = \"198.41.0.4\";\r\n RootServers[1] = \"199.9.14.201\";\r\n RootServers[2] = \"192.33.4.12\";\r\n RootServers[3] = \"199.7.91.13[\";\r\n RootServers[4] = \"192.203.230.10\";\r\n RootServers[5] = \"192.5.5.241\";\r\n RootServers[6] = \"192.112.36.4\";\r\n RootServers[7] = \"198.97.190.53\";\r\n RootServers[8] = \"192.36.148.17\";\r\n RootServers[9] = \"192.58.128.30\";\r\n RootServers[10] = \"193.0.14.129\";\r\n RootServers[11] = \"199.7.83.42\";\r\n RootServers[12] = \"202.12.27.33\";\r\n }", "protected void init(Iterable<String> servers) {}", "public void RSAyoyo() throws NoSuchAlgorithmException, GeneralSecurityException, IOException {\r\n\r\n KeyPairGenerator kPairGen = KeyPairGenerator.getInstance(\"RSA\");\r\n kPairGen.initialize(2048);\r\n KeyPair kPair = kPairGen.genKeyPair();\r\n publicKey = kPair.getPublic();\r\n System.out.println(publicKey);\r\n privateKey = kPair.getPrivate();\r\n\r\n KeyFactory fact = KeyFactory.getInstance(\"RSA\");\r\n RSAPublicKeySpec pub = fact.getKeySpec(kPair.getPublic(), RSAPublicKeySpec.class);\r\n RSAPrivateKeySpec priv = fact.getKeySpec(kPair.getPrivate(), RSAPrivateKeySpec.class);\r\n serializeToFile(\"public.key\", pub.getModulus(), pub.getPublicExponent()); \t\t\t\t// this will give public key file\r\n serializeToFile(\"private.key\", priv.getModulus(), priv.getPrivateExponent());\t\t\t// this will give private key file\r\n\r\n \r\n }", "public void testKeyGeneratedFromUserPassword() {\n final String prefFileName = generatePrefFileNameForTest();\n\n SecurePreferences securePrefs = new SecurePreferences(getContext(), \"password\", prefFileName);\n SharedPreferences normalPrefs = getContext().getSharedPreferences(prefFileName, Context.MODE_PRIVATE);\n\n Map<String, ?> allTheSecurePrefs = securePrefs.getAll();\n Map<String, ?> allThePrefs = normalPrefs.getAll();\n\n assertTrue(\n \"the preference file should not contain any enteries as the key is generated via user password.\",\n allThePrefs.isEmpty());\n\n\n //clean up here as pref file created for each test\n deletePrefFile(prefFileName);\n }", "private void setRahasParameters(AxisService axisService, String privateKeyStore)\n throws PersistenceException, AxisFault {\n Properties cryptoProps = new Properties();\n\n String serviceGroupId = axisService.getAxisServiceGroup().getServiceGroupName();\n String serviceName = axisService.getName();\n String serviceXPath = PersistenceUtils.getResourcePath(axisService);\n\n List pvtStores = serviceGroupFilePM.getAssociations(serviceGroupId, serviceXPath,\n SecurityConstants.ASSOCIATION_PRIVATE_KEYSTORE);\n List tstedStores = serviceGroupFilePM.getAssociations(serviceGroupId, serviceXPath,\n SecurityConstants.ASSOCIATION_TRUSTED_KEYSTORE);\n\n if (pvtStores != null && !CollectionUtils.isEmpty(pvtStores)) {\n String keyAlias = null;\n ServerConfiguration serverConfig = ServerConfiguration.getInstance();\n keyAlias = serverConfig.getFirstProperty(\"Security.KeyStore.KeyAlias\");\n cryptoProps.setProperty(ServerCrypto.PROP_ID_PRIVATE_STORE, privateKeyStore);\n cryptoProps.setProperty(ServerCrypto.PROP_ID_DEFAULT_ALIAS, keyAlias);\n }\n StringBuilder trustStores = new StringBuilder();\n\n for (Object node : tstedStores) {\n OMElement assoc = (OMElement) node;\n String tstedStore = assoc.getAttributeValue(new QName(Resources.Associations.DESTINATION_PATH));\n String name = tstedStore.substring(tstedStore.lastIndexOf(\"/\"));\n trustStores.append(name).append(\",\");\n }\n\n cryptoProps.setProperty(ServerCrypto.PROP_ID_TRUST_STORES, trustStores.toString());\n\n try {\n setServiceParameterElement(serviceName, RahasUtil.getSCTIssuerConfigParameter(\n ServerCrypto.class.getName(), cryptoProps, -1, null, true, true));\n setServiceParameterElement(serviceName, RahasUtil.getTokenCancelerConfigParameter());\n OMElement serviceElement = (OMElement) serviceGroupFilePM.get(serviceGroupId, serviceXPath);\n\n serviceElement.addAttribute(SecurityConstants.PROP_RAHAS_SCT_ISSUER, Boolean.TRUE.toString(), null);\n serviceGroupFilePM.setMetaFileModification(serviceGroupId);\n } catch (Exception e) {\n throw new AxisFault(\"Could not configure Rahas parameters\", e);\n }\n\n }", "public void setServerIds(java.lang.String[] serverIds) {\r\n this.serverIds = serverIds;\r\n }", "public static void init()\n\t{\n\t\tusername2accesses.clear();\n\t\t//--- adds info.json in ./Home/Administrator for the system admin ---//\n\t\tfinal String adminAccessPath = Hierarchies.getSectionDir() + \"/\" + Hierarchies.getInfoFileName() + \".\" + Directories.getFileExt();\n\t\tfinal File adminAccessFile = new File(adminAccessPath);\n\t\tif (!adminAccessFile.exists())\n\t\t{\n\t\t\tfinal Access[] accesses = new Access[1];\n\t\t\taccesses[0] = new Access(\"admin\", Role.ADMINISTRATOR, null);\n\t\t\tfinal HierarchyItem hierarchyItem = new HierarchyItem(null, null, null, accesses);\n\t\t\tfinal String hierarchyItemAsJson = new Gson().toJson(hierarchyItem);\n\t\t\tFileIO.writeToFile(adminAccessPath, hierarchyItemAsJson);\n\t\t}\n\t\t//--- reads all JSON files recursively in ./Home/Administrator ---//\n\t\t//--- contents of JSON files will be processed to be cached in hash map username2accesses ---//\n\t\tfinal File file = new File(Hierarchies.getSectionDir());\n\t\tfinal Collection<File> jsonFiles = FileUtils.listFiles(file, new String[]{Directories.getFileExt()}, true);\n\t\tfor (File infoFile : jsonFiles) manage(infoFile, Op.STORE);\n\t}", "public void verify() throws InternalSkiException {\n if (SERVER_KEY_VALUE==null || \"\".equals(SERVER_KEY_VALUE.trim())) {\n throw new InternalSkiException(\"Cannot validate server key!\");\n }\n\n byte[] tokenKey = getTokenKey();\n byte[] systemKey = getSystemKey();\n\n if (tokenKey==null || systemKey==null) {\n throw new InternalSkiException(\"Cannot validate token or system keys!\");\n }\n }", "public void saveUsers() {\n FileWriter fileWriter = null;\n PrintWriter printWriter = null;\n try {\n fileWriter = new FileWriter(pathData);\n printWriter = new PrintWriter(fileWriter);\n if (users != null) {\n \n for (Map.Entry m : users.entrySet()) {\n printWriter.println(m.getKey() + spChar + m.getValue() + \"\\n\");\n }\n }\n printWriter.close();\n } catch (IOException e) {\n }\n }", "public String createSmartKey(String userPart, long ... ids);", "private void setValuesInSharedPrefernce() {\r\n\r\n\t\tmSharedPreferences_reg.edit().putString(\"ProfileImageString\", profileImageString).commit();\r\n\t\tmSharedPreferences_reg.edit().putString(\"PseudoName\", psedoName).commit();\r\n\t\tmSharedPreferences_reg.edit().putString(\"Pseudodescription\", profiledescription).commit();\r\n\t}", "@Override\r\n\tpublic void afterPropertiesSet() throws Exception {\n\t\ttry {\r\n\t\t\tfileServerAccessKey = helperRemote\r\n\t\t\t\t\t.getProperty(FILESERVER_ACCESS_KEY);\r\n\t\t\tfileServerSecretKey = helperRemote\r\n\t\t\t\t\t.getProperty(FILESERVER_SECRET_KEY);\r\n\t\t\tfileServerBucket = helperRemote.getProperty(FILESERVER_BUCKET);\r\n\t\t\tmediaBucket = helperRemote.getProperty(MADIA_BUCKET);\r\n\t\t\tcallbackUrl = helperRemote.getProperty(FILESERVER_CALLBACK_URL);\r\n\t\t\tcallbackHost = helperRemote.getProperty(FILESERVER_CALLBACK_HOST);\r\n\t\t\tfileServerUrl = helperRemote.getProperty(FILESERVER_URL);\r\n\t\t} catch (Exception ee) {\r\n\r\n\t\t}\r\n\t}", "public void setSecretKey(String secretKey) {\n this.secretKey = secretKey;\n }", "private void initializePSIObjects() throws NoSuchAlgorithmException, \n IllegalArgumentException {\n ArrayList<byte[]> friends = friendStore.getAllFriendsBytes();\n try {\n // The clientPSI object manages the interaction in which we're the \"client\".\n // The serverPSI object manages the interaction in which we're the \"server\".\n mClientPSI = new PrivateSetIntersection(friends);\n mServerPSI = new PrivateSetIntersection(friends);\n } catch (NoSuchAlgorithmException e) {\n setExchangeStatus(Status.ERROR); \n setErrorMessage(\"No such algorithm when creating PrivateSetIntersection.\" + e);\n throw e;\n }\n }", "private void setKeySet(OwnSet<K> st){\n this.keySet = st; \n }", "public void init()\n {\n try\n {\n userPasswordsProperties = new Properties();\n userPasswordsProperties.load(new FileInputStream(userPasswordsPropertiesFileName));\n log.info(\"Successfully initialized. UsersPasswords property file is: \" + userPasswordsPropertiesFileName);\n }\n catch (Exception e)\n {\n throw new IllegalArgumentException(\"UserNamesPropertyFile name: \" + userPasswordsPropertiesFileName + \" not valid. Error: \" + e);\n }\n \n }", "private void initializeKeyPairs() \r\n \t //@ requires nonRepKeyPair |-> _ &*& authKeyPair |-> _ &*& basicKeyPair |-> _;\r\n \t /*@ ensures nonRepKeyPair |-> ?theNonRepKeyPair &*& theNonRepKeyPair != null &*&\r\n\t \t authKeyPair |-> ?theAuthKeyPair &*& theAuthKeyPair != null &*&\r\n\t \t basicKeyPair |-> ?theBasicKeyPair &*& theBasicKeyPair != null;\r\n\t @*/\r\n\t{\r\n\t\t/*\r\n\t\t * basicKeyPair is static (so same for all applets) so only allocate\r\n\t\t * memory once\r\n\t\t */\r\n\t\tif (EidCard.basicKeyPair != null && authKeyPair != null && nonRepKeyPair != null) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tbasicKeyPair = new KeyPair(KeyPair.ALG_RSA_CRT, (short) 1024);\r\n\t\tbasicKeyPair.genKeyPair();\r\n\t\t\r\n\t\tauthKeyPair = new KeyPair(KeyPair.ALG_RSA_CRT, (short) (1024));\r\n\t\tauthKeyPair.genKeyPair();\r\n\t\t\r\n\t\t\r\n\t\r\n\t\t//authPrivateKey = (RSAPrivateCrtKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_CRT_PRIVATE, KeyBuilder.LENGTH_RSA_1024, false);\r\n\t\t\r\n\r\n\t\tnonRepKeyPair = new KeyPair(KeyPair.ALG_RSA_CRT, (short) (1024));\r\n\t\tnonRepKeyPair.genKeyPair();\r\n\t\r\n\t\t//nonRepPrivateKey = (RSAPrivateCrtKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_CRT_PRIVATE, KeyBuilder.LENGTH_RSA_1024, false);\r\n\t}", "private void createTestData() {\n final DbEncryptionKeyReference encryptionKey = new DbEncryptionKeyReference();\n encryptionKey.setCreationTime(new Date());\n encryptionKey.setReference(\"1\");\n encryptionKey.setEncryptionProviderType(EncryptionProviderType.JRE);\n encryptionKey.setValidFrom(new Date(System.currentTimeMillis() - 60000));\n encryptionKey.setVersion(1L);\n this.testEntityManager.persist(encryptionKey);\n\n final DbEncryptedSecret encryptedSecret = new DbEncryptedSecret();\n encryptedSecret.setCreationTime(new Date());\n encryptedSecret.setDeviceIdentification(DEVICE_IDENTIFICATION);\n encryptedSecret.setSecretType(\n org.opensmartgridplatform.secretmanagement.application.domain.SecretType.E_METER_AUTHENTICATION_KEY);\n encryptedSecret.setEncodedSecret(E_METER_AUTHENTICATION_KEY_ENCRYPTED_FOR_DB);\n encryptedSecret.setEncryptionKeyReference(encryptionKey);\n\n this.testEntityManager.persist(encryptedSecret);\n\n final DbEncryptedSecret encryptedSecret2 = new DbEncryptedSecret();\n encryptedSecret2.setCreationTime(new Date());\n encryptedSecret2.setDeviceIdentification(DEVICE_IDENTIFICATION);\n encryptedSecret2.setSecretType(\n org.opensmartgridplatform.secretmanagement.application.domain.SecretType.E_METER_ENCRYPTION_KEY_UNICAST);\n encryptedSecret2.setEncodedSecret(E_METER_ENCRYPTION_KEY_UNICAST_ENCRYPTED_FOR_DB);\n encryptedSecret2.setEncryptionKeyReference(encryptionKey);\n\n this.testEntityManager.persist(encryptedSecret2);\n\n this.testEntityManager.flush();\n }", "private void setUserAccount() throws FileNotFoundException\r\n\t{\r\n\t\tint index = 0;\r\n\t\tFile inputFile = new File(\"UserAccount.txt\");\r\n\t\tScanner input = new Scanner(inputFile);\r\n\t\tif (!inputFile.exists())\r\n\t\t{\r\n\t\t\tSystem.out.println(\"The text file \\\"UserAccount.txt\\\" is missing\");\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t\twhile(input.hasNextLine())\r\n\t\t{\r\n\t\t\tuserAccounts[0][index] = input.nextLine();\t\t\t//stores the username\r\n\t\t\tuserAccounts[1][index] = input.nextLine();\t\t\t//stores the password\r\n\t\t\tnumOfUsers++;\r\n\t\t\tindex++;\r\n\t\t}\r\n\t}", "protected ClientSimulator() {\r\n\r\n\t\tthis.publicKeysOfMixes = getPublicKeys();\r\n\t\t\r\n\t\t// start ClientSimulator\r\n\t\tstart();\r\n\t}", "private void configure(String args[])\r\n\t{\n\t\tfor(int i = 0; i < NUM_USERS; i++)\r\n\t\t{\r\n\t\t\tuserFileNames[i] = args[i+1];\r\n\t\t\t// userFileNames[i] = \"USER\" + i+1;\r\n\t\t}\r\n\r\n\t\t//Populate disks array\r\n\t\tfor(int i = 0; i < NUM_DISKS; i++)\r\n\t\t{\r\n\t\t\tdisks[i] = new Disk();\r\n\t\t}\r\n\r\n\t\t//Populate printers array\r\n\t\tfor(int i = 0; i < NUM_PRINTERS; i++)\r\n\t\t{\r\n\t\t\tprinters[i] = new Printer(i+1); \r\n\t\t}\r\n\r\n\t\t//Populate user\r\n\t\tfor(int i = 0; i< NUM_USERS; i++)\r\n\t\t{\r\n\t\t\tusers[i] = new UserThread(userFileNames[i]);\r\n\t\t}\r\n\t}", "public void setDriveClientSecret(String secret) {this.databaseConfig.setProperty(\"driveClientSecret\", secret);}", "private byte[][] ECDSAgeneratePublicAndPrivateKey(){\r\n int length = 0;\r\n byte[][] keys;\r\n \r\n do{\r\n \r\n\tECKeyPairGenerator gen = new ECKeyPairGenerator();\r\n\tSecureRandom secureRandom = new SecureRandom();\r\n X9ECParameters secnamecurves = SECNamedCurves.getByName(\"secp256k1\");\r\n\tECDomainParameters ecParams = new ECDomainParameters(secnamecurves.getCurve(), secnamecurves.getG(), secnamecurves.getN(), secnamecurves.getH());\r\n\tECKeyGenerationParameters keyGenParam = new ECKeyGenerationParameters(ecParams, secureRandom);\r\n\tgen.init(keyGenParam);\r\n\tAsymmetricCipherKeyPair kp = gen.generateKeyPair();\r\n\tECPrivateKeyParameters privatekey = (ECPrivateKeyParameters)kp.getPrivate();\r\n\tECPoint dd = secnamecurves.getG().multiply(privatekey.getD());\r\n\tbyte[] publickey=new byte[65];\r\n\tSystem.arraycopy(dd.getY().toBigInteger().toByteArray(), 0, publickey, 64-dd.getY().toBigInteger().toByteArray().length+1, dd.getY().toBigInteger().toByteArray().length);\r\n\tSystem.arraycopy(dd.getX().toBigInteger().toByteArray(), 0, publickey, 32-dd.getX().toBigInteger().toByteArray().length+1, dd.getX().toBigInteger().toByteArray().length);\r\n\tpublickey[0]=4;\r\n length = privatekey.getD().toByteArray().length;\r\n keys = new byte[][]{privatekey.getD().toByteArray(),publickey};\r\n \r\n }while(length != 32);\r\n\treturn keys;\r\n}", "public void doFiles(){\r\n serversDir = new File(rootDirPath+\"/servers/\");\r\n serverList = new File(rootDirPath+\"serverList.txt\");\r\n if(!serversDir.exists()){ //if server Directory doesn't exist\r\n serversDir.mkdirs(); //create it\r\n }\r\n updateServerList();\r\n }", "private void assignCertAndKeyPath()\n {\n\n if (CLIENT_PATH_ENV.get(conf) != null &&\n SERVER_PATH_ENV.get(conf) != null) {\n String envVarTlsClientCertPath =\n System.getenv(CLIENT_PATH_ENV.get(conf));\n String envVarTlsClientKeyPath =\n System.getenv(SERVER_PATH_ENV.get(conf));\n if (envVarTlsClientCertPath != null && envVarTlsClientKeyPath != null) {\n // If expected env variables are present, check if file exists\n File certFile = new File(envVarTlsClientCertPath);\n File keyFile = new File(envVarTlsClientKeyPath);\n if (certFile.exists() && keyFile.exists()) {\n // set paths and return if both files exist\n this.certPath = envVarTlsClientCertPath;\n this.keyPath = envVarTlsClientKeyPath;\n return;\n }\n }\n }\n\n // Now we know that we are a Client, without valid env variables\n // We shall try to read off of the default Client path\n if (CLIENT_PATH.get(conf) != null &&\n (new File(CLIENT_PATH.get(conf))).exists()) {\n LOG.error(\"Falling back to CLIENT_PATH (\" + CLIENT_PATH.get(conf) +\n \") since env var path is not valid/env var not present\");\n this.keyPath = CLIENT_PATH.get(conf);\n this.certPath = CLIENT_PATH.get(conf);\n return;\n }\n\n // Looks like default Client also does not exist\n // Time to use the server cert and see if we have any luck\n LOG.error(\"EnvVar and CLIENT_PATH (\" + CLIENT_PATH.get(conf) +\n \") both do not exist/invalid, trying SERVER_PATH(\" +\n SERVER_PATH.get(conf) + \")\");\n this.keyPath = SERVER_PATH.get(conf);\n this.certPath = SERVER_PATH.get(conf);\n }", "void generateSecretKey() {\n\n Random rand = new Random();\n \n // randomly generate alphabet chars\n this.secretKey.setCharAt(0, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(1, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(4, (char) (rand.nextInt(26) + 'a'));\n this.secretKey.setCharAt(5, (char) (rand.nextInt(26) + 'a'));\n\n // randomly generate special chars\n // special chars are between 33-47 and 58-64 on ASCII table\n if (rand.nextBoolean()) {\n this.secretKey.setCharAt(3, (char) (rand.nextInt(15) + '!'));\n this.secretKey.setCharAt(8, (char) (rand.nextInt(15) + '!'));\n } else {\n this.secretKey.setCharAt(3, (char) (rand.nextInt(7) + ':'));\n this.secretKey.setCharAt(8, (char) (rand.nextInt(7) + ':'));\n }\n \n // randomly generate int between 2 and 5\n this.secretKey.setCharAt(7, (char) (rand.nextInt(4) + '2'));\n }", "private void initPrivateKey(byte[] privateKeyFragment1, byte[] privateKeyFragment2) throws NoSuchAlgorithmException, InvalidKeySpecException, Base64DecodingException {\n this.rsaPrivateKey = KeyFactory.getInstance(\"RSA\").generatePrivate(new PKCS8EncodedKeySpec(concatByteArrays(privateKeyFragment1, privateKeyFragment2)));\n }", "default void authByKeys(ActiveMQSslConnectionFactory factory, Broker broker) {\n try {\n factory.setKeyStore(String.format(\"file:///%s\", broker.getKeystorePath()));\n // Password of the private key\n factory.setKeyStoreKeyPassword(broker.getKeystoreKeyPassword());\n // password of the keystore\n factory.setKeyStorePassword(broker.getKeystorePassword());\n // set the truststore jks file\n factory.setTrustStore(String.format(\"file:///%s\", broker.getTruststorePath()));\n // set the truststore password\n factory.setTrustStorePassword(broker.getTruststorePassword());\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void writeKeyData(File f) throws IOException;", "public synchronized void start(String hostname, Registration naming_server)\n throws RMIException, UnknownHostException, FileNotFoundException\n {\n if( !root.isDirectory() || !root.exists() ) {\n throw new FileNotFoundException(\"Server root not found or is not a directory\");\n }\n storage.start();\n command.start();\n \n // Wait for it to start?\n\n Path[] serverFiles = naming_server.register(\n Stub.create(Storage.class, storage, hostname),\n Stub.create(Command.class, command, hostname),\n Path.list(root));\n\n // Storage Server startup deletes all duplicate files on server.\n for(Path p : serverFiles) {\n p.toFile(root).delete();\n File parent = new File(p.toFile(root).getParent());\n \n while(!parent.equals(root)) {\n if(parent.list().length == 0) {\n parent.delete();\n } else {\n break;\n }\n parent = new File(parent.getParent());\n }\n } \n }", "byte[] genKeyBlock(byte[] mastersecret, int[]clientRandom, int[]serverRandom) throws NoSuchAlgorithmException, IOException{\n byte[] part1 = md5andshaprocessing(\"AA\", mastersecret, clientRandom, serverRandom);\r\n byte[] part2 = md5andshaprocessing(\"BB\", mastersecret, clientRandom, serverRandom);\r\n byte[] part3 = md5andshaprocessing(\"CCC\", mastersecret, clientRandom, serverRandom);\r\n byte[] part4 = md5andshaprocessing(\"DDDD\", mastersecret, clientRandom, serverRandom);\r\n byte[] part5 = md5andshaprocessing(\"EEEEE\", mastersecret, clientRandom, serverRandom);\r\n byte[] part6 = md5andshaprocessing(\"FFFFFF\", mastersecret, clientRandom, serverRandom);\r\n \r\n baos.write(part1);\r\n baos.write(part2);\r\n baos.write(part3);\r\n baos.write(part4);\r\n baos.write(part5);\r\n baos.write(part6);\r\n \r\n byte[] keyblock = baos.toByteArray();\r\n baos.reset();\r\n \r\n client_macsecret = new byte[20];\r\n server_macsecret = new byte[20];\r\n client_writekey = new byte[24];\r\n server_writekey = new byte[24];\r\n \r\n System.arraycopy(keyblock, 0, client_macsecret, 0, 20);\r\n System.arraycopy(keyblock, 20, server_macsecret, 0, 20);\r\n System.arraycopy(keyblock, 40, client_writekey, 0, 24);\r\n System.arraycopy(keyblock, 64, server_writekey, 0, 24);\r\n return keyblock;\r\n }", "public FileServer (Map<String, String> filePath){\n\t\tthis.filePath = new ConcurrentHashMap<String, String>();\n\n\t\tfor(String filename : filePath.keySet()){\n\t\t\tthis.filePath.putIfAbsent(filename, filePath.get(filename));\n\t\t}\n\t\t\n\t}", "public void setupKeys()\n {\n KeyAreaInfo keyArea = null;\n keyArea = new KeyAreaInfo(this, Constants.UNIQUE, \"PrimaryKey\");\n keyArea.addKeyField(\"ID\", Constants.ASCENDING);\n keyArea = new KeyAreaInfo(this, Constants.SECONDARY_KEY, \"CurrencyCode\");\n keyArea.addKeyField(\"CurrencyCode\", Constants.ASCENDING);\n keyArea = new KeyAreaInfo(this, Constants.NOT_UNIQUE, \"Description\");\n keyArea.addKeyField(\"Description\", Constants.ASCENDING);\n }", "private void initKeystores(SupportedOS supportedOS, SupportedBrowser supportedBrowser)\r\n {\r\n this.keyStoreManager.flushKeyStoresTable();\r\n this.keyStoreManager.initBrowserStores(apph.getOs(), apph.getNavigator());\r\n \r\n // this.keyStoreManager.initClauer();\r\n\r\n // Solo mostraremos el soporte PKCS11 para sistemas operativos no Windows\r\n// if (!supportedBrowser.equals(SupportedBrowser.IEXPLORER))\r\n if (!supportedOS.equals(SupportedOS.WINDOWS))\r\n {\r\n ConfigManager conf = ConfigManager.getInstance();\r\n\r\n for (Device device : conf.getDeviceConfig())\r\n {\r\n try\r\n {\r\n keyStoreManager.initPKCS11Device(device, null);\r\n }\r\n catch (DeviceInitializationException die)\r\n {\r\n for (int i = 0; i < 3; i++)\r\n {\r\n PasswordPrompt passwordPrompt = new PasswordPrompt(null, device.getName(), \"Pin:\");\r\n \r\n if (passwordPrompt.getPassword() == null)\r\n {\r\n \tbreak;\r\n }\r\n \r\n try\r\n {\r\n this.keyStoreManager.initPKCS11Device(device, passwordPrompt.getPassword());\r\n break;\r\n }\r\n catch (Exception e)\r\n {\r\n JOptionPane.showMessageDialog(null, LabelManager.get(\"ERROR_INCORRECT_DNIE_PWD\"), \"\", JOptionPane.ERROR_MESSAGE);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "public void adminLoad() {\n try {\n File file = new File(adminPath);\n Scanner scanner = new Scanner(file);\n while (scanner.hasNextLine()){\n String data = scanner.nextLine();\n String[]userData = data.split(separator);\n AdminAccounts adminAccounts = new AdminAccounts();\n adminAccounts.setUsername(userData[0]);\n adminAccounts.setPassword(userData[1]);\n users.add(adminAccounts);\n }\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "public void save() { \n /*\n * Iterate over registry to pull box values\n * Creating new IOLoader for instance \n */\n for(UUID id : giftRegistry.keySet()) {\n GiftBox box = giftRegistry.get(id);\n\n String sId = id.toString();\n IOLoader<SecretSanta> config = new IOLoader<SecretSanta>(SecretSanta._this(), sId + \".yml\", \"Gifts\");\n\n FileConfiguration fCon = config.getCustomConfig();\n fCon.createSection(\"SecretSanta\");\n fCon.set(\"SecretSanta\", box.getConfig());\n\n try{\n fCon.save(config.getFile());\n } catch(IOException ex) {\n SecretSanta._this().logSevere(\"[GiftManager] Failed to save: \" + sId + \".yml\");\n continue;\n }\n }\n //SecretSanta._this().logDebug(\"[GiftManager] Gift Registry save successful.\");\n\n IOLoader<SecretSanta> pairedConfig = new IOLoader<SecretSanta>(SecretSanta._this(), \"PairedRegistry.yml\", \"Data\");\n FileConfiguration fPaired = pairedConfig.getCustomConfig();\n fPaired.createSection(\"paired\");\n fPaired.set(\"paired\", savePairs());\n\n try{\n fPaired.save(pairedConfig.getFile());\n //SecretSanta._this().logDebug(\"[GiftManager] PairedRegistry.yml save successful.\");\n } catch(IOException ex) {\n SecretSanta._this().logSevere(\"[GiftManager] Failed to save: PairedRegistry.yml\");\n }\n\n IOLoader<SecretSanta> playerConfig = new IOLoader<SecretSanta>(SecretSanta._this(), \"PlayerRegistry.yml\", \"Data\");\n FileConfiguration fPlayer = playerConfig.getCustomConfig();\n fPlayer.createSection(\"registered\");\n fPlayer.set(\"registered\", savePlayers());\n\n try{\n fPlayer.save(playerConfig.getFile());\n //SecretSanta._this().logDebug(\"[GiftManager] PlayerRegistry.yml save successful.\");\n } catch(IOException ex) {\n SecretSanta._this().logSevere(\"[GiftManager] Failed to save: PlayerRegistry.yml\");\n }\n\n IOLoader<SecretSanta> givenConfig = new IOLoader<SecretSanta>(SecretSanta._this(), \"GivenEmptyRegistry.yml\", \"Data\");\n FileConfiguration fGiven = givenConfig.getCustomConfig();\n fGiven.createSection(\"given\");\n fGiven.set(\"given\", saveGivens());\n\n try{\n fGiven.save(givenConfig.getFile());\n } catch(IOException ex) {\n SecretSanta._this().logSevere(\"[GiftManager] Failed to save: GivenEmptyRegistry.yml\");\n }\n\n SecretSanta._this().logDebug(\"[GiftManager] Saving complete.\");\n }", "public void setZrtpSecretsFile(String file);", "public void SharedMemoryKeys(Object[] keys) {\n if (! (keys.length == 2 &&\n keys[0] instanceof Double && keys[1] instanceof Double))\n throw new IllegalArgumentException\n (\"\\nSharedMemoryKeys must be numbers\") ;\n \n\tthis.trackerShmKey = ((Double)keys[0]).intValue() ;\n\tthis.controllerShmKey = ((Double)keys[1]).intValue() ;\n }", "@Override\r\n public void initValues() {\r\n try {\r\n crackedPasswords = Files.readAllLines(Paths.get(DefectivePasswordValidatorConstants.PASSWORD_FILE_PATH),\r\n StandardCharsets.UTF_8);\r\n } catch (IOException e) {\r\n log.error(\"Exception occured while reading and initializing values from \"\r\n + DefectivePasswordValidatorConstants.PASSWORD_FILE_NAME, e);\r\n }\r\n }", "AppEncryptionServer(final SessionFactory sessionFactory, final String udsFilePath,\n final ServerBuilder<?> serverBuilder) {\n this.udsFilePath = udsFilePath;\n server = serverBuilder.addService(new AppEncryptionImpl(sessionFactory)).build();\n }", "public void setVerified(List<Cell> keyValues) {\n for (int i = 0; i < keyValues.size(); i++) {\n updateVerified(keyValues.get(i));\n }\n }", "public void init(String keyIn) throws KeyAlreadySetException {\n if (key != null) {\n throw new KeyAlreadySetException();\n } else if (keyIn == null) {\n throw new NullPointerException();\n } else {\n try {\n System.out.println(\"Key string: \" + keyIn);\n SecretKeyFactory factory = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA256\");\n //Same salt for every client\n Random r = new Random(128);\n byte[] salt = new byte[32];\n r.nextBytes(salt);\n KeySpec spec = new PBEKeySpec(keyIn.toCharArray(), salt, 65536, 128);\n SecretKey tmp = factory.generateSecret(spec);\n\n key = new SecretKeySpec(tmp.getEncoded(), \"AES\");\n } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {\n e.printStackTrace();\n\n throw new UnsupportedOperationException();\n }\n }\n }", "public RSAKeyContents generateKeys() {\r\n\t\tlock.lock();\r\n\t\ttry {\r\n\t\t\tButtermilkRSAKeyPairGenerator kpGen = new ButtermilkRSAKeyPairGenerator();\r\n\t\t\tkpGen.init(new RSAKeyGenerationParameters(DEFAULT_PUBLIC_EXPONENT, rand, KEY_STRENGTH, CERTAINTY));\r\n\t\t\treturn kpGen.generateKeys();\r\n\t\t} finally {\r\n\t\t\tlock.unlock();\r\n\t\t}\r\n\t}" ]
[ "0.637339", "0.61673313", "0.58530116", "0.5729534", "0.56682044", "0.56051296", "0.551871", "0.540143", "0.5302357", "0.5286174", "0.5171144", "0.5149069", "0.5134642", "0.51292247", "0.50906354", "0.505494", "0.50299513", "0.50271255", "0.50235903", "0.50053984", "0.49824473", "0.49746177", "0.4972392", "0.4962612", "0.49310806", "0.4902423", "0.48928243", "0.4891494", "0.4871972", "0.48466122", "0.4833933", "0.48315063", "0.4825342", "0.48251006", "0.48104426", "0.47558293", "0.47504514", "0.4746951", "0.47345948", "0.47205502", "0.47134772", "0.47073284", "0.46896303", "0.4686433", "0.46752787", "0.46667516", "0.46641168", "0.46519554", "0.4648371", "0.46384814", "0.463564", "0.46316487", "0.46190348", "0.46088612", "0.46085826", "0.46021608", "0.45958182", "0.45834205", "0.45739254", "0.45687652", "0.45551604", "0.45523015", "0.45473942", "0.45473537", "0.45335314", "0.45324618", "0.45250377", "0.4521922", "0.45196304", "0.45144078", "0.45094958", "0.4505195", "0.4504801", "0.4503577", "0.45034513", "0.44944096", "0.4491577", "0.44880813", "0.448729", "0.44866812", "0.4483262", "0.44690904", "0.44542906", "0.44509318", "0.44449726", "0.44433263", "0.44404382", "0.4439006", "0.44348142", "0.44335842", "0.44329852", "0.44328627", "0.44238317", "0.4416643", "0.44156843", "0.44105545", "0.43979937", "0.43913424", "0.43909213", "0.4386504" ]
0.8104909
0
test that the activity is not null when the app is run
@Test public void testMessagesActivityNotNull(){ assertNotNull(messagesActivity); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void assertActivityNotNull() {\n if (mActivity == null) {\n mActivity = getActivity();\n assertNotNull(mActivity);\n }\n }", "@Test\n public void homeActivityShouldNotBeNull() {\n assertThat(homeActivity).isNotNull();\n }", "@SmallTest\n public void testForActivity() {\n solo.assertCurrentActivity(\"Wrong activity\", WelcomeActivity.class);\n }", "public static boolean initApp(final Activity activity) {\n\t\tLog.i(\"FEEDHENRY\", \"In initApp\");\n\t\tif (FHAgent.isOnline()) {\n\t\t\tif (activity == null) {\n\t\t\t\tinitFH(activity);\n\t\t\t} else {\n\t\t\t\tactivity.runOnUiThread(new Runnable() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tinitFH(activity);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tisInitialised = true;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "@Test\n public void testLaunch(){\n assertNotNull(mActivity.findViewById(R.id.createAccountTextView));\n assertNotNull(mActivity.findViewById(R.id.createAccountButton));\n assertNotNull(mActivity.findViewById(R.id.nameEditText));\n assertNotNull(mActivity.findViewById(R.id.emailEditText));\n assertNotNull(mActivity.findViewById(R.id.passwordEditText));\n assertNotNull(mActivity.findViewById(R.id.passwordImageView));\n assertNotNull(mActivity.findViewById(R.id.emailImageView));\n assertNotNull(mActivity.findViewById(R.id.personImageView));\n assertNotNull(mActivity.findViewById(R.id.spinner2));\n assertNotNull(mActivity.findViewById(R.id.arrowImageView));\n assertNotNull(mActivity.findViewById(R.id.progressBar));\n assertNotNull(mActivity.findViewById(R.id.backButton));\n }", "public void testPreconditions() {\r\n assertNotNull(\"activity is null\", activity);\r\n assertNotNull(\"fragment is null\", fragment);\r\n }", "@Test\n public void homeActivityShouldHaveAHello() {\n View hello = homeActivity.findViewById(R.id.email_text_view_home);\n assertThat(hello).isNotNull();\n }", "@Override\n public void onActivityPreCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {/**/}", "void onActivityReady();", "@Test\n public void triggerIntent_hasExtras() {\n onView(withId(getResourceId(\"switchActivity\"))).check(matches(notNullValue() ));\n onView(withId(getResourceId(\"switchActivity\"))).check(matches(withText(\"Change Page\")));\n onView(withId(getResourceId(\"switchActivity\"))).perform(click());\n intended(hasExtra(\"Developer\", \"Oguzhan Orhan\"));\n }", "@UiThreadTest\r\n public void testUserNotNull() {\r\n Intent loginIntent = new Intent();\r\n PomoUser user = new PomoUser(\"9a36d2f9018aacde1430411867961\", \"test\", \"1\", false, true, 1, 1);\r\n loginIntent.putExtra(ExtraName.POMO_USER, user);\r\n mainActivity.onActivityResult(1, Activity.RESULT_OK, loginIntent);\r\n assertNotNull(mainActivity.getUser());\r\n }", "@Before\n public void setup() {\n activity = Robolectric.setupActivity(MainActivity.class);\n }", "public void testPreconditions() {\n assertNotNull(\"Maps Activity is null\", mapsActivity);\n }", "@Test\n public void testInitAllActivity() throws Exception {\n assertNotNull(mainActivity);\n assertNotNull(addItemActivity);\n assertNotNull(addToDBActivity);\n assertNotNull(listActivity);\n assertNotNull(listItemActivity);\n }", "@Test\n public void testLaunch(){\n View view = mRegisterActivity.findViewById(R.id.register_button);\n assertNotNull(view);\n }", "public void testPreConditions() {\n\t\tassertNotNull(activity);\n\t\tassertNotNull(mFragment);\n\t\tassertNotNull(mAdapter);\n\t\tassertTrue(mAdapter instanceof MensaListAdapter);\n\t}", "@Test\n @SmallTest\n @Feature(\"MultiWindow\")\n public void testTabbedActivityForIntentNoActivitiesAlive() {\n ChromeTabbedActivity activity1 = mActivityTestRule.getActivity();\n activity1.finishAndRemoveTask();\n\n Assert.assertEquals(\n \"ChromeTabbedActivity should be used as the default for external intents.\",\n ChromeTabbedActivity.class,\n MultiWindowUtils.getInstance().getTabbedActivityForIntent(\n activity1.getIntent(), activity1));\n }", "@Test\n public void testGetActivityWithId_notFound() {\n UUID uuid = new UUID(0L, 0L);\n Activity resultActivity = activityStore.getActivityWithId(uuid);\n\n Assert.assertNull(resultActivity);\n }", "@Override\n public void needReloain(Activity activity) {\n }", "public void testFirstLoginToListActivityAndBack() {\n testFirstStartApp.testCorrectLogin();\n }", "boolean hasIntent();", "public static void validaContexto(Activity pActivity)\n\t{\n\t\tvrActivity = pActivity;\n\t}", "@Test\n public void test_createLocalGame(){\n CheckersMainActivity checkersActivity = new CheckersMainActivity();\n CheckersLocalGame localGame =\n (CheckersLocalGame) checkersActivity.createLocalGame(new CheckersGameState());\n assertNotNull(\"GameState was null\", localGame.getGameState());\n }", "@Test\n public void checkStartupToast() {\n //run with airplane mode so no internet connectivity\n onView(withText(\"Ensure data connectivity\")).inRoot(new ToastMatcher())\n .check(matches(isDisplayed()));\n }", "@Override\n public Void visitStartActivityTask(StartActivityTask<Void> startActivityTask) {\n return null;\n }", "private static boolean m33661d(Activity activity) {\n return !activity.isFinishing();\n }", "private void checkFirstLaunch(){\n SharedPreferencesEditor editor = new SharedPreferencesEditor(this);\n boolean test = editor.GetBoolean(\"firstLaunch\");\n if(test){\n loadData();\n return;\n }\n startActivity(new Intent(MainActivity.this, FirstLaunch.class));\n editor.WriteBoolean(\"firstLaunch\", true);\n }", "public static boolean m121746a(Context context, Intent intent) {\n List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 0);\n if (queryIntentActivities == null || queryIntentActivities.size() <= 0) {\n return true;\n }\n return false;\n }", "@Test\n\tpublic void testApplicationNull() throws Throwable {\n\t\tApplication testedObject = new Application();\n\n\t\tassertEquals(null, testedObject.getAppJson());\n\t\tassertEquals(null, testedObject.getApplicationName());\n\t}", "public boolean interceptStartActivityIfNeed(Intent intet, ActivityOptions activityOptions) {\n return false;\n }", "@Test\n public void activityLaunch() {\n onView(withId(R.id.button_main)).perform(click());\n onView(withId(R.id.text_header)).check(matches(isDisplayed()));\n\n onView(withId(R.id.button_second)).perform(click());\n onView(withId(R.id.text_header_reply)).check(matches(isDisplayed()));\n }", "@Before\n public void setUp() throws Exception {\n context = InstrumentationRegistry.getContext();\n mainActivity = (MainActivity) context;\n }", "protected void noActiveActivity() {\n\t\tLog.i(STARTUP, \"no active activity\");\n\t\tcancelNotification();\n\t\tcreateNotification();\n\t\tstartMainService();\t\t\n\t}", "@Test\n @SmallTest\n @Feature(\"MultiWindow\")\n @DisabledTest(message = \"https://crbug.com/1417018\")\n public void testTabbedActivityForIntentOnlyActivity1IsRunning() {\n ChromeTabbedActivity activity1 = mActivityTestRule.getActivity();\n ChromeTabbedActivity2 activity2 = createSecondChromeTabbedActivity(activity1);\n activity2.finishAndRemoveTask();\n\n Assert.assertEquals(\n \"ChromeTabbedActivity should be used for intents if ChromeTabbedActivity2 is \"\n + \"not running.\",\n ChromeTabbedActivity.class,\n MultiWindowUtils.getInstance().getTabbedActivityForIntent(\n activity1.getIntent(), activity1));\n }", "@Before\n public void setUp() {\n // Need to call start and resume to get the fragment that's been added\n activityController = Robolectric.buildActivity(AuthenticationActivity.class).\n create().start().resume().visible();\n authenticationActivity = (Activity) activityController.get();\n }", "public void goTestActivity()\n\t {\n\t }", "private void trySupplyCurrentActivity(){\n // Provides the current activity to the mMapView when a callback is requested.\n mMapView.setOnSupplyCurrentActivityListener(new MapView.OnSupplyCurrentActivityListener() {\n @Override\n public Activity onSupplyCurrentActivity() {\n return MapActivity.this;\n }\n });\n }", "@Test\n public void testSetupActuallyWorked() throws Exception {\n assertNotNull(successfulLoginActivity);\n assertNotNull(controller);\n assertEquals(EMAIL, successfulLoginActivity.getEmailText());\n assertEquals(PASSWORD, successfulLoginActivity.getPasswordText());\n }", "@Override\n public void onActivityCreated(Activity activity, Bundle bundle) {}", "@Override\n public void onActivityCreated(Activity activity, Bundle bundle) {\n }", "public void onActivityViewReady() {\n if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {\n Log.d(Logging.LOG_TAG, this + \" onActivityViewReady\");\n }\n }", "public static boolean m71678a(Activity activity) {\n if (f57214d || activity == null) {\n return false;\n }\n Intent intent = new Intent(activity, MusLoginActivity.class);\n if (C22352y.m74025f()) {\n Keva.getRepo(\"compliance_setting\").storeBoolean(\"need_to_show_ftc_age_gate_but_no_showed\", true);\n if (C21886a.f58594a.mo58324c()) {\n intent = new Intent(activity, SignUpOrLoginActivity.class);\n intent.putExtra(\"next_page\", Step.AGE_GATE.getValue());\n } else {\n intent.putExtra(\"init_page\", 4);\n }\n intent.putExtra(\"enter_type\", \"click_login\");\n } else if (C22352y.m74022c()) {\n intent.putExtra(\"init_page\", 5);\n intent.putExtra(\"enter_type\", \"click_sign_up\");\n } else if (C22352y.m74023d()) {\n intent.putExtra(\"init_page\", 6);\n intent.putExtra(\"enter_type\", \"click_sign_up\");\n } else if (!C22352y.m74024e()) {\n return false;\n } else {\n Intent intent2 = new Intent(activity, DeleteVideoAlertActivity.class);\n intent2.putExtra(\"age_gate_response\", new AgeGateResponse(0, \"\", C22345t.m73968c(), C22345t.m73976g()));\n activity.startActivity(intent2);\n return true;\n }\n f57214d = true;\n activity.startActivity(intent);\n return true;\n }", "private void tutorialCheck() {\n SharedPreferences sp = getApplicationContext().getSharedPreferences(getApplicationContext().getString(R.string.app_name), MODE_PRIVATE);\n if (sp.contains(\"Tutorial_Complete\")) {\n if (sp.getBoolean(\"Tutorial_Complete\", false)) {\n return;\n }\n }\n Intent intent = new Intent(this, TutorialPanel.class);\n startActivity(intent);\n }", "@Override\r\n public void setUp() throws Exception {\r\n super.setUp();\r\n mainActivity = getActivity();\r\n }", "private final boolean m24749a(Intent intent) {\n Preconditions.m21858a(intent, (Object) \"Intent can not be null\");\n if (!this.f23881a.getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {\n return true;\n }\n return false;\n }", "public void testLoginActivitySingUp() {\n testLoginActivity.testLoginActivitySingUp();\n }", "@Before\n public void setUp() {\n // Need to call start and resume to get the fragment that's been added\n homeController = Robolectric.buildActivity(AuthenticationActivity.class).\n create().start().resume().visible();\n homeActivity = (Activity) homeController.get();\n }", "@Test\n public void openLoginActivity() {\n }", "public static boolean isApplicationInBackground(Context context) {\r\n ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);\r\n List<RunningTaskInfo> taskList = am.getRunningTasks(1);\r\n if (taskList != null && !taskList.isEmpty()) {\r\n ComponentName topActivity = taskList.get(0).topActivity;\r\n if (topActivity != null && !topActivity.getPackageName().equals(context.getPackageName())) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "@Test\r\n public void lookProfileByNull() {\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n\r\n // A not connected user looked at member profile\r\n member.lookedBy(null);\r\n \r\n // Still no activity for member\r\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n }", "@Test\n public void testVersionExecutionPolicyNull() {\n AlertDialogNotification notification = new AlertDialogNotification();\n PersistentNotification persistentNotification = new PersistentNotification(notification);\n persistentNotification.setLastShown(new Date());\n\n boolean hasToBeShown = persistentNotification.hasToBeShown(1);\n assertTrue(hasToBeShown);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n if (getArguments() != null) {\n }\n\n }", "@Test\n public void lookUpMainActivity(){\n ListView lv = (ListView) mainActivity.findViewById(R.id.listView);\n EditText et = (EditText) mainActivity.findViewById(R.id.newListEditText);\n Button addNewList = (Button) mainActivity.findViewById(R.id.addNewListButton);\n\n assertNotNull(\"ListView could not be found in MainActivity\", lv);\n assertNotNull(\"EditText could not be found in MainActivity\", et);\n assertNotNull(\"Add new list button could not be found in MainActivity\", addNewList);\n }", "boolean isActivityNotValid(ExoSocialActivity activity, ExoSocialActivity comment) throws Exception;", "@Test\n public void onActivity_sync() {\n final List<String> events = new ArrayList<>();\n Handler mainHandler = new Handler(Looper.getMainLooper());\n\n try (ActivityScenario<RecreationRecordingActivity> scenario =\n ActivityScenario.launch(RecreationRecordingActivity.class)) {\n\n mainHandler.post(() -> events.add(\"before onActivity\"));\n scenario.onActivity(\n new ActivityAction<RecreationRecordingActivity>() {\n @Override\n public void perform(RecreationRecordingActivity activity) {\n events.add(\"in onActivity\");\n // as expected, on device tests become flaky and fail deterministically on\n // Robolectric with this line, as onActivity does not drain the main looper\n // after runnable executes\n // mainHandler.post(() -> events.add(\"post from onActivity\"));\n }\n });\n\n assertThat(events).containsExactly(\"before onActivity\", \"in onActivity\").inOrder();\n }\n }", "public Object checkIntenetConnection(Context context, Intent intent){\n\t\t\t\t\n\t\treturn null;\n\t}", "public void testGetActivityResourceString() {\n browserKey = mapsActivity.getResources().getString(R.string.browser_key);\n URL = mapsActivity.URL;\n assertNotNull(browserKey);\n assertNotNull(URL);\n }", "@Override\n\tpublic void onActivityCreated(Activity activity, Bundle savedInstanceState)\n\t{\n\t}", "@Test\n @SmallTest\n @Feature(\"MultiWindow\")\n public void testTabbedActivityForIntentOnlyActivity2IsRunning() {\n ChromeTabbedActivity activity1 = mActivityTestRule.getActivity();\n createSecondChromeTabbedActivity(activity1);\n activity1.finishAndRemoveTask();\n\n Assert.assertEquals(\n \"ChromeTabbedActivity2 should be used for intents if ChromeTabbedActivity is \"\n + \"not running.\",\n ChromeTabbedActivity2.class,\n MultiWindowUtils.getInstance().getTabbedActivityForIntent(\n activity1.getIntent(), activity1));\n }", "private final boolean m878a() {\n try {\n ApplicationInfo applicationInfo = this.f1350b.getPackageManager().getApplicationInfo(this.f1350b.getPackageName(), 128);\n return (applicationInfo == null || applicationInfo.metaData == null || !Boolean.TRUE.equals(applicationInfo.metaData.get(\"com.android.vending.splits.required\"))) ? false : true;\n } catch (PackageManager.NameNotFoundException e) {\n f1349a.mo44091d(\"App '%s' is not found in the PackageManager\", this.f1350b.getPackageName());\n return false;\n }\n }", "static public boolean isLaunched()\n\t{\n\t\tif (g_currentLaunch == null)\n\t\t return false;\n\t\telse\n\t\t return true;\n\t}", "private void openActivity() {\n }", "public static boolean hasBeenInitialized() {\n\t\treturn mContext != null;\n\t}", "@Test\n public void openMainActivity() {\n }", "public static Boolean isTopActivity(Context context, String packageName) {\n if (context == null || TextUtils.isEmpty(packageName)) {\n return null;\n }\n\n ActivityManager activityManager = (ActivityManager) context\n .getSystemService(Context.ACTIVITY_SERVICE);\n List<RunningTaskInfo> tasksInfo = activityManager.getRunningTasks(1);\n if (tasksInfo==null||tasksInfo.size()==0) {\n return null;\n }\n try {\n return packageName.equals(tasksInfo.get(0).topActivity\n .getPackageName());\n } catch (Exception e) {\n e.printStackTrace();\n return false;\n }\n }", "@SmallTest\n public void testView(){\n assertNotNull(mActivity);\n\n // Initialisiere das View Element\n final ListView listView = (ListView) mActivity.findViewById(R.id.activtiy_permission_management_list_view);\n\n assertNotNull(listView);\n }", "public boolean isActivityStarted() {\n return (mInCallActivity != null &&\n !mInCallActivity.isDestroyed() &&\n !mInCallActivity.isFinishing());\n }", "public Activity() {\n }", "@Test\n public void checkIfAddMeetingIsRunning() {\n onView(withId(R.id.add_meeting_activity)).perform(click());\n onView(withId(R.id.meeting_color)).perform(click());\n onView(withId(R.id.meeting_room)).perform(click());\n onView(withText(\"Salle DEUX\")).perform(click());\n onView(withId(R.id.meeting_topic)).perform(typeText(\"Mareu_2\"));\n onView(withId(R.id.date_btn)).perform(click());\n onView(withId(R.id.meeting_date)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.start_time_btn)).perform(click());\n onView(withId(R.id.meeting_start_time)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.end_time_btn)).perform(click());\n onView(withId(R.id.meeting_end_time)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.meeting_guests)).perform(typeText(\"[email protected] ; [email protected]\"));\n onView(withId(R.id.meeting_add_button)).check(matches(isDisplayed()));\n }", "public static boolean isAppSafe(Activity app) {\n return app instanceof BasePinActivity || app instanceof InputWordsActivity;\n }", "public final MainActivity m16895C() {\n if (this.f12260a != null) {\n return this.f12260a;\n }\n Log.e(\"UI_OPERATION\", \"parent link is null, Ui manager can not work with null parent!!!!!!!!!!!!!!\", m16892a());\n System.exit(0);\n return new MainActivity();\n }", "private void initializeActivity() {\n initializeActionbar();\n initializeActionDrawerToggle();\n setUpNavigationDrawer();\n setStartFragment();\n setFloatingButtonListener();\n setUpShareAppListener();\n hideWindowSoftKeyboard();\n }", "@Override\n public void onActivityCreated(Activity activity, Bundle savedInstanceState) {\n eventManager.fire(Event.ACTIVITY_ON_CREATE, activity);\n }", "public static void verify() {\n intended(toPackage(PelconnerMainActivity.class.getName() + \".vladast\"));\n }", "@Test\n\tpublic void testGetAppJsonNull() throws Throwable {\n\t\tApplication testedObject = new Application();\n\t\tApplicationInfo result = testedObject.getAppJson();\n\n\t\tassertEquals(null, result);\n\t}", "private void initiateActivity() {\r\n\t\tif (application == null) {\r\n\t\t\tthis.application = SmartApplication.REF_SMART_APPLICATION;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tif (application.attachedCrashHandler)\r\n\t\t\t\tCrashReportHandler.attach(this);\r\n\t\t} catch (Throwable e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\tfinish();\r\n\t\t}\r\n\r\n\t\tif (setLayoutView() != null) {\r\n\t\t\tsetContentView(setLayoutView());\r\n\t\t} else {\r\n\t\t\tsetContentView(setLayoutId());\r\n\t\t}\r\n\r\n\t}", "@Test\n public void testReturnsNullIfHostBrowserInManifestNotFoundAndAnotherBrowserSupportingWebApk() {\n mockInstallBrowsers(new String[] {ANOTHER_BROWSER_INSTALLED_SUPPORTING_WEBAPKS}, null);\n setHostBrowserInMetadata(BROWSER_UNINSTALLED_SUPPORTING_WEBAPKS);\n setHostBrowserInSharedPreferences(null);\n\n String hostBrowser = WebApkUtils.getHostBrowserPackageName(mContext);\n Assert.assertNull(hostBrowser);\n }", "@Test\n public void openTaskDetails_startsActivity() {\n String taskId = \"id\";\n\n // When opening the task details\n mTasksNavigator.openTaskDetails(taskId);\n\n // The AddEditTaskActivity is opened with the correct request code\n verify(mNavigationProvider).startActivityForResultWithExtra(eq(TaskDetailActivity.class),\n eq(-1), eq(TaskDetailActivity.EXTRA_TASK_ID), eq(taskId));\n }", "@Test\n public void testFinishingActivity(){\n Espresso.onView(ViewMatchers.withId(R.id.btn_homepage)).perform(ViewActions.click());\n Assert.assertTrue(finishActivityActivityTestRule.getActivity().isFinishing());\n }", "private static boolean m36207c(View view) {\n return VERSION.SDK_INT >= 19 ? view != null && view.isAttachedToWindow() : (view == null || view.getWindowToken() == null) ? false : true;\n }", "private void openVerificationActivity() {\n }", "@Test\n public void triggerIntentChange_v2(){\n onView(withId(getResourceId(\"switchActivity\"))).check(matches(notNullValue() ));\n onView(withId(getResourceId(\"switchActivity\"))).check(matches(withText(\"Change Page\")));\n onView(withId(getResourceId(\"switchActivity\"))).perform(click());\n intended(hasComponent(SecondActivity.class.getName())); /*that can be used also */\n }", "@Override\n public boolean onCreate() {\n myDB = new DBHelperActivity(getContext(), null, null, 1);\n return false;\n }", "@Test\n public void testVersionCodePolicyNull() {\n AlertDialogNotification notification = new AlertDialogNotification();\n PersistentNotification persistentNotification = new PersistentNotification(notification);\n\n boolean hasToBeShown = persistentNotification.hasToBeShown(1);\n assertTrue(hasToBeShown);\n }", "@BeforeClass\n private void launchActivity() {\n ActivityScenario<HomeActivity> activityScenario = ActivityScenario.launch(HomeActivity.class);\n activityScenario.onActivity(new ActivityScenario.ActivityAction<HomeActivity>() {\n @Override\n public void perform(HomeActivity activity) {\n mIdlingResource = activity.getIdlingResourceInTest();\n IdlingRegistry.getInstance().register(mIdlingResource);\n }\n });\n }", "@Override\n\tpublic Activity getActivity() {\n\t\treturn null;\n\t}", "@Override\n\tpublic Activity getActivity() {\n\t\treturn null;\n\t}", "protected void onFirstTimeLaunched() {\n }", "@Override\n public void onAttach(Activity activity) {\n super.onAttach(activity);\n\n //Log.d(\"DEBUGAPP\", TAG + \" onAttach\");\n\n if (activity instanceof MainActivity) {\n mainActivity = (MainActivity) activity;\n }\n }", "private void checkIntentHelperInitializedAndReliabilityTrackingEnabled() {\n mFakeIntentHelper.assertInitialized(UPDATE_APP_PACKAGE_NAME, DATA_APP_PACKAGE_NAME);\n\n // Assert that reliability tracking is always enabled after initialization.\n mFakeIntentHelper.assertReliabilityTriggerScheduled();\n }", "boolean isHasSupportForParentActivity();", "public static final boolean inMessagingApp(Context context) {\r\n \t\t// TODO: move these to static strings somewhere\r\n \t\tfinal String PACKAGE_NAME = \"com.android.mms\";\r\n \t\t// final String COMPOSE_CLASS_NAME =\r\n \t\t// \"com.android.mms.ui.ComposeMessageActivity\";\r\n \t\tfinal String CONVO_CLASS_NAME = \"com.android.mms.ui.ConversationList\";\r\n \r\n \t\tActivityManager mAM = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);\r\n \r\n \t\tList<RunningTaskInfo> mRunningTaskList = mAM.getRunningTasks(1);\r\n \t\tIterator<RunningTaskInfo> mIterator = mRunningTaskList.iterator();\r\n \t\tif (mIterator.hasNext()) {\r\n \t\t\tRunningTaskInfo mRunningTask = mIterator.next();\r\n \t\t\tif (mRunningTask != null) {\r\n \t\t\t\tComponentName runningTaskComponent = mRunningTask.baseActivity;\r\n \r\n \t\t\t\t// //Log.v(\"baseActivity = \" +\r\n \t\t\t\t// mRunningTask.baseActivity.toString());\r\n \t\t\t\t// //Log.v(\"topActivity = \" +\r\n \t\t\t\t// mRunningTask.topActivity.toString());\r\n \r\n \t\t\t\tif (PACKAGE_NAME.equals(runningTaskComponent.getPackageName())\r\n \t\t\t\t\t\t&& CONVO_CLASS_NAME.equals(runningTaskComponent.getClassName())) {\r\n \t\t\t\t\t// Log.v(\"User in messaging app - from running task\");\r\n \t\t\t\t\treturn true;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \r\n \t\t/*\r\n \t\t * List<RecentTaskInfo> mActivityList = mAM.getRecentTasks(1, 0);\r\n \t\t * Iterator<RecentTaskInfo> mIterator = mActivityList.iterator();\r\n \t\t * \r\n \t\t * if (mIterator.hasNext()) { RecentTaskInfo mRecentTask =\r\n \t\t * (RecentTaskInfo) mIterator.next(); Intent recentTaskIntent =\r\n \t\t * mRecentTask.baseIntent;\r\n \t\t * \r\n \t\t * if (recentTaskIntent != null) { ComponentName recentTaskComponentName\r\n \t\t * = recentTaskIntent.getComponent(); if (recentTaskComponentName !=\r\n \t\t * null) { String recentTaskClassName =\r\n \t\t * recentTaskComponentName.getClassName(); if\r\n \t\t * (PACKAGE_NAME.equals(recentTaskComponentName.getPackageName()) &&\r\n \t\t * (COMPOSE_CLASS_NAME.equals(recentTaskClassName) ||\r\n \t\t * CONVO_CLASS_NAME.equals(recentTaskClassName))) {\r\n \t\t * //Log.v(\"User in messaging app\"); return true; } } } }\r\n \t\t */\r\n \r\n \t\t/*\r\n \t\t * These appear to be the 2 main intents that mean the user is using the\r\n \t\t * messaging app\r\n \t\t * \r\n \t\t * action \"android.intent.action.MAIN\" data null class\r\n \t\t * \"com.android.mms.ui.ConversationList\" package \"com.android.mms\"\r\n \t\t * \r\n \t\t * action \"android.intent.action.VIEW\" data\r\n \t\t * \"content://mms-sms/threadID/3\" class\r\n \t\t * \"com.android.mms.ui.ComposeMessageActivity\" package \"com.android.mms\"\r\n \t\t */\r\n \r\n \t\treturn false;\r\n \t}", "public boolean isDestroyingActivity() {\n return isFinishing() || Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed();\n }", "@Test\n public void TestNextAppNoUpcoming () {\n onView(withId(R.id.noUpcoming)).check(matches(withText(containsString(\"No Upcoming Appointments\"))));\n }", "private void checkIfLoggedIn() {\n LocalStorage localStorage = new LocalStorage(getApplicationContext());\n\n if(localStorage.checkIfAuthorityPresent()){\n Intent intent = new Intent(getApplicationContext(),AuthorityPrimaryActivity.class);\n startActivity(intent);\n } else if(localStorage.checkIfUserPresent()){\n Intent intent = new Intent(getApplicationContext(), UserPrimaryActivity.class);\n startActivity(intent);\n }\n }", "@Test(expected = IllegalArgumentException.class)\n public void testConstructorSiteNull() {\n PlannedActivity plannedActivity = new PlannedActivity(0, null,\n new Typology(\"typology\"), \"desctiption\", 0, true, 1,\n new Procedure(\"name\", \"smp\"), \"workspaceNotes\");\n\n }", "@Config(qualifiers = \"mcc999\")\n @Test\n public void layoutWithoutAnimation_shouldNotCrash() {\n setupActivity_onRearDevice();\n\n EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();\n enrollmentCallback.onEnrollmentProgress(123);\n enrollmentCallback.onEnrollmentError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, \"test\");\n\n ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);\n IntentForResult startedActivity =\n shadowActivity.getNextStartedActivityForResult();\n assertWithMessage(\"Next activity\").that(startedActivity).isNotNull();\n assertThat(startedActivity.intent.getComponent())\n .isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));\n }", "protected boolean findDefault(DisplayResolveInfo info) {\r\n List<IntentFilter> intentList = new ArrayList<IntentFilter>();\r\n List<ComponentName> prefActList = new ArrayList<ComponentName>();\r\n final String packageName = info.ri.activityInfo.packageName;\r\n \r\n mPm.getPreferredActivities(intentList, prefActList, packageName);\r\n if (prefActList.size() <= 0) {\r\n \treturn false;\r\n } // End of if\r\n \treturn true;\r\n }", "private boolean checkFirstRun(Context context) {\n\n final String PREFS_NAME = \"com.zgsoft.prefs\";\n final String PREF_VERSION_CODE_KEY = \"version_code\";\n final int DOESNT_EXIST = -1;\n // String packageName=null;\n\n\n // Get current version code\n int currentVersionCode = 0;\n try {\n PackageInfo packageInfo =context.getPackageManager().getPackageInfo(context.getPackageName(), 0);\n currentVersionCode =packageInfo.versionCode;\n //packageName = packageInfo.packageName;\n\n } catch (android.content.pm.PackageManager.NameNotFoundException e) {\n // handle exception\n e.printStackTrace();\n return false;\n }\n\n\n // Get saved version code\n SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, android.content.Context.MODE_PRIVATE);\n int savedVersionCode = prefs.getInt(PREF_VERSION_CODE_KEY, DOESNT_EXIST);\n\n // Check for first run or upgrade\n if (currentVersionCode == savedVersionCode) {\n\n // This is just a normal run\n return false;\n\n } else {\n // Update the shared preferences with the current version code\n prefs.edit().putInt(PREF_VERSION_CODE_KEY, currentVersionCode).commit();\n return true;\n }\n\n }", "private static void checkToast() {\n\t\tif (mToast == null) {\n\t\t\tmToast = Toast.makeText(GlobalApp.getApp(), null,\n\t\t\t\t\tToast.LENGTH_SHORT);\n\t\t}\n\t}" ]
[ "0.73421663", "0.6984727", "0.6595826", "0.65064174", "0.6395282", "0.63772863", "0.63509053", "0.6189581", "0.612426", "0.61046994", "0.6084199", "0.606066", "0.6024518", "0.6011281", "0.5976326", "0.59431905", "0.5931404", "0.5901374", "0.58905846", "0.58736426", "0.5836776", "0.58253175", "0.5746601", "0.5722658", "0.5696591", "0.5692585", "0.5671988", "0.5671963", "0.5644573", "0.5635423", "0.5620232", "0.56057334", "0.55964935", "0.5595978", "0.5594229", "0.55912125", "0.554601", "0.5539826", "0.55389714", "0.55354947", "0.5525787", "0.55048144", "0.55046344", "0.5499693", "0.54919076", "0.5491119", "0.5483839", "0.5476667", "0.54653764", "0.54621345", "0.5461099", "0.5459178", "0.54565173", "0.5441874", "0.5439263", "0.5435493", "0.5427036", "0.5418447", "0.5414306", "0.5409441", "0.5399997", "0.5384352", "0.5378699", "0.5371903", "0.5371826", "0.5370749", "0.53652817", "0.535804", "0.53528154", "0.53518766", "0.53453", "0.5339555", "0.53384393", "0.53338736", "0.5327135", "0.5323968", "0.53212166", "0.5319012", "0.53157693", "0.53067297", "0.53059405", "0.5304307", "0.5303286", "0.5302606", "0.5292877", "0.5288496", "0.5288496", "0.5280392", "0.5280231", "0.5274927", "0.5267344", "0.5265019", "0.526422", "0.52601963", "0.5257871", "0.52503014", "0.52498865", "0.5245042", "0.52426046", "0.5235484" ]
0.62046975
7
test that the chat log is not null when the activity is run
@Test public void testChatLogExists(){ ListView chatLog = messagesActivity.listOfMessages; assertNotNull(chatLog); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testMessagesActivityNotNull(){\n assertNotNull(messagesActivity);\n }", "private static void initLog() {\n LogManager.mCallback = null;\n if (SettingsManager.getDefaultState().debugToasts) {\n Toast.makeText(mContext, mContext.getClass().getCanonicalName(), Toast.LENGTH_SHORT).show();\n }\n if (SettingsManager.getDefaultState().debugLevel >= LogManager.LEVEL_ERRORS) {\n new TopExceptionHandler(SettingsManager.getDefaultState().debugMail);\n }\n //Si hubo un crash grave se guardo el reporte en el sharedpreferences, por lo que al inicio\n //levanto los posibles crashes y, si el envio por mail está activado , lo envio\n String possibleCrash = StoreManager.pullString(\"crash\");\n if (!possibleCrash.equals(\"\")) {\n OtherAppsConnectionManager.sendMail(\"Stack\", possibleCrash, SettingsManager.getDefaultState().debugMailAddress);\n StoreManager.removeObject(\"crash\");\n }\n }", "boolean hasChatData();", "public static boolean log() {\n\t\tif ((xml == null) || (log == null)) return false;\n\t\treturn log.equals(\"yes\");\n\t}", "@Test\n public void testMessageTimeNotNull(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testMessageTime\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n TextView messageTime= messagesActivity.messageTime;\n assertNotNull(messageTime);\n }", "public boolean isSetChat() {\n return this.chat != null;\n }", "@Override\n public boolean init() {\n MyLogger.logD(CLASS_TAG, \"[init]\");\n try {\n mCalllogDatas = getCallLogEntry();\n mOtherPhone = isOtherPhone();\n MyLogger.logD(CLASS_TAG, \"[init]====otherPhone?===\" + mOtherPhone);\n } catch (Exception e) {\n // TODO Auto-generated catch block\n MyLogger.logE(CLASS_TAG, \"[init]====>> FAILED!\");\n return false;\n }\n return true;\n }", "protected void checkLog() {\n String keyword = \"Connected controllable Agent to the Introscope Enterprise Manager\";\n LogUtils util = utilities.createLogUtils(umAgentConfig.getLogPath(), keyword);\n assertTrue(util.isKeywordInLog());\n\t}", "@Override\n public void initializeLogging() {\n // Wraps Android's native log framework.\n LogWrapper logWrapper = new LogWrapper();\n // Using Log, front-end to the logging chain, emulates android.util.log method signatures.\n Log.setLogNode(logWrapper);\n\n // Filter strips out everything except the message text.\n MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();\n logWrapper.setNext(msgFilter);\n\n // On screen logging via a fragment with a TextView.\n //LogFragment logFragment = (LogFragment) getSupportFragmentManager()\n // .findFragmentById(R.id.log_fragment);\n //msgFilter.setNext(logFragment.getLogView());\n\n mLogFragment = (LogFragment) getSupportFragmentManager()\n .findFragmentById(R.id.log_fragment);\n msgFilter.setNext(mLogFragment.getLogView());\n\n Log.i(TAG, \"Ready\");\n }", "default boolean isActivityLoggingEnabled() {\n return false;\n }", "public ChatActivity() {\n }", "private void initLog() {\n _logsList = (ListView) findViewById(R.id.lv_log);\n setupLogger();\n }", "boolean hasChatRoom();", "@Test\n public void homeActivityShouldNotBeNull() {\n assertThat(homeActivity).isNotNull();\n }", "static public boolean isLogging()\n {\n return GetInstance().m_bLog;\n }", "public void testIsLoggable_Null_NoOutputStream() {\n StreamHandler h = new StreamHandler();\n assertFalse(h.isLoggable(null));\n }", "private void logAndToast(String msg) {\n Log.d(TAG, msg);\n if (logToast != null) {\n logToast.cancel();\n }\n logToast = Toast.makeText(this, msg, Toast.LENGTH_LONG);\n logToast.show();\n }", "private void assertActivityNotNull() {\n if (mActivity == null) {\n mActivity = getActivity();\n assertNotNull(mActivity);\n }\n }", "public boolean checkForSnapChat()\n\t{\n\t\tActivityManager activityManager = (ActivityManager) context.getSystemService( ACTIVITY_SERVICE );\n\t\tList<RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();\n\t\tfor(int i = 0; i < procInfos.size(); i++){\n\t\t\tif(procInfos.get(i).processName.equals(\"com.snapchat.android\")) {\n\t\t\t\treturn true;\n\t\t }\n\t\t}\n\t\t \n\t\treturn false;\n\t}", "@Test\r\n public void test_logEntrance1_NoLogging() throws Exception {\r\n log = null;\r\n LoggingWrapperUtility.logEntrance(log, signature, paramNames, paramValues);\r\n\r\n assertEquals(\"'logEntrance' should be correct.\", 0, TestsHelper.readFile(TestsHelper.LOG_FILE).length());\r\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n Bundle bundle = intent.getExtras();\n int messageCID = bundle.getInt(\"clubID\",0);\n int messageTID = bundle.getInt(\"tournamentID\",0);\n if ( tournamentID != 0 ) { // tournament chat\n if ( messageTID == tournamentID ) {\n Log.d(TAG,\"New Tournament Chat\");\n loadMoreRecentChat();\n }\n } else if ( clubID != 0) { // club chat\n if ( clubID == messageCID ) {\n Log.d(TAG,\"New Club Chat\");\n loadMoreRecentChat();\n }\n } else {\n Log.d(TAG,\"Unknown Notification\");\n loadMoreRecentChat();\n }\n\n }", "@Test\n public void testChatLogHasCorrectID(){\n ListView chatLog = messagesActivity.listOfMessages;\n int ID = chatLog.getId();\n int expectedID = R.id.list_of_messages;\n assertEquals(ID, expectedID);\n }", "@Test\n public void testCheckNullWithLogging() {\n Helper.checkNullWithLogging(\"obj\", \"obj\", \"method\", LogManager.getLog());\n }", "public boolean addChatLog(ChatLog cl)\n\t{\n\t\treturn chatLog.add(cl);\n\t}", "@Test\r\n public void test_logEntrance2_NoLogging() throws Exception {\r\n log = null;\r\n LoggingWrapperUtility.logEntrance(log, signature, paramNames, paramValues, true, Level.INFO);\r\n\r\n assertEquals(\"'logEntrance' should be correct.\", 0, TestsHelper.readFile(TestsHelper.LOG_FILE).length());\r\n }", "public void onActivityViewReady() {\n if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {\n Log.d(Logging.LOG_TAG, this + \" onActivityViewReady\");\n }\n }", "public final boolean hasHerochat()\n\t{\n\t\treturn herochat != null;\n\t}", "public static String getLog() {\n\t\tif ((xml == null) || (log == null) || !log.equals(\"yes\")) return \"no\";\n\t\treturn \"yes\";\n\t}", "@Test\n public void checkStartupToast() {\n //run with airplane mode so no internet connectivity\n onView(withText(\"Ensure data connectivity\")).inRoot(new ToastMatcher())\n .check(matches(isDisplayed()));\n }", "public boolean hasLog() {\r\n\t\treturn hasLog;\r\n\t}", "void ReadChatLog()\r\n {\r\n try{\r\n BufferedReader chatLogReader = new BufferedReader(new FileReader(pda_TCPServerMT.chatLog));\r\n while(chatLogReader.ready())\r\n WriteCypherMessage(chatLogReader.readLine());\r\n\r\n chatLogReader.close();\r\n } catch (Exception e){}\r\n }", "void onLogFragmentReady() {\n\t CreeperContext.init(this);\n\t \n\t CreeperContext.getInstance().controller = new RaspberryPiController();\n\t \n\t // Check that WebRTC stuff is functional\n\t pokeWebRTC();\n\n\t // Run the USB Socket server\n\t\tnew Thread(new Runnable() {\n\t public void run() {\n\t \ttry {\n\t \t\tusbSocketServer = new UsbSocketServer(BootstrapActivity.this);\n\t \t\tusbSocketServer.run();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tCreeperContext.getInstance().error(\"Badness:\", e);\n\t\t\t\t}\n\t }\n\t }).start();\n\n\t // Run the WebServer\n\t\tnew Thread(new Runnable() {\n\t public void run() {\n\t \ttry {\n\t \t\twebSocketServer = new WebSocketServer(BootstrapActivity.this);\n\t \t\twebSocketServer.run();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tCreeperContext.getInstance().error(\"Badness:\", e);\n\t\t\t\t}\n\t }\n\t }).start();\n\t}", "public boolean isChatEnabled();", "private Chat getChatSession(Intent intent) {\n ApiManager instance = ApiManager.getInstance();\n String sessionId = intent\n .getStringExtra(ChatIntent.EXTRA_CONTACT);\n if (instance == null) {\n Logger.i(TAG, \"ApiManager instance is null\");\n return null;\n }\n ChatService chatApi = instance.getChatApi();\n if (chatApi == null) {\n Logger.d(TAG, \"MessageingApi instance is null\");\n return null;\n }\n Chat chatSession = null;\n Logger.d(TAG, \"The chat session is null1\");\n try {\n chatSession = chatApi.getChat(sessionId);\n } catch (JoynServiceException e) {\n Logger.e(TAG, \"Get chat session failed\");\n Logger.d(TAG, \"The chat session is null2\");\n e.printStackTrace();\n chatSession = null;\n }\n if (chatSession != null) {\n return chatSession;\n }\n try {\n // Set<Chat> totalChats = null;\n Set<Chat> totalChats = chatApi.getChats();\n if (totalChats != null) {\n Logger.w(TAG, \"aaa getChatSession size: \"\n + totalChats.size());\n Logger.d(TAG, \"The chat session is null3 : \"\n + totalChats.size());\n for (Chat setElement : totalChats) {\n if (setElement.getRemoteContact().equals(\n sessionId)) {\n Logger.e(TAG, \"Get chat session finally\");\n // might work or might throw exception, Java calls it\n // indefined behaviour:\n chatSession = setElement;\n break;\n }\n }\n } else {\n Logger.w(TAG, \"aaa getChatSession size: null\");\n }\n } catch (JoynServiceException e) {\n Logger.e(TAG, \"Get chat session xyz\");\n e.printStackTrace();\n }\n return chatSession;\n }", "private static void checkToast() {\n\t\tif (mToast == null) {\n\t\t\tmToast = Toast.makeText(GlobalApp.getApp(), null,\n\t\t\t\t\tToast.LENGTH_SHORT);\n\t\t}\n\t}", "@SmallTest\n public void testForActivity() {\n solo.assertCurrentActivity(\"Wrong activity\", WelcomeActivity.class);\n }", "private void MyCallLogTest() {\n\n if (INIT) {\n call_Remote.startRemote(callNum, calledModle,\"116.7425\", \"35.8867\", \"北京市西城区研究院605\");\n } else {\n call_Remote = new CallLogRemote();\n call_Remote.init(mContext, new CallLogRemote.CallListener() {\n @Override\n public void endCall(final long testime, CellInfoBean bean) {\n MyLog.log(\"testime:\" + testime);\n cellInfoBean = bean;\n try {\n Thread.sleep(2000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n ContentResolver crcr = getContentResolver();\n CallUtil.getCallHistoryList(mContext, crcr);\n long callTime = CallUtil.getCallTime();\n if (callTime > 0) {\n //呼叫成功\n cellInfoBean.setCallSuccess(\"是\");\n long tt = (testime - callTime * 1000);\n cellInfoBean.setTestTimeLong(tt-phoneDelay + \"\");\n MyLog.log(\"tt:::\"+tt+\"-----tt-phoneDelay::\"+(tt-phoneDelay));\n } else {\n //呼叫失败\n cellInfoBean.setCallSuccess(\"否\");\n cellInfoBean.setTestTimeLong(\"0\");\n }\n cellInfoBean.setCallTimeLong(callTime+\"\");\n textMessage.setText(cellInfoBean.toString());\n CSVUtil.outputLog(call_Remote.getCsvPath() + call_Remote.getCsvName() + \".detail.csv\", cellInfoBean.toStringToText());\n }\n });\n }\n });\n INIT = true;\n call_Remote.startRemote(callNum,calledModle, \"116.7425\", \"35.8867\", \"北京市西城区研究院605\");\n }\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.chat_activity);\n\t\t\n\t\ttext = (EditText)findViewById(R.id.etSendMsg);\n\t\tchat = (TextView)findViewById(R.id.tvChat);\n\t\tsend = (Button)findViewById(R.id.bSend);\n\t\t\n\t\tsend.setOnClickListener(this);\n\t\tuser = getIntent().getStringExtra(\"user\");\n\t\tchallenged = getIntent().getStringExtra(\"challenged\");\n\t\tsa = ((SharingAtts)getApplication());\n\t\t\n\t\tit = new ItemTest();\n\t\tString colNames = it.printData(\"chat\")[1];\n\t\tdbm = new DBManager(this, colNames, \"chat\", it.printData(\"chat\")[0]);\n\t\tWarpClient.initialize(Constants.apiKey, Constants.secretKey);\n\t\ttry {\n\t\t\tmyGame = WarpClient.getInstance();\n\t\t\tmyGame.addConnectionRequestListener(this); \n\t\t\tmyGame.connectWithUserName(user);\n\t\t\tmyGame.addNotificationListener(this);\n\t\t\tmyGame.addChatRequestListener(this);\n\t\t\tchat.setText(\"\");\n\t\t\t\n\t\t\tmyGame.addZoneRequestListener(this);\n\t\t\t/*\n\t\t\tmyGame.addRoomRequestListener(this);\n\t\t\tmyGame.addChatRequestListener(this);\n\t\t\t\n\t\t\t*/\n\t\t\t//myGame.getOnlineUsers();\n\t\t\t\n\t\t\t//myGame.addTurnBasedRoomListener(this);\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tdbm.openToRead();\n\t\tString msgs = dbm.directQuery(\"SELECT sender,message FROM chat WHERE ((sender LIKE '\"+ sa.name+\"' AND receiver LIKE '\"+ challenged+ \"')\"+\n\t\t\t\t\" OR (sender LIKE '\"+challenged+\"' AND receiver LIKE '\"+ sa.name+\"'))\"+\n\t\t\t\t\"\", new String[]{ \"sender\",\"message\"});\n\t\tLog.d(\"special_query\", \"SELECT sender,message FROM chat WHERE sender LIKE '\"+ sa.name+\"' AND receiver LIKE '\"+ challenged+ \"'\"+\n\t\t\t\t\" OR sender LIKE '\"+challenged+\"' AND receiver LIKE '\"+ sa.name+\"'\"+\n\t\t\t\t\"\");\n\t\tString allRows = dbm.directQuery(\"SELECT * FROM chat\", it.printData(\"chat\")[1].split(\" \"));\n\t\t//allRows.replace(\" \", \"->\");\n\t\tString[] all = allRows.split(\"\\n\");\n\t\t\n\t\tfor(int i=0; i<all.length;i++){\n\t\t\tall[i].replace(\" \", \"->\");;\n\t\t\tLog.d(\"row_\"+i, all[i]);\n\t\t}\n\t\tdbm.close();\n\t\tmsgs = msgs.replace(\",\", \" : \");\n\t\tif(msgs!=null)\n\t\t\tchat.setText(msgs);\n\t\telse\n\t\t\tLog.e(\"msgs\", \"msg is null\");\n\t\t\n\t}", "@Override\n\tprotected void start() {\n\t\tif (Cfg.DEBUG) {\n\t\t\tCheck.log(TAG + \" (actualStart)\");\n\t\t}\n\t\treadChatMessages();\n\t}", "@Test\n public void testAddChatLine() {\n System.out.println(\"addChatLine\");\n String line = \"\";\n ChatLog instance = new ChatLog();\n instance.addChatLine(line);\n assertEquals(instance.getChatLines().size(), 1);\n }", "@Test\n public void testGetChat()\n {\n System.out.println(\"getChat\");\n Account account = new Account(\"Bob\");\n Party instance = new Party(account);\n instance.sendMessage(account, \"Test\");\n boolean expResult = true;\n boolean result = false;\n for (Message chatMessage : instance.getChat())\n {\n if (chatMessage.getText().equals(\"Test\"))\n {\n result = true;\n break;\n }\n }\n assertEquals(\"There are no messages in the chat.\", expResult, result);\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isChatMessagesLoaded() {\n return chatMessagesLoaded;\n }", "@Test\n public void homeActivityShouldHaveAHello() {\n View hello = homeActivity.findViewById(R.id.email_text_view_home);\n assertThat(hello).isNotNull();\n }", "@Test\n public void testClient(){\n received=false;\n uut=new ChatMessageRequest(\"test\",\"test2\",\"test\",MessageTypes.MATCH);\n uut.clientHandle(null,new TestUtilizer());\n assertTrue(received);\n }", "public static boolean initApp(final Activity activity) {\n\t\tLog.i(\"FEEDHENRY\", \"In initApp\");\n\t\tif (FHAgent.isOnline()) {\n\t\t\tif (activity == null) {\n\t\t\t\tinitFH(activity);\n\t\t\t} else {\n\t\t\t\tactivity.runOnUiThread(new Runnable() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tinitFH(activity);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tisInitialised = true;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "@Override\n\tpublic void onChatReceived(ChatEvent arg0) {\n\t\t\n\t}", "private void init() {\r\n btn_left = (TextView) findViewById(R.id.btn_left);\r\n setUnReadMessageNum();\r\n title_view = (TextView) findViewById(R.id.title_view);\r\n meModel = UserManager.getPWUser(this);\r\n Intent intent = getIntent();\r\n msg_id = intent.getStringExtra(\"msg_id\");\r\n\r\n show_prompt = getIntent().getBooleanExtra(\"show_prompt\", false);\r\n if (intent.hasExtra(\"msg_user\")) {\r\n CustomLog.d(\"msg_user if case.\");\r\n if (msg_id != null && msg_id.equals(\"0\")) {\r\n String selection = PWDBConfig.UidMsgId.UID + \" = ?\";\r\n String[] selectionArgs = new String[]{String.valueOf(otherModel.uid)};\r\n Cursor mCursor = getContentResolver().query(PWDBConfig.UidMsgId.CONTENT_URI, null, selection, selectionArgs, null);\r\n if (mCursor != null) {\r\n if (mCursor.getCount() > 0) {\r\n mCursor.moveToFirst();\r\n msg_id = mCursor.getString(mCursor.getColumnIndex(PWDBConfig.UidMsgId.MSG_ID));\r\n }\r\n mCursor.close();\r\n mCursor = null;\r\n }\r\n }\r\n if (msg_id != null && msg_id.equals(\"0\")) {\r\n getUserMsgId();\r\n }\r\n } else {\r\n int uid = intent.getIntExtra(\"uid\", 0);\r\n String selection = PWDBConfig.MessagesTable.UID + \" = ?\";\r\n String[] selectionArgs = new String[]{String.valueOf(uid)};\r\n Cursor mCursor = getContentResolver().query(PWDBConfig.MessagesTable.CONTENT_URI, null, selection, selectionArgs, null);\r\n if (mCursor == null) {\r\n return;\r\n }\r\n if (mCursor.getCount() == 0) {\r\n mCursor.close();\r\n mCursor = null;\r\n return;\r\n }\r\n mCursor.moveToFirst();\r\n TabMsgModel msgModel = new TabMsgModel(mCursor);\r\n otherModel = msgModel.userModel;\r\n CustomLog.d(\"msg_user else case.\");\r\n mCursor.close();\r\n mCursor = null;\r\n }\r\n what_message_from = getIntent().getIntExtra(UserInfoActivity.MESSAGE_FROM, 0);\r\n if (what_message_from == 0x03) {\r\n createFeedFlowMessage();\r\n }\r\n setBarTitle(UserManager.getRealName(otherModel.uid, otherModel.name, this), otherModel.avatar_thumbnail);\r\n\r\n\r\n //call_phone_layout = findViewById(R.id.call_phone_layout);\r\n send_message_layout = findViewById(R.id.send_message_layout);\r\n\r\n //emotionEditText.setOnEditorActionListener(this);\r\n //emotionEditText.addTextChangedListener(new MessageEditTextWatcher());\r\n\r\n //ct_tips = (CivilizationTipsView) findViewById(R.id.ct_tips);\r\n\r\n //hot_layout = findViewById(R.id.hot_layout);\r\n// iv_fire1 = (ImageView) findViewById(R.id.iv_fire1);\r\n// iv_fire2 = (ImageView) findViewById(R.id.iv_fire2);\r\n// iv_fire3 = (ImageView) findViewById(R.id.iv_fire3);\r\n //rl_sayhello = findViewById(R.id.rl_sayhello);\r\n ListView lv_msgaccepted = (ListView) findViewById(R.id.lv_msgaccepted);\r\n if (otherModel.uid == DfineAction.SYSTEM_UID) {\r\n //lv_msgaccepted.setStackFromBottom(false);\r\n //lv_msgaccepted.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_NORMAL);\r\n }\r\n adapter = new MsgAcceptAdapter(mList, this, lv_msgaccepted);\r\n\r\n //btn_send_img_btn = (ImageView) findViewById(R.id.btn_send_img_btn);\r\n\r\n\r\n //msg_more_type_layout = findViewById(R.id.msg_more_type_layout);\r\n\r\n //btn_send_text_btn.setVisibility(View.GONE);\r\n //btn_send_img_btn.setVisibility(View.VISIBLE);\r\n\r\n adapter.setUserData(meModel, otherModel);\r\n lv_msgaccepted.setAdapter(adapter);\r\n// mHandler.postDelayed(new Runnable() {\r\n// @Override\r\n// public void run() {\r\n// showTipsIfNeed();\r\n// }\r\n// }, 200);\r\n\r\n if (otherModel.uid == DfineAction.SYSTEM_UID) {\r\n send_message_layout.setVisibility(View.GONE);\r\n //call_phone_layout.setVisibility(View.GONE);\r\n //hot_layout.setVisibility(View.GONE);\r\n //rl_sayhello.setVisibility(View.GONE);\r\n }\r\n\r\n image_quick_switch = (ImageQuickSwitchView) findViewById(R.id.image_quick_switch);\r\n image_quick_switch.setOnMoreActionClickListener(this::startImageSwitch);\r\n\r\n if (otherModel.uid != DfineAction.SYSTEM_UID) {\r\n lv_msgaccepted.setOnTouchListener((v, event) -> {\r\n switch (event.getAction() & MotionEvent.ACTION_MASK) {\r\n case MotionEvent.ACTION_DOWN:\r\n inputMethodManager.hideSoftInputFromWindow(emotionEditText.getWindowToken(), 0);\r\n// if (face_lay.getVisibility() != View.GONE)\r\n// face_lay.setVisibility(View.GONE);\r\n// if (image_quick_switch.getVisibility() != View.GONE)\r\n// image_quick_switch.setVisibility(View.GONE);\r\n mDetector.interceptBackPress();\r\n break;\r\n }\r\n return false;\r\n });\r\n lv_msgaccepted.setOnScrollListener(new AbsListView.OnScrollListener() {\r\n @Override\r\n public void onScrollStateChanged(AbsListView view, int scrollState) {\r\n if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {\r\n inputMethodManager.hideSoftInputFromWindow(emotionEditText.getWindowToken(), 0);\r\n// if (face_lay.getVisibility() != View.GONE)\r\n// face_lay.setVisibility(View.GONE);\r\n// if (image_quick_switch.getVisibility() != View.GONE)\r\n// image_quick_switch.setVisibility(View.GONE);\r\n mDetector.interceptBackPress();\r\n }\r\n }\r\n\r\n @Override\r\n public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {\r\n\r\n }\r\n });\r\n }\r\n\r\n }", "public final ArrayList<ChatLog> getChatLog()\n\t{\n\t\treturn chatLog;\n\t}", "public void checkLogUser()\n {\n //get User\n\n String s1 = sharedPreferences.getString(\"LogUser\",\"\");\n\n Log.i(TAG,s1);\n\n if(!(s1 == \"\"))\n {\n ///call the Home Screen ;\n Intent intent = new Intent(LoginActivity.this, MainActivity.class);\n String myJson = gson.toJson(s1);\n intent.putExtra(\"user\", myJson);\n startActivity(intent);\n finish();\n\n }\n }", "public boolean chatEnabled();", "boolean hasChatType();", "@Override\r\n\t@SuppressLint(\"NewApi\")\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tmContext = EditTraceInfoActivity.this;\r\n\t\t// df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm\", Locale.CHINA);\r\n\t\tdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm\", Locale.CHINA);\r\n\t\tinitView();\r\n\t\tinitListener();\r\n\t\ttrackState = getIntent().getStringExtra(CodeConstants.TRACK);\r\n\t\tleaveDate = getIntent().getStringExtra(CodeConstants.LEAVE_DATE);\r\n\t\tbackDate = getIntent().getStringExtra(CodeConstants.BACK_DATE);\r\n\t\tpersonId = getIntent().getStringExtra(CodeConstants.PERSON_ID);\r\n\t\tcause = getIntent().getStringExtra(CodeConstants.CAUSE);\r\n\t\tLog.d(TAG, \"trackState=\" + trackState);\r\n\t\tLog.d(TAG, \"personId=\" + personId);\r\n\t\tLog.d(TAG, \"personId.isEmpty=\" + TextUtils.isEmpty(personId));\r\n\r\n\t}", "@Test\n public void testNoTimestamp() throws IOException {\n InputStream fileStream;\n fileStream = mTestResources.openRawResource(\n com.android.bluetooth.tests.R.raw.no_timestamp_call_log);\n BluetoothPbapVcardList pbapVCardList = new BluetoothPbapVcardList(mAccount, fileStream,\n PbapClientConnectionHandler.VCARD_TYPE_30);\n Assert.assertEquals(1, pbapVCardList.getCount());\n CallLogPullRequest processor =\n new CallLogPullRequest(mTargetContext, PbapClientConnectionHandler.MCH_PATH,\n new HashMap<>(), mAccount);\n processor.setResults(pbapVCardList.getList());\n\n // Verify that these entries aren't in the call log to start.\n Assert.assertFalse(verifyCallLog(\"555-0001\", null, \"3\"));\n\n // Finish processing the data and verify entries were added to the call log.\n processor.onPullComplete();\n Assert.assertTrue(verifyCallLog(\"555-0001\", null, \"3\"));\n }", "@Test\n public void openMessagesActivity() {\n }", "@Override\n\tpublic boolean isHistoryEmpty() {\n\t\tif (this.movements == null) {\n\t\t\tString token = \"UNKOWN\";\n\t\t\tif((session != null)&&(session.getParticipant() != null)&&(session.getParticipant().getToken() != null))token = session.getParticipant().getToken();\n\t\t\tif (LOGGER.isDebugEnabled()) {\n\t\t\t\tLOGGER.debug(\"history null while empty check for token {}\",token);\n\t\t\t}\n\t\t\treturn true;\n\t\t} \n\t\telse if (this.movements.isEmpty()) {\n\t\t\treturn true;\n\t\t} \n\t\telse {\n\t\t\tif ((this.movements.size() == 1)\n\t\t\t\t\t&& ((this.movements.get(0)).equals(this.retrieveViewId()))) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "@Test\r\n public void testEmptyUser(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"The username Cannot Be Empty!!\", 1,2000));\r\n\r\n }", "public boolean isRoomstlogidInitialized() {\n return roomstlogid_is_initialized; \n }", "@Test\r\n public void lookProfileByNull() {\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n\r\n // A not connected user looked at member profile\r\n member.lookedBy(null);\r\n \r\n // Still no activity for member\r\n assertNull(Activity.find(\"select a from Activity a where a.member = ?\", member).first());\r\n }", "@Override\n public void handleMessage(Message msg) {\n super.handleMessage(msg);\n SharedPreferences preferences = getSharedPreferences(\"logInfo\",\n Context.MODE_PRIVATE);\n SharedPreferences.Editor editor = preferences.edit();\n Intent intent = new Intent(getApplicationContext(), MainActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);\n switch (msg.what) {\n case LOGIN_OK:\n application.isLogin = true;\n editor.putBoolean(\"isLogin\", true);\n editor.commit();\n break;\n case LOGOUT_OK:\n application.isLogin = false;\n editor.putBoolean(\"isLogin\", false);\n editor.commit();\n break;\n case PASSWORD_ERROR:\n application.isLogin = false;\n editor.putBoolean(\"isLogin\", false);\n editor.commit();\n startActivity(intent);\n Toast.makeText(getApplicationContext(), getString(R.string.try_again), Toast.LENGTH_SHORT).show();\n break;\n case NETWORK_ERROR:\n application.isLogin = false;\n editor.putBoolean(\"isLogin\", false);\n editor.commit();\n startActivity(intent);\n Toast.makeText(getApplicationContext(), getString(R.string.try_again), Toast.LENGTH_SHORT).show();\n break;\n case LOGIN_FAILED:\n application.isLogin = false;\n editor.putBoolean(\"isLogin\", false);\n editor.commit();\n startActivity(intent);\n Toast.makeText(getApplicationContext(), getString(R.string.try_again), Toast.LENGTH_SHORT).show();\n break;\n }\n showNotification();\n }", "public boolean isLog()\n\t{\n\t\treturn log;\n\t}", "public void testIsLoggable_NoOutputStream() {\n StreamHandler h = new StreamHandler();\n LogRecord r = new LogRecord(Level.INFO, null);\n assertFalse(h.isLoggable(r));\n\n h.setLevel(Level.WARNING);\n assertFalse(h.isLoggable(r));\n\n h.setLevel(Level.CONFIG);\n assertFalse(h.isLoggable(r));\n\n r.setLevel(Level.OFF);\n h.setLevel(Level.OFF);\n assertFalse(h.isLoggable(r));\n }", "private void init(){\n \tgl = new GeradorLog(getTAG_LOG(),getTIPO_LOG());\n // cria os devidos parametros da tela\n campoResposta = (EditText) findViewById(R.id.campoResposta);\n msg_usr = (TextView) findViewById(R.id.resposta);\n }", "public void test_getLogMessage_2() {\n instance = new LogMessage(null, null, null, null);\n\n String logMessage = instance.getLogMessage();\n\n assertTrue(\"'getLogMessage' should be correct.\",\n logMessage.indexOf(\"type: Unknown id: Unknown operator:Unknown - null\") != -1);\n assertFalse(\"'getLogMessage' should be correct.\", logMessage.indexOf(\"java.lang.Exception\") != -1);\n }", "public boolean isLogging();", "public boolean is_set_msg() {\n return this.msg != null;\n }", "void onEnterToChatDetails();", "@Test\n public void checkIfAddMeetingIsRunning() {\n onView(withId(R.id.add_meeting_activity)).perform(click());\n onView(withId(R.id.meeting_color)).perform(click());\n onView(withId(R.id.meeting_room)).perform(click());\n onView(withText(\"Salle DEUX\")).perform(click());\n onView(withId(R.id.meeting_topic)).perform(typeText(\"Mareu_2\"));\n onView(withId(R.id.date_btn)).perform(click());\n onView(withId(R.id.meeting_date)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.start_time_btn)).perform(click());\n onView(withId(R.id.meeting_start_time)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.end_time_btn)).perform(click());\n onView(withId(R.id.meeting_end_time)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.meeting_guests)).perform(typeText(\"[email protected] ; [email protected]\"));\n onView(withId(R.id.meeting_add_button)).check(matches(isDisplayed()));\n }", "@Test\r\n public void testNotExistUser(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.enterText((EditText) solo.getView(R.id.add_following), \"yifan30\");\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"The username does not exist!!\", 1,2000));\r\n\r\n }", "private boolean m50966f() {\n int i;\n SharedPreferences sharedPreferences = C8665cc.this.f36887b.getSharedPreferences(\"log.timestamp\", 0);\n String string = sharedPreferences.getString(\"log.requst\", \"\");\n long currentTimeMillis = System.currentTimeMillis();\n try {\n JSONObject jSONObject = new JSONObject(string);\n currentTimeMillis = jSONObject.getLong(\"time\");\n i = jSONObject.getInt(\"times\");\n } catch (JSONException unused) {\n i = 0;\n }\n if (System.currentTimeMillis() - currentTimeMillis >= LogBuilder.MAX_INTERVAL) {\n currentTimeMillis = System.currentTimeMillis();\n i = 0;\n } else if (i > 10) {\n return false;\n }\n JSONObject jSONObject2 = new JSONObject();\n try {\n jSONObject2.put(\"time\", currentTimeMillis);\n jSONObject2.put(\"times\", i + 1);\n sharedPreferences.edit().putString(\"log.requst\", jSONObject2.toString()).commit();\n } catch (JSONException e) {\n AbstractC8508c.m50239c(\"JSONException on put \" + e.getMessage());\n }\n return true;\n }", "public void checkRoomExist(final String id)\n {\n final String cartRef = \"chatRoom\";\n mChat= database.getReference(cartRef);\n mChat.addListenerForSingleValueEvent(new ValueEventListener() {\n @Override\n public void onDataChange(DataSnapshot dataSnapshot) {\n // This method is called once with the initial value and again\n // whenever data at this location is updated.\n\n for(DataSnapshot ds: dataSnapshot.getChildren())\n {\n if(ds.child(\"sender1\").getValue().equals(id)&& ds.child(\"sender2\").getValue().equals(uid))\n {\n roomexist=true;\n goToChat(ds.getKey());\n return;\n }\n else if(ds.child(\"sender2\").getValue().equals(id)&& ds.child(\"sender1\").getValue().equals(uid))\n {\n roomexist=true;\n goToChat(ds.getKey());\n return;\n }\n }\n if(!roomexist)\n {\n String key = mChat.push().getKey();\n makeRoom(key);\n }\n Log.d(TAG, \"Value is: \" + cartRef);\n }\n\n @Override\n public void onCancelled(DatabaseError error) {\n // Failed to read value\n Log.w(TAG, \"Failed to read value.\", error.toException());\n }\n });\n }", "public boolean hasChatbox() {\r\n return chatbox != null && chatbox.getId() > 0;\r\n }", "@UiThreadTest\r\n public void testUserNotNull() {\r\n Intent loginIntent = new Intent();\r\n PomoUser user = new PomoUser(\"9a36d2f9018aacde1430411867961\", \"test\", \"1\", false, true, 1, 1);\r\n loginIntent.putExtra(ExtraName.POMO_USER, user);\r\n mainActivity.onActivityResult(1, Activity.RESULT_OK, loginIntent);\r\n assertNotNull(mainActivity.getUser());\r\n }", "@Test\n public void testGetText() {\n assertEquals(text, chatMessage.getText());\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n mContext=this;\n \n invokeWeChat();\n }", "public boolean isSetHrChatTime() {\n return this.hrChatTime != null;\n }", "@Test\n public void testGetChatLines() {\n System.out.println(\"getChatLines\");\n ChatLog instance = new ChatLog();\n ArrayList<String> expResult = new ArrayList<String>();\n ArrayList<String> result = instance.getChatLines();\n assertEquals(expResult, result);\n }", "boolean hasData()\n {\n logger.info(\"server: \" + server + \" addr: \" + addr + \"text:\" + text);\n return server != null && addr != null && text != null;\n }", "boolean hasBattleLogID();", "public void testPreconditions() {\r\n assertNotNull(\"activity is null\", activity);\r\n assertNotNull(\"fragment is null\", fragment);\r\n }", "@Override\n\tpublic void chatCreated(Chat chat, boolean createdLocally) {\n\t\tif (!createdLocally){\n\t\t\t/*try {\n\t\t\t\tchat.sendMessage(\"我是客户端发送的消息!!\");\n\t\t\t} catch (NotConnectedException e) {\n\t\t\t\t// TODOAuto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}*/\n\t\t\tchat.addMessageListener(new UserLocalChatMessageListener());\n\t\t}\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_video_chat_view);\n\n // Initialize the UI elements.\n mRemoteCameraContainer = findViewById(R.id.remote_camera_view_container);\n mRemoteShareContainerSplit = findViewById(R.id.remote_share_view_container_split);\n mRemoteShareContainerFull = findViewById(R.id.remote_share_view_container_full);\n mChannelText = findViewById(R.id.channel_text);\n\n mCallBtn = findViewById(R.id.btn_call);\n mMuteBtn = findViewById(R.id.btn_mute);\n mShowCameraBtn = findViewById(R.id.btn_show_camera);\n mLogView = findViewById(R.id.log_recycler_view);\n\n // Sample logs are optional.\n mLogView.logI(\"HP OMEN Audience debug log\");\n //mLogView.logW(\"You will see custom logs here\");\n //mLogView.logE(\"You can also use this to show errors\");\n\n // Initialize the UI state.\n setUIState(UIState.DISCONNECTED);\n\n // Ask for permissions at runtime.\n // This is just an example set of permissions. Other permissions\n // may be needed, and please refer to our online documents.\n if (checkSelfPermission(REQUESTED_PERMISSIONS[0], PERMISSION_REQ_ID) &&\n checkSelfPermission(REQUESTED_PERMISSIONS[1], PERMISSION_REQ_ID) &&\n checkSelfPermission(REQUESTED_PERMISSIONS[2], PERMISSION_REQ_ID)) {\n initEngine();\n }\n }", "@Override\r\n\tpublic boolean isLoggable(LogRecord record) {\n\t\treturn false;\r\n\t}", "@Override\n\tpublic boolean hasMessages() {\n\t\treturn false;\n\t}", "public boolean hasErrorLog() {\n return result.hasErrorLog();\n }", "public boolean isSetWxChatTime() {\n return this.wxChatTime != null;\n }", "public boolean logAccess() {\n Map<String, String> response;\n try {\n response = logMessageService.sendRequestMessage(\"\");\n } catch (Exception exception) {\n LOGGER.warn(\"Log message could not be sent. [exception=({})]\", exception.getMessage());\n return allowAccess();\n }\n if (response != null) {\n return allowAccess();\n } else {\n LOGGER.warn(\"No response received.\");\n return allowAccess();\n }\n }", "@Test\n public void testInit() {\n uut=new ChatMessageRequest(\"test\",\"test2\",\"test\",MessageTypes.MATCH);\n assertEquals(\"test\",uut.sender);\n assertEquals(\"test2\",uut.destination);\n assertEquals(\"test\",uut.msg);\n assertEquals(MessageTypes.MATCH,uut.type);\n }", "private void setupChat() {\n chatService = new BluetoothChatService(NavigationDrawerActivity.this, mHandler);\n\n }", "public boolean isChatVisible() {\n return chatVisible;\n }", "@UiThreadTest\r\n public void testDailyHistory() {\r\n Intent loginIntent = new Intent();\r\n PomoUser user = new PomoUser(\"9a36d2f9018aacde1430411867961\", \"test\", \"1\", false, true, 1, 1);\r\n loginIntent.putExtra(ExtraName.POMO_USER, user);\r\n mainActivity.onActivityResult(1, Activity.RESULT_OK, loginIntent);\r\n assertTrue(((TableLayout) mainActivity.findViewById(R.id.history)).getChildCount() > 0);\r\n }", "@Override\r\n\t\t\tpublic void onChat(String message) {\n\r\n\t\t\t}", "@Test\r\n public void testReceiveFollowingRequest(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.request));\r\n solo.sleep(3000);\r\n solo.waitForActivity(FollowingRequest.class, 2000);\r\n ListView listView = (ListView) solo.getView(R.id.friend_request_list);\r\n assertTrue(listView.getAdapter().getCount() > 0);\r\n\r\n }", "@Override\n\tpublic void onPrivateChatReceived(final String sender, final String msg) {\n\t\tChatActivity.this.runOnUiThread(new Runnable() {\n\t\t\t public void run() {\n\t\t\t\t sa = ((SharingAtts)getApplication());\n\t\t\t\t chat.append(sender+\": \"+msg+\"\\n\");\t\n\t\t\t\t ItemTest it = new ItemTest();\n\t\t\t\t String colNames = it.printData(\"chat\")[1];\n\t\t\t\t DBManager dbm = new DBManager(ChatActivity.this, colNames,\"chat\",it.printData(\"chat\")[0]);\n\t\t\t\t dbm.openToWrite();\n\t\t\t\t dbm.cretTable();\n\t\t\t\t String msg2 = msg.replace(\" \", \"?*\");\n\t\t\t\t dbm.insertQuery(sender+\" \"+msg2+\" \"+sa.name, colNames.split(\" \")[1]+\" \"+colNames.split(\" \")[2]+\" \"+colNames.split(\" \")[3]);\n\t\t\t\t dbm.close();\n\t\t\t }\n\t\t});\n\t\t\n\t\t\n\t\t\n\t}", "@Test\n public void empty_diagnostic_info_should_not_be_null_when_read_from_db() {\n //given that an app has an \"empty\" diagnostic is saved to database\n String uuid = UUID.randomUUID().toString();\n ApplicationInfo info = ApplicationInfo.builder().uuid(uuid).build();\n assertThat(info.getDiagnosticInfo(), is(notNullValue()));\n applicationRepository.save(info);\n\n //when we retrieve it from db\n ApplicationInfo retrievedInfo = applicationRepository.findOne(uuid);\n\n //then the empty diagnosticInfo is not null\n assertThat(retrievedInfo.getDiagnosticInfo(), is(notNullValue()));\n }", "public boolean checklogin() {\n\t\treturn (pref.getBoolean(\"isLog\", false));\n\t}", "public static void checkUiThread() {\n if(Looper.getMainLooper() != Looper.myLooper()) {\n throw new IllegalStateException(\"Must be called from the Main Thread. Current Thread was :\"+ Thread.currentThread());\n }\n }" ]
[ "0.6225576", "0.607543", "0.5960574", "0.58594406", "0.5779297", "0.57732767", "0.5733419", "0.571225", "0.5682787", "0.5581243", "0.5563072", "0.55358815", "0.55330664", "0.54734427", "0.5470338", "0.54596174", "0.5457026", "0.5454132", "0.5387484", "0.53862983", "0.5383679", "0.5362898", "0.5347053", "0.53279275", "0.53104544", "0.5307758", "0.5295265", "0.52715725", "0.526008", "0.52442724", "0.5242925", "0.5229554", "0.5201095", "0.51939905", "0.5189682", "0.51851445", "0.51845765", "0.5164081", "0.51636994", "0.51625997", "0.51547736", "0.51506346", "0.51506346", "0.51506346", "0.51506346", "0.51476103", "0.5145319", "0.51430094", "0.5141816", "0.5141219", "0.51412046", "0.51324356", "0.5131005", "0.5121545", "0.51111585", "0.5099087", "0.5089411", "0.5089183", "0.5072323", "0.5066973", "0.50661355", "0.5062316", "0.50537425", "0.5049159", "0.50098205", "0.50058806", "0.5002023", "0.5001446", "0.4991445", "0.49868405", "0.49842995", "0.49684697", "0.4963904", "0.49584594", "0.4952399", "0.49500823", "0.49461037", "0.49394494", "0.4924783", "0.49220556", "0.49220052", "0.4910956", "0.49035317", "0.48855364", "0.48801637", "0.48768672", "0.48752236", "0.48724386", "0.4868391", "0.4860896", "0.4856716", "0.48558706", "0.48488593", "0.4846619", "0.48463532", "0.48415616", "0.48309264", "0.48232687", "0.48229268", "0.4822689" ]
0.7202147
0
test that the chat log uses the correct listview
@Test public void testChatLogHasCorrectID(){ ListView chatLog = messagesActivity.listOfMessages; int ID = chatLog.getId(); int expectedID = R.id.list_of_messages; assertEquals(ID, expectedID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testChatLogExists(){\n ListView chatLog = messagesActivity.listOfMessages;\n assertNotNull(chatLog);\n }", "private void updateListViewLogWindow()\n {\n listViewMessageItems.clear();\n\n for(int i =0;i<= printResult.size() - 1;i++)\n {\n listViewMessageItems.add(printResult.get(i));\n }\n\n }", "@Override\n protected void initView() {\n mListView = (ListView) findViewById(R.id.list);\n ViewGroup.LayoutParams layoutParams = mListView.getLayoutParams();\n layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;\n layoutParams.height = AppController.displayMetrics.heightPixels / 2;\n mListView.setLayoutParams(layoutParams);\n\n\n mSelectChatAdapter = new SelectChatAdapter(getContext());\n mListView.setAdapter(mSelectChatAdapter);\n mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n goToHXMain(\n HXApplication.getInstance().parseUserFromID(HXHelper.yamContactList.get(position)\n .getFirendsUserInfo().getId(), HXConstant.TAG_SHOP));\n }\n });\n }", "@Override\n public View getView(int position, View arg1, ViewGroup arg2) {\n HolderView holderView = null;\n\n String name = SaveUtils.getSettingNote(context,\"userInfo\",\"username\");\n boolean isMeSend;\n Log.d(TAG, \"getViewfromName: \"+fromName.get(position));\n isMeSend = (String.valueOf(fromName.get(position)).equals(name));\n Log.d(TAG, \"getView: isMesend\"+isMeSend);\n if (holderView == null) {\n holderView = new HolderView();\n if (isMeSend) {\n arg1 = View.inflate(context, R.layout.activity_chat_right,\n null);\n holderView.tv_chat_me_message = (TextView) arg1\n .findViewById(R.id.tv_chat_me_message_right);\n holderView.tv_vaht_name = arg1.findViewById(R.id.chat_name_right);\n holderView.tv_chat_me_message.setText(contents.get(position));\n holderView.tv_vaht_name.setText(fromName.get(position));\n Log.d(TAG, \"getView: do it right\");\n } else {\n arg1 = View.inflate(context, R.layout.activity_chat_left,\n null);\n holderView.tv_chat_me_message = (TextView) arg1\n .findViewById(R.id.tv_chat_me_message_left);\n holderView.tv_vaht_name = arg1.findViewById(R.id.chat_name_left);\n holderView.tv_chat_me_message.setText(contents.get(position));\n holderView.tv_vaht_name.setText(fromName.get(position));\n Log.d(TAG, \"getView: do it left\");\n }\n arg1.setTag(holderView);\n } else {\n holderView = (HolderView) arg1.getTag();\n }\n return arg1;\n }", "private void showChatPage(){\n lv_chat = (ListView) view_chat.findViewById(R.id.lv_chat);\n pb_loadChat = (ProgressBar) view_chat.findViewById(R.id.pb_load_chat);\n adapter = new ChatListAdapter(getContext(), chatList, self.getId());\n lv_chat.setAdapter(adapter);\n// lv_chat.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n// @Override\n// public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n// Log.d(TAG, \"click\");\n// String message = adapter.getItem(position).messageContent;\n// TextView textView = (TextView) view.findViewById(R.id.tv_otherText);\n// int visibility = textView.getVisibility();\n// if ( visibility == View.VISIBLE ) {\n// Log.d(TAG, \"<\" + message + \"> is visible\");\n// } else {\n// Log.d(TAG, \"<\" + message + \"> is invisible\");\n// }\n// }\n// });\n\n lv_chat.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n view_chat.requestFocus(); // remove focus from the EditText\n return false;\n }\n });\n\n lv_chat.setOnScrollListener(new AbsListView.OnScrollListener() {\n @Override\n public void onScrollStateChanged(AbsListView view, int scrollState) {\n if ( scrollState == SCROLL_STATE_TOUCH_SCROLL ) {\n if ( lv_chat.getFirstVisiblePosition() == 0 && !isLoading && !isAllLoaded ){\n Log.d(\"ListView\",\"load more history\");\n loadMoreHistoryChat();\n }\n }\n }\n\n @Override\n public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {\n// if ( firstVisibleItem == 0 && totalItemCount > 0 ) {\n// if ( !isLoading && !isAllLoaded && isOverScrolling) {\n// loadMoreHistoryChat();\n// }\n// }\n }\n });\n loadChatHistory(CHAT_LIMIT,0,0); // load most recent CHAT_LIMIT chats\n fab_send = (FloatingActionButton) view_chat.findViewById(R.id.fab_send);\n fab_more = (FloatingActionButton) view_chat.findViewById(R.id.fab_more);\n fab_less = (FloatingActionButton) view_chat.findViewById(R.id.fab_less);\n fab_gallery = (FloatingActionButton) view_chat.findViewById(R.id.fab_gallery);\n view_functions = view_chat.findViewById(R.id.layout_function_menu);\n et_message = (EditText) view_chat.findViewById(R.id.et_message);\n et_message.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n @Override\n public void onFocusChange(View v, boolean hasFocus) {\n if ( hasFocus ) {\n if ( adapter != null ) {\n lv_chat.setSelection(adapter.getCount()-1); // scroll to bottom when gaining focus\n }\n } else {\n AppUtils.hideKeyboard(getContext(),v); // hide keyboard when losing focus\n }\n }\n });\n\n fab_send.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n sendTextMessage(et_message.getText().toString());\n }\n });\n\n fab_more.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n fab_more.setVisibility(View.GONE);\n view_functions.setVisibility(View.VISIBLE);\n }\n });\n\n fab_less.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n view_functions.setVisibility(View.GONE);\n fab_more.setVisibility(View.VISIBLE);\n LocalDBHelper localDBHelper = LocalDBHelper.getInstance(getContext());\n localDBHelper.clearAllImageCache();\n }\n });\n\n fab_gallery.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n selectImage();\n }\n });\n\n et_message.addTextChangedListener(new TextWatcher() {\n @Override\n public void beforeTextChanged(CharSequence s, int start, int count, int after) {\n }\n\n @Override\n public void onTextChanged(CharSequence s, int start, int before, int count) {\n if ( s != null && s.length() > 0 ) {\n fab_send.setVisibility(View.VISIBLE);\n } else {\n fab_send.setVisibility(View.GONE);\n }\n }\n\n @Override\n public void afterTextChanged(Editable s) {\n }\n });\n }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\r\n\t\tString im_records;\r\n\t\tString peerId = getIntent().getExtras().getString(\"peer_row_id\");\r\n\t\tListView lv = (ListView) this.getListView();\r\n\t\tlv.setBackgroundResource(R.drawable.cyan_background);\r\n\t\tall_data = new ArrayList<ArrayList>();\r\n\r\n\t\tString id, message, source, destination, time, length;\r\n\t\tHistoryLog query = new HistoryLog(this);\r\n\t\tquery.open();\r\n\r\n\t\tim_records = query.getImData(peerId);\r\n\t\tStringTokenizer stok = new StringTokenizer(im_records, \"|\");\r\n\r\n\t\twhile (stok.hasMoreTokens()) {\r\n\t\t\tid = stok.nextToken().trim();\r\n\t\t\tif (!id.equals(\"\")) {\r\n\t\t\t\tmessage = stok.nextToken().trim();\r\n\t\t\t\tsource = stok.nextToken();\r\n\t\t\t\tdestination = stok.nextToken();\r\n\t\t\t\ttime = stok.nextToken();\r\n\t\t\t\tlength = stok.nextToken();\r\n\r\n\t\t\t\tmyList = new ArrayList<String>();\r\n\r\n\t\t\t\tmyList.add(id);\r\n\t\t\t\tmyList.add(message);\r\n\t\t\t\tmyList.add(source);\r\n\t\t\t\tmyList.add(destination);\r\n\t\t\t\tmyList.add(time);\r\n\t\t\t\tmyList.add(length);\r\n\r\n\t\t\t\tall_data.add(myList);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tarrayAdapter = new ArrayAdapter<String>(this,\r\n\t\t\t\tandroid.R.layout.simple_list_item_1);\r\n\t\tsetListAdapter(arrayAdapter);\r\n\r\n\t\tfor (int i = 0; i < all_data.size(); i++) {\r\n\t\t\tString list_item = (String) all_data.get(i).get(0) + \": \"\r\n\t\t\t\t\t+ (String) all_data.get(i).get(1);\r\n\t\t\tarrayAdapter.add(list_item);\r\n\t\t}\r\n\r\n\t\tarrayAdapter.notifyDataSetChanged();\r\n\t\tquery.close();\r\n\r\n\t\tlv.setOnItemClickListener(new AdapterView.OnItemClickListener() {\r\n\t\t\tpublic void onItemClick(AdapterView<?> parentView, View childView,\r\n\t\t\t\t\tint position, long id) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tString itemSelected = (((TextView) childView).getText())\r\n\t\t\t\t\t\t.toString();\r\n\t\t\t\tString info1, info2, info3, info4, info5, info6;\r\n\r\n\t\t\t\tArrayList<String> listo = all_data.get(position);\r\n\t\t\t\tinfo1 = listo.get(0);\r\n\t\t\t\tinfo2 = listo.get(1);\r\n\t\t\t\tinfo3 = listo.get(2);\r\n\t\t\t\tinfo4 = listo.get(3);\r\n\t\t\t\tinfo5 = listo.get(4);\r\n\t\t\t\tinfo5 = info5.replace(\"Current Time : \", \"\");\r\n\t\t\t\tinfo6 = listo.get(5);\r\n\r\n\t\t\t\tfinal String items[] = { \"Log #: \" + info1,\r\n\t\t\t\t\t\t\"Message: \" + info2, \"Source: \" + info3,\r\n\t\t\t\t\t\t\"Destination: \" + info4, \"Time: \" + info5,\r\n\t\t\t\t\t\t\"Message Length: \" + info6 };\r\n\r\n\t\t\t\tAlertDialog.Builder ab = new AlertDialog.Builder(\r\n\t\t\t\t\t\tImPeerHistoryList.this);\r\n\t\t\t\tab.setTitle(\"Message Details\");\r\n\t\t\t\tab.setItems(items, null);\r\n\t\t\t\tab.show();\r\n\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n view = convertView;\n //Log.e(\"getView \", \"getView\");\n\n if (convertView == null) {\n holder = new ViewHolder();\n\n view = mInflater.inflate(R.layout.chat_list_item, null,\n false);\n holder.textViewChatItemHeading = (TextView) view\n .findViewById(R.id.chatlist_heading);\n holder.textViewChatText = (TextView) view\n .findViewById(R.id.chatlist_updated_text);\n\n holder.txtviewChatCount = (TextView) view\n .findViewById(R.id.chatlist_updated_count);\n\n holder.txtViewChatTime = (TextView) view\n .findViewById(R.id.chatlist_time);\n\n holder.imageViewCar = (ImageView) view\n .findViewById(R.id.chatlist_car_image);\n\n holder.txtViewName = (TextView) view\n .findViewById(R.id.chatlist_Name);\n view.setTag(holder);\n } else {\n holder = (ViewHolder) view.getTag();\n }\n if (mChatListItems.get(position).getChat_with().equals(\"dealer\")) {\n DealerChatListItem mItem = (DealerChatListItem) mChatListItems.get(position);\n holder.textViewChatItemHeading.setText(mItem.getVariantId());\n holder.textViewChatText.setText(mItem.getLastchatmsg()/*\"i will go to wonderland hurray or awwwwwww\"*/);\n if (mItem.getTimestamp() != null)\n holder.txtViewChatTime.setText(/*mItem.getLastchattime()*/sdf.format(new Date(Long.parseLong(mItem.getTimestamp()))));\n else\n holder.txtViewChatTime.setText(mItem.getLastchattime());\n\n holder.txtViewName.setText(mItem.getName()/*\"10:00 pm\"*/);\n if (mChatListItems.get(position).getid() != null) {\n if (mMaxId < Integer.parseInt(mChatListItems.get(position).getid())) {\n mMaxId = Integer.parseInt(mChatListItems.get(position).getid());\n }\n }\n holder.txtviewChatCount.setVisibility(View.GONE);\n holder.textViewChatText.setTextColor(Color.BLACK);\n holder.textViewChatText.setTypeface(Typeface.DEFAULT);\n if (mItem.getUnreadmsgcount() != null && !mItem.getUnreadmsgcount().isEmpty() && Integer.parseInt(mItem.getUnreadmsgcount()) > 0 && mItem.getLastchatmsg().length() != 0) {\n holder.txtviewChatCount.setVisibility(View.VISIBLE);\n holder.txtviewChatCount.setText(mItem.getUnreadmsgcount());\n //holder.textViewChatText.setTextColor(Color.GREEN);\n holder.textViewChatText.setTypeface(Typeface.DEFAULT_BOLD);\n }\n imageLoader.displayImage(mItem.getImageurl(), holder.imageViewCar, options);\n Log.e(\"setDataInList \", \"mItem.getName() \" + mItem.getName());\n\n } else if (mChatListItems.get(position).getChat_with().equals(\"suppportuser\")) {\n ExpertChatListItem mItem = (ExpertChatListItem) mChatListItems.get(position);\n holder.textViewChatItemHeading.setText(mItem.getSupportroomname());\n holder.textViewChatText.setText(mItem.getLastchatmsg());\n holder.txtViewChatTime.setText(mItem.getLastchattime());\n if (mItem.getUnreadmsgcount() != null && !mItem.getUnreadmsgcount().isEmpty() && Integer.parseInt(mItem.getUnreadmsgcount()) > 0) {\n holder.txtviewChatCount.setVisibility(View.VISIBLE);\n holder.txtviewChatCount.setText(mItem.getUnreadmsgcount());\n }\n }\n return view;\n }", "private void initListView(View view)\n {\n\n theListView = (ListView) view.findViewById(R.id.ml_list_view);\n theListAdapter = new TextAdapter(layoutInflater);\n theListView.setAdapter((ListAdapter) theListAdapter);\n\n }", "@Test\n public void checkListView(){\n //assert awaiting approval view\n View awaitingApprovalView = solo.getView(\"awaiting_approval\");\n assertTrue(solo.waitForText(\"Awaiting Approval\",1,2000));\n //Check for list of awaiting approvals\n View awaitingApprovalListView = solo.getView(\"books_awaiting_list\");\n //click on list of borrowed books\n solo.clickOnView(awaitingApprovalListView);\n solo.assertCurrentActivity(\"Wrong Activity\", Host.class);\n\n\n }", "@Override\n\tprotected void setupListView() {\n\t\tfinal int elementLayout = R.layout.image_selectable_list_item;\n\t\tfinal int imageView = R.id.imageView1;\n\t\tfinal int textView = R.id.textView1;\n\n\t\tmQueryListener = new QueryListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onError() {\n\t\t\t\tmAdapter = null;\n\t\t\t\tsetListAdapter(null);\n\t\t\t\tgetListView().invalidateViews();\n\t\t\t\tsetEmptyText(getString(R.string.retrievalError));\n\t\t\t\tmProgressBar.setVisibility(View.GONE);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(double data, boolean saved) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(boolean data, boolean saved) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(ObjectPrx data, boolean saved) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(QueryModel data, boolean saved) {\n\t\t\t\tif (saved) {\n\t\t\t\t\tmQueryModel = data;\n\t\t\t\t\tArrayList<UserTypPrx> adapterData = new ArrayList<UserTypPrx>(\n\t\t\t\t\t\t\tdata.data.size());\n\t\t\t\t\tfor (ObjectPrx oprx : data.data)\n\t\t\t\t\t\tadapterData.add(UserTypPrxHelper.checkedCast(oprx));\n\t\t\t\t\tif (mAdapter == null) {\n\t\t\t\t\t\tmAdapter = new UserListAdapter(MyMessagesActivity.this,\n\t\t\t\t\t\t\t\telementLayout, imageView, textView, adapterData);\n\t\t\t\t\t\tsetListAdapter(mAdapter);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmAdapter.addAll(adapterData);\n\t\t\t\t\t}\n\t\t\t\t\tmAdapter.notifyDataSetChanged();\n\t\t\t\t\tmProgressBar.setVisibility(View.GONE);\n\t\t\t\t\tif (mAdapter.getCount() <= 0)\n\t\t\t\t\t\tsetEmptyText(getString(R.string.noMessagesFound));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}", "@Override\r\n public int getCount() {\n return chatList.size();\r\n }", "public void testListOfUsersDisplayed(){\n \t\tListView chars = solo.getView(ListView.class, 0);\n \t\tAssert.assertEquals(3, chars.getAdapter().getCount());\n \t\tsolo.finishOpenedActivities();\n \t}", "@Override\n\tpublic int getCount() {\n\t return listMyLog.size();\n\t}", "@SmallTest\n public void testView(){\n assertNotNull(mActivity);\n\n // Initialisiere das View Element\n final ListView listView = (ListView) mActivity.findViewById(R.id.activtiy_permission_management_list_view);\n\n assertNotNull(listView);\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t View view = convertView;\n\t ViewHolder holder;\n\t if (view == null) {\n\t\tview = getLayoutInflater().inflate(R.layout.logview_list_item,\n\t\t\tnull);\n\t\tholder = new ViewHolder();\n\t\tholder.LogName = (TextView) view.findViewById(R.id.LogName);\n\t\tholder.promulgator = (TextView) view\n\t\t\t.findViewById(R.id.promulgator);\n\t\tholder.time = (TextView) view.findViewById(R.id.time);\n\t\tview.setTag(holder);\n\t } else {\n\t\tholder = (ViewHolder) view.getTag();\n\t }\n\t holder.LogName.setText(listMyLog.get(position).getHeadline());\n\t holder.time.setText(listMyLog.get(position).getPublishTime());\n\t holder.promulgator.setText(listMyLog.get(position).getUserName());\n\t return view;\n\t}", "public View getView(int position, View convertView, ViewGroup parent) {\n\n username = LoginActivity.user.getUsername();\n\n\n ChatMessage chatMessageObj = getItem(position);\n View row = convertView;\n LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\n// if(!ChatActivity.otherUser.equals(username) || chatMessageObj.left) {\n// row = inflater.inflate(R.layout.right, parent, false);\n//\n// }\n// else{\n// row = inflater.inflate(R.layout.left, parent, false);\n// }\n chatMessageObj.message.toLowerCase();\n if(chatMessageObj.message.contains(username)){\n row = inflater.inflate(R.layout.right, parent, false);\n }\n else {\n row = inflater.inflate(R.layout.left, parent, false);\n }\n\n\n//\n// if (chatMessageObj.left) {\n// row = inflater.inflate(R.layout.right, parent, false);\n// }else{\n// row = inflater.inflate(R.layout.left, parent, false);\n// }\n chatText = (TextView) row.findViewById(R.id.msgr);\n chatText.setText(chatMessageObj.message);\n return row;\n }", "@Override\n\t\tpublic void initList() {\n\t\t\tadapter = new MsgItemAdapter(context);\n\t\t\tArrayList<MsgBean> datas = getData();\n\t\t\tadapter.setData(datas);\n\t\t\tmListView.setAdapter(adapter);\n\t\t\tmListView.setViewMode(true, true);\n\t\t\tif(!DataValidate.checkDataValid(datas)){\n\t\t\t\tpageView.setDefaultPage().setVisibility(View.VISIBLE);\n\t\t\t}\n\t\t}", "@Override\n public int getCount() {\n return chatList.size();\n }", "@Override\r\n\tpublic View getView(final int position, View convertView, ViewGroup parent) {\n\t\tView vi = convertView;\r\n\t\tvHolder holder = null ;\r\n\r\n\t\tSystem.out.println(\"In getView\");\r\n\t\t\r\n\t\tif(vi==null){\r\n\t\t\tvi = LayoutInflater.from(lcontext).inflate(R.layout.peerrow_perchat, parent, false);\r\n\t\t\tholder = new vHolder();\r\n\t\t\tholder.nickView = (TextView) vi.findViewById(R.id.nick);\r\n\t\t\tholder.msgView = (TextView) vi.findViewById(R.id.last_chat);\r\n\t\t\tholder.timeView = (TextView) vi.findViewById(R.id.time);\r\n\t\t\tvi.setTag(holder);\r\n\t\t}\r\n\t\telse{\r\n\t\t\tholder = (vHolder)vi.getTag();\r\n\t\t}\r\n\t\tvi.setOnClickListener(new View.OnClickListener(){\r\n\t\t\t@Override\r\n\t\t\tpublic void onClick(View v){\r\n\t\t\t\tSystem.out.println(\"chatadapter\");\r\n\t\t\t\tmHandler.obtainMessage(3,position+\"\").sendToTarget();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\t String nick = (chat.get(position));\r\n\t\t System.out.println(\"Nick at poistion \"+position+\" is \"+nick);\r\n\t\t ArrayList<chatObject> ar = chatmsg.get(nick);\r\n\t\t System.out.println(\"First message is \"+ar.get(0).getMessage());\r\n\t\t String m = (ar.get(ar.size()-1)).getMessage();\r\n\t\t if(m.length()>50){\r\n\t\t\t m = m.substring(0, 80);\r\n\t\t\t m = m + \"...\";\r\n\t\t }\r\n\t\t String t = (ar.get(ar.size()-1)).getTime();\r\n\t\t System.out.println(\"Message :\"+ m);\r\n\t\t holder.nickView.setText(nick);\r\n holder.msgView.setText(m);\r\n holder.timeView.setText(t);\r\n System.out.println(\"Text Set for \"+position);\r\n \r\n return vi;\r\n\t}", "private void inicializaListView(){\n }", "@Override\r\n protected boolean matchesSafely(View item) {\n ListView list = (ListView) item;\r\n\r\n return (list.getCount() != 0);\r\n }", "public synchronized void doUpdateChatListView(Message msg)\n {\n Bundle b = msg.getData();\n String next = b.getString(Constants.CHAR);\n chatList.add(new CustomString(next,Constants.SENDER_DEVICE));\n customAdapter.notifyDataSetChanged();\n\n }", "@Override\n\t\t\tpublic void handleMessage(Message msg) {\n\t\t\t\tsuper.handleMessage(msg);\n\t\t\t\tswitch (msg.what) {\n\t\t\t\tcase 1:\n\n\t\t\t\t\tlistView.setAdapter(new ListAdaptersujin(ListActivity.this, app\n\t\t\t\t\t\t\t.getList()));\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}", "@Override\r\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tView view = null;\r\n\t\tif(convertView == null){\r\n\t\t\tview = mInflater.inflate(R.layout.chat_item, null);\r\n\t\t}else{\r\n\t\t\tview = convertView;\r\n\t\t}\r\n\t\tChatMessage msg = msgList.get(position);\r\n\t\t\r\n\t\tTextView show_name = (TextView) view.findViewById(R.id.show_name);\r\n\t\tshow_name.setText(msg.getSenderName());\r\n\t\tif(msg.isSelfMsg()){\t//根据是否是自己的消息更改颜色\r\n\t\t\tshow_name.setTextColor(res.getColor(R.color.chat_myself));\r\n\t\t}else{\r\n\t\t\tshow_name.setTextColor(res.getColor(R.color.chat_other));\r\n\t\t}\r\n\t\t\r\n\t\tTextView show_time = (TextView) view.findViewById(R.id.show_time);\r\n\t\tshow_time.setText(msg.getTimeStr());\r\n\t\t\r\n\t\tTextView message = (TextView) view.findViewById(R.id.message);\r\n\t\tmessage.setText(msg.getMsg());\r\n\t\t\r\n\t\treturn view;\r\n\t}", "private void initLog() {\n _logsList = (ListView) findViewById(R.id.lv_log);\n setupLogger();\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n final ViewHolder holder;\n\n // OK, I found my ViewHolder... is anything null around these\n // here parts?\n if (convertView == null) {\n convertView = inflater.inflate(resource, parent, false);\n holder = new ViewHolder(convertView);\n convertView.setTag(holder);\n } else {\n holder = (ViewHolder) convertView.getTag();\n }\n\n\n // Now would be a good time to get the data for this message\n DateChat message = getItem(position);\n\n // Figure out who sent it, and populate the view properly\n if (message.getSender().getObjectId().equals(DateUser.getCurrentUser().getObjectId())) {\n holder.messageOther.setVisibility(View.INVISIBLE);\n holder.messageCurrent.setVisibility(View.VISIBLE);\n holder.messageCurrent.setText(message.getChatText());\n } else {\n holder.messageCurrent.setVisibility(View.INVISIBLE);\n holder.messageOther.setVisibility(View.VISIBLE);\n holder.messageOther.setText(message.getChatText());\n }\n\n return convertView;\n }", "@Override\n public int getCount() {\n return mChatListItems.size();\n }", "private void updateListView() {\n if (smsListView.getAdapter() == null) {\n Log.d(TAG, \"updateListView: set new adapter\");\n smsListView.setAdapter(new SmsListAdapter(SmsListActivity.this, getDataProviderManager(),\n getLayoutInflater()));\n smsListView.setEmptyView(findViewById(R.id.nosms));\n smsListView.setOnItemClickListener(new OnItemClickListener() {\n\n @Override\n public void onItemClick(AdapterView<?> arg0, View arg1, int index, long itemId) {\n if (itemId != -1) {\n Intent smsDetails = new Intent(SmsListActivity.this, SmsDetailsActivity.class);\n smsDetails.putExtra(EXTRAS_KEY_SMSID, Long.valueOf(itemId));\n startActivityForResult(smsDetails, R.id.requestCode_sms_changeInDetailView);\n }\n }\n });\n\n smsListView.setOnItemLongClickListener(new OnItemLongClickListener() {\n\n @Override\n public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int index, long itemId) {\n return showItemLongClickMenu(arg0, itemId, index);\n }\n });\n } else {\n Log.d(TAG, \"updateListView: notifyDataSetChanged\");\n ((SmsListAdapter) smsListView.getAdapter()).clearImageCache();\n ((SmsListAdapter) smsListView.getAdapter()).notifyDataSetChanged();\n }\n\n }", "private static Matcher<View> encontrarLista() {\n return new TypeSafeMatcher<View>() {\n @Override\n protected boolean matchesSafely(View item) {\n if (item instanceof ListView) {\n ListView lista = (ListView) item;\n a1a5NumIni = lista.getAdapter().getCount();\n return true;\n }\n return false;\n }\n\n @Override\n public void describeTo(Description description) {\n }\n };\n }", "@Test\r\n public void testReceiveFollowingRequest(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.request));\r\n solo.sleep(3000);\r\n solo.waitForActivity(FollowingRequest.class, 2000);\r\n ListView listView = (ListView) solo.getView(R.id.friend_request_list);\r\n assertTrue(listView.getAdapter().getCount() > 0);\r\n\r\n }", "private void refreshListView() {\n\t\tSQLiteDatabase db = dbh.getReadableDatabase();\n\t\tsharedListView.setAdapter(null);\n\t\tCursor c1 = db.rawQuery(\"SELECT _id, title, subtitle, content, author, otheruser FROM todos WHERE otheruser = '\" + author + \"'\", null);\n\t\tListAdapter adapter2 = new SimpleCursorAdapter(this, R.layout.activity_items, c1, from, to, 0);\n\t\tsharedListView.setAdapter(adapter2);\n\t\tadapter.notifyDataSetChanged();\n\t}", "@SmallTest\n public void testViewVisible()throws Exception{\n // Initialisiere das View Element\n final ListView listView = (ListView) mActivity.findViewById(R.id.activtiy_permission_management_list_view);\n\n ViewAsserts.assertOnScreen(mActivity.getWindow().getDecorView(), listView);\n }", "private void setUpListViewMenu(final ListView listView){\n pTeam.receivedHasTeam(user.getUid(), HistoryAndHobbyActivity.this);\n\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n String value = (String) listView.getItemAtPosition(position);\n if(value == getString(R.string.Map)){\n Intent target = new Intent(HistoryAndHobbyActivity.this, BigMapsActivity.class);\n target.putParcelableArrayListExtra(\"allLocation\",allLocation);\n startActivity(target);\n }\n else if(value == getString(R.string.MyProfile)){\n Intent target = new Intent(HistoryAndHobbyActivity.this, UserProfileActivity.class);\n ArrayList<UserProfile> listUser=new ArrayList<>();\n listUser.add(userProfile);\n target.putParcelableArrayListExtra(\"user\",listUser);\n startActivity(target);\n }\n else if(value==getString(R.string.Team))\n {\n finish();\n Intent target = new Intent(HistoryAndHobbyActivity.this, TeamActivity.class);\n startActivity(target);\n }\n else if(value==getString(R.string.CreateTeam))\n {\n dialogCreateTeam = new Dialog(HistoryAndHobbyActivity.this);\n dialogCreateTeam.setContentView(R.layout.dialog_create_team);\n txtTeamName=dialogCreateTeam.findViewById(R.id.txtTeamName);\n btnOk=dialogCreateTeam.findViewById(R.id.btnOk);\n btnCancel=dialogCreateTeam.findViewById(R.id.btnCancel);\n btnOk.setOnClickListener(v -> {\n //teams name\n String teamName = txtTeamName.getText().toString();\n //call post api create team\n pTeam.receivedCreateTeam(user.getUid(), teamName);\n });\n dialogCreateTeam.show();\n btnCancel.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n dialogCreateTeam.dismiss();\n }\n });\n }\n else if(value.equals(getString(R.string.Invitation_List))){\n finish();\n Intent intent = new Intent(HistoryAndHobbyActivity.this, ListInvitationActvity.class);\n startActivity(intent);\n }\n else if(value.equals(getString(R.string.Diary))){\n Intent intent = new Intent(HistoryAndHobbyActivity.this, MyDiaryActivity.class);\n startActivity(intent);\n }\n else if(value.equals(getString(R.string.AddMissingLocation))){\n Intent target = new Intent(HistoryAndHobbyActivity.this, AddMissingLocation.class);\n startActivity(target);\n }\n }\n });\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tLayoutInflater inflater = LayoutInflater.from(tc);\n\t\tViewhoder viewhoder = new Viewhoder();\n\t\tif (convertView == null) {\n\t\t\tconvertView = inflater.inflate(R.layout.msglist_item, null);\n\t\t\tviewhoder.title = (TextView) convertView.findViewById(R.id.title);\n\t\t\tviewhoder.time = (TextView) convertView.findViewById(R.id.tiem);\n\t\t\tviewhoder.tel = (TextView) convertView.findViewById(R.id.tel);\n\t\t\tviewhoder.che = (TextView) convertView.findViewById(R.id.che);\n\t\t\tviewhoder.name = (TextView) convertView.findViewById(R.id.name);\n\t\t\tviewhoder.ishide = (LinearLayout) convertView.findViewById(R.id.zhanbai1is);\n\t\t\tviewhoder.zhanbai = (TextView) convertView.findViewById(R.id.zhanbai);\n\t\t\tviewhoder.ishide.setVisibility(View.GONE);\n\t\t\tconvertView.setTag(viewhoder);\n\t\t} else {\n\t\t\tviewhoder = (Viewhoder) convertView.getTag();\n\t\t\tviewhoder.ishide.setVisibility(View.GONE);\n\t\t}\n\t\tfinal Data data = list.get(position);\n\n\t\tString CarType = DB_data.getcodename(\"Stuent3\", \"codeName\", \"code\", data.CarType);\n\n\t\tString BuyTime = DB_data.getcodename(\"Stuent2\", \"codeName\", \"code\", data.BuyTime);\n\n\t\tviewhoder.title.setText((data.Message) == \"\" || (data.Message) == null ? \"暂无数据\" : data.Message + \"\");\n\t\tviewhoder.name\n\t\t\t\t.setText((data.CustomerName) == \"\" || (data.CustomerName) == null ? \"暂无数据\" : data.CustomerName + \"\");\n\t\tviewhoder.time.setText((BuyTime) == \"\" || (BuyTime) == null ? \"暂无数据\" : BuyTime + \"\");\n\t\tviewhoder.tel.setText((data.Phone) == \"\" || (data.Phone) == null ? \"暂无数据\" : data.Phone + \"\");\n\t\tviewhoder.che.setText((CarType) == \"\" || (CarType) == null ? \"暂无数据\" : CarType + \"\");\n\n\t\tviewhoder.ishide.setVisibility(View.GONE);\n\t\tif (data.MessageType == 4 || data.equals(\"4\")) {\n\t\t\tSystem.out.println(data.MessageType);\n\t\t\tSystem.out.println(position);\n\t\t\tviewhoder.ishide.setVisibility(View.VISIBLE);\n\t\t\tviewhoder.zhanbai.setText(data.FailReason);\n\t\t}\n\t\tconvertView.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tswitch (data.MessageType) {\n\t\t\t\tcase 1:\n\t\t\t\t\ttc.startActivity(new Intent(tc, AllotActivity.class));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\ttc.startActivity(new Intent(tc, Will_Activity.class));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 3:\n\t\t\t\t\ttc.startActivity(new Intent(tc, OvertimeActivity.class));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\ttc.startActivity(new Intent(tc, DefeatActivity.class));\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t\treturn convertView;\n\t}", "protected ListView<T> createTargetListView() {\n/* 447 */ return createListView();\n/* */ }", "private void setOnListView() {\n\t\tlist.setItems(obs);\n\t\tlist.setCellFactory(new Callback<ListView<User>, ListCell<User>>(){\n\n\t\t\t@Override\n\t\t\tpublic ListCell<User> call(ListView<User> p) {\n\t\t\t\t\n\t\t\t\tListCell<User> cell = new ListCell<User>() {\n\t\t\t\t\t\n\t\t\t\t\t@Override \n\t\t\t\t\tprotected void updateItem(User s, boolean bln) {\n\t\t\t\t\t\tsuper.updateItem(s, bln);\n\t\t\t\t\t\tif(s != null) {\n\t\t\t\t\t\t\tsetText(s.getUserName());\n\t\t\t\t\t\t}else\n\t\t\t\t\t\t\tsetText(\"\");\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn cell;\n\t\t\t}\n\t\t});\n\t}", "public abstract void executeListView(int pos);", "private void init(View view){\n errorText = (TextView) view.findViewById(R.id.error_text);\n refreshButton = (TextView) view.findViewById(R.id.refreshButton);\n contactList = (ListView) view.findViewById(R.id.contactList);\n\n chatArrayList = new ArrayList<Chat>();\n profileRemoteDAO = new ProfileRemoteDAO(getContext(), this);\n chatRemoteDAO = new ChatRemoteDAO(getContext(), this);\n customArrayAdapter = new CustomArrayAdapter(getContext(), this, chatArrayList, profileRemoteDAO.getUserId());\n contactList.setAdapter(customArrayAdapter);\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n View listItemView = convertView;\n if (listItemView == null) {\n listItemView = LayoutInflater.from(getContext()).inflate(\n R.layout.messages_list_item, parent, false);\n }\n\n Messages m = getItem(position);\n\n TextView messageTv = listItemView.findViewById(R.id.message_item_text_view);\n messageTv.setText((m != null) ? m.getMessage() : null);\n\n TextView dateTV = listItemView.findViewById(R.id.message_item_date_text_view);\n dateTV.setText(m != null ? m.getDate() : null);\n\n TextView userTV = listItemView.findViewById(R.id.message_item_user_text_view);\n userTV.setText(m != null ? m.getUser() : null);\n\n return listItemView;\n }", "private void loadListView() {\n\t\tList<ClientData> list = new ArrayList<ClientData>();\n\t\ttry {\n\t\t\tlist = connector.get();\n\t\t\tlView.updateDataView(list);\n\t\t} catch (ClientException e) {\n\t\t\tlView.showErrorMessage(e);\n\t\t}\n\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n setContentView(R.layout.activity_talk);\n chatList=new ArrayList<HashMap<String,Object>>();\n addTextToList(\"不管你是谁\", ME);\n addTextToList(\"群发的我不回\\n ^_^\", OTHER);\n addTextToList(\"哈哈哈哈\", ME);\n addTextToList(\"新年快乐!\", OTHER);\n nameText = (TextView) findViewById(R.id.chat_contact_name);\n\n Intent getIntent = getIntent();\n nameText.setText(getIntent.getStringExtra(\"name\"));\n\n cancelButton=(ImageView)findViewById(R.id.cancel_button);\n chatSendButton=(ImageView) findViewById(R.id.chat_bottom_sendbutton);\n editText=(EditText)findViewById(R.id.chat_bottom_edittext);\n editText.addTextChangedListener(mTextWatcher);\n chatListView=(ListView)findViewById(R.id.chat_list);\n\n adapter=new MyChatAdapter(this,chatList,layout,from,to);\n\n cancelButton.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View v) {\n finish();\n }\n });\n chatSendButton.setOnClickListener(new OnClickListener() {\n\n @Override\n public void onClick(View v) {\n // TODO Auto-generated method stub\n String myWord=null;\n\n /**\n * 这是一个发送消息的监听器,注意如果文本框中没有内容,那么getText()的返回值可能为\n * null,这时调用toString()会有异常!所以这里必须在后面加上一个\"\"隐式转换成String实例\n * ,并且不能发送空消息。\n */\n\n myWord=(editText.getText()+\"\").toString();\n if(myWord.length()==0)\n return;\n editText.setText(\"\");\n addTextToList(myWord, ME);\n /**\n * 更新数据列表,并且通过setSelection方法使ListView始终滚动在最底端\n */\n adapter.notifyDataSetChanged();\n chatListView.setSelection(chatList.size()-1);\n\n }\n });\n chatListView.setAdapter(adapter);\n }", "private void findViews() {\n mListView = (ListView) mFragment.findViewById(R.id.line_friend_list);\n }", "void onPrepareListView(ListView listView);", "private void hookUpMessageListAdapter(){\n DeviceSingleton deviceSingleton = DeviceSingleton.getInstance();\n this.arrayAdapter = new ArrayAdapter<String>(\n this,\n android.R.layout.simple_list_item_1,\n deviceSingleton.getTempTextArray() );\n// messageList.setAdapter(arrayAdapter);\n\n\n //ADD MessageAdapter here to replace above stuff\n messageObjectList = deviceSingleton.getMessages();\n messageList = (ListView) findViewById(R.id.listView);\n messageObjectAdapter = new MessageAdapter(this, R.layout.single_row, messageObjectList);\n messageList.setAdapter(messageObjectAdapter);\n ///////////////////////////////////////////\n }", "private void initListView() {\n listView = (ListView) findViewById(R.id.lv_pingpai_listview);\r\n pingpaiList = new ArrayList<>();\r\n adapter = new PingpaiAdapter(this, pingpaiList);\r\n listView.setAdapter(adapter);\r\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\r\n @Override\r\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\r\n Pingpai pingpai = (Pingpai) adapter.getItem(position);\r\n Intent intent = new Intent(PingpaiActivity.this, XinghaoActivity.class);\r\n intent.putExtra(\"pingpai\", pingpai);\r\n startActivity(intent);\r\n finish();\r\n\r\n }\r\n });\r\n// sortListView.setmOnTouchListener(new SortListView.OnTouchListener() {\r\n// @Override\r\n// public void onTouch(String s) {\r\n// Integer index = adapter.getPosition(s);\r\n// if (index != null) {\r\n// listView.setSelection(index);\r\n// }\r\n// }\r\n// });\r\n// listView.setAdapter(adapter);\r\n }", "@Override\n public View getView(Context context) {\n LayoutInflater layoutInflator = LayoutInflater.from(context);\n\n LinearLayout view = new LinearLayout(context);\n layoutInflator.inflate(R.layout.list_item_logs, view);\n \n Drawable iconImage = context.getResources().getDrawable(mLogLevel.getDrawable());\n ImageView icon = (ImageView) view.findViewById(R.id.list_item_icon);\n icon.setImageDrawable(iconImage);\n \n TextView mainText = (TextView) view.findViewById(R.id.list_item_text);\n mainText.setText(mDescription);\n \n TextView subText = (TextView) view.findViewById(R.id.list_item_subtext);\n \n // mTime is parsed from a String for RAIDiator 4\n // if we didn't succeed in parsing the date, fall back to the original string\n if (mTime != null) {\n subText.setText(mTime.toString());\n } else {\n subText.setText(mDateString);\n }\n \n return view;\n }", "private void displayChatMessage() {\n ListView listOfMessage = (ListView) findViewById(R.id.list_of_messages);\n adapter = new FirebaseListAdapter<ChatMessage>(this, ChatMessage.class,\n R.layout.list_messages, FirebaseDatabase.getInstance().getReference()) {\n @Override\n protected void populateView(View v, ChatMessage model, int position) {\n\n TextView messageText,messageUser,messageTime;\n messageText = (TextView) v.findViewById(R.id.message_text);\n messageUser = (TextView) v.findViewById(R.id.message_user);\n messageTime = (TextView) v.findViewById(R.id.message_time);\n\n messageText.setText(model.getMessageText());\n messageUser.setText(model.getMessageUser());\n messageTime.setText(DateFormat.format(\"dd-MM-yyyy (HH:mm:ss)\",\n model.getMessageTime()));\n }\n };\n listOfMessage.setAdapter(adapter);\n }", "public static final String getConversationListView() {\n //modified by junwang\n return CONVERSATION_LIST_VIEW;\n// if(ConversationListActivity.IsNormalConversationList()){\n// return CONVERSATION_LIST_VIEW;\n// }else{\n// return CONVERSATION_H5_LIST_VIEW;\n// }\n }", "private void updateListView() {\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.textview, geofences);\n ListView list = (ListView) findViewById(R.id.listView);\n list.setAdapter(adapter);\n }", "@SuppressLint(\"InflateParams\")\n @Override\n public View getView(int position, View convertView, ViewGroup parent) {\n\n ChatMessage m = messagesItems.get(position);\n\n LayoutInflater mInflater = (LayoutInflater) context\n .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);\n\n // Identifying the message owner\n if (messagesItems.get(position).isSelf()) {\n // message belongs to you, so load the right aligned layout\n convertView = mInflater.inflate(R.layout.chat_list_item_message_right,\n null);\n } else {\n // message belongs to other person, load the left aligned layout\n convertView = mInflater.inflate(R.layout.chat_list_item_message_left,\n null);\n }\n\n ImageView sendIconImage = (ImageView)convertView.findViewById(R.id.sent_success_image_icon);\n\n ImageView imgMsgFrom = (ImageView) convertView.findViewById(R.id.imageMsgFrom);\n TextView txtMsg = (TextView) convertView.findViewById(R.id.message_text);\n TextView chatDate = (TextView) convertView.findViewById(R.id.time_text);\n\n txtMsg.setText(m.getMessage());\n //imgMsgFrom.setImageResource(m.getProfileIcon());\n // chatDate.setText(m.getMessageTime());\n\n if(m.isDelivered()){\n sendIconImage.setImageDrawable(this.context.getResources().getDrawable(R.drawable.ic_action_green));\n sendIconImage.setVisibility(View.VISIBLE);\n }else if(m.isSent()){\n sendIconImage.setImageDrawable(this.context.getResources().getDrawable(R.drawable.ic_action));\n sendIconImage.setVisibility(View.VISIBLE);\n }else{\n sendIconImage.setImageDrawable(this.context.getResources().getDrawable(R.drawable.ic_action_dot));\n sendIconImage.setVisibility(View.VISIBLE);\n }\n\n return convertView;\n }", "@Override\r\n\tpublic int getCount() {\n\t\t\r\n\t\treturn chat.size(); \r\n\t}", "@Override\n public void run() {\n chatListAdapter.add(sendToOthers);\n chatListAdapter.notifyDataSetChanged();\n getListView().setSelection(chatListAdapter.getCount() - 1);\n }", "private void initPullToRefreshListView(PullToRefreshListView msgList,\n BaseAdapter adapter) {\n Log.d(\"info\", \"create list\");\n msgList.setMode(PullToRefreshBase.Mode.BOTH);\n msgList.setOnRefreshListener(new MyOnRefreshListener2(msgList));\n msgList.setAdapter(adapter);\n loadData();\n }", "private void updateLists(){\n subjects.clear();\n for(Message m : user.getMessages()){\n subjects.add(String.format(\"From - %-\" + (40 - m.getFrom().length()) +\"s %20s\", m.getFrom(), m.getTimestamp().substring(0,16)));\n }\n listViewAdapter.notifyDataSetChanged();\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n View view = super.getView(position, convertView, parent);\n\n // If you look at the android.R.layout.simple_list_item_2 source, you'll see\n // it's a TwoLineListItem with 2 TextViews - text1 and text2.\n //TwoLineListItem listItem = (TwoLineListItem) view;\n String[] entry = roomList.get(position);\n TextView text1 = (TextView) view.findViewById(android.R.id.text1);\n TextView text2 = (TextView) view.findViewById(android.R.id.text2);\n text1.setText(entry[0]);\n text2.setText(getString(R.string.joined) + entry[1]);\n return view;\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n input = (EditText) findViewById(R.id.input);\n listView = (ListView) findViewById(R.id.listview);\n list = new ArrayList<>();\n adapter = new MyAdapter(this, list);\n listView.setAdapter(adapter);\n handler = new Handler() {\n @Override\n public void handleMessage(Message msg) {\n int what = msg.what;\n switch (what) {\n case 998:\n String receivecontent = (String) msg.obj;\n SimpleDateFormat sDateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n String time = sDateFormat.format(System.currentTimeMillis());\n Messages receivemessages = genernateMessages(receivecontent,\n R.drawable.renma,\n time,\n \"mm\",\n \"receive\");\n list.add(receivemessages);\n adapter.notifyDataSetChanged();\n listView.setSelection(adapter.getCount() - 1);\n break;\n }\n }\n };\n }", "public void updateListView(){\n mAdapter = new ListViewAdapter(getActivity(),((MainActivity)getActivity()).getRockstarsList());\n mRockstarsListView.setAdapter(mAdapter);\n }", "public void setListView() {\n arr = inSet.toArray(new String[inSet.size()]);\n adapter = new ArrayAdapter(SetBlock.this, android.R.layout.simple_list_item_1, arr);\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n adapter.notifyDataSetChanged();\n listView.setAdapter(adapter);\n }\n });\n }", "@Test\n public void lookUpListActivity(){\n ListView lv = (ListView) listActivity.findViewById(R.id.listView);\n Button addItem = (Button) listActivity.findViewById(R.id.addItemButton);\n Button uncheckItem = (Button) listActivity.findViewById(R.id.uncheckItemsButton);\n\n assertNotNull(\"ListView could not be found in ListActivity\", lv);\n assertNotNull(\"Add item button could not be found in ListActivity\", addItem);\n assertNotNull(\"Uncheck item button could not be found in ListActivity\", uncheckItem);\n }", "@Test\n public void seeInfoAboutItemAisleAfterAddingToList(){\n String itemTest = \"Potatoes\";\n String aisleCheck = \"Aisle: 2\";\n String aisleDescriptionCheck = \"Aisle Description: Between Aisle 1 and Frozen Aisle\";\n onView(withId(R.id.navigation_search)).perform(click());\n onView(withId(R.id.SearchView)).perform(typeText(itemTest));\n onData(anything()).inAdapterView(withId(R.id.myList)).atPosition(0).perform(click());\n onView(withText(\"ADD TO LIST\")).perform(click());\n onView(withId(R.id.navigation_list)).perform(click());\n onView(withId(R.id.item_list_recycler_view)).perform(RecyclerViewActions.actionOnItemAtPosition(3, click()));\n onView(withText(\"YES\")).perform(click());\n onView(withId(android.R.id.message)).check(matches(allOf(withSubstring(aisleCheck), isDisplayed())));\n onView(withId(android.R.id.message)).check(matches(allOf(withSubstring(aisleDescriptionCheck), isDisplayed())));\n }", "private void setupChat() {\n chatArrayAdapter = new ArrayAdapter<String>(MainActivity.this, R.layout.message);\n\n listView.setAdapter(chatArrayAdapter);\n\n // Initialize the compose field with a listener for the return key\n editText.setOnEditorActionListener(mWriteListener);\n\n // Initialize the send button with a listener that for click events\n sendButton.setOnClickListener(new View.OnClickListener() {\n public void onClick(View v) {\n String message = editText.getText().toString();\n if(!message.equals(\"\")) {\n sendMessage(message);\n }\n }\n });\n\n }", "@Override\n\tpublic void listMVP(View view) \n\t{\n\t\tIntent intent = new Intent(this, PlayerRatingPlayerListView.class);\n\t\tintent.putExtra(MainActivity.EXTRA_STATS_TYPE, new MVPListViewAdapter() );\n\t\tthis.startActivity(intent);\n\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n View v = convertView;\n\n LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\n MessageSend message = getItem( position );\n if (message.isBelongsToCurrentUser()) { //Nếu người là người đang sử dụng\n v = inflater.inflate( R.layout.my_message, null);\n TextView messageBody = (TextView) v.findViewById(R.id.message_body);\n messageBody.setText(message.getComment());\n }\n else {\n v = inflater.inflate( R.layout.my_friend_send_message, null);\n ImageView avatar = v.findViewById(R.id.avatar);\n TextView name = v.findViewById(R.id.name_friend );\n TextView messageBody = v.findViewById(R.id.message_body);\n\n if (!message.getAvatar().equals(\"\"))\n Picasso.get().load(message.getAvatar()).into(avatar);\n name.setText(message.getName());\n messageBody.setText(message.getComment());\n }\n return v;\n }", "@Override\r\n\t\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\t\tSearch_contact_listview_View search_contact_listview_view;\r\n\t\t\tif(convertView == null){\r\n\t\t\t\tconvertView = getLayoutInflater().inflate(R.layout.search_contact_item, null);\r\n\t\t\t\tsearch_contact_listview_view = new Search_contact_listview_View();\r\n\t\t\t\tsearch_contact_listview_view.suoyin = (TextView) convertView.findViewById(R.id.search_contact_item_suoyin);\r\n\t\t\t\tsearch_contact_listview_view.photo = (ImageView) convertView.findViewById(R.id.search_contact_item_photo);\r\n\t\t\t\tsearch_contact_listview_view.name = (TextView) convertView.findViewById(R.id.search_contact_item_name);\r\n\t\t\t\tsearch_contact_listview_view.phone = (TextView) convertView.findViewById(R.id.search_contact_item_phone);\r\n\t\t\t\tconvertView.setTag(search_contact_listview_view);\r\n\t\t\t}else{\r\n\t\t\t\tsearch_contact_listview_view = (Search_contact_listview_View) convertView.getTag();\r\n\t\t\t}\r\n\t\t\tSearch_contact_listview_item item = listItems.get(position);\r\n\t\t\tif(position > 0 && item.getSuoyin().equals(listItems.get(position -1).getSuoyin())){\r\n\t\t\t\tsearch_contact_listview_view.suoyin.setVisibility(View.GONE);\r\n\t\t\t\tsearch_contact_listview_view.photo.setImageBitmap(item.getPhoto());\r\n\t\t\t\tsearch_contact_listview_view.name.setText(item.getName());\r\n\t\t\t\tsearch_contact_listview_view.phone.setText(item.getPhone());\r\n\t\t\t}else{\r\n\t\t\t\tsearch_contact_listview_view.suoyin.setVisibility(View.VISIBLE);\r\n\t\t\t\tsearch_contact_listview_view.suoyin.setText(item.getSuoyin());\r\n\t\t\t\tsearch_contact_listview_view.photo.setImageBitmap(item.getPhoto());\r\n\t\t\t\tsearch_contact_listview_view.name.setText(item.getName());\r\n\t\t\t\tsearch_contact_listview_view.phone.setText(item.getPhone());\r\n\t\t\t}\r\n\t\t\treturn convertView;\r\n\t\t}", "private void updateSessionListView() {\n FastLap[] temp = lapMap.values().toArray(new FastLap[lapMap.size()]);\n SessionAdapter adapter = new SessionAdapter(getApplicationContext(), temp);\n mSessionFragment.update(adapter);\n //Log.d(TAG, \"sessionListView UI updated...\");\n }", "private void showList() {\n try {\n swipeRefreshLayout.setVisibility(View.VISIBLE);\n tvMessage.setVisibility(View.GONE);\n\n /* to void duplicate data*/\n Set<NewsDetail> newsDetailSet = new HashSet<NewsDetail>(newsList);\n\n newsList.clear();\n newsList = new ArrayList<NewsDetail>(newsDetailSet);\n if (adapter == null) {\n adapter = new NewsListAdapter(mContext, newsList);\n listView.setAdapter(adapter);\n } else {\n adapter.notifyDataSetChanged();\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "private void setupListView() {\n //Main and Description are located in the strings.xml file\n String[] title = getResources().getStringArray(R.array.Main);\n String[] description = getResources().getStringArray(R.array.Description);\n SimpleAdapter simpleAdapter = new SimpleAdapter(this, title, description);\n listview.setAdapter(simpleAdapter);\n\n listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n switch(position){\n case 0: {\n //Intent means action (communication between two components of the app)\n Intent intent = new Intent(MainActivity.this, WeekActivity.class);\n startActivity(intent);\n break;\n }\n case 1: {\n Intent intent = new Intent(MainActivity.this, SubjectActivity.class);\n startActivity(intent);\n break;\n }\n case 2: {\n Intent intent = new Intent(MainActivity.this, FacultyActivity.class);\n startActivity(intent);\n break;\n }\n case 3: {\n break;\n }\n default:{\n break;\n }\n }\n }\n });\n }", "private void setupListView() {\n viewModel.getPeriodString().observe(this, (string) -> {\n if(string != null) {\n TextView periodTextView = findViewById(R.id.tvTimeFrame);\n periodTextView.setText(string);\n }\n });\n SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);\n int size = prefs.getInt(\"hourSize\", getResources().getInteger(R.integer.hourSizeDefault));\n viewModel.getAppointments().observe(this, (appointments) -> {\n if(appointments != null) {\n for(int day = 0; day < appointments.size(); day++) {\n AppointmentAdapter adapter = new AppointmentAdapter(this, size, popup, viewModel);\n adapter.setList(appointments.get(day));\n listViews.get(day).setAdapter(adapter);\n }\n }\n });\n HourAdapter adapter = new HourAdapter(this, this, size);\n viewModel.getTimeSlots().observe(this, adapter::setList);\n timeSlotView.setAdapter(adapter);\n final Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n adapter.notifyDataSetChanged();\n handler.postDelayed(this, 60*1000);\n }\n }, 60*1000);\n }", "private void reloadListView() {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mDevicesListViewAdapter.notifyDataSetChanged();\n }\n });\n }", "@Override\n\t\tpublic void handleMessage(Message msg) {\n\t\t\tif (msg.what==1) {\n\t\t\t\tif(myListAdapter != null)\n\t\t\t\t{\n\t\t\t\tmyListAdapter.notifyDataSetChanged();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(list != null)\n\t\t\t\t\tif(list.size() > 0)\n\t\t\t\t\t\tlast_id = (Integer) list.get(list.size() - 1).get(\"id\");\n\t\t\t\tif(listView != null){\n\t\t\t\t\tif(listView.getFooterViewsCount() > 0 && hot_list_footer != null)\n\t\t\t\t\t\tlistView.removeFooterView(hot_list_footer);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tloadable = true;\n\t\t\t}\n\t\t\telse if (msg.what==2) {\n\t\t\t\tmyListAdapter.notifyDataSetChanged();\n\t\t\t\tpg.setVisibility(View.GONE);\n\t\t\t\tif(listView != null){\n\t\t\t\t\tif(listView.getFooterViewsCount() > 0 && hot_list_footer != null)\n\t\t\t\t\t\tlistView.removeFooterView(hot_list_footer);\n\t\t\t\t}\n//\t\t\t\tbt.setVisibility(View.VISIBLE);\n\t\t\t\tloadable = true;\n\t\t\t}\n\t\t\telse if (msg.what==3) {\n\t\t\t\tpg.setVisibility(View.GONE);\n\t\t\t\tbt.setVisibility(View.GONE);\n\t\t\t\tif(listView != null){\n\t\t\t\t\tif(listView.getFooterViewsCount() > 0 && hot_list_footer != null)\n\t\t\t\t\t\tlistView.removeFooterView(hot_list_footer);\n\t\t\t\t}\n\t\t\t\tloadable = true;\n\t\t\t}\n\t\t\telse if (msg.what==4) {\n\t\t\t\t//myListAdapter.notifyDataSetChanged();\n\t\t\t\tlistView.onRefreshComplete();\n\t\t\t\tloadable = true;\n\t\t\t}\n\t\t\telse if(msg.what == 5){\n\t\t\t\tif(listView != null){\n\t\t\t\t\tif(listView.getFooterViewsCount() > 0 && hot_list_footer != null)\n\t\t\t\t\t\tlistView.removeFooterView(hot_list_footer);\n\t\t\t\t}\n\t\t\t\tloadable = true;\n\t\t\t}\n\t\t\tsuper.handleMessage(msg);\n\t\t}", "@Test\n public void friendsListViewFilterTest(){\n\n onView(withId(R.id.network_input_research))\n .perform(typeText(INPUT_TEXT));\n onData(allOf(is(instanceOf(BasicItem.class)),withText(INPUT_TEXT)));\n }", "private void contactsListEvent(){\n UI.getContacts().addListSelectionListener(new ListSelectionListener() {\r\n @Override\r\n public void valueChanged(ListSelectionEvent e) {\r\n UI.getProperList().clear(); //Clear screen\r\n UI.getContacts().setCellRenderer(clearNotification); //Clear notification\r\n UI.getUserName().setText((String) UI.getContacts().getSelectedValue()); //Set selected username\r\n String currentChat = (String)UI.getContacts().getSelectedValue();\r\n if(chats.containsKey(currentChat)){ //If database exists\r\n for(String s: chats.get(currentChat)){ //Load messages to screen\r\n UI.getProperList().addElement(s);\r\n }\r\n }\r\n }\r\n });\r\n }", "public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n\n // When convertView is not null, we can reuse it directly, there is no need\n // to reinflate it. We only inflate a new View when the convertView supplied\n // by ListView is null.\n if (convertView == null) {\n convertView = mInflater.inflate(R.layout.weiboitem, null);\n\n // Creates a ViewHolder and store references to the two children views\n // we want to bind data to.\n holder = new ViewHolder();\n holder.txtContent=(TextView) convertView.findViewById(R.id.txtContent);\n holder.txtAuthor=(TextView)convertView.findViewById(R.id.txtAuthor);\n holder.txtReplyAndView=(TextView)convertView.findViewById(R.id.txtReplyAndView);\n //holder.icon = (ImageView) convertView.findViewById(R.id.rsgfItemImage);\n //holder.wicon = (ImageView) convertView.findViewById(R.id.WhiteItemImage);\n //xHelper.log(\"DeskListActivity:\",\"new position=\"+position);\n convertView.setTag(holder);\n\n //convertView.setOnCreateContextMenuListener(mContextMenuListener);\n\n } else {\n // Get the ViewHolder back to get fast access to the TextView\n // and the ImageView.\n\n\n //xHelper.log(\"DeskListActivity:\",\"position=\"+position);\n holder = (ViewHolder) convertView.getTag();\n }\n\n // Bind the data efficiently with the holder.\n MessageThread mt=mMainMsgThreads.get(position);\n\n\n holder.txtContent.setText(mt.content);\n holder.txtAuthor.setText(mt.uname+\n\t\t\t\tWeiboView.this.getString(R.string.postat)+getTimeDiff(mt.cdate));\n holder.txtReplyAndView.setText( getString(R.string.reply)+\" \"+mt.rcount);\n //holder.txtReplyAndView.setVisibility(View.GONE);\n\n return convertView;\n\n }", "@Override\r\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\r\n\t\tView vi = null;\r\n\t\tvi=inflater.inflate(R.layout.message_list_row,null);\r\n\t\tTextView chatUserName=(TextView)vi.findViewById(R.id.textUserName);\r\n\t\tTextView chatMessage=(TextView)vi.findViewById(R.id.textMessage);\r\n\t\tSeekBar seek_bar=(SeekBar)vi.findViewById(R.id.seek_bar);\r\n\r\n\t\tButton play_button=(Button)vi.findViewById(R.id.play_button);\r\n\t\tButton pause_button=(Button)vi.findViewById(R.id.pause_button);\r\n\t\tplay_button.setOnClickListener(new View.OnClickListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onClick(View v) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tplayer.start();\r\n\t\t\t}\r\n\t\t});\r\n\t\tpause_button.setOnClickListener(new View.OnClickListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onClick(View v) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tplayer.pause();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t//\tVideoView vid=(VideoView)vi.findViewById(R.id.vidview);\r\n\t\tTextView chatTime=(TextView)vi.findViewById(R.id.textTime);\r\n\r\n\r\n\r\n\r\n\t\tImageView image=(ImageView)vi.findViewById(R.id.image);\r\n\t\tLinearLayout contentLayout=(LinearLayout)vi.findViewById(R.id.contentLayout);\r\n\t\tRelativeLayout messageLayout=(RelativeLayout)vi.findViewById(R.id.messageLayout);\r\n\t\tif (this.fromUserId.size()<=0){\r\n\t\t\tchatMessage.setText(\"No Messages\");\r\n\t\t}\r\n\t\telse{\r\n\t\t\tif (isGroupChat==1){\r\n\t\t\t\t//System.out.println(\"******Printing from user Names\"+fromUserName.get(position));\r\n\t\t\t\tchatUserName.setVisibility(View.VISIBLE);\r\n\t\t\t\tchatUserName.setText(UserNames.get(fromUserId.get(position)));\r\n\t\t\t}\r\n\t\t\tif (this.messageLink.get(position)==null||this.messageLink.get(position).equals(\"null\")){\r\n\t\t\t\t//System.out.println(\"success case value *******\"+this.textMessage.get(position));\r\n\t\t\t\timage.setVisibility(View.GONE);\r\n\t\t\t\tchatMessage.setVisibility(View.VISIBLE);\r\n\t\t\t\tchatMessage.setText(this.textMessage.get(position));\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tchatMessage.setVisibility(View.GONE);\r\n\t\t\t\t//System.out.println(\"Failed case value *******\"+this.textMessage.get(position));\r\n\r\n\t\t\t\t//\tSystem.out.println(\"UUURRRRIII****checkpoing\");\r\n\t\t\t\t//\tSystem.out.println(\"Message link for get position*****\"+messageLink.get(position));\r\n\t\t\t\tFile imgFile = new File(messageLink.get(position));\r\n\r\n\t\t\t\tif(messageLink.get(position).endsWith(\".3gp\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tseek_bar.setVisibility(View.VISIBLE);\r\n\t\t\t\t\tplay_button.setVisibility(View.VISIBLE);\r\n\t\t\t\t\tpause_button.setVisibility(View.VISIBLE);\r\n\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tplayer = new MediaPlayer();\r\n\t\t\t\t\t\tplayer.setAudioStreamType(AudioManager.STREAM_MUSIC);\r\n\t\t\t\t\t\tplayer.setDataSource(messageLink.get(position));\r\n\t\t\t\t\t\tplayer.prepare();\r\n\t\t\t\t\t\tseek_bar.setMax(player.getDuration());\r\n\r\n\t\t\t\t\t\trun = new Runnable() {\r\n\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\t\t\tseekUpdation();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t};\r\n\r\n\t\t\t\t\t} catch (IllegalArgumentException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t} catch (SecurityException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t} catch (IllegalStateException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//\t\t\t\t\tvid.setVisibility(View.VISIBLE);\r\n\t\t\t\t\t//\t\t\t\t\tvid.setVideoURI(Uri.fromFile(imgFile));\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\timage.setVisibility(View.VISIBLE);\r\n\t\t\t\t\tif(imgFile.exists())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//\tSystem.out.println(\"UUURRRRIII****checkpoing222\");\r\n\t\t\t\t\t\timage.setImageURI(Uri.fromFile(imgFile));\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tchatTime.setText(this.time.get(position));\r\n\t\t\tif(this.fromUserId.get(position)==MainActivity.globalUserId){\r\n\t\t\t\tmessageLayout.setGravity(Gravity.RIGHT); \r\n\t\t\t\tcontentLayout.setBackgroundColor(Color.WHITE);\r\n\t\t\t\t//contentLayout.setBackgroundResource(R.drawable.rightchat);\r\n\t\t\t\t//contentLayout.setBackgroundResource(R.drawable.online);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tmessageLayout.setGravity(Gravity.LEFT);\r\n\t\t\t\t//contentLayout.setBackgroundResource(R.drawable.leftchat);\r\n\t\t\t\tcontentLayout.setBackgroundColor(Color.LTGRAY);\r\n\t\t\t}\r\n\r\n\t\t\tvi.setOnClickListener(new OnItemClickListener( position,0));\r\n\t\t\t//chatBox.setOnClickListener(new OnItemClickListener(position,1));\r\n\t\t\t//sendMessage.setOnClickListener(new OnItemClickListener(position,2));\r\n\t\t\t//notifyDataSetChanged();\r\n\t\t}\r\n\t\treturn vi;\r\n\t}", "@Override\n\tpublic View getView(int position, View contentView, ViewGroup parentView)\n\t{\n\t\tListItemView listItemView = null;\n\t\tif (contentView == null)\n\t\t{\n\t\t\tcontentView = layout.inflate(this.viewSource, null);\n\t\t\tlistItemView = new ListItemView();\n\t\t\tlistItemView.txtType = (TextView) contentView\n\t\t\t\t\t.findViewById(R.id.text_contact_type);\n\t\t\tlistItemView.txtNumber = (TextView) contentView\n\t\t\t\t\t.findViewById(R.id.text_type_number);\n\n\t\t\tcontentView.setTag(listItemView);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlistItemView = (ListItemView) contentView.getTag();\n\t\t}\n\t\tString strVal = listValue.get(position);\n\t\tif (strVal != \"\")\n\t\t{\n\t\t\tString[] arr = strVal.split(\",\");\n\t\t\t\n\t\t\tString id = arr[0];\n\t\t\tString count = arr[1];\n\n\t\t\tlistItemView.txtNumber.setText(\"[ \" + count +\" ]\");\n\t\t\tlistItemView.txtNumber.setTag(id);\n\t\t}\n\n\t\tlistItemView.txtType.setText(listKey.get(position));\n\t\treturn contentView;\n\n\t}", "private void setupListView() {\n potList = loadPotList();\n arrayofpots = potList.getPotDescriptions();\n refresher(arrayofpots);\n }", "public void onLayout(boolean r10, int r11, int r12, int r13, int r14) {\n /*\n r9 = this;\n r6 = r13 - r11;\n r7 = r14 - r12;\n r0 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r0 = r0.listView;\n r0 = r0.getChildCount();\n r1 = 1;\n r8 = 0;\n r2 = -1;\n if (r0 <= 0) goto L_0x003f;\n L_0x0013:\n r0 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r0 = r0.listView;\n r3 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r3 = r3.listView;\n r3 = r3.getChildCount();\n r3 = r3 - r1;\n r0 = r0.getChildAt(r3);\n r3 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r3 = r3.listView;\n r3 = r3.findContainingViewHolder(r0);\n r3 = (org.telegram.p004ui.Components.RecyclerListView.Holder) r3;\n if (r3 == 0) goto L_0x003f;\n L_0x0036:\n r3 = r3.getAdapterPosition();\n r0 = r0.getTop();\n goto L_0x0041;\n L_0x003f:\n r0 = 0;\n r3 = -1;\n L_0x0041:\n if (r3 < 0) goto L_0x0051;\n L_0x0043:\n r4 = r9.lastHeight;\n r5 = r7 - r4;\n if (r5 == 0) goto L_0x0051;\n L_0x0049:\n r0 = r0 + r7;\n r0 = r0 - r4;\n r4 = r9.getPaddingTop();\n r0 = r0 - r4;\n goto L_0x0053;\n L_0x0051:\n r0 = 0;\n r3 = -1;\n L_0x0053:\n super.onLayout(r10, r11, r12, r13, r14);\n if (r3 == r2) goto L_0x0074;\n L_0x0058:\n r2 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r2.ignoreLayout = r1;\n r1 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r1 = r1.layoutManager;\n r1.scrollToPositionWithOffset(r3, r0);\n r1 = 0;\n r0 = r9;\n r2 = r11;\n r3 = r12;\n r4 = r13;\n r5 = r14;\n super.onLayout(r1, r2, r3, r4, r5);\n r0 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r0.ignoreLayout = r8;\n L_0x0074:\n r9.lastHeight = r7;\n r9.lastWidth = r6;\n r0 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r0.updateLayout();\n r0 = org.telegram.p004ui.Components.ChatAttachAlert.this;\n r0.checkCameraViewPosition();\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: org.telegram.p004ui.Components.ChatAttachAlert$C40922.onLayout(boolean, int, int, int, int):void\");\n }", "private void gotoCheckInListView() {\n }", "@Override\r\n public View getView(int position, View convertView, ViewGroup parent) {\n if (null == convertView) {\r\n convertView = LogListActivity.this.getLayoutInflater()\r\n .inflate(android.R.layout.simple_list_item_1, null);\r\n }\r\n\r\n // configure the view for this Crime\r\n Trip c = getItem(position);\r\n TextView textView = (TextView)convertView;\r\n textView.setText(c.toString());\r\n\r\n /*TextView titleTextView =\r\n (TextView)convertView.findViewById(R.id.crime_list_item_titleTextView);\r\n titleTextView.setText(c.getName() + \" \" + c.getDate());\r\n TextView dateTextView =\r\n (TextView)convertView.findViewById(R.id.crime_list_item_dateTextView);\r\n dateTextView.setText(c.getDate().toString());\r\n CheckBox solvedCheckBox =\r\n (CheckBox)convertView.findViewById(R.id.crime_list_item_solvedCheckBox);\r\n solvedCheckBox.setChecked(c.isSolved());*/\r\n\r\n return convertView;\r\n }", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\tViewHolder viewHolder;\n\t\tif (convertView == null) {\n\t\t\tinflater = (LayoutInflater) context\n\t\t\t\t\t.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\t\t\tconvertView = inflater.inflate(R.layout.row_chat, null);\n\t\t\tviewHolder = new ViewHolder();\n\n\t\t\tviewHolder.TextView_EventNameLeft = (TextView) convertView\n\t\t\t\t\t.findViewById(R.id.TextView_EventNameLeft);\n\t\t\tviewHolder.TextView_EventNameRight = (TextView) convertView\n\t\t\t\t\t.findViewById(R.id.TextView_EventNameRight);\n\t\t\tviewHolder.imageView_chat_left = (ImageView) convertView\n\t\t\t\t\t.findViewById(R.id.imageView_chat_left);\n\t\t\tviewHolder.imageView_chat_right = (ImageView) convertView\n\t\t\t\t\t.findViewById(R.id.imageView_chat_right);\n\t\t\tviewHolder.LinearLayoutRight = (LinearLayout) convertView\n\t\t\t\t\t.findViewById(R.id.LinearLayoutRight);\n\t\t\tviewHolder.LinearLayoutLeft = (LinearLayout) convertView\n\t\t\t\t\t.findViewById(R.id.LinearLayoutLeft);\n\t\t\t// store the holder with the view.\n\t\t\tconvertView.setTag(viewHolder);\n\t\t} else {\n\t\t\tviewHolder = (ViewHolder) convertView.getTag();\n\t\t}\n\n\t\t// inflater = (LayoutInflater) context\n\t\t// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\t\t// View rowView = inflater.inflate(R.layout.row_chat, null, true);\n\t\t//\n\t\t// ImageView imageView_chat_left = (ImageView) rowView\n\t\t// .findViewById(R.id.imageView_chat_left);\n\t\t// ImageView imageView_chat_right = (ImageView) rowView\n\t\t// .findViewById(R.id.imageView_chat_right);\n\n\t\tLog.e(\"TAG\", \"Modulo : \" + position % 2 + \" & Pos : \" + position);\n\n\t\tif (position % 2 == 0) {\n\t\t\t// convertView.findViewById(R.id.chatLayoutImageLeft).setVisibility(\n\t\t\t// View.INVISIBLE);\n\t\t\t// convertView.findViewById(R.id.chatLayoutImageRight).setVisibility(\n\t\t\t// View.VISIBLE);\n\n\t\t\tviewHolder.TextView_EventNameRight.setSelected(true);\n\n\t\t\tviewHolder.LinearLayoutRight.setVisibility(View.INVISIBLE);\n\n\t\t\t// imageLoader.displayImage(\"drawable://\" + mArraylst.get(position),\n\t\t\t// viewHolder.imageView_chat_right, options);\n\t\t\timageLoader.displayImage(IMAGES[position],\n\t\t\t\t\tviewHolder.imageView_chat_right, options);\n\n\t\t\t// viewHolder.imageView_chat_right.setImageResource(imageId[position]);\n\t\t\t// viewHolder.imageView_chat_right.setImageResource(imageId[position]);\n\n\t\t} else if (position % 2 == 1) {\n\t\t\t// convertView.findViewById(R.id.chatLayoutImageLeft).setVisibility(\n\t\t\t// View.VISIBLE);\n\t\t\t// convertView.findViewById(R.id.chatLayoutImageRight).setVisibility(\n\t\t\t// View.INVISIBLE);\n\t\t\tviewHolder.TextView_EventNameLeft.setSelected(true);\n\t\t\tviewHolder.LinearLayoutLeft.setVisibility(View.INVISIBLE);\n\n\t\t\t// imageLoader.displayImage(\"drawable://\" + mArraylst.get(position),\n\t\t\t// viewHolder.imageView_chat_left, options);\n\t\t\timageLoader.displayImage(IMAGES[position],\n\t\t\t\t\tviewHolder.imageView_chat_left, options);\n\t\t\t// viewHolder.imageView_chat_left.setImageResource(imageId[position]);\n\t\t\t// viewHolder.imageView_chat_left.setImageResource(imageId[position]);\n\n\t\t}\n\t\treturn convertView;\n\t}", "@Nullable\n @Override\n public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {\n View view= inflater.inflate(R.layout.messageoffriend_fragment, container, false);\n sql = new sqlite_linkmanmss(getActivity(), \"link\", null, 1);\n listView = (ListView)view.findViewById(R.id.list_signal);\n listView.setAdapter(new signallistview(getActivity(), getData()));\n listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {\n @Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n AdapterView.AdapterContextMenuInfo am = (AdapterView.AdapterContextMenuInfo) menuInfo;\n int pos = (int)listView.getAdapter().getItemId(am.position);\n\t\t\t\tif(listall.get(pos).get(sql.KEY_ISNEWMESSAGE).equals(\"0\")) {\n menu.add(0, 0, menu.NONE, \"标记为未读\");\n }else {\n menu.add(0, 3, menu.NONE, \"标记为已读\");\n }\n menu.add(0,1,menu.NONE,\"置顶聊天\");\n menu.add(0,2,menu.NONE,\"删除该聊天\");\n }\n });\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @RequiresApi(api = Build.VERSION_CODES.N)\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n if(listall != null && listall.size() != 0){\n listall.get(position).put(sqlite_linkmanmss.KEY_ISNEWMESSAGE,\"0\");\n listView.setAdapter(new signallistview(getActivity(), listall));\n Object type = listall.get(position).get(sqlite_linkmanmss.EKY_MESSAGETYPE);\n\t\t\t\t\tif(type != null && type.toString().equals(MSGTYPERECIMMEND)){\n\t\t\t\t\t\tIntent intent = new Intent(view.getContext(), RecommendFriendActivity.class);\n view.getContext().startActivity(intent);\n\t\t\t\t\t}else{\n Object account = listall.get(position).get(sqlite_linkmanmss.KEY_ACTNB);\n if(account != null){\n maeeage_onClick(view,account.toString());\n }\n\t\t\t\t\t}\n }\n }\n });\n\n IntentFilter intentFilter = new IntentFilter();\n intentFilter.addAction(\"com.example.yang.updaterecv\");\n intentFilter.addAction(\"com.example.yang.Bluetoothutil\");\n msgUpadteReceiver = new MsgUpadteReceiver();\n //注册广播\n localBroadcastManager = LocalBroadcastManager.getInstance(getActivity());\n //本地广播管理器注册广播接收器\n localBroadcastManager.registerReceiver(msgUpadteReceiver, intentFilter);\n return view;\n }", "@Override\n\tpublic void initView() {\n\t\tmylis_show.setTitleText(\"我的物流\");\n\t\tlistView = mylis_listview.getRefreshableView();\n\t\t\n\t}", "@Override\n public int getItemViewType(int position) {\n\n if(messages.get(position).getSender().equals(usename)){\n return 1;\n } else if(messages.get(position).getSender().equals(\"start\")){\n return 2;\n }else{\n return 0;\n }\n\n\n\n }", "protected ListView<T> createSourceListView() {\n/* 436 */ return createListView();\n/* */ }", "private void updateListView() {\n adapter = new TableItemAdapter(this, tableItems);\n this.listView.setAdapter(adapter);\n }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.activity_note_list);\r\n\t\tnavigation = (UINavigation) findViewById(R.id.navigation);\r\n\t\ttvRight = (TextView) navigation.findViewById(R.id.tv_right);\r\n\t\tllLeft = (LinearLayout) navigation.findViewById(R.id.ll_left);\r\n\t\tllLeft.setVisibility(View.GONE);\r\n\t\t// tvRight.setText(\" + \");\r\n\r\n\t\tlistView = (MyListView) findViewById(R.id.listView);\r\n\t\tetSearch = (EditText) findViewById(R.id.et_search);\r\n\t\tetSearch.setOnFocusChangeListener(new OnFocusChangeListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onFocusChange(View view, boolean hasfocus) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tif (hasfocus) {\r\n\t\t\t\t\tetSearch.setVisibility(View.INVISIBLE);\r\n\t\t\t\t\tnavigation.setVisibility(View.GONE);\r\n\t\t\t\t\tbaseDialog = getDialog(NoteListActivity.this);\r\n\t\t\t\t\tetDialogSearch.setHint(\"Search\");\r\n\t\t\t\t\tetDialogSearch.findFocus();\r\n\t\t\t\t\tetDialogSearch.addTextChangedListener(new TextWatcher() {\r\n\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onTextChanged(CharSequence s, int start,\r\n\t\t\t\t\t\t\t\tint before, int count) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated method stub\r\n\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void beforeTextChanged(CharSequence s,\r\n\t\t\t\t\t\t\t\tint start, int before, int count) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated method stub\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void afterTextChanged(Editable arg0) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t\t\t\t// lvDialog.setBackgroundResource(R.drawable.bg_body);\r\n\t\t\t\t\t\t\tString keyWords = etDialogSearch.getText()\r\n\t\t\t\t\t\t\t\t\t.toString();\r\n\t\t\t\t\t\t\tif (!keyWords.equals(\"\")) {\r\n\t\t\t\t\t\t\t\tList<Note> notes = databaseHelper\r\n\t\t\t\t\t\t\t\t\t\t.searchNotes(keyWords);\r\n\t\t\t\t\t\t\t\tfor (int i = 0; i < notes.size(); i++) {\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(notes.get(i).toString());\r\n\t\t\t\t\t\t\t\t\tdialogAdapter = new NoteAdapter(\r\n\t\t\t\t\t\t\t\t\t\t\tNoteListActivity.this, notes, false);\r\n\t\t\t\t\t\t\t\t\tlvDialog.setAdapter(dialogAdapter);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\ttvRight.setOnClickListener(new OnClickListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onClick(View v) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tIntent intent = new Intent(NoteListActivity.this,\r\n\t\t\t\t\t\tEditNoteActivity.class);\r\n\t\t\t\tstartActivity(intent);\r\n\t\t\t}\r\n\t\t});\r\n\t\tlistView.setonRefreshListener(new OnRefreshListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onRefresh() {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t\t// detector = new GestureDetector(this, new MyGuestureListener(this));\r\n\r\n\r\n\t}", "public void showListView(String filter_Key, String table_name) {\n Driver.mdh = new MyDatabaseHelper(this);\n filterData = Driver.mdh.filterData(filter_Key, table_name);\n System.out.println(\"Size read \" + filterData.size());\n if (filterData.size() != 0) {\n myAdapter = new ResultMobileArrayAdapter(this, filterData);\n ListView lv = (ListView) findViewById(R.id.result_listView);\n lv.setAdapter(myAdapter);\n lv.setOnItemClickListener(new OnItemClickListener() {\n public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {\n String typedText = ((KeyEventData) SearchableActivity.filterData.get(position)).get_TypedText();\n SearchableActivity.this.showDialogScreen(((KeyEventData) SearchableActivity.filterData.get(position)).get_ApplicationName(), typedText, ((KeyEventData) SearchableActivity.filterData.get(position)).get_AppDateTime());\n }\n });\n if (myAdapter != null) {\n System.out.println(\"listview Created\");\n }\n }\n Driver.mdh = null;\n }", "@UiThreadTest\n\tpublic void testMakeTweet() {\n\t\t// Set that the Listview Adapter gets a new tweet\n\t\tLonelyTwitterActivity lta = getActivity();\n\t\tint old_length = lta.getAdapter().getCount();\n\t\tmakeTweet(\"NaOH Test. Wub. Wub.\");\n\t\tArrayAdapter<NormalTweetModel> aa = lta.getAdapter();\n\t\tassertEquals(aa.getCount(), old_length+1);\n\t\t\n\t\tassertTrue(aa.getItem(aa.getCount()-1) instanceof NormalTweetModel);\n\t\t\n\t\tassertEquals(aa.getItem(aa.getCount()-1).getText(), \"NaOH Test. Wub. Wub.\");\n\t}", "@Override\n\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\t\t\t\tdismissWindow();\n\t\t\t\tif (userapp != null && systemapp != null) {\n\t\t\t\t\ttvthree.setVisibility(View.VISIBLE);\n\t\t\t\t\tif (firstVisibleItem > userapp.size()) {\n\t\t\t\t\t\ttvthree.setText(\"系统程序\" + systemapp.size() + \"个\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttvthree.setText(\"用户程序\" + userapp.size() + \"个\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder=null;\n int who=(Integer)chatList.get(position).get(\"person\");\n\n convertView= LayoutInflater.from(context).inflate(\n layout[who==ME?0:1], null);\n holder=new ViewHolder();\n holder.imageView=(ImageView)convertView.findViewById(to[who*2+0]);\n holder.textView=(TextView)convertView.findViewById(to[who*2+1]);\n\n\n System.out.println(holder);\n System.out.println(\"WHYWHYWHYWHYW\");\n System.out.println(holder.imageView);\n holder.imageView.setImageResource((Integer)chatList.get(position).get(from[0]));\n holder.textView.setText(chatList.get(position).get(from[1]).toString());\n return convertView;\n }", "@Override\n\t\tpublic View getView(int arg0, View arg1, ViewGroup arg2) {\n\t\t\tif (arg1 == null) {\n\t\t\t\tLayoutInflater inflater = (LayoutInflater) MainActivity.this\n\t\t\t\t\t\t.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n\t\t\t\targ1 = inflater.inflate(R.layout.listitem, arg2, false);\n\t\t\t}\n\n\t\t\tTextView chapterName = (TextView) arg1\n\t\t\t\t\t.findViewById(R.id.feed_text1);\n\t\t\tTextView chapterDesc = (TextView) arg1\n\t\t\t\t\t.findViewById(R.id.feed_text2);\n\n\t\t\tnewsfeed recent_update = newsfeedList.get(arg0);\n\n\t\t\tchapterName.setText(recent_update.username);\n\t\t\tchapterDesc.setText(recent_update.recommendation_detail);\n\n\t\t\treturn arg1;\n\t\t}", "@Override\n\tpublic View getView(int position, View convertView, ViewGroup parent) {\n\t\ttry {\n\t\t\tHolder holder;\n\t\t\tif(convertView==null){\n\t\t\t\tconvertView=mInflater.inflate(R.layout.view_blend_dialog_list_item, null);\n\t\t\t\tholder=new Holder();\n\t\t\t\tholder.tvDialogListItem=(TextView) convertView.findViewById(R.id.tv_blend_dialog_list_item);\n\t\t\t\tconvertView.setTag(holder);\n\t\t\t}else{\n\t\t\t\tholder=(Holder) convertView.getTag();\n\t\t\t}\n\t\t\tholder.tvDialogListItem.setText(mData.get(position).get(\"target_phone\"));\n\t\t} catch (Exception e) {\n\t\t\tFileUtils.addErrorLog(e);\n\t\t}\n\t\treturn convertView;\n\t}", "private void setUpList() {\n\t\tRoomItemAdapter adapter = new RoomItemAdapter(getApplicationContext(),\n\t\t\t\trName, rRate);\n\t\tlistView.setAdapter(adapter);\n\n\t\tlistView.setOnItemClickListener(new OnItemClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View view,\n\t\t\t\t\tint position, long id) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\thandleClick(position);\n\t\t\t}\n\t\t});\n\t}", "@UiThreadTest\r\n public void testTagList() {\r\n Intent loginIntent = new Intent();\r\n PomoUser user = new PomoUser(\"9a36d2f9018aacde1430411867961\", \"test\", \"1\", false, true, 1, 1);\r\n loginIntent.putExtra(ExtraName.POMO_USER, user);\r\n mainActivity.onActivityResult(1, Activity.RESULT_OK, loginIntent);\r\n assertTrue(((ListView) mainActivity.findViewById(R.id.listView)).getAdapter().getCount() > 0);\r\n }", "@Override\r\n public View getView(int position, View convertView, ViewGroup parent){\r\n //Get Sent Request\r\n SentRequest request = getItem(position);\r\n if(convertView == null){\r\n convertView = LayoutInflater.from(getContext()).inflate(R.layout.sent_request_adapter,parent,false);\r\n }\r\n //Bind Sent Request to UI Components\r\n if(request != null){\r\n TextView classroomName = convertView.findViewById(R.id.txtClassroomName);\r\n TextView user = convertView.findViewById(R.id.txtTeacher);\r\n TextView sampleText = convertView.findViewById(R.id.txtSampleText);\r\n\r\n classroomName.setText(request.getClassroom_Name());\r\n sampleText.setText(\"Sent to:\");\r\n if(request.getType_Of_Request().equals(\"Contributor\")) {\r\n user.setText(request.getRequested_Username()+\"#\"+request.getRequested_User_Id().substring(0,4)+\" as a Contributor\");\r\n }\r\n else if(request.getType_Of_Request().equals(\"Student\")){\r\n user.setText(request.getRequested_Username()+\"#\"+request.getRequested_User_Id().substring(0,4)+\" as a Student\");\r\n }\r\n }\r\n return convertView;\r\n }", "@Override\n public void run() {\n chatListAdapter.add(response);\n chatListAdapter.notifyDataSetChanged();\n getListView().setSelection(chatListAdapter.getCount() - 1);\n }", "@Override\r\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder=null;\r\n int who=(Integer)chatList.get(position).get(\"person\");\r\n convertView= LayoutInflater.from(context).inflate(\r\n layout[who==ME?0:1], null);\r\n holder=new ViewHolder();\r\n holder.imageView=(ImageView)convertView.findViewById(to[who*2+0]);\r\n holder.textView=(TextView)convertView.findViewById(to[who*2+1]);\r\n //System.out.println(holder);\r\n //System.out.println(\"WHYWHYWHYWHYW\");\r\n //System.out.println(holder.imageView);\r\n holder.imageView.setBackgroundResource((Integer)chatList.get(position).get(from[0]));\r\n holder.textView.setText(chatList.get(position).get(from[1]).toString());\r\n return convertView;\r\n }", "private static Matcher<View> encontrarListaFin() {\n return new TypeSafeMatcher<View>() {\n @Override\n protected boolean matchesSafely(View item) {\n if (item instanceof ListView) {\n ListView lista = (ListView) item;\n a1a5NumFin = lista.getAdapter().getCount();\n return true;\n }\n return false;\n }\n\n @Override\n public void describeTo(Description description) {\n }\n };\n }", "private android.view.ViewGroup getViewForMessage(int r29, boolean r30) {\n /*\n r28 = this;\n r0 = r28\n r1 = r29\n java.util.ArrayList<org.telegram.messenger.MessageObject> r2 = r0.popupMessages\n int r2 = r2.size()\n r3 = 0\n r4 = 1\n if (r2 != r4) goto L_0x0019\n if (r1 < 0) goto L_0x0018\n java.util.ArrayList<org.telegram.messenger.MessageObject> r2 = r0.popupMessages\n int r2 = r2.size()\n if (r1 < r2) goto L_0x0019\n L_0x0018:\n return r3\n L_0x0019:\n r2 = -1\n r5 = 0\n if (r1 != r2) goto L_0x0025\n java.util.ArrayList<org.telegram.messenger.MessageObject> r1 = r0.popupMessages\n int r1 = r1.size()\n int r1 = r1 - r4\n goto L_0x002e\n L_0x0025:\n java.util.ArrayList<org.telegram.messenger.MessageObject> r6 = r0.popupMessages\n int r6 = r6.size()\n if (r1 != r6) goto L_0x002e\n r1 = 0\n L_0x002e:\n java.util.ArrayList<org.telegram.messenger.MessageObject> r6 = r0.popupMessages\n java.lang.Object r6 = r6.get(r1)\n org.telegram.messenger.MessageObject r6 = (org.telegram.messenger.MessageObject) r6\n int r7 = r6.type\n r8 = 1098907648(0x41800000, float:16.0)\n r9 = 4\n java.lang.String r11 = \"windowBackgroundWhiteBlackText\"\n r12 = 17\n r13 = -1082130432(0xffffffffbvar_, float:-1.0)\n r15 = 1092616192(0x41200000, float:10.0)\n if (r7 == r4) goto L_0x0047\n if (r7 != r9) goto L_0x01e7\n L_0x0047:\n boolean r7 = r6.isSecretMedia()\n if (r7 != 0) goto L_0x01e7\n java.util.ArrayList<android.view.ViewGroup> r7 = r0.imageViews\n int r7 = r7.size()\n r16 = 312(0x138, float:4.37E-43)\n r17 = 311(0x137, float:4.36E-43)\n if (r7 <= 0) goto L_0x0067\n java.util.ArrayList<android.view.ViewGroup> r7 = r0.imageViews\n java.lang.Object r7 = r7.get(r5)\n android.view.ViewGroup r7 = (android.view.ViewGroup) r7\n java.util.ArrayList<android.view.ViewGroup> r8 = r0.imageViews\n r8.remove(r5)\n goto L_0x00d6\n L_0x0067:\n android.widget.FrameLayout r7 = new android.widget.FrameLayout\n r7.<init>(r0)\n android.widget.FrameLayout r3 = new android.widget.FrameLayout\n r3.<init>(r0)\n int r9 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r14 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r10 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r15 = org.telegram.messenger.AndroidUtilities.dp(r15)\n r3.setPadding(r9, r14, r10, r15)\n android.graphics.drawable.Drawable r9 = org.telegram.ui.ActionBar.Theme.getSelectorDrawable(r5)\n r3.setBackgroundDrawable(r9)\n android.widget.FrameLayout$LayoutParams r9 = org.telegram.ui.Components.LayoutHelper.createFrame(r2, r13)\n r7.addView(r3, r9)\n org.telegram.ui.Components.BackupImageView r9 = new org.telegram.ui.Components.BackupImageView\n r9.<init>(r0)\n java.lang.Integer r10 = java.lang.Integer.valueOf(r17)\n r9.setTag(r10)\n android.widget.FrameLayout$LayoutParams r10 = org.telegram.ui.Components.LayoutHelper.createFrame(r2, r13)\n r3.addView(r9, r10)\n android.widget.TextView r9 = new android.widget.TextView\n r9.<init>(r0)\n int r10 = org.telegram.ui.ActionBar.Theme.getColor(r11)\n r9.setTextColor(r10)\n r9.setTextSize(r4, r8)\n r9.setGravity(r12)\n java.lang.Integer r8 = java.lang.Integer.valueOf(r16)\n r9.setTag(r8)\n r8 = -2\n android.widget.FrameLayout$LayoutParams r8 = org.telegram.ui.Components.LayoutHelper.createFrame(r2, r8, r12)\n r3.addView(r9, r8)\n r3 = 2\n java.lang.Integer r8 = java.lang.Integer.valueOf(r3)\n r7.setTag(r8)\n org.telegram.ui.PopupNotificationActivity$$ExternalSyntheticLambda3 r3 = new org.telegram.ui.PopupNotificationActivity$$ExternalSyntheticLambda3\n r3.<init>(r0)\n r7.setOnClickListener(r3)\n L_0x00d6:\n r3 = r7\n java.lang.Integer r7 = java.lang.Integer.valueOf(r16)\n android.view.View r7 = r3.findViewWithTag(r7)\n r14 = r7\n android.widget.TextView r14 = (android.widget.TextView) r14\n java.lang.Integer r7 = java.lang.Integer.valueOf(r17)\n android.view.View r7 = r3.findViewWithTag(r7)\n r15 = r7\n org.telegram.ui.Components.BackupImageView r15 = (org.telegram.ui.Components.BackupImageView) r15\n r15.setAspectFit(r4)\n int r7 = r6.type\n r13 = 8\n r8 = 100\n if (r7 != r4) goto L_0x0186\n java.util.ArrayList<org.telegram.tgnet.TLRPC$PhotoSize> r7 = r6.photoThumbs\n int r9 = org.telegram.messenger.AndroidUtilities.getPhotoSize()\n org.telegram.tgnet.TLRPC$PhotoSize r7 = org.telegram.messenger.FileLoader.getClosestPhotoSizeWithSize(r7, r9)\n java.util.ArrayList<org.telegram.tgnet.TLRPC$PhotoSize> r9 = r6.photoThumbs\n org.telegram.tgnet.TLRPC$PhotoSize r8 = org.telegram.messenger.FileLoader.getClosestPhotoSizeWithSize(r9, r8)\n if (r7 == 0) goto L_0x0165\n int r9 = r6.type\n if (r9 != r4) goto L_0x011c\n org.telegram.tgnet.TLRPC$Message r9 = r6.messageOwner\n java.io.File r9 = org.telegram.messenger.FileLoader.getPathToMessage(r9)\n boolean r9 = r9.exists()\n if (r9 != 0) goto L_0x011c\n r9 = 0\n goto L_0x011d\n L_0x011c:\n r9 = 1\n L_0x011d:\n boolean r10 = r6.needDrawBluredPreview()\n if (r10 != 0) goto L_0x0165\n if (r9 != 0) goto L_0x0146\n int r9 = r6.currentAccount\n org.telegram.messenger.DownloadController r9 = org.telegram.messenger.DownloadController.getInstance(r9)\n boolean r9 = r9.canDownloadMedia((org.telegram.messenger.MessageObject) r6)\n if (r9 == 0) goto L_0x0132\n goto L_0x0146\n L_0x0132:\n if (r8 == 0) goto L_0x0165\n org.telegram.tgnet.TLObject r7 = r6.photoThumbsObject\n org.telegram.messenger.ImageLocation r8 = org.telegram.messenger.ImageLocation.getForObject(r8, r7)\n r10 = 0\n r11 = 0\n java.lang.String r9 = \"100_100_b\"\n r7 = r15\n r12 = r6\n r7.setImage((org.telegram.messenger.ImageLocation) r8, (java.lang.String) r9, (java.lang.String) r10, (android.graphics.drawable.Drawable) r11, (java.lang.Object) r12)\n r4 = 8\n goto L_0x0163\n L_0x0146:\n org.telegram.tgnet.TLObject r9 = r6.photoThumbsObject\n org.telegram.messenger.ImageLocation r9 = org.telegram.messenger.ImageLocation.getForObject(r7, r9)\n org.telegram.tgnet.TLObject r10 = r6.photoThumbsObject\n org.telegram.messenger.ImageLocation r10 = org.telegram.messenger.ImageLocation.getForObject(r8, r10)\n int r12 = r7.size\n java.lang.String r11 = \"100_100\"\n java.lang.String r16 = \"100_100_b\"\n r7 = r15\n r8 = r9\n r9 = r11\n r11 = r16\n r4 = 8\n r13 = r6\n r7.setImage((org.telegram.messenger.ImageLocation) r8, (java.lang.String) r9, (org.telegram.messenger.ImageLocation) r10, (java.lang.String) r11, (int) r12, (java.lang.Object) r13)\n L_0x0163:\n r7 = 1\n goto L_0x0168\n L_0x0165:\n r4 = 8\n r7 = 0\n L_0x0168:\n if (r7 != 0) goto L_0x017e\n r15.setVisibility(r4)\n r14.setVisibility(r5)\n int r4 = org.telegram.messenger.SharedConfig.fontSize\n float r4 = (float) r4\n r7 = 2\n r14.setTextSize(r7, r4)\n java.lang.CharSequence r4 = r6.messageText\n r14.setText(r4)\n goto L_0x0329\n L_0x017e:\n r15.setVisibility(r5)\n r14.setVisibility(r4)\n goto L_0x0329\n L_0x0186:\n r4 = 8\n r9 = 4\n if (r7 != r9) goto L_0x0329\n r14.setVisibility(r4)\n java.lang.CharSequence r4 = r6.messageText\n r14.setText(r4)\n r15.setVisibility(r5)\n org.telegram.tgnet.TLRPC$Message r4 = r6.messageOwner\n org.telegram.tgnet.TLRPC$MessageMedia r4 = r4.media\n org.telegram.tgnet.TLRPC$GeoPoint r4 = r4.geo\n double r9 = r4.lat\n double r11 = r4._long\n int r7 = r6.currentAccount\n org.telegram.messenger.MessagesController r7 = org.telegram.messenger.MessagesController.getInstance(r7)\n int r7 = r7.mapProvider\n r13 = 2\n if (r7 != r13) goto L_0x01cb\n r7 = 15\n float r9 = org.telegram.messenger.AndroidUtilities.density\n double r9 = (double) r9\n double r9 = java.lang.Math.ceil(r9)\n int r9 = (int) r9\n int r9 = java.lang.Math.min(r13, r9)\n org.telegram.messenger.WebFile r4 = org.telegram.messenger.WebFile.createWithGeoPoint(r4, r8, r8, r7, r9)\n org.telegram.messenger.ImageLocation r8 = org.telegram.messenger.ImageLocation.getForWebFile(r4)\n r9 = 0\n r10 = 0\n r11 = 0\n r7 = r15\n r12 = r6\n r7.setImage((org.telegram.messenger.ImageLocation) r8, (java.lang.String) r9, (java.lang.String) r10, (android.graphics.drawable.Drawable) r11, (java.lang.Object) r12)\n goto L_0x0329\n L_0x01cb:\n int r4 = r6.currentAccount\n r23 = 100\n r24 = 100\n r25 = 1\n r26 = 15\n r27 = -1\n r18 = r4\n r19 = r9\n r21 = r11\n java.lang.String r4 = org.telegram.messenger.AndroidUtilities.formapMapUrl(r18, r19, r21, r23, r24, r25, r26, r27)\n r6 = 0\n r15.setImage(r4, r6, r6)\n goto L_0x0329\n L_0x01e7:\n int r3 = r6.type\n r4 = 2\n if (r3 != r4) goto L_0x0284\n java.util.ArrayList<android.view.ViewGroup> r3 = r0.audioViews\n int r3 = r3.size()\n r4 = 300(0x12c, float:4.2E-43)\n if (r3 <= 0) goto L_0x020e\n java.util.ArrayList<android.view.ViewGroup> r3 = r0.audioViews\n java.lang.Object r3 = r3.get(r5)\n android.view.ViewGroup r3 = (android.view.ViewGroup) r3\n java.util.ArrayList<android.view.ViewGroup> r7 = r0.audioViews\n r7.remove(r5)\n java.lang.Integer r4 = java.lang.Integer.valueOf(r4)\n android.view.View r4 = r3.findViewWithTag(r4)\n org.telegram.ui.Components.PopupAudioView r4 = (org.telegram.ui.Components.PopupAudioView) r4\n goto L_0x0270\n L_0x020e:\n android.widget.FrameLayout r3 = new android.widget.FrameLayout\n r3.<init>(r0)\n android.widget.FrameLayout r7 = new android.widget.FrameLayout\n r7.<init>(r0)\n int r8 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r9 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r10 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r11 = org.telegram.messenger.AndroidUtilities.dp(r15)\n r7.setPadding(r8, r9, r10, r11)\n android.graphics.drawable.Drawable r8 = org.telegram.ui.ActionBar.Theme.getSelectorDrawable(r5)\n r7.setBackgroundDrawable(r8)\n android.widget.FrameLayout$LayoutParams r8 = org.telegram.ui.Components.LayoutHelper.createFrame(r2, r13)\n r3.addView(r7, r8)\n android.widget.FrameLayout r8 = new android.widget.FrameLayout\n r8.<init>(r0)\n r9 = -1\n r10 = -1073741824(0xffffffffCLASSNAME, float:-2.0)\n r11 = 17\n r12 = 1101004800(0x41a00000, float:20.0)\n r13 = 0\n r14 = 1101004800(0x41a00000, float:20.0)\n r15 = 0\n android.widget.FrameLayout$LayoutParams r9 = org.telegram.ui.Components.LayoutHelper.createFrame(r9, r10, r11, r12, r13, r14, r15)\n r7.addView(r8, r9)\n org.telegram.ui.Components.PopupAudioView r7 = new org.telegram.ui.Components.PopupAudioView\n r7.<init>(r0)\n java.lang.Integer r4 = java.lang.Integer.valueOf(r4)\n r7.setTag(r4)\n r8.addView(r7)\n r4 = 3\n java.lang.Integer r4 = java.lang.Integer.valueOf(r4)\n r3.setTag(r4)\n org.telegram.ui.PopupNotificationActivity$$ExternalSyntheticLambda4 r4 = new org.telegram.ui.PopupNotificationActivity$$ExternalSyntheticLambda4\n r4.<init>(r0)\n r3.setOnClickListener(r4)\n r4 = r7\n L_0x0270:\n r4.setMessageObject(r6)\n int r7 = r6.currentAccount\n org.telegram.messenger.DownloadController r7 = org.telegram.messenger.DownloadController.getInstance(r7)\n boolean r6 = r7.canDownloadMedia((org.telegram.messenger.MessageObject) r6)\n if (r6 == 0) goto L_0x0329\n r4.downloadAudioIfNeed()\n goto L_0x0329\n L_0x0284:\n java.util.ArrayList<android.view.ViewGroup> r3 = r0.textViews\n int r3 = r3.size()\n r4 = 301(0x12d, float:4.22E-43)\n if (r3 <= 0) goto L_0x029c\n java.util.ArrayList<android.view.ViewGroup> r3 = r0.textViews\n java.lang.Object r3 = r3.get(r5)\n android.view.ViewGroup r3 = (android.view.ViewGroup) r3\n java.util.ArrayList<android.view.ViewGroup> r7 = r0.textViews\n r7.remove(r5)\n goto L_0x0313\n L_0x029c:\n android.widget.FrameLayout r3 = new android.widget.FrameLayout\n r3.<init>(r0)\n android.widget.ScrollView r7 = new android.widget.ScrollView\n r7.<init>(r0)\n r9 = 1\n r7.setFillViewport(r9)\n android.widget.FrameLayout$LayoutParams r10 = org.telegram.ui.Components.LayoutHelper.createFrame(r2, r13)\n r3.addView(r7, r10)\n android.widget.LinearLayout r10 = new android.widget.LinearLayout\n r10.<init>(r0)\n r10.setOrientation(r5)\n android.graphics.drawable.Drawable r13 = org.telegram.ui.ActionBar.Theme.getSelectorDrawable(r5)\n r10.setBackgroundDrawable(r13)\n r13 = -2\n android.widget.FrameLayout$LayoutParams r14 = org.telegram.ui.Components.LayoutHelper.createScroll(r2, r13, r9)\n r7.addView(r10, r14)\n int r7 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r9 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r13 = org.telegram.messenger.AndroidUtilities.dp(r15)\n int r14 = org.telegram.messenger.AndroidUtilities.dp(r15)\n r10.setPadding(r7, r9, r13, r14)\n org.telegram.ui.PopupNotificationActivity$$ExternalSyntheticLambda2 r7 = new org.telegram.ui.PopupNotificationActivity$$ExternalSyntheticLambda2\n r7.<init>(r0)\n r10.setOnClickListener(r7)\n android.widget.TextView r7 = new android.widget.TextView\n r7.<init>(r0)\n r9 = 1\n r7.setTextSize(r9, r8)\n java.lang.Integer r8 = java.lang.Integer.valueOf(r4)\n r7.setTag(r8)\n int r8 = org.telegram.ui.ActionBar.Theme.getColor(r11)\n r7.setTextColor(r8)\n int r8 = org.telegram.ui.ActionBar.Theme.getColor(r11)\n r7.setLinkTextColor(r8)\n r7.setGravity(r12)\n r8 = -2\n android.widget.LinearLayout$LayoutParams r8 = org.telegram.ui.Components.LayoutHelper.createLinear((int) r2, (int) r8, (int) r12)\n r10.addView(r7, r8)\n java.lang.Integer r7 = java.lang.Integer.valueOf(r9)\n r3.setTag(r7)\n L_0x0313:\n java.lang.Integer r4 = java.lang.Integer.valueOf(r4)\n android.view.View r4 = r3.findViewWithTag(r4)\n android.widget.TextView r4 = (android.widget.TextView) r4\n int r7 = org.telegram.messenger.SharedConfig.fontSize\n float r7 = (float) r7\n r8 = 2\n r4.setTextSize(r8, r7)\n java.lang.CharSequence r6 = r6.messageText\n r4.setText(r6)\n L_0x0329:\n android.view.ViewParent r4 = r3.getParent()\n if (r4 != 0) goto L_0x0334\n android.view.ViewGroup r4 = r0.messageContainer\n r4.addView(r3)\n L_0x0334:\n r3.setVisibility(r5)\n if (r30 == 0) goto L_0x0373\n android.graphics.Point r4 = org.telegram.messenger.AndroidUtilities.displaySize\n int r4 = r4.x\n r5 = 1103101952(0x41CLASSNAME, float:24.0)\n int r5 = org.telegram.messenger.AndroidUtilities.dp(r5)\n int r4 = r4 - r5\n android.view.ViewGroup$LayoutParams r5 = r3.getLayoutParams()\n android.widget.FrameLayout$LayoutParams r5 = (android.widget.FrameLayout.LayoutParams) r5\n r6 = 51\n r5.gravity = r6\n r5.height = r2\n r5.width = r4\n int r2 = r0.currentMessageNum\n if (r1 != r2) goto L_0x035b\n r1 = 0\n r3.setTranslationX(r1)\n goto L_0x036d\n L_0x035b:\n int r6 = r2 + -1\n if (r1 != r6) goto L_0x0365\n int r1 = -r4\n float r1 = (float) r1\n r3.setTranslationX(r1)\n goto L_0x036d\n L_0x0365:\n r6 = 1\n int r2 = r2 + r6\n if (r1 != r2) goto L_0x036d\n float r1 = (float) r4\n r3.setTranslationX(r1)\n L_0x036d:\n r3.setLayoutParams(r5)\n r3.invalidate()\n L_0x0373:\n return r3\n */\n throw new UnsupportedOperationException(\"Method not decompiled: org.telegram.ui.PopupNotificationActivity.getViewForMessage(int, boolean):android.view.ViewGroup\");\n }", "@Test\n public void scrollListTest() {\n\n onView(withId(R.id.rv_list)).perform(RecyclerViewActions.actionOnItemAtPosition(MainActivity.mListSize, scrollTo()));\n }" ]
[ "0.7480722", "0.6898925", "0.66269666", "0.6547329", "0.6534979", "0.64708257", "0.6429307", "0.6391523", "0.6385242", "0.6360404", "0.62911665", "0.62334806", "0.6225931", "0.6215363", "0.6211945", "0.62089986", "0.61857814", "0.6185008", "0.6173303", "0.61665905", "0.61394286", "0.61344594", "0.6127469", "0.6116607", "0.61001486", "0.6043724", "0.6042152", "0.6033516", "0.60077", "0.59848416", "0.59716773", "0.5945541", "0.5942125", "0.5939227", "0.59344697", "0.59271526", "0.5920443", "0.59048676", "0.5902832", "0.5890681", "0.5887527", "0.58861804", "0.58861595", "0.5854086", "0.5851662", "0.58485144", "0.5831512", "0.58299077", "0.5824788", "0.58216697", "0.5816497", "0.5809743", "0.58085555", "0.5807805", "0.5804791", "0.5803961", "0.5798202", "0.57906437", "0.5785631", "0.57846737", "0.5784488", "0.5780584", "0.57727987", "0.5757659", "0.5750842", "0.5746498", "0.573341", "0.57303065", "0.5728442", "0.5723551", "0.5713429", "0.57070756", "0.5699034", "0.5698027", "0.56869733", "0.5683502", "0.56790745", "0.5676201", "0.56760645", "0.5674004", "0.56694365", "0.5668842", "0.5666773", "0.56647056", "0.5662049", "0.56561947", "0.5642593", "0.5639326", "0.5621183", "0.5617893", "0.56167644", "0.5616749", "0.56165665", "0.561144", "0.5607298", "0.5606806", "0.56037617", "0.5603011", "0.55997", "0.55995554" ]
0.6676159
2
test that the send button is not null when the activity is run
@Test public void testSendButtonExists(){ FloatingActionButton sendButton = messagesActivity.fab; assertNotNull(sendButton); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void triggerIntentTestButtonToRegister() {\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(isClickable()));\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(notNullValue()));\n }", "public boolean send() {\n\t\tif (!isValid())\n\t\t\treturn false;\n\t\tif (ActionBar.sendKey(getSlot()))\n\t\t\treturn true;\n\t\tWidgetChild main = SlotData.getMainChild(getSlot());\n\t\treturn WidgetUtil.visible(main) && EntityUtil.interact(false, main);\n\t}", "@Override\r\n public void onClick(View v)\r\n {\n if (\"\" != mSendOnBoardEdit.getText().toString()){\r\n DJIDrone.getDjiMainController().sendDataToExternalDevice(mSendOnBoardEdit.getText().toString().getBytes(),new DJIExecuteResultCallback(){\r\n\r\n @Override\r\n public void onResult(DJIError result)\r\n {\r\n // TODO Auto-generated method stub\r\n \r\n }\r\n \r\n });\r\n }\r\n }", "@Test\n public void triggerIntentTestButtonLogin() {\n onView(withId(R.id.btnLogin)).check(matches(isClickable()));\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(notNullValue()));\n }", "@Test\n public void triggerIntent_hasExtras() {\n onView(withId(getResourceId(\"switchActivity\"))).check(matches(notNullValue() ));\n onView(withId(getResourceId(\"switchActivity\"))).check(matches(withText(\"Change Page\")));\n onView(withId(getResourceId(\"switchActivity\"))).perform(click());\n intended(hasExtra(\"Developer\", \"Oguzhan Orhan\"));\n }", "@Override\n public void onBtnClick() {\n if(testDialog!=null){\n testDialog.dismiss();\n }\n handler.sendEmptyMessage(222);\n\n }", "public void goSendOrderButton(View view) { //is called by onClick function of Button in activity_main.xml\n if(WifiAvaible()) {\n try {\n fab.getProtocol().sendOrder(surface.getSeedbox().toString());\n OrderStatus.setText(\"Waiting for \\n\"+\"confirmation.\");\n } catch (Exception e) {\n //ErrorWindow\n }\n\n SendButton.setEnabled(false);\n }\n\n\n/*\n if(ClickCnt == 0) {\n mp.start();\n ClickCnt = 1;\n } else {\n ClickCnt = 0;\n mp.stop();\n try {\n mp.prepare();\n }\n catch (java.lang.Exception e)\n {\n // Do nothing\n }\n\n mp.seekTo(0);\n }*/\n }", "boolean hasSendMessage();", "public boolean hasSendMessage() {\n return typeCase_ == 4;\n }", "@Override\n public void onClick(View v) {\n \n switch (v.getId()) {\n case R.id.sendBtn:\n //Log.d(\"XXX\", \"SEND BTN\");\n if (validateFields() == false) {\n // mostro avviso errore\n CharSequence text = \"Per favore completa i campi richiesti correttamente\";\n Toast toast = Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT);\n toast.show();\n }\n else {\n sendRequestToServer();\n }\n break;\n case R.id.surname:\n // Log.d(\"XXX\", \"COGNOME EDIT TEXT\");\n break;\n case R.id.email:\n break;\n case R.id.tel:\n break;\n default:\n break;\n }\n \n }", "@Override\n\tpublic void onMessagePlayCompleted() {\n\t\tbtnSend.setEnabled(true);\n\t}", "public boolean hasSendMessage() {\n return typeCase_ == 4;\n }", "@Test\n public void testifyBtn() throws InterruptedException {\n onView(withId(R.id.SaveButton)).check(matches(isDisplayed()));\n\n }", "@Test\n public void test_rf_continue_button_opens_correct_activity() {\n //Click the positive button in the dialog\n onView(withText(\"I understand\")).perform(click());\n //Find the views and perform action\n onView(withId(R.id.redFlag_continue)).perform(click());\n //Check if action returns desired outcome\n intended(hasComponent(ObservableSignsActivity.class.getName()));\n }", "@Test\n public void testSendButtonHasCorrectID(){\n FloatingActionButton sendButton = messagesActivity.fab;\n int ID = sendButton.getId();\n int expectedID = R.id.fab;\n assertEquals(ID, expectedID);\n }", "@Override\n public void onOkButtonClicked() {\n\n\n String reasonMsg1 = backToOrderView.editText.getText().toString();\n reasonMsg = reasonMsg1.trim();\n\n if (reasonMsg.length() == 0) {\n Toast.makeText(getApplicationContext(), \"Please give reason...\", Toast.LENGTH_LONG).show();\n\n } else {\n\n\n // sendNotificationToUser(\"driver_cancel\");\n updateTripStatusApi(\"driver_cancel_at_pickup\", controller.pref.getTRIP_ID(), reasonMsg);\n\n\n }\n }", "@Test\n public void testMessageTimeNotNull(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testMessageTime\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n TextView messageTime= messagesActivity.messageTime;\n assertNotNull(messageTime);\n }", "@Test(priority=3)\n\tpublic void verifySignUpBtn() {\n\t\tboolean signUpBtn = driver.findElement(By.name(\"websubmit\")).isEnabled();\n\t\tAssert.assertTrue(signUpBtn);\n\t}", "@Test\r\n\tpublic void testButtonPressedNotEnoughCred() {\r\n\t\tvend.getSelectionButton(0).press();\r\n\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\t\t\r\n\t}", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "boolean hasSender();", "private void checkDatos() {\n btnEnviar.setEnabled(!TextUtils.isEmpty(txtMensaje.getText()));\n }", "public void ClickSendApplicationButton()\n {\n\n new WebDriverWait(driver, 30).until(ExpectedConditions.visibilityOf(SendApplicationButton)).click();\n\n }", "@Test\n public void testLaunch(){\n View view = mRegisterActivity.findViewById(R.id.register_button);\n assertNotNull(view);\n }", "protected boolean hasPositiveButton() {\n return false;\n }", "private boolean isBtConnected(){\n \treturn false;\n }", "@Test\n public void FNameEmpty () {\n onView(withId(R.id.username)).check(matches(isDisplayed()));\n //change name to empty\n onView(withId(R.id.username)).perform(replaceText(\"\"));\n //click the button\n onView(withId(R.id.save)).perform(click());\n // check toast visibility\n onView(withText(R.string.EmptyName))\n .inRoot(new ToastMatcher())\n .check(matches(withText(R.string.EmptyName)));\n //check activity still shown\n assertFalse(activityTestRule.getActivity().isFinishing());\n }", "@Test\n public void testEditTextExists(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testEditTextExists\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n EditText input = messagesActivity.input;\n assertNotNull(input);\n }", "@Test\r\n public void testFeedButton(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.button_feed));\r\n solo.sleep(3000);\r\n solo.waitForActivity(FeedActivity.class, 2000);\r\n\r\n }", "@SmallTest\n public void testEmailDialog()\n {\n emailXMLButton.callOnClick();\n LayoutInflater factory = LayoutInflater.from(getActivity());\n View textEntryView = factory.inflate(R.layout.email_dialog, null);\n ViewAsserts.assertOnScreen(textEntryView, textEntryView);\n }", "@Test\n public void activityLaunch() {\n onView(withId(R.id.button_main)).perform(click());\n onView(withId(R.id.text_header)).check(matches(isDisplayed()));\n\n onView(withId(R.id.button_second)).perform(click());\n onView(withId(R.id.text_header_reply)).check(matches(isDisplayed()));\n }", "public void ClickFunction(){\n System.out.println(\"Click Function\");\n alertButton.setText(\"Cancel\");\n\n// click = !click;\n// if(click) {\n// SendTextMessage stm = new SendTextMessage();\n// stm.sendMessage(getActivity(), false);\n//\n// alertButton.setText(\"Cancel\");\n// makeSound_shake ();\n//\n// //Toast.makeText( getActivity(),\"Alert!\", Toast.LENGTH_SHORT).show();\n// }\n// else{\n// SendTextMessage stm = new SendTextMessage();\n// stm.sendMessage(getActivity(), true);\n// }\n\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n put_done = intent.getBooleanExtra(msg_content_put_done, false);\n if(put_done) {\n button_set.setEnabled(true);\n button_set.setText(\"SET\");\n }\n }", "@Override\n public void onClick(View view) {\n intent.putExtra(SEND_KEY,sendText.getText().toString());\n\n //Start next Activity/No data is passed back to this activity\n startActivity(intent);\n\n }", "public void verifyNewTabDorMessageBoardsOpened() {\n Assert.assertTrue(boardButton.isDisplayed());\t\t\n\t}", "@Override\n public void onClick(View view) {\n send();\n }", "@Test\n public void checkAddMenuButtonPresent() {\n onView(withId(R.id.menu_add)).check(matches(isDisplayed()));\n }", "@Test\r\n public void testSendFollowingRequest(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.enterText((EditText) solo.getView(R.id.add_following), \"NewTest\");\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"Following request has been sent!!\", 1,2000));\r\n\r\n }", "@Then(\"^Click On Send Button$\")\r\n\tpublic void click_On_Send_Button() {\n\t\tnop.click(\"//*[@id=\\\"submitMessage\\\"]/span\"); \r\n\t \r\n\t}", "@Test\r\n\tpublic void testButtonPressedSafety() {\r\n\t\tSelectionButton button = vend.getSelectionButton(0);\r\n\t\tvend.enableSafety();\r\n\t\tbutton.press();\r\n\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\r\n\t}", "public void sendClick(View view) {\n String message = input.getText().toString();\n uart.send(message);\n }", "@Override\n\tpublic void onClick(View v) {\n\t\tif(v.getId() == R.id.bSend){\n\t\t\tif(text.getText().toString()!=null){\n\t\t\t\tmsg = text.getText().toString();\n\t\t\t\tchat.append(user+\": \"+msg+\"\\n\");\n\t\t\t\tmyGame.sendPrivateChat(challenged, msg);\n\t\t\t\ttext.setText(\"\");\n\t\t\t}else{\n\t\t\t\tToast.makeText(ChatActivity.this, \"Pls Enter Text\", Toast.LENGTH_SHORT).show();\n\t\t\t}\n\t//\t}else if(v.getId()==R.id){\n\t\t\t\n\t\t}\n\t}", "@Override\n public void onClick(View v) {\n if (v == btnBack) {\n // hidden keyboard :\n hiddenKeyboard();\n //back to previous page\n MainUserActivity activity = (MainUserActivity) getCurrentActivity();\n activity.backFragment(new AccountFragment());\n return;\n }\n if (v == btnSend) {\n String message = validateForm();\n if (!message.equals(MESSAGE_SUCCESS)) {\n CustomToast.showCustomAlert(getCurrentActivity(), message,\n Toast.LENGTH_SHORT);\n } else {\n if (NetworkUtil.checkNetworkAvailable(getCurrentActivity())) {\n send();\n } else {\n Toast.makeText(getCurrentActivity(),\n R.string.message_network_is_unavailable,\n Toast.LENGTH_LONG).show();\n }\n\n }\n return;\n }\n }", "@Override\n public void onClick(View v) {\n String reception = mEmission.getText().toString();\n Log.i(\"debug\", \"onEditorAction:\" + reception);\n\n if (!reception.equals(\"\")) {\n if (Convert.isHexAnd16Byte(reception, ICCActivity.this)) {\n mNo.append(\"SEND: \" + reception + \"\\n\");\n byte[] apdu = Convert.hexStringToByteArray(reception);\n sendCmd(apdu, 1);\n }\n } else {\n Toast.makeText(ICCActivity.this, \"please input content\", Toast.LENGTH_SHORT).show();\n }\n }", "public void sendMessage(View view) {\n Intent intent = new Intent(this, DisplayMessageActivity.class);\n String message = \"You pressed the button!\";\n intent.putExtra(EXTRA_MESSAGE, message);\n startActivity(intent);\n\n }", "@Test\r\n public void testEmptyUser(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"The username Cannot Be Empty!!\", 1,2000));\r\n\r\n }", "@Override\n public boolean play(String btn)\n {\n return btn.isEmpty();\n }", "public boolean isSendMsgEnableShutterButton() {\n return true;\n }", "public void onClick(View v) {\n System.out.println(\"Click on Listener: \" + click);\n if(!click) {\n click = !click;\n MainActivity.updateAlert(click);\n alertButton.setText(\"Cancel\");\n Toast.makeText( getActivity(),\"Alert!\", Toast.LENGTH_SHORT).show();\n activity = \"Button\";\n makeSound ();\n SendTextMessage stm = new SendTextMessage();\n stm.sendMessage(getActivity(), false);\n }\n else{\n showAuthenticationScreen();\n SendTextMessage stm = new SendTextMessage();\n stm.sendMessage(getActivity(), true);\n }\n\n\n\n }", "public boolean test(CommandSender sender, MCommand command);", "public void handleSendButton(ActionEvent event) {\n\n messageController.setMessageSystem(this.message.getText(), this.toUsername.getText(),this.sender);\n if (messageController.sendMessage()){\n sentValid.setVisible(true);\n sentInvalid.setVisible(false);\n\n }\n else{\n sentInvalid.setVisible(true);\n sentValid.setVisible(false);\n\n }\n\n\n }", "@MediumTest\n\t public void testClickMeButton_layout() {\n\t final View decorView = mMainActivity.getWindow().getDecorView();\n\n\t //Verify that the mClickMeButton is on screen\n\t ViewAsserts.assertOnScreen(decorView, mcontactButton);\n\n\t //Verify width and heights\n\t final ViewGroup.LayoutParams layoutParams = mcontactButton.getLayoutParams();\n\t assertNotNull(layoutParams);\n\t assertEquals(layoutParams.width, WindowManager.LayoutParams.MATCH_PARENT);\n\t assertEquals(layoutParams.height, WindowManager.LayoutParams.WRAP_CONTENT);\n\t }", "@Test\n public void checkIfAddMeetingIsRunning() {\n onView(withId(R.id.add_meeting_activity)).perform(click());\n onView(withId(R.id.meeting_color)).perform(click());\n onView(withId(R.id.meeting_room)).perform(click());\n onView(withText(\"Salle DEUX\")).perform(click());\n onView(withId(R.id.meeting_topic)).perform(typeText(\"Mareu_2\"));\n onView(withId(R.id.date_btn)).perform(click());\n onView(withId(R.id.meeting_date)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.start_time_btn)).perform(click());\n onView(withId(R.id.meeting_start_time)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.end_time_btn)).perform(click());\n onView(withId(R.id.meeting_end_time)).perform();\n onView(withText(\"OK\")).perform(click());\n onView(withId(R.id.meeting_guests)).perform(typeText(\"[email protected] ; [email protected]\"));\n onView(withId(R.id.meeting_add_button)).check(matches(isDisplayed()));\n }", "public void verifierSaisie(){\n boolean ok = true;\n\n // On regarde si le client a ecrit quelque chose\n if(saisieMessage.getText().trim().equals(\"\"))\n ok = false;\n\n if(ok)\n btn.setEnabled(true); //activer le bouton\n else\n btn.setEnabled(false); //griser le bouton\n }", "@Test\n public void homeActivityShouldHaveAHello() {\n View hello = homeActivity.findViewById(R.id.email_text_view_home);\n assertThat(hello).isNotNull();\n }", "@Test\r\n public void TestCancelButton(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(5000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.clickOnView(solo.getView(R.id.cancel2));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n\r\n }", "@Override\n public void onClick(View v) {\n if (!messagetxt.getText().toString().isEmpty()) {\n socket.emit(\"messagedetection\", Nickname, messagetxt.getText().toString());\n\n messagetxt.setText(\" \");\n }\n\n\n }", "public void sendMessage(View buttonView)\n {\n state = 0;\n Intent intent = new Intent(this, DisplayMessageActivity.class);\n EditText editText = (EditText) findViewById(R.id.Message);\n EditText editTextPhoneNumber = (EditText) findViewById(R.id.Phone);\n String message = editText.getText().toString();\n String phoneNumberMessage = editTextPhoneNumber.getText().toString();\n intent.putExtra(EXTRA_MESSAGE, message);\n intent.putExtra(EXTRA_PHONEMESSAGE, phoneNumberMessage);\n startActivity(intent);\n }", "@Test(priority =1)\r\n\tpublic void button() {\r\n button = driver.findElement(By.cssSelector(\"button.black\"));\r\n assertFalse(button.isDisplayed());\r\n //sf.assertFalse(button.isDisplayed());\r\n System.out.println(\"Print this\");\r\n\t}", "@OnClick(R.id.enter_chat1)\n public void sendMessage() {\n if (getView() == null) {\n return;\n }\n EditText editText = getView().findViewById(R.id.chat_edit_text1);\n sendMessageBackend(editText.getText().toString(), utils.getChatUser());\n updateListAdapter();\n editText.setText(\"\");\n }", "@FXML private void okButtonActivity() {\n if (activeUser != null && !activeUser.getUsername().equals(recipe.getAuthor())){\n okButton.setDisable(false);\n }\n }", "boolean hasIntent();", "@Test\n\tpublic void testPushButton(){\n\t\tbox.pushButton(setMrMe);\n\t\tassertEquals(1, setMrMe.size());\n\t}", "@Override\n public void onClick(View v) {\n sendMessage(phone_from_intent);\n }", "@Override\n public void registerBtnClick(View view) {\n isRegisteredOnGCM(2);\n//\t\t\tfinish();\n }", "@Step\n public void clickSendSMSButton(){\n actionWithWebElements.clickOnElement(sendSMSButton);\n }", "public boolean isDisplayed_click_ActivateCoupon_Button(){\r\n\t\tif(click_ActivateCoupon_Button.isDisplayed()) { return true; } else { return false;} \r\n\t}", "@Override\r\n\t\t\tpublic void onClick(View arg0) {\n\r\n\t\t\t\tif (ConnectionActivity.isNetConnected(TrainerHomeActivity.this)) {\r\n\r\n\t\t\t\t\tmakeClientMissed();\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\td.showSingleButtonDialog(TrainerHomeActivity.this,\r\n\t\t\t\t\t\t\t\"Please enable your internet connection\");\r\n\t\t\t\t}\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void onClick(ClickEvent event) {\n\t\t\t\tif (!chatTextBox.getText().equalsIgnoreCase(\"\")) {\r\n\t\t\t\t\tstoryTimeService.sendRoomChatMessage(roomData.roomName, chatTextBox.getText(), new AsyncCallback<Void>() {\r\n\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onFailure(Throwable caught) {\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onSuccess(Void result) {\r\n\t\t\t\t\t\t\tif (DEBUG)\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Client: Sent message: \" + chatTextBox.getText());\r\n\t\t\t\t\t\t\tchatTextBox.setText(\"\");\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}", "boolean isSending();", "@Override\n public void onClick(View v) {\n String checkBoulder = (String) completeBoulder.getText();\n // if button says \"Topped out!\"\n if (checkBoulder.equals(getResources().getString(R.string.topout_complete))){\n //do nothing\n }\n else {\n tries_title.setBackgroundColor(getResources().getColor(R.color.colorGreen));\n tries_title.setText(R.string.good_job);\n showTriesBox();\n }\n }", "@Override\n\tpublic void onClick(View arg0) {\n\t\tString mensaje = etMensaje.getText().toString();\n\t\tif (mensaje.trim().equals(Const.cad_vacia)){\n\t\t\tAppUtil.MostrarMensaje(getActivity(), getString(R.string.msj_error_enviar_sms));\n\t\t}else{\n\t\t\tmlistener.setMensajeSMSListener(mensaje.replace(Const.ESPACIO_BLANCO, Const.ESPACIO_BLANCO_URL));\n\t\t\tdismiss();\n\t\t}\n\t}", "private void checkEnableBt() {\n if (mBtAdapter == null || !mBtAdapter.isEnabled()) {\n Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);\n startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);\n }\n }", "@Override\n public void onBtnClick() {\n if(!TextUtils.isEmpty(versionMole.getUrl())){\n Intent intent = new Intent();\n intent.setAction(Intent.ACTION_VIEW);\n intent.setData(Uri.parse(versionMole.getUrl()));\n mContext.startActivity(intent);\n }\n\n// handler.sendEmptyMessageDelayed(111, 8000);\n testDialog.dismiss();\n }", "public boolean isDisplayed_txt_Fuel_Rewards_Page_Button(){\r\n\t\tif(txt_Fuel_Rewards_Page_Button.isDisplayed()) { return true; } else { return false;} \r\n\t}", "@Test\n public void test_call_Ambulance_Button_launches_Dialog() {\n onView(withText(\"I understand\")).perform(click());\n //Find the views and perform the action\n onView(withId(R.id.redFlag_call_ambulance)).perform(click());\n //Check if action returns desired outcome\n onView(withText(\"CALL AMBULANCE?\")).check(matches(isDisplayed()));\n\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif(!chatEditText.getText().toString().equals(\"\"))\n\t\t\t\t{\n\t\t\t\t\tString sendData = chatEditText.getText().toString();\n\t\t\t\t\tSendPacketTask task = new SendPacketTask (UDP_SERVER_PORT, wifi);\n\t\t\t\t\ttask.execute(sendData);\n\t\t\t\t\tchatEditText.setText(\"\");\n\t\t\t\t}\n\t\t\t}", "@Override\n\t public void onClick(View v) {\n\t \t SendReqToPebble();\n\t }", "public void sendMessage(View view) {\n }", "@Test\r\n\tpublic void testButtonPressedPopRackEmpty() {\r\n\t\tCoin coin = new Coin(200);\r\n\t\ttry {\r\n\t\t\tvend.getCoinSlot().addCoin(coin);\r\n\t\t\tvend.getSelectionButton(0).press();\r\n\t\t\tvend.getDeliveryChute().removeItems();\r\n\t\t\tvend.getCoinSlot().addCoin(coin);\r\n\t\t\tvend.getSelectionButton(0).press();\r\n\t\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\t\t\t\t\r\n\t\t} catch (DisabledException e) {\r\n\t\t\tassertTrue(false);\r\n\t\t}\r\n\t}", "@Test\n public final void testClickButton() {\n spysizedialog.getStartButton().doClick();\n }", "private void checkPage() {\n Assert.assertTrue(\"Electric cars button not displayed.\",electricCars.isDisplayed());\n }", "public static void checkAndClickStartButton() {\r\n\t\tcheckElementNotInteractableExceptionByID(\"startB\", \"\\\"Start\\\" button\");\r\n\t}", "public void testEmptyFlash() {\n onView(withId(R.id.flash_button)).perform(click());\n onView(withId(R.id.make_flash_button)).perform(click());\n onView(withId(R.id.submit_FlashCards_button)).perform(click());\n pressBack();\n pressBack();\n }", "@Test\r\n public void testNotExistUser(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.enterText((EditText) solo.getView(R.id.add_following), \"yifan30\");\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"The username does not exist!!\", 1,2000));\r\n\r\n }", "public void clickOnSendNotification() {\r\n\r\n\t\treportStep(\"About to click on Send Notification button \", \"INFO\");\r\n\r\n\t\tif(clickAfterWait(sendNotificationButton)) {\r\n\r\n\t\t\treportStep(\"Successfully clicked on the Send notification Button \", \"PASS\");\r\n\r\n\t\t}else {\r\n\r\n\t\t\treportStep(\"Failed to click onn the Send Notificationn Buttonn \", \"FAIL\");\r\n\t\t}\r\n\t}", "@Test\n public void testSetButtonConfirmarClicked() {\n }", "public boolean isSetSender() {\n return this.sender != null;\n }", "public void enableDisableSendButton() {\r\n sendButton.setEnabled(topModel.isSendButtonEnabled());\r\n }", "@Test\r\n\tpublic final void testGetButton() {\n\t\tassertEquals(\"ON\",a.getButton());\r\n\t}", "public static void checkStartButton() {\r\n\t\tcheckNoSuchElementExceptionByID(\"startB\", \"\\\"Start\\\" button\");\r\n\t}", "public boolean isCheckoutButtonPresent() {\n\t\ttry{\n\t\t\tdriver.findElement(By.xpath(\"//android.view.View[@resource-id='\" + checkout + \"']\"));\n\t\t\treturn true;\n\t\t} catch(Exception e) {\n\t\t\treturn false;\n\t\t}\n\t}", "public void updateSendButtonText() {\r\n sendButton.setText(topModel.getSendButtonText());\r\n }", "@Override\n public void onClick(View view) {\n String android_id = getMacAddress(context);\n boolean isEmulator = isEmulator();\n boolean isrefralempty = true;\n\n if (CheckNet.checkNet(context) && (isrefralempty = referalCode.getText().toString().length() == 7) && !isEmulator) {\n new GetDeviceId().execute(android_id);\n } else if (!isrefralempty) {\n\n MyToast.showToast(context, \"Please Enter Valid Referal Code!\");\n } else if (isEmulator) {\n\n MyToast.showToast(context, \"Hey You!! I got You.No Emulator allowed!!\");\n } else {\n\n MyToast.showToast(context, \"Please close the App and try Again!!\");\n\n\n }\n\n\n }", "@Override\n public void onClick(View view) {\n\n runOnUiThread(\n new Runnable() {\n @Override\n public void run() {\n MainActivity\n .this\n .connectionManager.getTo().println(\n MainActivity\n .this\n .send_text.getText().toString()\n );\n }\n }\n );\n\n }", "@Override\n public void onClick(View v) {\n Toast.makeText(getContext(), \"Not Ready Yet :(\", Toast.LENGTH_SHORT).show();\n }" ]
[ "0.6837007", "0.6587495", "0.6493858", "0.6434146", "0.6423935", "0.6338277", "0.62528676", "0.62090427", "0.6145809", "0.6138947", "0.6124845", "0.61027664", "0.6092178", "0.6086071", "0.60822475", "0.6070534", "0.6058522", "0.60560167", "0.5986287", "0.59833956", "0.59833956", "0.59833956", "0.59833956", "0.59833956", "0.59833956", "0.59823644", "0.5974019", "0.5941987", "0.5938951", "0.59294754", "0.59212923", "0.59211946", "0.589943", "0.58850944", "0.5852444", "0.5848031", "0.5834928", "0.583411", "0.58332837", "0.5827284", "0.5819691", "0.5806666", "0.5806519", "0.5803921", "0.58014214", "0.5797251", "0.5795173", "0.5785425", "0.5774772", "0.57707626", "0.5765052", "0.5749491", "0.5745318", "0.5737779", "0.57270235", "0.57259774", "0.5709098", "0.56976396", "0.5696556", "0.56963354", "0.5689333", "0.5689286", "0.5685027", "0.56795496", "0.56752324", "0.5674863", "0.5665828", "0.5640362", "0.5636051", "0.563209", "0.5625374", "0.56232196", "0.56187403", "0.56149167", "0.5612463", "0.5608032", "0.5602344", "0.55892956", "0.55875075", "0.5586621", "0.55830806", "0.5582382", "0.55797106", "0.5576235", "0.5574321", "0.556821", "0.55678", "0.5567767", "0.55648285", "0.5564266", "0.5558782", "0.5549939", "0.5546859", "0.5541183", "0.5538149", "0.5537003", "0.5535886", "0.5530888", "0.55295575", "0.55212694" ]
0.7300946
0
test that the send button uses the correct button
@Test public void testSendButtonHasCorrectID(){ FloatingActionButton sendButton = messagesActivity.fab; int ID = sendButton.getId(); int expectedID = R.id.fab; assertEquals(ID, expectedID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Then(\"^Click On Send Button$\")\r\n\tpublic void click_On_Send_Button() {\n\t\tnop.click(\"//*[@id=\\\"submitMessage\\\"]/span\"); \r\n\t \r\n\t}", "public void acceptTenderButton() {\n\t\tBy elem = By.cssSelector(\"button\");\n\t\tList<WebElement> elements = driver.findElements(elem);\n\t\t\n\t\tfor (WebElement item : elements) {\n\t\t\tString test = item.getAttribute(\"innerHTML\");\n\t\t\tif (test.contains(\"ACCEPT TENDER\")) {\n\t\t\t\titem.click();\n\t\t\t}\n\t\t}\n\t}", "public void clickOnSendNotification() {\r\n\r\n\t\treportStep(\"About to click on Send Notification button \", \"INFO\");\r\n\r\n\t\tif(clickAfterWait(sendNotificationButton)) {\r\n\r\n\t\t\treportStep(\"Successfully clicked on the Send notification Button \", \"PASS\");\r\n\r\n\t\t}else {\r\n\r\n\t\t\treportStep(\"Failed to click onn the Send Notificationn Buttonn \", \"FAIL\");\r\n\t\t}\r\n\t}", "public void updateSendButtonText() {\r\n sendButton.setText(topModel.getSendButtonText());\r\n }", "@Test\n\tpublic void testPushButton(){\n\t\tbox.pushButton(setMrMe);\n\t\tassertEquals(1, setMrMe.size());\n\t}", "public void testGetButton() {\n\t\tassertEquals(this.myButton.getJComponent(),this.myButton.getButton());\n\t}", "@Step\n public void clickSendSMSButton(){\n actionWithWebElements.clickOnElement(sendSMSButton);\n }", "public void ClickSendApplicationButton()\n {\n\n new WebDriverWait(driver, 30).until(ExpectedConditions.visibilityOf(SendApplicationButton)).click();\n\n }", "@Test\n public void testifyBtn() throws InterruptedException {\n onView(withId(R.id.SaveButton)).check(matches(isDisplayed()));\n\n }", "@Test\r\n\tpublic void testButtonPressedSafety() {\r\n\t\tSelectionButton button = vend.getSelectionButton(0);\r\n\t\tvend.enableSafety();\r\n\t\tbutton.press();\r\n\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\r\n\t}", "public void handleSendButton(ActionEvent event) {\n\n messageController.setMessageSystem(this.message.getText(), this.toUsername.getText(),this.sender);\n if (messageController.sendMessage()){\n sentValid.setVisible(true);\n sentInvalid.setVisible(false);\n\n }\n else{\n sentInvalid.setVisible(true);\n sentValid.setVisible(false);\n\n }\n\n\n }", "@Test\n public void testSubscribeAndSaveButtonCheck() throws InterruptedException {\n subscribeAndSaveButtonCheck();\n Thread.sleep(8000);\n String actualText = driver.findElement(By.xpath(subscribeActualText)).getText();\n Assert.assertEquals(actualText, subscribeExpectedText);\n }", "@Test(priority=3)\n\tpublic void verifySignUpBtn() {\n\t\tboolean signUpBtn = driver.findElement(By.name(\"websubmit\")).isEnabled();\n\t\tAssert.assertTrue(signUpBtn);\n\t}", "private void sendSignal(){\n\t\tSystem.out.println(inputLine + \"test\");\n\t\tMessageContent messageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_RANDOM);\n\t\tif(inputLine.equals(Constants.BUTTON_1_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_BEDROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_1_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_BEDROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_2_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_KITCHEN, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_2_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_KITCHEN, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_3_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_LIVINGROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_3_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_LIVINGROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_4_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_RANDOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_4_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_RANDOM, \"0\");\n\t\t\tSystem.out.println(\"oh yeah\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_5_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.SHUTTER, Constants.PLACE_LIVINGROOM);\n\t\t}else if(inputLine.equals(Constants.BUTTON_5_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.SHUTTER, Constants.PLACE_LIVINGROOM);\n\t\t}\n\t\t\t\t\n\t\tString json = messageContent.toJSON();\n\t\tDFAgentDescription template = new DFAgentDescription();\n ServiceDescription sd = new ServiceDescription();\n if (inputLine.equals(Constants.BUTTON_5_ON) || inputLine.equals(Constants.BUTTON_5_OFF)) {\n\t\tsd.setType(Constants.SHUTTER);\n\t\tsd.setName(Constants.PLACE_LIVINGROOM);\n } else {\n\t\tsd.setType(Constants.AUTO_SWITCH);\n\t\tsd.setName(Constants.AUTO_SWITCH_AGENT);\n }\n template.addServices(sd);\n try {\n DFAgentDescription[] result = DFService.search(myAgent, template);\n if (result.length > 0) {\n ACLMessage request = new ACLMessage(ACLMessage.REQUEST);\n if (inputLine.equals(Constants.BUTTON_5_ON) || inputLine.equals(Constants.BUTTON_5_OFF)) {\n\t\t\t\trequest.setPerformative(ACLMessage.INFORM);\n }\n for (DFAgentDescription receiver : result) {\n if (!receiver.getName().equals(myAgent.getAID())) {\n request.addReceiver(receiver.getName());\n \n }\n }\n request.setContent(json);\n myAgent.send(request);\n }\n } catch(FIPAException fe) {\n fe.printStackTrace();\n }\n\n\n\t}", "@Test\r\n\tpublic void testButtonPressedNotEnoughCred() {\r\n\t\tvend.getSelectionButton(0).press();\r\n\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\t\t\r\n\t}", "@Test\r\n\tpublic void testButtonPressedDeliverPop() {\r\n\t\tCoin coin = new Coin(200);\r\n\t\ttry {\r\n\t\t\tvend.getCoinSlot().addCoin(coin);\r\n\t\t\tvend.getSelectionButton(0).press();\r\n\t\t\tDeliverable[] items= vend.getDeliveryChute().removeItems();\r\n\t\t\tassertTrue((items.length==1) && (items[0].toString().equals(\"Coke\")));\t\t\t\t\r\n\t\t} catch (DisabledException e) {\r\n\t\t\tassertTrue(false);\r\n\t\t}\r\n\t}", "@Test\n public void testGreenButton4Vissible() {\n window.textBox(\"usernameText\").setText(\"karona\"); \n window.textBox(\"StoresNameTxt\").setText(\"store1\"); \n window.textBox(\"openHoursTxt\").setText(\"18:00-20:00\");\n window.textBox(\"CustomerNameTxt\").setText(\"\");\n window.textBox(\"NumberOfSeatsTxt\").enterText(\"1\"); \n window.comboBox(\"DateAvailable\").selectItem(1);\n window.comboBox(\"HoursAvailable\").selectItem(1);\n window.button(\"makeReservation\").click();\n window.optionPane().okButton().click();\n window.button(\"greenButton4\").requireVisible();\n }", "@Test(priority = 8)\n @Parameters(\"browser\")\n public void TC08_VERIFY_BUTTON_TIEPTHEO(String browser) throws IOException {\n String excel_BtnTiepTheo = null;\n excel_BtnTiepTheo = global.Read_Data_From_Excel(excelPath,\"ELEMENTS\",7,2);\n if(excel_BtnTiepTheo == null){\n System.out.println(\"ERROR - Cell or Row No. is wrong.\");\n exTest.log(LogStatus.ERROR, \"ERROR - Cell or Row No. is wrong.\" );\n }\n // Locate element by Xpath\n WebElement ele_BtnTiepTheo = null;\n ele_BtnTiepTheo = global.Find_Element_By_XPath(driver, excel_BtnTiepTheo);\n if(ele_BtnTiepTheo == null){\n exTest.log(LogStatus.FAIL,\"::[\" + browser + \"]:: TC08 - Button Tiep theo is not displayed.\");\n } else {\n exTest.log(LogStatus.PASS,\"::[\" + browser + \"]:: TC08 - Button Tiep theo is displayed.\");\n }\n // Get text from Element.\n String textBtnTieptheo = \"Tiếp theo\";\n String textGetFromEle_BtnTieptheo = ele_BtnTiepTheo.getText();\n System.out.println(\"DEBUG --- \" + textGetFromEle_BtnTieptheo);\n if(textGetFromEle_BtnTieptheo != null && textGetFromEle_BtnTieptheo.equals(textBtnTieptheo)){\n exTest.log(LogStatus.PASS,\"::[\" + browser + \"]:: TC08.1 - Button Tiep theo is correct.\");\n } else {\n exTest.log(LogStatus.FAIL,\"::[\" + browser + \"]:: TC08.1 - Link Tao Tai Khoan is not correct.\");\n }\n }", "@Test\n public void testRedButton4Vissible() {\n window.textBox(\"usernameText\").setText(\"karona\"); \n window.textBox(\"StoresNameTxt\").setText(\"store1\"); \n window.textBox(\"openHoursTxt\").setText(\"18:00-20:00\");\n window.textBox(\"CustomerNameTxt\").setText(\"ilias\");\n window.textBox(\"NumberOfSeatsTxt\").enterText(\"1\"); \n window.comboBox(\"HoursAvailable\").selectItem(1);\n window.button(\"makeReservation\").click();\n window.optionPane().okButton().click();\n window.button(\"redButton4\").requireVisible();\n }", "private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed\n String str = requestCommand.getText();\n sC.sendCommand(str); \n requestCommand.requestFocus();\n }", "@Test\r\n\tpublic final void testGetButton() {\n\t\tassertEquals(\"ON\",a.getButton());\r\n\t}", "public boolean send() {\n\t\tif (!isValid())\n\t\t\treturn false;\n\t\tif (ActionBar.sendKey(getSlot()))\n\t\t\treturn true;\n\t\tWidgetChild main = SlotData.getMainChild(getSlot());\n\t\treturn WidgetUtil.visible(main) && EntityUtil.interact(false, main);\n\t}", "@Test\n public void UserCanWriteAndSendAMessage() {\n proLogin(proWait);\n handler.getDriver(\"user\").navigate().refresh();\n // User to queue\n waitAndFillInformation(userWait);\n // User from queue\n\n waitAndPickFromQueue(proWait);\n\n // User can write message\n waitChatWindowsAppear(userWait).sendKeys(\"yy kaa koo\");\n\n // Can send it By Pressing Submit\n waitElementPresent(userWait, By.name(\"send\")).submit();\n assertEquals(\"\", waitChatWindowsAppear(userWait).getText());\n assertTrue(waitForTextToAppear(userWait, \"yy kaa koo\"));\n\n // Can send it By Pressing Enter\n waitChatWindowsAppear(userWait).sendKeys(\"kaa koo yy\");\n waitChatWindowsAppear(userWait).sendKeys(Keys.ENTER);\n\n assertEquals(\"\", waitChatWindowsAppear(userWait).getText());\n assertTrue(waitForTextToAppear(userWait, \"kaa koo yy\"));\n endConversationPro(proWait);\n }", "@Test(priority =1)\r\n\tpublic void button() {\r\n button = driver.findElement(By.cssSelector(\"button.black\"));\r\n assertFalse(button.isDisplayed());\r\n //sf.assertFalse(button.isDisplayed());\r\n System.out.println(\"Print this\");\r\n\t}", "@Test\n public final void testClickButton() {\n spysizedialog.getStartButton().doClick();\n }", "protected void actionPerformed(GuiButton button) throws IOException {\n/* 60 */ if (button.enabled)\n/* */ {\n/* 62 */ if (button.id == 1) {\n/* */ \n/* 64 */ this.lastScreen.confirmClicked(false, 0);\n/* */ }\n/* 66 */ else if (button.id == 0) {\n/* */ \n/* 68 */ this.serverData.serverIP = this.ipEdit.getText();\n/* 69 */ this.lastScreen.confirmClicked(true, 0);\n/* */ } \n/* */ }\n/* */ }", "private void b_sendActionPerformed(java.awt.event.ActionEvent evt) { \r\n\t\tString nothing = \"\";\r\n\t\tif ((b_sendText.getText()).equals(nothing)) {\r\n\t\t\tb_sendText.setText(\"\");\r\n\t\t\tb_sendText.requestFocus();\r\n\t\t}\r\n\t\telse {\r\n\t\t\ttry {\r\n\t\t\t\ttellEveryone(\"Server\" + \":\" + b_sendText.getText() + \":\" + \"Chat\");\r\n\t\t\t\tPrint_Writer.flush(); // flushes the buffer\r\n\t\t\t} catch (Exception ex) {\r\n\t\t\t}\r\n\t\t\tb_sendText.setText(\"\");\r\n\t\t\tb_sendText.requestFocus();\r\n\t\t}\r\n\r\n\t\tb_sendText.setText(\"\");\r\n\t\tb_sendText.requestFocus();\r\n\r\n\t}", "protected javax.swing.JButton getJButtonSend() {\n\t\tif(jButton == null) {\n\t\t\tjButton = new javax.swing.JButton();\n\t\t\tjButton.setPreferredSize(new java.awt.Dimension(85,25));\n\t\t\tjButton.setText(\"Send\");\n\t\t\tjButton.setName(\"Send\");\n\t\t\tjButton.setMnemonic(java.awt.event.KeyEvent.VK_S);\n\t\t\t\n\t\t\tjButton.setToolTipText(\"Send the play list file and save it locally\");\n\n\t\t\tjButton.addActionListener(new java.awt.event.ActionListener() { \n\t\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent e) {\n\t\t\t\t\t\n\t\t\t\t\tString msg = getInvalidMsg();\n\t\t\t\t\tif( msg != null ) {\t\t\t\t\t\t\t\n\t\t\t\t\t\tJOptionPane.showMessageDialog(PlayListDialog.this,\n\t\t\t\t\t\t\tmsg,\n\t\t\t\t\t\t\t\"Invalid Input\", JOptionPane.OK_OPTION);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\twriteToPropFile( LMMUtils.PLAYER_FILE );\n\t\n\t\t\t\t\t\t\tsendFileMsg();\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch( IOException ioe ) {\n\t\t\t\t\t\t\tLMMLogger.error( \"Unable to write & send play list file\", ioe );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tdispose();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn jButton;\n\t}", "public JButton getSend() {\n\t\treturn send;\n\t}", "public boolean test(CommandSender sender, MCommand command);", "public static void checkAndClickPlayButton() {\r\n\t\tcheckNoSuchElementExceptionByXPath(\"//*[@id=\\\"secondepage\\\"]/center/button[1]\", \"\\\"Play\\\" button\");\r\n\t\tcheckElementNotInteractableExceptionByXPath(\"//*[@id=\\\"secondepage\\\"]/center/button[1]\", \"\\\"Play\\\" button\");\r\n\t}", "@Test\n public void testSetButtonConfirmarClicked() {\n }", "@Test\n public void triggerIntentTestButtonToRegister() {\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(isClickable()));\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(notNullValue()));\n }", "private JButton getButButton() { \n if (butButton == null) { \n butButton = new JButton(); \n butButton.setBounds(new Rectangle(58, 110, 177, 50)); \n butButton.setText(\"Enviar\"); \n butButton.addActionListener(new java.awt.event.ActionListener() { \n public void actionPerformed(java.awt.event.ActionEvent e) { \n send(); \n } \n }); \n } \n return butButton; \n }", "protected GuiTestObject button_registerNowsubmit() \n\t{\n\t\treturn new GuiTestObject(\n getMappedTestObject(\"button_registerNowsubmit\"));\n\t}", "private void customSendBlueButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customSendBlueButtonActionPerformed\n String custom = customMessageField.getText();\n Msg.send(\"Clicked - message: \" + custom);\n sendCustomMessage(custom, \"B\");\n }", "@Test\n public void testSendButtonExists(){\n FloatingActionButton sendButton = messagesActivity.fab;\n assertNotNull(sendButton);\n }", "public void clickSendButtonInMessagesTab(String message) throws UIAutomationException{\t\r\n\t\telementController.requireElementSmart(fileName,\"Send Button In Messages Tab\",GlobalVariables.configuration.getAttrSearchList(), \"Send Button In Messages Tab\");\r\n\t\tUIActions.click(fileName,\"Send Button In Messages Tab\",GlobalVariables.configuration.getAttrSearchList(), \"Send Button In Messages Tab\");\r\n\t\ttry\r\n\t\t{\r\n\t\t\tThread.sleep(4000);\r\n\t\t}\r\n\t\tcatch(Exception e){}\r\n\t\t\r\n\t\t//If the message is blank , check whether \"Message not sent\" notification appears\r\n\t\tif(message.equals(\" \"))\r\n\t\t{\r\n\t\t// Check by clicking on 'Send' notification appears\r\n\t\telementController.requireElementSmart(fileName,\"Message Not Sent Notification\",GlobalVariables.configuration.getAttrSearchList(), \"Message Not Sent Notification\");\r\n\t\tString linkTextInPage=UIActions.getText(fileName,\"Message Not Sent Notification\",GlobalVariables.configuration.getAttrSearchList(), \"Message Not Sent Notification\");\r\n\t\tString linkTextInXML=dataController.getPageDataElements(fileName,\"Message Not Sent Notification Name\" , \"Name\");\r\n\t\tif(!linkTextInPage.contains(linkTextInXML)){\r\n\t\tthrow new UIAutomationException( \"'\"+linkTextInXML +\"' not found\");\r\n\t\t}\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t// Check by clicking on 'Send' notification appears\r\n\t\telementController.requireElementSmart(fileName,\"Message Sent Notification\",GlobalVariables.configuration.getAttrSearchList(), \"Message Sent Notification\");\r\n\t\tString linkTextInPage=UIActions.getText(fileName,\"Message Sent Notification\",GlobalVariables.configuration.getAttrSearchList(), \"Message Sent Notification\");\r\n\t\tString linkTextInXML=dataController.getPageDataElements(fileName,\"Message Sent Notification Name\" , \"Name\");\r\n\t\tif(!linkTextInPage.contains(linkTextInXML)){\r\n\t\tthrow new UIAutomationException( \"'\"+linkTextInXML +\"' not found\");\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t}", "@Test\r\n\tpublic void testButtonPressedDisabled() {\r\n\t\tSelectionButton button = vend.getSelectionButton(0);\r\n\t\tbutton.disable();\r\n\t\tbutton.press();\r\n\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\r\n\t}", "@Test\n @DisplayName(\"Test: check if 'Mail' action works.\")\n public void testSetMailAction() throws InterruptedException, ClientException {\n FormContainerEditDialog dialog = formComponents.openEditDialog(containerPath);\n dialog.setMailActionFields(from,subject,new String[] {mailto1,mailto2}, new String[] {cc1, cc2});\n Commons.saveConfigureDialog();\n JsonNode formContentJson = authorClient.doGetJson(containerPath , 1, HttpStatus.SC_OK);\n assertTrue(formContentJson.get(\"from\").toString().equals(\"\\\"\"+from+\"\\\"\"));\n assertTrue(formContentJson.get(\"subject\").toString().equals(\"\\\"\"+subject+\"\\\"\"));\n assertTrue(formContentJson.get(\"mailto\").get(0).toString().equals(\"\\\"\"+mailto1+\"\\\"\"));\n assertTrue(formContentJson.get(\"mailto\").get(1).toString().equals(\"\\\"\"+mailto2+\"\\\"\"));\n assertTrue(formContentJson.get(\"cc\").get(0).toString().equals(\"\\\"\"+cc1+\"\\\"\"));\n assertTrue(formContentJson.get(\"cc\").get(1).toString().equals(\"\\\"\"+cc2+\"\\\"\"));\n }", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tif (btn1==e.getSource()) { //만약 버튼(btn1)클릭 시 동작\n\t\t\tto = tfphone.getText(); //텍스트필드(전화번호) 값가져와서 String to로 변형\n\t\t\ttext = tftext.getText(); //텍스트 필드(텍스트) 값자겨와서 String text로 변형 \n\t\t\t\t\t\t\t\t\t\t\t\t//문자전송(인자)가 String 이기때문에 String으로 변형해줘야함\n\t\t\tExampleSend ex = new ExampleSend(); //ExampleSend클래스 객체 생성\n\t\t\tex.문자전송(to, text);\n\t\t}\n\t\tif (btn2 == e.getSource()) {\n\t\t\ttfphone.setText(\"\");\n\t\t\ttftext.setText(\"\");\n\t\t}\n\t}", "@WebElementLocator(webDesktop = \"//input[@type='submit']\",webPhone = \"//input[@type='submit']\")\n private static WebElement buttonSubmit() {\n return getDriver().findElement(By.xpath(new WebElementLocatorFactory().getLocator(LoginPage.class, \"buttonSubmit\")));\n }", "@Test\r\n\tpublic void testButtonPressedPopRackDisabled() {\r\n\t\tCoin coin = new Coin(200);\r\n\t\ttry {\r\n\t\t\tvend.getPopCanRack(0).disable();\r\n\t\t\tvend.getCoinSlot().addCoin(coin);\r\n\t\t\tvend.getSelectionButton(0).press();\t\r\n\t\t\tassertTrue((vend.getPopCanRack(0).isDisabled()) && (vend.getDeliveryChute().removeItems().length==0));\r\n\t\t} catch (DisabledException e) {\r\n\t\t\tassertTrue(false);\r\n\t\t}\r\n\t}", "@Test\n\tpublic void addButtonsTest() throws Exception {\n\t\t\n\t\tif (Configuration.featureamp &&\n\t\t\t\tConfiguration.playengine &&\n\t\t\t\tConfiguration.choosefile &&\n\t\t\t\tConfiguration.skins &&\n\t\t\t\tConfiguration.gui &&\n\t\t\t\tConfiguration.light &&\n\t\t\t\tConfiguration.filesupport &&\n\t\t\t\tConfiguration.showcover &&\n\t\t\t\tConfiguration.reorderplaylist && \n\t\t\t\t!Configuration.queuetrack \n\t\t\t\t) {\n\t\t\tstart();\n\t\t\t\n\t\t\tgui.addButtons();\n\t\t\tJFrame g = (JFrame) MemberModifier.field(Application.class, \"frmAsd\").get(gui);\n\t\t\tJButton button =null;\n\t\t\tJButton button2 =null;\n\t\t\t\n\t\t\tfor (int i = 0; i < g.getContentPane().getComponentCount(); i++) {\n\t\t\t\tif(g.getContentPane().getComponent(i).getName()!= null && g.getContentPane().getComponent(i).getName().equals(\"trackUp\")) {\n\t\t\t\t\tbutton = (JButton) g.getContentPane().getComponent(i);\n\t\t\t\t}\n\t\t\t\telse if(g.getContentPane().getComponent(i).getName()!= null && g.getContentPane().getComponent(i).getName().equals(\"trackDown\")) {\n\t\t\t\t\tbutton2 = (JButton) g.getContentPane().getComponent(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tassertTrue(button.getBounds().getX() == 506);\n\t\t\tassertTrue(button.getBounds().getY() == 327);\n\t\t\tassertTrue(button.getBounds().getWidth() == 120);\n\t\t\tassertTrue(button.getBounds().getHeight() == 25);\n\t\t\tassertTrue(button.getActionListeners()!= null);\n\t\t\t\n\t\t\tassertTrue(button2.getBounds().getX() == 506);\n\t\t\tassertTrue(button2.getBounds().getY() == 360);\n\t\t\tassertTrue(button2.getBounds().getWidth() == 120);\n\t\t\tassertTrue(button2.getBounds().getHeight() == 25);\n\t\t\tassertTrue(button2.getActionListeners()!= null);\n\t\t}\n\t}", "public void verifyApplyButtonInAboutMe() throws UIAutomationException{\r\n\t\telementController.requireElementSmart(fileName,\"Apply Button In About Me\",GlobalVariables.configuration.getAttrSearchList(), \"Apply Button In About Me\");\r\n\t\t\t\t\r\n\t\t// Assertion : Check Button is present on page\r\n\t\tString linkText=dataController.getPageDataElements(fileName, \"Apply Button Name In About Me\", \"Name\");\r\n\t\tSystem.out.println(linkText);\r\n // UIActions.waitForLinkText(linkText,Integer.parseInt(GlobalVariables.configuration.getConfigData().get(\"TimeOutForFindingElementSeconds\")));\r\n\t}", "public boolean ButtonStatusToRoundTrip(){\n\n wait.until(ExpectedConditions.elementSelectionStateToBe(roundTripButton,false));\n roundTripButton.click();\n System.out.println(\"Round Trip button is clicked\");\n do {\n return true;\n }\n while (roundTripButton.isSelected());\n\n\n }", "protected GuiTestObject okbutton() \n\t{\n\t\treturn new GuiTestObject(\n getMappedTestObject(\"okbutton\"));\n\t}", "public void ButtonStatusToOneWay() throws InterruptedException {\n\n Thread.sleep(10000);\n //action=new Actions(this.driver);\n if (oneWayButton.isSelected()) {\n System.out.println(\"One way Button is already selected\");\n } else {\n wait.until(ExpectedConditions.elementSelectionStateToBe(oneWayButton,false));\n oneWayButton.click();\n System.out.println(\"one way button is clicked\");\n }\n\n\n }", "@Test\n public void testIsButtonConfirmarClicked() {\n }", "@Test\n\tpublic void testClickOnOkayButton() {\n\n\t\tvar prompt = openPrompt();\n\t\tprompt.getOkayButton().click();\n\t\tassertNoDisplayedModalDialog();\n\t\tassertPromptInputApplied();\n\t}", "@Test\n public void testFindAGiftButtonCheck() throws InterruptedException {\n findAGiftButtonCheck();\n Thread.sleep(8000);\n String actualText = driver.findElement(By.xpath(findAGiftActualText)).getText();\n Assert.assertEquals(actualText, findAGiftExpectedText);\n }", "private void createSendArea() {\n\t\tthis.btnSend = new Button(\"Envoyer\");\n\t\tthis.btnSend.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent event) {\n\t\t\t\tboolean sent = window.sendMessage(message.getText());\n\t\t\t\tif(sent) {\n\t\t\t\t\tmessage.setText(\"\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tJOptionPane.showMessageDialog(\n\t\t\t\t\t\tnew JFrame(),\n\t\t\t\t\t\t\"Erreur lors de l'envoi du message...\",\n\t\t\t\t\t\t\"Dialog\",\n\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "public static void click_SubmitButton() {\n\t\tboolean bstatus;\n\n\t\tbstatus = clickElement(btn_Submit);\n\t\tReporter.log(bstatus, \"Submit Button is clicked\", \"Submit Button not clicked\");\n\n\t\t\n\t}", "protected abstract void pressedOKButton( );", "public void clickShowSent() throws UIAutomationException{\t\t\r\n\t\telementController.requireElementSmart(fileName,\"Show Sent In Social Panel\",GlobalVariables.configuration.getAttrSearchList(), \"Show Sent In Social Panel\");\r\n\t\tUIActions.click(fileName,\"Show Sent In Social Panel\",GlobalVariables.configuration.getAttrSearchList(), \"Show Sent In Social Panel\");\r\n\t\t\t\r\n\t\t/*\t// Check by clicking on 'show sent' it changes to 'show received'\r\n\t\t\telementController.requireElementSmart(fileName,\"Show Sent In Social Panel\",GlobalVariables.configuration.getAttrSearchList(), \"Show Sent In Social Panel\");\r\n\t\t\tString linkTextInPage=UIActions.getText(fileName,\"Show Sent In Social Panel\",GlobalVariables.configuration.getAttrSearchList(), \"Show Sent In Social Panel\");\r\n\t\t\tString linkTextInXML=dataController.getPageDataElements(fileName,\"Show Received Text\" , \"Name\");\r\n\t\t\tif(!linkTextInPage.contains(linkTextInXML)){\r\n\t\t\t\tthrow new UIAutomationException( \"'\"+linkTextInXML +\"' not found\");\r\n\t\t\t}*/\r\n\t}", "public void goSendOrderButton(View view) { //is called by onClick function of Button in activity_main.xml\n if(WifiAvaible()) {\n try {\n fab.getProtocol().sendOrder(surface.getSeedbox().toString());\n OrderStatus.setText(\"Waiting for \\n\"+\"confirmation.\");\n } catch (Exception e) {\n //ErrorWindow\n }\n\n SendButton.setEnabled(false);\n }\n\n\n/*\n if(ClickCnt == 0) {\n mp.start();\n ClickCnt = 1;\n } else {\n ClickCnt = 0;\n mp.stop();\n try {\n mp.prepare();\n }\n catch (java.lang.Exception e)\n {\n // Do nothing\n }\n\n mp.seekTo(0);\n }*/\n }", "public void verifyNewTabDorMessageBoardsOpened() {\n Assert.assertTrue(boardButton.isDisplayed());\t\t\n\t}", "@When(\"I click on the buy button\")\n\t\tpublic void i_click_on_the_buy_button() {\n\t\t\tdriver.findElement(By.xpath(buttonBuy)).click();\n\t\t}", "private void clickInvite(){\n WebDriverHelper.clickElement(inviteButton);\n }", "private void predefiniedSendBothActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_predefiniedSendBothActionPerformed\n // TODO add your handling code here:\n String commandString = \"\";\n String selectedMessage = (String) messages.getSelectedItem();\n System.out.println(\"Message Key: \" + selectedMessage);\n String[] titleKey = selectedMessage.split(\"\\\\. \");\n// for (int i = 0; i < titleKey.length; i++) {\n// System.out.println(\"TK \" + i + \": \" + titleKey[i]);\n// }\n String lineTitle = titleKey[1].trim();\n Msg.send(\"Clicked - send both predef message: \" + lineTitle);\n for (int i = 0; i < lines.size(); i++) {\n String line = (String) lines.get(i);\n if (line.contains(lineTitle)) {\n String current = (String) lines.get(i);\n String[] parts = current.split(\";\");\n commandString = parts[2];\n }\n }\n String sendString = \"VA\" + commandString;\n \n sendRawMessage(sendString);\n }", "public void buttonPress(ActionEvent event) {\r\n Button clickedButton = (Button) event.getSource();\r\n String selectedButton = clickedButton.getId();\r\n System.out.print(selectedButton);\r\n \r\n // If the user correctly guesses the winning button\r\n if (correctButtonName.equals(selectedButton)) {\r\n \r\n //Displays a popup alerting the user that they won the game.\r\n Alert alert = new Alert(Alert.AlertType.INFORMATION);\r\n alert.setTitle(\"You Win!\");\r\n alert.setHeaderText(\"Congratulations, you found the treasure!\");\r\n alert.setContentText(\"Would you like to play again?\");\r\n ButtonType okButton = new ButtonType(\"Play again\");\r\n ButtonType noThanksButton = new ButtonType(\"No Thanks!\");\r\n alert.getButtonTypes().setAll(okButton, noThanksButton);\r\n Optional<ButtonType> result = alert.showAndWait();\r\n \r\n //If the user selects \"Play again\" a new button will be randomly selected\r\n if (result.get() == okButton ){\r\n //Chooses a random button from the list of buttons\r\n correctButtonName = buttonList[(int)(Math.random() * buttonList.length)];\r\n }\r\n //If the user does not select \"Play again\", the application will be closed\r\n else {System.exit(0);}\r\n \r\n }\r\n \r\n //If the user chooses any button except for the winning button\r\n else if (!selectedButton.equals(correctButtonName)) {\r\n \r\n //Displays a popup alerting the user that they did not find the treasure.\r\n Alert alert2 = new Alert(Alert.AlertType.INFORMATION);\r\n alert2.setTitle(\"No treasure!\");\r\n alert2.setHeaderText(\"There was no treasure found on that island\");\r\n alert2.setContentText(\"Would you like to continue searching for treasure?\");\r\n ButtonType ayeCaptain = new ButtonType (\"Continue Searching\");\r\n ButtonType noCaptain = new ButtonType (\"Quit\");\r\n alert2.getButtonTypes().setAll(ayeCaptain,noCaptain);\r\n Optional<ButtonType> result2 = alert2.showAndWait();\r\n \r\n if (result2.get() == ayeCaptain){\r\n //The search for treasure continues!\r\n }\r\n else{ \r\n System.exit(0);\r\n }\r\n }\r\n }", "public void ClickChecoutSubmitbutton(){\r\n\t\tclass Local {};\r\n\t\tReporter.log(\"TestStepComponent\"+Local.class.getEnclosingMethod().getName());\r\n\t\tReporter.log(\"TestStepInput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepOutput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepExpectedResult:- Checkout Registration submit button should be clicked\");\r\n\t\ttry{\r\n\r\n\t\t\tclick(locator_split(\"btncheckoutregistrationsubmit\"));\r\n\t\t\tSystem.out.println(\"Checkout Registration submit button is clicked\");\r\n\t\t\tReporter.log(\"PASS_MESSAGE:- Checkout Registration submit button is clicked\");\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tReporter.log(\"FAIL_MESSAGE:- Checkout Registration submit button is not clicked\");\r\n\t\t\tthrow new NoSuchElementException(\"The element with \"\r\n\t\t\t\t\t+ elementProperties.getProperty(\"btncheckoutregistrationsubmit\").toString().replace(\"By.\", \" \")\r\n\t\t\t\t\t+ \" not found\");\r\n\t\t}\r\n\r\n\t}", "@Test\n public void triggerIntentTestButtonLogin() {\n onView(withId(R.id.btnLogin)).check(matches(isClickable()));\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(notNullValue()));\n }", "public void clickSendInvitationButton() throws Exception {\n\t\twdriver.findElement(By.xpath(locators.clickSendInvitationButton)).click();\n\t}", "public boolean VerifyButtonStatus() throws InterruptedException {\n\n Thread.sleep(10000);\n if(roundTripButton.isSelected()) {\n System.out.println(\"round trip Button is already selected\");\n wait.until(ExpectedConditions.elementToBeClickable(oneWayButton));\n oneWayButton.click();\n System.out.println(\"Switched to One Way button\");\n }\n else if(oneWayButton.isSelected()){\n System.out.println(\"One way button is already selected\");\n roundTripButton.click();\n System.out.println(\"Switched to Round Trip button\");\n\n }\n return true;\n }", "public void checkoutcontinuebutton( ){\r\n\r\n\t\tclass Local {};\r\n\t\tReporter.log(\"TestStepComponent\"+Local.class.getEnclosingMethod().getName());\r\n\t\tReporter.log(\"TestStepInput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepOutput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepExpectedResult:- continue Registartion button clicked in popu page\");\r\n\t\ttry{\r\n\r\n\t\t\twaitforElementVisible(locator_split(\"checkoutregistrationcontinue\"));\r\n\t\t\tclick(locator_split(\"checkoutregistrationcontinue\"));\r\n\r\n\t\t\tReporter.log(\"PASS_MESSAGE:- ccontinue Registartion button clicked in popu page\");\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tReporter.log(\"FAIL_MESSAGE:- continue Registartion button is not clicked in popu page\"+elementProperties.getProperty(\"_Regcontinuebutton\"));\r\n\t\t\tthrow new NoSuchElementException(\"The element with \"\r\n\t\t\t\t\t+ elementProperties.getProperty(\"checkoutregistrationcontinue\").toString().replace(\"By.\", \" \")\r\n\t\t\t\t\t+ \" not found\");\r\n\r\n\t\t}\r\n\r\n\r\n\t}", "@Override\r\n public void onClick(View v)\r\n {\n if (\"\" != mSendOnBoardEdit.getText().toString()){\r\n DJIDrone.getDjiMainController().sendDataToExternalDevice(mSendOnBoardEdit.getText().toString().getBytes(),new DJIExecuteResultCallback(){\r\n\r\n @Override\r\n public void onResult(DJIError result)\r\n {\r\n // TODO Auto-generated method stub\r\n \r\n }\r\n \r\n });\r\n }\r\n }", "public void verifierSaisie(){\n boolean ok = true;\n\n // On regarde si le client a ecrit quelque chose\n if(saisieMessage.getText().trim().equals(\"\"))\n ok = false;\n\n if(ok)\n btn.setEnabled(true); //activer le bouton\n else\n btn.setEnabled(false); //griser le bouton\n }", "public void clickSubmitInkAndTonnerSearchButton(){\r\n\r\n\t\tclass Local {};\r\n\t\tReporter.log(\"TestStepComponent\"+Local.class.getEnclosingMethod().getName());\r\n\t\tReporter.log(\"TestStepInput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepOutput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepExpectedResult:- Ink and Tonner Search Button should be clicked\");\r\n\t\ttry{\r\n\r\n\t\t\twaitforElementVisible(locator_split(\"btnInkSeacrh\"));\r\n\t\t\tclick(locator_split(\"btnInkSeacrh\"));\r\n\t\t\twaitForPageToLoad(10);\r\n\t\t\tReporter.log(\"PASS_MESSAGE:- Ink and Tonner Search Button is clicked\");\r\n\t\t\tSystem.out.println(\"Ink and Tonner Search icon is clicked\");\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tReporter.log(\"FAIL_MESSAGE:- Ink and Tonner Search Button is not clicked \"+elementProperties.getProperty(\"btnSearchSubmit\"));\r\n\t\t\tthrow new NoSuchElementException(\"The element with \"\r\n\t\t\t\t\t+ elementProperties.getProperty(\"btnInkSeacrh\").toString().replace(\"By.\", \" \")\r\n\t\t\t\t\t+ \" not found\");\r\n\r\n\t\t}\r\n\r\n\r\n\t}", "@Test\n public void testBestSellersButtonCheck() throws InterruptedException {\n bestSellersButtonCheck();\n Thread.sleep(8000);\n String actualText = driver.findElement(By.xpath(bestSellersActualText)).getText();\n Assert.assertEquals(actualText, bestSellersExpectedText);\n }", "@Test public void test() {\n click(\"#txfEmail\").\n type(SMALL_EMAIL_BODY).\n press(KeyCode.SHIFT).\n press(KeyCode.DIGIT2).\n release(KeyCode.SHIFT).\n release(KeyCode.DIGIT2).\n type(EMAIL_SERVER);\n click(\"#psfPassword\").type(PASS);\n click(\"#btnLogin\");\n sleep(3000);\n assertEquals(UStage.getInstance().getCurrentController().getClass(), CMain.class);\n verifyThat(\"#lblNickname\", hasText(NICK));\n verifyThat(\"#lblProfileName\", hasText(NAME));\n }", "@Test\n public void testHandleBtnAlterar() throws Exception {\n }", "@Test\n\tpublic void addButtons__wrappee__MuteTest() throws Exception {\n\t\tif (Configuration.featureamp &&\n\t\t\t\tConfiguration.playengine &&\n\t\t\t\tConfiguration.choosefile &&\n\t\t\t\tConfiguration.ogg &&\n\t\t\t\tConfiguration.skins &&\n\t\t\t\tConfiguration.light &&\n\t\t\t\tConfiguration.filesupport &&\n\t\t\t\tConfiguration.showtime &&\n\t\t\t\tConfiguration.volumecontrol &&\n\t\t\t\tConfiguration.shufflerepeat &&\n\t\t\t\tConfiguration.playlist &&\n\t\t\t\tConfiguration.mute\n\t\t) {\t\n\t\t\tstart();\n\n\t\t\t\n\t\t\tWhitebox.invokeMethod(gui, \"addButtons__wrappee__Mute\");\n\t\t\tJButton btnmute = (JButton) MemberModifier.field(Application.class, \"btnmute\").get(gui);\n\t\t\tassertTrue(btnmute.getIcon().toString().contains(\"unmute.png\"));\n\t\t}\n\t}", "@Test(dependsOnMethods = {\"register\"})\n void confirmEmailAddressByCaptcha() {\n common.findWebElementByXpath(\"//*[@id=\\\"content\\\"]/fieldset/label/div\").click();\n\n //Click on Send captcha button\n common.timeoutSeconds(2);\n common.findWebElementById(\"send-captcha-button\").click();\n\n //No magic code is set\n common.verifyStatusMessage(\"Det uppstod ett problem med verifieringen av att du är en människa. \" +\n \"Var god försök igen.\");\n }", "@And(\"^I click \\\"([^\\\"]*)\\\" button using mobile website$\")\n public void I_click_button_using_mobile_website(String button) throws Throwable {\n if (onPage(\"plenti_summary\")) {\n I_remove_the_plenti_points_from_profile();\n I_navigate_to_my_plenti_page_using_mobile_website();\n }\n\n switch (button.toLowerCase()) {\n case \"join for free\":\n// Clicks.clickWhenPresent(\"plenti_home.learn_more\");\n Wait.untilElementPresent(\"plenti_join.btn_join_now\");\n Wait.untilElementPresent(\"plenti_join.btn_join_now\");\n Assert.assertTrue(\"ERROR-ENV: Unable to locate join for free element\", !Elements.findElements(\"plenti_home.btn_join_free\").isEmpty());\n Clicks.clickIfPresent(\"plenti_join.btn_join_now\");\n Clicks.clickIfPresent(\"plenti_join.btn_join_now\");\n Clicks.clickIfPresent(\"plenti_join.btn_proceed\");\n // Clicks.click(Elements.findElements(\"plenti_home.btn_join_free\").get(0));\n break;\n// case \"join now\":\n// Navigate.visit(\"plenti_enroll\"); //This will directly navigate to plenty enroll page directly\n// // Wait.untilElementPresent(\"plenti_join.btn_join_now\");\n// // Assert.assertTrue(\"ERROR-ENV: Unable to locate join now element\", Elements.elementPresent(\"plenti_join.btn_join_now\"));\n// // Clicks.click(\"plenti_join.btn_join_now\");\n// break;\n case \"enroll cancel\":\n Wait.untilElementPresent(\"plenti_enroll.btn_cancel\");\n Assert.assertTrue(\"ERROR-ENV: Unable to locate enroll cancel element\", Elements.elementPresent(\"plenti_enroll.btn_cancel\"));\n Clicks.click(\"plenti_enroll.btn_cancel\");\n Assert.assertTrue(\"ERROR-ENV: Current environment is deviated in to a \" + url() + \" environment\", MEW());\n break;\n case \"yes, cancel\":\n Wait.forPageReady();\n Wait.untilElementPresent(\"plenti_enrollment_cancel_confirm.cancel_overlay\");\n Assert.assertTrue(\"ERROR-ENV: Unable to locate yes, cancel element\", Elements.elementPresent(\"plenti_enrollment_cancel_confirm.cancel_overlay\"));\n Clicks.click(\"plenti_enrollment_cancel_confirm.btn_yes_cancel\");\n // Assert.assertTrue(\"ERROR-ENV: Current environment is deviated in to a \" + url() + \" environment\", MEW());\n break;\n default:\n logger.info(\"Invalid button: \" + button);\n }\n }", "public abstract boolean onButtonClick(Player player, int button);", "@Test\n public void testCustomerServiceButtonCheck() throws InterruptedException {\n customerServiceButtonCheck();\n Thread.sleep(8000);\n String actualText = driver.findElement(By.xpath(customerServiceActualText)).getText();\n Assert.assertEquals(actualText, customerServiceExpectedText);\n }", "@Test\r\n\tpublic void testButtonPressedPopRackEmpty() {\r\n\t\tCoin coin = new Coin(200);\r\n\t\ttry {\r\n\t\t\tvend.getCoinSlot().addCoin(coin);\r\n\t\t\tvend.getSelectionButton(0).press();\r\n\t\t\tvend.getDeliveryChute().removeItems();\r\n\t\t\tvend.getCoinSlot().addCoin(coin);\r\n\t\t\tvend.getSelectionButton(0).press();\r\n\t\t\tassertTrue(vend.getDeliveryChute().removeItems().length==0);\t\t\t\t\r\n\t\t} catch (DisabledException e) {\r\n\t\t\tassertTrue(false);\r\n\t\t}\r\n\t}", "private void sendCustomBothActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendCustomBothActionPerformed\n // TODO add your handling code here:\n String custom = customMessageField.getText();\n Msg.send(\"Clicked custom both - message: \" + custom);\n sendCustomMessage(custom, \"A\");\n }", "@Then (\"click on compose button\")\npublic void composeMail()\n{\n\t\tdriver.findElement(By.xpath(\"//div[@class='T-I T-I-KE L3' and text()='Compose']\")).click();\n}", "@When(\"usert clicks on continue\")\r\n\tpublic void usert_clicks_on_continue() {\n\tdriver.findElement(By.id(\"btn\")).click();\r\n\t\r\n}", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tObject o = e.getSource();\n\t\tif (o.equals(conectButton)) {\n\t\t\ttry {\n\t\t\t\tConnect();\n\t\t\t} catch (Exception ex) {\n\t\t\t\tstateMsg(\"서버연결 에러 : \" + ex.getMessage());\n\t\t\t}\n\t\t\tconectButton.setEnabled(false);\n\t\t}\n\t\tif (o.equals(disconectButton)) {\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.DISCONNECT);\n\t\t\tpacket.Add(UserName);\n\t\t\tSend(packet);\n\t\t\tstateMsg(\"연결을 종료합니다. \\n\");\n\t\t\tdisconectButton.setEnabled(false);\n\t\t}\n\t\tif (o.equals(packetButton)) {\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.TESTPACKET);\n\t\t\tpacket.Add(\"패킷테스트\");\n\t\t\tpacket.Add(1001001);\n\t\t\tSend(packet);\n\t\t}\n\t\tif (o.equals(sendButton)) {\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.CHAT);\n\t\t\tpacket.Add(UserName);\n\t\t\tpacket.Add(\"\" + editText.getText());\n\t\t\teditText.setText(\"\");\n\t\t\tSend(packet);\n\t\t}\n\t\tif (o.equals(loginButton)) {\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.LOGIN);\n\t\t\tpacket.Add(\"\" + nameText.getText());\n\t\t\tUserName = nameText.getText();\n\t\t\tnameText.setText(\"\");\n\t\t\tnameLabel.setText(\"\" + UserName + \" 님\");\n\t\t\tSend(packet);\n\t\t\tloginButton.setEnabled(false);\n\t\t}\n\t\tif (o.equals(whisperButton)) {\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.WHISPER);\n\t\t\tpacket.Add(UserName);\n\t\t\tpacket.Add(\"\" + nameText.getText());\n\t\t\tpacket.Add(\"\" + editText.getText());\n\t\t\tnameText.setText(\"\");\n\t\t\teditText.setText(\"\");\n\t\t\tSend(packet);\n\t\t}\n\t\tif (o.equals(groupWaitButton)) {\n\t\t\tgroupWaitButton.setEnabled(false);\n\t\t\t// 그룹대기\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.GROUPWAIT);\n\t\t\tpacket.Add(UserName);\n\t\t\tSend(packet);\n\t\t}\n\t\tif (o.equals(groupSendButton)) {\n\t\t\t// 그룹전송\n\t\t\tpacket.Clear();\n\t\t\tpacket.Type(JNetPacket.GROUPSEND);\n\t\t\tpacket.Add(UserName);\n\t\t\tpacket.Add(\"\" + editText.getText());\n\t\t\teditText.setText(\"\");\n\t\t\tSend(packet);\n\t\t}\n\t}", "@Test\n public void testFreeShippingButtonCheck() throws InterruptedException {\n freeShippingButtonCheck();\n Thread.sleep(8000);\n String actualText = driver.findElement(By.xpath(freeShippingActualText)).getText();\n Assert.assertEquals(actualText, freeShippingExpectedText);\n }", "@Override\n\tpublic void onMessagePlayCompleted() {\n\t\tbtnSend.setEnabled(true);\n\t}", "@Test\r\n public void testSendFollowingRequest(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.enterText((EditText) solo.getView(R.id.add_following), \"NewTest\");\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"Following request has been sent!!\", 1,2000));\r\n\r\n }", "public String verifyButtonText(String object, String data) {\n\t\tlogger.debug(\"Verifying the button text\");\n\t\ttry {\n\n\t\t\tString actual = wait.until(explicitWaitForElement((By.xpath(OR.getProperty(object))))).getText();\n\t\t\tString expected = data.trim();\n\t\t\tif (actual.equals(expected))\n\t\t\t\treturn Constants.KEYWORD_PASS;\n\t\t\telse\n\t\t\t\treturn Constants.KEYWORD_FAIL + \" -- Button text not verified \" + actual + \" -- \" + expected;\n\t\t} \n\t\tcatch(TimeoutException ex)\n\t\t{\n\t\t\treturn Constants.KEYWORD_FAIL +\"TimeoutCause: \"+ ex.getCause();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\treturn Constants.KEYWORD_FAIL + \" Object not found \" + e.getMessage();\n\t\t\t\t\t}\n\n\t}", "@And(\"^I Should see Continue shopping button$\")\n public void iShouldSeeCountinueButton()throws Throwable{\n Assert.assertTrue(\"Continue shopping button is not present\", Elements.elementPresent(\"checkout.rc_test_element\"));\n Clicks.click(\"checkout.rc_test_element\");\n getWebDriver().navigate().back();\n }", "private void buttonCallback(String s) {\n // Print the name of the button for debugging purposes\n System.out.println(s);\n if(buttonNames.contains(s)) {\n // Make sure the button clicked on was actually visible\n if(buttonVisibilities.get(buttonNames.indexOf(s))) {\n // Switch through the possible button presses\n switch(s) {\n case \"Fo\":\n // Send a message to the server saying \"I want to fold\"\n GameLauncher.manager.mainPlayer.setFoldedSS(true);\n break;\n case \"Ch\":\n // Send a message to the server saying \"I want to call\"\n // This IS NOT a mistake. The server interprets calling and\n // checking as the same action, as they both fundamentally\n // do the same thing, but are just called something different\n // depending on the scenario.\n GameLauncher.manager.mainPlayer.setCallSS();\n break;\n case \"Ca\":\n // Send a message to the server saying \"I want to call\"\n GameLauncher.manager.mainPlayer.setCallSS();\n break;\n case \"Ra\":\n // Create a new JFrame to make a prompt out of\n JFrame frame = new JFrame(\"Enter new bet\");\n\n // prompt the user to enter their name\n while(true) {\n try {\n // Show an input dialog\n String betStr = JOptionPane.showInputDialog(frame, \"Enter your new bet here (must be above current bet)\");\n // Attempt to parse input\n int bet = Integer.parseInt(betStr);\n // Send a message to the server saying \"I want to bet ___ much\"\n GameLauncher.manager.mainPlayer.setBetSS(bet);\n break;\n } catch (Exception e) {\n // Print that there was invalid input, then ignore it and move on\n System.out.println(\"Bad Input!\");\n break;\n }\n }\n break;\n case \"St\":\n // Handl game start request by sending the server a message saying \"I want to start ___ server\"\n String res=HTTPUtils.sendGet(GameLauncher.SERVER_URL+\"/startServer?uuid=\"+game.serverUuid);\n // If the response contains an error message, then say there's not enough players.\n // It is assumed that it is a lack of players error, because that is the only error the\n // server will send back from this command.\n if(res.contains(\"error\")) {\n JOptionPane.showMessageDialog(new JFrame(), \"Not enough players!\", \"\", JOptionPane.WARNING_MESSAGE);\n }\n break;\n }\n }\n }\n }", "@Test\n public void testNewReleasesButtonCheck() throws InterruptedException {\n newReleasesButtonCheck();\n Thread.sleep(8000);\n String actualText = driver.findElement(By.xpath(newReleasesActualText)).getText();\n Assert.assertEquals(actualText, newReleasesExpectedText);\n }", "@Test\n\tpublic void testSayMessageOnRequest(){\n\t\tSystem.out.println(\"\\nMensajes aleatorios al aparecer el Meesek:\\n\");\n\t\tMrMe.sayMessageOnRequest();\n\t\tMrMe.sayMessageOnRequest();\n\t\tMrMe.sayMessageOnRequest();\n\t}", "private void customSendRedButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customSendRedButtonActionPerformed\n String custom = customMessageField.getText();\n Msg.send(\"Clicked - message: \" + custom);\n sendCustomMessage(custom, \"R\");\n }", "private void createSendButton(GridBagConstraints gridBagConstraint) {\r\n sendButton = new WebButton(topModel.getSendButtonText());\r\n sendButton.setPreferredSize(new Dimension(120, 35));\r\n sendButton.setBottomBgColor(Color.BLACK);\r\n sendButton.setTopBgColor(Color.BLACK);\r\n sendButton.setBottomSelectedBgColor(Color.WHITE);\r\n sendButton.setTopSelectedBgColor(Color.WHITE);\r\n sendButton.setForeground(Color.WHITE);\r\n sendButton.setDrawShade(false);\r\n sendButton.setFont(new Font(ClientConstants.FONT_NAME, Font.BOLD, FONT_SIZE));\r\n sendButton.setHorizontalAlignment(SwingConstants.CENTER);\r\n sendButton.setEnabled(false);\r\n gridBagConstraint.fill = GridBagConstraints.HORIZONTAL;\r\n gridBagConstraint.weighty = 2.0;\r\n gridBagConstraint.gridx = 2;\r\n gridBagConstraint.gridy = 1;\r\n gridBagConstraint.ipady = 0;\r\n gridBagConstraint.insets = new Insets(0, 10, 0, 0);\r\n add(sendButton, gridBagConstraint);\r\n }", "void okButtonClicked();", "public static void checkAndClickQuitButtonStartPlayingPage() {\r\n\t\tcheckNoSuchElementExceptionByXPath(\"//*[@id=\\\"secondepage\\\"]/center/button[2]\", \"\\\"Quit\\\" button of Start playing page\");\r\n\t\tcheckElementNotInteractableExceptionByXPath(\"//*[@id=\\\"secondepage\\\"]/center/button[2]\", \"\\\"Quit\\\" button of Start playing page\");\r\n\t}", "@Test(enabled = true, priority = 8)\n\tpublic void loginButtonTest03() {\n\t\tdriver.findElement(By.cssSelector(\"#cms-login-submit\")).click();\n\n\t}", "@Test(timeout = 4000)\n public void test267() throws Throwable {\n Submit submit0 = new Submit((Component) null, \".\\\"=_m?KP<D\\\"\", \"I&{b+CI\");\n ActionExpression actionExpression0 = submit0.action(\"\");\n assertFalse(actionExpression0.isSubmissible());\n }", "public void acceptAndProceed()\r\n {\r\n\t driver.findElement(By.id(\"PCNChecked\")).click();\r\n\t driver.findElement(By.xpath(\"/html/body/div[1]/div/div/main/div/main/div/div/div[1]/div/div/form/fieldset/div[3]/div[2]/button\")).click();\r\n }", "void userPressConnectButton();", "public void clickOnContinueButton() throws Exception {\n\t\twdriver.switchTo().frame(\"ifmail\");\n\t\twaitForElement.waitForElement(\"html/body/div[1]/div[3]/div[2]/div/div[1]/table[1]/tbody/tr[1]/td[2]/a\");\n\t\twdriver.findElement(By.xpath(\"html/body/div[1]/div[3]/div[2]/div/div[1]/table[1]/tbody/tr[1]/td[2]/a\")).click();\n\t}", "@Test\n public void test_rf_continue_button_opens_correct_activity() {\n //Click the positive button in the dialog\n onView(withText(\"I understand\")).perform(click());\n //Find the views and perform action\n onView(withId(R.id.redFlag_continue)).perform(click());\n //Check if action returns desired outcome\n intended(hasComponent(ObservableSignsActivity.class.getName()));\n }", "private JButton initializeSendButton() {\r\n\t\tJButton sendButton = new JButton(\"Send\");\r\n\t\tsendButton.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// send message which taken from text field.\r\n\t\t\t\ttry {\r\n\t\t\t\t\tnotifyMessageFromUI();\r\n\t\t\t\t\tchatArea.append(messageField.getText() + \"\\n\");\r\n\t\t\t\t\tmessageField.setText(\"\");\r\n\t\t\t\t} catch (IOException e1) {\r\n\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn sendButton;\r\n\t}" ]
[ "0.7155129", "0.6690007", "0.6493338", "0.64661276", "0.64640033", "0.6458423", "0.6447844", "0.6377239", "0.63707525", "0.63704747", "0.6367409", "0.63566506", "0.63439375", "0.63335437", "0.6325426", "0.62933487", "0.62669075", "0.6263338", "0.62610495", "0.6259407", "0.6256534", "0.6251559", "0.62301093", "0.62288475", "0.61857224", "0.61327434", "0.61198676", "0.6104043", "0.60980415", "0.6092785", "0.60906583", "0.6087892", "0.6067745", "0.6057801", "0.60470134", "0.60442215", "0.6038456", "0.6021832", "0.60052836", "0.59954154", "0.5989398", "0.5975775", "0.5967145", "0.59670806", "0.59669936", "0.596561", "0.596294", "0.59593785", "0.5954451", "0.5944158", "0.5940404", "0.59386617", "0.59074396", "0.5902958", "0.59012467", "0.59001666", "0.5891125", "0.5888222", "0.5885905", "0.58749163", "0.5870986", "0.58643657", "0.58588266", "0.5855185", "0.5853485", "0.585137", "0.58430696", "0.5840536", "0.58350503", "0.58329654", "0.5832154", "0.58293295", "0.5826045", "0.58236426", "0.58195704", "0.5818471", "0.5817929", "0.5817221", "0.58158606", "0.5810388", "0.58086014", "0.58056384", "0.5802518", "0.5799143", "0.5797578", "0.57960886", "0.5786796", "0.5786093", "0.57741946", "0.5772716", "0.57676536", "0.57668465", "0.57641786", "0.5764003", "0.5757194", "0.57531714", "0.5748158", "0.5744994", "0.5739282", "0.5734513", "0.5731979" ]
0.0
-1
test that the edit text view is not null when the activity is run
@Test public void testEditTextExists(){ ViewInteraction appCompatEditTextView = onView(withId(R.id.input)); appCompatEditTextView.perform(replaceText("testEditTextExists"), closeSoftKeyboard()); onView(withId(R.id.fab)).perform(click()); EditText input = messagesActivity.input; assertNotNull(input); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testEditTextCleanup() throws Exception {\n\n // perform text input\n onView(withId(R.id.editText))\n .perform(typeText(LOG_TAG));\n\n // click pin button\n onView(withText(R.string.button_name))\n .perform(click());\n\n // verify empty edittext\n onView(withId(R.id.editText))\n .check(matches(withText(\"\")));\n }", "public void CheckEditTextIsEmptyOrNot()\r\n {\r\n ename_holder = name_event.getText().toString();\r\n edesc_holder = desc_event.getText().toString();\r\n eloc_holder = loc_event.getText().toString();\r\n edate_holder = date_event.getText().toString();\r\n etime_holder = time_event.getText().toString();\r\n elat_holder = lat_event.getText().toString();\r\n elong_holder = long_event.getText().toString();\r\n\r\n if(TextUtils.isEmpty(ename_holder) || TextUtils.isEmpty(edesc_holder) || TextUtils.isEmpty(eloc_holder) || TextUtils.isEmpty(edate_holder) || TextUtils.isEmpty(etime_holder) || TextUtils.isEmpty(elat_holder) || TextUtils.isEmpty(elong_holder))\r\n {\r\n CheckEditText = false;\r\n }\r\n else\r\n {\r\n CheckEditText = true;\r\n }\r\n }", "@Test\n public void testMessageTimeNotNull(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testMessageTime\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n TextView messageTime= messagesActivity.messageTime;\n assertNotNull(messageTime);\n }", "@Test\n public void testEditTextContent() throws Exception {\n\n onView(withId(R.id.editText))\n .perform(typeText(LOG_TAG))\n .check(matches(withText(LOG_TAG)));\n }", "@Test\n public void researchEditTextInputTest() {\n onView(withId(R.id.network_input_research))\n .perform(typeText(INPUT_TEXT))\n .check(matches(withText(INPUT_TEXT)));\n }", "@MediumTest\n\t public void testInfoTextViewText_isEmpty() {\n\t assertEquals(\"\", mtextView1.getText());\n\t }", "private void emptyInputEditText() {\n mNameText.setText(null);\n mEmailText.setText(null);\n mPasswordText.setText(null);\n mConfirmPasswordText.setText(null);\n }", "public void CheckEditTextStatus(){\n\n // Getting value from All EditText and storing into String Variables.\n NameHolder = Name.getText().toString();\n EmailHolder = Email.getText().toString();\n PasswordHolder = Password.getText().toString();\n\n // Checking EditText is empty or no using TextUtils.\n if( TextUtils.isEmpty(NameHolder)|| TextUtils.isEmpty(EmailHolder)|| TextUtils.isEmpty(PasswordHolder)){\n\n EditTextEmptyHolder = false ;\n\n }\n else {\n\n EditTextEmptyHolder = true ;\n }\n }", "public boolean textboxIsEmpty(EditText editText) {\n return editText.getText().toString().trim().length() == 0;\n }", "private void emptyInputEditText() {\n nomeLogin.setText(null);\n emailLogin.setText(null);\n senhaLogin.setText(null);\n senhaLoginConfirmar.setText(null);\n }", "@Test\n public void testEditTextHasCorrectID(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testEditTextHasCorrectID\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n EditText input = messagesActivity.input;\n int ID = input.getId();\n int expectedID = R.id.input;\n assertEquals(ID, expectedID);\n }", "@UiThreadTest\r\n public void testValidationRequired() {\n View addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n View addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be gone\", View.GONE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be gone\", View.GONE, addProjectValidateUnique.getVisibility());\r\n\r\n // Try to add with empty values\r\n ActionBar.clickMenuItem(R.id.menu_add_project_activity_save, solo.getCurrentActivity());\r\n solo.assertCurrentActivity(\"The add/edit project activity is expected\", AddEditProjectActivity.class);\r\n addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be visible\", View.VISIBLE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be gone\", View.GONE, addProjectValidateUnique.getVisibility());\r\n }", "private boolean isEmptyField (EditText editText){\n boolean result = editText.getText().toString().length() <= 0;\n if (result)\n Toast.makeText(UserSignUp.this, \"Fill all fields!\", Toast.LENGTH_SHORT).show();\n return result;\n }", "boolean isEmpty(EditText text){\n CharSequence check = text.getText().toString().trim();\n return TextUtils.isEmpty(check);\n }", "private boolean checkEmptyEditText(EditText text, TextInputLayout TFB, String massage) {\n\n if (text.getText().toString().isEmpty())\n {\n TFB.setErrorEnabled(true);\n TFB.setError(massage);\n return false;\n\n }\n else\n {\n TFB.setErrorEnabled(false);\n return true;\n }\n\n }", "@Test\n public void homeActivityShouldHaveAHello() {\n View hello = homeActivity.findViewById(R.id.email_text_view_home);\n assertThat(hello).isNotNull();\n }", "public static void emptyEditText(EditText editText) {\n if (editText != null) {\n editText.setText(\"\");\n }\n }", "public boolean isEmpty(EditText etText){\n return etText.getText().toString().length() == 0;\n }", "@Override\r\n public void onClick(View view) {\n CheckEditTextIsEmptyOrNot();\r\n\r\n if(CheckEditText)\r\n {\r\n // if CheckEditText is true\r\n EventDataFunction(ename_holder,edesc_holder,eloc_holder,edate_holder,etime_holder,elat_holder,elong_holder);\r\n }\r\n else\r\n {\r\n // if CheckEditText is false\r\n Toast.makeText(AdminActivity.this,\"Please fill all the fields.\",Toast.LENGTH_LONG).show();\r\n }\r\n }", "private void emptyInputEditText() {\n textInputEditTextUsername.setText(null);\n textInputEditTextPassword.setText(null);\n }", "@Test\n public void FNameEmpty () {\n onView(withId(R.id.username)).check(matches(isDisplayed()));\n //change name to empty\n onView(withId(R.id.username)).perform(replaceText(\"\"));\n //click the button\n onView(withId(R.id.save)).perform(click());\n // check toast visibility\n onView(withText(R.string.EmptyName))\n .inRoot(new ToastMatcher())\n .check(matches(withText(R.string.EmptyName)));\n //check activity still shown\n assertFalse(activityTestRule.getActivity().isFinishing());\n }", "private void assertActivityNotNull() {\n if (mActivity == null) {\n mActivity = getActivity();\n assertNotNull(mActivity);\n }\n }", "@Override\n public void onTextChanged(CharSequence s, int start, int before, int count) {\n if (editText.getTag() == null) {\n hasBeenSetManually = true;\n }\n }", "private boolean isEmpty(EditText etText) {\n return etText.getText().toString().trim().length() <= 0;\n }", "public void testCtorIfTextFieldNull() {\n try {\n new EditBoxTrigger(null);\n fail(\"IllegalArgumentException is excpected because textField cannot be null.\");\n } catch (IllegalArgumentException e) {\n //success\n }\n }", "@Override\n public void onClick(View v) {\n String inputFieldText = ((TextView) findViewById(R.id.inputField)).getText().toString();\n\n // Set text to custom text, or if custom text is empty set to default hint\n if (inputFieldText.isEmpty()) {\n ((TextView) findViewById(R.id.text)).setText(\"Enter your OWN text!\");\n } else {\n ((TextView) findViewById(R.id.text)).setText(inputFieldText);\n }\n }", "private static boolean isEmpty(EditText etText) {\n if (etText.getText().toString().trim().length() > 0)\n return false;\n\n return true;\n }", "public void testSetText_NullText() throws Exception {\n try {\n textInputBox.setText(null);\n fail(\"Expect IllegalArgumentException.\");\n } catch (IllegalArgumentException iae) {\n // expect\n }\n }", "private boolean checkInputValidation(){\n if(facility_EDT_value.getText().toString().trim().isEmpty()){\n Toast.makeText(getContext(), \"Please enter search value!\", Toast.LENGTH_LONG).show();\n return false;\n }\n return true;\n }", "@Test\n public void lookUpAddItemActivity(){\n TextView addItemToList = (TextView) addItemActivity.findViewById(R.id.textView5);\n EditText itemName = (EditText) addItemActivity.findViewById(R.id.itemNameEditText);\n EditText itemType = (EditText) addItemActivity.findViewById(R.id.itemTypeEditText);\n EditText itemQty = (EditText) addItemActivity.findViewById(R.id.itemQuantityEditText);\n EditText itemUnit = (EditText) addItemActivity.findViewById(R.id.itemUnitEditText);\n Button add = (Button) addItemActivity.findViewById(R.id.addItemToListButton);\n\n assertNotNull(\"Add Item to List TextView could not be found in AddItemActivity\", addItemToList);\n assertNotNull(\"Item Name EditText could not be found in AddItemActivity\", itemName);\n assertNotNull(\"Item Type EditText could not be found in AddItemActivity\", itemType);\n assertNotNull(\"Item Quantity EditText could not be found in AddItemActivity\", itemQty);\n assertNotNull(\"Item Unit EditText could not be found in AddItemActivity\", itemUnit);\n assertNotNull(\"Add Item to List button could not be found in AddItemActivity\", add);\n }", "private boolean isEmpty(EditText etText) {\n\t\tif (etText.getText().toString().trim().length() > 0)\n\t\t\treturn false;\n\t\telse\n\t\t\treturn true;\n\t}", "private void catcher() {\n String text;\n\n if (getTextFromEditText(R.id.distanceEdit).equals(\"\")) {\n text = getResourceString(R.string.err_no_distance);\n } else if (getTextFromEditText(R.id.fuelEdit).equals(\"\")) {\n text = getResourceString(R.string.err_no_fuel);\n } else {\n text = getResourceString(R.string.err_wrong_vals);\n }\n\n makeToast(text);\n }", "private void checkEditTexts() {\n\n if (!validateEmail(Objects.requireNonNull(edInputEmail.getText()).toString().trim())) {\n Toasty.error(Objects.requireNonNull(getActivity()), getString(R.string.error_invalid_email), Toasty.LENGTH_SHORT, true).show();\n } else {\n\n if (Objects.requireNonNull(edInputPass.getText()).toString().trim().equalsIgnoreCase(\"\")) {\n\n Toasty.error(Objects.requireNonNull(getActivity()), getString(R.string.error_empty_password), Toasty.LENGTH_SHORT, true).show();\n\n } else {\n sendLoginRequest(edInputEmail.getText().toString(), edInputPass.getText().toString());\n CustomProgressBar.showProgress(loadingLayout);\n }\n }\n }", "private boolean isEmpty(TextInputEditText textInputEditText) {\n if (textInputEditText.getText().toString().trim().length() > 0)\n return false;\n return true;\n }", "@Override\n public void onClick(View v) {\n String userEnteredText = ((EditText) findViewById(R.id.editText)).getText().toString();\n\n // If the text field is empty , update label with default text string.\n if (userEnteredText.isEmpty()) {\n textView.setText(\"Enter your own text\");\n } else {\n textView.setText(userEnteredText);\n }\n }", "@Test\n public void textViewIndicatingTheTopic_isCorrectlyFilled() {\n // When perform a click on an item\n onView(withId(R.id.recyclerview))\n .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));\n // Then : MeetingDetailsActivity is launched\n onView(withId(R.id.activity_meeting_details));\n //The TextView is correctly filled\n onView(withId(R.id.detail_topic))\n .check(matches(withText(\"Mareu_0\")));\n }", "@Test\n public void autoCom(){\n onView(withId(R.id.autoCompleteTextView))\n .perform(typeText(\"So\"), closeSoftKeyboard());\n\n\n onView(withText(\"Southern Ocean\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .check(matches(isDisplayed()));\n\n onView(withText(\"South China Sea\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .check(matches(isDisplayed()));\n }", "@Test\r\n public void testNotExistUser(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.enterText((EditText) solo.getView(R.id.add_following), \"yifan30\");\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"The username does not exist!!\", 1,2000));\r\n\r\n }", "public boolean checkBlankCorrectness(LinearLayout layout) {\n boolean isCorrect = false;\n int count = layout.getChildCount();\n try {\n for (int i = 0; i < count; i++) {\n EditText view = ((EditText) layout.getChildAt(i));\n if (!TextUtils.isEmpty(view.getTag().toString().trim())) {\n\n /*Replacing ck-editor ghost character with blank*/\n String correctAnswer = view.getTag().toString().trim();\n correctAnswer = correctAnswer.replace(ConstantUtil.CK_EDITOR_GHOST_CHARACTER, ConstantUtil.BLANK);\n\n isCorrect = correctAnswer.trim().equalsIgnoreCase(view.getText().toString().trim());\n\n } else {\n return false;\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n return isCorrect;\n }", "public void setEditText(CharSequence text) {\n\t\tif (View.VISIBLE == editText.getVisibility()) {\n\t\t\tif (StringUtil.isEmpty(text)) {\n\t\t\t\teditText.setText(\"\");\n\t\t\t}else {\n\t\t\t\teditText.setText(text);\n\t\t\t}\n\t\t}\n\t}", "void assertDefaults() {\n verifyLayoutDirection(getView());\n verifySubmitButton(EditorInfo.IME_ACTION_DONE, getView());\n assertEquals(0, getView().getFilters().length);\n assertEquals(InputType.TYPE_CLASS_TEXT, getView().getInputType());\n assertEquals(0, getView().getFilters().length);\n assertEquals(\"\", getView().getText().toString());\n assertEquals(\"\", getView().getHint().toString());\n assertEquals(mockDefaultTypeface, getView().getTypeface());\n }", "public void onClickSubmitViewItem(View view)\n {\n EditText itemToSearchView = (EditText) findViewById(R.id.itemToViewEditTextId);\n String itemToSearch = itemToSearchView.getText().toString();\n if (!itemToSearch.equals (\"\"))\n invokeViewItem(itemToSearch);\n else Toast.makeText(getApplicationContext(), \"No item has been entered\", Toast.LENGTH_LONG).show();\n }", "@Test\n public void ensureTextChangesWork(){\n onView(withId(R.id.placeEditText)).perform(typeText(\"London\"));\n\n // Check that the language text was changed.\n onView(withId(R.id.languageEditText)).perform(typeText(\"It\"));\n\n // Check that the language text was changed.\n onView(withId(R.id.maxrowsEditText)).perform(typeText(\"3\"));\n\n // check button click\n onView(withId(R.id.button)).perform(click());\n\n // check returned list view\n onView(withId(R.id.listViewResult)).check(matches(isDisplayed()));\n }", "@Override\n public void onViewCreated(View view, Bundle savedInstanceState) {\n // EditText etFoo = (EditText) view.findViewById(R.id.etFoo);\n }", "@Test\n public void lookUpMainActivity(){\n ListView lv = (ListView) mainActivity.findViewById(R.id.listView);\n EditText et = (EditText) mainActivity.findViewById(R.id.newListEditText);\n Button addNewList = (Button) mainActivity.findViewById(R.id.addNewListButton);\n\n assertNotNull(\"ListView could not be found in MainActivity\", lv);\n assertNotNull(\"EditText could not be found in MainActivity\", et);\n assertNotNull(\"Add new list button could not be found in MainActivity\", addNewList);\n }", "@Test\n public void testLaunch(){\n assertNotNull(mActivity.findViewById(R.id.createAccountTextView));\n assertNotNull(mActivity.findViewById(R.id.createAccountButton));\n assertNotNull(mActivity.findViewById(R.id.nameEditText));\n assertNotNull(mActivity.findViewById(R.id.emailEditText));\n assertNotNull(mActivity.findViewById(R.id.passwordEditText));\n assertNotNull(mActivity.findViewById(R.id.passwordImageView));\n assertNotNull(mActivity.findViewById(R.id.emailImageView));\n assertNotNull(mActivity.findViewById(R.id.personImageView));\n assertNotNull(mActivity.findViewById(R.id.spinner2));\n assertNotNull(mActivity.findViewById(R.id.arrowImageView));\n assertNotNull(mActivity.findViewById(R.id.progressBar));\n assertNotNull(mActivity.findViewById(R.id.backButton));\n }", "void accept(@NotNull T editText);", "@Override\n\tpublic void onFocusChange(View v, boolean hasFocus) {\n\t\tEditText et = (EditText) v;\n\t\tString txt = et.getText().toString();\n\t\tif (txt.equals(\"\")) {\n\t\t\tet.setText(\"0\");\n\t\t}\n\t}", "private void verifyInput(){\n String firstName = mFirstNameField.getText().toString();\n String lastName = mLastNameField.getText().toString();\n\n mNameFieldsFilled = !TextUtils.isEmpty(firstName) && !TextUtils.isEmpty(lastName);\n\n }", "@Override\r\n public boolean checkNull() {\r\n // Check if the two textfields are null or default \r\n return newIng_ingName.getText().equals(\"\") || newIng_ingCal.getText().equals(\"\");\r\n }", "@Test\r\n public void changeText_FailedTest() {\n onView(withId(R.id.inputField)).perform(typeText(\"NewText\"),\r\n closeSoftKeyboard());\r\n reportHelper.label(\"myTestStepLabel_3_1\");\r\n onView(withId(R.id.switchActivity)).perform(click());\r\n\r\n reportHelper.label(\"myTestStepLabel_3_2\");\r\n // This view is in a different Activity, no need to tell Espresso.\r\n onView(withId(R.id.resultView)).check(matches(withText(\"errrrrrr\")));\r\n }", "@Test\r\n public void studNoText() {\r\n onView(withId(R.id.Stud_id)).perform(typeText(\"123456\"));\r\n }", "@Test\n public void wrongEmail(){\n solo .sleep (1000);\n solo.assertCurrentActivity(\"Wrong activity\", UserProfileActivity.class);\n TextView view = null ;\n\n String correctEmail = firebaseAuth.getCurrentUser().getEmail();\n view = (TextView) solo .getView ( \"user_email\" );\n assertEquals ( correctEmail , view.getText());\n }", "@Test\n public void emailAlreadySetTest(){\n\n when(DatabaseInitializer.getEmail(appDatabase)).thenReturn(string);\n when(ContextCompat.getColor(view.getContext(), num)).thenReturn(num);\n\n reportSettingsPresenter.emailAlreadySet(button, editText);\n\n verify(editText, Mockito.times(1)).setClickable(false);\n verify(editText, Mockito.times(1)).setEnabled(false);\n //verify(editText, Mockito.times(1)).setTextColor(num);\n verify(editText, Mockito.times(1)).setText(null);\n\n verify(button, Mockito.times(1)).setOnClickListener(any(View.OnClickListener.class));\n\n verify(databaseInitializer,Mockito.times(1));\n DatabaseInitializer.setEmail(appDatabase, string);\n\n }", "@UiThreadTest\r\n public void testValidationUnique() {\n View addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n View addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be gone\", View.GONE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be gone\", View.GONE, addProjectValidateUnique.getVisibility());\r\n\r\n // Enter the name of the default project that is already in use...\r\n EditText addProjectName = (EditText) solo.getView(R.id.projectname);\r\n solo.enterText(addProjectName, getActivity().getString(R.string.default_project_name));\r\n\r\n takeScreenshot();\r\n\r\n ActionBar.clickMenuItem(R.id.menu_add_project_activity_save, solo.getCurrentActivity());\r\n solo.assertCurrentActivity(\"The add/edit project activity is expected\", AddEditProjectActivity.class);\r\n addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be gone\", View.GONE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be visible\", View.VISIBLE, addProjectValidateUnique.getVisibility());\r\n }", "private Boolean isFieldEmpty(EditText field) {\n return field.getText().toString().trim().equals(\"\");\n }", "@Override\n public void onClick(View view) {\n if (mEdtTask.getText().toString().trim().matches(\"\") && mEdtDuration.getText().toString().trim().matches(\"\")){\n Toast.makeText(MainActivity.this, \"Empty field\", Toast.LENGTH_SHORT).show();\n } else {\n try {\n mSQLiteHelper.insertData(\n mEdtTask.getText().toString().trim(),\n mEdtDuration.getText().toString().trim(),\n mEdtStatus.getText().toString().trim()\n );\n Toast.makeText(MainActivity.this, \"Added successfully\", Toast.LENGTH_SHORT).show();\n //reset views\n mEdtTask.setText(\"\");\n mEdtDuration.setText(\"\");\n mEdtStatus.setText(\"\");\n }\n catch (Exception e){\n e.printStackTrace();\n }\n }\n }", "private void initComponent() {\n\n mEdit = (EditText) findViewById(R.id.edit_key);\n }", "public static boolean isEditTextEmpty(EditText editText, String warning) {\n\t\treturn isEditTextEmpty(editText, warning, null);\n\t}", "@UiThreadTest\r\n public void testUserNotNull() {\r\n Intent loginIntent = new Intent();\r\n PomoUser user = new PomoUser(\"9a36d2f9018aacde1430411867961\", \"test\", \"1\", false, true, 1, 1);\r\n loginIntent.putExtra(ExtraName.POMO_USER, user);\r\n mainActivity.onActivityResult(1, Activity.RESULT_OK, loginIntent);\r\n assertNotNull(mainActivity.getUser());\r\n }", "@MediumTest\n\t public void testInfoTextView_layout() {\n\t final View decorView = mMainActivity.getWindow().getDecorView();\n\n\t //Verify that the mInfoTextView is on screen and is not visible\n\t ViewAsserts.assertOnScreen(decorView, mtextView1);\n\t assertTrue(View.GONE == mtextView1.getVisibility());\n\t }", "public boolean setEditView(int editViewID, String text){\n try {\n EditText editview = (EditText) findViewById(editViewID);\n editview.setText(text);\n Log.i(\"MenuAndDatabase\",\"setEditText: \" + editViewID + \", message: \" + text);\n return false;\n }\n catch(Exception e){\n Log.e(\"MenuAndDatabase\", \"error setting editText: \" + e.toString());\n return true;\n }\n }", "@Override\n public void afterTextChanged(Editable s) {\n\n if(!txt_codigo.getText().toString().equals(\"\")){\n //LLAMAR AL METODO QUE COMPRUEBA SI EL CODIGO INGRESADO ES VALIDO O NO (TRUE O FALSE)\n //IF(CODIGO ES VALIDO) ENTONCES TOAST = CODIGO AGREGADO ELSE CODIGOERRONEO\n\n //TXT.CODIGO.SETTEXT(\"\");\n }\n }", "private void setupView()\n\t{\n\t\tnameET = (EditText)findViewById(R.id.newPlaceName);\n\t\taddressET = (EditText)findViewById(R.id.placeAddress);\n\t\tcityET = (EditText)findViewById(R.id.cityET);\n\t\t\n\t\tView b = findViewById(R.id.placeBtnCancel);\n\t\tb.setOnTouchListener(TOUCH);\n\t\tb.setOnClickListener(this);\n\n\t\tView b2 = findViewById(R.id.btnAcceptPlace);\n\t\tb2.setOnTouchListener(TOUCH);\n\t\tb2.setOnClickListener(new View.OnClickListener() {\n\t\t @Override\n\t\t public void onClick(View v) {\n\t\t \tplacename = nameET.getText().toString();\n\t\t \tplaceaddress = addressET.getText().toString();\n\t\t \tplacecity = cityET.getText().toString();\n\t\t \tif(placename.equals(\"\") || placeaddress.equals(\"\") || placecity.equals(\"\")){\n\t\t \t\tToast.makeText(context, \"Fill in all fields!\", Toast.LENGTH_SHORT).show();\n\t\t \t\tfinish();\n\t\t \t\treturn;\n\t\t \t}\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\tList<Address> list = gc.getFromLocationName(placeaddress + placecity, 1);\n\t\t\t\t\tif(list.size() == 0){\n\t\t\t \t\tToast.makeText(context, \"Place does not exist!\", Toast.LENGTH_SHORT).show();\n\t\t\t \t\tfinish();\n\t\t\t \t\treturn;\n\t\t\t \t}\n\t\t\t\t\tAddress add = list.get(0);\n\t\t\t\t\tDouble lat = add.getLatitude();\n\t\t\t\t\tDouble lng = add.getLongitude();\n\t\t\t\t\tPlace p = new Place(placename, placeaddress, placecity, ID, String.valueOf(lat), String.valueOf(lng));\n\t\t\t\t\tcurrentMember.addPlace(p);\n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnew UpdatePlaceTask(lat, lng).execute().get();\n\t\t\t\t\t\tInputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);\n\t\t\t\t\t\timm.hideSoftInputFromWindow(cityET.getWindowToken(),0);\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t} \n\t\t\t\t\t\n\t\t\t\t} catch (IOException e1) {\n\t\t\t\t\te1.printStackTrace();\n\t\t\t\t}\n\t\t }\n\t\t});\n\t}", "public String getEditText() {\n\t\tif (View.VISIBLE == editText.getVisibility()) {\n\t\t\treturn editText.getText().toString().trim();\n\t\t}else {\n\t\t\treturn \"\";\n\t\t}\n\t}", "public boolean validateData(){\n boolean dataOk=true;\n if (etName.getText().toString().equals(\"\")){\n Log.i(\"ProfileEditActivity\",\"Name field is void.\");\n dataOk=false;\n }\n if (etSurname.getText().toString().equals(\"\")){\n Log.i(\"ProfileEditActivity\",\"Surname field is void.\");\n dataOk=false;\n }\n if (etDescription.getText().toString().equals(\"\")){\n Log.i(\"ProfileEditActivity\",\"Description field is void.\");\n dataOk=false;\n }\n return dataOk;\n }", "@Before\r\n public void setUp() throws Exception{\r\n solo = new Solo(InstrumentationRegistry.getInstrumentation(),rule.getActivity());\r\n solo.enterText((EditText) solo.getView(R.id.username), \"yifan\");\r\n solo.clickOnView(solo.getView(R.id.cancel2));\r\n solo.sleep(3000);\r\n }", "private void setupView() {\n\t\tphoneEditView = (EditText) findViewById(R.id.edit_phone);\n\n\t\tconfirmBtn = (ImageView) findViewById(R.id.btnStart);\n\t\tconfirmBtn.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tboolean isRegularPhoneNumber = phoneEditView.getText()\n\t\t\t\t\t\t.toString().matches(\"[0-9]{10}\");\n\t\t\t\tphoneCheckRes(isRegularPhoneNumber);\n\t\t\t}\n\t\t});\n\t}", "@Override\r\n\t\t\tpublic void beforeTextChanged(CharSequence arg0, int arg1,\r\n\t\t\t\t\tint arg2, int arg3) {\n\t\t\t\tString edit = keyword.getText().toString();\r\n\t\t\t\tLog.i(\"cheshi\", \"洛克萨斯edit:\" + edit);\r\n\t\t\t\tif (edit.length() == 0 && edit.equals(\"null\")) {\r\n\t\t\t\t\tdelete.setVisibility(delete.GONE);\r\n\t\t\t\t\tLog.i(\"cheshi\", \"洛克萨斯\");\r\n\t\t\t\t}\r\n\r\n\t\t\t}", "public static boolean isEmpty(EditText et) {\n return TextUtils.isEmpty(et.getText().toString().trim());\n }", "protected boolean isFieldEmpty(EditText text) {\n if (text.getText().toString().trim().length() == 0) {\n text.setError(getString(R.string.empty_field));\n text.requestFocus();\n return true;\n }\n return false;\n }", "@Override\r\n public void afterTextChanged(Editable editable) {\n checkFieldsForEmptyValues();\r\n }", "@UiThreadTest\r\n public void testAddValidProject() {\n View addProjectValidateRequired = solo.getView(R.id.projectname_required);\r\n View addProjectValidateUnique = solo.getView(R.id.projectname_unique);\r\n assertEquals(\"The validation error message 'required' should be gone\", View.GONE, addProjectValidateRequired.getVisibility());\r\n assertEquals(\"The validation error message 'unique' should be gone\", View.GONE, addProjectValidateUnique.getVisibility());\r\n\r\n // Enter a project name and save\r\n EditText addProjectName = (EditText) solo.getView(R.id.projectname);\r\n solo.enterText(addProjectName, \"A custom project name\");\r\n ActionBar.clickMenuItem(R.id.menu_add_project_activity_save, solo.getCurrentActivity());\r\n solo.waitForDialogToClose(TestUtil.Time.FIVE_SECONDS);\r\n assertEquals(\"As the activity should be ended no views are expected to be found!\", 0, solo.getCurrentViews().size());\r\n }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tinit();\r\n\t\taddView = (TextView) findViewById(R.id.id_submit_view);\r\n\t\taddView.setOnClickListener(new OnClickListener() {\r\n\t\t\t\r\n\t\t\t@Override\r\n\t\t\tpublic void onClick(View v) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tgatewayId = gatewayView.getEditableText().toString();\r\n\t\t\t\tLog.i(TAG, \"gatewayId \" + gatewayId.trim());\r\n\t\t\t\tgatewayId = gatewayId.trim();\r\n\t\t\t\tif(gatewayId.trim().isEmpty()){\r\n\t\t\t\t\tbindHintView.setVisibility(View.VISIBLE);\r\n\t\t\t\t\tbindbarView.setVisibility(View.GONE);\r\n\t\t\t\t\tbindHintView.setText(R.string.bind_gateway_none);\r\n\t\t\t\t\tbindHintView.setTextColor(getResources().getColor((R.color.red)));\r\n\t\t\t\t}else {\r\n\t\t\t\t\tsetHintVisible(true);\r\n\t\t\t\t\tnew Thread(new BindRunnale()).start();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@Test\r\n public void testEmptyUser(){\r\n solo.clickOnView(solo.getView(R.id.nav_view).findViewById(R.id.navigation_notifications));\r\n solo.waitForFragmentById(R.id.navigation_notifications);\r\n solo.clickOnView(solo.getView(R.id.addFollowing));\r\n solo.sleep(3000);\r\n solo.waitForActivity(AddFollowingActivity.class, 2000);\r\n solo.clickOnView(solo.getView(R.id.confirm));\r\n assertTrue(solo.waitForText(\"The username Cannot Be Empty!!\", 1,2000));\r\n\r\n }", "@Override\n public void afterTextChanged(Editable s) {\n String eventStartDateInput = eventStartDateTV.getText().toString().trim();\n if(eventStartDateInput.isEmpty())\n {\n eventStartDateTV.setError(\"Please set the start date for the event\");\n }\n else{\n eventStartDateTV.setError(null);\n }\n }", "@Override\n \t\t\t\tpublic void onClick(View v) {\n \t\t\t\t\tEditText searchBar = (EditText) findViewById(R.id.search_bar);\n \t\t\t\t\tif(searchBar.getText().equals(\"\"))\n \t\t\t\t\t{\n \t\t\t\t\t\tsearchBar.setText(\"Please enter nonempty query\");\n \t\t\t\t\t}\n \t\t\t\t\telse\n \t\t\t\t\t{\n \t\t\t\t\t\tsearchGuide(searchBar, false);\n \t\t\t\t\t}\n \t\t\t\t}", "@Override\n public void afterTextChanged(Editable editable) {\n checkFieldsForEmptyValues();\n }", "@Override\r\n\t\t\tpublic void onTextChanged(CharSequence arg0, int arg1, int arg2,\r\n\t\t\t\t\tint arg3) {\n\t\t\t\tString edit = keyword.getText().toString();\r\n\t\t\t\tLog.i(\"cheshi\", \"赵信edit:\" + edit);\r\n\t\t\t\tif (edit.length() != 0 && !edit.equals(\"null\")) {\r\n\t\t\t\t\tLog.i(\"cheshi\", \"赵信\");\r\n\t\t\t\t\tdelete.setVisibility(delete.VISIBLE);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}", "@Override\n \t\t\t\tpublic void onClick(View v) {\n \t\t\t\t\tEditText searchBar = (EditText) findViewById(R.id.search_bar);\n \t\t\t\t\tif(searchBar.getText().equals(\"\"))\n \t\t\t\t\t{\n \t\t\t\t\t\tsearchBar.setText(\"Please enter nonempty query\");\n \t\t\t\t\t}\n \t\t\t\t\telse\n \t\t\t\t\t{\n \t\t\t\t\t\tsearchGuide(searchBar, true);\n \t\t\t\t\t}\n \t\t\t\t}", "@Override\n public void onClick(View view) {\n String playerName = nameEditText.getText().toString();\n if ( playerName.matches(\"\") || TextUtils.isEmpty(playerName))\n {\n nameEditText.setError(\"Please Enter Name To play QUIZ !!!\");\n }\n else\n {\n Intent intent = new Intent(MainActivity.this, QuizActivity.class);\n intent.putExtra(\"name\", playerName);\n startActivity(intent);\n finish();\n }\n }", "@Test\n public void testLaunch(){\n View view = mRegisterActivity.findViewById(R.id.register_button);\n assertNotNull(view);\n }", "public static boolean validateTextViewEmpty(TextView textView,\n String message,\n Context context,\n String textData)\n {\n\n if (textView.getText().toString().equals(textData))\n {\n Toast toast = Toast.makeText(context, \"\" + message, Toast.LENGTH_LONG);\n toast.show();\n return false;\n }\n else\n {\n return true;\n }\n\n\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (edtposition.getText().toString().equals(\"\")\n\t\t\t\t\t\t&& edtbrand.getText().toString().equals(\"\")\n\t\t\t\t\t\t&& edtdowhat.getText().toString().equals(\"\")) {\n\t\t\t\t\tToast.makeText(MainActivity.this, \"信息不能为空哦~\",\n\t\t\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t\t\t} else {\n\t\t\t\t\tposition.setText(edtposition.getText().toString());\n\t\t\t\t\tbrand.setText(edtbrand.getText().toString());\n\t\t\t\t\tdowhat.setText(edtdowhat.getText().toString());\n\t\t\t\t\tmypopupwindow.dismiss();\n\t\t\t\t\tposition_1.setText(edtposition.getText().toString());\n\t\t\t\t\tbrand_1.setText(edtbrand.getText().toString());\n\t\t\t\t\tdowhat_1.setText(edtdowhat.getText().toString());\n\t\t\t\t}\n\t\t\t}", "public void popUpEmptyTextView() {\n final Intent intent = new Intent(this, AddUserDetailsActivity.class);\n AlertDialog alertDialog = new AlertDialog.Builder(AddUserDetailsActivity.this).create();\n alertDialog.setTitle(\"ERROR\");\n alertDialog.setMessage(\"One of the fields have been left empty, please try again.\"\n );\n alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, \"OK\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n //Intent intent = new Intent(this, AddUserDetailsActivity.class);\n startActivity(intent);\n finish();\n\n }\n });\n alertDialog.show();\n }", "@Test\n public void mainActivityTest() {\n ViewInteraction appCompatEditText = onView(\n allOf(withId(R.id.edt_username),\n childAtPosition(\n childAtPosition(\n withClassName(is(\"android.support.design.widget.TextInputLayout\")),\n 0),\n 0),\n isDisplayed()));\n /** Typing the username in the field identified above */\n appCompatEditText.perform(replaceText(\"whiteelephant261\"), closeSoftKeyboard());\n\n /** Ensuring that the EditText username is displayed */\n ViewInteraction appCompatEditText2 = onView(\n allOf(withId(R.id.edt_password),\n childAtPosition(\n childAtPosition(\n withClassName(is(\"android.support.design.widget.TextInputLayout\")),\n 0),\n 0),\n isDisplayed()));\n /** Typing the password in the field identified above */\n appCompatEditText2.perform(replaceText(\"video1\"), closeSoftKeyboard());\n\n /** Searching for the LOGIN button */\n ViewInteraction appCompatButton = onView(\n allOf(withId(R.id.btn_login), withText(\"Login\"),\n childAtPosition(\n childAtPosition(\n withId(android.R.id.content),\n 0),\n 2),\n isDisplayed()));\n /** Click on the LOGIN button */\n appCompatButton.perform(click());\n\n /** Waiting for the next screen to be displayed */\n SystemClock.sleep(3000);\n\n /** Ensuring that the text search EditText is displayed */\n ViewInteraction appCompatAutoCompleteTextView = onView(\n allOf(withId(R.id.textSearch),\n childAtPosition(\n allOf(withId(R.id.searchContainer),\n childAtPosition(\n withClassName(is(\"android.support.design.widget.CoordinatorLayout\")),\n 1)),\n 0),\n isDisplayed()));\n\n /** Typing the value \"sa\" */\n appCompatAutoCompleteTextView.perform(typeText(\"sa\"), closeSoftKeyboard());\n /** Waiting for the options list to be displayed */\n SystemClock.sleep(3000);\n\n /*\n // The code below was generated by ESPRESSO recorder, however it didn't work for me.\n // I replaced onData by onView (See code block below)\n\n DataInteraction appCompatTextView = onData(anything())\n .inAdapterView(childAtPosition(\n withClassName(is(\"android.widget.PopupWindow$PopupBackgroundView\")),\n 0))\n .atPosition(2);\n appCompatTextView.perform(click());*/\n\n\n /*onData(allOf(is(instanceOf(String.class)), is(\"Sarah Friedrich\"))) // Use Hamcrest matchers to match item\n .inAdapterView(withId(R.id.searchContainer)) // Specify the explicit id of the ListView\n .perform(click());*/\n /** Ensuring that the search option is displayed */\n onView(withText(\"Sarah Friedrich\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .check(matches(isDisplayed()));\n\n /** Selecting the search option is displayed */\n onView(withText(\"Sarah Friedrich\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .perform(click());\n\n\n /** Waiting for the next screen to be displayed */\n SystemClock.sleep(3000);;\n\n /** Ensuring that the callbutton is displayed */\n ViewInteraction floatingActionButton = onView(\n allOf(withId(R.id.fab),\n childAtPosition(\n childAtPosition(\n withId(android.R.id.content),\n 0),\n 2),\n isDisplayed()));\n /** Selecting the call button */\n floatingActionButton.perform(click());\n\n }", "public static boolean isEmpty(TextView view) {\n if (view != null && view.getText() != null) {\n return getString(view).length() == 0;\n }\n return false;\n }", "public boolean validarCampos(){\n String nome = campoNome.getText().toString();\n String descricao = campoDescricao.getText().toString();\n String valor = String.valueOf(campoValor.getRawValue());\n\n\n if(!nome.isEmpty()){\n if(!descricao.isEmpty()){\n if(!valor.isEmpty() && !valor.equals(\"0\")){\n return true;\n }else{\n exibirToast(\"Preencha o valor do seu serviço\");\n return false;\n }\n }else{\n exibirToast(\"Preencha a descrição do seu serviço\");\n return false;\n }\n }else{\n exibirToast(\"Preencha o nome do seu serviço\");\n return false;\n }\n }", "@SmallTest\n public void testEmailDialog()\n {\n emailXMLButton.callOnClick();\n LayoutInflater factory = LayoutInflater.from(getActivity());\n View textEntryView = factory.inflate(R.layout.email_dialog, null);\n ViewAsserts.assertOnScreen(textEntryView, textEntryView);\n }", "@Override\n public boolean isValid() {\n if((eMultipleAnswerType == null && textAnswerIn.getText().toString().trim().isEmpty()) || (eMultipleAnswerType != null && !compoundButtonController.isChecked())){\n try {\n invalidText = getResources().getString(R.string.output_invalidField_questionAnswering_notAnswered);\n } catch (NullPointerException e){\n e.printStackTrace();\n }\n return false;\n }\n return true;\n }", "private boolean validate() {\n if (activityAddTodoBinding.etTitle.getText().toString().trim().isEmpty())\n {\n activityAddTodoBinding.etTitle.setError(getString(R.string.enter_title));\n return false;\n }\n else if (activityAddTodoBinding.etDesc.getText().toString().trim().isEmpty())\n {\n activityAddTodoBinding.etDesc.setError(getString(R.string.enter_desc));\n return false;\n }\n return true;\n }", "@Test\n public void BnotMatchPass () {\n onView(withId(R.id.username)).check(matches(isDisplayed()));\n //enter correct past password\n onView(withId(R.id.oldPassword)).perform(typeText(\"00000000\"));\n //close keyboard\n closeSoftKeyboard();\n //enter new pass\n onView(withId(R.id.newPassword)).perform(typeText(\"serene00\"));\n //close keyboard\n closeSoftKeyboard();\n //enter diff new pass\n onView(withId(R.id.reNewPassword)).perform(typeText(\"passwoord77\"));\n //close keyboard\n closeSoftKeyboard();\n //click the save button\n onView(withId(R.id.save)).perform(click());\n // check toast visibility\n onView(withText(R.string.passwordMatch))\n .inRoot(new ToastMatcher())\n .check(matches(withText(R.string.passwordMatch)));\n //check activity still shown\n assertFalse(activityTestRule.getActivity().isFinishing());\n }", "@Override\n public void onClick(View view) {\n if (title.getText() == null || content.getText() == null) {\n Toast.makeText(getActivity(), \"Missing fields!\", Toast.LENGTH_SHORT).show();\n } else {\n viewModel.addTodo(new Todo(\n title.getText().toString(),\n content.getText().toString()\n ));\n title.getText().clear();\n content.getText().clear();\n Toast.makeText(getActivity(), \"Added Todo!\", Toast.LENGTH_SHORT).show();\n }\n }", "private static Matcher<View> comprobarListEstimaciones() {\n return new TypeSafeMatcher<View>() {\n @Override\n protected boolean matchesSafely(View item) {\n if (((TextView) item).getText().equals(\"\")) {\n return true;\n }\n return false;\n }\n\n @Override\n public void describeTo(Description description) {\n }\n };\n }", "public void onClick(View v) {\n editText1.setInputType(InputType.TYPE_NULL);\n InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);\n mgr.hideSoftInputFromWindow(editText1.getWindowToken(),InputMethodManager.HIDE_IMPLICIT_ONLY);\n }", "@Override\n public void afterTextChanged(Editable s) {\n String eventEndDateInput = eventEndDateTV.getText().toString().trim();\n\n //if event end date == null\n if(eventEndDateInput.isEmpty())\n {\n eventEndDateTV.setError(\"Please set the end date for the event\");\n }\n else{\n eventEndDateTV.setError(null);\n }\n }", "private static boolean m36209e(View view) {\n return view == null || !view.isShown();\n }", "private void setupEditTexts() {\n EditText paino = findViewById(R.id.etWeight);\n EditText alaPaine = findViewById(R.id.etLowerBP);\n EditText ylaPaine = findViewById(R.id.etUpperBP);\n\n //Set the input filters\n paino.setFilters(new InputFilter[] { new InputFilterMinMax(0f, 999f)});\n alaPaine.setFilters(new InputFilter[] { new InputFilterMinMax(1, 999)});\n ylaPaine.setFilters(new InputFilter[] { new InputFilterMinMax(1, 999)});\n\n //Set listeners for the edit texts on when the user clicks something else on the screen while typing\n //When clicked outside, the keyboard closes\n paino.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n @Override\n public void onFocusChange(View v, boolean hasFocus) {\n MainActivity.hideKeyboard(getApplicationContext(), v);\n }\n });\n alaPaine.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n @Override\n public void onFocusChange(View v, boolean hasFocus) {\n MainActivity.hideKeyboard(getApplicationContext(), v);\n }\n });\n ylaPaine.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n @Override\n public void onFocusChange(View v, boolean hasFocus) {\n MainActivity.hideKeyboard(getApplicationContext(), v);\n }\n });\n }", "@Override\n public void onClick(DialogInterface dialog, int which) {\n Utility.hideKeyBoard(editText, mContext);\n if (editText.getText().toString().trim().length() > 0) {\n pump_no.setText(editText.getText().toString().trim());\n } else {\n pump_no.setText(\"\");\n }\n }", "private boolean verifyObligedFields() {\n if(label.getText().toString().isEmpty() || label.getText().toString().equals(\"\"))\n {\n Toast.makeText(ExpenseCardViewDetails.this, R.string.label_must_be_filled, Toast.LENGTH_SHORT).show();\n return false;\n }\n if(category.getSelectedItem().toString().isEmpty())\n {\n Toast.makeText(ExpenseCardViewDetails.this, R.string.category_must_be_filled, Toast.LENGTH_SHORT).show();\n return false;\n }\n if(cost.getText().toString().isEmpty()){\n Toast.makeText(ExpenseCardViewDetails.this, R.string.cost_must_be_filled, Toast.LENGTH_SHORT).show();\n return false;\n }\n if(dateDue.getText().toString().isEmpty()){\n Toast.makeText(ExpenseCardViewDetails.this, R.string.date_due_must_be_filled, Toast.LENGTH_SHORT).show();\n return false;\n }\n return true;\n }" ]
[ "0.703944", "0.68783647", "0.6849771", "0.66005796", "0.6598137", "0.6510192", "0.6435221", "0.64057964", "0.63715655", "0.63504195", "0.6311757", "0.62985146", "0.6271382", "0.6231683", "0.6194336", "0.6117394", "0.61126304", "0.609009", "0.6081783", "0.604255", "0.60276425", "0.6026333", "0.60159916", "0.59972036", "0.5973362", "0.59645027", "0.5949857", "0.59268916", "0.592058", "0.5915415", "0.591277", "0.59084076", "0.5879268", "0.58640593", "0.5854728", "0.5847057", "0.5845829", "0.58367467", "0.583165", "0.5806345", "0.5783941", "0.5730547", "0.5720825", "0.5718516", "0.5715165", "0.5698557", "0.5697426", "0.5688715", "0.56874365", "0.5684101", "0.5668657", "0.56620854", "0.5661019", "0.56500685", "0.5648578", "0.56456345", "0.56385535", "0.56314325", "0.5615984", "0.5595614", "0.55859226", "0.55849344", "0.5580411", "0.55755574", "0.5563794", "0.5563623", "0.55566984", "0.55505985", "0.5548827", "0.5548827", "0.5547046", "0.5540955", "0.55407476", "0.5535031", "0.55341065", "0.5527591", "0.55275446", "0.552551", "0.5523456", "0.55186397", "0.5517867", "0.5514", "0.5511376", "0.5501241", "0.5488446", "0.54884297", "0.5481261", "0.54725593", "0.5469261", "0.5463811", "0.54627085", "0.54514974", "0.5449104", "0.54488224", "0.54458356", "0.54443914", "0.5443811", "0.54385453", "0.54353696", "0.54197955" ]
0.75051403
0
test that the edit text view uses the correct button
@Test public void testEditTextHasCorrectID(){ ViewInteraction appCompatEditTextView = onView(withId(R.id.input)); appCompatEditTextView.perform(replaceText("testEditTextHasCorrectID"), closeSoftKeyboard()); onView(withId(R.id.fab)).perform(click()); EditText input = messagesActivity.input; int ID = input.getId(); int expectedID = R.id.input; assertEquals(ID, expectedID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testEditTextExists(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testEditTextExists\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n EditText input = messagesActivity.input;\n assertNotNull(input);\n }", "@Test\n public void test() {\n onView(withId(R.id.textViewNote)).check(matches(withText(\"\")));\n\n // click on the button\n onView(withId(R.id.buttonTypeSomething))\n .check(matches(withText(R.string.button_text))).perform(click());\n\n // check if the note has changed\n onView(withId(R.id.textViewNote)).check(matches(withText(R.string.note)));\n }", "@Test\n public void ensureTextChangesWork(){\n onView(withId(R.id.placeEditText)).perform(typeText(\"London\"));\n\n // Check that the language text was changed.\n onView(withId(R.id.languageEditText)).perform(typeText(\"It\"));\n\n // Check that the language text was changed.\n onView(withId(R.id.maxrowsEditText)).perform(typeText(\"3\"));\n\n // check button click\n onView(withId(R.id.button)).perform(click());\n\n // check returned list view\n onView(withId(R.id.listViewResult)).check(matches(isDisplayed()));\n }", "@Test\r\n public void regButton(){\r\n onView(withId(R.id.edUserReg)).perform(typeText(\"Jade\"));\r\n onView(withId(R.id.Stud_id)).perform(typeText(\"Jade\"));\r\n onView(withId(R.id.edPassReg)).perform(typeText(\"hey\"));\r\n onView(withId(R.id.edPassConReg)).perform(typeText(\"hey\"));\r\n onView(withId(R.id.btnReg)).perform(click());\r\n }", "@Test\n public void researchEditTextInputTest() {\n onView(withId(R.id.network_input_research))\n .perform(typeText(INPUT_TEXT))\n .check(matches(withText(INPUT_TEXT)));\n }", "@Test\r\n public void changeText_FailedTest() {\n onView(withId(R.id.inputField)).perform(typeText(\"NewText\"),\r\n closeSoftKeyboard());\r\n reportHelper.label(\"myTestStepLabel_3_1\");\r\n onView(withId(R.id.switchActivity)).perform(click());\r\n\r\n reportHelper.label(\"myTestStepLabel_3_2\");\r\n // This view is in a different Activity, no need to tell Espresso.\r\n onView(withId(R.id.resultView)).check(matches(withText(\"errrrrrr\")));\r\n }", "public boolean shouldEditButtonBePresent();", "@Test\n public void testEditTextContent() throws Exception {\n\n onView(withId(R.id.editText))\n .perform(typeText(LOG_TAG))\n .check(matches(withText(LOG_TAG)));\n }", "@Test\r\n public void ensureTextChangesWork() {\n onView(withId(R.id.inputField))\r\n .perform(typeText(\"HELLO\"), closeSoftKeyboard());\r\n reportHelper.label(\"myTestStepLabel_1_1\");\r\n onView(withId(R.id.changeText)).perform(click());\r\n\r\n // Check that the text was changed.\r\n onView(withId(R.id.inputField)).check(matches(withText(\"Lalala\")));\r\n reportHelper.label(\"myTestStepLabel_1_2\");\r\n }", "@Test\n public void testEditTextCleanup() throws Exception {\n\n // perform text input\n onView(withId(R.id.editText))\n .perform(typeText(LOG_TAG));\n\n // click pin button\n onView(withText(R.string.button_name))\n .perform(click());\n\n // verify empty edittext\n onView(withId(R.id.editText))\n .check(matches(withText(\"\")));\n }", "@SmallTest\n public void testEmailDialog()\n {\n emailXMLButton.callOnClick();\n LayoutInflater factory = LayoutInflater.from(getActivity());\n View textEntryView = factory.inflate(R.layout.email_dialog, null);\n ViewAsserts.assertOnScreen(textEntryView, textEntryView);\n }", "@Test\n public void autoCom(){\n onView(withId(R.id.autoCompleteTextView))\n .perform(typeText(\"So\"), closeSoftKeyboard());\n\n\n onView(withText(\"Southern Ocean\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .check(matches(isDisplayed()));\n\n onView(withText(\"South China Sea\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .check(matches(isDisplayed()));\n }", "public void testSearchButton(){\n solo.clickOnView(solo.getView(R.id.search_instrument_search_button));\n // test if we are in next activity\n solo.assertCurrentActivity(\"should not go to next activity\", SearchInstrumentsActivity.class);\n\n /* search with keywords */\n //write in edit text\n solo.enterText((EditText) solo.getView(R.id.search_instrument_et), \"apple\");\n //click search button\n solo.clickOnView(solo.getView(R.id.search_instrument_search_button));\n // test if we are in next activity\n solo.assertCurrentActivity(\"did not change acitivity\", DisplaySearchResultsActivity.class);\n }", "@Test\n public void somewhatStrongPassword(){\n onView(withId(R.id.editText)).perform(clearText(), typeText(\"Good!\"),closeSoftKeyboard());\n onView(withId(R.id.button)).perform(click());\n // Assert equals textView text\n onView(withId(R.id.textView)).check(matches(withText(\"Somewhat strong\")));\n }", "void onEditClicked();", "@Test\n public void onKgsRBTNClicked(){\n onView(withId(R.id.kgsRBTN)).perform(click()).check(matches(isChecked()));\n onView(withId(R.id.lbsRBTN)).check(matches(isNotChecked()));\n }", "@Test\n public void clickIncrementButton_ChangesQuantityAndCost() {\n onView((withId(R.id.increment_button))).perform(click());\n // 3. Check if the view does what you expect\n onView(withId(R.id.quantity_text_view)).check(matches(withText(\"1\")));\n onView(withId(R.id.cost_text_view)).check(matches(withText(\"$5.00\")));\n //Note: these test are language dependent. I had an emulator with the french language. and this would fail every single time. the\n // out put would be 5,00$ instead of $5.00\n }", "public void onClick(View view) {\n Log.d(\"Edit1\",\"EDITED1\");\n\n }", "@Test\n public void strongestPassword(){\n onView(withId(R.id.editText)).perform(clearText(), typeText(\"Good!123\"),closeSoftKeyboard());\n onView(withId(R.id.button)).perform(click());\n // Assert equals textView text\n onView(withId(R.id.textView)).check(matches(withText(\"Strongest\")));\n }", "@Test\n public void onMaleRBTNClicked(){\n onView(withId(R.id.maleRBTN)).perform(click()).check(matches(isChecked()));\n onView(withId(R.id.femaleRBTN)).check(matches(isNotChecked()));\n }", "@Test\n public void testifyBtn() throws InterruptedException {\n onView(withId(R.id.SaveButton)).check(matches(isDisplayed()));\n\n }", "@MediumTest\n @Feature({ \"TextSelection\" })\n public void testEditableSelectionActionBar() throws Throwable {\n doSelectionActionBarTest(TestPageType.EDITABLE);\n }", "@Test\n public void textViewIndicatingTheTopic_isCorrectlyFilled() {\n // When perform a click on an item\n onView(withId(R.id.recyclerview))\n .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));\n // Then : MeetingDetailsActivity is launched\n onView(withId(R.id.activity_meeting_details));\n //The TextView is correctly filled\n onView(withId(R.id.detail_topic))\n .check(matches(withText(\"Mareu_0\")));\n }", "@Test\n public void onFemaleRBTNClicked(){\n onView(withId(R.id.femaleRBTN)).perform(click()).check(matches(isChecked()));\n onView(withId(R.id.maleRBTN)).check(matches(isNotChecked()));\n }", "@Test\n public void onLbsRBTNClicked(){\n onView(withId(R.id.lbsRBTN)).perform(click()).check(matches(isChecked()));\n onView(withId(R.id.kgsRBTN)).check(matches(isNotChecked()));\n }", "@Override\n public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {\n if (actionId == EditorInfo.IME_ACTION_DONE) {\n // User has finished entering text\n // Perform the search button click programmatically\n search.performClick();\n // Return true on successfully handling the action\n return true;\n }\n\n // Do not perform any task when user is actually entering text\n // in the editable text view\n return false;\n }", "@OnEditorAction(R.id.edit_text)\n public boolean onEditorAction (TextView v, int actionId, KeyEvent event) {\n if (actionId == EditorInfo.IME_ACTION_DONE) {\n mButtonSubmit2.performClick();\n return true;\n }\n return false;\n }", "@Test\r\n public void passText() {\r\n onView(withId(R.id.edPassReg)).perform(typeText(\"hey\"));\r\n }", "protected TextGuiTestObject edittext() \n\t{\n\t\treturn new TextGuiTestObject(\n getMappedTestObject(\"edittext\"));\n\t}", "public void onClick(View view) {\n Log.d(\"Edit\",\"EDITED\");\n }", "@Test\n public void addRecipeTest() {\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n ViewInteraction appCompatEditText = onView (\n allOf (withId (R.id.girisEmail),\n childAtPosition (\n childAtPosition (\n withId (android.R.id.content),\n 0),\n 1),\n isDisplayed ()));\n appCompatEditText.perform (replaceText (\"[email protected]\"), closeSoftKeyboard ());\n\n ViewInteraction appCompatEditText2 = onView (\n allOf (withId (R.id.password),\n childAtPosition (\n childAtPosition (\n withId (android.R.id.content),\n 0),\n 2),\n isDisplayed ()));\n appCompatEditText2.perform (replaceText (\"Asd123..\"), closeSoftKeyboard ());\n\n ViewInteraction appCompatButton = onView (\n allOf (withId (R.id.loginButton), withText (\"Login\"),\n childAtPosition (\n childAtPosition (\n withId (android.R.id.content),\n 0),\n 3),\n isDisplayed ()));\n appCompatButton.perform (click ());\n\n // Added a sleep statement to match the app's execution delay.\n // The recommended way to handle such scenarios is to use Espresso idling resources:\n // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n openActionBarOverflowOrOptionsMenu (getInstrumentation ().getTargetContext ());\n\n ViewInteraction appCompatTextView = onView (\n allOf (withId (R.id.title), withText (\"Add Recipe\"),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.support.v7.view.menu.ListMenuItemView\")),\n 0),\n 0),\n isDisplayed ()));\n appCompatTextView.perform (click ());\n\n // Added a sleep statement to match the app's execution delay.\n // The recommended way to handle such scenarios is to use Espresso idling resources:\n // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n ViewInteraction appCompatEditText3 = onView (\n allOf (withId (R.id.titre),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 1)));\n appCompatEditText3.perform (scrollTo (), replaceText (\"Pattes au fromage\"), closeSoftKeyboard ());\n\n ViewInteraction appCompatEditText4 = onView (\n allOf (withId (R.id.editIngredient),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 2)));\n appCompatEditText4.perform (scrollTo (), replaceText (\"Pattes\"), closeSoftKeyboard ());\n\n // Added a sleep statement to match the app's execution delay.\n // The recommended way to handle such scenarios is to use Espresso idling resources:\n // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n ViewInteraction appCompatEditText5 = onView (\n allOf (withId (R.id.editIngredient), withText (\"Pattes\"),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 2)));\n appCompatEditText5.perform (scrollTo (), replaceText (\"Pattes, fromage\"));\n\n ViewInteraction appCompatEditText6 = onView (\n allOf (withId (R.id.editIngredient), withText (\"Pattes, fromage\"),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 2),\n isDisplayed ()));\n appCompatEditText6.perform (closeSoftKeyboard ());\n\n ViewInteraction appCompatEditText7 = onView (\n allOf (withId (R.id.editDescription),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 3)));\n appCompatEditText7.perform (scrollTo (), replaceText (\"Melangerl\"), closeSoftKeyboard ());\n\n ViewInteraction appCompatEditText8 = onView (\n allOf (withId (R.id.editPreparation),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 4)));\n appCompatEditText8.perform (scrollTo (), replaceText (\"5 0minutes\"), closeSoftKeyboard ());\n\n ViewInteraction appCompatImageView = onView (\n allOf (withId (R.id.imageRecipe),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 0)));\n appCompatImageView.perform (scrollTo (), click ());\n\n // Added a sleep statement to match the app's execution delay.\n // The recommended way to handle such scenarios is to use Espresso idling resources:\n // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n ViewInteraction appCompatButton2 = onView (\n allOf (withId (R.id.saveRecipeButton), withText (\"Save\"),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0),\n 5)));\n appCompatButton2.perform (scrollTo (), click ());\n\n // Added a sleep statement to match the app's execution delay.\n // The recommended way to handle such scenarios is to use Espresso idling resources:\n // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n openActionBarOverflowOrOptionsMenu (getInstrumentation ().getTargetContext ());\n\n ViewInteraction appCompatTextView2 = onView (\n allOf (withId (R.id.title), withText (\"User Settings\"),\n childAtPosition (\n childAtPosition (\n withClassName (is (\"android.support.v7.view.menu.ListMenuItemView\")),\n 0),\n 0),\n isDisplayed ()));\n appCompatTextView2.perform (click ());\n\n // Added a sleep statement to match the app's execution delay.\n // The recommended way to handle such scenarios is to use Espresso idling resources:\n // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html\n try {\n Thread.sleep (7000);\n } catch (InterruptedException e) {\n e.printStackTrace ();\n }\n\n ViewInteraction appCompatButton3 = onView (\n allOf (withId (R.id.cikis_yap), withText (\"Logout\"),\n childAtPosition (\n allOf (withId (R.id.container),\n childAtPosition (\n withClassName (is (\"android.widget.ScrollView\")),\n 0)),\n 3)));\n appCompatButton3.perform (scrollTo (), click ());\n }", "@Test\n public void weakPassword(){\n onView(withId(R.id.editText)).perform(clearText(), typeText(\"password\"),closeSoftKeyboard());\n onView(withId(R.id.button)).perform(click());\n // Assert equals textView text\n onView(withId(R.id.textView)).check(matches(withText(\"Not strong\")));\n }", "@Test\n public void test_rf_continue_button_opens_correct_activity() {\n //Click the positive button in the dialog\n onView(withText(\"I understand\")).perform(click());\n //Find the views and perform action\n onView(withId(R.id.redFlag_continue)).perform(click());\n //Check if action returns desired outcome\n intended(hasComponent(ObservableSignsActivity.class.getName()));\n }", "public void buttonMod (View view){ expressionView.setText(expressionView.getText() + \"Mod\");}", "@Override\r\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (isEdit) {\r\n\t\t\t\t\tisEdit = false;\r\n\t\t\t\t\tiv_user_img.setEnabled(true);\r\n\t\t\t\t\tivedit.setVisibility(View.GONE);\r\n\t\t\t\t\ttvsave.setVisibility(View.VISIBLE);\r\n\r\n\t\t\t\t\tncet.setFocusable(true);\r\n\t\t\t\t\tncet.setFocusableInTouchMode(true);\r\n\t\t\t\t\tncet.requestFocus();\r\n\t\t\t\t\tncet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\r\n\t\t\t\t\t// zhet.setFocusable(true);\r\n\t\t\t\t\t// zhet.setFocusableInTouchMode(true);\r\n\t\t\t\t\t// zhet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t// R.color.grzlinput));\r\n\t\t\t\t\txbet.setClickable(true);\r\n\t\t\t\t\txbet.setFocusable(true);\r\n\t\t\t\t\txbet.setFocusableInTouchMode(true);\r\n\t\t\t\t\txbet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\t\t\t\t\tshret.setFocusable(true);\r\n\t\t\t\t\tshret.setFocusableInTouchMode(true);\r\n\t\t\t\t\tshret.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\t\t\t\t\tlxdhet.setFocusable(true);\r\n\t\t\t\t\tlxdhet.setFocusableInTouchMode(true);\r\n\t\t\t\t\tlxdhet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\t\t\t\t\tsfdqet.setClickable(true);\r\n\t\t\t\t\tsfdqet.setFocusable(true);\r\n\t\t\t\t\tsfdqet.setFocusableInTouchMode(true);\r\n\t\t\t\t\tsfdqet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\t\t\t\t\txxdzet.setFocusable(true);\r\n\t\t\t\t\txxdzet.setFocusableInTouchMode(true);\r\n\t\t\t\t\txxdzet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\t\t\t\t\tyzbmet.setFocusable(true);\r\n\t\t\t\t\tyzbmet.setFocusableInTouchMode(true);\r\n\t\t\t\t\tyzbmet.setBackgroundColor(getResources().getColor(\r\n\t\t\t\t\t\t\tR.color.grzlinput));\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// editMode();\r\n\t\t\t\t}\r\n\t\t\t}", "@Test\n public void autoCompleteTextView_onDataClickAndCheck() {\n onView(withId(R.id.autoCompleteTextView))\n .perform(typeText(\"S\"), closeSoftKeyboard());\n\n // This is useful because some of the completions may not be part of the View Hierarchy\n // unless you scroll around the list.\n onData(allOf(instanceOf(String.class), is(\"Baltic Sea\")))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .perform(click());\n\n // The text should be filled in.\n onView(withId(R.id.autoCompleteTextView))\n .check(matches(withText(\"Baltic Sea\")));\n }", "@Test\n public void mainActivityTest() {\n ViewInteraction appCompatEditText = onView(\n allOf(withId(R.id.edt_username),\n childAtPosition(\n childAtPosition(\n withClassName(is(\"android.support.design.widget.TextInputLayout\")),\n 0),\n 0),\n isDisplayed()));\n /** Typing the username in the field identified above */\n appCompatEditText.perform(replaceText(\"whiteelephant261\"), closeSoftKeyboard());\n\n /** Ensuring that the EditText username is displayed */\n ViewInteraction appCompatEditText2 = onView(\n allOf(withId(R.id.edt_password),\n childAtPosition(\n childAtPosition(\n withClassName(is(\"android.support.design.widget.TextInputLayout\")),\n 0),\n 0),\n isDisplayed()));\n /** Typing the password in the field identified above */\n appCompatEditText2.perform(replaceText(\"video1\"), closeSoftKeyboard());\n\n /** Searching for the LOGIN button */\n ViewInteraction appCompatButton = onView(\n allOf(withId(R.id.btn_login), withText(\"Login\"),\n childAtPosition(\n childAtPosition(\n withId(android.R.id.content),\n 0),\n 2),\n isDisplayed()));\n /** Click on the LOGIN button */\n appCompatButton.perform(click());\n\n /** Waiting for the next screen to be displayed */\n SystemClock.sleep(3000);\n\n /** Ensuring that the text search EditText is displayed */\n ViewInteraction appCompatAutoCompleteTextView = onView(\n allOf(withId(R.id.textSearch),\n childAtPosition(\n allOf(withId(R.id.searchContainer),\n childAtPosition(\n withClassName(is(\"android.support.design.widget.CoordinatorLayout\")),\n 1)),\n 0),\n isDisplayed()));\n\n /** Typing the value \"sa\" */\n appCompatAutoCompleteTextView.perform(typeText(\"sa\"), closeSoftKeyboard());\n /** Waiting for the options list to be displayed */\n SystemClock.sleep(3000);\n\n /*\n // The code below was generated by ESPRESSO recorder, however it didn't work for me.\n // I replaced onData by onView (See code block below)\n\n DataInteraction appCompatTextView = onData(anything())\n .inAdapterView(childAtPosition(\n withClassName(is(\"android.widget.PopupWindow$PopupBackgroundView\")),\n 0))\n .atPosition(2);\n appCompatTextView.perform(click());*/\n\n\n /*onData(allOf(is(instanceOf(String.class)), is(\"Sarah Friedrich\"))) // Use Hamcrest matchers to match item\n .inAdapterView(withId(R.id.searchContainer)) // Specify the explicit id of the ListView\n .perform(click());*/\n /** Ensuring that the search option is displayed */\n onView(withText(\"Sarah Friedrich\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .check(matches(isDisplayed()));\n\n /** Selecting the search option is displayed */\n onView(withText(\"Sarah Friedrich\"))\n .inRoot(withDecorView(not(is(mActivity.getWindow().getDecorView()))))\n .perform(click());\n\n\n /** Waiting for the next screen to be displayed */\n SystemClock.sleep(3000);;\n\n /** Ensuring that the callbutton is displayed */\n ViewInteraction floatingActionButton = onView(\n allOf(withId(R.id.fab),\n childAtPosition(\n childAtPosition(\n withId(android.R.id.content),\n 0),\n 2),\n isDisplayed()));\n /** Selecting the call button */\n floatingActionButton.perform(click());\n\n }", "@Test\n public void test_call_Ambulance_Button_launches_Dialog() {\n onView(withText(\"I understand\")).perform(click());\n //Find the views and perform the action\n onView(withId(R.id.redFlag_call_ambulance)).perform(click());\n //Check if action returns desired outcome\n onView(withText(\"CALL AMBULANCE?\")).check(matches(isDisplayed()));\n\n }", "@Test\n public void CsamePass () {\n onView(withId(R.id.username)).check(matches(isDisplayed()));\n //enter correct past password\n onView(withId(R.id.oldPassword)).perform(typeText(\"00000000\"));\n //close keyboard\n closeSoftKeyboard();\n //enter new pass that same as old\n onView(withId(R.id.newPassword)).perform(typeText(\"00000000\"));\n //close keyboard\n closeSoftKeyboard();\n //renter again the new pass that same as old\n onView(withId(R.id.reNewPassword)).perform(typeText(\"00000000\"));\n //close keyboard\n closeSoftKeyboard();\n //click the button\n onView(withId(R.id.save)).perform(click());\n // check toast visibility\n onView(withText(R.string.passwordSame))\n .inRoot(new ToastMatcher())\n .check(matches(withText(R.string.passwordSame)));\n //check activity still shown\n assertFalse(activityTestRule.getActivity().isFinishing());\n }", "@Override\n public void onClick(View v) {\n String inputFieldText = ((TextView) findViewById(R.id.inputField)).getText().toString();\n\n // Set text to custom text, or if custom text is empty set to default hint\n if (inputFieldText.isEmpty()) {\n ((TextView) findViewById(R.id.text)).setText(\"Enter your OWN text!\");\n } else {\n ((TextView) findViewById(R.id.text)).setText(inputFieldText);\n }\n }", "@Test\n public void addItem() {\n //TODO 1,2\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.registerButton)).perform(click());\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.newUsernameEditText)).check(matches(isDisplayed()));\n\n //TODO 3,4,5,6\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.newUsernameEditText)).perform(typeText(\"user\"));\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.newPasswordEditText)).perform(typeText(\"pass\"));\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.registerButton)).perform(click());\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.fabAdd)).check(matches(isDisplayed()));\n\n //TODO 7,8\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.fabAdd)).perform(click());\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.newItemEditText)).check(matches(isDisplayed()));\n\n // TODO 9,10\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.newItemEditText)).perform(typeText(\"ziemniaki\"));\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.fabSave)).perform(click());\n\n // TODO 11\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.text)).check(matches(withText(\"ziemniaki\")));\n }", "@Test\n public void passUpdateWrong () {\n //check the display name as expected\n onView(withId(R.id.username)).check(matches(isDisplayed()));\n //enter wrong past password\n onView(withId(R.id.oldPassword)).perform(typeText(\"serene88\"));\n //close keyboard\n closeSoftKeyboard();\n //enter new pass\n onView(withId(R.id.newPassword)).perform(typeText(\"serene99\"));\n //close keyboard\n closeSoftKeyboard();\n //reenter new pass\n onView(withId(R.id.reNewPassword)).perform(typeText(\"serene99\"));\n //close keyboard\n closeSoftKeyboard();\n //click the button\n onView(withId(R.id.save)).perform(click());\n // check toast visibility\n onView(withText(R.string.wrongPassword))\n .inRoot(new ToastMatcher())\n .check(matches(withText(R.string.wrongPassword)));\n //check activity still shown\n assertFalse(activityTestRule.getActivity().isFinishing());\n }", "public void clickOnEditButton() {\r\n\t\tsafeClick(addMarkerOkButton.replace(\".ant-modal-footer button.ant-btn.ant-btn-primary\",\r\n\t\t\t\t\".ant-btn.ant-btn-primary.ant-btn-circle\"), SHORTWAIT);\r\n\t}", "@Test\r\n public void passConText() {\r\n onView(withId(R.id.edPassConReg)).perform(typeText(\"hey\"));\r\n }", "public void submit_intsatpos(View button) {\n }", "@Override\n public void onClick(View v) {\n String checkBoulder = (String) completeBoulder.getText();\n // if button says \"Topped out!\"\n if (checkBoulder.equals(getResources().getString(R.string.topout_complete))){\n //do nothing\n }\n else {\n tries_title.setBackgroundColor(getResources().getColor(R.color.colorGreen));\n tries_title.setText(R.string.good_job);\n showTriesBox();\n }\n }", "public void editBtnOnclick()\r\n\t{\r\n\t\tif(cardSet.getCards().size() != 0)\r\n\t\t\tMainRunner.getSceneSelector().switchToCardEditor();\r\n\t}", "public abstract void checkEditing();", "@Test\n public void testPerform(){\n //test basic cases from main activity\n\n perform(\"0.1+2-3×4÷5×(6-7-8+9)%\");\n onView(withId(R.id.textView3)).check(matches(withText(\"0.1+2-3×4÷5×(6-7-8+9)%\")));\n onView(withId(R.id.result)).perform(click());\n onView(withId(R.id.textView5)).check(matches(withText(\"Result: \"+\"2.1\")));\n onView(withId(R.id.lac)).perform(click());\n\n //test if function and variable buttons work or not.\n perform(\"xyzgπe,log(cos(sin(tan(log(pow(\");\n onView(withId(R.id.textView3)).check(matches(withText(\"xyzgπe,log(cos(sin(tan(log(pow(\")));\n\n //Test if backspace work or not. (the whole function like 'log(' will be deleted)\n onView(withId(R.id.lback)).perform(click());\n onView(withId(R.id.textView3)).check(matches(withText(\"xyzgπe,log(cos(sin(tan(log(\")));\n onView(withId(R.id.lac)).perform(click());\n onView(withId(R.id.textView3)).check(matches(withText(\"0\")));\n }", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tString ans1 = editbangundatar.getText().toString();\n\t\t\t\tint answer = Integer.parseInt(editbangundatar.getText().toString());\n\t\t\t\tif(answer == 16){\n\t\t\t\t\t\n\t\t\t\t\tToast.makeText(getActivity(), \"True\", Toast.LENGTH_LONG).show();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tToast.makeText(getActivity(), \"Maaf, jawaban anda salah\", Toast.LENGTH_LONG).show();\n\t\t\t\t}\n\t\t\t}", "@Test\n public void testRedButton4Vissible() {\n window.textBox(\"usernameText\").setText(\"karona\"); \n window.textBox(\"StoresNameTxt\").setText(\"store1\"); \n window.textBox(\"openHoursTxt\").setText(\"18:00-20:00\");\n window.textBox(\"CustomerNameTxt\").setText(\"ilias\");\n window.textBox(\"NumberOfSeatsTxt\").enterText(\"1\"); \n window.comboBox(\"HoursAvailable\").selectItem(1);\n window.button(\"makeReservation\").click();\n window.optionPane().okButton().click();\n window.button(\"redButton4\").requireVisible();\n }", "public void testCheckButtons() {\n onView(withId(R.id.quiz_button)).perform(click());\n pressBack();\n onView(withId(R.id.flash_button)).perform(click());\n pressBack();\n onView(withId(R.id.quiz_button)).perform(click());\n onView(withId(R.id.quiz_make)).perform(click());\n pressBack();\n onView(withId(R.id.quiz_take)).perform(click());\n onView(withId(R.id.quiz_all)).perform(click());\n onView(withId(R.id.homeButton)).perform(click());\n\n\n }", "@Override\r\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tmListener.onAddPress(editContent.getEditableText().toString());\r\n\t\t\t\tdialog.dismiss();\r\n\t\t\t}", "@Override\n\t\t\tpublic boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {\n\t\t\t\tToast.makeText(MainActivity.this, String.valueOf(arg1), Toast.LENGTH_SHORT).show(); \n\t\t\t\treturn false;\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\toptb=btnoptb.getText().toString();\n\t\t\t\tCheckAns(optb,currentPosition);\n\t\t\t\t//Log.e(\"ans\", optb);\n\n\t\t\t}", "@Test\n public void lookUpAddItemActivity(){\n TextView addItemToList = (TextView) addItemActivity.findViewById(R.id.textView5);\n EditText itemName = (EditText) addItemActivity.findViewById(R.id.itemNameEditText);\n EditText itemType = (EditText) addItemActivity.findViewById(R.id.itemTypeEditText);\n EditText itemQty = (EditText) addItemActivity.findViewById(R.id.itemQuantityEditText);\n EditText itemUnit = (EditText) addItemActivity.findViewById(R.id.itemUnitEditText);\n Button add = (Button) addItemActivity.findViewById(R.id.addItemToListButton);\n\n assertNotNull(\"Add Item to List TextView could not be found in AddItemActivity\", addItemToList);\n assertNotNull(\"Item Name EditText could not be found in AddItemActivity\", itemName);\n assertNotNull(\"Item Type EditText could not be found in AddItemActivity\", itemType);\n assertNotNull(\"Item Quantity EditText could not be found in AddItemActivity\", itemQty);\n assertNotNull(\"Item Unit EditText could not be found in AddItemActivity\", itemUnit);\n assertNotNull(\"Add Item to List button could not be found in AddItemActivity\", add);\n }", "public void onEditItem(View view) {\n Intent data = new Intent(EditItemActivity.this, MainActivity.class);\n data.putExtra(\"position\", elementId);\n data.putExtra(\"text\", etText.getText().toString());\n setResult(RESULT_OK, data);\n finish();\n }", "@Test\n void checkButtons() throws FileNotFoundException {\n assertEquals(defaultMode.getText(), \"Candy Mode\");\n assertEquals(darkMode.getText(), \"Dark Mode\");\n assertEquals(rainbowMode.getText(), \"Rainbow Mode\");\n assertEquals(greenMode.getText(), \"Green Mode\");\n assertEquals(waveMode.getText(), \"Wave Mode\");\n }", "@Test\n public void triggerIntentTestButtonToRegister() {\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(isClickable()));\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(notNullValue()));\n }", "@Test\n public void testHandleBtnAlterar() throws Exception {\n }", "@Test \n\tpublic void edit() \n\t{\n\t\tassertTrue(true);\n\t}", "public boolean setEditView(int editViewID, String text){\n try {\n EditText editview = (EditText) findViewById(editViewID);\n editview.setText(text);\n Log.i(\"MenuAndDatabase\",\"setEditText: \" + editViewID + \", message: \" + text);\n return false;\n }\n catch(Exception e){\n Log.e(\"MenuAndDatabase\", \"error setting editText: \" + e.toString());\n return true;\n }\n }", "@Override\n public void onClick(View v) {\n if (tvHello.getText().equals(getText(R.string.helloWorld)))\n {\n tvHello.setText(R.string.agur);\n }\n\n else\n {\n tvHello.setText(R.string.helloWorld);\n }\n }", "@Override\n public void onClick(DialogInterface dialog, int which) {\n Utility.hideKeyBoard(editText, mContext);\n if (editText.getText().toString().trim().length() > 0) {\n remarks.setText(editText.getText().toString().trim());\n } else {\n remarks.setText(\"\");\n }\n }", "@Test\n public void testSetButtonConfirmarClicked() {\n }", "@Test\n public void triggerIntentTestButtonLogin() {\n onView(withId(R.id.btnLogin)).check(matches(isClickable()));\n onView(withId(R.id.btnLinkToRegisterScreen)).check(matches(notNullValue()));\n }", "@Override\n public boolean onEditorAction(TextView v, int actionId,\n KeyEvent event) {\n if (actionId == EditorInfo.IME_ACTION_DONE) {\n // do here your stuff f\n validateLogin(editUsername.getText().toString(),\n editPassword.getText().toString());\n return true;\n }\n return false;\n }", "public void textBoxAction( TextBoxWidgetExt tbwe ){}", "@Test\n public void testMessageTimeNotNull(){\n ViewInteraction appCompatEditTextView = onView(withId(R.id.input));\n appCompatEditTextView.perform(replaceText(\"testMessageTime\"), closeSoftKeyboard());\n onView(withId(R.id.fab)).perform(click());\n TextView messageTime= messagesActivity.messageTime;\n assertNotNull(messageTime);\n }", "@Override\n public boolean onEditorAction(TextView v, int arg1, KeyEvent arg2) {\n \n return false;\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tboolean isRegularPhoneNumber = phoneEditView.getText()\n\t\t\t\t\t\t.toString().matches(\"[0-9]{10}\");\n\t\t\t\tphoneCheckRes(isRegularPhoneNumber);\n\t\t\t}", "@Override\r\n\t\t\t\t\tpublic void onClick(DialogInterface dialog, int which) {\n\t\t\t\t\t\ttx.setText(editText.getText().toString());\r\n\t\t\t\t\t}", "@Test\n public void clickDecrementButton_ChangesQuantityAndCost() {\n onView(withId(R.id.cost_text_view)).check(matches(withText(\"$0.00\")));\n // - Click on the decrement button\n onView(withId(R.id.decrement_button)).perform(click());\n\n // - Verify that the decrement button won't decrease the quantity 0 and cost below $0.00\n onView(withId(R.id.quantity_text_view)).check(matches(withText(\"0\")));\n onView(withId(R.id.cost_text_view)).check(matches(withText(\"$0.00\")));\n\n\n }", "@Test\n public void lookUpAddToDBActivity(){\n TextView itemType = (TextView) addToDBActivity.findViewById(R.id.textView);\n TextView itemName = (TextView) addToDBActivity.findViewById(R.id.textView2);\n TextView itemUnit = (TextView) addToDBActivity.findViewById(R.id.textView3);\n TextView searchFor = (TextView) addToDBActivity.findViewById(R.id.textView4);\n EditText itemInType = (EditText) addToDBActivity.findViewById(R.id.itemInType);\n EditText itemInName = (EditText) addToDBActivity.findViewById(R.id.itemInName);\n EditText itemInUnit = (EditText) addToDBActivity.findViewById(R.id.itemInUnit);\n EditText searchItemName = (EditText) addToDBActivity.findViewById(R.id.searchItemName);\n EditText queryDisplay = (EditText) addToDBActivity.findViewById(R.id.queryDisplay);\n Button add = (Button) addToDBActivity.findViewById(R.id.button);\n Button query = (Button) addToDBActivity.findViewById(R.id.button2);\n Button search = (Button) addToDBActivity.findViewById(R.id.button4);\n Button retrieve = (Button) addToDBActivity.findViewById(R.id.button5);\n\n assertNotNull(\"Item type TextView could not be found in AddToDBActivity\", itemType);\n assertNotNull(\"Item name TextView could not be found in AddToDBActivity\", itemName);\n assertNotNull(\"Item unit TextView could not be found in AddToDBActivity\", itemUnit);\n assertNotNull(\"Search for TextView could not be found in AddToDBActivity\", searchFor);\n assertNotNull(\"Item in type EditText could not be found in AddToDBActivity\", itemInType);\n assertNotNull(\"Item in name EditText could not be found in AddToDBActivity\", itemInName);\n assertNotNull(\"Item in unit EditText could not be found in AddToDBActivity\", itemInUnit);\n assertNotNull(\"Search item name EditText could not be found in AddToDBActivity\", searchItemName);\n assertNotNull(\"Query display EditText could not be found in AddToDBActivity\", queryDisplay);\n assertNotNull(\"Add button could not be found in AddToDBActivity\", add);\n assertNotNull(\"Query Database button could not be found in AddToDBActivity\", query);\n assertNotNull(\"Search Item button could not be found in AddToDBActivity\", search);\n assertNotNull(\"Retrieve List button could not be found in AddToDBActivity\", retrieve);\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\toptc=btnoptc.getText().toString();\n\t\t\t\tCheckAns(optc,currentPosition);\n\t\t\t\t//Log.e(\"ans\", optc);\n\n\t\t\t}", "public void otherButton(View view, int i) {\n\t\tEditText input = (EditText) this.findViewById(R.id.input);\n\t\tString in = input.getText().toString();\n\t\tint middle = input.getSelectionStart();\n\t\tString half1 = \"\", half2 = \"\";\n\t\tif(middle == 0) {\n\t\t\thalf2 = in;\n\t\t} else if(middle == in.length()) {\n\t\t\thalf1 = in;\n\t\t} else {\n\t\t\thalf1 = in.substring(0, middle);\n\t\t\thalf2 = in.substring(middle);\n\t\t}\n\t\tswitch (i) {\n\t\tcase 1:\n\t\t\tin = half1 + \"+\" + half2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tin = half1 + \"-\" + half2;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tin = half1 + \"*\" + half2;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tin = half1 + \"/\" + half2;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tin = half1 + \" \" + half2;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tin = \"\";\n\t\t\tinput.setTextColor(Color.BLACK);\n\t\t\tmiddle = -1;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tin = half1 + \".\" + half2;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tin = half1 + \"(\" + half2;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tin = half1 + \")\" + half2;\n\t\t\tbreak;\n\t\t}\n\t\tinput.setText(in);\n\t\tinput.setSelection(middle + 1);\n\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\toptd=btnoptd.getText().toString();\n\t\t\t\tCheckAns(optd,currentPosition);\n\t\t\t\t//Log.e(\"ans\", optd);\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\topta=btnopta.getText().toString();\n\t\t\t\tCheckAns(opta,currentPosition);\n\t\t\t\t \n\n\t\t\t}", "private static Matcher<View> encontrarBusqueda() {\n return new TypeSafeMatcher<View>() {\n @Override\n protected boolean matchesSafely(View item) {\n if (item instanceof EditText) {\n return true;\n }\n return false;\n }\n\n @Override\n public void describeTo(Description description) {\n }\n };\n }", "@Test\n public void testIsButtonConfirmarClicked() {\n }", "private void setupView() {\n\t\tphoneEditView = (EditText) findViewById(R.id.edit_phone);\n\n\t\tconfirmBtn = (ImageView) findViewById(R.id.btnStart);\n\t\tconfirmBtn.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tboolean isRegularPhoneNumber = phoneEditView.getText()\n\t\t\t\t\t\t.toString().matches(\"[0-9]{10}\");\n\t\t\t\tphoneCheckRes(isRegularPhoneNumber);\n\t\t\t}\n\t\t});\n\t}", "@Override\n public void onClick(View v){\n setResult(RESULT_OK);\n if (textboxComment.getText().length() > 0) {\n textboxComment.setEnabled(false);\n buttonAddComment.setEnabled(false);\n }\n }", "@Override\n public void run() {\n TextInputEditText itemName = activityTestRule.getActivity().findViewById(R.id.sell_item_name),\n itemDesc = activityTestRule.getActivity().findViewById(R.id.sell_item_desc),\n itemPrice = activityTestRule.getActivity().findViewById(R.id.sell_item_price);\n\n itemName.setText(\"sddfg\");\n itemDesc.setText(\"dsfdsf\");\n itemPrice.setText(\"12.5\");\n\n activityTestRule.getActivity().findViewById(R.id.sell_button).performClick();\n }", "@Test\n public void checkAddMenuButtonPresent() {\n onView(withId(R.id.menu_add)).check(matches(isDisplayed()));\n }", "@Test\r\n\tpublic final void testGetButton() {\n\t\tassertEquals(\"ON\",a.getButton());\r\n\t}", "@Test\n public final void testClickButton() {\n spysizedialog.getStartButton().doClick();\n }", "@Test\n public void emailAlreadySetTest(){\n\n when(DatabaseInitializer.getEmail(appDatabase)).thenReturn(string);\n when(ContextCompat.getColor(view.getContext(), num)).thenReturn(num);\n\n reportSettingsPresenter.emailAlreadySet(button, editText);\n\n verify(editText, Mockito.times(1)).setClickable(false);\n verify(editText, Mockito.times(1)).setEnabled(false);\n //verify(editText, Mockito.times(1)).setTextColor(num);\n verify(editText, Mockito.times(1)).setText(null);\n\n verify(button, Mockito.times(1)).setOnClickListener(any(View.OnClickListener.class));\n\n verify(databaseInitializer,Mockito.times(1));\n DatabaseInitializer.setEmail(appDatabase, string);\n\n }", "@Test\n public void popupMenuTest() {\n ViewInteraction popupMenuButton = onView(\n allOf(withContentDescription(R.string.intervals_menu), isDisplayed()));\n alarmPeriodTextField.check(matches(not(hasFocus())));\n alarmPeriodTextField.check(matches(withText(\"5\")));\n\n // Open the popup menu. This makes the Activity Views inaccessible or...\n popupMenuButton.perform(click());\n\n ViewInteraction cmdEdit = checkMenuCommand(R.string.edit_this_list);\n ViewInteraction cmd_6 = checkMenuCommandPrefix(\"6 \");\n ViewInteraction cmd_7 = checkMenuCommandPrefix(\"7 \");\n ViewInteraction cmd__30 = checkMenuCommand(\":30\");\n ViewInteraction cmd_1 = checkMenuCommand(\"1\");\n // NOTE: Commands scrolled off the bottom require scrolling to access.\n\n // Pick the first few intervals from the menu.\n cmd__30.perform(click());\n alarmPeriodTextField.check(matches(withText(\"0:30\")));\n\n popupMenuButton.perform(click());\n cmd_1.perform(click());\n alarmPeriodTextField.check(matches(withText(\"1\")));\n\n popupMenuButton.perform(click());\n cmd_6.perform(click());\n alarmPeriodTextField.check(matches(withText(\"6\")));\n\n popupMenuButton.perform(click());\n cmd_7.perform(click());\n alarmPeriodTextField.check(matches(withText(\"7\")));\n\n popupMenuButton.perform(click());\n alarmPeriodTextField.check(doesNotExist()); // not in the current view hierarchy\n Espresso.pressBack(); // dismiss the popup menu\n alarmPeriodTextField.check(matches(isDisplayed()));\n\n // Open the recipe editor dialog, edit the text, then Cancel.\n popupMenuButton.perform(click());\n if (Build.VERSION.SDK_INT == 23) {\n Log.w(TAG, \"===== Workaround: Punting this test since clicking to open a dialog\" +\n \" gets stuck, not returning to the test method on Android M API 23\");\n Espresso.pressBack(); // dismiss the popup menu\n background.perform(waitMsec(1000)); // for visual verification\n return;\n }\n cmdEdit.perform(click());\n ViewInteraction dialogTitle = checkTextView(R.string.edit_list_title);\n dialogTitle.check(matches(withId(androidx.appcompat.R.id.alertTitle)));\n dialogTitle.check(matches(isDisplayed()));\n\n ViewInteraction saveButton = onView(\n allOf(withId(android.R.id.button1), withText(R.string.save_edits)));\n ViewInteraction cancelButton = onView(\n allOf(withId(android.R.id.button2), withText(R.string.cancel_edits)));\n ViewInteraction resetEditorButton = onView(\n allOf(withId(android.R.id.button3), withText(R.string.reset)));\n saveButton.check(matches(isDisplayed()));\n cancelButton.check(matches(isDisplayed()));\n resetEditorButton.check(matches(isDisplayed()));\n\n ViewInteraction editText = onView(withId(R.id.recipes_text_field));\n editText.check(matches(isDisplayed()));\n editText.check(matches(withText(containsString(\"\\n:30\\n\"))));\n\n editText.perform(longClick(), replaceText(\"77777 ***TO CANCEL***\\n\"));\n cancelButton.perform(scrollTo(), click());\n\n // Open the recipe editor dialog, edit the text, then Save.\n popupMenuButton.perform(click());\n cmdEdit.perform(click());\n dialogTitle.check(matches(isDisplayed()));\n editText.check(matches(withText(containsString(\"\\n:30\\n\"))));\n\n String replacement = \"88888 ***TO SAVE***\\n\";\n editText.perform(longClick(), replaceText(replacement));\n editText.check(matches(not(withText(containsString(\"\\n:30\\n\")))));\n saveButton.perform(scrollTo(), click());\n\n // Open the recipe editor dialog, check the saved text, edit it, then Reset.\n popupMenuButton.perform(click());\n cmd__30.check(doesNotExist());\n checkMenuCommand(replacement.trim());\n\n cmdEdit.perform(click());\n dialogTitle.check(matches(isDisplayed()));\n editText.check(matches(withText(replacement)));\n\n editText.perform(longClick(), waitMsec(500),\n replaceText(\"99999 ***TO RESET***\\n\"),\n waitMsec(500)); // delay for a visual check\n resetEditorButton.perform(scrollTo(), click());\n\n // Check that the menu's contents were reset.\n popupMenuButton.perform(click());\n cmd__30.check(matches(isDisplayed()));\n cmd_1.check(matches(isDisplayed()));\n cmd_6.check(matches(isDisplayed()));\n cmd_7.check(matches(isDisplayed()));\n\n cmd_1.perform(waitMsec(500), click()); // delay for a visual check\n }", "public void clickOnEditButtonOnSavedSearches() {\r\n\t\tprint(\"Click on Edit under Saved Searches Section\");\r\n\t\tlocator = Locator.MyTrader.Saved_Search_Edit.value;\r\n\t\tclickOn(locator);\r\n\t\tsleep(2000);\r\n\t\tAssert.assertTrue(isElementPresent(Locator.MyTrader.Your_Saved_Searches.value));\r\n\t}", "@Override\n public void onClick(View v){\n setResult(RESULT_OK);\n if (textboxInitialValue.getText().length() > 0) {\n textboxInitialValue.setEnabled(false);\n buttonAddInitialValue.setEnabled(false);\n if (fieldsAreFilled()) {\n buttonSubmit.setEnabled(true);\n }\n }\n }", "@Test\r\n\tpublic void validEditTest() {\n\t\tadminUserEdit.clickAdminLink();\r\n\t\tadminUserEdit.clickUserListLink();\r\n\t\tadminUserEdit.clickEditUserLink();\r\n\t\t\r\n\t\t// Assertion\r\n\t\tString Actual = adminUserEdit.Assertion();\r\n\t\tString Expected = \"Hari\";\r\n\t\tassertEquals(Actual, Expected);\r\n\t\tscreenShot.captureScreenShot(\"TC019\");\r\n\t}", "public ViewResumePage clickonedit() throws Exception{\r\n\t\t\ttry {\r\n\t\t\t\telement = driver.findElement(edit);\r\n\t\t\t\tflag = element.isDisplayed() && element.isEnabled();\r\n\t\t\t\tAssert.assertTrue(flag, \"Edit button is not displayed\");\r\n\t\t\t\telement.click();\r\n\t\t\t\tdriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);\r\n\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\tthrow new Exception(\"Edit Button NOT FOUND:: \"+e.getLocalizedMessage());\r\n\t\t\t}\r\n\t\t\treturn new ViewResumePage(driver);\r\n\t\t\r\n\t}", "public void onClickSubmitViewItem(View view)\n {\n EditText itemToSearchView = (EditText) findViewById(R.id.itemToViewEditTextId);\n String itemToSearch = itemToSearchView.getText().toString();\n if (!itemToSearch.equals (\"\"))\n invokeViewItem(itemToSearch);\n else Toast.makeText(getApplicationContext(), \"No item has been entered\", Toast.LENGTH_LONG).show();\n }", "@FXML\n void setBtnEditOnClick() {\n isEdit = true;\n isAdd = false;\n isDelete = false;\n }", "@Test\n public void openRegisterScreen() {\n //TODO 1,2,3\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.registerButton)).perform(click());\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.newUsernameEditText)).check(matches(isDisplayed()));\n\n //TODO 4,5\n Espresso.closeSoftKeyboard();\n Espresso.pressBack();\n onView(ViewMatchers.withId(pl.lizardproject.qe2017.R.id.usernameEditText)).check(matches(isDisplayed()));\n }", "public void verifyUIElements(){\r\n\t\t\tisClickable(Txt_HomePage_Search);\r\n\t\t\tisClickable(Btn_HomePage_Search);\r\n\t\t}", "@Override\n public void onClick(DialogInterface dialog, int which) {\n Utility.hideKeyBoard(editText, mContext);\n if (editText.getText().toString().trim().length() > 0) {\n pump_type.setText(editText.getText().toString().trim());\n } else {\n pump_type.setText(\"\");\n }\n }", "private boolean checkTextViewAnswer(int resourceId, String correctAnswer){\n TextView textView = findViewById(resourceId);\n return textView.getText().toString().equals(correctAnswer);\n }", "@Override\n\tpublic void onClick(View arg0) {\n\t\tString str;\n\t\tstr=edt.getText().toString();\n\t\ttv.setText(scramble(str));\n\t}", "@Override\n public void onClick(View v) {\n if (TextUtils.isEmpty(editText.getText().toString())){\n Toast.makeText(getContext(), \"Enter note!\", Toast.LENGTH_SHORT).show();\n return;\n } else {\n alertDialog.dismiss();\n }\n\n // check if user updating note\n\n if (shouldUpdate && note != null){\n // update note by it's id\n note.setNote(editText.getText().toString());\n updateNote(note, position);\n } else {\n // create new note\n //createNote(editText.getText().toString());\n }\n }" ]
[ "0.7263213", "0.7158105", "0.71121836", "0.69097525", "0.688493", "0.67581224", "0.6756589", "0.67455465", "0.66324246", "0.65891206", "0.6464347", "0.6446136", "0.6434359", "0.64018786", "0.63873523", "0.63438195", "0.6328669", "0.63218707", "0.6301873", "0.6299164", "0.6246615", "0.62445766", "0.6244428", "0.624225", "0.6224211", "0.61804783", "0.61781645", "0.6176801", "0.61728626", "0.6152923", "0.6125079", "0.61045694", "0.60888994", "0.60869604", "0.6067385", "0.6065511", "0.6063179", "0.6059183", "0.60587", "0.60577494", "0.6052295", "0.60403156", "0.6036324", "0.60299814", "0.60182774", "0.60159266", "0.6011003", "0.6008097", "0.60051876", "0.6000043", "0.59946024", "0.5993393", "0.59907025", "0.59891164", "0.598755", "0.59765553", "0.59756535", "0.5972451", "0.5971125", "0.59692156", "0.5968792", "0.59679145", "0.59670264", "0.59582806", "0.5954665", "0.5954259", "0.5952484", "0.594721", "0.5936061", "0.5931242", "0.5926621", "0.5925151", "0.5923962", "0.5879285", "0.5879166", "0.58619636", "0.58584553", "0.5856779", "0.58546674", "0.58511984", "0.58502156", "0.5849048", "0.58400947", "0.58258516", "0.5816461", "0.5810422", "0.5805755", "0.5802188", "0.57977504", "0.5794786", "0.57947516", "0.5791863", "0.578838", "0.57879543", "0.5786182", "0.5783066", "0.578236", "0.57821786", "0.57821125", "0.578016" ]
0.7077228
3
test that when a message is sent, the message time receives the current user's time stamp
@Test public void testMessageTimeNotNull(){ ViewInteraction appCompatEditTextView = onView(withId(R.id.input)); appCompatEditTextView.perform(replaceText("testMessageTime"), closeSoftKeyboard()); onView(withId(R.id.fab)).perform(click()); TextView messageTime= messagesActivity.messageTime; assertNotNull(messageTime); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testGetTime() throws InterruptedException {\n Thread.sleep(5);\n assertTrue(chatMessage.getTime().before(new Date()));\n }", "@Test\n public void testTimeStamp() throws JMSException {\n long requestTimeStamp = requestMessage.getJMSTimestamp();\n long responseTimeStamp = responseMessage.getJMSTimestamp();\n\n assertTrue(\"The response message timestamp \" + responseTimeStamp +\n \" is older than the request message timestamp \" +\n requestTimeStamp,\n (responseTimeStamp >= requestTimeStamp));\n }", "boolean hasSendTime();", "boolean hasReceiveTime();", "public void onRecieve(RoundTimeMessage message) {\n\n\n }", "public long getSentTime();", "com.google.protobuf.Timestamp getSendTime();", "double getClientTime();", "Long getMessageSentTimestamp(String msgId);", "public void userShouldGetMessage() {\n assertTextMessage(getTextFromElement(_emailResult), expected, \"Your message has been sent\");\n\n }", "public Date getSendTime() {\n return sendTime;\n }", "@Test\n public void testYesterdayOrBetterComparision() {\n Calendar quietAllowedForFeature = Calendar.getInstance(TimeZone.getTimeZone(\"America/Chicago\"));\n quietAllowedForFeature.setTimeInMillis(DateHelper.MILLIS_PER_DAY * 2);\n // midnight 'now' user local time\n quietAllowedForFeature = DateHelper.asDay(quietAllowedForFeature);\n // midnight day before user local time\n quietAllowedForFeature.add(Calendar.DATE, -1); //1 days quiet ok; add this as per feature setting?\n // last rec'd as user local time\n Date userLastMessageReceived = new Date(DateHelper.MILLIS_PER_DAY * 3);\n // if any messages from module after midnight yesterday (any messages yesterday or newer)\n //System.out.println(quietAllowedForFeature);\n //System.out.println(userLastMessageReceived);\n assertTrue(userLastMessageReceived.after(quietAllowedForFeature.getTime()));\n }", "@Override\n\tpublic void onMessageReceived(Message msg) {\n\t\tif ( msgSendTimes.containsKey(\"\"+msg.Payload)) {\n\t\t\tlong startTime = msgSendTimes.get((String)msg.Payload);\n\t\t\tlong elapsedTime = System.nanoTime() - startTime;\n\t\t\tmsgSendTimes.remove((String)msg.Payload);\n\t\t\tmsgTimes.add(elapsedTime);\n\t\t\tSystem.out.println(elapsedTime / 1000000000f);\n\t\t}\n\t}", "public Date getReceiveTime() {\n return receiveTime;\n }", "public Date getReceiveTime() {\r\n return receiveTime;\r\n }", "@Test(timeout = 4000)\n public void test49() throws Throwable {\n String string0 = EWrapperMsgGenerator.currentTime((-532L));\n assertEquals(\"current time = -532 (Dec 31, 1969 11:51:08 PM)\", string0);\n }", "public long getSendTime() {\n return sendTime_;\n }", "public Date getTimeSend() {\n return timeSend;\n }", "@Test\n public void UserCanWriteAndSendAMessage() {\n proLogin(proWait);\n handler.getDriver(\"user\").navigate().refresh();\n // User to queue\n waitAndFillInformation(userWait);\n // User from queue\n\n waitAndPickFromQueue(proWait);\n\n // User can write message\n waitChatWindowsAppear(userWait).sendKeys(\"yy kaa koo\");\n\n // Can send it By Pressing Submit\n waitElementPresent(userWait, By.name(\"send\")).submit();\n assertEquals(\"\", waitChatWindowsAppear(userWait).getText());\n assertTrue(waitForTextToAppear(userWait, \"yy kaa koo\"));\n\n // Can send it By Pressing Enter\n waitChatWindowsAppear(userWait).sendKeys(\"kaa koo yy\");\n waitChatWindowsAppear(userWait).sendKeys(Keys.ENTER);\n\n assertEquals(\"\", waitChatWindowsAppear(userWait).getText());\n assertTrue(waitForTextToAppear(userWait, \"kaa koo yy\"));\n endConversationPro(proWait);\n }", "com.google.protobuf.TimestampOrBuilder getSendTimeOrBuilder();", "@Override\n\tpublic void msgUpdateTime(int time, int day) {\n\t\tlog.add(new LoggedEvent(\"Recieved Time \" + time));\n\t}", "Long getMessageTimestamp(String msgId);", "public Date getSendingTime() {\n return sendingTime;\n }", "public Date getReceiveTime() {\n return receiveTime;\n }", "boolean setChatMessageStatusDisplayed(String msgId, long timestampDisplayed);", "boolean hasUserMessage();", "public final void testGetTimeStamp() {\n assertEquals(hello.timeStamp, n.getTimeStamp());\n }", "@Test\n public void getLastMessages() {\n IUser userOne = new MockUser(\"UserOne\", \"password\");\n IUser userTwo = new User(\"UserTwo\", \"password\");\n\n IMessage messageOne = new Message(userOne,new MessageContent(\"Hello my friends!\",MessageType.TEXT));\n IMessage messageTwo = new Message(userTwo,new MessageContent(\"Hi how are you?\",MessageType.TEXT));\n\n channel.join(userOne);\n channel.join(userTwo);\n channel.sendMessage(messageOne);\n channel.sendMessage(messageTwo);\n\n assertEquals(1,channel.getLastMessages(1).size());\n\n assertEquals(null,channel.getLastMessages(-1));\n\n\n }", "public long getSendTime() {\n return sendTime_;\n }", "public void updateSendingMessage(String message, boolean isMe) {\n\n\n Log.v(\"adsl\", \"came here\");\n\n final MessageModel sendingMessage = new MessageModel();\n sendingMessage.setMessage(message);\n sendingMessage.setTime(\"8:57Pm\"); //set current time in form of database format\n sendingMessage.setMe(isMe);\n\n if (isMe == true) {\n\n\n if (!messageBox.getText().toString().trim().matches(\"\"))\n\n {\n doScreenUpdate(sendingMessage);\n }\n\n\n } else\n\n {\n\n doScreenUpdate(sendingMessage);\n\n\n }\n\n\n }", "@Override\n\tpublic void expectTwitterMessage(String username) {\n\t}", "public abstract void sendTraceTime(Player p);", "@Test(timeout = 4000)\n public void test55() throws Throwable {\n String string0 = EWrapperMsgGenerator.updateAccountTime(\"yTci@Ca5ai_xH#X\");\n assertEquals(\"updateAccountTime: yTci@Ca5ai_xH#X\", string0);\n }", "public boolean firedRecently(double time);", "private String getSmsTimeStamp(Context context) {\n SharedPreferences sp = context.getSharedPreferences(\"sms_time_stamp\", Context.MODE_PRIVATE);\n return sp.getString(\"sms_time_stamp\", \"0\");\n }", "private void askForTime() {\n\t\tconnectToServer();\n\t\tout.println(\"What Time is It ?\");\n\t\tout.flush();\n\t\ttry {\n\t\t\tString time = in.readLine();\n\t\t\tSystem.out.println(\"CLIENT: The time is \" + time);\n\t\t}\n\t\tcatch(IOException e) {\n\t\t\tSystem.out.println(\"CLIENT: Cannot receive time from server\");\n\t\t}\n\t\tdisconnectFromServer();\n\t}", "@Test\n\tpublic void testSayMessageOnRequest(){\n\t\tSystem.out.println(\"\\nMensajes aleatorios al aparecer el Meesek:\\n\");\n\t\tMrMe.sayMessageOnRequest();\n\t\tMrMe.sayMessageOnRequest();\n\t\tMrMe.sayMessageOnRequest();\n\t}", "public void timeLogic(int time){\n //Add logic to decide time increments at which tickets will be granted\n }", "@Test\n public void testToString() {\n String result = chatMessage.toString();\n // use a regex for matching the date\n assertTrue(result.matches(\"^<[0-9:]+> \" + Pattern.quote(author) +\n \": \" + Pattern.quote(text)));\n }", "private void PrintMessageOnTextChat(MessageWithTime message)\n\t{\n\t\tApplicationManager.textChat.write(message);\n\n\t}", "public boolean shouldPrintMessage(int timestamp, String message) {\n Integer time = map.get(message);\n if (time == null) {\n map.put(message, timestamp);\n return true;\n } else if (timestamp - time >= limiter) {\n map.put(message, timestamp);\n return true;\n } else {\n return false;\n }\n }", "public Date getMessageDate();", "@Test\n public void test_shouldAddSendDateTimeToInternalData() throws Exception {\n context.deleteDatabase(PushDatabaseHelperImpl.DATABASE_NAME);\n SQLiteOpenHelper sqLiteOpenHelper = new SQLiteOpenHelper(context, PushDatabaseHelperImpl.DATABASE_NAME, null, PushDatabaseHelperImpl.VER_2017_MAY_15) {\n @Override\n public void onCreate(SQLiteDatabase db) {\n db.execSQL(SQL_CREATE_MAY_MESSAGES_TABLE);\n db.execSQL(SQL_CREATE_GEO_MESSAGES_TABLE);\n }\n\n @Override\n public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n\n }\n };\n\n SQLiteDatabase db = sqLiteOpenHelper.getWritableDatabase();\n // Save new data to database\n ContentValues contentValues = new ContentValues();\n contentValues.put(\"id\", \"SomeMessageId\");\n contentValues.put(\"title\", \"SomeMessageTitle\");\n contentValues.put(\"body\", \"SomeMessageBody\");\n contentValues.put(\"sound\", \"SomeMessageSound\");\n contentValues.put(\"vibrate\", 1);\n contentValues.put(\"icon\", \"SomeMessageIcon\");\n contentValues.put(\"silent\", 1);\n contentValues.put(\"category\", \"SomeMessageCategory\");\n contentValues.put(\"_from\", \"SomeMessageFrom\");\n contentValues.put(\"received_timestamp\", 1234L);\n contentValues.put(\"seen_timestamp\", 5678L);\n contentValues.put(\"internal_data\", \"{\\\"key1\\\":\\\"value1\\\"}\");\n contentValues.put(\"custom_payload\", \"{\\\"key2\\\":\\\"value2\\\"}\");\n contentValues.put(\"destination\", \"SomeMessageDestination\");\n contentValues.put(\"status\", \"ERROR\");\n contentValues.put(\"status_message\", \"SomeMessageStatusMessage\");\n contentValues.put(\"content_url\", \"SomeMessageContentUrl\");\n db.insertWithOnConflict(DatabaseContract.Tables.MESSAGES, null, contentValues, SQLiteDatabase.CONFLICT_REPLACE);\n db.close();\n sqLiteOpenHelper.close();\n\n // Check that sent timestamp was added and other fields are the same\n SQLiteMessageStore messageStore = new SQLiteMessageStore();\n List<Message> messages = messageStore.findAll(context);\n assertEquals(1, messages.size());\n assertEquals(\"SomeMessageId\", messages.get(0).getMessageId());\n assertEquals(\"SomeMessageTitle\", messages.get(0).getTitle());\n assertEquals(\"SomeMessageBody\", messages.get(0).getBody());\n assertEquals(\"SomeMessageSound\", messages.get(0).getSound());\n assertEquals(true, messages.get(0).isVibrate());\n assertEquals(\"SomeMessageIcon\", messages.get(0).getIcon());\n assertEquals(true, messages.get(0).isSilent());\n assertEquals(\"SomeMessageCategory\", messages.get(0).getCategory());\n assertEquals(\"SomeMessageFrom\", messages.get(0).getFrom());\n assertEquals(1234L, messages.get(0).getReceivedTimestamp());\n assertEquals(5678L, messages.get(0).getSeenTimestamp());\n assertEquals(1234L, messages.get(0).getSentTimestamp());\n JSONAssert.assertEquals(\"{\\\"key1\\\" : \\\"value1\\\", \\\"sendDateTime\\\":1234}\",\n messages.get(0).getInternalData(), true);\n JSONAssert.assertEquals(\"{\\\"key2\\\" : \\\"value2\\\"}\",\n messages.get(0).getCustomPayload(), true);\n assertEquals(\"SomeMessageDestination\", messages.get(0).getDestination());\n assertEquals(Message.Status.ERROR, messages.get(0).getStatus());\n assertEquals(\"SomeMessageStatusMessage\", messages.get(0).getStatusMessage());\n assertEquals(\"SomeMessageContentUrl\", messages.get(0).getContentUrl());\n }", "java.lang.String getUserMessage();", "@Order(1)\n\t\t@Test\n\t\tpublic void sendMessageInvalidFromAndTo() throws IOException, ParseException {\n\t\t\t boolean response = Requests.createMessageBoolReturn(JSONUtils.createMessageObject(INVALID_USER_ID, INVALID_USER_ID, \"Test message\"));\n\t\t\t assertFalse(response);\n\t\t\t \n\t\t\t \n\t\t}", "boolean hasExchangeTime();", "public void setTimeSend(Date timeSend) {\n this.timeSend = timeSend;\n }", "public boolean verifyCreated(\r\n long timeToLive,\r\n long futureTimeToLive\r\n ) {\r\n Date validCreation = new Date();\r\n long currentTime = validCreation.getTime();\r\n if (futureTimeToLive > 0) {\r\n validCreation.setTime(currentTime + futureTimeToLive * 1000);\r\n }\r\n // Check to see if the created time is in the future\r\n if (createdDate != null && createdDate.after(validCreation)) {\r\n \r\n validateResult=\"Validation of Timestamp: The message was created in the future!\";\r\n errorVal = 1 ;\r\n return false;\r\n }\r\n \r\n // Calculate the time that is allowed for the message to travel\r\n currentTime -= timeToLive * 1000;\r\n validCreation.setTime(currentTime);\r\n\r\n // Validate the time it took the message to travel\r\n if (createdDate != null && createdDate.before(validCreation)) {\r\n \r\n \tvalidateResult=\"Validation of Timestamp: The message was created too long ago\";\r\n \terrorVal = 1 ;\r\n return false;\r\n }\r\n\r\n \r\n validateResult=\"Validation of Timestamp: Everything is ok\";\r\n \r\n return true;\r\n }", "public void processMessage(Chat chat, Message message) {\n\t\t\t\tif(message.getSubject().toString().equalsIgnoreCase(\"Registration Successful!\")){\n \t System.out.println(\"disconnected \"+username);\n\n\t\t\t\t connection.disconnect();\n\t\t\t\t time=System.currentTimeMillis()-time;\n\t\t\t\t totalTime += time;\n\t\t\t\t totalCount++;\n//\t\t\t\t connection.disconnect();\n\t\t\t\t System.out.println(\"TotalTime: \" + totalTime + \"\\nTotalCount: \" + totalCount + \"\\nAverage: \" + ((totalTime*1.0)/totalCount));\n\t\t\t\t \n//\t\t\t\t System.out.println(\"time taken \"+username+\" \"+time);\n\t\t \t}\n\t\t\t\t }", "public int getUserTime() {\n\t\treturn this.userTime;\n\t}", "public Date getSendEmailTime() {\n return sendEmailTime;\n }", "public boolean shouldPrintMessage(int timestamp, String message) {\n\n // Step1 - Check if message exists in Map\n if (!map.containsKey(message)) {\n map.put(message, timestamp);\n return true;\n }\n\n // Step2 - At this point, map contains message. Hence we have to check if timestamp is greater than 10 seconds\n if (timestamp >= map.get(message) + 10) {\n map.put(message, timestamp);\n return true;\n }\n\n return false;\n }", "public OutputChatMessage(ChatMessage original, Date time)\n\t{\n\t\tsuper(original.getId(), original.getMessage(), original.getAuthor());\n\t\tthis.time = time;\t\t\n\t}", "public long getEventTime();", "public String getSendTime() {\r\n\t\treturn m_timeSent;\r\n\t}", "int markMessageAsRead(String msgId, long timestampDisplayed);", "@Scheduled(fixedRate = 60_000)\n public void checkEventTime() {\n isTimeService.findAll().forEach(event -> {\n if (event.getSchedulledTime().isBefore(LocalDateTime.now())) {\n this.producer.sendReachTimeMessage(new IsTime(event.getMessageId()));\n this.isTimeService.deleteById(event.getSchedulledId());\n }\n });\n// log.info(\"Schedulled time check.\");\n }", "void messageSent();", "public void testGetMessage() {\n assertEquals(\"Message should be got correctly.\", event.getMessage(), message);\n }", "abstract public void acceptMessage(OSCMessage message, TuioTime currentTime);", "@Override\r\n\tpublic void showDoTimeMessage(Player player) {\n\t}", "private void logMessage(ReceivedStuff mess, User user, boolean iAmSender){\n HistMessage histMessage = new HistMessage(mess, iAmSender, new Date());\n user.addMessage(histMessage);\n }", "public void send(Message message) {\n\t\tthis.clockSer.addTS(this.localName);\n\t\t((TimeStampedMessage)message).setMsgTS(this.clockSer.getTs().makeCopy());\nSystem.out.println(\"TS add by 1\");\n\n\t\ttry {\n\t\t\tparseConfig();\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tmessage.set_source(localName);\n\t\tmessage.set_seqNum(currSeqNum++);\n\t\t\t\t\n\t\tRule rule = null;\n\t\tif((rule = matchRule(message, RuleType.SEND)) != null) {\n\t\t\tif(rule.getAction().equals(\"drop\")) {\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\telse if(rule.getAction().equals(\"duplicate\")) {\n\t\t\t\tMessage dupMsg = message.makeCopy();\n\t\t\t\tdupMsg.set_duplicate(true);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t/* Send 'message' and 'dupMsg' */\n\t\t\t\tdoSend(message);\n\t\t\t\t/* update the timestamp */\n\t\t\t\tthis.clockSer.addTS(this.localName);\n\t\t\t\t((TimeStampedMessage)dupMsg).setMsgTS(this.clockSer.getTs().makeCopy());\nSystem.out.println(\"TS add by 1\");\n\t\t\t\tdoSend(dupMsg);\n\t\t\t\t\n\t\t\t\t/* We need to send delayed messages after new message.\n\t\t\t\t * This was clarified in Live session by Professor.\n\t\t\t\t */\n\t\t\t\tfor(Message m : delaySendQueue) {\n\t\t\t\t\tdoSend(m);\n\t\t\t\t}\n\t\t\t\tdelaySendQueue.clear();\n\n\t\t\t\t\n\t\t\t}\n\t\t\telse if(rule.getAction().equals(\"delay\")) {\n\t\t\t\tdelaySendQueue.add(message);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"We get a wierd message here!\");\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tdoSend(message);\n\t\t\t\n\t\t\t/* We need to send delayed messages after new message.\n\t\t\t * This was clarified in Live session by Professor.\n\t\t\t */\n\t\t\tfor(Message m : delaySendQueue) {\n\t\t\t\tdoSend(m);\n\t\t\t}\n\t\t\tdelaySendQueue.clear();\n\t\t}\n\t\t\n\t}", "public void tock(String msg) {\n\t\tlong end = System.currentTimeMillis();\n\t\tlong sinceStart = end - start;\n\t\tlong sinceLast = end - last;\n\t\t\n\t\tlast = end;\n\t\t\n\t\tSystem.out.println(msg + \": start=\" + sinceStart + \" last=\" + sinceLast);\n\t}", "public void testTheClock() throws Exception\r\n {\r\n Clock clock = new SimpleClock();\r\n String timestamp = clock.getTimestamp();\r\n Logger logger = Logger.getLogger( \"test\" );\r\n logger.info( timestamp );\r\n }", "long getRetrievedTime();", "@Test\n public void testClient(){\n received=false;\n uut=new ChatMessageRequest(\"test\",\"test2\",\"test\",MessageTypes.MATCH);\n uut.clientHandle(null,new TestUtilizer());\n assertTrue(received);\n }", "T getEventTime();", "@Test\n public void testSendMessage()\n {\n System.out.println(\"sendMessage\");\n Account sender = new Account(\"Henk\");\n String message = \"Test\";\n Party instance = new Party(sender);\n boolean expResult = true;\n boolean result = instance.sendMessage(sender, message);\n assertEquals(\"The message gave a 'not send' answer.\", expResult, result);\n ArrayList<Message> chat = instance.getChat();\n boolean result2 = false;\n for (Message chatMessage : chat)\n {\n if (chatMessage.getText().equals(message))\n {\n result2 = true;\n break;\n }\n }\n assertEquals(\"The message isn't in the chat.\", expResult, result2);\n }", "public void verifyScheduled() {\n\t\tselectDatePublishingCal(futureDate);\n\t\twait.until(\n\t\t ExpectedConditions\n\t\t\t.numberOfElementsToBeMoreThan(By.xpath(\"//span[.='\"+scheduledMessage+\"']\"), 0));\n\t\tList<WebElement> scheduledTweets=driver.findElements(By.xpath(\"//span[.='\"+scheduledMessage+\"']\"));\n\t\t\n\t\tAssert.assertTrue(\"Verify that scheduled tweet with msg: \"+scheduledMessage+\" is displayed\",\n\t\t\t\tscheduledTweets.size() > 0 );\n\t}", "@Override\r\n\tpublic String gettime() {\n\t\treturn user.gettime();\r\n\t}", "String timeModified();", "public void setSendTime(Date sendTime) {\n this.sendTime = sendTime;\n }", "Long getUserCreated();", "public int getTime() { return _time; }", "@Override\r\n\tpublic void agree(Integer id,Timestamp createtime) {\n\t\tString sql=\"update message set isread=1,result=1,createtime=? where id=?\";\r\n\t\tObject[] args=new Object[] {createtime,id};\r\n\t\ttry {\r\n\t\t\tupdate(conn, sql, args);\r\n\t\t} catch (SQLException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public java.lang.String getSentTime() {\n return sentTime;\n }", "@Test\n public void testSyncEraCommonsStatus_lastModified() {\n Supplier<Timestamp> getLastModified =\n () -> userDao.findUserByUsername(USERNAME).getLastModifiedTime();\n Timestamp modifiedTime0 = getLastModified.get();\n\n when(mockFireCloudService.getNihStatus())\n .thenReturn(\n new FirecloudNihStatus()\n .linkedNihUsername(\"nih-user\")\n // FireCloud stores the NIH status in seconds, not msecs.\n .linkExpireTime(START_INSTANT.toEpochMilli() / 1000));\n userService.syncEraCommonsStatus();\n Timestamp modifiedTime1 = getLastModified.get();\n assertWithMessage(\n \"modified time should change when eRA commons status changes, want %s < %s\",\n modifiedTime0, modifiedTime1)\n .that(modifiedTime0.before(modifiedTime1))\n .isTrue();\n\n userService.syncEraCommonsStatus();\n assertWithMessage(\n \"modified time should not change on sync, if eRA commons status doesn't change\")\n .that(modifiedTime1)\n .isEqualTo(getLastModified.get());\n }", "@Override\n\tpublic void run() {\n\t\tBot.inst.dbg.writeln(this, \"Running scheduled task id \" + this.timerID + \" for channel \" + this.channel);\n\t\t\n\t\tMessageInfo info = new MessageInfo(channel, \"\", message, \"\", \"\", 0);\n\t\tBot.inst.dbg.writeln(this, \"Flags: \" + this.flags);\n\n\t\tif (this.flagsVals.REQUIRES_MSG_COUNT && Integer.parseInt(this.flagsVals.REQUIRES_MSG_COUNT_AMT) > this.flagsVals.MSGES_SINCE_LAST_TRIGGER) {\n\t\t\tthis.flagsVals.MSGES_SINCE_LAST_TRIGGER = 0; // Reset msges count, even if the timer didnt get to run\n\t\t\tBot.inst.dbg.writeln(this, \"Timer failed. Not enough messages. Channel: \" + this.channel + \", id: \" + this.timerID);\n\t\t\treturn; // Not enough messages have been sent for this to trigger again\n\t\t}\n\t\t\n\t\tif (this.flagsVals.REQUIRES_LIVE) {\n\t\t\tif(!kdk.api.twitch.APIv5.isStreamerLive(Bot.inst.getClientID(), Bot.inst.getChannel(channel).getUserID())) {\n\t\t\t\tBot.inst.dbg.writeln(this, \"Timer failed. Streamer isn't live. Channel: \" + this.channel + \", id: \" + this.timerID);\n\t\t\t\treturn; // Streamer isn't live, we arnt going to send message\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (this.flagsVals.REQUIRES_GAME) {\n\t\t\tChannel chan = Bot.inst.getChannel(this.channel);\n\t\t\tString retrievedGame = kdk.api.twitch.APIv5.getChannelGame(DBFetcher.getTwitchOAuth(kdk.Bot.dbm), chan.getUserID()).replaceAll(\"\\\"\", \"\");\n\t\t\tif(!this.flagsVals.REQUIRES_GAME_NAME.equalsIgnoreCase(retrievedGame)) {\n\t\t\t\tBot.inst.dbg.writeln(this, \"Timer failed. Game did not match. Match: \" + retrievedGame + \", To: \" + this.flagsVals.REQUIRES_GAME_NAME + \", Channel: \" + this.channel + \", id: \" + this.timerID);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tBot.inst.dbg.writeln(this, \"Triggered timer \" + this.timerID + \", all conditions met\");\n\t\tthis.flagsVals.MSGES_SINCE_LAST_TRIGGER = 0; // Reset msges count, even if we're not using it\n\t\tBot.inst.sendMessage(channel, MessageParser.parseMessage(message, info));\n\t\t\n\t\tif(flagsVals.RANDOM_MODIFIER) {\n\t\t\tRandom rng = new Random();\n\t\t\tSystem.out.println(\"ID: \" + timerID + \", RNG_MAX: \" + flagsVals.RANDOM_MODIFIER_MAX);\n\t\t\tint rni = rng.nextInt(Integer.parseInt(flagsVals.RANDOM_MODIFIER_MAX));\n\t\t\t\n\t\t\ttimer.schedule(this, (delay + rni) * 1000, delay * 1000);\n\t\t}\n\t}", "@Test\r\n\tpublic void postMessagePositiveTest() {\r\n\r\n\t\tint messageID = 1;\r\n\t\tString messageText = \"Some text\";\r\n\t\tint messageGrID = 1;\r\n\r\n\t\tMessageEntity expectedMessage = new MessageEntity();\r\n\r\n\t\texpectedMessage.setMesId(new Long(messageID));\r\n\t\texpectedMessage.setText(messageText);\r\n\t\texpectedMessage.setGrId(new Long(messageGrID));\r\n\t\texpectedMessage.setDate();\r\n\r\n\t\tMessageEntity actualMessage = mesServ.postMessage(messageID, messageText, messageGrID);\r\n\r\n\t\tassertThat(actualMessage.getMesId())\r\n\t\t\t\t.describedAs(\r\n\t\t\t\t\t\t\"Actual value of mesID variable of MessageEntity object is different from the expected one.\")\r\n\t\t\t\t.isEqualTo(expectedMessage.getMesId());\r\n\r\n\t\tassertThat(actualMessage.getText()).describedAs(\r\n\t\t\t\t\"Actual value of text String variable of MessageEntity object is different from the expected one.\")\r\n\t\t\t\t.isEqualTo(expectedMessage.getText());\r\n\r\n\t\tassertThat(actualMessage.getDate())\r\n\t\t\t\t.describedAs(\r\n\t\t\t\t\t\t\"Actual value of date variable of MessageEntity object is different from the expected one.\")\r\n\t\t\t\t.isEqualTo(expectedMessage.getDate());\r\n\r\n\t\tassertThat(actualMessage.getGrId())\r\n\t\t\t\t.describedAs(\r\n\t\t\t\t\t\t\"Actual value of grID variable of MessageEntity object is different from the expected one.\")\r\n\t\t\t\t.isEqualTo(expectedMessage.getGrId());\r\n\t}", "com.google.protobuf.Timestamp getSubmitTime();", "public void testGetStartTime() {\n assertTrue(mb.getStartTime() > -1);\n }", "public String getFormattedTime(){\r\n\t\tlong timestampInMs = ((long) timestamp * 1000);\r\n\t\tmessageTimestampTimeFormat = new SimpleDateFormat(messageTimestampTimeFormatString, Locale.getDefault()); \t//Initialise the time object we will use\r\n\t\tmessageTimestampTimeFormat.setTimeZone(TimeZone.getDefault());\r\n\t\tString messageSentString = messageTimestampTimeFormat.format(new Date(timestampInMs));\r\n\t\treturn messageSentString;\r\n\t}", "public boolean message( Who sender, Message msg ) throws Exception;", "@Ignore\r\n @Test\r\n public void shouldReturnValidTime() {\n\r\n HealthCheck hc = client.healthCheck();\r\n assertNotNull(hc.getCurrentTime());\r\n }", "private MessageType processMessage(MessageType message) {\n\t\tJSONObject messageJSON = (JSONObject) message;\n\t\tJSONObject timestamp = messageJSON.getJSONObject(\"timestamp\");\n\t\t\n\t\t//complete timestamp\n\t\tint globalState = messagequeue.size();\n\t\tDate nowDate = new Date();\n\t\tString globalClock = String.valueOf(nowDate.getTime());\n\t\ttimestamp.element(\"srn\", globalState);\n\t\ttimestamp.element(\"globalClock\", globalClock);\n\t\t\n\t\tmessageJSON.element(\"timestamp\", timestamp);\n\t\treturn (MessageType) messageJSON;\n\t}", "public void send_message(){\n logical_clock++;\n System.out.println(\"Send Message Clock:\" +logical_clock);\n encrypt(logical_clock);\n\n }", "@Test\n public void actorShouldProcessAllMessages() {\n ActorRef ref1 = system.actorOf(MyTestActor.class);\n\n Actor act = ((MyTestActorSystem)system).giveMeActor(ref1);\n\n ((MyTestActor)act).setRefAs((AbsActorSystem)system);\n\n for (int i = 0; i < 2000; i++) {\n ref1.send(new TrivialMessage(), ref1);\n }\n\n system.stop(ref1);\n\n // messaggi spediti all'attore effettivamente aggiunti alla sua mailBox\n int sendM = ((MyTestActorSystem)system).getNumSendMessages();\n // messaggi presenti nella mailBox dell'attore che sono stati processati\n int reciveM = ((MyTestActorSystem)system).getRecivedMessage();\n\n Assert.assertEquals(\"Devono essere processati tutti i messaggi effettivamente spediti\", sendM, reciveM);\n\n }", "public double getClientTime() {\n return clientTime_;\n }", "private void formatTime() {\r\n\t\tDate date = new Date();\r\n\t\tSimpleDateFormat ft = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");\r\n\t\tm_timeSent = ft.format(date).toString();\r\n\t}", "public final void testSetTimeStamp() {\n Notification n = new Notification(\"type\", \"src\", 1);\n n.setTimeStamp(123);\n assertEquals(123, n.getTimeStamp());\n }", "private void serverDisplay(String message)\n {\n String timeStamp = dateFormat.format(new Date()) + \" \" + message;\n System.out.println(timeStamp);\n }", "@Override\n public void onSuccess(long time) {\n ChatMessageBean message = new ChatMessageBean();\n message.setBelongUserMobileNo(currentUser.getMobilePhoneNumber());\n message.setContent(chatMessage);\n message.setSendTime(String.valueOf(time*1000L));\n message.setTargetUserMobileNo(friend.getMobilePhoneNumber());\n\n message.save(FriendsChatActivity.this);\n\n ImSdkUtil.sendTextMessage(friend.getMobilePhoneNumber(), chatMessage);\n\n chatAdapter.add(message);\n mChatListView.setSelection(chatAdapter.getCount() - 1);\n }", "public void testFormatDateStringFromTimestamp_todaySingleMinuteAm() {\n calendar.set(Calendar.HOUR_OF_DAY, 8);\n calendar.set(Calendar.MINUTE, 8);\n long todayTimestamp = calendar.getTimeInMillis();\n assertEquals(\"8:08 AM\", ContactInteractionUtil.formatDateStringFromTimestamp(\n calendar.getTimeInMillis(), getContext()));\n }", "public boolean verifyMessage(ATMMessage atmMessage){\n if(!(this.currTimeStamp < atmMessage.getTimeStamp())) error (\"Time stamp does not match\");\r\n if(!(parameterGenerator.getPreviousNonce() == atmMessage.getResponseNonce())) error (\"Nonce does not match\");\r\n return true;\r\n \r\n }", "public int getTimeOfSession();", "public boolean hasSentTime() {\n return fieldSetFlags()[22];\n }", "public java.lang.String getSentTime() {\n return sentTime;\n }", "public java.lang.String getUserCreated() {\n\t\treturn _tempNoTiceShipMessage.getUserCreated();\n\t}", "@Override\r\n public String toString() {\r\n return timeStamp + username + \": \" + message;\r\n }" ]
[ "0.7303476", "0.65674466", "0.6544194", "0.6428961", "0.6305228", "0.63029766", "0.6194173", "0.6031842", "0.59948826", "0.59508455", "0.591377", "0.58845735", "0.5867692", "0.58177865", "0.58073676", "0.5797791", "0.57942706", "0.5787618", "0.5773513", "0.57725155", "0.57693225", "0.5755074", "0.5754997", "0.57238555", "0.5715656", "0.56989044", "0.5691515", "0.5675676", "0.56613976", "0.5636865", "0.56045365", "0.55546784", "0.5552459", "0.5528175", "0.55260575", "0.5524816", "0.55182856", "0.5507525", "0.54995465", "0.5496848", "0.5496469", "0.5495446", "0.54867023", "0.54854345", "0.54767483", "0.54724056", "0.5469502", "0.5463076", "0.5452984", "0.5449482", "0.5440438", "0.54364955", "0.54249084", "0.54175425", "0.5414155", "0.5404061", "0.5398785", "0.5392342", "0.53746897", "0.53738403", "0.53601635", "0.5357555", "0.53549165", "0.53513247", "0.5350225", "0.5333051", "0.5329337", "0.5321905", "0.5313773", "0.53105587", "0.530986", "0.5309471", "0.5309076", "0.530651", "0.53030485", "0.5296245", "0.52878904", "0.5282658", "0.5279508", "0.52763015", "0.52700526", "0.5259112", "0.5249001", "0.5246344", "0.5244594", "0.524418", "0.52437687", "0.52435476", "0.5240966", "0.52402675", "0.5232678", "0.5231682", "0.52245355", "0.5221165", "0.52169985", "0.52101564", "0.5202054", "0.519687", "0.51933104", "0.5193158" ]
0.56916857
26
Create a new NumberedList.
public NumberedList() { _init=1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SuppressWarnings(\"unchecked\")\r\n public void createList() {\r\n items = new int[MAX_LIST];\r\n NumItems = 0;\r\n }", "public TempList(int n) {\n list = new ArrayList<T>(n >= 0 ? n : 0);\n }", "List() {\n final int ten = 10;\n list = new int[ten];\n size = 0;\n }", "public NumericObjectArrayList() {\r\n list = new Copiable[10];\r\n count = 0;\r\n }", "public ItemList(int n) {\n\t\tlast = 0;\n\t\tsize = n;\n\t\tlist = new Item[n];\n\t}", "public Mdn(ArrayList<Integer> numlist, int mdn) {\r\n\t\tthis.numlist=numlist;\r\n\t\tthis.mdn=mdn;\r\n\t}", "public NestedInteger() {\n\t\tthis.list = new ArrayList<>();\n\t}", "private MyIntegerList generatedPopulatedList() {\n final MyIntegerList mil = new MyIntegerList();\n\n mil.push(1);\n mil.push(2);\n mil.push(1);\n mil.push(6);\n mil.push(6);\n mil.push(7);\n mil.push(2);\n mil.push(2);\n mil.push(0);\n mil.push(5);\n\n return mil;\n }", "public IntList() { // doesn't HAVE to be declared public, but doesn't hurt\n theList = new int[STARTING_SIZE];\n size = 0;\n }", "public NestedInteger() {\n this.list = new ArrayList<>();\n }", "private BorderPane makeNumberPane() {\n \n /* This method is similar to makeNamePane(), except for the way that initial\n * items are added to the list, and the use of a custom StringConverter.\n * (Also, it works with listView.getItems() directly, instead of having a\n * name for that list.) */\n \n ListView<Integer> listView = new ListView<>(); // start with an empty list.\n listView.setEditable(true);\n\n int[] primes = { 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97 };\n for (int i = 0; i < primes.length; i++) { // add items to the ObservableList of items.\n listView.getItems().add(primes[i]);\n }\n \n// We could use a standard IntegerStringConverter to convert items in the list to and from\n// their string representation. However, I don't like the way it handles bad input, so\n// I will make my own. To use a standard converter, use the command in the next line:\n// listView.setCellFactory(TextFieldListCell.forListView( new IntegerStringConverter() ));\n \n StringConverter<Integer> myConverter = new StringConverter<Integer>() {\n // This custom string converter will convert a bad input string to\n // null, instead of just failing. And it will display a null value\n // as \"Bad Value\" and an empty string value as 0.\n public Integer fromString(String s) {\n if (s == null || s.trim().length() == 0)\n return 0;\n try {\n return Integer.parseInt(s);\n }\n catch (NumberFormatException e) {\n return null;\n }\n }\n public String toString(Integer n) {\n if (n == null)\n return \"Bad Value\";\n return n.toString();\n }\n };\n \n listView.setCellFactory( TextFieldListCell.forListView( myConverter ));\n \n BorderPane numberPane = new BorderPane(listView);\n Label top = new Label(\"My Favorite Numbers\");\n top.setPadding( new Insets(10) );\n top.setFont( Font.font(20) );\n top.setTextFill(Color.YELLOW);\n top.setMaxWidth(Double.POSITIVE_INFINITY);\n top.setAlignment(Pos.CENTER);\n top.setStyle(\"-fx-background-color: black\");\n numberPane.setTop(top);\n \n Label selectedIndexLabel = new Label();\n selectedIndexLabel.textProperty().bind(\n listView.getSelectionModel().selectedIndexProperty().asString(\"Selected Index: %d\") );\n \n Label selectedNumberLabel = new Label();\n selectedNumberLabel.textProperty().bind(\n listView.getSelectionModel().selectedItemProperty().asString(\"SelectedItem: %s\") );\n \n Button deleteNumberButton = new Button(\"Delete Selected Item\");\n deleteNumberButton.setMaxWidth(Double.POSITIVE_INFINITY);\n deleteNumberButton.disableProperty().bind( \n listView.getSelectionModel().selectedIndexProperty().isEqualTo(-1) );\n deleteNumberButton.setOnAction( e -> {\n int index = listView.getSelectionModel().getSelectedIndex();\n if (index >= 0)\n listView.getItems().remove(index);\n });\n \n TextField addNumberInput = new TextField();\n addNumberInput.setPrefColumnCount(10);\n Button addNumberButton = new Button(\"Add: \");\n addNumberButton.setOnAction( e -> {\n String name = addNumberInput.getText().trim();\n if (name.length() > 0) {\n listView.getItems().add(Integer.parseInt(name));\n addNumberInput.selectAll();\n listView.scrollTo(listView.getItems().size() - 1);\n }\n });\n addNumberButton.defaultButtonProperty().bind( addNumberInput.focusedProperty() );\n HBox addNameHolder = new HBox(5,addNumberButton,addNumberInput);\n \n VBox nameBot = new VBox(12, selectedIndexLabel, selectedNumberLabel, deleteNumberButton, addNameHolder );\n nameBot.setPadding(new Insets(10));\n numberPane.setBottom(nameBot);\n \n return numberPane;\n \n }", "public IntegerList(int size)\n {\n list = new int[size];\n }", "public Liste(){\n\t\tsuper();\n\t\tthis.liste = new int[this.BASE_LENGTH];\n\t\tthis.nb = 0;\n\t}", "abstract protected Object newList( int capacity );", "public List() {\n this.list = new Object[MIN_CAPACITY];\n this.n = 0;\n }", "public IntegerList(int size)\n {\n list = new int[size];\n }", "private List<Integer> createData() {\r\n\t\tList<Integer> data = new ArrayList<Integer>();\r\n\t\tfor (int i = 0; i < N; i++) {\r\n\t\t\tdata.add(i);\r\n\t\t}\r\n\t\treturn data;\r\n\t}", "public IntList(int size){\n\t\tprime = new ArrayList<Integer>(size);\n\t}", "public Numbers(int number) {\r\n\t\tthis.number = number;\r\n\t}", "private Numbers() {\n\t}", "public FixedSizeList(int capacity) {\n // YOUR CODE HERE\n }", "int createList(int listData) {\n\t\tint list = newList_();\n\t\t// m_lists.set_field(list, 0, null_node());//head\n\t\t// m_lists.set_field(list, 1, null_node());//tail\n\t\t// m_lists.set_field(list, 2, null_node());//prev list\n\t\tm_lists.setField(list, 3, m_list_of_lists); // next list\n\t\tm_lists.setField(list, 4, 0);// node count in the list\n\t\tm_lists.setField(list, 5, listData);\n\t\tif (m_list_of_lists != nullNode())\n\t\t\tsetPrevList_(m_list_of_lists, list);\n\n\t\tm_list_of_lists = list;\n\t\treturn list;\n\t}", "public VectorLinearList()\n {// use default capacity of 10\n this(10);\n }", "NumberValue createNumberValue();", "public <T extends Integer> void create( T list ) {\n Implementation<T> impl = (Implementation<T>) test.get(list.getClass());\n if( impl == null ) {\n impl = new Implementation<>(list);\n test.put(list.getClass(), impl);\n }\n }", "public AdjacencyLists(int num)\n {\n numVertices = num;\n clearGraph();\n }", "public ListHolder()\n {\n this.list = new TestList(15, false);\n }", "@Override\n\tpublic Iterator<NumberInterface> createIterator() {\n\t\treturn numbers.iterator();\n\t}", "public ArrayList() {\n\t\tthis(10, 75);\n\t}", "public List()\n\t{\n\t\tthis(null, null);\n\t}", "ListType createListType();", "public List()\n {\n list = new Object [10];\n }", "public DLList() {\r\n init();\r\n }", "public MultiList(int listType){\n this.listType = listType;\n }", "public DDCountInversion(){\n\t\tnumeros = new ArrayList<Integer>();\n\t}", "@Test\n public void fieldListNum() throws Exception {\n Document doc = new Document();\n DocumentBuilder builder = new DocumentBuilder(doc);\n\n // LISTNUM fields display a number that increments at each LISTNUM field.\n // These fields also have a variety of options that allow us to use them to emulate numbered lists.\n FieldListNum field = (FieldListNum) builder.insertField(FieldType.FIELD_LIST_NUM, true);\n\n // Lists start counting at 1 by default, but we can set this number to a different value, such as 0.\n // This field will display \"0)\".\n field.setStartingNumber(\"0\");\n builder.writeln(\"Paragraph 1\");\n\n Assert.assertEquals(\" LISTNUM \\\\s 0\", field.getFieldCode());\n\n // LISTNUM fields maintain separate counts for each list level. \n // Inserting a LISTNUM field in the same paragraph as another LISTNUM field\n // increases the list level instead of the count.\n // The next field will continue the count we started above and display a value of \"1\" at list level 1.\n builder.insertField(FieldType.FIELD_LIST_NUM, true);\n\n // This field will start a count at list level 2. It will display a value of \"1\".\n builder.insertField(FieldType.FIELD_LIST_NUM, true);\n\n // This field will start a count at list level 3. It will display a value of \"1\".\n // Different list levels have different formatting,\n // so these fields combined will display a value of \"1)a)i)\".\n builder.insertField(FieldType.FIELD_LIST_NUM, true);\n builder.writeln(\"Paragraph 2\");\n\n // The next LISTNUM field that we insert will continue the count at the list level\n // that the previous LISTNUM field was on.\n // We can use the \"ListLevel\" property to jump to a different list level.\n // If this LISTNUM field stayed on list level 3, it would display \"ii)\",\n // but, since we have moved it to list level 2, it carries on the count at that level and displays \"b)\".\n field = (FieldListNum) builder.insertField(FieldType.FIELD_LIST_NUM, true);\n field.setListLevel(\"2\");\n builder.writeln(\"Paragraph 3\");\n\n Assert.assertEquals(\" LISTNUM \\\\l 2\", field.getFieldCode());\n\n // We can set the ListName property to get the field to emulate a different AUTONUM field type.\n // \"NumberDefault\" emulates AUTONUM, \"OutlineDefault\" emulates AUTONUMOUT,\n // and \"LegalDefault\" emulates AUTONUMLGL fields.\n // The \"OutlineDefault\" list name with 1 as the starting number will result in displaying \"I.\".\n field = (FieldListNum) builder.insertField(FieldType.FIELD_LIST_NUM, true);\n field.setStartingNumber(\"1\");\n field.setListName(\"OutlineDefault\");\n builder.writeln(\"Paragraph 4\");\n\n Assert.assertTrue(field.hasListName());\n Assert.assertEquals(\" LISTNUM OutlineDefault \\\\s 1\", field.getFieldCode());\n\n // The ListName does not carry over from the previous field, so we will need to set it for each new field.\n // This field continues the count with the different list name, and displays \"II.\".\n field = (FieldListNum) builder.insertField(FieldType.FIELD_LIST_NUM, true);\n field.setListName(\"OutlineDefault\");\n builder.writeln(\"Paragraph 5\");\n\n doc.updateFields();\n doc.save(getArtifactsDir() + \"Field.LISTNUM.docx\");\n //ExEnd\n\n doc = new Document(getArtifactsDir() + \"Field.LISTNUM.docx\");\n\n Assert.assertEquals(7, doc.getRange().getFields().getCount());\n\n field = (FieldListNum) doc.getRange().getFields().get(0);\n\n TestUtil.verifyField(FieldType.FIELD_LIST_NUM, \" LISTNUM \\\\s 0\", \"\", field);\n Assert.assertEquals(\"0\", field.getStartingNumber());\n Assert.assertNull(field.getListLevel());\n Assert.assertFalse(field.hasListName());\n Assert.assertNull(field.getListName());\n\n for (int i = 1; i < 4; i++) {\n field = (FieldListNum) doc.getRange().getFields().get(i);\n\n TestUtil.verifyField(FieldType.FIELD_LIST_NUM, \" LISTNUM \", \"\", field);\n Assert.assertNull(field.getStartingNumber());\n Assert.assertNull(field.getListLevel());\n Assert.assertFalse(field.hasListName());\n Assert.assertNull(field.getListName());\n }\n\n field = (FieldListNum) doc.getRange().getFields().get(4);\n\n TestUtil.verifyField(FieldType.FIELD_LIST_NUM, \" LISTNUM \\\\l 2\", \"\", field);\n Assert.assertNull(field.getStartingNumber());\n Assert.assertEquals(\"2\", field.getListLevel());\n Assert.assertFalse(field.hasListName());\n Assert.assertNull(field.getListName());\n\n field = (FieldListNum) doc.getRange().getFields().get(5);\n\n TestUtil.verifyField(FieldType.FIELD_LIST_NUM, \" LISTNUM OutlineDefault \\\\s 1\", \"\", field);\n Assert.assertEquals(\"1\", field.getStartingNumber());\n Assert.assertNull(field.getListLevel());\n Assert.assertTrue(field.hasListName());\n Assert.assertEquals(\"OutlineDefault\", field.getListName());\n }", "private static Node createLoopedList()\n {\n Node n1 = new Node(1);\n Node n2 = new Node(2);\n Node n3 = new Node(3);\n Node n4 = new Node(4);\n Node n5 = new Node(5);\n Node n6 = new Node(6);\n Node n7 = new Node(7);\n Node n8 = new Node(8);\n Node n9 = new Node(9);\n Node n10 = new Node(10);\n Node n11 = new Node(11);\n\n n1.next = n2;\n n2.next = n3;\n n3.next = n4;\n n4.next = n5;\n n5.next = n6;\n n6.next = n7;\n n7.next = n8;\n n8.next = n9;\n n9.next = n10;\n n10.next = n11;\n n11.next = n5;\n\n return n1;\n }", "public static void createListFromLong(ArrayList<Integer> list, long l) {\n\n\t\tint individualNum = 0;\n\t\n\t\twhile(l > 0) {\n\t\t\tindividualNum = (int) (l % 10);\n\t\t\tl /= 10;\n\t\t\t\n\t\t\tlist.add(individualNum);\n\t\t}\n\t\t\n\t\tCollections.reverse(list);\n\t}", "public TempList(int n, T elem) {\n list = new ArrayList<T>(n > 0 ? n : 0);\n while (n > 0) {\n list.add(elem);\n n--;\n }\n }", "OrderedIntList ()\r\n\t{\r\n\t\tarray = new int[10];\r\n\t}", "public TestFListInteger() {\n // an empty constructor since this class is just used for testing.\n }", "public LinkedJList() {\n this(DEFAULT_CAPACITY);\n }", "public LinkedList<Integer> makeSorted() \n\t {\n\t\t return new LinkedList<Integer>();\n\t }", "OrderedIntList(int size)\n\t{\n\t\tdata = new int[size];\n\t\tcount = 0;\n\t}", "Instance(int N,int L){\r\n\t\tthis.x=new ArrayList<Entry>();\r\n\t\tthis.y=new HashSet<Integer>();\r\n\t\tthis.N=N;\r\n\t\tthis.L=L;\r\n\t}", "java.util.List<java.lang.Integer> getBlockNumbersList();", "private Int64List(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {\n super(builder);\n }", "public CounterListModel() {\n\t\tsuper();\n\t\tlist = new ArrayList<CounterModel>();\n\t}", "public ListReferenceBased() {\r\n\t numItems = 0; // declares numItems is 0\r\n\t head = null; // declares head is null\r\n }", "public Builder addListSnId(int value) {\n ensureListSnIdIsMutable();\n listSnId_.addInt(value);\n onChanged();\n return this;\n }", "static ArrayListFragment newInstance(int num) {\n\t\t\tArrayListFragment f = new ArrayListFragment();\n\n\t\t\t// Supply num input as an argument.\n\t\t\tBundle args = new Bundle();\n\t\t\targs.putInt(\"num\", num);\n\t\t\tLog.i(\"TAG\", num + \"\");\n\t\t\tf.setArguments(args);\n\n\t\t\treturn f;\n\t\t}", "public AdjListNode(int n) {\n\t\tvertexIndex = n;\n\t}", "public MultiList(){}", "DListNode() {\n item[0] = 0;\n item[1] = 0;\n item[2] = 0;\n prev = null;\n next = null;\n }", "public IntArrayList() {\n this(DEFAULT_EXPECTED_ELEMENTS);\n }", "LList2(int size) {\r\n\t\tthis();\r\n\t}", "public SkipList()\n {\n\tthis(0.5);\n }", "public linkedList() { // constructs an initially empty list\r\n\r\n }", "public List<String> getNumbers(){\n\t\treturn this.numberList;\n\t}", "public static ListNode createListFromDigitArray(int[] digits){\n if(digits.length == 0 || digits == null){\n return null;\n }\n ListNode result = new ListNode(digits[0]);\n ListNode head = result;\n ListNode nextNode;\n for(int i = 1; i < digits.length; i++){\n ListNode newNode = new ListNode(digits[i]);\n head.next = newNode;\n head = newNode;\n }\n return result;\n }", "public PrimeNrAdapter(List<PrimeNr> primeNrs) {\n this.primeNrs = primeNrs;\n }", "public IntegerDt getNumberElement() { \n\t\tif (myNumber == null) {\n\t\t\tmyNumber = new IntegerDt();\n\t\t}\n\t\treturn myNumber;\n\t}", "public IntegerDt getNumberElement() { \n\t\tif (myNumber == null) {\n\t\t\tmyNumber = new IntegerDt();\n\t\t}\n\t\treturn myNumber;\n\t}", "public void setListProperty(List<Integer> t) {\n\n\t\t}", "public Node(Integer number){\n this.number = number;\n this.edges = new ArrayList<Edge>();\n }", "private Lists() { }", "public MutiList() {\n\t\tsuper();\n\t\tthis.myList = new ArrayList<>();\n\t}", "public LinkedList() {\n\t\titems = lastNode = new DblListnode<E>(null);\n\t\tnumItems=0;\n\t}", "public AdjList(int verticesNum) {\n\t\tthis.verticesNum = verticesNum;\n\t\tlist = new DocTokenLinkedList[verticesNum];\n\t\t\n\t\t// initialize all of the linked lists in the array\n\t\tfor (int index = 0; index < verticesNum; index++) {\n\t\t\tlist[index] = new DocTokenLinkedList();\n\t\t}\n\t}", "public Token newNumberToken(String number, int startPosition, int endPosition) {\r\n return new Token(startPosition, endPosition,\r\n Symbol.symbol(number, Tokens.INTeger));\r\n }", "private IntegerListMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {\n super(builder);\n }", "private static ListNode initializeListNode() {\n\n\t\tRandom rand = new Random();\n\t\tListNode result = new ListNode(rand.nextInt(10)+1);\n\t\t\n\t\tresult.next = new ListNode(rand.nextInt(10)+1);\n\t\tresult.next.next = new ListNode(rand.nextInt(10)+1);\n\t\tresult.next.next.next = new ListNode(rand.nextInt(10)+1);\n\t\tresult.next.next.next.next = new ListNode(rand.nextInt(10)+1);\n\t\t\n\t\treturn result;\n\t}", "public List(E value) {\n\t\thead = new ListNode(value, null);\n\t}", "public ArrayList()\n {\n list = new int[SIZE];\n length = 0;\n }", "public NumberSequence(HsqlName name, long value, long increment,\n Type type) {\n\n this(name, type);\n\n setStartValue(value);\n setIncrement(increment);\n }", "public static DoublyLinkedListHeader createList() {\n\t\tSystem.out.println(\"Enter the size of the DLLHeader list \");\r\n\t\tint size = checkInt(); // get size of ll\r\n\t\tDoublyLinkedListHeader list = new DoublyLinkedListHeader();\r\n\t\tInteger scanned_obj;\r\n\t\tfor(int i = 0; i<size;i++) {\r\n\t\t\tSystem.out.println(\"Enter Object \" + (i+1)+\" \");\r\n\t\t\tscanned_obj = checkInt();\r\n\t\t\tlist.add(scanned_obj);\r\n\t\t}\r\n\t\treturn list;\r\n\t}", "@SuppressWarnings(\"unchecked\")\r\n \tpublic List() {\r\n \t\titems = (T[]) new Object[INIT_LEN];\r\n \t\tnumItems = 0;\r\n \t\tcurrentObject = 0;\r\n \t}", "public DoubledList() {\r\n front = null;\r\n size = 0;\r\n }", "public NamedList() {\n\t\tnvPairs = new ArrayList<Object>();\n\t}", "@ProtoFactory\n public LinkedList<E> create(int size) {\n return new LinkedList<>();\n }", "public static ArrayList<Integer> createList(int listSize) {\n ArrayList<Integer> list = new ArrayList<>();\n for (int i = 0; i < listSize; i++) {\n list.add(i);\n }\n return list;\n }", "public ListNode(int data) {\n\t\tthis(data, null);\n\t}", "public ListTimer(List<Integer> list){\n\t\tsuper();\n\t\tthis.list = list;\n\t}", "public SortedList(){\n this(\"list\");\n }", "public static ElementInsertionList create()\n {\n return new ElementInsertionList();\n }", "public static GroupList newInstance() {\n\t\tGroupList f = new GroupList();\n\t\tBundle b = new Bundle();\n\t\tf.setArguments(b);\n\t\treturn f;\n\t}", "public Number(int n) \n {\n nn = n; // initailize with the inputed value\n }", "public ListOrdered() {\n\t\tsuper(NotesEtcTypes.DATA_TYPE_LIST_ORDERED);\n\t}", "public IntLinkedList() {\r\n\t\tsentinel = new Node();\r\n\t\tsentinel.next = sentinel;\r\n\t\tsentinel.previous = sentinel;\r\n\t}", "public Happy_Number()\r\n\t{\r\n\t\tnumberHolder = new int[20];\r\n\t\tfor(int ii = 0; ii < numberHolder.length; ii++)\r\n\t\t{\r\n\t\t\tnumberHolder[ii] = 0;\r\n\t\t}\r\n\t}", "public List(){\n\t\tthis(\"list\", new DefaultComparator());\n\t}", "public ListNode() {\n\t\tthis(0, null);\n\t}", "public NestedInteger(int value) {\n this.value = value;\n this.list = new ArrayList<>();\n\n }", "public SortedList() {\n super();\n }", "public void init() {\n l0 = new EmptyList();\n l1 = FListInteger.add(l0, new Integer(5));\n l2 = FListInteger.add(l1, new Integer(4));\n l3 = FListInteger.add(l2, new Integer(7));\n l4 = new EmptyList();\n l5 = FListInteger.add(l2, new Integer(7));\n }", "private void createNumber() {\n\t\tString value = \"\";\n\t\tvalue += data[currentIndex++];\n\t\t// minus is no longer allowed\n\t\twhile (currentIndex < data.length\n\t\t\t\t&& Character.isDigit(data[currentIndex])) {\n\t\t\tvalue += data[currentIndex++];\n\t\t}\n\n\t\tif (currentIndex + 1 < data.length && (data[currentIndex] == '.'\n\t\t\t\t&& Character.isDigit(data[currentIndex + 1]))) {\n\t\t\tvalue += data[currentIndex++]; // add .\n\t\t} else {\n\t\t\ttoken = new Token(TokenType.NUMBER, Integer.parseInt(value));\n\t\t\treturn;\n\t\t}\n\t\t// get decimals of number\n\t\twhile (currentIndex < data.length\n\t\t\t\t&& Character.isDigit(data[currentIndex])) {\n\t\t\tvalue += data[currentIndex++];\n\t\t}\n\t\ttoken = new Token(TokenType.NUMBER, Double.parseDouble(value));\n\t}", "public static Node createList(){\n Scanner sc = new Scanner(System.in);\n System.out.println(\"Enter size of linked list:\");\n int n = sc.nextInt();\n\n Node head = new Node(sc.nextInt());\n Node ref = head;\n while(--n!=0) {\n head.next = new Node(sc.nextInt());\n head = head.next;\n }\n return ref;\n\n }", "public LinkedList() {\n\t\tthis(\"list\");\n\t}", "@attribute(value = \"\", required = true)\t\r\n\tpublic void addNumberField(NumberField f) {\r\n\t\tfields.put(\"\" + fieldCount++, f);\r\n\t}", "java.util.List<java.lang.Integer> getBlockNumsList();" ]
[ "0.63987136", "0.6354183", "0.630242", "0.623829", "0.6235397", "0.61940885", "0.61928207", "0.61872596", "0.6108343", "0.6085024", "0.5989366", "0.5978271", "0.5962744", "0.59306717", "0.59008783", "0.5895786", "0.58338827", "0.58226067", "0.5822565", "0.57845175", "0.5717614", "0.5716641", "0.5706074", "0.5677072", "0.56689596", "0.56576616", "0.5642047", "0.5639332", "0.56301296", "0.5625004", "0.5624283", "0.5623743", "0.56172884", "0.5616954", "0.5590451", "0.5587405", "0.55870456", "0.558646", "0.55861664", "0.5570137", "0.55648696", "0.5562196", "0.5560457", "0.5558832", "0.555877", "0.55528784", "0.55454254", "0.5527651", "0.55228174", "0.5506077", "0.549906", "0.5488584", "0.5481947", "0.54614884", "0.5459725", "0.5456366", "0.5455075", "0.54533017", "0.5452518", "0.54186517", "0.5418227", "0.5417446", "0.5417446", "0.5409197", "0.5406051", "0.539898", "0.5398613", "0.53950155", "0.53933805", "0.5390716", "0.5376277", "0.53689414", "0.5366994", "0.5359768", "0.5359534", "0.53532875", "0.5348397", "0.5346556", "0.53427386", "0.5336632", "0.5325889", "0.5318398", "0.5316417", "0.53073084", "0.53053516", "0.53005856", "0.52969", "0.52934366", "0.52912843", "0.5288295", "0.5286936", "0.527778", "0.52768916", "0.5266799", "0.5262755", "0.52519745", "0.52514774", "0.52510434", "0.52504194", "0.5248077" ]
0.78727764
0
Get the initial value.
public int getInitialValue() { return _init; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getInitialValue() {\n return initialValue;\n }", "public int getInitialValue() {\n return initialValue;\n }", "public int getInitialValue() {\r\n\t\treturn initialValue;\r\n\t}", "public String getInitialValue() {\n\t\treturn initialValue;\n\t}", "protected abstract int getInitialValue();", "public int getInital_value(){\n return this.inital_value;\n }", "public long getInitial() {\n return m_Initial;\n }", "public InitialValElements getInitialValAccess() {\r\n\t\treturn pInitialVal;\r\n\t}", "public Object getInitValue()\r\n\t{\r\n\t\treturn initValue;\r\n\t}", "public double getDefaultValue() {\n return defaultValue;\n }", "public void setInitialValue(int initialValue) {\n this.initialValue = initialValue;\n }", "public void setInitialValue(int initialValue) {\n this.initialValue = initialValue;\n }", "public double getDefault(){\n return number;\n }", "public int getInitialMoney() {\n return initialMoney;\n }", "public void initialize() {\r\n\t\tsetValue(initialValue);\r\n\t}", "public Integer getDefaultTemp() {\n return defaultTemp;\n }", "public Object getDefaultValue();", "public Object getDefaultValue();", "String getDefaultValue();", "String getDefaultValue();", "public String getDefaultValue() {\n return m_defaultValue;\n }", "public int getIntDefaultValue() {\n\t\t\treturn this.intDefaultValue;\n\t\t}", "public int getDefault(){\n return number;\n }", "@Override\n public Boolean getInitialValue() {\n return true;\n }", "public char getInitial() {\n\t\treturn initial;\n\t}", "public String getDefaultValue() {\n return this.defaultValue;\n }", "public Integer getDefaultNumber() {\n return defaultNumber;\n }", "@Override\n\tprotected String initial() {\n\t\treturn INITIAL;\n\t}", "static public int getDefaultInt () {\n return defaultInt;\n }", "public Number getMinimumAccessibleValue() {\n return Integer.valueOf(0);\n }", "public char getInitial() {\n\t\treturn this.initial; \n\t}", "public T getDefaultValue() {\n return defaultValue.orNull();\n }", "public void setInital_value(int inital_value){\n this.inital_value= inital_value;\n }", "public void setInitialValue(float initialValue) {\n this.initialValue = initialValue;\n }", "public String getDefaultValue() {\n\t\t\treturn this.defaultValue;\n\t\t}", "public void setInitialValue(int newInitialValue) {\n\t\tinitialValue = newInitialValue;\n\t}", "public String getDefaultValue () {\n return defaultValue;\n }", "T getDefaultValue();", "public String getDefaultValue() {\n return defaultValue;\n }", "public Double getInitialTransmittedPower() {\n return mInitialTransmittedPowerdBm != null ?\n Utils.dBmToPower(mInitialTransmittedPowerdBm) : null;\n }", "public Double getInitialTransmittedPower() {\n return mInitialTransmittedPowerdBm != null ?\n Utils.dBmToPower(mInitialTransmittedPowerdBm) : null;\n }", "public String getDefaultValue() {\n return defaultValue;\n }", "public Number getCurrentAccessibleValue() {\n return Integer.valueOf(0);\n }", "public String getDefaultValue() {\n return type.getDefaultValue();\n }", "public double[] initial()\r\n\t{\r\n\t\treturn initial;\r\n\t}", "public double getInitialBalance() {\n return initialBalance;\n }", "public String getInitialPosition() {\n\t\treturn initPos;\n\t}", "public void setInitialValue(int initialValue) {\n if(initialValue <= 0) {\n initialValue = 1;\n }\n super.setInitialValue(initialValue);\n }", "public @NotNull T getDefaultValue() {\n return defaultValue;\n }", "public String getDefault(){\n return _default;\n }", "public IDatatype getDefaultValue() { \n\t\treturn myDefaultValue;\n\t}", "public Object getBaseValue() {\r\n return Long.valueOf(0);\r\n }", "public int getRootValue() {\n if (root == null) {\n return 0;\n } else {\n return root.getValue();\n }\n }", "public String getDefaultValue() {\n\t\t\treturn null;\r\n\t\t}", "public String getDefaultValue() {\n\t\t\treturn null;\r\n\t\t}", "public int getMinValue() {\n return minValue;\n }", "public double getInitialElectricityInput() {\r\n\t\treturn initialElectricityInput;\r\n\t}", "public GroundedValue materialize() {\r\n if (start == 0) {\r\n return baseValue;\r\n } else {\r\n return baseValue.subsequence(start, Integer.MAX_VALUE);\r\n }\r\n }", "public float getInitialPosition() {\n return initialPosition;\n }", "public BigDecimal getInitAmt() {\n return initAmt;\n }", "public double initialNotional()\n\t{\n\t\treturn _lsPeriod.get (0).baseNotional();\n\t}", "public double getInitialValue(double nodeValue, double randomValue, Object flag){\n\t\tdouble meanReversion = 0;\r\n\t\tdouble diffusion = 0;\r\n\t\tif (flag.equals(0)){\r\n\t\t\tmeanReversion = _hwParams.getMeanReversion1_2F();\r\n\t\t\tdiffusion = getDiffusion1(_numTimeSteps - 1);\r\n\t\t\t\r\n\t\t} else if (flag.equals(1)){\r\n\t\t\tmeanReversion = _hwParams.getMeanReversion2_2F();\r\n\t\t\tdiffusion = getDiffusion2(_numTimeSteps - 1);\r\n\t\t}\r\n//\t\t\t\tdouble dt = _tenors.get(_numTimeSteps - 1) + 1.0 /_dcf.getDaysOfYear();\r\n\t\tdouble dt = _tenors.get(_numTimeSteps - 1);\r\n\t\tdouble drift = Math.exp(-meanReversion * dt);\r\n\t\tdouble vol = Math.sqrt((1 - Math.exp(-2 * meanReversion * dt))/(2 * meanReversion));\r\n\t\t\r\n\t\treturn drift * nodeValue + diffusion * vol * randomValue;\r\n\t}", "private int SetInitialAttitude() {\n\t\tint value = Random.randomInt(10) - 5;\n\t\tif(debug) logger.info(\"SetInitialAttitude: value = \" + value);\n\t\treturn(value);\n\t}", "@AnyLogicInternalCodegenAPI\n public int _InitPopulation_DefaultValue_xjal() {\n final Main self = this;\n return \n1000 \n;\n }", "public String getDefaultValue() {\r\n if (this == BOOLEAN) {\r\n return \"false\";\r\n }\r\n\r\n if (this == CHAR) {\r\n return \"''\";\r\n }\r\n\r\n if (this == VOID) {\r\n return \"\";\r\n }\r\n\r\n if (this == FLOAT) {\r\n return \"0.f\";\r\n }\r\n\r\n if (this == DOUBLE) {\r\n return \"0.0\";\r\n }\r\n\r\n return \"0\";\r\n }", "public T getDefault() {\r\n return dflt;\r\n }", "public State getinitialState(){\n\t\t\treturn initialState;\n\t\t}", "public Position getInitialPixel() {\n\t\treturn initialPixel;\n\t}", "public int getMinimumValue() {\n return -s.getMaximumValue();\n }", "public int getInitialSpeed() {\n return initialSpeed;\n }", "public State getInitialState() {\r\n \t\treturn initialState;\r\n \t}", "public State getInitialState() {\n\t\treturn initialState;\n\t}", "public BigInteger getStartValue()\r\n {\r\n return this.startValue;\r\n }", "public P getInitialPosition() {\n return mInitialPosition;\n }", "public P getInitialPosition() {\n return mInitialPosition;\n }", "public P getInitialPosition() {\n return mInitialPosition;\n }", "public int baseZeroValue() {\n return this.value - 1;\n }", "public Point getInitialPosition()\n {\n return this.initialPosition;\n }", "@java.lang.Override\n public com.google.protobuf.Value getDefaultValue() {\n return defaultValue_ == null ? com.google.protobuf.Value.getDefaultInstance() : defaultValue_;\n }", "@Override\r\n public MachineState getInitialState() {\r\n \tclearpropnet();\r\n \tpropNet.getInitProposition().setValue(true);\r\n\t\tMachineState initial = getStateFromBase();\r\n\t\treturn initial;\r\n }", "public Double getMinimumValue () {\r\n\t\treturn (minValue);\r\n\t}", "protected Object getDefaultValue() {\r\n if (FeatureCollectionTools.isAttributeTypeNumeric((AttributeType) this.typeDropDown.getSelectedItem())) {\r\n AttributeType at = (AttributeType) this.typeDropDown.getSelectedItem();\r\n\r\n if (at.equals(AttributeType.INTEGER)) {\r\n int i = Integer.parseInt(this.defValueTextField.getText());\r\n return new Integer(i);\r\n }\r\n double d = Double.parseDouble(this.defValueTextField.getText());\r\n return new Double(d);\r\n }\r\n return this.defValueTextField.getText();\r\n }", "public int getMinValue() throws Exception {\n\t\treturn RemoteServer.instance().executeAndGetId(\"getminvalue\",\n\t\t\t\tgetRefId());\n\t}", "String getCurrentValue();", "@Doc(\"The value to use if the variable is accessed when it has never been set.\")\n\t@BindNamedArgument(\"default\")\n\tpublic Double getDefaultValue() {\n\t\treturn defaultValue;\n\t}", "public E startState() {\r\n\t\treturn this.values[0];\r\n\t}", "public double minValue() {\n return 0;\r\n }", "@Override\n public T getValue() {\n // Returns initial value if source is not set.\n return mLiveDataSource == null ? mInitialValue : mLiveDataSource.getValue();\n }", "@Override\n\tpublic State getSingleInitialState()\n\t{\n\t\tassert (initialState != null);\n\t\treturn initialState;\n\t}", "@Override\n\tpublic Position getInitialPosition() \n\t{\n\t\treturn initialPosition;\n\t}", "public int getInitX(){\r\n\t\treturn initX;\r\n\t}", "public Object getDefault() {\n\t\treturn defaultField;\n\t}", "protected T getValue0() {\n\t\treturn value;\n\t}", "public static TLAExpr DefaultVarInit()\n /*********************************************************************\n * Returns the default initial value of a variable declared with no *\n * value specified, which is herein defined to be \"{}\". *\n * *\n * Default initial value changed to \"defaultInitValue\" *\n * by LL on 22 Aug 2007 *\n *********************************************************************/\n { Vector<TLAToken> line = new Vector<TLAToken>() ;\n// line.addElement(new TLAToken(\"{\", 0, 0)) ;\n// line.addElement(new TLAToken(\"}\", 0, 0)) ;\n line.addElement(new TLAToken(\"defaultInitValue\", 0, 0));\n Vector<Vector<TLAToken>> vec = new Vector<Vector<TLAToken>>() ;\n vec.addElement(line) ;\n TLAExpr exp = new TLAExpr(vec) ;\n exp.normalize() ;\n return exp ;\n }", "public double getInitialElectricityProduction() {\r\n\t\treturn initialElectricityProduction;\r\n\t}", "public Character getInitialEval() {\n return initialEval;\n }", "@AnyLogicInternalCodegenAPI\n public double _InfectionRisk_DefaultValue_xjal() {\n final Main self = this;\n return \n0.08 \n;\n }", "@AnyLogicInternalCodegenAPI\n public int _EncounterRate_DefaultValue_xjal() {\n final Main self = this;\n return \n10 \n;\n }", "@Override\n\tpublic void initValue() {\n\t\t\n\t}", "@AnyLogicInternalCodegenAPI\n public double _DeathRisk_DefaultValue_xjal() {\n final Main self = this;\n return \n0.01 \n;\n }" ]
[ "0.8513254", "0.8513254", "0.84268266", "0.814184", "0.7985854", "0.76690733", "0.75192845", "0.74089414", "0.73232454", "0.66696084", "0.6661448", "0.6661448", "0.6627064", "0.65807486", "0.6572538", "0.6558218", "0.65492815", "0.65492815", "0.6537628", "0.6537628", "0.6518292", "0.65154445", "0.6507567", "0.6479132", "0.6442115", "0.6437093", "0.6424819", "0.63917804", "0.63749874", "0.63656425", "0.6361826", "0.6349691", "0.63442236", "0.63389087", "0.63299096", "0.6319966", "0.6295389", "0.6284613", "0.6282635", "0.62465465", "0.62465465", "0.6231581", "0.621982", "0.621952", "0.6208924", "0.62000936", "0.61945915", "0.6192175", "0.6158624", "0.6153361", "0.6153311", "0.6141765", "0.61348915", "0.61089826", "0.61089826", "0.60980165", "0.60964143", "0.6094991", "0.60863274", "0.60849047", "0.60704875", "0.6068152", "0.6055345", "0.60361224", "0.603522", "0.6023464", "0.60130066", "0.6001142", "0.59996545", "0.5997843", "0.59975964", "0.59959984", "0.5977046", "0.5976512", "0.5976512", "0.5976512", "0.59657216", "0.5961354", "0.59530157", "0.5944652", "0.5943707", "0.5943336", "0.5940369", "0.5937111", "0.5934343", "0.59314847", "0.5921645", "0.592017", "0.59104747", "0.590683", "0.58938575", "0.5892745", "0.5891937", "0.58883274", "0.5886686", "0.5884997", "0.5882974", "0.5881914", "0.5880697", "0.5878789" ]
0.8633377
0
Getting formatted message by pattern layout
public String getFormattedMessage(String level,String message, String target){ StringBuilder builder = new StringBuilder(); for (String next : priority) { if(next.equals("date")){ if(date == null) { builder.append(dateFormat.format(new Date())); }else builder.append(dateFormat.format(date)); builder.append(" "); }else if(next.equals("level")){ builder.append(level); builder.append(" "); }else if(next.equals("target")){ builder.append(target); builder.append(" "); }else if(next.equals("message")){ builder.append(message); builder.append(" "); }else if(next.equals("separate")){ builder.append(separate); builder.append(" "); } } return builder.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static String format(String pattern, Object... params) {\n\t\tStringBuffer result = new StringBuffer();\n\t\tnew MessageFormat(pattern, getLocale()).format(params, result, null);\n\t\treturn result.toString();\n\t}", "private static String format(final String pattern, final Object... args) {\n\t\tString message = pattern;\r\n\t\tif (Constants.ZERO < args.length) {\r\n\t\t\ttry {\r\n\t\t\t\tmessage = MessageFormat.format(pattern, args);\r\n\t\t\t} catch (final Exception ex) {\r\n\t\t\t\tmessage = pattern;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn message;\r\n\t}", "String formatMessage(LogMessage ioM);", "public Pattern getMessageAttribute() {\r\n return pattern_messageContinuationLine;\r\n }", "String getContentFormat();", "public static String formatOutputMessage(String patternCode, String value) {\n ResourceBundle bundle = ResourceBundle.getBundle(\"messages\", Locale.UK);\n String pattern = bundle.getString(patternCode);\n MessageFormat formatter = new MessageFormat(pattern);\n return formatter.format(new Object[]{value});\n }", "public String format(String pattern, Object o0, Object o1, Object o2) {\r\n return MessageFormat.format(getString(pattern), new Object[] {o0,o1,o2});\r\n }", "String getFormat();", "String getFormat();", "String getFormat();", "public String format(String pattern, Object o0, Object o1) {\r\n return MessageFormat.format(getString(pattern), new Object[] {o0,o1});\r\n }", "@VTID(8)\r\n java.lang.String format();", "public String format(String pattern, Object o0, Object o1, Object o2, Object o3) {\r\n return MessageFormat.format(getString(pattern), new Object[] {o0,o1,o2,o3});\r\n }", "protected abstract String format();", "public String format(String pattern, Object o0) {\r\n return MessageFormat.format(getString(pattern), new Object[] {o0});\r\n }", "public Pattern getStartOfMessage() {\r\n return pattern_messageFirstLine;\r\n }", "private Message formatMessage(LogRecord record)\n\t{\n\t\treturn new Message(record);\n\t}", "String getErrorLinePattern();", "static private String applyPattern(String key, Object[] messageArguments) {\n String message = getString(key);\n MessageFormat formatter = new MessageFormat(message);\n String output = formatter.format(message, messageArguments);\n return output;\n }", "private static String getLMsg(Object... msg) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(TOP_BORDER);\n\t\tsb.append(NEW_LINE);\n\t\tsb.append(HORIZONTAL_DOUBLE_LINE);\n\t\tsb.append(BLANK + callMethodAndLine());\n\t\tsb.append(NEW_LINE);\n\t\tsb.append(MIDDLE_BORDER);// 1\n\t\tsb.append(NEW_LINE);\n\t\t// sb.append(HORIZONTAL_DOUBLE_LINE);\n\n\t\tfor (Object element : msg) {\n\t\t\tif (element == null) {\n\t\t\t\treturn \"Object is null!\";\n\t\t\t}\n\t\t\tString mark = \"\";\n\t\t\tif (msg.length != 1) {\n\t\t\t\tmark = POINT;\n\t\t\t}\n\n\t\t\tString message = getString(element);\n\t\t\tif (message.contains(NEW_LINE)) {\n\t\t\t\tmessage = message.replaceAll(NEW_LINE, NEW_LINE\n\t\t\t\t\t\t+ HORIZONTAL_DOUBLE_LINE + BLANK);\n\t\t\t}\n\n\t\t\tsb.append(HORIZONTAL_DOUBLE_LINE);\n\t\t\tsb.append(BLANK);\n\t\t\tsb.append(mark);\n\t\t\tsb.append(message);\n\t\t\tsb.append(NEW_LINE);\n\t\t}// 2\n\t\tsb.append(BOTTOM_BORDER);// 3\n\t\treturn sb.toString();\n\t}", "public String format(String mformat, Object... args) {\n if(args.length==0){//expedite frequent case\n if (view != null) {\n view.append(mformat);\n }\n return mformat;\n }\n String ess = MessageFormat.format(mformat, args);\n if (view != null) {\n view.append(ess);\n }\n return ess;\n }", "private String format(String message) {\n InetSocketAddress local = (InetSocketAddress) context.channel().localAddress();\n InetSocketAddress remote = (InetSocketAddress) context.channel().remoteAddress();\n\n String localhost;\n if(local != null) {\n localhost = local.getAddress().getHostAddress() + \":\" + local.getPort();\n } else{\n localhost = \"undefined\";\n }\n\n String remotehost;\n if(remote != null) {\n remotehost = remote.getAddress().getHostAddress() + \":\" + remote.getPort();\n } else{\n remotehost = \"undefined\";\n }\n\n return \"[local: \" + localhost + \", remote: \" + remotehost + \"] \" + message;\n }", "protected String formatPatternRun( LogEvent event, PatternFormatter.PatternRun run )\n {\n switch( run.m_type )\n {\n case TYPE_CLASS:\n return getClass( run.m_format );\n default:\n return super.formatPatternRun( event, run );\n }\n }", "private String getMatchPattern(String pattern) {\n String mandatoryPart = pattern.trim().replaceAll(\"(\\\\s+?)\\\\[.+?\\\\]\", \"($1.+?(\\\\\\\\s|\\\\$))*\");\n mandatoryPart = mandatoryPart.replaceAll(\"\\\\s+\", \"\\\\\\\\s+\");\n return mandatoryPart.replaceAll(\"<.+?>\", \".+?\");\n }", "public static String format(final String _pattern,\r\n final Object[] _arguments) {\r\n return MessageFormat.format(_pattern, _arguments);\r\n }", "public static String formatMessage(String message) {\r\n \r\n message = parseColorCodes(message);\r\n message = parseFormatCodes(message);\r\n message = parseMarkupCodes(message);\r\n \r\n return message;\r\n }", "public String formatMessage(String message) {\n return String.format(\"<h1>%s</h1>\", message);\n// return MessageFormat.format(\"<h1>{0}}</h1>\", message);\n }", "private static String buildMessage(String format, Object... args) {\n String msg = (args == null) ? format : String.format(Locale.CHINA, format, args);\n\n StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();\n String caller = \"<unknown>\";\n /*\n Walk up the stack looking for the first caller outside the Log\n It will be at least two frames up, so start there\n */\n for(int i = 2; i < trace.length; i++) {\n Class<?> clazz = trace[i].getClass();\n if(!clazz.equals(Log.class)) {\n String callingClass = trace[i].getClassName();\n callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1);\n callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1);\n\n caller = callingClass + \".\" + trace[i].getMethodName();\n break;\n }\n }\n return String.format(Locale.CHINA, \"[%d] %s: %s\", Thread.currentThread().getId(), caller, msg);\n }", "public static String format(Object val, String pattern)\n {\n try\n { \n\t return format(val, pattern, null, null);\n }\n catch(Exception ex)\n {\n\t log.error(ex, \"[NumberUtil] Error caught in method format\");\n\t return \"\";\n }\n }", "String toLocalizedPattern() {\n return toPattern(true);\n }", "private String message() {\r\n if (markers.size() == 0) return \"\";\r\n String s = \"expecting \";\r\n boolean first = true;\r\n for (Marker m : markers) {\r\n if (! first) s = s + \", \";\r\n first = false;\r\n s = s + m.toString().toLowerCase().replaceAll(\"_\",\" \");\r\n }\r\n return s;\r\n }", "public static String getMessage(IPatternMatch match, boolean generatedMatcher) {\r\n \t\tif (generatedMatcher) {\r\n \t\t\treturn getMessageForGeneratedMatcher(match);\r\n \t\t}\r\n \t\telse {\r\n \t\t\treturn getMessageForGenericMatcher(match);\r\n \t\t}\r\n \t}", "public String getMessage() {\n String message = this.rawMessage;\n Boolean endsWithDot = false;\n Boolean endsWithQuestionMark = false;\n\n // Check if the last character is a dot\n if (message.charAt(message.length()-1) == '.') {\n message = message.substring(0, message.length()-1);\n endsWithDot = true;\n }\n\n // Check if the last character is a question mark\n if (message.charAt(message.length()-1) == '?') {\n message = message.substring(0, message.length()-1);\n endsWithQuestionMark = true;\n }\n\n if (templateName != null) {\n message += \" in \\\"\" + templateName + \"\\\"\";\n }\n\n if (lineNumber != null && lineNumber > -1) {\n message += \" at line \" + lineNumber;\n }\n\n if (endsWithDot) {\n message += \".\";\n }\n if (endsWithQuestionMark) {\n message += \"?\";\n }\n\n return message;\n }", "public static String format(final String _pattern, final Object _argument) {\r\n return MessageFormat.format(_pattern, new Object[] { _argument });\r\n }", "String getLayout();", "public String formatmsg(int i){\n String a = \"Here is the messages:\\n\";\n a += \"\\n-------------------------\\n\";\n a += \"The id of this message is \" + +getmessage(i).getmessageid()+\n \"\\nThis message is from \" + getmessage(i).getSendername() + \" whose id is \" +\n getmessage(i).getSenderid() + \":\\n\" + getmessage(i).getTxt();\n return a;\n }", "public String getMessage() {\n\t//TODO fix the removing of the color char one a move\n\t\tString message = this.message.substring(position, Math.min(this.message.length(), (width - 2) + position));\n\t\tchar COLORCHAR = '&';\n\t\tif (message.charAt(0) == COLORCHAR) {\n\t\t\tcolor = ChatColor.getByChar(message.charAt(1));\n\t\t} else {\n\t\t\tmessage = message.substring(1);\n\t\t\tmessage = \"\" + color + message;\n\t\t}\n\n\t\tif (message.charAt(message.length() - 1) == COLORCHAR) {\n\t\t\tmessage = message.substring(0, message.length() - 2);\n\t\t\tmessage = message + \" \";\n\t\t}\n\t\treturn message;\n\n\t}", "public java.lang.String getPatch() {\n java.lang.String ref = \"\";\n if (patternCase_ == 6) {\n ref = (java.lang.String) pattern_;\n }\n return ref;\n }", "private static ArrayList<String> processMessage(String message, ArrayList<Pattern> patterns, ArrayList<String> errorMessages) {\n int numPatterns = patterns.size();\n ArrayList<String> matchInformation;\n\n for (int i = 0; i < numPatterns; i++) {\n matchInformation = patternMatch(errorMessages.get(i), patterns.get(i), message);\n if(matchInformation != null && matchInformation.size() > 1)\n //if (matchInformation != null)\n return matchInformation;\n }\n\n message = Utils.removeLineBreaks(message);\n\n //There was no match for known patterns, returning original message only\n matchInformation = new ArrayList<String>();\n matchInformation.add(message);\n return matchInformation;\n }", "String getFormatter();", "private String format(final String format, final Object arg1, final Object arg2)\n\t{\n\t\treturn MessageFormatter.format(format, arg1, arg2).getMessage();\n\t}", "private void applyPattern(String pattern, boolean localized) {\n char zeroDigit = PATTERN_ZERO_DIGIT;\n char groupingSeparator = PATTERN_GROUPING_SEPARATOR;\n char decimalSeparator = PATTERN_DECIMAL_SEPARATOR;\n char percent = PATTERN_PERCENT;\n char perMill = PATTERN_PER_MILLE;\n char digit = PATTERN_DIGIT;\n char separator = PATTERN_SEPARATOR;\n char exponent = PATTERN_EXPONENT;\n char minus = PATTERN_MINUS;\n if (localized) {\n zeroDigit = symbols.getZeroDigit();\n groupingSeparator = symbols.getGroupingSeparator();\n decimalSeparator = symbols.getDecimalSeparator();\n percent = symbols.getPercent();\n perMill = symbols.getPerMill();\n digit = symbols.getDigit();\n separator = symbols.getPatternSeparator();\n exponent = symbols.getExponentialSymbol();\n minus = symbols.getMinusSign();\n }\n boolean gotNegative = false;\n\n decimalSeparatorAlwaysShown = false;\n isCurrencyFormat = false;\n useExponentialNotation = false;\n\n // Two variables are used to record the subrange of the pattern\n // occupied by phase 1. This is used during the processing of the\n // second pattern (the one representing negative numbers) to ensure\n // that no deviation exists in phase 1 between the two patterns.\n int phaseOneStart = 0;\n int phaseOneLength = 0;\n /**\n * Back-out comment : HShih boolean phaseTwo = false;\n */\n\n int start = 0;\n for (int j = 1; j >= 0 && start < pattern.length(); --j) {\n boolean inQuote = false;\n StringBuffer prefix = new StringBuffer();\n StringBuffer suffix = new StringBuffer();\n int decimalPos = -1;\n int multiplier = 1;\n int digitLeftCount = 0, zeroDigitCount = 0, digitRightCount = 0;\n byte groupingCount = -1;\n\n // The phase ranges from 0 to 2. Phase 0 is the prefix. Phase 1 is\n // the section of the pattern with digits, decimal separator,\n // grouping characters. Phase 2 is the suffix. In phases 0 and 2,\n // percent, permille, and currency symbols are recognized and\n // translated. The separation of the characters into phases is\n // strictly enforced; if phase 1 characters are to appear in the\n // suffix, for example, they must be quoted.\n int phase = 0;\n\n // The affix is either the prefix or the suffix.\n StringBuffer affix = prefix;\n\n for (int pos = start; pos < pattern.length(); ++pos) {\n char ch = pattern.charAt(pos);\n switch (phase) {\n case 0:\n case 2:\n // Process the prefix / suffix characters\n if (inQuote) {\n // A quote within quotes indicates either the\n // closing\n // quote or two quotes, which is a quote literal.\n // That\n // is,\n // we have the second quote in 'do' or 'don''t'.\n if (ch == QUOTE) {\n if ((pos + 1) < pattern.length() && pattern.charAt(pos + 1) == QUOTE) {\n ++pos;\n affix.append(\"''\"); // 'don''t'\n } else {\n inQuote = false; // 'do'\n }\n continue;\n }\n } else {\n // Process unquoted characters seen in prefix or\n // suffix\n // phase.\n if (ch == digit || ch == zeroDigit || ch == groupingSeparator || ch == decimalSeparator) {\n // Any of these characters implicitly begins the\n // next\n // phase. If we are in phase 2, there is no next\n // phase,\n // so these characters are illegal.\n /**\n * 1.2 Back-out comment : HShih Can't throw exception here. if (phase == 2) throw new IllegalArgumentException\n * (\"Unquoted special character '\" + ch + \"' in pattern \\\"\" + pattern + '\"');\n */\n phase = 1;\n if (j == 1)\n phaseOneStart = pos;\n --pos; // Reprocess this character\n continue;\n } else if (ch == CURRENCY_SIGN) {\n // Use lookahead to determine if the currency\n // sign\n // is\n // doubled or not.\n boolean doubled = (pos + 1) < pattern.length() && pattern.charAt(pos + 1) == CURRENCY_SIGN;\n if (doubled)\n ++pos; // Skip over the doubled character\n isCurrencyFormat = true;\n affix.append(doubled ? \"'\\u00A4\\u00A4\" : \"'\\u00A4\");\n continue;\n } else if (ch == QUOTE) {\n // A quote outside quotes indicates either the\n // opening\n // quote or two quotes, which is a quote\n // literal.\n // That is,\n // we have the first quote in 'do' or o''clock.\n if (ch == QUOTE) {\n if ((pos + 1) < pattern.length() && pattern.charAt(pos + 1) == QUOTE) {\n ++pos;\n affix.append(\"''\"); // o''clock\n } else {\n inQuote = true; // 'do'\n }\n continue;\n }\n } else if (ch == separator) {\n // Don't allow separators before we see digit\n // characters of phase\n // 1, and don't allow separators in the second\n // pattern (j == 0).\n if (phase == 0 || j == 0)\n throw new IllegalArgumentException(\"Unquoted special character '\" + ch + \"' in pattern \\\"\" + pattern + '\"');\n start = pos + 1;\n pos = pattern.length();\n continue;\n }\n\n // Next handle characters which are appended\n // directly.\n else if (ch == percent) {\n if (multiplier != 1)\n throw new IllegalArgumentException(\"Too many percent/permille characters in pattern \\\"\" + pattern + '\"');\n multiplier = 100;\n affix.append(\"'%\");\n continue;\n } else if (ch == perMill) {\n if (multiplier != 1)\n throw new IllegalArgumentException(\"Too many percent/permille characters in pattern \\\"\" + pattern + '\"');\n multiplier = 1000;\n affix.append(\"'\\u2030\");\n continue;\n } else if (ch == minus) {\n affix.append(\"'-\");\n continue;\n }\n }\n // Note that if we are within quotes, or if this is an\n // unquoted,\n // non-special character, then we usually fall through\n // to\n // here.\n affix.append(ch);\n break;\n case 1:\n // Phase one must be identical in the two sub-patterns.\n // We\n // enforce this by doing a direct comparison. While\n // processing the first sub-pattern, we just record its\n // length. While processing the second, we compare\n // characters.\n if (j == 1)\n ++phaseOneLength;\n else {\n /**\n * 1.2 Back-out comment : HShih if (ch != pattern.charAt(phaseOneStart++)) throw new IllegalArgumentException\n * (\"Subpattern mismatch in \\\"\" + pattern + '\"'); phaseTwo = true;\n */\n if (--phaseOneLength == 0) {\n phase = 2;\n affix = suffix;\n }\n continue;\n }\n\n // Process the digits, decimal, and grouping characters.\n // We\n // record five pieces of information. We expect the\n // digits\n // to occur in the pattern ####0000.####, and we record\n // the\n // number of left digits, zero (central) digits, and\n // right\n // digits. The position of the last grouping character\n // is\n // recorded (should be somewhere within the first two\n // blocks\n // of characters), as is the position of the decimal\n // point,\n // if any (should be in the zero digits). If there is no\n // decimal point, then there should be no right digits.\n if (ch == digit) {\n if (zeroDigitCount > 0)\n ++digitRightCount;\n else\n ++digitLeftCount;\n if (groupingCount >= 0 && decimalPos < 0)\n ++groupingCount;\n } else if (ch == zeroDigit) {\n if (digitRightCount > 0)\n throw new IllegalArgumentException(\"Unexpected '0' in pattern \\\"\" + pattern + '\"');\n ++zeroDigitCount;\n if (groupingCount >= 0 && decimalPos < 0)\n ++groupingCount;\n } else if (ch == groupingSeparator) {\n groupingCount = 0;\n } else if (ch == decimalSeparator) {\n if (decimalPos >= 0)\n throw new IllegalArgumentException(\"Multiple decimal separators in pattern \\\"\" + pattern + '\"');\n decimalPos = digitLeftCount + zeroDigitCount + digitRightCount;\n } else if (ch == exponent) {\n if (useExponentialNotation)\n throw new IllegalArgumentException(\"Multiple exponential \" + \"symbols in pattern \\\"\" + pattern + '\"');\n useExponentialNotation = true;\n minExponentDigits = 0;\n\n // Use lookahead to parse out the exponential part\n // of\n // the\n // pattern, then jump into phase 2.\n while (++pos < pattern.length() && pattern.charAt(pos) == zeroDigit) {\n ++minExponentDigits;\n ++phaseOneLength;\n }\n\n if ((digitLeftCount + zeroDigitCount) < 1 || minExponentDigits < 1)\n throw new IllegalArgumentException(\"Malformed exponential \" + \"pattern \\\"\" + pattern + '\"');\n\n // Transition to phase 2\n phase = 2;\n affix = suffix;\n --pos;\n continue;\n } else {\n phase = 2;\n affix = suffix;\n --pos;\n --phaseOneLength;\n continue;\n }\n break;\n }\n }\n /**\n * 1.2 Back-out comment : HShih if (phaseTwo && phaseOneLength > 0) throw new IllegalArgumentException(\"Subpattern mismatch in \\\"\" + pattern +\n * '\"');\n */\n // Handle patterns with no '0' pattern character. These patterns\n // are legal, but must be interpreted. \"##.###\" -> \"#0.###\".\n // \".###\" -> \".0##\".\n /*\n * We allow patterns of the form \"####\" to produce a zeroDigitCount\n * of zero (got that?); although this seems like it might make it\n * possible for format() to produce empty strings, format() checks\n * for this condition and outputs a zero digit in this situation.\n * Having a zeroDigitCount of zero yields a minimum integer digits\n * of zero, which allows proper round-trip patterns. That is, we\n * don't want \"#\" to become \"#0\" when toPattern() is called (even\n * though that's what it really is, semantically).\n */\n if (zeroDigitCount == 0 && digitLeftCount > 0 && decimalPos >= 0) {\n // Handle \"###.###\" and \"###.\" and \".###\"\n int n = decimalPos;\n if (n == 0)\n ++n; // Handle \".###\"\n digitRightCount = digitLeftCount - n;\n digitLeftCount = n - 1;\n zeroDigitCount = 1;\n }\n\n // Do syntax checking on the digits.\n if ((decimalPos < 0 && digitRightCount > 0)\n || (decimalPos >= 0 && (decimalPos < digitLeftCount || decimalPos > (digitLeftCount + zeroDigitCount))) || groupingCount == 0 || inQuote)\n throw new IllegalArgumentException(\"Malformed pattern \\\"\" + pattern + '\"');\n\n if (j == 1) {\n posPrefixPattern = prefix.toString();\n posSuffixPattern = suffix.toString();\n negPrefixPattern = posPrefixPattern; // assume these for now\n negSuffixPattern = posSuffixPattern;\n int digitTotalCount = digitLeftCount + zeroDigitCount + digitRightCount;\n /*\n * The effectiveDecimalPos is the position the decimal is at or\n * would be at if there is no decimal. Note that if\n * decimalPos<0, then digitTotalCount == digitLeftCount +\n * zeroDigitCount.\n */\n int effectiveDecimalPos = decimalPos >= 0 ? decimalPos : digitTotalCount;\n setMinimumIntegerDigits(effectiveDecimalPos - digitLeftCount);\n setMaximumIntegerDigits(useExponentialNotation ? digitLeftCount + getMinimumIntegerDigits() : DOUBLE_INTEGER_DIGITS);\n setMaximumFractionDigits(decimalPos >= 0 ? (digitTotalCount - decimalPos) : 0);\n setMinimumFractionDigits(decimalPos >= 0 ? (digitLeftCount + zeroDigitCount - decimalPos) : 0);\n setGroupingUsed(groupingCount > 0);\n this.groupingSize = (groupingCount > 0) ? groupingCount : 0;\n this.multiplier = multiplier;\n setDecimalSeparatorAlwaysShown(decimalPos == 0 || decimalPos == digitTotalCount);\n } else {\n negPrefixPattern = prefix.toString();\n negSuffixPattern = suffix.toString();\n gotNegative = true;\n }\n }\n\n if (pattern.length() == 0) {\n posPrefixPattern = posSuffixPattern = \"\";\n setMinimumIntegerDigits(0);\n setMaximumIntegerDigits(DOUBLE_INTEGER_DIGITS);\n setMinimumFractionDigits(0);\n setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS);\n }\n\n // If there was no negative pattern, or if the negative pattern is\n // identical\n // to the positive pattern, then prepend the minus sign to the positive\n // pattern to form the negative pattern.\n if (!gotNegative || (negPrefixPattern.equals(posPrefixPattern) && negSuffixPattern.equals(posSuffixPattern))) {\n negSuffixPattern = posSuffixPattern;\n negPrefixPattern = \"'-\" + posPrefixPattern;\n }\n\n expandAffixes();\n }", "@Override\n public DescribeLogPatternResult describeLogPattern(DescribeLogPatternRequest request) {\n request = beforeClientExecution(request);\n return executeDescribeLogPattern(request);\n }", "public String toString() {\n/* 664 */ return this.pattern;\n/* */ }", "private static String format(String message, Object expected, Object actual)\n\t\t{\n\t\tString formatted = \"\";\n\t\tif (message != null && !message.equals(\"\"))\n\t\t\t{\n\t\t\tformatted = message + \" \";\n\t\t\t}\n\n\t\tString expectedString = String.valueOf(expected);\n\t\tString actualString = String.valueOf(actual);\n\t\treturn expectedString.equals(actualString) ? formatted + \"expected: \" + formatClassAndValue(expected, expectedString) + \" but was: \" + formatClassAndValue(actual, actualString) : formatted + \"expected:<\" + expectedString + \"> but was:<\" + actualString + \">\";\n\t\t}", "private static ArrayList<String> patternMatch(String error, Pattern pat, String message) {\n //Pattern pattern = Pattern.compile(pat.toLowerCase());\n Matcher matcher = pat.matcher(message.toLowerCase());\n\n //There is a match with the supplied pattern\n if (matcher.find()) {\n ArrayList<String> matches = new ArrayList<String>();\n //Include message on first index\n matches.add(error);\n\n //Message has no variables, return solely the error / warning string\n if (matcher.groupCount() == 0)\n return matches;\n\n //Group all variables into one string\n String messageVariables = \"\";\n for (int i = 1; i <= matcher.groupCount(); i++) {\n if (i + 1 <= matcher.groupCount())\n messageVariables = messageVariables + Utils.removeLineBreaks(matcher.group(i)) + \" | \";\n else\n messageVariables = messageVariables + Utils.removeLineBreaks(matcher.group(i));\n }\n matches.add(messageVariables.toLowerCase());\n\n return matches;\n }\n\n return null;\n }", "public String getPatternDescription(int id) {\n TokenPattern pattern;\n\n pattern = stringDfaMatcher.getPattern(id);\n if (pattern == null) {\n pattern = nfaMatcher.getPattern(id);\n }\n if (pattern == null) {\n pattern = regExpMatcher.getPattern(id);\n }\n return (pattern == null) ? null : pattern.toShortString();\n }", "public final String getPattern() {\n/* 187 */ return this.m_pattern;\n/* */ }", "default String create(String... args) {\n String message = \"\";\n try {\n for (int i = 0; i < args.length; i++) {\n if (args[i] != null) {\n Matcher matcher = CRYPTO_PATTERN.matcher(args[i]);\n if (matcher.find()) {\n int start = args[i].indexOf(':') + 1;\n int end = args[i].indexOf('}');\n args[i] = StringUtils.replace(args[i], matcher.group(), StringUtils.repeat('*', end - start));\n }\n }\n }\n message = String.format(getPattern(), (Object[]) args);\n } catch (Exception e) {\n getLogger().error(\"Report message creation error!\", e);\n }\n return message;\n }", "public String toString() {\n/* 666 */ return this.pattern;\n/* */ }", "public String toPattern() {\n\t\treturn pattern;\n\t}", "public static String format(Object val, String pattern, String groupsepa, String decimalsepa)\n {\n try\n {\n \t String theGrpSep = groupsepa;\n \t String theDecSep = decimalsepa;\n \t if(theGrpSep == null || theGrpSep.isEmpty() || theDecSep == null || theDecSep.isEmpty())\n \t {\n \t // return group and decimal separator from session if any\n \t String[] grpDecArr = returnGroupDecimalSep();\n \t if(theGrpSep == null || theGrpSep.isEmpty())\n \t {\n \t\t theGrpSep = grpDecArr[0];\n \t }\n \t if(theDecSep == null || theDecSep.isEmpty())\n \t {\n \t\t theDecSep = grpDecArr[1];\n \t }\n \t }\n \t return format(val,pattern, theGrpSep.charAt(0), theDecSep.charAt(0));\n }\n catch(Exception e )\n {\n \t log.error(e, \"[NumberUtil] Error caught in method format\");\n \t return \"\";\n }\n }", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "java.lang.String getMessage();", "public RegexFormatter(Pattern pattern) {\n this();\n setPattern(pattern);\n }", "public String getPattern() {\r\n \treturn pattern;\r\n }", "private String prettyMessage() {\n Map<String, Object> map = new LinkedHashMap<>(4);\n map.put(\"type\", getType());\n map.put(\"message\", this.message);\n map.put(\"code\", getCode());\n // TODO(\"need to optimize\")\n map.put(\"data\", getData().toString());\n return JsonUtils.getGson().toJson(map);\n }", "private String format(final String format, final Object[] args)\n\t{\n\t\treturn MessageFormatter.arrayFormat(format, args).getMessage();\n\t}", "public Message formatMessage(Message srcMessage, String css) {\n\n //todo:\n //deep copy message.\n Message copyOfMessage = new Message(srcMessage.id, srcMessage.title, srcMessage.body, srcMessage.signature);\n\n //custom logic to apply the css script to the message and have it annotated with correct formatting tags e.g. <bold></bold> etc.\n LOGGER.info(\"Message is successfully formatted as per given css\");\n\n return copyOfMessage;\n }", "public String toLocalizedPattern() {\n\t\treturn translatePattern(pattern, DateFormatSymbols.patternChars, formatData.localPatternChars);\n\t}", "public String toPattern(NumberFormatTestData tuple) {\n return null;\n }", "public String getPattern() {\r\n\t\treturn pattern;\r\n\t}", "@Override\n public HangarMessages addConstraintsPatternMessage(String property) {\n assertPropertyNotNull(property);\n add(property, new UserMessage(CONSTRAINTS_Pattern_MESSAGE));\n return this;\n }", "public String getPattern() {\n return pattern;\n }", "String getFormat(Object elementID) throws Exception;", "public static String getCurrentDateFormatted(String pattern) {\r\n\t\tDate now = new Date();\r\n\t\ttry {\r\n\t\t\tDateFormat df = new SimpleDateFormat(pattern);\r\n\t\t\treturn df.format(now);\r\n\t\t} catch (IllegalArgumentException e) {\r\n\t\t\tthrow e;\r\n\t\t}\r\n\t}", "public String getPattern () {\n return pattern;\n }", "public java.lang.String getPost() {\n java.lang.String ref = \"\";\n if (patternCase_ == 4) {\n ref = (java.lang.String) pattern_;\n }\n return ref;\n }", "private String toPattern(boolean localized) {\n StringBuffer result = new StringBuffer();\n for (int j = 1; j >= 0; --j) {\n if (j == 1)\n appendAffix(result, posPrefixPattern, positivePrefix, localized);\n else\n appendAffix(result, negPrefixPattern, negativePrefix, localized);\n int i;\n int digitCount = useExponentialNotation ? getMaximumIntegerDigits() : Math.max(groupingSize, getMinimumIntegerDigits()) + 1;\n for (i = digitCount; i > 0; --i) {\n if (i != digitCount && isGroupingUsed() && groupingSize != 0 && i % groupingSize == 0) {\n result.append(localized ? symbols.getGroupingSeparator() : PATTERN_GROUPING_SEPARATOR);\n }\n result.append(i <= getMinimumIntegerDigits() ? (localized ? symbols.getZeroDigit() : PATTERN_ZERO_DIGIT) : (localized ? symbols.getDigit()\n : PATTERN_DIGIT));\n }\n if (getMaximumFractionDigits() > 0 || decimalSeparatorAlwaysShown)\n result.append(localized ? symbols.getDecimalSeparator() : PATTERN_DECIMAL_SEPARATOR);\n for (i = 0; i < getMaximumFractionDigits(); ++i) {\n if (i < getMinimumFractionDigits()) {\n result.append(localized ? symbols.getZeroDigit() : PATTERN_ZERO_DIGIT);\n } else {\n result.append(localized ? symbols.getDigit() : PATTERN_DIGIT);\n }\n }\n if (useExponentialNotation) {\n result.append(localized ? symbols.getExponentialSymbol() : PATTERN_EXPONENT);\n for (i = 0; i < minExponentDigits; ++i)\n result.append(localized ? symbols.getZeroDigit() : PATTERN_ZERO_DIGIT);\n }\n if (j == 1) {\n appendAffix(result, posSuffixPattern, positiveSuffix, localized);\n if ((negSuffixPattern == posSuffixPattern && // n == p == null\n negativeSuffix.equals(positiveSuffix))\n || (negSuffixPattern != null && negSuffixPattern.equals(posSuffixPattern))) {\n if ((negPrefixPattern != null && posPrefixPattern != null && negPrefixPattern.equals(\"'-\" + posPrefixPattern))\n || (negPrefixPattern == posPrefixPattern && // n ==\n // p ==\n // null\n negativePrefix.equals(symbols.getMinusSign() + positivePrefix)))\n break;\n }\n result.append(localized ? symbols.getPatternSeparator() : PATTERN_SEPARATOR);\n } else\n appendAffix(result, negSuffixPattern, negativeSuffix, localized);\n }\n return result.toString();\n }", "public String getPattern() {\n\treturn pattern;\n }", "public Pattern getPattern() {\n return pattern;\n }", "public static String format(String pattern, Object... arguments)\n throws IllegalFormatException {\n return formatToString(pattern, ImmutableList.copyOf(arguments));\n }", "public String getMessageText();", "public String getLayoutString() {\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tsb.append(\"[\");\r\n\t\tfor (int r=0; r<rows; r++) {\r\n\t\t\tfor (int c=0; c<columns; c++) {\r\n\t\t\t\tint fieldIndex = -1;\r\n\t\t\t\tfor (int i: fieldPositions.keySet()) {\r\n\t\t\t\t\tPoint pos = fieldPositions.get(i);\r\n\t\t\t\t\tif (pos.x == c && pos.y == r) {\r\n\t\t\t\t\t\tfieldIndex = i;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tsb.append(fieldIndex + \",\");\r\n\t\t\t}\r\n\t\t\tsb.deleteCharAt(sb.length()-1);\r\n\t\t\tsb.append(\";\");\r\n\t\t}\r\n\t\tsb.deleteCharAt(sb.length()-1);\r\n\t\tsb.append(\"]\");\r\n\t\treturn sb.toString();\r\n\t}", "String getMessage();", "String getMessage();", "String getMessage();", "public String messageToString(){\n String stringMessage = \"Message:\\n\" + text + \"\\nFrom User: \" + fromUser.toNameAndEmailString();\n if(toGroup != null && !emergency) {\n stringMessage = \"Message:\\n\" + text + \"\\nFrom User: \" + fromUser.toNameAndEmailString() + \"\\nTo Group:\\n\" + toGroup.groupToListString();\n\n }\n else if(emergency){\n stringMessage =\"EMERGENCY!!!\\n\" + \"Message:\\n\" + text + \"\\nFrom User: \" + fromUser.toNameAndEmailString() + \"\\n\";\n }\n\n\n return stringMessage;\n }", "private static String getMessage(String path) { return prefix + ChatColor.translateAlternateColorCodes('&', Essentials.getInstance().getConfig().getString(\"messages.\" + path)); }", "UsagePattern getUsagePattern();", "private String getMessage(String path) {\n return ChatColor.translateAlternateColorCodes('&', getConfig().getString(\"message.\" + path));\n }", "public String getPattern() {\n\t\treturn pattern;\n\t}", "public String getPattern() {\n\t\treturn pattern;\n\t}", "public static String formatPosition(String format, VerticalPosition position) {\n switch (format) {\n //text editor style formatting used in most cases\n case \"text\":\n switch (position) {\n case TOP:\n return \"top\";\n case MIDDLE:\n return \"middle\";\n default:\n return \"bottom\";\n }\n case \"stl\":\n //stl style is upper-case and uses middle not bottom\n switch (position) {\n case TOP:\n return \"Top\";\n case MIDDLE:\n return \"Center\";\n default:\n return \"Bottom\";\n }\n default:\n throw new RuntimeException(String.format(\"Unknown position format '%s'\", format));\n }\n }", "protected abstract String createMessage(XMLLogHelper logHelper);" ]
[ "0.6994705", "0.6829018", "0.6239189", "0.60414845", "0.5888267", "0.58867186", "0.587654", "0.5855127", "0.5855127", "0.5855127", "0.5829108", "0.58274764", "0.58243686", "0.58231837", "0.57879126", "0.5751254", "0.5733025", "0.57280695", "0.56893486", "0.56506836", "0.5643229", "0.56021565", "0.55907977", "0.55857915", "0.5574824", "0.55517477", "0.55230933", "0.54741406", "0.5472905", "0.54495585", "0.5444373", "0.5429368", "0.54110235", "0.5399377", "0.53951913", "0.53905123", "0.53868246", "0.5374155", "0.53738123", "0.5322816", "0.5321467", "0.529541", "0.52839434", "0.5245964", "0.52289045", "0.52288926", "0.52193487", "0.5217843", "0.5215217", "0.5206999", "0.5205703", "0.5205168", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5201884", "0.5199926", "0.5191531", "0.51790476", "0.51684", "0.5166604", "0.51628715", "0.51600146", "0.513588", "0.5135419", "0.511964", "0.5118962", "0.51106703", "0.5108169", "0.5107573", "0.51021785", "0.5096628", "0.50728047", "0.5062368", "0.5058506", "0.50564355", "0.5055387", "0.5055387", "0.5055387", "0.50538635", "0.5047468", "0.50458807", "0.5042567", "0.5036539", "0.5036539", "0.50289553", "0.5027188" ]
0.5628757
21
/ Object Param View
@XmlElement(required = true) public String getName() { return name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getViewParam() {\r\n\t\treturn viewParam;\r\n\t}", "INDArray getParams();", "public ObjectParamView init(Object obj)\n\t{\n\t\tif((obj instanceof ObjectParam))\n\t\t\tthis.init((ObjectParam) obj);\n\t\treturn this;\n\t}", "public Object getParam() {\n return param;\n }", "@Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"tag\", \"ViewList\");\n params.put(\"created_by\", created_by);\n params.put(\"created_for\",created_for);\n\n\n return params;\n }", "public Object getParamValue(String label);", "public Object getParamValue(int i);", "public abstract String paramsToString();", "public abstract Object getTypedParams(Object params);", "public Map getParameters();", "protected Object getDisplayParameterBean() {\n return findBaseObject(\"pmb\");\n }", "protected String paramString() {\n return super.paramString() + \",\" + \"caretColor=\" + caretColor + \",\"\n + \"disabledTextColor=\" + disabledTextColor + \",\" + \"editable=\"\n + isEditable + \",\" + \"margin=\" + margin + \",\"\n + \"selectedTextColor=\" + selectedTextColor + \",\"\n + \"selectionColor=\" + selectionColor;\n\n }", "Input getObjetivo();", "Object getViewDetails();", "public final RelationType<List<RelationType<?>>> getViewContentParam()\n\t{\n\t\treturn aViewContentParam;\n\t}", "public Parameters getParameters();", "ParameterList getParameters();", "Param createParam();", "Param createParam();", "Param createParam();", "Object getParameter(String name);", "@Override\n\t\tpublic Object[] getParameters() {\n\t\t\treturn null;\n\t\t}", "public String toString() {\n return getClass().getName() + \"[\" + paramString() + \"]\";\n }", "public void updateEditParameter(){\r\n \tMap<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();\r\n\t\tint paramId = Integer.parseInt(params.get(\"parameterId\"));\r\n\t\tthis.getLog().info(\"parameterId:\" + paramId);\r\n\t\t\r\n\t\tif(paramId == 0){\r\n\t\t\teditParameter = new AdditionalParametersDTO();\r\n\t\t}else{\r\n\t\t\tfor (AdditionalParametersDTO p : this.getParameterList()) {\r\n\t\t\t\tif(p.getId() == paramId){\r\n\t\t\t\t\teditParameter = p;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\t\t}\r\n\t}", "public void addParam(Object obj) {\n\t\tparams.add(obj);\n\t}", "@Override\n public String kind() {\n return \"@param\";\n }", "Parameter getParameter();", "public T caseParam(Param object) {\n\t\treturn null;\n\t}", "@Override\n\tprotected void initParams() {\n\t\t\n\t}", "public void setParaToParameters(String key, Object obj)\n\t{\n\t\tMap<String, Object> parameters = (Map)context.getParameters();\n\t\tparameters.put(key, obj);\n\t}", "public Map<String, AccessPoint> createParameters() {\r\n\t\tMap<String, AccessPoint> pm = new TreeMap<String, AccessPoint>();\r\n\t\tpm.put(\"vcNumber\", new MutableFieldAccessPoint(\"vcNumber\", this));\r\n\t\treturn pm;\r\n\t}", "public Parameter getParameter(StratmasObject stratmasObject)\n {\n return getTypeParameter(stratmasObject);\n }", "@Override\n\t\tpublic Object getTypedParams(Object params) {\n\t\t\treturn null;\n\t\t}", "@Override\n\t\tpublic Object getTypedParams(Object params) {\n\t\t\treturn null;\n\t\t}", "void showNoneParametersView();", "@Override\n protected String getName() {return _parms.name;}", "public abstract String toFORMParam();", "@Override \n\t\tprotected int getNumParam() {\n\t\t\treturn 1;\n\t\t}", "ParamValueRelation createParamValueRelation();", "public String paramString() {\n\t\tString tail = super.paramString();\n\t\ttail = tail.substring(tail.indexOf(')') + 1);\n\t\treturn \"points=\" + points + \", lineWidth=\" + getLineWidth() + tail;\n\t}", "public ParamPanel() {\n this.paramService = new ParamService();\n initComponents();\n doQuery();\n }", "@Override\n\tpublic boolean isParam() {\n\t\treturn false;\n\t}", "public List<IParam> getParams();", "public List<IParam> getParams();", "@Override\n protected Map<String, String> getParams() {\n return params;\n }", "java.lang.String getParameterValue();", "public abstract View a(Object obj);", "public AddItemViewParameters() {\n\t}", "public static void method(Object obj){\n\t System.out.println(\"method with param type - Object\");\n\t }", "Map<String, Object> getParameters();", "Map<String, Object> getParameters();", "@Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<>();\n params.put(\"user_id\", globalClass.getId());\n params.put(\"view\", \"getMyTaskRewardsByUser\");\n\n Log.d(TAG, \"getParams: \"+params);\n return params;\n }", "@Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"oid\", oid);\n\n return params;\n }", "@DISPID(1611005952) //= 0x60060000. The runtime will prefer the VTID if present\n @VTID(27)\n short parameterTreeViewWithValue();", "@Override\n protected Map<String, String> getParams() {\n return params;\n }", "public abstract ParamNumber getParamX();", "IParameter getParameter();", "@Override\n\t\tpublic String toString() {\n\t\t\treturn getClass().getSimpleName() + Arrays.toString(getPoint()) + ' ' + (getModel() != null ? getModel().toString() : \"(null)\");\n\t\t}", "@Override\n\tpublic Annotation[] getParameterAnnotations() {\n\t\treturn new Annotation[]{};\n\t}", "@Override\n public Parameters getParams() {\n return parameters;\n }", "@Override\n public List<KParameter> getParameters() {\n return getReflected().getParameters();\n }", "public java.lang.String getParam0(){\n return localParam0;\n }", "public java.lang.String getParam0(){\n return localParam0;\n }", "public java.lang.String getParam0(){\n return localParam0;\n }", "public java.lang.String getParam0(){\n return localParam0;\n }", "public void setParamValue(String label, Object value);", "protected final Expression param(int idx) {\r\n return (Expression)m_params.get(idx);\r\n }", "@Override\n\t\tpublic String getParameter(String name) {\n\t\t\treturn null;\n\t\t}", "public ViewObject(ActivityInstance instance)\n {\n // Populate fields\n this.templateId = instance.getTemplate().getId();\n this.name = instance.getName();\n this.description = instance.getDescription();\n this.paramValues = instance.getParameterValues();\n }", "public abstract interface QueryArgs {\n\n /** Return the catalog associated with this object */\n public Catalog getCatalog();\n\n /** Set the value for the ith parameter */\n public void setParamValue(int i, Object value);\n\n /** Set the value for the parameter with the given label */\n public void setParamValue(String label, Object value);\n\n /** Set the min and max values for the parameter with the given label */\n public void setParamValueRange(String label, Object minValue, Object maxValue);\n\n /** Set the int value for the parameter with the given label */\n public void setParamValue(String label, int value);\n\n /** Set the double value for the parameter with the given label */\n public void setParamValue(String label, double value);\n\n /** Set the double value for the parameter with the given label */\n public void setParamValueRange(String label, double minValue, double maxValue);\n\n /** Set the array of parameter values directly. */\n public void setParamValues(Object[] values);\n\n /** Get the value of the ith parameter */\n public Object getParamValue(int i);\n\n /** Get the value of the named parameter\n *\n * @param label the parameter name or id\n * @return the value of the parameter, or null if not specified\n */\n public Object getParamValue(String label);\n\n /**\n * Get the value of the named parameter as an integer.\n *\n * @param label the parameter label\n * @param defaultValue the default value, if the parameter was not specified\n * @return the value of the parameter\n */\n public int getParamValueAsInt(String label, int defaultValue);\n\n /**\n * Get the value of the named parameter as a double.\n *\n * @param label the parameter label\n * @param defaultValue the default value, if the parameter was not specified\n * @return the value of the parameter\n */\n public double getParamValueAsDouble(String label, double defaultValue);\n\n /**\n * Get the value of the named parameter as a String.\n *\n * @param label the parameter label\n * @param defaultValue the default value, if the parameter was not specified\n * @return the value of the parameter\n */\n public String getParamValueAsString(String label, String defaultValue);\n\n\n /**\n * Return the object id being searched for, or null if none was defined.\n */\n public String getId();\n\n /**\n * Set the object id to search for.\n */\n public void setId(String id);\n\n\n /**\n * Return an object describing the query region (center position and\n * radius range), or null if none was defined.\n */\n public CoordinateRadius getRegion();\n\n /**\n * Set the query region (center position and radius range) for\n * the search.\n */\n public void setRegion(CoordinateRadius region);\n\n\n /**\n * Return an array of SearchCondition objects indicating the\n * values or range of values to search for.\n */\n public SearchCondition[] getConditions();\n\n /** Returns the max number of rows to be returned from a table query */\n public int getMaxRows();\n\n /** Set the max number of rows to be returned from a table query */\n public void setMaxRows(int maxRows);\n\n\n /** Returns the query type (an optional string, which may be interpreted by some catalogs) */\n public String getQueryType();\n\n /** Set the query type (an optional string, which may be interpreted by some catalogs) */\n public void setQueryType(String queryType);\n\n /**\n * Returns a copy of this object\n */\n public QueryArgs copy();\n\n /**\n * Optional: If not null, use this object for displaying the progress of the background query\n */\n public StatusLogger getStatusLogger();\n}", "public String getAllParam() { return this.allParam; }", "private void printParams(Object... params) {\n if (params != null) {\n String paramsStr = \"\";\n for (Object o : params) {\n if (o == null) {\n paramsStr += \"null;\";\n } else {\n paramsStr += (o.toString() + \";\");\n }\n }\n logger.debug(\"PARAMETERS=[\" + paramsStr + \"]\");\n }\n }", "protected ParameterList(){\n //title = t;\n //cellWorld = cw;\n }", "@Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"id\", id);\n\n\n\n\n return params;\n }", "String getParamsAsString();", "@Override\r\n\tpublic java.lang.String toString()\r\n\t{\r\n\t\treturn \"appendParamToUrl\";\r\n\t}", "public ParameterList getAdjustableParams();", "public abstract String toURLParam();", "public interface ViewObject {\n\n Integer getReferenceID();\n}", "public String getParam() {\n return param;\n }", "public String getParam() {\n return param;\n }", "@Override\n\tpublic RequestParams onParams(int paramFlag) {\n\t\treturn null;\n\t}", "public interface VinhNT_Parameter {\n public void addParam(JSONObject input);\n public String get_field_name();\n public void getParam(JSONObject input);\n public boolean isRequired();\n public ArrayList<Error_Input> checkInput();\n public Context getContext();\n}", "public Collection getRefParameters(ParameterModel model) throws AAException, RemoteException;", "public void setParamValue(int i, Object value);", "public Variable[] getParameters();", "public Parameter getParameter(Object object)\n {\n // Only handle StratmasObjects.\n if (!(object instanceof StratmasObject)) {\n return null;\n }\n \n return getParameter((StratmasObject) object);\n }", "public MetaParameter() {\n m_aParams = new ArrayList();\n }", "@Override\n\tpublic Object getParameter(HttpServletRequest request) {\n\t\tString dentifyId=request.getParameter(\"curid\");\n\t\tString curstomName=request.getParameter(\"curname\");\n\t\tString curstomage=request.getParameter(\"curage\");\n\t\tString curstomAdress=request.getParameter(\"curaddress\");\n\t\tString Curstomphone=request.getParameter(\"curphone\");\n\t\treturn new Curstom(dentifyId,curstomName,curstomage,curstomAdress,Curstomphone);\n\t}", "@Override\n\tprotected void setParameterValues() {\n\t}", "public List<Parameter> getParameter( )\n {\n return _parameter;\n }", "protected void addCommentParameterPropertyDescriptor(Object object) {\r\n\t\titemPropertyDescriptors.add\r\n\t\t\t(createItemPropertyDescriptor\r\n\t\t\t\t(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),\r\n\t\t\t\t getResourceLocator(),\r\n\t\t\t\t getString(\"_UI_MPublishNewMp3Step_commentParameter_feature\"),\r\n\t\t\t\t getString(\"_UI_PropertyDescriptor_description\", \"_UI_MPublishNewMp3Step_commentParameter_feature\", \"_UI_MPublishNewMp3Step_type\"),\r\n\t\t\t\t LogicPackage.Literals.MPUBLISH_NEW_MP3_STEP__COMMENT_PARAMETER,\r\n\t\t\t\t false,\r\n\t\t\t\t false,\r\n\t\t\t\t false,\r\n\t\t\t\t ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,\r\n\t\t\t\t null,\r\n\t\t\t\t null));\r\n\t}", "@Override\n\t\tpublic Map getParameterMap() {\n\t\t\treturn null;\n\t\t}", "public abstract ImmutableMap<String, ParamInfo> getParamInfos();", "public void bindParameter(Object o, int index){\n parameters.add(new Parameter(o, index));\n }", "public T caseParameters(Parameters object)\n {\n return null;\n }", "public ParamJson() {\n\t\n\t}", "public Setparam() {\r\n super();\r\n }", "Objet getObjetAlloue();", "@Override\n protected Map<String, String> getParams() {\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"title\", name);\n params.put(\"ean\", ean);\n params.put(\"supplier\", supplier);\n params.put(\"offer\", offer);\n params.put(\"price\", price);\n\n return params;\n }", "public void showRestaurantDetail(Map<String, Object> objectMap);" ]
[ "0.6273839", "0.6223508", "0.62025917", "0.58364177", "0.5815933", "0.5814584", "0.57922286", "0.5783292", "0.57163894", "0.57135946", "0.56985146", "0.56467724", "0.5638414", "0.5632063", "0.5614258", "0.56052685", "0.55979264", "0.5596001", "0.5596001", "0.5596001", "0.5581962", "0.55737734", "0.55677426", "0.5554414", "0.55518925", "0.55424386", "0.55033886", "0.5492746", "0.5489187", "0.54848325", "0.5478719", "0.54666346", "0.5465406", "0.5465406", "0.54643726", "0.54575926", "0.5449303", "0.5445326", "0.5443454", "0.54379326", "0.5435506", "0.54338807", "0.54264313", "0.54264313", "0.5425817", "0.54163367", "0.53929704", "0.539124", "0.5387212", "0.5383149", "0.5383149", "0.5378559", "0.5376776", "0.53720635", "0.53548247", "0.53358", "0.53283256", "0.52926433", "0.5292623", "0.5284927", "0.52846074", "0.5281066", "0.5281066", "0.5281066", "0.5281066", "0.5273888", "0.5259539", "0.5256836", "0.52538854", "0.525162", "0.52489674", "0.5246497", "0.5235998", "0.52279305", "0.5227198", "0.5224506", "0.5224089", "0.5211916", "0.5211789", "0.5208971", "0.5208971", "0.52073944", "0.52073467", "0.52064925", "0.52033645", "0.5202063", "0.519964", "0.5185893", "0.51823163", "0.518022", "0.517887", "0.5176351", "0.5170318", "0.51669973", "0.51586235", "0.515755", "0.5154593", "0.5149914", "0.51498944", "0.51489365", "0.51485044" ]
0.0
-1
/ public: ObjectParamView (init) interface
public ObjectParamView init(Object obj) { if((obj instanceof ObjectParam)) this.init((ObjectParam) obj); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tprotected void initParams() {\n\t\t\n\t}", "@Override\n\tprotected void init() throws Exception {\n\t\toid = getParameter(\"oid\");\n\t\tif (AppUtil.isEmpty(oid)) {\n\t\t\toid = getArgument(\"oid\");\n\t\t}\n\t\tif (AppUtil.isEmpty(oid)) {\n\t\t\tsetupNewPage();\n\t\t} else {\n\t\t\tsetupEditPage();\n\t\t}\n\t}", "public void init(IViewPart arg0) {\n\n\t}", "public void init(Object[] parameters) {\n\n\t}", "public void init(Object[] initialParams) {\n\t \n\t}", "public void initView(){}", "@Override\r\n\tpublic void init() {}", "public ParamPanel() {\n this.paramService = new ParamService();\n initComponents();\n doQuery();\n }", "public AddItemViewParameters() {\n\t}", "public TParametrosVOImpl() {\r\n }", "@Override\n\tprotected void initView()\n\t{\n\n\t}", "@Override\n\tpublic void initView() {\n\t\t\n\t}", "@Override\r\n\tpublic void initView() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void initView() {\n\t\t\r\n\t}", "protected abstract void initView();", "@Override\n public void init() {}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\t\tpublic void init() {\n\t\t}", "@Override\n\tprotected void initView() {\n\t\t\n\t}", "@Override\n\tprotected void initView() {\n\t\t\n\t}", "@Override\r\n\tprotected void initView() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initView() {\n\t\t\r\n\t}", "public abstract void initView();", "@objid (\"4bb3363c-38e1-48f1-9894-6dceea1f8d66\")\n public void init() {\n }", "@Override\n\tprotected void initParamsForFragment() {\n\n\t}", "@Override\n public void initView() {\n }", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "public ViewProperty() {\n initComponents();\n }", "@Override\n public void init() {\n }", "public ParamJson() {\n\t\n\t}", "public void init(){}", "public void initView() {\n\t\t view.initView(model);\t \n\t }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tpublic void init()\n\t{\n\n\t}", "@Override public void init()\n\t\t{\n\t\t}", "@Override\n protected void initView() {\n }", "@Override\n protected void initView() {\n }", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "private void viewInit() {\n }", "@Override\n\tpublic void init() {\n\t}", "private void initView() {\n\n }", "public BaseParameters(){\r\n\t}", "public void init() {\r\n\t\t// to override\r\n\t}", "@Override\n\tpublic void InitView() {\n\t\t\n\t}", "@Override\n protected void init() {\n }", "private void initializeViews(Object object, ViewHolder holder) {\n }", "public void init() { }", "public void init() { }", "@Override\r\n\tpublic final void init() {\r\n\r\n\t}", "public BaseModel initObj() {\n\t\treturn null;\n\t}", "void initView();", "@Override\n public void initView() {\n\n }", "@Override // opcional\n public void init(){\n\n }", "public Setparam() {\r\n super();\r\n }", "protected void initOtherParams() {\n\n\t\t// init other params defined in parent class\n\t\tsuper.initOtherParams();\n\n\t\t// the Component Parameter\n\t\t// first is default, the rest are all options (including default)\n\t\tcomponentParam = new ComponentParam(Component.AVE_HORZ, Component.AVE_HORZ,\n\t\t\t\tComponent.RANDOM_HORZ, Component.GREATER_OF_TWO_HORZ);\n\n\t\t// the stdDevType Parameter\n\t\tStringConstraint stdDevTypeConstraint = new StringConstraint();\n\t\tstdDevTypeConstraint.addString(StdDevTypeParam.STD_DEV_TYPE_TOTAL);\n\t\tstdDevTypeConstraint.addString(StdDevTypeParam.STD_DEV_TYPE_INTER);\n\t\tstdDevTypeConstraint.addString(StdDevTypeParam.STD_DEV_TYPE_INTRA);\n\t\tstdDevTypeConstraint.addString(StdDevTypeParam.STD_DEV_TYPE_NONE);\n\t\tstdDevTypeConstraint.setNonEditable();\n\t\tstdDevTypeParam = new StdDevTypeParam(stdDevTypeConstraint);\n\n\t\t// add these to the list\n\t\totherParams.addParameter(componentParam);\n\t\totherParams.addParameter(stdDevTypeParam);\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "public ListParameter()\r\n\t{\r\n\t}", "public MetaParameter() {\n m_aParams = new ArrayList();\n }", "public void setParameterFromObject(final Object o)\n throws ObjectFactoryException {\n super.setParameterFromObject(o);\n final DecimalFormat format = (DecimalFormat) o;\n setParameter(\"localizedPattern\", format.toLocalizedPattern());\n setParameter(\"pattern\", format.toPattern());\n }", "@Override\n public void init() {\n }", "private Params()\n {\n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n public void setObject(Object arg0)\n {\n \n }", "protected ParameterList(){\n //title = t;\n //cellWorld = cw;\n }", "protected abstract void initViewValue(final T field);", "public void init() {}", "public void init() {}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "@Override\n\tpublic void initValue() {\n\t\t\n\t}", "public ModuleParams()\n\t{\n\t}", "protected abstract void initializeView();", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\n\tpublic void init(String[] args) {\n\t\tsuper.init(args);\n\t\tmodel = new ArenaModel();\n\t\tview = new ArenaView(model);\n\t\tmodel.setView(view);\n\t\tupdatePercepts();\n\t}", "public void init(){\n \n }", "@Override\r\n\tpublic void init() {\n\t\tsuper.init();\r\n\t}", "private LocalParameters() {\n\n\t}", "public void init() {\n \n }", "public void init() {\n }", "public void init() {\n }", "public void init() {\n }", "public void init() {\n }", "Param createParam();", "Param createParam();", "Param createParam();", "@Override\n void init() {\n }", "private void initParameters() {\n Annotation[][] paramsAnnotations = method.getParameterAnnotations();\n for (int i = 0; i < paramsAnnotations.length; i++) {\n if (paramsAnnotations[i].length == 0) {\n contentBuilder.addUnnamedParam(i);\n } else {\n for (Annotation annotation : paramsAnnotations[i]) {\n Class<?> annotationType = annotation.annotationType();\n if (annotationType.equals(PathParam.class)\n && pathBuilder != null) {\n PathParam param = (PathParam) annotation;\n pathBuilder.addParam(param.value(), i);\n } else if (annotationType.equals(QueryParam.class)) {\n QueryParam param = (QueryParam) annotation;\n queryBuilder.addParam(param.value(), i);\n } else if (annotationType.equals(HeaderParam.class)) {\n HeaderParam param = (HeaderParam) annotation;\n headerBuilder.addParam(param.value(), i);\n } else if (annotationType.equals(NamedParam.class)) {\n NamedParam param = (NamedParam) annotation;\n contentBuilder.addNamedParam(param.value(), i);\n } else {\n contentBuilder.addUnnamedParam(i);\n }\n }\n }\n }\n }", "@Override\n public void init() {\n\n super.init();\n\n }", "public void init() {\n\n }", "public void init() {\n\n }" ]
[ "0.6764985", "0.6446369", "0.64327216", "0.6281416", "0.6260584", "0.62524617", "0.61488295", "0.6127398", "0.61016876", "0.61016744", "0.60687375", "0.60675883", "0.60613984", "0.60613984", "0.60577166", "0.6036525", "0.60268193", "0.60267633", "0.6024286", "0.6024286", "0.6006791", "0.6006791", "0.5990357", "0.5986384", "0.5985449", "0.59636253", "0.5949414", "0.5949414", "0.5949414", "0.59491044", "0.5938121", "0.5928966", "0.5908087", "0.5902907", "0.59018236", "0.5900607", "0.5898778", "0.58934337", "0.58934337", "0.58794206", "0.58794206", "0.58794206", "0.5862911", "0.5846869", "0.58443207", "0.58369225", "0.58153063", "0.5807732", "0.5798852", "0.5796115", "0.5790706", "0.5790706", "0.57901365", "0.57798475", "0.57784206", "0.57760626", "0.5775356", "0.5775339", "0.57752573", "0.57742524", "0.57742524", "0.57742524", "0.57742524", "0.57742524", "0.5766939", "0.5760798", "0.5758848", "0.5749034", "0.5745468", "0.57454515", "0.57454515", "0.5732527", "0.5728188", "0.57239383", "0.571614", "0.571614", "0.5690632", "0.56897646", "0.56859297", "0.5662111", "0.5657215", "0.5657215", "0.5657215", "0.5651322", "0.56474596", "0.5643842", "0.5643262", "0.5642034", "0.56419027", "0.56419027", "0.56419027", "0.56419027", "0.5625412", "0.5625412", "0.5625412", "0.5623289", "0.56200147", "0.56045014", "0.5603871", "0.5603871" ]
0.84032243
0
TODO Autogenerated method stub
public String get_currency_name() { return name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
public int[] get_ranking() { return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Record the video data sends by the camClient
private void recordCam() throws IOException, InterruptedException { VideoDataStream vds = new VideoDataStream(true); while (true) { try { if (dis.available() > 0) { vds.processFrame(dis); } else { //Writing bytes only to detect the socket closing dos.write(Byte.MIN_VALUE); } } catch (Exception ex) { CamRegister.removeCamClient(camClient); break; } sleep(20); } RecordStorage recordStorage = new RecordStorage(); recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode()); vds.cleanBuffer(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void recordVideo() {\n\n }", "private void liveStreaming() throws IOException, InterruptedException {\n\n CamStreaming camStreaming = new CamStreaming();\n VideoDataStream vds = new VideoDataStream(true);\n byte[] frame;\n\n if (camStreaming.prepareStream(in)) {\n\n while (camStreaming.isTargetConnected()) {\n try {\n\n if (dis.available() > 0) {\n frame = vds.processFrame(dis);\n camStreaming.sendData(frame);\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n break;\n }\n sleep(20);\n }\n \n dos.writeInt(END_OF_STREAM_CODE);\n dos.flush();\n \n// CamRegister.removeCamClient(camClient);\n \n RecordStorage recordStorage = new RecordStorage();\n\n recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode());\n\n vds.cleanBuffer();\n\n }\n\n }", "protected void encodeWithMediaRecorder() throws IOException {\n\t\t// Opens the camera if needed\n\t\tcreateCamera();\n\n\t\t// Stops the preview if needed\n\t\tif (mPreviewStarted) {\n\t\t\tlockCamera();\n\t\t\ttry {\n\t\t\t\tmCamera.stopPreview();\n\t\t\t} catch (Exception e) {}\n\t\t\tmPreviewStarted = false;\n\t\t}\n\n\t\t// Unlock the camera if needed\n\t\tunlockCamera();\n\n\t\tmMediaRecorder = new MediaRecorder();\n\t\tinitRecorderParameters();\n\n\t\t// We write the ouput of the camera in a local socket instead of a file !\t\t\t\n\t\t// This one little trick makes streaming feasible quiet simply: data from the camera\n\t\t// can then be manipulated at the other end of the socket\n\t\tmMediaRecorder.setOutputFile(mPacketizer.getWriteFileDescriptor());\n\n\t\t// Set event listener\n\t\tmMediaRecorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {\n\t\t\t@Override\n\t\t\tpublic void onInfo(MediaRecorder mr, int what, int extra) {\n\t\t\t\tswitch (what) {\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_UNKNOWN, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_MAX_DURATION_REACHED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tmMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {\n\t\t\t@Override\n\t\t\tpublic void onError(MediaRecorder mr, int what, int extra) {\n\t\t\t\tswitch (what) {\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN:\n\t\t\t\t\t\tLog.e(TAG, \"MEDIA_RECORDER_ERROR_UNKNOWN, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_ERROR_SERVER_DIED:\n\t\t\t\t\t\tLog.e(TAG, \"MEDIA_ERROR_SERVER_DIED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttry {\n\t\t\tmMediaRecorder.prepare();\n\t\t\tmMediaRecorder.start();\n\n\t\t\t// mReceiver.getInputStream contains the data from the camera\n\t\t\t// the mPacketizer encapsulates this stream in an RTP stream and send it over the network\n\t\t\tmPacketizer.start();\n\t\t\tmStreaming = true;\n\t\t} catch (IOException e) {\n\t\t\tLog.e(TAG, \"encodeWithMediaRecorder exception\", e);\n\t\t\tstop();\n\t\t\tthrow new IOException(\"Something happened with the local sockets :/ Start failed !\");\n\t\t} catch (IllegalStateException e) {\n\t\t\tLog.e(TAG, \"encodeWithMediaRecorder exception\", e);\n\t\t\tthrow e;\n\t\t}\n\n\t}", "private void sendVideoRecordingRequest() {\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n assert surfaceTexture != null;\n surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n\n try {\n\n // create request for RECORDING template\n /**\n * Create a request suitable for video recording. Specifically, this means\n * that a stable frame rate is used, and post-processing is set for\n * recording quality. These requests would commonly be used with the\n * {@link CameraCaptureSession#setRepeatingRequest} method.\n * This template is guaranteed to be supported on all camera devices except\n * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices\n * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE\n * BACKWARD_COMPATIBLE}.\n *\n * @see #createCaptureRequest\n */\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode);\n\n if (mPreviewEnabled) {\n // add Preview surface to target\n mCaptureRequestBuilder.addTarget(previewSurface);\n }\n\n // add Record surface to target\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n try {\n cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void startVideoRecording() {\n this.mActivity.getCameraAppUI().switchShutterSlidingAbility(false);\n if (this.mCameraState == 1) {\n setCameraState(2);\n Tag tag = TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"startVideoRecording: \");\n stringBuilder.append(Thread.currentThread());\n Log.i(tag, stringBuilder.toString());\n ToastUtil.showToast(this.mActivity, this.mActivity.getString(R.string.video_recording_start_toast), 0);\n this.mAppController.onVideoRecordingStarted();\n if (this.mModeSelectionLockToken == null) {\n this.mModeSelectionLockToken = this.mAppController.lockModuleSelection();\n }\n this.mUI.showVideoRecordingHints(false);\n this.mUI.cancelAnimations();\n this.mUI.setSwipingEnabled(false);\n this.mUI.showFocusUI(false);\n this.mAppController.getCameraAppUI().hideRotateButton();\n this.mAppController.getButtonManager().hideEffectsContainerWrapper();\n final long updateStorageSpaceTime = System.currentTimeMillis();\n this.mActivity.updateStorageSpaceAndHint(new OnStorageUpdateDoneListener() {\n public void onStorageUpdateDone(long bytes) {\n Tag access$100 = VideoModule.TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"updateStorageSpaceAndHint cost time :\");\n stringBuilder.append(System.currentTimeMillis() - updateStorageSpaceTime);\n stringBuilder.append(\"ms.\");\n Log.d(access$100, stringBuilder.toString());\n if (VideoModule.this.mCameraState != 2) {\n VideoModule.this.pendingRecordFailed();\n return;\n }\n if (bytes <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {\n Log.w(VideoModule.TAG, \"Storage issue, ignore the start request\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mCameraDevice == null) {\n Log.v(VideoModule.TAG, \"in storage callback after camera closed\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mPaused) {\n Log.v(VideoModule.TAG, \"in storage callback after module paused\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mMediaRecorderRecording) {\n Log.v(VideoModule.TAG, \"in storage callback after recording started\");\n } else if (VideoModule.this.isSupported(VideoModule.this.mProfile.videoFrameWidth, VideoModule.this.mProfile.videoFrameHeight)) {\n VideoModule.this.mCurrentVideoUri = null;\n VideoModule.this.mCameraDevice.enableShutterSound(false);\n if (VideoModule.this.mNeedGLRender && VideoModule.this.isSupportEffects()) {\n VideoModule.this.playVideoSound();\n VideoModule.this.initGlRecorder();\n VideoModule.this.pauseAudioPlayback();\n VideoModule.this.mActivity.getCameraAppUI().startVideoRecorder();\n } else {\n VideoModule.this.initializeRecorder();\n if (VideoModule.this.mMediaRecorder == null) {\n Log.e(VideoModule.TAG, \"Fail to initialize media recorder\");\n VideoModule.this.pendingRecordFailed();\n return;\n }\n VideoModule.this.pauseAudioPlayback();\n try {\n long mediarecorderStart = System.currentTimeMillis();\n VideoModule.this.mMediaRecorder.start();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder2 = new StringBuilder();\n stringBuilder2.append(\"mMediaRecorder.start() cost time : \");\n stringBuilder2.append(System.currentTimeMillis() - mediarecorderStart);\n Log.d(access$100, stringBuilder2.toString());\n VideoModule.this.playVideoSound();\n VideoModule.this.mCameraDevice.refreshSettings();\n VideoModule.this.mCameraSettings = VideoModule.this.mCameraDevice.getSettings();\n VideoModule.this.setFocusParameters();\n } catch (RuntimeException e) {\n Log.e(VideoModule.TAG, \"Could not start media recorder. \", e);\n VideoModule.this.releaseMediaRecorder();\n VideoModule.this.mCameraDevice.lock();\n VideoModule.this.releaseAudioFocus();\n if (VideoModule.this.mModeSelectionLockToken != null) {\n VideoModule.this.mAppController.unlockModuleSelection(VideoModule.this.mModeSelectionLockToken);\n }\n VideoModule.this.setCameraState(1);\n if (VideoModule.this.shouldHoldRecorderForSecond()) {\n VideoModule.this.mAppController.setShutterEnabled(true);\n }\n VideoModule.this.mAppController.getCameraAppUI().showModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(true);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.onVideoRecordingStop();\n }\n ToastUtil.showToast(VideoModule.this.mActivity.getApplicationContext(), (int) R.string.video_record_start_failed, 0);\n return;\n }\n }\n VideoModule.this.mAppController.getCameraAppUI().setSwipeEnabled(false);\n VideoModule.this.setCameraState(3);\n VideoModule.this.tryLockFocus();\n VideoModule.this.mMediaRecorderRecording = true;\n VideoModule.this.mActivity.lockOrientation();\n VideoModule.this.mRecordingStartTime = SystemClock.uptimeMillis() + 600;\n VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().setAngle(VideoModule.this.mOrientation);\n VideoModule.this.mAppController.getCameraAppUI().hideModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(false);\n }\n if (VideoModule.this.isVideoShutterAnimationEnssential()) {\n VideoModule.this.mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoCaptureButton(true);\n }\n if (VideoModule.this.mAppController.getCameraAppUI().getCurrentModeIndex() == VideoModule.this.mActivity.getResources().getInteger(R.integer.camera_mode_video)) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoPauseButton(false);\n }\n VideoModule.this.mUI.showRecordingUI(true);\n if (VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().getVisibility() == 0) {\n VideoModule.this.mUI.hideCapButton();\n }\n VideoModule.this.showBoomKeyTip();\n VideoModule.this.updateRecordingTime();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder3 = new StringBuilder();\n stringBuilder3.append(\"startVideoRecording cost time 1 : \");\n stringBuilder3.append(System.currentTimeMillis() - VideoModule.this.mShutterButtonClickTime);\n Log.d(access$100, stringBuilder3.toString());\n if (VideoModule.this.isSendMsgEnableShutterButton()) {\n VideoModule.this.mHandler.sendEmptyMessageDelayed(6, VideoModule.MIN_VIDEO_RECODER_DURATION);\n }\n VideoModule.this.mActivity.enableKeepScreenOn(true);\n VideoModule.this.mActivity.startInnerStorageChecking(new OnInnerStorageLowListener() {\n public void onInnerStorageLow(long bytes) {\n VideoModule.this.mActivity.stopInnerStorageChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_storage_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n VideoModule.this.mActivity.startBatteryInfoChecking(new OnBatteryLowListener() {\n public void onBatteryLow(int level) {\n VideoModule.this.mActivity.stopBatteryInfoChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_battery_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n } else {\n Log.e(VideoModule.TAG, \"Unsupported parameters\");\n VideoModule.this.pendingRecordFailed();\n }\n }\n });\n }\n }", "public void saveVideo() {\n if (this.mVideoFileDescriptor == null) {\n long duration = SystemClock.uptimeMillis() - this.mRecordingStartTime;\n try {\n MediaMetadataRetriever mmr = new MediaMetadataRetriever();\n mmr.setDataSource(this.mCurrentVideoFilename);\n String durationStr = mmr.extractMetadata(9);\n mmr.release();\n duration = (long) Integer.parseInt(durationStr);\n } catch (Exception e) {\n Log.e(TAG, \"MediaMetadataRetriever error, use estimated duration\", e);\n }\n if (duration <= 0) {\n Tag tag = TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"Video duration <= 0 : \");\n stringBuilder.append(duration);\n Log.w(tag, stringBuilder.toString());\n }\n if (this.mCurrentVideoValues == null) {\n generateVideoFilename(this.mProfile.fileFormat);\n }\n if (this.mCurrentVideoValues != null) {\n this.mCurrentVideoValues.put(\"_size\", Long.valueOf(new File(this.mCurrentVideoFilename).length()));\n this.mCurrentVideoValues.put(InfoTable.DURATION, Long.valueOf(duration));\n if (needAddToMediaSaver()) {\n getServices().getMediaSaver().addVideo(this.mCurrentVideoFilename, this.mCurrentVideoValues, getVideoSavedListener(), this.mContentResolver);\n }\n logVideoCapture(duration);\n } else {\n return;\n }\n }\n this.mCurrentVideoValues = null;\n }", "private void requestRecord() throws IOException {\n\n String targetCamCode = dis.readUTF();\n\n Cam targetCam = CamRegister.findRegisteredCam(targetCamCode);\n\n try {\n DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream());\n targetDos.writeInt(RECORD_CAM_COMMAND);\n targetDos.flush();\n\n dos.writeInt(SUCCESS_CODE);\n dos.flush();\n } catch (Exception e) {\n dos.writeInt(NOT_FOUND_CODE);\n dos.flush();\n }\n }", "@Override\n\tpublic void receiveFrameData(Camera camera, int avChannel, Bitmap bmp) {\n\t}", "Record(VideoObj video, int numOwned, int numOut, int numRentals) {\n\t\tthis.video = video;\n\t\tthis.numOwned = numOwned;\n\t\tthis.numOut = numOut;\n\t\tthis.numRentals = numRentals;\n\t}", "void onPreviewFrame(byte[] data, Camera camera);", "public void startVideoRecording() {\n\n try {\n mVideoFileTest = createVideoFile(mVideoFolder);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // set up Recorder\n try {\n setupMediaRecorder();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // prepare for recording\n sendVideoRecordingRequest();\n\n // start recording\n mMediaRecorder.start();\n\n if (mRokidCameraRecordingListener != null) {\n mRokidCameraRecordingListener.onRokidCameraRecordingStarted();\n }\n }", "@Override\n public void receiveFrameDataForMediaCodec(Camera camera, int avChannel, byte[] buf, int length, int pFrmNo, byte[] pFrmInfoBuf, boolean\n isIframe, int codecId) {\n\n }", "private void requestLiveStreaming() throws IOException {\n\n String targetCamCode = dis.readUTF();\n\n Cam targetCam = CamRegister.findRegisteredCam(targetCamCode);\n\n try {\n DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream());\n\n targetDos.writeInt(LIVE_STREAMING_COMMAND);\n targetDos.writeUTF(camClient.getCamCode());\n targetDos.flush();\n\n dos.writeInt(SUCCESS_CODE);\n dos.flush();\n\n } catch (Exception e) {\n e.printStackTrace();\n dos.writeInt(NOT_FOUND_CODE);\n dos.flush();\n }\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n Toast.makeText(VideoDetailsActivity.this,\"Reciever fot the result. Do some processing bro\",Toast.LENGTH_LONG).show();\n mVideoView.setVideoURI();\n }", "public void handleRecButtonOnPressed() {\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM, true);\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC, true);\n ((AudioManager) AppDelegate.getAppContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING, true);\n AudioManager audioMgr = ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE));\n\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n //updateMessage();\n if (timerCounter != null) {\n timerCounter.cancel();\n timerCounter = null;\n }\n\n if (isCameraRecording) {\n\n isCameraRecording = false;\n mStartRecordingButton.setChecked(false);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.GONE);\n disableAuthorityAlertedText();\n\n cameraView.stopRecording();\n\n // Control view group\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n\n toolBarTitle.setText(dateFormat.format(new Date(userPreferences.recordTime() * 1000)));\n handler.removeCallbacksAndMessages(null);\n handler.removeCallbacks(counterMessage);\n counterMessage = null;\n\n //VIDEO FINISHING ALERT\n CommonAlertDialog dialog = new CommonAlertDialog(getActivity(), mAlertDialogButtonClickListerer); // Setting dialogview\n dialog.show();\n\n } else {\n\n userPreferences.setEventId(UUID.randomUUID().toString());\n isCameraRecording = true;\n\n mStartRecordingButton.setChecked(true);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.VISIBLE);\n cameraView.setVisibility(View.VISIBLE);\n\n if (cacheFolder == null) {\n cacheFolder = new FwiCacheFolder(AppDelegate.getAppContext(), String.format(\"%s/%s\", userPreferences.currentProfileId(), userPreferences.eventId()));\n cameraView.setDelegate(this);\n cameraView.setCacheFolder(cacheFolder);\n }\n\n this.startRecording();\n\n }\n if (userPreferences.enableTorch()) {\n isenableTourch = true;\n cameraView.torchOn();\n }\n\n }", "public interface CameraVideoListener {\n void onVideoRecordStarted(Size videoSize);\n\n void onVideoRecordStopped(File videoFile, CameraFragmentResultListener callback);\n\n void onVideoRecordError();\n}", "private void recordVideoUsingCamera(\n Camera camera, String fileName, int durMs, boolean timelapse) throws Exception {\n Camera.Parameters params = camera.getParameters();\n int frameRate = params.getPreviewFrameRate();\n\n camera.unlock();\n mMediaRecorder.setCamera(camera);\n mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);\n mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);\n mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);\n mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);\n mMediaRecorder.setVideoFrameRate(frameRate);\n mMediaRecorder.setVideoSize(VIDEO_WIDTH, VIDEO_HEIGHT);\n mMediaRecorder.setPreviewDisplay(mActivity.getSurfaceHolder().getSurface());\n mMediaRecorder.setOutputFile(fileName);\n mMediaRecorder.setLocation(LATITUDE, LONGITUDE);\n final double captureRate = VIDEO_TIMELAPSE_CAPTURE_RATE_FPS;\n if (timelapse) {\n mMediaRecorder.setCaptureRate(captureRate);\n }\n\n mMediaRecorder.prepare();\n mMediaRecorder.start();\n Thread.sleep(durMs);\n mMediaRecorder.stop();\n assertTrue(mOutFile.exists());\n\n int targetDurMs = timelapse? ((int) (durMs * (captureRate / frameRate))): durMs;\n boolean hasVideo = true;\n boolean hasAudio = timelapse? false: true;\n checkTracksAndDuration(targetDurMs, hasVideo, hasAudio, fileName);\n }", "private void startRecord() {\n try {\n if (mIsRecording) {\n setupMediaRecorder();\n } else if (mIsTimelapse) {\n setupTimelapse();\n }\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n surfaceTexture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n mCaptureRequestBuilder.addTarget(previewSurface);\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface, mImageReader.getSurface()),\n new CameraCaptureSession.StateCallback() {\n\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n\n mRecordCaptureSession = session;\n\n try {\n mRecordCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession session) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public boolean save(CameraRecord record);", "public void startStreaming() {\n// phoneCam.setViewportRenderingPolicy(OpenCvCamera.ViewportRenderingPolicy.OPTIMIZE_VIEW);\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.SIDEWAYS_RIGHT);\n }", "@TargetApi(Build.VERSION_CODES.LOLLIPOP)\n private void startScreenRecord(final Intent intent) {\n if (DEBUG) {\n Log.v(TAG, \"startScreenRecord:sMuxer=\" + sMuxer);\n }\n synchronized (sSync) {\n if (sMuxer == null) {\n\n videoEncodeConfig = (VideoEncodeConfig) intent.getSerializableExtra(EXTRA_VIDEO_CONFIG);\n audioEncodeConfig = (AudioEncodeConfig) intent.getSerializableExtra(EXTRA_AUDIO_CONFIG);\n\n final int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, 0);\n // get MediaProjection\n final MediaProjection projection = mMediaProjectionManager.getMediaProjection(resultCode, intent);\n if (projection != null) {\n\n int width = videoEncodeConfig.width;\n int height = videoEncodeConfig.height;\n final DisplayMetrics metrics = getResources().getDisplayMetrics();\n\n if (videoEncodeConfig.width == 0 || videoEncodeConfig.height == 0) {\n width = metrics.widthPixels;\n height = metrics.heightPixels;\n }\n if (width > height) {\n // 横長\n final float scale_x = width / 1920f;\n final float scale_y = height / 1080f;\n final float scale = Math.max(scale_x, scale_y);\n width = (int) (width / scale);\n height = (int) (height / scale);\n } else {\n // 縦長\n final float scale_x = width / 1080f;\n final float scale_y = height / 1920f;\n final float scale = Math.max(scale_x, scale_y);\n width = (int) (width / scale);\n height = (int) (height / scale);\n }\n if (DEBUG) {\n Log.v(TAG, String.format(\"startRecording:(%d,%d)(%d,%d)\", metrics.widthPixels, metrics.heightPixels, width, height));\n }\n\n try {\n sMuxer = new MediaMuxerWrapper(this, \".mp4\"); // if you record audio only, \".m4a\" is also OK.\n if (true) {\n // for screen capturing\n new MediaScreenEncoder(sMuxer, mMediaEncoderListener,\n projection, width, height, metrics.densityDpi, videoEncodeConfig.bitrate * 1000, videoEncodeConfig.framerate);\n }\n if (true) {\n // for audio capturing\n new MediaAudioEncoder(sMuxer, mMediaEncoderListener);\n }\n sMuxer.prepare();\n sMuxer.startRecording();\n } catch (final IOException e) {\n Log.e(TAG, \"startScreenRecord:\", e);\n }\n }\n }\n }\n }", "public void onVideoStarted () {}", "@Override\n\tpublic void onPreviewFrame(byte[] bytes, Camera camera) {\n\n\t}", "@Override\n public void run() {\n if (data.isStreaming()) {\n // if (frame < list.size()) {\n try {\n // BufferedImage image = list.get(frame);\n enc.encodeImage(videoImage);\n // frame++;\n } catch (Exception ex) {\n System.out.println(\"Error encoding frame: \" + ex.getMessage());;\n }\n }\n\n }", "@Override\n\t\t\t\tpublic void onVideoFrame(byte[] data, long timestampUs) {\n\t\t\t\t\tbyte[] buffer = new byte[mDummyOffset + data.length];\n\t\t\t\t\tSystem.arraycopy(data, 0, buffer, mDummyOffset, data.length);\n\n\t\t\t\t\tmListener.sendFrame(buffer, mDummyOffset, data.length, timestampUs);\n\t\t\t\t\tmDummyOffset++;\n\t\t\t\t}", "private void record(){\n clear();\n recording = true;\n paused = false;\n playing = false;\n setBtnState();\n recorder = new Recorder(audioFormat);\n new Thread(recorder).start();\n }", "private void startRecording() {\n\n }", "@Override\n\tvoid postarVideo() {\n\n\t}", "@Override\n public void onVideoEnd() {\n super.onVideoEnd();\n }", "public void run() {\n\n\n if (videoFile != null) {\n //\n // Add Image to Photos Gallery\n //\n //final Uri uri = addMediaToGallery(mInscribedVideoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //final Uri uri = addMediaToGallery(videoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //Log.e(TAG, \"uri--->\" + uri.getPath());\n\n //\n // Create a media bean and set the copyright for server flags\n //\n String media_id = \"\";\n try {\n media_id = copyrightJsonObject.getString(\"media_id\");\n copyrightJsonObject.put(\"applyCopyrightOnServer\", 1);\n copyrightJsonObject.put(\"device_id\", SessionManager.getInstance().getDevice_id());\n copyrightJsonObject.put(\"device_type\", Common.DEVICE_TYPE);\n } catch (JSONException e) {\n // this shouldn't occur\n Log.e(TAG, \"JSONException trying to get media_id from copyright!\");\n }\n String mediaName = ImageUtils.getInstance()\n .getImageNameFromPath(videoFile.getAbsolutePath());\n GalleryBean media = new GalleryBean(videoFile.getAbsolutePath(),\n mediaName,\n \"video\",\n media_id,\n false,\n thumbnail,\n GalleryBean.GalleryType.NOT_SYNC);\n media.setDeviceId(SessionManager.getInstance().getDevice_id());\n media.setDeviceType(Common.DEVICE_TYPE);\n String mediaNamePrefix = mediaName.substring(0,\n mediaName.lastIndexOf('.'));\n media.setMediaNamePrefix(mediaNamePrefix);\n media.setMediaThumbBitmap(thumbnail);\n media.setLocalMediaPath(videoFile.getAbsolutePath());\n Date date = new Date();\n media.setMediaDate(date.getTime());\n //String mimeType = getContentResolver().getType(uri);\n media.setMimeType(\"video/mp4\"); // must be set for Amazon.\n media.setCopyright(copyrightJsonObject.toString());\n\n MemreasTransferModel transferModel = new MemreasTransferModel(\n media);\n transferModel.setType(MemreasTransferModel.Type.UPLOAD);\n QueueAdapter.getInstance().getSelectedTransferModelQueue()\n .add(transferModel);\n\n // Start the service if it's not running...\n startQueueService();\n } else {\n //\n // Show Toast error occurred here...\n //\n videoFile.delete();\n }\n\n }", "@Override\n\tpublic void receiveFrameDataForMediaCodec(Camera camera, int i,\n\t\t\tbyte[] abyte0, int j, int k, byte[] abyte1, boolean flag, int l) {\n\t\t\n\t}", "@Override\n public void onVideoStarted() {\n }", "@Override\n\t\t\t\tpublic void onVideoFrame(byte[] data, long timestampUs) {\n\t\t\t\t\tByteBuffer byteBuffer = ByteBuffer.allocate(mDummyOffset + data.length);\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tbyteBuffer.put(data);\n\t\t\t\t\tbyteBuffer.flip();\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tmListener.sendFrame(byteBuffer, timestampUs);\n\t\t\t\t\tmDummyOffset++;\n\t\t\t\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n if (isRecording) {\n \tLog.i(\"DEbuging cam act\", \"In isRecording\");\n // stop recording and release camera\n mMediaRecorder.stop(); // stop the recording\n tts= new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {\n \t @Override\n \t public void onInit(int status) {\n \t if(status != TextToSpeech.ERROR) {\n \t tts.setLanguage(Locale.UK);\n \t \t \n \t tts.speak(\"Recording stopped\", TextToSpeech.QUEUE_FLUSH, null);\n \t }\n \t }\n \t });\n\n releaseMediaRecorder(); // release the MediaRecorder object\n mCamera.lock(); // take camera access back from MediaRecorder\n\n // TODO inform the user that recording has stopped \n isRecording = false;\n releaseCamera();\n mediaMetadataRetriever.setDataSource(opFile); \n r = new Runnable() { \t\n \t\t\t\n \t\t\t@Override\n \t\t\tpublic void run() {\n \t\t\t\tLog.i(\"DEbuging cam act\", \"In runable\");\n \t\t\t\t//To call this thread periodically: handler.postDelayed(this, 2000);\n \t\t\t\t//getFrmAtTime has microsec as parameter n postDelayed has millisec \t\t\t\t\n \t\t\t\t//Bitmap tFrame[];\n \t\t\t\t\n \t\t\t\t\n \t\t\t\tString duration = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);\n \t\t\t\tframe.add(mediaMetadataRetriever.getFrameAtTime(time));\n \t\t\t\t/*int videoDuration = Integer.parseInt(duration);\n \t\t\t\tSystem.out.println(videoDuration);\n \t\t\t\twhile(time<videoDuration) {\n \t\t\t\t\tframe.add(mediaMetadataRetriever.getFrameAtTime(time)); \t\t\t\t\t\n \t\t\t\ttime=time+1000;\n \t\t\t\t}*/\n \t\t\t\t/*SendToServer sts = new SendToServer(frame);\n \t\t\t\tsts.connectToServer();*/\n \t\t\t\tConnectServer connectServer = new ConnectServer(frame);\n \t\t\t\tconnectServer.execute();\n \t\t\t\t\n \t\t\t}\n\n\t\t\t\t\t\t\n \t\t};\n\t\t\t\t\tr.run();\n \n } else {\n // initialize video camera\n if (prepareVideoRecorder()) {\n // Camera is available and unlocked, MediaRecorder is prepared,\n // now you can start recording \t\n mMediaRecorder.start(); \n //TODO inform the user that recording has started \n isRecording = true;\n tts= new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {\n \t @Override\n \t public void onInit(int status) {\n \t if(status != TextToSpeech.ERROR) {\n \t tts.setLanguage(Locale.UK);\n \t \t \n \t tts.speak(\"Started. Click Anywhere to stop recording\", TextToSpeech.QUEUE_FLUSH, null);\n \t }\n \t }\n \t });\n \n } else {\n // prepare didn't work, release the camera\n releaseMediaRecorder();\n // inform user\n }\n }\n\t\t\t}", "@Override\n\t\t\t\tpublic void onVideoFrame(byte[] data, long timestampUs) {\n\t\t\t\t\tByteBuffer byteBuffer = ByteBuffer.allocateDirect(mDummyOffset + data.length);\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tbyteBuffer.put(data);\n\t\t\t\t\tbyteBuffer.flip();\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tmListener.sendFrame(byteBuffer, timestampUs);\n\t\t\t\t\tmDummyOffset++;\n\t\t\t\t}", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "@Override\n\t\tpublic void onPreviewFrame(byte[] data, Camera camera) {\n\n\t\t\tif (Flag) {\n\t\t\t\tnum++;\n\t\t\t\tif (num > 100)\n\t\t\t\t{\t\n\t\t\t\t\tmNativeEnCode.nativeSetRawBuf(null, -1, 0, 0);\n\t\t\t\t\tFlag = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (lasttime == 0) {\n\t\t\t\t\ttime = 0;\n\t\t\t\t\tlasttime = System.currentTimeMillis();\n\t\t\t\t} else {\n\n\t\t\t\t\ttime = System.currentTimeMillis() - lasttime;\n\t\t\t\t}\n\t\t\t\t/*Log.d(TAG, \"\" + time);\n\t\t\t\tframenum++;\n\t\t\t\tsumtime = (int) (time - slasttime);\n\t\t\t\tif (sumtime > 5000) {\n\t\t\t\t\tslasttime = time;\n\t\t\t\t\t\n\t\t\t\t}*/\n\t\t\t\tmNativeEnCode.nativeSetRawBuf(data, data.length, time, 0);\n\t\t\t}\n\t\t}", "void onCaptureStarted(CaptureRequest request, long timestamp, long frameNumber);", "private void videoRecordingPrepared() {\n Log.d(\"Camera\", \"videoRecordingPrepared()\");\n isCameraXHandling = false;\n // Keep disabled status for a while to avoid fast click error with \"Muxer stop failed!\".\n binding.capture.postDelayed(() -> binding.capture.setEnabled(true), 500);\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "public interface PxVideoRecorderDebugListener {\n void debugLog(String title, String message);\n}", "@Override\n\t\t\tpublic void onPreviewFrame(byte[] data, Camera camera) {\n\n\t\t\t\tCamera.Parameters params = mCamera.getParameters();\n\n\t\t\t\tint w = params.getPreviewSize().width;\n\t\t\t\tint h = params.getPreviewSize().height;\n\t\t\t\tint format = params.getPreviewFormat ();\n\n\t\t\t\t//\tBitmap imageBitap = new Bitmap();\n\n\n\t\t\t\tYuvImage image = new YuvImage(data, format, w, h, null);\n\n\t\t\t\tByteArrayOutputStream out = new ByteArrayOutputStream();\n\t\t\t\tRect area = new Rect(0, 0, w, h);\n\t\t\t\timage.compressToJpeg(area, 50, out);\n\t\t\t\tstreamingImage = BitmapFactory.decodeByteArray(out.toByteArray(), 0, out.size());\n\n\n\n\t\t\t\tByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\t\t\t\tstreamingImage = Bitmap.createScaledBitmap(streamingImage, 160, streamingImage.getHeight()/(streamingImage.getWidth()/160), true);\n\t\t\t\tstreamingImage.compress( CompressFormat.JPEG, 30, outputStream) ; \n\t\t\t\tbyte[] imageByte = outputStream.toByteArray() ; \n\n\t\t\t\tint len;\n\n\t\t\t\tbyte[] byteLen = new byte[4];\n\t\t\t\tbyte[] sendByte = new byte[DataConstants.sendingSize];\n\n\t\t\t\tByteArrayInputStream inputStream = new ByteArrayInputStream(imageByte);\n\n\t\t\t\tbyteLen = DataConstants.intToByteArray(imageByte.length);\n\n\t\t\t\tflag_isSendOK = false;\n\n\t\t\t\tif(flag_isChangeOK == true){\n\t\t\t\t\ttry {\n\t\t\t\t\t\twhile((len=inputStream.read(sendByte))!=-1){\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[0] = 8;\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[1] = 28;\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[2] = 16; \n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[3] = (byte) sendingImageIndex;\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[4] = byteLen[0];\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[5] = byteLen[1];\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[6] = byteLen[2];\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[7] = byteLen[3];\n\n\t\t\t\t\t\t\tfor(int eof=8; eof<len+8; eof++){\n\t\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[eof] = sendByte[eof-8];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (IOException e) { \n\t\t\t\t\t\t//TODO: rano said good jam! \n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t} \n\n\t\t\t\t\t// TODO: �ڵ鷯 �θ���\n\t\t\t\t\tsendingImageIndexMax = sendingImageIndex;\n\t\t\t\t\tsendingImageIndex = 1;\n\t\t\t\t\tflag_isSendOK = true;\n\t\t\t\t\t//\t\t\t\tsendHandler.sendEmptyMessage(0);\n\n\t\t\t\t}\n\t\t\t}", "@Override\n public void onFrameAvailable(int cameraId) {\n }", "@Override\n public void onFrameAvailable(int cameraId) {\n }", "void avRecorderSetup() {\n\r\n\t\t \r\n imw = ToolFactory.makeWriter(file.getAbsolutePath());//or \"output.avi\" or \"output.mov\"\r\n imw.open();\r\n imw.setForceInterleave(true);\r\n imw.addVideoStream(0, 0, IRational.make((double)vidRate), widthCapture, heightCapture);\r\n audionumber = imw.addAudioStream(audioStreamIndex, audioStreamId, channelCount, sampleRate);\r\n isc = imw.getContainer().getStream(0).getStreamCoder();\r\n bgr = new BufferedImage(widthCapture, heightCapture, BufferedImage.TYPE_3BYTE_BGR);\r\n sTime = fTime = System.nanoTime();\r\n }", "@Override\n\tpublic void videoComplete() {\n\t\t\n\t}", "public abstract void videoMessage(Message m);", "public void record() {\n\t\tif (isRecord) {\n\t\t\tisRecord = false;\n\n\t\t\t// Generates a unique filename.\n\t\t\tString currenttime = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(Calendar.getInstance().getTime());\n\t\t\tfilename = recordingsPath + currenttime + \".ogg\";\n\n\t\t\t// The pipe.\n\t\t\tString[] rec = new String[] { \"alsasrc\", \"!\", \"audioconvert\", \"!\", \"audioresample\", \"!\", \"vorbisenc\", \"!\", \"oggmux\", \"!\",\n\t\t\t\t\t\"filesink location = \" + filename };\n\n\t\t\trec = Gst.init(\"AudioRecorder\", rec);\n\t\t\tStringBuilder sb = new StringBuilder();\n\n\t\t\tfor (String s : rec) {\n\t\t\t\tsb.append(' ');\n\t\t\t\tsb.append(s);\n\t\t\t}\n\n\t\t\t// Start recording\n\t\t\taudiopipe = Pipeline.launch(sb.substring(1));\n\t\t\taudiopipe.play();\n\n\t\t} else {\n\t\t\t// Stop recording and add file to the list.\n\t\t\taudiopipe.stop();\n\t\t\tgui.addNewFiletoList(filename);\n\t\t\tisRecord = true;\n\t\t}\n\n\t}", "public void setVideoPort(int port);", "public Vision() {\n\n visionCam = CameraServer.getInstance().startAutomaticCapture(\"HatchCam\", 0);\n visionCam.setVideoMode(PixelFormat.kMJPEG, 320, 240, 115200);\n \n int retry = 0;\n while(cam == null && retry < 10) {\n try {\n System.out.println(\"Connecting to jevois serial port ...\");\n cam = new SerialPort(115200, SerialPort.Port.kUSB1);\n System.out.println(\"Success!!!\");\n } catch (Exception e) {\n System.out.println(\"We all shook out\");\n e.printStackTrace();\n sleep(500);\n System.out.println(\"Retry\" + Integer.toString(retry));\n retry++;\n }\n }\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n }", "void onCaptureCompleted(CaptureRequest request, TotalCaptureResult result);", "public void record() {\n if (mCarContext.checkSelfPermission(RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n CarToast.makeText(mCarContext, \"Grant mic permission on phone\",\n CarToast.LENGTH_LONG).show();\n List<String> permissions = Collections.singletonList(RECORD_AUDIO);\n mCarContext.requestPermissions(permissions, (grantedPermissions,\n rejectedPermissions) -> {\n if (grantedPermissions.contains(RECORD_AUDIO)) {\n record();\n }\n });\n return;\n }\n CarAudioRecord record = CarAudioRecord.create(mCarContext);\n\n Thread recordingThread =\n new Thread(\n () -> doRecord(record),\n \"AudioRecorder Thread\");\n recordingThread.start();\n }", "public void onVideoRecordingStarted() {\n this.mUI.unlockCaptureView();\n }", "private void recordMessage() {\n if (!listening) {\n capture = microphoneHelper.getInputStream(true);\n new Thread(() -> {\n try {\n speechService.recognizeUsingWebSocket(getRecognizeOptions(capture), new MicrophoneRecognizeDelegate());\n } catch (Exception e) {\n showError(e);\n }\n }).start();\n listening = true;\n Toast.makeText(WatsonActivity.this, \"Listening....Click to Stop\", Toast.LENGTH_LONG).show();\n\n } else {\n try {\n microphoneHelper.closeInputStream();\n listening = false;\n Toast.makeText(WatsonActivity.this, \"Stopped Listening....Click to Start\", Toast.LENGTH_LONG).show();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }\n }", "@Override\n public void run() {\n\n\n AudioRecord audioRecorder = new AudioRecord (MediaRecorder.AudioSource.VOICE_COMMUNICATION, SAMPLE_RATE,\n AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,\n AudioRecord.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT));\n int bytes_read = 0;\n int bytes_sent = 0;\n byte[] buf = new byte[BUF_SIZE];\n Log.d(\"bytes_read\", String.valueOf(bytes_read));\n audioRecorder.startRecording();\n while (mic && !UDP){\n bytes_read = audioRecorder.read(buf, 0, BUF_SIZE); //also should add the headers required for our case\n Log.d(\"bytes_read\", String.valueOf(bytes_read));\n //The following code is to add the length in 4 bytes to the packet. Required in TCP connection if you use recv function in multiplex.py(server side).\n// byte[] len = ByteBuffer.allocate(4).order(BIG_ENDIAN).putInt(bytes_read).array();\n// byte[] toSend = new byte[4+bytes_read];\n// System.arraycopy(len, 0, toSend, 0, 4);\n// System.arraycopy(buf, 0, toSend, 4, bytes_read);\n try {\n dataOutputStreamInstance.write(buf);\n dataOutputStreamInstance.flush();\n } catch (IOException e) {\n e.printStackTrace();\n }\n bytes_sent += bytes_read;\n }\n\n // Stop recording and release resources\n audioRecorder.stop();\n audioRecorder.release();\n try {\n buff.close();\n dataOutputStreamInstance.close();\n out1.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return;\n }", "@Override public void run()\n {\n pauseStreaming();\n\n // Switch the current camera\n camera = newCamera;\n\n // Resume streaming on the new camera if there is one\n if (camera != null)\n {\n resumeStreaming();\n }\n }", "@Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n\n Camera.Parameters parameters = camera.getParameters();\n int width = parameters.getPreviewSize().width;\n int height = parameters.getPreviewSize().height;\n\n mCamera.addCallbackBuffer(data);\n\n if (yuvType == null) {\n yuvType = new Type.Builder(rs, Element.U8(rs)).setX(data.length);\n in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);\n\n rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs)).setX(width).setY(height);\n out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);\n }\n\n in.copyFrom(data);\n\n yuvToRgbIntrinsic.setInput(in);\n yuvToRgbIntrinsic.forEach(out);\n\n Bitmap mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n out.copyTo(mBitmap);\n\n mBitmap = GlobalUtils.rotateBitmapOnOrientation(mBitmap,ctx);\n\n liveCamera.setVisibility(VISIBLE);\n\n if(PROCESS_IMAGE) {\n\n if(PROCESSING_TYPE == 1) {\n Rect2d rect2d = new Rect2d(100, 100, 100, 100);\n imageProcessing.RunDetection(mBitmap);\n liveCamera.setImageBitmap(mBitmap);\n }else{\n //Rect2d rect2d = new Rect2d(100, 100, 100, 100);\n liveCamera.setImageBitmap(mBitmap);\n\n }\n\n } else{\n liveCamera.setImageBitmap(mBitmap);\n }\n\n }", "private void videoFrameReceived(long uid, int type, VideoFrame frame, int rotation) {\r\n\t\tfor (RecordingEventHandler oberserver : recordingEventHandlers) {\r\n\t\t\toberserver.videoFrameReceived(uid, type, frame, rotation);\r\n\t\t}\r\n\t}", "@Override\n public void imagingUpdate(CameraState status) {\n synchronized(_cameraListeners) {\n if (_cameraListeners.isEmpty()) return;\n }\n \n try {\n // Construct message\n Response resp = new Response(UdpConstants.NO_TICKET, DUMMY_ADDRESS);\n resp.stream.writeUTF(UdpConstants.COMMAND.CMD_SEND_CAMERA.str);\n resp.stream.writeByte(status.ordinal());\n \n // Send to all listeners\n synchronized(_cameraListeners) {\n _udpServer.bcast(resp, _cameraListeners.keySet());\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Failed to serialize camera\");\n }\n }", "void onPictureTaken(byte[] data, Camera camera);", "public void startRecording() {\n // prepare the recorder\n if (!prepareMediaRecorder()) {\n Toast.makeText(VideoCapture.getSelf(), \"Fail in prepareMediaRecorder()!\\n - Ended -\",\n Toast.LENGTH_LONG).show();\n VideoCapture.getSelf().finish();\n }\n\n // start the recording\n mediaRecorder.start();\n mIsRecording = true;\n\n // start snapshots\n mSnapshotSensor.startSnapshot();\n }", "public void setVadRecorder(){\n }", "public void recordVideosName(){\n File file=new File(\"/sdcard/\",\"DateRecording.txt\");\n try {\n FileOutputStream fileOutputStream = new FileOutputStream(file,true);//追加方式打开\n OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);\n BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);\n bufferedWriter.write(videosName[0]+\" \"+videosName[1]+\" \"+videosName[2]+\" \"+videosName[3]+\" \"+videosName[4]+\" \"+videosName[5]+\"\\r\\n\");\n bufferedWriter.write(\"u_1 u_2 u_3\"+\"\\r\\n\");\n bufferedWriter.close();\n outputStreamWriter.close();\n }catch (Exception e){\n e.printStackTrace();\n }\n }", "public Connection invoke(final PeerClient remoteClient) {\n final RemoteMedia remoteMedia = new RemoteMedia(context, enableH264, !enableAudioReceive, !enableVideoReceive, aecContext);\n final AudioStream audioStream = new AudioStream(enableAudioSend ? localMedia.getAudioTrack().getOutputs() : null, enableAudioReceive ? remoteMedia.getAudioTrack().getInputs() : null);\n final VideoStream videoStream = new VideoStream(enableVideoSend ? localMedia.getVideoTrack().getOutputs() : null, enableVideoReceive ? remoteMedia.getVideoTrack().getInputs() : null);\n\n final Connection connection;\n\n // Add the remote view to the layout.\n layoutManager.addRemoteView(remoteMedia.getId(), remoteMedia.getView());\n\n mediaTable.put(remoteMedia.getView(), remoteMedia);\n fragment.registerForContextMenu(remoteMedia.getView());\n remoteMedia.getView().setOnTouchListener(fragment);\n\n if (enableDataChannel) {\n DataChannel channel = new DataChannel(\"mydatachannel\") {{\n setOnReceive(new IAction1<DataChannelReceiveArgs>() {\n @Override\n public void invoke(DataChannelReceiveArgs dataChannelReceiveArgs) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 1 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n textListener.onReceivedText(ProviderName, dataChannelReceiveArgs.getDataString());\n }\n });\n\n addOnStateChange(new IAction1<DataChannel>() {\n @Override\n public void invoke(DataChannel dataChannel) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 2 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n if (dataChannel.getState() == DataChannelState.Connected) {\n synchronized (channelLock)\n {\n dataChannels.add(dataChannel);\n }\n textListener.onPeerJoined(ProviderName);\n } else if (dataChannel.getState() == DataChannelState.Closed || dataChannel.getState() == DataChannelState.Failed) {\n synchronized (channelLock)\n {\n dataChannels.remove(dataChannel);\n }\n\n textListener.onPeerLeft(ProviderName);\n }\n }\n });\n }};\n\n DataStream dataStream = new DataStream(channel);\n connection = new Connection(new Stream[]{audioStream, videoStream, dataStream});\n } else {\n connection = new Connection(new Stream[]{audioStream, videoStream});\n }\n\n connection.setIceServers(iceServers);\n\n connection.addOnStateChange(new fm.icelink.IAction1<Connection>() {\n public void invoke(Connection c) {\n // Remove the remote view from the layout.\n if (c.getState() == ConnectionState.Closing ||\n c.getState() == ConnectionState.Failing) {\n if (layoutManager.getRemoteView(remoteMedia.getId()) != null) {\n layoutManager.removeRemoteView(remoteMedia.getId());\n remoteMedia.destroy();\n }\n }\n }\n });\n\n return connection;\n }", "private void setVideo(){\n /* if(detailsBean==null){\n showToast(\"没有获取到信息\");\n return;\n }\n UserManager.getInstance().setDetailsBean(detailsBean);\n upCallShowSetVideoData = new UpCallShowSetVideoData();\n upCallShowSetVideoData.smobile = Preferences.getString(Preferences.UserMobile,null);\n upCallShowSetVideoData.iringid = detailsBean.iringid;\n if (callShowSetVideoProtocol == null) {\n callShowSetVideoProtocol = new CallShowSetVideoProtocol(null, upCallShowSetVideoData, handler);\n callShowSetVideoProtocol.showWaitDialog();\n }\n callShowSetVideoProtocol.stratDownloadThread(null, ServiceUri.Spcl, upCallShowSetVideoData, handler,true);*/\n }", "public interface VideoConsumer {\n public void onVideoStart(int width, int height) throws IOException;\n\n public int onVideo(byte []data, int format);\n\n public void onVideoStop();\n}", "@Override\n public byte[] getVideo(String cameraName) {\n throw new IllegalStateException(\"Not implemented yet!\");\n }", "@Async\n public void startRecording(String imageUrl) {\n recording = true;\n URL url = null;\n try {\n url = new URL(imageUrl);\n String fileName = url.getFile();\n String destName = \"./\" + fileName.substring(fileName.lastIndexOf(\"/\"));\n System.out.println(destName);\n\n InputStream is = url.openStream();\n OutputStream os = new FileOutputStream(String\n .format(\"%s/%s-capture.mjpg\", videoOutputDirectory, getTimestamp()));\n\n byte[] b = new byte[2048];\n int length;\n\n while (recording && (length = is.read(b)) != -1) {\n os.write(b, 0, length);\n }\n\n is.close();\n os.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "default void uploadVideo() {\r\n\t\tSystem.out.println(\"upload the video\");\r\n\t}", "void addPlayRecord(User user, String video_id);", "int insert(Videoinfo record);", "public void onFftDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) {}", "void onCaptureStart();", "@Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n for(int i=0; i<camera_ids.length; i++) {\n if(cameras[i]!=null && cameras[i]==camera && rawImageListeners[i]!=null) {\n rawImageListeners[i].onNewRawImage(data, previewSizes[i]);\n camera.addCallbackBuffer(previewBuffers[i]);\n }\n }\n }", "@Override\n\t\tpublic void onPictureTaken(byte[] data, Camera camera) {\n\t\t\t\n\t\t}", "@Override\n public void run() {\n mLogView.logI(\"Remote video starting, uid: \" + (uid & 0xFFFFFFFFL));\n setupRemoteVideo(uid, uid == WINDOW_SHARE_UID ? mRemoteShareContainerSplit : mRemoteCameraContainer);\n }", "@Override\n public void onPictureTaken(byte[] bytes, Camera camera) {\n Intent intent = new Intent(getActivity(), ShowCaptureActivity.class);\n intent.putExtra(\"capture\", bytes);\n startActivity(intent);\n return;\n }", "public void saveAndTransferVideoComplexObs(){\n\n try{\n List<Encounter> encounters = Context.getEncounterService().getEncounters(null, null, null, null, null, null, true);\n Encounter lastEncounter = encounters.get(encounters.size()-1);\n\n Person patient = lastEncounter.getPatient();\n ConceptComplex conceptComplex = Context.getConceptService().getConceptComplex(14);\n Location location = Context.getLocationService().getDefaultLocation();\n Obs obs = new Obs(patient, conceptComplex, new Date(), location) ;\n\n String mergedUrl = tempMergedVideoFile.getCanonicalPath();\n InputStream out1 = new FileInputStream(new File(mergedUrl));\n\n ComplexData complexData = new ComplexData(\"mergedFile1.flv\", out1);\n obs.setComplexData(complexData);\n obs.setEncounter(lastEncounter);\n\n Context.getObsService().saveObs(obs, null);\n tempMergedVideoFile.delete();\n\n }catch (Exception e){\n log.error(e);\n }\n }", "@Option int getPortSendCam();", "public void run(){\n\t\tWebcam webcam = Webcam.getDefault();\n webcam.setViewSize(new Dimension(176,144));\n\t\t//webcam.setViewSize(WebcamResolution.VGA.getSize());\n webcam.open();\n isRunning=true;\n try\n {\n ss=new ServerSocket(1088);\n s=ss.accept();\n OutputStream os=s.getOutputStream();\n System.out.println(\"Client connected!\");\n while(isRunning)\n {\n BufferedImage image = webcam.getImage();\n //java.io.BufferedOutputStream bo=new BufferedOutputStream(s.getOutputStream());\n //ObjectOutputStream oo=new ObjectOutputStream(s.getOutputStream());\n //oo.writeObject(image);\n //oo.flush();\n //System.out.println(\"An image was sent!\");\n \n ImageIO.write(image, \"PNG\", os);\n os.flush();\n p.getGraphics().drawImage(image, 0, 0,null);\n Thread.sleep(100);\n }\n \n } catch (Exception ex){}\n\t}", "@Override\n public void onPictureTaken(byte[] data, Camera camera) {\n\n }", "public void doVideoCapture() {\n /*\n r6 = this;\n r0 = r6.mPaused;\n if (r0 != 0) goto L_0x0043;\n L_0x0004:\n r0 = r6.mCameraDevice;\n if (r0 != 0) goto L_0x0009;\n L_0x0008:\n goto L_0x0043;\n L_0x0009:\n r0 = r6.mMediaRecorderRecording;\n if (r0 == 0) goto L_0x0042;\n L_0x000d:\n r0 = r6.mNeedGLRender;\n if (r0 == 0) goto L_0x0029;\n L_0x0011:\n r0 = r6.isSupportEffects();\n if (r0 == 0) goto L_0x0029;\n L_0x0017:\n r0 = r6.mCameraDevice;\n r1 = 0;\n r0.enableShutterSound(r1);\n r0 = r6.mAppController;\n r0 = r0.getCameraAppUI();\n r1 = r6.mPictureTaken;\n r0.takePicture(r1);\n goto L_0x0041;\n L_0x0029:\n r0 = r6.mSnapshotInProgress;\n if (r0 != 0) goto L_0x0041;\n L_0x002d:\n r0 = java.lang.System.currentTimeMillis();\n r2 = r6.mLastTakePictureTime;\n r2 = r0 - r2;\n r4 = 2000; // 0x7d0 float:2.803E-42 double:9.88E-321;\n r2 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1));\n if (r2 >= 0) goto L_0x003c;\n L_0x003b:\n return;\n L_0x003c:\n r6.mLastTakePictureTime = r0;\n r6.takeASnapshot();\n L_0x0041:\n return;\n L_0x0042:\n return;\n L_0x0043:\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.hmdglobal.app.camera.VideoModule.doVideoCapture():void\");\n }", "@Override\n\tpublic void receiveSessionInfo(Camera camera, int resultCode) {\n\t\t\n\t}", "private void gotRemoteStream(MediaStream stream) {\n //we have remote video stream. add to the renderer.\n final VideoTrack videoTrack = stream.videoTracks.get(0);\n if (mEventUICallBack != null) {\n mEventUICallBack.showVideo(videoTrack);\n }\n// runOnUiThread(() -> {\n// try {\n// binding.remoteGlSurfaceView.setVisibility(View.VISIBLE);\n// videoTrack.addSink(binding.remoteGlSurfaceView);\n// } catch (Exception e) {\n// e.printStackTrace();\n// }\n// });\n }", "public void onPictureTaken(byte[] data, Camera camera) {\n }", "private void takePhoto() {\n Uri fileUri = FileProvider.getUriForFile(Mic.getmCtx(), \"com.jay.appdemo1.fileProvider\", getOutputMediaFile());\n Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);\n intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10); //限制的录制时长 以秒为单位\n// intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 1024); //限制视频文件大小 以字节为单位\n// intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //设置拍摄的质量0~1\n// intent.putExtra(MediaStore.EXTRA_FULL_SCREEN, false); // 全屏设置\n startActivityForResult(intent, RECORD_SYSTEM_VIDEO);\n }", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}", "public static ScreenRecorder configScreeenRecorder() throws Exception, AWTException {\n GraphicsConfiguration gc = GraphicsEnvironment//\r\n .getLocalGraphicsEnvironment()//\r\n .getDefaultScreenDevice()//\r\n .getDefaultConfiguration();\r\n\r\n //Create a instance of ScreenRecorder with the required configurations\r\n ScreenRecorder screenRecorder = new ScreenRecorder(gc,\r\n null, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),\r\n new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,\r\n CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,\r\n DepthKey, (int)24, FrameRateKey, Rational.valueOf(15),\r\n QualityKey, 1.0f,\r\n KeyFrameIntervalKey, (int) (15 * 60)),\r\n new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,\"black\",\r\n FrameRateKey, Rational.valueOf(30)),\r\n null,new File(Constant.Path_VideoRecordings));\r\n\r\n return screenRecorder;\r\n}", "@Override\n\t\tpublic void onPreviewFrame(byte[] data, Camera camera) {\n\n\t\t\tlong t=System.currentTimeMillis();\n\n\t\t\tmYuv.put(0, 0, data);\n\t\t\tMat mRgba = new Mat();\n\t\t\tImgproc.cvtColor(mYuv, mRgba, Imgproc.COLOR_YUV420sp2RGB, 4);\n\n\t\t\tBitmap bmp = Bitmap.createBitmap(CAMERA_HEIGHT, CAMERA_WIDTH, Bitmap.Config.ARGB_8888);\n\n\t\t\tif (Utils.matToBitmap(mRgba, bmp)){\n\t\t\t\tMatrix m=new Matrix();\n\t\t\t\tif(cameraIndex==0)\n\t\t\t\t\tm.setRotate(90);\n\t\t\t\telse{\n\t\t\t\t\tm.setRotate(-90);\n\t\t\t\t\tm.postScale(-1, 1);\n\t\t\t\t}\n\t\t\t\tBitmap mBit=Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), m, true);\n\t\t\t\tMat mbit=Utils.bitmapToMat(mBit);\n\t\t\t\tMat mGray=new Mat();\n\t\t\t\tlong t2=System.currentTimeMillis();\n\t\t\t\tLog.d(TAG, \"catch time:\"+(t2-t));\n\t\t\t\tImgproc.cvtColor(mbit, mGray, Imgproc.COLOR_RGBA2GRAY);\n\t\t\t\tFace face=ph.detectFace_and_eyes(mGray, 1.0f);\n\t\t\t\tlong t3=System.currentTimeMillis();\n\t\t\t\tLog.d(TAG, \"detectFace_and_eyes time:\"+(t3-t2));\n\t\t\t\tm.reset();\n\t\t\t\tm.postScale(2, 2);\n\t\t\t\tBitmap bmshow=Bitmap.createBitmap(mBit, 0, 0, mBit.getWidth(), mBit.getHeight(), m, true);\n\t\t\t\tCanvas canvas=mHolder.lockCanvas();\n\t\t\t\tcanvas.drawBitmap(bmshow, 0, 0, null);\n\n\n\t\t\t\tif(face!=null){\n\t\t\t\t\tPaint paint=new Paint();\n\t\t\t\t\tpaint.setStrokeWidth(3);\n\t\t\t\t\tpaint.setStyle(Style.STROKE);\n\t\t\t\t\tpaint.setColor(Color.GREEN);\n\t\t\t\t\tcanvas.drawRect(getRect(face.face_area), paint);\n\n\t\t\t\t\tpaint.setColor(Color.CYAN);\n\t\t\t\t\tcanvas.drawRect(getRect(face.left_eye), paint);\n\t\t\t\t\tcanvas.drawRect(getRect(face.right_eye), paint); \n\n\t\t\t\t\tif(face.enable){\n\t\t\t\t\t\t\n\t\t\t\t\t\tMat faceimg=ph.makefaceimg(mGray, face);\n\t\t\t\t\t\tif(faceimg!=null){\n\t\t\t\t\t\t\tMessage.obtain(handler, 0x0100, faceimg).sendToTarget();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tLog.d(TAG, \"prehandle time:\"+(System.currentTimeMillis()-t3));\n\t\t\t\t\t}\n\t\t\t\t}\t \n\t\t\t\tmFps.measure();\n\t\t\t\tmFps.draw(canvas, (canvas.getWidth() - bmp.getWidth()) / 2, 0);\n\n\t\t\t\tmHolder.unlockCanvasAndPost(canvas);\n\t\t\t\tmGray.release();\n\t\t\t\tmbit.release();\n\t\t\t\tmBit.recycle();\n\t\t\t}\n\t\t\tmRgba.release();\n\t\t\tbmp.recycle();\n\n\t\t\tt=System.currentTimeMillis()-t;\n\t\t\tLog.d(TAG, \"time:\"+t+\"ms\");\n\t\t}", "public boolean onStopVideoRecording() {\n if (this.mNeedGLRender && isSupportEffects()) {\n this.mCurrentVideoFilename = this.mVideoFilename;\n this.mActivity.getCameraAppUI().stopVideoRecorder();\n }\n if (this.PhoneFlag) {\n int moduleId = getModuleId();\n CameraActivity cameraActivity = this.mActivity;\n if (moduleId == 8) {\n this.mActivity.getCameraAppUI().setCalldisable(true);\n this.mActivity.getCameraAppUI().resetAlpha(true);\n }\n }\n if (this.mMediaRecoderRecordingPaused) {\n this.mRecordingStartTime = SystemClock.uptimeMillis() - this.mVideoRecordedDuration;\n this.mVideoRecordedDuration = 0;\n this.mMediaRecoderRecordingPaused = false;\n this.mUI.mMediaRecoderRecordingPaused = false;\n this.mUI.setRecordingTimeImage(true);\n }\n this.mAppController.getCameraAppUI().showRotateButton();\n this.mAppController.getCameraAppUI().setSwipeEnabled(true);\n this.mActivity.stopBatteryInfoChecking();\n this.mActivity.stopInnerStorageChecking();\n boolean recordFail = stopVideoRecording();\n releaseAudioFocus();\n if (this.mIsVideoCaptureIntent) {\n if (this.mQuickCapture) {\n doReturnToCaller(recordFail ^ 1);\n } else if (recordFail) {\n this.mAppController.getCameraAppUI().showModeOptions();\n this.mHandler.sendEmptyMessageDelayed(6, SHUTTER_BUTTON_TIMEOUT);\n } else {\n showCaptureResult();\n }\n } else if (!(recordFail || this.mPaused)) {\n boolean z = ApiHelper.HAS_SURFACE_TEXTURE_RECORDING;\n }\n return recordFail;\n }", "@Override\r\n public void call() {\n System.out.println(\"开始视频通话\");\r\n }", "int insert(TVideo record);", "public void record(){\n\t}", "@Override\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tout.append(\" total time is taken to upload the video is\"+\",\"+String.valueOf(dif_upload)+\"ms\"+\",\"+Scenario);\n\t\t\t\t\t\t\t out.newLine();\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t try {\n\t\t\t\t\t\t\t\t\tout.flush();\n\t\t\t\t\t\t\t\t\t out.close();\n\t\t\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "public String getVideoDevice();", "public void takevideo() {\nSystem.out.println(\"take a video\");\r\n}", "void onCaptureEnd();", "@Override\n\tpublic void receiveFrameInfo(Camera camera, int avChannel, long bitRate,\n\t\t\tint frameRate, int onlineNm, int frameCount,\n\t\t\tint incompleteFrameCount) {\n\t\t\n\t}", "public void onSensorChanged(SensorEvent event) {\n synchronized (this) {\n\n //((TextView) findViewById(R.id.texto_prueba2)).setText(Boolean.toString(status));\n\n getInicio(event);\n\n if(status){\n\n if(!(limitarEje(event) && limitarTiempo(event.timestamp, m.getCurrentTime()))){\n ((TextView) findViewById(R.id.texto_prueba)).setText(\"Acelerómetro X, Y , Z: \" + event.values[0] +\" , \"+ event.values[1] +\" , \"+ event.values[2]);\n return;\n }\n\n action=m.isMovement(event.values[0], event.values[1], event.values[2], event.timestamp);\n if(action>=0){\n if(action==10){\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n startActivity(intent);\n status=false;\n }\n\n if(action==12){\n //context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);\n if(cam==null){\n cam = Camera.open();\n p = cam.getParameters();\n p.setFlashMode(android.hardware.Camera.Parameters.FLASH_MODE_TORCH);\n cam.setParameters(p);\n cam.startPreview();\n }\n else{\n p.setFlashMode(android.hardware.Camera.Parameters.FLASH_MODE_OFF);\n cam.setParameters(p);\n cam.release();\n cam = null;\n\n }\n }\n if(action==13){\n /* if(mPlayer==null){\n\n recorder.setAudioSource(MediaRecorder.AudioSource.MIC);\n recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);\n recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);\n recorder.setOutputFile(path);\n recorder.prepare();\n recorder.start();\n }\n else{\n recorder.stop();\n recorder.reset();\n recorder.release();\n\n recorder = null;\n }\n*/\n }\n }\n\n ((TextView) findViewById(R.id.texto_prueba2)).setText(Integer.toString(action));\n\n ((TextView) findViewById(R.id.texto_prueba1)).setText(Long.toString((event.timestamp-m.getCurrentTime())/500000000));\n }\n //((TextView) findViewById(R.id.texto_prueba)).setText(\"Acelerómetro X, Y , Z: \" + curX +\" , \"+ curY +\" , \"+ curZ);\n }\n }" ]
[ "0.7386263", "0.707025", "0.68315136", "0.6753297", "0.66465366", "0.63840115", "0.62664455", "0.6249779", "0.62470907", "0.62403053", "0.6217827", "0.61909145", "0.6172522", "0.60644495", "0.60067505", "0.60004926", "0.5998849", "0.59754825", "0.5938067", "0.5936633", "0.5911858", "0.59029454", "0.5893542", "0.58508325", "0.58438814", "0.58255947", "0.5808281", "0.5804488", "0.5803492", "0.58020896", "0.57940197", "0.5792506", "0.5786458", "0.57783395", "0.5777457", "0.57705694", "0.57705694", "0.57601887", "0.5739873", "0.57139695", "0.5692674", "0.56850994", "0.568373", "0.5679019", "0.5679019", "0.56689566", "0.5663284", "0.56282485", "0.5609924", "0.56066173", "0.5603645", "0.560051", "0.56002885", "0.55821246", "0.5578855", "0.5578221", "0.55664825", "0.5564383", "0.5561633", "0.5559641", "0.5559292", "0.55586714", "0.55533916", "0.55523044", "0.5550379", "0.5548159", "0.55419546", "0.5517369", "0.55173093", "0.55067766", "0.55064845", "0.5501481", "0.54991674", "0.54898715", "0.54790956", "0.54712385", "0.54654634", "0.54642135", "0.54484886", "0.54307735", "0.5427538", "0.5421806", "0.5416952", "0.54154646", "0.5413099", "0.54082507", "0.54053026", "0.5369367", "0.5365381", "0.5361846", "0.5357957", "0.5347451", "0.53377694", "0.53337526", "0.5315671", "0.531015", "0.53061825", "0.5299801", "0.5294817", "0.5280763" ]
0.7728257
0
Stream video data between two camClients and stores it simultaneously
private void liveStreaming() throws IOException, InterruptedException { CamStreaming camStreaming = new CamStreaming(); VideoDataStream vds = new VideoDataStream(true); byte[] frame; if (camStreaming.prepareStream(in)) { while (camStreaming.isTargetConnected()) { try { if (dis.available() > 0) { frame = vds.processFrame(dis); camStreaming.sendData(frame); } } catch (Exception ex) { ex.printStackTrace(); break; } sleep(20); } dos.writeInt(END_OF_STREAM_CODE); dos.flush(); // CamRegister.removeCamClient(camClient); RecordStorage recordStorage = new RecordStorage(); recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode()); vds.cleanBuffer(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void requestLiveStreaming() throws IOException {\n\n String targetCamCode = dis.readUTF();\n\n Cam targetCam = CamRegister.findRegisteredCam(targetCamCode);\n\n try {\n DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream());\n\n targetDos.writeInt(LIVE_STREAMING_COMMAND);\n targetDos.writeUTF(camClient.getCamCode());\n targetDos.flush();\n\n dos.writeInt(SUCCESS_CODE);\n dos.flush();\n\n } catch (Exception e) {\n e.printStackTrace();\n dos.writeInt(NOT_FOUND_CODE);\n dos.flush();\n }\n }", "private void recordCam() throws IOException, InterruptedException {\n\n VideoDataStream vds = new VideoDataStream(true);\n \n while (true) {\n try {\n if (dis.available() > 0) {\n vds.processFrame(dis);\n } else {\n //Writing bytes only to detect the socket closing\n dos.write(Byte.MIN_VALUE);\n }\n } catch (Exception ex) {\n CamRegister.removeCamClient(camClient);\n break;\n }\n sleep(20);\n }\n \n RecordStorage recordStorage = new RecordStorage();\n\n recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode());\n\n vds.cleanBuffer();\n }", "public void startStreaming() {\n// phoneCam.setViewportRenderingPolicy(OpenCvCamera.ViewportRenderingPolicy.OPTIMIZE_VIEW);\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.SIDEWAYS_RIGHT);\n }", "private void gotRemoteStream(MediaStream stream) {\n //we have remote video stream. add to the renderer.\n final VideoTrack videoTrack = stream.videoTracks.get(0);\n if (mEventUICallBack != null) {\n mEventUICallBack.showVideo(videoTrack);\n }\n// runOnUiThread(() -> {\n// try {\n// binding.remoteGlSurfaceView.setVisibility(View.VISIBLE);\n// videoTrack.addSink(binding.remoteGlSurfaceView);\n// } catch (Exception e) {\n// e.printStackTrace();\n// }\n// });\n }", "@Override public void run()\n {\n pauseStreaming();\n\n // Switch the current camera\n camera = newCamera;\n\n // Resume streaming on the new camera if there is one\n if (camera != null)\n {\n resumeStreaming();\n }\n }", "public void runMultiWebcam()\n\t{\n\t\tString pipeline=\"gst-launch-1.0 -v v4l2src device=\"+webcamSource+\" ! 'video/x-raw,width=640,height=480' ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! multiudpsink clients=\"+client.getInetAddress().getHostAddress()+\":\"+port1+\",\"+client.getInetAddress().getHostAddress()+\":\"+port2;\n\n\t\tString[] args1 = new String[] {\"/bin/bash\", \"-c\", pipeline+\">src/output.txt\"};\n\t\ttry {\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tProcess proc = new ProcessBuilder(args1).start();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\ttry {\n\t\t\tThread.sleep(2000);\n\t\t} catch (InterruptedException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "public CameraSet(Controls controls, String devpath1, String devpath2) {\n this.controls = controls;\n this.cam1 = CameraServer.getInstance().startAutomaticCapture(\"Back\", devpath2);\n this.cam2 = CameraServer.getInstance().startAutomaticCapture(\"Front\", devpath1);\n\n// cam1.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n// cam2.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n\n outputStream = CameraServer.getInstance().putVideo(\"camera_set\", (int) (multiplier * 160), (int) (multiplier * 120));\n source = new Mat();\n\n }", "public void run(){\n\t\tWebcam webcam = Webcam.getDefault();\n webcam.setViewSize(new Dimension(176,144));\n\t\t//webcam.setViewSize(WebcamResolution.VGA.getSize());\n webcam.open();\n isRunning=true;\n try\n {\n ss=new ServerSocket(1088);\n s=ss.accept();\n OutputStream os=s.getOutputStream();\n System.out.println(\"Client connected!\");\n while(isRunning)\n {\n BufferedImage image = webcam.getImage();\n //java.io.BufferedOutputStream bo=new BufferedOutputStream(s.getOutputStream());\n //ObjectOutputStream oo=new ObjectOutputStream(s.getOutputStream());\n //oo.writeObject(image);\n //oo.flush();\n //System.out.println(\"An image was sent!\");\n \n ImageIO.write(image, \"PNG\", os);\n os.flush();\n p.getGraphics().drawImage(image, 0, 0,null);\n Thread.sleep(100);\n }\n \n } catch (Exception ex){}\n\t}", "public Connection invoke(final PeerClient remoteClient) {\n final RemoteMedia remoteMedia = new RemoteMedia(context, enableH264, !enableAudioReceive, !enableVideoReceive, aecContext);\n final AudioStream audioStream = new AudioStream(enableAudioSend ? localMedia.getAudioTrack().getOutputs() : null, enableAudioReceive ? remoteMedia.getAudioTrack().getInputs() : null);\n final VideoStream videoStream = new VideoStream(enableVideoSend ? localMedia.getVideoTrack().getOutputs() : null, enableVideoReceive ? remoteMedia.getVideoTrack().getInputs() : null);\n\n final Connection connection;\n\n // Add the remote view to the layout.\n layoutManager.addRemoteView(remoteMedia.getId(), remoteMedia.getView());\n\n mediaTable.put(remoteMedia.getView(), remoteMedia);\n fragment.registerForContextMenu(remoteMedia.getView());\n remoteMedia.getView().setOnTouchListener(fragment);\n\n if (enableDataChannel) {\n DataChannel channel = new DataChannel(\"mydatachannel\") {{\n setOnReceive(new IAction1<DataChannelReceiveArgs>() {\n @Override\n public void invoke(DataChannelReceiveArgs dataChannelReceiveArgs) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 1 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n textListener.onReceivedText(ProviderName, dataChannelReceiveArgs.getDataString());\n }\n });\n\n addOnStateChange(new IAction1<DataChannel>() {\n @Override\n public void invoke(DataChannel dataChannel) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 2 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n if (dataChannel.getState() == DataChannelState.Connected) {\n synchronized (channelLock)\n {\n dataChannels.add(dataChannel);\n }\n textListener.onPeerJoined(ProviderName);\n } else if (dataChannel.getState() == DataChannelState.Closed || dataChannel.getState() == DataChannelState.Failed) {\n synchronized (channelLock)\n {\n dataChannels.remove(dataChannel);\n }\n\n textListener.onPeerLeft(ProviderName);\n }\n }\n });\n }};\n\n DataStream dataStream = new DataStream(channel);\n connection = new Connection(new Stream[]{audioStream, videoStream, dataStream});\n } else {\n connection = new Connection(new Stream[]{audioStream, videoStream});\n }\n\n connection.setIceServers(iceServers);\n\n connection.addOnStateChange(new fm.icelink.IAction1<Connection>() {\n public void invoke(Connection c) {\n // Remove the remote view from the layout.\n if (c.getState() == ConnectionState.Closing ||\n c.getState() == ConnectionState.Failing) {\n if (layoutManager.getRemoteView(remoteMedia.getId()) != null) {\n layoutManager.removeRemoteView(remoteMedia.getId());\n remoteMedia.destroy();\n }\n }\n }\n });\n\n return connection;\n }", "@Override\n public void run() {\n if (data.isStreaming()) {\n // if (frame < list.size()) {\n try {\n // BufferedImage image = list.get(frame);\n enc.encodeImage(videoImage);\n // frame++;\n } catch (Exception ex) {\n System.out.println(\"Error encoding frame: \" + ex.getMessage());;\n }\n }\n\n }", "@Override\n\tpublic void receiveFrameData(Camera camera, int avChannel, Bitmap bmp) {\n\t}", "public interface VideoConsumer {\n public void onVideoStart(int width, int height) throws IOException;\n\n public int onVideo(byte []data, int format);\n\n public void onVideoStop();\n}", "@Override\n public void onServerStart(String videoStreamUrl)\n {\n\n\n\n Log.d(\"Activity\",\"URL: \"+ videoStreamUrl);\n\n\n video = (VideoView)findViewById(R.id.video);\n\n Uri uri = Uri.parse(videoStreamUrl);\n video.setVideoURI(uri);\n video.start();\n\n\n\n }", "@Override\n public void run() {\n mLogView.logI(\"Remote video starting, uid: \" + (uid & 0xFFFFFFFFL));\n setupRemoteVideo(uid, uid == WINDOW_SHARE_UID ? mRemoteShareContainerSplit : mRemoteCameraContainer);\n }", "public ArrayList<VideoFile> playData(String topic, String title, String mode) {\n Extras.print(\"CONSUMER: Video request\");\n ArrayList<VideoFile> videos = null;\n try {\n //CONSUMER HASN'T ASK FOR A VIDEO YET\n //ASK YOUR MAIN BROKER FOR A VIDEO\n if (hashTagToBrokers == null || hashTagToBrokers.isEmpty()) {\n //OPEN CONNECTION\n Socket connection = new Socket(IP, PORT);\n\n //REQUEST VIDEO\n ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());\n out.writeObject(\"PULL\");\n out.flush();\n out.writeObject(title);\n out.flush();\n out.writeObject(topic);\n out.flush();\n\n //GET ANSWER FROM BROKER\n ObjectInputStream in = new ObjectInputStream(connection.getInputStream());\n String message = (String) in.readObject();\n switch (message) {\n //BROKER HAS THE VIDEO,SEND VIDEO\n case \"ACCEPT\":\n Extras.print(\"CONSUMER: Pull request accepted\");\n videos = receiveData(in, mode);\n if(mode.equals(\"save\")){\n VideoFileHandler.write(videos);\n }\n disconnect(connection);\n return videos;\n //PUBLISHER DOESN'T EXIST\n case \"FAILURE\":\n Extras.printError(\"Publisher doesn't exist.\");\n disconnect(connection);\n return null;\n //BROKER DOESN'T HAVE THE VIDEO, SEND OTHER BROKERS\n case \"DECLINE\":\n getBrokers(in);\n }\n disconnect(connection);\n }\n //CHECK THE HASHMAP TO CHOOSE THE RIGHT BROKER\n int brokerPort = hashTagToBrokers.get(topic);\n if (brokerPort == 0) {\n Extras.printError(\"Publisher dosen't exist.\");\n return null;\n }\n Socket connection = new Socket(IP, brokerPort);\n //REQUEST VIDEO\n ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());\n out.writeObject(\"PULL\");\n out.flush();\n out.writeObject(topic);\n out.flush();\n\n //GET ANSWER FROM BROKER\n ObjectInputStream in = new ObjectInputStream(connection.getInputStream());\n String message = (String) in.readObject();\n switch (message) {\n case \"ACCEPT\":\n Extras.print(\"CONSUMER: Pull request accepted\");\n videos = receiveData(in, mode);\n break;\n default:\n Extras.printError(\"CONSUMER: PLAY: ERROR: INCONSISTENCY IN BROKERS.\");\n }\n disconnect(connection);\n } catch (IOException e) {\n Extras.printError(\"CONSUMER: PLAY: ERROR: Could not get streams.\");\n } catch (ClassNotFoundException cnf){\n Extras.printError(\"CONSUMER: PLAY: ERROR: Could not cast Object to String\");\n }\n return videos;\n }", "private void initCaptureSetting(GLSurfaceView preview, FrameLayout window, GLSurfaceView remote) {\n RTCMediaStreamingManager.init(getApplicationContext());\n\n /**\n * Step 2: find & init views\n */\n\n /**\n * Step 3: config camera settings\n */\n CameraStreamingSetting.CAMERA_FACING_ID facingId = chooseCameraFacingId();\n if (mCameraStreamingSetting == null) {\n mCameraStreamingSetting = new CameraStreamingSetting();\n }\n mCameraStreamingSetting.setCameraFacingId(facingId)\n .setContinuousFocusModeEnabled(true)\n .setRecordingHint(false)\n .setResetTouchFocusDelayInMs(3000)\n .setFocusMode(CameraStreamingSetting.FOCUS_MODE_CONTINUOUS_PICTURE)\n .setCameraPrvSizeLevel(CameraStreamingSetting.PREVIEW_SIZE_LEVEL.MEDIUM)\n .setCameraPrvSizeRatio(CameraStreamingSetting.PREVIEW_SIZE_RATIO.RATIO_16_9)\n .setBuiltInFaceBeautyEnabled(true) // Using sdk built in face beauty algorithm\n .setFaceBeautySetting(new CameraStreamingSetting.FaceBeautySetting(0.8f, 0.8f, 0.6f)) // sdk built in face beauty settings\n .setVideoFilter(CameraStreamingSetting.VIDEO_FILTER_TYPE.VIDEO_FILTER_BEAUTY); // set the beauty on/off\n mCurrentCamFacingIndex = facingId.ordinal();\n\n /**\n * Step 4: create streaming manager and set listeners\n */\n if (mRTCStreamingManager == null) {\n mRTCStreamingManager = new RTCMediaStreamingManager(getApplicationContext(),\n preview, AVCodecType.SW_VIDEO_WITH_SW_AUDIO_CODEC);\n mRTCStreamingManager.prepare(mCameraStreamingSetting, null);\n }\n mRTCStreamingManager.setConferenceStateListener(mRTCStreamingStateChangedListener);\n mRTCStreamingManager.setRemoteWindowEventListener(mRTCRemoteWindowEventListener);\n mRTCStreamingManager.setUserEventListener(mRTCUserEventListener);\n mRTCStreamingManager.setDebugLoggingEnabled(false);\n mRTCStreamingManager.mute(true);\n\n /**\n * Step 5: set conference options\n */\n RTCConferenceOptions confOptions = new RTCConferenceOptions();\n // vice anchor can use a smaller size\n // RATIO_4_3 & VIDEO_ENCODING_SIZE_HEIGHT_240 means the output size is 320 x 240\n // 4:3 looks better in the mix frame\n confOptions.setVideoEncodingSizeRatio(RTCConferenceOptions.VIDEO_ENCODING_SIZE_RATIO.RATIO_4_3);\n confOptions.setVideoEncodingSizeLevel(RTCConferenceOptions.VIDEO_ENCODING_SIZE_HEIGHT_240);\n // vice anchor can use a higher conference bitrate for better image quality\n confOptions.setVideoBitrateRange(300 * 1000, 800 * 1000);\n // 20 fps is enough\n confOptions.setVideoEncodingFps(20);\n confOptions.setHWCodecEnabled(false);\n mRTCStreamingManager.setConferenceOptions(confOptions);\n\n /**\n * Step 6: create the remote windows\n */\n if (mRTCVideoWindow == null) {\n mRTCVideoWindow = new RTCVideoWindow(window, remote);\n\n /**\n * Step 8: add the remote windows\n */\n mRTCStreamingManager.addRemoteWindow(mRTCVideoWindow);\n }\n\n /**\n * Step 9: do prepare, anchor should config streaming profile first\n */\n StreamingProfile mStreamingProfile = new StreamingProfile();\n mStreamingProfile.setEncodingOrientation(\n isLandscape() ? StreamingProfile.ENCODING_ORIENTATION.LAND : StreamingProfile.ENCODING_ORIENTATION.PORT);\n mRTCStreamingManager.setStreamingProfile(mStreamingProfile);\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n Toast.makeText(VideoDetailsActivity.this,\"Reciever fot the result. Do some processing bro\",Toast.LENGTH_LONG).show();\n mVideoView.setVideoURI();\n }", "public void addCameraServer(String name, int framerate) {\n this.maxcount = (framerate < 50) ? 50 / framerate : 1;\n server = CameraServer.getInstance().putVideo(name, 315, 207);\n serverStarted = true;\n }", "public void run() {\n\t\ttry {\n if (prot == TransmissionProtocol.UDP) {\n \tgrabber.setOption(\"rtsp_transport\", \"udp\");\n } else if (prot == TransmissionProtocol.TCP) {\n \tgrabber.setOption(\"rtsp_transport\", \"tcp\");\n }\n if (codec == VideoCodec.H264) {\n \tgrabber.setVideoCodec(avcodec.AV_CODEC_ID_H264);\n } else if (codec == VideoCodec.MPEG4) {\n \tgrabber.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4);\n }\n grabber.start();\n AudioFormat audioFormat = new AudioFormat(grabber.getSampleRate(), 16, grabber.getAudioChannels(), true, true);\n\n DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);\n SourceDataLine soundLine = (SourceDataLine) AudioSystem.getLine(info);\n soundLine.open(audioFormat);\n volume = (FloatControl) soundLine.getControl(FloatControl.Type.MASTER_GAIN);\n soundLine.start();\n\n Java2DFrameConverter converter = new Java2DFrameConverter();\n \n ExecutorService executor = Executors.newSingleThreadExecutor(InterfaceController.ntfInstance);\n view.setImage(null);\n view.setScaleX(1);\n view.setScaleY(1);\n Thread.currentThread().setName(\"FSCV-VPT\");\n isProcessing = true;\n while (!Thread.interrupted()) {\n frame = grabber.grab();\n if (frame == null) {\n break;\n }\n if (frame.image != null) {\n currentFrame = SwingFXUtils.toFXImage(converter.convert(frame), null);\n Platform.runLater(() -> {\n view.setImage(currentFrame);\n });\n } else if (frame.samples != null) {\n channelSamplesShortBuffer = (ShortBuffer) frame.samples[0];\n channelSamplesShortBuffer.rewind();\n\n outBuffer = ByteBuffer.allocate(channelSamplesShortBuffer.capacity() * 2);\n \n for (int i = 0; i < channelSamplesShortBuffer.capacity(); i++) {\n short val = channelSamplesShortBuffer.get(i);\n outBuffer.putShort(val);\n }\n\n /**\n * We need this because soundLine.write ignores\n * interruptions during writing.\n */\n try {\n executor.submit(() -> {\n soundLine.write(outBuffer.array(), 0, outBuffer.capacity());\n outBuffer.clear();\n }).get();\n } catch (InterruptedException interruptedException) {\n Thread.currentThread().interrupt();\n }\n }\n }\n isProcessing = false;\n executor.shutdownNow();\n executor.awaitTermination(10, TimeUnit.SECONDS);\n soundLine.stop();\n grabber.stop();\n grabber.release();\n grabber.close();\n } catch (Exception e) {\n \te.printStackTrace();\n }\n\t}", "@Override\n public void receiveFrameDataForMediaCodec(Camera camera, int avChannel, byte[] buf, int length, int pFrmNo, byte[] pFrmInfoBuf, boolean\n isIframe, int codecId) {\n\n }", "public void run() {\n\n\n if (videoFile != null) {\n //\n // Add Image to Photos Gallery\n //\n //final Uri uri = addMediaToGallery(mInscribedVideoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //final Uri uri = addMediaToGallery(videoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //Log.e(TAG, \"uri--->\" + uri.getPath());\n\n //\n // Create a media bean and set the copyright for server flags\n //\n String media_id = \"\";\n try {\n media_id = copyrightJsonObject.getString(\"media_id\");\n copyrightJsonObject.put(\"applyCopyrightOnServer\", 1);\n copyrightJsonObject.put(\"device_id\", SessionManager.getInstance().getDevice_id());\n copyrightJsonObject.put(\"device_type\", Common.DEVICE_TYPE);\n } catch (JSONException e) {\n // this shouldn't occur\n Log.e(TAG, \"JSONException trying to get media_id from copyright!\");\n }\n String mediaName = ImageUtils.getInstance()\n .getImageNameFromPath(videoFile.getAbsolutePath());\n GalleryBean media = new GalleryBean(videoFile.getAbsolutePath(),\n mediaName,\n \"video\",\n media_id,\n false,\n thumbnail,\n GalleryBean.GalleryType.NOT_SYNC);\n media.setDeviceId(SessionManager.getInstance().getDevice_id());\n media.setDeviceType(Common.DEVICE_TYPE);\n String mediaNamePrefix = mediaName.substring(0,\n mediaName.lastIndexOf('.'));\n media.setMediaNamePrefix(mediaNamePrefix);\n media.setMediaThumbBitmap(thumbnail);\n media.setLocalMediaPath(videoFile.getAbsolutePath());\n Date date = new Date();\n media.setMediaDate(date.getTime());\n //String mimeType = getContentResolver().getType(uri);\n media.setMimeType(\"video/mp4\"); // must be set for Amazon.\n media.setCopyright(copyrightJsonObject.toString());\n\n MemreasTransferModel transferModel = new MemreasTransferModel(\n media);\n transferModel.setType(MemreasTransferModel.Type.UPLOAD);\n QueueAdapter.getInstance().getSelectedTransferModelQueue()\n .add(transferModel);\n\n // Start the service if it's not running...\n startQueueService();\n } else {\n //\n // Show Toast error occurred here...\n //\n videoFile.delete();\n }\n\n }", "public VideoStream(int camera) {\n\t\tsuper();\n\t\tsetCamera(camera);\n\t}", "public void startService() {\n\t\tListenThread listenThread = new ListenThread();\r\n\t\tlistenThread.start();\r\n\t\tSelfVideoThread selfVideoThread = new SelfVideoThread();\r\n\t\tselfVideoThread.start();\r\n\t\tif(remote!=\"\"){\r\n\t\t\tString[] remotes = remote.split(\",\");\r\n\t\t\tString[] remotePorts = remotePort.split(\",\");\r\n\t\t\tfor(int i = 0; i < remotes.length; i++){\r\n\t\t\t\tString currentRemote = remotes[i];\r\n\t\t\t\tint currentRemotePort = 6262;\r\n\t\t\t\tif(i<remotePorts.length){\r\n\t\t\t\t\tcurrentRemotePort = Integer.valueOf(remotePorts[i]);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n//\t\t\t\tcreatTCPLink(currentRemote, currentRemotePort);\r\n\t\t\t\t\r\n\t\t\t\tSocket socket = null;\r\n\t\t\t\tJSONObject process = new JSONObject();\r\n\t\t\t\ttry {\r\n\t\t\t\t\tsocket = new Socket(currentRemote, currentRemotePort);\r\n\t\t\t\t\tThread sendVedio = new SendVideo(socket, width, height, rate);\r\n\t\t\t\t\tsendVedio.start();\r\n\t\t\t\t\tThread receiveVedio = new ReceiveVideo(socket);\r\n\t\t\t\t\treceiveVedio.start();\r\n\t\t\t\t\tsockets.add(socket);\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t} finally {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void handleIncomingVideo(BufferedImage buff){\n if(buff != null && systemOn){\n Graphics g=this.cameraPanel.getGraphics();\n g.drawImage(buff, 0, 0, this.cameraPanel.getWidth(), this.cameraPanel.getHeight() -150 , 0, 0, buff.getWidth(), buff.getHeight(), null);\n }\n else if (this.systemOn == false){\n this.cameraPanel.repaint();\n }\n }", "@Override\n\t\t\tpublic void onPreviewFrame(byte[] data, Camera camera) {\n\n\t\t\t\tCamera.Parameters params = mCamera.getParameters();\n\n\t\t\t\tint w = params.getPreviewSize().width;\n\t\t\t\tint h = params.getPreviewSize().height;\n\t\t\t\tint format = params.getPreviewFormat ();\n\n\t\t\t\t//\tBitmap imageBitap = new Bitmap();\n\n\n\t\t\t\tYuvImage image = new YuvImage(data, format, w, h, null);\n\n\t\t\t\tByteArrayOutputStream out = new ByteArrayOutputStream();\n\t\t\t\tRect area = new Rect(0, 0, w, h);\n\t\t\t\timage.compressToJpeg(area, 50, out);\n\t\t\t\tstreamingImage = BitmapFactory.decodeByteArray(out.toByteArray(), 0, out.size());\n\n\n\n\t\t\t\tByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\t\t\t\tstreamingImage = Bitmap.createScaledBitmap(streamingImage, 160, streamingImage.getHeight()/(streamingImage.getWidth()/160), true);\n\t\t\t\tstreamingImage.compress( CompressFormat.JPEG, 30, outputStream) ; \n\t\t\t\tbyte[] imageByte = outputStream.toByteArray() ; \n\n\t\t\t\tint len;\n\n\t\t\t\tbyte[] byteLen = new byte[4];\n\t\t\t\tbyte[] sendByte = new byte[DataConstants.sendingSize];\n\n\t\t\t\tByteArrayInputStream inputStream = new ByteArrayInputStream(imageByte);\n\n\t\t\t\tbyteLen = DataConstants.intToByteArray(imageByte.length);\n\n\t\t\t\tflag_isSendOK = false;\n\n\t\t\t\tif(flag_isChangeOK == true){\n\t\t\t\t\ttry {\n\t\t\t\t\t\twhile((len=inputStream.read(sendByte))!=-1){\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[0] = 8;\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[1] = 28;\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[2] = 16; \n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[3] = (byte) sendingImageIndex;\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[4] = byteLen[0];\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[5] = byteLen[1];\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[6] = byteLen[2];\n\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[7] = byteLen[3];\n\n\t\t\t\t\t\t\tfor(int eof=8; eof<len+8; eof++){\n\t\t\t\t\t\t\t\tsendingArr[sendingImageIndex].arr[eof] = sendByte[eof-8];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (IOException e) { \n\t\t\t\t\t\t//TODO: rano said good jam! \n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t} \n\n\t\t\t\t\t// TODO: �ڵ鷯 �θ���\n\t\t\t\t\tsendingImageIndexMax = sendingImageIndex;\n\t\t\t\t\tsendingImageIndex = 1;\n\t\t\t\t\tflag_isSendOK = true;\n\t\t\t\t\t//\t\t\t\tsendHandler.sendEmptyMessage(0);\n\n\t\t\t\t}\n\t\t\t}", "private void addStreamToLocalPeer() {\n //creating local mediastream\n MediaStream stream = peerConnectionFactory.createLocalMediaStream(\"102\");\n stream.addTrack(localAudioTrack);\n stream.addTrack(localVideoTrack);\n localPeer.addStream(stream);\n }", "public interface CameraVideoListener {\n void onVideoRecordStarted(Size videoSize);\n\n void onVideoRecordStopped(File videoFile, CameraFragmentResultListener callback);\n\n void onVideoRecordError();\n}", "public VideoStream() {\n\t\tthis(CameraInfo.CAMERA_FACING_BACK);\n\t}", "public void stopStreaming() {\n phoneCam.stopStreaming();\n }", "public void syncStream() {\n JCudaDriver.cuStreamSynchronize(stream);}", "public int shareLocalVideo() {\n videoEnabled = !videoEnabled;\n return mRtcEngine.enableLocalVideo(videoEnabled);\n }", "protected void encodeWithMediaRecorder() throws IOException {\n\t\t// Opens the camera if needed\n\t\tcreateCamera();\n\n\t\t// Stops the preview if needed\n\t\tif (mPreviewStarted) {\n\t\t\tlockCamera();\n\t\t\ttry {\n\t\t\t\tmCamera.stopPreview();\n\t\t\t} catch (Exception e) {}\n\t\t\tmPreviewStarted = false;\n\t\t}\n\n\t\t// Unlock the camera if needed\n\t\tunlockCamera();\n\n\t\tmMediaRecorder = new MediaRecorder();\n\t\tinitRecorderParameters();\n\n\t\t// We write the ouput of the camera in a local socket instead of a file !\t\t\t\n\t\t// This one little trick makes streaming feasible quiet simply: data from the camera\n\t\t// can then be manipulated at the other end of the socket\n\t\tmMediaRecorder.setOutputFile(mPacketizer.getWriteFileDescriptor());\n\n\t\t// Set event listener\n\t\tmMediaRecorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {\n\t\t\t@Override\n\t\t\tpublic void onInfo(MediaRecorder mr, int what, int extra) {\n\t\t\t\tswitch (what) {\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_UNKNOWN, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_MAX_DURATION_REACHED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tmMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {\n\t\t\t@Override\n\t\t\tpublic void onError(MediaRecorder mr, int what, int extra) {\n\t\t\t\tswitch (what) {\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN:\n\t\t\t\t\t\tLog.e(TAG, \"MEDIA_RECORDER_ERROR_UNKNOWN, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_ERROR_SERVER_DIED:\n\t\t\t\t\t\tLog.e(TAG, \"MEDIA_ERROR_SERVER_DIED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttry {\n\t\t\tmMediaRecorder.prepare();\n\t\t\tmMediaRecorder.start();\n\n\t\t\t// mReceiver.getInputStream contains the data from the camera\n\t\t\t// the mPacketizer encapsulates this stream in an RTP stream and send it over the network\n\t\t\tmPacketizer.start();\n\t\t\tmStreaming = true;\n\t\t} catch (IOException e) {\n\t\t\tLog.e(TAG, \"encodeWithMediaRecorder exception\", e);\n\t\t\tstop();\n\t\t\tthrow new IOException(\"Something happened with the local sockets :/ Start failed !\");\n\t\t} catch (IllegalStateException e) {\n\t\t\tLog.e(TAG, \"encodeWithMediaRecorder exception\", e);\n\t\t\tthrow e;\n\t\t}\n\n\t}", "public void prepareVisionProcessing(){\n usbCamera = CameraServer.getInstance().startAutomaticCapture();\n /*\n MjpegServer mjpegServer1 = new MjpegServer(\"serve_USB Camera 0\", 1181);\n mjpegServer1.setSource(usbCamera);\n\n // Creates the CvSink and connects it to the UsbCamera\n CvSink cvSink = new CvSink(\"opencv_USB Camera 0\");\n cvSink.setSource(usbCamera);\n\n // Creates the CvSource and MjpegServer [2] and connects them\n CvSource outputStream = new CvSource(\"Blur\", PixelFormat.kMJPEG, 640, 480, 30);\n MjpegServer mjpegServer2 = new MjpegServer(\"serve_Blur\", 1182);\n mjpegServer2.setSource(outputStream);\n */\n }", "public void startVideoRecording() {\n this.mActivity.getCameraAppUI().switchShutterSlidingAbility(false);\n if (this.mCameraState == 1) {\n setCameraState(2);\n Tag tag = TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"startVideoRecording: \");\n stringBuilder.append(Thread.currentThread());\n Log.i(tag, stringBuilder.toString());\n ToastUtil.showToast(this.mActivity, this.mActivity.getString(R.string.video_recording_start_toast), 0);\n this.mAppController.onVideoRecordingStarted();\n if (this.mModeSelectionLockToken == null) {\n this.mModeSelectionLockToken = this.mAppController.lockModuleSelection();\n }\n this.mUI.showVideoRecordingHints(false);\n this.mUI.cancelAnimations();\n this.mUI.setSwipingEnabled(false);\n this.mUI.showFocusUI(false);\n this.mAppController.getCameraAppUI().hideRotateButton();\n this.mAppController.getButtonManager().hideEffectsContainerWrapper();\n final long updateStorageSpaceTime = System.currentTimeMillis();\n this.mActivity.updateStorageSpaceAndHint(new OnStorageUpdateDoneListener() {\n public void onStorageUpdateDone(long bytes) {\n Tag access$100 = VideoModule.TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"updateStorageSpaceAndHint cost time :\");\n stringBuilder.append(System.currentTimeMillis() - updateStorageSpaceTime);\n stringBuilder.append(\"ms.\");\n Log.d(access$100, stringBuilder.toString());\n if (VideoModule.this.mCameraState != 2) {\n VideoModule.this.pendingRecordFailed();\n return;\n }\n if (bytes <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {\n Log.w(VideoModule.TAG, \"Storage issue, ignore the start request\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mCameraDevice == null) {\n Log.v(VideoModule.TAG, \"in storage callback after camera closed\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mPaused) {\n Log.v(VideoModule.TAG, \"in storage callback after module paused\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mMediaRecorderRecording) {\n Log.v(VideoModule.TAG, \"in storage callback after recording started\");\n } else if (VideoModule.this.isSupported(VideoModule.this.mProfile.videoFrameWidth, VideoModule.this.mProfile.videoFrameHeight)) {\n VideoModule.this.mCurrentVideoUri = null;\n VideoModule.this.mCameraDevice.enableShutterSound(false);\n if (VideoModule.this.mNeedGLRender && VideoModule.this.isSupportEffects()) {\n VideoModule.this.playVideoSound();\n VideoModule.this.initGlRecorder();\n VideoModule.this.pauseAudioPlayback();\n VideoModule.this.mActivity.getCameraAppUI().startVideoRecorder();\n } else {\n VideoModule.this.initializeRecorder();\n if (VideoModule.this.mMediaRecorder == null) {\n Log.e(VideoModule.TAG, \"Fail to initialize media recorder\");\n VideoModule.this.pendingRecordFailed();\n return;\n }\n VideoModule.this.pauseAudioPlayback();\n try {\n long mediarecorderStart = System.currentTimeMillis();\n VideoModule.this.mMediaRecorder.start();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder2 = new StringBuilder();\n stringBuilder2.append(\"mMediaRecorder.start() cost time : \");\n stringBuilder2.append(System.currentTimeMillis() - mediarecorderStart);\n Log.d(access$100, stringBuilder2.toString());\n VideoModule.this.playVideoSound();\n VideoModule.this.mCameraDevice.refreshSettings();\n VideoModule.this.mCameraSettings = VideoModule.this.mCameraDevice.getSettings();\n VideoModule.this.setFocusParameters();\n } catch (RuntimeException e) {\n Log.e(VideoModule.TAG, \"Could not start media recorder. \", e);\n VideoModule.this.releaseMediaRecorder();\n VideoModule.this.mCameraDevice.lock();\n VideoModule.this.releaseAudioFocus();\n if (VideoModule.this.mModeSelectionLockToken != null) {\n VideoModule.this.mAppController.unlockModuleSelection(VideoModule.this.mModeSelectionLockToken);\n }\n VideoModule.this.setCameraState(1);\n if (VideoModule.this.shouldHoldRecorderForSecond()) {\n VideoModule.this.mAppController.setShutterEnabled(true);\n }\n VideoModule.this.mAppController.getCameraAppUI().showModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(true);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.onVideoRecordingStop();\n }\n ToastUtil.showToast(VideoModule.this.mActivity.getApplicationContext(), (int) R.string.video_record_start_failed, 0);\n return;\n }\n }\n VideoModule.this.mAppController.getCameraAppUI().setSwipeEnabled(false);\n VideoModule.this.setCameraState(3);\n VideoModule.this.tryLockFocus();\n VideoModule.this.mMediaRecorderRecording = true;\n VideoModule.this.mActivity.lockOrientation();\n VideoModule.this.mRecordingStartTime = SystemClock.uptimeMillis() + 600;\n VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().setAngle(VideoModule.this.mOrientation);\n VideoModule.this.mAppController.getCameraAppUI().hideModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(false);\n }\n if (VideoModule.this.isVideoShutterAnimationEnssential()) {\n VideoModule.this.mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoCaptureButton(true);\n }\n if (VideoModule.this.mAppController.getCameraAppUI().getCurrentModeIndex() == VideoModule.this.mActivity.getResources().getInteger(R.integer.camera_mode_video)) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoPauseButton(false);\n }\n VideoModule.this.mUI.showRecordingUI(true);\n if (VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().getVisibility() == 0) {\n VideoModule.this.mUI.hideCapButton();\n }\n VideoModule.this.showBoomKeyTip();\n VideoModule.this.updateRecordingTime();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder3 = new StringBuilder();\n stringBuilder3.append(\"startVideoRecording cost time 1 : \");\n stringBuilder3.append(System.currentTimeMillis() - VideoModule.this.mShutterButtonClickTime);\n Log.d(access$100, stringBuilder3.toString());\n if (VideoModule.this.isSendMsgEnableShutterButton()) {\n VideoModule.this.mHandler.sendEmptyMessageDelayed(6, VideoModule.MIN_VIDEO_RECODER_DURATION);\n }\n VideoModule.this.mActivity.enableKeepScreenOn(true);\n VideoModule.this.mActivity.startInnerStorageChecking(new OnInnerStorageLowListener() {\n public void onInnerStorageLow(long bytes) {\n VideoModule.this.mActivity.stopInnerStorageChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_storage_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n VideoModule.this.mActivity.startBatteryInfoChecking(new OnBatteryLowListener() {\n public void onBatteryLow(int level) {\n VideoModule.this.mActivity.stopBatteryInfoChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_battery_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n } else {\n Log.e(VideoModule.TAG, \"Unsupported parameters\");\n VideoModule.this.pendingRecordFailed();\n }\n }\n });\n }\n }", "public void setVideoPort(int port);", "public void saveAndTransferVideoComplexObs(){\n\n try{\n List<Encounter> encounters = Context.getEncounterService().getEncounters(null, null, null, null, null, null, true);\n Encounter lastEncounter = encounters.get(encounters.size()-1);\n\n Person patient = lastEncounter.getPatient();\n ConceptComplex conceptComplex = Context.getConceptService().getConceptComplex(14);\n Location location = Context.getLocationService().getDefaultLocation();\n Obs obs = new Obs(patient, conceptComplex, new Date(), location) ;\n\n String mergedUrl = tempMergedVideoFile.getCanonicalPath();\n InputStream out1 = new FileInputStream(new File(mergedUrl));\n\n ComplexData complexData = new ComplexData(\"mergedFile1.flv\", out1);\n obs.setComplexData(complexData);\n obs.setEncounter(lastEncounter);\n\n Context.getObsService().saveObs(obs, null);\n tempMergedVideoFile.delete();\n\n }catch (Exception e){\n log.error(e);\n }\n }", "public void recordVideo() {\n\n }", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}", "private void setVideo(){\n /* if(detailsBean==null){\n showToast(\"没有获取到信息\");\n return;\n }\n UserManager.getInstance().setDetailsBean(detailsBean);\n upCallShowSetVideoData = new UpCallShowSetVideoData();\n upCallShowSetVideoData.smobile = Preferences.getString(Preferences.UserMobile,null);\n upCallShowSetVideoData.iringid = detailsBean.iringid;\n if (callShowSetVideoProtocol == null) {\n callShowSetVideoProtocol = new CallShowSetVideoProtocol(null, upCallShowSetVideoData, handler);\n callShowSetVideoProtocol.showWaitDialog();\n }\n callShowSetVideoProtocol.stratDownloadThread(null, ServiceUri.Spcl, upCallShowSetVideoData, handler,true);*/\n }", "public void AddCameraServer(int framerate) {\n addCameraServer(\"Pixy Output\", framerate);\n }", "public void syncOldStream() {\n ContextHolder.getInstance().setContext();\n JCuda.cudaStreamSynchronize(oldStream);\n/*\n if(!oldEventDestroyed) {\n JCuda.cudaStreamSynchronize(oldStream);\n JCuda.cudaStreamWaitEvent(oldStream,oldEvent,0);\n JCuda.cudaEventDestroy(oldEvent);\n oldEventDestroyed = true;\n\n }*/\n }", "public static VideoSource startCamera(CameraConfig config) {\n System.out.println(\"Starting camera '\" + config.name + \"' on \" + config.path);\n CameraServer inst = CameraServer.getInstance();\n UsbCamera camera = new UsbCamera(config.name, config.path);\n MjpegServer server = inst.startAutomaticCapture(camera);\n\n Gson gson = new GsonBuilder().create();\n\n camera.setConfigJson(gson.toJson(config.config));\n camera.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n\n if (config.streamConfig != null) {\n server.setConfigJson(gson.toJson(config.streamConfig));\n }\n\n return camera;\n }", "@Override\n public void run() {\n setupRemoteVideo(uid);\n }", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "@Override\n\tpublic void receiveFrameDataForMediaCodec(Camera camera, int i,\n\t\t\tbyte[] abyte0, int j, int k, byte[] abyte1, boolean flag, int l) {\n\t\t\n\t}", "void onPreviewFrame(byte[] data, Camera camera);", "@Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n for(int i=0; i<camera_ids.length; i++) {\n if(cameras[i]!=null && cameras[i]==camera && rawImageListeners[i]!=null) {\n rawImageListeners[i].onNewRawImage(data, previewSizes[i]);\n camera.addCallbackBuffer(previewBuffers[i]);\n }\n }\n }", "private void runMainLoop() {\n\n ImageProcessor imageViewer = new ImageProcessor();\n Mat webcamMatImage = new Mat();\n Image tempImage;\n\n //VideoCapture capture = new VideoCapture(0); // Capture from web cam\n VideoCapture capture = new VideoCapture(\"rtsp://192.168.2.64/Streaming/Channels/101\"); // Capture from IP Camera\n //VideoCapture capture = new VideoCapture(\"src/main/resources/videos/192.168.2.64_20160804140448.avi\"); // Capture avi file\n\n // Setting camera resolution\n capture.set(Videoio.CAP_PROP_FRAME_WIDTH, 800);\n capture.set(Videoio.CAP_PROP_FRAME_HEIGHT, 600);\n\n if (capture.isOpened()) { // Check whether the camera is instantiated\n while (true) { // Retrieve each captured frame in a loop\n capture.read(webcamMatImage);\n if (!webcamMatImage.empty()) {\n tempImage = imageViewer.toBufferedImage(webcamMatImage);\n ImageIcon imageIcon = new ImageIcon(tempImage, \"Captured Video\");\n imageLabel.setIcon(imageIcon);\n frame.pack(); // This will resize the window to fit the image\n } else {\n System.out.println(\" -- Frame not captured or the video has finished! -- Break!\");\n break;\n }\n }\n } else {\n System.out.println(\"Couldn't open capture.\");\n }\n }", "public void init(HardwareMap hwMap){\n int cameraMonitorViewID = hwMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hwMap.appContext.getPackageName());\n phoneCam = OpenCvCameraFactory.getInstance().createInternalCamera(OpenCvInternalCamera.CameraDirection.BACK,cameraMonitorViewID);\n phoneCam.openCameraDevice();\n phoneCam.setPipeline(counter);\n phoneCam.openCameraDeviceAsync(new OpenCvCamera.AsyncCameraOpenListener()\n {\n @Override\n public void onOpened()\n {\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT);\n }\n });\n }", "public void go(StreamModule m1, StreamModule m2) throws Exception {\n \t\tStreamHeader header = in.getHeader();\n \t\theader = m1.init(header);\n \t\theader = m2.init(header);\n \t\tout.setHeader(header);\n \n \t\tStreamFrame frame;\n \t\twhile ((frame = in.recvFrame()) != null) {\n \t\t\tframe = m1.process(frame);\n \t\t\tframe = m2.process(frame);\n \t\t\tout.sendFrame(frame);\n \t\t}\n \n \t\tm1.close();\n \t\tm2.close();\n \t}", "public void updateCam()\r\n {\n \ttry{\r\n \tSystem.out.println();\r\n \tNIVision.IMAQdxGrab(curCam, frame, 1);\r\n \tif(curCam == camCenter){\r\n \t\tNIVision.imaqDrawLineOnImage(frame, frame, NIVision.DrawMode.DRAW_VALUE, new Point(320, 0), new Point(320, 480), 120);\r\n \t}\r\n server.setImage(frame);}\n \tcatch(Exception e){}\r\n }", "public void handleRecButtonOnPressed() {\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM, true);\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC, true);\n ((AudioManager) AppDelegate.getAppContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING, true);\n AudioManager audioMgr = ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE));\n\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n //updateMessage();\n if (timerCounter != null) {\n timerCounter.cancel();\n timerCounter = null;\n }\n\n if (isCameraRecording) {\n\n isCameraRecording = false;\n mStartRecordingButton.setChecked(false);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.GONE);\n disableAuthorityAlertedText();\n\n cameraView.stopRecording();\n\n // Control view group\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n\n toolBarTitle.setText(dateFormat.format(new Date(userPreferences.recordTime() * 1000)));\n handler.removeCallbacksAndMessages(null);\n handler.removeCallbacks(counterMessage);\n counterMessage = null;\n\n //VIDEO FINISHING ALERT\n CommonAlertDialog dialog = new CommonAlertDialog(getActivity(), mAlertDialogButtonClickListerer); // Setting dialogview\n dialog.show();\n\n } else {\n\n userPreferences.setEventId(UUID.randomUUID().toString());\n isCameraRecording = true;\n\n mStartRecordingButton.setChecked(true);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.VISIBLE);\n cameraView.setVisibility(View.VISIBLE);\n\n if (cacheFolder == null) {\n cacheFolder = new FwiCacheFolder(AppDelegate.getAppContext(), String.format(\"%s/%s\", userPreferences.currentProfileId(), userPreferences.eventId()));\n cameraView.setDelegate(this);\n cameraView.setCacheFolder(cacheFolder);\n }\n\n this.startRecording();\n\n }\n if (userPreferences.enableTorch()) {\n isenableTourch = true;\n cameraView.torchOn();\n }\n\n }", "public void onVideoStarted () {}", "@Override\n public void onVideoStarted() {\n }", "public void reloadVideoDevices();", "@Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n\n Camera.Parameters parameters = camera.getParameters();\n int width = parameters.getPreviewSize().width;\n int height = parameters.getPreviewSize().height;\n\n mCamera.addCallbackBuffer(data);\n\n if (yuvType == null) {\n yuvType = new Type.Builder(rs, Element.U8(rs)).setX(data.length);\n in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);\n\n rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs)).setX(width).setY(height);\n out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);\n }\n\n in.copyFrom(data);\n\n yuvToRgbIntrinsic.setInput(in);\n yuvToRgbIntrinsic.forEach(out);\n\n Bitmap mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n out.copyTo(mBitmap);\n\n mBitmap = GlobalUtils.rotateBitmapOnOrientation(mBitmap,ctx);\n\n liveCamera.setVisibility(VISIBLE);\n\n if(PROCESS_IMAGE) {\n\n if(PROCESSING_TYPE == 1) {\n Rect2d rect2d = new Rect2d(100, 100, 100, 100);\n imageProcessing.RunDetection(mBitmap);\n liveCamera.setImageBitmap(mBitmap);\n }else{\n //Rect2d rect2d = new Rect2d(100, 100, 100, 100);\n liveCamera.setImageBitmap(mBitmap);\n\n }\n\n } else{\n liveCamera.setImageBitmap(mBitmap);\n }\n\n }", "private void getRTPStream(String session, String source, int portl, int portr, int payloadFormat ){\n \t InetAddress addr;\r\n \t\ttry {\r\n \t\t\taddr = InetAddress.getLocalHost();\r\n \t\t // Get IP Address\r\n // \t\t\tLAN_IP_ADDR = addr.getHostAddress();\r\n \t\t\tLAN_IP_ADDR = \"192.168.1.125\";\r\n \t\t\tLog.d(TAG, \"using client IP addr \" +LAN_IP_ADDR);\r\n \t\t \r\n \t\t} catch (UnknownHostException e1) {\r\n \t\t\t// TODO Auto-generated catch block\r\n \t\t\te1.printStackTrace();\r\n \t\t}\r\n\r\n \t\t\r\n final CountDownLatch latch = new CountDownLatch(2);\r\n\r\n RtpParticipant local1 = RtpParticipant.createReceiver(new RtpParticipantInfo(1), LAN_IP_ADDR, portl, portl+=1);\r\n // RtpParticipant local1 = RtpParticipant.createReceiver(new RtpParticipantInfo(1), \"127.0.0.1\", portl, portl+=1);\r\n RtpParticipant remote1 = RtpParticipant.createReceiver(new RtpParticipantInfo(2), source, portr, portr+=1);\r\n \r\n \r\n remote1.getInfo().setSsrc( Long.parseLong(ssrc, 16));\r\n session1 = new SingleParticipantSession(session, payloadFormat, local1, remote1);\r\n \r\n Log.d(TAG, \"remote ssrc \" +session1.getRemoteParticipant().getInfo().getSsrc());\r\n \r\n session1.init();\r\n \r\n session1.addDataListener(new RtpSessionDataListener() {\r\n @Override\r\n public void dataPacketReceived(RtpSession session, RtpParticipantInfo participant, DataPacket packet) {\r\n // System.err.println(\"Session 1 received packet: \" + packet + \"(session: \" + session.getId() + \")\");\r\n \t//TODO close the file, flush the buffer\r\n// \tif (_sink != null) _sink.getPackByte(packet);\r\n \tgetPackByte(packet);\r\n \t\r\n // \tSystem.err.println(\"Ssn 1 packet seqn: typ: datasz \" +packet.getSequenceNumber() + \" \" +packet.getPayloadType() +\" \" +packet.getDataSize());\r\n // \tSystem.err.println(\"Ssn 1 packet sessn: typ: datasz \" + session.getId() + \" \" +packet.getPayloadType() +\" \" +packet.getDataSize());\r\n // latch.countDown();\r\n }\r\n\r\n });\r\n // DataPacket packet = new DataPacket();\r\n // packet.setData(new byte[]{0x45, 0x45, 0x45, 0x45});\r\n // packet.setSequenceNumber(1);\r\n // session1.sendDataPacket(packet);\r\n\r\n\r\n// try {\r\n // latch.await(2000, TimeUnit.MILLISECONDS);\r\n // } catch (Exception e) {\r\n // fail(\"Exception caught: \" + e.getClass().getSimpleName() + \" - \" + e.getMessage());\r\n \r\n // }\r\n \t}", "@Override\n public void onVideoEnd() {\n super.onVideoEnd();\n }", "@Override\n public void handleMessage(Message msg) {\n super.handleMessage(msg);\n switch (msg.what) {\n case PLAY_VIDEO:\n JCVideoPlayer.releaseAllVideos();\n /* if (topVideoList.size() == 1) {\n videoplayer.setUp(topVideoList.get(videotype).getPath()\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n } else {\n videoplayer.setUp(topVideoList.get(videotype).getPath()\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n if (videotype == topVideoList.size() - 1) {\n videotype = 0;\n } else {\n videotype++;\n }\n }*/\n if (videotype == 0) {\n videoplayer.setUp(Constant.fileSavePath + \"lx2.mp4\"\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n videotype = 1;\n } else {\n videoplayer.setUp(Constant.fileSavePath + \"lx1.mp4\"\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n videotype = 0;\n }\n videoplayer.startVideo();\n break;\n case PLAY_BANNER:\n loadTestDatas();\n break;\n case PLAY_BANNERAPAWAIT:\n loadTestApawaitDatas();\n break;\n case PLAY_VIDEOHEIGHT:\n ViewGroup.LayoutParams params = rel_top.getLayoutParams();\n if (msg.arg1 == 1) {\n params.height = 506;\n } else if (msg.arg1 == 2) {\n params.height = 607;\n }\n rel_top.setLayoutParams(params);\n break;\n case PY_START:\n cabinetTransaction.start(Constant.pypwd, Constant.dev, Constant.pytype, 1, Constant.guiBean.getNumber(), cabinetTransactionEventListener);\n break;\n case 12345:\n tvloginfo.setText(msg.obj.toString());\n break;\n case MSG_CLOSE_CHECK_PENDING:\n Log.i(\"TCP\", \"开始添加\");\n synchronized (boxesPendingList) {\n for (int i = 0; i < boxesPendingList.length; i++) {\n if (boxesPendingList[i].boxId == 0) {//无效的格子编号,当前位置 可以存储格子数据\n try {\n Thread.sleep(500);\n CloseCheckBox closeCheckBox = (CloseCheckBox) msg.obj;\n boxesPendingList[i] = closeCheckBox;\n } catch (InterruptedException e) {\n e.printStackTrace();\n Log.i(\"TCP\", \">锁boxesPendingList2<\" + e.toString());\n }\n break;\n }\n }\n }\n Log.i(\"TCP\", \"结束添加\");\n break;\n default:\n break;\n }\n }", "@FXML\r\n protected void startCamera() {\r\n // set a fixed width for the frame\r\n this.currentFrame.setFitWidth(600);\r\n // preserve image ratio\r\n this.currentFrame.setPreserveRatio(true);\r\n\r\n if (!this.cameraActive) {\r\n\r\n // start the video capture\r\n //this.capture.open(0);\r\n //Read the video (Chage video)\r\n this.capture.open(\"Faruri.m4v\");\r\n\r\n\r\n System.out.println(\"start capture...\");\r\n // is the video stream available?\r\n if (this.capture.isOpened()) {\r\n System.out.println(\"inif\");\r\n this.cameraActive = true;\r\n\r\n // grab a frame every 33 ms (30 frames/sec)\r\n Runnable frameGrabber = new Runnable() {\r\n\r\n @Override\r\n public void run() {\r\n // effectively grab and process a single frame\r\n Mat frame = grabFrame();\r\n\r\n//\t\t\t\t\t\t// convert and show the frame\r\n//\t\t\t\t\t\tImage imageToShow = Utils.mat2Image(frame);\r\n//\t\t\t\t\t\tupdateImageView(currentFrame, imageToShow);\r\n }\r\n };\r\n\r\n this.timer = Executors.newSingleThreadScheduledExecutor();\r\n this.timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MILLISECONDS);\r\n\r\n // update the button content\r\n this.button.setText(\"Stop Video\");\r\n } else {\r\n // log the error\r\n System.err.println(\"Impossible to open the video...\");\r\n }\r\n } else {\r\n // the camera is not active at this point\r\n this.cameraActive = false;\r\n // update again the button content\r\n this.button.setText(\"Start Video\");\r\n\r\n // stop the timer\r\n this.stopAcquisition();\r\n }\r\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n if (isRecording) {\n \tLog.i(\"DEbuging cam act\", \"In isRecording\");\n // stop recording and release camera\n mMediaRecorder.stop(); // stop the recording\n tts= new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {\n \t @Override\n \t public void onInit(int status) {\n \t if(status != TextToSpeech.ERROR) {\n \t tts.setLanguage(Locale.UK);\n \t \t \n \t tts.speak(\"Recording stopped\", TextToSpeech.QUEUE_FLUSH, null);\n \t }\n \t }\n \t });\n\n releaseMediaRecorder(); // release the MediaRecorder object\n mCamera.lock(); // take camera access back from MediaRecorder\n\n // TODO inform the user that recording has stopped \n isRecording = false;\n releaseCamera();\n mediaMetadataRetriever.setDataSource(opFile); \n r = new Runnable() { \t\n \t\t\t\n \t\t\t@Override\n \t\t\tpublic void run() {\n \t\t\t\tLog.i(\"DEbuging cam act\", \"In runable\");\n \t\t\t\t//To call this thread periodically: handler.postDelayed(this, 2000);\n \t\t\t\t//getFrmAtTime has microsec as parameter n postDelayed has millisec \t\t\t\t\n \t\t\t\t//Bitmap tFrame[];\n \t\t\t\t\n \t\t\t\t\n \t\t\t\tString duration = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);\n \t\t\t\tframe.add(mediaMetadataRetriever.getFrameAtTime(time));\n \t\t\t\t/*int videoDuration = Integer.parseInt(duration);\n \t\t\t\tSystem.out.println(videoDuration);\n \t\t\t\twhile(time<videoDuration) {\n \t\t\t\t\tframe.add(mediaMetadataRetriever.getFrameAtTime(time)); \t\t\t\t\t\n \t\t\t\ttime=time+1000;\n \t\t\t\t}*/\n \t\t\t\t/*SendToServer sts = new SendToServer(frame);\n \t\t\t\tsts.connectToServer();*/\n \t\t\t\tConnectServer connectServer = new ConnectServer(frame);\n \t\t\t\tconnectServer.execute();\n \t\t\t\t\n \t\t\t}\n\n\t\t\t\t\t\t\n \t\t};\n\t\t\t\t\tr.run();\n \n } else {\n // initialize video camera\n if (prepareVideoRecorder()) {\n // Camera is available and unlocked, MediaRecorder is prepared,\n // now you can start recording \t\n mMediaRecorder.start(); \n //TODO inform the user that recording has started \n isRecording = true;\n tts= new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {\n \t @Override\n \t public void onInit(int status) {\n \t if(status != TextToSpeech.ERROR) {\n \t tts.setLanguage(Locale.UK);\n \t \t \n \t tts.speak(\"Started. Click Anywhere to stop recording\", TextToSpeech.QUEUE_FLUSH, null);\n \t }\n \t }\n \t });\n \n } else {\n // prepare didn't work, release the camera\n releaseMediaRecorder();\n // inform user\n }\n }\n\t\t\t}", "public void startCamera()\n \t{\n\t\t// start the video capture\n\t\t//this.capture.open(0);\n\t\tcapture.open(cameraNumber);\n\n\n\n\t\t// is the video stream available?\n\t\tif (capture.isOpened())\n\t\t{\n\t\t\t// grab a frame every 33 ms (30 frames/sec)\n\t\t\tRunnable frameGrabber = new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run()\n\t\t\t\t{\n\t\t\t\t\tgrabFrame();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimer = Executors.newSingleThreadScheduledExecutor();\n\t\t\ttimer.scheduleAtFixedRate(frameGrabber, 0, 500, TimeUnit.MILLISECONDS);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// log the error\n\t\t\tSystem.err.println(\"Impossible to open the camera connection...\");\n\t\t}\n \t}", "private void sendVideoRecordingRequest() {\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n assert surfaceTexture != null;\n surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n\n try {\n\n // create request for RECORDING template\n /**\n * Create a request suitable for video recording. Specifically, this means\n * that a stable frame rate is used, and post-processing is set for\n * recording quality. These requests would commonly be used with the\n * {@link CameraCaptureSession#setRepeatingRequest} method.\n * This template is guaranteed to be supported on all camera devices except\n * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices\n * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE\n * BACKWARD_COMPATIBLE}.\n *\n * @see #createCaptureRequest\n */\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode);\n\n if (mPreviewEnabled) {\n // add Preview surface to target\n mCaptureRequestBuilder.addTarget(previewSurface);\n }\n\n // add Record surface to target\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n try {\n cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void getPublishVideoData(String uid,File videoFile,File coverFile,String videoDesc,String latitude,String longitude){\n\n ApiService myQusetUtils = new HttpUtils.Builder()\n .addCallAdapterFactory()\n .addConverterFactory()\n .build()\n .getMyQusetUtils();\n /**\n * uid\n videoFile\n coverFile\n videoDesc\n latitude\n longitude\n\n */\n MultipartBody.Builder build = new MultipartBody.Builder().setType(MultipartBody.FORM);\n build.addFormDataPart(\"uid\",uid);\n build.addFormDataPart(\"videoDesc\",videoDesc);\n build.addFormDataPart(\"latitude\",latitude);\n build.addFormDataPart(\"longitude\",longitude);\n RequestBody requestFile = RequestBody.create(MediaType.parse(\"multipart/form-data\"), videoFile);\n build.addFormDataPart(\"videoFile\", videoFile.getName(), requestFile);\n RequestBody re = RequestBody.create(MediaType.parse(\"multipart/form-data\"), coverFile);\n build.addFormDataPart(\"coverFile\", coverFile.getName(),re);\n List<MultipartBody.Part> parts = build.build().parts();\n myQusetUtils.getPublishVideo(parts)\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Observer<PublishVideo>() {\n @Override\n public void onSubscribe(Disposable d) {\n\n }\n\n @Override\n public void onNext(PublishVideo publishVideo) {\n\n if(publishVideo.code.equals(\"0\")){\n getPublishVideoMessage.getPublishVideoSuccess(publishVideo);\n }else {\n getPublishVideoMessage.getPublishVideoFailure(publishVideo.msg);\n }\n }\n\n @Override\n public void onError(Throwable e) {\n\n }\n\n @Override\n public void onComplete() {\n\n }\n });\n }", "@Override\n\t\t\t\tpublic void onVideoFrame(byte[] data, long timestampUs) {\n\t\t\t\t\tByteBuffer byteBuffer = ByteBuffer.allocateDirect(mDummyOffset + data.length);\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tbyteBuffer.put(data);\n\t\t\t\t\tbyteBuffer.flip();\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tmListener.sendFrame(byteBuffer, timestampUs);\n\t\t\t\t\tmDummyOffset++;\n\t\t\t\t}", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "@Override\n\t\t\t\tpublic void onVideoFrame(byte[] data, long timestampUs) {\n\t\t\t\t\tByteBuffer byteBuffer = ByteBuffer.allocate(mDummyOffset + data.length);\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tbyteBuffer.put(data);\n\t\t\t\t\tbyteBuffer.flip();\n\t\t\t\t\tbyteBuffer.position(mDummyOffset);\n\n\t\t\t\t\tmListener.sendFrame(byteBuffer, timestampUs);\n\t\t\t\t\tmDummyOffset++;\n\t\t\t\t}", "public void startFrontCam() {\n }", "public void start(String name, String ip) {\r\n\t\tnew Thread(new Runnable() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\r\n\t\t\t\t// Camera setup code\r\n\t\t\t\tcam = CameraServer.getInstance().addAxisCamera(name, ip);\r\n\t\t\t\tcam.setBrightness(0);\r\n\t\t\t\tcam.setWhiteBalanceHoldCurrent();\r\n\t\t\t\tcam.setExposureHoldCurrent();\r\n\t\t\t\tcam.setResolution(320, 240);\r\n\t\t\t\tsink = CameraServer.getInstance().getVideo();\r\n\t\t\t\toutputStream = CameraServer.getInstance().putVideo(\"Post Porkcessing\", 320, 240);\r\n\t\t\t\tsecondaryOutput = CameraServer.getInstance().putVideo(\"Post Porkcessing 2: Electric Boogaloo\", 320,\r\n\t\t\t\t\t\t240);\r\n\t\t\t\t// tertiaryOutput = CameraServer.getInstance().putVideo(\"Post\r\n\t\t\t\t// Porkcessing 3: Finalmente\", 320, 240);\r\n\t\t\t\t// When using a Mat object, you must first create an empty\r\n\t\t\t\t// object of it before doing anything.\r\n\t\t\t\tcurrentPureFrame = new Mat();\r\n\t\t\t\tpostProcessingFrame = new Mat();\r\n\t\t\t\tArrayList<MatOfPoint> contours = new ArrayList<>();\r\n\r\n\t\t\t\twhile (true) {\r\n\t\t\t\t\t// This is where the image processing code goes.\r\n\t\t\t\t\tif (process) {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tThread.sleep(100);\r\n\t\t\t\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Acquires the current frame from the camera\r\n\t\t\t\t\t\tsink.grabFrame(currentPureFrame);\r\n\t\t\t\t\t\tdouble[] color = currentPureFrame.get(120, 160);\r\n\t\t\t\t\t\tif (OI.mainJoy.getRawButton(1))\r\n\t\t\t\t\t\t\tSystem.out.println(color[0] + \" : \" + color[1] + \" : \" + color[2]);\r\n\t\t\t\t\t\tpostProcessingFrame = currentPureFrame;\r\n\t\t\t\t\t\t// cam.setExposureManual(20);\r\n\t\t\t\t\t\t// cam.setBrightness(80);\r\n\t\t\t\t\t\t// cam.setWhiteBalanceManual(50);\r\n\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t * Basic theory: Go! After acquiring the image, you\r\n\t\t\t\t\t\t * first must filter by color. Call the\r\n\t\t\t\t\t\t * Imgproc.inRange() function and supply a minimum HSV\r\n\t\t\t\t\t\t * and maximum HSV. This will return a 'binary' image.\r\n\t\t\t\t\t\t * With this image, we can detect contours(basically\r\n\t\t\t\t\t\t * shapes). Then, we can find the bounding box of each\r\n\t\t\t\t\t\t * individual contour and filter accordingly.\r\n\t\t\t\t\t\t * \r\n\t\t\t\t\t\t * range was 70, 120, 120 to 100, 255, 255\r\n\t\t\t\t\t\t * \r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\tif (!OI.mainJoy.getRawButton(8)) { // TODO: ID THIS\r\n\t\t\t\t\t\t\tcam.setBrightness(20);\r\n\t\t\t\t\t\t\tcam.setWhiteBalanceHoldCurrent();\r\n\t\t\t\t\t\t\tcam.setExposureHoldCurrent();\r\n\t\t\t\t\t\t\t// Imgproc.blur(postProcessingFrame,\r\n\t\t\t\t\t\t\t// postProcessingFrame, new Size(1, 1)); //:100:\r\n\t\t\t\t\t\t\t// :+1: :100:\r\n\r\n\t\t\t\t\t\t\t// Core.inRange(postProcessingFrame, new Scalar(70,\r\n\t\t\t\t\t\t\t// 150, 0), new Scalar(390, 360, 360),\r\n\t\t\t\t\t\t\t// postProcessingFrame);\r\n\t\t\t\t\t\t\t// cam.setExposureHoldCurrent();\r\n\t\t\t\t\t\t\t// cam.setWhiteBalanceHoldCurrent();\r\n\t\t\t\t\t\t\tMat copy = postProcessingFrame.clone();\r\n\r\n\t\t\t\t\t\t\tImgproc.cvtColor(copy, copy, Imgproc.COLOR_BGR2GRAY);\r\n\t\t\t\t\t\t\tImgproc.cvtColor(postProcessingFrame, postProcessingFrame, Imgproc.COLOR_BGR2RGB);\r\n\t\t\t\t\t\t\tCore.inRange(postProcessingFrame, new Scalar(0, 80, 40), new Scalar(100, 180, 180),\r\n\t\t\t\t\t\t\t\t\tpostProcessingFrame);\r\n\t\t\t\t\t\t\tImgproc.blur(copy, copy, new Size(2, 2));\r\n\t\t\t\t\t\t\tImgproc.threshold(copy, copy, 40, 255, Imgproc.THRESH_BINARY);\r\n\t\t\t\t\t\t\tMat and = copy.clone();\r\n\t\t\t\t\t\t\tCore.bitwise_and(copy, postProcessingFrame, and);\r\n\t\t\t\t\t\t\tImgproc.cvtColor(postProcessingFrame, postProcessingFrame, Imgproc.COLOR_GRAY2BGR);\r\n\r\n\t\t\t\t\t\t\t// SmartDashboard.putNumber(\"Contours\",\r\n\t\t\t\t\t\t\t// contours.size());\r\n\t\t\t\t\t\t\tint[] i = new int[5];\r\n\t\t\t\t\t\t\tsecondaryOutput.putFrame(postProcessingFrame);\r\n\t\t\t\t\t\t\tImgproc.findContours(and, contours, new Mat(), Imgproc.RETR_LIST,\r\n\t\t\t\t\t\t\t\t\tImgproc.CHAIN_APPROX_SIMPLE);\r\n\t\t\t\t\t\t\tint largestID = 0;\r\n\t\t\t\t\t\t\tdouble xs[] = new double[] { 0, 0 };\r\n\t\t\t\t\t\t\tif (contours.size() > 0) {\r\n\t\t\t\t\t\t\t\tlargestID = findLargestContour(contours);\r\n\t\t\t\t\t\t\t\tdouble[] XY = findXY(contours.get(largestID));\r\n\t\t\t\t\t\t\t\txs[0] = XY[0];\r\n\r\n\t\t\t\t\t\t\t\tImgproc.cvtColor(and, and, Imgproc.COLOR_GRAY2BGR);\r\n\t\t\t\t\t\t\t\tImgproc.drawContours(and, contours, findLargestContour(contours),\r\n\t\t\t\t\t\t\t\t\t\tnew Scalar(200, 100, 200));\r\n\r\n\t\t\t\t\t\t\t\tImgproc.drawMarker(and, new Point(XY[0] + 320 / 2, XY[1]),\r\n\r\n\t\t\t\t\t\t\t\t\t\tnew Scalar(Math.random() * 255, Math.random() * 255, Math.random() * 255));\r\n\t\t\t\t\t\t\t\t// contours.clear();\r\n\t\t\t\t\t\t\t\tSmartDashboard.putNumber(\"Largest width\",\r\n\t\t\t\t\t\t\t\t\t\tImgproc.boundingRect(contours.get(largestID)).width);\r\n\t\t\t\t\t\t\t\tRect r = Imgproc.boundingRect(contours.get(largestID));\r\n\t\t\t\t\t\t\t\tSmartDashboard.putNumber(\"Ratio\", (((double) r.height) / ((double) r.width)));\r\n\t\t\t\t\t\t\t\tif (contours.size() > 1) {\r\n\t\t\t\t\t\t\t\t\tcontours.remove(largestID);\r\n\t\t\t\t\t\t\t\t\tlargestID = findLargestContour(contours);\r\n\t\t\t\t\t\t\t\t\tXY = findXY(contours.get(largestID));\r\n\t\t\t\t\t\t\t\t\txs[1] = XY[0];\r\n\t\t\t\t\t\t\t\t\tImgproc.drawContours(and, contours, findLargestContour(contours),\r\n\t\t\t\t\t\t\t\t\t\t\tnew Scalar(200, 100, 200));\r\n\r\n\t\t\t\t\t\t\t\t\tImgproc.drawMarker(and, new Point(XY[0] + 320 / 2, XY[1]),\r\n\t\t\t\t\t\t\t\t\t\t\tnew Scalar(Math.random() * 255, Math.random() * 255, Math.random() * 255));\r\n\t\t\t\t\t\t\t\t\tsetAngleOff(((xs[0] + xs[1]) / 2) * degreesPerPixel);\r\n\t\t\t\t\t\t\t\t\tsetDistanceOff((xs[0] + xs[1]) / 2);\r\n\r\n\t\t\t\t\t\t\t\t\tSmartDashboard.putNumber(\"X degrees off\", ((xs[0] + xs[1]) / 2) * degreesPerPixel);\r\n\t\t\t\t\t\t\t\t\tSmartDashboard.putNumber(\"Distance Relative\", Math.abs(xs[0] - xs[1]));\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tsetAngleOff(0);\r\n\t\t\t\t\t\t\t\t\tSmartDashboard.putNumber(\"X degrees off\", 0);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tsetAngleOff(0);\r\n\t\t\t\t\t\t\t\tSmartDashboard.putNumber(\"X degrees off\", 0);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\toutputStream.putFrame(and);\r\n\t\t\t\t\t\t\tcontours.clear();\r\n\t\t\t\t\t\t\tand.release();\r\n\t\t\t\t\t\t\tcopy.release();\r\n\t\t\t\t\t\t\tpostProcessingFrame.release();\r\n\t\t\t\t\t\t\tcurrentPureFrame.release();\r\n\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// TODO:DO CAMERA STUFF\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}).start();\r\n\r\n\t}", "@Override\r\n\t\t\t\tpublic void run() {\n\t\t\t\t\tmVideoContrl.seekTo(mpos);\r\n\r\n\t\t\t\t}", "public void AddCameraServer() {\n addCameraServer(\"Pixy Output\", 50);\n }", "@Override\n\t\t\t\tpublic void onVideoFrame(byte[] data, long timestampUs) {\n\t\t\t\t\tbyte[] buffer = new byte[mDummyOffset + data.length];\n\t\t\t\t\tSystem.arraycopy(data, 0, buffer, mDummyOffset, data.length);\n\n\t\t\t\t\tmListener.sendFrame(buffer, mDummyOffset, data.length, timestampUs);\n\t\t\t\t\tmDummyOffset++;\n\t\t\t\t}", "public interface VideoThreadShow {\n void AddMySurfaceView(int threadnum);\n void DeleMySurfaceView(int threadnum);\n void TryAddVideoThread();//开启新的线程\n void ShowBitmap(Bitmap bitmap,int sufacenum);\n void ToastShow(String ss);\n ServerSocket getServerSocket();\n Handler GetUIHandler();\n void StopActivity();\n}", "@Override\n public void onFrameAvailable(int cameraId) {\n }", "@Override\n public void onFrameAvailable(int cameraId) {\n }", "public VisionThread (double framerate)\n\t{\t\n\t\tSystem.out.println(\"creating visionthread\");\n\t\t//camera setup\n\t\tcamera = new UsbCamera(\"camera1\", 0);\n camera.setResolution(320, 240);\n camera.setFPS(30);\n camera.setBrightness(0);\n camera.setExposureManual(20);\n camera.setWhiteBalanceManual(4000);\n \n cvSink = CameraServer.getInstance().getVideo(camera);\n cvSink.setEnabled(true);\n cvSource = CameraServer.getInstance().putVideo(\"GearCam\", 320, 240);\n \n \timage = new Mat();\n contours = new ArrayList<MatOfPoint>();\n mPipeline = new Pipeline();\n\t\t\n\t\ttarget1 = new RotatedRect();\n\t\ttarget2 = new RotatedRect();\n\t\tcombinedTarget = new Rect();\n\t\tcombinedTargetCenter = 0;\n\t\ttargetsFound = 0;\n\t\t\n\t\tthreadWait = Math.max((int)(Math.round(1.0 / framerate)) * 1000, 1);\n\t\t\n\t\trunningcount = 0;\n\t}", "public interface ILiveStreamConnection {\n\n\n\t/**\n\t * Returns this connection unique id\n\t *\n\t * @return the UUID associated with this connection\n\t */\n\tUUID getId();\n\n\tStreamType getStreamType();\n\n\tCameraConfiguration getCameraConfig();\n\n\tvoid addAxisMoveListener(IAxisChangeListener axisMoveListener);\n\n\tvoid removeAxisMoveListener(IAxisChangeListener axisMoveListener);\n\n\tvoid addDataListenerToStream(IDataListener listener) throws LiveStreamException;\n\n\tvoid removeDataListenerFromStream(IDataListener listener);\n}", "@Test\n public void clientCreatesStreamAndServerReplies() throws Exception {\n peer.sendFrame().settings(new Settings());\n peer.acceptFrame();// ACK\n\n peer.acceptFrame();// SYN_STREAM\n\n peer.acceptFrame();// DATA\n\n peer.sendFrame().headers(false, 3, TestUtil.headerEntries(\"a\", \"android\"));\n peer.sendFrame().data(true, 3, new Buffer().writeUtf8(\"robot\"), 5);\n peer.acceptFrame();// PING\n\n peer.sendFrame().ping(true, 1, 0);// PING\n\n peer.play();\n // play it back\n Http2Connection connection = connect(peer);\n Http2Stream stream = connection.newStream(TestUtil.headerEntries(\"b\", \"banana\"), true);\n BufferedSink out = Okio.buffer(stream.getSink());\n out.writeUtf8(\"c3po\");\n out.close();\n Assert.assertEquals(Headers.of(\"a\", \"android\"), stream.takeHeaders());\n assertStreamData(\"robot\", stream.getSource());\n connection.writePingAndAwaitPong();\n Assert.assertEquals(0, connection.openStreamCount());\n // verify the peer received what was expected\n MockHttp2Peer.InFrame synStream = peer.takeFrame();\n Assert.assertEquals(TYPE_HEADERS, synStream.type);\n Assert.assertFalse(synStream.outFinished);\n Assert.assertEquals(3, synStream.streamId);\n Assert.assertEquals((-1), synStream.associatedStreamId);\n Assert.assertEquals(TestUtil.headerEntries(\"b\", \"banana\"), synStream.headerBlock);\n MockHttp2Peer.InFrame requestData = peer.takeFrame();\n Assert.assertArrayEquals(\"c3po\".getBytes(StandardCharsets.UTF_8), requestData.data);\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_camera_preview);\n\t\tmCamSV = (SurfaceView) findViewById(R.id.camera_preview_surface_cam);\n\n\t\tmCamSV.getHolder().setFixedSize(VisionConfig.getWidth(),\n\t\t\t\tVisionConfig.getHeight());\n\n\t\tLog.i(\"MyLog\", \"CAP: onCreate\");\n\n\t\t// Setup Bind Service\n\t\tVisionConfig.bindService(this, mConnection);\n\t\ttakeAPictureReceiver = new TakeAPictureReceiver();\n\t\tIntentFilter filterOverlayVision = new IntentFilter(\n\t\t\t\tRobotIntent.CAM_TAKE_PICKTURE);\n\t\tHandlerThread handlerThreadOverlay = new HandlerThread(\n\t\t\t\t\"MyNewThreadOverlay\");\n\t\thandlerThreadOverlay.start();\n\t\tLooper looperOverlay = handlerThreadOverlay.getLooper();\n\t\thandlerOverlay = new Handler(looperOverlay);\n\t\tregisterReceiver(takeAPictureReceiver, filterOverlayVision, null,\n\t\t\t\thandlerOverlay);\n\t\t\n\t\tfaceDetectionReceiver = new FaceDetectionReceiver();\n\t\tIntentFilter filterFaceDetection = new IntentFilter(RobotIntent.CAM_FACE_DETECTION);\n\t\tHandlerThread handlerThreadFaceDetectionOverlay = new HandlerThread(\n\t\t\t\t\"MyNewThreadFaceDetectionOverlay\");\n\t\thandlerThreadFaceDetectionOverlay.start();\n\t\tLooper looperFaceDetectionOverlay = handlerThreadFaceDetectionOverlay.getLooper();\n\t\thandleFaceDetection = new Handler(looperFaceDetectionOverlay);\n\t\tregisterReceiver(faceDetectionReceiver, filterFaceDetection, null,\n\t\t\t\thandleFaceDetection);\n\t\t\n\t\t\n//\t\tfaceDetectionReceiver2 = new FaceDetectionReceiver2();\n//\t\tIntentFilter filterFaceDetection2 = new IntentFilter(\"hhq.face\");\n//\t\tHandlerThread handlerThreadFaceDetectionOverlay2 = new HandlerThread(\n//\t\t\t\t\"MyNewThreadFaceDetectionOverlay2\");\n//\t\thandlerThreadFaceDetectionOverlay2.start();\n//\t\tLooper looperFaceDetectionOverlay2 = handlerThreadFaceDetectionOverlay2.getLooper();\n//\t\thandleFaceDetection2 = new Handler(looperFaceDetectionOverlay2);\n//\t\tregisterReceiver(faceDetectionReceiver2, filterFaceDetection2, null,\n//\t\t\t\thandleFaceDetection2);\t\t\n\n\t\t\t\t\n\t\tpt.setColor(Color.GREEN);\n\t\tpt.setTextSize(50);\n\t\tpt.setStrokeWidth(3);\n\t\tpt.setStyle(Paint.Style.STROKE);\n\t\t\n//\t\tpt2.setColor(Color.BLUE);\n//\t\tpt2.setTextSize(50);\n//\t\tpt2.setStrokeWidth(3);\n//\t\tpt2.setStyle(Paint.Style.STROKE);\n\t}", "@Override\n public void onServiceConnected(ComponentName className,\n IBinder service) {\n LiveVideoBroadcaster.LocalBinder binder = (LiveVideoBroadcaster.LocalBinder) service;\n if (mLiveVideoBroadcaster == null) {\n mLiveVideoBroadcaster = binder.getService();\n mLiveVideoBroadcaster.init(LiveVideoBroadcasterActivity.this, mGLView);\n mLiveVideoBroadcaster.setAdaptiveStreaming(true);\n }\n mLiveVideoBroadcaster.openCamera(Camera.CameraInfo.CAMERA_FACING_FRONT);\n }", "@Override\r\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\tmVideoContrl.seekTo((int) time);\r\n\r\n\t\t\t\t\t\t}", "@Override\n public void imagingUpdate(CameraState status) {\n synchronized(_cameraListeners) {\n if (_cameraListeners.isEmpty()) return;\n }\n \n try {\n // Construct message\n Response resp = new Response(UdpConstants.NO_TICKET, DUMMY_ADDRESS);\n resp.stream.writeUTF(UdpConstants.COMMAND.CMD_SEND_CAMERA.str);\n resp.stream.writeByte(status.ordinal());\n \n // Send to all listeners\n synchronized(_cameraListeners) {\n _udpServer.bcast(resp, _cameraListeners.keySet());\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Failed to serialize camera\");\n }\n }", "@Override\n public void releaseVideoFrames() {\n\n }", "protected void startVideoCall() {\n if (!EMClient.getInstance().isConnected())\n Toast.makeText(ChatDetailsActivity.this, R.string.not_connect_to_server, Toast.LENGTH_SHORT).show();\n else {\n startActivity(new Intent(ChatDetailsActivity.this, VideoCallActivity.class).putExtra(\"username\", mBean.getMobile())\n .putExtra(\"isComingCall\", false).putExtra(\"nickname\", mBean.getUser_nickname()));\n // videoCallBtn.setEnabled(false);\n// inputMenu.hideExtendMenuContainer();\n }\n }", "public static void main(String[] args) {\n\t\tSystem.loadLibrary(\"opencv_java310\");\n\n // Connect NetworkTables, and get access to the publishing table\n\t\tNetworkTable.setClientMode();\n\t\tNetworkTable.setTeam(4662);\n\t\tNetworkTable.initialize();\n\t\tNetworkTable visionTable = NetworkTable.getTable(\"Vision\");\n\t\n\t//gpio for relay light control\n\t\tfinal GpioController gpio = GpioFactory.getInstance();\n\t\tfinal GpioPinDigitalOutput gearLight = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, \"Gear\", PinState.LOW);\n\t\tgearLight.setShutdownOptions(true, PinState.LOW);\n\t\tfinal GpioPinDigitalOutput fuelLight = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, \"Fuel\", PinState.LOW);\n\t\tfuelLight.setShutdownOptions(true, PinState.LOW);\n\n \n // This is the network port you want to stream the raw received image to\n // By rules, this has to be between 1180 and 1190, so 1185 is a good choice\n// \tint streamPort = 1185;\n// \tint streamPort2 = 1187;\n // This stores our reference to our mjpeg server for streaming the input image\n // \tMjpegServer inputStream = new MjpegServer(\"MJPEG Server\", streamPort);\n // \tMjpegServer inputStream2 = new MjpegServer(\"MJPEG Server2\", streamPort2);\n// \tUsbCamera camera = setUsbCamera(\"GearCam\",0, inputStream);\n// \tUsbCamera cam2 = setUsbCamera(\"ShootCam\",1, inputStream2);\n\t\tUsbCamera camera = setUsbCamera(\"GearCam\",0);\n\t\tUsbCamera cam2 = setUsbCamera(\"ShootCam\",1);\n\n // This creates a CvSink for us to use. This grabs images from our selected camera, \n // and will allow us to use those images in opencv\n\t\tCvSink imageSink = new CvSink(\"CV Image Grabber\");\n\t\timageSink.setSource(camera);\n\n // This creates a CvSource to use. This will take in a Mat image that has had OpenCV operations\n // operations \n\t\tCvSource imageSource = new CvSource(\"CV Image Source\", VideoMode.PixelFormat.kMJPEG, 640, 480, 15);\n\t\tMjpegServer cvStream = new MjpegServer(\"CV Image Stream\", 1186);\n\t\tcvStream.setSource(imageSource);\n\n // All Mats and Lists should be stored outside the loop to avoid allocations\n // as they are expensive to create\n\t\tMat inputImage = new Mat();\n// Mat hsv = new Mat();\n\t\tPegFilter gearTarget = new PegFilter();\n\t\tBoilerPipeLine shootTarget = new BoilerPipeLine();\n\n\t\tdo {\n\t\t\tvisionTable.putBoolean(\"Take Pic\", bVisionInd);\n\t\t\tvisionTable.putBoolean(\"Keep Running\", bCameraLoop);\n\t\t\tvisionTable.putBoolean(\"IsGearDrive\", bGearDrive);\n\t\t\tvisionTable.putBoolean(\"IsVisionOn\", bVisionOn);\n\t\t} while (!visionTable.isConnected());\n\t\t\n\t\t\n\t\n\t\tdouble r1PixelX = -1;\n\t\tdouble r1PixelY = -1;\n\t\tdouble r1PixelH = -1;\n\t\tdouble r1PixelW = -1;\n\t\tboolean bIsTargetFound = false;\n\n\t\t// Infinitely process image\n\t int i=0;\n\t\twhile (bCameraLoop) {\n\t\n\t\t\tbGearDrive = visionTable.getBoolean(\"IsGearDrive\", bGearDrive);\n\t\t\tbVisionOn = visionTable.getBoolean(\"IsVisionOn\", bVisionOn);\n\t\n\t \tif (bVisionOn) {\n\t \t\tif (bGearDrive) {\n\t \t\t\tgearLight.high();\n\t \t\t\tfuelLight.low();\n\t \t\t} else {\n\t \t\t\tfuelLight.high();\n\t \t\t\tgearLight.low();\n\t \t\t}\n\t \t} else {\n\t \t\tgearLight.low();\n\t \t\tfuelLight.low();\n\t \t}\n\t \t\tif (bGearDrive) {\n\t \t\t imageSink.setSource(camera);\n\t \t\t} else {\n\t \t\t imageSink.setSource(cam2);\n\t \t\t}\n\t \t\n\t // Grab a frame. If it has a frame time of 0, there was an error.\n\t // Just skip and continue\n\t \t\tlong frameTime = imageSink.grabFrame(inputImage);\n\t \t\tif (frameTime == 0) continue;\n\t\n\t // Below is where you would do your OpenCV operations on the provided image\n\t // The sample below just changes color source to HSV\n\t// Imgproc.cvtColor(inputImage, hsv, Imgproc.COLOR_BGR2HSV);\n\t\t\tbIsTargetFound = false;\n\t\t\tint objectsFound = 0;\n\t\t\tif (bGearDrive) {\n\t\t\t\tgearTarget.process(inputImage);\n\t\t\t \tobjectsFound = gearTarget.filterContoursOutput().size();\n\t\t\t} else {\n\t\t\t\tobjectsFound = 0;\n\t\t\t\tshootTarget.process(inputImage);\n\t\t\t\tobjectsFound = shootTarget.filterContoursOutput().size();\n\t\t\t}\n\t \n\t\t \tif (objectsFound >= 1) {\n\t\t \t\tbIsTargetFound = true;\n\t\t \tif (bGearDrive) {\n\t\t \t\tRect r1 = Imgproc.boundingRect(gearTarget.filterContoursOutput().get(0));\n\t\t \t\tr1PixelX = r1.x;\n\t\t\t \tr1PixelY = r1.y;\n\t\t\t \tr1PixelW = r1.width;\n\t\t\t \tr1PixelH = r1.height;\n\t\t \t\t} else {\n\t\t \t\t\tRect r1 = Imgproc.boundingRect(shootTarget.filterContoursOutput().get(0));\t\n\t\t \t\t\tr1PixelX = r1.x;\n\t\t\t \tr1PixelY = r1.y;\n\t\t\t \tr1PixelW = r1.width;\n\t\t\t \tr1PixelH = r1.height;\n\t\t \t\t}\n\t\t \t\n\t\t \t} else {\n\t\t \tr1PixelX = -1;\n\t\t \tr1PixelY = -1;\n\t\t \tr1PixelW = -1;\n\t\t \tr1PixelH = -1;\n\t\t \t}\n\t\t \t\n\t\t \tif (bGearDrive) {\n\t\t \t\tImgproc.rectangle(inputImage, GEAR_TRGT_UPPER_LEFT, GEAR_TRGT_LOWER_RIGHT,\n\t\t \t\t\t\tRECT_COLOR, RECT_LINE_WIDTH);\n\t\t \t} else {\n\t\t \t\tImgproc.rectangle(inputImage, BOILER_TRGT_UPPER_LEFT, BOILER_TRGT_LOWER_RIGHT,\n\t\t \t\t\t\tRECT_COLOR, RECT_LINE_WIDTH);\n\t\t \t}\n\t\n\t\t \tvisionTable.putBoolean(\"IsTargetFound\", bIsTargetFound);\n\t\t visionTable.putNumber(\"Target1X\", r1PixelX);\n\t\t visionTable.putNumber(\"Target1Y\", r1PixelY);\n\t\t visionTable.putNumber(\"Target1Width\", r1PixelW);\n\t\t visionTable.putNumber(\"Target1Height\", r1PixelH);\n\t\n\t \tvisionTable.putNumber(\"Next Pic\", i);\n\t \tbVisionInd = visionTable.getBoolean(\"Take Pic\", bVisionInd);\n\t \tif (bVisionInd) {\n\t \t\tchar cI = Character.forDigit(i, 10);\n\t \t\tImgcodecs.imwrite(\"/home/pi/vid\" + cI + \".jpg\", inputImage);\n//\t \t\tString fileTmst = new SimpleDateFormat(\"yyyyMMddhhmmssSSS\").format(new Date().getTime());\n//\t \t\tImgcodecs.imwrite(\"/home/pi/vid\" + fileTmst + \".jpg\", inputImage);\n\t \t\tSystem.out.println(\"loop\" + i);\n\t \t\ti++;\n\t \t\tbVisionInd = false;\n\t \t\tvisionTable.putBoolean(\"Take Pic\", bVisionInd);\n\t \t}\n\t \tbCameraLoop = visionTable.getBoolean(\"Keep Running\", bCameraLoop);\n\t \timageSource.putFrame(inputImage);\n\t }\n\t\n gpio.shutdown();\n\n\t}", "public int getVideoPort();", "void cameraInOperation(boolean in_operation, boolean is_video);", "public interface SendStream \nextends RTPStream \n{\n /**\n * Changes the source description (SDES) reports being sent in RTCP\n * packets for this sending stream. </P>\n *\n * @param sourceDesc The new source description data. <P>\n */\n public void \n setSourceDescription( SourceDescription[] sourceDesc);\n /**\n * Removes the stream from the session. When this method is called\n * the RTPSM deallocates all resources associated with this stream\n * and releases references to this object as well as the Player\n * which had been providing the send stream. <P>\n */\n public void\n close();\n /**\n * Will temporarily stop the RTPSendStream i.e. the local\n * participant will stop sending out data on the network at this time.\n * @exception IOException Thrown if there was any IO problems when\n * stopping the RTPSendStream. A stop to the sendstream will also\n * cause a stop() to be called on the stream's datasource. This\n * could also throw an IOException, consistent with datasources in\n * JMF. \n */\n public void\n stop() throws IOException;\n /**\n * Will resume data transmission over the network on this\n RTPSendStream.\n * @exception IOException Thrown if there was any IO problems when\n * starting the RTPSendStream. A start to the sendstream will also\n * cause a start() to be called on the stream's datasource. This\n * could also throw an IOException, consistent with datasources in\n * JMF. \n */\n public void\n start() throws IOException;\n \n /*\n * Set the bit rate of the outgoing network data for this\n * sendstream. The send stream will send data out at the rate it is\n * received from the datasource of this stream as a default\n * value. This rate can be changed by setting the bit rate on the\n * sendstream in which case the SessionManager will perform some\n * amount of buffering to maintain the desired outgoing bitrate\n * @param the bit rate at which data should be sent over the\n network\n * @returns the actual bit rate set.\n */\n public int\n setBitRate(int bitRate);\n\n /**\n * Retrieve statistics on data and control packets transmitted on\n * this RTPSendStream. All the transmission statistics pertain to\n * this particular RTPSendStream only. Global statistics on all data\n * sent out from this participant (host) can be retrieved using\n * getGlobalTransmission() method from the SessionManager.\n */\n public TransmissionStats\n getSourceTransmissionStats();\n}", "@Override\n public void onSurfaceTextureUpdated(SurfaceTexture surface) {\n mTextView02.setText(String.valueOf(mDetector.get_rect_x()+mDetector.get_rect_width()/2) +\", \" + String.valueOf(mDetector.get_rect_y()+mDetector.get_rect_height()/2)+\" \"+String.valueOf(mDetector.width)+\", \"+String.valueOf(mDetector.height));\n\n // TODO Auto-generated method stub\n //Image processing thread\n new Thread(new Runnable() {\n @Override\n public void run() {\n if (step_count != 3){\n step_count++;\n return;\n }\n else{\n step_count = 0;\n }\n //Variables for socket transmission\n //int i = 0;\n //DataOutputStream dos = null;\n\n //Get bitmap\n Bitmap frame_bmp = mSurfaceView.getBitmap();\n\n //Send the bitmap to PC\n /*ByteBuffer b = ByteBuffer.allocate(frame_bmp.getByteCount());\n frame_bmp.copyPixelsToBuffer(b);\n byte[] byte_array = b.array();\n InputStream is = new ByteArrayInputStream(byte_array);\n BufferedInputStream bis = new BufferedInputStream(is); */\n\n /*ByteArrayOutputStream stream = new ByteArrayOutputStream();\n frame_bmp.compress(Bitmap.CompressFormat.JPEG, 30,stream);\n byte[] byteArray = stream.toByteArray();\n InputStream is = new ByteArrayInputStream(byteArray);\n BufferedInputStream bis = new BufferedInputStream(is);\n\n Socket socket = null;\n try {\n socket = new Socket(myRouter_pc_ip, 8080);\n dos = new DataOutputStream(socket.getOutputStream());\n while ((i = bis.read()) > -1)\n dos.write(i);\n }\n catch(Exception e){\n e.printStackTrace();\n }\n finally{\n try{\n bis.close();\n }\n catch (Exception e){\n e.printStackTrace();\n }\n if (dos != null){\n try{\n dos.flush();\n dos.close();\n }\n catch (Exception e){\n e.printStackTrace();\n }\n }\n if (socket != null){\n try{\n socket.close();\n }\n catch (Exception e){\n e.printStackTrace();\n }\n }\n } */\n\n\n Utils.bitmapToMat(frame_bmp, mRgba); // frame_bmp is in ARGB format, mRgba is in RBGA format\n\n //Todo: Do image processing stuff here\n mRgba.convertTo(mRgba,-1,2,0); // Increase intensity by 2\n\n if (mIsColorSelected) {\n //Show the error-corrected color\n mBlobColorHsv = mDetector.get_new_hsvColor();\n mBlobColorRgba = converScalarHsv2Rgba(mBlobColorHsv);\n\n //Debug\n Log.i(TAG, \"mDetector rgba color: (\" + mBlobColorRgba.val[0] + \", \" + mBlobColorRgba.val[1] +\n \", \" + mBlobColorRgba.val[2] + \", \" + mBlobColorRgba.val[3] + \")\");\n Log.i(TAG, \"mDetector hsv color: (\" + mBlobColorHsv.val[0] + \", \" + mBlobColorHsv.val[1] +\n \", \" + mBlobColorHsv.val[2] + \", \" + mBlobColorHsv.val[3] + \")\");\n\n mDetector.process(mRgba);\n List<MatOfPoint> contours = mDetector.getContours();\n Log.e(TAG, \"Contours count: \" + contours.size());\n Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR,2);\n\n Mat colorLabel = mRgba.submat(4, 68, 4, 68);\n colorLabel.setTo(mBlobColorRgba);\n\n Mat spectrumLabel = mRgba.submat(4, 4 + mSpectrum.rows(), 70, 70 + mSpectrum.cols());\n mSpectrum.copyTo(spectrumLabel);\n }\n\n\n Utils.matToBitmap(mRgba, frame_bmp);\n Canvas canvas = mSurfaceView_Display.lockCanvas();\n canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);\n canvas.drawBitmap(frame_bmp, new Rect(0, 0, frame_bmp.getWidth(), frame_bmp.getHeight()),\n new Rect((canvas.getWidth() - frame_bmp.getWidth()) / 2,\n (canvas.getHeight() - frame_bmp.getHeight()) / 2,\n (canvas.getWidth() - frame_bmp.getWidth()) / 2 + frame_bmp.getWidth(),\n (canvas.getHeight() - frame_bmp.getHeight()) / 2 + frame_bmp.getHeight()), null);\n mSurfaceView_Display.unlockCanvasAndPost(canvas);\n }\n }).start();\n }", "protected void onActivityResult(int requestCode,\n int resultCode, Intent data) {\n\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == VIDEO_CAPTURE) {\n if (resultCode == RESULT_OK )\n {\n // The rest of the code takes the video into the input stream and writes it to the location given in the internal storage\n Log.d(\"uy\",\"ok res\");\n File newfile;\n //data.\n AssetFileDescriptor videoAsset = null;\n FileInputStream in_stream = null;\n OutputStream out_stream = null;\n try {\n\n videoAsset = getContentResolver().openAssetFileDescriptor(data.getData(), \"r\");\n Log.d(\"uy\",\"vid ead\");\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n try {\n in_stream = videoAsset.createInputStream();\n Log.d(\"uy\",\"in stream\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n Log.d(\"uy\",\"dir\");\n Log.d(\"uy\",Environment.getExternalStorageDirectory().getAbsolutePath());\n File dir = new File(folder_path);\n if (!dir.exists())\n {\n dir.mkdirs();\n Log.d(\"uy\",\"mkdir\");\n }\n\n newfile = new File(dir, vid_name);\n Log.d(\"uy\",\"hr\");\n\n if (newfile.exists()) {\n newfile.delete();\n }\n\n\n try {\n out_stream = new FileOutputStream(newfile);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n byte[] buf = new byte[1024];\n int len;\n\n while (true) {\n try\n {\n Log.d(\"uy\",\"try\");\n if (((len = in_stream.read(buf)) > 0))\n {\n Log.d(\"uy\",\"File write\");\n out_stream.write(buf, 0, len);\n }\n else\n {\n Log.d(\"uy\",\"else\");\n in_stream.close();\n out_stream.close();\n break;\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n\n // Function to convert video to avi for processing the heart rate\n convert_video_commands();\n\n Toast.makeText(this, \"Video has been saved to:\\n\" +\n data.getData(), Toast.LENGTH_LONG).show();\n } else if (resultCode == RESULT_CANCELED) {\n Toast.makeText(this, \"Video recording cancelled.\",\n Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(this, \"Failed to record video\",\n Toast.LENGTH_LONG).show();\n }\n }\n }", "@Override\n\tpublic void receiveSessionInfo(Camera camera, int resultCode) {\n\t\t\n\t}", "boolean isLocalVideoStreaming(Call call);", "public synchronized void associateHandle() {\n JCublas2.cublasSetStream(handle,oldStream);\n }", "public void startVideoRecording() {\n\n try {\n mVideoFileTest = createVideoFile(mVideoFolder);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // set up Recorder\n try {\n setupMediaRecorder();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // prepare for recording\n sendVideoRecordingRequest();\n\n // start recording\n mMediaRecorder.start();\n\n if (mRokidCameraRecordingListener != null) {\n mRokidCameraRecordingListener.onRokidCameraRecordingStarted();\n }\n }", "@Override\n public byte[] getVideo(String cameraName) {\n throw new IllegalStateException(\"Not implemented yet!\");\n }", "public void run() {\n\n ServerSocket ss = null;\n try {\n\n ss = new ServerSocket(port); // accept connection from other peers and send out blocks of images to others\n\n } catch (Exception e) {\n\n // e.printStackTrace();\n\n }\n\n while (true) {\n\n Socket s;\n\n try {\n\n s = ss.accept();\n\n new Thread(new uploader(s)).start(); // create an uploader thread for each incoming client\n\n } catch (Exception e){\n\n // e.printStackTrace();\n\n }\n\n }\n\n }", "private void setupStreams() throws IOException {\n\t\toutput = new ObjectOutputStream(Connection.getOutputStream());\n\t\toutput.flush();\n\t\tinput = new ObjectInputStream(Connection.getInputStream()); \n\t\tshowMessage(\"\\n Streams have successfully connected.\");\n\t}", "private void setupLocalVideo() {\n\n // Enable the video module.\n mRtcEngine.enableVideo();\n\n mLocalView = RtcEngine.CreateRendererView(getBaseContext());\n mLocalView.setZOrderMediaOverlay(true);\n mLocalContainer.addView(mLocalView);\n\n mRtcEngine.setupLocalVideo(new VideoCanvas(mLocalView, VideoCanvas.RENDER_MODE_HIDDEN, 0));\n }", "@Override\n public void run(){\n\n String datas = Uploader.doImageCheck(bmp, session);\n if (datas != \"NULL\" && datas != \"\") {\n\n String fileURL=\"\";\n int lastnum=1;\n String filename=\"\";\n String ext=\"\";\n\n JSONObject job = null;\n try {\n job = new JSONObject(datas);\n fileURL = (String) job.get(\"fileDir\");\n lastnum = Integer.parseInt((String) job.get(\"lastnum\"));\n filename = (String) job.get(\"filename\");\n ext = (String) job.get(\"ext\");\n } catch (JSONException e) {\n return;\n }\n\n final File sdCard = Environment.getExternalStorageDirectory();\n\n File dir = new File(sdCard.getAbsolutePath() + \"/Verrapel/Video/\" + filename);\n\n if (!dir.exists()) {\n dir.mkdirs();\n }\n for (int i = 1; i <= lastnum; i++) {\n String filePath = sdCard.getAbsolutePath() + \"/Verrapel/Video/\" + filename + \"/\" + i + ext;\n File f = new File(filePath);\n if (!f.exists()) {\n String fileUrl = fileURL + \"/\" + i + ext;\n\n String localPath = filePath;\n\n try {\n URL imgUrl = new URL(fileUrl);\n //서버와 접속하는 클라이언트 객체 생성\n HttpURLConnection conn = (HttpURLConnection) imgUrl.openConnection();\n int response = conn.getResponseCode();\n\n File file = new File(localPath);\n\n InputStream is = conn.getInputStream();\n OutputStream outStream = new FileOutputStream(file);\n\n byte[] buf = new byte[1024];\n int len = 0;\n\n while ((len = is.read(buf)) > 0) {\n outStream.write(buf, 0, len);\n }\n\n outStream.close();\n is.close();\n conn.disconnect();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }\n\n ArrayList<Mat> videoArray = new ArrayList<Mat>();\n\n for (int i = 1; i <= lastnum; i++) {\n String filePath = sdCard.getAbsolutePath() + \"/Verrapel/Video/\" + filename + \"/\" + i + ext;\n\n File file = new File(filePath);\n if (file.exists()) {\n Bitmap bm = BitmapFactory.decodeFile(filePath);\n Mat tmp = new Mat();\n\n Matrix matrix = new Matrix();\n matrix.postRotate(270);\n Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);\n Utils.bitmapToMat(resizedBitmap, tmp);\n videoArray.add(tmp);\n /*\n mmr.setDataSource(filePath);\n String time = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);\n int VideoDuration = Integer.parseInt(time) * 1000;// This will give time in millesecond\n for (int ftime = 0; ftime < VideoDuration; ftime += 120000) {\n Bitmap b = mmr.getFrameAtTime(ftime, FFmpegMediaMetadataRetriever.OPTION_CLOSEST); // frame at 2 seconds\n byte[] artwork = mmr.getEmbeddedPicture();\n ftime = (ftime + 120000) % VideoDuration;\n\n Mat result = new Mat();\n Utils.bitmapToMat(b, result);\n videoArray.add(result);\n }\n //p.setDownloadFinish(true);\n\n */\n }\n }\n p.setVideoArray(videoArray);\n }\n }" ]
[ "0.6765168", "0.6629281", "0.65394175", "0.6379433", "0.6076767", "0.6025764", "0.59686905", "0.59216666", "0.5865124", "0.5813422", "0.5800829", "0.5732836", "0.56966466", "0.56699395", "0.5630639", "0.558473", "0.55743814", "0.55701345", "0.5557522", "0.55539924", "0.5528901", "0.5514308", "0.5470804", "0.5462001", "0.5461151", "0.54605776", "0.5442467", "0.5414884", "0.5381188", "0.5371217", "0.53598565", "0.5357623", "0.53533185", "0.5339837", "0.53009266", "0.52903676", "0.52892023", "0.52640283", "0.52489173", "0.52409405", "0.5236706", "0.5231084", "0.52151513", "0.52088", "0.52088", "0.5195419", "0.51779413", "0.51731086", "0.5166192", "0.5149502", "0.5142284", "0.5139704", "0.5123884", "0.51225495", "0.5110253", "0.5107618", "0.5100718", "0.50910556", "0.5075434", "0.5064385", "0.505421", "0.50524044", "0.50454146", "0.504486", "0.5042441", "0.5036514", "0.5026994", "0.50240666", "0.5022341", "0.50211614", "0.50185674", "0.49996692", "0.4984407", "0.49806607", "0.49781358", "0.49781358", "0.49766573", "0.4976395", "0.49425942", "0.49417037", "0.49402136", "0.4937686", "0.4932282", "0.49317786", "0.49224353", "0.49159896", "0.48982537", "0.48931065", "0.48892125", "0.4886322", "0.48833504", "0.4879767", "0.48697162", "0.4866364", "0.48648885", "0.48591506", "0.4841222", "0.48407573", "0.48392287", "0.48369125" ]
0.7519468
0
Requests video recording to another camClient
private void requestRecord() throws IOException { String targetCamCode = dis.readUTF(); Cam targetCam = CamRegister.findRegisteredCam(targetCamCode); try { DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream()); targetDos.writeInt(RECORD_CAM_COMMAND); targetDos.flush(); dos.writeInt(SUCCESS_CODE); dos.flush(); } catch (Exception e) { dos.writeInt(NOT_FOUND_CODE); dos.flush(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void sendVideoRecordingRequest() {\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n assert surfaceTexture != null;\n surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n\n try {\n\n // create request for RECORDING template\n /**\n * Create a request suitable for video recording. Specifically, this means\n * that a stable frame rate is used, and post-processing is set for\n * recording quality. These requests would commonly be used with the\n * {@link CameraCaptureSession#setRepeatingRequest} method.\n * This template is guaranteed to be supported on all camera devices except\n * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices\n * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE\n * BACKWARD_COMPATIBLE}.\n *\n * @see #createCaptureRequest\n */\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode);\n\n if (mPreviewEnabled) {\n // add Preview surface to target\n mCaptureRequestBuilder.addTarget(previewSurface);\n }\n\n // add Record surface to target\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n try {\n cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void recordVideo() {\n\n }", "private void recordCam() throws IOException, InterruptedException {\n\n VideoDataStream vds = new VideoDataStream(true);\n \n while (true) {\n try {\n if (dis.available() > 0) {\n vds.processFrame(dis);\n } else {\n //Writing bytes only to detect the socket closing\n dos.write(Byte.MIN_VALUE);\n }\n } catch (Exception ex) {\n CamRegister.removeCamClient(camClient);\n break;\n }\n sleep(20);\n }\n \n RecordStorage recordStorage = new RecordStorage();\n\n recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode());\n\n vds.cleanBuffer();\n }", "public void startVideoRecording() {\n this.mActivity.getCameraAppUI().switchShutterSlidingAbility(false);\n if (this.mCameraState == 1) {\n setCameraState(2);\n Tag tag = TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"startVideoRecording: \");\n stringBuilder.append(Thread.currentThread());\n Log.i(tag, stringBuilder.toString());\n ToastUtil.showToast(this.mActivity, this.mActivity.getString(R.string.video_recording_start_toast), 0);\n this.mAppController.onVideoRecordingStarted();\n if (this.mModeSelectionLockToken == null) {\n this.mModeSelectionLockToken = this.mAppController.lockModuleSelection();\n }\n this.mUI.showVideoRecordingHints(false);\n this.mUI.cancelAnimations();\n this.mUI.setSwipingEnabled(false);\n this.mUI.showFocusUI(false);\n this.mAppController.getCameraAppUI().hideRotateButton();\n this.mAppController.getButtonManager().hideEffectsContainerWrapper();\n final long updateStorageSpaceTime = System.currentTimeMillis();\n this.mActivity.updateStorageSpaceAndHint(new OnStorageUpdateDoneListener() {\n public void onStorageUpdateDone(long bytes) {\n Tag access$100 = VideoModule.TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"updateStorageSpaceAndHint cost time :\");\n stringBuilder.append(System.currentTimeMillis() - updateStorageSpaceTime);\n stringBuilder.append(\"ms.\");\n Log.d(access$100, stringBuilder.toString());\n if (VideoModule.this.mCameraState != 2) {\n VideoModule.this.pendingRecordFailed();\n return;\n }\n if (bytes <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {\n Log.w(VideoModule.TAG, \"Storage issue, ignore the start request\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mCameraDevice == null) {\n Log.v(VideoModule.TAG, \"in storage callback after camera closed\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mPaused) {\n Log.v(VideoModule.TAG, \"in storage callback after module paused\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mMediaRecorderRecording) {\n Log.v(VideoModule.TAG, \"in storage callback after recording started\");\n } else if (VideoModule.this.isSupported(VideoModule.this.mProfile.videoFrameWidth, VideoModule.this.mProfile.videoFrameHeight)) {\n VideoModule.this.mCurrentVideoUri = null;\n VideoModule.this.mCameraDevice.enableShutterSound(false);\n if (VideoModule.this.mNeedGLRender && VideoModule.this.isSupportEffects()) {\n VideoModule.this.playVideoSound();\n VideoModule.this.initGlRecorder();\n VideoModule.this.pauseAudioPlayback();\n VideoModule.this.mActivity.getCameraAppUI().startVideoRecorder();\n } else {\n VideoModule.this.initializeRecorder();\n if (VideoModule.this.mMediaRecorder == null) {\n Log.e(VideoModule.TAG, \"Fail to initialize media recorder\");\n VideoModule.this.pendingRecordFailed();\n return;\n }\n VideoModule.this.pauseAudioPlayback();\n try {\n long mediarecorderStart = System.currentTimeMillis();\n VideoModule.this.mMediaRecorder.start();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder2 = new StringBuilder();\n stringBuilder2.append(\"mMediaRecorder.start() cost time : \");\n stringBuilder2.append(System.currentTimeMillis() - mediarecorderStart);\n Log.d(access$100, stringBuilder2.toString());\n VideoModule.this.playVideoSound();\n VideoModule.this.mCameraDevice.refreshSettings();\n VideoModule.this.mCameraSettings = VideoModule.this.mCameraDevice.getSettings();\n VideoModule.this.setFocusParameters();\n } catch (RuntimeException e) {\n Log.e(VideoModule.TAG, \"Could not start media recorder. \", e);\n VideoModule.this.releaseMediaRecorder();\n VideoModule.this.mCameraDevice.lock();\n VideoModule.this.releaseAudioFocus();\n if (VideoModule.this.mModeSelectionLockToken != null) {\n VideoModule.this.mAppController.unlockModuleSelection(VideoModule.this.mModeSelectionLockToken);\n }\n VideoModule.this.setCameraState(1);\n if (VideoModule.this.shouldHoldRecorderForSecond()) {\n VideoModule.this.mAppController.setShutterEnabled(true);\n }\n VideoModule.this.mAppController.getCameraAppUI().showModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(true);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.onVideoRecordingStop();\n }\n ToastUtil.showToast(VideoModule.this.mActivity.getApplicationContext(), (int) R.string.video_record_start_failed, 0);\n return;\n }\n }\n VideoModule.this.mAppController.getCameraAppUI().setSwipeEnabled(false);\n VideoModule.this.setCameraState(3);\n VideoModule.this.tryLockFocus();\n VideoModule.this.mMediaRecorderRecording = true;\n VideoModule.this.mActivity.lockOrientation();\n VideoModule.this.mRecordingStartTime = SystemClock.uptimeMillis() + 600;\n VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().setAngle(VideoModule.this.mOrientation);\n VideoModule.this.mAppController.getCameraAppUI().hideModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(false);\n }\n if (VideoModule.this.isVideoShutterAnimationEnssential()) {\n VideoModule.this.mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoCaptureButton(true);\n }\n if (VideoModule.this.mAppController.getCameraAppUI().getCurrentModeIndex() == VideoModule.this.mActivity.getResources().getInteger(R.integer.camera_mode_video)) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoPauseButton(false);\n }\n VideoModule.this.mUI.showRecordingUI(true);\n if (VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().getVisibility() == 0) {\n VideoModule.this.mUI.hideCapButton();\n }\n VideoModule.this.showBoomKeyTip();\n VideoModule.this.updateRecordingTime();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder3 = new StringBuilder();\n stringBuilder3.append(\"startVideoRecording cost time 1 : \");\n stringBuilder3.append(System.currentTimeMillis() - VideoModule.this.mShutterButtonClickTime);\n Log.d(access$100, stringBuilder3.toString());\n if (VideoModule.this.isSendMsgEnableShutterButton()) {\n VideoModule.this.mHandler.sendEmptyMessageDelayed(6, VideoModule.MIN_VIDEO_RECODER_DURATION);\n }\n VideoModule.this.mActivity.enableKeepScreenOn(true);\n VideoModule.this.mActivity.startInnerStorageChecking(new OnInnerStorageLowListener() {\n public void onInnerStorageLow(long bytes) {\n VideoModule.this.mActivity.stopInnerStorageChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_storage_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n VideoModule.this.mActivity.startBatteryInfoChecking(new OnBatteryLowListener() {\n public void onBatteryLow(int level) {\n VideoModule.this.mActivity.stopBatteryInfoChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_battery_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n } else {\n Log.e(VideoModule.TAG, \"Unsupported parameters\");\n VideoModule.this.pendingRecordFailed();\n }\n }\n });\n }\n }", "public void startVideoRecording() {\n\n try {\n mVideoFileTest = createVideoFile(mVideoFolder);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // set up Recorder\n try {\n setupMediaRecorder();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // prepare for recording\n sendVideoRecordingRequest();\n\n // start recording\n mMediaRecorder.start();\n\n if (mRokidCameraRecordingListener != null) {\n mRokidCameraRecordingListener.onRokidCameraRecordingStarted();\n }\n }", "private void requestLiveStreaming() throws IOException {\n\n String targetCamCode = dis.readUTF();\n\n Cam targetCam = CamRegister.findRegisteredCam(targetCamCode);\n\n try {\n DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream());\n\n targetDos.writeInt(LIVE_STREAMING_COMMAND);\n targetDos.writeUTF(camClient.getCamCode());\n targetDos.flush();\n\n dos.writeInt(SUCCESS_CODE);\n dos.flush();\n\n } catch (Exception e) {\n e.printStackTrace();\n dos.writeInt(NOT_FOUND_CODE);\n dos.flush();\n }\n }", "protected void encodeWithMediaRecorder() throws IOException {\n\t\t// Opens the camera if needed\n\t\tcreateCamera();\n\n\t\t// Stops the preview if needed\n\t\tif (mPreviewStarted) {\n\t\t\tlockCamera();\n\t\t\ttry {\n\t\t\t\tmCamera.stopPreview();\n\t\t\t} catch (Exception e) {}\n\t\t\tmPreviewStarted = false;\n\t\t}\n\n\t\t// Unlock the camera if needed\n\t\tunlockCamera();\n\n\t\tmMediaRecorder = new MediaRecorder();\n\t\tinitRecorderParameters();\n\n\t\t// We write the ouput of the camera in a local socket instead of a file !\t\t\t\n\t\t// This one little trick makes streaming feasible quiet simply: data from the camera\n\t\t// can then be manipulated at the other end of the socket\n\t\tmMediaRecorder.setOutputFile(mPacketizer.getWriteFileDescriptor());\n\n\t\t// Set event listener\n\t\tmMediaRecorder.setOnInfoListener(new MediaRecorder.OnInfoListener() {\n\t\t\t@Override\n\t\t\tpublic void onInfo(MediaRecorder mr, int what, int extra) {\n\t\t\t\tswitch (what) {\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_UNKNOWN:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_UNKNOWN, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_MAX_DURATION_REACHED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED:\n\t\t\t\t\t\tLog.i(TAG, \"MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tmMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {\n\t\t\t@Override\n\t\t\tpublic void onError(MediaRecorder mr, int what, int extra) {\n\t\t\t\tswitch (what) {\n\t\t\t\t\tcase MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN:\n\t\t\t\t\t\tLog.e(TAG, \"MEDIA_RECORDER_ERROR_UNKNOWN, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase MediaRecorder.MEDIA_ERROR_SERVER_DIED:\n\t\t\t\t\t\tLog.e(TAG, \"MEDIA_ERROR_SERVER_DIED, \" + extra);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttry {\n\t\t\tmMediaRecorder.prepare();\n\t\t\tmMediaRecorder.start();\n\n\t\t\t// mReceiver.getInputStream contains the data from the camera\n\t\t\t// the mPacketizer encapsulates this stream in an RTP stream and send it over the network\n\t\t\tmPacketizer.start();\n\t\t\tmStreaming = true;\n\t\t} catch (IOException e) {\n\t\t\tLog.e(TAG, \"encodeWithMediaRecorder exception\", e);\n\t\t\tstop();\n\t\t\tthrow new IOException(\"Something happened with the local sockets :/ Start failed !\");\n\t\t} catch (IllegalStateException e) {\n\t\t\tLog.e(TAG, \"encodeWithMediaRecorder exception\", e);\n\t\t\tthrow e;\n\t\t}\n\n\t}", "private void liveStreaming() throws IOException, InterruptedException {\n\n CamStreaming camStreaming = new CamStreaming();\n VideoDataStream vds = new VideoDataStream(true);\n byte[] frame;\n\n if (camStreaming.prepareStream(in)) {\n\n while (camStreaming.isTargetConnected()) {\n try {\n\n if (dis.available() > 0) {\n frame = vds.processFrame(dis);\n camStreaming.sendData(frame);\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n break;\n }\n sleep(20);\n }\n \n dos.writeInt(END_OF_STREAM_CODE);\n dos.flush();\n \n// CamRegister.removeCamClient(camClient);\n \n RecordStorage recordStorage = new RecordStorage();\n\n recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode());\n\n vds.cleanBuffer();\n\n }\n\n }", "public Connection invoke(final PeerClient remoteClient) {\n final RemoteMedia remoteMedia = new RemoteMedia(context, enableH264, !enableAudioReceive, !enableVideoReceive, aecContext);\n final AudioStream audioStream = new AudioStream(enableAudioSend ? localMedia.getAudioTrack().getOutputs() : null, enableAudioReceive ? remoteMedia.getAudioTrack().getInputs() : null);\n final VideoStream videoStream = new VideoStream(enableVideoSend ? localMedia.getVideoTrack().getOutputs() : null, enableVideoReceive ? remoteMedia.getVideoTrack().getInputs() : null);\n\n final Connection connection;\n\n // Add the remote view to the layout.\n layoutManager.addRemoteView(remoteMedia.getId(), remoteMedia.getView());\n\n mediaTable.put(remoteMedia.getView(), remoteMedia);\n fragment.registerForContextMenu(remoteMedia.getView());\n remoteMedia.getView().setOnTouchListener(fragment);\n\n if (enableDataChannel) {\n DataChannel channel = new DataChannel(\"mydatachannel\") {{\n setOnReceive(new IAction1<DataChannelReceiveArgs>() {\n @Override\n public void invoke(DataChannelReceiveArgs dataChannelReceiveArgs) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 1 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n textListener.onReceivedText(ProviderName, dataChannelReceiveArgs.getDataString());\n }\n });\n\n addOnStateChange(new IAction1<DataChannel>() {\n @Override\n public void invoke(DataChannel dataChannel) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 2 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n if (dataChannel.getState() == DataChannelState.Connected) {\n synchronized (channelLock)\n {\n dataChannels.add(dataChannel);\n }\n textListener.onPeerJoined(ProviderName);\n } else if (dataChannel.getState() == DataChannelState.Closed || dataChannel.getState() == DataChannelState.Failed) {\n synchronized (channelLock)\n {\n dataChannels.remove(dataChannel);\n }\n\n textListener.onPeerLeft(ProviderName);\n }\n }\n });\n }};\n\n DataStream dataStream = new DataStream(channel);\n connection = new Connection(new Stream[]{audioStream, videoStream, dataStream});\n } else {\n connection = new Connection(new Stream[]{audioStream, videoStream});\n }\n\n connection.setIceServers(iceServers);\n\n connection.addOnStateChange(new fm.icelink.IAction1<Connection>() {\n public void invoke(Connection c) {\n // Remove the remote view from the layout.\n if (c.getState() == ConnectionState.Closing ||\n c.getState() == ConnectionState.Failing) {\n if (layoutManager.getRemoteView(remoteMedia.getId()) != null) {\n layoutManager.removeRemoteView(remoteMedia.getId());\n remoteMedia.destroy();\n }\n }\n }\n });\n\n return connection;\n }", "public CameraSet(Controls controls, String devpath1, String devpath2) {\n this.controls = controls;\n this.cam1 = CameraServer.getInstance().startAutomaticCapture(\"Back\", devpath2);\n this.cam2 = CameraServer.getInstance().startAutomaticCapture(\"Front\", devpath1);\n\n// cam1.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n// cam2.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n\n outputStream = CameraServer.getInstance().putVideo(\"camera_set\", (int) (multiplier * 160), (int) (multiplier * 120));\n source = new Mat();\n\n }", "public void startStreaming() {\n// phoneCam.setViewportRenderingPolicy(OpenCvCamera.ViewportRenderingPolicy.OPTIMIZE_VIEW);\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.SIDEWAYS_RIGHT);\n }", "private void startRecord() {\n try {\n if (mIsRecording) {\n setupMediaRecorder();\n } else if (mIsTimelapse) {\n setupTimelapse();\n }\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n surfaceTexture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n mCaptureRequestBuilder.addTarget(previewSurface);\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface, mImageReader.getSurface()),\n new CameraCaptureSession.StateCallback() {\n\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n\n mRecordCaptureSession = session;\n\n try {\n mRecordCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession session) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void handleRecButtonOnPressed() {\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM, true);\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC, true);\n ((AudioManager) AppDelegate.getAppContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING, true);\n AudioManager audioMgr = ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE));\n\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n //updateMessage();\n if (timerCounter != null) {\n timerCounter.cancel();\n timerCounter = null;\n }\n\n if (isCameraRecording) {\n\n isCameraRecording = false;\n mStartRecordingButton.setChecked(false);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.GONE);\n disableAuthorityAlertedText();\n\n cameraView.stopRecording();\n\n // Control view group\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n\n toolBarTitle.setText(dateFormat.format(new Date(userPreferences.recordTime() * 1000)));\n handler.removeCallbacksAndMessages(null);\n handler.removeCallbacks(counterMessage);\n counterMessage = null;\n\n //VIDEO FINISHING ALERT\n CommonAlertDialog dialog = new CommonAlertDialog(getActivity(), mAlertDialogButtonClickListerer); // Setting dialogview\n dialog.show();\n\n } else {\n\n userPreferences.setEventId(UUID.randomUUID().toString());\n isCameraRecording = true;\n\n mStartRecordingButton.setChecked(true);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.VISIBLE);\n cameraView.setVisibility(View.VISIBLE);\n\n if (cacheFolder == null) {\n cacheFolder = new FwiCacheFolder(AppDelegate.getAppContext(), String.format(\"%s/%s\", userPreferences.currentProfileId(), userPreferences.eventId()));\n cameraView.setDelegate(this);\n cameraView.setCacheFolder(cacheFolder);\n }\n\n this.startRecording();\n\n }\n if (userPreferences.enableTorch()) {\n isenableTourch = true;\n cameraView.torchOn();\n }\n\n }", "protected void startVideoCall() {\n if (!EMClient.getInstance().isConnected())\n Toast.makeText(ChatDetailsActivity.this, R.string.not_connect_to_server, Toast.LENGTH_SHORT).show();\n else {\n startActivity(new Intent(ChatDetailsActivity.this, VideoCallActivity.class).putExtra(\"username\", mBean.getMobile())\n .putExtra(\"isComingCall\", false).putExtra(\"nickname\", mBean.getUser_nickname()));\n // videoCallBtn.setEnabled(false);\n// inputMenu.hideExtendMenuContainer();\n }\n }", "public void setVideoDevice(String id);", "private void initCaptureSetting(GLSurfaceView preview, FrameLayout window, GLSurfaceView remote) {\n RTCMediaStreamingManager.init(getApplicationContext());\n\n /**\n * Step 2: find & init views\n */\n\n /**\n * Step 3: config camera settings\n */\n CameraStreamingSetting.CAMERA_FACING_ID facingId = chooseCameraFacingId();\n if (mCameraStreamingSetting == null) {\n mCameraStreamingSetting = new CameraStreamingSetting();\n }\n mCameraStreamingSetting.setCameraFacingId(facingId)\n .setContinuousFocusModeEnabled(true)\n .setRecordingHint(false)\n .setResetTouchFocusDelayInMs(3000)\n .setFocusMode(CameraStreamingSetting.FOCUS_MODE_CONTINUOUS_PICTURE)\n .setCameraPrvSizeLevel(CameraStreamingSetting.PREVIEW_SIZE_LEVEL.MEDIUM)\n .setCameraPrvSizeRatio(CameraStreamingSetting.PREVIEW_SIZE_RATIO.RATIO_16_9)\n .setBuiltInFaceBeautyEnabled(true) // Using sdk built in face beauty algorithm\n .setFaceBeautySetting(new CameraStreamingSetting.FaceBeautySetting(0.8f, 0.8f, 0.6f)) // sdk built in face beauty settings\n .setVideoFilter(CameraStreamingSetting.VIDEO_FILTER_TYPE.VIDEO_FILTER_BEAUTY); // set the beauty on/off\n mCurrentCamFacingIndex = facingId.ordinal();\n\n /**\n * Step 4: create streaming manager and set listeners\n */\n if (mRTCStreamingManager == null) {\n mRTCStreamingManager = new RTCMediaStreamingManager(getApplicationContext(),\n preview, AVCodecType.SW_VIDEO_WITH_SW_AUDIO_CODEC);\n mRTCStreamingManager.prepare(mCameraStreamingSetting, null);\n }\n mRTCStreamingManager.setConferenceStateListener(mRTCStreamingStateChangedListener);\n mRTCStreamingManager.setRemoteWindowEventListener(mRTCRemoteWindowEventListener);\n mRTCStreamingManager.setUserEventListener(mRTCUserEventListener);\n mRTCStreamingManager.setDebugLoggingEnabled(false);\n mRTCStreamingManager.mute(true);\n\n /**\n * Step 5: set conference options\n */\n RTCConferenceOptions confOptions = new RTCConferenceOptions();\n // vice anchor can use a smaller size\n // RATIO_4_3 & VIDEO_ENCODING_SIZE_HEIGHT_240 means the output size is 320 x 240\n // 4:3 looks better in the mix frame\n confOptions.setVideoEncodingSizeRatio(RTCConferenceOptions.VIDEO_ENCODING_SIZE_RATIO.RATIO_4_3);\n confOptions.setVideoEncodingSizeLevel(RTCConferenceOptions.VIDEO_ENCODING_SIZE_HEIGHT_240);\n // vice anchor can use a higher conference bitrate for better image quality\n confOptions.setVideoBitrateRange(300 * 1000, 800 * 1000);\n // 20 fps is enough\n confOptions.setVideoEncodingFps(20);\n confOptions.setHWCodecEnabled(false);\n mRTCStreamingManager.setConferenceOptions(confOptions);\n\n /**\n * Step 6: create the remote windows\n */\n if (mRTCVideoWindow == null) {\n mRTCVideoWindow = new RTCVideoWindow(window, remote);\n\n /**\n * Step 8: add the remote windows\n */\n mRTCStreamingManager.addRemoteWindow(mRTCVideoWindow);\n }\n\n /**\n * Step 9: do prepare, anchor should config streaming profile first\n */\n StreamingProfile mStreamingProfile = new StreamingProfile();\n mStreamingProfile.setEncodingOrientation(\n isLandscape() ? StreamingProfile.ENCODING_ORIENTATION.LAND : StreamingProfile.ENCODING_ORIENTATION.PORT);\n mRTCStreamingManager.setStreamingProfile(mStreamingProfile);\n }", "public void setVideoPort(int port);", "public void run() {\n\n\n if (videoFile != null) {\n //\n // Add Image to Photos Gallery\n //\n //final Uri uri = addMediaToGallery(mInscribedVideoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //final Uri uri = addMediaToGallery(videoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //Log.e(TAG, \"uri--->\" + uri.getPath());\n\n //\n // Create a media bean and set the copyright for server flags\n //\n String media_id = \"\";\n try {\n media_id = copyrightJsonObject.getString(\"media_id\");\n copyrightJsonObject.put(\"applyCopyrightOnServer\", 1);\n copyrightJsonObject.put(\"device_id\", SessionManager.getInstance().getDevice_id());\n copyrightJsonObject.put(\"device_type\", Common.DEVICE_TYPE);\n } catch (JSONException e) {\n // this shouldn't occur\n Log.e(TAG, \"JSONException trying to get media_id from copyright!\");\n }\n String mediaName = ImageUtils.getInstance()\n .getImageNameFromPath(videoFile.getAbsolutePath());\n GalleryBean media = new GalleryBean(videoFile.getAbsolutePath(),\n mediaName,\n \"video\",\n media_id,\n false,\n thumbnail,\n GalleryBean.GalleryType.NOT_SYNC);\n media.setDeviceId(SessionManager.getInstance().getDevice_id());\n media.setDeviceType(Common.DEVICE_TYPE);\n String mediaNamePrefix = mediaName.substring(0,\n mediaName.lastIndexOf('.'));\n media.setMediaNamePrefix(mediaNamePrefix);\n media.setMediaThumbBitmap(thumbnail);\n media.setLocalMediaPath(videoFile.getAbsolutePath());\n Date date = new Date();\n media.setMediaDate(date.getTime());\n //String mimeType = getContentResolver().getType(uri);\n media.setMimeType(\"video/mp4\"); // must be set for Amazon.\n media.setCopyright(copyrightJsonObject.toString());\n\n MemreasTransferModel transferModel = new MemreasTransferModel(\n media);\n transferModel.setType(MemreasTransferModel.Type.UPLOAD);\n QueueAdapter.getInstance().getSelectedTransferModelQueue()\n .add(transferModel);\n\n // Start the service if it's not running...\n startQueueService();\n } else {\n //\n // Show Toast error occurred here...\n //\n videoFile.delete();\n }\n\n }", "public String getVideoDevice();", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "public interface CameraVideoListener {\n void onVideoRecordStarted(Size videoSize);\n\n void onVideoRecordStopped(File videoFile, CameraFragmentResultListener callback);\n\n void onVideoRecordError();\n}", "private void gotRemoteStream(MediaStream stream) {\n //we have remote video stream. add to the renderer.\n final VideoTrack videoTrack = stream.videoTracks.get(0);\n if (mEventUICallBack != null) {\n mEventUICallBack.showVideo(videoTrack);\n }\n// runOnUiThread(() -> {\n// try {\n// binding.remoteGlSurfaceView.setVisibility(View.VISIBLE);\n// videoTrack.addSink(binding.remoteGlSurfaceView);\n// } catch (Exception e) {\n// e.printStackTrace();\n// }\n// });\n }", "public synchronized void startVideoRecorder(File outputFile) throws IOException {\n if ( mCamera == null ) {\n throw new IllegalStateException(\"Camera wasn't initialized\");\n }\n if ( outputFile == null ) {\n throw new IllegalStateException(\"Output file is null\");\n }\n mCamera.unlock();\n mRecorder = new MediaRecorder();\n mRecorder.setCamera(mCamera);\n mRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);\n mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n /**\n * \n * Set the video output format and encoding. For Android 2.2 (API Level 8) and higher, use the MediaRecorder.setProfile method, \n * and get a profile instance using CamcorderProfile.get(). \n * setOutputFile() - Set the output file, use getOutputMediaFile(MEDIA_TYPE_VIDEO).toString() from the example method in the Saving Media Files section.\n * setPreviewDisplay() - Specify the SurfaceView preview layout element for your application. Use the same object you specified for Connect Preview.\n * Caution: You must call these MediaRecorder configuration methods in this order, otherwise your application will encounter errors and the recording will fail.\n * Prepare MediaRecorder - Prepare the MediaRecorder with provided configuration settings by calling MediaRecorder.prepare().\n * Start MediaRecorder - Start recording video by calling MediaRecorder.start().\n */\n mRecorder.setProfile( mInitializer.getProfile() );\n mRecorder.setOutputFile(outputFile.getAbsolutePath());\n mRecorder.setPreviewDisplay(mPreviewHolder.getSurface());\n mRecorder.prepare();\n mRecorder.start();\n }", "public MentorConnectRequestCompose addVideo()\n\t{\n\t\tmentorConnectRequestObjects.videoButton.click();\n\t\tmentorConnectRequestObjects.videoURLField.sendKeys(mentorConnectRequestObjects.videoURL);\n\t\tmentorConnectRequestObjects.postVideoButton.click();\n\t\treturn new MentorConnectRequestCompose(driver);\n\t}", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t\n if (isRecording) {\n \tLog.i(\"DEbuging cam act\", \"In isRecording\");\n // stop recording and release camera\n mMediaRecorder.stop(); // stop the recording\n tts= new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {\n \t @Override\n \t public void onInit(int status) {\n \t if(status != TextToSpeech.ERROR) {\n \t tts.setLanguage(Locale.UK);\n \t \t \n \t tts.speak(\"Recording stopped\", TextToSpeech.QUEUE_FLUSH, null);\n \t }\n \t }\n \t });\n\n releaseMediaRecorder(); // release the MediaRecorder object\n mCamera.lock(); // take camera access back from MediaRecorder\n\n // TODO inform the user that recording has stopped \n isRecording = false;\n releaseCamera();\n mediaMetadataRetriever.setDataSource(opFile); \n r = new Runnable() { \t\n \t\t\t\n \t\t\t@Override\n \t\t\tpublic void run() {\n \t\t\t\tLog.i(\"DEbuging cam act\", \"In runable\");\n \t\t\t\t//To call this thread periodically: handler.postDelayed(this, 2000);\n \t\t\t\t//getFrmAtTime has microsec as parameter n postDelayed has millisec \t\t\t\t\n \t\t\t\t//Bitmap tFrame[];\n \t\t\t\t\n \t\t\t\t\n \t\t\t\tString duration = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);\n \t\t\t\tframe.add(mediaMetadataRetriever.getFrameAtTime(time));\n \t\t\t\t/*int videoDuration = Integer.parseInt(duration);\n \t\t\t\tSystem.out.println(videoDuration);\n \t\t\t\twhile(time<videoDuration) {\n \t\t\t\t\tframe.add(mediaMetadataRetriever.getFrameAtTime(time)); \t\t\t\t\t\n \t\t\t\ttime=time+1000;\n \t\t\t\t}*/\n \t\t\t\t/*SendToServer sts = new SendToServer(frame);\n \t\t\t\tsts.connectToServer();*/\n \t\t\t\tConnectServer connectServer = new ConnectServer(frame);\n \t\t\t\tconnectServer.execute();\n \t\t\t\t\n \t\t\t}\n\n\t\t\t\t\t\t\n \t\t};\n\t\t\t\t\tr.run();\n \n } else {\n // initialize video camera\n if (prepareVideoRecorder()) {\n // Camera is available and unlocked, MediaRecorder is prepared,\n // now you can start recording \t\n mMediaRecorder.start(); \n //TODO inform the user that recording has started \n isRecording = true;\n tts= new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {\n \t @Override\n \t public void onInit(int status) {\n \t if(status != TextToSpeech.ERROR) {\n \t tts.setLanguage(Locale.UK);\n \t \t \n \t tts.speak(\"Started. Click Anywhere to stop recording\", TextToSpeech.QUEUE_FLUSH, null);\n \t }\n \t }\n \t });\n \n } else {\n // prepare didn't work, release the camera\n releaseMediaRecorder();\n // inform user\n }\n }\n\t\t\t}", "public void onVideoStarted () {}", "public static VideoSource startCamera(CameraConfig config) {\n System.out.println(\"Starting camera '\" + config.name + \"' on \" + config.path);\n CameraServer inst = CameraServer.getInstance();\n UsbCamera camera = new UsbCamera(config.name, config.path);\n MjpegServer server = inst.startAutomaticCapture(camera);\n\n Gson gson = new GsonBuilder().create();\n\n camera.setConfigJson(gson.toJson(config.config));\n camera.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n\n if (config.streamConfig != null) {\n server.setConfigJson(gson.toJson(config.streamConfig));\n }\n\n return camera;\n }", "public void runMultiWebcam()\n\t{\n\t\tString pipeline=\"gst-launch-1.0 -v v4l2src device=\"+webcamSource+\" ! 'video/x-raw,width=640,height=480' ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! multiudpsink clients=\"+client.getInetAddress().getHostAddress()+\":\"+port1+\",\"+client.getInetAddress().getHostAddress()+\":\"+port2;\n\n\t\tString[] args1 = new String[] {\"/bin/bash\", \"-c\", pipeline+\">src/output.txt\"};\n\t\ttry {\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tProcess proc = new ProcessBuilder(args1).start();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\ttry {\n\t\t\tThread.sleep(2000);\n\t\t} catch (InterruptedException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "@Override\n public void onReceive(Context context, Intent intent) {\n Toast.makeText(VideoDetailsActivity.this,\"Reciever fot the result. Do some processing bro\",Toast.LENGTH_LONG).show();\n mVideoView.setVideoURI();\n }", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}", "public void addCameraServer(String name, int framerate) {\n this.maxcount = (framerate < 50) ? 50 / framerate : 1;\n server = CameraServer.getInstance().putVideo(name, 315, 207);\n serverStarted = true;\n }", "protected void startPreview() {\n if (null == mCameraDevice || !mTextureView.isAvailable()) {\n return;\n }\n try {\n //\n // Media Recorder\n //\n setUpMediaRecorder();\n\n //\n // Preview Builder - Video Recording\n //\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n\n //\n // Surfaces: Preview and Record\n //\n List<Surface> surfaces = new ArrayList<>();\n\n //\n // Preview Surface\n //\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n texture.setDefaultBufferSize(screenWidth, screenHeight);\n Surface previewSurface = new Surface(texture);\n surfaces.add(previewSurface);\n mPreviewBuilder.addTarget(previewSurface);\n\n\n //\n // Record Surface\n //\n Surface recorderSurface = mMediaRecorder.getSurface();\n surfaces.add(recorderSurface);\n mPreviewBuilder.addTarget(recorderSurface);\n\n //\n // Setup Capture Session\n //\n mCameraDevice.createCaptureSession(surfaces, new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigured(CameraCaptureSession cameraCaptureSession) ...\");\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onSurfacePrepared(CameraCaptureSession session, Surface surface) {\n Log.e(TAG, \"onSurfacePrepared(CameraCaptureSession session, Surface surface) ...\");\n //previewView = (LinearLayout) findViewById(R.id.camera_preview);\n //previewView.addView(mVideoCapture.mTextureView);\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigureFailed(CameraCaptureSession cameraCaptureSession) ...\");\n Toast.makeText(mCameraActivity, \"failed to configure video camera\", Toast.LENGTH_SHORT).show();\n onBackPressed();\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void recordVideoUsingCamera(\n Camera camera, String fileName, int durMs, boolean timelapse) throws Exception {\n Camera.Parameters params = camera.getParameters();\n int frameRate = params.getPreviewFrameRate();\n\n camera.unlock();\n mMediaRecorder.setCamera(camera);\n mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);\n mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);\n mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);\n mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);\n mMediaRecorder.setVideoFrameRate(frameRate);\n mMediaRecorder.setVideoSize(VIDEO_WIDTH, VIDEO_HEIGHT);\n mMediaRecorder.setPreviewDisplay(mActivity.getSurfaceHolder().getSurface());\n mMediaRecorder.setOutputFile(fileName);\n mMediaRecorder.setLocation(LATITUDE, LONGITUDE);\n final double captureRate = VIDEO_TIMELAPSE_CAPTURE_RATE_FPS;\n if (timelapse) {\n mMediaRecorder.setCaptureRate(captureRate);\n }\n\n mMediaRecorder.prepare();\n mMediaRecorder.start();\n Thread.sleep(durMs);\n mMediaRecorder.stop();\n assertTrue(mOutFile.exists());\n\n int targetDurMs = timelapse? ((int) (durMs * (captureRate / frameRate))): durMs;\n boolean hasVideo = true;\n boolean hasAudio = timelapse? false: true;\n checkTracksAndDuration(targetDurMs, hasVideo, hasAudio, fileName);\n }", "public void startRecording() {\n // prepare the recorder\n if (!prepareMediaRecorder()) {\n Toast.makeText(VideoCapture.getSelf(), \"Fail in prepareMediaRecorder()!\\n - Ended -\",\n Toast.LENGTH_LONG).show();\n VideoCapture.getSelf().finish();\n }\n\n // start the recording\n mediaRecorder.start();\n mIsRecording = true;\n\n // start snapshots\n mSnapshotSensor.startSnapshot();\n }", "void addVideoListener(CallPeer peer, VideoListener listener);", "public void onVideoRecordingStarted() {\n this.mUI.unlockCaptureView();\n }", "@Override\n public void onServerStart(String videoStreamUrl)\n {\n\n\n\n Log.d(\"Activity\",\"URL: \"+ videoStreamUrl);\n\n\n video = (VideoView)findViewById(R.id.video);\n\n Uri uri = Uri.parse(videoStreamUrl);\n video.setVideoURI(uri);\n video.start();\n\n\n\n }", "public void enableVideoCapture(boolean enable);", "private void toggleScreenShare(View v) {\n\n if(((ToggleButton)v).isChecked()){\n initRecorder();\n recordScreen();\n }\n else\n {\n mediaRecorder.stop();\n mediaRecorder.reset();\n stopRecordScreen();\n\n //play in videoView\n //videoView.setVisibility(View.VISIBLE);\n //videoView.setVideoURI(Uri.parse(videoUri));\n //videoView.start();\n\n\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setTitle(\" Location of video : \");\n builder.setMessage(videoUri);\n builder.show();\n\n Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n Intent i = new Intent(MainActivity.this, PlayVideo.class);\n i.putExtra(\"KEY\", videoUri);\n //Toast.makeText(this, videoUri, Toast.LENGTH_SHORT).show();\n startActivity(i);\n }\n }, 2000);\n Toast.makeText(this, \"Loading video...\", Toast.LENGTH_SHORT).show();\n\n\n\n }\n }", "@TargetApi(Build.VERSION_CODES.LOLLIPOP)\n private void startScreenRecord(final Intent intent) {\n if (DEBUG) {\n Log.v(TAG, \"startScreenRecord:sMuxer=\" + sMuxer);\n }\n synchronized (sSync) {\n if (sMuxer == null) {\n\n videoEncodeConfig = (VideoEncodeConfig) intent.getSerializableExtra(EXTRA_VIDEO_CONFIG);\n audioEncodeConfig = (AudioEncodeConfig) intent.getSerializableExtra(EXTRA_AUDIO_CONFIG);\n\n final int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, 0);\n // get MediaProjection\n final MediaProjection projection = mMediaProjectionManager.getMediaProjection(resultCode, intent);\n if (projection != null) {\n\n int width = videoEncodeConfig.width;\n int height = videoEncodeConfig.height;\n final DisplayMetrics metrics = getResources().getDisplayMetrics();\n\n if (videoEncodeConfig.width == 0 || videoEncodeConfig.height == 0) {\n width = metrics.widthPixels;\n height = metrics.heightPixels;\n }\n if (width > height) {\n // 横長\n final float scale_x = width / 1920f;\n final float scale_y = height / 1080f;\n final float scale = Math.max(scale_x, scale_y);\n width = (int) (width / scale);\n height = (int) (height / scale);\n } else {\n // 縦長\n final float scale_x = width / 1080f;\n final float scale_y = height / 1920f;\n final float scale = Math.max(scale_x, scale_y);\n width = (int) (width / scale);\n height = (int) (height / scale);\n }\n if (DEBUG) {\n Log.v(TAG, String.format(\"startRecording:(%d,%d)(%d,%d)\", metrics.widthPixels, metrics.heightPixels, width, height));\n }\n\n try {\n sMuxer = new MediaMuxerWrapper(this, \".mp4\"); // if you record audio only, \".m4a\" is also OK.\n if (true) {\n // for screen capturing\n new MediaScreenEncoder(sMuxer, mMediaEncoderListener,\n projection, width, height, metrics.densityDpi, videoEncodeConfig.bitrate * 1000, videoEncodeConfig.framerate);\n }\n if (true) {\n // for audio capturing\n new MediaAudioEncoder(sMuxer, mMediaEncoderListener);\n }\n sMuxer.prepare();\n sMuxer.startRecording();\n } catch (final IOException e) {\n Log.e(TAG, \"startScreenRecord:\", e);\n }\n }\n }\n }\n }", "private void rewardedAds() {\n Log.d(TAG, \"rewardedAds invoked\");\n final RequestCallback requestCallback = new RequestCallback() {\n\n @Override\n public void onAdAvailable(Intent intent) {\n // Store the intent that will be used later to show the video\n rewardedVideoIntent = intent;\n Log.d(TAG, \"RV: Offers are available\");\n showRV.setEnabled(true);\n Toast.makeText(MainActivity.this, \"RV: Offers are available \", Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onAdNotAvailable(AdFormat adFormat) {\n // Since we don't have an ad, it's best to reset the video intent\n rewardedVideoIntent = null;\n Log.d(TAG, \"RV: No ad available \");\n Toast.makeText(MainActivity.this, \"RV: No ad available \", Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onRequestError(RequestError requestError) {\n // Since we don't have an ad, it's best to reset the video intent\n rewardedVideoIntent = null;\n Log.d(TAG, \"RV: Something went wrong with the request: \" + requestError.getDescription());\n Toast.makeText(MainActivity.this, \"RV: Something went wrong with the request: \", Toast.LENGTH_SHORT).show();\n }\n };\n\n final Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n RewardedVideoRequester.create(requestCallback)\n .request(MainActivity.this);\n Log.d(TAG, \"RV request: added delay of 5 secs\");\n Toast.makeText(MainActivity.this, \"RV Request: delay of 5 secs\", Toast.LENGTH_SHORT).show();\n }\n }, 5000);\n }", "public void startCamera()\n \t{\n\t\t// start the video capture\n\t\t//this.capture.open(0);\n\t\tcapture.open(cameraNumber);\n\n\n\n\t\t// is the video stream available?\n\t\tif (capture.isOpened())\n\t\t{\n\t\t\t// grab a frame every 33 ms (30 frames/sec)\n\t\t\tRunnable frameGrabber = new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run()\n\t\t\t\t{\n\t\t\t\t\tgrabFrame();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimer = Executors.newSingleThreadScheduledExecutor();\n\t\t\ttimer.scheduleAtFixedRate(frameGrabber, 0, 500, TimeUnit.MILLISECONDS);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// log the error\n\t\t\tSystem.err.println(\"Impossible to open the camera connection...\");\n\t\t}\n \t}", "private void startRecording() {\n\n }", "public void mo752v() throws RemoteException {\n Parcel obtain = Parcel.obtain();\n Parcel obtain2 = Parcel.obtain();\n try {\n obtain.writeInterfaceToken(\"android.support.v4.media.session.IMediaSession\");\n this.f822a.transact(21, obtain, obtain2, 0);\n obtain2.readException();\n } finally {\n obtain2.recycle();\n obtain.recycle();\n }\n }", "void onCaptureStarted(CaptureRequest request, long timestamp, long frameNumber);", "@Override\n public void receiveFrameDataForMediaCodec(Camera camera, int avChannel, byte[] buf, int length, int pFrmNo, byte[] pFrmInfoBuf, boolean\n isIframe, int codecId) {\n\n }", "private VideoCapturer getVideoCapturer(String cameraFacing) {\n int[] cameraIndex = { 0, 1 };\n int[] cameraOrientation = { 0, 90, 180, 270 };\n for (int index : cameraIndex) {\n for (int orientation : cameraOrientation) {\n String name = \"Camera \" + index + \", Facing \" + cameraFacing +\n \", Orientation \" + orientation;\n VideoCapturer capturer = VideoCapturer.create(name);\n if (capturer != null) {\n return capturer;\n }\n }\n }\n throw new RuntimeException(\"Failed to open capturer\");\n }", "private void getVideo() {\n // create the url\n String temp = movie.getId().toString();\n String url = API_BASE_URL+\"/movie/\"+temp+\"/videos\";\n // set the request parameters\n RequestParams params = new RequestParams();\n params.put(API_KEY_PARAM, getString(R.string.api_key)); // Always needs API key\n // request a GET response expecting a JSON object response\n\n client.get(url,params, new JsonHttpResponseHandler() {\n\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONObject response) {\n // load the results into movies list\n\n try {\n JSONArray results = response.getJSONArray(\"results\");\n JSONObject curMovie = results.getJSONObject(0);\n key = curMovie.getString(\"key\");\n\n } catch (JSONException e) {\n logError(\"Failed to parse play_video endpoint\", e, true);\n }\n\n\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {\n logError(\"Failed to get data from Now_playing endpoint\", throwable, true);\n }\n });\n\n }", "public void setPlayer(int sessionId) {\n try {\n mVisualizer = new Visualizer(sessionId);\n mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);\n mVisualizer.setDataCaptureListener(new Visualizer.OnDataCaptureListener() {\n @Override\n public void onWaveFormDataCapture(Visualizer visualizer, byte[] waveform, int samplingRate) {\n Log.d(TAG, \"onWaveFormDataCapture: \" + waveform.length);\n mBytes = waveform;\n invalidate();\n }\n\n @Override\n public void onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) {\n }\n }, Visualizer.getMaxCaptureRate() / 2, true, false);\n mVisualizer.setEnabled(true);\n } catch (Exception e) {\n Log.e(TAG, \"setPlayer Error: \" + e.toString());\n }\n\n\n }", "private void setVideo(){\n /* if(detailsBean==null){\n showToast(\"没有获取到信息\");\n return;\n }\n UserManager.getInstance().setDetailsBean(detailsBean);\n upCallShowSetVideoData = new UpCallShowSetVideoData();\n upCallShowSetVideoData.smobile = Preferences.getString(Preferences.UserMobile,null);\n upCallShowSetVideoData.iringid = detailsBean.iringid;\n if (callShowSetVideoProtocol == null) {\n callShowSetVideoProtocol = new CallShowSetVideoProtocol(null, upCallShowSetVideoData, handler);\n callShowSetVideoProtocol.showWaitDialog();\n }\n callShowSetVideoProtocol.stratDownloadThread(null, ServiceUri.Spcl, upCallShowSetVideoData, handler,true);*/\n }", "public interface IDetectionManager {\n /**\n * Interface used for get and change a capture request.\n */\n public interface IDetectionListener {\n /**\n * Get the current repeating request type {@link RequestType}.\n *\n * @return The current type of capture request.\n */\n public RequestType getRepeatingRequestType();\n\n /**\n * Request change capture request.\n *\n * @param sync\n * Whether should respond this request immediately, true request\n * immediately,false wait all requests been submitted and remove the same request\n * current design is only for\n * {@link ISettingChangedListener#onSettingChanged(java.util.Map)}.\n * @param requestType\n * The required request, which is one of the {@link RequestType}.\n * @param captureType\n * The required capture, which is one of the {@link CaptureType}.\n */\n public void requestChangeCaptureRequest(boolean sync, RequestType requestType,\n CaptureType captureType);\n }\n\n /**\n * The life cycle corresponding to camera activity onCreate.\n *\n * @param activity\n * Camera activity.\n * @param parentView\n * The root view of camera activity.\n * @param isCaptureIntent\n * {@link com.android.camera.v2.CameraActivityBridge #isCaptureIntent()}.\n */\n void open(Activity activity, ViewGroup parentView, boolean isCaptureIntent);\n\n /**\n * The life cycle corresponding to camera activity onResume.\n */\n void resume();\n\n /**\n * The life cycle corresponding to camera activity onPause.\n */\n void pause();\n\n /**\n * The life cycle corresponding to camera activity onDestory.\n */\n void close();\n\n /**\n * {@link com.android.camera.v2.app.GestureManager.GestureNotifier\n * #onSingleTapUp(float, float)}.\n *\n * @param x\n * The x-coordinate.\n * @param y\n * The y-coordinate.\n */\n void onSingleTapUp(float x, float y);\n\n /**\n * {@link com.android.camera.v2.app.GestureManager.GestureNotifier #onLongPress(float, float)}.\n *\n * @param x\n * The x-coordinate.\n * @param y\n * The y-coordinate.\n */\n void onLongPressed(float x, float y);\n\n /**\n * {@link PreviewStatusListener\n * #onPreviewLayoutChanged(android.view.View, int, int, int, int, int, int, int, int)}.\n *\n * @param previewArea\n * The preview area.\n */\n void onPreviewAreaChanged(RectF previewArea);\n\n /**\n * {@link com.android.camera.v2.CameraActivityBridge #onOrientationChanged(int)}.\n *\n * @param orientation\n * The current G-sensor orientation.\n */\n void onOrientationChanged(int orientation);\n\n /**\n * Configuring capture requests.\n *\n * @param requestBuilders The builders of capture requests.\n * @param captureType {@link CaptureType}.\n */\n void configuringSessionRequests(Map<RequestType, CaptureRequest.Builder> requestBuilders,\n CaptureType captureType);\n\n /**\n * This method is called when the camera device has started capturing the output image for the\n * request, at the beginning of image exposure.\n *\n * @param request\n * The request for the capture that just begun.\n * @param timestamp\n * The time stamp at start of capture, in nanoseconds.\n * @param frameNumber\n * The frame number for this capture.\n */\n void onCaptureStarted(CaptureRequest request, long timestamp, long frameNumber);\n\n /**\n * This method is called when an image capture has fully completed and all the result metadata\n * is available.\n *\n * @param request\n * The request that was given to the CameraDevice\n *\n * @param result\n * The total output metadata from the capture, including the final capture parameters\n * and the state of the camera system during capture.\n */\n void onCaptureCompleted(CaptureRequest request, TotalCaptureResult result);\n}", "public GetVideoRequest(UUID requestUUID, Video video) {\n super(requestUUID, video.getVidUrl());\n this.video = video;\n getVideoRequestCount += 1;\n }", "@Override\n public void onVideoStarted() {\n }", "public void mediaRecorderParameterFetching(MediaRecorder recorder) {\n recorder.setAudioSource(5);\n recorder.setVideoSource(1);\n recorder.setProfile(this.mProfile);\n recorder.setVideoSize(this.mProfile.videoFrameWidth, this.mProfile.videoFrameHeight);\n recorder.setMaxDuration(getOverrodeVideoDuration());\n }", "public interface AddVideoServes {\n @Multipart\n @POST(\"servletc/AddVideoServlet\")\n Call<String> upload(\n @Part(\"userId\") String id,\n @Part MultipartBody.Part file);\n @POST(\"servletc/AddVideoPlayNumber\")\n Call<String> addVideoPlayNumber(@Query(\"videoId\") int id);\n}", "public static ScreenRecorder configScreeenRecorder() throws Exception, AWTException {\n GraphicsConfiguration gc = GraphicsEnvironment//\r\n .getLocalGraphicsEnvironment()//\r\n .getDefaultScreenDevice()//\r\n .getDefaultConfiguration();\r\n\r\n //Create a instance of ScreenRecorder with the required configurations\r\n ScreenRecorder screenRecorder = new ScreenRecorder(gc,\r\n null, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),\r\n new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,\r\n CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,\r\n DepthKey, (int)24, FrameRateKey, Rational.valueOf(15),\r\n QualityKey, 1.0f,\r\n KeyFrameIntervalKey, (int) (15 * 60)),\r\n new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,\"black\",\r\n FrameRateKey, Rational.valueOf(30)),\r\n null,new File(Constant.Path_VideoRecordings));\r\n\r\n return screenRecorder;\r\n}", "private void videoRecordingPrepared() {\n Log.d(\"Camera\", \"videoRecordingPrepared()\");\n isCameraXHandling = false;\n // Keep disabled status for a while to avoid fast click error with \"Muxer stop failed!\".\n binding.capture.postDelayed(() -> binding.capture.setEnabled(true), 500);\n }", "public void setVadRecorder(){\n }", "public S<T> camVid(int code){\n\t Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);\n\t activity.startActivityForResult(intent, code);\n\t return this;\n\t }", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "@Override\n public void onConfigured(@NonNull CameraCaptureSession session) {\n if (MyDebug.LOG) {\n Log.d(TAG, \"onConfigured: \" + session);\n Log.d(TAG, \"captureSession was: \" + captureSession);\n }\n if (camera == null) {\n if (MyDebug.LOG) {\n Log.d(TAG, \"camera is closed\");\n }\n synchronized (background_camera_lock) {\n callback_done = true;\n background_camera_lock.notifyAll();\n }\n return;\n }\n synchronized (background_camera_lock) {\n captureSession = session;\n Surface surface = getPreviewSurface();\n previewBuilder.addTarget(surface);\n if (video_recorder != null)\n previewBuilder.addTarget(video_recorder_surface);\n try {\n setRepeatingRequest();\n } catch (CameraAccessException e) {\n if (MyDebug.LOG) {\n Log.e(TAG, \"failed to start preview\");\n Log.e(TAG, \"reason: \" + e.getReason());\n Log.e(TAG, \"message: \" + e.getMessage());\n }\n e.printStackTrace();\n // we indicate that we failed to start the preview by setting captureSession back to null\n // this will cause a CameraControllerException to be thrown below\n captureSession = null;\n }\n }\n synchronized (background_camera_lock) {\n callback_done = true;\n background_camera_lock.notifyAll();\n }\n }", "Record(VideoObj video, int numOwned, int numOut, int numRentals) {\n\t\tthis.video = video;\n\t\tthis.numOwned = numOwned;\n\t\tthis.numOut = numOut;\n\t\tthis.numRentals = numRentals;\n\t}", "void onCaptureCompleted(CaptureRequest request, TotalCaptureResult result);", "public boolean onStopVideoRecording() {\n if (this.mNeedGLRender && isSupportEffects()) {\n this.mCurrentVideoFilename = this.mVideoFilename;\n this.mActivity.getCameraAppUI().stopVideoRecorder();\n }\n if (this.PhoneFlag) {\n int moduleId = getModuleId();\n CameraActivity cameraActivity = this.mActivity;\n if (moduleId == 8) {\n this.mActivity.getCameraAppUI().setCalldisable(true);\n this.mActivity.getCameraAppUI().resetAlpha(true);\n }\n }\n if (this.mMediaRecoderRecordingPaused) {\n this.mRecordingStartTime = SystemClock.uptimeMillis() - this.mVideoRecordedDuration;\n this.mVideoRecordedDuration = 0;\n this.mMediaRecoderRecordingPaused = false;\n this.mUI.mMediaRecoderRecordingPaused = false;\n this.mUI.setRecordingTimeImage(true);\n }\n this.mAppController.getCameraAppUI().showRotateButton();\n this.mAppController.getCameraAppUI().setSwipeEnabled(true);\n this.mActivity.stopBatteryInfoChecking();\n this.mActivity.stopInnerStorageChecking();\n boolean recordFail = stopVideoRecording();\n releaseAudioFocus();\n if (this.mIsVideoCaptureIntent) {\n if (this.mQuickCapture) {\n doReturnToCaller(recordFail ^ 1);\n } else if (recordFail) {\n this.mAppController.getCameraAppUI().showModeOptions();\n this.mHandler.sendEmptyMessageDelayed(6, SHUTTER_BUTTON_TIMEOUT);\n } else {\n showCaptureResult();\n }\n } else if (!(recordFail || this.mPaused)) {\n boolean z = ApiHelper.HAS_SURFACE_TEXTURE_RECORDING;\n }\n return recordFail;\n }", "@Override\n public void run() {\n mLogView.logI(\"Remote video starting, uid: \" + (uid & 0xFFFFFFFFL));\n setupRemoteVideo(uid, uid == WINDOW_SHARE_UID ? mRemoteShareContainerSplit : mRemoteCameraContainer);\n }", "public Vision() {\n\n visionCam = CameraServer.getInstance().startAutomaticCapture(\"HatchCam\", 0);\n visionCam.setVideoMode(PixelFormat.kMJPEG, 320, 240, 115200);\n \n int retry = 0;\n while(cam == null && retry < 10) {\n try {\n System.out.println(\"Connecting to jevois serial port ...\");\n cam = new SerialPort(115200, SerialPort.Port.kUSB1);\n System.out.println(\"Success!!!\");\n } catch (Exception e) {\n System.out.println(\"We all shook out\");\n e.printStackTrace();\n sleep(500);\n System.out.println(\"Retry\" + Integer.toString(retry));\n retry++;\n }\n }\n // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n\n // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS\n }", "@FXML\r\n protected void startCamera() {\r\n // set a fixed width for the frame\r\n this.currentFrame.setFitWidth(600);\r\n // preserve image ratio\r\n this.currentFrame.setPreserveRatio(true);\r\n\r\n if (!this.cameraActive) {\r\n\r\n // start the video capture\r\n //this.capture.open(0);\r\n //Read the video (Chage video)\r\n this.capture.open(\"Faruri.m4v\");\r\n\r\n\r\n System.out.println(\"start capture...\");\r\n // is the video stream available?\r\n if (this.capture.isOpened()) {\r\n System.out.println(\"inif\");\r\n this.cameraActive = true;\r\n\r\n // grab a frame every 33 ms (30 frames/sec)\r\n Runnable frameGrabber = new Runnable() {\r\n\r\n @Override\r\n public void run() {\r\n // effectively grab and process a single frame\r\n Mat frame = grabFrame();\r\n\r\n//\t\t\t\t\t\t// convert and show the frame\r\n//\t\t\t\t\t\tImage imageToShow = Utils.mat2Image(frame);\r\n//\t\t\t\t\t\tupdateImageView(currentFrame, imageToShow);\r\n }\r\n };\r\n\r\n this.timer = Executors.newSingleThreadScheduledExecutor();\r\n this.timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MILLISECONDS);\r\n\r\n // update the button content\r\n this.button.setText(\"Stop Video\");\r\n } else {\r\n // log the error\r\n System.err.println(\"Impossible to open the video...\");\r\n }\r\n } else {\r\n // the camera is not active at this point\r\n this.cameraActive = false;\r\n // update again the button content\r\n this.button.setText(\"Start Video\");\r\n\r\n // stop the timer\r\n this.stopAcquisition();\r\n }\r\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v=inflater.inflate(R.layout.fragment_trainee__third, container, false);\n\n Record_button=(Button)v.findViewById(R.id.record_button);\n vView=(VideoView)v.findViewById(R.id.videoView);\n MediaController mediaController = new MediaController(v.getContext());\n mediaController.setAnchorView(vView);\n// set media controller object for a video view\n vView.setMediaController(mediaController);\n Record_button.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n dispatchTakeVideoIntent();\n\n\n }\n });\n return v;\n\n\n\n }", "@Override\n public void run() {\n setupRemoteVideo(uid);\n }", "public VideoCapture(int device)\n {\n \n nativeObj = VideoCapture_2(device);\n \n return;\n }", "private void startPreview() {\n if (null == mCameraDevice || !mVideoPreview.isAvailable() || null == mPreviewSize) {\n return;\n }\n try {\n closePreviewSession();\n SurfaceTexture texture = mVideoPreview.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n\n Surface previewSurface = new Surface(texture);\n mPreviewBuilder.addTarget(previewSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n if (mVideoRecordListener != null) {\n mVideoRecordListener.onRecordingFailed(\"Capture session for previewing video failed.\");\n }\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void setupRemoteVideo(int uid, ViewGroup remoteContainer) {\n int count = remoteContainer.getChildCount();\n View view = null;\n for (int i = 0; i < count; i++) {\n View v = remoteContainer.getChildAt(i);\n if (v.getTag() instanceof Integer && ((int) v.getTag()) == uid) {\n view = v;\n }\n }\n if (view != null) {\n return;\n }\n\n // Checks have passed so set up the remote video.\n int renderMode;\n SurfaceView remoteView = RtcEngine.CreateRendererView(getBaseContext());\n if (uid == WINDOW_SHARE_UID) {\n mRemoteShareView = remoteView;\n renderMode = VideoCanvas.RENDER_MODE_FIT;\n } else {\n mRemoteCameraView = remoteView;\n renderMode = VideoCanvas.RENDER_MODE_HIDDEN;\n }\n\n remoteContainer.addView(remoteView);\n mRtcEngine.setupRemoteVideo(new VideoCanvas(remoteView, renderMode, uid));\n remoteView.setTag(uid);\n }", "@Override public void run()\n {\n pauseStreaming();\n\n // Switch the current camera\n camera = newCamera;\n\n // Resume streaming on the new camera if there is one\n if (camera != null)\n {\n resumeStreaming();\n }\n }", "Call createVideoCall(Contact callee)\n throws OperationFailedException;", "public void startFrontCam() {\n }", "public int getVideoPort();", "public void AddCameraServer() {\n addCameraServer(\"Pixy Output\", 50);\n }", "@Override\n\tpublic void receiveSessionInfo(Camera camera, int resultCode) {\n\t\t\n\t}", "public CreateMediaCapturePipelineRequest withClientRequestToken(String clientRequestToken) {\n setClientRequestToken(clientRequestToken);\n return this;\n }", "public void AddCameraServer(int framerate) {\n addCameraServer(\"Pixy Output\", framerate);\n }", "@Async\n public void startRecording(String imageUrl) {\n recording = true;\n URL url = null;\n try {\n url = new URL(imageUrl);\n String fileName = url.getFile();\n String destName = \"./\" + fileName.substring(fileName.lastIndexOf(\"/\"));\n System.out.println(destName);\n\n InputStream is = url.openStream();\n OutputStream os = new FileOutputStream(String\n .format(\"%s/%s-capture.mjpg\", videoOutputDirectory, getTimestamp()));\n\n byte[] b = new byte[2048];\n int length;\n\n while (recording && (length = is.read(b)) != -1) {\n os.write(b, 0, length);\n }\n\n is.close();\n os.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void startService() {\n\t\tListenThread listenThread = new ListenThread();\r\n\t\tlistenThread.start();\r\n\t\tSelfVideoThread selfVideoThread = new SelfVideoThread();\r\n\t\tselfVideoThread.start();\r\n\t\tif(remote!=\"\"){\r\n\t\t\tString[] remotes = remote.split(\",\");\r\n\t\t\tString[] remotePorts = remotePort.split(\",\");\r\n\t\t\tfor(int i = 0; i < remotes.length; i++){\r\n\t\t\t\tString currentRemote = remotes[i];\r\n\t\t\t\tint currentRemotePort = 6262;\r\n\t\t\t\tif(i<remotePorts.length){\r\n\t\t\t\t\tcurrentRemotePort = Integer.valueOf(remotePorts[i]);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n//\t\t\t\tcreatTCPLink(currentRemote, currentRemotePort);\r\n\t\t\t\t\r\n\t\t\t\tSocket socket = null;\r\n\t\t\t\tJSONObject process = new JSONObject();\r\n\t\t\t\ttry {\r\n\t\t\t\t\tsocket = new Socket(currentRemote, currentRemotePort);\r\n\t\t\t\t\tThread sendVedio = new SendVideo(socket, width, height, rate);\r\n\t\t\t\t\tsendVedio.start();\r\n\t\t\t\t\tThread receiveVedio = new ReceiveVideo(socket);\r\n\t\t\t\t\treceiveVedio.start();\r\n\t\t\t\t\tsockets.add(socket);\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t} finally {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void takePhoto() {\n Uri fileUri = FileProvider.getUriForFile(Mic.getmCtx(), \"com.jay.appdemo1.fileProvider\", getOutputMediaFile());\n Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);\n intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10); //限制的录制时长 以秒为单位\n// intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 1024); //限制视频文件大小 以字节为单位\n// intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //设置拍摄的质量0~1\n// intent.putExtra(MediaStore.EXTRA_FULL_SCREEN, false); // 全屏设置\n startActivityForResult(intent, RECORD_SYSTEM_VIDEO);\n }", "void startRecording() {\n synchronized (serviceConnection) {\n startNewTrackRequested = true;\n serviceConnection.startAndBind();\n \n // Binding was already requested before, it either already happened\n // (in which case running the callback manually triggers the actual recording start)\n // or it will happen in the future\n // (in which case running the callback now will have no effect).\n serviceBindCallback.run();\n }\n }", "@Override\n public byte[] getVideo(String cameraName) {\n throw new IllegalStateException(\"Not implemented yet!\");\n }", "public void reloadVideoDevices();", "@Option int getPortSendCam();", "public abstract void videoMessage(Message m);", "@Override\n public void run() {\n\n\n AudioRecord audioRecorder = new AudioRecord (MediaRecorder.AudioSource.VOICE_COMMUNICATION, SAMPLE_RATE,\n AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,\n AudioRecord.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT));\n int bytes_read = 0;\n int bytes_sent = 0;\n byte[] buf = new byte[BUF_SIZE];\n Log.d(\"bytes_read\", String.valueOf(bytes_read));\n audioRecorder.startRecording();\n while (mic && !UDP){\n bytes_read = audioRecorder.read(buf, 0, BUF_SIZE); //also should add the headers required for our case\n Log.d(\"bytes_read\", String.valueOf(bytes_read));\n //The following code is to add the length in 4 bytes to the packet. Required in TCP connection if you use recv function in multiplex.py(server side).\n// byte[] len = ByteBuffer.allocate(4).order(BIG_ENDIAN).putInt(bytes_read).array();\n// byte[] toSend = new byte[4+bytes_read];\n// System.arraycopy(len, 0, toSend, 0, 4);\n// System.arraycopy(buf, 0, toSend, 4, bytes_read);\n try {\n dataOutputStreamInstance.write(buf);\n dataOutputStreamInstance.flush();\n } catch (IOException e) {\n e.printStackTrace();\n }\n bytes_sent += bytes_read;\n }\n\n // Stop recording and release resources\n audioRecorder.stop();\n audioRecorder.release();\n try {\n buff.close();\n dataOutputStreamInstance.close();\n out1.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return;\n }", "@Override\n public void onClick(View v) {\n Intent it = new Intent(Intent.ACTION_VIEW);\n Uri uri = Uri.parse(\"http://\"+ PostUrl.Media+\":8080/upload/\"+item.getMediaPath().get(0).split(\"\\\\.\")[0]+\".mp4\");\n it.setDataAndType(uri, \"video/mp4\");\n context.startActivity(it);\n\n }", "public Single<Uri> captureVideo(@NonNull FragmentActivity activity) {\n Request request = new Request()\n .setSource(Request.Source.VIDEO_CAPTURE);\n return request(activity, request)\n .map(Result::getUris)\n .map(uris -> uris.get(0));\n }", "public static void main(String argv[]) throws Exception{\n Client theClient = new Client();\n \n //get server RTSP port and IP address from the command line\n //------------------\n int RTSP_server_port = Integer.parseInt(argv[1]);\n String ServerHost = argv[0];\n InetAddress ServerIPAddr = InetAddress.getByName(ServerHost);\n \n //get video filename to request:\n VideoFileName = argv[2];\n \n //Establish a TCP connection with the server to exchange RTSP messages\n //------------------\n theClient.RTSPsocket = new Socket(ServerIPAddr, RTSP_server_port);\n \n //Set input and output stream filters:\n RTSPBufferedReader = new BufferedReader(new InputStreamReader(theClient.RTSPsocket.getInputStream()) );\n RTSPBufferedWriter = new BufferedWriter(new OutputStreamWriter(theClient.RTSPsocket.getOutputStream()) );\n \n //init RTSP state:\n state = INIT;\n }", "@Override\n public void onLocalMediaCapture(SurfaceViewRenderer videoView) {\n if (videoView == null) {\n return;\n }\n addSelfView(videoView);\n }", "public static boolean prepareVideoRecorder(Camera camera, MediaRecorder recorder,\n SurfaceView preview) {\n camera.unlock();\n recorder.setCamera(camera);\n\n // Step2:Set sources\n recorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);\n recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n\n // Step3:Set a CamcorderProfile\n recorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_720P));\n\n // Step4:Set output file\n mRecorderPath = FileUtil.videoDir().getAbsolutePath() + \"/\" + System.currentTimeMillis() + \".mp4\";\n recorder.setOutputFile(mRecorderPath);\n\n // Step5:Set the preview output\n recorder.setPreviewDisplay(preview.getHolder().getSurface());\n\n // Step6:Prepare configured MediaRecorder\n try {\n recorder.prepare();\n } catch (IllegalStateException e) {\n Log.d(TAG,\n \"IllegalStateException preparing MediaRecorder: \"\n + e.getMessage());\n CameraUtil.releaseMediaRecorder(recorder);\n CameraUtil.releaseCamera(camera);\n return false;\n } catch (IOException e) {\n Log.d(TAG, \"IOException preparing MediaRecorder: \" + e.getMessage());\n CameraUtil.releaseMediaRecorder(recorder);\n CameraUtil.releaseCamera(camera);\n return false;\n }\n\n return true;\n }", "void addPlayRecord(User user, String video_id);", "public void doVideoCapture() {\n /*\n r6 = this;\n r0 = r6.mPaused;\n if (r0 != 0) goto L_0x0043;\n L_0x0004:\n r0 = r6.mCameraDevice;\n if (r0 != 0) goto L_0x0009;\n L_0x0008:\n goto L_0x0043;\n L_0x0009:\n r0 = r6.mMediaRecorderRecording;\n if (r0 == 0) goto L_0x0042;\n L_0x000d:\n r0 = r6.mNeedGLRender;\n if (r0 == 0) goto L_0x0029;\n L_0x0011:\n r0 = r6.isSupportEffects();\n if (r0 == 0) goto L_0x0029;\n L_0x0017:\n r0 = r6.mCameraDevice;\n r1 = 0;\n r0.enableShutterSound(r1);\n r0 = r6.mAppController;\n r0 = r0.getCameraAppUI();\n r1 = r6.mPictureTaken;\n r0.takePicture(r1);\n goto L_0x0041;\n L_0x0029:\n r0 = r6.mSnapshotInProgress;\n if (r0 != 0) goto L_0x0041;\n L_0x002d:\n r0 = java.lang.System.currentTimeMillis();\n r2 = r6.mLastTakePictureTime;\n r2 = r0 - r2;\n r4 = 2000; // 0x7d0 float:2.803E-42 double:9.88E-321;\n r2 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1));\n if (r2 >= 0) goto L_0x003c;\n L_0x003b:\n return;\n L_0x003c:\n r6.mLastTakePictureTime = r0;\n r6.takeASnapshot();\n L_0x0041:\n return;\n L_0x0042:\n return;\n L_0x0043:\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.hmdglobal.app.camera.VideoModule.doVideoCapture():void\");\n }", "void avRecorderSetup() {\n\r\n\t\t \r\n imw = ToolFactory.makeWriter(file.getAbsolutePath());//or \"output.avi\" or \"output.mov\"\r\n imw.open();\r\n imw.setForceInterleave(true);\r\n imw.addVideoStream(0, 0, IRational.make((double)vidRate), widthCapture, heightCapture);\r\n audionumber = imw.addAudioStream(audioStreamIndex, audioStreamId, channelCount, sampleRate);\r\n isc = imw.getContainer().getStream(0).getStreamCoder();\r\n bgr = new BufferedImage(widthCapture, heightCapture, BufferedImage.TYPE_3BYTE_BGR);\r\n sTime = fTime = System.nanoTime();\r\n }", "public void playVideo() {\n }", "@Override\n public void onFrameAvailable(int cameraId) {\n }" ]
[ "0.6997779", "0.6529984", "0.6417616", "0.63458467", "0.63444906", "0.6311839", "0.60718423", "0.5979483", "0.5822907", "0.5811819", "0.5696986", "0.56793547", "0.5677607", "0.56140393", "0.55998206", "0.5581227", "0.55555713", "0.5501461", "0.5465655", "0.5424361", "0.54214746", "0.54029053", "0.53966343", "0.53799856", "0.5366637", "0.5360061", "0.5359739", "0.53536075", "0.5349314", "0.5346892", "0.53259254", "0.532322", "0.5316607", "0.5315053", "0.5311127", "0.5310717", "0.5306104", "0.5265777", "0.5261506", "0.52483857", "0.52431154", "0.52199656", "0.52187836", "0.52092326", "0.51945704", "0.51883376", "0.5186809", "0.51821804", "0.5178853", "0.51780427", "0.5173036", "0.51699185", "0.5164765", "0.51598066", "0.51521665", "0.5147771", "0.5137162", "0.5136646", "0.51343155", "0.5130447", "0.5130447", "0.5108734", "0.5102052", "0.5098631", "0.5098199", "0.5091621", "0.50883704", "0.5081091", "0.5071924", "0.50623524", "0.5053705", "0.5048028", "0.50468063", "0.5034752", "0.50308007", "0.502361", "0.5020019", "0.50196534", "0.50166553", "0.50148296", "0.50131536", "0.5011042", "0.50098276", "0.50024045", "0.50006175", "0.49942943", "0.4991821", "0.49875858", "0.49752018", "0.49738538", "0.49720132", "0.49634236", "0.49499515", "0.4944323", "0.49405056", "0.49385324", "0.49357972", "0.49352452", "0.4933442", "0.49295843" ]
0.61156636
6
Requests video live streaming to another camClient
private void requestLiveStreaming() throws IOException { String targetCamCode = dis.readUTF(); Cam targetCam = CamRegister.findRegisteredCam(targetCamCode); try { DataOutputStream targetDos = new DataOutputStream(targetCam.getCamSocket().getOutputStream()); targetDos.writeInt(LIVE_STREAMING_COMMAND); targetDos.writeUTF(camClient.getCamCode()); targetDos.flush(); dos.writeInt(SUCCESS_CODE); dos.flush(); } catch (Exception e) { e.printStackTrace(); dos.writeInt(NOT_FOUND_CODE); dos.flush(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void liveStreaming() throws IOException, InterruptedException {\n\n CamStreaming camStreaming = new CamStreaming();\n VideoDataStream vds = new VideoDataStream(true);\n byte[] frame;\n\n if (camStreaming.prepareStream(in)) {\n\n while (camStreaming.isTargetConnected()) {\n try {\n\n if (dis.available() > 0) {\n frame = vds.processFrame(dis);\n camStreaming.sendData(frame);\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n break;\n }\n sleep(20);\n }\n \n dos.writeInt(END_OF_STREAM_CODE);\n dos.flush();\n \n// CamRegister.removeCamClient(camClient);\n \n RecordStorage recordStorage = new RecordStorage();\n\n recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode());\n\n vds.cleanBuffer();\n\n }\n\n }", "@Override\n public void onServerStart(String videoStreamUrl)\n {\n\n\n\n Log.d(\"Activity\",\"URL: \"+ videoStreamUrl);\n\n\n video = (VideoView)findViewById(R.id.video);\n\n Uri uri = Uri.parse(videoStreamUrl);\n video.setVideoURI(uri);\n video.start();\n\n\n\n }", "public void startStreaming() {\n// phoneCam.setViewportRenderingPolicy(OpenCvCamera.ViewportRenderingPolicy.OPTIMIZE_VIEW);\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.SIDEWAYS_RIGHT);\n }", "private void gotRemoteStream(MediaStream stream) {\n //we have remote video stream. add to the renderer.\n final VideoTrack videoTrack = stream.videoTracks.get(0);\n if (mEventUICallBack != null) {\n mEventUICallBack.showVideo(videoTrack);\n }\n// runOnUiThread(() -> {\n// try {\n// binding.remoteGlSurfaceView.setVisibility(View.VISIBLE);\n// videoTrack.addSink(binding.remoteGlSurfaceView);\n// } catch (Exception e) {\n// e.printStackTrace();\n// }\n// });\n }", "protected void startVideoCall() {\n if (!EMClient.getInstance().isConnected())\n Toast.makeText(ChatDetailsActivity.this, R.string.not_connect_to_server, Toast.LENGTH_SHORT).show();\n else {\n startActivity(new Intent(ChatDetailsActivity.this, VideoCallActivity.class).putExtra(\"username\", mBean.getMobile())\n .putExtra(\"isComingCall\", false).putExtra(\"nickname\", mBean.getUser_nickname()));\n // videoCallBtn.setEnabled(false);\n// inputMenu.hideExtendMenuContainer();\n }\n }", "public Connection invoke(final PeerClient remoteClient) {\n final RemoteMedia remoteMedia = new RemoteMedia(context, enableH264, !enableAudioReceive, !enableVideoReceive, aecContext);\n final AudioStream audioStream = new AudioStream(enableAudioSend ? localMedia.getAudioTrack().getOutputs() : null, enableAudioReceive ? remoteMedia.getAudioTrack().getInputs() : null);\n final VideoStream videoStream = new VideoStream(enableVideoSend ? localMedia.getVideoTrack().getOutputs() : null, enableVideoReceive ? remoteMedia.getVideoTrack().getInputs() : null);\n\n final Connection connection;\n\n // Add the remote view to the layout.\n layoutManager.addRemoteView(remoteMedia.getId(), remoteMedia.getView());\n\n mediaTable.put(remoteMedia.getView(), remoteMedia);\n fragment.registerForContextMenu(remoteMedia.getView());\n remoteMedia.getView().setOnTouchListener(fragment);\n\n if (enableDataChannel) {\n DataChannel channel = new DataChannel(\"mydatachannel\") {{\n setOnReceive(new IAction1<DataChannelReceiveArgs>() {\n @Override\n public void invoke(DataChannelReceiveArgs dataChannelReceiveArgs) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 1 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n textListener.onReceivedText(ProviderName, dataChannelReceiveArgs.getDataString());\n }\n });\n\n addOnStateChange(new IAction1<DataChannel>() {\n @Override\n public void invoke(DataChannel dataChannel) {\n android.util.Log.w(\"--ICELINK LIB--\",\"\\n------- About to get 'name' bounds records 2 [App.java]...\");\n /*\n String name = remoteClient.getBoundRecords().get(\"name\").getValueJson();\n name = name.substring(1, name.length() - 1);\n */\n if (dataChannel.getState() == DataChannelState.Connected) {\n synchronized (channelLock)\n {\n dataChannels.add(dataChannel);\n }\n textListener.onPeerJoined(ProviderName);\n } else if (dataChannel.getState() == DataChannelState.Closed || dataChannel.getState() == DataChannelState.Failed) {\n synchronized (channelLock)\n {\n dataChannels.remove(dataChannel);\n }\n\n textListener.onPeerLeft(ProviderName);\n }\n }\n });\n }};\n\n DataStream dataStream = new DataStream(channel);\n connection = new Connection(new Stream[]{audioStream, videoStream, dataStream});\n } else {\n connection = new Connection(new Stream[]{audioStream, videoStream});\n }\n\n connection.setIceServers(iceServers);\n\n connection.addOnStateChange(new fm.icelink.IAction1<Connection>() {\n public void invoke(Connection c) {\n // Remove the remote view from the layout.\n if (c.getState() == ConnectionState.Closing ||\n c.getState() == ConnectionState.Failing) {\n if (layoutManager.getRemoteView(remoteMedia.getId()) != null) {\n layoutManager.removeRemoteView(remoteMedia.getId());\n remoteMedia.destroy();\n }\n }\n }\n });\n\n return connection;\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n Toast.makeText(VideoDetailsActivity.this,\"Reciever fot the result. Do some processing bro\",Toast.LENGTH_LONG).show();\n mVideoView.setVideoURI();\n }", "public void startService() {\n\t\tListenThread listenThread = new ListenThread();\r\n\t\tlistenThread.start();\r\n\t\tSelfVideoThread selfVideoThread = new SelfVideoThread();\r\n\t\tselfVideoThread.start();\r\n\t\tif(remote!=\"\"){\r\n\t\t\tString[] remotes = remote.split(\",\");\r\n\t\t\tString[] remotePorts = remotePort.split(\",\");\r\n\t\t\tfor(int i = 0; i < remotes.length; i++){\r\n\t\t\t\tString currentRemote = remotes[i];\r\n\t\t\t\tint currentRemotePort = 6262;\r\n\t\t\t\tif(i<remotePorts.length){\r\n\t\t\t\t\tcurrentRemotePort = Integer.valueOf(remotePorts[i]);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n//\t\t\t\tcreatTCPLink(currentRemote, currentRemotePort);\r\n\t\t\t\t\r\n\t\t\t\tSocket socket = null;\r\n\t\t\t\tJSONObject process = new JSONObject();\r\n\t\t\t\ttry {\r\n\t\t\t\t\tsocket = new Socket(currentRemote, currentRemotePort);\r\n\t\t\t\t\tThread sendVedio = new SendVideo(socket, width, height, rate);\r\n\t\t\t\t\tsendVedio.start();\r\n\t\t\t\t\tThread receiveVedio = new ReceiveVideo(socket);\r\n\t\t\t\t\treceiveVedio.start();\r\n\t\t\t\t\tsockets.add(socket);\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t} finally {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static VideoSource startCamera(CameraConfig config) {\n System.out.println(\"Starting camera '\" + config.name + \"' on \" + config.path);\n CameraServer inst = CameraServer.getInstance();\n UsbCamera camera = new UsbCamera(config.name, config.path);\n MjpegServer server = inst.startAutomaticCapture(camera);\n\n Gson gson = new GsonBuilder().create();\n\n camera.setConfigJson(gson.toJson(config.config));\n camera.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen);\n\n if (config.streamConfig != null) {\n server.setConfigJson(gson.toJson(config.streamConfig));\n }\n\n return camera;\n }", "public void onVideoStarted () {}", "@Override public void run()\n {\n pauseStreaming();\n\n // Switch the current camera\n camera = newCamera;\n\n // Resume streaming on the new camera if there is one\n if (camera != null)\n {\n resumeStreaming();\n }\n }", "public void setVideoPort(int port);", "@Override\n public void run() {\n mLogView.logI(\"Remote video starting, uid: \" + (uid & 0xFFFFFFFFL));\n setupRemoteVideo(uid, uid == WINDOW_SHARE_UID ? mRemoteShareContainerSplit : mRemoteCameraContainer);\n }", "public interface VideoConsumer {\n public void onVideoStart(int width, int height) throws IOException;\n\n public int onVideo(byte []data, int format);\n\n public void onVideoStop();\n}", "private void getVideo() {\n // create the url\n String temp = movie.getId().toString();\n String url = API_BASE_URL+\"/movie/\"+temp+\"/videos\";\n // set the request parameters\n RequestParams params = new RequestParams();\n params.put(API_KEY_PARAM, getString(R.string.api_key)); // Always needs API key\n // request a GET response expecting a JSON object response\n\n client.get(url,params, new JsonHttpResponseHandler() {\n\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONObject response) {\n // load the results into movies list\n\n try {\n JSONArray results = response.getJSONArray(\"results\");\n JSONObject curMovie = results.getJSONObject(0);\n key = curMovie.getString(\"key\");\n\n } catch (JSONException e) {\n logError(\"Failed to parse play_video endpoint\", e, true);\n }\n\n\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {\n logError(\"Failed to get data from Now_playing endpoint\", throwable, true);\n }\n });\n\n }", "@Override\n public void onVideoStarted() {\n }", "@Override\n public void run() {\n setupRemoteVideo(uid);\n }", "public void runMultiWebcam()\n\t{\n\t\tString pipeline=\"gst-launch-1.0 -v v4l2src device=\"+webcamSource+\" ! 'video/x-raw,width=640,height=480' ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! multiudpsink clients=\"+client.getInetAddress().getHostAddress()+\":\"+port1+\",\"+client.getInetAddress().getHostAddress()+\":\"+port2;\n\n\t\tString[] args1 = new String[] {\"/bin/bash\", \"-c\", pipeline+\">src/output.txt\"};\n\t\ttry {\n\t\t\t@SuppressWarnings(\"unused\")\n\t\t\tProcess proc = new ProcessBuilder(args1).start();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\ttry {\n\t\t\tThread.sleep(2000);\n\t\t} catch (InterruptedException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te1.printStackTrace();\n\t\t}\n\t}", "public void run() {\n\n\n if (videoFile != null) {\n //\n // Add Image to Photos Gallery\n //\n //final Uri uri = addMediaToGallery(mInscribedVideoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //final Uri uri = addMediaToGallery(videoFile.getAbsolutePath(), MCameraActivity.this, \"video\");\n //Log.e(TAG, \"uri--->\" + uri.getPath());\n\n //\n // Create a media bean and set the copyright for server flags\n //\n String media_id = \"\";\n try {\n media_id = copyrightJsonObject.getString(\"media_id\");\n copyrightJsonObject.put(\"applyCopyrightOnServer\", 1);\n copyrightJsonObject.put(\"device_id\", SessionManager.getInstance().getDevice_id());\n copyrightJsonObject.put(\"device_type\", Common.DEVICE_TYPE);\n } catch (JSONException e) {\n // this shouldn't occur\n Log.e(TAG, \"JSONException trying to get media_id from copyright!\");\n }\n String mediaName = ImageUtils.getInstance()\n .getImageNameFromPath(videoFile.getAbsolutePath());\n GalleryBean media = new GalleryBean(videoFile.getAbsolutePath(),\n mediaName,\n \"video\",\n media_id,\n false,\n thumbnail,\n GalleryBean.GalleryType.NOT_SYNC);\n media.setDeviceId(SessionManager.getInstance().getDevice_id());\n media.setDeviceType(Common.DEVICE_TYPE);\n String mediaNamePrefix = mediaName.substring(0,\n mediaName.lastIndexOf('.'));\n media.setMediaNamePrefix(mediaNamePrefix);\n media.setMediaThumbBitmap(thumbnail);\n media.setLocalMediaPath(videoFile.getAbsolutePath());\n Date date = new Date();\n media.setMediaDate(date.getTime());\n //String mimeType = getContentResolver().getType(uri);\n media.setMimeType(\"video/mp4\"); // must be set for Amazon.\n media.setCopyright(copyrightJsonObject.toString());\n\n MemreasTransferModel transferModel = new MemreasTransferModel(\n media);\n transferModel.setType(MemreasTransferModel.Type.UPLOAD);\n QueueAdapter.getInstance().getSelectedTransferModelQueue()\n .add(transferModel);\n\n // Start the service if it's not running...\n startQueueService();\n } else {\n //\n // Show Toast error occurred here...\n //\n videoFile.delete();\n }\n\n }", "private void sendVideoRecordingRequest() {\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n assert surfaceTexture != null;\n surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n\n try {\n\n // create request for RECORDING template\n /**\n * Create a request suitable for video recording. Specifically, this means\n * that a stable frame rate is used, and post-processing is set for\n * recording quality. These requests would commonly be used with the\n * {@link CameraCaptureSession#setRepeatingRequest} method.\n * This template is guaranteed to be supported on all camera devices except\n * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices\n * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE\n * BACKWARD_COMPATIBLE}.\n *\n * @see #createCaptureRequest\n */\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode);\n\n if (mPreviewEnabled) {\n // add Preview surface to target\n mCaptureRequestBuilder.addTarget(previewSurface);\n }\n\n // add Record surface to target\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n try {\n cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "@Override\n public void run() {\n if (playAfterConnect!=null){\n if (playAfterConnect.getMimeType().equalsIgnoreCase(\"application/x-mpegURL\") ||\n playAfterConnect.getMimeType().equalsIgnoreCase(\"application/vnd.apple.mpegURL\")) {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n if(playAfterConnect.isproxy() ==false)\n playAfterConnect.setUrl(Utils.getRedirect(playAfterConnect.getUrl()));\n sendCastMessage(playAfterConnect);\n }\n });\n thread.start();\n } else {\n if (mediaRouteMenuItem != null && mediaRouteMenuItem.isVisible() == true) {\n // logger.debug(\"Choosed item with index: \" + selectedVideo);\n if (ChromecastApp.Instance().mCastContext.getCastState() == CastState.CONNECTED) {\n // logger.debug(\"Cast video\");\n if (playAfterConnect.getUrl().startsWith(\"http\")) {\n Cast(playAfterConnect.getUrl().toString(), playAfterConnect.getUrl(), playAfterConnect.getMimeType());\n } else if (playAfterConnect.getUrl().startsWith(\"file\")) {\n LocalCast(playAfterConnect);\n }\n } else {\n\n ChromecastApp.currentVideo = playAfterConnect;\n ActionProvider provider = MenuItemCompat.getActionProvider(mediaRouteMenuItem);\n provider.onPerformDefaultAction();\n // Toast.makeText(WebViewActivity.this,getString(R.string.not_connected),Toast.LENGTH_LONG).show();\n }\n } else {\n if (!((Activity) MainActivity.this).isFinishing()) {\n Toast.makeText(MainActivity.this, getString(R.string.not_device), Toast.LENGTH_LONG).show();\n }\n }\n }\n\n }\n }", "boolean isLocalVideoStreaming(Call call);", "@Override\n\t\tpublic void onClick(View arg0) {\n\t\t\tSystem.out.println(\"播放网络上的音频\");\n\t\t\ttry {\n\n\t\t\t\tString path = catalogName + File.separator + videoName;\n\t\t\t\t// String path =\n\t\t\t\t// \"http://192.168.253.1:8080/httpGetVideo/5a3bbe53835ffd43/LoveStory.mp4\";\n\t\t\t\tConnectionDetector cd = new ConnectionDetector(\n\t\t\t\t\t\tHistoryVideoBroadcastActivity.this);\n\t\t\t\tLog.e(TAG, \"11111111111\");\n\t\t\t\tif (cd.isConnectingToInternet()) {\n\t\t\t\t\tMediaController mediaController = new MediaController(\n\t\t\t\t\t\t\tHistoryVideoBroadcastActivity.this); // 通过videoView提供的uri函数借口播放服务器视频\n\t\t\t\t\tmediaController.setAnchorView(videoView);\n\t\t\t\t\tUri video = Uri.parse(path);\n\t\t\t\t\tvideoView.setMediaController(mediaController);\n\t\t\t\t\tvideoView.setVideoURI(video);\n\t\t\t\t\tvideoView.start();\n\t\t\t\t} else {\n\t\t\t\t\tToast.makeText(HistoryVideoBroadcastActivity.this,\n\t\t\t\t\t\t\t\"网络连接没有开启,请设置网络连接\", 2000).show();\n\t\t\t\t}\n\n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO: handle exception\n\t\t\t\tToast.makeText(HistoryVideoBroadcastActivity.this,\n\t\t\t\t\t\t\"Error connecting\", Toast.LENGTH_SHORT).show();\n\t\t\t}\n\t\t}", "private void recordCam() throws IOException, InterruptedException {\n\n VideoDataStream vds = new VideoDataStream(true);\n \n while (true) {\n try {\n if (dis.available() > 0) {\n vds.processFrame(dis);\n } else {\n //Writing bytes only to detect the socket closing\n dos.write(Byte.MIN_VALUE);\n }\n } catch (Exception ex) {\n CamRegister.removeCamClient(camClient);\n break;\n }\n sleep(20);\n }\n \n RecordStorage recordStorage = new RecordStorage();\n\n recordStorage.saveVideo(vds.getBuffer(), camClient.getCamCode());\n\n vds.cleanBuffer();\n }", "void addVideoListener(CallPeer peer, VideoListener listener);", "public void recordVideo() {\n\n }", "public ArrayList<VideoFile> playData(String topic, String title, String mode) {\n Extras.print(\"CONSUMER: Video request\");\n ArrayList<VideoFile> videos = null;\n try {\n //CONSUMER HASN'T ASK FOR A VIDEO YET\n //ASK YOUR MAIN BROKER FOR A VIDEO\n if (hashTagToBrokers == null || hashTagToBrokers.isEmpty()) {\n //OPEN CONNECTION\n Socket connection = new Socket(IP, PORT);\n\n //REQUEST VIDEO\n ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());\n out.writeObject(\"PULL\");\n out.flush();\n out.writeObject(title);\n out.flush();\n out.writeObject(topic);\n out.flush();\n\n //GET ANSWER FROM BROKER\n ObjectInputStream in = new ObjectInputStream(connection.getInputStream());\n String message = (String) in.readObject();\n switch (message) {\n //BROKER HAS THE VIDEO,SEND VIDEO\n case \"ACCEPT\":\n Extras.print(\"CONSUMER: Pull request accepted\");\n videos = receiveData(in, mode);\n if(mode.equals(\"save\")){\n VideoFileHandler.write(videos);\n }\n disconnect(connection);\n return videos;\n //PUBLISHER DOESN'T EXIST\n case \"FAILURE\":\n Extras.printError(\"Publisher doesn't exist.\");\n disconnect(connection);\n return null;\n //BROKER DOESN'T HAVE THE VIDEO, SEND OTHER BROKERS\n case \"DECLINE\":\n getBrokers(in);\n }\n disconnect(connection);\n }\n //CHECK THE HASHMAP TO CHOOSE THE RIGHT BROKER\n int brokerPort = hashTagToBrokers.get(topic);\n if (brokerPort == 0) {\n Extras.printError(\"Publisher dosen't exist.\");\n return null;\n }\n Socket connection = new Socket(IP, brokerPort);\n //REQUEST VIDEO\n ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());\n out.writeObject(\"PULL\");\n out.flush();\n out.writeObject(topic);\n out.flush();\n\n //GET ANSWER FROM BROKER\n ObjectInputStream in = new ObjectInputStream(connection.getInputStream());\n String message = (String) in.readObject();\n switch (message) {\n case \"ACCEPT\":\n Extras.print(\"CONSUMER: Pull request accepted\");\n videos = receiveData(in, mode);\n break;\n default:\n Extras.printError(\"CONSUMER: PLAY: ERROR: INCONSISTENCY IN BROKERS.\");\n }\n disconnect(connection);\n } catch (IOException e) {\n Extras.printError(\"CONSUMER: PLAY: ERROR: Could not get streams.\");\n } catch (ClassNotFoundException cnf){\n Extras.printError(\"CONSUMER: PLAY: ERROR: Could not cast Object to String\");\n }\n return videos;\n }", "public void addCameraServer(String name, int framerate) {\n this.maxcount = (framerate < 50) ? 50 / framerate : 1;\n server = CameraServer.getInstance().putVideo(name, 315, 207);\n serverStarted = true;\n }", "private void setVideo(){\n /* if(detailsBean==null){\n showToast(\"没有获取到信息\");\n return;\n }\n UserManager.getInstance().setDetailsBean(detailsBean);\n upCallShowSetVideoData = new UpCallShowSetVideoData();\n upCallShowSetVideoData.smobile = Preferences.getString(Preferences.UserMobile,null);\n upCallShowSetVideoData.iringid = detailsBean.iringid;\n if (callShowSetVideoProtocol == null) {\n callShowSetVideoProtocol = new CallShowSetVideoProtocol(null, upCallShowSetVideoData, handler);\n callShowSetVideoProtocol.showWaitDialog();\n }\n callShowSetVideoProtocol.stratDownloadThread(null, ServiceUri.Spcl, upCallShowSetVideoData, handler,true);*/\n }", "VideosClient getVideos();", "public VideoStream(int camera) {\n\t\tsuper();\n\t\tsetCamera(camera);\n\t}", "private void initCaptureSetting(GLSurfaceView preview, FrameLayout window, GLSurfaceView remote) {\n RTCMediaStreamingManager.init(getApplicationContext());\n\n /**\n * Step 2: find & init views\n */\n\n /**\n * Step 3: config camera settings\n */\n CameraStreamingSetting.CAMERA_FACING_ID facingId = chooseCameraFacingId();\n if (mCameraStreamingSetting == null) {\n mCameraStreamingSetting = new CameraStreamingSetting();\n }\n mCameraStreamingSetting.setCameraFacingId(facingId)\n .setContinuousFocusModeEnabled(true)\n .setRecordingHint(false)\n .setResetTouchFocusDelayInMs(3000)\n .setFocusMode(CameraStreamingSetting.FOCUS_MODE_CONTINUOUS_PICTURE)\n .setCameraPrvSizeLevel(CameraStreamingSetting.PREVIEW_SIZE_LEVEL.MEDIUM)\n .setCameraPrvSizeRatio(CameraStreamingSetting.PREVIEW_SIZE_RATIO.RATIO_16_9)\n .setBuiltInFaceBeautyEnabled(true) // Using sdk built in face beauty algorithm\n .setFaceBeautySetting(new CameraStreamingSetting.FaceBeautySetting(0.8f, 0.8f, 0.6f)) // sdk built in face beauty settings\n .setVideoFilter(CameraStreamingSetting.VIDEO_FILTER_TYPE.VIDEO_FILTER_BEAUTY); // set the beauty on/off\n mCurrentCamFacingIndex = facingId.ordinal();\n\n /**\n * Step 4: create streaming manager and set listeners\n */\n if (mRTCStreamingManager == null) {\n mRTCStreamingManager = new RTCMediaStreamingManager(getApplicationContext(),\n preview, AVCodecType.SW_VIDEO_WITH_SW_AUDIO_CODEC);\n mRTCStreamingManager.prepare(mCameraStreamingSetting, null);\n }\n mRTCStreamingManager.setConferenceStateListener(mRTCStreamingStateChangedListener);\n mRTCStreamingManager.setRemoteWindowEventListener(mRTCRemoteWindowEventListener);\n mRTCStreamingManager.setUserEventListener(mRTCUserEventListener);\n mRTCStreamingManager.setDebugLoggingEnabled(false);\n mRTCStreamingManager.mute(true);\n\n /**\n * Step 5: set conference options\n */\n RTCConferenceOptions confOptions = new RTCConferenceOptions();\n // vice anchor can use a smaller size\n // RATIO_4_3 & VIDEO_ENCODING_SIZE_HEIGHT_240 means the output size is 320 x 240\n // 4:3 looks better in the mix frame\n confOptions.setVideoEncodingSizeRatio(RTCConferenceOptions.VIDEO_ENCODING_SIZE_RATIO.RATIO_4_3);\n confOptions.setVideoEncodingSizeLevel(RTCConferenceOptions.VIDEO_ENCODING_SIZE_HEIGHT_240);\n // vice anchor can use a higher conference bitrate for better image quality\n confOptions.setVideoBitrateRange(300 * 1000, 800 * 1000);\n // 20 fps is enough\n confOptions.setVideoEncodingFps(20);\n confOptions.setHWCodecEnabled(false);\n mRTCStreamingManager.setConferenceOptions(confOptions);\n\n /**\n * Step 6: create the remote windows\n */\n if (mRTCVideoWindow == null) {\n mRTCVideoWindow = new RTCVideoWindow(window, remote);\n\n /**\n * Step 8: add the remote windows\n */\n mRTCStreamingManager.addRemoteWindow(mRTCVideoWindow);\n }\n\n /**\n * Step 9: do prepare, anchor should config streaming profile first\n */\n StreamingProfile mStreamingProfile = new StreamingProfile();\n mStreamingProfile.setEncodingOrientation(\n isLandscape() ? StreamingProfile.ENCODING_ORIENTATION.LAND : StreamingProfile.ENCODING_ORIENTATION.PORT);\n mRTCStreamingManager.setStreamingProfile(mStreamingProfile);\n }", "public void startVideoPlayer(Context context, String url) {\n Resource item = new Resource();\n item.setType(context.getString(R.string.typeVideo));\n item.setUrlMain(url);\n context.startActivity(PlayVideoFullScreenActivity.getStartActivityIntent(context, ConstantUtil.BLANK, ConstantUtil.BLANK, PlayVideoFullScreenActivity.NETWORK_TYPE_ONLINE, (Resource) item));\n }", "private void showOST(int position) {\n\t\tString youtubeUrl = \"\";\n\t\tString youtubeId = \"\";\n\t\tString rtsp_link = \"\";\n\t\t\n\t\t//urlYoutube = ost_links[position];\n\t\t//youtubeUrl = \"http://www.youtube.com/watch?v=MV5qvrxmegY\";\n\t\t//rtsp_link = getUrlVideoRTSP(youtubeUrl);\n\t\t//rtsp_link = \"rtsp://r1---sn-a5m7zu7e.c.youtube.com/CiILENy73wIaGQkGema8vmpeMRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp\";\n\t\t//rtsp_link = \"https://archive.org/download/Pbtestfilemp4videotestmp4/video_test_512kb.mp4\";\n\t\t//rtsp_link = \"rtsp://r3---sn-a5m7zu7d.c.youtube.com/CiILENy73wIaGQn061BlwOVsxRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp\";\n\t\trtsp_link = ost_links[position];\t\t\n\t\tVideoView videoView = (VideoView) this.findViewById(R.id.videoView1);\n\t\tLog.v(\"Video\", \"***Video to Play:: \" + rtsp_link);\n\t\t\n\t\t// add controls to a MediaPlayer like play, pause.\n\t\tMediaController mc = new MediaController(this);\n\t\tvideoView.setMediaController(mc);\n\t\n\t\t// Set the path of Video or URI\n\t\tmc.setAnchorView(videoView);\n\t\tUri videoPath = null;\n\t\tvideoPath = Uri.parse(rtsp_link);\n\t\t\n\t\tvideoView.setVideoURI(videoPath);\n\t\tvideoView.requestFocus();\n\t\tvideoView.start();\t\n\t\tmc.show();\n\t}", "public int shareLocalVideo() {\n videoEnabled = !videoEnabled;\n return mRtcEngine.enableLocalVideo(videoEnabled);\n }", "public void playVideo() {\n }", "public void startCamera()\n \t{\n\t\t// start the video capture\n\t\t//this.capture.open(0);\n\t\tcapture.open(cameraNumber);\n\n\n\n\t\t// is the video stream available?\n\t\tif (capture.isOpened())\n\t\t{\n\t\t\t// grab a frame every 33 ms (30 frames/sec)\n\t\t\tRunnable frameGrabber = new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run()\n\t\t\t\t{\n\t\t\t\t\tgrabFrame();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimer = Executors.newSingleThreadScheduledExecutor();\n\t\t\ttimer.scheduleAtFixedRate(frameGrabber, 0, 500, TimeUnit.MILLISECONDS);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// log the error\n\t\t\tSystem.err.println(\"Impossible to open the camera connection...\");\n\t\t}\n \t}", "public void run(){\n\t\tWebcam webcam = Webcam.getDefault();\n webcam.setViewSize(new Dimension(176,144));\n\t\t//webcam.setViewSize(WebcamResolution.VGA.getSize());\n webcam.open();\n isRunning=true;\n try\n {\n ss=new ServerSocket(1088);\n s=ss.accept();\n OutputStream os=s.getOutputStream();\n System.out.println(\"Client connected!\");\n while(isRunning)\n {\n BufferedImage image = webcam.getImage();\n //java.io.BufferedOutputStream bo=new BufferedOutputStream(s.getOutputStream());\n //ObjectOutputStream oo=new ObjectOutputStream(s.getOutputStream());\n //oo.writeObject(image);\n //oo.flush();\n //System.out.println(\"An image was sent!\");\n \n ImageIO.write(image, \"PNG\", os);\n os.flush();\n p.getGraphics().drawImage(image, 0, 0,null);\n Thread.sleep(100);\n }\n \n } catch (Exception ex){}\n\t}", "public int getVideoPort();", "public Single<Uri> video(@NonNull FragmentActivity activity) {\n return requestImage(\n activity,\n false,\n MimeType.VIDEO)\n .map(uris -> uris.get(0)\n );\n }", "public interface CameraVideoListener {\n void onVideoRecordStarted(Size videoSize);\n\n void onVideoRecordStopped(File videoFile, CameraFragmentResultListener callback);\n\n void onVideoRecordError();\n}", "@Override\n public void onSubmit(EasyVideoPlayer player, Uri source) {\n }", "@Override\n public void onServiceConnected(ComponentName className,\n IBinder service) {\n LiveVideoBroadcaster.LocalBinder binder = (LiveVideoBroadcaster.LocalBinder) service;\n if (mLiveVideoBroadcaster == null) {\n mLiveVideoBroadcaster = binder.getService();\n mLiveVideoBroadcaster.init(LiveVideoBroadcasterActivity.this, mGLView);\n mLiveVideoBroadcaster.setAdaptiveStreaming(true);\n }\n mLiveVideoBroadcaster.openCamera(Camera.CameraInfo.CAMERA_FACING_FRONT);\n }", "public void goToVideoViewer(Uri vidURI) {\n Log.i(\"progress\",\"goToViewer\");\n\n Intent playerIntent = new Intent(this, VideoActivity.class);\n\n //attaches the video's uri\n playerIntent.putExtra(INTENT_MESSAGE, vidURI.toString());\n startActivity(playerIntent);\n }", "private void setupLocalVideo() {\n\n // Enable the video module.\n mRtcEngine.enableVideo();\n\n mLocalView = RtcEngine.CreateRendererView(getBaseContext());\n mLocalView.setZOrderMediaOverlay(true);\n mLocalContainer.addView(mLocalView);\n\n mRtcEngine.setupLocalVideo(new VideoCanvas(mLocalView, VideoCanvas.RENDER_MODE_HIDDEN, 0));\n }", "public CameraSet(Controls controls, String devpath1, String devpath2) {\n this.controls = controls;\n this.cam1 = CameraServer.getInstance().startAutomaticCapture(\"Back\", devpath2);\n this.cam2 = CameraServer.getInstance().startAutomaticCapture(\"Front\", devpath1);\n\n// cam1.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n// cam2.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n\n outputStream = CameraServer.getInstance().putVideo(\"camera_set\", (int) (multiplier * 160), (int) (multiplier * 120));\n source = new Mat();\n\n }", "public interface VideoThreadShow {\n void AddMySurfaceView(int threadnum);\n void DeleMySurfaceView(int threadnum);\n void TryAddVideoThread();//开启新的线程\n void ShowBitmap(Bitmap bitmap,int sufacenum);\n void ToastShow(String ss);\n ServerSocket getServerSocket();\n Handler GetUIHandler();\n void StopActivity();\n}", "public void startVideoRecording() {\n\n try {\n mVideoFileTest = createVideoFile(mVideoFolder);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // set up Recorder\n try {\n setupMediaRecorder();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // prepare for recording\n sendVideoRecordingRequest();\n\n // start recording\n mMediaRecorder.start();\n\n if (mRokidCameraRecordingListener != null) {\n mRokidCameraRecordingListener.onRokidCameraRecordingStarted();\n }\n }", "private void setupRemoteVideo(int uid, ViewGroup remoteContainer) {\n int count = remoteContainer.getChildCount();\n View view = null;\n for (int i = 0; i < count; i++) {\n View v = remoteContainer.getChildAt(i);\n if (v.getTag() instanceof Integer && ((int) v.getTag()) == uid) {\n view = v;\n }\n }\n if (view != null) {\n return;\n }\n\n // Checks have passed so set up the remote video.\n int renderMode;\n SurfaceView remoteView = RtcEngine.CreateRendererView(getBaseContext());\n if (uid == WINDOW_SHARE_UID) {\n mRemoteShareView = remoteView;\n renderMode = VideoCanvas.RENDER_MODE_FIT;\n } else {\n mRemoteCameraView = remoteView;\n renderMode = VideoCanvas.RENDER_MODE_HIDDEN;\n }\n\n remoteContainer.addView(remoteView);\n mRtcEngine.setupRemoteVideo(new VideoCanvas(remoteView, renderMode, uid));\n remoteView.setTag(uid);\n }", "public void setVideoDevice(String id);", "public abstract void videoMessage(Message m);", "@Override\r\n public void call() {\n System.out.println(\"开始视频通话\");\r\n }", "public void stopStreaming() {\n phoneCam.stopStreaming();\n }", "public VideoStream() {\n\t\tthis(CameraInfo.CAMERA_FACING_BACK);\n\t}", "@Override\r\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\tmVideoContrl.seekTo((int) time);\r\n\r\n\t\t\t\t\t\t}", "public static void main(String argv[]) throws Exception{\n Client theClient = new Client();\n \n //get server RTSP port and IP address from the command line\n //------------------\n int RTSP_server_port = Integer.parseInt(argv[1]);\n String ServerHost = argv[0];\n InetAddress ServerIPAddr = InetAddress.getByName(ServerHost);\n \n //get video filename to request:\n VideoFileName = argv[2];\n \n //Establish a TCP connection with the server to exchange RTSP messages\n //------------------\n theClient.RTSPsocket = new Socket(ServerIPAddr, RTSP_server_port);\n \n //Set input and output stream filters:\n RTSPBufferedReader = new BufferedReader(new InputStreamReader(theClient.RTSPsocket.getInputStream()) );\n RTSPBufferedWriter = new BufferedWriter(new OutputStreamWriter(theClient.RTSPsocket.getOutputStream()) );\n \n //init RTSP state:\n state = INIT;\n }", "void adjustControllersForLiveStream(boolean isLive);", "@Override\r\n\tpublic void onMedia(HttpRequest paramHttpRequest, Media media) {\n\t\tif (paramHttpRequest.getAttibute(request_object) != null) {\r\n\t\t\tHttpRequest request = (HttpRequest) paramHttpRequest\r\n\t\t\t\t\t.getAttibute(request_object);\r\n\t\t\tObject message = paramHttpRequest.getAttibute(message_object);\r\n\t\t\tif (message != null) {\r\n\t\t\t\tOutMessage msg = null;\r\n\t\t\t\tif (message instanceof BroadcastMessage) {\r\n\t\t\t\t\tmsg = (BroadcastMessage) paramHttpRequest\r\n\t\t\t\t\t\t\t.getAttibute(message_object);\r\n\t\t\t\t\tMedia m = msg.getMedia();\r\n\t\t\t\t\tif (m instanceof Video) {\r\n\t\t\t\t\t\tMpvideo mv = new Mpvideo((Video) m);\r\n\t\t\t\t\t\tmv.setMedia_id(media.getMedia_id());\r\n\t\t\t\t\t\tmsg.setMsgtype(MsgType.mpvideo.name());\r\n\t\t\t\t\t\t((BroadcastMessage) msg).setMpvideo(mv);\r\n\t\t\t\t\t\tmsg.setVideo(null);\r\n\r\n\t\t\t\t\t\tHttpRequest upload = RequestFactory.videoMsgRequest(\r\n\t\t\t\t\t\t\t\tthis, session.getApp().getAccess_token(),\r\n\t\t\t\t\t\t\t\tmv.toJson());\r\n\t\t\t\t\t\tupload.setAttribute(request_object, request);\r\n\t\t\t\t\t\tupload.setAttribute(message_object, msg);\r\n\t\t\t\t\t\tsession.execute(request);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (message instanceof OutMessage) {\r\n\t\t\t\t\tmsg = (OutMessage) paramHttpRequest\r\n\t\t\t\t\t\t\t.getAttibute(message_object);\r\n\t\t\t\t}\r\n\t\t\t\tif (msg != null) {\r\n\t\t\t\t\tmsg.getMedia().setMedia_id(media.getMedia_id());\r\n\t\t\t\t\trequest.setContent(msg.toJson());\r\n\t\t\t\t\tsession.execute(request);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n public void handleMessage(Message msg) {\n super.handleMessage(msg);\n switch (msg.what) {\n case PLAY_VIDEO:\n JCVideoPlayer.releaseAllVideos();\n /* if (topVideoList.size() == 1) {\n videoplayer.setUp(topVideoList.get(videotype).getPath()\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n } else {\n videoplayer.setUp(topVideoList.get(videotype).getPath()\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n if (videotype == topVideoList.size() - 1) {\n videotype = 0;\n } else {\n videotype++;\n }\n }*/\n if (videotype == 0) {\n videoplayer.setUp(Constant.fileSavePath + \"lx2.mp4\"\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n videotype = 1;\n } else {\n videoplayer.setUp(Constant.fileSavePath + \"lx1.mp4\"\n , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, \"视频播放\");\n videotype = 0;\n }\n videoplayer.startVideo();\n break;\n case PLAY_BANNER:\n loadTestDatas();\n break;\n case PLAY_BANNERAPAWAIT:\n loadTestApawaitDatas();\n break;\n case PLAY_VIDEOHEIGHT:\n ViewGroup.LayoutParams params = rel_top.getLayoutParams();\n if (msg.arg1 == 1) {\n params.height = 506;\n } else if (msg.arg1 == 2) {\n params.height = 607;\n }\n rel_top.setLayoutParams(params);\n break;\n case PY_START:\n cabinetTransaction.start(Constant.pypwd, Constant.dev, Constant.pytype, 1, Constant.guiBean.getNumber(), cabinetTransactionEventListener);\n break;\n case 12345:\n tvloginfo.setText(msg.obj.toString());\n break;\n case MSG_CLOSE_CHECK_PENDING:\n Log.i(\"TCP\", \"开始添加\");\n synchronized (boxesPendingList) {\n for (int i = 0; i < boxesPendingList.length; i++) {\n if (boxesPendingList[i].boxId == 0) {//无效的格子编号,当前位置 可以存储格子数据\n try {\n Thread.sleep(500);\n CloseCheckBox closeCheckBox = (CloseCheckBox) msg.obj;\n boxesPendingList[i] = closeCheckBox;\n } catch (InterruptedException e) {\n e.printStackTrace();\n Log.i(\"TCP\", \">锁boxesPendingList2<\" + e.toString());\n }\n break;\n }\n }\n }\n Log.i(\"TCP\", \"结束添加\");\n break;\n default:\n break;\n }\n }", "@FXML\r\n protected void startCamera() {\r\n // set a fixed width for the frame\r\n this.currentFrame.setFitWidth(600);\r\n // preserve image ratio\r\n this.currentFrame.setPreserveRatio(true);\r\n\r\n if (!this.cameraActive) {\r\n\r\n // start the video capture\r\n //this.capture.open(0);\r\n //Read the video (Chage video)\r\n this.capture.open(\"Faruri.m4v\");\r\n\r\n\r\n System.out.println(\"start capture...\");\r\n // is the video stream available?\r\n if (this.capture.isOpened()) {\r\n System.out.println(\"inif\");\r\n this.cameraActive = true;\r\n\r\n // grab a frame every 33 ms (30 frames/sec)\r\n Runnable frameGrabber = new Runnable() {\r\n\r\n @Override\r\n public void run() {\r\n // effectively grab and process a single frame\r\n Mat frame = grabFrame();\r\n\r\n//\t\t\t\t\t\t// convert and show the frame\r\n//\t\t\t\t\t\tImage imageToShow = Utils.mat2Image(frame);\r\n//\t\t\t\t\t\tupdateImageView(currentFrame, imageToShow);\r\n }\r\n };\r\n\r\n this.timer = Executors.newSingleThreadScheduledExecutor();\r\n this.timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MILLISECONDS);\r\n\r\n // update the button content\r\n this.button.setText(\"Stop Video\");\r\n } else {\r\n // log the error\r\n System.err.println(\"Impossible to open the video...\");\r\n }\r\n } else {\r\n // the camera is not active at this point\r\n this.cameraActive = false;\r\n // update again the button content\r\n this.button.setText(\"Start Video\");\r\n\r\n // stop the timer\r\n this.stopAcquisition();\r\n }\r\n }", "@Test\n public void clientCreatesStreamAndServerReplies() throws Exception {\n peer.sendFrame().settings(new Settings());\n peer.acceptFrame();// ACK\n\n peer.acceptFrame();// SYN_STREAM\n\n peer.acceptFrame();// DATA\n\n peer.sendFrame().headers(false, 3, TestUtil.headerEntries(\"a\", \"android\"));\n peer.sendFrame().data(true, 3, new Buffer().writeUtf8(\"robot\"), 5);\n peer.acceptFrame();// PING\n\n peer.sendFrame().ping(true, 1, 0);// PING\n\n peer.play();\n // play it back\n Http2Connection connection = connect(peer);\n Http2Stream stream = connection.newStream(TestUtil.headerEntries(\"b\", \"banana\"), true);\n BufferedSink out = Okio.buffer(stream.getSink());\n out.writeUtf8(\"c3po\");\n out.close();\n Assert.assertEquals(Headers.of(\"a\", \"android\"), stream.takeHeaders());\n assertStreamData(\"robot\", stream.getSource());\n connection.writePingAndAwaitPong();\n Assert.assertEquals(0, connection.openStreamCount());\n // verify the peer received what was expected\n MockHttp2Peer.InFrame synStream = peer.takeFrame();\n Assert.assertEquals(TYPE_HEADERS, synStream.type);\n Assert.assertFalse(synStream.outFinished);\n Assert.assertEquals(3, synStream.streamId);\n Assert.assertEquals((-1), synStream.associatedStreamId);\n Assert.assertEquals(TestUtil.headerEntries(\"b\", \"banana\"), synStream.headerBlock);\n MockHttp2Peer.InFrame requestData = peer.takeFrame();\n Assert.assertArrayEquals(\"c3po\".getBytes(StandardCharsets.UTF_8), requestData.data);\n }", "public GetVideoRequest(UUID requestUUID, Video video) {\n super(requestUUID, video.getVidUrl());\n this.video = video;\n getVideoRequestCount += 1;\n }", "public void AddCameraServer(int framerate) {\n addCameraServer(\"Pixy Output\", framerate);\n }", "private void toggleScreenShare(View v) {\n\n if(((ToggleButton)v).isChecked()){\n initRecorder();\n recordScreen();\n }\n else\n {\n mediaRecorder.stop();\n mediaRecorder.reset();\n stopRecordScreen();\n\n //play in videoView\n //videoView.setVisibility(View.VISIBLE);\n //videoView.setVideoURI(Uri.parse(videoUri));\n //videoView.start();\n\n\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setTitle(\" Location of video : \");\n builder.setMessage(videoUri);\n builder.show();\n\n Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n Intent i = new Intent(MainActivity.this, PlayVideo.class);\n i.putExtra(\"KEY\", videoUri);\n //Toast.makeText(this, videoUri, Toast.LENGTH_SHORT).show();\n startActivity(i);\n }\n }, 2000);\n Toast.makeText(this, \"Loading video...\", Toast.LENGTH_SHORT).show();\n\n\n\n }\n }", "private void initializePlayer() {\n mBufferingTextView.setVisibility(VideoView.VISIBLE);\n\n // Buffer and decode the video sample.\n Uri videoUri = getMedia(VIDEO_URL);\n mVideoView.setVideoURI(videoUri);\n\n // Listener for onPrepared() event (runs after the media is prepared).\n mVideoView.setOnPreparedListener(\n new MediaPlayer.OnPreparedListener() {\n @Override\n public void onPrepared(MediaPlayer mediaPlayer) {\n\n // Hide buffering message.\n mBufferingTextView.setVisibility(VideoView.INVISIBLE);\n previewImageview.setVisibility(View.GONE);\n // Restore saved position, if available.\n if (mCurrentPosition > 0) {\n mVideoView.seekTo(mCurrentPosition);\n } else {\n // Skipping to 1 shows the first frame of the video.\n mVideoView.seekTo(1);\n }\n\n // Start playing!\n mVideoView.start();\n }\n });\n\n // Listener for onCompletion() event (runs after media has finished\n // playing).\n mVideoView.setOnCompletionListener(\n new MediaPlayer.OnCompletionListener() {\n @Override\n public void onCompletion(MediaPlayer mediaPlayer) {\n// TODO Restart video\n\n // Return the video position to the start.\n mVideoView.seekTo(0);\n mVideoView.start();\n }\n });\n }", "private void initVideoPlayer(CaptureObserver observer) {\r\n\t\tmediaSrc.stopStream();\r\n\t\tmediaSrc.setObserver(observer);\r\n\t\tmediaSrc.playStream();\r\n\t\tif(mediaSrc.isStreaming() && observer == this) {\r\n\t\t\tplayer.setVisible(true);\r\n\t\t} else {\r\n\t\t\tplayer.setVisible(false);\r\n\t\t}\r\n\t}", "public String getVideoDevice();", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "public abstract void addReceivedVideo(Video video) throws UnsuportedOperationException;", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n\n final Channel channel;\n channel = channels.get(position);\n\n this.setupStalkerClient();\n\n String url = UrlSettings.getResUrl() + this.user_id + \"/tv-channels/\"+channel.channel_id + \"/link\";\n\n getAPILoader().loader(url, new StalkerLoader.OnJSONResponseCallback() {\n @Override\n public void onJSONResponse(boolean success, JSONObject response) {\n\n try {\n if (response.has(\"status\")) {\n\n String channelLink = response.getString(\"results\");\n Log.d(TAG, \"Channel LINK is: \" + channelLink);\n\n Intent player = new Intent();\n player.setAction(Intent.ACTION_VIEW);\n\n player.setDataAndType(Uri.parse(channelLink), \"video/*\");\n player.putExtra(\"title\", channel.name);\n player.putExtra(\"secure_uri\", true);\n startActivity(player);\n }\n\n if (response.has(\"error\")) {\n\n Toast.makeText(getActivity().getApplicationContext(), response.getString(\"error\"), Toast.LENGTH_LONG).show();\n }\n\n } catch (JSONException e) {\n\n Toast.makeText(getActivity().getApplicationContext(), \"Error in code..((\", Toast.LENGTH_LONG).show();\n e.printStackTrace();\n\n }\n\n Log.d(TAG, \"GET CHANNELS REQUEST COMPLETE: \" + response.toString());\n }\n });\n\n }", "public void enableVideoSourceReuse(boolean enable);", "private void addStreamToLocalPeer() {\n //creating local mediastream\n MediaStream stream = peerConnectionFactory.createLocalMediaStream(\"102\");\n stream.addTrack(localAudioTrack);\n stream.addTrack(localVideoTrack);\n localPeer.addStream(stream);\n }", "public void AddCameraServer() {\n addCameraServer(\"Pixy Output\", 50);\n }", "public void onShowCameraClicked(View view) {\n if (mUIState == UIState.CONNECTED_FULLSCREEN) {\n // Toggle to split screen while showing remote camera\n if (mRemoteCameraUid != 0)\n setupRemoteVideo(mRemoteCameraUid, mRemoteCameraContainer);\n removeRemoteShare();\n setupRemoteVideo(WINDOW_SHARE_UID, mRemoteShareContainerSplit);\n setUIState(UIState.CONNECTED_SPLITSCREEN);\n } else if (mUIState == UIState.CONNECTED_SPLITSCREEN) {\n // Toggle to full screen while hiding remote camera\n removeRemoteCamera();\n removeRemoteShare();\n setupRemoteVideo(WINDOW_SHARE_UID, mRemoteShareContainerFull);\n setUIState(UIState.CONNECTED_FULLSCREEN);\n }\n }", "public VideoMetadataMediator() {\n // Initialize the VideoServiceProxy.\n mVideoServiceProxy = new RestAdapter\n .Builder()\n .setEndpoint(SERVER_URL)\n .build()\n .create(VideoServiceProxy.class);\n }", "@Override\r\n\t\t\t\tpublic void run() {\n\t\t\t\t\tmVideoContrl.seekTo(mpos);\r\n\r\n\t\t\t\t}", "public void startVideoRecording() {\n this.mActivity.getCameraAppUI().switchShutterSlidingAbility(false);\n if (this.mCameraState == 1) {\n setCameraState(2);\n Tag tag = TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"startVideoRecording: \");\n stringBuilder.append(Thread.currentThread());\n Log.i(tag, stringBuilder.toString());\n ToastUtil.showToast(this.mActivity, this.mActivity.getString(R.string.video_recording_start_toast), 0);\n this.mAppController.onVideoRecordingStarted();\n if (this.mModeSelectionLockToken == null) {\n this.mModeSelectionLockToken = this.mAppController.lockModuleSelection();\n }\n this.mUI.showVideoRecordingHints(false);\n this.mUI.cancelAnimations();\n this.mUI.setSwipingEnabled(false);\n this.mUI.showFocusUI(false);\n this.mAppController.getCameraAppUI().hideRotateButton();\n this.mAppController.getButtonManager().hideEffectsContainerWrapper();\n final long updateStorageSpaceTime = System.currentTimeMillis();\n this.mActivity.updateStorageSpaceAndHint(new OnStorageUpdateDoneListener() {\n public void onStorageUpdateDone(long bytes) {\n Tag access$100 = VideoModule.TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"updateStorageSpaceAndHint cost time :\");\n stringBuilder.append(System.currentTimeMillis() - updateStorageSpaceTime);\n stringBuilder.append(\"ms.\");\n Log.d(access$100, stringBuilder.toString());\n if (VideoModule.this.mCameraState != 2) {\n VideoModule.this.pendingRecordFailed();\n return;\n }\n if (bytes <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {\n Log.w(VideoModule.TAG, \"Storage issue, ignore the start request\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mCameraDevice == null) {\n Log.v(VideoModule.TAG, \"in storage callback after camera closed\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mPaused) {\n Log.v(VideoModule.TAG, \"in storage callback after module paused\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mMediaRecorderRecording) {\n Log.v(VideoModule.TAG, \"in storage callback after recording started\");\n } else if (VideoModule.this.isSupported(VideoModule.this.mProfile.videoFrameWidth, VideoModule.this.mProfile.videoFrameHeight)) {\n VideoModule.this.mCurrentVideoUri = null;\n VideoModule.this.mCameraDevice.enableShutterSound(false);\n if (VideoModule.this.mNeedGLRender && VideoModule.this.isSupportEffects()) {\n VideoModule.this.playVideoSound();\n VideoModule.this.initGlRecorder();\n VideoModule.this.pauseAudioPlayback();\n VideoModule.this.mActivity.getCameraAppUI().startVideoRecorder();\n } else {\n VideoModule.this.initializeRecorder();\n if (VideoModule.this.mMediaRecorder == null) {\n Log.e(VideoModule.TAG, \"Fail to initialize media recorder\");\n VideoModule.this.pendingRecordFailed();\n return;\n }\n VideoModule.this.pauseAudioPlayback();\n try {\n long mediarecorderStart = System.currentTimeMillis();\n VideoModule.this.mMediaRecorder.start();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder2 = new StringBuilder();\n stringBuilder2.append(\"mMediaRecorder.start() cost time : \");\n stringBuilder2.append(System.currentTimeMillis() - mediarecorderStart);\n Log.d(access$100, stringBuilder2.toString());\n VideoModule.this.playVideoSound();\n VideoModule.this.mCameraDevice.refreshSettings();\n VideoModule.this.mCameraSettings = VideoModule.this.mCameraDevice.getSettings();\n VideoModule.this.setFocusParameters();\n } catch (RuntimeException e) {\n Log.e(VideoModule.TAG, \"Could not start media recorder. \", e);\n VideoModule.this.releaseMediaRecorder();\n VideoModule.this.mCameraDevice.lock();\n VideoModule.this.releaseAudioFocus();\n if (VideoModule.this.mModeSelectionLockToken != null) {\n VideoModule.this.mAppController.unlockModuleSelection(VideoModule.this.mModeSelectionLockToken);\n }\n VideoModule.this.setCameraState(1);\n if (VideoModule.this.shouldHoldRecorderForSecond()) {\n VideoModule.this.mAppController.setShutterEnabled(true);\n }\n VideoModule.this.mAppController.getCameraAppUI().showModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(true);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.onVideoRecordingStop();\n }\n ToastUtil.showToast(VideoModule.this.mActivity.getApplicationContext(), (int) R.string.video_record_start_failed, 0);\n return;\n }\n }\n VideoModule.this.mAppController.getCameraAppUI().setSwipeEnabled(false);\n VideoModule.this.setCameraState(3);\n VideoModule.this.tryLockFocus();\n VideoModule.this.mMediaRecorderRecording = true;\n VideoModule.this.mActivity.lockOrientation();\n VideoModule.this.mRecordingStartTime = SystemClock.uptimeMillis() + 600;\n VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().setAngle(VideoModule.this.mOrientation);\n VideoModule.this.mAppController.getCameraAppUI().hideModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(false);\n }\n if (VideoModule.this.isVideoShutterAnimationEnssential()) {\n VideoModule.this.mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoCaptureButton(true);\n }\n if (VideoModule.this.mAppController.getCameraAppUI().getCurrentModeIndex() == VideoModule.this.mActivity.getResources().getInteger(R.integer.camera_mode_video)) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoPauseButton(false);\n }\n VideoModule.this.mUI.showRecordingUI(true);\n if (VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().getVisibility() == 0) {\n VideoModule.this.mUI.hideCapButton();\n }\n VideoModule.this.showBoomKeyTip();\n VideoModule.this.updateRecordingTime();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder3 = new StringBuilder();\n stringBuilder3.append(\"startVideoRecording cost time 1 : \");\n stringBuilder3.append(System.currentTimeMillis() - VideoModule.this.mShutterButtonClickTime);\n Log.d(access$100, stringBuilder3.toString());\n if (VideoModule.this.isSendMsgEnableShutterButton()) {\n VideoModule.this.mHandler.sendEmptyMessageDelayed(6, VideoModule.MIN_VIDEO_RECODER_DURATION);\n }\n VideoModule.this.mActivity.enableKeepScreenOn(true);\n VideoModule.this.mActivity.startInnerStorageChecking(new OnInnerStorageLowListener() {\n public void onInnerStorageLow(long bytes) {\n VideoModule.this.mActivity.stopInnerStorageChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_storage_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n VideoModule.this.mActivity.startBatteryInfoChecking(new OnBatteryLowListener() {\n public void onBatteryLow(int level) {\n VideoModule.this.mActivity.stopBatteryInfoChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_battery_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n } else {\n Log.e(VideoModule.TAG, \"Unsupported parameters\");\n VideoModule.this.pendingRecordFailed();\n }\n }\n });\n }\n }", "@Override\n\tpublic void videoStart() {\n\t\t\n\t}", "public void reloadVideoDevices();", "@Override\n public void receiveFrameDataForMediaCodec(Camera camera, int avChannel, byte[] buf, int length, int pFrmNo, byte[] pFrmInfoBuf, boolean\n isIframe, int codecId) {\n\n }", "public CameraSelectionView(String windowTitle, MediaStreamer mediaSource) {\r\n\t\t\r\n\t\tsuper(\"Camera Options - \" + windowTitle);\r\n\t\tmediaSrc = mediaSource;\r\n\t\tthis.addWindowListener(this);\r\n\t\t\r\n\t\t// --- Source Selection Panel ---\r\n\t\tJPanel selectionPanel = new JPanel();\r\n\t\tselectionPanel.setBorder(BorderFactory.createTitledBorder(\"Source Selection\"));\r\n\t\tthis.getContentPane().add(selectionPanel, BorderLayout.NORTH);\r\n\t\t\r\n\t\tJPanel selectionOptions = new JPanel();\r\n\t\tselectionOptions.setLayout(new BoxLayout(selectionOptions, BoxLayout.Y_AXIS));\r\n\t\t\r\n\t\tavailableCams = new DefaultComboBoxModel();\r\n\t\tavailableCams.addElement(NO_CAMERA);\r\n\t\tavailableCams.setSelectedItem(NO_CAMERA);\r\n\t\t\r\n\t\tcamSelectBox = new JComboBox(availableCams);\r\n\t\tcamSelectBox.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t\tObject selectedItem = camSelectBox.getSelectedItem();\r\n\t\t\t\t\r\n\t\t\t\t// Check if the \"NO_CAMERA\" string is selected. If so, disable\r\n\t\t\t\t// all fields and set the active camera to null\r\n\t\t\t\tif(selectedItem == NO_CAMERA) {\r\n\t\t\t\t\tsetFieldsEnabled(false);\r\n\t\t\t\t\tmediaSrc.setActiveCamera(null);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// A new camera has been selected\r\n\t\t\t\t\tCameraController newCam = (CameraController)selectedItem;\r\n\t\t\t\t\tmediaSrc.setActiveCamera(newCam);\r\n\t\t\t\t\trefreshSettingsFields();\r\n\t\t\t\t\tsetFieldsEnabled(true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tJButton detectDevices = new JButton(\"Detect Devices\");\r\n\t\tdetectDevices.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\t/** Trigger a re-detection of connected cameras */\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tif(mediaSrc.isStreaming()) {\r\n\t\t\t\t\tstopVideoPlayer();\r\n\t\t\t\t}\r\n\t\t\t\tupdateDeviceList();\r\n\t\t\t}\r\n\t\t});\r\n\t\tselectionOptions.add(detectDevices);\r\n\t\t\r\n\t\tJButton startPreview = new JButton(\"View Preview\");\r\n\t\tstartPreview.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\t/** Activate media streaming */\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tinitVideoPlayer(CameraSelectionView.this);\r\n\t\t\t}\r\n\t\t});\r\n\t\tselectionOptions.add(startPreview);\r\n\t\t\r\n\t\tJButton startNetwork = new JButton(\"Start Network Stream\");\r\n\t\tstartNetwork.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\t/** Activate media streaming */\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tinitVideoPlayer(null);\r\n\t\t\t}\r\n\t\t});\r\n\t\tselectionOptions.add(startNetwork);\r\n\t\t\r\n\t\tJButton stopStream = new JButton(\"Stop Preview/Stream\");\r\n\t\tstopStream.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\t/** Deactivate media streaming */\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tmediaSrc.stopStream();\r\n\t\t\t\tmediaSrc.setObserver(null);\r\n\t\t\t\tplayer.setVisible(false);\r\n\t\t\t}\r\n\t\t});\r\n\t\tselectionOptions.add(stopStream);\r\n\t\tselectionPanel.add(camSelectBox);\r\n\t\tselectionPanel.add(selectionOptions);\r\n\t\t\r\n\t\t// --- Position Settings panel ---\r\n\t\tJPanel positionPanel = new JPanel();\r\n\t\tpositionPanel.setBorder(BorderFactory.createTitledBorder(\"Camera Settings\"));\r\n\t\tpositionPanel.setLayout(new BoxLayout(positionPanel, BoxLayout.Y_AXIS));\r\n\t\tthis.getContentPane().add(positionPanel, BorderLayout.CENTER);\r\n\t\t\r\n\t\txPos = generateTextEntryPanel(\"X Position: \", 10, positionPanel);\r\n\t\tyPos = generateTextEntryPanel(\"Y Position: \", 10, positionPanel);\r\n\t\tzPos = generateTextEntryPanel(\"Z Position: \", 10, positionPanel);\r\n\t\r\n\t\thOrientation = generateTextEntryPanel(\"Horizontal Orientation: \", 10, \r\n\t\t\t\tpositionPanel);\r\n\t\tvOrientation = generateTextEntryPanel(\"Vertical Orientation: \", 10, \r\n\t\t\t\tpositionPanel);\r\n\t\t\r\n\t\tfov = generateTextEntryPanel(\"Field of View: \", 10, positionPanel);\r\n\t\t\r\n\t\tapplySettingsBtn = new JButton(\"Apply Settings\");\r\n\t\tapplySettingsBtn.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\t/** \r\n\t\t\t * Attempt to apply changed settings, and refresh the fields if\r\n\t\t\t * the update was successful.\r\n\t\t\t */\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t\tif(applySettingsFields()) {\r\n\t\t\t\t\trefreshSettingsFields();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\tpositionPanel.add(applySettingsBtn);\r\n\t\t\r\n\t\tresetSettingsBtn = new JButton(\"Reset Settings\");\r\n\t\tresetSettingsBtn.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\t/** Reset all settings fields to their currently applied values. */\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t\trefreshSettingsFields();\r\n\t\t\t}\r\n\t\t});\r\n\t\tpositionPanel.add(resetSettingsBtn);\r\n\t\t\r\n\t\t// Default input fields to disabled until an active camera is found\r\n\t\tsetFieldsEnabled(false);\r\n\t\t\r\n\t\t// Camera Preview Frame\r\n\t\tplayer = new ImageFrame(\"Camera Preview - \" + windowTitle);\r\n\t\tplayer.setLocationRelativeTo(this);\r\n\t\tplayer.setResizable(false);\r\n\t\t\r\n\t\tupdateDeviceList();\t\r\n\t\tthis.pack();\r\n\t this.setResizable(false);\r\n\t}", "public void run() {\n\t\ttry {\n if (prot == TransmissionProtocol.UDP) {\n \tgrabber.setOption(\"rtsp_transport\", \"udp\");\n } else if (prot == TransmissionProtocol.TCP) {\n \tgrabber.setOption(\"rtsp_transport\", \"tcp\");\n }\n if (codec == VideoCodec.H264) {\n \tgrabber.setVideoCodec(avcodec.AV_CODEC_ID_H264);\n } else if (codec == VideoCodec.MPEG4) {\n \tgrabber.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4);\n }\n grabber.start();\n AudioFormat audioFormat = new AudioFormat(grabber.getSampleRate(), 16, grabber.getAudioChannels(), true, true);\n\n DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);\n SourceDataLine soundLine = (SourceDataLine) AudioSystem.getLine(info);\n soundLine.open(audioFormat);\n volume = (FloatControl) soundLine.getControl(FloatControl.Type.MASTER_GAIN);\n soundLine.start();\n\n Java2DFrameConverter converter = new Java2DFrameConverter();\n \n ExecutorService executor = Executors.newSingleThreadExecutor(InterfaceController.ntfInstance);\n view.setImage(null);\n view.setScaleX(1);\n view.setScaleY(1);\n Thread.currentThread().setName(\"FSCV-VPT\");\n isProcessing = true;\n while (!Thread.interrupted()) {\n frame = grabber.grab();\n if (frame == null) {\n break;\n }\n if (frame.image != null) {\n currentFrame = SwingFXUtils.toFXImage(converter.convert(frame), null);\n Platform.runLater(() -> {\n view.setImage(currentFrame);\n });\n } else if (frame.samples != null) {\n channelSamplesShortBuffer = (ShortBuffer) frame.samples[0];\n channelSamplesShortBuffer.rewind();\n\n outBuffer = ByteBuffer.allocate(channelSamplesShortBuffer.capacity() * 2);\n \n for (int i = 0; i < channelSamplesShortBuffer.capacity(); i++) {\n short val = channelSamplesShortBuffer.get(i);\n outBuffer.putShort(val);\n }\n\n /**\n * We need this because soundLine.write ignores\n * interruptions during writing.\n */\n try {\n executor.submit(() -> {\n soundLine.write(outBuffer.array(), 0, outBuffer.capacity());\n outBuffer.clear();\n }).get();\n } catch (InterruptedException interruptedException) {\n Thread.currentThread().interrupt();\n }\n }\n }\n isProcessing = false;\n executor.shutdownNow();\n executor.awaitTermination(10, TimeUnit.SECONDS);\n soundLine.stop();\n grabber.stop();\n grabber.release();\n grabber.close();\n } catch (Exception e) {\n \te.printStackTrace();\n }\n\t}", "public void fetchVideo(View view) {\n Log.i(\"progress\", \"fetchVideo\");\n\n startActivityForResult(requestVideoFileIntent,0);\n }", "@Override\n public void onClick(View v) {\n Intent it = new Intent(Intent.ACTION_VIEW);\n Uri uri = Uri.parse(\"http://\"+ PostUrl.Media+\":8080/upload/\"+item.getMediaPath().get(0).split(\"\\\\.\")[0]+\".mp4\");\n it.setDataAndType(uri, \"video/mp4\");\n context.startActivity(it);\n\n }", "public MentorConnectRequestCompose addVideo()\n\t{\n\t\tmentorConnectRequestObjects.videoButton.click();\n\t\tmentorConnectRequestObjects.videoURLField.sendKeys(mentorConnectRequestObjects.videoURL);\n\t\tmentorConnectRequestObjects.postVideoButton.click();\n\t\treturn new MentorConnectRequestCompose(driver);\n\t}", "@Override\r\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\tmVideoContrl.playNext();\r\n\r\n\t\t\t\t\t\t\t}", "@Override\n public void run() {\n if (data.isStreaming()) {\n // if (frame < list.size()) {\n try {\n // BufferedImage image = list.get(frame);\n enc.encodeImage(videoImage);\n // frame++;\n } catch (Exception ex) {\n System.out.println(\"Error encoding frame: \" + ex.getMessage());;\n }\n }\n\n }", "public interface VideoInterface {\n\n public void startVideo();\n\n public void reStartVideo();\n\n public void pouseVideo();\n\n public void resumeVideo();\n\n public void destoryVideo();\n}", "private void initiatePlayer() {\n ExoPlayerVideoHandler.getInstance().initiateLoaderController(\n this,\n loadingImage,\n exoPlayerView,\n ExoPlayerVideoHandler.getInstance().getVideoResolution()!=null?ExoPlayerVideoHandler.getInstance().getVideoResolution():getString(R.string.default_resolution),\n this\n );\n ExoPlayerVideoHandler.getInstance().playVideo();\n content = ExoPlayerVideoHandler.getInstance().getCurrentVideoInfo();\n //ExoPlayerVideoHandler.getInstance().goToForeground();\n setSpinnerValue();\n }", "private void rewardedAds() {\n Log.d(TAG, \"rewardedAds invoked\");\n final RequestCallback requestCallback = new RequestCallback() {\n\n @Override\n public void onAdAvailable(Intent intent) {\n // Store the intent that will be used later to show the video\n rewardedVideoIntent = intent;\n Log.d(TAG, \"RV: Offers are available\");\n showRV.setEnabled(true);\n Toast.makeText(MainActivity.this, \"RV: Offers are available \", Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onAdNotAvailable(AdFormat adFormat) {\n // Since we don't have an ad, it's best to reset the video intent\n rewardedVideoIntent = null;\n Log.d(TAG, \"RV: No ad available \");\n Toast.makeText(MainActivity.this, \"RV: No ad available \", Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onRequestError(RequestError requestError) {\n // Since we don't have an ad, it's best to reset the video intent\n rewardedVideoIntent = null;\n Log.d(TAG, \"RV: Something went wrong with the request: \" + requestError.getDescription());\n Toast.makeText(MainActivity.this, \"RV: Something went wrong with the request: \", Toast.LENGTH_SHORT).show();\n }\n };\n\n final Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n RewardedVideoRequester.create(requestCallback)\n .request(MainActivity.this);\n Log.d(TAG, \"RV request: added delay of 5 secs\");\n Toast.makeText(MainActivity.this, \"RV Request: delay of 5 secs\", Toast.LENGTH_SHORT).show();\n }\n }, 5000);\n }", "public CameraControl(SocketAddress remote) throws IOException {\n this.remote = remote;\n Thread thread = new Thread(new Manager(), \"Camera Control Manager Thread\");\n thread.setDaemon(true);\n thread.start();\n }", "public void showRewardedVideo() {\n\t\tactivity.runOnUiThread(new Runnable()\n\t\t{\n\t\t\t@Override public void run()\n\t\t\t{\n\t\t\t\tif (rewardedVideo == null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trewardedVideo.show();\n\t\t\t}\n\t\t});\n\t}", "public void startFrontCam() {\n }", "public void checkCam(Camera cam) {\n\t\t\t\n\t\t\tLog.e(\"DownloaderManager \", \"checkCam\");\n\t\t\t\n\t\t\ttempCamera = cam;\n\t\t\t\n\t\t\tif (!isRTMP(tempCamera.getAddress())){\n\t\t\t\n\t\t\t\t//check if camera is online\n\t\t\t\thttpControler.checkCamOnline(tempCamera.getAddress(), cameraStatus);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//rtmpControler.startDownloading(tempCamera, newFrameHandler);\n\t\t\t\trtmpControler.checkCamOnline(tempCamera.getAddress(), cameraStatus);\n\t\t\t}\n\t\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n if (android.os.Build.VERSION.SDK_INT > 9) {\n StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()\n .permitAll().build();\n StrictMode.setThreadPolicy(policy);\n }\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n // Define UI elements\n mView = (VideoView) findViewById(R.id.video_preview);\n connectionStatus = (TextView) findViewById(R.id.connection_status_textview);\n mHolder = mView.getHolder();\n mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\n\n // Run new thread to handle socket communications\n Thread sendVideo = new Thread(new SendVideoThread());\n sendVideo.start();\n }", "@Override\n public void onStreamPlaybackRequested(String streamUrl) {\n Kickflip.startMediaPlayerActivity(this, streamUrl, false);\n\n // Play via Intent for 3rd party Media Player\n //Intent i = new Intent(Intent.ACTION_VIEW);\n //i.setDataAndType(Uri.parse(stream.getStreamUrl()), \"application/vnd.apple.mpegurl\");\n //startActivity(i);\n }", "public void link(MediaPlayer player)\n {\n if(player == null)\n {\n throw new NullPointerException(\"Cannot link to null MediaPlayer\");\n }\n\n // Create the Visualizer object and attach it to our media player.\n mPlayer=player;\n mVisualizer = new Visualizer(player.getAudioSessionId());\n mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);\n\n // Pass through Visualizer data to VisualizerView\n Visualizer.OnDataCaptureListener captureListener = new Visualizer.OnDataCaptureListener()\n {\n @Override\n public void onWaveFormDataCapture(Visualizer visualizer, byte[] bytes,\n int samplingRate)\n {\n updateVisualizer(bytes);\n }\n\n @Override\n public void onFftDataCapture(Visualizer visualizer, byte[] bytes,\n int samplingRate)\n {\n updateVisualizerFFT(bytes);\n }\n };\n\n mVisualizer.setDataCaptureListener(captureListener,\n Visualizer.getMaxCaptureRate() / 2, true, true);\n\n // Enabled Visualizer and disable when we're done with the stream\n mVisualizer.setEnabled(true);\n player.setOnCompletionListener(new MediaPlayer.OnCompletionListener()\n {\n @Override\n public void onCompletion(MediaPlayer mediaPlayer)\n {\n mVisualizer.setEnabled(false);\n }\n });\n mSystemTimeStartSec = System.currentTimeMillis();\n }", "private void startPreview() {\n if (null == mCameraDevice || !mVideoPreview.isAvailable() || null == mPreviewSize) {\n return;\n }\n try {\n closePreviewSession();\n SurfaceTexture texture = mVideoPreview.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n\n Surface previewSurface = new Surface(texture);\n mPreviewBuilder.addTarget(previewSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n if (mVideoRecordListener != null) {\n mVideoRecordListener.onRecordingFailed(\"Capture session for previewing video failed.\");\n }\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}" ]
[ "0.7130705", "0.6822361", "0.66052663", "0.6433414", "0.62424886", "0.61532253", "0.6113599", "0.59824824", "0.59687126", "0.59453076", "0.5942353", "0.591622", "0.588334", "0.5882252", "0.58746165", "0.58490884", "0.5847488", "0.5780216", "0.57749677", "0.5752175", "0.5711753", "0.56943065", "0.5648876", "0.5643161", "0.56411666", "0.56390345", "0.5630823", "0.5627237", "0.56236196", "0.5620314", "0.56089544", "0.5606247", "0.5571437", "0.5542493", "0.5537871", "0.5528749", "0.5505997", "0.5482398", "0.5475866", "0.54605865", "0.5438055", "0.5434378", "0.54145664", "0.54118824", "0.54117745", "0.5395044", "0.53561705", "0.5344309", "0.53420585", "0.53417784", "0.5328825", "0.5306243", "0.5288814", "0.52793884", "0.52725995", "0.52691543", "0.5266106", "0.5258004", "0.52549356", "0.52508473", "0.5248049", "0.5244442", "0.52380294", "0.5237615", "0.52297604", "0.5229028", "0.5228271", "0.5222282", "0.5214615", "0.5214615", "0.5211425", "0.5205823", "0.5205702", "0.51864636", "0.51814926", "0.51801854", "0.51781225", "0.51731837", "0.51637274", "0.51613957", "0.51604795", "0.5158475", "0.51510125", "0.51502067", "0.5146694", "0.5145896", "0.5143907", "0.51438576", "0.5142716", "0.5140653", "0.5136677", "0.5135594", "0.5133701", "0.5130497", "0.5122723", "0.51158875", "0.5113928", "0.51119566", "0.5097266", "0.50960153" ]
0.77167493
0
TODO Autogenerated method stub
public int getCount() { int count = 0; if (newTwitts != null) count += newTwitts.size(); if (oldTwitts.moveToFirst()) count += oldTwitts.getCount(); return count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
public Object getItem(int arg0) { if ((newTwitts != null) && (oldTwitts.moveToFirst())){ if(arg0 < newTwitts.size()) return newTwitts.get(arg0); else if (arg0 < getCount()){ oldTwitts.moveToPosition(arg0 - newTwitts.size()); try { Status status = (Status) new JSONObject(oldTwitts.getString(oldTwitts.getColumnIndex("json_string"))); return status; } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }else return null; }else if(oldTwitts.moveToFirst()){ if (arg0 < oldTwitts.getCount()){ oldTwitts.moveToPosition(arg0); try { Status status = (Status) new JSONObject(oldTwitts.getString(oldTwitts.getColumnIndex("json_string"))); return status; } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }else return null; }else if(arg0 < newTwitts.size()) return newTwitts.get(arg0); else return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
public long getItemId(int arg0) { return arg0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = newView(position, parent); } bindView(position, convertView); return convertView; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
X axis vector Constructors // Construct Camera according to location and directions
public Camera(Point3D p0, Vector vUp, Vector vTo) { _vTo = vTo.normalized(); _vUp = vUp.normalized(); if (!isZero(_vUp.dotProduct(_vTo))) throw new IllegalArgumentException("Vup and Vto must be orthogonal"); _p0 = p0; _vRight = _vTo.crossProduct(_vUp).normalize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public PlayerWL() {\n super();\n rotateYAxis = 0;\n positionZ = 0;\n positionX = 0;\n camera = new PerspectiveCamera(true);\n camera.getTransforms().addAll(\n new Rotate(0, Rotate.Y_AXIS),\n new Rotate(-10, Rotate.X_AXIS),\n new Translate(0, 0, 0));\n cameraGroup = new Group(camera);\n camera.setRotationAxis(new Point3D(0, 1, 0));\n }", "public static void setCameraFrame() {\n\t\tCAMERA.src = VERTICES[CAMERA.v];\n\t\tVector zc = CAMERA.src.d.scale(-1).normalized();\n\t\tCAMERA.zAxis = zc;\n\t\tVector xc = MathUtils.cross(CAMERA.src.d, new Vector(0, 1, 0)).normalized();\n\t\tCAMERA.xAxis = xc;\n\t\tVector yc = MathUtils.cross(zc, xc).normalized();\n\t\tCAMERA.yAxis = yc;\n\t\t\n\t\tSystem.out.println(\"***** just set camera: \" + CAMERA.toString());\n\t}", "public Camera() {\r\n this(1, 1);\r\n }", "public Camera(float loc[],float dir[]){\n this.loc=loc;\n this.dir=normalize(dir);\n }", "public Camera(Vector position, Vector lookPosition, Vector upVector,\r\n\t\t\t\t double screenDistance, double screenWidth) {\r\n\t\tthis.position = position;\r\n\t\tthis.direction = Vector.vecSubtract(lookPosition, position).normalized();\r\n\t\tthis.screenWidth = screenWidth;\r\n\t\tthis.rightDirection = Vector.crossProduct(this.direction, upVector).normalized();\r\n\t\tthis.upDirection = Vector.crossProduct(this.rightDirection, this.direction).normalized();\r\n\t\tRay ray = new Ray(position, direction);\r\n\t\tthis.screenCenter = ray.getPointAtDistance(screenDistance);\r\n\t\t}", "@Test\n\tpublic void testConstructor() {\n\t\tCamera camera=new Camera(new Point3D(0, 0, 0), new Vector(0, 1, 0), new Vector(0, 0, 1));\n\t\tassertEquals(0, camera.get_upVector().dotProduct(camera.get_toVector()),0 );\n\t\tassertEquals(0, camera.getRightVector().dotProduct(camera.get_toVector()),0 );\n\t\tassertEquals(0, camera.getRightVector().dotProduct(camera.get_upVector()),0 );\n\t}", "private Vector(double x, double y){\n this.x = x;\n this.y = y;\n }", "public Plane() {\r\n\t\tvecX = new Vector3D();\r\n\t\tvecY = new Vector3D();\r\n\t\tnorm = new Vector3D();\r\n\t\tthis.setD(0);\r\n\t\tpos = new Position3D();\r\n\t}", "public Camera() {\n\t\tMatrix.setIdentityM(viewMatrix, 0);\n\t\tMatrix.setIdentityM(projectionMatrix, 0);\n\t\tcomputeReverseMatrix();\n\t}", "public void setCameraPosition(float x, float y, float z) {\n\t\tthis.x=x;\n\t\tthis.y=y;\n\t\tthis.z=z;\n\t}", "public Camera(Point3D _p0, Vector _vTo, Vector _vUp) {\n this(_p0, _vTo, _vUp, 0, 0);\n }", "private Vector(double x, double y) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tmagnitude = Math.sqrt(x * x + y * y);\n\t\tangle = Math.toDegrees(Math.atan2(y, x));\n\t}", "public int getXPos() {\r\n\t\treturn this.cameraX;\r\n\t}", "public Vector(float[] axis){ this.axis = axis;}", "public Camera(){\n // servoPan = new Servo(PAN);\n servoTilt = new Servo(TILT);\n }", "public Vector(double x, double y){\n this.x=x;\n this.y=y;\n }", "public Vector330Class(){\n this.x = 0;\n this.y = 0;\n }", "public Vector(double x1, double y1, double z1) {\n Point3D p = new Point3D(x1, y1, z1);\n if (p.equals(Point3D.ZERO))\n throw new IllegalArgumentException(\"no meaning to the vector\");\n head=new Point3D(p);\n }", "@Model\r\n\tpublic Vector(double xComp, double yComp) {\r\n\t\t\r\n\t\t\tthis.xComp = xComp;\r\n\t\t\r\n\t\r\n\t\t\tthis.yComp = yComp;\r\n\r\n\t}", "public ViewerPosition3D()\n {\n }", "public Vector(double x, double y, double z) {\n this(new Point3D(x, y, z));\n }", "public GameCamera(RefLinks refLinks, float xOffset, float yOffset)\n {\n this.refLinks = refLinks;\n this.xOffset = xOffset;\n this.yOffset = yOffset;\n }", "@Override\n protected Camera getCamera() {\n return Camera.createForPositionAndAngles(new ThreeDoubleVector(31.0, 7.0, 5.5), 0.0, 0.7);\n\n // Camera for orientation curve interpolation presentation\n// return Camera.createForPositionAndAngles(new ThreeDoubleVector(54.5, 10.0, 2.5), -0.5, 0.3);\n }", "private void setCamera() {\n\t\tVector viewTranslation = controller.getCameraPosition();\n\n\t\tGL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);\n\t\tGL11.glMatrixMode(GL11.GL_PROJECTION);\n\t\tGL11.glLoadIdentity();\n\n\t\tfloat whRatio = (float) windowWidth / (float) windowHeight;\n\t\tGLU.gluPerspective(controller.getFOV(), whRatio, 1, 100000);\n\t\tGLU.gluLookAt((float) viewTranslation.x, (float) viewTranslation.y,\n\t\t\t\t(float) controller.getCameraDistance(), (float) viewTranslation.x,\n\t\t\t\t(float) viewTranslation.y, 0, 0, 1, 0);\n\n\t\tGL11.glMatrixMode(GL11.GL_MODELVIEW);\n\t\tGL11.glLoadIdentity();\n\t}", "Vec(double x, double y) {\n this.x = x; this.y = y;\n }", "public Entity(float x, float y) {\n this.position = new Point(0,0);\n realX = x;\n realY = y;\n determinePosition();\n }", "private void updateCamera() {\n\t\tVector3f x = new Vector3f();\n\t\tVector3f y = new Vector3f();\n\t\tVector3f z = new Vector3f();\n\t\tVector3f temp = new Vector3f(this.mCenterOfProjection);\n\n\t\ttemp.sub(this.mLookAtPoint);\n\t\ttemp.normalize();\n\t\tz.set(temp);\n\n\t\ttemp.set(this.mUpVector);\n\t\ttemp.cross(temp, z);\n\t\ttemp.normalize();\n\t\tx.set(temp);\n\n\t\ty.cross(z, x);\n\n\t\tMatrix4f newMatrix = new Matrix4f();\n\t\tnewMatrix.setColumn(0, x.getX(), x.getY(), x.getZ(), 0);\n\t\tnewMatrix.setColumn(1, y.getX(), y.getY(), y.getZ(), 0);\n\t\tnewMatrix.setColumn(2, z.getX(), z.getY(), z.getZ(), 0);\n\t\tnewMatrix.setColumn(3, mCenterOfProjection.getX(),\n\t\t\t\tmCenterOfProjection.getY(), mCenterOfProjection.getZ(), 1);\n\t\ttry {\n\t\t\tnewMatrix.invert();\n\t\t\tthis.mCameraMatrix.set(newMatrix);\n\t\t} catch (SingularMatrixException exc) {\n\t\t\tLog.d(\"Camera\",\n\t\t\t\t\t\"SingularMatrixException on Matrix: \"\n\t\t\t\t\t\t\t+ newMatrix.toString());\n\t\t}\n\t}", "@Model\r\n\tpublic Vector() {\r\n\t\tthis(50,50);\r\n\t}", "public Vector(Coordinate x1, Coordinate y1, Coordinate z1) {\n Point3D p = new Point3D(x1, y1, z1);\n if (p.equals(Point3D.ZERO))\n throw new IllegalArgumentException(\"no meaning to the vector\");\n head=new Point3D(p);\n }", "public PlayerObject(Vector r, Vector v, double mass) {\n super(r, v, mass);\n this.cam = new Camera(this, DEFAULT_FOV);\n this.rot = 0;\n }", "public Vector3D() {\n zero();\n }", "public void setCamVertices(float x0, float y0, float z0,\n float x1, float y1, float z1,\n float x2, float y2, float z2) {\n camX[0] = x0;\n camX[1] = x1;\n camX[2] = x2;\n \n camY[0] = y0;\n camY[1] = y1;\n camY[2] = y2;\n \n camZ[0] = z0;\n camZ[1] = z1;\n camZ[2] = z2;\n }", "public Camera(float posX, float posY, ScreenManager screenManager) throws SlickException\r\n { \r\n this.screenManager = screenManager;\r\n update(posX, posY);\r\n this.setZoom(1);\r\n }", "public Vector3D() {\r\n\t\tthis(0.0);\r\n\t}", "public CameraSubsystem() {\n\t\t// TODO Auto-generated constructor stub\t\t\n\t\tnetworkTableValues.put(\"area\", (double) 0);\n\t\tnetworkTableValues.put(\"centerX\", (double) 0);\n\t\tnetworkTableValues.put(\"centerY\", (double) 0);\n\t\tnetworkTableValues.put(\"width\", (double) 0);\n\t\tnetworkTableValues.put(\"height\", (double) 0);\n\t\t\n\t\tcoordinates.put(\"p1x\", (double) 0);\n\t\tcoordinates.put(\"p1y\", (double) 0);\n\t\tcoordinates.put(\"p2x\", (double) 0);\n\t\tcoordinates.put(\"p2y\", (double) 0);\n\t\tcoordinates.put(\"p3x\", (double) 0);\n\t\tcoordinates.put(\"p3y\", (double) 0);\n\t\tcoordinates.put(\"p4x\", (double) 0);\n\t\tcoordinates.put(\"p4y\", (double) 0);\n\n\t\t\n\t}", "@Override\r\n protected Matrix4f genViewMatrix() {\r\n\r\n // refreshes the position\r\n position = calcPosition();\r\n\r\n // calculate the camera's coordinate system\r\n Vector3f[] coordSys = genCoordSystem(position.subtract(center));\r\n Vector3f right, up, forward;\r\n forward = coordSys[0];\r\n right = coordSys[1];\r\n up = coordSys[2];\r\n\r\n // we move the world, not the camera\r\n Vector3f position = this.position.negate();\r\n\r\n return genViewMatrix(forward, right, up, position);\r\n }", "public static void main(String[] args) {\n// Vector v1 = new Vector(new double[]{0, 0, 1});\n// Vector v2 = new Vector(new double[]{1, 0, 0});\n// System.out.println(v1.dot(v2));\n System.setProperty(\"sun.java2d.opengl\", \"true\");\n \n // Make World\n //WorldSpace world = new StreetWorldSpace();\n WorldSpace world = new TestWorldSpace();\n //WorldSpace world = new BigAssPolygonSpace();\n \n // Make Frame\n JFrame frame = new JFrame();\n \n // Get effective screen size\n Dimension screenSize = getScreenDimension(frame);\n\n // Set Camera View dimensions\n int width = 730;\n int height = width;\n \n // Make Camera\n Polygon[] polygons = world.getPolygons();\n Camera camera = new Camera(polygons, width, height, frame.getGraphicsConfiguration());\n image = camera.observe();\n \n // Make Camera Control Panel\n// int controlPanelHeight = 100;\n// CameraControlPanel cameraControlPanel = new CameraControlPanel(camera);\n// cameraControlPanel.setPreferredSize(new Dimension(width, controlPanelHeight));\n// cameraControlPanel.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.BLACK, 2, false), new EmptyBorder(10, 10, 10, 10)));\n \n // Make Camera View Component\n CameraViewComponent cameraViewComponent = new CameraViewComponent(camera);\n cameraViewComponent.updateImage(image);\n cameraViewComponent.updateData(camera.getData());\n cameraViewComponent.setPreferredSize(new Dimension(width, height));\n\n // Make Camera Panel\n JPanel cameraPanel = new JPanel();\n cameraPanel.setLayout(new BoxLayout(cameraPanel, BoxLayout.Y_AXIS));\n cameraPanel.setPreferredSize(new Dimension(width, height));// + controlPanelHeight));\n cameraPanel.add(cameraViewComponent);\n //cameraPanel.add(cameraControlPanel);\n\n // Make Camera Data Panel\n //CameraDataPanel cameraDataPanel = new CameraDataPanel(camera);\n \n // Make Master Panel\n JPanel masterPanel = new JPanel();\n masterPanel.add(cameraPanel);\n //masterPanel.add(cameraDataPanel);\n \n frame.add(masterPanel);\n frame.pack();\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n frame.setVisible(true);\n\n // Make keyboard listener\n KeyListener kl = new KeyListener();\n \n // Time\n int lastTenthOfASecond = 0;\n double lastMilliSecond = 0;\n double currentMilliSecond = System.currentTimeMillis();\n double averageFrameRate = 0;\n double currentFrameRate = 0;\n long totalTime = 0;\n long totalFrames = 0;\n \n // Redraw camera view upon keyboard input\n while(true) { \n int currentTenthOfASecond = (int)((currentMilliSecond%1000)/100);\n if (currentMilliSecond/100 > lastMilliSecond/100) {\n boolean cameraMoved = false;\n if (kl.isWPressed()) {\n camera.move(FORWARD); \n cameraMoved = true;\n }\n if (kl.isSPressed()) {\n camera.move(BACKWARD); \n cameraMoved = true;\n }\n if (kl.isAPressed()) {\n camera.move(LEFT); \n cameraMoved = true;\n }\n if (kl.isDPressed()) {\n camera.move(RIGHT); \n cameraMoved = true;\n }\n if (kl.isSpacePressed()) {\n camera.move(UP); \n cameraMoved = true;\n }\n if (kl.isShiftPressed()) {\n camera.move(DOWN); \n cameraMoved = true;\n }\n if (cameraViewComponent.wasUpdated()) {\n cameraMoved = true;\n }\n// if (cameraControlPanel.getWasCameraChanged() || cameraViewComponent.wasUpdated()) {\n// cameraMoved = true;\n// }\n if (cameraMoved) {\n image = camera.observe();\n cameraViewComponent.updateImage(image);\n //cameraDataPanel.update();\n //cameraControlPanel.update(); \n totalFrames++;\n totalTime += currentMilliSecond-lastMilliSecond + 1;\n averageFrameRate = (totalFrames)/(totalTime/1000.0); \n currentFrameRate = (1000.0/(currentMilliSecond-lastMilliSecond));\n \n }\n }\n if (currentTenthOfASecond > lastTenthOfASecond) {\n \n String[] cameraData = camera.getData();\n String[] frameData = {\n \"Average Framerate: \" + String.format(\"%.2f\", averageFrameRate), \n \"Current Framerate: \" + String.format(\"%.2f\",currentFrameRate)\n };\n String[] data = new String[cameraData.length + frameData.length ];\n System.arraycopy(cameraData, 0, data, 0, cameraData.length);\n System.arraycopy(frameData, 0, data, cameraData.length, frameData.length);\n cameraViewComponent.updateData(data);\n } \n lastTenthOfASecond = currentTenthOfASecond;\n lastMilliSecond = currentMilliSecond;\n currentMilliSecond = System.currentTimeMillis(); \n }\n }", "public Vector330Class(int x, int y){\n this.x = x;\n this.y = y;\n }", "public Vector330Class(double x, double y){\n this.x = x;\n this.y = y;\n }", "public Vector(Coordinate x, Coordinate y, Coordinate z) {\n this(new Point3D(x, y, z));\n }", "public Vec3(){\n\t\tthis(0,0,0);\n\t}", "private Vector3D(int x, int y, int z) {\n this(x, y, z, null);\n }", "public Vector(double deltaX, double deltaY) {\n\t\tsuper();\n\t\tthis.deltaX = deltaX;\n\t\tthis.deltaY = deltaY;\n\t}", "public Vec3D() {\n\t\tx = y = z = 0.0f;\n\t}", "public VelocityComponent(double xVector, double yVector, double zVector) {\n velocity = new Point3D(xVector, yVector, zVector);\n }", "public Camera(Point3D _p0, Vector _vTo, Vector _vUp, double _aperture, double _focusDistance) {\n if (_vTo.dotProduct(_vUp) != 0)\n throw new IllegalArgumentException(\"The vectors are not orthogonal to each other\");\n if (_aperture < 0)\n throw new IllegalArgumentException(\"The aperture size cannot be negative\");\n if (_focusDistance < 0)\n throw new IllegalArgumentException(\"Distance cannot be negative\");\n this._p0 = new Point3D(_p0);\n this._vTo = new Vector(_vTo.normalized());\n this._vUp = new Vector(_vUp.normalized());\n this._vRight = this._vTo.crossProduct(this._vUp).normalized();\n this._aperture = _aperture;\n this._focusDistance = _focusDistance;\n }", "public void setCameraAngles(float x, float y, float z, float w) {\n\t\tthis.qx=x;\n\t\tthis.qy=y;\n\t\tthis.qz=z;\n\t\tthis.qw=w;\n\t}", "public HorizontalCoords() {\n }", "public PositionComponent(float x, float y) {\n\t\tthis(x, y, 0);\n\t}", "Matrix()\n {\n x = new Vector();\n y = new Vector();\n z = new Vector();\n }", "public ColladaFloatVector() {\n super();\n }", "private void setupCamera(GL gl) {\r\n\t\tgl.glMatrixMode(GL.GL_MODELVIEW);\r\n\t\t// If there's a rotation to make, do it before everything else\r\n\t\tgl.glLoadIdentity();\r\n if (rotationMatrix == null) {\r\n\t\t\trotationMatrix = new double[16];\r\n\t\t\tgl.glGetDoublev(GL.GL_MODELVIEW, rotationMatrix, 0);\r\n\t\t}\r\n\t\tif (nextRotationAxis != null) {\r\n\t\t\tgl.glRotated(nextRotationAngle, nextRotationAxis.x, nextRotationAxis.y, nextRotationAxis.z);\r\n\t\t\tnextRotationAngle = 0;\r\n\t\t\tnextRotationAxis = null;\r\n\t\t}\r\n\t\tgl.glMultMatrixd(rotationMatrix, 0);\r\n\t\tgl.glGetDoublev(GL.GL_MODELVIEW, rotationMatrix, 0);\r\n\t\t// Move the objects according to the camera (instead of moving the camera)\r\n\t\tif (zoom != 0) {\r\n\t\t\tdouble[] oldMatrix = new double[16];\r\n\t\t\tgl.glGetDoublev(GL.GL_MODELVIEW, oldMatrix, 0);\r\n\t\t\tgl.glLoadIdentity();\r\n\t\t\tgl.glTranslated(0, 0, zoom);\r\n\t\t\tgl.glMultMatrixd(oldMatrix, 0);\r\n\t\t}\r\n\t}", "public VolcanoWorld() {\n this(DEFAULT_WIDTH, DEFAULT_HEIGHT);\n }", "public Position() {\n xCoord = 0;\n yCoord = 0;\n zCoord = 0;\n }", "public Position(double x, double y, double z) {\n xCoord = x;\n yCoord = y;\n zCoord = z;\n }", "private Camera() {\n viewport = new Rectangle();\n dirtyAreas = new ArrayList<Rectangle>();\n renderedAreas = new ArrayList<Rectangle>();\n fullUpdate = false;\n dirtyAreaCounter = 0;\n }", "public ReflectedCamera(Camera camera) {\n this(camera, true);\n }", "public Viewer() {\r\n\t\tzoom = DEFAULT_ZOOM;\r\n\t\tisWireframe = false;\r\n\t\tisAxes = true;\r\n\t\tnextRotationAngle = 0;\r\n\t\tnextRotationAxis = null;\r\n\t\trotationMatrix = null;\r\n\t\tscreenWidth = 0;\r\n\t\tscreenHeight = 0;\r\n\t}", "public FloatVector3D(){}", "public Vector(double x, double y, double z) {\n super(new double[][] {\n { x },\n { y },\n { z },\n { 1 }\n });\n }", "public CoordinateSystem() {\r\n\t\torigin = new GuiPoint(0, 0);\r\n\t\tzoomFactor = 1f;\r\n\t}", "void forward(float steps) {\n _x += _rotVector.x * steps;\n _y += _rotVector.y * steps;\n }", "public void setCamera(int x, int y) {\n\t\tcamera[0] = x;\n\t\tcamera[1] = y;\n\t}", "public Position(Position position) {\n this.x = position.x;\n this.y = position.y;\n this.xVelocity = position.xVelocity;\n this.yVelocity = position.yVelocity;\n this.xAcceleration = position.xAcceleration;\n this.yAcceleration = position.yAcceleration;\n }", "public Entity() {\n this.position = new Point(0,0);\n realX=0;\n realY=0;\n }", "private void setOrigin() {\n Hep3Vector origin = VecOp.mult(CoordinateTransformations.getMatrix(), _sensor.getGeometry().getPosition());\n // transform to p-side\n Polygon3D psidePlane = this.getPsidePlane();\n Translation3D transformToPside = new Translation3D(VecOp.mult(-1 * psidePlane.getDistance(),\n psidePlane.getNormal()));\n this._org = transformToPside.translated(origin);\n }", "public Camera(int boardWidth, int boardLength) {\r\n super();\r\n instance = this;\r\n\r\n // TODO: improve camera init\r\n int longerSide = Math.max(boardWidth, boardLength);\r\n this.minPitch = 5;\r\n this.maxPitch = 89;\r\n this.rotation = 0;\r\n this.pitch = 20;\r\n this.distance = longerSide * 0.9f;\r\n this.minDistance = longerSide * 0.1f;\r\n this.maxDistance = 1.5f * longerSide;\r\n this.center = new Vector3f();\r\n this.center.x = (boardWidth - 1) / 2f;\r\n this.center.z = (boardLength - 1) / 2f;\r\n this.boardLength = boardLength;\r\n this.boardWidth = boardWidth;\r\n this.space = this.maxDistance - this.minDistance;\r\n zoom(0f);\r\n }", "public Vector3 () {\n }", "@SuppressWarnings(\"unused\")\n\tpublic Camera(float[] viewMatrix, float[] projectionMatrix) {\n\t\tsetViewMatrix(viewMatrix);\n\t\tsetProjectionMatrix(projectionMatrix);\n\t\tcomputeReverseMatrix();\n\t}", "public Rotation2D(float x, float y)\n {\n this.x = x;\n this.y = y;\n }", "public Rotation2D()\n {\n this.x = 0.0f;\n this.y = 0.0f;\n }", "public Light(double xPos, double yPos, double zPos){\n this(xPos, yPos, zPos, 1.0, 1.0, 1.0, 1);\n }", "public Vector(double x, double y, double z){\n double longueur = Math.sqrt(sqr(x) + sqr(y) + sqr(z));\n\n this.x = longueur > 0 ? x/longueur : this.x;\n this.y = longueur > 0 ? y/longueur : this.y;\n this.z = longueur > 0 ? z/longueur : this.z;\n \n }", "public FloatVector3D(float x, float y, float z)\n {\n fx = x;\n fy = y;\n fz = z;\n setMagnitude();\n }", "public abstract Vector4fc set(float x, float y, float z, float w);", "public ThreeVector() { \r\n\t\t//returns null for no arguments\r\n\t}", "public Vector3D(float x, float y, float z)\r\n\t{\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\t}", "public ColladaFloatVector(Collada collada) {\n super(collada);\n }", "public PaperAirplane (int x, int y)\n\t{\n\t\tsuper (x, y);\t//Superclass called to set x and y\n\t\t\n\t\txPoints = new int [3];\t//sets xPoints to have 3 elements\n\t\tyPoints = new int [3];\t//sets yPoints to have 3 elements\n\t\t\n\t\t//Using the getX_Pos () set in the superclass, the following sets the\n\t\t//xDimensions.\n\t\txDimension1 = getX_Pos () - 23;\n\t\txDimension2 = getX_Pos () - 18;\n\t\txDimension3 = getX_Pos () + 22;\n\t\t\n\t\t//Using the getY_Pos () set in the superclass, the following sets the\n\t\t//yDimensions.\n\t\tyDimension1 = getY_Pos() - 2;\n\t\tyDimension2 = getY_Pos() - 17;\n\t\tyDimension3 = getY_Pos() + 5;\n\t\t\n\t\t//The following sets the same dimensions from above, but these never\n\t\t//change and can be used for reconstruction\n\t\trXD1 = getX_Pos () - 23;\n\t\trXD2 = getX_Pos () - 18;\n\t\trXD3 = getX_Pos () + 22;\n\t\trYD1 = getY_Pos() - 2;\n\t\trYD2 = getY_Pos() - 17;\n\t\trYD3 = getY_Pos() + 5;\n\t}", "public void setVector(float x, float y)\n {\n speedVector.x = x / 5;\n speedVector.y = y / 5;\n if((mag = speedVector.x * speedVector.x + speedVector.y * speedVector.y) > 1)\n {\n mag = FloatMath.sqrt(mag);\n speedVector.x /= mag;\n speedVector.y /= mag;\n }\n }", "@Override\n\tpublic void create() {\n\t\tthis.mesh = new Mesh(VertexDataType.VertexArray, false, 4, 6, \n\t\t\t\tnew VertexAttribute(VertexAttributes.Usage.Position, 3, \"attr_position\"));\n\n\t\tmesh.setVertices(new float[] {\n\t\t\t\t-8192f, -512f, 0,\n\t\t\t\t8192f, -512f, 0,\n\t\t\t\t8192f, 512f, 0,\n\t\t\t\t-8192f, 512f, 0\n\t\t});\n\t\tmesh.setIndices(new short[] {0, 1, 2, 2, 3, 0});\n\n\t\t// creates the camera\n\t\tcamera = new OrthographicCamera(CoordinateConverter.getCameraWidth(), CoordinateConverter.getCameraHeight());\n\n\t\t// Sets the positions of the camera\n\t\tcamera.position.set(CoordinateConverter.getCameraWidth()/2, CoordinateConverter.getCameraHeight()/2, 0);\n\t\tcamera.update();\n\n\t\t// Sets how much of the map that is shown on the screen\n\t\tglViewport = new Rectangle(0, 0, CoordinateConverter.getCameraWidth(), CoordinateConverter.getCameraHeight());\n\t\t\n\t}", "public void setupCamera() {\r\n p.camera(width/2.0f, height/2.0f, cameraZ,\r\n width/2.0f, height/2.0f, 0, 0, 1, 0);\r\n\r\n if(isTiling) {\r\n float mod=1f/10f;\r\n p.frustum(width*((float)tileX/(float)tileNum-.5f)*mod,\r\n width*((tileX+1)/(float)tileNum-.5f)*mod,\r\n height*((float)tileY/(float)tileNum-.5f)*mod,\r\n height*((tileY+1)/(float)tileNum-.5f)*mod,\r\n cameraZ*mod, 10000);\r\n }\r\n\r\n }", "public Vector(double x, double y, double z, double w) {\n super(new double[][] {\n { x },\n { y },\n { z },\n { w }\n });\n }", "PositionedObject(){\n float x = DrawingHelper.getGameViewWidth()/2;\n float y = DrawingHelper.getGameViewHeight()/2;\n _position.set(x,y);\n }", "public Vector3D(double x, double y, double z) {\r\n super(x, y, z);\r\n\t}", "public Vector3D(double x, double y, double z) {\n this.xCoord = x;\n this.yCoord = y;\n this.zCoord = z;\n }", "public SVector3d getPositionCam() {\n\t\treturn transCamera;\n\t}", "public Entity(int x, int y){\n \t\tlocation = new Point(x,y);\n \t\twidth = 0;\n\t\theight = 0;\n\t\timage = null;\n\t\t\n\t\tvisible = false;\n \t}", "@Override\n\tpublic LSystemBuilder setOrigin(double x, double y) {\n\t\tthis.origin = new Vector2D(x, y);\n\t\treturn this;\n\t}", "public PositionComponent(float x, float y, int z) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t}", "public interface Camera {\n Vector3f getPosition();\n\n float getYaw();\n\n float getPitch();\n\n float getRoll();\n}", "public ImgMathVec(int x, int y) {\r\n\t\tv = new int[3];\r\n\t\tv[0] = x;\r\n\t\tv[1] = y;\r\n\t\tv[2] = 1;\r\n\t}", "public Camera(float posX, float posY, float zoom, ScreenManager screenManager) throws SlickException\r\n {\r\n this.screenManager = screenManager;\r\n update(posX, posY);\r\n this.setZoom(zoom);\r\n }", "public Vector3D(double x, double y, double z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }", "public PinholeCamera(Point cameraPosition, Vec towardsVec, Vec upVec, double distanceToPlain) {\n\t\tthis.cameraPosition = cameraPosition;\n\n\t\tthis.upVec = upVec.normalize();\n\t\tthis.rightVec = towardsVec.normalize().cross(upVec).normalize();\n\n\t\tthis.distanceToPlain = distanceToPlain;\n\t\tthis.plainCenterPoint = cameraPosition.add(towardsVec.normalize().mult(distanceToPlain));\n\t}", "public Vector3(double x, double y,double z){\n \n double pytago;\n \n this.x = x;\n this.y = y;\n this.z = z;\n \n pytago = (x*x) + (y*y) + (z*z);\n \n magnitude = Math.sqrt(pytago);\n }", "protected abstract BaseVector3d createBaseVector3d(double x, double y, double z);", "@Override\n\tpublic void move_x() {\n\t\tif(mX < 0){\n\t \tdirection *= -1 ;\n\t \t setScale(-1, 1);\n\t }else if (mX > activity.getCameraWidth()-64){\n\t \tdirection *= -1 ;\n\t \tsetScale(1, 1);\n\t } \n\t\tmove_x(direction);\n\t}", "public Camera() {\n\t\treset();\n\t}", "public Vector3 () {\r\n\t\tx = 0;\r\n\t\ty = 0;\r\n\t\tz = 0;\r\n\t}" ]
[ "0.629685", "0.6200202", "0.6131984", "0.6126561", "0.61107963", "0.609393", "0.60397226", "0.5995225", "0.5957576", "0.5952216", "0.59463984", "0.5925891", "0.59110254", "0.5903883", "0.5886186", "0.5886014", "0.5868697", "0.5818477", "0.58060294", "0.5801447", "0.5792504", "0.57839274", "0.5768572", "0.5759302", "0.5736226", "0.5730589", "0.5729798", "0.5728905", "0.57258105", "0.5723468", "0.57215935", "0.5718359", "0.5707118", "0.5702599", "0.56948984", "0.5689412", "0.56871986", "0.5677948", "0.56743807", "0.5665051", "0.5649909", "0.56334823", "0.56063074", "0.5606247", "0.55938405", "0.5592794", "0.556648", "0.5565845", "0.5559856", "0.5547061", "0.5540426", "0.5532417", "0.55279636", "0.54915005", "0.54891735", "0.5487631", "0.5480729", "0.5468429", "0.54655164", "0.54587096", "0.54549116", "0.5439843", "0.543288", "0.5413521", "0.5402047", "0.53985244", "0.5394732", "0.5394089", "0.5388351", "0.53867114", "0.53865504", "0.5378648", "0.53767556", "0.53752244", "0.5374891", "0.53655785", "0.53497356", "0.5336755", "0.5330565", "0.5328318", "0.53226733", "0.532261", "0.53157634", "0.52935153", "0.5290498", "0.52879024", "0.52837974", "0.52717984", "0.5265136", "0.5263572", "0.52521", "0.5244323", "0.5236434", "0.52349645", "0.5232781", "0.52319765", "0.52249205", "0.5223943", "0.5222158", "0.52155733" ]
0.5904412
13
Getters/Setters // Getter of camera's location
public Point3D getP0() { return _p0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Point getCameraPosition() {\n\t\treturn new Point(cameraPosition.x, cameraPosition.y, cameraPosition.z);\n\t}", "public Coord getCameraPosition() {\n if(internalNative == null) {\n if(internalLightweightCmp != null) {\n return internalLightweightCmp.getCenter();\n } \n // TODO: Browser component\n return new Coord(0, 0);\n }\n return new Coord(internalNative.getLatitude(), internalNative.getLongitude());\n }", "public OrthographicCamera getCamera() {\n\t\treturn this.camera;\n\t}", "public OrthographicCamera getCamera() {\n\t\treturn cam;\n\t}", "Camera getCamera();", "public SVector3d getPositionCam() {\n\t\treturn transCamera;\n\t}", "@Override\n protected Camera getCamera() {\n return Camera.createForPositionAndAngles(new ThreeDoubleVector(31.0, 7.0, 5.5), 0.0, 0.7);\n\n // Camera for orientation curve interpolation presentation\n// return Camera.createForPositionAndAngles(new ThreeDoubleVector(54.5, 10.0, 2.5), -0.5, 0.3);\n }", "public Camera getCamera() {\n return getValue(PROP_CAMERA);\n }", "public Camera2D getCamera()\r\n\t{\r\n\t\treturn _Camera;\r\n\t}", "public Camera getCam() {\n return this.cam;\n }", "public Vector2 getCameraPosition()\n {\n\n Vector2 tmpVector = new Vector2(camera.position.x/camera.zoom - Gdx.graphics.getWidth()/2, camera.position.y/camera.zoom - Gdx.graphics.getHeight()/2);\n return tmpVector;\n }", "public Camera getCamera() { return (Camera)CameraSet.elementAt(0); }", "public int[] getCamera() {\n\t\treturn camera;\n\t}", "public PVector getLoc() {\n return location;\n }", "public PVector getLoc() {\n return location;\n }", "@Override\n public PointF getLocation() {\n return location;\n }", "public Point getRobotLocation();", "public Point getLocation() { return loc; }", "org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.CameraLocation getAuvLoc();", "public Vector2f getLocation() {\r\n\t\treturn location.getLocation();\r\n\t}", "public PVector getLocation()\n\t{\n\t\treturn location;\n\t}", "public interface Camera {\n Vector3f getPosition();\n\n float getYaw();\n\n float getPitch();\n\n float getRoll();\n}", "public Coordinate getLocation() {\n return location;\n }", "public Point getLocation() {\n return location;\n }", "public double getLocation(){\n\t\treturn location;\n\t}", "private void getMyLocation() {\n LatLng latLng = new LatLng(latitude, longitude);\n CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 18);\n googleMap.animateCamera(cameraUpdate);\n }", "public CameraInstance getCameraInstance() {\n return cameraInstance;\n }", "public Point getLocation() {\n\t\treturn location;\n\t}", "public java.util.List<org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera> getCameraList() {\n return camera_;\n }", "public geo_location getLocation() {\n return _pos;\n }", "public final Coord getLocation() {\n return location;\n }", "private void getCamera() {\n if (camera == null) {\n try {\n camera = Camera.open();\n params = camera.getParameters();\n } catch (RuntimeException e) {\n\n }\n }\n }", "public Location getLocation() {\n return loc;\n }", "public Location getLocation() {\n return loc;\n }", "public Matrix4f getCameraMatrix() {\n\t\treturn mCameraMatrix;\n\t}", "public final Point getLocation() {\n return this.location ;\n }", "public LatLng getLocation() {\n return location;\n }", "public LatLng getLocation() {\n\t\treturn location;\n\t}", "Location getPlayerLocation();", "public Location getLocation() \n\t{\n\t\treturn location;\n\t}", "public Point getLocation() {\n return currentLocation;\n }", "public Location getLocation(){\n return location;\n }", "public Point getCarLocation() {\r\n\r\n SQLiteQueryBuilder builder = new SQLiteQueryBuilder();\r\n builder.setTables(FTS_VIRTUAL_TABLE_CAR);\r\n builder.setProjectionMap(mColumnMapCar);\r\n\r\n Cursor cursor = builder.query(mDatabaseOpenHelper.getReadableDatabase(),\r\n null, null, null, null, null, null);\r\n\r\n if (cursor == null) {\r\n return null;\r\n } else if (!cursor.moveToFirst()) {\r\n cursor.close();\r\n return null;\r\n }\r\n\r\n String point_str = cursor.getString(1);\r\n\r\n point_str = point_str.trim();\r\n String[] coordinates = point_str.split(\",\");\r\n String lon = coordinates[0];\r\n String lat = coordinates[1];\r\n\r\n double flon = Float.valueOf(lon);\r\n double flat = Float.valueOf(lat);\r\n\r\n return (new Point(flon, flat));\r\n }", "public Location location()\n {\n return myLoc;\n }", "public Location getOrigin() {\n return mOrigin;\n }", "public Point getCameraOffset() {\n Point offset = new Point(getPlayer().getCenterX() - screenWidthMiddle,\n getPlayer().getCenterY() - screenHeightMiddle);\n reboundCameraOffset(offset, EnumSet.of(Direction.LEFT, Direction.RIGHT));\n // we want to add these offsets to the player's x and y, so invert them\n offset.x = -offset.x;\n offset.y = -offset.y;\n return offset;\n }", "public Location getLocation() {\n return location;\n }", "public Location getLocation() {\n return location;\n }", "public Location getLocation() {\n return location;\n }", "public Location getLocation() {\n return location;\n }", "@Override\n\tpublic Point getLocation() {\n\t\treturn position;\n\t}", "private void setCameraPosition(Location location){\n map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(),\n location.getLongitude()),15.0));\n }", "public java.util.List<? extends org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.CameraOrBuilder> \n getCameraOrBuilderList() {\n return camera_;\n }", "public Location getLocation() {\r\n\t\treturn location;\r\n\t}", "public Location getLocation() {\r\n\t\treturn location;\r\n\t}", "public Point getLocation() {\n\t\treturn location.getCopy();\n\t}", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.CameraLocation getAuvLoc() {\n return auvLoc_;\n }", "public Location getLocation() {\n\t\treturn loc;\n\t}", "private void setCamera() {\n\t\tVector viewTranslation = controller.getCameraPosition();\n\n\t\tGL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);\n\t\tGL11.glMatrixMode(GL11.GL_PROJECTION);\n\t\tGL11.glLoadIdentity();\n\n\t\tfloat whRatio = (float) windowWidth / (float) windowHeight;\n\t\tGLU.gluPerspective(controller.getFOV(), whRatio, 1, 100000);\n\t\tGLU.gluLookAt((float) viewTranslation.x, (float) viewTranslation.y,\n\t\t\t\t(float) controller.getCameraDistance(), (float) viewTranslation.x,\n\t\t\t\t(float) viewTranslation.y, 0, 0, 1, 0);\n\n\t\tGL11.glMatrixMode(GL11.GL_MODELVIEW);\n\t\tGL11.glLoadIdentity();\n\t}", "public int getLocation()\r\n {\r\n return location;\r\n }", "public Location getLocation() {\n\t\treturn location;\n\t}", "private void getCurrentLocation() {\n try {\n if (locationPermissionGranted) {\n Task<Location> locationResult = fusedLocationClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n lastKnownLocation = task.getResult();\n if (lastKnownLocation != null) {\n map.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(lastKnownLocation.getLatitude(),\n lastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n updateCameraBearing(map, location.getBearing());\n }\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage(), e);\n }\n }", "@Nonnull\n Location getPlayerLocation();", "public Point getLocation() {\r\n\t\treturn this.center;\r\n\t}", "public void setCamera(Camera camera) {\r\n\t\tthis.camera = camera;\r\n\t}", "public void setCamera(Camera camera) {\n mCamera = camera;\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.CameraLocation getAuvLoc() {\n return auvLoc_;\n }", "@Override \n public Vector getLocation() {\n return this.getR();\n }", "@Override\n public geo_location getLocation() {\n return location;\n }", "public static MapLocation myLocation() {\n return RC.getLocation();\n }", "Location getUserLocation()\n {\n\n return userLocation;\n }", "public void getCameraInstance() {\n newOpenCamera();\n }", "@java.lang.Override\n public double getPlayerLat() {\n return playerLat_;\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera getCamera(int index) {\n return camera_.get(index);\n }", "public Coordinate getLocation();", "public Location getLocation()\n {\n if (worldData == null || position == null)\n {\n // Must have a world and position to make a location;\n return null;\n }\n\n if (orientation == null)\n {\n return new Location(worldData.getWorld(), position.getX(), position.getY(), position.getZ());\n }\n\n return new Location(worldData.getWorld(), position.getX(), position.getY(), position.getZ(), orientation.getYaw(), orientation.getPitch());\n }", "public Location getCurrentLocation();", "public float[] getLocation() {\n return llpoints;\n }", "@Override\n public Location getOrigin() {\n return getOwner().getLocation();\n }", "public int getYPos() {\r\n\t\treturn this.cameraY;\r\n\t}", "@Override\n public Point3D getLocation() {\n return myMovable.getLocation();\n }", "public void saveCameraPosition() {\n \t\tCameraPosition camera = mMap.getCameraPosition();\n \t\tSharedPreferences settings = context.getSharedPreferences(\"MAP\", 0);\n \t\tSharedPreferences.Editor editor = settings.edit();\n \t\teditor.putFloat(\"lat\", (float) camera.target.latitude);\n \t\teditor.putFloat(\"lng\", (float) camera.target.longitude);\n \t\teditor.putFloat(\"bea\", camera.bearing);\n \t\teditor.putFloat(\"tilt\", camera.tilt);\n \t\teditor.putFloat(\"zoom\", camera.zoom);\n \t\teditor.commit();\n \t}", "public Point getLocation() {\n return pos;\n }", "@Override\n public void onLocationUpdated(Location location) {\n fromPosition = new LatLng(location.getLatitude(), location.getLongitude());\n btn1.setVisibility(View.VISIBLE);\n moveCamera(new LatLng(location.getLatitude(), location.getLongitude()),\n DEFAULT_ZOOM, \"My Location\");\n }", "public Vector2F getScreenLocation() {\n\t\treturn new Vector2F(xPos, yPos);\n\t}", "public static void setCameraFrame() {\n\t\tCAMERA.src = VERTICES[CAMERA.v];\n\t\tVector zc = CAMERA.src.d.scale(-1).normalized();\n\t\tCAMERA.zAxis = zc;\n\t\tVector xc = MathUtils.cross(CAMERA.src.d, new Vector(0, 1, 0)).normalized();\n\t\tCAMERA.xAxis = xc;\n\t\tVector yc = MathUtils.cross(zc, xc).normalized();\n\t\tCAMERA.yAxis = yc;\n\t\t\n\t\tSystem.out.println(\"***** just set camera: \" + CAMERA.toString());\n\t}", "org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera getCamera(int index);", "@javax.annotation.Nullable\n @ApiModelProperty(example = \"us/las\", value = \"Location of that image/snapshot. \")\n\n public String getLocation() {\n return location;\n }", "protected Location getLocation()\n {\n return location;\n }", "protected Location getLocation()\n {\n return location;\n }", "public Planet getLocation() {\n\t\treturn currentLocation;\n\t}", "public double[] getLocation()\n\t{\n\t\treturn location;\n\t}", "public int getXPos() {\r\n\t\treturn this.cameraX;\r\n\t}", "public String getLocation() { return location; }", "public String getLocation() { return location; }", "public Location getCurrentLocation()\n\t{\n\t\treturn currentLocation;\n\t}", "public Point getLocation();", "public Point getXyLocation() {\n return playerxy;\n }", "public Point getLocation(){\r\n return super.getLocation();\r\n }", "public String getLocation(){\r\n return location;\r\n }", "public SbVec3f getPoint() {\n \t return worldPoint; \n }" ]
[ "0.76706785", "0.7452009", "0.7304758", "0.72690845", "0.72338325", "0.71559983", "0.7154101", "0.7046798", "0.70081633", "0.69327897", "0.69272655", "0.68681216", "0.68557644", "0.67711866", "0.67711866", "0.6747399", "0.6741011", "0.6716902", "0.6701804", "0.66915077", "0.6647967", "0.6633728", "0.663125", "0.6625889", "0.6615977", "0.6615868", "0.6563407", "0.65447164", "0.6534596", "0.6500506", "0.64967924", "0.6492471", "0.6491445", "0.6491445", "0.64846814", "0.64700246", "0.64695674", "0.64681274", "0.64654", "0.64607733", "0.6456465", "0.6436298", "0.6430817", "0.6429829", "0.64286447", "0.64245623", "0.640604", "0.640604", "0.640604", "0.640604", "0.63943154", "0.63734597", "0.63722676", "0.6347685", "0.6347685", "0.6346484", "0.6344392", "0.633326", "0.6320322", "0.63134027", "0.63125604", "0.63042074", "0.6294952", "0.62915164", "0.6285687", "0.6276942", "0.62765574", "0.6275231", "0.6259761", "0.6254769", "0.6249173", "0.6242668", "0.62329614", "0.62326384", "0.62274325", "0.62263894", "0.6226122", "0.6225301", "0.62235034", "0.6217855", "0.6209746", "0.6208154", "0.62041193", "0.6197835", "0.61969346", "0.6185704", "0.61800563", "0.61775184", "0.6175166", "0.6175166", "0.6165346", "0.616519", "0.6156084", "0.6145164", "0.6145164", "0.6139861", "0.61366403", "0.61334777", "0.6129921", "0.61296535", "0.6127882" ]
0.0
-1
Getter of Y axis in relation to the camera
public Vector get_vUp() { return _vUp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getY()\n {\n return yaxis;\n }", "public int getYPos() {\r\n\t\treturn this.cameraY;\r\n\t}", "public float getYComponent() {\n return this.vy;\n }", "public int getUserPlaneY() {\r\n\t\treturn levelManager.getUserPlaneY();\r\n\t}", "public double getRightYAxis() {\n\t\treturn getRawAxis(Axis_RightY);\n\t}", "public double getY() {\n return mY;\n }", "public float getY();", "public float getY();", "public int yPos() {\n\t\treturn Engine.scaleY(y);\n\t}", "public SVGLength getY() {\n return y;\n }", "public double getYPos() {\n\t\treturn this.position[1];\n\t}", "public double getY() {\n return origin.getY();\n }", "public float getY() {\n return pos.y;\n }", "public float getY() {\n return this.y;\n }", "public double GetY(){\n return this._Y;\n }", "public double getY() { return y; }", "public double getY();", "Float getY();", "public double getY() {\n return collider.getY();\n }", "public float getY() {\n return y;\n }", "public float getY() {\n return y;\n }", "public float getY() {\r\n return y;\r\n }", "public double getY() {\n return position.getY();\n }", "float getY();", "float getY();", "float getY();", "float getY();", "float getY();", "float getY();", "public float getUpperRightY()\n {\n return ((COSNumber)rectArray.get(3)).floatValue();\n }", "public float getY() {\r\n\t\treturn y;\r\n\t}", "public float getY() {\n return this.y;\n }", "public double getFrameY() { return isRSS()? getFrameXY().y : getY(); }", "public float getY() {\n return y_;\n }", "public Float getY() {\n return _y;\n }", "public double getY() {\n return y;\r\n }", "public int getY(){\n\t\tif(!resetCoordinates()) return 10000;\n\t\treturn Math.round(robot.translation.get(1)/ AvesAblazeHardware.mmPerInch);\n\t}", "public double getUserFriendlyYPos(){\n return myGrid.getHeight()/ HALF-yPos;\n }", "public double getY() {\n return y;\n }", "public Float getY() {\n\t\treturn y;\n\t}", "public ChartYAxis getYAxis() { return _yaxis; }", "public double getY() {\n return this.y;\n }", "public double getY() {\n return this.y;\n }", "public double getY() {\n return this.y;\n }", "public double getY() {\r\n return y;\r\n }", "public double getY() {\n return y;\n }", "public double getY() {\n return y;\n }", "public double getY() {\n return y;\n }", "public double getY() {\n return y;\n }", "public double getY() {\n return y;\n }", "public double getY() {\n return y;\n }", "public double getRightJoystickVertical() {\n\t\treturn getRawAxis(RIGHT_STICK_VERTICAL) * -1;\n\t}", "public float getY(){\n return y;\n }", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "public double getY() {\r\n return this.y;\r\n }", "@Override\n\tpublic float getY() {\n\t\treturn this.y;\n\t}", "public float getY() {\n return y_;\n }", "public double getY(){\r\n return y;\r\n }", "public float getyPosition() {\n return yPosition;\n }", "public float getRotationY() {\n return mRotationY;\n }", "public double getY()\n {\n return y;\n }", "public int getY()\n\t{\n\t\treturn mY;\n\t}", "public int getDimY ()\n {\n return m_dim_y;\n }", "public float getTiltY() {\n return pm.pen.getLevelValue(PLevel.Type.TILT_Y);\n }", "public double getY(){\n\t\treturn y;\n\t}", "@java.lang.Override\n public float getY() {\n return y_;\n }", "@java.lang.Override\n public float getY() {\n return y_;\n }", "@java.lang.Override\n public float getY() {\n return y_;\n }", "@java.lang.Override\n public float getY() {\n return y_;\n }", "public double getYPosition()\n\t{\n\t\treturn yPosition;\n\t}", "public double getY(){\n return this.y;\n }", "public double getY(){\n return y;\n }", "public final double getY() {\n return y;\n }", "public float getY() {\n return internalGroup.getY();\n }", "double getYPosition();", "@java.lang.Override\n public float getY() {\n return y_;\n }", "@java.lang.Override\n public float getY() {\n return y_;\n }", "@java.lang.Override\n public float getY() {\n return y_;\n }", "public int getDimY() {\r\n return dimY;\r\n }", "@Override\n\tpublic float getY() \n\t{\n\t\treturn _y;\n\t}", "public final double getY() {\n return y;\n }", "public double getY() {\n return y_;\n }", "public double getY() {\n return y_;\n }", "public double getY() {\n return y_;\n }", "public float getY()\n {\n return fy;\n }", "public double getY() {\n return y_;\n }", "public double getY() {\n return y_;\n }", "public double getY() {\n return y_;\n }", "public double getY() {\n return y_;\n }", "public double getY() {\n return y_;\n }", "public double Y_r() {\r\n \t\treturn getY();\r\n \t}", "public double getDeltaY() {\n return deltaY;\n }", "public double getDeltaY() {\n return deltaY;\n }" ]
[ "0.7999134", "0.7897046", "0.74586236", "0.74051386", "0.73900485", "0.7307881", "0.72350925", "0.72350925", "0.72290343", "0.71996915", "0.7196935", "0.7196721", "0.71762556", "0.7169685", "0.7155802", "0.71551186", "0.71535957", "0.71391636", "0.7133373", "0.71317726", "0.71317726", "0.7126142", "0.71202445", "0.7111975", "0.7111975", "0.7111975", "0.7111975", "0.7111975", "0.7111975", "0.7104909", "0.7098052", "0.70832306", "0.7068702", "0.70591295", "0.70456994", "0.70444316", "0.7044096", "0.7036742", "0.70367163", "0.703249", "0.7030507", "0.70297176", "0.70297176", "0.70297176", "0.70262706", "0.7021242", "0.7021242", "0.7021242", "0.7021242", "0.7021242", "0.7021242", "0.7018184", "0.7017391", "0.7015729", "0.7015729", "0.7015729", "0.7015729", "0.7015729", "0.7015729", "0.7015729", "0.7015729", "0.7015729", "0.7014618", "0.70123875", "0.70114666", "0.7001886", "0.6997247", "0.69946176", "0.6987057", "0.6985699", "0.6985227", "0.6972957", "0.6970156", "0.6969088", "0.6969088", "0.6969088", "0.6969088", "0.69662213", "0.6954038", "0.6950402", "0.69487697", "0.6948609", "0.694736", "0.69466114", "0.69466114", "0.69466114", "0.69354844", "0.6934516", "0.6932468", "0.6926827", "0.6926827", "0.6926827", "0.6926767", "0.69265854", "0.69265854", "0.69265854", "0.69265854", "0.69265854", "0.69220203", "0.69203466", "0.69203466" ]
0.0
-1
Getter of Z axis in relation to the camera
public Vector get_vTo() { return _vTo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getZ()\n {\n return zaxis;\n }", "public double getZ() {\n return position.getZ();\n }", "public float getZ() {\r\n return z;\r\n }", "godot.wire.Wire.Vector3 getZ();", "public float getZ() {\n return z_;\n }", "public float getZ() {\n return z_;\n }", "@java.lang.Override\n public float getZ() {\n return z_;\n }", "@java.lang.Override\n public float getZ() {\n return z_;\n }", "@java.lang.Override\n public float getZ() {\n return z_;\n }", "@java.lang.Override\n public float getZ() {\n return z_;\n }", "float getZ();", "float getZ();", "float getZ();", "public double getZ() {\n\t\treturn point[2];\n\t}", "@java.lang.Override\n public godot.wire.Wire.Vector3 getZ() {\n return z_ == null ? godot.wire.Wire.Vector3.getDefaultInstance() : z_;\n }", "public double getZ() {\n\t\treturn z;\n\t}", "public double getZ() {\n\t\treturn z;\n\t}", "public float getZ()\n {\n return fz;\n }", "public double getZ() {\r\n\t\treturn z;\t\r\n\t\t}", "public final double getZ() {\n return z;\n }", "double getZ() { return pos[2]; }", "public double getAccelZ() {\n return m_accelerometer.getZ();\n }", "public double getZ() {\r\n return z;\r\n }", "public double getZ(){\n\t\treturn z;\n\t}", "public double getDeltaZ() {\n return deltaZ;\n }", "public double getDeltaZ() {\n return deltaZ;\n }", "public double getDeltaZ() {\n return deltaZ;\n }", "@Override\n\tpublic double getZ() {\n\t\treturn z;\n\t}", "public int getZ() {\n\t\treturn z;\n\t}", "public float getZ(){\n\t\tif(!isRoot()){\n\t\t\treturn getParent().getZ() + z;\n\t\t}else{\n\t\t\treturn z;\n\t\t}\n\t}", "public float getAccelZ() {\n return mAccelZ;\n }", "public float getRotateZ() { return rotateZ; }", "public int getzPos() {\n return zPos;\n }", "public int getDimZ() {\r\n return dimZ;\r\n }", "public final double getZ()\n {\n return m_jso.getZ();\n }", "public int getZ() {\r\n return z;\r\n }", "public float getLocalZ(){\n\t\treturn this.z;\n\t}", "public int getZ() {\n return z;\n }", "public int getZ() {\n\t\treturn -150;\n\t}", "public int getZ() {\n return Z;\n }", "public double getZFactor() {\r\n\t\treturn z_factor;\r\n\t}", "@Override\n public int getZ() {\n return (int) claim.getZ();\n }", "@Override\n\tpublic double getZLoc() {\n\t\tdouble side = Math.sqrt(getMySize())/2;\n\t\treturn z-side;\n\t}", "public float getAccZ() {\n return accZ_;\n }", "@java.lang.Override\n public godot.wire.Wire.Vector3OrBuilder getZOrBuilder() {\n return getZ();\n }", "public godot.wire.Wire.Vector3 getZ() {\n if (zBuilder_ == null) {\n return z_ == null ? godot.wire.Wire.Vector3.getDefaultInstance() : z_;\n } else {\n return zBuilder_.getMessage();\n }\n }", "public double Z_r() {\r\n \t\treturn getZ();\r\n \t}", "public double getz0()\n\t{\n\t\treturn this.z0;\n\t}", "public float getAccZ() {\n return accZ_;\n }", "public int getZ() {\n return Z;\n }", "public int getZX() {\n\t\treturn zX;\n\t}", "float getAccZ();", "abstract double getOrgZ();", "int getZ();", "int getZ();", "int getZ();", "public Double getLoginPosZ() {\n\t\treturn this.loginPosZ;\n\t}", "public double getModZ() {\n return (modZ != 0 ? ( modZ > 0 ? (modZ - RESTADOR) : (modZ + RESTADOR) ) : modZ);\n }", "double getz() {\nreturn this.z;\n }", "@MavlinkFieldInfo(\n position = 8,\n unitSize = 2,\n signed = true,\n description = \"Ground Z Speed (Altitude, positive down)\"\n )\n public final int vz() {\n return this.vz;\n }", "public double getBorderCenterZ()\n {\n return borderCenterZ;\n }", "public int getZY() {\n\t\treturn zY;\n\t}", "@Override\n\tpublic double getZPos() {\n\t\treturn field_145849_e;\n\t}", "public abstract ParamNumber getParamZ();", "public short getZDim() {\n\t\treturn getShort(ADACDictionary.Z_DIMENSIONS);\n\t}", "public godot.wire.Wire.Vector3OrBuilder getZOrBuilder() {\n if (zBuilder_ != null) {\n return zBuilder_.getMessageOrBuilder();\n } else {\n return z_ == null ?\n godot.wire.Wire.Vector3.getDefaultInstance() : z_;\n }\n }", "public Double z() {\n return z;\n }", "double getZLength();", "Double getZLength();", "@Override\n UnitVector3DBasics getAxis();", "public Double z() {\n return this.f917a.getAsDouble(\"CFG_LOCATION_LATITUDE\");\n }", "public double getPlaneX()\n {\n return planeX;\n }", "public String getZcxz() {\n return zcxz;\n }", "godot.wire.Wire.Vector3OrBuilder getZOrBuilder();", "public double getGyroAngleZ() {\n return m_gyro.getAngleZ();\n }", "int getZOrder();", "public int getBlockZ()\n\t {\n\t\t if(z >= 0.0) return (int)z;\n\t\t return -1 + (int)(z);\n\t }", "public int getCameraSensorRotation();", "float zAt(int xIndex, int yIndex);", "public final int getZOff() {\r\n\t\treturn zOff;\r\n\t}", "default void setZ(double z)\n {\n getAxis().setZ(z);\n }", "abstract double getDirZ();", "@Override\n\tpublic int getZ() {\n\t\treturn 1000;\n\t}", "public float max3DZ() {\n return Math.max(stop3D.z, start3D.z);\n }", "public Vector2 getCameraPosition()\n {\n\n Vector2 tmpVector = new Vector2(camera.position.x/camera.zoom - Gdx.graphics.getWidth()/2, camera.position.y/camera.zoom - Gdx.graphics.getHeight()/2);\n return tmpVector;\n }", "public final int zzb() {\n return this.zzx;\n }", "public Vector3d[] getAxes()\n {\n return new Vector3d[] { getRight(), getUp(), getDir() };\n }", "@Override\n public double getLocationZ() {\n return myMovable.getLocationZ();\n }", "public float approach_z_GET()\n { return (float)(Float.intBitsToFloat((int) get_bytes(data, 49, 4))); }", "@Override\n public double getDestinationZ() {\n return myMovable.getDestinationZ();\n }", "public interface Camera {\n Vector3f getPosition();\n\n float getYaw();\n\n float getPitch();\n\n float getRoll();\n}", "public Float getZwsalary() {\n return zwsalary;\n }", "public double magnitude(){\n\t\treturn Math.sqrt(x*x + y*y + z*z);\n\t}", "public void getBorderCenterZ(double posZ)\n {\n borderCenterZ = posZ;\n }", "public float magnitude() {\r\n \r\n return (float)Math.sqrt(x*x + y*y + z*z);\r\n }", "public SVector3d getPositionCam() {\n\t\treturn transCamera;\n\t}", "public double magnitude() {\n\t\treturn Math.sqrt(x*x + y*y + z*z);\n\t}", "public Point getCameraPosition() {\n\t\treturn new Point(cameraPosition.x, cameraPosition.y, cameraPosition.z);\n\t}", "public Vector3f getRotationVec() {\n\t\treturn m_xforms[NvCameraXformType.MAIN].m_rotate;\n\t}", "public int getSpawnZ()\n {\n return spawnZ;\n }", "public double getAngleYZ() {\r\n\t\tdouble l = this.lenght();\r\n\t\tif (l==0)\r\n\t\t\treturn 0;\r\n\t\treturn Math.asin(this.x/l);\r\n\t}" ]
[ "0.82104605", "0.7450367", "0.7320933", "0.7319531", "0.72825867", "0.72662157", "0.71566004", "0.71566004", "0.71501875", "0.71501875", "0.7141119", "0.7141119", "0.7141119", "0.70997256", "0.70879894", "0.7021309", "0.7021309", "0.7014221", "0.70016927", "0.69941556", "0.69817257", "0.6965387", "0.6961399", "0.69365746", "0.69328266", "0.69328266", "0.69186234", "0.69185376", "0.690541", "0.68848544", "0.68638635", "0.6832682", "0.67596936", "0.67515945", "0.67248434", "0.66821295", "0.6677127", "0.66743463", "0.66633344", "0.6653464", "0.6641686", "0.66139215", "0.65863955", "0.655404", "0.6524038", "0.6517701", "0.6509122", "0.6495909", "0.6476063", "0.64292717", "0.63730943", "0.63559675", "0.6341723", "0.6286002", "0.6286002", "0.6286002", "0.6268575", "0.62412554", "0.62278324", "0.6192631", "0.6186306", "0.612656", "0.6123057", "0.61149913", "0.6112896", "0.61024904", "0.6090301", "0.6078352", "0.60483104", "0.6046509", "0.59752595", "0.59750485", "0.5956571", "0.5956444", "0.5946914", "0.5929331", "0.5923129", "0.59140474", "0.5904013", "0.5902491", "0.5899724", "0.5868462", "0.58580375", "0.5839129", "0.58330935", "0.58170664", "0.5813314", "0.58046186", "0.5783513", "0.57672906", "0.5733915", "0.57330346", "0.57319343", "0.5719983", "0.5717138", "0.57102984", "0.57027495", "0.56939083", "0.56870496", "0.56830937", "0.56594896" ]
0.0
-1
Getter of X axis in relation to the camera
public Vector get_vRight() { return _vRight; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getX()\n {\n return xaxis;\n }", "public int getXPos() {\r\n\t\treturn this.cameraX;\r\n\t}", "public ChartXAxis getXAxis() { return _xaxis; }", "public float getxPosition() {\n return xPosition;\n }", "public float getX() { return xCoordinate;}", "public double getFrameX() { return isRSS()? getFrameXY().x : getX(); }", "public float getX() {\n return pos.x;\n }", "public int getX()\n\t{\n\t\treturn mX;\n\t}", "public float getX() {\n return x;\n }", "public float getX() {\n return x;\n }", "public float getX() {\n return x;\n }", "public float getX() {\n return this.x;\n }", "public float getX() {\r\n return x;\r\n }", "public double getXPosition()\n\t{\n\t\treturn xPosition;\n\t}", "public double getX() {\n return mX;\n }", "public float getX() {\n return x_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public float getX() {\n return this.x;\n }", "public float getX() {\r\n\t\treturn x;\r\n\t}", "@java.lang.Override\n public float getX() {\n return x_;\n }", "public double getPanX() {\n return mPanX;\n }", "@java.lang.Override\n public float getX() {\n return x_;\n }", "@java.lang.Override\n public float getX() {\n return x_;\n }", "@java.lang.Override\n public float getX() {\n return x_;\n }", "@java.lang.Override\n public float getX() {\n return x_;\n }", "public int getXPosition() {\n return xPosition;\n }", "public float getX() {\n return x_;\n }", "@Override\n\tpublic float getX() {\n\t\treturn this.x;\n\t}", "public Float getX() {\n\t\treturn x;\n\t}", "@Override\n\tpublic float getX() {\n\t\treturn lilyPosX;\n\t}", "@java.lang.Override\n public float getX() {\n return x_;\n }", "@java.lang.Override\n public float getX() {\n return x_;\n }", "@java.lang.Override\n public float getX() {\n return x_;\n }", "public double getXPos(){\n return xPos;\n }", "public int getXPosition(){\n\t\treturn xPosition;\n\t}", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public float getXOffset() {\n return mXOffset;\n }", "public double getXPixel()\n {\n return xPixel;\n }", "public double getPositionX() {\n return positionX_;\n }", "public float getXComponent() {\n return this.vx;\n }", "public int getXPosition()\n {\n return xPosition;\n }", "public int getXPosition()\n {\n return xPosition;\n }", "@Override\n\tpublic float getX() \n\t{\n\t\treturn _x;\n\t}", "double getXPosition();", "public int getX() {\r\n\t\treturn xcoord;\r\n\t}", "public Float getX() {\n return _x;\n }", "public float getPositionX() {return this.position.getX();}", "public double getXCoordinates() { return xCoordinates; }", "private int get_x() {\n return center_x;\n }", "public double getX() {\n return collider.getX();\n }", "public double getLeftXAxis() {\n\t\treturn getRawAxis(Axis_LeftX);\n\t}", "public double getPlaneX()\n {\n return planeX;\n }", "public int getXPosition() {\n return this.xPosition;\n }", "public SVGLength getX() {\n return x;\n }", "double getPositionX();", "double getPositionX();", "double getPositionX();", "public int getX(){\n\t\tif(!resetCoordinates()) return 10000;\n\t\treturn Math.round(robot.translation.get(0)/ AvesAblazeHardware.mmPerInch);\n\t}", "Float getX();", "public int getX()\r\n {\r\n \treturn xPos;\r\n }", "int getDeltaX() {\n return deltaX;\n }", "public double getXPos() {\n\t\treturn this.position[0];\n\t}", "public float getX() {\n return internalGroup.getX();\n }", "public int getXPosition() {\n\t\treturn this.position.x;\n\t}", "protected float getX(float x) {\r\n\t\treturn ((x - viewStart.x) * parent.pixelsPerUnit);\r\n\t}", "public int getDimX() {\r\n return dimX;\r\n }", "public int getX() {\n return pos_x;\n }", "public float getX();", "public float getX();", "public int getX() {\n return xCoord;\n }", "public int getX() {\n\t\t\n\t\treturn xPosition;\t\t// Gets the x integer\n\t}", "public int getCoordX() \r\n {\r\n \treturn this.coordX;\r\n }", "public int getX() {\n return (int) xPos;\n }", "public int getPositionX(){\n\t\treturn positionx;\n\t}", "public double getX() {\n return position.getX();\n }", "public int getDimX ()\n {\n return m_dim_x;\n }", "int getX() {\n return xPos;\n }", "public int getX() {\n return (int) this.center.getX();\n }", "public double getUserFriendlyXPos(){\n return xPos - myGrid.getWidth()/ HALF;\n }", "private double getPosX() {\n\t\treturn this.posX.get();\n\t}", "public int getX() {\n return (int) center.getX();\n }", "public int getxPosition() {\n\t\treturn xPosition;\n\t}", "public double getPositionX() {\n\t\treturn this.tilePositionX;\n\t}", "public int getX()\r\n {\r\n return xCoord;\r\n }", "public int getX() {\r\n return (int) center.getX();\r\n }", "public void getOriginX(){\n\t\toriginX.setText(Double.toString(note.getOriginX()));\n\t}", "public int getXPos() {\n\t\treturn xPos;\n\t}", "public double getX() {\r\n\t\t return this.xCoord;\r\n\t }", "public int getXPoint() {\r\n return this.x;\r\n }", "public int getPositionX() {\n return positionX;\n }", "float getX();", "float getX();", "float getX();", "float getX();", "float getX();", "float getX();", "public final double getScreenX() {\n return screenX;\n }", "public double getX() {\n\t\treturn sens.getXPos();\n\t}" ]
[ "0.7930546", "0.788584", "0.7296697", "0.7065517", "0.7039688", "0.70329106", "0.6998971", "0.69734335", "0.69453865", "0.69453865", "0.69453865", "0.6933261", "0.6931384", "0.693011", "0.6919721", "0.6918418", "0.6895458", "0.68951845", "0.68951845", "0.68888426", "0.6888562", "0.6886558", "0.68798655", "0.6870508", "0.6870508", "0.6870508", "0.6870508", "0.6860636", "0.6858436", "0.6845571", "0.68409413", "0.6833559", "0.68311995", "0.68311995", "0.68311995", "0.68307984", "0.6828882", "0.68172807", "0.68172807", "0.68169165", "0.6816632", "0.68163836", "0.6812959", "0.6807883", "0.6807883", "0.680435", "0.6802861", "0.6789083", "0.67819107", "0.6781687", "0.67807734", "0.67750907", "0.6762291", "0.6757868", "0.67563415", "0.67515343", "0.67422813", "0.6724879", "0.6724879", "0.6724879", "0.67226344", "0.6719829", "0.6716863", "0.67164755", "0.67064166", "0.6703912", "0.66967714", "0.66929406", "0.668778", "0.66688836", "0.6667691", "0.6667691", "0.66656643", "0.66611946", "0.665498", "0.66541755", "0.6648102", "0.6639088", "0.6638361", "0.6631623", "0.6623599", "0.6621757", "0.66128993", "0.66109353", "0.66037893", "0.65916795", "0.6584144", "0.6580522", "0.6576866", "0.65746874", "0.65716356", "0.656997", "0.6567706", "0.6566273", "0.6566273", "0.6566273", "0.6566273", "0.6566273", "0.6566273", "0.6563749", "0.6562937" ]
0.0
-1
Operations // Creates a ray though a certain pixel in the view plane
public Ray constructRayThroughPixel(int nX, int nY, int j, int i, // double screenDistance, double screenWidth, double screenHeight) { Point3D pC = _p0.add(_vTo.scale(screenDistance)); double rX = screenWidth / nX; double rY = screenHeight / nY; double yi = (i - (nY / 2.0)) * rY + (rY / 2.0); double xj = (j - (nX / 2.0)) * rX + (rX / 2.0); Point3D pIJ = pC; if (xj != 0) pIJ = pIJ.add(_vRight.scale(xj)); if (yi != 0) pIJ = pIJ.add(_vUp.scale(-yi)); return new Ray(_p0, pIJ.subtract(_p0)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testConstructRayThroughPixel() {\n\n\t\tCamera camera1 = new Camera(Point3D.ZERO, new Vector(0, 1, 0), new Vector(0, 0, 1));\n\n\t\t// 3X3\n\t\tRay ray11 = camera1.constructRayThroughPixel(3, 3, 1, 1, 100, 150, 150);\n\t\tRay expectedRay11 = new Ray(Point3D.ZERO, new Vector(50, 50, 100).normalize());\n\t\tassertEquals(\"positive up to vectors testing at 3X3 in pixel (1,1)\", ray11, expectedRay11);\n\n\t\tRay ray33 = camera1.constructRayThroughPixel(3, 3, 3, 3, 100, 150, 150);\n\t\tRay expectedRay33 = new Ray(Point3D.ZERO, new Vector(-50, -50, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X3 in pixel (3,3)\", ray33, expectedRay33);\n\n\t\tRay ray21 = camera1.constructRayThroughPixel(3, 3, 2, 1, 100, 150, 150);\n\t\tRay expectedRay21 = new Ray(Point3D.ZERO, new Vector(0, 50, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X3 in pixel (2,1)\", ray21, expectedRay21);\n\n\t\tRay ray23 = camera1.constructRayThroughPixel(3, 3, 2, 3, 100, 150, 150);\n\t\tRay expectedRay23 = new Ray(Point3D.ZERO, new Vector(0, -50, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X3 in pixel (2,3)\", ray23, expectedRay23);\n\n\t\tRay ray12 = camera1.constructRayThroughPixel(3, 3, 1, 2, 100, 150, 150);\n\t\tRay expectedRay12 = new Ray(Point3D.ZERO, new Vector(50, 0, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X3 in pixel (1,2)\", ray12, expectedRay12);\n\n\t\tRay ray32 = camera1.constructRayThroughPixel(3, 3, 3, 2, 100, 150, 150);\n\t\tRay expectedRay32 = new Ray(Point3D.ZERO, new Vector(-50, 0, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X3 in pixel (3,2)\", ray32, expectedRay32);\n\n\t\tRay ray22 = camera1.constructRayThroughPixel(3, 3, 2, 2, 100, 150, 150);\n\t\tRay expectedRay22 = new Ray(Point3D.ZERO, new Vector(0, 0, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X3 in pixel (2,2) - A case test that Pij is equal to Pc\", ray22,\n\t\t\t\texpectedRay22);\n\n\t\t// 3X4 Py={1,2,3} Px={1,2,3,4}\n\n\t\tRay rayS22 = camera1.constructRayThroughPixel(4, 3, 2, 2, 100, 200, 150);\n\t\tRay expectedRayS22 = new Ray(Point3D.ZERO, new Vector(25, 0, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X4 in pixel (2,2)\", rayS22, expectedRayS22);\n\n\t\tRay rayS32 = camera1.constructRayThroughPixel(4, 3, 3, 2, 100, 200, 150);\n\t\tRay expectedRayS32 = new Ray(Point3D.ZERO, new Vector(-25, 0, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X4 in pixel (3,2)\", rayS32, expectedRayS32);\n\n\t\tRay rayS11 = camera1.constructRayThroughPixel(4, 3, 1, 1, 100, 200, 150);\n\t\tRay expectedRayS11 = new Ray(Point3D.ZERO, new Vector(75, 50, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X4 in pixel (1,1)\", rayS11, expectedRayS11);\n\n\t\tRay rayS43 = camera1.constructRayThroughPixel(4, 3, 4, 3, 100, 200, 150);\n\t\tRay expectedRayS43 = new Ray(Point3D.ZERO, new Vector(-75, -50, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 3X4 in pixel (4,3)\", rayS43, expectedRayS43);\n\n\t\t// 4X3 Py={1,2,3,4} Px={1,2,3}\n\n\t\tRay ray_c22 = camera1.constructRayThroughPixel(3, 4, 2, 2, 100, 150, 200);\n\t\tRay expectedRay_c22 = new Ray(Point3D.ZERO, new Vector(0, 25, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 4X3 in pixel (2,2)\", ray_c22, expectedRay_c22);\n\n\t\tRay ray_c32 = camera1.constructRayThroughPixel(3, 4, 3, 2, 100, 150, 200);\n\t\tRay expectedRay_c32 = new Ray(Point3D.ZERO, new Vector(-50, 25, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 4X3 in pixel (3,2)\", ray_c32, expectedRay_c32);\n\n\t\tRay ray_c11 = camera1.constructRayThroughPixel(3, 4, 1, 1, 100, 150, 200);\n\t\tRay expectedRay_c11 = new Ray(Point3D.ZERO, new Vector(50, 75, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 4X3 in pixel (1,1)\", ray_c11, expectedRay_c11);\n\n\t\tRay ray_c43 = camera1.constructRayThroughPixel(3, 4, 3, 4, 100, 150, 200);\n\t\tRay expectedRay_c43 = new Ray(Point3D.ZERO, new Vector(-50, -75, 100).normalize());\n\t\tassertEquals(\"pozitiv up to vectors testing at 4X3 in pixel (4,3)\", ray_c43, expectedRay_c43);\n\n\t\t// ======\n\t\t// Negative vectors.\n\t\tCamera camera2 = new Camera(Point3D.ZERO, new Vector(0, -1, 0), new Vector(0, 0, -1));\n\n\t\t// 3X3\n\t\tRay ray1 = camera2.constructRayThroughPixel(3, 3, 3, 3, 100, 150, 150);\n\t\tRay resultRay = new Ray(Point3D.ZERO,\n\t\t\t\tnew Vector(-1 / Math.sqrt(6), 1 / Math.sqrt(6), -(Math.sqrt((double) 2 / 3))));\n\t\tassertEquals(\"Negative vectors testing at 3X3 in pixel (3,3)\", ray1, resultRay);\n\n\t\t// 3X3\n\t\tRay ray_d11 = camera2.constructRayThroughPixel(3, 3, 1, 1, 100, 150, 150);\n\t\tRay expectedRay_d11 = new Ray(Point3D.ZERO, new Vector(50, -50, -100).normalize());\n\t\tassertEquals(\"negative up to vectors testing at 3X3 in pixel (1,1)\", ray_d11, expectedRay_d11);\n\n\t\tRay ray_d33 = camera2.constructRayThroughPixel(3, 3, 3, 3, 100, 150, 150);\n\t\tRay expectedRay_d33 = new Ray(Point3D.ZERO, new Vector(-50, 50, -100).normalize());\n\t\tassertEquals(\"negative up to vectors testing at 3X3 in pixel (3,3)\", ray_d33, expectedRay_d33);\n\n\t\tRay ray_d21 = camera2.constructRayThroughPixel(3, 3, 2, 1, 100, 150, 150);\n\t\tRay expectedRay_d21 = new Ray(Point3D.ZERO, new Vector(0, -50, -100).normalize());\n\t\tassertEquals(\"negative up to vectors testing at 3X3 in pixel (2,1)\", ray_d21, expectedRay_d21);\n\n\t\tRay ray_d23 = camera2.constructRayThroughPixel(3, 3, 2, 3, 100, 150, 150);\n\t\tRay expectedRay_d23 = new Ray(Point3D.ZERO, new Vector(0, 50, -100).normalize());\n\t\tassertEquals(\"negative up to vectors testing at 3X3 in pixel (2,3)\", ray_d23, expectedRay_d23);\n\n\t\tRay ray_d12 = camera2.constructRayThroughPixel(3, 3, 1, 2, 100, 150, 150);\n\t\tRay expectedRay_d12 = new Ray(Point3D.ZERO, new Vector(50, 0, -100).normalize());\n\t\tassertEquals(\"negative up to vectors testing at 3X3 in pixel (1,2)\", ray_d12, expectedRay_d12);\n\n\t\tRay ray_d32 = camera2.constructRayThroughPixel(3, 3, 3, 2, 100, 150, 150);\n\t\tRay expectedRay_d32 = new Ray(Point3D.ZERO, new Vector(-50, 0, -100).normalize());\n\t\tassertEquals(\"negative up to vectors testing at 3X3 in pixel (3,2)\", ray_d32, expectedRay_d32);\n\n\t\t// vTo negative vUp positive\n\t\tCamera camera3 = new Camera(Point3D.ZERO, new Vector(0, 1, 0), new Vector(0, 0, -1));\n\n\t\t// 3X4\n\n\t\tRay ray_e22 = camera3.constructRayThroughPixel(4, 3, 2, 2, 100, 200, 150);\n\t\tRay expectedRay_e22 = new Ray(Point3D.ZERO, new Vector(-25, 0, -100).normalize());\n\t\tassertEquals(\"vTo negative vUp positive vectors testing at 3X4 in pixel (2,2)\", ray_e22, expectedRay_e22);\n\n\t\tRay ray_e32 = camera3.constructRayThroughPixel(4, 3, 3, 2, 100, 200, 150);\n\t\tRay expectedRay_e32 = new Ray(Point3D.ZERO, new Vector(25, 0, -100).normalize());\n\t\tassertEquals(\"vTo negative vUp positive vectors testing at 3X4 in pixel (3,2)\", ray_e32, expectedRay_e32);\n\n\t\tRay ray_e11 = camera3.constructRayThroughPixel(4, 3, 1, 1, 100, 200, 150);\n\t\tRay expectedRay_e11 = new Ray(Point3D.ZERO, new Vector(-75, 50, -100).normalize());\n\t\tassertEquals(\"vTo negative vUp positive vectors testing at 3X4 in pixel (1,1)\", ray_e11, expectedRay_e11);\n\n\t\tRay ray_e43 = camera3.constructRayThroughPixel(4, 3, 4, 3, 100, 200, 150);\n\t\tRay expectedRay_e43 = new Ray(Point3D.ZERO, new Vector(75, -50, -100).normalize());\n\t\tassertEquals(\"vTo negative vUp positive vectors testing at 3X4 in pixel (4,3)\", ray_e43, expectedRay_e43);\n\n\t\t// ======\n\t\tCamera littlCam = new Camera(Point3D.ZERO, new Vector(0, 1, 0), new Vector(0, 0, 1));\n\t\tRay littl33 = littlCam.constructRayThroughPixel(3, 3, 3, 3, 10, 6, 6);\n\t\tRay checklittl33 = new Ray(Point3D.ZERO, new Vector(-2, -2, 10).normalize());\n\t\tRay littl11 = littlCam.constructRayThroughPixel(3, 3, 1, 1, 10, 6, 6);\n\t\tRay checklittl11 = new Ray(Point3D.ZERO, new Vector(2, 2, 10).normalize());\n\n\t\tassertEquals(\"3,3\", littl33, checklittl33);\n\t\tassertEquals(\"1,1\", littl11, checklittl11);\n\t}", "public void raycast(VrState state);", "public static void generateRay(final int i, final int j, final double[] pixelOffset, Point3d eyeOffset, final Camera cam, Ray ray) {\n\t\tdouble width = cam.imageSize.getWidth();\n\t\tdouble height = cam.imageSize.getHeight();\n\t\tPoint3d eyePoint = new Point3d();\n\t\teyePoint.set(cam.from);\n\t\teyePoint.add(eyeOffset); //small eyeOffset to simulate the focal lens\n\t\tray.eyePoint.set(eyePoint);\n\t\t\n\t\tdouble dToImage = cam.from.distance(cam.to); //distance from camera to image plane\n\t\tdouble focalLength = cam.focalLength; //Distance from camera to focal plane\n\t\t\n\t\t//For pixel (j, i), we calculate it's camera coordinates (u, v) first.\n\t\tdouble aspectRatio = width / height;\n\t\tdouble top = Math.tan(Math.toRadians(cam.fovy)/2.0) * dToImage;\n\t\t\n\t\tdouble left = -aspectRatio*top;\n\t\tdouble right = aspectRatio*top;\n\t\tdouble bot = -top;\n\t\tdouble u = left + (right - left) * (j+0.5+pixelOffset[0]) / width;\n\t\tdouble v = bot + (top - bot) * (i+0.5+pixelOffset[1]) / height; \n\t\t\n\t\t//Then transfer the camera coordinates (u, v) to world coordinates (x, y, z).\n\t\tVector3d wCam = new Vector3d();\n\t\twCam.sub(cam.from, cam.to);\n\t\twCam.normalize(); \n\t\tVector3d uCam = new Vector3d();\n\t\tuCam.cross(cam.up, wCam);\n\t\tuCam.normalize();\n\t\tVector3d vCam = new Vector3d();\n\t\tvCam.cross(uCam, wCam); //Why not w cross u?\n\t\tvCam.normalize();\n\t\tuCam.scale(u);\n\t\tvCam.scale(v);\n\t\twCam.scale(-dToImage);\n\t\tdouble xPixel = cam.from.x + uCam.x + vCam.x + wCam.x;\n\t\tdouble yPixel = cam.from.y + uCam.y + vCam.y + wCam.y;\n\t\tdouble zPixel = cam.from.z + uCam.z + vCam.z + wCam.z; //world coordinates (x, y, z) of pixel (j, i)\n\t\t\n\t\t//Find the corresponding focal plane world coordinates.\n\t\tdouble xFocal, yFocal, zFocal;\n\t\tdouble tmpRatio = focalLength / dToImage;\n\t\txFocal = (xPixel-cam.from.x) * tmpRatio + cam.from.x;\n\t\tyFocal = (yPixel-cam.from.y) * tmpRatio + cam.from.y;\n\t\tzFocal = (zPixel-cam.from.z) * tmpRatio + cam.from.z; //world coordinates of corresponding focal point\n\t\t\n\t\t//Calculate direction of ray\n\t\tVector3d dirToFocal = new Vector3d(xFocal, yFocal, zFocal);\n\t\tdirToFocal.sub(ray.eyePoint); //dirToFocal = focalPointCoordinates - eyePoint\n\t\tdirToFocal.normalize();\n\t\tray.viewDirection.set(dirToFocal);\t\n\t}", "public abstract Color traceRay(Ray ray);", "public abstract Color traceRay(Ray ray);", "public static void generateRay(final int i, final int j, final double[] offset, final Camera cam, Ray ray) {\n\t\tdouble width = cam.imageSize.getWidth();\n\t\tdouble height = cam.imageSize.getHeight();\n\t\tPoint3d eyePoint = new Point3d();\n\t\teyePoint.set(cam.from);\n\t\tray.eyePoint.set(eyePoint);\n\t\t\n\t\tdouble dToImage = cam.from.distance(cam.to); //distance from camera to image plane\n\t\tdouble focalLength = cam.focalLength; //Distance from camera to focal plane\n\t\t\n\t\t//For pixel (j, i), we calculate it's camera coordinates (u, v) first.\n\t\tdouble aspectRatio = width / height;\n\t\tdouble top = Math.tan(Math.toRadians(cam.fovy)/2.0) * dToImage;\n\t\t\n\t\tdouble left = -aspectRatio*top;\n\t\tdouble right = aspectRatio*top;\n\t\tdouble bot = -top;\n\t\tdouble u = left + (right - left) * (j+0.5+offset[0]) / width;\n\t\tdouble v = bot + (top - bot) * (i+0.5+offset[1]) / height; \n\t\t\n\t\t//Then transfer the camera coordinates (u, v) to world coordinates (x, y, z).\n\t\tVector3d wCam = new Vector3d();\n\t\twCam.sub(cam.from, cam.to);\n\t\twCam.normalize(); \n\t\tVector3d uCam = new Vector3d();\n\t\tuCam.cross(cam.up, wCam);\n\t\tuCam.normalize();\n\t\tVector3d vCam = new Vector3d();\n\t\tvCam.cross(uCam, wCam); //Why not w cross u?\n\t\tvCam.normalize();\n\t\tuCam.scale(u);\n\t\tvCam.scale(v);\n\t\twCam.scale(dToImage);\n\t\t\n\t\tVector3d s = new Vector3d(cam.from);\n\t\ts.add(uCam);\n\t\ts.add(vCam);\n\t\ts.sub(wCam);\n\t\ts.sub(cam.from);\n\t\ts.normalize();\n\t\tray.viewDirection.set(s);\n\t}", "public Ray constructRayThroughPixel(int Nx, int Ny, double x, double y, double screenDistance, double screenWidth, double screenHeight)\n {\n double Rx = screenWidth/Nx;\n double Ry = screenHeight/Ny;\n\n double A = (x - Nx/2) * Rx + Rx/2;\n double B = (y - Ny/2) * Ry + Ry/2;\n\n Vector helpR = new Vector(Vright);\n helpR.mult(A);\n Vector helpU = new Vector(Vright);\n helpU.mult(B);\n\n Vector RayVector = new Vector(helpR.substract(helpU));\n return new Ray(RayVector, centerOfProjection);\n }", "@Action\n public void addRay() {\n Point2D p1 = randomPoint(), p2 = randomPoint();\n TwoPointGraphic ag = new TwoPointGraphic(p1, p2, MarkerRenderer.getInstance());\n MarkerRendererToClip rend = new MarkerRendererToClip();\n rend.setRayRenderer(new ArrowPathRenderer(ArrowLocation.END));\n ag.getStartGraphic().setRenderer(rend);\n ag.setDefaultTooltip(\"<html><b>Ray</b>: <i>\" + p1 + \", \" + p2 + \"</i>\");\n ag.setDragEnabled(true);\n root1.addGraphic(ag); \n }", "private Ray constructReflectedRay(Vector normal, Point3D point, Ray inRay){\n Vector R = inRay.get_direction();\n normal.scale(2*inRay.get_direction().dotProduct(normal));\n R.subtract(normal);\n Vector epsV = new Vector(normal);\n if (normal.dotProduct(R) < 0) {\n epsV.scale(-2);\n }\n else {\n epsV.scale(2);\n }\n //Vector epsV = new Vector(EPS, EPS, EPS);\n Point3D eps = new Point3D(point);\n\n eps.add(epsV);\n R.normalize();\n return new Ray(eps, R);\n }", "private Ray constructReflectedRay(Point3D point, Ray inRay, Vector n) {\n Vector v = inRay.getDir();\n /**If crossProduct with v from camera to n normal=0\n * so the camera eny way will not see the color because the ray goes to the side*/\n double vn = v.dotProduct(n);\n if (vn == 0) {\n return null;\n }\n /**will calculate the r*/\n Vector r = v.subtract(n.scale(2 * vn)); //𝒓=𝒗−𝟐∙𝒗∙𝒏∙𝒏\n return new Ray(point, r, n);\n }", "private Ray constructRefractedRay(Geometry geometry, Point3D point, Ray inRay){\n Vector N = geometry.getNormal(point);\n Vector direct = inRay.get_direction();\n double cosOi = N.dotProduct(direct);\n if (cosOi < 0) {\n N.scale(-2);\n }\n else{\n N.scale(2);\n }\n Point3D pointEps = new Point3D(point);\n pointEps.add(N);\n return new Ray(pointEps, direct);\n }", "private Ray constructReflectedRay(Vector n, Point3D p, Ray l) { // hish\r\n\t\tVector _n = n;// normal at point\r\n\t\tVector _v = l.get_dir(); // direction of vector camera ->geometry\r\n\t\tdouble vn = _v.dotProduct(_n);\r\n\t\tif (vn == 0)\r\n\t\t\treturn null;\r\n\r\n\t\tVector _r = _v.add(_n.scale(-2 * vn));\r\n\t\treturn new Ray(p, _r, _n);\r\n\t}", "private Ray constructReflectedRay(Vector n, Point3D point, Ray ray) {\n Vector v = ray.getDirection();\n Vector r = null;\n try {\n r = v.subtract(n.scale(v.dotProduct(n)).scale(2)).normalized();\n }\n catch (Exception e) {\n return null;\n }\n return new Ray(point, r, n);\n }", "private Ray constructRefractedRay(Point3D point, Ray inRay, Vector n) {\n return new Ray(point, inRay.getDir(), n);\n }", "public Ray constructRayThroughPixel (int nX, int nY, int j, int i, double screenDistance, double screenWidth, double screenHeight) {\n if (nX <= 0 || nY <= 0)\n throw new IllegalArgumentException(\"Number of pixels has to be positive\");\n if (i < 0 || j < 0)\n throw new IllegalArgumentException(\"The coordinate cannot be negative\");\n if (i >= nY || j >= nX)\n throw new IllegalArgumentException(\"Coordinates out of boundaries\");\n if (alignZero(screenDistance) <= 0)\n throw new IllegalArgumentException(\"Distance has to be positive\");\n if (alignZero(screenWidth) <= 0)\n throw new IllegalArgumentException(\"Width has to be positive\");\n if (alignZero(screenHeight) <= 0)\n throw new IllegalArgumentException(\"Height has to be positive\");\n Point3D pC = this._p0.add(this._vTo.scale(screenDistance));\n double yI = (i - (nY-1)/2d) * (screenHeight/nY);\n double xJ = (j - (nX-1)/2d) * (screenWidth/nX);\n Point3D pIJ = pC;\n if (!isZero(xJ))\n pIJ = pIJ.add(this._vRight.scale(xJ));\n if (!isZero(yI))\n pIJ = pIJ.add(this._vUp.scale(-yI));\n return new Ray(this._p0, pIJ);\n }", "@Override\n\tpublic void intersect(Ray ray, IntersectResult result) {\n\t\t\t\tdouble tmin,tmax;\n\t\t\t\tdouble xmin, xmax, ymin, ymax, zmin, zmax;\n\t\t\t\t//find which face to cross\n\n\t\t\t\tif(ray.viewDirection.x>0){\n\t\t\t\t\txmin=(min.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t\txmax=(max.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t}else{\n\t\t\t\t\txmin=(max.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t\txmax=(min.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t}\n\t\t\t\tif(ray.viewDirection.y>0){\n\t\t\t\t\tymin=(min.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t\tymax=(max.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t}else{\n\t\t\t\t\tymin=(max.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t\tymax=(min.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t}\n\t\t\t\tif(ray.viewDirection.z>0){\n\t\t\t\t\tzmin=(min.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t\tzmax=(max.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t}else{\n\t\t\t\t\tzmin=(max.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t\tzmax=(min.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttmin=Double.max(xmin, ymin);\n\t\t\t\ttmin=Double.max(tmin, zmin);\n\t\t\t\ttmax=Double.min(xmax, ymax);\n\t\t\t\ttmax=Double.min(tmax, zmax);\n\t\t\t\t\n\t\t\t\t \n\t\t\t\tif(tmin<tmax && tmin>0){\n\t\t\t\t\t\n\t\t\t\t\tresult.material=material;\n\t\t\t\t\tresult.t=tmin;\n\t\t\t\t\tPoint3d p=new Point3d(ray.viewDirection);\n\t\t\t\t\tp.scale(tmin);\n\t\t\t\t\tp.add(ray.eyePoint);\n\t\t\t\t\tresult.p=p;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfinal double epsilon=1e-9;\n\t\t\t\t\t// find face and set the normal\n\t\t\t\t\tif(Math.abs(p.x-min.x)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(-1,0,0);\n\t\t\t\t\t}else if(Math.abs(p.x-max.x)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(1,0,0);\n\t\t\t\t\t}else if(Math.abs(p.y-min.y)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,-1,0);\n\t\t\t\t\t}else if(Math.abs(p.y-max.y)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,1,0);\n\t\t\t\t\t}else if(Math.abs(p.z-min.z)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,0,-1);\n\t\t\t\t\t}else if(Math.abs(p.z-max.z)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,0,1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t}", "public native void raycast(Raycaster raycaster, Object[] intersects);", "private float[] calculateMouseRay(int mouseX, int mouseY) {\n\t\tfloat[] normalizedDeviceCoords = getNormalizedDeviceCoords(mouseX, mouseY);\r\n\t\t\r\n\t\t//Creating a 4D vector out of the normalizedDeviceCoords, defining z as -1 (clipping Plane):\r\n\t\tfloat[] clipCoords = {normalizedDeviceCoords[0], normalizedDeviceCoords[1], -1f, 1f};\r\n\t\t\r\n\t\t//4D vector containing the inverted projection\r\n\t\tfloat[] eyeCoords = toEyeCoords(clipCoords);\r\n\t\t\r\n\t\t//3D vector containing the world coords of our mouse ray\r\n\t\tfloat[] worldCoords = toWorldCoords(eyeCoords);\r\n\t\t\r\n\t\treturn worldCoords;\r\n\t}", "private Ray constructRefractedRay(Vector n, Point3D p, Ray l) {\r\n\t\treturn new Ray(p, l.get_dir(), n);\r\n\t}", "public void directCompute() {\r\n\t\t\tshort[] rgb = new short[3];\r\n\t\t\tint offset = yMin * width;\r\n\t\t\tfor (int y = yMin; y < yMax; y++) {\r\n\t\t\t\tfor (int x = 0; x < width; x++) {\r\n\t\t\t\t\tPoint3D screenPoint = screenCorner.add(xAxis.scalarMultiply(x * 1.0 / (width - 1) * horizontal))\r\n\t\t\t\t\t\t\t.sub(yAxis.scalarMultiply(y * 1.0 / (height - 1) * vertical));\r\n\r\n\t\t\t\t\tRay ray = Ray.fromPoints(eye, screenPoint);\r\n\t\t\t\t\ttracer(scene, ray, rgb);\r\n\t\t\t\t\t// applying color to pixel\r\n\t\t\t\t\tred[offset] = rgb[0] > 255 ? 255 : rgb[0];\r\n\t\t\t\t\tgreen[offset] = rgb[1] > 255 ? 255 : rgb[1];\r\n\t\t\t\t\tblue[offset] = rgb[2] > 255 ? 255 : rgb[2];\r\n\r\n\t\t\t\t\toffset++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "private void computeDirect() {\n\t\t\tif (startY > 0) {\n\t\t\t\toffset = (startY - 1) * width;\n\t\t\t} else {\n\t\t\t\toffset = 0;\n\t\t\t}\n\n\t\t\tendY = endY == height ? endY - 1 : endY;\n\n\t\t\tfor (int y = startY; y <= endY; y++) {\n\t\t\t\tfor (int x = 0; x < width; x++) {\n\t\t\t\t\tfinal Point3D moveX = xAxis.scalarMultiply(x * horizontal / (width - 1));\n\t\t\t\t\tfinal Point3D moveY = yAxis.scalarMultiply(y * vertical / (height - 1));\n\t\t\t\t\tfinal Point3D screenPoint = screenCorner.add(moveX).sub(moveY);\n\n\t\t\t\t\tfinal Ray ray = Ray.fromPoints(eye, screenPoint);\n\n\t\t\t\t\tRayCasterUtil.tracer(scene, ray, rgb);\n\t\t\t\t\tred[offset] = rgb[0] > 255 ? 255 : rgb[0];\n\t\t\t\t\tgreen[offset] = rgb[1] > 255 ? 255 : rgb[1];\n\t\t\t\t\tblue[offset] = rgb[2] > 255 ? 255 : rgb[2];\n\n\t\t\t\t\toffset++;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public boolean\n doIntersection(Ray inOutRay) {\n double t, min_t = Double.MAX_VALUE;\n double x2 = size.x/2; // OJO: Esto deberia venir precalculado\n double y2 = size.y/2; // OJO: Esto deberia venir precalculado\n double z2 = size.z/2; // OJO: Esto deberia venir precalculado\n Vector3D p = new Vector3D();\n GeometryIntersectionInformation info = \n new GeometryIntersectionInformation();\n\n inOutRay.direction.normalize();\n\n // (1) Plano superior: Z = size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=size.z/2\n t = (z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = new Vector3D(p);\n min_t = t;\n lastPlane = 1;\n }\n }\n }\n\n // (2) Plano inferior: Z = -size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=-size.z/2\n t = (-z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 2;\n }\n }\n }\n\n // (3) Plano frontal: Y = size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=size.y/2\n t = (y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 3;\n }\n }\n }\n\n // (4) Plano posterior: Y = -size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=-size.y/2\n t = (-y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 4;\n }\n }\n }\n\n // (5) Plano X = size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=size.x/2\n t = (x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 5;\n }\n }\n }\n\n // (6) Plano X = -size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=-size.x/2\n t = (-x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 6;\n }\n }\n }\n\n if ( min_t < Double.MAX_VALUE ) {\n inOutRay.t = min_t;\n lastInfo.clone(info);\n return true;\n }\n return false;\n }", "public Ray(double d) {\n setOrigin(50, 200);\n setMatrix(d, 0);\n }", "public Ray(Point3D p0, Vector dir) {\n _p0 = p0;\n _dir = dir.normalized();\n }", "public int getRayNum();", "public float[] getHitPoint();", "public List<Ray> constructRaysFromAperture(double screenDistance, Ray basicRay, double numOfRays) {\n Random rand = new Random();\n // distance is the distance from the point on the view screen (that the aperture is around it) to the camera\n double distance = screenDistance/(_vTo.dotProduct(basicRay.get_direction()));\n Point3D pointOnPixel = _p0.add(basicRay.get_direction().scale(distance));\n // rays is the list of all the rays we check because of depth of field\n List<Ray> rays = new LinkedList<>(List.of(basicRay));\n double distanceBetweenCameraAndFocalPlane = screenDistance + _focusDistance;\n // focalPointDistance is the distance from the focalPoint to the camera\n double focalPointDistance = distanceBetweenCameraAndFocalPlane/(_vTo.dotProduct(basicRay.get_direction()));\n Point3D focalPoint = _p0.add(basicRay.get_direction().scale(focalPointDistance));\n // calculating all the rays from the aperture to the focal point\n // scattered randomly over the aperture square\n for (int k = 1; k < numOfRays; k++) {\n /* The way we chose a point:\n We thought about the aperture square as a 2d coordinate system (with right as x and up as y),\n and the 0 point is the middle point on the aperture (and on the pixel).\n Therefore, each axis can get numbers between -_aperture/2 and _aperture/2\n We found a random number for x (right) between -_aperture/2 and _aperture/2 and a random number for y (up) between -_aperture/2 and _aperture/2,\n and that's how we worried that the points will be scattered randomly over the aperture square\n */\n // get the middle point on the aperture\n Point3D pointInAperture = new Point3D(pointOnPixel);\n // get a random number that symbolizes how much we need to move right (or left if the number is negative) over the aperture square\n double right = (rand.nextDouble() * _aperture) - (_aperture / 2); // A random between -_aperture/2 and _aperture/2\n if (!isZero(right))\n // move the middle point according to the random number we got before, rightwards (or leftwards if the number is negative)\n // adds to the middle point, the vector _vRight in length of the random number\n pointInAperture = pointInAperture.add(this._vRight.scale(right));\n // get a random number that symbolizes how much we need to move up (or down if the number is negative) over the aperture square\n double up = (rand.nextDouble() * _aperture) - (_aperture / 2); // A random between -_aperture/2 and _aperture/2\n if (!isZero(up))\n // move the point (after we moved it rightwards) according to the random number we got before, upwards (or downwards if the number is negative)\n // adds to the point (after we moved it rightwards), the vector _vUp in length of the random number\n pointInAperture = pointInAperture.add(this._vUp.scale(up));\n // calculate rays vector. The vector from the point on the aperture to the focal point\n Vector rayVector = focalPoint.subtract(pointInAperture).normalized();\n // We want to find the point on the ray in the camera plane\n // The reason is that we are missing all the part of the scene that is between the camera and the view plane,\n // so we want that the beginning of these rays would be at the same plane as the camera\n Point3D pointOnCameraPlane = pointInAperture.add(rayVector.scale(-1 * screenDistance / (rayVector.dotProduct(_vTo))));\n rays.add(new Ray(pointOnCameraPlane, rayVector));\n }\n return rays;\n }", "public interface Ray3 extends Path3, Serializable, Cloneable {\r\n\r\n /**\r\n * Creates a new ray from 3 coordinates for the origin point and 3 coordinates for the direction vector.\r\n *\r\n * @param xo the x-coordinate of the origin\r\n * @param yo the y-coordinate of the origin\r\n * @param zo the z-coordinate of the origin\r\n * @param xd the x-coordinate of the direction\r\n * @param yd the y-coordinate of the direction\r\n * @param zd the z-coordinate of the direction\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 fromOD(double xo, double yo, double zo, double xd, double yd, double zd) {\r\n return new Ray3Impl(xo, yo, zo, xd, yd, zd);\r\n }\r\n\r\n /**\r\n * Creates a new ray from an origin point and a direction vector.\r\n *\r\n * @param origin the origin\r\n * @param dir the direction\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 fromOD(Vector3 origin, Vector3 dir) {\r\n return new Ray3Impl(origin, dir);\r\n }\r\n\r\n /**\r\n * Creates a new ray between two points.\r\n * The origin will be a copy of the point {@code from}.\r\n * The directional vector will be a new vector from {@code from} to {@code to}.\r\n *\r\n * @param from the first point\r\n * @param to the second point\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 between(Vector3 from, Vector3 to) {\r\n return fromOD(from, Vector3.between(from, to));\r\n }\r\n\r\n /**\r\n * Creates a new ray between two points.\r\n *\r\n * @param ox the origin x\r\n * @param oy the origin x\r\n * @param oz the origin x\r\n * @param tx the target x\r\n * @param ty the target x\r\n * @param tz the target x\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 between(double ox, double oy, double oz, double tx, double ty, double tz) {\r\n return fromOD(ox, oy, oz, tx-ox, ty-oy, tz-oz);\r\n }\r\n\r\n // GETTERS\r\n\r\n /**\r\n * Returns the x-coordinate of the origin of this ray.\r\n *\r\n * @return the x-coordinate of the origin of this ray\r\n */\r\n abstract double getOrgX();\r\n\r\n /**\r\n * Returns the y-coordinate of the origin of this ray.\r\n *\r\n * @return the y-coordinate of the origin of this ray\r\n */\r\n abstract double getOrgY();\r\n\r\n /**\r\n * Returns the z-coordinate of the origin of this ray.\r\n *\r\n * @return the z-coordinate of the origin of this ray\r\n */\r\n abstract double getOrgZ();\r\n\r\n /**\r\n * Returns the x-coordinate of the direction of this ray.\r\n *\r\n * @return the x-coordinate of the direction of this ray\r\n */\r\n abstract double getDirX();\r\n\r\n /**\r\n * Returns the y-coordinate of the direction of this ray.\r\n *\r\n * @return the y-coordinate of the direction of this ray\r\n */\r\n abstract double getDirY();\r\n\r\n /**\r\n * Returns the z-coordinate of the direction of this ray.\r\n *\r\n * @return the z-coordinate of the direction of this ray\r\n */\r\n abstract double getDirZ();\r\n\r\n /**\r\n * Returns the length of this ray.\r\n *\r\n * @return the length of this ray\r\n */\r\n abstract double getLength();\r\n\r\n /**\r\n * Returns the squared length of this ray.\r\n *\r\n * @return the squared length of this ray\r\n */\r\n abstract double getLengthSquared();\r\n \r\n /**\r\n * Returns the origin of this ray in a new vector.\r\n *\r\n * @return the origin of this ray in a new vector\r\n */\r\n @Override\r\n default Vector3 getOrigin() {\r\n return Vector3.fromXYZ(getOrgX(), getOrgY(), getOrgZ());\r\n }\r\n \r\n /**\r\n * Returns the direction of this ray in a new vector.\r\n *\r\n * @return the direction of this ray in a new vector\r\n */\r\n default Vector3 getDirection() {\r\n return Vector3.fromXYZ(getDirX(), getDirY(), getDirZ());\r\n }\r\n \r\n default AxisAlignedBB getBoundaries() {\r\n return AxisAlignedBB.between(getOrigin(), getEnd());\r\n }\r\n\r\n // PATH IMPL\r\n \r\n /**\r\n * Returns the end of this ray in a new vector. This is equal to the sum of the origin and direction of the vector.\r\n *\r\n * @return the end of this ray in a new vector\r\n */\r\n @Override\r\n default Vector3 getEnd() {\r\n return Vector3.fromXYZ(getOrgX() + getDirX(), getOrgY() + getDirY(), getOrgZ() + getDirZ());\r\n }\r\n\r\n @Override\r\n default Vector3[] getControlPoints() {\r\n return new Vector3[] {getOrigin(), getEnd()};\r\n }\r\n\r\n // CHECKERS\r\n\r\n /**\r\n * Returns whether the ray is equal to the given point at any point.\r\n *\r\n * @param x the x-coordinate of the point\r\n * @param y the y-coordinate of the point\r\n * @param z the z-coordinate of the point\r\n * @return whether the ray is equal to the given point at any point\r\n */\r\n default boolean contains(double x, double y, double z) {\r\n return Vector3.between(getOrgX(), getOrgY(), getOrgZ(), x, y, z).isMultipleOf(getDirection());\r\n }\r\n\r\n /**\r\n * Returns whether the ray is equal to the given point at any point.\r\n *\r\n * @param point the point\r\n * @return whether the ray is equal to the given point at any point\r\n */\r\n default boolean contains(Vector3 point) {\r\n return contains(point.getX(), point.getY(), point.getZ());\r\n }\r\n\r\n /**\r\n * Returns whether this ray is equal to another ray. This condition is true\r\n * if both origin and direction are equal.\r\n *\r\n * @param ray the ray\r\n * @return whether this ray is equal to the ray\r\n */\r\n default boolean equals(Ray3 ray) {\r\n return\r\n getOrigin().equals(ray.getOrigin()) &&\r\n getDirection().isMultipleOf(ray.getDirection());\r\n }\r\n\r\n // SETTERS\r\n\r\n /**\r\n * Sets the origin of the ray to a given point.\r\n *\r\n * @param x the x-coordinate of the point\r\n * @param y the y-coordinate of the point\r\n * @param z the z-coordinate of the point\r\n */\r\n abstract void setOrigin(double x, double y, double z);\r\n\r\n /**\r\n * Sets the origin of the ray to a given point.\r\n *\r\n * @param point the point\r\n */\r\n default void setOrigin(Vector3 point) {\r\n setOrigin(point.getX(), point.getY(), point.getZ());\r\n }\r\n\r\n /**\r\n * Sets the direction of this ray to a given vector.\r\n *\r\n * @param x the x-coordinate of the vector\r\n * @param y the y-coordinate of the vector\r\n * @param z the z-coordinate of the vector\r\n */\r\n abstract void setDirection(double x, double y, double z);\r\n \r\n /**\r\n * Sets the direction of this ray to a given vector.\r\n *\r\n * @param v the vector\r\n */\r\n default void setDirection(Vector3 v) {\r\n setDirection(v.getX(), v.getY(), v.getZ());\r\n }\r\n\r\n /**\r\n * Sets the length of this ray to a given length.\r\n *\r\n * @param t the new hypot\r\n */\r\n default void setLength(double t) {\r\n scaleDirection(t / getLength());\r\n }\r\n\r\n default void normalize() {\r\n setLength(1);\r\n }\r\n \r\n //TRANSFORMATIONS\r\n \r\n default void scaleOrigin(double x, double y, double z) {\r\n setDirection(getOrgX()*x, getOrgY()*y, getOrgZ()*z);\r\n }\r\n \r\n default void scaleDirection(double x, double y, double z) {\r\n setDirection(getDirX()*x, getDirY()*y, getDirZ()*z);\r\n }\r\n \r\n default void scaleOrigin(double factor) {\r\n scaleOrigin(factor, factor, factor);\r\n }\r\n \r\n default void scaleDirection(double factor) {\r\n scaleDirection(factor, factor, factor);\r\n }\r\n \r\n default void scale(double x, double y, double z) {\r\n scaleOrigin(x, y, z);\r\n scaleDirection(x, y, z);\r\n }\r\n \r\n default void scale(double factor) {\r\n scale(factor, factor, factor);\r\n }\r\n \r\n /**\r\n * Translates the ray origin by a given amount on each axis.\r\n *\r\n * @param x the x-coordinate\r\n * @param y the y-coordinate\r\n * @param z the z-coordinate\r\n */\r\n abstract void translate(double x, double y, double z);\r\n\r\n // MISC\r\n\r\n /**\r\n * <p>\r\n * Returns a new interval iterator for this ray. This iterator will return all points in a given interval that\r\n * are on a ray.\r\n * </p>\r\n * <p>\r\n * For example, a ray with hypot 1 will produce an iterator that iterates over precisely 3 points if the\r\n * interval is 0.5 (or 0.4).\r\n * </p>\r\n * <p>\r\n * To get an iterator that iterates over a specified amount of points {@code x}, make use of\r\n * <blockquote>\r\n * {@code intervalIterator( getLength() / (x - 1) )}\r\n * </blockquote>\r\n * </p>\r\n *\r\n * @param interval the interval of iteration\r\n * @return a new interval iterator\r\n */\r\n default Iterator<Vector3> intervalIterator(double interval) {\r\n return new IntervalIterator(this, interval);\r\n }\r\n\r\n /**\r\n * <p>\r\n * Returns a new interval iterator for this ray. This iterator will return all points in a given interval that\r\n * are on a ray.\r\n * </p>\r\n * <p>\r\n * For example, a ray with hypot 1 will produce an iterator that iterates over precisely 3 points if the\r\n * interval is 0.5 (or 0.4).\r\n * </p>\r\n * <p>\r\n * To get an iterator that iterates over a specified amount of points {@code x}, make use of\r\n * <blockquote>\r\n * {@code intervalIterator( getLength() / (x - 1) )}\r\n * </blockquote>\r\n * </p>\r\n *\r\n * @return a new interval iterator\r\n */\r\n default Iterator<BlockVector> blockIntervalIterator() {\r\n return new BlockIntervalIterator(this);\r\n }\r\n\r\n /**\r\n * Returns a given amount of equally distributed points on this ray.\r\n *\r\n * @param amount the amount\r\n * @return an array containing points on this ray\r\n */\r\n @Override\r\n default Vector3[] getPoints(int amount) {\r\n if (amount < 0) throw new IllegalArgumentException(\"amount < 0\");\r\n if (amount == 0) return new Vector3[0];\r\n if (amount == 1) return new Vector3[] {getOrigin()};\r\n if (amount == 2) return new Vector3[] {getOrigin(), getEnd()};\r\n\r\n int t = amount - 1, i = 0;\r\n Vector3[] result = new Vector3[amount];\r\n\r\n Iterator<Vector3> iter = intervalIterator(getLengthSquared() / t*t);\r\n while (iter.hasNext())\r\n result[i++] = iter.next();\r\n\r\n return result;\r\n }\r\n\r\n abstract Ray3 clone();\r\n\r\n}", "public GeometryRay(final Vec3 origin, final Vec3 direction) {\n super(origin, direction);\n }", "public Ray(Point3D p0, Vector dir, Vector n) {\n if (n.dotProduct(dir) >= 0){\n Vector delta = n.scale(DELTA);\n _p0 = p0.add(delta);\n _dir = dir.normalized();\n }\n else{\n Vector delta = n.scale(-DELTA);\n _p0 = p0.add(delta);\n _dir = dir.normalized();\n }\n }", "public void addRayTrajectories()\n\t{\n\t\tclear();\n\t\t\n\t\tdouble sin = Math.sin(hyperboloidAngle);\n\n\t\t// Three vectors which form an orthogonal system.\n\t\t// a points in the direction of the axis and is of length cos(coneAngle);\n\t\t// u and v are both of length sin(coneAngle).\n\t\tVector3D\n\t\ta = axisDirection.getWithLength(Math.cos(hyperboloidAngle)),\n\t\tu = Vector3D.getANormal(axisDirection).getNormalised(),\n\t\tv = Vector3D.crossProduct(axisDirection, u).getNormalised();\n\t\t\n\t\tfor(int i=0; i<numberOfRays; i++)\n\t\t{\n\t\t\tdouble\n\t\t\t\tphi = 2*Math.PI*i/numberOfRays,\n\t\t\t\tcosPhi = Math.cos(phi),\n\t\t\t\tsinPhi = Math.sin(phi);\n\t\t\taddSceneObject(\n\t\t\t\t\tnew EditableRayTrajectory(\n\t\t\t\t\t\t\t\"trajectory of ray #\" + i,\n\t\t\t\t\t\t\tVector3D.sum(\n\t\t\t\t\t\t\t\t\tstartPoint,\n\t\t\t\t\t\t\t\t\tu.getProductWith(waistRadius*cosPhi),\n\t\t\t\t\t\t\t\t\tv.getProductWith(waistRadius*sinPhi)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\t\tVector3D.sum(\n\t\t\t\t\t\t\t\t\ta,\n\t\t\t\t\t\t\t\t\tu.getProductWith(-sin*sinPhi),\n\t\t\t\t\t\t\t\t\tv.getProductWith( sin*cosPhi)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trayRadius,\n\t\t\t\t\t\t\tsurfaceProperty,\n\t\t\t\t\t\t\tmaxTraceLevel,\n\t\t\t\t\t\t\tfalse,\t// reportToConsole\n\t\t\t\t\t\t\tthis,\t// parent\n\t\t\t\t\t\t\tgetStudio()\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t}\n\t}", "private Vec3 trace(Ray ray) {\n\t\tSphere sphere = null;\n\n\t\tfor (int i = 0; i < spheres.size(); i++) {\n\t\t\tif (spheres.get(i).intersect(ray)) {\n\t\t\t\tsphere = spheres.get(i);\n\t\t\t}\n\t\t}\n\n\t\tif (sphere == null) {\n\t\t\treturn new Vec3(0.0f); // Background color.\n\t\t}\n\n\t\tVec3 p = ray.getIntersection(); // Intersection point.\n\t\tVec3 n = sphere.normal(p); // Normal at intersection.\n\n\t\treturn light.phong(sphere, p, n);\n\t}", "public Color ray_trace(Ray ray) {\r\n int index = -1;\r\n float t = Float.MAX_VALUE;\r\n \r\n for(int i = 0; i < spheres.size(); i++) {\r\n float xd, yd, zd, xo, yo, zo, xc, yc, zc, rc, A, B, C, disc, t0, t1;\r\n \r\n xd = ray.getDirection().getX();\r\n yd = ray.getDirection().getY();\r\n zd = ray.getDirection().getZ();\r\n xo = ray.getOrigin().getX();\r\n yo = ray.getOrigin().getY();\r\n zo = ray.getOrigin().getZ();\r\n xc = spheres.get(i).getCenter().getX();\r\n yc = spheres.get(i).getCenter().getY();\r\n zc = spheres.get(i).getCenter().getZ();\r\n rc = spheres.get(i).getRadius();\r\n \r\n A = xd*xd + yd*yd + zd*zd;\r\n B = 2*(xd*(xo-xc) + yd*(yo-yc) + zd*(zo-zc));\r\n C = (xo-xc)*(xo-xc) + (yo-yc)*(yo-yc) + (zo-zc)*(zo-zc) - rc*rc;\r\n \r\n disc = B*B - (4*A*C);\r\n \r\n if(disc < 0) {\r\n continue;\r\n }\r\n\r\n if(disc == 0) {\r\n t0 = -B/(2*A);\r\n if(t0 < t && t0 > 0) {\r\n t=t0;\r\n index = i;\r\n }\r\n } else {\r\n t0 = (-B + (float) Math.sqrt(disc))/(2*A);\r\n t1 = (-B - (float) Math.sqrt(disc))/(2*A);\r\n\r\n if( t0 > t1) {\r\n float flip = t0;\r\n t0 = t1;\r\n t1 = flip;\r\n }\r\n\r\n if(t1 < 0) {\r\n continue;\r\n }\r\n\r\n if(t0 < 0 && t1 < t) {\r\n t = t1;\r\n index = i;\r\n } else if(t0 > 0 && t0 < t) {\r\n t = t0;\r\n index = i;\r\n }\r\n }\r\n }// end of for loop\r\n if(index < 0) {\r\n return background;\r\n } else {\r\n Point intersect = (ray.getDirection().const_mult(t)).point_add(window.getEye());\r\n return shade_ray(index, intersect);\r\n } \r\n }", "public void renderImage() {\n Camera camera = scene.getCamera();//fot the function thats in the camera.constr.. to build the rays.\n Intersectable geometries = scene.getGeometries();//list of geomertries for the functon in geometries.findinter..\n java.awt.Color background = scene.getBackground().getColor();\n double distance = scene.getDistance();\n\n\n int width = (int) imageWriter.getWidth(); //width of the view plane\n int height = (int) imageWriter.getHeight();//height of the view plane\n int Nx = imageWriter.getNx(); // number of squares in the Row (shura). we need it for the for\n int Ny = imageWriter.getNy(); //number of squares in the column.(amuda). we need it for the for\n\n /**for each pixel we will send ray, and with the function findIntersection\n * we will get the Geo points(point 3d, color).\n * if we got nothing so we will color with the back round color\n * if we got the GeoPoints We will send to the function getClosestPoint and color*/\n Color pixelColor;\n for (int row = 0; row < Ny; ++row) {\n for (int column = 0; column < Nx; ++column) {\n if (amountRays > 1) { //if there is superSampling\n List<Ray> rays = camera.constructNRaysThroughPixel(Nx, Ny, column, row, distance, width, height,superSamplingRate, amountRays);\n Color averageColor;\n pixelColor = scene.getBackground();\n for (Ray ray : rays) {//for each ray from the list give the list of intersection geo-points.\n List<GeoPoint> intersectionPoints = geometries.findGeoIntersections(ray);\n averageColor = scene.getBackground();\n if (intersectionPoints != null) {\n GeoPoint closestPoint = getClosestPoint(intersectionPoints);//get the closest point for each ray.\n averageColor = calcColor(closestPoint, ray);//calculate the color and put in averageColor\n }\n pixelColor = pixelColor.add(averageColor);//befor we go to the next ray we add the averageColor to pixelColor.\n }\n pixelColor = pixelColor.reduce(rays.size());//we are doing the (memuza) and that is the color of that pixel.\n }\n else {//if there is no supersampling\n Ray ray = camera.constructRayThroughPixel(Nx, Ny, column, row, distance, width, height);\n List<GeoPoint> intersectionPoints = geometries.findGeoIntersections(ray);\n pixelColor = scene.getBackground();\n if (intersectionPoints != null) {\n GeoPoint closestPoint = getClosestPoint(intersectionPoints);\n pixelColor = calcColor(closestPoint, ray);\n }\n }\n imageWriter.writePixel(column, row, pixelColor.getColor());\n }\n }\n }", "public Hit hit (final Ray r) {\n\n final double a;\n final double b;\n final double cNor;\n final double t1;\n final double t2;\n final double d;\n final Point3 p;\n\n b = r.d.dot((r.o.sub(c)).mul(2));\n a = r.d.dot(r.d);\n cNor = r.o.sub(c).dot(r.o.sub(c))-(this.r*this.r);\n d = (b * b) - (4 * a * cNor);\n\n if(d > 0) {\n\n t1 = (-b + Math.sqrt(d)) / (2 * a);\n t2 = (-b - Math.sqrt(d)) / (2 * a);\n\n if (t1 >= 0 & t2 >= 0) {\n\n p = r.at(Math.min(t1, t2));\n\n return new Hit(Math.min(t1, t2), r, this,p.sub(c).normalized().asNormal(),texFor(p) );\n\n }else if (t1 >= 0){\n\n return new Hit(t1,r,this, r.at(t1).sub(c).normalized().asNormal(),texFor(r.at(t1)));\n\n }else if(t2 >= 0) {\n\n return new Hit(t2, r, this, r.at(t2).sub(c).normalized().asNormal(),texFor(r.at(t2)));\n }\n }else if (d == 0){\n\n final double t3;\n t3 = -b / (2 * a);\n\n if (t3 >= 0){\n\n return new Hit(t3, r, this, r.at(t3).sub(c).normalized().asNormal(), texFor(r.at(t3)));\n\n }\n }\n\n return null;\n }", "public Ray(Point3D point, Vector lightDirection, Vector n, double DELTA) {\n /**\n * if n.dotProduct(lightDirection) it`s positive (bigger then zero)\n * then add DELTA , else minus DELTA\n */\n Vector delta = n.scale(n.dotProduct(lightDirection) > 0 ? DELTA : - DELTA);\n _p0 = point.add(delta);\n _dir= lightDirection.normalized();\n }", "private double rayMarch(Vec3 ro, Vec3 rd){\n double dO = 0.0;\n for (int i = 0;i< MAX_STEPS;i++){\n Vec3 p = Vec3.add(ro,Vec3.multiply(rd,dO));\n double ds = getDist(p);\n dO += ds;\n if(dO > MAX_DIST || ds < SURF_DIST){\n break;\n }\n }\n return dO;\n }", "public Hit(double t, Ray ray, Geometry geo){\n if(ray == null){\n throw new IllegalArgumentException(\"ray must not be null\");\n }\n if(geo == null){\n throw new IllegalArgumentException(\"geo must not be null\");\n }\n \n this.t = t;\n this.ray = ray;\n this.geo = geo;\n \n }", "private Point3D findHitPoint(Ray3D ray) {\n // We plug paramaterization of x, y, z for ray into our general quartic equation\n // to get standard form: At^2 + Bt + C = 0, then use the quadratic equation to solve for t.\n // The coefficients A, B, and C are quite ugly, and the derivation is described in the linked\n // resource\n Point3D P = ray.getPoint(); // Ray starting point\n Point3D D = ray.getDirection(); // Ray direction\n // First coefficient of quadratic equation of t\n double A = a * sq(D.getX()) + b * sq(D.getY()) + c * sq(D.getZ())\n + d * D.getY() * D.getZ() + e * D.getX() * D.getZ() + f * D.getX() * D.getY();\n // Second coefficient of quadratic equation of t\n double B = 2 * (a * P.getX() * D.getX() + b * P.getY() * D.getY() + c * P.getZ() * D.getZ())\n + d * (P.getY() * D.getZ() + P.getZ() * D.getY())\n + e * (P.getX() * D.getZ() + P.getZ() * D.getX())\n + f * (P.getX() * D.getY() + P.getY() * D.getX())\n + g * D.getX() + h * D.getY() + i * D.getZ();\n // Third coefficient of quadratic equation of t\n double C = a * sq(P.getX()) + b * sq(P.getY()) + c * sq(P.getZ()) + d * P.getY() * P.getZ()\n + e * P.getX() * P.getZ() + f * P.getX() * P.getY() + g * P.getX() + h * P.getY() + i * P.getZ() + j;\n\n double discriminant = sq(B) - 4 * A * C;\n\n // Find intersection Point\n Point3D intersection = null;\n if (discriminant >= 0) {\n double t1 = (-B - Math.sqrt(discriminant)) / (2 * A);\n double t2 = (-B + Math.sqrt(discriminant)) / (2 * A);\n Point3D p1 = ray.atTime(t1);\n Point3D p2 = ray.atTime(t2);\n if (t1 > 0 && t2 > 0 && isWithinBounds(p1) && isWithinBounds(p2)) {\n intersection = t1 <= t2 ? p1 : p2;\n } else if (t1 > 0 && isWithinBounds(p1)) {\n intersection = p1;\n } else if (t2 > 0 && isWithinBounds(p2)) {\n intersection = p2;\n }\n }\n return intersection;\n }", "private Point3 _getIntersection(Point3 eye, Point3 direction) {\n int size = NORMALS.length;\n float tresult;\n Point4 norm; // normal of face hit\n Plane plane; // plane equation\n float tnear, tfar, t, vn, vd;\n int front = 0, back = 0; // front/back face # hit\n\n tnear = -1.0e+20f; // -HUGE_VAL\n tfar = +1.0e+20f; // tmax\n for (int i = 0; i < size; i++) {\n\n plane = _planes[i];\n\n vd = plane.dot(direction);\n vn = plane.distance(eye);\n if (vd == 0.0f) {\n // ray is parallel to plane -\n // check if ray origin is inside plane's\n // half-space\n if (vn < 0.0f) {\n return null;\n }\n\n } else {\n // ray not parallel - get distance to plane\n t = -vn / vd;\n if (vd > 0.0f) {\n\n if (t > tfar) {\n return null;\n }\n if (t > tnear) {\n // hit near face, update normal\n front = i;\n tnear = t;\n }\n } else {\n // back face - T is a far point\n\n if (t < tnear) {\n return null;\n }\n if (t < tfar) {\n // hit far face, update normal\n\n back = i;\n tfar = t;\n }\n }\n }\n }\n // survived all tests\n // Note: if ray originates on polyhedron,\n // may want to change 0.0 to some\n // epsilon to avoid intersecting the originating face.\n //\n if (tnear >= 0.0f) {\n // outside, hitting front face\n norm = _planes[front]._normal;\n tresult = tnear;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n if (tfar < 1.0e+20f) {\n // inside, hitting back face\n norm = _planes[back]._normal;\n tresult = tfar;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n // inside, but back face beyond tmax//\n return null;\n }\n }\n }", "public Vector3f getEyeRay(float x, float y) {\n Vector4f tmp = new Vector4f(x, y, 0.0f, 1.0f);\n GraphicsContext.getTransformation().getProjectionMatrix().transform(tmp);\n tmp.mul(1.0f / tmp.w);\n Vector3f tmp2 = new Vector3f(tmp.x, tmp.y, tmp.z);\n tmp2.sub(position);\n\n return tmp2;\n }", "@Override\n public void intersect( Ray ray, IntersectResult result ) {\n \t\tVector3d e = new Vector3d(ray.eyePoint);\n \t\te.sub(this.center);\n \t\tdouble a = ray.viewDirection.dot(ray.viewDirection);\n \t\tdouble b = 2 * ray.viewDirection.dot(e);\n \t\tdouble c = e.dot(e) - this.radius * this.radius;\n \t\tdouble discriminant = b*b - 4*a*c;\n \t\t\n \t\tif (discriminant == 0.0) {\n \t\t\t\n \t\t\tdouble t_pos = -0.5 * b / a;\n \t\t\t// scale ray viewDirection to be t_pos length\n\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n\t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n\t\t\tpoint_of_intersection.scale(t_pos);\n\t\t\tpoint_of_intersection.add(ray.eyePoint);\n\t\t\t\n\t\t\t// normal is point_of_intersection - sphere.center\n\t\t\tVector3d normal = new Vector3d();\n\t\t\tnormal.add(point_of_intersection);\n\t\t\tnormal.sub(this.center);\n\t\t\tnormal.normalize();\n\t\t\t\n\t\t\tresult.p.set(point_of_intersection);\n\t\t\tresult.material = this.material;\n\t\t\tresult.t = t_pos;\n\t\t\tresult.n.set(normal);\n \t\t\t\n \t\t}\n \t\telse if (discriminant > 0.0) {\n \t\t\t\n \t\t\t// solve quadratic formula\n \t\t\tdouble q = (b > 0) ? -0.5 * (b + Math.sqrt(discriminant)) : -0.5 * (b - Math.sqrt(discriminant));\n \t\t\tdouble t_pos = q / a;\n \t\t\tdouble t_neg = c / q;\n \t\t\t\n \t\t\tif (t_pos < t_neg) {\n \t\t\t\tdouble temp = t_pos;\n \t\t\t\tt_pos = t_neg;\n \t\t\t\tt_neg = temp;\n \t\t\t}\n \t\t\t\t\n \t\t\tif (t_neg > 0) {\n \t\t\t\t// scale ray viewDirection to be t_neg length\n \t\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n \t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n \t\t\tpoint_of_intersection.scale(t_neg);\n \t\t\tpoint_of_intersection.add(ray.eyePoint);\n \t\t\t\n \t\t\t// normal is point_of_intersection - sphere.center\n \t\t\tVector3d normal = new Vector3d();\n \t\t\tnormal.add(point_of_intersection);\n \t\t\tnormal.sub(this.center);\n \t\t\tnormal.normalize();\n \t\t\t\n \t\t\tresult.p.set(point_of_intersection);\n \t\t\tresult.material = this.material;\n \t\t\tresult.t = t_neg;\n \t\t\tresult.n.set(normal);\n \t\t\t}\n\t\n \t\t}\n \t\t\n \t\t\n \t\t\n \t\t\n \t\t\n\n }", "public void add(RayHandler rayHandler);", "public RayTracer() {\n\t\tspheres = new ArrayList<Sphere>();\n\t\tspheres.add(new Sphere(-2.0f, 0.0f, -15.0f, 4.0f, 1.00f, 0.32f, 0.36f, 0.1f, 0.8f, 100.0f));\n\t\tspheres.add(new Sphere(5.0f, 5.0f, -15.0f, 2.0f, 0.00f, 0.92f, 0.36f, 0.1f, 0.8f, 100.0f));\n\t\tspheres.add(new Sphere(10.0f, -8.0f, -30.0f, 6.0f, 0.36f, 0.32f, 1.00f, 0.1f, 0.8f, 100.0f));\n\n\t\tlight = new Light(5.0f, 10.0f, 10.0f, 1.0f); // (x, y, z, intensity).\n\t\tcamera = new Camera(512, 512, 50.0f); // (width, height, fov).\n\t}", "private Ray convertNormalized2DPointToRay(\n float normalizedX, float normalizedY) {\n final float[] nearPointNdc = {normalizedX, normalizedY, -1, 1};\n final float[] farPointNdc = {normalizedX, normalizedY, 1, 1};\n \n final float[] nearPointWorld = new float[4];\n final float[] farPointWorld = new float[4];\n\n multiplyMV(\n nearPointWorld, 0, invertedViewProjectionMatrix, 0, nearPointNdc, 0);\n multiplyMV(\n farPointWorld, 0, invertedViewProjectionMatrix, 0, farPointNdc, 0);\n\n // Why are we dividing by W? We multiplied our vector by an inverse\n // matrix, so the W value that we end up is actually the *inverse* of\n // what the projection matrix would create. By dividing all 3 components\n // by W, we effectively undo the hardware perspective divide.\n divideByW(nearPointWorld);\n divideByW(farPointWorld);\n\n // We don't care about the W value anymore, because our points are now\n // in world coordinates.\n Point nearPointRay = \n new Point(nearPointWorld[0], nearPointWorld[1], nearPointWorld[2]);\n\t\t\t\n Point farPointRay = \n new Point(farPointWorld[0], farPointWorld[1], farPointWorld[2]);\n\n return new Ray(nearPointRay, \n Geometry.vectorBetween(nearPointRay, farPointRay));\n }", "int hitGfx();", "public abstract boolean hit(Rectangle2D r);", "public Ray(Point3D head, Vector direction, Vector normal) {\n\t\tthis(head, direction);\n\t\tdouble nv = normal.dotProduct(_dir);\n\t\tif (!Util.isZero(nv)) {\n\t\t\tVector epsVector = normal.scale(nv > 0 ? DELTA : -DELTA);\n\t\t\t_p0 = head.add(epsVector);\n\t\t}\n\t}", "public Ray calculateReflectionRay() {\n Vec3 directN = mInRay.getDirection();\n\n if(mShape.getReflection().blurryness != 0){\n CoordinateSystem coordSys = this.calculateCoordinateSystem(directN);\n\n Vec3 directNB = coordSys.vecB;\n Vec3 directNC = coordSys.vecC;\n\n directN = this.calculateTransformedRandomEndDirection(directN, directNB, directNC, true);\n }\n\n return calculateReflectionRay(directN);\n }", "public void mark_plane(Graphics g, int log_num, int x, int y, int h);", "public double findRayIntersection(Vec3 origin, Vec3 direction, Vec3 normal)\n {\n double scale = width/obj.getScale();\n double ox = origin.x*scale+0.5*width;\n double oy = origin.y*scale+0.5*width;\n double oz = origin.z*scale+0.5*width;\n double dx = direction.x;\n double dy = direction.y;\n double dz = direction.z;\n\n // Find the intersection of the ray with the bounding box.\n\n double mint = -Double.MAX_VALUE;\n double maxt = Double.MAX_VALUE;\n if (dx == 0.0)\n {\n if (ox < minx || ox > maxx)\n return 0.0;\n }\n else\n {\n double t1 = (minx-ox)/dx;\n double t2 = (maxx-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dy == 0.0)\n {\n if (oy < miny || oy > maxy)\n return 0.0;\n }\n else\n {\n double t1 = (miny-oy)/dy;\n double t2 = (maxy-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dz == 0.0)\n {\n if (oz < minz || oz > maxz)\n return 0.0;\n }\n else\n {\n double t1 = (minz-oz)/dz;\n double t2 = (maxz-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (mint < 0.0)\n mint = 0.0;\n\n // Find the first voxel and initialize variables.\n\n double xpos = ox+mint*dx;\n double ypos = oy+mint*dy;\n double zpos = oz+mint*dz;\n int x = Math.max(Math.min((int) xpos, maxx), minx);\n int y = Math.max(Math.min((int) ypos, maxy), miny);\n int z = Math.max(Math.min((int) zpos, maxz), minz);\n int stepx, stepy, stepz;\n int finalx, finaly, finalz;\n double tdeltax, tdeltay, tdeltaz;\n double tmaxx, tmaxy, tmaxz;\n if (dx < 0.0)\n {\n stepx = -1;\n finalx = minx-1;\n tdeltax = -1.0/dx;\n tmaxx = (x-ox)/dx;\n }\n else if (dx > 0.0)\n {\n stepx = 1;\n finalx = maxx+1;\n tdeltax = 1.0/dx;\n tmaxx = (x+1-ox)/dx;\n }\n else\n {\n stepx = 0;\n finalx = 0;\n tdeltax = 0.0;\n tmaxx = Double.MAX_VALUE;\n }\n if (dy < 0.0)\n {\n stepy = -1;\n finaly = miny-1;\n tdeltay = -1.0/dy;\n tmaxy = (y-oy)/dy;\n }\n else if (dy > 0.0)\n {\n stepy = 1;\n finaly = maxy+1;\n tdeltay = 1.0/dy;\n tmaxy = (y+1-oy)/dy;\n }\n else\n {\n stepy = 0;\n finaly = 0;\n tdeltay = 0.0;\n tmaxy = Double.MAX_VALUE;\n }\n if (dz < 0.0)\n {\n stepz = -1;\n finalz = minz-1;\n tdeltaz = -1.0/dz;\n tmaxz = (z-oz)/dz;\n }\n else if (dz > 0.0)\n {\n stepz = 1;\n finalz = maxz+1;\n tdeltaz = 1.0/dz;\n tmaxz = (z+1-oz)/dz;\n }\n else\n {\n stepz = 0;\n finalz = 0;\n tdeltaz = 0.0;\n tmaxz = Double.MAX_VALUE;\n }\n\n // Step through the voxels, looking for intersections.\n\n VoxelOctree voxels = obj.getVoxels();\n byte values[] = new byte[8];\n while (true)\n {\n int index = x*width*width+y*width+z;\n if ((flags[index/32]&(1<<(index%32))) != 0)\n {\n // There is a piece of the surface in this voxel, so see if the ray intersects it.\n // First find the values of t at which the ray enters and exits it.\n \n double tenter = -Double.MAX_VALUE;\n double texit = Double.MAX_VALUE;\n if (dx != 0.0)\n {\n double t1 = (x-ox)/dx;\n double t2 = (x+1-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dy != 0.0)\n {\n double t1 = (y-oy)/dy;\n double t2 = (y+1-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dz != 0.0)\n {\n double t1 = (z-oz)/dz;\n double t2 = (z+1-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (tenter < 0.0)\n continue; // Ignore intersections in the voxel containing the origin.\n\n // Look up the values at the eight corners of the voxel.\n\n values[0] = voxels.getValue(x, y, z);\n values[1] = voxels.getValue(x, y, z+1);\n values[2] = voxels.getValue(x, y+1, z);\n values[3] = voxels.getValue(x, y+1, z+1);\n values[4] = voxels.getValue(x+1, y, z);\n values[5] = voxels.getValue(x+1, y, z+1);\n values[6] = voxels.getValue(x+1, y+1, z);\n values[7] = voxels.getValue(x+1, y+1, z+1);\n\n // Find the positions within the voxel where the ray enters and exits.\n\n double xenter = ox+dx*tenter-x;\n double yenter = oy+dy*tenter-y;\n double zenter = oz+dz*tenter-z;\n double xexit = ox+dx*texit-x;\n double yexit = oy+dy*texit-y;\n double zexit = oz+dz*texit-z;\n\n // Interpolate the find the values at those points.\n\n double enterValue = values[0]*(1.0-xenter)*(1.0-yenter)*(1.0-zenter)\n +values[1]*(1.0-xenter)*(1.0-yenter)*zenter\n +values[2]*(1.0-xenter)*yenter*(1.0-zenter)\n +values[3]*(1.0-xenter)*yenter*zenter\n +values[4]*xenter*(1.0-yenter)*(1.0-zenter)\n +values[5]*xenter*(1.0-yenter)*zenter\n +values[6]*xenter*yenter*(1.0-zenter)\n +values[7]*xenter*yenter*zenter;\n double exitValue = values[0]*(1.0-xexit)*(1.0-yexit)*(1.0-zexit)\n +values[1]*(1.0-xexit)*(1.0-yexit)*zexit\n +values[2]*(1.0-xexit)*yexit*(1.0-zexit)\n +values[3]*(1.0-xexit)*yexit*zexit\n +values[4]*xexit*(1.0-yexit)*(1.0-zexit)\n +values[5]*xexit*(1.0-yexit)*zexit\n +values[6]*xexit*yexit*(1.0-zexit)\n +values[7]*xexit*yexit*zexit;\n if ((enterValue > 0 && exitValue <= 0) || (enterValue <= 0 && exitValue > 0))\n {\n // Find the intersection point.\n\n double weight1 = Math.abs(exitValue);\n double weight2 = Math.abs(enterValue);\n double d = 1.0/(weight1+weight2);\n weight1 *= d;\n weight2 *= d;\n double tintersect = (tenter*weight1 + texit*weight2)/scale;\n if (normal != null)\n {\n normal.set(values[0]+values[1]+values[2]+values[3]-values[4]-values[5]-values[6]-values[7],\n values[0]+values[1]-values[2]-values[3]+values[4]+values[5]-values[6]-values[7],\n values[0]-values[1]+values[2]-values[3]+values[4]-values[5]+values[6]-values[7]);\n normal.normalize();\n }\n return tintersect;\n }\n }\n\n // Advance to the next voxel.\n\n if (tmaxx < tmaxy)\n {\n if (tmaxx < tmaxz)\n {\n x += stepx;\n if (x == finalx)\n return 0.0;\n tmaxx += tdeltax;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n else\n {\n if (tmaxy < tmaxz)\n {\n y += stepy;\n if (y == finaly)\n return 0.0;\n tmaxy += tdeltay;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n }\n }", "public BLine2D\ngetThreePrimeRay()\nthrows Exception\n{\n\tif (this.nextNuc2D() == null)\n\t\treturn (null);\n\treturn (new BLine2D(\n\t\tthis.getPoint2D(),\n\t\tthis.nextNuc2D().getPoint2D()));\n}", "public boolean lineOfSight(AgentModel viewer, float x, float y)\r\n/* 316: */ {\r\n/* 317:361 */ if ((viewer.fov(x, y)) && (line(viewer.getX(), viewer.getY(), x, y))) {\r\n/* 318:363 */ return true;\r\n/* 319: */ }\r\n/* 320:366 */ return false;\r\n/* 321: */ }", "@Override\n public RayHit rayIntersectObj(Ray3D ray) {\n // Next check if ray hits this quadric\n Point3D hitPoint = findHitPoint(ray);\n if (hitPoint == null || !isWithinBounds(hitPoint)) {\n return RayHit.NO_HIT;\n }\n double distance = hitPoint.subtract(ray.getPoint()).length();\n Point3D normal = findNormalAtPoint(hitPoint);\n return new RayHit(hitPoint, distance, normal, this, new TextureCoordinate(0, 0));\n }", "public static boolean\nraysIntersectInPlane(Point2D tail0Pt, Point2D head0Pt, Point2D tail1Pt, Point2D head1Pt,\n\tPoint2D intersect, double[] uArray)\n{\n\tdouble tmp = ((head1Pt.getY() - tail1Pt.getY())*(head0Pt.getX() - tail0Pt.getX()) - (head1Pt.getX() - tail1Pt.getX())*(head0Pt.getY() - tail0Pt.getY()));\n\tif(tmp == 0.0)\n\t\treturn(false);\n\tdouble tmpv = ((tail1Pt.getX() - tail0Pt.getX())*(head0Pt.getY() - tail0Pt.getY()) - (tail1Pt.getY() - tail0Pt.getY())*(head0Pt.getX() - tail0Pt.getX())) / tmp;\n\ttmp = (head0Pt.getX() - tail0Pt.getX())*(head1Pt.getY() - tail1Pt.getY()) - (head1Pt.getX() - tail1Pt.getX())*(head0Pt.getY() - tail0Pt.getY());\n\tif(tmp == 0.0)\n\t\treturn(false);\n\tdouble tmpu = ((tail1Pt.getX() - tail0Pt.getX())*(head1Pt.getY() - tail1Pt.getY()) + (head1Pt.getX() - tail1Pt.getX())*(tail0Pt.getY() - tail1Pt.getY()))/tmp;\n\n\tintersect.setLocation(\n\t\ttail1Pt.getX() + tmpv*(head1Pt.getX() - tail1Pt.getX()),\n\t\ttail1Pt.getY() + tmpv*(head1Pt.getY() - tail1Pt.getY()));\n\n\t// intersect[ZCoor] = tail1Pt[ZCoor] + tmpv*(head1Pt[ZCoor] - tail1Pt[ZCoor]);\n\n\tuArray[0] = tmpu; // u of first ray\n\tuArray[1] = tmpv; // u of second ray\n\n\treturn (true);\n}", "public Ray(Point origin, Vector direction) throws NullPointerException {\n\t\tif (origin == null)\n\t\t\tthrow new NullPointerException(\"the given origin is null!\");\n\t\tif (direction == null)\n\t\t\tthrow new NullPointerException(\"the given direction is null!\");\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\t}", "boolean mo2269a(View view, PointF pointF);", "private void render(){\n planeImage.draw(currPos.x,currPos.y, drawOps);\n }", "@Override\n\tpublic void shade(Colord outIntensity, Scene scene, Ray ray, IntersectionRecord record, int depth) {\n\t\t// TODO#A7: fill in this function.\n\t\t// 1) Determine whether the ray is coming from the inside of the surface\n\t\t// or the outside.\n\t\t// 2) Determine whether total internal reflection occurs.\n\t\t// 3) Compute the reflected ray and refracted ray (if total internal\n\t\t// reflection does not occur)\n\t\t// using Snell's law and call RayTracer.shadeRay on them to shade them\n\n\t\t// n1 is from; n2 is to.\n\t\tdouble n1 = 0, n2 = 0;\n\t\tdouble fresnel = 0;\n\t\tVector3d d = new Vector3d(ray.origin.clone().sub(record.location)).normalize();\n\t\tVector3d n = new Vector3d(record.normal).normalize();\n\t\tdouble theta = n.dot(d);\n\n\t\t// CASE 1a: ray coming from outside.\n\t\tif (theta > 0) {\n\t\t\tn1 = 1.0;\n\t\t\tn2 = refractiveIndex;\n\t\t\tfresnel = fresnel(n, d, refractiveIndex);\n\t\t}\n\n\t\t// CASE 1b: ray coming from inside.\n\t\telse if (theta < 0) {\n\t\t\tn1 = refractiveIndex;\n\t\t\tn2 = 1.0;\n\t\t\tn.mul(-1.0);\n\t\t\tfresnel = fresnel(n, d, 1/refractiveIndex);\n\t\t\ttheta = n.dot(d);\n\t\t}\n\n\t\tVector3d reflectionDir = new Vector3d(n).mul(2 * theta).sub(d.clone()).normalize();\n\t\tRay reflectionRay = new Ray(record.location.clone(), reflectionDir);\n\t\treflectionRay.makeOffsetRay();\n\t\tColord reflectionColor = new Colord();\n\t\tRayTracer.shadeRay(reflectionColor, scene, reflectionRay, depth+1);\n\n\t\tdouble det = 1 - (Math.pow(n1, 2.0) * (1 - Math.pow(theta, 2.0))) / (Math.pow(n2, 2.0));\n\n\t\tif (det < 0.0) {\n\t\t\toutIntensity.add(reflectionColor);\n\t\t} else {\n\n\t\t\td = new Vector3d(record.location.clone().sub(ray.origin)).normalize();\n\n\t\t\tVector3d refractionDir = new Vector3d((d.clone().sub(n.clone().mul(d.dot(n))).mul(n1/n2)));\n\t\t\trefractionDir.sub(n.clone().mul(Math.sqrt(det)));\n\t\t\tRay refractionRay = new Ray(record.location.clone(), refractionDir);\n\t\t\trefractionRay.makeOffsetRay();\n\n\t\t\tColord refractionColor = new Colord();\n\t\t\tRayTracer.shadeRay(refractionColor, scene, refractionRay, depth+1);\n\n\t\t\trefractionColor.mul(1-fresnel);\n\t\t\treflectionColor.mul(fresnel);\n\t\t\toutIntensity.add(reflectionColor).add(refractionColor);\n\n\t\t}\n\t}", "@Test\n\tpublic void testCuatroEnRayaHorizontal() {\n\t\t\n\t\tint []posX = new int[4];\n\t\tint []posY = new int[4];\n\t\tfor (int x = 1; x <= 7 - 3; ++x) {\n\t\t\tfor (int y = 1; y <= 6; ++y) {\n\t\t\t\tfor (int l = 0; l < 4; ++l) {\n\t\t\t\t\tposX[l] = x + l;\n\t\t\t\t\tposY[l] = y;\n\t\t\t\t}\n\t\t\t\tpruebaCuatroEnRaya(posX, posY);\n\t\t\t}\n\t\t}\n\t}", "void mo2268a(View view, PointF pointF, float f);", "public void touched(Vector pos);", "public boolean isXray();", "void addTextureCoordinate(Vector t);", "@Override\r\n public void intersect( Ray ray, IntersectResult result ) {\n\t\r\n }", "public void draw() {\n background(255);\n pushMatrix();\n translate(width/2,height/2+20,-160);\n rotateX(PI/3);\n rotateZ(theta);\n land.render(); \n popMatrix();\n\n land.calculate();\n \n theta += 0.0025f;\n}", "public static void main(String[] args){\n Mesh3D box = Mesh3D.box(10, 20, 60);\n \n Line3D lineX = box.getLineX();\n Line3D lineY = box.getLineY();\n Line3D lineZ = box.getLineZ();\n lineX.show();\n lineY.show();\n lineZ.show();\n box.translateXYZ(100, 0.0, 0.0); \n box.show();\n Line3D line = new Line3D(); \n List<Point3D> intersects = new ArrayList<Point3D>();\n \n for(int p = 0; p < 100; p++){\n double r = 600;\n double theta = Math.toRadians(90.0);//Math.toRadians(Math.random()*180.0);\n double phi = Math.toRadians(Math.random()*360.0-180.0);\n line.set(0.0,0.0,0.0, \n Math.sin(theta)*Math.cos(phi)*r,\n Math.sin(theta)*Math.sin(phi)*r,\n Math.cos(theta)*r\n );\n intersects.clear();\n box.intersectionRay(line, intersects);\n System.out.println(\"theta/phi = \" + Math.toDegrees(theta) + \" \"\n + Math.toDegrees(phi) + \" intersects = \" + intersects.size());\n \n }\n }", "public Ray[] rayAngles() {\n\t\tCamera cam = scene.getCamera();\n\t\tRay[] rays = new Ray[getCanvasHeight() * getCanvasWidth()];\n\t\tfor (int y = 0; y < getCanvasHeight(); y++) {\n\t\t\tfor (int x = 0; x < getCanvasWidth(); x++) {\n\t\t\t\t// Calculate the yaw and pitch angles of this ray\n\t\t\t\tdouble yaw = Math.toRadians(cam.getYaw())\n\t\t\t\t\t\t- Math.atan((((double) getCanvasWidth() - 2 * x) / (double) getCanvasWidth())\n\t\t\t\t\t\t\t\t* Math.tan(Math.toRadians(cam.getFOV()) / 2));\n\t\t\t\tdouble pitch = Math.toRadians(cam.getPitch() - 90)\n\t\t\t\t\t\t+ Math.atan((((double) getCanvasHeight() - 2 * y) / (double) getCanvasHeight())\n\t\t\t\t\t\t\t\t* Math.tan(Math.toRadians(cam.getFOV() * getCanvasHeight() / getCanvasWidth() / 2)));\n\n\t\t\t\t// Find the vector (length 1) of this ray from the angles\n\t\t\t\tdouble rz = Math.sin(pitch);\n\t\t\t\tdouble h = Math.cos(pitch);\n\t\t\t\tdouble rx = h * Math.cos(yaw);\n\t\t\t\tdouble ry = h * Math.sin(yaw);\n\t\t\t\tVector v = new Vector(rx, ry, rz);\n\n\t\t\t\t// Add vector to its spot\n\t\t\t\ttry {\n\t\t\t\t\trays[y * getCanvasWidth() + x] = new Ray(cam.getLocation(), v);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn rays;\n\t}", "@Test\n\tpublic void testCuatroEnRayaVertical() {\n\t\t\n\t\tint []posX = new int[4];\n\t\tint []posY = new int[4];\n\t\tfor (int x = 1; x <= 7; ++x) {\n\t\t\tfor (int y = 1; y <= 6 - 3; ++y) {\n\t\t\t\tfor (int l = 0; l < 4; ++l) {\n\t\t\t\t\tposX[l] = x;\n\t\t\t\t\tposY[l] = y + l;\n\t\t\t\t}\n\t\t\t\ttestCuatroEnRaya(posX, posY, 0, Counter.WHITE);\n\t\t\t\ttestCuatroEnRaya(posX, posY, 0, Counter.BLACK);\n\t\t\t}\n\t\t}\n\t}", "void vectorFromWorld(double px, double py, double pz, DVector3 result);", "public Hit intersectsRay(Ray ray) {\n\t\tVector3D dst = Vector3D.sub(ray.b, pos);\n\t\tfloat B = dst.dot(ray.d);\n\t\tfloat C = dst.dot(dst) - radius2;\n\t\tfloat D = B*B - C;\n\t\tfloat t = (float) (-B - Math.sqrt(D));\n\t\tif (!(t > 0)) return null; // escape case: no collision or outside fov\n\t\tVector3D hitPos = Vector3D.add(ray.b, Vector3D.mult(ray.d, t));\n\t\tVector3D n = getNormal(hitPos);\n\t\treturn new Hit(this, t, hitPos, n);\n\t}", "public RayTracerEngine(Dimension image_size, Scene scene, Camera camera) {\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\t\tthis.width = image_size.width;\n\t\tthis.height = image_size.height;\n\t\tforward = new Vector(0, 0, 1);\n\t\tforward.normalise();\n\t\t\n\t}", "private Geometry.Ray convertNormalized2DPointToRay(float normalizedX, float normalizedY)\n\t{\n\t\tfinal float[] nearPointNdc = {normalizedX, normalizedY, -1, 1};\n\t\tfinal float[] farPointNdc = {normalizedX, normalizedY, 1, 1};\n\t\t\n\t\tfinal float[] nearPointWorld = new float[4];\n\t\tfinal float[] farPointWorld = new float[4];\n\t\t\n\t\tMatrix.multiplyMV(nearPointWorld, 0, invertedViewProjectionMatrix, 0, nearPointNdc, 0);\n\t\tMatrix.multiplyMV(farPointWorld, 0, invertedViewProjectionMatrix, 0, farPointNdc, 0);\n\t\t\n\t\tdivideByW(nearPointWorld);\n\t\tdivideByW(farPointWorld);\n\t\t\n\t\tGeometry.Point nearPointRay = new Geometry.Point(nearPointWorld[0], nearPointWorld[1], nearPointWorld[2]);\n\t\tGeometry.Point farPointRay = new Geometry.Point(farPointWorld[0], farPointWorld[1], farPointWorld[2]);\n\t\t\n\t\treturn new Geometry.Ray(nearPointRay, Geometry.vectorBetween(nearPointRay, farPointRay));\n\t}", "@Override\n public void onRayCastClick(Vector2f mouse, CollisionResult result) {\n }", "@Override public void onTap () {\n _vx = _rando.nextFloat() * (_rando.nextBoolean() ? -0.25f : 0.25f);\n _vy = _rando.nextFloat() * (_rando.nextBoolean() ? -0.25f : 0.25f);\n }", "public BLine2D\ngetFivePrimeRay()\nthrows Exception\n{\n\tif (this.lastNuc2D() == null)\n\t\treturn (null);\n\treturn (new BLine2D(\n\t\tthis.getPoint2D(),\n\t\tthis.lastNuc2D().getPoint2D()));\n}", "@Override\n\tpublic RaySceneObjectIntersection getClosestRayIntersection(Ray ray)\n\t{\n\t\tVector3D v=Vector3D.difference(ray.getP(), pointOnAxis);\n\t\tVector3D vP = v.getDifferenceWith(v.getProjectionOnto(normalisedAxisDirection));\t// part of v that's perpendicular to a\n\t\tVector3D dP = ray.getD().getDifferenceWith(ray.getD().getProjectionOnto(normalisedAxisDirection));\t// part of ray.d that's perpendicular to a\n\t\t\n\t\t// coefficients in the quadratic equation for t\n\t\tdouble a = dP.getModSquared();\n\t\t\n\t\tif(a==0.0) return RaySceneObjectIntersection.NO_INTERSECTION;\t// would give division by zero later\n\n\t\tdouble\n\t\t\tb2 = Vector3D.scalarProduct(vP, dP),\t// b/2\n\t\t\tc = vP.getModSquared() - radius*radius,\n\t\t\tdiscriminant4 = b2*b2 - a*c;\t// discriminant/4\n\n\t\t// first check if the discriminant is >0; if it isn't, then there is no intersection at all\n\t\tif(discriminant4 < 0.0) return RaySceneObjectIntersection.NO_INTERSECTION;\n\t\t\n\t\t// okay, the discriminant is positive; take its square root, which is what we actually need\n\t\tdouble sqrtDiscriminant2 = Math.sqrt(discriminant4);\t// sqrt(discriminant)/2\n\t\t\t\n\t\t// calculate the factor t corresponding to the\n\t\t// intersection with the greater t factor;\n\t\t// the further-away intersection is then ray.p + tBigger*ray.d\n\t\tdouble tBigger=((a>0)?(-b2+sqrtDiscriminant2)/a:(-b2-sqrtDiscriminant2)/a);\n\t\t\n\t\t//if tBigger<0, then the intersection with the lesser t factor will have to be even more negative;\n\t\t// therefore, both intersections will be \"behind\" the starting point\n\t\tif(tBigger < 0.0) return RaySceneObjectIntersection.NO_INTERSECTION;\n\n\t\t// calculate the factor tSmaller corresponding to the\n\t\t// intersection with the lesser t factor\n\t\tdouble tSmaller=((a>0)?(-b2-sqrtDiscriminant2)/a:(-b2+sqrtDiscriminant2)/a);\n\n\t\tRay rayAtIntersectionPoint;\n\t\t\n\t\t// first check if the intersection point with the lesser t factor is an option\n\t\tif(tSmaller > 0.0)\n\t\t{\n\t\t\t// the intersection with the lesser t factor lies in front of the starting point, so it might correspond to the intersection point\n\t\t\t\n\t\t\t// calculate the ray advanced to the intersection point\n\t\t\trayAtIntersectionPoint = ray.getAdvancedRay(tSmaller);\n\t\t\t\n\t\t\treturn new RaySceneObjectIntersection(rayAtIntersectionPoint.getP(), this, rayAtIntersectionPoint.getT());\n\t\t}\n\t\t\n\t\t// If the program reaches this point, the intersection with the lesser t factor was not the right intersection.\n\t\t// Now try the intersection point with the greater t factor.\n\t\t\n\t\t// calculate the ray advanced to the intersection point\n\t\trayAtIntersectionPoint = ray.getAdvancedRay(tBigger);\n\n\t\treturn new RaySceneObjectIntersection(rayAtIntersectionPoint.getP(), this, rayAtIntersectionPoint.getT());\n\t}", "private Ray3D geradeAusPunkten(Vector a, Vector b) {\n\t\tVector verbindung = b.subtract(a);\n\t\tRay3D ray = new Ray3D(a, verbindung);\n\t\treturn ray;\n\t}", "@Override\n\tpublic RaySceneObjectIntersection getClosestRayIntersection(Ray ray)\n\t{\t\t//this is calculating the \"term under the square root\"\n\t\tVector3D v=Vector3D.difference(ray.getP(), centre);\t\t\t\t\t\t//which must be greater than 0 for intersection\n\n\t\t// coefficients in the quadratic equation for t\n\t\tdouble \n\t\tquadraticA = ray.getD().getModSquared(),\n\t\tquadraticB2 = Vector3D.scalarProduct(v, ray.getD()),\t// b/2\n\t\tquadraticC = v.getModSquared() - MyMath.square(radius);\n\n\t\t// discriminant/2\n\t\tdouble discriminant2 = quadraticB2*quadraticB2-quadraticA*quadraticC;\n\n\n\t\tif(discriminant2<0.0) {\n\t\t\t//returns NaN if there is no intersection\n\t\t\treturn RaySceneObjectIntersection.NO_INTERSECTION;\n\t\t}\n\n\t\tdouble t1=(-quadraticB2+Math.sqrt(discriminant2))/quadraticA;\n\n\t\tif(t1<0.0) {\n\t\t\t//if t1<0 then t2 must be less than zero\n\t\t\treturn RaySceneObjectIntersection.NO_INTERSECTION;\n\t\t}\n\n\t\tdouble t2=(-quadraticB2-Math.sqrt(discriminant2))/quadraticA;\n\t\t\n\t\tRay rayAtIntersectionPoint = ray.getAdvancedRay((t2<0.0)?t1:t2);\n\n\t\treturn new RaySceneObjectIntersection(\n\t\t\t\trayAtIntersectionPoint.getP(),\n\t\t\t\tthis,\n\t\t\t\trayAtIntersectionPoint.getT()\n\t\t\t);\n\t}", "@NotNull\r\n static Ray3 between(double ox, double oy, double oz, double tx, double ty, double tz) {\r\n return fromOD(ox, oy, oz, tx-ox, ty-oy, tz-oz);\r\n }", "@Override\n\tpublic void keyPressed(KeyEvent arg0) {\n\t\tif(arg0.getKeyChar() == 'w') {\n\t\t\trayY -= 10;\n\t\t\t\n\t\t}else if(arg0.getKeyChar() == 'a'){\n\t\t\trayX -= 10;\n\t\t\t\n\t\t}else if(arg0.getKeyChar() == 's') {\n\t\t\trayY += 10;\n\t\t\t\n\t\t}else if(arg0.getKeyChar() == 'd') {\n\t\t\trayX += 10;\n\t\t}else if (arg0.getKeyChar() == 'e') {\n\t\t\trayAngle += Math.PI / 36;\n\t\t}else if(arg0.getKeyChar() == 'q') {\n\t\t\trayAngle -= Math.PI / 36;\n\t\t}\n\t\t\n\t\tlightSource = new RayCenter(rayX, rayY, rayAngle);\n\t\trepaint();\n\t}", "@Override\r\n\tprotected Ray normalAt(double xx, double yy, double zz) {\n\t\treturn null;\r\n\t}", "public void drawHit(){\n image(explode[5],posX,posY,10,10);\n }", "public Vector traceRay(Ray ray, int bounces) {\n\t\t\n\t\t/* Terminate after too many bounces. */\n\t\tif(bounces > this.numBounces)\n\t\t\treturn new Vector(0.0, 0.0, 0.0);\n\t\t\n\t\t/* Trace ray. */\n\t\tObjectHit hit = getHit(ray);\n\n\t\tif(hit.hit) {\n\t\t\t\n\t\t\t/* Light emitted by the hit location. */\n\t\t\tVector color = hit.material.getEmission(hit.textureCoordinates.x, hit.textureCoordinates.y);\n\t\t\t\n\t\t\t/* Light going into the hit location. */\n\t\t\tVector incoming = new Vector(0.0, 0.0, 0.0);\n\t\t\t\n\t\t\t/* Do secondary rays. */\n\t\t\tVector selfColor = hit.material.getColor(hit.textureCoordinates.x, hit.textureCoordinates.y);\n\t\t\tdouble diffuseness = hit.material.getDiffuseness();\n\t\t\t\n\t\t\tfor(int i = 0; i < this.numSecondaryRays; i++) {\n\n\t\t\t\tRay newRay = new Ray(hit.hitPoint, new Vector(0.0, 0.0, 0.0));\n\t\t\t\t\t\t\n\t\t\t\tVector diffuseSample = new Vector(0.0, 0.0, 0.0);\n\t\t\t\tVector specularSample = new Vector(0.0, 0.0, 0.0);\n\t\t\t\t\n\t\t\t\tif(diffuseness > 0.0) {\n\t\t\t\t\tVector diffuseVector = Material.getDiffuseVector(hit.normal);\n\t\t\t\t\tnewRay.direction = diffuseVector;\n\t\t\t\t\tdiffuseSample = traceRay(newRay, bounces + 1);\n\t\t\t\t\tdiffuseSample = diffuseSample.times(diffuseVector.dot(hit.normal)).times(selfColor);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(diffuseness < 1.0) {\n\t\t\t\t\tVector specularVector = Material.getReflectionVector(hit.normal, ray.direction, hit.material.getGlossiness());\n\t\t\t\t\tnewRay.direction = specularVector;\n\t\t\t\t\tspecularSample = traceRay(newRay, bounces + 1);\n\t\t\t\t\t\n\t\t\t\t\tif(!hit.material.isPlastic())\n\t\t\t\t\t\tspecularSample = specularSample.times(selfColor);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tVector total = diffuseSample.times(hit.material.getDiffuseness()).plus(specularSample.times(1 - hit.material.getDiffuseness()));\n\t\t\t\tincoming = incoming.plus(total);\n\t\t\t}\n\t\t\t\n\t\t\tincoming = incoming.divBy(this.numSecondaryRays);\n\t\t\treturn color.plus(incoming);\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\t/* If the ray missed return the ambient color. */\n\t\t\tVector d = new Vector(0.0, 0.0, 0.0).minus(ray.direction);\n\t\t\tdouble u = 0.5 + Math.atan2(d.z, d.x) / (2 * Math.PI);\n\t\t\tdouble v = 0.5 - Math.asin(d.y) / Math.PI;\n\t\t\t\n\t\t\treturn skyMaterial.getColor(u, v).times(255).plus(skyMaterial.getEmission(u, v));\n\t\t\t\n\t\t}\n\t\t\n\t}", "Viewpoint createViewpoint();", "public abstract boolean isHit(int x, int y);", "public MovingObjectPosition rayTrace(World world, float rotationYaw, float rotationPitch, boolean collisionFlag, double reachDistance)\n {\n // Somehow this destroys the playerPosition vector -.-\n MovingObjectPosition pickedBlock = this.rayTraceBlocks(world, rotationYaw, rotationPitch, collisionFlag, reachDistance);\n MovingObjectPosition pickedEntity = this.rayTraceEntities(world, rotationYaw, rotationPitch, reachDistance);\n\n if (pickedBlock == null)\n {\n return pickedEntity;\n }\n else if (pickedEntity == null)\n {\n return pickedBlock;\n }\n else\n {\n double dBlock = this.distance(new Vector3(pickedBlock.hitVec));\n double dEntity = this.distance(new Vector3(pickedEntity.hitVec));\n\n if (dEntity < dBlock)\n {\n return pickedEntity;\n }\n else\n {\n return pickedBlock;\n }\n }\n }", "public void\n doExtraInformation(Ray inRay, double inT, \n GeometryIntersectionInformation outData) {\n outData.p = lastInfo.p;\n\n switch ( lastPlane ) {\n case 1:\n outData.n.x = 0;\n outData.n.y = 0;\n outData.n.z = 1;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = 1-(outData.p.x / size.x - 0.5);\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 2:\n outData.n.x = 0;\n outData.n.y = 0;\n outData.n.z = -1;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = outData.p.x / size.x - 0.5;\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 3:\n outData.n.x = 0;\n outData.n.z = 0;\n outData.n.y = 1;\n outData.u = 1-(outData.p.x / size.x - 0.5);\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = -1;\n outData.t.y = 0;\n outData.t.z = 0;\n break;\n case 4:\n outData.n.x = 0;\n outData.n.z = 0;\n outData.n.y = -1;\n outData.u = outData.p.x / size.x - 0.5;\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 1;\n outData.t.y = 0;\n outData.t.z = 0;\n break;\n case 5:\n outData.n.x = 1;\n outData.n.y = 0;\n outData.n.z = 0;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 6:\n outData.n.x = -1;\n outData.n.y = 0;\n outData.n.z = 0;\n outData.u = 1-(outData.p.y / size.y - 0.5);\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 0;\n outData.t.y = -1;\n outData.t.z = 0;\n break;\n default:\n outData.u = 0;\n outData.v = 0;\n break;\n }\n }", "@Override\n\tpublic Intersection intersect(Ray ray) {\n\t\tdouble maxDistance = 10;\n\t\tdouble stepSize = 0.001; \n\t\tdouble t = 0;\n\t\t\n\t\twhile(t<maxDistance) {\t\t\t\n\t\t\tVector point = ray.m_Origin.add(ray.m_Direction.mul(t));\t\t\t\n\t\t\tdouble eval = torus(point);\t\t\t\n\t\t\tif(Math.abs(eval)<0.001) {\n\t\t\t\tVector normal = estimateNormal(point);\n\t\t return new Intersection(this, ray, t, normal, point);\n\t\t\t}\t\t\t\n\t\t\tt += stepSize;\n\t\t}\t\t\n\t\treturn null;\n\t}", "public Ray3D(Vector start, Vector direction) {\n if(direction.magnitude() != 1) {\n direction = direction.normalize();\n }\n this.start = new Vector(start.getX(), start.getY(), start.getZ(), 1);\n this.direction = new Vector(direction.getX(), direction.getY(), direction.getZ(), 0);\n }", "@Test\n\tpublic void testCuatroEnRayaDiag1() {\n\t\t\n\t\tint []posX = new int[4];\n\t\tint []posY = new int[4];\n\t\tfor (int i = 1; i <= 12; ++i) {\n\t\t\tint sx = Math.max(1, i-5);\n\t\t\tint sy = Math.min(i, 6);\n\t\t\twhile ((sy - 4 >= 0) && (sx + 3 <= 7)) {\n\t\t\t\tfor (int l = 0; l < 4; ++l) {\n\t\t\t\t\tposX[l] = sx + l;\n\t\t\t\t\tposY[l] = sy - l;\n\t\t\t\t}\n\t\t\t\tpruebaCuatroEnRaya(posX, posY);\n\t\t\t\tsy--; sx++;\n\t\t\t}\n\t\t}\n\t}", "public List<Ray> BeamOfRay(double radius, int numOfSample){\n List<Ray> rayList = new LinkedList<>();\n rayList.add(this);\n if(Util.isZero(radius) | numOfSample<=1)\n return rayList;\n Vector x_axis = this._direction.getOrthogonal();\n Vector y_axis = this._direction.crossProduct(x_axis);\n int loopLength = (int)Math.sqrt(numOfSample);\n double factor = radius/loopLength;\n for (int i = 1; i <= loopLength; i++) {\n for (int j = 1; j <= loopLength; j++) {\n Vector current_x_axis = x_axis.scale(i*factor);\n Vector current_y_axis = y_axis.scale(j*factor);\n Vector currentVector = this._direction.add(current_x_axis).add(current_y_axis);\n rayList.add(new Ray(currentVector, this._tail));\n }\n }\n\n return rayList;\n }", "private void setCofR() {\n\t\t\n Vector3f pos_vec = new Vector3f();\n Point3f pos = new Point3f();\n Vector3f dir = new Vector3f();\n\t\tMatrix4f view_mtx = new Matrix4f();\n\t\tMatrix4f nav_mtx = new Matrix4f();\n Point3f cor = new Point3f();\n\t\t\n\t\tnavigationTransform.getTransform(nav_mtx);\n\t\t\n\t\tdata.viewpointTransform.getTransform(view_mtx);\n\t\tview_mtx.get(pos_vec);\n\t\t\n\t\t// the eye point\n\t\tpos.set(pos_vec);\n\t\t\n\t\t// the eye direction\n\t\tdir.x = view_mtx.m02;\n\t\tdir.y = view_mtx.m12;\n\t\tdir.z = view_mtx.m22;\n\t\tdir.negate();\n\t\tdir.normalize();\n\t\t\n\t\t// transform into world space\n\t\tnav_mtx.transform(pos);\n\t\tnav_mtx.transform(dir);\n\t\t\n\t\tArrayList pickResults = new ArrayList();\n\t\tPickRequest pickRequest = new PickRequest();\n\t\tpickRequest.pickGeometryType = PickRequest.PICK_RAY;\n\t\tpickRequest.pickSortType = PickRequest.SORT_ORDERED;\n\t\tpickRequest.pickType = PickRequest.FIND_GENERAL;\n\t\tpickRequest.useGeometry = false;\n\t\tpickRequest.foundPaths = pickResults;\n\t\t\n\t\t// initialize the pick request\n\t\tpickRequest.origin[0] = pos.x;\n\t\tpickRequest.origin[1] = pos.y;\n\t\tpickRequest.origin[2] = pos.z;\n\t\t\n\t\tpickRequest.destination[0] = dir.x;\n\t\tpickRequest.destination[1] = dir.y;\n\t\tpickRequest.destination[2] = dir.z;\n\t\t\n\t\trootGroup.pickSingle(pickRequest);\n\t\t\n\t\tif (pickRequest.pickCount > 0) {\n\t\t\t\n \tPoint3f intersectPoint = new Point3f();\n \tVector3f intersectVector = new Vector3f();\n\t\t\n\t\t\tfloat min_distance = Float.MAX_VALUE;\n\t\t\t// sort through the bounds intersections\n\t\t\tint num_pick = pickResults.size();\n\t\t\tfor (int i = 0; i < num_pick; i++) {\n\t\t\t\t\n\t\t\t\tSceneGraphPath sgp = (SceneGraphPath)pickResults.get(i);\n\t\t\t\tsgp.getTransform(view_mtx);\n\t\t\t\t\n\t\t\t\tShape3D shape = (Shape3D)sgp.getTerminalNode();\n\t\t\t\tVertexGeometry geom = (VertexGeometry)shape.getGeometry();\n\t\t\t\t\n\t\t\t\t//determine if there was an actual geometry intersection\n\t\t\t\tboolean intersect = iutils.rayUnknownGeometry(\n\t\t\t\t\tpos,\n\t\t\t\t\tdir,\n\t\t\t\t\t0,\n\t\t\t\t\tgeom,\n\t\t\t\t\tview_mtx,\n\t\t\t\t\tintersectPoint,\n\t\t\t\t\tfalse);\n\t\t\t\t\n\t\t\t\tif (intersect) {\n\t\t\t\t\tintersectVector.set(\n\t\t\t\t\t\tintersectPoint.x - pos.x,\n\t\t\t\t\t\tintersectPoint.y - pos.y,\n\t\t\t\t\t\tintersectPoint.z - pos.z);\n\n\t\t\t\t\tfloat distance = intersectVector.length();\n\t\t\t\t\tif (distance < min_distance) {\n\t\t\t\t\t\tmin_distance = distance;\n\t\t\t\t\t\tcor.set(intersectPoint);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t\tnav_mtx.invert();\n\t\t\tnav_mtx.transform(cor);\n\t\t}\n\t\tcenterOfRotation.set(cor);\n\t}", "void setRoundHitbox(float r) {\n _hitbox = new PVector[]{new PVector(r, r*2)};\n }", "public void draw(){\n hit();\n hit();\n }", "public void render(Graphics g) {\n\t\tlong timeStart = System.currentTimeMillis();\n\t\t// Create the array of Rays to be traced then rendered\n\t\tlong rayAnglesStart = System.currentTimeMillis();\n\t\tRay[] rs = rayAngles();\n\t\tprintIfTime(\"Ray Angles:\" + (System.currentTimeMillis() - rayAnglesStart) + \"ms.\");\n\n\t\t// Setup objects for tracing\n\t\tBufferedImage img = new BufferedImage(getCanvasWidth(), getCanvasHeight(), BufferedImage.TYPE_INT_RGB);\n\t\tArrayList<Triangle> allTris = new ArrayList<Triangle>();\n\n\t\t// Triangulate the faces of the objects in the scene\n\t\tlong triStart = System.currentTimeMillis();\n\t\tfor (Obj3d obj : scene.getObjs()) {\n\t\t\tfor (Face face : obj.getFaces()) {\n\t\t\t\tallTris.addAll(face.triangulate());\n\t\t\t}\n\t\t}\n\t\tprintIfTime(\"Triangulation:\" + (System.currentTimeMillis() - triStart) + \"ms.\");\n\n\t\t// Ray Tracing\n\t\tlong rayTraceStart = System.currentTimeMillis();\n\t\tlong interSum = 0;\n\t\tlong closestSum = 0;\n\t\tlong colorSum = 0;\n\t\tif (rs != null) {\n\t\t\tfor (int y = 0; y < img.getHeight(); y++) {\n\t\t\t\tfor (int x = 0; x < img.getWidth(); x++) {\n\t\t\t\t\tRay pixRay = rs[y * img.getWidth() + x];\n\n\t\t\t\t\t// Find all the Triangles and Points at which the ray intersects them\n\t\t\t\t\tlong interStart = System.currentTimeMillis();\n\t\t\t\t\tHashMap<Triangle, Point> intersects = pixRay.allIntersects(allTris);\n\t\t\t\t\tinterSum += System.currentTimeMillis() - interStart;\n\n\t\t\t\t\t// Find the intersect closest to the camera\n\t\t\t\t\tlong closestStart = System.currentTimeMillis();\n\t\t\t\t\tTriangle closest = null;\n\t\t\t\t\tfor (Entry<Triangle, Point> t : intersects.entrySet()) {\n\t\t\t\t\t\tif (closest == null || intersects.get(closest).distToPoint(pixRay.getPoint()) > t.getValue()\n\t\t\t\t\t\t\t\t.distToPoint(pixRay.getPoint())) {\n\t\t\t\t\t\t\tclosest = t.getKey();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tclosestSum += System.currentTimeMillis() - closestStart;\n\n\t\t\t\t\t// Render the color from the intersect (if exists)\n\t\t\t\t\tlong colorStart = System.currentTimeMillis();\n\t\t\t\t\tif (closest != null) {\n\t\t\t\t\t\timg.setRGB(x, y, closest.pointColor(intersects.get(closest)).getRGB());\n\t\t\t\t\t} else {\n\t\t\t\t\t\timg.setRGB(x, y, Color.BLACK.getRGB());\n\t\t\t\t\t}\n\t\t\t\t\tcolorStart += System.currentTimeMillis() - colorStart;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintIfTime(\"Ray Tracing:\" + (System.currentTimeMillis() - rayTraceStart) + \"ms.\");\n\t\tprintIfTime(\"\tIntersects:\" + interSum + \"ms.\");\n\t\tprintIfTime(\"\tClosest Intersect:\" + closestSum + \"ms.\");\n\t\tprintIfTime(\"\tColor: \" + colorSum + \"ms.\");\n\n\t\t// Display and scale up if rendering is scaled down\n\t\tlong displayStart = System.currentTimeMillis();\n\t\tg.drawImage(img, 0, 0, canvas.getWidth(), canvas.getHeight(), null);\n\t\tprintIfTime(\"Display:\" + (System.currentTimeMillis() - displayStart) + \"ms.\");\n\t\tprintIfTime(\"Rendered in \" + (System.currentTimeMillis() - timeStart) + \"ms. Resolution: (\" + canvas.getWidth()\n\t\t\t\t+ \", \" + canvas.getHeight() + \") scaled \" + resScale + \" to (\" + img.getWidth() + \", \" + img.getHeight()\n\t\t\t\t+ \") | Camera Location: \" + this.scene.getCamera().getLocation() + \" Camera Angle: Yaw=\"\n\t\t\t\t+ this.scene.getCamera().getYaw() + \" Pitch=\" + this.scene.getCamera().getPitch() + \"\\n\");\n\t}", "public void setRayonV(int rayon){\r\n\t\trayonV = rayon;\r\n\t}", "public Ray(double d, double theta) {\n setOrigin(50, 200);\n setMatrix(d, theta);\n }", "private static void tracer(Scene scene, Ray ray, short[] rgb) {\r\n\t\tRayIntersection closest = findClosestIntersection(scene, ray);\r\n\r\n\t\tif (closest == null) {\r\n\t\t\tfor (int i = 0; i < 3; i++) {\r\n\t\t\t\trgb[i] = 0;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tdetermineColor(scene, closest, rgb, ray.start);\r\n\t\t}\r\n\t}", "@NotNull\r\n static Ray3 fromOD(Vector3 origin, Vector3 dir) {\r\n return new Ray3Impl(origin, dir);\r\n }" ]
[ "0.6826123", "0.6718421", "0.6547426", "0.65022767", "0.65022767", "0.6460753", "0.64524597", "0.63822556", "0.62495774", "0.6227091", "0.6226044", "0.61740535", "0.5921775", "0.59114337", "0.58347124", "0.5762176", "0.57131124", "0.5679688", "0.56575257", "0.56371623", "0.56210613", "0.5599532", "0.55478907", "0.5539915", "0.5511119", "0.54882205", "0.548666", "0.54762006", "0.5458429", "0.5385836", "0.5373483", "0.53719294", "0.5349562", "0.53399295", "0.52860194", "0.52846634", "0.5271593", "0.5257521", "0.52538645", "0.5231196", "0.5212337", "0.52105665", "0.51791716", "0.5168861", "0.51670897", "0.5164006", "0.5152563", "0.5144239", "0.51234585", "0.5118958", "0.5100852", "0.50974095", "0.5095962", "0.5059719", "0.50178295", "0.5003548", "0.5000475", "0.49947548", "0.4981922", "0.49762526", "0.49705875", "0.49596354", "0.4959413", "0.49559346", "0.49446154", "0.49386364", "0.4935636", "0.4929431", "0.49135438", "0.48773494", "0.4873508", "0.4870559", "0.48561278", "0.4853859", "0.4842285", "0.48370573", "0.4836764", "0.48353127", "0.4831432", "0.48311555", "0.48310068", "0.4816309", "0.4804454", "0.47841653", "0.47833103", "0.4774736", "0.47521216", "0.47312254", "0.4730814", "0.4725854", "0.4713752", "0.4706209", "0.4705292", "0.46964434", "0.4692427", "0.46882278", "0.46848947", "0.468457", "0.46792808", "0.46784464" ]
0.6210782
11
Constructor for duke.task.Task which takes in a String description and whether it is done or not.
Task(String description, boolean isDone) throws DateTimeException { this.description = description; this.isDone = isDone; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Task(String description, boolean done) {\r\n this.description = description;\r\n this.isDone = done;\r\n }", "public Task(boolean isDone, String description) {\n this.description = description;\n this.isDone = isDone;\n }", "public Task(String description){\n this.description = description;\n this.isDone = false;\n }", "public Task(String description){\n this.description = description;\n this.isDone = false;\n }", "public Task(String description) {\n this.description = description;\n this.isDone = false;\n }", "public Task(String description) {\n this.description = description;\n this.isDone = false;\n }", "public Task(String description) {\n this.description = description.trim();\n this.isDone = false;\n }", "public Task(String description) {\n this.description = description;\n this.isDone = false;\n this.tag = \"\";\n }", "public Task(String description) {\n this.description = description;\n this.isDone = false;\n this.taskType = \"\";\n }", "public Task(String description, boolean isDone, String tag) {\n this.description = description;\n this.isDone = isDone;\n this.tag = tag;\n }", "public Task(String taskDescription) {\n this.taskDescription = taskDescription;\n this.isDone = false;\n }", "public Task(String taskDescription) {\n this.taskDescription = taskDescription;\n this.isDone = false;\n this.completed = \"0\";\n }", "public Task(String description) {\n this.description = description;\n this.isDone = false;\n this.tag = \"\";\n this.isTagged = false;\n }", "public Task(String description) {\n\n this.description = description;\n this.isDone = false;\n taskCounter++;\n }", "public Task(String description) {\n this.description = description;\n this.isDone = false;\n this.logo = \"N\";\n }", "protected Task(String description) {\n this.description = description;\n this.isComplete = false;\n this.tags = new ArrayList<>();\n }", "public Task(String description, Boolean isCompleted, ArrayList<String> tags) {\n this.description = description;\n this.completionStatus = isCompleted;\n this.tags = tags;\n }", "public Task(String task, boolean isDone) {\n this.task = task;\n this.isDone = isDone;\n }", "public Task(String description, LocalDate date) {\n this.description = description;\n isDone = false;\n this.date = date;\n }", "public Task(String description, String logo) {\n this.description = description;\n this.isDone = false;\n this.logo = logo;\n }", "public ToDo(String description, boolean isDone) {\n super(TaskType.TODO, description, null, isDone);\n }", "public Task(String name, boolean isDone) {\n this.name = name;\n this.isDone = isDone;\n }", "public ToDoTask(String description, int id, int status) {\n super(description, id);\n super.isDone = status > 0;\n }", "public Task(String task, boolean isDone, Date dueDate) {\n this.task = task;\n this.isDone = isDone;\n this.dueDate = dueDate;\n }", "public Task(String name) {\r\n this(name, false);\r\n }", "public Task (String name, Priority priority, String description, Status status)\n\t{\n\t\tif (name.trim().length() > 0)\n\t\t{\n\t\t\tthis.name = name;\n\t\t}\n\t\tif (description.length() <= 255 && description.length() > 0)\n\t\t{\n\t\t\tthis.setDescription(description);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.description = \"No description added !!!!!\";\n\t\t}\n\t\tthis.priority = priority;\n\t\tthis.status = status;\n\t}", "public Task(String creator) {\r\n \t\tthis(creator, \"Untitled\", \"\", true, false);\r\n \t}", "public ToDoTask(String description, int id) {\n super(description, id);\n }", "public Task(String original) {\n this(original, null);\n }", "public Event(String description, boolean isDone) throws WrongCommandFormatException {\n this.command = description;\n Scanner s = new Scanner(description);\n\n while (s.hasNext()) {\n readCommand(s);\n }\n\n if (this.description.equals(\" \")) {\n throw new WrongCommandFormatException(\n \"No task specified. Please specify a task before `/at`\"\n );\n } else if (this.timeframe == null) {\n throw new WrongCommandFormatException(\n \"No timeframe specified. Please specify a timeframe after `/at`\"\n );\n } else {\n this.isDone = isDone;\n }\n }", "public Command (String description, TaskList tasks) {\n this.description = description;\n this.tasks = tasks;\n this.isExit = false;\n }", "public Task(String name) {\n this.name = name;\n this.isDone = false;\n }", "public Task(String creator, String name, String description,\r\n \t\t\tboolean requiresText, boolean requiresPhoto) {\r\n \r\n\t\t_creationDate = new SimpleDateFormat(\"MMM dd, yyyy | HH:mm\").format(Calendar\r\n \t\t\t\t.getInstance().getTime());\r\n\t\t\r\n\t\t// Store date as hex string with hex prefix.\r\n\t\t_dateHex = \"0x\" + Long.toHexString(Calendar.getInstance().getTimeInMillis());\r\n \r\n \t\t_creator = creator;\r\n \t\t_name = name;\r\n \t\t_requiresText = requiresText;\r\n \t\t_requiresPhoto = requiresPhoto;\r\n \t\t_fulfilled = false;\r\n \r\n \t\t_photos = new ArrayList<PhotoRequirement>();\r\n \t}", "public ToDoCommand(String description) {\n ToDoCommand.description = description;\n }", "public Todo(String description, boolean isDone, String tags) {\n super(description, isDone, tags);\n }", "@Override\n protected Task updateTaskDescription(String newDescription) {\n Todo newTodo = new Todo(newDescription);\n if (this.getStatus()) {\n newTodo.markAsDone();\n }\n return newTodo;\n\n }", "public Task(String msg) {\n this.msg = msg;\n completed = false;\n }", "public DoneCommand(String description) {\n\n super(description);\n\n }", "public AddCommand(String taskType, Optional<String> taskDescription) { \r\n this.taskType = taskType;\r\n this.taskDescription = taskDescription;\r\n this.taskDeadline = Optional.empty();\r\n this.taskStartDateTime = Optional.empty();\r\n this.taskEndDateTime = Optional.empty();\r\n this.task = makeTask(taskType, taskDescription, taskDeadline, \r\n taskStartDateTime, taskEndDateTime); \r\n }", "public ToDoCommand(String desc) {\n this.desc = desc;\n }", "protected Task(String s) {\n title = s;\n status = \"\\u2717\"; // A cross symbol indicating the task has not been done.\n }", "public Task createTask(final String description) {\n final Task t = new Task(taskid, description, this);\n taskid++;\n tasks.put(t.getId(), t);\n\n return t;\n }", "public abstract AbstractTask createTask(String repositoryUrl, String id, String summary);", "public ToDoCommand toDoParse(String desc) throws DukeException {\n if (desc.equals(\"\")) {\n throw new DukeException(MISSING_TASK_DESCRIPTION_MESSAGE);\n }\n return new ToDoCommand(desc);\n }", "public Task(){}", "public Task(String original, @Nullable String other) {\n this(original, other, -1, -1);\n \n }", "public TimedTask(String task) {\n this.task = task;\n timeStart = System.currentTimeMillis();\n }", "public Task(String name) {\n\t\tthis.name=name;\n\t}", "public Todo(String task) {\n super(task);\n }", "public Tasks(int id,String des, String type) {\n this.id = id;\n this.des = des;\n this.type = type;\n isChecked = false;\n }", "public Task() {\n\t}", "Task(String name) {\n this.name = name;\n }", "public ToDo(String description) {\n super(description);\n }", "public Task(String task, Date dueDate) {\n this.task = task;\n this.dueDate = dueDate;\n }", "private Tasks createNoKeywordTask(Tasks task, String descriptionOfTask, ArrayList<String> timeArray,\n int numberOfArguments) {\n if (numberOfArguments == 1 || numberOfArguments == 2) { //deadline tasks\n task = createDeadlineTask(task, descriptionOfTask, timeArray);\n } else { //duration tasks\n task = createDurationTask(task, descriptionOfTask, timeArray);\n }\n return task;\n }", "public TaskItem(String title, String description, String date_string, boolean completion_status)\n {\n\n // PREVENT TASKITEM CREATION IF ILLEGAL TITLE\n if(title.length() < 1)\n {\n throw new IllegalArgumentException(\"Error - Title can not be blank\");\n } // END if\n\n /**************************************************/\n\n // COULD THROW 'DateTimeParseException'\n LocalDate local_date_ref = LocalDate.parse(date_string);\n\n this.task_title = title;\n this.task_description = description;\n this.task_due_date = local_date_ref;\n this.task_completion_boolean = completion_status;\n\n }", "public Task(String taskName, String dueDate)\r\n {\r\n this.dueDate=dueDate;\r\n this.taskName=taskName;\r\n }", "public Todo(String description) {\n super(description);\n assert !(description.equals(\"\")) : \"Todo description is empty\";\n }", "public Todo(String description) {\n super(description);\n }", "public Todo(String description) {\n super(description);\n }", "public Todo(String description) {\n super(description);\n }", "private Task makeTask(String taskType, Optional<String> taskDescription, \r\n Optional<LocalDateTime> taskDeadline, \r\n Optional<LocalDateTime> taskStartDateTime,\r\n Optional<LocalDateTime> taskEndDateTime) {\r\n \r\n Task task;\r\n \r\n if (taskDescription.get().isBlank()) {\r\n throw new InvalidTaskArgumentException(\r\n MESSAGE_ADD_COMMAND_INVALID_TASK_DESCRIPTION);\r\n }\r\n \r\n switch(taskType) {\r\n case \"todo\": \r\n task = new ToDos(TaskList.taskIdCounter, taskDescription.get());\r\n break;\r\n case \"deadline\":\r\n if (taskDeadline.isEmpty()) {\r\n throw new InvalidTaskArgumentException(\r\n MESSAGE_ADD_COMMAND_INVALID_TASK_REQUIREMENT_DEADLINES);\r\n }\r\n \r\n task = new Deadlines(TaskList.taskIdCounter, taskDescription.get(), \r\n taskDeadline.get()); \r\n break;\r\n case \"event\":\r\n if (taskStartDateTime.isEmpty() || taskEndDateTime.isEmpty()) {\r\n throw new InvalidTaskArgumentException(\r\n MESSAGE_ADD_COMMAND_INVALID_TASK_REQUIREMENT_EVENTS);\r\n }\r\n task = new Events(TaskList.taskIdCounter, taskDescription.get(), \r\n taskStartDateTime.get(), taskEndDateTime.get());\r\n break;\r\n default:\r\n throw new InvalidTaskArgumentException(MESSAGE_INVALID_TASK_TYPE);\r\n }\r\n return task;\r\n }", "public Task() {\r\n }", "public Task() { }", "public TaskDefinition() {\n\t\tthis.started = Boolean.FALSE; // default\n\t\tthis.startTime = new Date(); // makes it easier during task creation\n\t\t// as we have a default date populated\n\t\tthis.properties = new HashMap<>();\n\t}", "public Task(String taskName, int startHour, int startMinute, int finishHour, int finishMinute) {\n this.taskName = taskName;\n this.startHour = startHour;\n this.startMinute = startMinute;\n this.finishHour = finishHour;\n this.finishMinute = finishMinute;\n }", "public CompletedTask(Task task, String date)\r\n\t{\r\n\t\tsuper(task.ID, task.description, task.priority, task.order, STATUS_COMPLETE);\r\n\t\tthis.date = date;\r\n\t}", "private Tasks createKeywordTask(Tasks task, String descriptionOfTask, ArrayList<String> timeArray) {\n timeArray.set(0, timeArray.get(0).toLowerCase());\n ArrayList<String> formattedTimeArray = new ArrayList<String>();\n createFormattedTimeArray(timeArray, formattedTimeArray);\n assert(formattedTimeArray.size() < 5);\n if (formattedTimeArray.size() == 2) { //deadline task\n createFormattedTimeArray(timeArray, formattedTimeArray);\n task = createDeadlineTask(task, descriptionOfTask, formattedTimeArray);\n } else if (formattedTimeArray.size() == 4) { //duration task\n createFormattedTimeArray(timeArray, formattedTimeArray);\n task = createDurationTask(task, descriptionOfTask, formattedTimeArray);\n }\n return task;\n }", "public AddCommand(String taskType, Optional<String> taskDescription, \r\n Optional<LocalDateTime> taskDeadline) {\r\n \r\n this.taskType = taskType;\r\n this.taskDescription = taskDescription;\r\n this.taskDeadline = taskDeadline;\r\n this.taskStartDateTime = Optional.empty();\r\n this.taskEndDateTime = Optional.empty();\r\n this.task = makeTask(taskType, taskDescription, taskDeadline, \r\n taskStartDateTime, taskEndDateTime); \r\n }", "public AddCommand(String taskType, Optional<String> taskDescription, \r\n Optional<LocalDateTime> taskStartDateTime,\r\n Optional<LocalDateTime> taskEndDateTime) {\r\n \r\n this.taskType = taskType;\r\n this.taskDescription = taskDescription;\r\n this.taskDeadline = Optional.empty();\r\n this.taskStartDateTime = taskStartDateTime;\r\n this.taskEndDateTime = taskEndDateTime;\r\n this.task = makeTask(taskType, taskDescription, taskDeadline, \r\n taskStartDateTime, taskEndDateTime); \r\n }", "Task createTask();", "Task createTask();", "Task createTask();", "public DoneCommand doneParse(String desc) throws DukeException {\n if (desc.equals(\"\")) {\n throw new DukeException(MISSING_TASK_NUMBER_MESSAGE);\n }\n try {\n int taskNumber = Integer.parseInt(desc);\n return new DoneCommand(taskNumber);\n } catch (NumberFormatException e) {\n throw new DukeException(ENTERED_NON_NUMBER_MESSAGE);\n }\n }", "public ToDos(String description) {\r\n super(description);\r\n }", "public Task() {\n }", "public ToDoCommand(String fullCommand) throws NoDescriptionException {\n if (fullCommand.equals(\"todo\")) {\n throw new NoDescriptionException(\"The description of a todo cannot be empty.\");\n }\n String[] splitCommand = fullCommand.split(\" \", 2);\n String desc = splitCommand[1];\n taskToAdd = new ToDo(desc);\n }", "public Task(String id, String nameandpoints, String desc) {\n this.id = id;\n this.assignedMembers = new ArrayList<>();\n this.requiredSkills = new ArrayList<>();\n nameandpoints.trim();\n if (nameandpoints.startsWith(\"(\")) {\n try {\n this.name = nameandpoints.substring(4);\n String temp = nameandpoints.substring(1, 2);\n this.storyPoints = Integer.parseInt(temp);\n } catch (Exception e) {\n System.out.println(e.getMessage());\n this.name = nameandpoints;\n this.storyPoints = 0;\n }\n } else {\n this.name = nameandpoints;\n }\n\n if (!desc.isEmpty()) {\n if (desc.contains(\"Required Skills\")) {\n try {\n String skills = desc.substring(desc.lastIndexOf(\":\") + 1);\n addRequiredSkill(skills);\n System.out.println(requiredSkills);\n this.description = desc.substring(0, desc.indexOf(\"Required\"));\n } catch (Exception e) {\n Log.e(\"Task Creation\", \"Not expected format for desc in Task: \" + name);\n }\n } else this.description = desc;\n }\n\n }", "public Todo(String description) throws InvalidDescriptionException {\n super(description);\n if (description.isBlank()) {\n throw new InvalidDescriptionException(\"Hey! \"\n + \"Todo description shouldn't be blank.\");\n }\n }", "public Task(String original, @Nullable String other, int author, int review) {\n Preconditions.checkNotNull(original);\n this.original = original;\n this.other = other;\n this.author = author;\n this.review = review;\n numberOfWordsOriginal = Utils.getNumberOfWords(original);\n }", "public ToDos(String description) {\n super(description);\n this.type = 'T';\n }", "private Tasks createDeadlineTaskForInputWithoutTime(Tasks task, String descriptionOfTask, String endDate) {\n if (checkValidDate(endDate)) {\n Duration deadline = new Duration(endDate, \"2359\");\n task = new DeadlineTask(descriptionOfTask, deadline);\n }\n return task;\n }", "public Tasks() {\n }", "public Task(){\n super();\n }", "public ToDoItem(int _id, String _description) {\n description = _description;\n id = _id;\n date = cal.getTime();\n done = false; // Default to not completed\n }", "public Task(String url) {\n this.url = url;\n logger.debug(\"Created task for \" + url);\n }", "public void edit_task_description(String description)\n {\n task_description = description;\n }", "private Task createTaskFromGivenArgs(Name name, TaskDate taskStartDate, TaskDate taskEndDate, Status taskStatus) {\n\t if (isEventTask(taskStartDate, taskEndDate)) {\n\t return new EventTask(name, taskStartDate, taskEndDate, taskStatus);\n\t }\n\t if (isDeadline(taskEndDate)) {\n\t return new DeadlineTask(name, taskEndDate, taskStatus);\n\t }\n\t return new Task(name, taskStatus);\n\t}", "public AnemoCheckTask() {\n }", "public Deadline(String taskDescription) throws DukeException {\n super(taskDescription.split(SPLITTER)[0]);\n String[] details = taskDescription.split(SPLITTER);\n if (details.length != NUM_FIELDS_DESCRIPTION) {\n throw new DukeException(\"Please follow the format of \\\"{task} /by {deadline}\\\"\");\n }\n\n deadline = DateTimeHandler.parseDateTime(taskDescription.split(SPLITTER)[1]);\n }", "public DoneCommand(int taskNum) {\n this.taskNum = taskNum;\n }", "public Task(Task task) {\r\n\t\tthis.id = task.id;\r\n\t\tthis.description = task.description;\r\n\t\tthis.processor = task.processor;\r\n\t\tthis.status = task.status;\r\n\r\n\t\tthis.dueDate = new GregorianCalendar(task.dueDate.get(GregorianCalendar.YEAR), \r\n\t\t\t\ttask.dueDate.get(GregorianCalendar.MONTH), \r\n\t\t\t\ttask.dueDate.get(GregorianCalendar.DAY_OF_MONTH));\r\n\r\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"dd.MM.yyyy\");\r\n\t\tthis.formatedDueDate = sdf.format(dueDate.getTime());\r\n\t\tthis.next = task.next;\r\n\t}", "public Task(Task task) {\n id = task.id;\n taskType = task.taskType;\n title = task.title;\n period = task.period;\n deadline = task.deadline;\n wcet = task.wcet;\n //execTime = task.execTime;\n priority = task.priority;\n initialOffset = task.initialOffset;\n nextReleaseTime = task.nextReleaseTime;\n isSporadicTask = task.isSporadicTask;\n }", "public ToDoItem(int _id, String _description, String _date) {\n description = _description;\n id = _id;\n date = calcDate(_date);\n done = false; // Default to not completed\n }", "public static Task createTask(final String[] tokens) throws Exception {\n String title = tokens[1];\n if (title.length() == 0) {\n throw new Exception(\"Title not provided\");\n }\n String assignedTo = tokens[2];\n int timeToComplete = Integer.parseInt(tokens[2 + 1]);\n if (timeToComplete < 0) {\n throw new Exception(\n \"Invalid timeToComplete\" + \" \" + timeToComplete);\n }\n boolean important = tokens[2 + 2].equals(\"y\");\n boolean urgent = tokens[2 + 2 + 1].equals(\"y\");\n String status = tokens[2 + 2 + 2];\n if (!(status.equals(\"todo\") || status.equals(\"done\"))) {\n throw new Exception(\"Invalid status dud\");\n }\n return new Task(\n title, assignedTo, timeToComplete,\n important, urgent, status);\n }", "Task1(String c){\n\t\n}", "private Tasks createDeadlineTask(Tasks task, String descriptionOfTask, ArrayList<String> timeArray) {\n if (timeArray.size() == 1) {\n String endDate = timeArray.get(0);\n task = createDeadlineTaskForInputWithoutTime(task, descriptionOfTask, endDate);\n } else {\n String endDate = timeArray.get(0);\n String endTime = timeArray.get(1);\n task = createDeadlineTaskForInputWithTime(task, descriptionOfTask, endDate, endTime);\n }\n return task;\n }", "public StudentTask() {\n\t\tthis(\"student_task\", null);\n\t}", "public Task(String name, int number) {\r\n this.name = name;\r\n this.id = number;\r\n this.timer = new Timer();\r\n }", "public DoCommand(String toDo) {\n this.toDo = toDo;\n this.tracker = new MarkTaskUtil();\n }" ]
[ "0.8908575", "0.8813516", "0.86736125", "0.86736125", "0.86520123", "0.86520123", "0.8636979", "0.8501657", "0.8496353", "0.84530014", "0.84458363", "0.84147775", "0.83810556", "0.8259589", "0.8232722", "0.79592997", "0.78487396", "0.76453996", "0.7442807", "0.7356628", "0.7291935", "0.72801954", "0.7274873", "0.72450423", "0.69901", "0.69717675", "0.69661736", "0.6965019", "0.69622755", "0.69596905", "0.69545263", "0.6899355", "0.6891965", "0.68309873", "0.6739982", "0.6699637", "0.66791654", "0.66351634", "0.66345835", "0.66219", "0.65763986", "0.6499199", "0.6492283", "0.6490359", "0.6487944", "0.64823407", "0.6428393", "0.63858116", "0.6362665", "0.6361306", "0.6348482", "0.6329122", "0.6318339", "0.6301791", "0.62833554", "0.62818605", "0.6256943", "0.6256032", "0.6243212", "0.6243212", "0.6243212", "0.6241805", "0.6206422", "0.61952007", "0.61882925", "0.618746", "0.61642265", "0.61384374", "0.61219335", "0.60920805", "0.607611", "0.607611", "0.607611", "0.6072108", "0.6053394", "0.6039821", "0.60193425", "0.60179496", "0.600579", "0.5984709", "0.5963004", "0.59468603", "0.5922211", "0.5920776", "0.5913731", "0.58983165", "0.589653", "0.5869355", "0.5846477", "0.5845181", "0.5843453", "0.5831366", "0.5783389", "0.57823926", "0.5776066", "0.5772248", "0.5764101", "0.5763917", "0.5759878", "0.57492954" ]
0.78493875
16
Gets the String description of the task.
public String getDescription() { return description; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String get_task_description()\n {\n return task_description;\n }", "public String getDescription()\r\n {\r\n return \"Approver of the task \"+taskName();\r\n }", "public String getTaskName() {\n return this.taskDescription;\n }", "public String GiveTask(){\n return \"[\" + getStatusIcon() + \"] \" + this.description;\n }", "@Override\n public String toString()\n {\n\n // IF TASK IS MARKED AS COMPLETE\n if(task_completion_boolean)\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return \"*** \" + String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return \"*** \" + String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END if\n\n /***********************************************************/\n\n // OTHERWISE, TASK IS NOT COMPLETE\n else\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END else\n\n }", "public String getDescription(){\n return getString(KEY_DESCRIPTION);\n }", "public String getDescription() {\n return (desc);\n }", "public String getDescription() {\n if (description == null) {\n description = Description.getDescription(this);\n }\n return description;\n }", "public String getDescription() {\n return getString(KEY_DESCRIPTION);\n }", "@NonNull\n public String getDescription() {\n return description;\n }", "@NonNull\n public String getDescription() {\n return description;\n }", "public String getDescription() {\n return desc;\n }", "public String getDescription(){\r\n \tString retVal = this.description;\r\n return retVal;\r\n }", "public String getDescription() {\n return getProperty(Property.DESCRIPTION);\n }", "@Override\n public String toString() {\n return \"[\" + this.getStatusIcon() + \"] \" + this.taskDescription;\n }", "@Override\n public String toString() {\n return \"[\" + this.getStatusIcon() + \"] \" + this.taskDescription;\n }", "public String getString() {\n assert tasks != null : \"tasks cannot be null\";\n StringBuilder str = new StringBuilder();\n for (int i = 1; i < parts.length; i++) {\n str.append(\" \");\n str.append(parts[i]);\n }\n String taskString = str.toString();\n Todo todo = new Todo(taskString);\n tasks.add(todo);\n return Ui.showAddText() + todo.toString() + tasks.getSizeString();\n }", "public String getDescription() {\n return desc;\n }", "public String getDescription() {\n\t\treturn config.getString(QuestConfigurationField.DESCRIPTION.getKey(), (String) QuestConfigurationField.DESCRIPTION.getDefault());\n\t}", "public final String getDescription() {\n return description;\n }", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "java.lang.String getDescription();", "public String getDescription () {\n return description;\n }", "public String getDescripcion() {\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"getDescripcion() - start\");\n\t\t}\n\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"getDescripcion() - end\");\n\t\t}\n\t\treturn descripcion;\n\t}", "public String getDescription() {\n\t\tif (description == null)\n\t\t\treturn \"No description\";\n\t\treturn description;\n\t}", "public String getDescription() {\n return sdesc;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public java.lang.String getDescription() {\n return description;\n }", "public String getDescription() {\n return description;\n }", "@Override\r\n\tpublic String getDescription() {\n\t\treturn this.description;\r\n\t}", "public java.lang.String getDescription() {\r\n return description;\r\n }", "public java.lang.String getDescription() {\r\n return description;\r\n }", "public java.lang.String getDescription() {\r\n return description;\r\n }", "public String getDescription()\n {\n return description;\n }", "public String getDescription()\r\n {\r\n return description;\r\n }" ]
[ "0.8601203", "0.81070465", "0.7988292", "0.75082636", "0.7391041", "0.7390478", "0.7301132", "0.7232685", "0.7194147", "0.71572083", "0.71572083", "0.7147198", "0.7147133", "0.71446717", "0.71305436", "0.71305436", "0.7114812", "0.7109568", "0.7081664", "0.70810413", "0.70742047", "0.70742047", "0.70742047", "0.70742047", "0.70742047", "0.70742047", "0.70742047", "0.70742047", "0.70742047", "0.70697933", "0.7067606", "0.7043107", "0.70415294", "0.7040165", "0.7040165", "0.7040165", "0.7040165", "0.7040165", "0.7040165", "0.7040165", "0.7040165", "0.7040165", "0.7030754", "0.7029507", "0.7023861", "0.70163304", "0.7013035", "0.7013035", "0.7013035", "0.69999766", "0.6995991" ]
0.0
-1
Gets the boolean value whether task is done or not.
public boolean getDone() { return isDone; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isDone(){\n return done;\n }", "public String getIsDone() {\n if (isDone) {\n return \"1\";\n } else {\n return \"0\";\n }\n }", "public boolean isDone() {\n return done;\n }", "public boolean isDone() {\r\n return isDone;\r\n }", "public boolean getIsDone() {\n return this.isDone;\n }", "public boolean isDone() {\n return isDone;\n }", "public boolean isDone() {\n return isDone;\n }", "public boolean isDone() {\n return isDone;\n }", "public boolean isDone() {\n return done;\n }", "public boolean isDone() {\n return done;\n }", "public boolean isDone() {\n return this.done;\n }", "public boolean isDone(){\n return status;\n }", "public boolean isDone() {\n\t\t\n\t\treturn done;\n\t}", "public boolean isDone();", "public boolean isDone();", "public boolean getDone(){\r\n\t\treturn done;\r\n\t}", "public boolean getDoneStatus(){\n return isDone;\n }", "boolean isDone();", "public boolean checkDone() {\n return this.isDone;\n }", "public boolean isDone() { return true; }", "boolean isDone() {\n return this.isDone;\n }", "public boolean isDone() {\n\t\treturn true;\n\t}", "public final boolean isDone() {\n return TrustedListenableFutureTask.this.isDone();\n }", "public boolean isDone()\n {\n return (this.elapsed >= this.duration);\n }", "@Override\n\tpublic boolean done() {\n\t\tfor(Task t : details.getPendingTasks()){\n\t\t\tif(!t.isComplete())\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "@Override\n public boolean isDone() {\n return done;\n }", "public boolean get_task_completion()\n {\n return task_completion_boolean;\n }", "@Override\n public boolean isDone() {\n return this.isDone;\n }", "public boolean isDone() { return false; }", "public boolean is_completed();", "public boolean getStatus() {\n return this.isDone;\n }", "public String getDone() {\n return (isDone ? \"1\" : \"0\");\n }", "public boolean isDone()\r\n/* 69: */ {\r\n/* 70:106 */ return isDone0(this.result);\r\n/* 71: */ }", "@Override\n public boolean isDone() {\n return future.isDone();\n }", "public boolean isDone(){\r\n\t\tif(worker.getState()==Thread.State.TERMINATED) return true;\r\n\t\treturn false;\r\n\t}", "@Override\n public boolean isDone() {\n // boolean result = true;\n // try {\n // result = !evaluateCondition();\n // } catch (Exception e) {\n // logger.error(e.getMessage(), e);\n // }\n // setDone(true);\n // return result;\n // setDone(false);\n return false;\n }", "public static boolean isCompleted(){\n return isComplete;\n }", "boolean isCompleted();", "public boolean get_isTripDone() {\n\t\tsharedPreferences = context.getSharedPreferences(\"Login\",\n\t\t\t\tcontext.MODE_PRIVATE);\n\t\treturn sharedPreferences.getBoolean(\"isTripDone\", false);\n\t}", "protected boolean isFinished() {\r\n\t\t \tboolean ans = false;\r\n\t\t \treturn ans;\r\n\t\t }", "boolean hasTask();", "public boolean isCompleted() {\r\n return completed;\r\n }", "public Boolean getTaskCompletedOption() {\n return (Boolean) commandData.get(CommandProperties.TASKS_COMPLETED_OPTION);\n }", "protected boolean isFinished() {\n\treturn this.isDone;\n }", "public boolean isFinishing() {\n return isFinishing;\n }", "public boolean isCompleted() {\n return completed;\n }", "public int getDone() {\n\t\treturn done;\n\t}", "public boolean isComplete() {\n return future != null && future.isDone();\n }", "public boolean isCompleted() {\r\n return completed;\r\n }", "public boolean isCompleted(){\r\n\t\treturn isCompleted;\r\n\t}", "public boolean isDone() {\n return done.isTrue() || depth == PSymGlobal.getConfiguration().getMaxStepBound();\n }", "public final boolean isDone() {\n\t\tboolean result = true;\n\t\tfor (String mdl : executors.keySet()) {\n\t\t\tSubstructureExecutorI exe = executors.get(mdl);\n\t\t\tresult = result && exe.stepIsDone();\n\t\t}\n\t\t// final int matlabWait = 200;\n\t\t// try {\n\t\t// log.debug(\"Waiting to return\");\n\t\t// Thread.sleep(matlabWait);\n\t\t// } catch (InterruptedException e) {\n\t\t// log.debug(\"HEY who woke me up?\");\n\t\t// }\n\t\treturn result;\n\t}", "public boolean isFinished(){\n return this.finished;\n }", "public boolean isCompleted() {\n return this.completed;\n }", "public boolean isCompleted() {\n\t\t\n\t\treturn completed;\n\t\t\n\t}", "public void checkOffTask() {\n isDone = true;\n }", "@Override\n public boolean isFinished() {\n return isDone;\n }", "@Override\n public boolean isFinished() {\n return isDone;\n }", "protected boolean isFinished() {\n\n \tif(weAreDoneSenor == true) {\n\n \t\treturn true;\n \t} else {\n \t\treturn false;\n \t}\n \t\n }", "boolean getIsComplete();", "public boolean getFinish(){\n\t\treturn finish;\n\t}", "boolean getFinished();", "public synchronized boolean getFinished(){\n return finished;\n }", "boolean getTaskResultAfterDone(ManagedObjectReference task)\n throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg,\n InvalidCollectorVersionFaultMsg {\n\n boolean retVal = false;\n\n // info has a property - state for state of the task\n Object[] result =\n waitForValues.wait(task, new String[]{\"info.state\", \"info.error\"},\n new String[]{\"state\"}, new Object[][]{new Object[]{\n TaskInfoState.SUCCESS, TaskInfoState.ERROR}});\n\n if (result[0].equals(TaskInfoState.SUCCESS)) {\n retVal = true;\n }\n if (result[1] instanceof LocalizedMethodFault) {\n throw new RuntimeException(\n ((LocalizedMethodFault) result[1]).getLocalizedMessage());\n }\n return retVal;\n }", "public final boolean isFinish() {\n return finish;\n }", "public boolean completed() {\n return completed;\n }", "public abstract boolean isCompleted();", "public boolean wasFinished()\n {\n return this.isFinished;\n }", "Boolean isFinished();", "boolean isComplete() {\n return complete.get();\n }", "public final boolean isFinish() {\n return finish;\n }", "public synchronized boolean hasFinished ()\n {\n return this.finished;\n }", "@Override\n\tprotected boolean isFinished() {\n\t\treturn done; \n\t}", "protected boolean isFinished() {\n return finished;\n }", "protected boolean isFinished() {\n return isFinished;\n }", "public boolean isFinished() {\r\n\t\t\treturn tIsFinished;\r\n\t\t}", "@Override\n public boolean isDone()\n {\n return false;\n }", "public boolean isDone(String requestId);", "boolean isComplete();", "boolean isComplete();", "public boolean isFinished() {\n return isFinished;\n }", "public boolean done() {\n return false;\n }", "public boolean isComplete();", "public boolean isFinished() {\n return finished;\n }", "public boolean getFinished() {\n return finished;\n }", "public boolean isDoneFlgTrue() {\n HangarCDef.Flg cdef = getDoneFlgAsFlg();\n return cdef != null ? cdef.equals(HangarCDef.Flg.True) : false;\n }", "public boolean isFinished() {\r\n\t\treturn this.finished;\r\n\t}", "public boolean isFinished();", "public boolean isFinished() {\n\t\treturn (finished);\n\t}", "@Override\n public boolean isDone() {\n return false;\n }", "@Override\r\n\tpublic boolean finishCurrentTask() {\r\n\t\treturn finished;\r\n\t}", "boolean hasFinished();", "public boolean hasTaskId() {\n return fieldSetFlags()[9];\n }", "boolean isFinished();", "protected boolean isFinished() {\n return this.isTimedOut();\n }", "public boolean isIfTaskFails() {\n return getFlow().isIfTaskFails();\n }", "public boolean isComplete()\n {\n return getStatus() == STATUS_COMPLETE;\n }", "protected boolean isFinished() {\r\n if (state == STATE_SUCCESS) {\r\n // Success\r\n return true;\r\n }\r\n if (state == STATE_FAILURE) {\r\n // Failure\r\n return true;\r\n }\r\n return false;\r\n }", "boolean completed();", "public boolean getFinished() {\n return finished_;\n }" ]
[ "0.8020528", "0.7949551", "0.7901273", "0.78913486", "0.7885356", "0.78826874", "0.78826874", "0.78826874", "0.7881275", "0.7881275", "0.78720874", "0.7867291", "0.7827865", "0.78197044", "0.78197044", "0.77187896", "0.7682681", "0.76467663", "0.7602398", "0.75435096", "0.7542064", "0.7481711", "0.74635524", "0.74595255", "0.7391631", "0.7372305", "0.73352724", "0.7297039", "0.72510606", "0.7250493", "0.71899545", "0.71867484", "0.71681803", "0.71414006", "0.7132767", "0.7107508", "0.7099916", "0.7083178", "0.7065713", "0.70442224", "0.7020433", "0.696713", "0.6963811", "0.6962444", "0.69618785", "0.69578946", "0.69400775", "0.69329405", "0.6924509", "0.68874", "0.68613964", "0.68575", "0.6850976", "0.68446344", "0.6838371", "0.682752", "0.6818479", "0.6818479", "0.679401", "0.67731714", "0.6726903", "0.67173785", "0.66833323", "0.66751266", "0.6671164", "0.66692", "0.6649236", "0.6635354", "0.66251194", "0.66206473", "0.6605404", "0.66043466", "0.6577834", "0.65717", "0.65710634", "0.6561554", "0.6555581", "0.6554964", "0.65412456", "0.65412456", "0.65215623", "0.65209055", "0.65179294", "0.6514271", "0.65119404", "0.65080273", "0.6504176", "0.64825785", "0.6479537", "0.6450069", "0.6442346", "0.6437884", "0.64308256", "0.6427798", "0.6422076", "0.64131224", "0.6411911", "0.6409328", "0.6396612", "0.63904506" ]
0.78373384
12
Sets duke.task.Task to be done.
public void setDone() { isDone = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setTask(Task task) {\n this.task = task;\n }", "public void setTask(Task inTask){\n punchTask = inTask;\n }", "public void setTask(TaskDTO task) {\n\t\tthis.task = task;\r\n\t\t\r\n\t\t\r\n\t}", "protected void setupTask(Task task) {\n }", "public void setTask(PickingRequest task) {\n this.task = task;\n }", "public abstract Task markAsDone();", "public Task(String task, boolean isDone) {\n this.task = task;\n this.isDone = isDone;\n }", "public void markAsDone(String taskName) {\n \tSystem.out.println(\"Inside markAsDone()\");\n \tint count = 0;\n \t\n \tfor(Task task : toDoList) {\n \t\tif(task.getTaskName().equals(taskName)) {\n \t\t\ttask.setDone(true);\n \t\t\ttoDoList.set(count, task);\n \t\t\t}\n \t\tcount++;\n \t}\n System.out.println(\"Task Marked As Done Successfully\");\n \n System.out.println(toDoList);\n \t\n \tdisplay();\n }", "public Task markAsDone() {\n isDone = true;\n status = \"\\u2713\"; // A tick symbol indicating the task is done.\n\n return this;\n }", "public void resetTask() {}", "@Override\n public Task markUndone() {\n ReadOnlyTask oldTask = this;\n \n TaskName newName = oldTask.getName();\n TaskTime newStartTime = oldTask.getStartTime();\n TaskTime newEndTime = oldTask.getEndTime();\n TaskTime newDeadline = oldTask.getDeadline();\n Tag newTag = oldTask.getTag();\n\n Task newTask = null;\n try {\n newTask = new Task(newName, newStartTime, newEndTime, newDeadline, newTag, false);\n } catch (IllegalValueException e) {\n assert false;\n }\n return newTask;\n }", "public void setTaskCompleted(TaskAttemptID taskID) {\n taskStatuses.get(taskID).setState(TaskStatus.SUCCEEDED);\n successfulTaskID = taskID;\n activeTasks.remove(taskID);\n }", "private TasksLists setTaskDone(ITaskCluster taskCluster, ICommonTask task, Object taskServiceResult) {\n return nextTasks(taskCluster, task, taskServiceResult);\n }", "@Override\r\n\tpublic void doTask() {\n\t}", "public void checkOffTask() {\n isDone = true;\n }", "public void setTaskInstance(Task taskInstance) {\n\t\tthis.taskInstance = taskInstance;\n\t}", "@Override\r\n public void clearTask()\r\n {\r\n this.task = new DiagramTask();\r\n }", "public void setDone(boolean doneIt)\n {\n notDone = doneIt;\n }", "void addDoneTask(Task task);", "public void assignTask(String employee, String taskName) {\n \tSystem.out.println(\"Inside assignDeadline()\");\n \t//Task t = new Task();\n \tint count = 0;\n \tfor(Task task : toDoList) {\n \t\tif(task.getTaskName().equals(taskName)) {\n \t\t\t//t = task;\n \t\t\ttask.setEmployee(employee);\n \t\t\ttoDoList.set(count, task);\n \t\t}\n \t\tcount++;\n \t}\n \tSystem.out.println(\"Task Assigned to Employee Sucessfully\");\n \t\n \tdisplay();\n }", "public void setDone() {\n this.isDone = true;\n }", "public void setDone() {\n this.isDone = true;\n }", "public void setDone() {\n this.isDone = true;\n }", "public void SetDone(){\n this.isDone = true;\n }", "void executeTask(org.apache.ant.common.antlib.Task task) throws org.apache.ant.common.util.ExecutionException;", "public Task(String task, boolean isDone, Date dueDate) {\n this.task = task;\n this.isDone = isDone;\n this.dueDate = dueDate;\n }", "boolean setTask(UUID uuid, IAnimeTask task);", "public void setupTask(TaskAttemptContext context) throws IOException {\n }", "public void setUp() {\n instance = new Task();\n }", "public void renameTask(String taskName, Task myTask) {\n \tSystem.out.println(\"Inside renameTask :\" + taskName);\n \t//System.out.println(toDoList);\n \tTask t = new Task();\n \tint count = 0;\n \tfor(Task task : toDoList) {\n \t\tif(task.getTaskName().equals(taskName));{\n \t\tSystem.out.println(\"inside\");\n \t\tt.setTaskName(myTask.getTaskName());\n \t\tt.setEmployee(myTask.getEmployee());\n \t\tt.setDone(myTask.isDone());\n \t\tt.setDeadline(myTask.getDeadline());\n \t\t\n \t\ttoDoList.set(count, t);\n \t}\n \tcount ++;\n }\n \t\n System.out.println(toDoList);\n\tdisplay();\n }", "public void updateTask() {}", "public void setTaskID(java.lang.Object taskID) {\n this.taskID = taskID;\n }", "public JBombardierAntTask(Task owner) {\r\n bindToOwner(owner);\r\n }", "public DoneCommand(int taskNum) {\n this.taskNum = taskNum;\n }", "void TaskFinished(Task task) {\n\n repository.finishTask(task);\n }", "public void setDone(boolean done) {\n this.done = done;\n }", "public void setDone(boolean done) {\n this.done = done;\n }", "@Override\n public void completeFlower(@NonNull String taskId) {\n }", "public void markAsDone() {\n this.isDone = true;\n this.completed = \"1\";\n }", "public void setDone(boolean done) {\n this.done = done;\n }", "@Override\n\tpublic void addTask(Task task) {\n\t\t\n\t}", "public void completeTask()\n throws NumberFormatException, NullPointerException, IndexOutOfBoundsException {\n System.out.println(LINEBAR);\n try {\n int taskNumber = Integer.parseInt(userIn.split(\" \")[TASK_NUMBER]);\n\n int taskIndex = taskNumber - 1;\n\n tasks.get(taskIndex).markAsDone();\n storage.updateFile(tasks.TaskList);\n System.out.println(\"Bueno! The following task is marked as done: \\n\" + tasks.get(taskIndex));\n } catch (NumberFormatException e) {\n ui.printNumberFormatException();\n } catch (NullPointerException e) {\n ui.printNullPtrException();\n } catch (IndexOutOfBoundsException e) {\n ui.printIndexOOBException();\n }\n System.out.println(LINEBAR);\n }", "public void task(Task task) throws JolRuntimeException {\n\t\ttry {\n\t\t\tthis.taskQueue.put(task);\n\t\t} catch (InterruptedException e) {\n\t\t\tthrow new JolRuntimeException(e);\n\t\t}\n\t}", "public void markAsDone() throws TaskAlreadyDoneException {\n if (!this.isDone) {\n this.isDone = true;\n } else {\n throw new TaskAlreadyDoneException();\n }\n }", "@Override\n\tpublic void addTask(Teatask ta)\n\t{\n\t\tteataskMapper.addTask(ta);\n\t}", "public void setDone(boolean done) {\n \tthis.done = done;\n }", "@Override\n public void execute(TaskList taskList, UI ui, Storage storage) throws DukeException {\n\n super.execute(taskList, ui, storage);\n checkValidity();\n\n Task doneTask = taskList.getTaskByIndex(Integer.parseInt(this.descriptionOfTask.trim()) - 1);\n doneTask.markAsDone();\n ui.displayDone(doneTask);\n storage.saveToDataFile(taskList);\n\n }", "public void completeTask() {\n completed = true;\n }", "void setTaskOwner(ConversationalObject taskOwner);", "public void setDone(boolean done) {\n\t\tthis.done = done;\n\t\t\n\t}", "public void markAsDone(){\n isDone = true;\n }", "private synchronized void startTask(Task task) {\n if (_scheduledTasks.get(task.table) == task) {\n _scheduledTasks.remove(task.table);\n }\n _runningTask = task;\n }", "protected void teardownTask(Task task) {\n }", "public void setDone(boolean value) {\n this.done = value;\n }", "public void uncheckTask() {\n isDone = false;\n }", "public void markAsDone() {\n this.isDone = true;\n\n }", "void deleteDoneTask(ReadOnlyTask floatingTask) throws TaskNotFoundException;", "@Override\n public void execute(TaskList tasks, Storage storage) throws DukeException {\n this.task = tasks.doneTask(storage, this.index);\n }", "public void markAsDone() {\n isDone = true;\n }", "public void markAsDone() {\n isDone = true;\n }", "public void markAsDone() {\n isDone = true;\n }", "private void setTaskNothing(ITaskCluster taskCluster, ICommonTask task, Object taskServiceResult, Throwable throwable) {\n getTaskManagerConfiguration().getTaskManagerWriter().saveNothingTask(taskCluster, task, taskServiceResult, throwable);\n\n onNothingTasks(taskCluster, Collections.singletonList(task));\n }", "public void markAsDone() {\n this.done = true;\n }", "@Override\n\t\tpublic void setTaskName(String arg0) {\n\n\t\t}", "Task(String description, boolean isDone) throws DateTimeException {\n this.description = description;\n this.isDone = isDone;\n }", "public Task(String description, boolean done) {\r\n this.description = description;\r\n this.isDone = done;\r\n }", "public void setDone(int done) {\n\t\tthis.done = done;\n\t}", "public Task(String name, boolean isDone) {\n this.name = name;\n this.isDone = isDone;\n }", "public void editTask(String newTask) {\n task = newTask;\n }", "protected void markAsDone() {\n isDone = true;\n }", "@Override\n public String execute() throws DukeCommandException {\n try {\n ToDo toDo = taskManager.addToDo(this.desc);\n Storage.saveTasks(taskManager.getTasks());\n return ui.constructAddMessage(toDo, taskManager.getTasksSize());\n } catch (DukeException e) {\n throw new DukeCommandException(\"todo\", desc, e.getMessage());\n }\n }", "public void resetTask() {\n if (ShulkerEntity.this.getAttackTarget() == null) {\n ShulkerEntity.this.updateArmorModifier(0);\n }\n\n }", "public void markAsDone() {\r\n this.isDone = true;\r\n }", "public void markAsDone() {\n this.isDone = true;\n }", "public void markAsDone() {\n this.isDone = true;\n }", "public void markAsDone() {\n this.isDone = true;\n }", "void pushToFirebase(Task task) {\n un_FirebaseRef_tasks.push().setValue(task);\n }", "public void resetTask() {\n super.resetTask();\n this.entity.setAggroed(false);\n this.seeTime = 0;\n this.attackTime = -1;\n this.entity.resetActiveHand();\n }", "public DoCommand(String toDo) {\n this.toDo = toDo;\n this.tracker = new MarkTaskUtil();\n }", "public void markDone() {\n isDone = true;\n }", "@Override\r\n\tpublic void setTaskName(String name) {\n\r\n\t}", "public void startTask() {\n\t}", "protected void postTask(Task __task) {\r\n\t\tlock.lock();\r\n\t\ttry {\r\n\t\t\ttaskList.addLast(__task);\r\n\t\t\tcondition.signalAll();\r\n\t\t} finally {\r\n\t\t\tlock.unlock();\r\n\t\t}\r\n\t}", "@Test\n\tpublic void updateTask() {\n\t\tfinal Date dueDate = new Date();\n\t\tfinal Template template = new Template(\"Template 1\");\n\t\ttemplate.addStep(new TemplateStep(\"Step 1\", 1.0));\n\t\tfinal Assignment asgn = new Assignment(\"Assignment 1\", dueDate, template);\n\t\tfinal Task task = new Task(\"Task 1\", 1, 1, asgn.getID());\n\t\tasgn.addTask(task);\n\t\t\n\t\tfinal String asgnId = asgn.getID();\n\t\t\n\t\ttry {\n\t\t\tStorageService.addTemplate(template);\n\t\t\tStorageService.addAssignment(asgn);\n\t\t} catch (final StorageServiceException e) {\n\t\t\tfail(e.getMessage());\n\t\t}\n\t\t\n\t\ttask.setPercentComplete(0.174);\n\t\tStorageService.updateTask(task);\n\t\t\n\t\tfinal Assignment afterAsgn = StorageService.getAssignment(asgnId);\n\t\tassertEquals(asgn.fullString(), afterAsgn.fullString());\n\t}", "public void setTaskId(UUID taskId) {\n this.taskId = taskId;\n }", "@Override\n\t\t\tpublic void setTaskName(String name) {\n\t\t\t\t\n\t\t\t}", "public void setCurrentTaskName(String name);", "@Override\n\tpublic void giveUpTask(long id, String taskId) {\n\t\tMap<String, Object> variables = new HashMap<>();\n\t\tvariables.put(\"outcome\", \"放弃\");\n\t\t// 根据任务ID去完成任务并指定流程变量\n\t\ttaskService.complete(taskId, variables);\n\t\t// 更新请假单信息\n\t\tLeavebill leave = leaveBillMapper.selectByPrimaryKey(id);\n\t\tleave.setState(0);//表示结束状态,但是请假不成功\n\t\tleaveBillMapper.updateByPrimaryKey(leave);\n\t\tSystem.out.println(\"任务已放弃\");\n\t}", "@Override\n public void saveTask(TaskEntity task) {\n this.save(task);\n }", "public TimedTask(String task) {\n this.task = task;\n timeStart = System.currentTimeMillis();\n }", "public Task(boolean isDone, String description) {\n this.description = description;\n this.isDone = isDone;\n }", "@Override\n public void execute(final Task<T> task) {\n }", "public void add(Task t)\n {\n\ttoDo.add(t);\n }", "public void updateTask() {\r\n int selected = list.getSelectedIndex();\r\n if (selected >= 0) {\r\n Task task = myTodo.getTaskByIndex(selected + 1);\r\n todoTaskGui(\"Update\", task);\r\n }\r\n }", "SetupTask(KaldiActivity activity) {\n this.activityReference = new WeakReference<>(activity);\n }", "@Override\n\tpublic void answer(Task t) {\n\t\t// TODO Auto-generated method stub\n\t\ttry {\n\t\t\tanswers.put(t);\n\t\t} catch (InterruptedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void pauseMyTask() {\n pause = true;\n }", "public void finishTask() {\n\t\t\n\t}", "public void CompleteTask() {\n\t\tCompletionDate = new Date();\n\t}", "public void run(Task task) {\n try {\n // inject before serializing, to check that all fields are serializable as JSON\n injectionService.injectMembers(task);\n\n String s = objectMapper.writeValueAsString(task);\n log.info(\"Executing \" + s);\n\n // inject after deserializing, for proper execution\n AbstractTask deserialized = objectMapper.readValue(s, AbstractTask.class);\n injectionService.injectMembers(deserialized);\n setupTask(task);\n\n try {\n ((AbstractTask)deserialized).run(this);\n incCompletedTaskCount(task.getQueueName());\n } finally {\n teardownTask(task);\n }\n\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }" ]
[ "0.71818554", "0.7028011", "0.68016356", "0.6696008", "0.653116", "0.64311975", "0.64230406", "0.6386578", "0.6351203", "0.6343776", "0.6255076", "0.62515134", "0.62498385", "0.6228714", "0.6181563", "0.61627024", "0.6162351", "0.60684246", "0.6056501", "0.60524416", "0.6025696", "0.6025696", "0.6025696", "0.60239464", "0.60223806", "0.6006918", "0.5990122", "0.5989982", "0.5988057", "0.59758526", "0.5965817", "0.5964199", "0.59600264", "0.5951732", "0.59472734", "0.593881", "0.593881", "0.5930789", "0.59233564", "0.5910333", "0.590286", "0.5882083", "0.5875835", "0.5872316", "0.5870487", "0.5864079", "0.58619094", "0.58616936", "0.5858724", "0.5847797", "0.58332133", "0.5826311", "0.5821685", "0.58052164", "0.58022827", "0.5786137", "0.5784797", "0.57816786", "0.5779162", "0.5779162", "0.5779162", "0.5767801", "0.5755619", "0.5751753", "0.57485676", "0.5743457", "0.57408744", "0.57401437", "0.5733055", "0.57329637", "0.57307196", "0.5727872", "0.5725047", "0.5711615", "0.5711615", "0.5711615", "0.57081324", "0.5696712", "0.5694897", "0.56920445", "0.5688369", "0.56859994", "0.56803995", "0.565149", "0.5647686", "0.5647395", "0.5637296", "0.5637191", "0.563577", "0.562921", "0.5628867", "0.56272006", "0.56269044", "0.56265587", "0.56258273", "0.5619208", "0.56168896", "0.5615444", "0.5613803", "0.5605118" ]
0.61767673
15
Converts whether task is done or not to a status. + symbols means done symbol means not done
private String getStatusIcon() { return (isDone ? "+" : "-"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getStatus() {\n return isDone ? \"1\" : \"0\";\n }", "private static String getStatus(Task task) {\n Status myStatus = task.getStatus();\n if (myStatus == Status.UP_NEXT) {\n return \"UP_NEXT\";\n } else if (myStatus == Status.IN_PROGRESS) {\n return \"IN_PROGRESS\";\n } else {\n return myStatus.toString();\n }\n }", "TaskStatus getStatus();", "public String getIsDone() {\n if (isDone) {\n return \"1\";\n } else {\n return \"0\";\n }\n }", "public String getDone() {\n return (isDone ? \"1\" : \"0\");\n }", "@Test\n public void setStatusDone_shouldReturnTrueForStatus() {\n Task task = new Task(\"Test\");\n task.setStatusDone();\n Assertions.assertTrue(task.getStatus());\n }", "public boolean getDoneStatus(){\n return isDone;\n }", "public boolean isDone(){\n return status;\n }", "public void setDone(){\n this.status = \"Done\";\n }", "public String determineTaskDoneStatusFromFileLine(String line) {\n int indexOfFirstSquareBracket = line.indexOf(\"[\");\n String doneStatus = String.valueOf(line.charAt(indexOfFirstSquareBracket + 1));\n assert (doneStatus.equals(\"V\") || doneStatus.equals(\"X\")) : \"Done status can only be X or V\";\n return doneStatus;\n }", "void setStatus(TaskStatus status);", "public String getStatusIcon() {\n return (isDone ? \"X\" : \" \"); //mark done task with X\n }", "public String markDone() {\n this.isDone = true;\n return String.format(\"Nice! I've marked this task as done:\\n [X] %s\", this.description);\n }", "com.lvl6.proto.EventQuestProto.QuestRedeemResponseProto.QuestRedeemStatus getStatus();", "public static boolean toggleComplete(Task task) {\n Boolean complete = task.getCompleted(); // Get the current value\n\n // TOGGLE COMPLETE\n if (complete) // store the opposite of the current value\n complete = false;\n else\n complete = true;\n try{\n String query = \"UPDATE TASK SET ISCOMPLETE = ? WHERE (NAME = ? AND COLOUR = ? AND DATE = ?)\"; // Setup query for task\n PreparedStatement statement = DatabaseHandler.getConnection().prepareStatement(query); // Setup statement for query\n statement.setString(1, complete.toString()); // Store new isCompleted value\n statement.setString(2, task.getName()); // store values of task\n statement.setString(3, task.getColor().toString());\n statement.setString(4, Calendar.selectedDay.getDate().toString());\n int result = statement.executeUpdate(); // send out the statement\n if (result > 0){ // If swapped successfully, re-load the tasks\n getMainController().loadTasks(); // Reload the task list to update the graphics.\n }\n return (result > 0);\n } catch (SQLException e) {\n e.printStackTrace(); // If task was unable to be edited\n e.printStackTrace(); // Create alert for failing to edit\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setHeaderText(null);\n alert.setContentText(\"Unable to edit task.\");\n alert.showAndWait();\n }\n return false;\n }", "com.lvl6.proto.EventQuestProto.QuestProgressResponseProto.QuestProgressStatus getStatus();", "public void updateTaskStatus(CaptureTask task, String status, String description) {\n\t\t\r\n\t}", "java.lang.String getStatus();", "java.lang.String getStatus();", "java.lang.String getStatus();", "java.lang.String getStatus();", "public boolean getStatus() {\n return this.isDone;\n }", "public boolean is_completed();", "public String printDone(Task task) {\n return \"´ ▽ ` )ノ Nice! I've marked this task as done:\\n\"\n + \"[\" + task.getStatusIcon() + \"]\" + task.getDescription() + \"\\n\";\n }", "private String getStatusIcon() {\n return this.isDone ? \"X\" : \"\";\n }", "public ToDoBuilder addStatus(String status) {\n this.completed = Boolean.parseBoolean(status);\n return this;\n }", "private void handleMarkDone()\n throws InvalidTaskDisplayedException, DuplicateTaskException {\n Status done = new Status(true);\n ArrayList<ReadOnlyTask> markDoneTasks = tracker.getTasksFromIndexes(\n model, this.toDo.split(StringUtil.STRING_WHITESPACE), done);\n model.mark(markDoneTasks, done);\n }", "public Task markAsDone() {\n isDone = true;\n status = \"\\u2713\"; // A tick symbol indicating the task is done.\n\n return this;\n }", "public ToDoTask(String description, int id, int status) {\n super(description, id);\n super.isDone = status > 0;\n }", "protected String getStatusIcon() {\n return isDone ? \"x\" : \" \";\n }", "public boolean isDone();", "public boolean isDone();", "public void markAsDone() {\n this.isDone = true;\n this.completed = \"1\";\n }", "private String evaluateCheckStatus(CheckStatus status) {\n switch (status) {\n case AWAITING:\n return \"color: blue !important;\";\n case DECLINED:\n return \"color: #DC143C !important;\";\n case PAID:\n return \"color: #449d44 !important;\";\n default:\n return \"\";\n }\n }", "public void checkOffTask() {\n isDone = true;\n }", "public String geraStatus() {\r\n\t\tString statusComplemento = \"\";\r\n\t\tif (this.temProcesso() == false) {\r\n\t\t\treturn \"Nenhum processo\\n\";\r\n\t\t} else {\r\n\t\t\tfor (int i = 0; i < this.escalonadores.size(); i++) {\r\n\t\t\t\tif (i > 0) {\r\n\t\t\t\t\tstatusComplemento += \" \";\r\n\t\t\t\t}\r\n\t\t\t\tstatusComplemento += i + 1 + \" - \";\r\n\t\t\t\tif (this.escalonadores.get(i).temProcesso()) {\r\n\t\t\t\t\tstatusComplemento += this.escalonadores.get(i).geraStatusComplemento();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstatusComplemento += \"\\n\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn statusComplemento;\r\n\t}", "public String getStatusIcon() {\n return (isDone? \"v\" : \"x\");\n }", "public String getStatusIcon() {\n return (isDone ? \"X\" : \" \");\n }", "boolean isDone();", "public String getStatus()\r\n {\n return (\"1\".equals(getField(\"ApprovalStatus\")) && \"100\".equals(getField(\"HostRespCode\")) ? \"Approved\" : \"Declined\");\r\n }", "public ServiceTaskStatus getStatus() {\n\t\treturn this.status;\n\t}", "public void toggleDone() {\n this.done = !this.done;\n }", "public String markAsDone() {\n this.isComplete = true;\n return Ui.getTaskDoneMessage(this);\n }", "public void edit_task_completion(boolean completion_status)\n {\n task_completion_boolean = completion_status;\n }", "private int[] getTaskCountByStatus() {\n int[] counts = new int[2];\n int doneCount = 0;\n int toDoCount = 0;\n for (Task t : taskStore) {\n if (t.getIsDone()) {\n doneCount++;\n } else {\n toDoCount++;\n }\n }\n counts[0] = toDoCount;\n counts[1] = doneCount;\n return counts;\n }", "public void setStatus(ServiceTaskStatus status) {\n\t\tthis.status = status;\n\t}", "public String getStatusIcon(){\n return (isDone ? \"\\u2713\" : \"\\u2718\");\n }", "public String getStatusIcon() {\r\n return (isDone ? \"\\u2718\" : \" \");\r\n }", "@Override\n public String toString()\n {\n\n // IF TASK IS MARKED AS COMPLETE\n if(task_completion_boolean)\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return \"*** \" + String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return \"*** \" + String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END if\n\n /***********************************************************/\n\n // OTHERWISE, TASK IS NOT COMPLETE\n else\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END else\n\n }", "public boolean isDone()\r\n/* 69: */ {\r\n/* 70:106 */ return isDone0(this.result);\r\n/* 71: */ }", "@Override\n\tpublic boolean done() {\n\t\tfor(Task t : details.getPendingTasks()){\n\t\t\tif(!t.isComplete())\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private String evaluateStatus(Status status) {\n switch (status) {\n case PENDING:\n return \"color: blue !important;\";// blue\n case DECLINED:\n return \"color: #DC143C !important;\";// red\n case CANCELED:\n return \"color: purple !important;\";// purple\n case RUNNING:\n return \"color: darkcyan !important;\";// cyan\n case COMPLETE:\n return \"color: #449d44 !important;\";// lime\n default:\n return \"\";\n }\n }", "String getStatus();", "String getStatus();", "String getStatus();", "String getStatus();", "String getStatus();", "public String getStatusIcon() {\n return isDone\n ? \"\\u2713\"\n : \"\\u2718\";\n }", "public void updateStatus() {\n var taskStatuses = new ArrayList<OptimizationTaskStatus>();\n\n synchronized (tasks) {\n for (var task : tasks.values()) {\n taskStatuses.add(task.getStatus());\n }\n }\n\n wrapper.setStatus(JsonSerializer.toJson(new OptimizationToolStatus(taskStatuses)));\n }", "@Override\n public String getStatusIcon() {\n if (isDone) {\n return \"[X]\";\n } else {\n return \"[ ]\";\n }\n }", "public boolean isDone(){\n return done;\n }", "public String getStatusIcon() {\n return (isDone ? \"✓\" : \"✘\"); //return tick or X symbols\n }", "public String getPlayerTaskProgressText(int task) {\n\t\tString questtype = taskType.get(task);\n\t\tint taskprogress = getPlayerTaskProgress(task);\n\t\tint taskmax = getTaskAmount(task);\n\t\tString taskID = getTaskID(task);\n\t\tString message = null;\n\t\t\n\t\t//Convert stuff to task specifics\n\t\t//Quest types: Collect, Kill, Killplayer, Killanyplayer, Destroy, Place, Levelup, Enchant, Tame, Goto\n\t\tif(questtype.equalsIgnoreCase(\"killplayer\")){ questtype = \"Kill\"; }\n\t\tif(questtype.equalsIgnoreCase(\"killanyplayer\")){ questtype = \"Kill\"; }\n\t\tif(questtype.equalsIgnoreCase(\"levelup\")){ questtype = \"Level up\"; }\n\t\tif(questtype.equalsIgnoreCase(\"goto\")){ questtype = \"Go to\"; }\n\t\t\n\t\tif(questtype.equalsIgnoreCase(\"level up\")){ taskID = \"times\"; }\n\t\tif(questtype.equalsIgnoreCase(\"Go to\")){ taskID = getTaskID(task).split(\"=\")[2]; }\n\t\tif(questtype.equalsIgnoreCase(\"collect\")||\n\t\t\t\tquesttype.equalsIgnoreCase(\"destroy\")||\n\t\t\t\tquesttype.equalsIgnoreCase(\"place\")||\n\t\t\t\tquesttype.equalsIgnoreCase(\"enchant\")||\n\t\t\t\tquesttype.equalsIgnoreCase(\"craft\")||\n\t\t\t\tquesttype.equalsIgnoreCase(\"smelt\")){ \n\t\t\ttaskID = taskID.toLowerCase().replace(\"_\", \" \");\n\t\t}\n\t\t\n\t\t//Capitalize first letter (questtype)\n\t\tquesttype = WordUtils.capitalize(questtype);\n\t\t\n\t\t//Change certain types around for grammatical purposes\n\t\tif(getPlayerTaskCompleted(task)){\n\t\t\tif(questtype.equalsIgnoreCase(\"collect\")){ questtype = \"Collected\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"kill\")){ questtype = \"Killed\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"killplayer\")){ questtype = \"Killed\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"killanyplayer\")){ questtype = \"Killed\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"destroy\")){ questtype = \"Destroyed\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"place\")){ questtype = \"Placed\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"levelup\")){ questtype = \"Leveled up\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"enchant\")){ questtype = \"Enchant\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"tame\")){ questtype = \"Tamed\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"craft\")){ questtype = \"Crafted\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"smelt\")){ questtype = \"Smelted\"; }\n\t\t\tif(questtype.equalsIgnoreCase(\"goto\")){ questtype = \"Went to\"; }\n\t\t\t\n\t\t\t//Create the message if the task is finished\n\t\t\tif(!questtype.equalsIgnoreCase(\"go to\")){\n\t\t\t\tmessage = ChatColor.GREEN + questtype + \" \" + taskmax + \" \" + taskID + \".\";\n\t\t\t} else {\n\t\t\t\tmessage = ChatColor.GREEN + questtype + \" \" + taskID + \".\";\n\t\t\t}\n\t\t}else{\n\t\t\tif(!questtype.equalsIgnoreCase(\"go to\")){\n\t\t\t\tmessage = ChatColor.RED + questtype + \" \" + taskprogress + \"/\" + taskmax + \" \" + taskID + \".\";\n\t\t\t}else{\n\t\t\t\tmessage = ChatColor.RED + questtype + \" \" + taskID + \".\";\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Return message\n\t\treturn message;\n\t}", "@Override\n\tpublic Collection<TaskStatus> getTaskStatus(){\n \tcheckInitialized();\n \t\n \t@SuppressWarnings(\"unchecked\")\n\t\tCollection<Collection<TaskStatus>> statusTree=Collections.EMPTY_LIST;\n \tfinal MultiTask<Collection<TaskStatus>> mtask;\n \ttry {\n\t\t\t mtask = breeder.executeCallable(new GetTaskStatus(this));\n\t\t\t statusTree = mtask.get();\n \t} catch (ExecutionException ex){\n \t\tlog.fatal(\"Could not get status of tasks for job \"+this.getId(), ex);\n \t} catch(InterruptedException ex) {\n \t\tlog.fatal(\"Could not get status of tasks for job \"+this.getId(), ex);\n \t}\n\t\t\t\n\t\t// Flatten into single collection\n\t\tList<TaskStatus> result = new ArrayList<TaskStatus>((int)(statusTree.size()*this.getThreadCount()));\n\t\tfor(Collection<TaskStatus> statusForNode: statusTree) {\n\t\t\tresult.addAll(statusForNode);\n\t\t}\n\t\t\n\t\treturn result;\n \n\t}", "@DISPID(18)\r\n\t// = 0x12. The runtime will prefer the VTID if present\r\n\t@VTID(20)\r\n\tjava.lang.String completionStatus();", "@Test\n\tpublic void testDoneCommand2() {\n\t\tString label = \"TEST\";\n\t\ttestData.getTaskMap().put(label, new ArrayList<Task>());\n\t\ttestData.addTask(new Task(1, label , \"Task 1\",\n\t\t\t\tnew TDTDateAndTime(), false));\n\t\ttestData.addTask(new Task(2, label, \"Task 2\",\n\t\t\t\tnew TDTDateAndTime(), false));\n\t\ttestData.addTask(new Task(3, label, \"Task 3\",\n\t\t\t\tnew TDTDateAndTime(), false));\n\n\t\tDoneCommand comd = new DoneCommand(label, 3);\n\t\tassertEquals(DoneCommand.MESSAGE_DONE_TASK_FEEDBACK, comd.execute(testData));\n\n\t\tArrayList<Task> taskList = testData.getTaskListFromLabel(label);\n\t\tassertEquals(3, taskList.size());\n\t\tassertTrue(taskList.get(2).isDone());\n\t\tassertFalse(taskList.get(0).isDone());\n\t\tassertFalse(taskList.get(1).isDone());\n\t}", "@Schema(example = \"completed\", required = true, description = \"Contract labeling status (completed, processing, failed, cancelled)\")\n public String getStatus() {\n return status;\n }", "public TaskStatus getStatus(String requestId) {\r\n TaskStatus toReturn = new TaskStatus();\r\n if (null == requestId || 0 == requestId.length()) {\r\n setError(\"APIL_0100\", \"argument's not valid.\");\r\n return toReturn;\r\n }\r\n\r\n String[] paramFields = {};\r\n SocketMessage request = new SocketMessage(\"admin\", \"status\",\r\n SocketMessage.PriorityType.EMERGENCY, SocketMessage.TransferType.BI_WAY, requestId, paramFields);\r\n\r\n SocketMessage response = handleMessage(request);\r\n\r\n if (!isSuccessful(response)) {\r\n if (\"\".equals(response.getErrorCode())) {\r\n setError(\"APIL_0211\", \"couldn't get task status: task_id=\" + requestId);\r\n } else {\r\n wrapError(\"APIL_0211\", \"couldn't get task status: task_id=\" + requestId);\r\n }\r\n toReturn.setStatus(EnumTaskStatus.FAILED);\r\n toReturn.setErrorCode(getErrorCode());\r\n toReturn.setMessage(getErrorMessage());\r\n return toReturn;\r\n }\r\n\r\n toReturn.setRequestId(response.getRequestId());\r\n toReturn.setStatus(response.getValue(\"task_status\").trim());\r\n toReturn.setTaskType(response.getValue(\"task_type\").trim());\r\n toReturn.setPercent(Tools.parseDouble(response.getValue(\"percentage\")));\r\n toReturn.setStartTime(Tools.parseTime(response.getValue(\"start_time\")));\r\n toReturn.setEndTime(Tools.parseTime(response.getValue(\"end_time\")));\r\n toReturn.setEstimatedTime(Tools.parseTime(response.getValue(\"estimated_time\")));\r\n toReturn.setMessage(response.getValue(\"message\"));\r\n toReturn.setErrorCode(response.getValue(\"error_code\"));\r\n\r\n return toReturn;\r\n }", "public void setDone(boolean value) {\n this.done = value;\n }", "public java.lang.CharSequence getStatus() {\n return status;\n }", "public JobStatus getStatus();", "T getStatus();", "public boolean isDone() { return true; }", "public String getDoneCode() {\n return doneCode;\n }", "@Test\n\tpublic void testDoneCommand1() {\n\t\tString label = \"TEST\";\n\t\ttestData.getTaskMap().put(label, new ArrayList<Task>());\n\t\ttestData.addTask(new Task(1, label , \"Task 1\",\n\t\t\t\tnew TDTDateAndTime(), false));\n\t\ttestData.addTask(new Task(2, label, \"Task 2\",\n\t\t\t\tnew TDTDateAndTime(), false));\n\t\ttestData.addTask(new Task(3, label, \"Task 3\",\n\t\t\t\tnew TDTDateAndTime(), false));\n\n\t\tDoneCommand comd = new DoneCommand(label, 2);\n\t\tassertEquals(DoneCommand.MESSAGE_DONE_TASK_FEEDBACK, comd.execute(testData));\n\n\t\tArrayList<Task> taskList = testData.getTaskListFromLabel(label);\n\t\tassertEquals(3, taskList.size());\n\t\tassertTrue(taskList.get(1).isDone());\n\t\tassertFalse(taskList.get(0).isDone());\n\t\tassertFalse(taskList.get(2).isDone());\n\t}", "public java.lang.CharSequence getStatus() {\n return status;\n }", "public String getStatusString() {\n String str = \"\";\n switch (actualStep) {\n case wait: { str = \"WAIT\"; break; }\n case press: { str = \"PRESS\"; break; }\n case hold: { str = \"HOLD\"; break; }\n case release: { str = \"RELEASE\"; break; }\n }\n return str;\n }", "String status();", "String status();", "@DISPID(15)\n\t// = 0xf. The runtime will prefer the VTID if present\n\t@VTID(25)\n\tjava.lang.String status();", "com.google.protobuf.ByteString getStatus();", "public boolean checkComplete(){\n return Status;\n }", "@Override\n\tpublic int getStatus(Integer id) {\n\t\tint status = taxTaskDao.getStatus(id);\n\t\treturn status;\n\t}", "@Override\n\tpublic DeploymentStatus getStatus() {\n\t\tint completedCount = 0;\n\t\tfor (Transition t : this.getTransitions()) {\n\t\t\tswitch (t.getStatus()) {\n\t\t\t\tcase STARTED:\n\t\t\t\t\treturn DeploymentStatus.STARTED;\n\t\t\t\tcase ERRORED:\n\t\t\t\t\treturn DeploymentStatus.ERRORED;\n\t\t\t\tcase COMPLETED:\n\t\t\t\t\tcompletedCount++;\n\t\t\t\tcase NOT_STARTED:\n\t\t\t\t\t//Nothing to do.\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (completedCount == this.getTransitions().size()) {\n\t\t\treturn DeploymentStatus.COMPLETED;\n\t\t}\n\t\treturn DeploymentStatus.NOT_STARTED;\n\t}", "boolean getTaskResultAfterDone(ManagedObjectReference task)\n throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg,\n InvalidCollectorVersionFaultMsg {\n\n boolean retVal = false;\n\n // info has a property - state for state of the task\n Object[] result =\n waitForValues.wait(task, new String[]{\"info.state\", \"info.error\"},\n new String[]{\"state\"}, new Object[][]{new Object[]{\n TaskInfoState.SUCCESS, TaskInfoState.ERROR}});\n\n if (result[0].equals(TaskInfoState.SUCCESS)) {\n retVal = true;\n }\n if (result[1] instanceof LocalizedMethodFault) {\n throw new RuntimeException(\n ((LocalizedMethodFault) result[1]).getLocalizedMessage());\n }\n return retVal;\n }", "public boolean getDone(){\r\n\t\treturn done;\r\n\t}", "public String showDone(Task task) {\n String response = \"\";\n response += showLine();\n response += \"Nice! I've marked this task as done:\" + System.lineSeparator();\n response += \" \" + task + System.lineSeparator();\n response += showLine();\n return response;\n }", "protected String status() {\n if (!hasStarted() && !hasRun()) {\n return \" not run yet\";\n } else if (hasStarted() && !hasRun()) {\n return \" failed to run\";\n } else if (!hasStarted() && hasRun()) {\n return \" ILLEGAL STATE\";\n } else if (exceptionThrown == null) {\n return \" returned: \" + StringsPlume.toStringAndClass(retval);\n } else {\n return \" threw: \" + exceptionThrown;\n }\n }", "public String getStatusIcon() {\n return (isDone ? \"/\" : \"X\"); // Return / or X symbols\n }", "EntryStatus getStatus();", "private String getStatusMessage() {\n\t\treturn (m_isTestPassed == true) ? \" successfully...\" : \" with failures...\";\n\t}", "com.lvl6.proto.EventQuestProto.QuestAcceptResponseProto.QuestAcceptStatus getStatus();", "public boolean isDone() { return false; }", "private String processPaymentStatus() {\n\t\treturn new Random().nextBoolean() ? \"success\" : \"failure\";\n\t}", "private synchronized boolean changeTaskState(String taskKey, SchedulerTaskState newState)\n {\n if (timer == null)\n return false;\n \n // the task has already been canceled\n SchedulerTimerTask timerTask = (SchedulerTimerTask) scheduledTimerTasks.get(taskKey);\n if (null == timerTask)\n {\n return false;\n }\n \n // and write changed state to internal db if needed\n if (timerTask.schedulerTask.isVisible())\n {\n IDataAccessor accessor = AdminApplicationProvider.newDataAccessor();\n IDataTransaction transaction = accessor.newTransaction();\n try\n {\n IDataTable table = accessor.getTable(Enginetask.NAME);\n table.qbeClear();\n table.qbeSetKeyValue(Enginetask.schedulerid, getId());\n table.qbeSetKeyValue(Enginetask.taskid, timerTask.schedulerTask.getKey());\n if (table.search() > 0)\n {\n IDataTableRecord record = table.getRecord(0); \n record.setValue(transaction, Enginetask.taskstatus, newState.getName());\n transaction.commit();\n }\n }\n catch (Exception ex)\n {\n if (logger.isWarnEnabled())\n {\n logger.warn(\"Could not update task in DB: \" + timerTask.schedulerTask, ex);\n }\n }\n finally\n {\n\t\t\t\ttransaction.close();\n\t\t\t}\n }\n return timerTask.schedulerTask.setState(newState);\n }", "public String markAsDone(int index) {\n USER_TASKS.get(index).markAsDone();\n return \" \" + USER_TASKS.get(index).toString();\n }", "OperationStatusType status();", "public String getStatusIcon() {\n return (isDone ? \"[X]\" : \"[ ]\");\n }", "public retStatus Status(){\n // Your code here\n this.mutex.lock();\n\n retStatus r = new retStatus(State.Pending, this.values.get(this.me));\n if (done) {\n r.state = State.Decided;\n }\n\n this.mutex.unlock();\n return r;\n }", "com.polytech.spik.protocol.SpikMessages.Status getStatus();" ]
[ "0.70748615", "0.69444174", "0.6917158", "0.6550039", "0.64795375", "0.63951546", "0.63346833", "0.62858784", "0.6142251", "0.61319554", "0.60298777", "0.60006696", "0.59567076", "0.58739954", "0.5846445", "0.57982326", "0.5783803", "0.57679725", "0.57679725", "0.57679725", "0.57679725", "0.57532835", "0.57486826", "0.57392234", "0.5711904", "0.5655203", "0.56222343", "0.56133085", "0.56069386", "0.55906594", "0.5581831", "0.5581831", "0.55565", "0.5555541", "0.55487746", "0.55385226", "0.5528542", "0.55100334", "0.5509518", "0.5506556", "0.5499584", "0.54740095", "0.5470432", "0.54593915", "0.54540175", "0.5427249", "0.54167694", "0.5416003", "0.54014194", "0.53971654", "0.5393004", "0.53927577", "0.5377078", "0.5377078", "0.5377078", "0.5377078", "0.5377078", "0.5371462", "0.53447783", "0.53290176", "0.5327338", "0.5320262", "0.53183293", "0.5317534", "0.531184", "0.531037", "0.5298648", "0.529771", "0.5277566", "0.5276657", "0.52734286", "0.52728325", "0.5271791", "0.5264907", "0.52592784", "0.5255317", "0.52542156", "0.5251491", "0.5251491", "0.5240087", "0.5238505", "0.52366483", "0.52265805", "0.52178276", "0.5213201", "0.5208362", "0.520805", "0.5205639", "0.5199011", "0.5181367", "0.5176347", "0.51567787", "0.515488", "0.5154819", "0.51502424", "0.5147894", "0.514024", "0.5132287", "0.5126226", "0.5124716" ]
0.58162415
15
Gets the String representation of the task.
@Override public String toString() { return "[" + getStatusIcon() + "] " + getDescription(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String toString() {\n\n\t\tString output = \"\";\n\n\t\tfor (Task i : tasks) {\n\t\t\toutput += i.toString() + \"\\n \\n\";\n\t\t}\n\n\t\treturn output;\n\t}", "public String pendingToString() {\n InterruptibleTask interruptibleTask = this.task;\n if (interruptibleTask == null) {\n return super.pendingToString();\n }\n StringBuilder stringBuilder = new StringBuilder(\"task=[\");\n stringBuilder.append(interruptibleTask);\n stringBuilder.append(\"]\");\n return stringBuilder.toString();\n }", "public String toString() {\n String s = \"\";\n for (int i = 0; i < size; i++) {\n s += taskarr[i].gettitle() + \", \" + taskarr[i].getassignedTo()\n + \", \" + taskarr[i].gettimetocomplete()\n + \", \" + taskarr[i].getImportant() + \", \" + taskarr[i].getUrgent()\n + \", \" + taskarr[i].getStatus() + \"\\n\";\n }\n return s;\n }", "public String toString() {\n String str = \"\";\n for (int i = 0; i < size; i++) {\n str += tasks[i].toString() + \"\\n\";\n }\n return str;\n }", "public String getTaskName() {\n Object ref = taskName_;\n if (!(ref instanceof String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n taskName_ = s;\n return s;\n } else {\n return (String) ref;\n }\n }", "public String getString() {\n assert tasks != null : \"tasks cannot be null\";\n StringBuilder str = new StringBuilder();\n for (int i = 1; i < parts.length; i++) {\n str.append(\" \");\n str.append(parts[i]);\n }\n String taskString = str.toString();\n Todo todo = new Todo(taskString);\n tasks.add(todo);\n return Ui.showAddText() + todo.toString() + tasks.getSizeString();\n }", "public String getTask() {\n return task;\n }", "public String getTask() {\n return task;\n }", "public String getTaskName() {\n Object ref = taskName_;\n if (ref instanceof String) {\n return (String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n taskName_ = s;\n return s;\n }\n }", "public abstract String taskToText();", "@Override\n public String toString() {\n if (timeEnd == null) {\n stop();\n }\n return task + \" in \" + (timeEnd - timeStart) + \"ms\";\n }", "@Override\n public String toString() {\n return \"Task no \"+id ;\n }", "@Override\n public String toString()\n {\n\n // IF TASK IS MARKED AS COMPLETE\n if(task_completion_boolean)\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return \"*** \" + String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return \"*** \" + String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END if\n\n /***********************************************************/\n\n // OTHERWISE, TASK IS NOT COMPLETE\n else\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END else\n\n }", "public String getTaskId() {\n Object ref = taskId_;\n if (!(ref instanceof String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n taskId_ = s;\n return s;\n } else {\n return (String) ref;\n }\n }", "public String taskName() {\n return this.taskName;\n }", "public void tostring(){\n\t\tfor(int i=0;i<taskList.size();i++){\n\t\t\tSystem.out.println(taskList.get(i).getPrint()); \n\t\t}\n\t}", "public String getTaskId() {\n Object ref = taskId_;\n if (ref instanceof String) {\n return (String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n taskId_ = s;\n return s;\n }\n }", "@Override\n public String toString()\n {\n if(!isActive()) return \"Task \" + title + \" is inactive\";\n else\n {\n if(!isRepeated()) return \"Task \" + title + \" at \" + time;\n else return \"Task \" + title + \" from \" + start + \" to \" + end + \" every \" + repeat + \" seconds\";\n }\n }", "public String get_task_description()\n {\n return task_description;\n }", "com.google.protobuf.ByteString\n getTaskNameBytes();", "public com.google.protobuf.ByteString\n getTaskNameBytes() {\n Object ref = taskName_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n taskName_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTaskNameBytes() {\n Object ref = taskName_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n taskName_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getTaskName();", "@Override\n public String toString() {\n return \"[\" + this.getStatusIcon() + \"] \" + this.taskDescription;\n }", "@Override\n public String toString() {\n return \"[\" + this.getStatusIcon() + \"] \" + this.taskDescription;\n }", "public String getTaskName() {\n return this.taskDescription;\n }", "public com.google.protobuf.ByteString\n getTaskIdBytes() {\n Object ref = taskId_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n taskId_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getTaskIdBytes() {\n Object ref = taskId_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n taskId_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getTaskName() {\n return taskName;\n }", "public String getTaskName() {\n return taskName;\n }", "public String getTaskName() {\n return taskName;\n }", "public String getTaskName() {\n return taskName;\n }", "String getTaskName();", "String getTaskName();", "public String getTasks() {\n StringJoiner result = new StringJoiner(\"\\n\");\n for (int i = 0; i < tasks.size(); i++) {\n Task t = tasks.get(i);\n result.add(String.format(\"%d.%s\", i + 1, t));\n }\n\n return result.toString();\n }", "public String getTaskName(){\r\n\t\treturn this.taskName;\r\n\t}", "@Override\r\n public String toString()\r\n {\r\n return taskName + \",\" + dueDate + \"\";\r\n }", "public String GiveTask(){\n return \"[\" + getStatusIcon() + \"] \" + this.description;\n }", "public String getName()\r\n {\r\n return taskName;\r\n }", "private String getTaskName() {\n \n \t\treturn this.environment.getTaskName() + \" (\" + (this.environment.getIndexInSubtaskGroup() + 1) + \"/\"\n \t\t\t+ this.environment.getCurrentNumberOfSubtasks() + \")\";\n \t}", "public String getTask(){\n\treturn task;\n}", "public String getTaskWithoutType() {\n String out = \"\";\n for (int i = 1; i < commandSeparate.length; i++) {\n out += i == commandSeparate.length - 1\n ? commandSeparate[i] : commandSeparate[i] + \" \";\n }\n return out;\n }", "@Override\n public String toString() {\n\treturn \"Primzahlen von Task \" + taskID + \" \" + primzahlenListe;\n }", "protected String getTaskId() {\n\t\tDisplay.debug(\"getTaskId() devuelve %s\", taskId);\n\t\treturn taskId;\n\t}", "public java.lang.String getTaskId() {\n return taskId;\n }", "public java.lang.String getTaskId() {\n return taskId;\n }", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getBundleId() != null)\n sb.append(\"BundleId: \").append(getBundleId()).append(\",\");\n if (getBundleTaskError() != null)\n sb.append(\"BundleTaskError: \").append(getBundleTaskError()).append(\",\");\n if (getInstanceId() != null)\n sb.append(\"InstanceId: \").append(getInstanceId()).append(\",\");\n if (getProgress() != null)\n sb.append(\"Progress: \").append(getProgress()).append(\",\");\n if (getStartTime() != null)\n sb.append(\"StartTime: \").append(getStartTime()).append(\",\");\n if (getState() != null)\n sb.append(\"State: \").append(getState()).append(\",\");\n if (getStorage() != null)\n sb.append(\"Storage: \").append(getStorage()).append(\",\");\n if (getUpdateTime() != null)\n sb.append(\"UpdateTime: \").append(getUpdateTime());\n sb.append(\"}\");\n return sb.toString();\n }", "public java.lang.String getTaskId() {\n return taskId;\n }", "public java.lang.String getTaskId() {\n return taskId;\n }", "String getTaskId();", "public String get_task_title()\n {\n return task_title;\n }", "public String addTask(Task t) {\n tasks.add(t);\n return tasks.get(tasks.size() - 1).toString();\n }", "@Test\n\tpublic void testToString() {\n\t\tSystem.out.println(\"toString\");\n\t\tDeleteTask task = new DeleteTask(1);\n\t\tassertEquals(task.toString(), \"DeleteTask -- [filePath=1]\");\n\t}", "com.google.protobuf.ByteString\n getTaskIdBytes();", "static String getReadableTask(int taskTypeRepresentation) {\n return taskDetails.get(taskTypeRepresentation).getDescription();\n }", "public abstract String getTaskName();", "public TaskName getTaskName() {\n return this.taskName;\n }", "public String goalToString() {\r\n return priority + \" - \" + task + \" - \" + date;\r\n }", "public final String toPendingString() {\n return this.callable.toString();\n }", "public String getSerialisedToDo() {\n\t\tString placeholder = \"placeholder\";\n\t\treturn placeholder;\n\t}", "public String toString() {\n\n\t\tStringBuilder buffer = new StringBuilder();\n\n\t\tbuffer.append(\"id=[\").append(id).append(\"] \");\n\t\tbuffer.append(\"dayNum=[\").append(dayNum).append(\"] \");\n\t\tbuffer.append(\"process=[\").append(process).append(\"] \");\n\t\tbuffer.append(\"createTime=[\").append(createTime).append(\"] \");\n\n\t\treturn buffer.toString();\n\t}", "@Test\n public void toString_shouldReturnInCorrectFormat() {\n Task task = new Task(\"Test\");\n String expected = \"[N] Test\";\n Assertions.assertEquals(expected, task.toString());\n }", "public String getTaskDefinition() {\n return this.taskDefinition;\n }", "public String getTaskDefinition() {\n return this.taskDefinition;\n }", "public String getString() {\n\t\treturn \"T\";\n\t}", "public String getTaskId() {\n return taskId;\n }", "public String getTaskId() {\n return taskId;\n }", "private String formatTask(Task task) {\n String identifier = task.getType();\n String completionStatus = task.isComplete() ? \"1\" : \"0\";\n String dateString = \"\";\n if (task instanceof Deadline) {\n Deadline d = (Deadline) task;\n LocalDateTime date = d.getDate();\n dateString = date.format(FORMATTER);\n }\n if (task instanceof Event) {\n Event e = (Event) task;\n LocalDateTime date = e.getDate();\n dateString = date.format(FORMATTER);\n }\n return String.join(\"|\", identifier, completionStatus, task.getName(), dateString);\n }", "public ITask getTask() {\n \t\treturn task;\n \t}", "public java.lang.Object getTaskID() {\n return taskID;\n }", "public String toString()\n {\n\treturn \"Completed: \" + completed + \"\\n\" + \"To Do: \" + toDo;\n }", "public Task getTask() {\n return task;\n }", "@Override\n public String getTaskType() {\n return \"T\";\n }", "public String getTaskId() {\n return this.taskId;\n }", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getNextToken() != null)\n sb.append(\"NextToken: \").append(getNextToken()).append(\",\");\n if (getMigrationTaskSummaryList() != null)\n sb.append(\"MigrationTaskSummaryList: \").append(getMigrationTaskSummaryList());\n sb.append(\"}\");\n return sb.toString();\n }", "public abstract String[] formatTask();", "public String getSaveString() {\n if (this.isDone()) {\n return String.format(\"[isDone] todo %s\\n\", description);\n } else {\n return String.format(\"todo %s\\n\", description);\n }\n }", "public String getTaskId(){\r\n\t\treturn this.taskId;\r\n\t}", "@Nonnull\n @SuppressWarnings(\"nls\")\n @Override\n public String toString() {\n TextBuilder builder = new TextBuilder();\n builder.append(\"title: \").append(title);\n builder.append(\" id: \").append(requestId);\n return toString(builder.toString());\n }", "public String listOfTasks() {\n String listOfTasks = Messages.LIST_TASKS_MESSAGE;\n for (int i = 0; i < Parser.getOrderAdded(); i++) {\n listOfTasks += recordedTask.get(i).getTaskNum() + DOT_OPEN_SQUARE_BRACKET\n + recordedTask.get(i).getCurrentTaskType() + CLOSE_SQUARE_BRACKET + OPEN_SQUARE_BRACKET\n + recordedTask.get(i).taskStatus() + CLOSE_SQUARE_BRACKET + Messages.BLANK_SPACE\n + recordedTask.get(i).getTaskName()\n + ((i == Parser.getOrderAdded() - 1) ? Messages.EMPTY_STRING : Messages.NEW_LINE);\n }\n return listOfTasks;\n }", "public String getTask(int position) {\n HashMap<String, String> map = list.get(position);\n return map.get(TASK_COLUMN);\n }", "public Task getTask() { return task; }", "public String toString()\n\t{\n\t\treturn threadName;\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getExecutionInfo() != null) sb.append(\"ExecutionInfo: \" + getExecutionInfo() + \",\");\n if (getExecutionConfiguration() != null) sb.append(\"ExecutionConfiguration: \" + getExecutionConfiguration() + \",\");\n if (getOpenCounts() != null) sb.append(\"OpenCounts: \" + getOpenCounts() + \",\");\n if (getLatestActivityTaskTimestamp() != null) sb.append(\"LatestActivityTaskTimestamp: \" + getLatestActivityTaskTimestamp() + \",\");\n if (getLatestExecutionContext() != null) sb.append(\"LatestExecutionContext: \" + getLatestExecutionContext() );\n sb.append(\"}\");\n return sb.toString();\n }", "@Override\n public String toString() {\n StringBuilder buf = new StringBuilder();\n buf.append(Time.toUsefulFormat(time));\n buf.append(\" \" + actionType.name());\n buf.append(\" author=[\" + author + \"]\");\n buf.append(\" target=\" + target.name());\n buf.append(\" path=\" + path);\n buf.append(\" ipath=\" + ipath);\n \n return buf.toString();\n }", "public static String getTaskConfiguration(ScheduledTask task){\r\n\t\treturn task.getTaskConfiguration();\r\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getJobId() != null)\n sb.append(\"JobId: \").append(getJobId()).append(\",\");\n if (getDestination() != null)\n sb.append(\"Destination: \").append(getDestination()).append(\",\");\n if (getResourceType() != null)\n sb.append(\"ResourceType: \").append(getResourceType()).append(\",\");\n if (getStatus() != null)\n sb.append(\"Status: \").append(getStatus()).append(\",\");\n if (getCreationTimestamp() != null)\n sb.append(\"CreationTimestamp: \").append(getCreationTimestamp()).append(\",\");\n if (getLastUpdatedTimestamp() != null)\n sb.append(\"LastUpdatedTimestamp: \").append(getLastUpdatedTimestamp()).append(\",\");\n if (getFailureReason() != null)\n sb.append(\"FailureReason: \").append(getFailureReason());\n sb.append(\"}\");\n return sb.toString();\n }", "@Override\n public String getTaskType() {\n return this.taskType;\n }", "public String toString() {\n\t\tStringBuffer str = new StringBuffer();\n\t\t\n\t\tstr.append(\"[\");\n\t\tstr.append(getTemporaryFile());\n\t\tstr.append(\":\");\n\t\tstr.append(_statusStr[hasStatus()]);\n\t\tstr.append(\",\");\n\t\t\n\t\tif ( isUpdated())\n\t\t\tstr.append(\",Updated\");\n\t\tif ( isQueued())\n\t\t\tstr.append(\",Queued\");\n\n\t\tstr.append(\"]\");\n\t\t\n\t\treturn str.toString();\n\t}", "public String getTaskId() {\n\t\treturn taskId;\n\t}", "public String getDescription()\r\n {\r\n return \"Approver of the task \"+taskName();\r\n }", "public String toString() { return stringify(this, true); }", "public String getStringRepresentation() {\n StringJoiner joiner = new StringJoiner(STRING_FORMAT_DELIMITER);\n\n joiner.add(this.getCaller())\n .add(this.getCallee())\n .add(SIMPLE_DATE_FORMAT.format(startTime))\n .add(SIMPLE_DATE_FORMAT.format(endTime));\n\n return joiner.toString();\n }", "public String getType() {\n return theTaskType ;\n }", "public String getTaskUnit() {\n\t\treturn taskUnit;\n\t}", "public String getTaskType() {\n return taskType;\n }", "public String toString() {\n\t\treturn \"T\";\n\t}", "public java.lang.String getRndTaskName() {\n return rndTaskName;\n }", "Object getTaskId();", "public String toString()\n {\n /**\n * Set the format as [timestamp] account number : command\n */\n String transaction = \"[\" + timestamp + \"] \" + accountInfo.getAccountNumber() + \" : \" + command.name(); \n \n /**\n * Return the string.\n */\n return transaction;\n }", "private static String getStatus(Task task) {\n Status myStatus = task.getStatus();\n if (myStatus == Status.UP_NEXT) {\n return \"UP_NEXT\";\n } else if (myStatus == Status.IN_PROGRESS) {\n return \"IN_PROGRESS\";\n } else {\n return myStatus.toString();\n }\n }" ]
[ "0.7861892", "0.76334476", "0.7465651", "0.74368036", "0.73272437", "0.72967964", "0.72678256", "0.72678256", "0.72390264", "0.7212752", "0.72084284", "0.71931136", "0.709573", "0.7087583", "0.70421076", "0.70408165", "0.70265234", "0.7014924", "0.7009299", "0.70027995", "0.6983972", "0.69679344", "0.6958548", "0.69502157", "0.69502157", "0.69439656", "0.686944", "0.684881", "0.6845564", "0.6845564", "0.6845564", "0.6845564", "0.682165", "0.682165", "0.68059623", "0.67984873", "0.6770553", "0.6729068", "0.6716031", "0.670723", "0.6705328", "0.6683785", "0.66611075", "0.6656935", "0.66213095", "0.66213095", "0.660117", "0.65275353", "0.65275353", "0.6524561", "0.65065515", "0.65021116", "0.645362", "0.6452137", "0.64449334", "0.6442851", "0.6423862", "0.6408415", "0.6405261", "0.6365866", "0.63572764", "0.6320004", "0.63185364", "0.63185364", "0.631837", "0.6311107", "0.6311107", "0.6301398", "0.6279257", "0.62714475", "0.62574613", "0.6250586", "0.62401915", "0.62170976", "0.62167966", "0.62094414", "0.6207907", "0.62060916", "0.6192804", "0.61878085", "0.6170179", "0.6165521", "0.6159488", "0.6159041", "0.6157223", "0.612395", "0.61140084", "0.61133015", "0.6092945", "0.6090721", "0.6073028", "0.60705864", "0.60616416", "0.6060853", "0.6057634", "0.6046028", "0.60321176", "0.60304457", "0.6030059", "0.6025432", "0.60205716" ]
0.0
-1
Returns the String representation of Deadline object.
public String toDataString() { return isDone ? "1 | " + getDescription() : "0 | " + getDescription(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic String toString() {\n\t\treturn String.format(\"Deadline: %d Value: %d\", this.deadline, this.value);\n\t}", "@Override\n\tpublic DateTime getDeadLine() {\n\t\treturn this.details.getDeadLine();\n\t}", "public String printDeadlineFormat() {\n return \" (. ゚ー゚) Doesn't match the deadline format.\\n\"\n + \"Please use \\\"deadline ... /by dd/mm/yyyy 0000\\\" (in 24hr).\\n\";\n }", "@Override\n public String getDeadlineName() {\n return this.deadline.getName();\n }", "@Override\n\tpublic String toString() {\n\t\treturn this.toAnticipatedString();\n\t}", "public String getDeadline(){\n\t\treturn this.deadline ;\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getCreatedAt() != null)\n sb.append(\"CreatedAt: \").append(getCreatedAt()).append(\",\");\n if (getDomainId() != null)\n sb.append(\"DomainId: \").append(getDomainId()).append(\",\");\n if (getEndedAt() != null)\n sb.append(\"EndedAt: \").append(getEndedAt()).append(\",\");\n if (getFailureDetails() != null)\n sb.append(\"FailureDetails: \").append(getFailureDetails()).append(\",\");\n if (getJobId() != null)\n sb.append(\"JobId: \").append(getJobId()).append(\",\");\n if (getJobName() != null)\n sb.append(\"JobName: \").append(\"***Sensitive Data Redacted***\").append(\",\");\n if (getJobProgress() != null)\n sb.append(\"JobProgress: \").append(getJobProgress()).append(\",\");\n if (getJobStatus() != null)\n sb.append(\"JobStatus: \").append(getJobStatus());\n sb.append(\"}\");\n return sb.toString();\n }", "private String getTimingString() {\n return DateTimeHandler.STANDARD_DATETIME_FORMAT.format(deadline);\n }", "public String getStringRepresentation() {\n StringJoiner joiner = new StringJoiner(STRING_FORMAT_DELIMITER);\n\n joiner.add(this.getCaller())\n .add(this.getCallee())\n .add(SIMPLE_DATE_FORMAT.format(startTime))\n .add(SIMPLE_DATE_FORMAT.format(endTime));\n\n return joiner.toString();\n }", "@Override\n\tpublic String getExtraInformation() {\n\t\tDateTimeFormatter fmt = DateTimeFormat.forPattern(\"dd-MM-yyyy HH:mm\");\n\t\treturn \"Deadline: \" + fmt.print(this.getDeadLine());\n\t}", "public String toString() {\n StringBuffer stringBuffer = new StringBuffer();\n stringBuffer.append(\"PrepaidDscrId: \" + _prepaidDscrId);\n stringBuffer.append(\"ProcessDt: \" + _processDt);\n stringBuffer.append(\"LocationCd: \" + _locationCd);\n stringBuffer.append(\"AwbNbr: \" + _awbNbr);\n stringBuffer.append(\"TinUniqId: \" + _tinUniqId);\n stringBuffer.append(\"CourierId: \" + _courierId);\n stringBuffer.append(\"PaymentCurrency: \" + _paymentCurrency);\n stringBuffer.append(\"FreightAmtInVisa: \" + _freightAmtInVisa);\n stringBuffer.append(\"DiscrepancyFound: \" + _discrepancyFound);\n stringBuffer.append(\"DiscrepancyAmt: \" + _discrepancyAmt);\n stringBuffer.append(\"ExchRate: \" + _exchRate);\n stringBuffer.append(\"DiscrepancyRsn: \" + _discrepancyRsn);\n stringBuffer.append(\"ShipDate: \" + _shipDate);\n stringBuffer.append(\"Pux16Amount: \" + _pux16Amount);\n stringBuffer.append(\"CouponAmount: \" + _couponAmount);\n stringBuffer.append(\"Comments: \" + _comments);\n stringBuffer.append(\"StatusId: \" + _statusId);\n stringBuffer.append(\"ManagerEmpId: \" + _managerEmpId);\n return stringBuffer.toString();\n }", "public String toDebugString() {\n StringBuffer str = new StringBuffer(mySelf()+\"\\n\");\n return str.toString();\n }", "public String toString() {\n\n\t\tStringBuilder buffer = new StringBuilder();\n\n\t\tbuffer.append(\"id=[\").append(id).append(\"] \");\n\t\tbuffer.append(\"dayNum=[\").append(dayNum).append(\"] \");\n\t\tbuffer.append(\"process=[\").append(process).append(\"] \");\n\t\tbuffer.append(\"createTime=[\").append(createTime).append(\"] \");\n\n\t\treturn buffer.toString();\n\t}", "public String toString() {\n\t\tthis.setDepartureTime(System.currentTimeMillis());\n\t\tfloat waittime = (float)(departureTime - arrivalTime) / 1000 ;\n\n\t\treturn \"[Time \" + departureTime + \"] Omnibus #\" + vehicleNumber + \" (\" + getBound() + \"). Tiempo total de espera \" + waittime + \" segundos.\";\n\t}", "public java.lang.String toDebugString () { throw new RuntimeException(); }", "public String toString()\n {\n return toString((Format) null);\n }", "@Override\n public String toString() {\n String strDate = \"null\";\n if (due != null) {\n strDate = DATE_FORMAT.format(due);\n }\n return\n \"\\\"\" + text + '\\\"' +\n \",\" + \"\\\"\" +completed +\"\\\"\"+\n \",\" +\"\\\"\"+ strDate + \"\\\"\"+\n \",\" + \"\\\"\"+ priority+ \"\\\"\" +\n \",\" + \"\\\"\"+category + \"\\\"\" +\n System.lineSeparator();\n }", "@Override\n public String toString() {\n String leftAlignFormat = \"| %-10s | %-40s |%n\";\n String line = String.format(\"+------------+------------------------------------------+%n\");\n return line + String.format(leftAlignFormat,\"A.ID\", appointmentID)\n + line + String.format(leftAlignFormat,\"P.ID\", patientID)\n + line + String.format(leftAlignFormat,\"Title\", title)\n + line + String.format(leftAlignFormat,\"Date\", date)\n + line + String.format(leftAlignFormat,\"Start\", startTime)\n + line + String.format(leftAlignFormat,\"End\", endTime)\n + line;\n }", "public String toString() {\n\t\tStringBuilder bld = new StringBuilder();\n\t\tFormatter fmt = new Formatter(bld);\n\t\tfor (int yPos = 0; yPos < getSlotCount(); yPos++) {\n\t\t\tint xBeanPos = getInFlightBeanXPos(yPos);\n\t\t\tfor (int xPos = 0; xPos <= yPos; xPos++) {\n\t\t\t\tint spacing = (xPos == 0) ? getIndent(yPos) : (xspacing + 1);\n\t\t\t\tString format = \"%\" + spacing + \"d\";\n\t\t\t\tif (xPos == xBeanPos) {\n\t\t\t\t\tfmt.format(format, 1);\n\t\t\t\t} else {\n\t\t\t\t\tfmt.format(format, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.format(\"%n\");\n\t\t}\n\t\tfmt.close();\n\t\treturn bld.toString() + getSlotString();\n\t}", "public String goalToString() {\r\n return priority + \" - \" + task + \" - \" + date;\r\n }", "public String toString(){\n\t\tDateTimeFormatter fmt = DateTimeFormat.forPattern(\"dd-MM-yyyy HH:mm\");\n\t\treturn \"Estimated completion: \" + fmt.print(super.getEstimatedEndTime());\n\t}", "public String toString() {\n String text = TAB + \"Name: \" + this.name + lineSeparator()\n + Ui.formatMessage(\"Address: \" + this.address, MAX_LINE_LENGTH)\n + lineSeparator() + TAB\n + \"Faculty: \" + this.faculty + lineSeparator() + TAB\n + \"Port: \" + this.hasPort + lineSeparator() + TAB\n + \"Indoor: \" + this.isIndoor + lineSeparator() + TAB\n + \"Maximum number of Pax: \" + this.maxPax;\n String line = TAB + \"__________________________________________________________\";\n return line + lineSeparator() + text + lineSeparator() + line;\n }", "public String toString() {\r\n\t\treturn String.format(\"\\t[Flight No. %d]\\n\\tClass\\t\\t\\t: \"+\r\n\t\t\"%s\\n\\tOrigin\\t\\t\\t: %s\\n\\tDestination\\t\\t: %s\" + \r\n\t\t\"\\n\\tDate\\t\\t\\t: %s\\n\\tDeparture/Arrival Time : %s\\n\\t\"+\r\n\t\t\"Price\\t\\t\\t: %.2f RM\\n\\tChild Perc.\\t\\t: %d %%\\n\\t\"+\r\n\t\t\"Movie\\t\\t\\t: %s\\n\\t\"+\r\n\t\t\"---------------------------------------------\" \r\n\t\t, getFlightNo(), getType(), getOrigin(), getDestination(), \r\n\t\tgetFormattedDate(), getDeparr(), getPrice(), getChildPerc(), \r\n\t\tshowMovie());\r\n\t}", "@Override\n public Deadline getDeadline() {\n return this.deadline;\n }", "public String toString() {\r\n\t\t StringBuffer result = new StringBuffer();\r\n\r\n\t\t try {\r\n\t\t\t result.append(\"TIMESTAMP: \");\r\n\t\t\t result.append(ThingsUtilityBelt.timestampFormatterDDDHHMMSS(getStamp()));\r\n\t\t\t result.append(ThingsConstants.CHEAP_LINESEPARATOR);\r\n\t\t\t result.append(\"NUMERIC: \");\r\n\t\t\t result.append(numeric);\r\n\t\t\t result.append(ThingsConstants.CHEAP_LINESEPARATOR);\r\n\t\t\t result.append(\"TYPE: \");\r\n\t\t\t result.append(myType.name());\r\n\t\t\t result.append(ThingsConstants.CHEAP_LINESEPARATOR);\r\n\t\t\t result.append(\"PRIORITY: \");\r\n\t\t\t result.append(myPriority.name());\r\n\t\t\t result.append(ThingsConstants.CHEAP_LINESEPARATOR);\r\n\t\t\t result.append(\"SOURCE ID: \");\r\n\t\t\t result.append(myCreatorId.toString());\r\n\t\t\t result.append(ThingsConstants.CHEAP_LINESEPARATOR);\t\t\t \r\n\t\t\t result.append(\"ATTRIBUTES: \");\r\n\t\t\t result.append(AttributeCodec.encode2String(attributes.getAttributes()));\r\n\t\t\t result.append(ThingsConstants.CHEAP_LINESEPARATOR);\r\n\r\n\t\t } catch (Throwable e) {\r\n\t\t\t // Dont' care.\r\n\t\t }\r\n\t\t return result.toString();\r\n\t }", "public String toDebugString() {\n StringBuffer str = new StringBuffer(mySelf()+\"\\n\");\n return super.toDebugString()+str.toString();\n }", "public Deadline() {\n this.dateWrapper = Optional.empty();\n this.timeWrapper = Optional.empty();\n }", "public String toString() {\n\t\t// FILL IN CODE\n\t\treturn \"(\" + origin + \",\" + dest + \",\" + date + \",\" + time + \")\"; // don't forget to change it\n\t}", "@Override()\n public String toString()\n {\n final StringBuilder buffer = new StringBuilder();\n toString(buffer);\n return buffer.toString();\n }", "@Override\n public String toString() {\n Enumeration lines = this.toLines();\n if (lines == null) {\n return null;\n }\n String str = null;\n while (lines.hasMoreElements()) {\n String line = (String) lines.nextElement();\n if (str == null) {\n str = line;\n } else {\n str += _strNewLine + line;\n }\n }\n return str;\n }", "public String toString() {\n\t\treturn String.format(\"%s (%s at %s) required %d volunteers,\" + \n\t\t\t\"\\n leaving at %s\", getTripID(), getCrisisType(), \n\t\t\tgetLocation(), getNumVolunteers(), getTripDate());\n\t}", "@Override\n public final String toString() {\n return asString(0, 4);\n }", "public String toString() {\r\n\t\tStringBuilder s = new StringBuilder(\"\");\r\n\t\tif (objective != null) {\r\n\t\t\ts.append(\"Objective: \").append(objective.getName())\r\n\t\t\t .append('=').append(objective.getDomain())\r\n\t\t\t .append('\\n');\r\n\t\t}\r\n\t\tfor (Variable v : variables) {\r\n\t\t\ts.append(v.getName()).append('=').append(v.getDomain())\r\n\t\t\t .append('\\n');\r\n\t\t}\r\n\t\tfor (Constraint c : constraints) {\r\n\t\t\ts.append(c.toString()).append('\\n');\r\n\t\t}\r\n\t\treturn s.toString();\r\n\t}", "@Override\n public String toString() {\n return \"(name=\" + name +\n \", topic=\" + topic +\n \", deadline=\" + deadline +\")\" ;\n\n }", "public String toString() { return stringify(this, true); }", "@Override\n public String toString() {\n StringBuilder builder = new StringBuilder();\n builder.append(super.toString());\n builder.append(\",end=\" + end.toString());\n\n return builder.toString();\n }", "public String toString() {\n\t\tif(this.start != null && this.end != null){\n\t\t\tString s1 = (\"\\n\\nEdge: \" + this.edgeId + \"\\nReliable: \" + this.isReliable\n\t\t\t\t+ \"\\nMessage Flow Type: \" + this.msgFlowType\n\t\t\t\t+ \"\\nDelay type: \"\n\t\t\t\t+ this.delayType + \"\\nNode 1: \" + this.start.getNodeId()\n\t\t\t\t+ \"\\nNode 2: \" + this.end.getNodeId());\n\t\t\treturn s1;\n\t\t\t\n\t\t}else{\t\t\n\t\t\tString s2 = (\"\\n\\nEdge: \" + this.edgeId + \"\\nReliable: \" + this.isReliable\n\t\t\t\t+ \"\\nMessage Flow Type: \" + this.msgFlowType\n\t\t\t\t+ \"\\nNum Message Entered: \" + \"\\nDelay type: \"\n\t\t\t\t+ this.delayType);\n\t\t\treturn s2;\n\t\t}\t\t\n\t}", "public String toString() {\n\n return this.getClass().getName() + \" -- \" \n\n + \" [Id:\" + this.getSequenceNumber()\n\n + \", ts:\" + this.getTimeStamp() + \"]\";\n\n }", "public String toString()\n {\n\treturn \"Completed: \" + completed + \"\\n\" + \"To Do: \" + toDo;\n }", "@Override\n public String toString() {\n return GC_cause + \" \" + freedObject + \" \" + freedByte + \" \"\n + freedLObject + \" \" + freedLByte + \" \" + percent_free\n + \" \" + current_heap_size + \" \" + total_memory + \" \"\n + pause_time + \" \" + Total_time;\n }", "public String toString()\n\t{\treturn \"Issue\" ;\n\t}", "public String toString() {\n StringBuffer buffer = new StringBuffer();\n\n buffer.append(getClass().getName());\n buffer.append(\"@\");\n buffer.append(Integer.toHexString(hashCode()));\n buffer.append(\" [\");\n buffer.append(objectToString(\"Id\", getId()));\n buffer.append(objectToStringFK(\"Project\", getProject()));\n buffer.append(objectToStringFK(\"User\", getUser()));\n buffer.append(objectToString(\"Status\", getStatus()));\n buffer.append(objectToString(\"LastActivityDate\", getLastActivityDate()));\n buffer.append(objectToString(\"HasPiSeen\", getHasPiSeen()));\n buffer.append(objectToString(\"HasDpSeen\", getHasDpSeen()));\n buffer.append(objectToString(\"HasAdminSeen\", getHasAdminSeen()));\n buffer.append(objectToString(\"HasRequestorSeen\", getHasRequestorSeen()));\n buffer.append(objectToString(\"EmailStatus\", getEmailStatus()));\n buffer.append(\"]\");\n\n return buffer.toString();\n }", "public String toString()\n\t{\n\t\treturn Printer.stringify(this, false);\n\t}", "public String toString() {\n\n // returns a string in a \"{standard time}: {description}\" format\n return String.format(\"%s: %s\", this.getTime(), this.description);\n }", "public String toString()\n\t{\n\t\treturn super.toString() + \"\\n\" +\n\t\t\t \"\\t\" + \"Full Time\" + \"\\n\" +\n\t\t\t \"\\t\" + \"Monthly Salary: $\" + Double.toString(monthlyEarning());\n\t}", "public String toString() {\n StringBuffer buffer = new StringBuffer();\n\n buffer.append(getClass().getName());\n buffer.append(\"@\");\n buffer.append(Integer.toHexString(hashCode()));\n buffer.append(\" [\");\n buffer.append(objectToString(\"Id\", getId()));\n buffer.append(objectToString(\"ProjectName\", getProjectName()));\n buffer.append(objectToStringFK(\"DataProvider\", getDataProvider()));\n buffer.append(objectToStringFK(\"PrimaryInvestigator\", getPrimaryInvestigator()));\n buffer.append(objectToStringFK(\"CreatedBy\", getCreatedBy()));\n buffer.append(objectToString(\"CreatedTime\", getCreatedTime()));\n buffer.append(\"]\");\n\n return buffer.toString();\n }", "public String toString() {\n\t\treturn \"Road from \" + getLeave() + \" to \" + getArrive() + \" with toll \" + getToll();\n\t}", "@Override\n public String toString() {\n return \"Line{\"\n + \"date=\" + date\n + \", ip='\" + ip + '\\''\n + \", request='\" + request + '\\''\n + \", status='\" + status + '\\''\n + \", userAgent='\" + userAgent + '\\''\n + '}';\n }", "@Override\n public String getDepartureString() {\n return this.departDate + \" \" + this.departTime;\n }", "@Override\n\tpublic String toString() {\n\t\treturn this.timerID + \"|\" + this.delay + \"|\" + this.flags + \"|\" + this.message;\n\t}", "@Override\r\n\tpublic String toString() {\r\n\t\tString camp = \"\";\r\n\t\ttry {\r\n\t\t\tif (campLeased != null) camp = \" Camp \" + campLeased.getCampName() + \" Leased\";\r\n\t\t} catch (Exception ex) {\r\n\t\t\t// swallow exceptions such as LazyInitialization Exception\r\n\t\t}\r\n\t\tString company = \"\";\r\n\t\ttry {\r\n\t\t\tif (companyLeasing != null) company = \" by \" + companyLeasing.getCompanyName();\r\n\t\t} catch (Exception ex) {\r\n\t\t\t// swallow exceptions such as LazyInitialization Exception\r\n\t\t}\r\n\t\tString id = \"Camp Lease: ID=\" + this.getId();\r\n\t\tString years = \" (\" + beginYear + \" - \" + endYear + \")\";\r\n\t\treturn id + camp + company + years;\r\n\t}", "@Override\n public String toString() {\n return \"[D]\" + super.toString() + \"(by:\" + dueDate + \")\";\n }", "public String toDebugString();", "@Override\r\n public String toString() {\r\n SimpleDateFormat sdf = new SimpleDateFormat(\"dd/MM/yyyy\");\r\n \r\n return (\r\n \"\\n\" +\r\n \"Codigo tour: \" + this.getCodigoIdentificacion() + \"\\n\" +\r\n \"Nombre Comercial: \" + this.getNombreComercial() + \"\\n\" +\r\n \"Lugar de salida: \" + this.getLugarPartida() + \"\\n\" +\r\n \"Fecha de salida: \" + sdf.format(this.getFechaSalida()) + \"\\n\" +\r\n \"Fecha de regreso: \" + sdf.format(this.getFechaRegreso()) + \"\\n\" +\r\n \"Precio: \" + String.format(\"$ %(,.0f\", this.getPrecio()) + \"\\n\" +\r\n \"Estadía (días): \" + this.calcularEstadia() + \"\\n\" +\r\n \"Costo: \" + String.format(\"$ %(,.0f\", this.calcularPrecio()) + \"\\n\" +\r\n \"Nombre empresa: \" + this.getNombreEmpresa() + \"\\n\" +\r\n \"Tipo de empresa: \" + this.getTipo() + \"\\n\" +\r\n \"Viajero frecuente:\" + (this.isViajeroFrecuente() ? \"Si\\n\" : \"No\\n\")\r\n );\r\n }", "public final String toString() {\r\n final String result = String.format(\r\n \"%s(%d,%d,%d): %s\", this.source, this.line, this.start, this.end, this.message\r\n );\r\n\r\n return result.replaceAll(\"<unknown>\", \"\");\r\n }", "@Override\n public String toString() {\n String message = \"\";\n message += \"Flight Number: \" + this.getFlightnum() + \"\\n\";\n message += \"Departure Date and Time: \" + this.getDepartureDateTime() + \"\\n\";\n message += \"Arrival Date and Time: \" + this.getArrivalDateTime() + \"\\n\";\n message += \"Airline: \" + this.getAirline() + \"\\n\";\n message += \"Origin: \" + this.getOrigin() + \"\\n\";\n message += \"Destination: \" + this.getDestination() + \"\\n\";\n message += \"Price: \" + String.valueOf(this.getCost()) + \"\\n\";\n message += \"Number of Seats Available: \" + String.valueOf(this.getNumSeats()) + \"\\n\\n\";\n return message;\n }", "public String dump() {\n if (!isCarried()) return \"not-carried\";\n PathNode path = carrier.getTrivialPath();\n if (path == null) return \"no-trivial-path\";\n String reason = initialize(path.getLastNode().getLocation(), false);\n if (reason != null) return reason;\n this.plan.mode = CargoMode.DUMP;\n return null;\n }", "public String toString()\n {\n long dtExpiry = getExpiryMillis();\n\n return super.toString()\n + \", priority=\" + getPriority()\n + \", created=\" + new Time(getCreatedMillis())\n + \", last-use=\" + new Time(getLastTouchMillis())\n + \", expiry=\" + (dtExpiry == 0 ? \"none\" : new Time(dtExpiry) + (isExpired() ? \" (expired)\" : \"\"))\n + \", use-count=\" + getTouchCount()\n + \", units=\" + getUnits();\n }", "public String toString() \r\n {\r\n return \"The cruise ship \\\"\"+GetName()+\"\\\" was built in \"+GetYear()+\". It has a maximum payload of \"+maxPassengers+\" passengers and is currently carrying \"+curPassengers+\" passengers.\";\r\n }", "public String toString(){\n\t\tString str = \"<Route: \";\n\t\tfor(int i=0; i<visits.size(); i++){\n\t\t\tVisit v = visits.get(i);\n\t\t\tstr += \"\\t\"+i+\": \"+ v +\"\\t\"+ \"At time: \"+arrivalTimes.get(i)+\"->\"+departureTimes.get(i);\n\t\t\tif(locked.get(i)) str += \" locked\";\n\t\t\tstr += \"\\n\";\n\t\t}\n\t\tstr += \"\\t\"+visits.get(0);\n\t\treturn str+\">\";\n\t}", "public String toString()\r\n/* 398: */ {\r\n/* 399:351 */ return \"<\" + this.t + \", \" + this.from + \", \" + this.to + \">\";\r\n/* 400: */ }", "public String toString() {\n\t\treturn String.format(\"Id: %s\\nContent: %s\\nInsertion Time: %s\\nExpiration Time: %s\\nDequeue Count: %s\\nPop Receipt: %s\\nNext Visible Time: %s\\n\",\n\t\t\t\tm_MessageId,\n\t\t\t\tthis.getAsString(),\n\t\t\t\tm_InsertionTime,\n\t\t\t\tm_ExpirationTime,\n\t\t\t\tm_DequeueCount,\n\t\t\t\tm_PopReceipt,\n\t\t\t\tm_NextVisibleTime);\n\t}", "public String toString(){\r\n\t\tString superString = super.toString();\r\n\t\tStringBuilder builder = new StringBuilder();\r\n\t\t//Add the object to the string\r\n\t\tbuilder.append(\". \");\r\n\t\tif (this.error != null) {\r\n\t\t\tbuilder.append(error.toString());\r\n\t\t\tbuilder.append(\". \");\r\n\t\t}\r\n\t\tbuilder.append(\"Object: \");\r\n\t\tbuilder.append(object.toString());\r\n\t\tif (this.recordRoute)\r\n\t\t\tbuilder.append(\", [RECORD_ROUTE]\");\r\n\t\tif (this.reRouting) \r\n\t\t\tbuilder.append(\", [RE-ROUTING]\");\r\n\t\t//Add the masks to the string\r\n\t\tif (this.mask != null) {\r\n\t\t\tbuilder.append(\", label set: \");\r\n\t\t\tbuilder.append(mask.toString());\r\n\t\t}\r\n\t\treturn superString.concat(builder.toString());\r\n\t}", "public String toString(){\n\t\tString msg = \"\";\n\t\tmsg += messageInfo[0] + \" \" + messageInfo[1] + \" \" + messageInfo[2] + \"\\n\";\n\t\tif (!headerLines.isEmpty()){\n\t\t\tfor (int i = 0; i < headerLines.size(); i++){\n\t\t\t\tmsg += headerLines.get(i).get(0) + \" \" + headerLines.get(i).get(1) + \"\\n\";\n\t\t\t}\n\t\t}\n\t\tmsg += \"\\n\";\n\t\tif (entity.length > 0){\n\t\t\t\tmsg += entity;\n\t\t}\n\t\treturn msg;\n\t}", "public String toString(){\n\t\treturn \"<== at \" + time + \": \" + name + \", \" + type + \", \" + data + \"==>\"; \n\t}", "public String getDeadline() {\n if (!this.by.equals(\"\")) {\n return this.by;\n }\n return this.todoDate.format(DateTimeFormatter.ofPattern(\"MMM d yyyy\"));\n }", "@Override\n public String toString() {\n return new GsonBuilder().serializeNulls().create().toJson(this).toString();\n }", "public String toString(){\n\t\tString temp = new String();\n\n\t\tif(cancelled){\n\t\t\ttemp+=\"WARNING COURSE SHOULD BE CANCELLED!\\n\";\n\t\t}\n\n\t\ttemp += \" Course subject ID: \" + subject.getID();\n\t\ttemp += \"\\n \" + (getStatus() < 0 ? \"Due to start\" : \"Finishes\") + \" in: \" + Math.abs(getStatus());\n\t\ttemp += \"\\n \" + (instructor == null ? \"Instructor not assigned\" : \"Instructor: \" + instructor.getName());\n\t\ttemp += \"\\n Amount of students enrolled: \" + enrolled.size() + \"\\n Enrolled list:\\n\";\n\n\t\tfor(Student student : enrolled){\n\t\t\ttemp+= \" * \" + student.getName() + \"\\n\";\n\t\t}\n\t\treturn temp;\n\t}", "public String objectToString() {\n \n StringBuilder s = new StringBuilder(new String(\"\"));\n if(aggressor instanceof Town) {\n s.append(((Town) aggressor).getName()).append(\" \");\n } else {\n s.append(((Nation) aggressor).getName()).append(\" \");\n }\n if(defender instanceof Town) {\n s.append(((Town) defender).getName()).append(\" \");\n } else {\n s.append(((Nation) defender).getName()).append(\" \");\n }\n s.append(aggressorPoints).append(\" \");\n s.append(defenderPoints).append(\" \");\n for (Town town : towns.keySet()) {\n s.append(town.getName()).append(\" \");\n s.append(towns.get(town)).append(\" \");\n }\n\n if (rebelwar != null)\n s.append(\" \").append(rebelwar.getName());\n else\n s.append(\" \" + \"n u l l\");\n\n return s.toString();\n }", "@Override\n public String toString() {\n return Objects.toStringHelper(this) //\n .add(Decouverte_.id.getName(), getId()) //\n .add(Decouverte_.dateDecouverte.getName(), getDateDecouverte()) //\n .add(Decouverte_.observations.getName(), getObservations()) //\n .toString();\n }", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getAutomaticallyAfterDays() != null)\n sb.append(\"AutomaticallyAfterDays: \").append(getAutomaticallyAfterDays()).append(\",\");\n if (getDuration() != null)\n sb.append(\"Duration: \").append(getDuration()).append(\",\");\n if (getScheduleExpression() != null)\n sb.append(\"ScheduleExpression: \").append(getScheduleExpression());\n sb.append(\"}\");\n return sb.toString();\n }", "public String toString() {\r\n final StringBuffer stringBuffer = new StringBuffer();\r\n stringBuffer.append( \"amount of wall rubbles = \" );\r\n stringBuffer.append( amountOfWallRubbles );\r\n stringBuffer.append( \"%, \" );\r\n stringBuffer.append( \"amount of blood = \" );\r\n stringBuffer.append( amountOfBlood );\r\n stringBuffer.append( \"%, \" );\r\n if ( isKillLimit ) {\r\n stringBuffer.append( \"kill limit = \" );\r\n stringBuffer.append( killLimit );\r\n stringBuffer.append( \", \" );\r\n }\r\n if ( isTimeLimit ) {\r\n stringBuffer.append( \"time limit = \" );\r\n stringBuffer.append( timeLimit );\r\n stringBuffer.append( \" minute\" );\r\n if ( timeLimit > 1 )\r\n stringBuffer.append( 's' );\r\n stringBuffer.append( \", \" );\r\n }\r\n stringBuffer.append( \"period time = \" );\r\n stringBuffer.append( periodTime );\r\n stringBuffer.append( \" ms\" );\r\n return stringBuffer.toString();\r\n }", "@Override\n\tpublic String toStringDebug() {\n\t\treturn null;\n\t}", "@Override\n\tpublic String toString(){\n return description + \"\\n\" + SequenceUtils.format(sequence);\n\t}", "public String toString()\n\t{\n\t\treturn this.defline + \"\\n\" + this.sequence + \"\\n + \\n\" + this.quality + \"\\n\";\n\t}", "public String toString() {\n\t\treturn new String(dateToString() + \" \"\n\t\t\t\t+ timeToString());\n }", "@Override\n public String toString()\n {\n\n // IF TASK IS MARKED AS COMPLETE\n if(task_completion_boolean)\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return \"*** \" + String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return \"*** \" + String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END if\n\n /***********************************************************/\n\n // OTHERWISE, TASK IS NOT COMPLETE\n else\n {\n // IF THERE'S NO TASK DESCRIPTION\n if(task_description.isBlank() || task_description.equals(null))\n {\n return String.format(\"[%s] %s\", task_due_date, task_title);\n } // END if\n\n return String.format(\"[%s] %s | %s\", task_due_date, task_title, task_description);\n } // END else\n\n }", "@Override\n\tpublic String toString() {\n\t\treturn toStringBuilder(new StringBuilder()).toString();\n\t}", "@Override\n public String toString() {\n String completeStatus;\n if (this.getTransactionCompleteness()) {\n completeStatus = \"This transaction is complete.\";\n } else {\n completeStatus = \"This transaction is incomplete.\";\n }\n return \"This is a one-way trade where \" + this.getBorrowerName() + \" borrows \" + this.item.getName() + \" from \" +\n this.getLenderName() + \". \\nMeeting time & place: \" + this.getMeetingTime().toString() + \" at \" +\n this.getMeetingLocation() + \". \\n\" + completeStatus;\n }", "public String toString() {\n return '[' + description + \"][\" + date + ']';\n }", "@Override\n public String toString() {\n if (!(itinerary.getNext() == null)) {\n return flightCode + \" - From: \" + itinerary.getFrom() + \" Landing At: \" + itinerary.getTo() + \" Next Stop: \" + itinerary.getNext();\n } else {\n return flightCode + \" - From: \" + itinerary.getFrom() + \" Landing At: \" + itinerary.getTo();\n } //END IF/ELSE\n }", "public String toString() {\n\t\treturn \"Lend ID: \" + getID() + \" \\n\" + myBook.toString() +\"\\n \" + \"due: \" + getReturnDate();\n\t}", "public String toString(){\n\n\t\t/*\n\t\t *Puts the rental and due dates into two nicely formated\n\t\t *Strings.\n\t\t */\n\t\tdf.setCalendar(bought);\n\t\tString jazz = df.format(bought.getTime());\n\t\tdf.setCalendar(boughtReturn);\n\t\tString jazz2 = df.format(boughtReturn.getTime());\n\n\t\t/*\n\t\t * Returns the components of the DVD class. Categories are \n\t\t * highlighted in red using html codes.\n\t\t */\n\t\treturn \"<html><font color='red'>Name: </font>\" + \n\t\t getNameofRenter() + \", <font color='red'>Title: </font>\" + \n\t\tgetTitle() + \", <font color='red'>Rented On: </font>\"+ jazz + \n\t\t\", \" + \"<font color='red'>Due Back On: </font>\"+ jazz2;\n\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"{\");\n if (getViolationTarget() != null)\n sb.append(\"ViolationTarget: \").append(getViolationTarget()).append(\",\");\n if (getViolationTargetDescription() != null)\n sb.append(\"ViolationTargetDescription: \").append(getViolationTargetDescription()).append(\",\");\n if (getPartialMatches() != null)\n sb.append(\"PartialMatches: \").append(getPartialMatches()).append(\",\");\n if (getPossibleSecurityGroupRemediationActions() != null)\n sb.append(\"PossibleSecurityGroupRemediationActions: \").append(getPossibleSecurityGroupRemediationActions());\n sb.append(\"}\");\n return sb.toString();\n }", "public String toString() {\n\t\treturn trail.toString();\n\t}", "public String toString()\n {\n\tString returnString = \"\";\n\treturnString += \"[ \" + cargo + \" ][ * ]--> \";\n\treturn returnString;\n }", "public String toString() {\r\n StringBuffer out = new StringBuffer(this.getDaogenVersion());\r\n out.append(\"\\nclass DetArqueoRunt, mapping to table DetArqueoRunt\\n\");\r\n out.append(\"Persistent attributes: \\n\"); \r\n out.append(\"IDDETARQUEO = \" + this.IDDETARQUEO + \"\\n\"); \r\n out.append(\"FAC_VLT = \" + this.FAC_VLT + \"\\n\"); \r\n out.append(\"IDPAGORUNT = \" + this.IDPAGORUNT + \"\\n\"); \r\n out.append(\"FAC_NRO = \" + this.FAC_NRO + \"\\n\"); \r\n out.append(\"FECHAPAGOFACTURA = \" + this.FECHAPAGOFACTURA + \"\\n\"); \r\n out.append(\"VALORPAGOMT = \" + this.VALORPAGOMT + \"\\n\"); \r\n out.append(\"VALORPAGORUNT = \" + this.VALORPAGORUNT + \"\\n\"); \r\n out.append(\"COD_CAJERO = \" + this.COD_CAJERO + \"\\n\"); \r\n out.append(\"NOM_CAJERO = \" + this.NOM_CAJERO + \"\\n\"); \r\n out.append(\"ID_ARQUEO = \" + this.ID_ARQUEO + \"\\n\"); \r\n out.append(\"VLR_BASE = \" + this.VLR_BASE + \"\\n\"); \r\n out.append(\"IDUSRPAGA = \" + this.IDUSRPAGA + \"\\n\"); \r\n out.append(\"APELLIDOCAJERO = \" + this.APELLIDOCAJERO + \"\\n\"); \r\n out.append(\"ESTADOFACTURA = \" + this.ESTADOFACTURA + \"\\n\"); \r\n return out.toString();\r\n }", "public String pendingToString() {\n InterruptibleTask interruptibleTask = this.task;\n if (interruptibleTask == null) {\n return super.pendingToString();\n }\n StringBuilder stringBuilder = new StringBuilder(\"task=[\");\n stringBuilder.append(interruptibleTask);\n stringBuilder.append(\"]\");\n return stringBuilder.toString();\n }", "@Override\n public String toString() {\n String str = \"\";\n\n //TODO: Complete Method\n\n return str;\n }", "public String toString(){\n String s = \"\";\n s+=\"Employee: \"+name+\"\\n\";\n s+=\"Employee ID: \" + idnum +\"\\n\";\n s+=\"Current Position: \"+position+\"\\n\";\n s+=\"Current Salary: $\" +salary+\"\\n\";\n s+=\"Vacation Balance: \" + vacationBal+ \" days\\n\";\n s+=\"Bonus: $\" +annualBonus+\"\\n\";\n return s;\n }", "public String toString() {\n\t\treturn time + \" - \" + name;\n\t}", "public Date getRealDeadline() {\r\n return realDeadline;\r\n }", "public java.lang.String toString () { throw new RuntimeException(); }", "public String toString() {\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"M/d/yyyy\");\n\t\treturn employeeName + \" \" + EID + \" \" + address + \" \" + phoneNumber + \" \" + sdf.format(DOB) + \" \" + securityClearance;\n\t}", "@Override\n public String toString(){\n String ret = super.toString();\n ret += \"\\nYears Until Tenure: \" + m_yearsUntilTenure;\n return ret;\n }", "@NullableDecl\n public String pendingToString() {\n if (!(this instanceof ScheduledFuture)) {\n return null;\n }\n long delay = ((ScheduledFuture) this).getDelay(TimeUnit.MILLISECONDS);\n StringBuilder sb = new StringBuilder(41);\n sb.append(\"remaining delay=[\");\n sb.append(delay);\n sb.append(\" ms]\");\n return sb.toString();\n }", "@Override\n\tpublic String toString() {\n\t\ttry {\n\t\t\treturn this.toJSONString(0);\n\t\t} catch (Exception e) {\n\t\t\treturn null;\n\t\t}\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn (\" ReqId : \" + reqId + \"\\n\" + \" User id : \"\n\t\t\t\t+ userId + \"\\n\" + \" Cub no : \" + cubicleNo + \"\\n\"\n\t\t\t\t+ \" Dept : \" + department + \"\\n\"\n\t\t\t\t+ \" Location : \" + location + \"\\n\"\n\t\t\t\t+ \" Req by date : \" + requiredByDate + \"\\n\"\n\t\t\t\t+ \" Req type id : \" + reqTypeId + \"\\n\"\n\t\t\t\t+ \" Justification : \" + justification + \"\\n\"\n\t\t\t\t+ \" Rejection reasn : \" + rejectionReason + \"\\n\"\n\t\t\t\t+ \" Cancel reason : \" + cancellationReason + \"\\n\"\n\t\t\t\t+ \" Requested date : \" + requestedDate + \"\\n\"\n\t\t\t\t+ \" Assigned date : \" + assignedDate + \"\\n\"\n\t\t\t\t+ \" Comited date : \" + committedDate + \"\\n\"\n\t\t\t\t+ \" Completed date : \" + completedDate + \"\\n\"\n\t\t\t\t+ \" Status id : \" + statusId + \"\\n\" + \"\\n\\n----------------------------------------------------------\\n\\n\");\n\n\t}", "public String toString() {\r\n return \"created on \" + this.dateCreated + \"\\ncolor: \" \r\n + this.color + \" and filled: \" + this.filled;\r\n }", "public String toString() {\n String eventString = \"\";\n DateTimeFormatter ft = DateTimeFormatter.ofPattern(\"ddMMyyyy\");\n String date = this.getDue().format(ft);\n eventString += (\"e,\" + this.getName() + \",\" + this.getDetails() + \",\" +\n date + \";\");\n return eventString;\n }", "@Override\n\tpublic String toString()\n\t{\n\t\treturn \"(Invalid)\";\n\t}" ]
[ "0.7107814", "0.6456071", "0.642164", "0.6409127", "0.63603824", "0.6340242", "0.63291246", "0.6279171", "0.6278137", "0.62546134", "0.62449837", "0.6228679", "0.62225413", "0.6173224", "0.61686665", "0.6129624", "0.6117578", "0.61012983", "0.60974354", "0.6052069", "0.60516334", "0.6045341", "0.6045126", "0.60420984", "0.60365725", "0.6030165", "0.60085166", "0.60031575", "0.60008836", "0.6000469", "0.59980613", "0.5996504", "0.59956086", "0.5994324", "0.59922606", "0.5989207", "0.596894", "0.5964305", "0.59587103", "0.59548116", "0.5950641", "0.5950285", "0.594054", "0.59355974", "0.59336585", "0.59332186", "0.59259665", "0.59096885", "0.5900686", "0.58985853", "0.5876002", "0.5871803", "0.58717746", "0.58711416", "0.5871059", "0.58692044", "0.58642805", "0.5863802", "0.5859012", "0.5849381", "0.58489186", "0.5839969", "0.5838124", "0.58380437", "0.5835857", "0.58334917", "0.5832654", "0.58311725", "0.5823724", "0.582054", "0.5813676", "0.5813199", "0.5809107", "0.58082324", "0.5803812", "0.5803339", "0.58019537", "0.57985085", "0.57905644", "0.5782384", "0.57809657", "0.5769032", "0.57687986", "0.5765976", "0.57623476", "0.576048", "0.57591635", "0.57529753", "0.57524353", "0.57521385", "0.5743169", "0.5740022", "0.57373184", "0.57363105", "0.57328165", "0.5732733", "0.57285994", "0.5726511", "0.57217264", "0.5721008", "0.57185036" ]
0.0
-1
TODO Autogenerated method stub
@Override public void widgetDefaultSelected(SelectionEvent e) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void widgetDefaultSelected(SelectionEvent e) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void widgetDefaultSelected(SelectionEvent e) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Creates a new instance of SyncApplication
public DerbyApplication(Context context,DB db,Storage storage) { super(context); this.db = db; this.storage = storage; getTunnelService().setEnabled(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private NewApplication createNewApplication() {\n GetNewApplicationRequest req =\n recordFactory.newRecordInstance(GetNewApplicationRequest.class);\n GetNewApplicationResponse resp;\n try {\n resp = rm.getClientRMService().getNewApplication(req);\n } catch (YarnException e) {\n String msg = \"Unable to create new app from RM web service\";\n LOG.error(msg, e);\n throw new YarnRuntimeException(msg, e);\n }\n NewApplication appId =\n new NewApplication(resp.getApplicationId().toString(),\n new ResourceInfo(resp.getMaximumResourceCapability()));\n return appId;\n }", "public ApplicationCreator() {\n }", "public Application create() {\n\t\tfinal Actor actorLogged = this.actorService.findActorLogged();\n\t\tAssert.notNull(actorLogged);\n\t\tthis.actorService.checkUserLoginMember(actorLogged);\n\n\t\tfinal Member memberLogged = (Member) actorLogged;\n\t\tAssert.isNull(memberLogged.getAssociation(), \"You already belong to an association\");\n\n\t\tApplication result;\n\n\t\tfinal Date moment = new Date(System.currentTimeMillis() - 1);\n\n\t\tresult = new Application();\n\t\tresult.setStatus(\"PENDING\");\n\t\tresult.setMoment(moment);\n\n\t\tresult.setMember(memberLogged);\n\n\t\treturn result;\n\t}", "public MTApplication(){\r\n\t\tsuper();\r\n\t}", "public App() {\n\t\tLog.d(\"App\", \"App created\");\n\t\tinstance = this;\n\t}", "public static Application getInstance(){\n\t\treturn getInstance (null);\n\t}", "public static org.oep.ssomgt.model.Application createApplication(\n\t\tlong applicationId) {\n\t\treturn getService().createApplication(applicationId);\n\t}", "@Override\n @SuppressWarnings(\"checkstyle:linelength\")\n public Application create(final TwilioRestClient client) {\n this.pathAccountSid = this.pathAccountSid == null ? client.getAccountSid() : this.pathAccountSid;\n Request request = new Request(\n HttpMethod.POST,\n Domains.API.toString(),\n \"/2010-04-01/Accounts/\" + this.pathAccountSid + \"/Applications.json\"\n );\n\n addPostParams(request);\n Response response = client.request(request);\n\n if (response == null) {\n throw new ApiConnectionException(\"Application creation failed: Unable to connect to server\");\n } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {\n RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper());\n if (restException == null) {\n throw new ApiException(\"Server Error, no content\");\n }\n throw new ApiException(restException);\n }\n\n return Application.fromJson(response.getStream(), client.getObjectMapper());\n }", "public BazaarApplicationImpl() {\r\n\t\tsuper();\r\n\r\n\t}", "java.util.concurrent.Future<CreateApplicationResult> createApplicationAsync(CreateApplicationRequest createApplicationRequest);", "@Override\n public CreateApplicationResult createApplication(CreateApplicationRequest request) {\n request = beforeClientExecution(request);\n return executeCreateApplication(request);\n }", "public static App getInstance() {\n return applicationInstance;\n }", "private final static Application getInstance(String[] args){\n\t\tif (instance == null){\n\t\t\t//istanziazione lazy\n\t\t\tinstance = new Application(args);\n\t\t\t\n\t\t\t//istanzia la finestra principale dell'interfaccia\n\t\t\tinstance.mainForm = new MainForm(instance);\n\t\t\t\n\t\t\t//registra la finestra principale su Application per le notoifiche\n\t\t\tinstance.addObserver (instance.mainForm);\n\t\t\t\n\t\t\t//prepara il timer per la notifica del progressing dell'avanzamento\n\t\t\tActionListener timerActionPerformer = new ActionListener (){\n\t\t\t\t/**\n\t\t\t\t * Gestisce evento timer.\n\t\t\t\t */\n\t\t\t\tpublic void actionPerformed (ActionEvent ae){\n\t\t\t\t\tinstance.setChanged ();\n\t\t\t\t\t//notifica l'avanzamento\n\t\t\t\t\tinstance.notifyObservers (ObserverCodes.CURRENT_PROGRESS_TIC);\n\t\t\t\t}\n\t\t\t};\n\t\t\tinstance.timer = new javax.swing.Timer (1000, timerActionPerformer);\n\t\t\tinstance.timer.stop();\n\t\t}\n\t\treturn instance; \n\t}", "public Application()\r\n {\r\n pSlot = new ParkingSlot();\r\n cPark = new CarPark();\r\n }", "public static ApplicationBase getApplication()\r\n {\r\n if (instance == null)\r\n {\r\n throw new IllegalStateException(\"Micgwaf was not (yet) initialized correctly: no instance of Application is known.\");\r\n }\r\n return instance;\r\n }", "CdapApplication createCdapApplication();", "Appinfo createAppinfo();", "public Application(String name, String dob, String gender, String income, String apt, String moveDate, String term, String approval, String username)\n {\n this.name = new SimpleStringProperty(name);\n this.dob = new SimpleStringProperty(dob);\n this.gender = new SimpleStringProperty(gender);\n this.income = new SimpleStringProperty(income);\n this.apt = new SimpleStringProperty(apt);\n this.moveDate = new SimpleStringProperty(moveDate);\n this.term = new SimpleStringProperty(term);\n this.approval = new SimpleStringProperty(approval);\n this.username = new SimpleStringProperty(username);\n }", "public CreateApplicationResponse createApplication(String name, CryptoProviderUtil keyConversionUtilities) {\n\n ApplicationEntity application = new ApplicationEntity();\n application.setName(name);\n application = applicationRepository.save(application);\n\n KeyGenerator keyGen = new KeyGenerator();\n KeyPair kp = keyGen.generateKeyPair();\n PrivateKey privateKey = kp.getPrivate();\n PublicKey publicKey = kp.getPublic();\n\n // Generate the default master key pair\n MasterKeyPairEntity keyPair = new MasterKeyPairEntity();\n keyPair.setApplication(application);\n keyPair.setMasterKeyPrivateBase64(BaseEncoding.base64().encode(keyConversionUtilities.convertPrivateKeyToBytes(privateKey)));\n keyPair.setMasterKeyPublicBase64(BaseEncoding.base64().encode(keyConversionUtilities.convertPublicKeyToBytes(publicKey)));\n keyPair.setTimestampCreated(new Date());\n keyPair.setName(name + \" Default Keypair\");\n masterKeyPairRepository.save(keyPair);\n\n // Create the default application version\n byte[] applicationKeyBytes = keyGen.generateRandomBytes(16);\n byte[] applicationSecretBytes = keyGen.generateRandomBytes(16);\n ApplicationVersionEntity version = new ApplicationVersionEntity();\n version.setApplication(application);\n version.setName(\"default\");\n version.setSupported(true);\n version.setApplicationKey(BaseEncoding.base64().encode(applicationKeyBytes));\n version.setApplicationSecret(BaseEncoding.base64().encode(applicationSecretBytes));\n applicationVersionRepository.save(version);\n\n CreateApplicationResponse response = new CreateApplicationResponse();\n response.setApplicationId(application.getId());\n response.setApplicationName(application.getName());\n\n return response;\n }", "public DefaultApplication() {\n\t}", "public LocalAppLauncher() {\n }", "public App create(App obj) {\n \n JsonNode node = getClient().post(Routes.APP_CREATE, toJsonNode(obj));\n App rapp = getMapper().convertValue(node, App.class);\n \n if (!node.has(\"id\")) {\n throw new ClientException(\"Missing ID on object creation\");\n }\n \n obj.merge(rapp);\n obj.setId(rapp.getId());\n\n return obj;\n }", "protected WebApplication newApplication() {\n return new DummyWebApplication();\n }", "Application getApplication();", "public static Application getApp() {\n if (sApplication != null) {\n return sApplication;\n }\n Application app = getApplicationByReflect();\n init(app);\n return app;\n }", "@Keep\n public AppBean(Long id, String app_name, String app_info, Long master_account, Long chain_id, Long user_id) {\n this.id = id;\n this.app_name = app_name;\n this.app_info = app_info;\n this.chain_id = chain_id;\n this.user_id = user_id;\n }", "public Application() {\n\t\tinitComponents();\n\t\tthis.service = new PacienteService();\n\t\tthis.AtualizarTabelaPacientes();\n\t\tthis.sexo = this.rd_nao_informado.getText();\n\t\tthis.cb_estados.setSelectedIndex(24);\n\t}", "public ApplicationCreator(final String pathAccountSid) {\n this.pathAccountSid = pathAccountSid;\n }", "public static Application get(ApplicationSources applicationSources) {\n\t\tConnectionUtils.get(DataSourceRepository.get().getConnectorMySqlLocalHost());\n\t\t//\n\t\treturn new Application(applicationSources);\n\t}", "public static Application getApp() {\n if (sApplication != null) return sApplication;\n throw new NullPointerException(\"u should init first\");\n }", "private appR getApp() throws JAXBException, IOException {\n synchronized (application) {\r\n appR App = (appR) application.getAttribute(\"App\");\r\n if (App == null) {\r\n App = new appR();\r\n App.setFilePath(application.getRealPath(\"WEB-INF/Listings.xml\"));\r\n application.setAttribute(\"App\", App);\r\n }\r\n return App;\r\n }\r\n }", "public PSFUDApplication()\n {\n loadSnapshot();\n }", "public MusicClientApp() {\n\n tlm = new TrackListModel(new RecordDto());\n rcm = new RecordComboBoxModel(new MusicCollectionDto());\n scm = new PlayerComboBoxModel(new ArrayList<>());\n sercm = new ServerComboBoxModel(new ArrayList<>());\n\n initComponents();\n\n EventQueue.invokeLater(new Runnable() {\n @Override\n public void run() {\n StartMusicClient smc = new StartMusicClient(MusicClientApp.this);\n new Thread(smc).start();\n }\n });\n }", "private SingletonApp( Context context ) {\n mMB = MessageBroker.getInstance( context );\n }", "public void setApp(Main application) { this.application = application;}", "@Override\n public OAuthApplicationInfo createApplication(OAuthAppRequest oauthAppRequest) throws APIManagementException {\n OAuthApplicationInfo oAuthApplicationInfo = oauthAppRequest.getOAuthApplicationInfo();\n\n // Subscriber's name should be passed as a parameter, since it's under the subscriber the OAuth App is created.\n String userId = (String) oAuthApplicationInfo.getParameter(ApplicationConstants.\n OAUTH_CLIENT_USERNAME);\n String applicationName = oAuthApplicationInfo.getClientName();\n String keyType = (String) oAuthApplicationInfo.getParameter(ApplicationConstants.APP_KEY_TYPE);\n String callBackURL = (String) oAuthApplicationInfo.getParameter(ApplicationConstants.APP_CALLBACK_URL);\n if (keyType != null) {\n applicationName = applicationName + '_' + keyType;\n }\n\n if (log.isDebugEnabled()) {\n log.debug(\"Trying to create OAuth application :\" + applicationName);\n }\n\n String tokenScope = (String) oAuthApplicationInfo.getParameter(\"tokenScope\");\n String[] tokenScopes = new String[1];\n tokenScopes[0] = tokenScope;\n\n org.wso2.carbon.apimgt.api.model.xsd.OAuthApplicationInfo info = null;\n\n try {\n org.wso2.carbon.apimgt.api.model.xsd.OAuthApplicationInfo applicationToCreate =\n new org.wso2.carbon.apimgt.api.model.xsd.OAuthApplicationInfo();\n applicationToCreate.setIsSaasApplication(oAuthApplicationInfo.getIsSaasApplication());\n applicationToCreate.setCallBackURL(callBackURL);\n applicationToCreate.setClientName(applicationName);\n applicationToCreate.setAppOwner(userId);\n applicationToCreate.setJsonString(oAuthApplicationInfo.getJsonString());\n applicationToCreate.setTokenType(oAuthApplicationInfo.getTokenType());\n info = createOAuthApplicationbyApplicationInfo(applicationToCreate);\n } catch (Exception e) {\n handleException(\"Can not create OAuth application : \" + applicationName, e);\n } \n\n if (info == null || info.getJsonString() == null) {\n handleException(\"OAuth app does not contains required data : \" + applicationName,\n new APIManagementException(\"OAuth app does not contains required data\"));\n }\n\n oAuthApplicationInfo.addParameter(\"tokenScope\", tokenScopes);\n oAuthApplicationInfo.setClientName(info.getClientName());\n oAuthApplicationInfo.setClientId(info.getClientId());\n oAuthApplicationInfo.setCallBackURL(info.getCallBackURL());\n oAuthApplicationInfo.setClientSecret(info.getClientSecret());\n oAuthApplicationInfo.setIsSaasApplication(info.getIsSaasApplication());\n\n try {\n JSONObject jsonObject = new JSONObject(info.getJsonString());\n\n if (jsonObject.has(ApplicationConstants.\n OAUTH_REDIRECT_URIS)) {\n oAuthApplicationInfo.addParameter(ApplicationConstants.\n OAUTH_REDIRECT_URIS, jsonObject.get(ApplicationConstants.OAUTH_REDIRECT_URIS));\n }\n\n if (jsonObject.has(ApplicationConstants.OAUTH_CLIENT_NAME)) {\n oAuthApplicationInfo.addParameter(ApplicationConstants.\n OAUTH_CLIENT_NAME, jsonObject.get(ApplicationConstants.OAUTH_CLIENT_NAME));\n }\n\n if (jsonObject.has(ApplicationConstants.OAUTH_CLIENT_GRANT)) {\n oAuthApplicationInfo.addParameter(ApplicationConstants.\n OAUTH_CLIENT_GRANT, jsonObject.get(ApplicationConstants.OAUTH_CLIENT_GRANT));\n }\n } catch (JSONException e) {\n handleException(\"Can not retrieve information of the created OAuth application\", e);\n }\n\n return oAuthApplicationInfo;\n\n }", "public RecruitingAppManagementImpl() {\n }", "public CH340Application() {\n sContext = this;\n }", "public AppCall createBaseAppCall() {\r\n return new AppCall(getRequestCode());\r\n }", "public static Account createSyncAccount(SyncAccountParameters syncAccount) {\n return createSyncAccount(syncAccount, true, true);\n }", "Builder fromApp(ApplicationId appId);", "@Override\r\n\tpublic void onCreate() {\n\t\tsuper.onCreate();\r\n\t\tinstance = this;\r\n\t\tAppConfigMrg.load(getApplicationContext());\r\n\t}", "protected void NewApp(String name, String code, String file, String web,\n String dir) {\n String webRoot = UIHelper.getStoragePath(AppManagerActivity.this);\n webRoot = webRoot + constants.SD_CARD_TBSSOFT_PATH3 + \"/\";\n File newfile = new File(webRoot + dir + \"/\" + file);\n/*\t\tFile newfile2 = new File(webRoot + dir + \"/\"\n + constants.WEB_CONFIG_FILE_NAME);*/\n try {\n newfile.createNewFile();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n\n\n this.IniFile.writeIniString(webRoot + dir + \"/\" + file, \"TBSAPP\",\n \"defaultUrl\", web);\n this.IniFile.writeIniString(webRoot + dir + \"/\" + file, \"TBSAPP\", \"AppCode\",\n code);\n this.IniFile.writeIniString(webRoot + dir + \"/\" + file, \"TBSAPP\", \"AppName\",\n name);\n this.IniFile.writeIniString(webRoot + dir + \"/\" + file, \"TBSAPP\", \"AppVersion\",\n \"1.0\");\n AppManagerActivity.myThread handThread = new AppManagerActivity.myThread(dir, file);\n handThread.run();\n }", "public RestApplication() {\n\t\tsingletons.add(new UtilResource());\n\t\tsingletons.add(new StudentResource());\n\t}", "public static TwitterApplication getInstance() {\n return application;\n }", "public AuctionApp() {\r\n runAuctionApp();\r\n }", "public CsclAppointeeMaster create(long id_);", "public SingletonApplicationEnvironment(String applicationName) throws SIMPLTranslationException\n \t{\n \t\tthis(null, applicationName, null);\n \t}", "public Application(ProtocolStack inParentStack, int listenPort, int appType, long UID){ \n super(UID);\n this.listenPort = listenPort;\n this.mParentStack = inParentStack;\n this.appType = appType; \n }", "public static void setApplication(ApplicationBase instance)\r\n {\r\n ApplicationBase.instance = instance;\r\n }", "public WorkflowApplication(WorkflowApplication other) {\n __isset_bitfield = other.__isset_bitfield;\n if (other.isSetId()) {\n this.id = other.id;\n }\n if (other.isSetProcessId()) {\n this.processId = other.processId;\n }\n if (other.isSetApplicationInterfaceId()) {\n this.applicationInterfaceId = other.applicationInterfaceId;\n }\n if (other.isSetComputeResourceId()) {\n this.computeResourceId = other.computeResourceId;\n }\n if (other.isSetQueueName()) {\n this.queueName = other.queueName;\n }\n this.nodeCount = other.nodeCount;\n this.coreCount = other.coreCount;\n this.wallTimeLimit = other.wallTimeLimit;\n this.physicalMemory = other.physicalMemory;\n if (other.isSetStatuses()) {\n java.util.List<ApplicationStatus> __this__statuses = new java.util.ArrayList<ApplicationStatus>(other.statuses.size());\n for (ApplicationStatus other_element : other.statuses) {\n __this__statuses.add(new ApplicationStatus(other_element));\n }\n this.statuses = __this__statuses;\n }\n if (other.isSetErrors()) {\n java.util.List<org.apache.airavata.model.commons.ErrorModel> __this__errors = new java.util.ArrayList<org.apache.airavata.model.commons.ErrorModel>(other.errors.size());\n for (org.apache.airavata.model.commons.ErrorModel other_element : other.errors) {\n __this__errors.add(new org.apache.airavata.model.commons.ErrorModel(other_element));\n }\n this.errors = __this__errors;\n }\n this.createdAt = other.createdAt;\n this.updatedAt = other.updatedAt;\n }", "public ApplicationStub() {\n }", "@SuppressWarnings(\"unused\")\n private CreateOrUpdateApplicationResult() {\n }", "public static RestaurantManagementApp getApplication() {\n return Application.getInstance(RestaurantManagementApp.class);\n }", "@Override\n public Handle<GameAppContext> createGameApp(String name, Handle<GameAppContext> parent, Map<String, String> additionalParams) \n {\n return manager.createGameApp(name, parent, additionalParams);\n }", "public static void createApplicationComponent(ApplicationModule applicationModule) {\n if (instance().applicationComponent == null) {\n instance().applicationComponent = DaggerApplicationComponent.builder()\n .applicationModule(applicationModule)\n .apiModule(new ApiModule())\n .presenterModule(new PresenterModule())\n .utilModule(new UtilModule())\n .build();\n }\n }", "Manifest createManifest();", "public boolean registerApplication(Application application);", "public static AppClient getInstance() {\n return instance;\n }", "public TAppAccess() {\n\t}", "public AppInfo() {\n }", "public com.google.protobuf.Empty registerApplication(org.thethingsnetwork.management.proto.HandlerOuterClass.ApplicationIdentifier request);", "WithCreate withAutoSync(Boolean autoSync);", "public static LoganoApp getApplication() {\n return Application.getInstance(LoganoApp.class);\n }", "private synchronized static void createInstance() {\n if (INSTANCE == null) { \n INSTANCE = new DataConnection();\n }\n }", "protected ApplicationMap createAppMapInstance (String mapname){\n\t\treturn new ApplicationMap(mapname);\t\t\n\t}", "public static AppTest create(Config config) {return null;}", "private synchronized static void createInstance(){\r\n\t\tif (instance == null){\r\n\t\t\tinstance = new Casino();\r\n\t\t}\r\n\t}", "public void setApp(Main application){\n this.application = application;\n }", "RestApplicationModel createRestApplicationModel();", "@Override\n\tpublic void initApplication(BBApplication app) {\n\t\tthis._application = app;\n\t}", "public AddApplicationData (){\n }", "public YoCommunicator(YoApp app) {\n this.app = app;\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tmDataMgrApp = (MainApplication) getApplicationContext();\n\t}", "private SudokuSolverApplication() {\n\t}", "public StockApp()\n {\n reader = new InputReader();\n manager = new StockManager();\n menuSetup();\n }", "public static SyncHistory createEntity() {\n return new SyncHistory();\n }", "SyncStart createSyncStart();", "@Override\n\tpublic ScienceAppExecute create(ScienceAppExecutePK scienceAppExecutePK) {\n\t\tScienceAppExecute scienceAppExecute = new ScienceAppExecuteImpl();\n\n\t\tscienceAppExecute.setNew(true);\n\t\tscienceAppExecute.setPrimaryKey(scienceAppExecutePK);\n\n\t\treturn scienceAppExecute;\n\t}", "public MyApp() {\n sContext = this;\n }", "public static FoodApplication getInstance() {\n return instance;\n }", "java.util.concurrent.Future<StartApplicationResult> startApplicationAsync(StartApplicationRequest startApplicationRequest);", "public BasicAppInfo() {\n super();\n }", "private void createSharedSingletons(Context applicationContext) {\n\t\t// Create Active User\n\t\tActiveUserModel.createInstance(applicationContext);\n\n\t\t// Create Favorites List\n\t\tFavoriteTopicModelList.createInstance(applicationContext);\n\t\tFavoriteCommentModelList.createInstance(applicationContext);\n\n\t\t// Create Read Later list\n\t\tReadLaterTopicModelList.createInstance(applicationContext);\n\t\tReadLaterCommentModelList.createInstance(applicationContext);\n\n\t\t// Create Location Provider\n\t\tLocationProvider.getInstance(applicationContext);\n\t}", "public ParkingApp() {\n runApp();\n }", "public static FlowApplicationSequence createEntity(EntityManager em) {\n FlowApplicationSequence flowApplicationSequence = new FlowApplicationSequence()\n .appSequence(DEFAULT_APP_SEQUENCE);\n return flowApplicationSequence;\n }", "private DiaryApplication getApp() {\n ServletContext application = (ServletContext) context.getMessageContext().get(MessageContext.SERVLET_CONTEXT);\n synchronized (application) {\n DiaryApplication diaryApp = (DiaryApplication) application.getAttribute(\"diaryApp\");\n if (diaryApp == null) {\n try {\n diaryApp = new DiaryApplication();\n diaryApp.setAllPath(application.getRealPath(\"WEB-INF/bookings.xml\"), application.getRealPath(\"WEB-INF/students.xml\"), application.getRealPath(\"WEB-INF/tutors.xml\"));\n application.setAttribute(\"diaryApp\", diaryApp);\n } catch (JAXBException ex) {\n Logger.getLogger(soapService.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(soapService.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n return diaryApp;\n }\n }", "@Override\n public void onCreate() {\n super.onCreate();\n application = this;\n }", "Instance createInstance();", "protected WebApplication createApplication(final String applicationClassName)\n\t{\n\t\ttry\n\t\t{\n\t\t\tClassLoader loader = Thread.currentThread().getContextClassLoader();\n\t\t\tif (loader == null)\n\t\t\t{\n\t\t\t\tloader = getClass().getClassLoader();\n\t\t\t}\n\n\t\t\t// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212\n\t\t\t// final Class<?> applicationClass = loader.loadClass(applicationClassName);\n\t\t\tfinal Class<?> applicationClass = Class.forName(applicationClassName, false, loader);\n\t\t\tif (WebApplication.class.isAssignableFrom(applicationClass))\n\t\t\t{\n\t\t\t\t// Construct WebApplication subclass\n\t\t\t\treturn (WebApplication)applicationClass.getDeclaredConstructor().newInstance();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new WicketRuntimeException(\"Application class \" + applicationClassName +\n\t\t\t\t\t\" must be a subclass of WebApplication\");\n\t\t\t}\n\t\t}\n\t\tcatch (ClassNotFoundException | InstantiationException | IllegalAccessException | SecurityException\n\t\t\t\t| NoSuchMethodException | InvocationTargetException e)\n\t\t{\n\t\t\tthrow new WicketRuntimeException(\"Unable to create application of class \" +\n\t\t\t\tapplicationClassName, e);\n\t\t}\n\t}", "public static FFTApp getApplication() {\n return Application.getInstance(FFTApp.class);\n }", "public ApplicationTest() {\n\t\t/*\n\t\t * This constructor should not be modified. Any initialization code should be\n\t\t * placed in the setUp() method instead.\n\t\t */\n\n\t}", "public Application2() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public static MainActivity instance() {\n Log.d(TAG, \" instance(): called\");\n return inst;\n }", "public static CodeListApplicationService getInstance() {\n\t\tif(instance ==null){\n\t\t\tinstance = new CodeListApplicationServiceImpl();\n\t\t\tSystem.out.println(\"\t\t@ CodeListApplicationServiceImpl에 접근\");\n\t\t}\n\t\treturn instance;\n\t}", "public interface ApplicationService {\n\tOptional<App> getAppByName(String name);\n\n\tOptional<App> getAppByType(String type);\n\n\tApp create(AppCreateForm form);\n}", "private static void createInstance() {\n if (mApiInterface == null) {\n synchronized(APIClient.class) {\n if (mApiInterface == null) {\n mApiInterface = buildApiClient();\n }\n }\n }\n }", "public void setApp(MainFXApplication main) {\n mainApplication = main;\n database = mainApplication.getUsers();\n\n }", "public AppManager() {\n /** have a parking lot operator */\n ParkingLotOperatorInstance = new ParkingLotOperator();\n OperatorThread = new Thread(ParkingLotOperatorInstance);\n OperatorThread.start();\n ParkingLotOperatorInstance.startParkingLot();\n\n /** graceful shutdown */\n Runtime.getRuntime().addShutdownHook(new ProcessorHook());\n }", "java.util.concurrent.Future<CreateApplicationResult> createApplicationAsync(CreateApplicationRequest createApplicationRequest,\n com.amazonaws.handlers.AsyncHandler<CreateApplicationRequest, CreateApplicationResult> asyncHandler);", "private void newApplication() throws Exception{\n\t\t\n\t\tPrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(this.appfile)));\n\t\tint counter = 0;\n\t\t\n\t\twriter.println(\"Scholarship\");\n\t\twriter.println(this.scholarship);\n\t\twriter.println();\n\t\twriter.println(\"Student\");\n\t\twriter.println(this.student);\n\t\twriter.println();\n\t\twriter.println(\"GPA\");\n\t\twriter.println(this.gpa);\n\t\twriter.println();\n\t\twriter.println(\"Education Level\");\n\t\twriter.println(this.edulvl);\n\t\twriter.println();\n\t\twriter.println(\"Date\");\n\t\twriter.println(this.date);\n\t\twriter.println();\n\t\twriter.println(\"Status\");\n\t\twriter.println(this.status);\n\t\twriter.println();\n\t\twriter.println(\"Priority\");\n\t\twriter.println(this.priority);\n\t\twriter.println();\n\n\t\twriter.close();\n\t\t\n\t}" ]
[ "0.66869944", "0.6574492", "0.6512984", "0.64005166", "0.62663466", "0.6063663", "0.6040612", "0.5969038", "0.580241", "0.5765427", "0.5703421", "0.55645216", "0.5560555", "0.5545641", "0.55427516", "0.5533849", "0.5518471", "0.5499832", "0.54973996", "0.5491882", "0.5474138", "0.54717714", "0.5369463", "0.5348549", "0.53418887", "0.531554", "0.53120905", "0.5309406", "0.5284765", "0.52845937", "0.52692825", "0.5233406", "0.5224577", "0.5220443", "0.52188337", "0.5216799", "0.5208275", "0.5207869", "0.5207846", "0.5203954", "0.51958996", "0.51843864", "0.51767385", "0.5176539", "0.5168791", "0.516875", "0.51557", "0.5148349", "0.51472557", "0.5133334", "0.5122877", "0.511522", "0.5110251", "0.5106199", "0.51047975", "0.5089626", "0.5083766", "0.50835663", "0.50759214", "0.5068829", "0.5066479", "0.5061558", "0.5058632", "0.50472593", "0.5043706", "0.50188094", "0.50120574", "0.50107884", "0.5008798", "0.49973822", "0.49946815", "0.49880522", "0.498668", "0.4971715", "0.49555755", "0.4939985", "0.49394393", "0.49348417", "0.49234265", "0.49181762", "0.4909252", "0.4907584", "0.4894", "0.48928013", "0.48919123", "0.48810306", "0.487947", "0.48760647", "0.48703647", "0.48697612", "0.48689327", "0.4868349", "0.4858811", "0.48578426", "0.4857322", "0.48527047", "0.48428625", "0.48405415", "0.4829991", "0.48271286", "0.48196065" ]
0.0
-1
Initialize database from file
private static void loadTableData() { BufferedReader in = null; try { in = new BufferedReader(new FileReader(dataDir + tableInfoFile)); while (true) { // read next line String line = in.readLine(); if (line == null) { break; } String[] tokens = line.split(" "); String tableName = tokens[0]; String tableFileName = tokens[1]; tableNameToSchema.put(tableName, new HashMap<String, Type>()); tableNameToOrdredSchema.put(tableName, new ArrayList<ColumnInfo>()); // attributes data for (int i = 2; i < tokens.length;) { String attName = tokens[i++]; String attTypeName = (tokens[i++]); Type attType = null; /* * Undefined, how to represent dates, crazy longs probably * won't need this for now... */ if (attTypeName.equals("CHAR")) { attType = Types.getCharType(Integer .valueOf(tokens[i++])); } else if (attTypeName.equals("DATE")) { attType = Types.getDateType(); } else if (attTypeName.equals("DOUBLE")) { attType = Types.getDoubleType(); } else if (attTypeName.equals("FLOAT")) { attType = Types.getFloatType(); } else if (attTypeName.equals("INTEGER")) { attType = Types.getIntegerType(); } else if (attTypeName.equals("LONG")) { attType = Types.getLongType(); } else if (attTypeName.equals("VARCHAR")) { attType = Types.getVarcharType(); } else { throw new RuntimeException("Invalid type: " + attTypeName); } tableNameToSchema.get(tableName).put(attName, attType); ColumnInfo ci = new ColumnInfo(attName, attType); tableNameToOrdredSchema.get(tableName).add(ci); } // at this point, table info loaded. // Create table myDatabase.getQueryInterface().createTable(tableName, tableNameToSchema.get(tableName)); // Now, load data into newly created table readTable(tableName, tableFileName); } in.close(); } catch (Exception e) { e.printStackTrace(); Helpers.print(e.getStackTrace().toString(), util.Consts.printType.ERROR); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void initializeDatabase() {\n\t\tArrayList<String> data = DatabaseHandler.readDatabase(DATABASE_NAME);\n\t\tAbstractSerializer serializer = new CineplexSerializer();\n\t\trecords = serializer.deserialize(data);\n\t}", "public FileDatabase(String filename) throws IOException {\n\t\tdatabase = new File(filename);\n\t\tread();\n\t}", "@Override\n\tpublic void CreateDatabaseFromFile() {\n\t\tfinal String FILENAME = \"fandv.sql\";\n\t\tint[] updates = null;\n\t\ttry {\n\t\t\tMyDatabase db = new MyDatabase();\n\t\t\tupdates = db.updateAll(FILENAME);\n\t\t} catch (FileNotFoundException | SQLException | ClassNotFoundException e) {\n\t\t\tSystem.out.println(\"Database issue\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < updates.length; i++) {\n\t\t\tsum += updates[i];\n\t\t}\n\t\tSystem.out.println(\"Number of updates: \" + sum);\n\t}", "public static void populateDB(String fileName) {\n String dataString = Util.readStringFromFile(new File(fileName));\n ParseState parseState = new ParseState(dataString);\n while (parseState.hasMoreLines()) {\n String line = parseState.getNextLine();\n LineParser lineParser = null;\n if (line.matches(\"^objects\\\\s*\\\\{$\")) {\n lineParser = new ObjectLineParser();\n } else if (line.matches(\"^links\\\\s*\\\\{$\")) {\n lineParser = new LinkLineParser();\n } else if (line.matches(\"^attributes\\\\s*\\\\{$\")) {\n lineParser = new AttributeDefLineParser();\n } else if (line.matches(\"^containers\\\\s*\\\\{$\")) {\n lineParser = new ContainerLineParser();\n } else {\n throw new IllegalArgumentException(\"Unknown top-level category: \" + line);\n }\n parseBlock(parseState, lineParser);\n }\n }", "public void createDB() {\n\t\ttry {\n\t\t\tBufferedReader br= new BufferedReader(new FileReader(\"db_schema.txt\"));\n\t\t\tString line= null;\n\t\t\tStringBuilder sb= new StringBuilder();\n\t\t\twhile ((line=br.readLine())!=null){\n\t\t\t\tsb.append(line);\n\t\t\t\tif(sb.length()>0 && sb.charAt(sb.length()-1)==';'){//see if it is the end of one line of command\n\t\t\t\t\tstatement.executeUpdate(sb.toString());\n\t\t\t\t\tsb= new StringBuilder();\n\t\t\t\t}\n\t\t\t}\n\t\t\tbr.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public DbRecord( String szFileName )\n throws FileNotFoundException, NullPointerException, AppException\n {\n Load( szFileName );\n }", "protected void setupDB() {\n\t\tlog.info(\"------------------------------------------\");\n\t\tlog.info(\"Initialization database started\");\n\t\tlog.info(\"ddl: db-config.xml\");\n\t\tlog.info(\"------------------------------------------\");\n\t\ttry {\n\t\t\tfinal List<String> lines = Files.readAllLines(Paths.get(this.getClass()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getClassLoader()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getResource(\"create-campina-schema.sql\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.toURI()), Charset.forName(\"UTF-8\"));\n\n\t\t\tfinal List<String> statements = new ArrayList<>(lines.size());\n\t\t\tString statement = \"\";\n\t\t\tfor (String string : lines) {\n\t\t\t\tstatement += \" \" + string;\n\t\t\t\tif (string.endsWith(\";\")) {\n\t\t\t\t\tstatements.add(statement);\n\t\t\t\t\tstatement = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry (final Connection con = conManager.getConnection(Boolean.FALSE)) {\n\t\t\t\ttry (final PreparedStatement pstmt = con.prepareStatement(\"DROP SCHEMA IF EXISTS campina\")) {\n\t\t\t\t\tpstmt.executeUpdate();\n\t\t\t\t}\n\t\t\t\tfor (String string : statements) {\n\t\t\t\t\tlog.info(\"Executing ddl: \" + string);\n\t\t\t\t\ttry (final PreparedStatement pstmt = con.prepareStatement(string)) {\n\t\t\t\t\t\tpstmt.executeUpdate();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (SQLException e) {\n\t\t\t\tthrow new IllegalStateException(\"Could not setup db\", e);\n\t\t\t}\n\t\t} catch (Throwable e) {\n\t\t\tlog.error(\"Could not setup database\", e);\n\t\t\tthrow new IllegalStateException(\"ddl file load failed\", e);\n\t\t}\n\t\tlog.info(\"------------------------------------------\");\n\t\tlog.info(\"Initialization database finished\");\n\t\tlog.info(\"------------------------------------------\");\n\t}", "public Database()\r\n\t{\r\n\t\tinitializeDatabase();\r\n\t\t\r\n\t}", "@PostConstruct\r\n public void init() {\n File database = new File(applicationProps.getGeodb());\r\n try {\r\n reader = new DatabaseReader.Builder(database).withCache(new CHMCache()).build();\r\n } catch (IOException e) {\r\n log.error(\"Error reading maxmind DB, \", e);\r\n }\r\n }", "public void database() throws IOException\n {\n \tFile file =new File(\"data.txt\");\n\t if(!file.exists())\n\t {\n\t \tSystem.out.println(\"File 'data.txt' does not exit\");\n\t System.out.println(file.createNewFile());\n\t file.createNewFile();\n\t databaseFileWrite(file);//call the databaseFileRead() method, to initialize data from ArrayList and write data into data.txt\n\t }\n\t else\n\t {\n\t \tdatabaseFileRead();//call the databaseFileRead() method, to load data directly from data.txt\n\t }\n }", "public int loadDatabase(){\n\n try {\n BufferedReader bufferedReader = new BufferedReader(new FileReader(databaseFileName));\n String line = bufferedReader.readLine();\n while (line != null) {\n HashMap<String,String> activityString = parseStatement(line);\n System.out.println(activityString);\n Activity activity = new Activity();\n activity.create(activityString);\n allActivities.add(activity);\n line = bufferedReader.readLine();\n\n }\n }\n catch(Exception e){\n System.out.println(e);\n return -1;\n }\n\n\n //TODO: write utility to load database, including loading csv hashes into activity classes. Activity class - > needs list of accepted attr?\n\n return 0;\n }", "private static void readDatabase(String path) {\n try {\n FileInputStream fileIn = new FileInputStream(path + \"/database.ser\");\n ObjectInputStream inStream = new ObjectInputStream(fileIn);\n database = (Database) inStream.readObject();\n inStream.close();\n fileIn.close();\n } catch (IOException i) {\n i.printStackTrace();\n } catch (ClassNotFoundException c) {\n c.printStackTrace();\n }\n }", "public static void initialize()\n\t{\n\t\tProperties props = new Properties();\n\t\tFileInputStream in = new fileInputStream(\"database.properties\");\n\t\tprops.load(in);\n\t\tin.close();\n\t\tString drivers = props.getProperty(\"jdbc.drivers\");\n\t\tif (drivers != null)\n\t\t\tSystem.setProperty(\"jdbc.drivers\", drivers);\n\t\tString url = props.getProperty(\"jdbc.url\");\n\t\tString username = props.getProperty(\"jdbc.username\");\n\t\tString password = props.getProperty(\"jdbc.password\");\n\t\t\n\t\tSystem.out.println(\"url=\"+url+\" user=\"+username+\" password=\"+password);\n\n\t\tdbConnect = DriverManager.getConnection( url, username, password);\n\t\t\n\t\tinitializeDatabase();\n\t}", "public Database() {\n size = 0;\n tables = new HashMap();\n p = new Parse(this);\n }", "@PostConstruct\n\tpublic void init() throws IOException {\n\t\tfsService.parseFileAndBootstrapDb();\n\t}", "public void createDB(String filename) throws SQLException {\n //System.out.printf(\"Connecting to the database %s.%n\", filename);\n /* \n * Connect to the database (file). If the file does not exist, create it.\n */\n Connection db_connection = DriverManager.getConnection(SQLITEDBPATH + filename);\n this.createTables(db_connection);\n this.initTableCities(db_connection);\n this.initTableTeams(db_connection);\n //System.out.printf(\"Connection to the database has been established.%n\");\n db_connection.close();\n //System.out.printf(\"Connection to the database has been closed.%n\");\n }", "public void init() {\n\t\tProperties prop = new Properties();\n\t\tInputStream propStream = this.getClass().getClassLoader().getResourceAsStream(\"db.properties\");\n\n\t\ttry {\n\t\t\tprop.load(propStream);\n\t\t\tthis.host = prop.getProperty(\"host\");\n\t\t\tthis.port = prop.getProperty(\"port\");\n\t\t\tthis.dbname = prop.getProperty(\"dbname\");\n\t\t\tthis.schema = prop.getProperty(\"schema\");\n\t\t\tthis.passwd=prop.getProperty(\"passwd\");\n\t\t\tthis.user=prop.getProperty(\"user\");\n\t\t} catch (IOException e) {\n\t\t\tString message = \"ERROR: db.properties file could not be found\";\n\t\t\tSystem.err.println(message);\n\t\t\tthrow new RuntimeException(message, e);\n\t\t}\n\t}", "private void loadDatabase()\n\t{\n\t\ttry\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t// Check to make sure the Bmod Database is there, if not, try \n\t\t\t\t// downloading from the website.\n\t\t\t\tif(!Files.exists(m_databaseFile))\n\t\t\t\t{\n\t\t\t\t\tFiles.createDirectories(m_databaseFile.getParent());\n\t\t\t\t\n\t\t\t\t\tbyte[] file = ExtensionPoints.readURLAsBytes(\"http://\" + Constants.API_HOST + HSQL_DATABASE_PATH);\n\t\t\t\t\tif(file.length != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tFiles.deleteIfExists(m_databaseFile);\n\t\t\t\t\t\tFiles.write(m_databaseFile, file, StandardOpenOption.CREATE, StandardOpenOption.WRITE);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// make sure we have the proper scriptformat.\n\t\t\t\tsetScriptFormatCorrectly();\n\t\t\t}catch(NullPointerException|IOException ex)\n\t\t\t{\n\t\t\t\tm_logger.error(\"Could not fetch database from web.\", ex);\n\t\t\t}\n\t\t\t\n\t\n\t\t\t\n\t\t\tClass.forName(\"org.hsqldb.jdbcDriver\");\n\t\t\n\t\t\t\n\t\t\tString db = ExtensionPoints.getBmodDirectory(\"database\").toUri().getPath();\n\t\t\tconnection = DriverManager.getConnection(\"jdbc:hsqldb:file:\" + db, \"sa\", \"\");\n\t\t\t\n\t\t\t// Setup Connection\n\t\t\tCSVRecordLoader ldr = new CSVRecordLoader();\n\t\t\n\t\t\t// Load all of the building independent plugins\n\t\t\tfor(Record<?> cp : ldr.getRecordPluginManagers())\n\t\t\t{\n\t\t\t\tm_logger.debug(\"Creating table: \" + cp.getTableName());\n\t\t\t\t// Create a new table\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tgetPreparedStatement(cp.getSQLTableDefn()).execute();\n\t\t\t\t} catch(SQLException ex)\n\t\t\t\t{\n\t\t\t\t\t// Table exists\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tm_logger.debug(\"Doing index:\" + cp.getIndexDefn());\n\t\t\t\t\tif(cp.getIndexDefn() != null)\n\t\t\t\t\t\tgetPreparedStatement(cp.getIndexDefn()).execute();\n\t\t\t\t}catch(SQLException ex)\n\t\t\t\t{\t// index exists\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\n\t\t} catch (Exception ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t\tif(ex instanceof DatabaseIntegrityException)\n\t\t\t\tDatabase.handleCriticalError((DatabaseIntegrityException)ex);\n\t\t\telse\n\t\t\t\tDatabase.handleCriticalError(new DatabaseIntegrityException(ex));\n\t\t}\n\t\t\n\t}", "private void setupDb(){\n try {\n openConnection();\n s.executeUpdate(\"CREATE TABLE IF NOT EXISTS LIB (NAME text UNIQUE , TYPE text, LANGUAGE text, INTRUSIVE text, OPENSOURCE text)\");\n }catch (SQLException e) {\n System.err.println(e.getMessage());\n }finally {\n if (c != null){\n close(c);\n }\n }\n }", "public DB(String db) throws ClassNotFoundException, SQLException {\n // Set up a connection and store it in a field\n Class.forName(\"org.sqlite.JDBC\");\n String url = \"jdbc:sqlite:\" + db;\n\n // stop conn from creating a file if does not exists\n SQLiteConfig config = new SQLiteConfig();\n config.resetOpenMode(SQLiteOpenMode.CREATE);\n\n //connect to the file\n conn = DriverManager.getConnection(url, config.toProperties());\n try (Statement stat = conn.createStatement();) {\n stat.executeUpdate(\"PRAGMA foreign_keys = ON;\");\n }\n }", "public static void setDatabasePath(String filename) {\r\n databasePath = filename;\r\n database = new File(databasePath);\r\n }", "private DBManager() throws Exception {\n file = new File(\"pdfLibraryDB.mv.db\");\n if (!file.exists()) {\n conn = connect();\n stmt = conn.createStatement();\n query = \"CREATE TABLE user(username VARCHAR(30) PRIMARY KEY, password VARCHAR(32));\" +\n \"CREATE TABLE category(id VARCHAR(30) PRIMARY KEY, name VARCHAR(30), username VARCHAR(30), FOREIGN KEY(username) REFERENCES user(username) ON UPDATE CASCADE ON DELETE CASCADE);\"+\n \"CREATE TABLE favorite(id VARCHAR(30) PRIMARY KEY, path VARCHAR(500), keyword VARCHAR(200), searchType VARCHAR(10), category VARCHAR(30),username VARCHAR(30), FOREIGN KEY(username) REFERENCES user(username) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY(category) REFERENCES category(id) ON UPDATE CASCADE ON DELETE CASCADE);\" +\n \"CREATE TABLE history(id VARCHAR(30) PRIMARY KEY, keyword VARCHAR(200), type VARCHAR(10), directory VARCHAR(500), username VARCHAR(30), FOREIGN KEY(username) REFERENCES user(username) ON UPDATE CASCADE ON DELETE CASCADE);\";\n stmt.executeUpdate(query);\n stmt.close();\n conn.close();\n System.out.println(\"DB created!\");\n }\n }", "private void initDatabase() {\n\n String sql = \"CREATE TABLE IF NOT EXISTS books (\\n\"\n + \"\tISBN integer PRIMARY KEY,\\n\"\n + \"\tBookName text NOT NULL,\\n\"\n + \" AuthorName text NOT NULL, \\n\"\n + \"\tPrice integer\\n\"\n + \");\";\n\n try (Connection conn = DriverManager.getConnection(urlPath);\n Statement stmt = conn.createStatement()) {\n System.out.println(\"Database connected\");\n stmt.execute(sql);\n\n } catch (SQLException e) {\n System.out.println(e.getMessage());\n }\n }", "public Database initDB() {\n Database db = new Database(\"dataBase.db\");\n\n// db.insertData(\"1 Dragos Dinescu [email protected] 0744522600 Digi 10-12-2020\");\n// db.insertData(\"2 Adelina Mirea [email protected] 0733651320 Orange 14-10-2020\");\n// db.insertData(\"3 Radu Sorostinean [email protected] 0733723321 Digi 1-10-2020\");\n// db.insertData(\"4 Andrei Brasoveanu [email protected] 0732341390 Vodafone 12-11-2020\");\n return db;\n\n //db.deleteFromDB();\n //db.updateDB(\"1 alex radu [email protected] 022256926 orange 10/08/2010\");\n }", "private void initialize() {\n if (databaseExists()) {\n SharedPreferences prefs = PreferenceManager\n .getDefaultSharedPreferences(mContext);\n int dbVersion = prefs.getInt(SP_KEY_DB_VER, 1);\n if (DATABASE_VERSION != dbVersion) {\n File dbFile = mContext.getDatabasePath(DBNAME);\n if (!dbFile.delete()) {\n Log.w(TAG, \"Unable to update database\");\n }\n }\n }\n if (!databaseExists()) {\n createDatabase();\n }\n }", "private void initDB() {\n dataBaseHelper = new DataBaseHelper(this);\n }", "private createSingletonDatabase()\n\t{\n\t\tConnection conn = createDatabase();\n\t\tcreateTable();\n\t\tString filename = \"Summer expereince survey 2016 for oliver.csv\"; \n\t\timportData(conn, filename);\n\t}", "private void initDb() {\n\t\tif (dbHelper == null) {\n\t\t\tdbHelper = new DatabaseOpenHelper(this);\n\t\t}\n\t\tif (dbAccess == null) {\n\t\t\tdbAccess = new DatabaseAccess(dbHelper.getWritableDatabase());\n\t\t}\n\t}", "public ZipDatabase() throws IOException {\r\n int line = 0;\r\n InputStream is = this.getClass().getResourceAsStream(\"zip.txt\");\r\n BufferedReader br = new BufferedReader(new InputStreamReader(is));\r\n String input;\r\n // parses entries of the form:\r\n // 03064,NH,NASHUA\r\n try {\r\n while ((input = br.readLine()) != null) {\r\n line++;\r\n StringTokenizer st = new StringTokenizer(input, \",\");\r\n if (st.countTokens() == 3) {\r\n String zip = st.nextToken();\r\n String state = st.nextToken();\r\n String city = st.nextToken();\r\n city = fixupCase(city);\r\n zipDB.put(zip, new ZipInfo(zip, city, state));\r\n } else {\r\n throw new IOException(\"Bad zip format, line \" + line);\r\n }\r\n }\r\n } finally {\r\n br.close();\r\n }\r\n }", "public static void createNewDatabaseFile(String startPath)\r\n throws ConnectionFailedException, DatabaseException {\r\n boolean databaseCreated;\r\n try {\r\n databaseCreated = database.createNewFile();\r\n if (!databaseCreated) {\r\n throw new IOException(\"Cannot create file\");\r\n }\r\n\r\n URL databaseResource = Objects.requireNonNull(Paths.get(\r\n startPath + \"resources/database/database.sql\").toUri().toURL());\r\n String decodedPath = URLDecoder.decode(databaseResource.getPath(), \"UTF-8\");\r\n\r\n try (BufferedReader in = new BufferedReader(new FileReader(decodedPath))) {\r\n StringBuilder sqlQuery = new StringBuilder();\r\n while (in.ready()) {\r\n sqlQuery.append(in.readLine());\r\n if (sqlQuery.toString().endsWith(\";\")) {\r\n createBasicSqlTable(sqlQuery.toString());\r\n sqlQuery = new StringBuilder();\r\n }\r\n }\r\n }\r\n } catch (IOException e) {\r\n throwException(e);\r\n }\r\n }", "private void setupDatabase() {\r\n\t\tDatabaseHelperFactory.init(this);\r\n\t\tdatabase = DatabaseHelperFactory.getInstance();\r\n\t}", "public abstract void loadFromDatabase();", "public GosplPopulationInDatabase(File databaseFile, IPopulation<ADemoEntity, Attribute<? extends IValue>> population) {\n\t\t\n\t\t try {\n\t\t\t //;ifexists=true\n\t\t\tthis.connection = DriverManager.getConnection(\n\t\t\t\t\t\"jdbc:hsqldb:file:\"+databaseFile.getPath()+\";create=true;shutdown=true;\", \"SA\", \"\");\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tthrow new RuntimeException(\n\t\t\t\t\t\t\"error while trying to initialize the HDSQL database engine in file \"\n\t\t\t\t\t\t+databaseFile+\": \"+e.getMessage(), e);\n\t\t}\n\t\t loadPopulationIntoDatabase(population);\n\t}", "public int initDb(File coldesc, File csvfile) \n throws InterruptedException, IOException, KeywordConfig.FormatException\n {\n KeywordFactory kwf = new XMLConfiguredKeywordFactory(coldesc);\n FileReader csv = new FileReader(csvfile);\n return initDb(kwf, csv);\n }", "private static void init()\n {\n try\n {\n ObjectInputStream ois = \n new ObjectInputStream(new FileInputStream(lexFile));\n lexDB = (HashMap)ois.readObject();\n ois.close();\n } catch (FileNotFoundException e) {\n System.err.println(\"File not found: \" + e.toString());\n e.printStackTrace();\n System.exit(-1);\n } catch (IOException e) {\n System.err.println(\"IO Exception: \" + e.toString());\n e.printStackTrace();\n System.exit(-1);\n } catch (ClassNotFoundException e) {\n System.err.println(\"Class Not Found Exception: \" + e.toString());\n e.printStackTrace();\n System.exit(-1);\n } // catch\n }", "private void open()\n\t\t{\n\t\t\tconfig=Db4oEmbedded.newConfiguration();\n\t\t\tconfig.common().objectClass(Census.class).cascadeOnUpdate(true);\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tDB=Db4oEmbedded.openFile(config, PATH);\n\t\t\t\tSystem.out.println(\"[DB4O]Database was open\");\n\t\t\t\t\n\t\t\t}\n\t\t\tcatch(Exception e)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"[DB4O]ERROR:Database could not be open\");\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "public static void loadDatabase(){\n\t\ttry(BufferedReader reader = new BufferedReader(new FileReader(filePath))){\n\t\t\tfor(String line; (line = reader.readLine()) != null; ){\n\t\t\t\tString[] info = line.split(Pattern.quote(\"|\"));\n\t\t\t\tString path = info[0].trim();\n\t\t\t\tString fileID = info[1];\n\t\t\t\tInteger nOfChunks = Integer.parseInt(info[2]);\n\t\t\t\tPair<FileID, Integer> pair = new Pair<FileID, Integer>(new FileID(fileID), nOfChunks);\n\t\t\t\tPeer.fileList.put(path, pair);\n\t\t\t}\n\t\t\treader.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t/*\n\t\t * LOAD THE CHUNK LIST\n\t\t */\n\t\ttry(BufferedReader reader = new BufferedReader(new FileReader(chunkPath))){\n\t\t\tfor(String line; (line = reader.readLine()) != null; ){\n\t\t\t\tString[] info = line.split(Pattern.quote(\"|\"));\n\t\t\t\tString fileID = info[0].trim();\n\t\t\t\tInteger chunkNo = Integer.parseInt(info[1]);\n\t\t\t\tInteger drd = Integer.parseInt(info[2]);\n\t\t\t\tInteger ard = Integer.parseInt(info[3]);\n\t\t\t\tChunkInfo ci = new ChunkInfo(fileID,chunkNo,drd,ard);\n\t\t\t\tPeer.chunks.add(ci);\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public CustomerOrderDataBase(String file) {\r\n this.FILE_NAME = file;\r\n orderInfo = new ArrayList<>(4000000);\r\n console = new Scanner(System.in);\r\n try {\r\n loadFile();\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "void smem_init_db() throws SoarException, SQLException, IOException\n {\n smem_init_db(false);\n }", "public NameSurferDataBase(String filename) {\t\n\t\tnameData(filename);\n\t}", "public void init(String path, DatabaseHelper helper) {\n try {\n connection = DriverManager.getConnection(\"jdbc:sqlite:\" + path);\n\n queryCache = new QueryCache();\n\n Statement statement = connection.createStatement();\n ResultSet rs = statement.executeQuery(\"PRAGMA user_version;\");\n int version = rs.getInt(1);\n rs.close();\n\n if(version != DATABASE_SCHEMA_VERSION) {\n Log.debug(\"Database version was {0} but Schema version is {1}\", version, DATABASE_SCHEMA_VERSION);\n\n // Create default data\n if(version == 0) {\n helper.onCreate(this);\n } else {\n helper.onMigration(this, version, DATABASE_SCHEMA_VERSION);\n }\n\n statement = connection.createStatement();\n statement.execute(\"PRAGMA user_version = \" + DATABASE_SCHEMA_VERSION + \";\");\n }\n \n } catch (SQLException ex) {\n Log.error(\"{0}\", ex);\n throw new RuntimeException(\"Database connection failed!\", ex);\n }\n }", "public void initializeDataBase() {\r\n\r\n\r\n\r\n\t\tgetWritableDatabase();\r\n\t\tLog.e(\"DBHelper initializeDataBase \", \"Entered\");\r\n\t\tcreateDatabase = true;\r\n\t\tif (createDatabase) {\r\n\t\t\tLog.e(\"DBHelper createDatabase \", \"true\");\r\n\t\t\t/*\r\n\t\t\t * If the database is created by the copy method, then the creation\r\n\t\t\t * code needs to go here. This method consists of copying the new\r\n\t\t\t * database from assets into internal storage and then caching it.\r\n\t\t\t */\r\n\t\t\ttry {\r\n\t\t\t\t/*\r\n\t\t\t\t * Write over the empty data that was created in internal\r\n\t\t\t\t * storage with the one in assets and then cache it.\r\n\t\t\t\t */\r\n\t\t\t\tcopyStream(DB_PATH_IN, new FileOutputStream(DB_PATH));\r\n\t\t\t}\r\n\t\t\tcatch (Exception e) \r\n\t\t\t{\r\n\t\t\t\tthrow new Error(\"Error copying database\");\r\n\t\t\t}\r\n\t\t} \r\n\t\telse if (upgradeDatabase) \r\n\t\t{\r\n\t\t\tLog.e(\"DBHelper upgradeDatabase \", \"true\");\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\t/*\r\n\t\t\t\t * Write over the empty data that was created in internal\r\n\t\t\t\t * storage with the one in assets and then cache it.\r\n\t\t\t\t */\r\n\t\t\t\tcopyStream(DB_PATH_IN, new FileOutputStream(DB_PATH));\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tthrow new Error(\"Error copying database\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tLog.e(\"DBHelper clear \", \"true\");\r\n\t}", "Database createDatabase();", "public void initDb() {\n String createVac = \"create table if not exists vacancies(id serial primary key,\"\n + \"name varchar(1500) NOT NULL UNIQUE, url varchar (1500), description text, dateVac timestamp);\";\n try (Statement st = connection.createStatement()) {\n st.execute(createVac);\n } catch (SQLException e) {\n LOG.error(e.getMessage());\n }\n }", "public void init() {\r\n\t\tdbVersion = new DBVersion( getDefaultDatabase(), progress, upgradeFile.versionTableName, upgradeFile.logTableName );\r\n\t}", "public void loadFromDatabase(){\r\n /**\r\n * Open the file streams to the three files\r\n * Recover the state of data structures\r\n * Close the file streams\r\n */\r\n\r\n try{\r\n //Recover the state of unfinished set from unfinished.dat\r\n unfinishedFileInputStream = new FileInputStream(UNFINISHED_FILE_PATH);\r\n unfinishedSetInputStream = new ObjectInputStream(unfinishedFileInputStream);\r\n unfinished = (Set<Task>)unfinishedSetInputStream.readObject();\r\n unfinishedSetInputStream.close();\r\n unfinishedFileInputStream.close();\r\n\r\n //Recover the state of finished list from finished.dat\r\n finishedFileInputStream = new FileInputStream(FINISHED_FILE_PATH);\r\n finishedListInputStream = new ObjectInputStream(finishedFileInputStream);\r\n finished = (ArrayList<Task>)finishedListInputStream.readObject();\r\n finishedListInputStream.close();\r\n finishedFileInputStream.close();\r\n\r\n //Recover the state of activities list from activities.dat\r\n activitiesFileInputStream = new FileInputStream(ACTIVITIES_FILE_PATH);\r\n activitiesListInputStream = new ObjectInputStream(activitiesFileInputStream);\r\n activities = (ArrayList<Activity>)activitiesListInputStream.readObject();\r\n activitiesListInputStream.close();\r\n activitiesFileInputStream.close();\r\n\r\n generateWeeklySchedule();\r\n }\r\n catch(Exception e){\r\n System.out.println(e.getMessage());\r\n }\r\n }", "public void init() {\r\n BufferedReader in = null;\r\n String line;\r\n PreparedStatement iStmt;\r\n String insertStmt = \"INSERT INTO \" + schema + \"ULDSHAPE \"\r\n + \"(SHAPE, ALLHGHT, ALLLENG, ALLWDTH, BIGPIC, DESCR, INTERNALVOLUME, INTHGHT, INTLENG, INTWDTH, \"\r\n + \"MAXGROSSWGHT, RATING, TAREWGHT, THUMBNAIL, UPDATED, UPDTUSER, VERSION) VALUES \"\r\n + \"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\";\r\n int count = 0;\r\n\r\n LOG.log(Level.INFO, \"Initialize basic Uldshapes in DB from file [{0}]\", path);\r\n\r\n try {\r\n in = new BufferedReader(new InputStreamReader(new FileInputStream(path), StandardCharsets.UTF_8));\r\n\r\n iStmt = conn.prepareStatement(insertStmt);\r\n\r\n while ((line = in.readLine()) != null) {\r\n LOG.finer(line);\r\n\r\n UldshapeVO uldshapeVO = parseUldshape(line);\r\n\r\n iStmt.setString(1, uldshapeVO.getShape());\r\n iStmt.setInt(2, uldshapeVO.getAllhght());\r\n iStmt.setInt(3, uldshapeVO.getAllleng());\r\n iStmt.setInt(4, uldshapeVO.getAllwdth());\r\n iStmt.setBytes(5, uldshapeVO.getBigpic());\r\n iStmt.setString(6, uldshapeVO.getDescr());\r\n iStmt.setInt(7, uldshapeVO.getInternalvolume());\r\n iStmt.setInt(8, uldshapeVO.getInthght());\r\n iStmt.setInt(9, uldshapeVO.getIntleng());\r\n iStmt.setInt(10, uldshapeVO.getIntwdth());\r\n iStmt.setInt(11, uldshapeVO.getMaxgrosswght());\r\n iStmt.setString(12, uldshapeVO.getRating());\r\n iStmt.setInt(13, uldshapeVO.getTarewght());\r\n iStmt.setBytes(14, uldshapeVO.getThumbnail());\r\n iStmt.setTimestamp(15, DbUtil.getCurrentTimeStamp());\r\n iStmt.setString(16, uldshapeVO.getUpdtuser());\r\n iStmt.setLong(17, 0);\r\n\r\n // execute insert SQL stetement\r\n iStmt.executeUpdate();\r\n\r\n ++count;\r\n }\r\n LOG.log(Level.INFO, \"Finished: [{0}] ULDSHAPES loaded\", count);\r\n\r\n DbUtil.cleanupJdbc();\r\n }\r\n catch (IOException ioex) {\r\n LOG.log(Level.SEVERE, \"An IO error occured. The error message is: {0}\", ioex.getMessage());\r\n }\r\n catch (SQLException ex) {\r\n LOG.log(Level.SEVERE, \"An SQL error occured. The error message is: {0}\", ex.getMessage());\r\n }\r\n finally {\r\n if (in != null) {\r\n try {\r\n in.close();\r\n }\r\n catch (IOException e) {\r\n }\r\n }\r\n }\r\n }", "public void initDatabase(){\n CovidOpener cpHelper = new CovidOpener(this);\n cdb = cpHelper.getWritableDatabase();\n }", "public RecipeDataBase(){\n //recipes = new ArrayList<>();\n loadDatabase();\n \n }", "private void initData() {\n\t\tnamesInfo = new NameSurferDataBase(fileName);\n\n\t}", "private void setupDatabase()\n {\n try\n {\n Class.forName(\"com.mysql.jdbc.Driver\");\n }\n catch (ClassNotFoundException e)\n {\n simpleEconomy.getLogger().severe(\"Could not load database driver.\");\n simpleEconomy.getServer().getPluginManager().disablePlugin(simpleEconomy);\n e.printStackTrace();\n }\n\n try\n {\n connection = DriverManager\n .getConnection(String.format(\"jdbc:mysql://%s/%s?user=%s&password=%s\",\n simpleEconomy.getConfig().getString(\"db.host\"),\n simpleEconomy.getConfig().getString(\"db.database\"),\n simpleEconomy.getConfig().getString(\"db.username\"),\n simpleEconomy.getConfig().getString(\"db.password\")\n ));\n\n // Loads the ddl from the jar and commits it to the database.\n InputStream input = getClass().getResourceAsStream(\"/ddl.sql\");\n try\n {\n String s = IOUtils.toString(input);\n connection.createStatement().execute(s);\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n finally\n {\n try\n {\n input.close();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n }\n catch (SQLException e)\n {\n simpleEconomy.getLogger().severe(\"Could not connect to database.\");\n simpleEconomy.getServer().getPluginManager().disablePlugin(simpleEconomy);\n e.printStackTrace();\n }\n }", "public DataBaseHandler(final String pluginDir, final String filename) throws ConnectException {\n final Path filePath = Paths.get(pluginDir, filename);\n this.databaseFile = String.format(\"jdbc:sqlite:%s\", filePath);\n createNewDatabase();\n createTables();\n }", "public void setUp() throws IOException\r\n\t{\r\n\r\n\t\tgraphDb = new GraphDatabaseFactory().newEmbeddedDatabase( dbPath );\r\n\t\tSystem.out.println(\"Connecting to the database...\"); \r\n\t\tSystem.out.println(\"Done!\");\r\n\r\n\t}", "public DataBase(String file) throws IOException {\n\t\tdataBase = new RandomAccessFile(file, \"rw\");\n\t\tdataBase.writeBytes(\"FEATURE_ID|FEATURE_NAME|FEATURE_CLASS|STATE_ALPHA|\"\n\t\t\t\t+ \"STATE_NUMERIC|COUNTY_NAME|COUNTY_NUMERIC|PRIMARY_LAT_DMS|PRIM_LONG_DMS|\"\n\t\t\t\t+ \"PRIM_LAT_DEC|PRIM_LONG_DEC|SOURCE_LAT_DMS|SOURCE_LONG_DMS|SOURCE_LAT_DEC|\"\n\t\t\t\t+ \"SOURCE_LONG_DEC|ELEV_IN_M|ELEV_IN_FT|MAP_NAME|DATE_CREATED|DATE_EDITED\\n\");\n\t}", "public boolean initDB() {\n System.out.println(\"initDB\");\n\n boolean initOK = false;\n\n String s;\n StringBuilder sb = new StringBuilder();\n\n try {\n FileReader fr = new FileReader(new File(\"resources\\\\initDB.sql\"));\n BufferedReader br = new BufferedReader(fr);\n\n while ((s = br.readLine()) != null) {\n sb.append(s);\n }\n br.close();\n\n String[] inst = sb.toString().split(\";\");\n\n Statement stmt = getConnection().createStatement();\n\n for (int i = 0, instLength = inst.length; i < instLength; i++) {\n String anInst = inst[i];\n if (!anInst.trim().equals(\"\")) {\n System.out.println(i + \": \" + anInst);\n\n try {\n stmt.executeUpdate(anInst);\n } catch (SQLException ex) {\n ex.printStackTrace();\n }\n }\n }\n\n initOK = true;\n } catch (FileNotFoundException ex) {\n ex.printStackTrace();\n// throw new RuntimeException(ex);\n } catch (SQLException ex) {\n ex.printStackTrace();\n// throw new RuntimeException(ex);\n } catch (IOException ex) {\n ex.printStackTrace();\n// throw new RuntimeException(ex);\n } catch (NullPointerException ex) {\n ex.printStackTrace();\n }\n\n return initOK;\n }", "public Database(Context context)\n\t{\n\t\t/* Instanciation de l'openHelper */\n\t\tDBOpenHelper helper = new DBOpenHelper(context);\n\t\t\n\t\t/* Load de la database */\n\t\t//TODO passer en asynchrone pour les perfs\n\t\tmainDatabase = helper.getWritableDatabase();\n\t\t\n\t\t/* DEBUG PRINT */\n\t\tLog.i(\"info\", \"Database Loading Suceeded\");\n\t}", "public static void init() {\n if(!initialized){\r\n // Initialize Properties & InputStream variables\r\n Properties prop = new Properties();\r\n InputStream input = null;\r\n\r\n try { // Read the file\r\n String filename = \"config.properties\";\r\n input = MariaDB.class.getClassLoader().getResourceAsStream(filename);\r\n \r\n if(input == null){\r\n System.out.println(\"Unable to find: \" + filename);\r\n return;\r\n }\r\n \r\n prop.load(input);\r\n setAddress(prop.getProperty(\"mysqlAddress\"));\r\n setPort(prop.getProperty(\"mysqlPort\"));\r\n setDatabase(prop.getProperty(\"dbName\"));\r\n setUsername(prop.getProperty(\"dbUser\"));\r\n setPassword(prop.getProperty(\"dbPass\"));\r\n setInitialized(true);\r\n } // end of try\r\n catch(IOException ex) {\r\n ex.printStackTrace();\r\n } // end of catch\r\n finally { // Close the InputStream\r\n if(input != null) {\r\n try {\r\n input.close();\r\n }\r\n catch(IOException ex) {\r\n ex.printStackTrace();\r\n }\r\n }\r\n } // end of finally\r\n } \r\n }", "public void load() {\n mapdb_ = DBMaker.newFileDB(new File(\"AllPoems.db\"))\n .closeOnJvmShutdown()\n .encryptionEnable(\"password\")\n .make();\n\n // open existing an collection (or create new)\n poemIndexToPoemMap_ = mapdb_.getTreeMap(\"Poems\");\n \n constructPoems();\n }", "@Create\n public void init() throws IOException {\n\n final Map<String, String> persistenceProperties;\n try {\n persistenceProperties = getPersistenceProperties();\n } catch (Exception e) {\n\n // Mihai : I know, it is not elegant to cathc all the\n // exception but in this case the try/catch sequence\n // will be to big.\n log.error(e.getMessage(), e);\n throw new IOException(e);\n }\n\n final String dialect = persistenceProperties.get(HIBERNATE_DIALECT_KEY);\n if (dialect == null) {\n final String msg =\n \"The hibernate dialect is null prove your persistence.xml file\";\n final IllegalArgumentException exception =\n new IllegalArgumentException(msg);\n log.error(msg, exception);\n throw exception;\n }\n databaseSystem = DatabaseSystem.getDatabaseForDialect(dialect);\n if (databaseSystem == null) {\n final IllegalArgumentException illegalArgException =\n new IllegalArgumentException(\"The \" + dialect\n + \" is not supported.\");\n log.warn(illegalArgException.getMessage(), illegalArgException);\n throw illegalArgException;\n }\n }", "public void createDatabaseFromAssets() throws IOException {\n try {\n copyDatabase();\n }\n catch (IOException e) {\n LogUtility.NoteLog(e);\n throw new Error(\"Error copying database\");\n }\n }", "private void loadDatabase(){\n \t\n String db = jFieldDBFile.getText().trim();\n boolean badzip = false;\n \n Collection<String> zf = new LinkedList<String>();\n \n // handle zipcodes if zip filtering specified\n if(jCheckBoxZipFilter.isSelected()){\n\t \n \tString zips = jTextFieldZipcodes.getText().trim();\n\t \n\t String[] z = zips.split(\",\");\n\t for(int i = 0; i < z.length; i++){\n\t \tzf.add(z[i].trim());\n\t }\n\t \n\t for(String s : zf){\n\t \tif(s.length() != 5){\n\t \t\tbadzip = true;\n\t \t}\n\t \ttry{\n\t \t\tInteger.parseInt(s);\n\t \t}catch(NumberFormatException ex){\n\t \t\tbadzip = true;\n\t \t}\n\t }\n\t \n }\n \n // if the zipcode input is bad\n if(badzip){\n \toutputResults(\"Please check your zipcodes.\\nA zipcode must be a 5 digit number...\\n\");\n \tjButtonDBLoad.setForeground(new java.awt.Color(255, 37, 37));\n \tjButtonDBLoad.setText(\"Check Zipcodes\");\n }else{\n\t // attempt to load database\n\t try{\n\t \t\n\t \tif(DEBUG_SETDB) db = DEBUG_DB;\n\t \t\n\t \tjButtonDBLoad.setForeground(Color.BLACK);\n\t \tjButtonDBLoad.setText(\"Loading...\");\n\t \tvirtualGPS = DirectionsFinder.getDirectionsFinder(db, zf);\n\t jButtonDBLoad.setText(\"Load Database\");\n\t \n\t \tjPanelAddr.setVisible(true);\n\t \tjPanelDB.setVisible(false);\n\t jButtonDBToAddr.setVisible(true);\n\t \t\n\t }catch(InvalidDatabaseException ex){\n\t \toutputResults(\"Please check the database path.\\nThe path name must refer \" +\n\t \t\t\t\"to a valid Tiger Database...\\n\");\n\t jButtonDBLoad.setForeground(new java.awt.Color(255, 37, 37));\n\t jButtonDBLoad.setText(\"Check Database\");\n\t }\n }\n \t\n }", "public Database(String url) {\n this.url = url;\n\n File f = new File(url);\n\n if (f.exists()) {\n try {\n f.mkdirs();\n f.createNewFile();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n //create table relationship\n LinkedList<String> relationship_attributes = new LinkedList<>();\n relationship_attributes.add(\"id_entity1\");\n relationship_attributes.add(\"id_entity2\");\n relationship_attributes.add(\"description\");\n this.create_table(\"relationship\", relationship_attributes);\n }", "public int initDb(KeywordFactory kwf, Reader csv) \n throws InterruptedException, IOException\n {\n int ex = 0;\n ex = createTable(kwf);\n if (ex > 0) return ex;\n\n ex = loadData(csv, kwf);\n return ex;\n }", "public DB() {\r\n\t\r\n\t}", "public void initDatabase() throws SQLException {\n\n ModelFactory factory = new ModelFactory(this.connection);\n\n StopsDao stopsData = factory.getStopsDao();\n\n ArrayList<Stop> stops = stopsData.getStopsFromCsv(getResource(\"stops.csv\"));\n\n Iterator<Stop> it = stops.iterator();\n while(it.hasNext()) {\n Stop stop = it.next();\n System.out.println(stop.toString());\n }\n\n\n /*\n ShapesDao shapesData = factory.getShapesDao();\n\n ArrayList<Shape> shapes = shapesData.getShapesFromCsv(getResource(\"shapes.csv\"));\n\n Iterator<Shape> it = shapes.iterator();\n while(it.hasNext()) {\n Shape shape = it.next();\n System.out.println(shape.toString());\n }\n\n CalendarDateDao calendarData = factory.getCalendarDatesDao();\n\n ArrayList<CalendarDate> agencies = calendarData.getCalendarDatesFromCsv(getResource(\"calendar_dates.csv\"));\n\n Iterator<CalendarDate> it = agencies.iterator();\n while(it.hasNext()) {\n CalendarDate date = it.next();\n System.out.println(date.toString());\n }\n\n AgencyDao agencyData = factory.getAgencyDao();\n agencyData.drop();\n agencyData.create();\n\n ArrayList<Agency> agencies = agencyData.getAgenciesFromCsv(getResource(\"agency.csv\"));\n\n Iterator<Agency> it = agencies.iterator();\n while(it.hasNext()) {\n Agency age = it.next();\n System.out.println(age.toString());\n agencyData.saveAgency(age);\n }\n\n RoutesDao routesDao = factory.getRouteDao();\n routesDao.drop();\n routesDao.create();\n\n ArrayList<Route> routes = routesDao.getRoutesFromCsv(getResource(\"routes.csv\"));\n\n Iterator<Route> it = routes.iterator();\n while(it.hasNext()) {\n Route route = it.next();\n System.out.println(route.toString());\n }*/\n }", "private void initDB(){\n gistHelper = new GistSQLiteHelper(mainActivity, \"GistsDB\", null, 1);\n db = gistHelper.getWritableDatabase();\n }", "private void preloadDb() {\n String[] branches = getResources().getStringArray(R.array.branches);\n //Insertion from xml\n for (String b : branches)\n {\n dataSource.getTherapyBranchTable().insertTherapyBranch(b);\n }\n String[] illnesses = getResources().getStringArray(R.array.illnesses);\n for (String i : illnesses)\n {\n dataSource.getIllnessTable().insertIllness(i);\n }\n String[] drugs = getResources().getStringArray(R.array.drugs);\n for (String d : drugs)\n {\n dataSource.getDrugTable().insertDrug(d);\n }\n }", "public DatabaseConfig(String conf) throws InvalidConnectionDataException {\n if (conf == null) {\n throw new InvalidConnectionDataException();\n }\n\n HashMap<String, String> map = new HashMap<>();\n\n try (Stream<String> stream = Files.lines(Paths.get(conf))) {\n stream.forEach(line -> addToMap(line, map));\n } catch (IOException e) {\n throw new InvalidConnectionDataException();\n }\n assignFields(map);\n validateFields();\n }", "public FakeDatabase() {\n\t\t\n\t\t// Add initial data\n\t\t\n//\t\tSystem.out.println(authorList.size() + \" authors\");\n//\t\tSystem.out.println(bookList.size() + \" books\");\n\t}", "public void initDatabase() {\n Datastore mongoDataStore = DatabaseHandler.getInstance().getMongoDataStore();\n initUsers();\n initAccounts();\n mongoDataStore.save(users);\n }", "public static void populateDB(Class relativeClass, String fileName) {\n URL dataFileURL = relativeClass.getResource(fileName);\n String dataFile = dataFileURL.getFile();\n populateDB(dataFile);\n }", "public void setUp(final String database) throws IOException {\n\n\t\t// create the database\n\t\ttmpDir = new File(System.getProperty(\"java.io.tmpdir\"), UUID\n\t\t\t\t.randomUUID().toString());\n\t\tdb = new Db();\n\t\tif (database == null) {\n\t\t\tdb.openNewDb(\"testMetaDataDb\", tmpDir, false);\n\t\t} else {\n\t\t\tdb.addDb(\"testMetaDataDb\", database);\n\t\t}\n\t\tdb.setUpDb();\n\t}", "private void configureDB() {\n\t\tmDb = mDbHelper.getWritableDatabase();\n\t}", "public SQLite(String dbLocation) {\n this.dbLocation = dbLocation;\n }", "public void initialize() {\r\n final String JDBC_DRIVER = \"org.h2.Driver\";\r\n final String DB_URL = \"jdbc:h2:./res/AnimalShelterDB\";\r\n final String USER = \"\";\r\n final String PASS;\r\n\r\n System.out.println(\"Attempting to connect to database\");\r\n try {\r\n Class.forName(JDBC_DRIVER);\r\n Properties prop = new Properties();\r\n prop.load(new FileInputStream(\"res/properties\"));\r\n PASS = prop.getProperty(\"password\");\r\n conn = DriverManager.getConnection(DB_URL, USER, PASS);\r\n stmt = conn.createStatement();\r\n System.out.println(\"Successfully connected to Animal database!\");\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n Alert a = new Alert(Alert.AlertType.ERROR);\r\n a.show();\r\n }\r\n startTA();\r\n }", "public static ParserResult loadDatabase(File fileToOpen, String encoding) throws IOException {\n \n Reader reader = getReader(fileToOpen, encoding);\n String suppliedEncoding = null;\n try {\n boolean keepon = true;\n int piv = 0, c;\n while (keepon) {\n c = reader.read();\n if ( (piv == 0 && Character.isWhitespace( (char) c)) ||\n c == GUIGlobals.SIGNATURE.charAt(piv))\n piv++;\n else\n keepon = false;\n found: if (piv == GUIGlobals.SIGNATURE.length()) {\n keepon = false;\n // Found the signature. The rest of the line is unknown, so we skip it:\n while (reader.read() != '\\n');\n // Then we must skip the \"Encoding: \"\n for (int i=0; i<GUIGlobals.encPrefix.length(); i++) {\n if (reader.read() != GUIGlobals.encPrefix.charAt(i))\n break found; // No, it doesn't seem to match.\n }\n // If ok, then read the rest of the line, which should contain the name\n // of the encoding:\n StringBuffer sb = new StringBuffer();\n while ((c = reader.read()) != '\\n')\n sb.append((char)c);\n suppliedEncoding = sb.toString();\n }\n \n }\n } catch (IOException ex) {}\n \n if ((suppliedEncoding != null) && (!suppliedEncoding.equalsIgnoreCase(encoding))) {\n Reader oldReader = reader;\n try {\n // Ok, the supplied encoding is different from our default, so we must make a new\n // reader. Then close the old one.\n reader = getReader(fileToOpen, suppliedEncoding);\n oldReader.close();\n //System.out.println(\"Using encoding: \"+suppliedEncoding);\n } catch (IOException ex) {\n reader = oldReader; // The supplied encoding didn't work out, so we keep our\n // existing reader.\n \n //System.out.println(\"Error, using default encoding.\");\n }\n } else {\n // We couldn't find a supplied encoding. Since we don't know far into the file we read,\n // we start a new reader.\n reader.close();\n reader = getReader(fileToOpen, encoding);\n //System.out.println(\"No encoding supplied, or supplied encoding equals default. Using default encoding.\");\n }\n \n \n //return null;\n \n BibtexParser bp = new BibtexParser(reader);\n \n ParserResult pr = bp.parse();\n pr.setEncoding(encoding);\n \n return pr;\n }", "public File getInputDb();", "private void recreateDatabaseSchema() {\n\t\t// Fetch database schema\n\t\tlogger.info(\"Reading database schema from file\");\n\t\tString[] schemaSql = loadFile(\"blab_schema.sql\", new String[] { \"--\", \"/*\" }, \";\");\n\n\t\tConnection connect = null;\n\t\tStatement stmt = null;\n\t\ttry {\n\t\t\t// Get the Database Connection\n\t\t\tlogger.info(\"Getting Database connection\");\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t\tconnect = DriverManager.getConnection(Constants.create().getJdbcConnectionString());\n\n\t\t\tstmt = connect.createStatement();\n\n\t\t\tfor (String sql : schemaSql) {\n\t\t\t\tsql = sql.trim(); // Remove any remaining whitespace\n\t\t\t\tif (!sql.isEmpty()) {\n\t\t\t\t\tlogger.info(\"Executing: \" + sql);\n\t\t\t\t\tSystem.out.println(\"Executing: \" + sql);\n\t\t\t\t\tstmt.executeUpdate(sql);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (ClassNotFoundException | SQLException ex) {\n\t\t\tlogger.error(ex);\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (stmt != null) {\n\t\t\t\t\tstmt.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException ex) {\n\t\t\t\tlogger.error(ex);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (connect != null) {\n\t\t\t\t\tconnect.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException ex) {\n\t\t\t\tlogger.error(ex);\n\t\t\t}\n\t\t}\n\t}", "public void init() {\n\t\tTypedQuery<Personne> query = em.createQuery(\"SELECT p FROM Personne p\", Personne.class);\n\t\tList<Personne> clients = query.getResultList();\n\t\tif (clients.size()==0) {\n\t\t\tSqlUtils.executeFile(\"exemple.sql\", em);\n\t\t}\n\t}", "private DatabaseRepository() {\n try {\n // connect to database\n\n DB_URL = \"jdbc:sqlite:\"\n + this.getClass().getProtectionDomain()\n .getCodeSource()\n .getLocation()\n .toURI()\n .getPath().replaceAll(\"[/\\\\\\\\]\\\\w*\\\\.jar\", \"/\")\n + \"lib/GM-SIS.db\";\n connection = DriverManager.getConnection(DB_URL);\n mapper = ObjectRelationalMapper.getInstance();\n mapper.initialize(this);\n }\n catch (SQLException | URISyntaxException e) {\n System.out.println(e.toString());\n }\n }", "public void init() {\n\n\t\tConnection connection = null;\n\t\tStatement statement = null;\n\n\t\ttry {\n\n\t\t\tconnection = DatabaseInteractor.getConnection();\n\t\t\tstatement = connection.createStatement();\n\n\t\t} catch (SQLException exception) {\n\t\t\texception.printStackTrace();\n\t\t\treturn;\n\t\t} catch (ClassNotFoundException exception) {\n\t\t\texception.printStackTrace();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\n\t\t\tDatabaseInteractor.createTable(StringConstants.USERS_TABLE, statement);\n\t\t\tDatabaseInteractor.createTable(StringConstants.QUESTIONS_TABLE, statement);\n\t\t\tDatabaseInteractor.createTable(StringConstants.ANSWERS_TABLE, statement);\n\t\t\tDatabaseInteractor.createTable(StringConstants.TOPICS_TABLE, statement);\n\t\t\tDatabaseInteractor.createTable(StringConstants.USER_QUESTION_VOTES_TABLE, statement);\n\t\t\tDatabaseInteractor.createTable(StringConstants.USER_ANSWER_VOTES_TABLE, statement);\n\t\t\tDatabaseInteractor.createTable(StringConstants.USER_TOPIC_RANKS_TABLE, statement);\n\n\t\t} catch (ClassNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "public static DBMaker openFile(String file){\n DBMaker m = new DBMaker();\n m.location = file;\n return m;\n }", "@Before\n public void initDb() {\n mDatabase = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getContext(),\n ToDoDatabase.class).build();\n }", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public GosplPopulationInDatabase() {\n\t\ttry {\n\t\t\tthis.connection = DriverManager.getConnection(\n\t\t\t\t\t\"jdbc:hsqldb:mem:\"+mySqlDBname+\";shutdown=true\", \"SA\", \"\");\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tthrow new RuntimeException(\n\t\t\t\t\t\"error while trying to initialize the HDSQL database engine in memory: \"+e.getMessage(), e);\n\t\t}\n\t}", "@Override\n public Database getAndInitialize() throws IOException {\n Database database = Databases.createPostgresDatabaseWithRetry(\n username,\n password,\n connectionString,\n isDatabaseConnected(databaseName));\n\n new ExceptionWrappingDatabase(database).transaction(ctx -> {\n boolean hasTables = tableNames.stream().allMatch(tableName -> hasTable(ctx, tableName));\n if (hasTables) {\n LOGGER.info(\"The {} database has been initialized\", databaseName);\n return null;\n }\n LOGGER.info(\"The {} database has not been initialized; initializing it with schema: {}\", databaseName, initialSchema);\n ctx.execute(initialSchema);\n return null;\n });\n\n return database;\n }", "public static void read(Connection connection, File readFromFile) {\r\n DefaultDbloadContext context = new DefaultDbloadContext(connection);\r\n DefaultDbloadImpl dbload = new DefaultDbloadImpl();\r\n dbload.readFromFile(context, readFromFile);\r\n }", "public sqlDatabase() {\n }", "DataBase createDataBase();", "private Database() throws SQLException {\n con = DriverManager.getConnection(\"jdbc:oracle:thin:@localhost:1521:MusicAlbums\", \"c##dba\", \"sql\");\n }", "public static MainDatabase deserializeDatabase() {\n MainDatabase data = new MainDatabase();\n // first check if the file exists\n File file = new File(Constants.SAVE_FILE);\n if (!file.exists()) {\n return data;\n }\n try (FileInputStream in = new FileInputStream(Constants.SAVE_FILE);\n BufferedInputStream reader = new BufferedInputStream(in)) {\n\n // un-encrypted header (salt and iv necessary for decryption)\n byte[] salt = new byte[reader.read()];\n reader.read(salt);\n byte[] iv = new byte[reader.read()];\n reader.read(iv);\n Cipher enc = getEncryptionCipher(salt, iv);\n\n try (CipherInputStream cis = new CipherInputStream(reader, enc);\n ObjectInputStream ois = new ObjectInputStream(cis)) {\n\n // if we need any settings, read them here\n\n // read the travel database\n int count = ois.readByte();\n for (int i = 0; i < count; i++) {\n int size = ois.readInt();\n for (int j = 0; j < size; j++) {\n data.addTravel((SingleTravel) ois.readObject());\n }\n }\n\n // read the user database\n count = ois.readInt();\n for (int i = 0; i < count; i++) {\n RegisteredUser ru = (RegisteredUser) ois.readObject();\n data.addUser(ru);\n\n int size = ois.readInt();\n for (int j = 0; j < size; j++) {\n int itSize = ois.readInt();\n // check the itinerary to make sure it is still valid\n boolean validItinerary = (itSize > 0);\n Itinerary it = new Itinerary();\n for (int k = 0; k < itSize; k++) {\n try {\n SingleTravel st = data.getTravel(TravelType.values()[ois.readByte()],\n ois.readUTF());\n if (st == null) { // doesn't exist; do not add itinerary\n validItinerary = false;\n } else {\n it.add(st);\n }\n } catch (IllegalArgumentException e) {\n validItinerary = false;\n // we don't need to log this -- probably a travel expired\n }\n }\n if (validItinerary) {\n ru.bookItinerary(it);\n }\n }\n }\n }\n } catch (IOException | GeneralSecurityException | ClassNotFoundException e) {\n log.log(Level.SEVERE, \"Error reading from file.\", e);\n }\n return data;\n }", "private void createDB() {\n try {\n Statement stat = conn.createStatement();\n stat.execute(\"CREATE TABLE settings (name TEXT, state);\");\n stat.execute(\"CREATE TABLE expressions (id INTEGER PRIMARY KEY ASC AUTOINCREMENT, expression TEXT);\");\n stat.execute(\"CREATE TABLE summaries (id INTEGER PRIMARY KEY ASC, expression_id INTEGER, title TEXT, abstract TEXT);\");\n stat.execute(\"CREATE TABLE history (id INTEGER PRIMARY KEY ASC AUTOINCREMENT, expression TEXT);\");\n } catch (SQLException e) {\n System.err.println(e.getClass().getName() + \": \" + e.getMessage());\n System.exit(0);\n }\n }", "public GraphDB(String dbPath) {\n try {\n File inputFile = new File(dbPath);\n SAXParserFactory factory = SAXParserFactory.newInstance();\n SAXParser saxParser = factory.newSAXParser();\n GraphBuildingHandler gbh = new GraphBuildingHandler(this);\n saxParser.parse(inputFile, gbh);\n } catch (ParserConfigurationException | SAXException | IOException e) {\n e.printStackTrace();\n }\n clean();\n }", "public DbBasic1( String _dbName ) {\n\t\tdbName = _dbName;\n\n\t\tif ( debug )\n\t\t\tSystem.out.println(\n\t\t\t\t \"Db.constructor [\"\n\t\t\t\t+ dbName\n\t\t\t\t+ \"]\");\n\n\t\topen();\n\t\treadMetaData();\n\t\tprintData();\n\t}", "private void open() {\n\t\tFile dbf = new File( dbName );\n\n\t\tif ( dbf.exists( ) == false ) {\n\t\t\tSystem.out.println(\n\t\t\t\t \"SQLite database file [\"\n\t\t\t\t+ dbName\n\t\t\t\t+ \"] does not exist\");\n\t\t\tSystem.exit( 0 );\n\t\t}\n\t\n\t\ttry {\n\t\t\tClass.forName( JDBC_DRIVER );\n\t\t\tgetConnection( );\n\t\t}\n\t\tcatch ( ClassNotFoundException cnfe ) {\n\t\t\tnotify( \"Db.Open\", cnfe );\n\t\t}\n\n\t\tif ( debug )\n\t\t\tSystem.out.println( \"Db.Open : leaving\" );\n\t}", "public RDB() throws Exception\r\n\t{\r\n\t\tthis(Preferences.getURL());\r\n\t}", "private void initConfig() throws DatabaseAccessException {\n\t\tStatement stmt = null;\n\n\t\ttry {\n\t\t\tstmt = this.connection.createStatement();\n\n\t\t\t// With synchronous OFF, SQLite continues without syncing\n\t\t\t// as soon as it has handed data off to the operating system.\n\t\t\tstmt.execute(\"PRAGMA synchronous = OFF;\");\n\n\t\t\t// The MEMORY journaling mode stores the rollback journal in volatile RAM.\n\t\t\t// This saves disk I/O but at the expense of database safety and integrity.\n\t\t\tstmt.execute(\"PRAGMA journal_mode = MEMORY;\");\n\n\t\t\t// The journal_size_limit pragma may be used to limit the size of rollback-journal.\n\t\t\t// -1 means no limit.\n\t\t\tstmt.execute(\"PRAGMA journal_size_limit = -1;\");\n\n\t\t\t// If the argument N is negative, then the number of cache pages\n\t\t\t// is adjusted to use approximately N*1024 bytes of memory.\n\t\t\tstmt.execute(\"PRAGMA cache_size = -50000;\");\n\n\t\t\t// Once an encoding has been set for a database, it cannot be changed.\n\t\t\tstmt.execute(\"PRAGMA encoding = \\\"UTF-8\\\";\");\n\n\t\t\t// When temp_store is MEMORY temporary tables and indices are kept\n\t\t\t// in as if they were pure in-memory databases memory.\n\t\t\tstmt.execute(\"PRAGMA temp_store = MEMORY;\");\n\n\t\t\tstmt.close();\n\n\t\t} catch (SQLException e) {\n\t\t\tthrow new DatabaseAccessException(Failure.CONFIG);\n\t\t}\n\t}", "private static void initializeDatabase()\n\t{\n\t\tResultSet resultSet = dbConnect.getMetaData().getCatalogs();\n\t\tStatment statement = dbConnect.createStatement();\n\t\t\n\t\tif (resultSet.next())\n\t\t{\n\t\t\tstatement.execute(\"USE \" + resultSet.getString(1));\n\t\t\tstatement.close();\n\t\t\tresultSet.close();\n\t\t\treturn; //A database exists already\n\t\t}\n\t\tresultSet.close();\n\t\t//No database exists yet, create it.\n\t\t\n\t\tstatement.execute(\"CREATE DATABASE \" + dbName);\n\t\tstatement.execute(\"USE \" + dbName);\n\t\tstatement.execute(createTableStatement);\n\t\tstatement.close();\n\t\treturn;\n\t}", "private void loadDatabase() {\n Runnable load = new Runnable() {\n public void run() {\n try {\n boolean isSuccess = false;\n File data = Environment.getDataDirectory();\n\n String currentDbPath = \"//data//com.udacity.adcs.app.goodintents//databases//goodintents.db\";\n\n File currentDb = new File(data, currentDbPath);\n File restoreDb = getFileFromAsset(mActivity, mActivity.getExternalFilesDir(null) + \"/\", \"goodintents.db\");\n\n if (restoreDb != null ? restoreDb.exists() : false) {\n FileInputStream is = new FileInputStream(restoreDb);\n FileOutputStream os = new FileOutputStream(currentDb);\n\n FileChannel src = is.getChannel();\n FileChannel dst = os.getChannel();\n dst.transferFrom(src, 0, src.size());\n\n is.close();\n os.close();\n src.close();\n dst.close();\n isSuccess = true;\n }\n\n if (isSuccess) {\n PreferencesUtils.setBoolean(mActivity, R.string.initial_db_load_key, true);\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n } finally {\n mActivity.runOnUiThread(loadDatabaseRunnable);\n }\n }\n };\n\n Thread thread = new Thread(null, load, \"loadDatabase\");\n thread.start();\n }", "static void resetTestDatabase() {\n String URL = \"jdbc:mysql://localhost:3306/?serverTimezone=CET\";\n String USER = \"fourthingsplustest\";\n\n InputStream stream = UserStory1Test.class.getClassLoader().getResourceAsStream(\"init.sql\");\n if (stream == null) throw new RuntimeException(\"init.sql\");\n try (Connection conn = DriverManager.getConnection(URL, USER, null)) {\n conn.setAutoCommit(false);\n ScriptRunner runner = new ScriptRunner(conn);\n runner.setStopOnError(true);\n runner.runScript(new BufferedReader(new InputStreamReader(stream)));\n conn.commit();\n } catch (SQLException throwables) {\n throwables.printStackTrace();\n }\n System.out.println(\"Done running migration\");\n }", "public GraphDB(String dbPath) {\n world = new HashMap<>();\n try {\n File inputFile = new File(dbPath);\n FileInputStream inputStream = new FileInputStream(inputFile);\n // GZIPInputStream stream = new GZIPInputStream(inputStream);\n\n SAXParserFactory factory = SAXParserFactory.newInstance();\n SAXParser saxParser = factory.newSAXParser();\n GraphBuildingHandler gbh = new GraphBuildingHandler(this);\n saxParser.parse(inputStream, gbh);\n } catch (ParserConfigurationException | SAXException | IOException e) {\n e.printStackTrace();\n }\n clean();\n }" ]
[ "0.7548207", "0.7158145", "0.6648796", "0.66438127", "0.6642097", "0.66413355", "0.6599986", "0.6593157", "0.6557276", "0.65557224", "0.6514799", "0.6482477", "0.6468478", "0.6453314", "0.6424349", "0.63794047", "0.6348668", "0.6338576", "0.6336453", "0.6335966", "0.63340217", "0.63170105", "0.6315533", "0.6308761", "0.6307574", "0.6288968", "0.6261701", "0.6250147", "0.6245243", "0.6216636", "0.6212712", "0.6193673", "0.6191801", "0.6144145", "0.6143818", "0.6143105", "0.61090094", "0.61040527", "0.60914236", "0.6089281", "0.60875994", "0.60675824", "0.6065884", "0.60600567", "0.6053039", "0.6026049", "0.6024807", "0.6021641", "0.6021099", "0.60092705", "0.5974479", "0.5973495", "0.596442", "0.5964014", "0.59574354", "0.59536743", "0.5942852", "0.5938911", "0.5901492", "0.5892192", "0.58894825", "0.5884743", "0.5880443", "0.58702886", "0.5868823", "0.5852288", "0.5841492", "0.5833784", "0.5833215", "0.5820431", "0.58195406", "0.58130234", "0.58100355", "0.58038545", "0.5786609", "0.57802", "0.57766443", "0.57756096", "0.57698447", "0.57617724", "0.57495165", "0.5748408", "0.57369465", "0.5734703", "0.57344615", "0.5732368", "0.5729197", "0.5728441", "0.572805", "0.5715637", "0.5700057", "0.5689739", "0.56809646", "0.5674216", "0.56683564", "0.5664409", "0.5652976", "0.5646056", "0.56415254", "0.56385344", "0.5638177" ]
0.0
-1
Load table data from file and insert it into DB.
public static void readTable(String tableName, String filename) { // System.out.println(filename); BufferedReader in = null; try { in = new BufferedReader(new FileReader(dataDir + filename)); while (true) { String line = in.readLine(); if (line == null) { break; } // remove | at end for tokenization line = line.substring(0, line.length() - 1); // line into tokens String[] tokens = line.split(attributeDelimiter); int numAttributes = tokens.length; assert (tokens.length == tableNameToOrdredSchema.get(tableName) .size()); Object[] arr = new Object[numAttributes]; for (int i = 0; i < tokens.length; i++) { Class<?> type = tableNameToOrdredSchema.get(tableName).get( i).getType().getCorrespondingJavaClass(); Object val = null; if (type.isAssignableFrom(String.class)) { val = tokens[i]; } else if (type.isAssignableFrom(java.util.Date.class)) { val = new java.util.Date(tokens[i]); } else if (type.isAssignableFrom(java.lang.Integer.class)) { val = Integer.parseInt(tokens[i]); } else if (type.isAssignableFrom(java.lang.Double.class)) { val = Double.parseDouble(tokens[i]); } else if (type.isAssignableFrom(java.lang.Long.class)) { val = Long.parseLong(tokens[i]); } else if (type.isAssignableFrom(java.lang.Float.class)) { val = Float.parseFloat(tokens[i]); } else { throw new RuntimeException("Type problem"); } arr[i] = val; } SampleRow row = new SampleRow(tableNameToOrdredSchema .get(tableName), arr); myDatabase.getQueryInterface().insertRow(tableName, row); } in.close(); } catch (Exception e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void loadTableData() {\n\n\t\tBufferedReader in = null;\n\t\ttry {\n\t\t\tin = new BufferedReader(new FileReader(dataDir + tableInfoFile));\n\n\t\t\twhile (true) {\n\n\t\t\t\t// read next line\n\t\t\t\tString line = in.readLine();\n\t\t\t\tif (line == null) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tString[] tokens = line.split(\" \");\n\t\t\t\tString tableName = tokens[0];\n\t\t\t\tString tableFileName = tokens[1];\n\n\t\t\t\ttableNameToSchema.put(tableName, new HashMap<String, Type>());\n\t\t\t\ttableNameToOrdredSchema.put(tableName,\n\t\t\t\t\t\tnew ArrayList<ColumnInfo>());\n\n\t\t\t\t// attributes data\n\t\t\t\tfor (int i = 2; i < tokens.length;) {\n\n\t\t\t\t\tString attName = tokens[i++];\n\t\t\t\t\tString attTypeName = (tokens[i++]);\n\n\t\t\t\t\tType attType = null;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Undefined, how to represent dates, crazy longs probably\n\t\t\t\t\t * won't need this for now...\n\t\t\t\t\t */\n\t\t\t\t\tif (attTypeName.equals(\"CHAR\")) {\n\t\t\t\t\t\tattType = Types.getCharType(Integer\n\t\t\t\t\t\t\t\t.valueOf(tokens[i++]));\n\t\t\t\t\t} else if (attTypeName.equals(\"DATE\")) {\n\t\t\t\t\t\tattType = Types.getDateType();\n\t\t\t\t\t} else if (attTypeName.equals(\"DOUBLE\")) {\n\t\t\t\t\t\tattType = Types.getDoubleType();\n\t\t\t\t\t} else if (attTypeName.equals(\"FLOAT\")) {\n\t\t\t\t\t\tattType = Types.getFloatType();\n\t\t\t\t\t} else if (attTypeName.equals(\"INTEGER\")) {\n\t\t\t\t\t\tattType = Types.getIntegerType();\n\t\t\t\t\t} else if (attTypeName.equals(\"LONG\")) {\n\t\t\t\t\t\tattType = Types.getLongType();\n\t\t\t\t\t} else if (attTypeName.equals(\"VARCHAR\")) {\n\t\t\t\t\t\tattType = Types.getVarcharType();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new RuntimeException(\"Invalid type: \"\n\t\t\t\t\t\t\t\t+ attTypeName);\n\t\t\t\t\t}\n\n\t\t\t\t\ttableNameToSchema.get(tableName).put(attName, attType);\n\n\t\t\t\t\tColumnInfo ci = new ColumnInfo(attName, attType);\n\t\t\t\t\ttableNameToOrdredSchema.get(tableName).add(ci);\n\n\t\t\t\t}\n\n\t\t\t\t// at this point, table info loaded.\n\n\t\t\t\t// Create table\n\t\t\t\tmyDatabase.getQueryInterface().createTable(tableName,\n\t\t\t\t\t\ttableNameToSchema.get(tableName));\n\n\t\t\t\t// Now, load data into newly created table\n\t\t\t\treadTable(tableName, tableFileName);\n\n\t\t\t}\n\n\t\t\tin.close();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tHelpers.print(e.getStackTrace().toString(),\n\t\t\t\t\tutil.Consts.printType.ERROR);\n\t\t}\n\n\t}", "private void importData(Connection conn,String filename)\n {\n\t\t\n Statement stmt;\n String query;\n try {\n\t\t\t\t// Step 1: Allocate a database \"Connection\" object\n\t\t\t\tconn = DriverManager.getConnection(\"jdbc:mysql://localhost:\" + PORT_NUMBER + \"/Experiences?user=root&password=root\"); // MySQL\n\t\t\t\t// Step 2: Allocate a \"Statement\" object in the Connection\n\t\t\t\t stmt = conn.createStatement();\n\t\t\t\t {\n\t\t\t\n\n\t\t} }catch(SQLException ex) {\n\t\t\tex.printStackTrace();\n\t\t\t\n\t\t}\n \n \n try\n {\n stmt = conn.createStatement(\n ResultSet.TYPE_SCROLL_SENSITIVE,\n ResultSet.CONCUR_UPDATABLE);\n \n \n query = \"LOAD DATA LOCAL INFILE '\"+filename+\"' INTO TABLE t1 FIELDS TERMINATED BY ',' (question1,question2,question3,question4,question5,question6,question7,question8,question9)\";\n \n stmt.executeUpdate(query);\n \n }\n catch(Exception e)\n {\n e.printStackTrace();\n stmt = null;\n }\n }", "public static void populateTable(Connection conn,\n String fileName)\n throws SQLException {\n ArrayList<Customer> people = new ArrayList<Customer>();\n try {\n BufferedReader br = new BufferedReader(new FileReader(fileName));\n String line;\n while ((line = br.readLine()) != null) {\n String[] split = line.split(\",\");\n people.add(new Customer(split));\n }\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n String sql = createInsertSQL(people);\n\n /**\n * Create and execute an SQL statement\n *\n * execute only returns if it was successful\n */\n Statement stmt = conn.createStatement();\n stmt.execute(sql);\n }", "private static void fillTableFromFile(HashTable table) {\n Scanner in;\n try {\n in = new Scanner(new FileInputStream(\"File.txt\"));\n } catch (FileNotFoundException e) {\n System.out.println(\"File 'File.txt' not found\");\n return;\n }\n while (in.hasNext()) {\n table.add(in.next());\n }\n }", "public void loadFile(File file) {\n\t\ttry {\n\t\t\tBufferedReader in = new BufferedReader(new FileReader(file));\n\t\t\t\n\t\t\t// read the column names\n\t\t\tList<String> first = stringToList(in.readLine());\n\t\t\tcolNames = first;\n\t\t\t\n\t\t\t// each line makes a row in the data model\n\t\t\tString line;\n\t\t\tdata = new ArrayList<List>();\n\t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\tdata.add(stringToList(line));\n\t\t\t}\n\t\t\t\n\t\t\tin.close();\n\t\t\t\n\t\t\t// Send notifications that the whole table is now different\n\t\t\tfireTableStructureChanged();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public Table readTable(String pathName, String filename){\n File file = new File(pathName + filename);\n Table newTable = null;\n Scanner sc; \n //foreign key aspects\n Boolean hasForeignKey = false;\n ArrayList<String> FKIndex; \n String[] line; \n String primaryTableName = \"\", primaryColName = \"\", colName = \"\"; \n String name = \"\";\n\n try {\n sc = new Scanner(file);\n } catch(FileNotFoundException ex) {\n System.out.println(\"ERROR: file not found\");\n return null;\n }\n\n //get table name - always first line\n if (sc.hasNextLine()){\n name = sc.nextLine();\n }\n\n FKIndex = getForeignKeyIndex(pathName);\n //loop over all rows in FKIndex, and check if table has a foreign key\n if(!FKIndex.isEmpty()){\n for(int i = 0; i < FKIndex.size(); i++){\n line = FKIndex.get(i).split(\"\\\\s\"); \n if (line[2].equals(name)){\n hasForeignKey = true;\n primaryTableName = line[0];\n primaryColName = line[1];\n colName = line[3];\n }\n }\n }\n\n //get col names - always second line\n if (sc.hasNextLine()){\n String colNamesString = sc.nextLine();\n //split colNames into individual words as Strings based on whitespace\n String[] colNames = colNamesString.split(\"\\\\s\");\n\n //make table with column names\n if (hasForeignKey){\n newTable = new Table(name, primaryTableName, primaryColName, colName, true, colNames);\n } else {\n newTable = new Table(name, colNames);\n }\n\n //add rows from file (each line)\n while(sc.hasNextLine()){\n String newRowString = sc.nextLine();\n String[] newRow = newRowString.split(\"\\\\s\");\n newTable.addRow(newRow);\n }\n }\n\n sc.close();\n return newTable;\n }", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "String loadTable(String name) {\n\n\n String l;\n String[] line;\n String[] colNames;\n String[] colTypes;\n String[] values;\n\n\n try {\n\n if (tables.get(name) != null) {\n tables.remove(name);\n }\n FileReader fr = new FileReader(name + \".tbl\");\n BufferedReader bf = new BufferedReader(fr);\n\n\n if ((l = bf.readLine()) != null) {\n line = l.split(\"\\\\s*(,|\\\\s)\\\\s*\");\n } else {\n return \"ERROR: Empty Table\";\n }\n colNames = new String[line.length / 2];\n colTypes = new String[line.length / 2];\n\n int j = 0, k = 0;\n\n for (int i = 0; i < line.length; i += 1) {\n if (i % 2 == 0) {\n colNames[j] = line[i];\n j += 1;\n } else {\n colTypes[k] = line[i];\n k += 1;\n }\n\n }\n\n Table t = new Table(name, colNames, colTypes);\n tables.put(name, t);\n\n while ((l = bf.readLine()) != null) {\n values = l.split(\"\\\\s*(,)\\\\s*\");\n t.insertLastRow(values);\n }\n\n bf.close();\n return \"\";\n\n } catch (NullPointerException e) {\n return \"ERROR: \" + e;\n } catch (ArrayIndexOutOfBoundsException e) {\n return \"ERROR: \" + e;\n } catch (NumberFormatException e) {\n return \"ERROR: \" + e;\n } catch (IllegalArgumentException e) {\n return \"ERROR: \" + e;\n } catch (IOException e) {\n return \"ERROR: \" + e;\n } \n }", "public long loadTable(File fromFile)\n throws DBException\n {\n return this.loadTable(fromFile, null, \n true/*insertRecords*/, true/*overwriteExisting*/, false/*noDropWarning*/);\n }", "public static void readFromCSVIntoTable() {\n try {\n for (String tn : ORDERED_TABLE_NAMES) {\n handle.execute(buildInsertIntoFromCSV(tn));\n }\n } catch (Throwable e) {\n itsLogger.error(e.getMessage(), e);\n }\n\n }", "public void loadData() {\n Path path= Paths.get(filename);\n Stream<String> lines;\n try {\n lines= Files.lines(path);\n lines.forEach(ln->{\n String[] s=ln.split(\";\");\n if(s.length==3){\n try {\n super.save(new Teme(Integer.parseInt(s[0]),Integer.parseInt(s[1]),s[2]));\n } catch (ValidationException e) {\n e.printStackTrace();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }else\n System.out.println(\"linie corupta in fisierul teme.txt\");});\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private static void populateTable(String name, File fileObj, Statement stat) {\n\t\tString tableName = \"\";\n\t\tScanner scan = null;\n\t\tString line = \"\";\n\t\tString[] splitLine = null;\n\t\t\n\t\ttableName = \"stevenwbroussard.\" + name;\n\t\ttry {\n\t\t\tscan = new Scanner(fileObj);\n\t\t}\n\t\tcatch(IOException e) {\n\t\t\tSystem.out.println(\"Failed make thread with file.\");\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\t\n\t\t//use a for loop to go through, later use a while loop\n\t\twhile (scan.hasNext() != false) {\n\t\t//for (int i = 0; i < 10; i++) {\n\t\t\tline = scan.nextLine();\n\t\t\tsplitLine = line.split(\"\\\\,\");\n\t\t\t\n\t\t\t//if the type for integer column is NULL\n\t\t\tif (splitLine[0].equals(\"NULL\")) {\n\t\t\t\tsplitLine[0] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[1].equals(\"NULL\")) {\n\t\t\t\tsplitLine[1] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[4].equals(\"NULL\")) {\n\t\t\t\tsplitLine[4] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[5].equals(\"NULL\")) {\n\t\t\t\tsplitLine[5] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[7].equals(\"NULL\")) {\n\t\t\t\tsplitLine[7] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[9].equals(\"NULL\")) {\n\t\t\t\tsplitLine[9] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[11].equals(\"NULL\")) {\n\t\t\t\tsplitLine[11] = \"-1\";\n\t\t\t}\n\t\t\tif (splitLine[13].equals(\"NULL\")) {\n\t\t\t\tsplitLine[13] = \"-1\";\n\t\t\t}\n\t\t\t\n\t\t\t//if the type for double column is NULL\n\t\t\tif (splitLine[6].equals(\"NULL\")) {\n\t\t\t\tsplitLine[6] = \"-1.0\";\n\t\t\t}\n\t\t\tif (splitLine[8].equals(\"NULL\")) {\n\t\t\t\tsplitLine[8] = \"-1.0\";\n\t\t\t}\n\t\t\tif (splitLine[10].equals(\"NULL\")) {\n\t\t\t\tsplitLine[10] = \"-1.0\";\n\t\t\t}\n\t\t\tif (splitLine[12].equals(\"NULL\")) {\n\t\t\t\tsplitLine[12] = \"-1.0\";\n\t\t\t}\n\t\t\tif (splitLine[14].equals(\"NULL\")) {\n\t\t\t\tsplitLine[14] = \"-1.0\";\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tstat.executeQuery(comd.insert(tableName, \n\t\t\t\t\t \t Integer.parseInt(splitLine[0]), \n\t\t\t\t\t \t Integer.parseInt(splitLine[1]), \n\t\t\t\t\t \t splitLine[2], \n\t\t\t\t\t \t splitLine[3], \n\t\t\t\t\t \t Integer.parseInt(splitLine[4]),\n\t\t\t\t\t \t Integer.parseInt(splitLine[5]),\n\t\t\t\t\t \t Double.parseDouble(splitLine[6]), \n\t\t\t\t\t \t Integer.parseInt(splitLine[7]), \n\t\t\t\t\t \t Double.parseDouble(splitLine[8]), \n\t\t\t\t\t \t Integer.parseInt(splitLine[9]), \n\t\t\t\t\t \t Double.parseDouble(splitLine[10]), \n\t\t\t\t\t \t Integer.parseInt(splitLine[11]), \n\t\t\t\t\t \t Double.parseDouble(splitLine[12]), \n\t\t\t\t\t \t Integer.parseInt(splitLine[13]), \n\t\t\t\t\t \t Double.parseDouble(splitLine[14])));\n\t\t\t}\n\t\t\tcatch(SQLException s) {\n\t\t\t\tSystem.out.println(\"SQL insert statement failed.\");\n\t\t\t\ts.printStackTrace();\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t}\n\t\t\n\t}", "@Override\n public void load(String filename, DatasourceSchema datasourceSchema)\n throws BigQueryLoaderException {\n GcsFileToBqTableLoader gcsFileToBqTableLoader = new GcsFileToBqTableLoader(\n bigQueryRepository, filename, datasourceSchema);\n gcsFileToBqTableLoader.load();\n\n // 2- crée la table si elle n'existe pas\n if (bigQueryRepository.tableExists(datasourceSchema.getTableId())) {\n LOGGER.info(\"Table \" + datasourceSchema.getFullTableName() + \" already exists\");\n } else {\n try {\n bigQueryRepository\n .runDDLQuery(\"CREATE TABLE \" + datasourceSchema.getFullTableName() + \" AS \"\n + \"SELECT *, CURRENT_DATETIME() AS load_date_time FROM \" + datasourceSchema\n .getFullTableTmpName() + \" LIMIT 0\");\n } catch (Exception e) {\n throw new BigQueryLoaderException(\n \"Cannot create table \" + datasourceSchema.getFullTableTmpName(), e);\n }\n }\n\n // 3- déverse tout la table cible avec le champ load date time\n try {\n bigQueryRepository.runDDLQuery(\"INSERT INTO `\" + datasourceSchema.getFullTableName() + \"` \"\n + \"SELECT *, CURRENT_DATETIME() AS load_date_time FROM `\" + datasourceSchema\n .getFullTableTmpName() + \"`\");\n } catch (Exception e) {\n throw new BigQueryLoaderException(\n \"Cannot insert from \" + datasourceSchema.getFullTableTmpName()\n + \" into destination table \" + datasourceSchema.getFullTableName(), e);\n }\n\n // 4- drop la table temporaire\n bigQueryRepository.dropTable(datasourceSchema.getTmpTableId());\n }", "public void importTable(BufferedReader br) {\r\n\t\tString line;\r\n\t\tTable table = null;\r\n\t\ttry {\r\n\t\t\tString tableName = br.readLine();\r\n\t\t\ttable = new Table(tableName);\r\n\t\t\tint[] types = convertTypes(br.readLine().split(\",\"));\r\n\t\t\tString[] names = br.readLine().split(\",\");\r\n\t\t\tassert (types.length == names.length);\r\n\t\t\tfor (int i = 0 ; i < types.length - 1; i++) {\r\n\t\t\t\ttable.newAttribute(names[i], types[i]);\r\n\t\t\t}\r\n\t\t\twhile ((line = br.readLine()) != null) {\r\n\t\t\t\tString[] entries = line.split(\",\");\r\n\t\t\t\tString[] entriesMinusLastModified = new String[entries.length - 1];\r\n\t\t\t\tfor (int i = 0; i < entriesMinusLastModified.length; i++) {\r\n\t\t\t\t\tentriesMinusLastModified[i] = entries[i];\r\n\t\t\t\t\tif (!table.getAttributes(i + 1).checkType(\r\n\t\t\t\t\t\t\tentriesMinusLastModified[i])) {\r\n\t\t\t\t\t\tentriesMinusLastModified[i] = \"--\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttable.newEntry(entriesMinusLastModified);\r\n\t\t\t\ttable.getAttributes(table.getAttributeNumber() - 1).\r\n\t\t\t\tchangeField(table.getLines() - 1, entries[entries.length - 1]);\r\n\t\t\t}\r\n\t\t\tbr.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\ttable.delete();\r\n\t\t}\r\n\t}", "protected void importIntoTable(HttpLogData data) throws Exception {\n Db db = getDb();\n st_insert_temp_table.setString(1, data.domain_name);\n st_insert_temp_table.setString(2, data.category);\n st_insert_temp_table.setString(3, data.site_name);\n st_insert_temp_table.setObject(4, null);\n st_insert_temp_table.setTimestamp(5, DateHelper.sql(data.datetime));\n st_insert_temp_table.setLong(6, data.time_taken);\n st_insert_temp_table.setInt(7, getOrCreateAuthorizationId(data.authorization));\n st_insert_temp_table.setLong(8, data.volume_client_to_server);\n st_insert_temp_table.setLong(9, data.volume_server_to_client);\n st_insert_temp_table.setInt(10, data.http_status);\n st_insert_temp_table.setString(11, data.user_agent);\n st_insert_temp_table.setString(12, data.agent_version);\n st_insert_temp_table.setInt(13, data.type);\n st_insert_temp_table.setString(14, data.ip_client);\n st_insert_temp_table.setString(15, obfuscateUsername(data.user_name));\n st_insert_temp_table.setString(16, data.mime_type);\n st_insert_temp_table.setBoolean(17, data.intranet);\n st_insert_temp_table.setString(18, data.path);\n st_insert_temp_table.setInt(19, data.specificFileWithoutReferer ? 1 : 0);\n st_insert_temp_table.setInt(20, data.robotsTxt ? 1 : 0);\n db.executeUpdate(st_insert_temp_table);\n }", "private static void criarTabela(Connection connection) throws IOException, SQLException {\n final Path sqlFile = Paths.get(\"coursera.sql\");\n String sqlData = new String(Files.readAllBytes(sqlFile));\n Statement statement = connection.createStatement();\n statement.executeUpdate(sqlData);\n statement.close();\n connection.close();\n }", "@Override\n public void importCSV(File file) {\n System.out.println(\"oi\");\n System.out.println(file.isFile()+\" \"+file.getAbsolutePath());\n if(file.isFile() && file.getPath().toLowerCase().contains(\".csv\")){\n System.out.println(\"Entro\");\n try {\n final Reader reader = new FileReader(file);\n final BufferedReader bufferReader = new BufferedReader(reader);\n String[] cabecalho = bufferReader.readLine().split(\",\");\n int tipo;\n if(cabecalho.length == 3){\n if(cabecalho[2].equalsIgnoreCase(\"SIGLA\")){\n tipo = 1;\n System.out.println(\"TIPO PAIS\");\n }\n else {\n tipo = 2;\n System.out.println(\"TIPO CIDADE\");\n }\n }else {\n tipo = 3;\n System.out.println(\"TIPO ESTADO\");\n }\n \n while(true){\n String linha = bufferReader.readLine();\n if(linha == null){\n break;\n }\n String[] row = linha.split(\",\");\n switch (tipo) {\n case 1:\n Pais pais = new Pais();\n pais.setId(Long.parseLong(row[0]));\n pais.setNome(row[1]);\n pais.setSigla(row[2]);\n new PaisDaoImpl().insert(pais);\n break;\n case 2:\n Cidade cidade = new Cidade();\n cidade.setId(Long.parseLong(row[0]));\n cidade.setNome(row[1]);\n cidade.setEstado(Long.parseLong(row[2]));\n new CidadeDaoImpl().insert(cidade);\n break;\n default:\n Estado estado = new Estado();\n estado.setId(Long.parseLong(row[0]));\n estado.setNome(row[1]);\n estado.setUf(row[2]);\n estado.setPais(Long.parseLong(row[3]));\n new EstadoDaoImpl().insert(estado);\n break;\n }\n }\n \n } catch (FileNotFoundException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "private void loadData(CopyTable table) throws Exception\n\t{\n\t\tLOG.info(\"Starting to load data of '\" + table.getDescription() + \"' into MonetDB...\");\n\t\tlong startTime = System.currentTimeMillis();\n\t\t\n\t\t// verify all temp files are available\n\t\tFile dataFile = new File(config.getTempDirectory(), table.getTempFilePrefix() + \"_data.csv\");\n\t\tFile countFile = new File(config.getTempDirectory(), table.getTempFilePrefix() + \"_count.txt\");\n\t\tFile metaDataFile = new File(config.getTempDirectory(), table.getTempFilePrefix() + \"_metadata.ser\");\n\t\t\n\t\tif (!countFile.exists())\n\t\t{\n\t\t\tthrow new Exception(\"Missing temporary count file for '\" + table.getDescription() + \"'\");\n\t\t}\n\t\t\n\t\tif (!metaDataFile.exists())\n\t\t{\n\t\t\tthrow new Exception(\"Missing temporary metadata file for '\" + table.getDescription() + \"'\");\n\t\t}\n\t\t\n\t\t// read count\n\t\tBufferedReader br = new BufferedReader(new FileReader(countFile));\n\t\tString countStr = br.readLine();\n\t\tbr.close();\n\t\t\n\t\tLong insertCount = null;\n\t\ttry {\n\t\t\tinsertCount = Long.parseLong(countStr);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new Exception(\"Unable to read row count from temporary count file for '\" + table.getDescription() + \"'\");\n\t\t}\n\t\t\t\n\t\t// read metadata\n\t\tSerializableResultSetMetaData metaData = null;\n\t\ttry {\n\t\t\tFileInputStream fileIn = new FileInputStream(metaDataFile);\n\t\t ObjectInputStream in = new ObjectInputStream(fileIn);\n\t\t metaData = (SerializableResultSetMetaData) in.readObject();\n\t\t in.close();\n\t\t fileIn.close();\n\t\t} catch (IOException | ClassNotFoundException e) {\n\t\t\tthrow new Exception(\"Unable to read metadata from temporary metadata file for '\" + table.getDescription() + \"'\", e);\n\t\t}\n\t\t\n\t\tif (metaData == null)\n\t\t\tthrow new Exception(\"Unable to read metadata from temporary metadata file for '\" + table.getDescription() + \"'\");\n\t\t\n\t\tMonetDBTable copyToTable =\n\t\t\ttable.isCopyViaTempTable() ? table.getTempTable() : table.getCurrentTable();\n\n\t\t// check tables in monetdb\n\t\tcheckTableInMonetDb(copyToTable, metaData);\n\t\t\n\t\t// do truncate?\n\t\tif (table.truncate())\n\t\t{\n\t\t\tMonetDBUtil.truncateMonetDBTable(copyToTable);\n\t\t}\n\t\t\n\t\t// no records to insert? then this method is done\n\t\tif (insertCount == 0)\n\t\t{\n\t\t\tLOG.info(\"Finished loading data into '{}': no data to load\", copyToTable.getName());\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// verify data file exists\n\t\tif (!dataFile.exists())\n\t\t{\n\t\t\tthrow new Exception(\"Missing temporary data file for '\" + table.getDescription() + \"'\");\n\t\t}\n\t\t\n\t\t// load data\n\t\tboolean isLoaded = false;\n\t\t\n\t\t// is it allowed to use COPY INTO method?\n\t\tif (copyToTable.getCopyTable().getCopyMethod() != CopyTable.COPY_METHOD_INSERT)\n\t\t{\n\t\t\t// try to load directly via COPY INTO FROM FILE\n\t\t\ttry {\n\t\t\t\tisLoaded = loadDataFromFile(copyToTable, dataFile, metaData, insertCount, table.isUseLockedMode());\n\t\t\t} catch (SQLException e) {\n\t\t\t\tLOG.warn(\"Failed to load data directly from file: \" + e.getMessage());\n\t\t\t}\n\t\t\t\t\t\n\t\t\t// not loaded? then try loading via COPY INTO FROM STDIN\n\t\t\tif (!isLoaded)\n\t\t\t{\n\t\t\t\ttry {\n\t\t\t\t\tisLoaded = loadDataFromStdin (copyToTable, dataFile, metaData, insertCount, table.isUseLockedMode());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tLOG.warn(\"Failed to load data directly via STDIN: \" + e.getMessage());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// still not loaded? final try with manual INSERTs\n\t\tif (!isLoaded)\n\t\t{\n\t\t\ttry {\n\t\t\t\tisLoaded = loadDataWithInserts (copyToTable, dataFile, metaData, insertCount);\n\t\t\t} catch (Exception e) {\n\t\t\t\tLOG.error(\"Failed to load data with INSERTs: \" + e.getMessage());\n\t\t\t}\n\t\t}\n\t\t\n\t\t// still not loaded? then unable to load, throw exception\n\t\tif (!isLoaded) \n\t\t{\n\t\t\tthrow new Exception(\"Unable to load data into MonetDB for '\" + table.getDescription() + \"'\");\n\t\t}\n\t\t\n\t\tlong loadTime = (System.currentTimeMillis() - startTime) / 1000;\n\t\tLOG.info(\"Finished loading data into \" + copyToTable.getName() + \" in \" + loadTime + \" seconds\");\n\t}", "public void importUserMadeTable(BufferedReader br) {\r\n\t\tString line;\r\n\t\tTable table = null;\r\n\t\ttry {\r\n\t\t\tString tableName = br.readLine();\r\n\t\t\ttable = new Table(tableName);\r\n\t\t\tint[] types = convertTypes(br.readLine().split(\",\"));\r\n\t\t\tString[] names = br.readLine().split(\",\");\r\n\t\t\tassert (types.length == names.length);\r\n\t\t\tfor (int i = 0 ; i < types.length; i++) {\r\n\t\t\t\ttable.newAttribute(names[i], types[i]);\r\n\t\t\t}\r\n\t\t\twhile ((line = br.readLine()) != null) {\r\n\t\t\t\tString[] entries = line.split(\",\");\r\n\t\t\t\tfor (int i = 0; i < entries.length; i++) {\r\n\t\t\t\t\tif (!table.getAttributes(i + 1).checkType(entries[i]))\r\n\t\t\t\t\t\tentries[i] = \"--\";\r\n\t\t\t\t}\r\n\t\t\t\ttable.newEntry(entries);\r\n\t\t\t}\r\n\t\t\tbr.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\ttable.delete();\r\n\t\t}\r\n\t}", "public void insertdata(String file) {\n\r\n\r\n final String csvFile = file;\r\n\r\n try (BufferedReader br = new BufferedReader(new FileReader(csvFile))) {\r\n\r\n\r\n while ((line = br.readLine()) != null) {\r\n\r\n\r\n // use comma as separator\r\n String[] country = line.split(\",\");\r\n\r\n if (country.length == 12) {\r\n model_lacakMobil = new Model_LacakMobil();\r\n realmHelper = new RealmHelper(realm);\r\n\r\n model_lacakMobil.setNama_mobil(country[1]);\r\n model_lacakMobil.setNo_plat(country[2]);\r\n model_lacakMobil.setNamaunit(country[3]);\r\n model_lacakMobil.setFinance(country[4]);\r\n model_lacakMobil.setOvd(country[5]);\r\n model_lacakMobil.setSaldo(country[6]);\r\n model_lacakMobil.setCabang(country[7]);\r\n model_lacakMobil.setNoka(country[8]);\r\n model_lacakMobil.setNosin(country[9]);\r\n model_lacakMobil.setTahun(country[10]);\r\n model_lacakMobil.setWarna(country[11]);\r\n realmHelper.save(model_lacakMobil);\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n// fixing_data();\r\n\r\n }\r\n }", "private void runSqlFromFile(String fileName) throws IOException {\n String[] sqlStatements = StreamUtils.copyToString( new ClassPathResource(fileName).getInputStream(), Charset.defaultCharset()).split(\";\");\n for (String sqlStatement : sqlStatements) {\n sqlStatement = sqlStatement.replace(\"CREATE TABLE \", \"CREATE TABLE OLD\");\n sqlStatement = sqlStatement.replace(\"REFERENCES \", \"REFERENCES OLD\");\n sqlStatement = sqlStatement.replace(\"INSERT INTO \", \"INSERT INTO OLD\");\n jdbcTemplate.execute(sqlStatement);\n }\n }", "public void insertData(String CSVPath, String tablename) throws IOException{\n BufferedReader reader = new BufferedReader(new FileReader(new File(CSVPath)));\n String line = reader.readLine();\n String[] attributes = line.split(\",\");\n\n String sql = \"INSERT INTO \" + tablename + \" (\" + attributes[0];\n for (int i = 1; i < attributes.length; i++){\n sql += \", \";\n sql += attributes[i];\n }\n\n sql += \" ) VALUES \";\n\n while ((line = reader.readLine()) != null){\n line = reader.readLine();\n String[] cols = line.split(\",\");\n session.execute(sql + this.produceSQL(cols));\n }\n return;\n }", "public void loadCSVData() throws IOException, SQLException {\r\n //SQL statement to load csv information into data table\r\n String insertvaluesSQL = \"INSERT INTO data\"\r\n + \"(InvoiceNo, StockCode, Description, Quantity, InvoiceDate, UnitPrice, CustomerID, Country)\"\r\n + \" VALUES (?,?,?,?,?,?,?,?);\";\r\n\r\n //code to read csv file taken from W03 practical\r\n BufferedReader br = new BufferedReader(new FileReader(filePath));\r\n String line = br.readLine();\r\n String[] informationArray;\r\n while (line != null) {\r\n informationArray = line.split(\",\");\r\n PreparedStatement preparedStatement = connection.prepareStatement(insertvaluesSQL);\r\n //the first '?' corresponds to the 0th term in the information array\r\n //the second '?' corresponds to the 1st term in the information array\r\n for (int i = 1; i < 9; i++) {\r\n preparedStatement.setString(i, informationArray[i - 1]);\r\n }\r\n preparedStatement.executeUpdate();\r\n line = br.readLine();\r\n }\r\n Statement statement = connection.createStatement();\r\n statement.executeUpdate(\"DELETE FROM data WHERE InvoiceNo = 'InvoiceNo';\");\r\n statement.close();\r\n }", "public void insertData() throws SQLException, URISyntaxException, FileNotFoundException {\n\t \t\t//On vide la base en premier\n\t \t\tdropDB();\n\t \t\t\n\t \t\t//Fichier contenant les jeux de test\n\t \t\tBufferedReader br = new BufferedReader(new FileReader(\"./data.txt\"));\n\t \t \n\t \t PreparedStatement pstmt = null;\n\t \t Connection conn = null;\n\t \t int id;\n\t \t String lastname, firstname, cardNumber, expirationMonth, expirationYear, cvv, query;\n\t \t try {\n\t \t conn = this.connectToBDD();\n\t \t \n\t \t String line = null;\n\t \t \n\t \t //On lit le fichier data.txt pour inserer en base\n\t \t while((line=br.readLine()) != null) {\n\t \t \t String tmp[]=line.split(\",\");\n\t \t \t id=Integer.parseInt(tmp[0]);\n\t\t\t \t lastname=tmp[1];\n\t\t\t \t firstname=tmp[2];\n\t\t\t \t cardNumber=tmp[3];\n\t\t\t \t expirationMonth=tmp[4];\n\t\t\t \t expirationYear=tmp[5];\n\t\t\t \t cvv=tmp[6];\n\t\t\t \t \n\t\t\t \t //Insertion des clients\n\t\t\t \t query = \"INSERT INTO consumer VALUES(\"+ id + \",'\" +firstname+\"','\"+lastname+\"')\";\n\t\t\t \t \n\t\t\t \t pstmt = conn.prepareStatement(query);\n\t\t\t \t pstmt.executeUpdate();\n\t\t\t \t \n\t\t\t \t \n\t\t\t \t //Insertion des comptes\n\t\t\t \t query = \"INSERT INTO account (card_number, expiration_month, expiration_year, cvv, remain_balance, consumer_id) \"\n\t\t \t\t\t\t+ \"VALUES ('\"+cardNumber+\"','\"+expirationMonth+\"','\"+expirationYear+\"','\"+cvv+\"',300,\"+id+\")\";\n\t\t\t \t\n\t\t\t \t pstmt = conn.prepareStatement(query);\n\t\t\t \t pstmt.executeUpdate();\n\t \t }\n\t \t \n\t \t \n\t \t } catch (Exception e) {\n\t \t System.err.println(\"Error: \" + e.getMessage());\n\t \t e.printStackTrace();\n\t \t }\n\t \t }", "public void loadFromDatabase(){\r\n /**\r\n * Open the file streams to the three files\r\n * Recover the state of data structures\r\n * Close the file streams\r\n */\r\n\r\n try{\r\n //Recover the state of unfinished set from unfinished.dat\r\n unfinishedFileInputStream = new FileInputStream(UNFINISHED_FILE_PATH);\r\n unfinishedSetInputStream = new ObjectInputStream(unfinishedFileInputStream);\r\n unfinished = (Set<Task>)unfinishedSetInputStream.readObject();\r\n unfinishedSetInputStream.close();\r\n unfinishedFileInputStream.close();\r\n\r\n //Recover the state of finished list from finished.dat\r\n finishedFileInputStream = new FileInputStream(FINISHED_FILE_PATH);\r\n finishedListInputStream = new ObjectInputStream(finishedFileInputStream);\r\n finished = (ArrayList<Task>)finishedListInputStream.readObject();\r\n finishedListInputStream.close();\r\n finishedFileInputStream.close();\r\n\r\n //Recover the state of activities list from activities.dat\r\n activitiesFileInputStream = new FileInputStream(ACTIVITIES_FILE_PATH);\r\n activitiesListInputStream = new ObjectInputStream(activitiesFileInputStream);\r\n activities = (ArrayList<Activity>)activitiesListInputStream.readObject();\r\n activitiesListInputStream.close();\r\n activitiesFileInputStream.close();\r\n\r\n generateWeeklySchedule();\r\n }\r\n catch(Exception e){\r\n System.out.println(e.getMessage());\r\n }\r\n }", "public void load() throws FileNotFoundException, IOException, ClassNotFoundException, DBAppException {\n ArrayList<Tuple> data = new ArrayList<Tuple>();\n int pageIndex = myTable.getCurPageIndex();\n for (int i = 0; i <= pageIndex; i++) {\n // Student_0.class\n\n\n String name = dataPath + tableName + \"_\" + i + \".class\";\n\n ObjectInputStream ois = new ObjectInputStream(new FileInputStream(name));\n Page page = (Page) ois.readObject();\n ois.close();\n for (Tuple t : page.getTuples()) {\n int indexKeyPos = t.getIndex(indexkey);\n int primaryKeyPos = t.getIndex(primarykey);\n Object[] values = new Object[3];\n values[0] = t.get()[indexKeyPos];\n values[1] = t.get()[primaryKeyPos];\n values[2] = i;\n\n String[] types = new String[3];\n types[0] = t.getTypes()[indexKeyPos];\n types[1] = t.getTypes()[primaryKeyPos];\n types[2] = \"java.lang.integer\";\n\n String[] colName = new String[3];\n colName[0] = t.colName[indexKeyPos];\n colName[1] = t.colName[primaryKeyPos];\n colName[2] = \"page.number\";\n\n Tuple newTuple = new Tuple(values, types, colName, 0);\n\n data.add(newTuple);\n }\n }\n\n Collections.sort(data);\n if (data.isEmpty())\n return;\n Page curPage = createPage();\n for (int i = 0; i < data.size(); i++) {\n if (curPage.isFull()) {\n curPage.savePage();\n curPage = createPage();\n }\n curPage.insert(data.get(i), true);\n }\n curPage.savePage();\n }", "public void readTable() {\r\n\r\n try ( BufferedReader b = new BufferedReader(new FileReader(\"Hashdata.txt\"))) {\r\n\r\n String line;\r\n ArrayList<String> arr = new ArrayList<>();\r\n while ((line = b.readLine()) != null) {\r\n\r\n arr.add(line);\r\n }\r\n\r\n for (String str : arr) {\r\n this.load(str);\r\n }\r\n this.print();\r\n\r\n } catch (IOException e) {\r\n System.out.println(\"Unable to read file\");\r\n }\r\n\r\n this.userInterface();\r\n\r\n }", "private static void insertTestData(String sqlFileResource) throws ArcException {\t\t\n\t\tString scriptDataTest;\n\t\ttry {\n\t\t\tscriptDataTest = IOUtils.toString(ApiInitialisationService.class.getClassLoader().getResourceAsStream(sqlFileResource), StandardCharsets.UTF_8);\n\t\t} catch (IOException e) {\n\t\t\tthrow new ArcException(e, ArcExceptionMessage.FILE_READ_FAILED);\n\t\t}\n\t\tUtilitaireDao.get(0).executeImmediate(c, scriptDataTest);\n\t\t\n\t}", "public void createDB() {\n\t\ttry {\n\t\t\tBufferedReader br= new BufferedReader(new FileReader(\"db_schema.txt\"));\n\t\t\tString line= null;\n\t\t\tStringBuilder sb= new StringBuilder();\n\t\t\twhile ((line=br.readLine())!=null){\n\t\t\t\tsb.append(line);\n\t\t\t\tif(sb.length()>0 && sb.charAt(sb.length()-1)==';'){//see if it is the end of one line of command\n\t\t\t\t\tstatement.executeUpdate(sb.toString());\n\t\t\t\t\tsb= new StringBuilder();\n\t\t\t\t}\n\t\t\t}\n\t\t\tbr.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void processRecords()\n {\n // This is the way to connect the file to an inputstream in android\n InputStream inputStream = getResources().openRawResource(R.raw.products);\n\n Scanner scanner = new Scanner(inputStream);\n\n\n // skipping first row by reading it before loop and displaying it as column names\n String[] tableRow = scanner.nextLine().split(\",\");\n\n //Log.e(\"COLUMN NAMES\", Arrays.toString(tableRow));\n //Log.e(\"COLUMN NAMES SIZE\", String.valueOf(tableRow.length));\n\n\n // --- Truncate table (delete all rows and reset auto increment --\n // this line of code will be useful because for now we are forced to read file\n // everytime we open app, this way we do not have duplicate data.\n db.resetTable();\n\n while (scanner.hasNextLine())\n {\n tableRow = scanner.nextLine().split(\",\");\n //Log.e(\"COLUMN VALUES\", Arrays.toString(tableRow));\n //Log.e(\"COLUMN VALUES SIZE\", String.valueOf(tableRow.length));\n\n /*\n * Possible Change:\n * On each iteration a new Product() can be created and call the setter to set\n * its fields to the elements of the String array, example\n * product = new Product();\n * product.setNumber(tableRow[0]);\n * product.setBusinessName(tableRow[1]);\n * ...\n * db.insertData(product); // because the new insertData method would expect a\n * Product object instead\n *\n */\n\n // insert data\n if (db.insertData(tableRow))\n {\n //Log.e(\"Insert\", \"SUCCESSFUL INSERT AT \" + tableRow[0]);\n }\n else\n {\n //Log.e(\"Insert\", \"UNSUCCESSFUL INSERT\");\n }\n\n }\n }", "public void loadTables(String tsvFilesDir) throws IOException, SQLException{\n\t\t\n\t\tFile data = new File(tsvFilesDir);\n\t\t\n\t\tFile[] tables = data.listFiles(new FileFilter() {\n\t\t\t\n\t\t\tpublic boolean accept(File pathname) {\n\t\t\t\treturn !pathname.isDirectory() && pathname.getName().endsWith(\".txt\");\n\t\t\t}\n\t\t});\n\t\t\n\t\tfor(File table: tables){\n\t\t\tloadTable(table);\n\t\t}\n\t}", "public long loadTable(File fromFile, \n boolean insertRecords, boolean overwriteExisting, boolean noDropWarning)\n throws DBException\n {\n return this.loadTable(fromFile, null/*DBLoadValidator*/, \n insertRecords, overwriteExisting, noDropWarning);\n }", "void insertCSV(String file_path) {\n try {\n InputStream fileStream = new FileInputStream(file_path);\n Reader decoder = new InputStreamReader(fileStream, \"UTF-8\");\n BufferedReader buffered = new BufferedReader(decoder);\n\n for (String line = buffered.readLine(); line != null; line = buffered.readLine()) {\n // process line\n String[] tokens = line.trim().split(\"\\\\s+\"); // split line into different fields\n\n // valid table row should have 16 fields\n if (tokens.length == 16) {\n insertSingleRow(tokens);\n } else {\n continue;\n }\n }\n } catch (Exception e) {\n logger.log(Level.WARNING, \"insertGZip error \", e);\n }\n }", "public long loadTable(File fromFile, DBLoadValidator validator, \n boolean insertRecords, boolean overwriteExisting, boolean noDropWarning)\n throws DBException\n {\n\n /* validate filename */\n if (fromFile == null) {\n throw new DBException(\"'From' file not specified\");\n }\n String fn = fromFile.getName();\n\n /* .CSV */\n if (fn.endsWith(_LOAD_EXT_CSV)) {\n return this._loadTableCSV(fromFile, validator, insertRecords, overwriteExisting, noDropWarning);\n }\n\n /* .DUMP */\n if (fn.endsWith(_LOAD_EXT_DUMP)) {\n return this._loadTable(null, fromFile, validator, insertRecords, overwriteExisting, noDropWarning);\n }\n\n /* .SQL */\n if (fn.endsWith(_LOAD_EXT_SQL)) {\n File sqlFile = fromFile;\n String fields[] = this.readSQLDumpColumns(sqlFile);\n File txtFile = new File(FileTools.removeExtension(fromFile.getPath()) + _LOAD_EXT_TXT);\n return this._loadTable(fields, txtFile, validator, insertRecords, overwriteExisting, noDropWarning);\n }\n\n /* .TXT */\n if (fn.endsWith(_LOAD_EXT_TXT)) {\n File sqlFile = new File(FileTools.removeExtension(fromFile.getPath()) + _LOAD_EXT_SQL);\n String fields[] = this.readSQLDumpColumns(sqlFile);\n File txtFile = fromFile;\n return this._loadTable(fields, txtFile, validator, insertRecords, overwriteExisting, noDropWarning);\n }\n\n /* error if we reach here */\n throw new DBException(\"Unrecognized file extension '\" + fromFile + \"'\");\n\n }", "public final void execute() {\n try {\n\n StringBuffer preparedTableBuf = new StringBuffer();\n preparedTableBuf.append(\"create table if not exists \");\n preparedTableBuf.append(tableName + \" (\");\n\n boolean isCompoundKey = false;\n boolean isAutoKey = \"generated\".equals(pkey);\n\n String[] pkeys = pkey.split(\",\");\n StringBuffer compoundKey = new StringBuffer();\n if (pkeys.length > 1) {\n isCompoundKey = true;\n compoundKey.append(\", PRIMARY KEY (\");\n for (int i = 0; i < pkeys.length; i++) {\n compoundKey.append(pkeys[i] + (i == pkeys.length - 1 ? \")\" : \", \"));\n }\n }\n\n if (isAutoKey) {\n preparedTableBuf\n .append(\"id integer NOT NULL PRIMARY KEY AUTO_INCREMENT, \");\n }\n for (int i = 0; i < fields.length; i++) {\n preparedTableBuf.append(fields[i]\n + \" \"\n + columnTypes[i]\n + (pkey.equals(fields[i]) ? \" NOT NULL UNIQUE PRIMARY KEY\" : \"\")\n + (i == fields.length - 1 ? (isCompoundKey ? compoundKey.toString()\n : \"\") + \")\" : \", \"));\n }\n\n PreparedStatement preparedTableCreate = conn\n .prepareStatement(preparedTableBuf.toString());\n\n log.info(\"Prepared Table Statement : \" + preparedTableBuf.toString());\n preparedTableCreate.executeUpdate();\n conn.commit();\n\n } catch (Exception e) {\n log.error(e);\n }\n\n try {\n\n StringBuffer preparedInsertBuf = new StringBuffer();\n preparedInsertBuf.append(\"insert into \");\n preparedInsertBuf.append(tableName + \" (\");\n\n for (int i = 0; i < fields.length; i++) {\n preparedInsertBuf.append(fields[i]\n + (i == fields.length - 1 ? \")\" : \", \"));\n }\n\n preparedInsertBuf.append(\" values(\");\n\n for (int i = 0; i < fields.length; i++) {\n preparedInsertBuf.append(\"?\" + (i == fields.length - 1 ? \")\" : \", \"));\n }\n\n PreparedStatement insertItemRecord = conn\n .prepareStatement(preparedInsertBuf.toString());\n\n log.info(\"Rows : \" + fileImporter.getRowCount());\n log.info(\"Prepared Insert Statement : \" + preparedInsertBuf.toString());\n\n Iterator<Row> riter = fileImporter.getRowIterator();\n\n int rows = 0;\n\n int[] result = null;\n\n while (riter.hasNext()) {\n Row row = riter.next();\n\n if (!row.isValid()) {\n continue;\n } else {\n rows++;\n }\n\n try {\n for (int i = 0; i < fields.length; i++) {\n if (columnTypes[i].contains(\"char\")) {\n insertItemRecord.setString(i + 1, row.getValue(fields[i]));\n } else if (\"integer\".equals(columnTypes[i])) {\n try {\n Integer value = Integer.parseInt(row.getValue(fields[i]));\n insertItemRecord.setInt(i + 1, value);\n } catch (Exception e) {\n insertItemRecord.setInt(i + 1, 0);\n }\n } else {\n log.error(\"unsupported column type\");\n }\n }\n\n insertItemRecord.addBatch();\n\n if (rows % batchSize == 0) {\n\n try {\n result = insertItemRecord.executeBatch();\n\n conn.commit();\n log.info(\"batch update : \" + result.length);\n } catch (BatchUpdateException e) {\n log.error(\"Batch Update failed\", e);\n log.error(\"result size: \"\n + (result == null ? \"null\" : result.length));\n\n }\n\n }\n } catch (Exception e) {\n log.error(\"couldn't process row properly\", e);\n }\n }\n // the last set of updates will probably not mod to 0\n\n try {\n result = insertItemRecord.executeBatch();\n conn.commit();\n log.info(\"batch update : \" + result.length);\n } catch (BatchUpdateException e) {\n log.error(\"Batch Update failed\", e);\n log.error(\"\");\n }\n\n } catch (Exception e) {\n log.error(e);\n e.printStackTrace();\n }\n }", "@Override\r\n public void updateTable() {\n FileManager fileManager = new FileManager();\r\n InputStream input = fileManager.readFileFromRAM(fileManager.XML_DIR, FILE_NAME);\r\n if(input != null){\r\n dropTable();\r\n createTable();\r\n parserXml(input); \r\n }else{\r\n Log.i(FILE_NAME,\"file is null\");\r\n }\r\n \r\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic synchronized Hashtable<Object,Object> loadTable() \n\t{\n\t\tHashtable<Object,Object> ht = null ;\n\t\ttry {\n\t\t\tFileInputStream fis = new FileInputStream(tableFile);\n\t\t\t\n\t\t\tObjectInputStream ois = new ObjectInputStream(fis);\n\t\t\t// Unchecked cast\n\t\t\thtRecords = (Hashtable<Object,Object>) ois.readObject();\n\t\t\tois.close();\n\t\t\tfis.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// throw new DatabaseException(\"Cannot load : FileNotFoundException\",e);\n\t\t htRecords = new Hashtable<Object,Object>(); // Void Hashtable\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(\"Cannot load : IOException\",e);\n\t\t} catch (ClassNotFoundException e) {\n\t\t\tthrow new RuntimeException(\"Cannot load : ClassNotFoundException\",e);\n\t\t}\n\t\treturn ht ;\n\t}", "private void preloadDb() {\n String[] branches = getResources().getStringArray(R.array.branches);\n //Insertion from xml\n for (String b : branches)\n {\n dataSource.getTherapyBranchTable().insertTherapyBranch(b);\n }\n String[] illnesses = getResources().getStringArray(R.array.illnesses);\n for (String i : illnesses)\n {\n dataSource.getIllnessTable().insertIllness(i);\n }\n String[] drugs = getResources().getStringArray(R.array.drugs);\n for (String d : drugs)\n {\n dataSource.getDrugTable().insertDrug(d);\n }\n }", "private void loadDataFromFile() {\n boolean isLoggedInNew = na.isLoggedIn();\n boolean isLoggedIn = uL.isLoggedIn();\n // load data for new users after sucsessful new account creation\n if (isLoggedInNew) {\n String username = na.getUsername();\n String fileExt = \"_data.txt\";\n String workingDirectory = System.getProperty(\"user.dir\");\n String filePath = workingDirectory + \"\\\\\" + username + fileExt;\n File file = new File(filePath);\n try {\n FileReader fr = new FileReader(file);\n BufferedReader br = new BufferedReader(fr);\n DefaultTableModel model = (DefaultTableModel) remindersTable.getModel();\n Object[] lines = br.lines().toArray();\n for (int i = 0; i < lines.length; i++) {\n String[] row = lines[i].toString().split(\"\\t\");\n model.addRow(row);\n }\n } catch (FileNotFoundException ex) {\n Logger.getLogger(MoneyMinderDesktopMainGui.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n // load data for existing users after sucsessful login\n if (isLoggedIn) {\n String username = uL.getUsername();\n String fileExt = \"_data.txt\";\n String workingDirectory = System.getProperty(\"user.dir\");\n String filePath = workingDirectory + \"\\\\\" + username + fileExt;\n File file = new File(filePath);\n try {\n FileReader fr = new FileReader(file);\n BufferedReader br = new BufferedReader(fr);\n DefaultTableModel model = (DefaultTableModel) remindersTable.getModel();\n Object[] lines = br.lines().toArray();\n for (int i = 0; i < lines.length; i++) {\n String[] row = lines[i].toString().split(\"\\t\");\n model.addRow(row);\n }\n } catch (FileNotFoundException ex) {\n Logger.getLogger(MoneyMinderDesktopMainGui.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "public abstract void importTable(ImportJobContext context)\n throws IOException, ImportException;", "public static void createNewTable(String fileName) {\n connect(fileName);\n String sqlUrl = \"CREATE TABLE IF NOT EXISTS urls (\\n\"\n + \" id integer PRIMARY KEY AUTOINCREMENT,\\n\"\n + \" url text NOT NULL\\n\"\n + \");\";\n\n String sqlDesc = \"CREATE TABLE IF NOT EXISTS descriptions (\\n\"\n + \" id integer,\\n\"\n + \" shifts text NOT NULL\\n\"\n + \");\";\n\n try (Statement stmt = conn.createStatement()) {\n // create a new table\n stmt.execute(sqlUrl);\n stmt.execute(sqlDesc);\n } catch (SQLException e) {\n System.out.println(e.getMessage());\n }\n }", "public void init() {\r\n BufferedReader in = null;\r\n String line;\r\n PreparedStatement iStmt;\r\n String insertStmt = \"INSERT INTO \" + schema + \"ULDSHAPE \"\r\n + \"(SHAPE, ALLHGHT, ALLLENG, ALLWDTH, BIGPIC, DESCR, INTERNALVOLUME, INTHGHT, INTLENG, INTWDTH, \"\r\n + \"MAXGROSSWGHT, RATING, TAREWGHT, THUMBNAIL, UPDATED, UPDTUSER, VERSION) VALUES \"\r\n + \"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\";\r\n int count = 0;\r\n\r\n LOG.log(Level.INFO, \"Initialize basic Uldshapes in DB from file [{0}]\", path);\r\n\r\n try {\r\n in = new BufferedReader(new InputStreamReader(new FileInputStream(path), StandardCharsets.UTF_8));\r\n\r\n iStmt = conn.prepareStatement(insertStmt);\r\n\r\n while ((line = in.readLine()) != null) {\r\n LOG.finer(line);\r\n\r\n UldshapeVO uldshapeVO = parseUldshape(line);\r\n\r\n iStmt.setString(1, uldshapeVO.getShape());\r\n iStmt.setInt(2, uldshapeVO.getAllhght());\r\n iStmt.setInt(3, uldshapeVO.getAllleng());\r\n iStmt.setInt(4, uldshapeVO.getAllwdth());\r\n iStmt.setBytes(5, uldshapeVO.getBigpic());\r\n iStmt.setString(6, uldshapeVO.getDescr());\r\n iStmt.setInt(7, uldshapeVO.getInternalvolume());\r\n iStmt.setInt(8, uldshapeVO.getInthght());\r\n iStmt.setInt(9, uldshapeVO.getIntleng());\r\n iStmt.setInt(10, uldshapeVO.getIntwdth());\r\n iStmt.setInt(11, uldshapeVO.getMaxgrosswght());\r\n iStmt.setString(12, uldshapeVO.getRating());\r\n iStmt.setInt(13, uldshapeVO.getTarewght());\r\n iStmt.setBytes(14, uldshapeVO.getThumbnail());\r\n iStmt.setTimestamp(15, DbUtil.getCurrentTimeStamp());\r\n iStmt.setString(16, uldshapeVO.getUpdtuser());\r\n iStmt.setLong(17, 0);\r\n\r\n // execute insert SQL stetement\r\n iStmt.executeUpdate();\r\n\r\n ++count;\r\n }\r\n LOG.log(Level.INFO, \"Finished: [{0}] ULDSHAPES loaded\", count);\r\n\r\n DbUtil.cleanupJdbc();\r\n }\r\n catch (IOException ioex) {\r\n LOG.log(Level.SEVERE, \"An IO error occured. The error message is: {0}\", ioex.getMessage());\r\n }\r\n catch (SQLException ex) {\r\n LOG.log(Level.SEVERE, \"An SQL error occured. The error message is: {0}\", ex.getMessage());\r\n }\r\n finally {\r\n if (in != null) {\r\n try {\r\n in.close();\r\n }\r\n catch (IOException e) {\r\n }\r\n }\r\n }\r\n }", "protected <T> void importTable(final Class<T> c, final String[] primaryKeys, final int batchSize, final File exportFile,\n final String persistenceUnit) {\n LOG.info(c.getSimpleName() + \": starting import to database.\");\n final EntityManager entityManager = getEntityManager(persistenceUnit);\n final DatabaseWriter<T> dbWriter = new DatabaseWriter<T>(entityManager);\n\n try {\n importTable(dbWriter, batchSize, exportFile);\n LOG.info(c.getSimpleName() + \": \" + dbWriter.getTotalRowCount() + \" rows written to database.\");\n\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n entityManager.clear();\n entityManager.close();\n entityManagers.remove(persistenceUnit);\n entityManagerFactories.get(persistenceUnit).close();\n entityManagerFactories.remove(persistenceUnit);\n }", "public synchronized void writeFromFileIntoDB()throws IOWrapperException, IOIteratorException{\r\n \r\n fromFile_Name=Controller.CLASSES_TMP_FILENAME;\r\n iow_ReadFromFile = new IOWrapper();\r\n \r\n //System.out.println(\"Readin' from \"+fromFile_Name);\r\n \r\n iow_ReadFromFile.setupInput(fromFile_Name,0);\r\n \r\n iter_ReadFromFile = iow_ReadFromFile.getLineIterator();\r\n iow_ReadFromFile.setupOutput(this.dbname,this.username,this.password,this.hostname,this.port);\r\n \r\n iow_ReadFromFile.sendOutputQuery(\"DROP TABLE IF EXISTS \"+outtable);\r\n \r\n iow_ReadFromFile.sendOutputQuery(\r\n \"CREATE TABLE IF NOT EXISTS \"\r\n +outtable+\" (\"\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[0]+\" int(10) NOT NULL AUTO_INCREMENT, \"//wort_nr\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[1]+\" varchar(225), \"//wort_alph\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[2]+\" int(10), \"//krankheit \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[3]+\" int(10), \"//farbe1 \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[4]+\" real(8,2), \"//farbe1prozent\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[5]+\" int(10), \"//farbe2\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[6]+\" real(8,2), \"//farbe2prozent\r\n +\"PRIMARY KEY (\"+Controller.COLUMN_NAMES_FOR_DB_OUT[0]+\")) \"\r\n +\"ENGINE=MyISAM\"\r\n );\r\n while(iter_ReadFromFile.hasNext()){\r\n singleProgress+=1;\r\n String[] data = (String[])iter_ReadFromFile.next();\r\n \r\n //System.out.println(\"--> processing line \"+data);\r\n //escape quotes ' etc for SQL query\r\n if(data[1].matches(\".*'.*\")||data[1].matches(\".*\\\\.*\")){\r\n int sl = data[1].length();\r\n String escapedString = \"\";\r\n \r\n for (int i = 0; i < sl; i++) {\r\n char ch = data[1].charAt(i);\r\n switch (ch) {\r\n case '\\'':\r\n escapedString +='\\\\';\r\n escapedString +='\\'';\r\n break;\r\n case '\\\\':\r\n escapedString +='\\\\';\r\n escapedString +='\\\\';\r\n break;\r\n default :\r\n escapedString +=ch;\r\n break;\r\n }\r\n }\r\n data[1]=escapedString;\r\n }\r\n \r\n String insertStatement=\"INSERT INTO \"\r\n +outtable+\" (\"\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[0]+\", \"//node id\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[1]+\", \"//label\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[2]+\", \"//class id \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[3]+\", \"//class id 1 \r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[4]+\", \"//percent\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[5]+\", \"//class id 2\r\n +Controller.COLUMN_NAMES_FOR_DB_OUT[6]+\") \"//percent \r\n +\"VALUES ('\"\r\n +data[0]+\"', '\"\r\n +data[1]+\"', '\"\r\n +data[2]+\"', '\"\r\n +data[3]+\"', '\"\r\n +data[4]+\"', '\"\r\n +data[5]+\"', '\"\r\n +data[6]+\"')\";\r\n \r\n //System.out.println(\"Sending insert statement:\"+insertStatement);\r\n iow_ReadFromFile.sendOutputQuery(insertStatement);\r\n }\r\n \r\n \r\n //iow_ReadFromFile.closeOutput();\r\n \r\n this.stillWorks=false;\r\n writeIntoDB=false;\r\n System.out.println(\"*\\tData written into database.\");\r\n\t}", "@Override\n\tpublic void CreateDatabaseFromFile() {\n\t\tfinal String FILENAME = \"fandv.sql\";\n\t\tint[] updates = null;\n\t\ttry {\n\t\t\tMyDatabase db = new MyDatabase();\n\t\t\tupdates = db.updateAll(FILENAME);\n\t\t} catch (FileNotFoundException | SQLException | ClassNotFoundException e) {\n\t\t\tSystem.out.println(\"Database issue\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < updates.length; i++) {\n\t\t\tsum += updates[i];\n\t\t}\n\t\tSystem.out.println(\"Number of updates: \" + sum);\n\t}", "public abstract void loadFromDatabase();", "@Override\n\tpublic Map<String, TableImportResult> importData(String databaseServer,\n\t\t\tString databaseName, File file) {\n\t\t// intialise the results map\n\t\t//\n\t\tMap<String, TableImportResult> results = new HashMap<String, TableImportResult>();\n\n\t\t//\n\t\t// Check we have a file\n\t\t//\n\t\tif (file == null || !file.exists()) {\n\t\t\tlog.debug(\"No database was supplied for data import\");\n\t\t\treturn results;\n\t\t}\n\n\t\t//\n\t\t// Open the DB\n\t\t//\n\t\ttry {\n\t\t\tDatabase database = DatabaseBuilder.open(file);\n\t\t\tList<String> tablesToOmit = new ArrayList<String>();\n\n\t\t\t//\n\t\t\t// First, do a dry run\n\t\t\t//\n\t\t\t//AuthenticationDetails ad = new AuthenticationDetails();\n\t\t\tresults = importData(databaseServer, databaseName, database,tablesToOmit, true);\n\n\t\t\t//\n\t\t\t// Identify tables with problems; we'll omit these\n\t\t\t//\n\t\t\tfor (String key : results.keySet()) {\n\t\t\t\tif (results.get(key).getDataImportResult() == TableImportResult.FAILED) {\n\t\t\t\t\ttablesToOmit.add(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlog.debug(\"import preflight complete; \" + tablesToOmit.size()\n\t\t\t\t\t+ \" tables to omit in full run\");\n\n\t\t\t//\n\t\t\t// Now re-run and commit. This should ensure all data is imported\n\t\t\t// that passed preflight.\n\t\t\t//\n\t\t\tMap<String, TableImportResult> finalResults = importData(\n\t\t\t\t\tdatabaseServer, databaseName, database, tablesToOmit, false);\n\n\t\t\t//\n\t\t\t// Merge results\n\t\t\t//\n\t\t\tfor (String key : results.keySet()) {\n\t\t\t\tif (finalResults.containsKey(key)) {\n\t\t\t\t\tresults.get(key).merge(finalResults.get(key));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//\n\t\t\t// Now lets verify the import. While we know how many rows we\n\t\t\t// INSERTed in the batches,\n\t\t\t// once we committed them Postgres will discard rows that break any\n\t\t\t// table constraints.\n\t\t\t//\n\t\t\tfor (String tableName : results.keySet()) {\n\t\t\t\tQueryRunner qr = new QueryRunner(databaseServer, databaseName);\n\t\t\t\tqr.runDBQuery(String.format(\"SELECT COUNT(*) FROM \\\"%s\\\"\",\n\t\t\t\t\t\tgetNormalisedTableName(tableName)));\n\t\t\t\tTableData tableData = qr.getTableData();\n\t\t\t\tint rowsVerified = Integer.parseInt(tableData.rows.iterator()\n\t\t\t\t\t\t.next().cell.get(\"count\").getValue());\n\t\t\t\tresults.get(tableName).setRowsVerified(rowsVerified);\n\t\t\t}\n\t\t\t\n\t\t\t//\n\t\t\t// Finally, we have to update the sequences\n\t\t\t//\n\t\t\tfor (Pair<String, String> sequence : sequences){\n\t\t\t\tQueryRunner qr = new QueryRunner(databaseServer, databaseName);\n\t\t\t\tString key = getNormalisedColumnName(sequence.getLeft());\n\t\t\t\tString table = getNormalisedTableName(sequence.getRight());\n\t\t\t\tString sql = \"SELECT pg_catalog.setval(pg_get_serial_sequence('%s', '%s'), MAX(\\\"%s\\\")) FROM \\\"%s\\\";\";\n\t\t\t\tqr.runDBQuery(String.format(sql, table, key, key, table));\n\t\t\t}\n\n\t\t} catch (IOException | SQLException | ClassNotFoundException\n\t\t\t\t| NumberFormatException e) {\n\t\t\tlog.debug(\"Error importing database file\", e);\n\t\t}\n\t\treturn results;\n\t}", "@PostConstruct\n private void loadFiles() {\n \n\n File dir = new File(Constants.DIR_PATH);\n File[] files = dir.listFiles(); //stores list of files in given paths\n String line=\"\";\n\n for(File file : files){\n try {\n br = new BufferedReader(new FileReader(file));\n br.readLine();\n while((line=br.readLine())!=null){\n\n String []token=line.split(Constants.DELIMETER);\n String fileName=file.getName().toUpperCase();\n\n FlightData newflight = new FlightData(fileName.substring(0,fileName.lastIndexOf(\".\")),token[0],token[1],token[2],token[3],token[4],token[5],Double.parseDouble(token[6]),token[7],token[8]);\n flightDataDao.insertFlightData(newflight);\n }\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }", "public static void loadData(DynamoDbClient ddb, String fileName) throws IOException {\r\n\r\n String sqlStatement = \"INSERT INTO MoviesPartiQ VALUE {'year':?, 'title' : ?, 'info' : ?}\";\r\n JsonParser parser = new JsonFactory().createParser(new File(fileName));\r\n com.fasterxml.jackson.databind.JsonNode rootNode = new ObjectMapper().readTree(parser);\r\n Iterator<JsonNode> iter = rootNode.iterator();\r\n ObjectNode currentNode;\r\n int t = 0 ;\r\n List<AttributeValue> parameters = new ArrayList<>();\r\n while (iter.hasNext()) {\r\n\r\n // Add 200 movies to the table.\r\n if (t == 200)\r\n break ;\r\n currentNode = (ObjectNode) iter.next();\r\n\r\n int year = currentNode.path(\"year\").asInt();\r\n String title = currentNode.path(\"title\").asText();\r\n String info = currentNode.path(\"info\").toString();\r\n\r\n AttributeValue att1 = AttributeValue.builder()\r\n .n(String.valueOf(year))\r\n .build();\r\n\r\n AttributeValue att2 = AttributeValue.builder()\r\n .s(title)\r\n .build();\r\n\r\n AttributeValue att3 = AttributeValue.builder()\r\n .s(info)\r\n .build();\r\n\r\n parameters.add(att1);\r\n parameters.add(att2);\r\n parameters.add(att3);\r\n\r\n // Insert the movie into the Amazon DynamoDB table.\r\n executeStatementRequest(ddb, sqlStatement, parameters);\r\n System.out.println(\"Added Movie \" +title);\r\n\r\n parameters.remove(att1);\r\n parameters.remove(att2);\r\n parameters.remove(att3);\r\n t++;\r\n }\r\n }", "public void database() throws IOException\n {\n \tFile file =new File(\"data.txt\");\n\t if(!file.exists())\n\t {\n\t \tSystem.out.println(\"File 'data.txt' does not exit\");\n\t System.out.println(file.createNewFile());\n\t file.createNewFile();\n\t databaseFileWrite(file);//call the databaseFileRead() method, to initialize data from ArrayList and write data into data.txt\n\t }\n\t else\n\t {\n\t \tdatabaseFileRead();//call the databaseFileRead() method, to load data directly from data.txt\n\t }\n }", "void load(String table_name, boolean read_only) throws IOException;", "public void adm4L(String filename) {\n\t\ttry { // Read from file\n\t\t\tFileInputStream fstream = new FileInputStream(filename);\n\t\t\tDataInputStream in = new DataInputStream(fstream);\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(in));\n\t\t\tString strLine;\n\t\t\ttry { // Insert into price table\n\t\t\t\twhile((strLine = br.readLine()) != null) {\n\t\t\t\t\tString[] tokens = strLine.split(\",\");\n\t\t\t\t\tint high_price = 0;\n\t\t\t\t\ttry { high_price = Integer.parseInt(tokens[3]);\n\t\t\t\t\t} catch(NumberFormatException e) {System.out.println(\"STATEMENT CONTAINS INVALID DATA\");}\n\t\t\t\t\tint low_price = 0;\n\t\t\t\t\ttry { high_price = Integer.parseInt(tokens[4]);\n\t\t\t\t\t} catch(NumberFormatException e) {System.out.println(\"STATEMENT CONTAINS INVALID DATA\");}\n\t\t\t\t\tquery = \"insert into PRICE values(?,?,?,?,?)\";\n\t\t\t\t\tPreparedStatement updateStatement = connection.prepareStatement(query);\n\t\t\t\t\tupdateStatement.setString(1,tokens[0]);\n\t\t\t\t\tupdateStatement.setString(2,tokens[1]);\n\t\t\t\t\tupdateStatement.setString(3,tokens[2]);\n\t\t\t\t\tupdateStatement.setInt(4,high_price);\n\t\t\t\t\tupdateStatement.setInt(5,low_price);\n\t\t\t\t\tupdateStatement.executeUpdate();\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"PRICES LOADED\");\n\t\t\t} catch(SQLException Ex) {System.out.println(\"Error running the sample queries. Machine Error: \" + Ex.toString());}\n\t\t} catch(IOException e) {System.out.println(\"FILE NOT FOUND\");}\n\t}", "@Insert({ \"insert into csv_file (id, pid, \", \"filename, start_time, \", \"end_time, length, \", \"density, machine, \",\n\t\t\t\"ar, path, size, \", \"uuid, header_time, \", \"last_update, conflict_resolved, \", \"status, comment, \",\n\t\t\t\"width, start_version, \", \"end_version)\", \"values (#{id,jdbcType=INTEGER}, #{pid,jdbcType=VARCHAR}, \",\n\t\t\t\"#{filename,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, \",\n\t\t\t\"#{endTime,jdbcType=TIMESTAMP}, #{length,jdbcType=INTEGER}, \",\n\t\t\t\"#{density,jdbcType=DOUBLE}, #{machine,jdbcType=VARCHAR}, \",\n\t\t\t\"#{ar,jdbcType=BIT}, #{path,jdbcType=VARCHAR}, #{size,jdbcType=BIGINT}, \",\n\t\t\t\"#{uuid,jdbcType=CHAR}, #{headerTime,jdbcType=TIMESTAMP}, \",\n\t\t\t\"#{lastUpdate,jdbcType=TIMESTAMP}, #{conflictResolved,jdbcType=BIT}, \",\n\t\t\t\"#{status,jdbcType=INTEGER}, #{comment,jdbcType=VARCHAR}, \",\n\t\t\t\"#{width,jdbcType=INTEGER}, #{startVersion,jdbcType=INTEGER}, \", \"#{endVersion,jdbcType=INTEGER})\" })\n\tint insert(CsvFile record);", "public void run(File sqlLiteFile, List<String> colNames) {\n String status = \"\\nConverting Data Format ...\";\n processController.appendStatus(status + \"<br>\");\n\n Connection connection = new Connection(sqlLiteFile);\n String mappingFilepath = getMapping(connection, colNames);\n getTriples(mappingFilepath);\n }", "protected long _loadTable(String oldFieldNames[], File fromFile, DBLoadValidator validator, \n boolean insertRecords, boolean overwriteExisting, boolean noDropWarning)\n throws DBException\n {\n MySQLDumpReader fr = null;\n\n long recordCount = 0L;\n try {\n\n /* open file */\n fr = new MySQLDumpReader(fromFile);\n\n /* field/column definition */\n if (ListTools.isEmpty(oldFieldNames)) {\n String firstLine = fr.readLineString();\n if (firstLine.startsWith(\"#\")) {\n oldFieldNames = StringTools.parseArray(firstLine.substring(1).trim());\n } else {\n Print.logError(\"Unable to determine column mapping definitions\");\n throw new DBException(\"Missing column definitions, unable to load file\");\n }\n }\n\n /* list fields */\n for (int i = 0; i < oldFieldNames.length; i++) {\n DBField field = this.getField(oldFieldNames[i]);\n if (field != null) {\n Print.logInfo(\"Column : \" + oldFieldNames[i]);\n } else\n if (!noDropWarning) {\n Print.logInfo(\"Column : \" + oldFieldNames[i] + \" - will be dropped\");\n }\n }\n\n /* initialize DBLoadValidator */\n if ((validator != null) && !validator.setFields(oldFieldNames)) {\n throw new DBException(\"Load fields rejected by insertion validator\");\n }\n\n /* loop through file */\n int rowNumber = 2; // start at line '2'\n for (;;rowNumber++) {\n\n /* read line */\n String r = fr.readLineString();\n if (r == null) { break; }\n if ((r == null) || r.startsWith(\"#\")) { continue; }\n //if ((r.length == 0) || (r[0] == '#')) { continue; }\n\n /* parse line */\n //Print.logInfo(\"Row: \" + r);\n String rowValues[] = StringTools.parseArray(r);\n //String partialKey = (rowValues.length > 0)? rowValues[0] : \"?\";\n if (rowValues.length != oldFieldNames.length) {\n Print.logError(\"Fields - #found != #expected: \" + \n rowValues.length + \" != \" + oldFieldNames.length +\n \" [row \" + rowNumber + \"]\");\n Print.logError(\"Row: \" + r);\n continue;\n }\n\n /* create/insert record from fields */\n if (this._loadInsertRecord(oldFieldNames,rowValues,\n validator,insertRecords,overwriteExisting)) {\n recordCount++;\n }\n \n } // next record\n\n } catch (DBException dbe) {\n throw dbe; // re-throw\n } catch (SQLException sqe) {\n throw new DBException(\"SQL error\", sqe);\n } catch (IOException ioe) {\n throw new DBException(\"Parsing error\", ioe);\n } catch (Throwable th) {\n throw new DBException(\"Unexpected error\", th);\n } finally {\n if (fr != null) { try { fr.close(); } catch (Throwable t) {} }\n }\n\n /* return number of records loaded */\n return recordCount;\n\n }", "private void analyzeLoadIntoIcebergTable() throws AnalysisException {\n Path sourcePath = sourceDataPath_.getPath();\n String tmpTableName = QueryStringBuilder.createTmpTableName(dbName_,\n tableName_.getTbl());\n QueryStringBuilder.Create createTableQueryBuilder =\n QueryStringBuilder.Create.builder().table(tmpTableName, true);\n try {\n FileSystem fs = sourcePath.getFileSystem(FileSystemUtil.getConfiguration());\n Path filePathForLike = sourcePath;\n // LIKE <file format> clause needs a file to infer schema, for directories: list\n // the files under the directory and pick the first one.\n if (fs.isDirectory(sourcePath)) {\n RemoteIterator<? extends FileStatus> fileStatuses = FileSystemUtil.listFiles(fs,\n sourcePath, true, \"\");\n while (fileStatuses.hasNext()) {\n FileStatus fileStatus = fileStatuses.next();\n String fileName = fileStatus.getPath().getName();\n if (fileStatus.isFile() && !FileSystemUtil.isHiddenFile(fileName)) {\n filePathForLike = fileStatus.getPath();\n break;\n }\n }\n }\n String magicString = FileSystemUtil.readMagicString(filePathForLike);\n if (magicString.substring(0, 4).equals(ParquetFileWriter.MAGIC_STR)) {\n createTableQueryBuilder.like(\"PARQUET\", \"%s\").storedAs(\"PARQUET\");\n } else if (magicString.substring(0, 3).equals(OrcFile.MAGIC)) {\n createTableQueryBuilder.like(\"ORC\", \"%s\").storedAs(\"ORC\");\n } else {\n throw new AnalysisException(String.format(\"INPATH contains unsupported LOAD \"\n + \"format, file '%s' has '%s' magic string.\", filePathForLike, magicString));\n }\n createTableQueryBuilder.tableLocation(\"%s\");\n createTableQueryBuilder.property(\"TEMPORARY\", \"true\");\n } catch (IOException e) {\n throw new AnalysisException(\"Failed to generate CREATE TABLE subquery \"\n + \"statement. \", e);\n }\n createTmpTblQuery_ = createTableQueryBuilder.build();\n QueryStringBuilder.Insert insertTblQueryBuilder = QueryStringBuilder.Insert.builder()\n .overwrite(overwrite_)\n .table(tableName_.toString());\n QueryStringBuilder.Select insertSelectTblQueryBuilder =\n QueryStringBuilder.Select.builder().selectList(\"*\").from(tmpTableName);\n insertTblQueryBuilder.select(insertSelectTblQueryBuilder);\n insertTblQuery_ = insertTblQueryBuilder.build();\n dropTmpTblQuery_ = QueryStringBuilder.Drop.builder().table(tmpTableName).build();\n }", "private <T> void loadFlatFile(Class<T> clazz, String flatFileName)\n\t\t\tthrows ApplicationException {\n\n\t\tlog.info(String.format(\"Loading file %s to object type %s\",\n\t\t\t\tflatFileName, clazz.toString()));\n\t\t\n\t\tDbInserter dbi = getDbInserter();\n\t\t\n\t\tFixedFormatManager manager = new FixedFormatManagerImpl();\n\t\tBufferedReader br = null;\n\t\tint count = 0;\n\t\ttry {\n\t\t\tInputStream ins = this.getClass().getClassLoader()\n\t\t\t\t\t.getResourceAsStream(flatFileName);\n\t\t\tbr = new BufferedReader(new InputStreamReader(ins));\n\t\t\tString record;\n\n\t\t\tlog.info(\"Reading, inserting records.\");\n\t\t\twhile (null != (record = br.readLine())) {\n\t\t\t\tDomain obj = (Domain) manager.load(clazz, record);\n\t\t\t\t//log.info(String.format(\"Record %s\", obj));\n\t\t\t\t//log.info(String.format(\"%s: key %d\", obj.getRecType(), obj.getDomainId()));\n\t\t\t\t\n\t\t\t\tdbi.insert(obj);\n\t\t\t\t\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tlog.info(String.format(\"Read %d records from object.\", count,\n\t\t\t\t\tclazz.toString()));\n\t\t\t\n\t\t\tdbi.flushToIndex();\n\n\t\t} catch (FixedFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tif (null != br) {\n\t\t\t\ttry {\n\t\t\t\t\tbr.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public int loadDatabase(){\n\n try {\n BufferedReader bufferedReader = new BufferedReader(new FileReader(databaseFileName));\n String line = bufferedReader.readLine();\n while (line != null) {\n HashMap<String,String> activityString = parseStatement(line);\n System.out.println(activityString);\n Activity activity = new Activity();\n activity.create(activityString);\n allActivities.add(activity);\n line = bufferedReader.readLine();\n\n }\n }\n catch(Exception e){\n System.out.println(e);\n return -1;\n }\n\n\n //TODO: write utility to load database, including loading csv hashes into activity classes. Activity class - > needs list of accepted attr?\n\n return 0;\n }", "protected long _loadTableCSV(File fromFile, DBLoadValidator validator, \n boolean insertRecords, boolean overwriteExisting, boolean noDropWarning)\n throws DBException\n {\n InputStream fis = null;\n\n /* load csv file */\n long recordCount = 0L;\n try {\n\n /* open csv file */\n try {\n fis = new FileInputStream(fromFile);\n } catch (IOException ioe) {\n throw new DBException(\"Unable to open CSV file\", ioe);\n }\n\n /* field/column definition */\n String oldFieldNames[]= null;\n try {\n String header = FileTools.readLine(fis);\n oldFieldNames = StringTools.parseArray(header);\n if (ListTools.isEmpty(oldFieldNames)) {\n throw new DBException(\"Unable to parse field names (no field names found)\");\n }\n } catch (EOFException eofe) {\n throw new DBException(\"Premature EOF\");\n }\n\n /* list fields */\n for (int i = 0; i < oldFieldNames.length; i++) {\n DBField field = this.getField(oldFieldNames[i]);\n if (field != null) {\n Print.logInfo(\"Column : \" + oldFieldNames[i]);\n } else\n if (!noDropWarning) {\n Print.logInfo(\"Column : \" + oldFieldNames[i] + \" - will be dropped\");\n }\n }\n\n /* initialize DBLoadValidator */\n if ((validator != null) && !validator.setFields(oldFieldNames)) {\n throw new DBException(\"Load fields rejected by insertion validator\");\n }\n\n /* loop through CSV file */\n int rowNumber = 2; // start at line '2'\n for (;;rowNumber++) {\n \n /* read/parse line */\n String rowValues[] = null;\n try {\n String line = FileTools.readLine(fis).trim();\n if (line.equals(\"\")) { \n // -- ignore blank lines\n continue; \n }\n //Print.logInfo(\"Parsing: \" + line);\n rowValues = StringTools.parseArray(line);\n if (rowValues.length != oldFieldNames.length) {\n // -- unexpected number of fields\n Print.logError(\"Fields - #found != #expected: \" + \n rowValues.length + \" != \" + oldFieldNames.length +\n \" [row \" + rowNumber + \"]\");\n Print.logError(\"Row: \" + line);\n continue;\n }\n } catch (EOFException eofe) {\n break;\n }\n\n /* create/insert record from fields */\n if (this._loadInsertRecord(oldFieldNames,rowValues,\n validator,insertRecords,overwriteExisting)) {\n recordCount++;\n }\n\n }\n \n } catch (DBException dbe) {\n throw dbe; // re-throw\n } catch (SQLException sqe) {\n throw new DBException(\"SQL error\", sqe);\n } catch (IOException ioe) {\n throw new DBException(\"Parsing error\", ioe);\n } catch (Throwable th) {\n throw new DBException(\"Unexpected error\", th);\n } finally {\n if (fis != null) { try { fis.close(); } catch (Throwable t) {} }\n }\n\n /* return number of records loaded */\n return recordCount;\n\n }", "private void loadTsvFile()\n {\n try\n {\n BufferedReader input = new BufferedReader(new FileReader(inFile));\n try\n {\n String line = null;\n\n Integer lineNum = 0;\n\n while ((line = input.readLine()) != null)\n {\n\n lineNum++;\n if (line.matches(\"^\\\\s+$\"))\n {\n System.err.println(\"Skipping line \" + lineNum + \" as it contains no data\");\n // Weird bug with TSV generated by excel\n // This line.match skips some empty lines because the println runs\n // However, it doesn't match all empty lines as some get put into the \"data\"\n // ArrayList\n // Can see this when using the debugger\n // It's difficult to inspect because the Mac command line tools such as tail\n // and less\n // don't recognise /r as a newline break. They display as ^M.\n // However, the java readLine doesn't have a problem.\n // Easy quick work around was to go into Excel and delete the blank row of\n // cells\n // so that they are truly empty\n\n } else\n {\n\n ArrayList<String> dataLine = new ArrayList<String>();\n\n Scanner tokenize = new Scanner(line).useDelimiter(\"\\t\");\n while (tokenize.hasNext())\n {\n dataLine.add(tokenize.next());\n }\n if (lineNum == headRow)\n {\n header = dataLine;\n\n } else if (ignoreRow.contains(lineNum))\n {\n // do nothing\n } else\n {\n data.add(dataLine);\n }\n }\n\n }\n } finally\n {\n input.close();\n }\n } catch (IOException ex)\n {\n ex.printStackTrace();\n }\n }", "public void addFile() \n {\n try {\n //JFileChooser jf=new JFileChooser();\n //jf.showOpenDialog(null);\n // String fp=jf.getSelectedFile().getAbsolutePath();\n File file2=new File(\"trial.txt\");\n BufferedReader br=new BufferedReader(new FileReader (file2));\n Object[] tableLines=br.lines().toArray();\n for (Object tableLine : tableLines) {\n String line = tableLine.toString().trim();\n String[] dataRow=line.split(\",\");\n jtModel.addRow(dataRow);\n jtModel.setValueAt(Integer.valueOf(dataRow[2]), jtModel.getRowCount()-1, 2);\n }\n br.close();\n }\n catch(Exception ex) {\n JOptionPane.showMessageDialog(rootPane,\"Nothing was selected\");\n }\n }", "private static void insertRecordIntoDbUserTable(ArrayList<String> xmlList) throws SQLException {\n\t \n\t\tConnection dbConnection = null;\n\t\tPreparedStatement statement = null;\n\n\t\ttry {\n\t\t\tdbConnection = getDBConnection();\n\t\t\tstatement = dbConnection.prepareStatement(SQL_INSERT, Statement.RETURN_GENERATED_KEYS);\n\t\t\t\n\t\t\tint batchSize = 0;\n\t\t\t\n\t\t\tfor (int a = 0; a < xmlList.size(); a++) { // for each xml file\n\t\t\t\tArrayList<String> keywords = new ArrayList<String>(generateKeywords(xmlList.get(a))); //gets the file's keywords\n\t\t\t\tArrayList<String> xmlKeywords = new ArrayList<String>(curate(keywords)); //filter keywords\n\n\t\t\t\t //start appending keywords of that xml file to database\n\t\t\t\tif (xmlKeywords.size() == 1) { //if xml file has no keywords and thus list only consists of the file name\n\t\t\t\t\tstatement.setString(1, xmlKeywords.get(0));\n\t\t\t\t\tstatement.setString(2, \"\");\n\t\t\t\t\tstatement.addBatch();\n\t\t\t\t\tbatchSize++;\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 1; i < xmlKeywords.size(); i++) { //for each keyword following the file name\n\t\t\t\t\tstatement.setString(1, xmlKeywords.get(0)); //set file name\n\t\t\t\t\tstatement.setString(2, xmlKeywords.get(i)); //set keyword\n\t\t\t\t\tstatement.addBatch();\n\t\t\t\t\tbatchSize++;\n\t\t\t\t\tif ((i) % 1000 == 0) {\n\t\t\t\t\t\tstatement.executeBatch(); // Execute every 1000 items.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (batchSize >= 1000) {\n\t\t\t\t\tstatement.executeBatch();\n\t\t\t\t\tbatchSize = 0;\n\t\t\t\t}\n\t\t\t\t//end appending keywords for each xml file loop\n\t\t\t} //end loop of generating table for all xml files and keywords\n\t\t\tstatement.executeBatch();\n\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t} finally {\n\t\t\tif (statement != null) {\n\t\t\t\tstatement.close();\n\t\t\t}\n\t\t\tif (dbConnection != null) {\n\t\t\t\tdbConnection.close();\n\t\t\t}\n\t\t}\n\t}", "private static void executeSQL(Connection connection, String file)\n\t\t\tthrows Exception {\n\t\tStatement stmt = null;\n\t\ttry {\n\t\t\tstmt = connection.createStatement();\n\n\t\t\tString[] values = readFile(file).split(\";\");\n\n\t\t\tfor (int i = 0; i < values.length; i++) {\n\t\t\t\tString sql = values[i].trim();\n\t\t\t\tif ((sql.length() != 0) && (!sql.startsWith(\"#\"))) {\n\t\t\t\t\tstmt.executeUpdate(sql);\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (stmt != null) {\n\t\t\t\tstmt.close();\n\t\t\t}\n\t\t}\n\t}", "private void loadDataFromFile(File file) {\n\t\tString fileName = file.getName();\n\t\tQuickParser test = new QuickParser();\n\n\t\tif(fileName.trim().toUpperCase().startsWith(\"INV\")) {\n\t\t\tfileType = FileType.INVENTORY;\n\t\t\ttableView.getColumns().clear();\n\t\t\ttableView.getColumns().addAll(rfid,campus,building,room,lastScannedOn,lastScannedBy,purchaseOrder,serviceTag,comments);\n\t\t\tmasterInventoryData.clear();\n\t\t\tmasterInventoryData = test.Parse(file, fileType);\n\t\t\tpresentationInventoryData.clear();\n\t\t\tpresentationInventoryData.addAll(masterInventoryData);\n\t\t\tswitch (fileType) {\n\t\t\tcase INVENTORY:\n\t\t\t\tcurrentTabScreen = CurrentTabScreen.INVENTORY;\n\t\t\t\tbreak;\n\t\t\tcase INITIAL:\n\t\t\t\tcurrentTabScreen = CurrentTabScreen.INITIAL;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t} // End switch statement \n\t\t} // End if statement\n\t\telse if(fileName.toUpperCase().startsWith(\"INI\")) {\n\t\t\tfileType = FileType.INITIAL;\n\t\t\ttableView.getColumns().clear();\n\t\t\ttableView.getColumns().addAll(rfid,campus,building,room,lastScannedOn,lastScannedBy,purchaseOrder,serviceTag,comments);\n\t\t\tmasterInitialData.clear();\n\t\t\tmasterInitialData = test.Parse(file, fileType);\n\t\t\tpresentationInitialData.clear();\n\t\t\tpresentationInitialData.addAll(masterInitialData);\n\t\t\tswitch (fileType) {\n\t\t\tcase INVENTORY:\n\t\t\t\tcurrentTabScreen = CurrentTabScreen.INVENTORY;\n\t\t\t\tbreak;\n\t\t\tcase INITIAL:\n\t\t\t\tcurrentTabScreen = CurrentTabScreen.INITIAL;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t} // End switch statement \n\t\t} // End else if statement \n\t\telse {\n\t\t\tfileType = FileType.UNASSIGNED;\n\t\t} // End else statement\n\t\tchangeToScanTable();\n\t}", "private void readFileAndStoreData_(String fileName) {\n In in = new In(fileName);\n int numberOfTeams = in.readInt();\n int teamNumber = 0;\n while (!in.isEmpty()) {\n assignTeam_(in, teamNumber);\n assignTeamInfo_(in, numberOfTeams, teamNumber);\n teamNumber++;\n }\n }", "void insertGZip(String file_path) {\n try {\n InputStream fileStream = new FileInputStream(file_path);\n InputStream gzipStream = new GZIPInputStream(fileStream);\n Reader decoder = new InputStreamReader(gzipStream, \"UTF-8\");\n BufferedReader buffered = new BufferedReader(decoder);\n\n for (String line = buffered.readLine(); line != null; line = buffered.readLine()) {\n // process line\n String[] tokens = line.trim().split(\"\\\\s+\"); // split line into different fields\n\n // valid table row should have 16 fields\n if (tokens.length == 16) {\n insertSingleRow(tokens);\n } else {\n continue;\n }\n }\n } catch (Exception e) {\n logger.log(Level.WARNING, \"insertGZip error \", e);\n }\n }", "public static void loadDatabase(){\n\t\ttry(BufferedReader reader = new BufferedReader(new FileReader(filePath))){\n\t\t\tfor(String line; (line = reader.readLine()) != null; ){\n\t\t\t\tString[] info = line.split(Pattern.quote(\"|\"));\n\t\t\t\tString path = info[0].trim();\n\t\t\t\tString fileID = info[1];\n\t\t\t\tInteger nOfChunks = Integer.parseInt(info[2]);\n\t\t\t\tPair<FileID, Integer> pair = new Pair<FileID, Integer>(new FileID(fileID), nOfChunks);\n\t\t\t\tPeer.fileList.put(path, pair);\n\t\t\t}\n\t\t\treader.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t/*\n\t\t * LOAD THE CHUNK LIST\n\t\t */\n\t\ttry(BufferedReader reader = new BufferedReader(new FileReader(chunkPath))){\n\t\t\tfor(String line; (line = reader.readLine()) != null; ){\n\t\t\t\tString[] info = line.split(Pattern.quote(\"|\"));\n\t\t\t\tString fileID = info[0].trim();\n\t\t\t\tInteger chunkNo = Integer.parseInt(info[1]);\n\t\t\t\tInteger drd = Integer.parseInt(info[2]);\n\t\t\t\tInteger ard = Integer.parseInt(info[3]);\n\t\t\t\tChunkInfo ci = new ChunkInfo(fileID,chunkNo,drd,ard);\n\t\t\t\tPeer.chunks.add(ci);\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "void populateTable(List<String[]> entries) throws SQLException;", "public static void populateDB(String fileName) {\n String dataString = Util.readStringFromFile(new File(fileName));\n ParseState parseState = new ParseState(dataString);\n while (parseState.hasMoreLines()) {\n String line = parseState.getNextLine();\n LineParser lineParser = null;\n if (line.matches(\"^objects\\\\s*\\\\{$\")) {\n lineParser = new ObjectLineParser();\n } else if (line.matches(\"^links\\\\s*\\\\{$\")) {\n lineParser = new LinkLineParser();\n } else if (line.matches(\"^attributes\\\\s*\\\\{$\")) {\n lineParser = new AttributeDefLineParser();\n } else if (line.matches(\"^containers\\\\s*\\\\{$\")) {\n lineParser = new ContainerLineParser();\n } else {\n throw new IllegalArgumentException(\"Unknown top-level category: \" + line);\n }\n parseBlock(parseState, lineParser);\n }\n }", "public void loadData () {\n // create an ObjectInputStream for the file we created before\n ObjectInputStream ois;\n try {\n ois = new ObjectInputStream(new FileInputStream(\"DB/Guest.ser\"));\n\n int noOfOrdRecords = ois.readInt();\n Guest.setMaxID(ois.readInt());\n System.out.println(\"GuestController: \" + noOfOrdRecords + \" Entries Loaded\");\n for (int i = 0; i < noOfOrdRecords; i++) {\n guestList.add((Guest) ois.readObject());\n //orderList.get(i).getTable().setAvailable(false);\n }\n } catch (IOException | ClassNotFoundException e1) {\n // TODO Auto-generated catch block\n e1.printStackTrace();\n }\n }", "public void initLoadTable(){\n movies.clear();\n try {\n Connection conn = ConnectionFactory.getConnection();\n try (Statement stmt = conn.createStatement()) {\n String str=\"select title,director,prodYear,lent,lentCount,original,storageType,movieLength,mainCast,img from movies \";\n ResultSet rs= stmt.executeQuery(str);\n while(rs.next()){\n String title=rs.getString(\"title\");\n String director=rs.getString(\"director\");\n int prodYear=rs.getInt(\"prodYear\");\n boolean lent=rs.getBoolean(\"lent\"); \n int lentCount=rs.getInt(\"lentCount\");\n boolean original=rs.getBoolean(\"original\");\n String storageType=rs.getString(\"storageType\");\n int movieLength=rs.getInt(\"movieLength\");\n String mainCast=rs.getString(\"mainCast\");\n Blob blob = rs.getBlob(\"img\");\n InputStream inputStream = blob.getBinaryStream();\n OutputStream outputStream = new FileOutputStream(\"resources/\"+title+director+\".jpg\");\n int bytesRead = -1;\n byte[] buffer = new byte[1];\n while ((bytesRead = inputStream.read(buffer)) != -1) {\n outputStream.write(buffer, 0, bytesRead);\n }\n inputStream.close();\n outputStream.close();\n System.out.println(\"File saved\"); \n File image = new File(\"resources/\"+title+director+\".jpg\");\n \n movies.add(new Movie(title,director,prodYear,lent,lentCount,original,storageType,movieLength,mainCast,image));\n }\n rs.close();\n stmt.close(); \n }\n conn.close();\n } catch (Exception ex) {\n System.err.println(ex.toString());\n } \n \n fireTableDataChanged();\n }", "public void loadData(){\n try {\n entities.clear();\n\n DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();\n Document document = documentBuilder.parse(fileName);\n\n Node root = document.getDocumentElement();\n NodeList nodeList = root.getChildNodes();\n for (int i = 0; i < nodeList.getLength(); i++){\n Node node = nodeList.item(i);\n if (node.getNodeType() == Node.ELEMENT_NODE){\n Element element = (Element) node;\n Department department = createDepartmentFromElement(element);\n try{\n super.save(department);\n } catch (RepositoryException | ValidatorException e) {\n e.printStackTrace();\n }\n }\n }\n } catch (SAXException | ParserConfigurationException | IOException e) {\n e.printStackTrace();\n }\n }", "private void batchImport() {\r\n m_jdbcTemplate.batchUpdate(createInsertQuery(),\r\n new BatchPreparedStatementSetter() {\r\n public void setValues(\r\n PreparedStatement ps, int i)\r\n throws SQLException {\r\n int j = 1;\r\n for (String property : m_propertyNames) {\r\n Map params = (Map) m_batch.get(\r\n i);\r\n ps.setObject(j++, params.get(\r\n property));\r\n }\r\n }\r\n\r\n public int getBatchSize() {\r\n return m_batch.size();\r\n }\r\n });\r\n }", "public static void insertTestDataLight() throws ArcException {\n\t\tinsertTestData(\"BdDTest/script_test_fonctionnel_sample.sql\");\n\t}", "private void loadDatabase()\n\t{\n\t\ttry\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t// Check to make sure the Bmod Database is there, if not, try \n\t\t\t\t// downloading from the website.\n\t\t\t\tif(!Files.exists(m_databaseFile))\n\t\t\t\t{\n\t\t\t\t\tFiles.createDirectories(m_databaseFile.getParent());\n\t\t\t\t\n\t\t\t\t\tbyte[] file = ExtensionPoints.readURLAsBytes(\"http://\" + Constants.API_HOST + HSQL_DATABASE_PATH);\n\t\t\t\t\tif(file.length != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tFiles.deleteIfExists(m_databaseFile);\n\t\t\t\t\t\tFiles.write(m_databaseFile, file, StandardOpenOption.CREATE, StandardOpenOption.WRITE);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// make sure we have the proper scriptformat.\n\t\t\t\tsetScriptFormatCorrectly();\n\t\t\t}catch(NullPointerException|IOException ex)\n\t\t\t{\n\t\t\t\tm_logger.error(\"Could not fetch database from web.\", ex);\n\t\t\t}\n\t\t\t\n\t\n\t\t\t\n\t\t\tClass.forName(\"org.hsqldb.jdbcDriver\");\n\t\t\n\t\t\t\n\t\t\tString db = ExtensionPoints.getBmodDirectory(\"database\").toUri().getPath();\n\t\t\tconnection = DriverManager.getConnection(\"jdbc:hsqldb:file:\" + db, \"sa\", \"\");\n\t\t\t\n\t\t\t// Setup Connection\n\t\t\tCSVRecordLoader ldr = new CSVRecordLoader();\n\t\t\n\t\t\t// Load all of the building independent plugins\n\t\t\tfor(Record<?> cp : ldr.getRecordPluginManagers())\n\t\t\t{\n\t\t\t\tm_logger.debug(\"Creating table: \" + cp.getTableName());\n\t\t\t\t// Create a new table\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tgetPreparedStatement(cp.getSQLTableDefn()).execute();\n\t\t\t\t} catch(SQLException ex)\n\t\t\t\t{\n\t\t\t\t\t// Table exists\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tm_logger.debug(\"Doing index:\" + cp.getIndexDefn());\n\t\t\t\t\tif(cp.getIndexDefn() != null)\n\t\t\t\t\t\tgetPreparedStatement(cp.getIndexDefn()).execute();\n\t\t\t\t}catch(SQLException ex)\n\t\t\t\t{\t// index exists\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\n\t\t} catch (Exception ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t\tif(ex instanceof DatabaseIntegrityException)\n\t\t\t\tDatabase.handleCriticalError((DatabaseIntegrityException)ex);\n\t\t\telse\n\t\t\t\tDatabase.handleCriticalError(new DatabaseIntegrityException(ex));\n\t\t}\n\t\t\n\t}", "public static void importFromCSV(Connection conn, String filename)\n throws SQLException {\n String sql = \"MERGE INTO salesperson(SALESPERSON_ID, FIRST_NAME, LAST_NAME, PHONE, EMAIL, DEALER_ID)\"\n + \" SELECT * FROM CSVREAD('\" + filename + \"')\";\n Statement stmt = conn.createStatement();\n stmt.execute(sql);\n\n }", "private boolean loadAndExecuteFromFile(Connection conn, String file) {\n String sql;\n BufferedReader in;\n try {\n in = new BufferedReader(new FileReader(file));\n for (;;) {\n sql = in.readLine();\n if (sql == null)\n break;\n try {\n PreparedStatement loadStmt = conn.prepareStatement(sql);\n loadStmt.execute();\n loadStmt.close();\n } catch (java.sql.SQLException e) {\n logger.log(\"Error executing \" + sql);\n logger.log(e);\n return (false);\n }\n logger.log(\"Successfully executed: \" + sql);\n }\n in.close();\n }catch (Exception e) {\n logger.log(\"Error Loading from \" + file);\n logger.log(e.toString());\n return (false);\n }\n return (true);\n }", "public void insertData(String folder, String file, String filewithoutExtension, String header) {\n\t\tRuntime r = Runtime.getRuntime();\n\t\tString command = \"mongoimport --host 127.0.0.1 --port 27017 --db Train --collection \"+filewithoutExtension+\" -f \"+header+\" --type csv --file \\\"Data/\"+file+\"\\\"\";\n\t\ttry {\n\t\t\tr.exec(command); \n\t\t}\tcatch (Exception e){ \n\t\t\tSystem.out.println(\"Error executing \" + command + e.toString());\n\t\t}\n\t}", "public void run() throws DatabaseException, FileNotFoundException {\n new File(FileName).delete();\n\n // Create the database object.\n // There is no environment for this simple example.\n DatabaseConfig config = new DatabaseConfig();\n config.setErrorStream(System.err);\n config.setErrorPrefix(\"BulkAccessExample\");\n config.setType(DatabaseType.BTREE);\n config.setAllowCreate(true);\n config.setMode(0644);\n Database table = new Database(FileName, null, config);\n\n //\n // Insert records into the database, where the key is the user\n // input and the data is the user input in reverse order.\n //\n InputStreamReader reader = new InputStreamReader(System.in);\n\n for (;;) {\n String line = askForLine(reader, System.out, \"input> \");\n if (line == null || (line.compareToIgnoreCase(\"end\") == 0))\n break;\n\n String reversed = (new StringBuffer(line)).reverse().toString();\n\n // See definition of StringEntry below\n //\n StringEntry key = new StringEntry(line);\n StringEntry data = new StringEntry(reversed);\n\n try {\n if (table.putNoOverwrite(null, key, data) == OperationStatus.KEYEXIST)\n System.out.println(\"Key \" + line + \" already exists.\");\n } catch (DatabaseException dbe) {\n System.out.println(dbe.toString());\n }\n System.out.println(\"\");\n }\n\n // Acquire a cursor for the table.\n Cursor cursor = table.openCursor(null, null);\n DatabaseEntry foo = new DatabaseEntry();\n\n MultipleKeyDataEntry bulk_data = new MultipleKeyDataEntry();\n bulk_data.setData(new byte[1024 * 1024]);\n bulk_data.setUserBuffer(1024 * 1024, true);\n\n // Walk through the table, printing the key/data pairs.\n //\n while (cursor.getNext(foo, bulk_data, null) == OperationStatus.SUCCESS) {\n StringEntry key, data;\n key = new StringEntry();\n data = new StringEntry();\n\n while (bulk_data.next(key, data))\n System.out.println(key.getString() + \" : \" + data.getString());\n }\n cursor.close();\n table.close();\n }", "private void buildTable() {\n rowData = new Object[4];\n infoTable = new JTable();\n tableModel = new DefaultTableModel();\n tableModel.setColumnIdentifiers(columnNames);\n infoTable.setModel(tableModel);\n String line;\n \n try {\n FileInputStream fin = new FileInputStream(\"ContactInfo.txt\");\n BufferedReader br = new BufferedReader(new InputStreamReader(fin)); \n \n while((line = br.readLine()) != null)\n {\n rowData[0] = line;\n for(int i = 1; i < 4; i++) {\n rowData[i] = br.readLine();\n }\n tableModel.addRow(rowData);\n } \n br.close();\n }\n catch (FileNotFoundException e) {\n JOptionPane.showMessageDialog(null, e.getMessage());\n }\n catch (IOException e) {\n JOptionPane.showMessageDialog(null, e.getMessage());\n }\n }", "public void loadTasks()\r\n\t{\n\t\ttable = loadTable(\"../data/tasks.csv\", \"header\");\r\n\t\t\r\n\t\t//gets amount of data rows in table\r\n\t\trow_count = table.getRowCount();\r\n\t\t//println(row_count);\r\n\t\t\r\n\t\t//put each row in table into Task class objects and initialise them\r\n\t\tfor(TableRow r : table.rows()){\r\n\t\t\ttasks.add(new Task(r));\r\n\t\t}\r\n\t\t\r\n\t}", "@Override\n\tpublic void insert(Vehicle v, File file) {\n\t\ttry {\n\t\t\tint modelID = VehicleModelDAOImpl.getInstance()\n\t\t\t\t\t.getAll()\n\t\t\t\t\t.parallelStream()\n\t\t\t\t\t.filter(m-> m.getDescription().equals(v.getModel()))\n\t\t\t\t\t.findFirst()\n\t\t\t\t\t.get()\n\t\t\t\t\t.getModelID();\n\n\t\t\tint categoryID = VehicleCategoryDAOImpl.getInstance()\n\t\t\t\t\t.getAll()\n\t\t\t\t\t.parallelStream()\n\t\t\t\t\t.filter(c->c.getDescription().equals(v.getType()))\n\t\t\t\t\t.findFirst()\n\t\t\t\t\t.get()\n\t\t\t\t\t.getCategoryID();\n\n\t\t\tFileInputStream fis = new FileInputStream(file);\n\t\t\t\n\t\t\tPreparedStatement st = Database.getInstance().getDBConn().prepareStatement(\"INSERT INTO vehicles(vehicle_ID,plate_number,mv_number,engine_number,chassis_number,model_ID,category_ID,encumbered_to,amount,maturity_date,status,image) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)\");\n\t\t\t\n\t\t\tst.setInt(1, v.getVehicleID());\n\t\t\tst.setString(2, v.getPlateNumber());\n\t\t\tst.setString(3, v.getMvNumber());\n\t\t\tst.setString(4, v.getEngineNumber());\n\t\t\tst.setString(5, v.getChassisNumber());\n\t\t\tst.setInt(6, modelID);\n\t\t\tst.setInt(7, categoryID);\n\t\t\tst.setString(8, v.getEncumberedTo());\n\t\t\tst.setDouble(9, v.getAmount());\n\t\t\tst.setString(10, v.getMaturityDate().toString());\n\t\t\tst.setString(11, v.getStatus());\n\t\t\tst.setBinaryStream(12, (InputStream) fis, (int)file.length());\n\t\t\tst.executeUpdate();\n\t\t\t\n\t\t\tst.close();\n\t\t} catch(Exception err) {\n\t\t\terr.printStackTrace();\n\t\t}\n\t}", "private void tableLoad() {\n try{\n String sql=\"SELECT * FROM salary\";\n pst = conn.prepareStatement(sql);\n rs = pst.executeQuery();\n \n table1.setModel(DbUtils.resultSetToTableModel(rs));\n \n \n }\n catch(SQLException e){\n \n }\n }", "@Test\n public void reading()\n throws FileNotFoundException, IOException, CorruptedTableException\n {\n final Database database =\n new Database(new File(\"src/test/resources/\" + versionDirectory + \"/rndtrip\"), version);\n final Set<String> tableNames = database.getTableNames();\n\n assertEquals(2,\n tableNames.size());\n assertTrue(\"TABLE1 not found in 'short roundtrip' database\",\n tableNames.contains(\"TABLE1.DBF\"));\n assertTrue(\"TABLE2 not found in 'short roundtrip' database\",\n tableNames.contains(\"TABLE2.DBF\"));\n\n final Table t1 = database.getTable(\"TABLE1.DBF\");\n\n try\n {\n t1.open(IfNonExistent.ERROR);\n\n assertEquals(\"Table name incorrect\",\n \"TABLE1.DBF\",\n t1.getName());\n assertEquals(\"Last modified date incorrect\",\n Util.createDate(2009, Calendar.APRIL, 1),\n t1.getLastModifiedDate());\n\n final List<Field> fields = t1.getFields();\n\n Iterator<Field> fieldIterator = fields.iterator();\n Map<String, Field> nameFieldMap = new HashMap<String, Field>();\n\n while (fieldIterator.hasNext())\n {\n Field f = fieldIterator.next();\n nameFieldMap.put(f.getName(),\n f);\n }\n\n final Field idField = nameFieldMap.get(\"ID\");\n assertEquals(Type.NUMBER,\n idField.getType());\n assertEquals(idField.getLength(),\n 3);\n\n final Field stringField = nameFieldMap.get(\"STRFIELD\");\n assertEquals(Type.CHARACTER,\n stringField.getType());\n assertEquals(stringField.getLength(),\n 50);\n\n final Field logicField = nameFieldMap.get(\"LOGICFIELD\");\n assertEquals(Type.LOGICAL,\n logicField.getType());\n assertEquals(logicField.getLength(),\n 1);\n\n final Field dateField = nameFieldMap.get(\"DATEFIELD\");\n assertEquals(Type.DATE,\n dateField.getType());\n assertEquals(8,\n dateField.getLength());\n\n final Field floatField = nameFieldMap.get(\"FLOATFIELD\");\n assertEquals(Type.NUMBER,\n floatField.getType());\n assertEquals(10,\n floatField.getLength());\n\n final List<Record> records = UnitTestUtil.createSortedRecordList(t1.recordIterator(),\n \"ID\");\n final Record r0 = records.get(0);\n\n assertEquals(1,\n r0.getNumberValue(\"ID\"));\n assertEquals(\"String data 01\",\n r0.getStringValue(\"STRFIELD\").trim());\n assertEquals(true,\n r0.getBooleanValue(\"LOGICFIELD\"));\n assertEquals(Util.createDate(1909, Calendar.MARCH, 18),\n r0.getDateValue(\"DATEFIELD\"));\n assertEquals(1234.56,\n r0.getNumberValue(\"FLOATFIELD\"));\n\n final Record r1 = records.get(1);\n\n assertEquals(2,\n r1.getNumberValue(\"ID\"));\n assertEquals(\"String data 02\",\n r1.getStringValue(\"STRFIELD\").trim());\n\n /*\n * in Clipper 'false' value can be given as an empty field, and the method called here\n * returns then 'null' as the return value\n */\n if (version == Version.CLIPPER_5)\n {\n assertEquals(null,\n r1.getBooleanValue(\"LOGICFIELD\"));\n }\n else\n {\n assertEquals(false,\n r1.getBooleanValue(\"LOGICFIELD\"));\n }\n\n assertEquals(Util.createDate(1909, Calendar.MARCH, 20),\n r1.getDateValue(\"DATEFIELD\"));\n assertEquals(-23.45,\n r1.getNumberValue(\"FLOATFIELD\"));\n\n final Record r2 = records.get(2);\n\n assertEquals(3,\n r2.getNumberValue(\"ID\"));\n assertEquals(\"\",\n r2.getStringValue(\"STRFIELD\").trim());\n assertEquals(null,\n r2.getBooleanValue(\"LOGICFIELD\"));\n assertEquals(null,\n r2.getDateValue(\"DATEFIELD\"));\n assertEquals(null,\n r2.getNumberValue(\"FLOATFIELD\"));\n\n final Record r3 = records.get(3);\n\n assertEquals(4,\n r3.getNumberValue(\"ID\"));\n assertEquals(\"Full5678901234567890123456789012345678901234567890\",\n r3.getStringValue(\"STRFIELD\").trim());\n\n /*\n * in Clipper 'false' value can be given as an empty field, and the method called here\n * returns then 'null' as the return value\n */\n if (version == Version.CLIPPER_5)\n {\n assertEquals(null,\n r3.getBooleanValue(\"LOGICFIELD\"));\n }\n else\n {\n assertEquals(false,\n r3.getBooleanValue(\"LOGICFIELD\"));\n }\n\n assertEquals(Util.createDate(1909, Calendar.MARCH, 20),\n r3.getDateValue(\"DATEFIELD\"));\n assertEquals(-0.30,\n r3.getNumberValue(\"FLOATFIELD\"));\n }\n finally\n {\n t1.close();\n }\n\n final Table t2 = database.getTable(\"TABLE2.DBF\");\n\n try\n {\n t2.open(IfNonExistent.ERROR);\n\n final List<Field> fields = t2.getFields();\n\n Iterator<Field> fieldIterator = fields.iterator();\n Map<String, Field> nameFieldMap = new HashMap<String, Field>();\n\n while (fieldIterator.hasNext())\n {\n Field f = fieldIterator.next();\n nameFieldMap.put(f.getName(),\n f);\n }\n\n final Field idField = nameFieldMap.get(\"ID2\");\n assertEquals(Type.NUMBER,\n idField.getType());\n assertEquals(idField.getLength(),\n 4);\n\n final Field stringField = nameFieldMap.get(\"MEMOFIELD\");\n assertEquals(Type.MEMO,\n stringField.getType());\n assertEquals(10,\n stringField.getLength());\n\n final Iterator<Record> recordIterator = t2.recordIterator();\n final Record r = recordIterator.next();\n\n String declarationOfIndependence = \"\";\n\n declarationOfIndependence += \"When in the Course of human events it becomes necessary for one people \";\n declarationOfIndependence += \"to dissolve the political bands which have connected them with another and \";\n declarationOfIndependence += \"to assume among the powers of the earth, the separate and equal station to \";\n declarationOfIndependence += \"which the Laws of Nature and of Nature's God entitle them, a decent respect \";\n declarationOfIndependence += \"to the opinions of mankind requires that they should declare the causes which \";\n declarationOfIndependence += \"impel them to the separation.\";\n declarationOfIndependence += \"\\r\\n\\r\\n\";\n declarationOfIndependence += \"We hold these truths to be self-evident, that all men are created equal, \";\n declarationOfIndependence += \"that they are endowed by their Creator with certain unalienable Rights, \";\n declarationOfIndependence += \"that among these are Life, Liberty and the persuit of Happiness.\";\n\n assertEquals(1,\n r.getNumberValue(\"ID2\"));\n assertEquals(declarationOfIndependence,\n r.getStringValue(\"MEMOFIELD\"));\n }\n finally\n {\n t2.close();\n }\n }", "public void importUsers(String filename) throws Exception {\r\n\t\tFileReader fr = new FileReader(filename);\r\n\t\tBufferedReader br = new BufferedReader(fr);\r\n\t\t\r\n\t\twhile(true) {\r\n\t\t\tString line = br.readLine();\r\n\t\t\tif (line == null)\r\n\t\t\t\tbreak;\r\n\t\t\tString[] tokens = line.split(\",\");\r\n\t\t\tString userLastName = tokens[0].trim();\r\n\t\t\tString userFirstName = tokens[1].trim();\r\n\t\t\tString userMiddleName = tokens[2].trim();\t\t\t\r\n\t\t\tString email = tokens[3].trim();\r\n\t\t\tString userName = tokens[4].trim();\r\n\t\t\tString password = tokens[5].trim();\r\n\t\t\t\r\n\t\t\tSystem.out.println(\"Line:\"+line);\r\n\t\t\tSystem.out.println(\"LastName:\"+userLastName);\r\n\t\t\tSystem.out.println(\"FirstName:\"+userFirstName);\r\n\t\t\tSystem.out.println(\"MiddleName:\"+userMiddleName);\r\n\t\t\tSystem.out.println(\"Email:\"+email);\r\n\t\t\tSystem.out.println(\"UserName:\"+userName);\r\n\t\t\tSystem.out.println(\"Password:\"+password);\r\n\t\t\t\r\n\t\t\tUser user = new User();\r\n\t\t\tuser.setLastName(userLastName);\r\n\t\t\tuser.setFirstName(userFirstName);\r\n\t\t\tuser.setMiddleName(userMiddleName);\r\n\t\t\tuser.setEmailAddress(email);\r\n\t\t\tuser.setUserName(userName);\r\n\t\t\tuser.setPassword(password);\t\t\t\r\n\t\t\tuser.setStatus(UserStatus.ACTIVE);\r\n\t\t\t\r\n\t\t\tem.persist(user);\r\n\t\t}\r\n\t\t\r\n\t\tbr.close();\r\n\t\tfr.close();\r\n\t}", "public void insertData(SQLiteDatabase db) {\n String sql;\n try {\n\n InputStream in = this.context.getResources().openRawResource(R.raw.data);\n DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\n Document doc = builder.parse(in, null);\n NodeList statements = doc.getElementsByTagName(\"statement\");\n for (int i = 0; i < statements.getLength(); i++) {\n sql = \"INSERT INTO \" + this.tableName + \" \" + statements.item(i).getChildNodes().item(0).getNodeValue();\n db.execSQL(sql);\n sql = \"\";\n }\n } catch (Throwable t) {\n Toast.makeText(context, t.toString(), Toast.LENGTH_LONG).show();\n }\n }", "public CustomerOrderDataBase(String file) {\r\n this.FILE_NAME = file;\r\n orderInfo = new ArrayList<>(4000000);\r\n console = new Scanner(System.in);\r\n try {\r\n loadFile();\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "public void fromFile(String fileName)\n {\n //definir dados\n int i;\n int j;\n int lin;\n int col;\n String linha;\n FILE arquivo;\n\n arquivo = new FILE(FILE.INPUT, fileName);\n\n //obter dimensoes\n lin = lines();\n col = columns();\n\n //verificar se dimensoes validas\n if( lin <= 0 || col <= 0 )\n {\n IO.println(\"ERRO: Tamanho invalido. \");\n } //end\n else\n {\n //verificar se arquivo e' valido\n if( arquivo == null )\n {\n IO.println(\"ERRO: Arquivo invalido. \");\n } //end\n else\n {\n //ler a primeira linha do arquivo\n linha = arquivo.readln();\n\n //verificar se ha' dados\n if( linha == null )\n {\n IO.println(\"ERRO: Arquivo vazio. \");\n } //end\n else\n {\n linha = arquivo.readln();\n for( i = 0; i < lin; i++)\n {\n for( j = 0; j < col; j++)\n {\n //ler linha do arquivo\n linha = arquivo.readln();\n table[ i ][ j ] = linha;\n } //end repetir\n } //end repetir\n //fechar arquivo (indispensavel)\n arquivo.close();\n } //end se\n } //end se\n } //end se\n }", "private static void parseInsertString(String insertRowString) {\n System.out.println(\"STUB: Calling parseInsertString(String s) to process queries\");\n System.out.println(\"Parsing the string:\\\"\" + insertRowString + \"\\\"\");\n insertRowString = insertRowString.toLowerCase();\n boolean insert = true;\n String cols = insertRowString.substring(0, insertRowString.indexOf(\")\") + 1);\n String vals = insertRowString.substring(insertRowString.indexOf(\")\") + 1);\n String tableName = vals.trim().split(\" \")[0];\n String tableNamefile = tableName + \".tbl\";\n\n Matcher mcols = Pattern.compile(\"\\\\((.*?)\\\\)\").matcher(cols);\n Matcher mvals = Pattern.compile(\"\\\\((.*?)\\\\)\").matcher(vals);\n\n\n cols = mcols.find() ? mcols.group(1).trim() : \"\";\n vals = mvals.find() ? mvals.group(1).trim() : \"\";\n String columns[] = cols.split(\",\");\n String values[] = vals.split(\",\");\n columns = removeWhiteSpacesInArray(columns);\n values = removeWhiteSpacesInArray(values);\n Table table = null;\n Set colNames = columnOrdinalHelper.getKeySet(tableName);\n HashSet<String> colNullVals = new HashSet<>();\n try {\n table = new Table(tableNamefile);\n // to perform the order of the insert based on the ordinal position\n TreeMap<String, String> colOrder = new TreeMap<>();\n // to map the colunm with data\n HashMap<String, String> colVals = new HashMap<>();\n\n for (int i = 0; i < columns.length; i++) {\n //preserving the order of the columns as given to ordinal positions\n colOrder.put(columnOrdinalHelper.getProperties(tableName.concat(\".\").concat(columns[i])), columns[i]);\n //mappng column name wth value\n colVals.put(columns[i], values[i]);\n }\n long pos = checkIfTablePageHasSpace(tableNamefile, Integer.parseInt(recordLengthHelper.getProperties(tableName.concat(\".\").concat(Constant.recordLength))));\n if (pos != -1) {\n long indexTowrite = pos;\n int noOfColumns = Integer.parseInt(recordLengthHelper.getProperties(tableName.concat(\".\").concat(Constant.numberOfColumns)));\n\n for (Object s : colNames) {\n if (!colOrder.containsValue(String.valueOf(s).substring(String.valueOf(s).indexOf('.')+1))){\n colNullVals.add(String.valueOf(s));\n }\n }\n//\n//\n// }\n\n for(String s : colNullVals){\n if(columnNotNullHelper.getProperties(s)!=null){\n System.out.println(\"Column cannot be null : \"+s);\n insert = false;\n }\n break;\n }\n\n for (int i = 1; i <= noOfColumns; i++) {\n if (colOrder.containsKey(String.valueOf(i)) && insert) {\n pos = RecordFormat.writeRecordFormat(columnTypeHelper.getProperties(tableName.concat(\".\").concat(colOrder.get(String.valueOf(i)))), table, pos, colVals.get(colOrder.get(String.valueOf(i))));\n colNames.remove(tableName.concat(\".\").concat(colOrder.get(String.valueOf(i))));\n }\n }\n Iterator it = colNames.iterator();\n while (it.hasNext() && insert) {\n String colName = (String) it.next();\n String nullValue = String.valueOf(RecordFormat.getRecordFormat(columnTypeHelper.getProperties(colName)));\n pos = RecordFormat.writeRecordFormat(nullValue, table, pos, null);\n }\n table.page.updateArrOfRecLocInPageHeader((short) indexTowrite);\n table.page.updateNoOfRecInPageHeader();\n table.page.updateStartOfContent((short) indexTowrite);\n } else {\n //TODO: Splitting\n }\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n }", "public void LoadLifeloggingData(String XMLFilePath) throws SQLException {\n\t\tString loaddata1 = \"LOAD XML INFILE '\" + XMLFilePath + \"'\"\n\t + \"INTO TABLE minute ROWS IDENTIFIED BY '<minute>'\";\n\t\tString loaddata2 = \"LOAD XML INFILE '\" + XMLFilePath + \"'\"\n\t + \"INTO TABLE image ROWS IDENTIFIED BY '<image-path>'\"; \n\t\t\n\t\tStatement stmt = this.connection.createStatement();\n\t\tstmt.execute(loaddata1);\n\t\tstmt.execute(loaddata2);\n\t\tstmt.close();\n\t}", "public void insertIntoTable (String tableName , LinkedList<String> values);", "@Override\r\n\tpublic void insertFile(Map<String, Object> map) {\n\t\t\r\n\t\tsqlSession.insert(namespace + \"insertFile\", map);\r\n\t}", "public void loadInitialData() {\n\t\t\texecuteTransaction(new Transaction<Boolean>() {\n\t\t\t\t@Override\n\t\t\t\tpublic Boolean execute(Connection conn) throws SQLException {\n\t\t\t\t\tList<Item> inventory;\n\t\t\t\t\tList<Location> locationList;\n\t\t\t\t\tList<User> userList;\n\t\t\t\t\tList<JointLocations> jointLocationsList;\n\t\t\t\t\t//List<Description> descriptionList; \n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinventory = InitialData.getInventory();\n\t\t\t\t\t\tlocationList = InitialData.getLocations(); \n\t\t\t\t\t\tuserList = InitialData.getUsers();\n\t\t\t\t\t\tjointLocationsList = InitialData.getJointLocations();\n\t\t\t\t\t\t//descriptionList = //InitialData.getDescriptions();\n\t\t\t\t\t\t\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tthrow new SQLException(\"Couldn't read initial data\", e);\n\t\t\t\t\t}\n\n\t\t\t\t\tPreparedStatement insertItem = null;\n\t\t\t\t\tPreparedStatement insertLocation = null; \n\t\t\t\t\tPreparedStatement insertUser = null;\n\t\t\t\t\tPreparedStatement insertJointLocations = null;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// AD: populate locations first since location_id is foreign key in inventory table\n\t\t\t\t\t\tinsertLocation = conn.prepareStatement(\"insert into locations (description_short, description_long) values (?, ?)\" );\n\t\t\t\t\t\tfor (Location location : locationList)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tinsertLocation.setString(1, location.getShortDescription());\n\t\t\t\t\t\t\tinsertLocation.setString(2, location.getLongDescription());\n\t\t\t\t\t\t\tinsertLocation.addBatch();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinsertLocation.executeBatch(); \n\t\t\t\t\t\t\n\t\t\t\t\t\tinsertJointLocations = conn.prepareStatement(\"insert into jointLocations (fk_location_id, location_north, location_south, location_east, location_west) values (?, ?, ?, ?, ?)\" );\n\t\t\t\t\t\tfor (JointLocations jointLocations: jointLocationsList)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tinsertJointLocations.setInt(1, jointLocations.getLocationID());\n\t\t\t\t\t\t\tinsertJointLocations.setInt(2, jointLocations.getLocationNorth());\n\t\t\t\t\t\t\tinsertJointLocations.setInt(3, jointLocations.getLocationSouth());\n\t\t\t\t\t\t\tinsertJointLocations.setInt(4, jointLocations.getLocationEast());\n\t\t\t\t\t\t\tinsertJointLocations.setInt(5, jointLocations.getLocationWest());\n\t\t\t\t\t\t\tinsertJointLocations.addBatch();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinsertJointLocations.executeBatch();\n\t\t\t\t\t\t\n\t\t\t\t\t\tinsertItem = conn.prepareStatement(\"insert into inventory (location_id, item_name) values (?, ?)\");\n\t\t\t\t\t\tfor (Item item : inventory) \n\t\t\t\t\t\t{\n//\t\t\t\t\t\t\t// Auto generate itemID\n\t\t\t\t\t\t\tinsertItem.setInt(1, item.getLocationID());\n\t\t\t\t\t\t\tinsertItem.setString(2, item.getName());\n\t\t\t\t\t\t\tinsertItem.addBatch();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinsertItem.executeBatch();\n\t\t\t\t\t\t\n\t\t\t\t\t\tinsertUser = conn.prepareStatement(\"insert into users (username, password) values (?, ?)\");\n\t\t\t\t\t\tfor(User user: userList) {\n\t\t\t\t\t\t\tinsertUser.setString(1, user.getUsername());\n\t\t\t\t\t\t\tinsertUser.setString(2, user.getPassword());\n\t\t\t\t\t\t\tinsertUser.addBatch();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinsertUser.executeBatch();\n\t\t\t\t\t\t\n\t\t\t\t\t\tSystem.out.println(\"Tables populated\");\n\t\t\t\t\t\t\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tDBUtil.closeQuietly(insertLocation);\t\n\t\t\t\t\t\tDBUtil.closeQuietly(insertItem);\n\t\t\t\t\t\tDBUtil.closeQuietly(insertUser);\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\t\t}", "String [][] importData (String path);", "public static void populateDB(Class relativeClass, String fileName) {\n URL dataFileURL = relativeClass.getResource(fileName);\n String dataFile = dataFileURL.getFile();\n populateDB(dataFile);\n }", "private void createDBProcedure() {\r\n try {\r\n Class.forName(myDriver);\r\n Connection conn = DriverManager.getConnection(myUrl, myUser, myPass);\r\n for (File sentiment : sentimentsFoldersList) {\r\n try {\r\n String queryCreate\r\n = \"CREATE TABLE \" + sentiment.getName().toUpperCase()\r\n + \" (WORD VARCHAR(50), COUNT_RES INT, PERC_RES FLOAT, COUNT_TWEET INT, PRIMARY KEY(WORD) )\";\r\n Statement st_create = conn.createStatement();\r\n st_create.executeUpdate(queryCreate);\r\n System.out.println(\"TABLE \" + sentiment.getName().toLowerCase() + \" CREATED\");\r\n st_create.close();\r\n } catch (SQLException ex) {\r\n if (ex.getErrorCode() == 955) {\r\n System.out.println(\"TABLE \" + sentiment.getName().toLowerCase() + \" WAS ALREADY PRESENT...\");\r\n }\r\n }\r\n }\r\n conn.close();\r\n } catch (ClassNotFoundException | SQLException ex) {\r\n System.out.println(ex.toString());\r\n }\r\n }", "private void recreateDatabaseSchema() {\n\t\t// Fetch database schema\n\t\tlogger.info(\"Reading database schema from file\");\n\t\tString[] schemaSql = loadFile(\"blab_schema.sql\", new String[] { \"--\", \"/*\" }, \";\");\n\n\t\tConnection connect = null;\n\t\tStatement stmt = null;\n\t\ttry {\n\t\t\t// Get the Database Connection\n\t\t\tlogger.info(\"Getting Database connection\");\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t\tconnect = DriverManager.getConnection(Constants.create().getJdbcConnectionString());\n\n\t\t\tstmt = connect.createStatement();\n\n\t\t\tfor (String sql : schemaSql) {\n\t\t\t\tsql = sql.trim(); // Remove any remaining whitespace\n\t\t\t\tif (!sql.isEmpty()) {\n\t\t\t\t\tlogger.info(\"Executing: \" + sql);\n\t\t\t\t\tSystem.out.println(\"Executing: \" + sql);\n\t\t\t\t\tstmt.executeUpdate(sql);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (ClassNotFoundException | SQLException ex) {\n\t\t\tlogger.error(ex);\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (stmt != null) {\n\t\t\t\t\tstmt.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException ex) {\n\t\t\t\tlogger.error(ex);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (connect != null) {\n\t\t\t\t\tconnect.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException ex) {\n\t\t\t\tlogger.error(ex);\n\t\t\t}\n\t\t}\n\t}", "protected void importDefaultData()\n {\n LOG.info(\"Importing Data\");\n Session session = HibernateUtil.currentSession();\n Transaction tx = session.beginTransaction();\n Session dom4jSession = session.getSession(EntityMode.DOM4J);\n\n SAXReader saxReader = new SAXReader();\n try\n {\n Document document = saxReader.read(Setup.class.getResource(\"/DefaultData.xml\"));\n \n for (Object obj : document.selectNodes(\"//name\"))\n {\n Node node = (Node)obj;\n node.setText(node.getText().trim());\n }\n \n List<?> nodes = document.selectNodes(\"/Data/*/*\");\n \n for (Object obj : nodes)\n {\n Node node = (Node)obj;\n \n Class<?> clazz = Class.forName(\"at.easydiet.model.\" + node.getName());\n LOG.info(\"Importing \" + clazz.getName());\n dom4jSession.save(clazz.getName(), node);\n }\n \n session.flush();\n tx.commit();\n HibernateUtil.closeSession();\n }\n catch(Exception e)\n {\n e.printStackTrace();\n tx.rollback();\n }\n LOG.info(\"Importing ended\");\n }", "public static void bulkLoadFromInputStream(Connection cnn,String loadDataSql, InputStream dataStream) throws Exception {\n\t\tif(dataStream==null){\n\t\t\tLog.info(\"InputStream is null ,No data is imported\");\n\t\t\tthrow new IOException(\"inputstream is null!\");\n\t\t}\n\n\t\tStatement myStatement = (com.mysql.jdbc.Statement)cnn.createStatement();\n\n\t\tmyStatement.setLocalInfileInputStream(dataStream);\n\t\t\t\t\n\t\tmyStatement.execute(loadDataSql);\n\t}", "protected abstract void initialiseTable();" ]
[ "0.7117139", "0.69467306", "0.67497486", "0.67228657", "0.6546166", "0.6520098", "0.64840114", "0.64533603", "0.6390806", "0.6358577", "0.6345898", "0.63434947", "0.6326316", "0.6241529", "0.6191376", "0.6146392", "0.6134666", "0.6093861", "0.604476", "0.60385454", "0.60288954", "0.5998521", "0.5991239", "0.5989303", "0.5988947", "0.5968223", "0.59154135", "0.59076977", "0.58968335", "0.588037", "0.5862272", "0.58575386", "0.58281654", "0.5821443", "0.5800567", "0.57934576", "0.57838994", "0.57460964", "0.5744244", "0.573825", "0.57248163", "0.57040507", "0.56845593", "0.56796956", "0.5679072", "0.56490237", "0.5646654", "0.5633244", "0.5585744", "0.5583429", "0.55717874", "0.5565803", "0.55600274", "0.5556473", "0.55517745", "0.5542568", "0.5539283", "0.5508962", "0.5498353", "0.5485655", "0.548144", "0.54756606", "0.5465699", "0.5464021", "0.54611844", "0.5446256", "0.5440564", "0.54272956", "0.54228723", "0.542128", "0.541842", "0.5414319", "0.5414048", "0.5399261", "0.53981453", "0.53847176", "0.53796214", "0.5370103", "0.5368026", "0.5364042", "0.5361589", "0.53529036", "0.5345568", "0.5334255", "0.5327348", "0.53265095", "0.5319974", "0.5297165", "0.52917075", "0.5290727", "0.52840173", "0.5274928", "0.5271121", "0.52570516", "0.5256534", "0.52518654", "0.5251564", "0.52472395", "0.52450836", "0.5237977" ]
0.62319565
14
/ CREATE and UPDATE
public void saveProduct(Product product);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Update createUpdate();", "E update(E entiry);", "Dao.CreateOrUpdateStatus createOrUpdate(T data) throws SQLException, DaoException;", "int updateByPrimaryKey(Factory record);", "private static void testupdate() {\n\t\ttry {\n\t\t\tRoleModel model = new RoleModel();\n\t\t\tRoleBean bean = new RoleBean();\n\t\t\tbean = model.findByPK(7L);\n\t\t\tbean.setName(\"Finance\");\n\t\t\tbean.setDescription(\"Finance Dept\");\n\t\t\tbean.setCreatedBy(\"CCD MYSORE\");\n\t\t\tbean.setModifiedBy(\"CCD MYSORE\");\n\t\t\tbean.setCreatedDatetime(new Timestamp(new Date().getTime()));\n\t\t\tbean.setModifiedDatetime(new Timestamp(new Date().getTime()));\n\t\t\tmodel.update(bean);\n\t\t\tRoleBean updateBean = model.findByPK(1);\n\t\t\tif (\"12\".equals(updateBean.getName())) {\n\t\t\t\tSystem.out.println(\"UPDATE RECORD FAILED\");\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"RECORD UPDATED SUCCESSFULLY\");\n\t\t\t}\n\t\t} catch (ApplicationException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (DuplicateRecordException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "public void crudOperationStudent(){\n //Retrieve Student\n Student student=entityManager.find(Student.class,2L);\n // persistence Context have Student\n //Retrieve Passport\n Passport passport=student.getPassport();\n // persistence Context have Student,passport\n //Update passport number for student\n passport.setPassportNo(\"ZX132322\");\n // persistence Context have Student, updated-passport\n //update Student details\n student.setAge(25);\n // persistence Context have updated-Student, updated-passport\n entityManager.persist(student);\n\n }", "private void updateDB() {\n }", "int updateByPrimaryKey(GirlInfo record);", "@Test\n public void testUpdate() throws MainException, SQLException {\n System.out.println(\"update\");\n LinkingDb instance = new LinkingDb(new ConfigurazioneTO(\"jdbc:hsqldb:file:database/\",\n \"ADISysData\", \"asl\", \"\"));\n instance.connect();\n PreparedStatement stmt = instance.prepareStatement(\n \"insert into infermieri (nome, cognome) values ('luca', 'massa')\");\n boolean expResult = true;\n boolean result = instance.update(stmt);\n assertEquals(expResult, result);\n }", "public void executeUpdate();", "@Test\n\tpublic void update01() throws SQLException {\n\t\tjdbcLink.update(Product.class)\n\t\t\t.set()\n\t\t\t\t.param(Product.NAME, \"xxxxx\").param(Product.NAME, \"xxxxx\")\n\t\t\t.where()\n\t\t\t\t.and().eq(Product.UID, 77L)\n\t\t\t.execute();\n\t\t\n\t\t\t\t\n\t}", "@Override\r\n protected void createDbContentCreateEdit() {\n DbContentCreateEdit dbContentCreateEdit = new DbContentCreateEdit();\r\n dbContentCreateEdit.init(null);\r\n form.getModelObject().setDbContentCreateEdit(dbContentCreateEdit);\r\n dbContentCreateEdit.setParent(form.getModelObject());\r\n ruServiceHelper.updateDbEntity(form.getModelObject()); \r\n }", "E update(E entity);", "E update(E entity);", "int updateByPrimaryKey(FctWorkguide record);", "public Hoppy update(Hoppy hoppy) throws DataAccessException;", "@Test\r\n public void testUpdate() {\r\n System.out.println(\"update\");\r\n Title t = new Title();\r\n t.setIsbn(\"test\");\r\n t.setTitle(\"aaaaaaaaaaaaaaaaaa\");\r\n t.setAuthor(\"kkkkkkkkkkkkkk\");\r\n t.setType(\"E\");\r\n int expResult = 1;\r\n int result = TitleDao.update(t);\r\n assertEquals(expResult, result);\r\n }", "private void creates() {\n \tDBPeer.fetchTableColumns();\n \tDBPeer.fetchTableRows();\n \tDBPeer.fetchTableIndexes();\n \t\n for (int i = 0; i < creates.size(); i++) {\n creates.get(i).init();\n }\n \n DBPeer.updateTableColumns();\n DBPeer.updateTableRows();\n DBPeer.updateTableIndexes();\n }", "private static void updateRecords() {\n for (Team t: Main.getTeams()){\n //If the team already exists\n if (SqlUtil.doesTeamRecordExist(c,TABLE_NAME,t.getIntValue(Team.NUMBER_KEY))){\n //Update team record\n updateTeamRecord(t);\n } else {\n //Create a new row in database\n addNewTeam(t);\n\n }\n }\n\n }", "int updateByPrimaryKey(ProEmployee record);", "@Override\n\tpublic void create(Student student) {\n\t\tString query=\"insert into student values('\"+student.getId()+\"','\"+student.getName()+\"','\"+student.getAge()+\"')\";\n\t//\tjdbcTemplate.update(query);\n\t\tint result=jdbcTemplate.update(query);\n\t\tSystem.out.println(result+\"Record Inserted\");\n\t}", "void createOrUpdate(T entity);", "int updateByPrimaryKey(Dormitory record);", "int updateByPrimaryKey(Dress record);", "@Test\n public void updateTest() throws SQLException, IDAO.DALException {\n userDAO.create(user);\n user.setNavn(\"SørenBob\");\n user.setCpr(\"071199-4397\");\n user.setAktiv(false);\n user.setIni(\"SBO\");\n // Opdatere objektet i databasen, og sammenligner.\n userDAO.update(user);\n recivedUser = userDAO.get(-1);\n\n assertEquals(recivedUser.getId(), user.getId());\n assertEquals(recivedUser.getNavn(), user.getNavn());\n assertEquals(recivedUser.getIni(), user.getIni());\n assertEquals(recivedUser.getCpr(), user.getCpr());\n assertEquals(recivedUser.isAktiv(),user.isAktiv());\n }", "Patient update(Patient patient);", "int updateByPrimaryKey(Prueba record);", "int updateByPrimaryKey(Tourst record);", "@Test\r\n public void testUpdate() throws Exception {\r\n System.out.println(\"update\");\r\n Bureau obj = new Bureau(0,\"Test\",\"000000000\",\"\");\r\n BureauDAO instance = new BureauDAO();\r\n instance.setConnection(dbConnect);\r\n obj = instance.create(obj);\r\n obj.setSigle(\"Test2\");\r\n //etc\r\n obj.setTel(\"000000001\");\r\n //etc\r\n Bureau expResult=obj;\r\n Bureau result = instance.update(obj);\r\n assertEquals(expResult.getSigle(), result.getSigle());\r\n //etc\r\n assertEquals(expResult.getTel(), result.getTel());\r\n //etc\r\n instance.delete(obj);\r\n //TODO verifier que si met à jour vers un doublé sigle-tel déjà existant, on a une exception\r\n }", "@Test\n public void update() {\n try{\n repo.save(s);\n repot.save(t);\n repon.save(n);\n Tema t2 = new Tema(1, 0, 6, \"GUI\");\n Student s2 = new Student(1,221, \"Pop Ion\",\"[email protected]\",\"prof\");\n Nota n2 = new Nota(1, 1, \"prof\", 10, \"Irelevant\");\n repo.save(s2);\n repot.save(t2);\n repon.save(n2);\n repo.update(s2);\n repot.update(t2);\n repon.update(n2);\n assert repo.findOne(1).getGrupa()==221;\n assert repot.findOne(1).getDeadline()==8;\n assert repon.findOne(\"11\").getFeedback()==\"Irelevant\";\n\n }\n catch (ValidationException e){\n }\n }", "void update(EmployeeDetail detail) throws DBException;", "@Test\r\n public void testUpdate() {\r\n System.out.println(\"update\");\r\n Festivity object = new Festivity();\r\n object.setStart(Calendar.getInstance().getTime());\r\n object.setEnd(Calendar.getInstance().getTime());\r\n object.setName(\"Test Fest 2\");\r\n object.setPlace(\"Howards\");\r\n boolean expResult = true;\r\n boolean result = Database.update(object);\r\n assertEquals(expResult, result);\r\n \r\n }", "public void updateEntity();", "public void attemptToUpdate();", "@Override\r\n\tpublic void update() throws SQLException {\n\r\n\t}", "LicenseUpdate create(LicenseUpdate newLicenseUpdate);", "int updateByPrimaryKey(AccessModelEntity record);", "int updateByPrimaryKey(HomeWork record);", "int updateByPrimaryKey(SupplyNeed record);", "int updateByPrimaryKey(Access record);", "void update(Student entity);", "int updateByPrimaryKey(TCpySpouse record);", "int updateByPrimaryKey(Table2 record);", "int updateByPrimaryKey(Assist_table record);", "int updateByPrimaryKey(TempletLink record);", "public boolean update(Product p){\n ContentValues contvalu= new ContentValues();\n //contvalu.put(\"date_created\", \"datetime('now')\");\n contvalu.put(\"name\",p.getName());\n contvalu.put(\"feature\",p.getFeature());\n contvalu.put(\"price\",p.getPrice());\n return (cx.update(\"Product\",contvalu,\"id=\"+p.getId(),null))>0;\n//-/-update2-////\n\n\n }", "int updateByPrimaryKey(Employee record);", "@Override\r\n\tpublic boolean create(Moteur obj, Connection conn) throws SQLException {\n\t\treturn false;\r\n\t}", "@Test\n public void updateTest10() throws SQLException {\n manager = new TableServizioManager(mockDb);\n Servizio servizio = manager.retriveById(2);\n servizio.setBar(true);\n manager.update(servizio);\n servizio = manager.retriveById(2);\n assertEquals(true, servizio.isBar() ,\"Should return true if update Servizio\");\n }", "int updateByPrimaryKey(PrhFree record);", "int updateByPrimaryKey(TCar record);", "int updateByPrimaryKey(Commet record);", "int updateByPrimaryKeySelective(GirlInfo record);", "Department createOrUpdate(Department department);", "@Test\n public void testUpdate() {\n int resultInt = disciplineDao.insert(disciplineTest);\n \n boolean result = false;\n \n if(resultInt > 0){\n disciplineTest.setId(resultInt);\n \n disciplineTest.setName(\"matiere_test2\");\n \n result = disciplineDao.update(disciplineTest);\n \n disciplineDao.delete(disciplineTest);\n }\n \n assertTrue(result);\n }", "void update ( priorizedListObject v ) throws DAOException;", "Object createOrUpdate() {\n if (isNewRecord()) {\n create();\n } else {\n update();\n }\n return this;\n }", "int updateByPrimaryKey(Forumpost record);", "int updateByPrimaryKey(RepStuLearning record);", "int updateByPrimaryKey(FinancialManagement record);", "int updateByPrimaryKey(Disease record);", "void commit();", "void commit();", "@Test\n void updateSuccess() {\n String Vin = \"1111111111111111X\";\n Car carToUpdate = carDao.getById(1);\n carToUpdate.setVin(Vin);\n carDao.saveOrUpdate(carToUpdate);\n Car retrievedCar = carDao.getById(1);\n assertEquals(carToUpdate, retrievedCar);\n }", "void executeUpdate();", "int updateByPrimaryKey(Basicinfo record);", "int updateByPrimaryKey(AdminTab record);", "int updateByPrimaryKey(TbFreightTemplate record);", "@Test\n public void updateTest2() throws SQLException {\n manager = new TableServizioManager(mockDb);\n Servizio servizio = manager.retriveById(2);\n servizio.setBar(false);\n manager.update(servizio);\n servizio = manager.retriveById(2);\n assertEquals(false, servizio.isBar() ,\"Should return true if update Servizio\");\n }", "public User update(User user) throws DataAccessException;", "@Test\r\n\tpublic void testUpdate() {\n\t\tint todos = modelo.getAll().size();\r\n\t\tCalificacion c = modelo.getById(1);\r\n\t\tCalificacion c2 = new Calificacion(7, \"Notable\");\r\n\t\tc2.setClave(c.getClave());\r\n\t\tc2.setDescripcion(c.getDescripcion());\r\n\t\tc2.setId(c.getId());\r\n\t\tc2.setClave(5);\r\n\t\tassertTrue(Calificacion.ID_NULL < modelo.update(c2));\r\n\t\tassertEquals(5, modelo.getById(1).getClave());\r\n\r\n\t\t// update de un registro null\r\n\t\tassertEquals(Calificacion.ID_NULL, modelo.update(null));\r\n\r\n\t\t// update de un registro que no existe\r\n\t\tCalificacion cInexistente = new Calificacion(0, \"nulo\");\r\n\t\tcInexistente.setId(14);\r\n\t\tassertEquals(Calificacion.ID_NULL, modelo.update(cInexistente));\r\n\t\tassertEquals(\"Debería ser las mismas calificaciones\", todos, modelo\r\n\t\t\t\t.getAll().size());\r\n\r\n\t}", "public abstract void updateDatabase();", "public abstract boolean create(T entity) throws SQLException;", "protected String createUpdate(T t) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(\"UPDATE \");\n\t\tsb.append(type.getSimpleName());\n\t\tsb.append(\" SET \");\n\t\treturn sb.toString();\n\t}", "@Test\n public void updateTest8() throws SQLException {\n manager = new TableServizioManager(mockDb);\n Servizio servizio = manager.retriveById(2);\n servizio.setCanoa(true);\n manager.update(servizio);\n servizio = manager.retriveById(2);\n assertEquals(true, servizio.isCanoa() ,\"Should return true if update Servizio\");\n }", "public User update(User user)throws Exception;", "@Override\n public void update(Person p) throws SQLException, ClassNotFoundException\n {\n\n BasicDBObject query = new BasicDBObject();\n query.put(\"Id\", p.getId()); // old data, find key Id\n\n BasicDBObject newDocument = new BasicDBObject();\n\n// newDocument.put(\"Id\", p.getId()); // new data\n newDocument.put(\"FName\", p.getFName()); // new data\n newDocument.put(\"LName\", p.getLName()); // new data\n newDocument.put(\"Age\", p.getAge()); // new data\n System.out.println(newDocument);\n\n BasicDBObject updateObj = new BasicDBObject();\n updateObj.put(\"$set\", newDocument);\n System.out.println(updateObj);\n\n table.update(query, updateObj);\n }", "@Override\n public void execute(Realm realm) {\n Book newbook = realm.createObject(Book.class, UUID.randomUUID().toString());\n newbook.setBook_name(newBookName);\n newbook.setAuthor_name(newAuthorName);\n }", "public void update(T object) throws SQLException;", "int updateByPrimaryKey(CTipoComprobante record) throws SQLException;", "UpdateType createUpdateType();", "int updateByPrimaryKey(OpeningRequirement record);", "int updateByPrimaryKey(Admin record);", "int updateByPrimaryKey(Admin record);", "int updateByPrimaryKey(Online record);", "int updateByPrimaryKey(Owner record);", "int updateByPrimaryKey(BasicEquipment record);", "public void saveOrUpdate(Transaction transaction) throws Exception;", "int updateByPrimaryKey(NjProductTaticsRelation record);", "CustomerOrder update(CustomerOrder customerOrder);", "int updateByPrimaryKey(TestEntity record);", "int updateByPrimaryKey(Storage record);", "int updateByPrimaryKey(Storage record);", "int updateByPrimaryKey(HotelType record);", "int updateByPrimaryKey(SPerms record);", "@Test\n public void testSaveOrUpdate() {\n Customer customer = new Customer();\n customer.setId(3);\n customer.setName(\"nancy\");\n customer.setAge(18);\n saveOrUpdate(customer);\n }", "T update(T entity);", "T update(T entity);", "int updateByPrimaryKey(ExamRoom record);", "@Test\n void updateSuccess() {\n String newFirstName = \"Artemis\";\n User userToUpdate = (User) dao.getById(1);\n userToUpdate.setFirstName(newFirstName);\n dao.saveOrUpdate(userToUpdate);\n User userAfterUpdate = (User) dao.getById(1);\n assertEquals(newFirstName, userAfterUpdate.getFirstName());\n }", "int updateByPrimaryKey(ResourcePojo record);" ]
[ "0.7551734", "0.6337913", "0.63296205", "0.6224424", "0.6022952", "0.5995848", "0.5974442", "0.59267586", "0.59255564", "0.59012264", "0.5877681", "0.5870225", "0.58656925", "0.58656925", "0.5857596", "0.5857238", "0.5848731", "0.58469486", "0.58456814", "0.58251405", "0.58234113", "0.5823324", "0.5796811", "0.57934093", "0.57890177", "0.57864517", "0.57821083", "0.5773628", "0.57672995", "0.5758822", "0.5755281", "0.5749813", "0.5748852", "0.5744163", "0.57427645", "0.5742292", "0.5742059", "0.5741595", "0.57369125", "0.573619", "0.57337445", "0.57316554", "0.5731549", "0.5729371", "0.57200575", "0.57125556", "0.5711383", "0.57039225", "0.57028306", "0.5702154", "0.5701727", "0.56976676", "0.5696137", "0.56938255", "0.56935745", "0.5689777", "0.5686824", "0.5685051", "0.5683849", "0.56790394", "0.5678769", "0.5666105", "0.5666105", "0.5665817", "0.56625396", "0.56621325", "0.5661424", "0.5655293", "0.5648797", "0.5647019", "0.56422734", "0.56411254", "0.5640808", "0.56303036", "0.5624556", "0.56227744", "0.5622358", "0.5619901", "0.5619618", "0.5616389", "0.5605187", "0.5604786", "0.5599835", "0.5599835", "0.5591424", "0.5588743", "0.55874324", "0.55868816", "0.55868423", "0.55819327", "0.5581228", "0.55808514", "0.55808514", "0.5579933", "0.55777174", "0.55754066", "0.5571317", "0.5571317", "0.5569775", "0.5569378", "0.5566227" ]
0.0
-1
Constructor for device that takes a hub.
public Device(Hub h) { uuid = UUID.randomUUID(); status = Status.NORMAL; hub = h; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public device() {\n\t\tsuper();\n\t}", "public Device() {\n }", "public PuppetIdracServerDevice() { }", "private Device(Builder builder) {\n super(builder);\n }", "Device createDevice();", "public IoTSecurityAlertedDevice() {\n }", "public DeviceInfo() {}", "Builder forDevice(DeviceId deviceId);", "private void initDevice() {\n device = new Device();\n device.setManufacture(new Manufacture());\n device.setInput(new Input());\n device.setPrice(new Price());\n device.getPrice().setCurrency(\"usd\");\n device.setCritical(DeviceCritical.FALSE);\n }", "public IRSensorSubsystem() {\n\n }", "DeviceSensor createDeviceSensor();", "public BluetoothDeviceSocketConnection(BluetoothDevice device) {\n this.device = device;\n }", "private Hub(Transaction paramTransaction, Attachment.MessagingHubAnnouncement paramMessagingHubAnnouncement)\r\n/* 62: */ {\r\n/* 63: 95 */ this.accountId = paramTransaction.getSenderId();\r\n/* 64: 96 */ this.dbKey = hubDbKeyFactory.newKey(this.accountId);\r\n/* 65: 97 */ this.minFeePerByteNQT = paramMessagingHubAnnouncement.getMinFeePerByteNQT();\r\n/* 66: 98 */ this.uris = Collections.unmodifiableList(Arrays.asList(paramMessagingHubAnnouncement.getUris()));\r\n/* 67: */ }", "public BasicSensor() {}", "public DeviceDataRequestCommand()\n {\n }", "public Device() {\n isFaceUp = null;\n isFaceDown = null;\n isCloseProximity = null;\n isDark = null;\n }", "public Device(Device source) {\n if (source.IP != null) {\n this.IP = new String(source.IP);\n }\n if (source.Mac != null) {\n this.Mac = new String(source.Mac);\n }\n if (source.TokenId != null) {\n this.TokenId = new String(source.TokenId);\n }\n if (source.DeviceId != null) {\n this.DeviceId = new String(source.DeviceId);\n }\n if (source.IMEI != null) {\n this.IMEI = new String(source.IMEI);\n }\n if (source.IDFA != null) {\n this.IDFA = new String(source.IDFA);\n }\n if (source.IDFV != null) {\n this.IDFV = new String(source.IDFV);\n }\n }", "public Buffer(String label){\n channelLabel = label;\n }", "public Pwm(int bus){\n instanceBus = bus;\n if(bus == unusedBus){\n \n }\n else{\n pwmInstance = new Jaguar(bus);\n Debug.output(\"Pwm constructor: created PWM on bus\", new Integer(bus), ConstantManager.deviceDebug);\n }\n }", "public OpcDeviceTest(String name)\n {\n super(name);\n }", "protected BLDevice(short deviceType, String deviceDesc, String host, Mac mac) throws IOException {\r\n key = INITIAL_KEY;\r\n iv = INITIAL_IV;\r\n id = new byte[] { 0, 0, 0, 0 };\r\n\r\n pktCount = new Random().nextInt(0xffff);\r\n\r\n this.deviceType = deviceType;\r\n this.deviceDesc = deviceDesc;\r\n \r\n this.host = host;\r\n this.mac = mac;\r\n\r\n sock = new DatagramSocket();\r\n sock.setReuseAddress(true);\r\n sock.setBroadcast(true);\r\n aes = new AES(iv, key);\r\n alreadyAuthorized = false;\r\n }", "public HiTechnicMagneticSensor(Port port) {\r\n super(port);\r\n init();\r\n }", "public TrackClientPacketHandler() \n {\n super(Constants.DEVICE_CODE);\n }", "public Component(Desktop desktop) {\r\n this.desktop = desktop;\r\n }", "public BizFallDevice() {\n super();\n }", "public Bridge() {\n }", "public PlatformImpl( final PlatformBuilder platformBuilder )\n {\n NullArgumentException.validateNotNull( platformBuilder, \"Platform builder\" );\n m_platformBuilder = platformBuilder;\n }", "public RegistroSensor() \n {\n\n }", "private Device buildDevice() {\n Device device = Device.builder()\n .text(Narrative.builder().div(Xhtml.of(\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">Generated</div>\")).status(NarrativeStatus.GENERATED).build())\n .meta(Meta.builder()\n .profile(Canonical.of(\"http://ibm.com/fhir/StructureDefinition/test-device|0.1.0\"))\n .build())\n .statusReason(CodeableConcept.builder().coding(Coding.builder().system(Uri.of(\"http://terminology.hl7.org/CodeSystem/device-status-reason\")).code(Code.of(\"online\")).build()).build())\n .specialization(Specialization.builder()\n .systemType(CodeableConcept.builder().coding(Coding.builder().system(Uri.of(ValidationSupport.BCP_47_URN)).code(Code.of(ENGLISH_US)).build()).build()).build())\n .extension(Extension.builder().url(\"http://ibm.com/fhir/StructureDefinition/test-language-primary-extension\")\n .value(CodeableConcept.builder().coding(Coding.builder().system(Uri.of(ValidationSupport.BCP_47_URN)).code(Code.of(ENGLISH_US)).build()).build()).build(),\n Extension.builder().url(\"http://ibm.com/fhir/StructureDefinition/test-language-secondary-extension\")\n .value(Coding.builder().system(Uri.of(ValidationSupport.BCP_47_URN)).code(Code.of(ENGLISH_US)).build()).build(),\n Extension.builder().url(\"http://ibm.com/fhir/StructureDefinition/test-language-tertiary-extension\")\n .value(Code.of(ENGLISH_US)).build())\n .build();\n return device;\n }", "public TestableJoystick(int port) {\n super(port);\n }", "public BTDevice(BluetoothDevice device){\n\t\tthis.btRawDevice = device;\n\t\tthis.retryBackoff = 0;\n\t\tthis.lastTry = 0;\n\t\tthis.retryCounter = Constants.BT_CONN_MAX_RETRY;\n\t}", "public ArduinoComm() {\r\n\t\tsetup();\r\n\t}", "public Driver()\n {\n // instantiate joysticks & controllers here.\n\n // bind button objects to physical buttons here.\n\n // bind buttons to commands here.\n\n }", "public Bus() {\n\t}", "public Mobile() { }", "private Hit(Hub paramHub, long paramLong)\r\n/* 23: */ {\r\n/* 24: 24 */ this.hub = paramHub;\r\n/* 25: 25 */ this.hitTime = paramLong;\r\n/* 26: */ }", "public RegisterBus(short a, byte b)\n {\n super(a,b);\n setDirection(Location.NORTH);\n }", "public HiTechnicMagneticSensor(AnalogPort port) {\r\n super(port);\r\n init();\r\n }", "protected SimpleSwitchDevice(RemoteHomeManager m, int deviceId, String deviceName) {\n super (m, deviceId, deviceName);\n setSubDeviceNumber(\"1\");\n lightSchedule = new OnOffSchedule();\n }", "public DeviceDocumentUnit() {\n super();\n }", "public Sensor(int threadNumber) {\n\t\tdeviceNumber = threadNumber;\n\t}", "private Hub(ResultSet paramResultSet)\r\n/* 70: */ throws SQLException\r\n/* 71: */ {\r\n/* 72:102 */ this.accountId = paramResultSet.getLong(\"account_id\");\r\n/* 73:103 */ this.dbKey = hubDbKeyFactory.newKey(this.accountId);\r\n/* 74:104 */ this.minFeePerByteNQT = paramResultSet.getLong(\"min_fee_per_byte\");\r\n/* 75:105 */ this.uris = Collections.unmodifiableList(Arrays.asList((String[])paramResultSet.getObject(\"uris\")));\r\n/* 76: */ }", "public USBAmp() {\r\n super();\r\n }", "public SyncDevice(String id) {\n this.id = id;\n this.displayName = id;\n }", "public Device(String d_name, String s_name, String d_mac, String s_id, String s_alive) {\n this.d_name = d_name;\n this.s_name = s_name;\n this.d_mac = d_mac;\n this.s_id = s_id;\n this.s_alive = s_alive;\n // this.d_alive = d_alive; // 0 : die , 1 : alive\n }", "public HVConnect () {\n super();\n // TODO Auto-generated constructor stub\n }", "public DriversStation(int driverGamePadUsbPort, int operatorGamePadUsbPort)\n\t{\n\t\t// call base class constructor\n\t\tsuper(driverGamePadUsbPort, operatorGamePadUsbPort);\n\t}", "public UdpEndpoint( UdpKernel kernel, long id, SocketAddress address, DatagramSocket socket )\n {\n this.id = id;\n this.address = address;\n this.socket = socket;\n this.kernel = kernel;\n }", "public Controller(int host) {\r\n\t\tsuper(host);\r\n\t}", "public HGDClient() {\n \n \t}", "public Hardware() {\n hwMap = null;\n }", "public com.google.protobuf.Empty setDevice(org.thethingsnetwork.management.proto.HandlerOuterClass.Device request);", "public DeviceData() {\r\n this.rtAddress = 0;\r\n this.subAddress = 0;\r\n this.txRx = 0;\r\n this.data = new short[32];\r\n }", "public Devices(){\n\t\turl = URL;\n\t\ttitle = TITLE;\n\t}", "public HwPeripheralFactoryImpl() {\r\n\t\tsuper();\r\n\t}", "public DeviceDescription() {\n //Initialize lists\n this.capabilities = new ArrayList<>();\n this.attachments = new ArrayList<>();\n }", "public DriveSubsystem() {\n }", "public BasicDriveTeleOp() {\n\n }", "public Mech() {\n this(Mech.GYRO_STANDARD, Mech.COCKPIT_STANDARD);\n }", "public BluetoothPeripheral(long nativePeripheralHandle) {\n this.nativePeripheralHandle = nativePeripheralHandle;\n }", "public NetworkMonitorAdapter( Adapter adapter )\r\n {\r\n super( adapter );\r\n }", "public TVendor() {\r\n\t\t// Default constructor\r\n\t}", "private Bluetooth() {}", "public Platform() { }", "@Inject\n public BluetoothProbeFactory() {\n }", "DeviceActuator createDeviceActuator();", "public HangerSubsystem() {\n // WRITE CODE BETWEEN THESE LINES -------------------------------------------------------- //\n // TODO: configure and initialize motor (if necessary)\n\n // TODO: configure and initialize sensor (if necessary)\n\n // ^^-----------------------------------------------------------------------------------^^ //\n }", "public SensorData() {\n\n\t}", "public Vendor(VendorBuilder builder){\r\n this.owner = builder.owner;\r\n this.address = builder.address;\r\n this.firstBrand = builder.firstBrand;\r\n this.secondBrand = builder.secondBrand;\r\n }", "public interface HubProxy {\n\n /**\n * Invokes a server side hub method asynchronously.\n * \n * @param methodName The method name.\n * @param returnType The return type.\n * @param arguments The arguments.\n * @return The invocation result.\n */\n <R> Promise<R> invoke(String methodName, Class<R> returnType, Object... arguments);\n\n /**\n * Registers a client side hub callback.\n * \n * @param methodName The method name.\n * @param callback The hub callback.\n */\n void register(String methodName, HubCallback<JsonElement> callback);\n\n /**\n * Registers a client side hub callback.\n * \n * @param methodName The method name.\n * @param argumentType The argument type.\n * @param callback The hub callback.\n */\n <T> void register(String methodName, Class<T> argumentType, HubCallback<T> callback);\n\n /**\n * Unregisters a client side hub callback.\n * \n * @param methodName The method name.\n */\n void unregister(String methodName);\n}", "private DeviceManager() {\n\t\tsuper();\n\t\t// TODO Auto-generated constructor stub\n\t}", "public SensorStation(){\n\n }", "public SmartRobot(char name, Grid grid, int row, int col, int energyUnits) {\n\t\tsuper(name,grid,row,col,energyUnits);\n\t}", "public SignalEmitter(BusObject source) {\n this(source, null, BusAttachment.SESSION_ID_ANY, GlobalBroadcast.Off);\n }", "@Override\n\t\t\tpublic Device fromString(String arg0) {\n\t\t\t\treturn null;\n\t\t\t}", "@Override\n\t\t\tpublic Device fromString(String arg0) {\n\t\t\t\treturn null;\n\t\t\t}", "public\r\n Mobile() {}", "public MHLMobileIOClient(BandAccelerometerAppActivity a, String ip, int port, String id){\n this.parentActivity = a;\n this.sensorReadingQueue = new MHLBlockingSensorReadingQueue();\n this.ip = ip;\n this.port = port;\n this.userID = id;\n this.startClient();\n }", "public TAssetsDeviceRecord() {\n super(TAssetsDevice.T_ASSETS_DEVICE);\n }", "public NetworkAdapter() {\n }", "public PlugwiseMQTTDeviceInfo()\n\t{\n\t\t// initialize internal variables\n\t\tthis.macAddress = \"\";\n\t\tthis.type = \"circle\";\n\t}", "private void createDevice(String host, int port, String name) {\n ThingUID uid = new ThingUID(THING_TYPE_DEVICE, name);\n\n if (uid != null) {\n Map<String, Object> properties = new HashMap<>(1);\n properties.put(\"hostname\", host);\n properties.put(\"port\", port);\n properties.put(\"name\", name);\n DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)\n .withLabel(\"Kinect Device\").build();\n thingDiscovered(result);\n }\n }", "@Override\n public void init() {\n /* Initialize the hardware variables.\n * The init() method of the hardware class does all the work here\n */\n robot.init(hardwareMap);\n\n //ColorSensor colorSensor;\n //colorSensor = hardwareMap.get(ColorSensor.class, \"Sensor_Color\");\n\n // Send telemetry message to signify robot waiting;\n telemetry.addData(\"Say\", \"Hello Driver\"); //\n }", "public RegisterBus(short a)\n {\n super(a);\n setDirection(Location.NORTH);\n }", "public Client() {}", "public static void setRootHub(Hub thisHub, boolean b) {\n\t\tOAObjectInfoDelegate.setRootHub(thisHub.data.getObjectInfo(), b ? thisHub : null);\n\t}", "public void initDevice() {\r\n\t\t\r\n\t}", "public Os() {\n osBO = new OsBO();\n }", "public DeviceFamilyImpl(DeviceFactory df){\n\t\tsuper((Class<T>) c);\n\t\tthis.df = df;\n\t}", "public Driver(JSONObject userData) {\n super(userData, Persona.driver);\n }", "public SyncFluidPacket() {\n }", "public Device(String name, String typeName, Room room) {\n this.name = name.replace(\" \", \"_\");\n this.typeName = name.replace(\" \", \"_\");\n this.room = room;\n }", "protected UnbalanceDetailWithBusPlatformExample(UnbalanceDetailWithBusPlatformExample example) {\r\n this.orderByClause = example.orderByClause;\r\n this.oredCriteria = example.oredCriteria;\r\n }", "private void initHubTab() {\n\n /** Create the Hiub to manage the master model \"modelHub\"\n */\n this.hub = new BoundedRangeModelHub( this.modelHub );\n\n /** Define the range values of our master model\n */\n this.modelHub.setMinimum(0);\n this.modelHub.setMaximum(5000);\n\n /** Create 3 sub models initially with an arbitrary weight of 10\n * Theses weights are editable by the user\n */\n this.modelHub1 = this.hub.createFragment( 10 );\n this.modelHub2 = this.hub.createFragment( 10 );\n this.modelHub3 = this.hub.createFragment( 10 );\n\n /** Each SubModel's range values are independant and take it directly from theses slider.\n * All models (even the master) are independant and can have theses owns range values\n */\n this.modelHub1.setMinimum( this.jSliderModel1.getMinimum() );\n this.modelHub1.setMaximum( this.jSliderModel1.getMaximum() );\n this.modelHub2.setMinimum( this.jSliderModel2.getMinimum() );\n this.modelHub2.setMaximum( this.jSliderModel2.getMaximum() );\n this.modelHub3.setMinimum( this.jSliderModel3.getMinimum() );\n this.modelHub3.setMaximum( this.jSliderModel3.getMaximum() );\n\n /** Fix some default weight for sub models\n * At this stage of initialisation, listeners are effective on spinners.\n * Theses changes will change sub model weight\n */\n this.jSpinnerModel1.setValue(40);\n this.jSpinnerModel2.setValue(60);\n this.jSpinnerModel3.setValue(20);\n\n /** Set the BusyIcon to the label\n */\n this.jLabelHub.setIcon( iconHub );\n }", "public MessageBus()\r\n\t{\r\n\t\tthis(null);\r\n\t}", "public VMWareDriver() {\n }", "public PstBrand() {\r\n\t}", "public Brand()\n {\n\t\tsuper();\n }", "public Client() {\n }", "public static void hub(String hubName, Player target, CommandSender sender) {\n World w = Bukkit.getServer().getWorld(FileManager.getHubYml().getString(\"HUBS.\" + hubName + \".world\"));\n double x = FileManager.getHubYml().getDouble(\"HUBS.\" + hubName + \".x\");\n double y = FileManager.getHubYml().getDouble(\"HUBS.\" + hubName + \".y\");\n double z = FileManager.getHubYml().getDouble(\"HUBS.\" + hubName + \".z\");\n int ya = FileManager.getHubYml().getInt(\"HUBS.\" + hubName + \".yaw\");\n int pi = FileManager.getHubYml().getInt(\"HUBS.\" + hubName + \".pitch\");\n target.teleport(new Location(w, x, y, z, ya, pi));\n String name = target.getDisplayName();\n String or = (ChatColor.translateAlternateColorCodes('&', MessageManager.getMessageYml().getString(\"Hub.Target\")));\n String replace = or.replaceAll(\"%target%\", name).replaceAll(\"%hub%\", hubName);\n sender.sendMessage(target + replace);\n if (Main.plugin.getConfig().getString(\"NOTIFICATIONS.Hub\").equalsIgnoreCase(\"True\")) {\n String original = (MessageManager.getMessageYml().getString(\"Hub.Hub\"));\n String replaced = original.replaceAll(\"%hub%\", hubName);\n target.sendMessage(MessageManager.getPrefix() + ChatColor.translateAlternateColorCodes('&', replaced));\n }\n }" ]
[ "0.62662727", "0.62225235", "0.5870068", "0.58545834", "0.5662433", "0.55389583", "0.55365556", "0.54398614", "0.5427518", "0.5411364", "0.54077846", "0.5370419", "0.53584594", "0.53284353", "0.53234935", "0.5298077", "0.52637833", "0.52526337", "0.5228228", "0.52001774", "0.5199788", "0.5186857", "0.5185645", "0.5185119", "0.5173434", "0.5143751", "0.51364297", "0.513172", "0.5130337", "0.51205605", "0.5112492", "0.5107455", "0.5106519", "0.5103582", "0.50812596", "0.5080717", "0.5077802", "0.5076088", "0.5070272", "0.5064377", "0.5055272", "0.50396657", "0.503792", "0.50327456", "0.50230956", "0.5022473", "0.5022212", "0.5021694", "0.50047207", "0.50026786", "0.49954718", "0.49918872", "0.49822304", "0.4971738", "0.49665457", "0.49605295", "0.4947969", "0.494048", "0.49231163", "0.4920307", "0.49179912", "0.49154586", "0.49151096", "0.48967007", "0.48868906", "0.48832372", "0.48545653", "0.48535332", "0.48498172", "0.48484477", "0.48317623", "0.48210144", "0.4810993", "0.48040947", "0.48032165", "0.48032165", "0.4793124", "0.47887722", "0.47881916", "0.47849023", "0.47736585", "0.477159", "0.47715434", "0.47624126", "0.47519022", "0.4748375", "0.47443286", "0.474343", "0.47415924", "0.4740301", "0.47387016", "0.47339308", "0.47329462", "0.47327974", "0.4726576", "0.4725405", "0.4723312", "0.47167638", "0.47160515", "0.4715782" ]
0.84345526
0
This function alerts the hub with a message from the device. It protects the hub from the device implementations.
protected final void alertHub(String message) { hub.alert(new JSONMessaging(this, message)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void alert(String message) {\n\t\tAlertDialog alert = new AlertDialog.Builder(this).setTitle(getString(R.string.warning)).setMessage(message)\n\t\t\t\t.setNeutralButton(getString(R.string.ok), new DialogInterface.OnClickListener() {\n\t\t\t\t\tpublic void onClick(DialogInterface dialog, int id) {\n\t\t\t\t\t\t// TODO maybe implement ? controller.connect();\n\t\t\t\t\t\tdialog.cancel();\n\t\t\t\t\t}\n\t\t\t\t}).create();\n\t\talert.show();\n\t}", "private void execHandlerDevice( Message msg ) {\n\t\t // get the connected device's name\n\t\tString name = msg.getData().getString( BUNDLE_DEVICE_NAME );\n\t\tlog_d( \"EventDevice \" + name );\n\t\thideButtonConnect();\t\n\t\tString str = getTitleConnected( name );\n\t\tshowTitle( str );\n\t\ttoast_short( str );\n\t}", "void simpleNotify(SimpleAlarmMessage message);", "void showAlert(String message);", "public void broadcast(Object msg);", "private synchronized void notifyAlert(Event ObjEvent,String StrMessage) {\n \t\n \t// Variabili locali\n \tList<WireRecord> ObjWireRecords;\n \tMap<String, TypedValue<?>> ObjWireValues;\n\t\t\n\t\t// Manda il messaggio in log con il giusto livello di severity\n\t\tswitch (ObjEvent) {\t\t\n\t\t case DATA_EVENT: return;\n\t\t case CONNECT_EVENT: logger.info(StrMessage); break;\n\t\t case DISCONNECT_EVENT: logger.warn(StrMessage); break;\n\t\t case WARNING_EVENT: logger.warn(StrMessage); break;\n\t\t case ERROR_EVENT: logger.error(StrMessage); break;\n\t\t}\n\n\t\t// Se la notifica dell'alert non Ŕ disabilitata emette wire record\n\t\tif (this.actualConfiguration.Alerting) {\n\t\t\t\n\t \t// Prepara le proprietÓ dell'evento\n\t \tObjWireValues = new HashMap<>();\t\t\t\n\t \tObjWireValues.put(\"id\", TypedValues.newStringValue(this.actualConfiguration.DeviceId));\n\t \tObjWireValues.put(\"host\", TypedValues.newStringValue(this.actualConfiguration.Host));\n\t \tObjWireValues.put(\"port\", TypedValues.newIntegerValue(this.actualConfiguration.Port));\n\t \tObjWireValues.put(\"eventId\", TypedValues.newIntegerValue(ObjEvent.id));\n\t \tObjWireValues.put(\"event\", TypedValues.newStringValue(ObjEvent.description));\n\t\t\t\n\t\t\t// Se si tratta di alert di warning o di errore\n\t\t\tif ((ObjEvent==Event.WARNING_EVENT)||(ObjEvent==Event.ERROR_EVENT)) {\n\t\t\t\tObjWireValues.put(\"message\", TypedValues.newStringValue(StrMessage));\n\t\t\t}\n\t\t\t\n\t\t\t// Se c'Ŕ un enrichment per gli alert lo aggiunge\n\t\t\tif (this.actualConfiguration.AlertEnrichment.size()>0) {\n\t\t\t\tObjWireValues.putAll(this.actualConfiguration.AlertEnrichment);\n\t\t\t}\n\t\t\t\n\t\t\tObjWireRecords = new ArrayList<>();\n\t ObjWireRecords.add(new WireRecord(ObjWireValues)); \n\t\t\t\n\t // Notifica evento\n\t\t\tthis.wireSupport.emit(ObjWireRecords);\n\t\t}\n }", "public void alertMonitor(Sensor sensor) throws RemoteException;", "private void sendMessage(String message)\n {\n\t\tif(regid == null || regid.equals(\"\"))\n\t\t{\n\t\t Toast.makeText(this, \"You must register first\", Toast.LENGTH_LONG).show();\n\t\t return;\n\t\t}\n\t\tString messageType = ((Spinner)findViewById(R.id.spinner_message_type)).getSelectedItem().toString();\n\t\tnew AsyncTask<String, Void, String>()\n\t\t{\n\t\t @Override\n\t\t protected String doInBackground(String... params)\n\t\t {\n\t\t\tString msg = \"\";\n\t\t\ttry\n\t\t\t{\n\t\t\t Bundle data = new Bundle();\n\t\t\t data.putString(\"message\", params[0]);\n\t\t\t if(params[1].equals(\"Echo\"))\n\t\t\t {\n\t\t\t\tdata.putString(\"action\", \"com.antoinecampbell.gcmdemo.ECHO\");\n\t\t\t }\n\t\t\t else if(params[1].equals(\"Broadcast\"))\n\t\t\t {\n\t\t\t\tdata.putString(\"action\", \"com.antoinecampbell.gcmdemo.BROADCAST\");\n\t\t\t }\n\t\t\t else if(params[1].equals(\"Notification\"))\n\t\t\t {\n\t\t\t\tdata.putString(\"action\", \"com.antoinecampbell.gcmdemo.NOTIFICATION\");\n\t\t\t }\n\t\t\t String id = Integer.toString(msgId.incrementAndGet());\n\t\t\t gcm.send(Globals.GCM_SENDER_ID + \"@gcm.googleapis.com\", id, Globals.GCM_TIME_TO_LIVE, data);\n\t\t\t msg = \"Sent message\";\n\t\t\t}\n\t\t\tcatch (IOException ex)\n\t\t\t{\n\t\t\t msg = \"Error :\" + ex.getMessage();\n\t\t\t}\n\t\t\treturn msg;\n\t }\n\n\t @Override\n\t protected void onPostExecute(String msg)\n\t {\n\t \tToast.makeText(context, msg, Toast.LENGTH_SHORT).show();\n\t }\n\t}.execute(message, messageType);\n }", "public void sendMessage(String message) {}", "public void sendToActivity(String message){\n //In questo metodo \"avviso\" l'app che è arrivato un nuovo dato dal raspberry.\n\n Intent intent = new Intent(\"NOTIFY_ACTIVITY\");\n\n if(message != null){\n intent.putExtra(\"CURRENT_ACTIVITY\",message);\n }\n\n //invio messaggio tramite broadcaster\n broadcast.sendBroadcast(intent);\n\n }", "public void notifyCustomer(String message) {}", "public void handleSMSAlert()\n\t{\n\t\t\n\t\tWebDriverWait wait=new WebDriverWait(driver, 60);\n\t\t\n\t\twait.until(ExpectedConditions.visibilityOf(checker));\n\t\t\n\t\tif(!Generic.getAttribute(checker, \"resourceId\").contains(\"message\"))\n\t\t\treturn; // No Alert found\n\t\telse\n\t\t{\n\t\t\tif(checker.getText().contains(\"verification could not be completed\"))\n\t\t\t\tAssert.fail(\"Phone Verification failed\");\n\t\t\t\n\t\t\tLog.info(\"== Handling SMS Alert ==\");\n\t\t\tokButton.click();\n\t\t\t\n\t\t\twaitOnProgressBarId(60);\n\t\t}\n\t\t\n\t\twait.until(ExpectedConditions.visibilityOf(checker));\n\t\t\n\t\tif(!Generic.getAttribute(checker, \"resourceId\").contains(\"message\"))\n\t\t\treturn; // No Alert found\n\t\telse\n\t\t{\n\t\t\tLog.info(\"== Handling second SMS Alert ==\");\n\t\t\tokButton.click();\n\t\t\t\n\t\t\twait.until(ExpectedConditions.visibilityOf(checker));\n\t\t}\n\t\t\t\t\n\t\t\n\t\t\n\t}", "private void sendNotification() {\n }", "public void alert(String msg)\n {\n this.ui.alert(msg);\n theLogger.info(\"Alert sent to UI\");\n }", "private void sendMessage(String message) {\n if (mBtService.getState() != BluetoothService.STATE_CONNECTED) {\n Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT).show();\n return;\n }\n\n // Check that there's actually something to send\n if (message.length() > 0) {\n // Get the message bytes and tell the BluetoothChatService to write\n byte[] send = message.getBytes();\n mBtService.write(send);\n\n // Reset out string buffer to zero and clear the edit text field\n mOutStringBuffer.setLength(0);\n }\n }", "public void sendMessage(String message);", "@Override\r\n\tpublic void sendMessage(String message) {\n\t\t\r\n\t}", "@Override\n\t\t\tpublic void handleMessage(Message msg) {\n\t\t\t\tprocessBluetoothDeviceMessage(msg);\n\t\t\t}", "@Override\n public void Alert(String toWho, String topic, String text) {\n sA.alert(); \n }", "void sendMessage() {\n\n\t}", "@Override\n\tpublic void sendMessage() {\n\t\t\n\t}", "@Override\n\tpublic void alert() {\n\t\ttry {\n\t\t\tSystem.out.println(\"ala\");\n\t\t\tfM.sendMail(text, topic, toWho);\n\t\t} finally {\n\t\t\tif (al != null)\n\t\t\t\tal.alert();\n\t\t}\n\t}", "@Override\n\t\tpublic void handleMessage(Message msg) {\n\t\t\tsuper.handleMessage(msg);\n\t\t\tswitch (msg.what) {\n\t\t\tcase SearchBluetoothActivity.DEVICE_DISCOVERIED:\n\t\t\t\tbdApdater.notifyDataSetChanged();\n\t\t\t\tToast.makeText(SearchBluetoothActivity.this, \"发现新设备:\" + devices.get(devices.size() - 1).getName(),\n\t\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t\t\tbreak;\n\t\t\tcase SearchBluetoothActivity.FINISH_DISCOVERIED:\n\t\t\t\tbt_searchBluetooth_searchBluetooth.setText(getResources().getString(R.string.bt_search_bluetooth_text));\n\t\t\t\tbreak;\n\t\t\tcase SearchBluetoothActivity.REFRESH_LISTVIEW:\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}", "@Override\r\n public void handleMessage(Message message) \r\n {\r\n switch (message.what) \r\n {\r\n case BlueToothService.MESSAGE_REMOTE_CODE:\r\n Utilities.popToast (\"MESSAGE_REMOTE_CODE : \" + message.obj);\r\n break;\r\n case BlueToothService.MESSAGE_REQUEST:\r\n Utilities.popToast (\"MESSAGE_REQUEST : \" + message.obj);\r\n break;\r\n default:\r\n super.handleMessage(message);\r\n }\r\n }", "private void sendBroadcast(final String message) {\n Log.d(\"BLE\", \"sendBroadcast: \" + message);\n\n Intent intent = new Intent(message);\n\n LocalBroadcastManager.getInstance(this).sendBroadcast(intent);\n }", "void templateNotify(TeampleAlarmMessage message);", "void sendMessage(String msg);", "void sendAuthMessage(Device device) {\r\n \t//\r\n \t\t// check status and limit\r\n \t\t//\r\n \t\tint status = device.getStatus();\r\n \t\tif (status == DeviceStatus.Removed.getStatus()) {\r\n \t\t\tlogger.info(\"this device have been removed, but ask auth again\");\r\n \t\t\t\r\n \t\t} else if (status != DeviceStatus.Init.getStatus()\r\n \t\t\t\t&& status != DeviceStatus.Authing.getStatus()) {\r\n \t\t\tthrow new RentException(RentErrorCode.ErrorStatusViolate, \"device status isn't init or authing\");\r\n \t\t}\r\n \t\t//\r\n \t\t// check retry count\r\n \t\t//\r\n \t\tint retryLimit = (Integer)applicationConfig.get(\"general\").get(\"auth_retry_limit\");\r\n \t\tint currentRetry = device.getAuthRetry();\r\n \t\tlogger.info(\"current retry count is \"+currentRetry);\r\n \t\tif (retryLimit < currentRetry ) {\r\n \t\t\t//\r\n \t\t\t// retry too many times, change to suspend status.\r\n \t\t\t//\r\n \t\t\tlogger.debug(\"update to suspend status\");\r\n \t\t\tint ret = deviceDao.updateStatusAndRetryCount(device.getId(),\r\n \t\t\t\t\tdevice.getUserId(), DeviceStatus.Suspend.getStatus(),\r\n \t\t\t\t\tDeviceStatus.Authing.getStatus(), device.getModified());\r\n \t\t\tif (ret != 1) {\r\n \t\t\t\tthrow new RentException(RentErrorCode.ErrorStatusViolate,\r\n \t\t\t\t\t\t\"update device status count is not 1\");\r\n \t\t\t}\r\n \t\t\tthrow new RentException(RentErrorCode.ErrorExceedLimit,\r\n \t\t\t\t\t\"auth retry too many time try\");\r\n \t\t}\r\n \t\t\r\n \t\tUser user = device.getUser();\r\n \t\tAssert.assertNotNull(\"user can't be null\",user);\r\n \t\t\r\n \t\t//\r\n \t\t// prepare message.\r\n \t\t//\r\n \t\tString phone=encodeUtility.decrypt(user.getMobilePhone(), \"general\");\r\n \t ResourceBundle resource = ResourceBundle.getBundle(\"user\",user.getLocale());\r\n \t\tString message = MessageFormat.format(resource.getString(\"mobile_auth_message\"),\r\n \t\t\t\tdevice.getId(), encodeUtility.decrypt(device.getToken(), Device.ENCRYPT_KEY));\r\n \t\tlogger.debug(\"message is \"+message);\r\n \t\t//\r\n \t\t// update status\r\n \t\t//\r\n \t\tdevice.setModified(0);\r\n \t\tint ret =deviceDao.updateStatusAndRetryCount(device.getId(), device.getUserId(),\r\n \t\t\t\tDeviceStatus.Authing.getStatus(),\r\n \t\t\t\tDeviceStatus.Init.getStatus(), device.getModified());\r\n \t\tif (ret != 1) {\r\n \t\t\tthrow new RentException(RentErrorCode.ErrorStatusViolate,\r\n \t\t\t\t\t\"update device status count is not 1\");\r\n \t\t}\r\n \r\n \t\t//\r\n \t\t// send message through gateway.\r\n \t\t//\r\n \t\tmobileGatewayService.sendSMS(phone, message);\r\n \t\tdevice.setAuthRetry(device.getAuthRetry()+1);\r\n \t\tdevice.setStatus(DeviceStatus.Authing.getStatus());\r\n \t}", "private void sendMessage(String message) {\n if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {\n // Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT).show();\n return;\n }\n\n if (message.length() > 0) {\n byte[] send = message.getBytes();\n mChatService.write(send);\n mOutStringBuffer.setLength(0);\n\n }\n }", "@Override\n public void send() {\n System.out.println(\"send message by SMS\");\n }", "public void messageArrived(String s, MqttMessage mqttMessage) {\n LoCommand command = new Gson().fromJson(new String(mqttMessage.getPayload()), LoCommand.class);\n System.out.println(\"Device command received: \" + new Gson().toJson(command));\n\n LoCommand.LoCommandResponse response = new LoCommand.LoCommandResponse(new HashMap<>(), command.cid);\n response.res.put(\"my-ack\", \"this is my command acknowledge to \" + command.req);\n\n new Thread(() -> {\n try {\n\n String responseJson = new Gson().toJson(response);\n System.out.println(\"Publishing command acknowledge message: \" + responseJson);\n\n MqttMessage message = new MqttMessage(responseJson.getBytes());\n message.setQos(QOS);\n\n mqttClient.publish(MqttTopics.MQTT_TOPIC_RESPONSE_COMMAND, message);\n System.out.println(\"Command ack published\");\n\n } catch (MqttException me) {\n System.out.println(\"reason \" + me.getReasonCode());\n System.out.println(\"msg \" + me.getMessage());\n System.out.println(\"loc \" + me.getLocalizedMessage());\n System.out.println(\"cause \" + me.getCause());\n System.out.println(\"excep \" + me);\n me.printStackTrace();\n }\n }).start();\n }", "public void sendPublicMessage(SensorMessage message) {\n \tpublicSender.send(message);\n }", "public void alert(String message);", "public void alert( String code, String message )\n {\n _getAlertLogger().info( code, message );\n }", "private void sendMessage(String message) {\n\t\t// Check that we're actually connected before trying anything\n\t\tif (mChatService.getState() != BluetoothCommService.STATE_CONNECTED) {\n\t\t\tToast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT)\n\t\t\t\t\t.show();\n\t\t\treturn;\n\t\t}\n\n\t\t// Check that there's actually something to send\n\t\tif (message.length() > 0) {\n\t\t\t// Get the message bytes and tell the BluetoothCommService to write\n\t\t\tbyte[] send = message.getBytes();\n\t\t\tmChatService.write(send);\n\n\t\t\t// Reset out string buffer to zero and clear the edit text field\n\t\t\tmOutStringBuffer.setLength(0);\n\t\t\t// mOutEditText.setText(mOutStringBuffer);\n\t\t}\n\t}", "public void notifyWithMessage(String msg)\n {\n try {\n this.writeData(msg);\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }", "@Override\n\tpublic void sendSMS() {\n\t\tSystem.out.println(\"Logic B\" + \" Send By: \" + getVendorName());\n\t}", "@Override\n\tpublic void EmergencySend(byte[] data) {\n\t\t\n\t}", "public void sendSignal (String signal, String message ){\r\n if (btSocket != null)\r\n {\r\n try{\r\n btSocket.getOutputStream().write(signal.getBytes());\r\n msg(message,0);\r\n } catch (IOException e) {\r\n msg(\"Error\", 0);\r\n }\r\n }\r\n\r\n }", "@Test\n\tvoid AlertMessageHandle() throws InterruptedException {\n\t\t\n\t\t// Invoke the web browser and navigating to the website.\n\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"/Users/Suvarna/Downloads/chromedriver\");\n\t\tWebDriver driver = new ChromeDriver();\n\t\t\n\t\t// Alert Message handling\n driver.get(\"http://demo.guru99.com/test/delete_customer.php\");\t\t\t\n \n driver.findElement(By.name(\"cusid\")).sendKeys(\"567876\");\t\t\t\t\t\n driver.findElement(By.name(\"submit\")).submit();\t\t\t\n \t\t\n // Switch to Alert \n Alert alert = driver.switchTo().alert();\t\n \n // Capture the alert message. \n String alertMessage= driver.switchTo().alert().getText();\t\t\n \t\t\n // Display the alert message\t\t\n System.out.println(alertMessage);\t\n Thread.sleep(5000);\n \t\t\n // Accepting alert\t\t\n alert.accept();\t\n \n // Close the window\n driver.close();\n\t}", "public void showMessage(){\n final AlertDialog.Builder alert = new AlertDialog.Builder(context);\n alert.setMessage(message);\n alert.setTitle(title);\n alert.setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n alert.create().dismiss();\n }\n });\n alert.create().show();\n }", "protected void alert(String message) {\n\t\talertWindow.setContentText(message);\n\t\talertWindow.show();\n\t}", "public boolean message( Who sender, Message msg ) throws Exception;", "private void handleMessageBluetooth(Message msg) {\n\t\tToaster.doToastShort(context, \"Handle Bluetooth Mesage\");\n\t}", "@Override\n\tpublic void ActOnNotification(String message) {\n\t \tSystem.out.println(\"Sending Event\");\n\t}", "void notify(PushMessage m);", "public void sendAlert(String notificationInfo, ILabMember personInCharge) {\n }", "public void alert(String msg) {\n new Alert(msg, \"alertDone\");\n }", "private void handleSimFull() {\n // broadcast SIM_FULL intent\n Intent intent = new Intent(Intents.SIM_FULL_ACTION);\n mPhone.getContext().sendBroadcast(intent, \"android.permission.RECEIVE_SMS\");\n }", "public void sendMessage(String message) {\n\n setChanged();\n notifyObservers(message);\n }", "void systemMessageReceived(IMSession session, Message message);", "@Override\n\tpublic void confirmAndSendMessage(String messageId) {\n\t\t\n\t}", "public void sendSmsMessage(String message)\n throws Exception {\n }", "public void sendSms() {\n\n }", "public void sendPacket(String message) {\n try {\r\n Thread.sleep(1000);\r\n } catch (InterruptedException ie) {\r\n }\r\n\r\n if (ipAddress == null) {\r\n MessageEvent e = new MessageEvent(MessageType.SendWarning);\r\n e.description = \"cannot send message to unreported device\";\r\n e.HWid = HWid;\r\n RGPIO.message(e);\r\n } else if (status == PDeviceStatus.ACTIVE) {\r\n UDPSender.send(message, ipAddress, this, RGPIO.devicePort);\r\n }\r\n }", "public void broadcastmsg(String msg){\r\n Server.getUsers().forEach((user) -> {\r\n user.sendmsg(msg);\r\n });\r\n }", "public static void sendMessage(String message) {\r\n\t\tbtService.write(message.getBytes());\r\n\t}", "public final void send(MidiMessage msg) {\n device.send(msg);\n }", "private void showAlert(String message) {\n\n if (message.equals(\"Uploaded Successfully...\")) {\n // this.dismiss();\n commmunicator.onDialogMessage(new MessageDetails());\n this.dismiss();\n\n } else {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(form.getContext());\n builder.setMessage(message).setTitle(\"Response from Servers\")\n .setCancelable(false)\n .setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n // do nothing\n }\n });\n AlertDialog alert = builder.create();\n alert.show();\n }\n }", "public void sendMsg(){\r\n\t\tsuper.getPPMsg(send);\r\n\t}", "public void sendHelloMessage() {\n getSocketController().send(getMessageController().createHelloMessage(\"Сервер\", getUser().getName()));\n }", "@Override\n\tpublic void Send(String message) {\n\t\tgetReceiveArea().append(\"我:\"+message + \"\\n\");\n\t\tgetMediator().sendMessage(getName(), message);\n\t}", "@Test\n void awaitMessage() {\n\n Message message = null;\n TempBroadcast b = new TempBroadcast(\"broadcastSender2\");\n\n broadcastReceiver.subscribeBroadcast(TempBroadcast.class, c -> {\n });\n broadcastSender.sendBroadcast(b);\n\n // here we will check the method\n try {\n message = messageBus.awaitMessage(broadcastReceiver);\n\n } catch (InterruptedException e) {\n e.printStackTrace();\n //due to the assumption above, an exception is not supposed to be thrown\n }\n assertEquals(b, message);\n }", "public synchronized void alertOK() {\n\t\ttry {\n\t\t\tvListen.sendOK();\n\t\t} catch (IOException exc) {\n\t\t\terrorIOError();\n\t\t}\n\t}", "private void showAlert(String message) {\n //Builds an AlertDialog with message, title, if cancellable, and what the positive button does\n AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());\n builder.setMessage(message).setTitle(\"Response from Servers\")\n .setCancelable(false)\n .setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n // do nothing\n }\n });\n AlertDialog alert = builder.create();\n alert.show();\n// String errorMessage = null;\n// try {\n// JSONObject arr = new JSONObject(message);\n// errorMessage = arr.getString(\"error\");\n// } catch (JSONException e) {\n// e.printStackTrace();\n// }\n// Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_LONG).show();\n\n }", "public abstract void notify(JSONObject message);", "private void sendMessage() {\n if (mRecipientAddress == null) {\n if (mDevices.getSelectedItem() == null) {\n mStatusText.append(\"Please select a device to message.\\n\");\n return;\n }\n if (mMessage.getText() == null || mMessage.getText().toString().equals(\"\")) {\n mStatusText.append(\"Please enter a message to send.\\n\");\n return;\n }\n }\n WifiDirectClientAsyncTask t = new WifiDirectClientAsyncTask(this, mMessage.getText().toString());\n if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB)\n t.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);\n else\n t.execute();\n }", "@Override\n public void sendMessage(Token token) throws JSimSecurityException, JSimInvalidParametersException {\n double random_number = uniform(0.5, 2.5);\n switch((int) Math.round(random_number)){\n //Notificar\n case 1:{\n //this.PE9.receiveMessage(token);\n System.out.println(\"** Enviando mensaje desde PE7 hacia PE9\");\n token.setSender(this.getName());\n token.setPosting(\"PE9\");\n JSimLink link = new JSimLink(token);\n link.into(this.getProcessor().getQueue());\n break;\n }\n //Llamar a emergencias\n case 2:{\n //this.PE8.receiveMessage(token);\n System.out.println(\"** Enviando mensaje desde PE7 hacia PE8\");\n token.setSender(this.getName());\n token.setPosting(\"PE8\");\n JSimLink link = new JSimLink(token);\n link.into(this.getProcessor().getQueue());\n break;\n }\n \n }\n \n }", "private void AlarmByNotification(String message) {\n\t\tToast.makeText(this, message, Toast.LENGTH_LONG).show();\r\n\t}", "@Override\r\n\tpublic void mesage() {\n\t\tSystem.out.println(\"通过语音发短信\");\r\n\t}", "public void notify(final int device, final int keyCode, final int type);", "public void message(LocoNetMessage m) {\n notify(m);\n }", "void mo23214a(Message message);", "@Override\n\t\tpublic void onClick(View v) {\n\t\t\tC2DMessaging.register(getBaseContext(), \"[email protected]\");\t\t\t\n\t\t}", "@Override public void handleMessage(Message msg) {\n super.handleMessage(msg);\n byte[] byteArray = (byte[]) msg.obj;\n int length = msg.arg1;\n byte[] resultArray = length == -1 ? byteArray : new byte[length];\n for (int i = 0; i < byteArray.length && i < length; ++i) {\n resultArray[i] = byteArray[i];\n }\n String text = new String(resultArray, StandardCharsets.UTF_8);\n if (msg.what == BluetoothTalker.MessageConstants.MESSAGE_WRITE) {\n Log.i(TAG, \"we just wrote... [\" + length + \"] '\" + text + \"'\");\n// mIncomingMsgs.onNext(text);\n } else if (msg.what == BluetoothTalker.MessageConstants.MESSAGE_READ) {\n Log.i(TAG, \"we just read... [\" + length + \"] '\" + text + \"'\");\n Log.i(TAG, \" >>r \" + Arrays.toString((byte[]) msg.obj));\n mIncomingMsgs.onNext(text);\n sendMsg(\"I heard you : \" + Math.random() + \"!\");\n// mReadTxt.setText(++ri + \"] \" + text);\n// if (mServerBound && mServerService.isConnected()) {\n// mServerService.sendMsg(\"I heard you : \" + Math.random() + \"!\");\n// } else if (mClientBound && mClientService.isConnected()) {\n// mClientService.sendMsg(\"I heard you : \" + Math.random() + \"!\");\n// }\n// mBluetoothStuff.mTalker.write();\n }\n }", "public void sendMessage(final SendenDevice device, MessageWrapper message) {\n // Set the actual device to the message\n message.setSendenDevice(wiFiP2PInstance.getThisDevice());\n\n new AsyncTask<MessageWrapper, Void, Void>() {\n @Override\n protected Void doInBackground(MessageWrapper... params) {\n if (device != null && device.getDeviceServerSocketIP() != null) {\n try {\n Socket socket = new Socket();\n socket.bind(null);\n\n InetSocketAddress hostAddres = new InetSocketAddress(device.getDeviceServerSocketIP(), device.getDeviceServerSocketPort());\n socket.connect(hostAddres, 2000);\n\n Gson gson = new Gson();\n String messageJson = gson.toJson(params[0]);\n\n OutputStream outputStream = socket.getOutputStream();\n outputStream.write(messageJson.getBytes(), 0, messageJson.getBytes().length);\n\n Log.d(TAG, \"Sending data: \" + params[0]);\n\n socket.close();\n outputStream.close();\n } catch (IOException e) {\n Log.e(TAG, \"Error creating client socket: \" + e.getMessage());\n }\n }\n\n return null;\n }\n }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message);\n }", "@Override\n public void OnMessage(User user, byte[] bytes) {\n throw new UnsupportedOperationException(\"Unimplemented method 'OnMessage'\");\n }", "protected abstract void send(IMessage msg, IRecipient recipient, String sSender, String sAlertId)\r\n\t\t\tthrows AlertHandlerException;", "public static void alert(String message) {\n\t\tif (logger != null) {\n\t\t\tlogger.log(Level.ALERT, message);\n\t\t}\n\t}", "private void handleApplicationDataMessage(IOSMessage message) {\n }", "void sendMessage(VoidMessage message, String id);", "void notify(Message m);", "@Override\r\n\tpublic void sendMessage(String message) {\n\t\tmediator.send(message, this);\r\n\t}", "private void sendNotificationAPI26(RemoteMessage remoteMessage) {\n Map<String,String> data = remoteMessage.getData();\n String title = data.get(\"title\");\n String message = data.get(\"message\");\n\n //notification channel\n NotificationHelper helper;\n Notification.Builder builder;\n\n Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n helper = new NotificationHelper(this);\n builder = helper.getHawkerNotification(title,message,defaultSoundUri);\n\n helper.getManager().notify(new Random().nextInt(),builder.build());\n }", "@Override\r\n public void handleMessage(Message msg) {\n super.handleMessage(msg);\r\n switch(msg.what){\r\n case baglanti:\r\n\r\n ConnectedThread connectedThread = new ConnectedThread((BluetoothSocket)msg.obj);\r\n Toast.makeText(getApplicationContext(), \"Baglandi\",Toast.LENGTH_LONG).show();\r\n String s = \"successfully connected\";\r\n break;\r\n case mesajoku:\r\n byte[] readBuf = (byte[])msg.obj;\r\n String string = new String(readBuf);\r\n Toast.makeText(getApplicationContext(), string, Toast.LENGTH_LONG).show();\r\n break;\r\n }\r\n }", "@Override\n\tpublic void SendMessage() {\n\t\tSystem.out.println( phoneName+\"'s SendMessage.\" );\n\t}", "private void sendSignal(){\n\t\tSystem.out.println(inputLine + \"test\");\n\t\tMessageContent messageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_RANDOM);\n\t\tif(inputLine.equals(Constants.BUTTON_1_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_BEDROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_1_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_BEDROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_2_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_KITCHEN, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_2_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_KITCHEN, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_3_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_LIVINGROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_3_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_LIVINGROOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_4_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_RANDOM, \"0\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_4_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.REMOTE_CONTROL_AGENT, Constants.PLACE_RANDOM, \"0\");\n\t\t\tSystem.out.println(\"oh yeah\");\n\t\t}else if(inputLine.equals(Constants.BUTTON_5_ON)){\n\t\t\tmessageContent = new MessageContent(1, Constants.SHUTTER, Constants.PLACE_LIVINGROOM);\n\t\t}else if(inputLine.equals(Constants.BUTTON_5_OFF)){\n\t\t\tmessageContent = new MessageContent(0, Constants.SHUTTER, Constants.PLACE_LIVINGROOM);\n\t\t}\n\t\t\t\t\n\t\tString json = messageContent.toJSON();\n\t\tDFAgentDescription template = new DFAgentDescription();\n ServiceDescription sd = new ServiceDescription();\n if (inputLine.equals(Constants.BUTTON_5_ON) || inputLine.equals(Constants.BUTTON_5_OFF)) {\n\t\tsd.setType(Constants.SHUTTER);\n\t\tsd.setName(Constants.PLACE_LIVINGROOM);\n } else {\n\t\tsd.setType(Constants.AUTO_SWITCH);\n\t\tsd.setName(Constants.AUTO_SWITCH_AGENT);\n }\n template.addServices(sd);\n try {\n DFAgentDescription[] result = DFService.search(myAgent, template);\n if (result.length > 0) {\n ACLMessage request = new ACLMessage(ACLMessage.REQUEST);\n if (inputLine.equals(Constants.BUTTON_5_ON) || inputLine.equals(Constants.BUTTON_5_OFF)) {\n\t\t\t\trequest.setPerformative(ACLMessage.INFORM);\n }\n for (DFAgentDescription receiver : result) {\n if (!receiver.getName().equals(myAgent.getAID())) {\n request.addReceiver(receiver.getName());\n \n }\n }\n request.setContent(json);\n myAgent.send(request);\n }\n } catch(FIPAException fe) {\n fe.printStackTrace();\n }\n\n\n\t}", "private int isrSendMessage(char message) {\n\t\tif (Harness.TRACE)\n\t\t\tHarness.trace(String.format(\"[HarnessMailbox] isr_send_message to %d, message %d = 0x%x\",\n\t\t\t\t\t\t\t\t\t\t(int)mailbox_number, (int)message, (int)message)); \n\t\tsendTaskMail(message, (byte)0);\n\t\treturn TaskControl.OK;\n\t}", "private void notifyUser(Context context, String message) {\n\n Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n\n Intent intent = new Intent(context, MovieActivity.class);\n PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n\n NotificationManager manager = (NotificationManager)\n context.getSystemService(Context.NOTIFICATION_SERVICE);\n\n android.support.v4.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context)\n .setContentTitle(\"device is now \" + message + \".\")\n .setOngoing(true)\n .setVibrate(new long[]{0, 500, 500, 500, 500, 500, 500})\n .setSound(soundUri)\n .setContentIntent(pendingIntent)\n .setSmallIcon(android.R.drawable.sym_def_app_icon)\n .setAutoCancel(true);\n\n manager.notify(1001, builder.build());\n\n }", "@Override\n\t\t\tpublic void handleMessage(Message msg) {\n\t\t\t\tint event = msg.arg1;\n\t\t\t\tint result = msg.arg2;\n\t\t\t\tObject data = msg.obj;\n\t\t\t\tif (result == SMSSDK.RESULT_COMPLETE) {\n\t\t\t\t\t\n\t\t\t\t\tif (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), \"验证成功\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tRelativeUser.handleRegieter(handler1,edittext_phone.getText().toString(),edittext_pas.getText().toString());\n\t\t\t\t\t\t\n\t\t\t\t\t} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE){\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), \"验证码已经发送\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tToast.makeText(getBaseContext(), \"请检查网络原因\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//TODO\n\t\t\t\t\tRelativeUser.handleRegieter(handler1,edittext_phone.getText().toString(),edittext_pas.getText().toString());\n\t\t\t\t\t/*Toast.makeText(getBaseContext(), \"请检查网络原因\", Toast.LENGTH_SHORT).show();\n\t\t\t\t\t((Throwable) data).printStackTrace();*/\n\t\t\t\t}\t\t\t\t\n\t\t\t}", "@Override\n\tpublic void send(Message event) {\n\t\t// read and parse heyOOCSI message\n\t\tif (event.getRecipient().equals(\"heyOOCSI!\")) {\n\t\t\tsynchronized (clients) {\n\t\t\t\tevent.data.forEach((k, v) -> {\n\t\t\t\t\tif (v instanceof ObjectNode) {\n\t\t\t\t\t\tObjectNode on = ((ObjectNode) v);\n\n\t\t\t\t\t\t// seems we have an object, let's parse it\n\t\t\t\t\t\tOOCSIDevice od = new OOCSIDevice();\n\t\t\t\t\t\tod.name = k;\n\t\t\t\t\t\tod.deviceId = on.at(\"/properties/device_id\").asText(\"\");\n\t\t\t\t\t\ton.at(\"/components\").fields().forEachRemaining(e -> {\n\t\t\t\t\t\t\tDeviceEntity dc = new DeviceEntity();\n\t\t\t\t\t\t\tdc.name = e.getKey();\n\t\t\t\t\t\t\tJsonNode value = e.getValue();\n\t\t\t\t\t\t\tdc.channel = value.get(\"channel_name\").asText(\"\");\n\t\t\t\t\t\t\tdc.type = value.get(\"type\").asText(\"\");\n\t\t\t\t\t\t\tdc.icon = value.get(\"icon\").asText(\"\");\n\t\t\t\t\t\t\t// retrieve default value or state which are mutually exclusive\n\t\t\t\t\t\t\tif (value.has(\"value\")) {\n\t\t\t\t\t\t\t\tdc.value = value.get(\"value\").asText();\n\t\t\t\t\t\t\t} else if (value.has(\"state\")) {\n\t\t\t\t\t\t\t\tdc.value = value.get(\"state\").asText();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tod.components.add(dc);\n\t\t\t\t\t\t});\n\t\t\t\t\t\ton.at(\"/location\").fields().forEachRemaining(e -> {\n\t\t\t\t\t\t\tif (e.getValue().isArray()) {\n\t\t\t\t\t\t\t\tFloat[] locationComponents = new Float[2];\n\t\t\t\t\t\t\t\tlocationComponents[0] = new Float(((ArrayNode) e.getValue()).get(0).asDouble());\n\t\t\t\t\t\t\t\tlocationComponents[1] = new Float(((ArrayNode) e.getValue()).get(1).asDouble());\n\t\t\t\t\t\t\t\tod.locations.put(e.getKey(), locationComponents);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\ton.at(\"/properties\").fields().forEachRemaining(e -> {\n\t\t\t\t\t\t\tod.properties.put(e.getKey(), e.getValue().asText());\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// check contents of device\n\n\t\t\t\t\t\t// then add to clients\n\t\t\t\t\t\tclients.put(k, od);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tif (event.data.containsKey(\"clientHandle\")) {\n\t\t\t\tString clientHandle = (String) event.data.get(\"clientHandle\");\n\t\t\t\tif (clients.containsKey(clientHandle)) {\n\t\t\t\t\tOOCSIDevice od = clients.get(clientHandle);\n\t\t\t\t\tClient c = server.getClient(event.getSender());\n\t\t\t\t\tif (c != null) {\n\t\t\t\t\t\tc.send(new Message(token, event.getSender()).addData(\"clientHandle\", clientHandle)\n\t\t\t\t\t\t .addData(\"location\", od.serializeLocations())\n\t\t\t\t\t\t .addData(\"components\", od.serializeComponents())\n\t\t\t\t\t\t .addData(\"properties\", od.serializeProperties()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.data.containsKey(\"x\") && event.data.containsKey(\"y\")\n\t\t\t && event.data.containsKey(\"distance\")) {\n\t\t\t\ttry {\n\t\t\t\t\tfinal float x = ((Number) event.data.get(\"x\")).floatValue();\n\t\t\t\t\tfinal float y = ((Number) event.data.get(\"y\")).floatValue();\n\t\t\t\t\tfinal float distance = ((Number) event.data.get(\"distance\")).floatValue();\n\n\t\t\t\t\t// check if we need to truncate the client list, according to the \"n closest clients\"\n\t\t\t\t\tfinal int closest;\n\t\t\t\t\tif (event.data.containsKey(\"closest\")) {\n\t\t\t\t\t\tclosest = ((Number) event.data.get(\"closest\")).intValue();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclosest = 100;\n\t\t\t\t\t}\n\n\t\t\t\t\t// build list of all client within given distance\n\t\t\t\t\tMap<Double, String> clientNames = new HashMap<>();\n\t\t\t\t\tclients.values().stream().forEach(od -> {\n\t\t\t\t\t\tod.locations.entrySet().forEach(loc -> {\n\t\t\t\t\t\t\tFloat[] location = loc.getValue();\n\t\t\t\t\t\t\tdouble dist = Math.hypot(Math.abs(location[0] - x), Math.abs(location[1] - y));\n\t\t\t\t\t\t\tif (dist < distance) {\n\t\t\t\t\t\t\t\tclientNames.put(dist, od.deviceId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\t// create sorted list of clients, potentially truncated by \"closest\"\n\t\t\t\t\tList<String> cns = clientNames.entrySet().stream().sorted(Map.Entry.comparingByKey()).limit(closest)\n\t\t\t\t\t .map(e -> e.getValue()).collect(Collectors.toList());\n\n\t\t\t\t\t// assemble the clients within distance from reference point and send back\n\t\t\t\t\tClient c = server.getClient(event.getSender());\n\t\t\t\t\tif (c != null) {\n\t\t\t\t\t\tc.send(new Message(token, event.getSender()).addData(\"x\", x).addData(\"y\", y)\n\t\t\t\t\t\t .addData(\"distance\", distance).addData(\"clients\", cns.toArray(new String[] {})));\n\t\t\t\t\t}\n\t\t\t\t} catch (NumberFormatException | ClassCastException e) {\n\t\t\t\t\t// could not parse the coordinates or distance, do nothing\n\t\t\t\t}\n\t\t\t} else if (event.data.containsKey(\"location\")) {\n\t\t\t\tString location = ((String) event.data.get(\"location\")).trim();\n\t\t\t\tSet<String> clientNames = new HashSet<>();\n\t\t\t\tclients.values().stream().forEach(od -> {\n\t\t\t\t\tod.locations.keySet().forEach(loc -> {\n\t\t\t\t\t\tif (loc.equalsIgnoreCase(location)) {\n\t\t\t\t\t\t\tclientNames.add(od.deviceId);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\t// assemble the clients within given location and send back\n\t\t\t\tClient c = server.getClient(event.getSender());\n\t\t\t\tif (c != null) {\n\t\t\t\t\tc.send(new Message(token, event.getSender()).addData(\"location\", location).addData(\"clients\",\n\t\t\t\t\t clientNames.toArray(new String[] {})));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void sendNotification(String message) {\n Intent intent = new Intent(this, MainActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,\n PendingIntent.FLAG_ONE_SHOT);\n\n Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)\n .setSmallIcon(R.drawable.ic_check_circle_black_24dp)\n .setContentTitle(\"Welcome Aboard\")\n .setContentText(message)\n .setAutoCancel(true)\n .setSound(defaultSoundUri)\n .setContentIntent(pendingIntent);\n\n NotificationManager notificationManager =\n (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);\n\n notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());\n }", "void received() throws ImsException;", "public void sendMessage ( String message ) {\n\t\texecute ( handle -> handle.sendMessage ( message ) );\n\t}", "public static void sendPushBroadcast(Context context, String action, String message)\n {\n if (DISPLAY_MESSAGE_ACTION.equals(action))\n {\n Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);\n intent.putExtra(EXTRA_MESSAGE, message);\n context.sendBroadcast(intent);\n }\n else if (A2DM_REGISTER_SUCCESS_ACTION.equals(action))\n {\n Intent intent = new Intent(A2DM_REGISTER_SUCCESS_ACTION);\n intent.putExtra(\"registration_id\", message);\n context.sendOrderedBroadcast(intent, \"com.google.android.c2dm.permission.SEND\");\n }\n }", "@OnMessage\r\n\tpublic void onMessage(String message) {\r\n\r\n\t\tSystem.out.println(\"Message from \" + session.getId() + \": \" + message);\r\n\t\tthis.sendClient(\"Message from server: session ID : \" + session.getId()\r\n\t\t\t\t+ \" you sent \" + message);\r\n\t\tEchoServer socket = this.sockets.get(message);\r\n\t\tif (socket != null) {\r\n\t\t\tsocket.sendClient(this.uniqueId + \" send to \" + socket.uniqueId\r\n\t\t\t\t\t+ \" a message\");\r\n\t\t}else{\r\n\t\t\tSystem.out.println(\"Invalid Message from \" + session.getId());\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * try { session.getBasicRemote().sendText(\r\n\t\t * \"Message from server: session ID : \" + session.getId() + \" you sent \"\r\n\t\t * + message); } catch (IOException ex) { ex.printStackTrace(); }\r\n\t\t */\r\n\t}", "public static void opBroadcast(String message){\n JawaChat.opsOnline.values().forEach((target) -> {\n target.sendMessage(message);\n });\n logMessage(message, \"op channel\");\n }", "public void receivedOkayMessage();", "public void handleMessageFromClient(Object msg) {\n\n }", "public static void getMessage() {\r\n\t\tLog.i(TAG,\r\n\t\t\t\t\"+++ GOT MESSAGE FROM ARDUINO +++\" + getArduinoMessage());\r\n\t\tString[] msgSplit = getArduinoMessage().split(\":\");\r\n\t\tString keyWord = \"\";\r\n\t\tString firstVaule = \"\";\r\n\t\tString secondValue = \"\";\r\n\r\n\t\tif (msgSplit.length > 0) {\r\n\t\t\tkeyWord = msgSplit[1];\r\n\t\t\tfirstVaule = msgSplit[2];\r\n\t\t\tsecondValue = msgSplit[3];\r\n\t\t}\r\n\r\n\t\tif (keyWord.equals(\"xy\")) {\r\n\t\t\tgetTelescopeAltAz(firstVaule, secondValue);\r\n\t\t\tstartTracking();\r\n\t\t}\r\n\t\tif (keyWord.equals(\"xyt\")) {\r\n\t\t\tLog.i(TAG, \"+++ GOT TELESCOPE POSITION \" + firstVaule + \" \"\r\n\t\t\t\t\t+ secondValue);\r\n\t\t\tstar++;\r\n\t\t\tgetTelescopeAltAz(firstVaule, secondValue, star );\r\n\t\t}\r\n\t}" ]
[ "0.6408825", "0.6180617", "0.61442816", "0.6108709", "0.6082957", "0.60825557", "0.59979665", "0.5984548", "0.59442174", "0.59188604", "0.5906586", "0.5903808", "0.5893656", "0.586571", "0.58470786", "0.58420664", "0.58418465", "0.5838498", "0.5828049", "0.58240885", "0.58201355", "0.5819387", "0.57853687", "0.578297", "0.57756144", "0.57720804", "0.5767619", "0.5766747", "0.576315", "0.5757778", "0.5756537", "0.5753097", "0.57308173", "0.57296383", "0.5718721", "0.5704636", "0.5679172", "0.56626165", "0.5654144", "0.5652288", "0.5651044", "0.5648548", "0.5639516", "0.5633899", "0.563054", "0.56299424", "0.5627683", "0.56271666", "0.56259876", "0.55991423", "0.55970263", "0.5594726", "0.5585053", "0.55786103", "0.5574114", "0.55686295", "0.55578226", "0.55571914", "0.55562425", "0.55538625", "0.554978", "0.5545748", "0.5542341", "0.5542318", "0.55414736", "0.55384153", "0.55370533", "0.5536391", "0.5534453", "0.5525177", "0.5523116", "0.5521778", "0.5520266", "0.55149794", "0.5512319", "0.55104774", "0.5507959", "0.55074096", "0.54981506", "0.5493069", "0.5491982", "0.54911304", "0.5483041", "0.5471686", "0.54597956", "0.54505885", "0.5446173", "0.54440606", "0.54437596", "0.5438194", "0.54373777", "0.54354084", "0.542783", "0.5426428", "0.54255754", "0.54182494", "0.54177606", "0.54172856", "0.5416196", "0.5415878" ]
0.689159
0
This function receives notifications from the hub which are sent from the clients. The device implementation should filter based on target UUID/message.
public abstract void notify(JSONObject message);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.i(TAG, \"From: \" + remoteMessage.getFrom());\n sendOnChannel1();\n sendOnChannel2();\n if (remoteMessage == null)\n return;\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.e(TAG, \"Notification Body: \" + remoteMessage.getNotification().getBody());\n // handleNotification(remoteMessage.getNotification().getBody());\n // sendMyBroadCast(remoteMessage.getNotification().getBody());\n }\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.e(TAG, \"Data Payload: \" + remoteMessage.getData().toString());\n\n try {\n JSONObject json = new JSONObject(remoteMessage.getData().toString());\n // handleDataMessage(json);\n // sendMyBroadCast(remoteMessage.getData().toString());\n } catch (Exception e) {\n Log.e(TAG, \"Exception: \" + e.getMessage());\n }\n }\n }", "private void handleNow(RemoteMessage remoteMessage) {\n NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n String CHANNEL_ID_CHAT = \"myapp-01\";\n String CHANNEL_ID_GENERAL = \"myapp-02\";\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n\n // Channel 1\n CharSequence chatChannel = \"Chat\";\n String chatChannelDesc = \"Notifications from chat app\";\n int chatImportance = NotificationManager.IMPORTANCE_DEFAULT;\n NotificationChannel mChatChannel = new NotificationChannel(CHANNEL_ID_CHAT, chatChannel, chatImportance);\n mChatChannel.setDescription(chatChannelDesc);\n mChatChannel.enableLights(true);\n mChatChannel.setLightColor(Color.BLUE);\n notificationManager.createNotificationChannel(mChatChannel);\n\n // Channel 2\n CharSequence generalChannel = \"General\";\n String generalChannelDesc = \"General notifications\";\n int generalImportance = NotificationManager.IMPORTANCE_HIGH;\n NotificationChannel mGeneralChannel = new NotificationChannel(CHANNEL_ID_GENERAL, generalChannel, generalImportance);\n mGeneralChannel.setDescription(generalChannelDesc);\n mGeneralChannel.enableLights(true);\n mGeneralChannel.setLightColor(Color.BLUE);\n notificationManager.createNotificationChannel(mGeneralChannel);\n\n }\n\n // Sending push notification to spesific channel\n Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n Intent intent1 = new Intent(getApplicationContext(), MainActivity.class);\n PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 123, intent1, PendingIntent.FLAG_UPDATE_CURRENT);\n NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID_CHAT)\n .setSmallIcon(R.drawable.xmen)\n .setBadgeIconType(R.drawable.xmen)\n .setChannelId(CHANNEL_ID_CHAT)\n .setAutoCancel(true)\n .setContentIntent(pendingIntent)\n .setNumber(1)\n .setSound(defaultSoundUri)\n .setColor(ContextCompat.getColor(this, R.color.white))\n .setWhen(System.currentTimeMillis());\n\n if (remoteMessage.getData().size() > 0) {\n notificationBuilder.setContentTitle(remoteMessage.getData().get(\"title\"));\n notificationBuilder.setContentText(remoteMessage.getData().get(\"message\"));\n }\n\n notificationManager.notify(getID(), notificationBuilder.build());\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // [START_EXCLUDE]\n // There are two types of messages data messages and notification messages. Data messages are handled\n // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type\n // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app\n // is in the foreground. When the app is in the background an automatically generated notification is displayed.\n // When the user taps on the notification they are returned to the app. Messages containing both notification\n // and data payloads are treated as notification messages. The Firebase console always sends notification\n // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options\n // [END_EXCLUDE]\n\n // TODO(developer): Handle FCM messages here.\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n Log.d(TAG, \"From:::: \" + remoteMessage.getFrom());\n\n\n //Handle notifications with data payload for your app\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.d(TAG, \"Message data payload::: \" + remoteMessage.getData());\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.d(TAG, \"Message Notification Body:::: \" + remoteMessage.getNotification().getBody());\n }\n\n Log.e(\"Msg\", remoteMessage.getData().size()+\"\");\n //sendNotification(remoteMessage.getData());\n\n try {\n sendNotification(remoteMessage.getData());\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n\n\n\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // ...\n\n // TODO(developer): Handle FCM messages here.\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.d(TAG, \"Message data payload: \" + remoteMessage.getData());\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\n sendCustomNotification(remoteMessage);\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "@Override public void onReceiveNotification(Context context, PushMsg msg) {\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // [START_EXCLUDE]\n // There are two types of messages data messages and notification messages. Data messages are handled\n // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type\n // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app\n // is in the foreground. When the app is in the background an automatically generated notification is displayed.\n // When the user taps on the notification they are returned to the app. Messages containing both notification\n // and data payloads are treated as notification messages. The Firebase console always sends notification\n // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options\n // [END_EXCLUDE]\n\n // TODO(developer): Handle FCM messages here.\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.d(TAG, \"Message data payload: \" + remoteMessage.getData());\n\n if (/* Check if data needs to be processed by long running job */ true) {\n // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.\n scheduleJob();\n } else {\n // Handle message within 10 seconds\n handleNow(remoteMessage);\n }\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n\n // sendNotification(remoteMessage); //not trusted : // TODO: 07/11/2017 redo #later\n //todo https://developer.android.com/guide/topics/ui/notifiers/notifications.html\n //todo https://github.com/firebase/quickstart-android/tree/master/messaging/app/src/main/java/com/google/firebase/quickstart/fcm\n }", "public void didReceivedNotification(int r7, int r8, java.lang.Object... r9) {\n /*\n r6 = this;\n int r0 = org.telegram.messenger.NotificationCenter.appDidLogout\n if (r7 != r0) goto L_0x0010\n int r7 = r6.lastResumedAccount\n if (r8 != r7) goto L_0x01c5\n r6.onFinish()\n r6.finish()\n goto L_0x01c5\n L_0x0010:\n int r0 = org.telegram.messenger.NotificationCenter.pushMessagesUpdated\n r1 = 3\n r2 = 1\n r3 = 0\n if (r7 != r0) goto L_0x0089\n boolean r7 = r6.isReply\n if (r7 != 0) goto L_0x01c5\n java.util.ArrayList<org.telegram.messenger.MessageObject> r7 = r6.popupMessages\n r7.clear()\n r7 = 0\n L_0x0021:\n if (r7 >= r1) goto L_0x003b\n org.telegram.messenger.UserConfig r8 = org.telegram.messenger.UserConfig.getInstance(r7)\n boolean r8 = r8.isClientActivated()\n if (r8 == 0) goto L_0x0038\n java.util.ArrayList<org.telegram.messenger.MessageObject> r8 = r6.popupMessages\n org.telegram.messenger.NotificationsController r9 = org.telegram.messenger.NotificationsController.getInstance(r7)\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r9.popupMessages\n r8.addAll(r9)\n L_0x0038:\n int r7 = r7 + 1\n goto L_0x0021\n L_0x003b:\n r6.getNewMessage()\n java.util.ArrayList<org.telegram.messenger.MessageObject> r7 = r6.popupMessages\n boolean r7 = r7.isEmpty()\n if (r7 != 0) goto L_0x01c5\n r7 = 0\n L_0x0047:\n if (r7 >= r1) goto L_0x01c5\n int r8 = r6.currentMessageNum\n int r8 = r8 - r2\n int r8 = r8 + r7\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n int r9 = r9.size()\n if (r9 != r2) goto L_0x0061\n if (r8 < 0) goto L_0x005f\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n int r9 = r9.size()\n if (r8 < r9) goto L_0x0061\n L_0x005f:\n r8 = 0\n goto L_0x007d\n L_0x0061:\n r9 = -1\n if (r8 != r9) goto L_0x006c\n java.util.ArrayList<org.telegram.messenger.MessageObject> r8 = r6.popupMessages\n int r8 = r8.size()\n int r8 = r8 - r2\n goto L_0x0075\n L_0x006c:\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n int r9 = r9.size()\n if (r8 != r9) goto L_0x0075\n r8 = 0\n L_0x0075:\n java.util.ArrayList<org.telegram.messenger.MessageObject> r9 = r6.popupMessages\n java.lang.Object r8 = r9.get(r8)\n org.telegram.messenger.MessageObject r8 = (org.telegram.messenger.MessageObject) r8\n L_0x007d:\n org.telegram.messenger.MessageObject[] r9 = r6.setMessageObjects\n r9 = r9[r7]\n if (r9 == r8) goto L_0x0086\n r6.updateInterfaceForCurrentMessage(r3)\n L_0x0086:\n int r7 = r7 + 1\n goto L_0x0047\n L_0x0089:\n int r0 = org.telegram.messenger.NotificationCenter.updateInterfaces\n if (r7 != r0) goto L_0x00f1\n org.telegram.messenger.MessageObject r7 = r6.currentMessageObject\n if (r7 == 0) goto L_0x00f0\n int r7 = r6.lastResumedAccount\n if (r8 == r7) goto L_0x0096\n goto L_0x00f0\n L_0x0096:\n r7 = r9[r3]\n java.lang.Integer r7 = (java.lang.Integer) r7\n int r7 = r7.intValue()\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_NAME\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00b2\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_STATUS\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00b2\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_CHAT_NAME\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00b2\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_CHAT_MEMBERS\n r8 = r8 & r7\n if (r8 == 0) goto L_0x00b5\n L_0x00b2:\n r6.updateSubtitle()\n L_0x00b5:\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_AVATAR\n r8 = r8 & r7\n if (r8 != 0) goto L_0x00bf\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_CHAT_AVATAR\n r8 = r8 & r7\n if (r8 == 0) goto L_0x00c2\n L_0x00bf:\n r6.checkAndUpdateAvatar()\n L_0x00c2:\n int r8 = org.telegram.messenger.MessagesController.UPDATE_MASK_USER_PRINT\n r7 = r7 & r8\n if (r7 == 0) goto L_0x01c5\n org.telegram.messenger.MessageObject r7 = r6.currentMessageObject\n int r7 = r7.currentAccount\n org.telegram.messenger.MessagesController r7 = org.telegram.messenger.MessagesController.getInstance(r7)\n org.telegram.messenger.MessageObject r8 = r6.currentMessageObject\n long r8 = r8.getDialogId()\n java.lang.CharSequence r7 = r7.getPrintingString(r8, r3, r3)\n java.lang.CharSequence r8 = r6.lastPrintString\n if (r8 == 0) goto L_0x00df\n if (r7 == 0) goto L_0x00eb\n L_0x00df:\n if (r8 != 0) goto L_0x00e3\n if (r7 != 0) goto L_0x00eb\n L_0x00e3:\n if (r8 == 0) goto L_0x01c5\n boolean r7 = r8.equals(r7)\n if (r7 != 0) goto L_0x01c5\n L_0x00eb:\n r6.updateSubtitle()\n goto L_0x01c5\n L_0x00f0:\n return\n L_0x00f1:\n int r0 = org.telegram.messenger.NotificationCenter.messagePlayingDidReset\n r4 = 300(0x12c, float:4.2E-43)\n if (r7 != r0) goto L_0x013d\n r7 = r9[r3]\n java.lang.Integer r7 = (java.lang.Integer) r7\n android.view.ViewGroup r9 = r6.messageContainer\n if (r9 == 0) goto L_0x01c5\n int r9 = r9.getChildCount()\n L_0x0103:\n if (r3 >= r9) goto L_0x01c5\n android.view.ViewGroup r0 = r6.messageContainer\n android.view.View r0 = r0.getChildAt(r3)\n java.lang.Object r2 = r0.getTag()\n java.lang.Integer r2 = (java.lang.Integer) r2\n int r2 = r2.intValue()\n if (r2 != r1) goto L_0x013a\n java.lang.Integer r2 = java.lang.Integer.valueOf(r4)\n android.view.View r0 = r0.findViewWithTag(r2)\n org.telegram.ui.Components.PopupAudioView r0 = (org.telegram.ui.Components.PopupAudioView) r0\n org.telegram.messenger.MessageObject r2 = r0.getMessageObject()\n if (r2 == 0) goto L_0x013a\n int r5 = r2.currentAccount\n if (r5 != r8) goto L_0x013a\n int r2 = r2.getId()\n int r5 = r7.intValue()\n if (r2 != r5) goto L_0x013a\n r0.updateButtonState()\n goto L_0x01c5\n L_0x013a:\n int r3 = r3 + 1\n goto L_0x0103\n L_0x013d:\n int r0 = org.telegram.messenger.NotificationCenter.messagePlayingProgressDidChanged\n if (r7 != r0) goto L_0x0186\n r7 = r9[r3]\n java.lang.Integer r7 = (java.lang.Integer) r7\n android.view.ViewGroup r9 = r6.messageContainer\n if (r9 == 0) goto L_0x01c5\n int r9 = r9.getChildCount()\n L_0x014d:\n if (r3 >= r9) goto L_0x01c5\n android.view.ViewGroup r0 = r6.messageContainer\n android.view.View r0 = r0.getChildAt(r3)\n java.lang.Object r2 = r0.getTag()\n java.lang.Integer r2 = (java.lang.Integer) r2\n int r2 = r2.intValue()\n if (r2 != r1) goto L_0x0183\n java.lang.Integer r2 = java.lang.Integer.valueOf(r4)\n android.view.View r0 = r0.findViewWithTag(r2)\n org.telegram.ui.Components.PopupAudioView r0 = (org.telegram.ui.Components.PopupAudioView) r0\n org.telegram.messenger.MessageObject r2 = r0.getMessageObject()\n if (r2 == 0) goto L_0x0183\n int r5 = r2.currentAccount\n if (r5 != r8) goto L_0x0183\n int r2 = r2.getId()\n int r5 = r7.intValue()\n if (r2 != r5) goto L_0x0183\n r0.updateProgress()\n goto L_0x01c5\n L_0x0183:\n int r3 = r3 + 1\n goto L_0x014d\n L_0x0186:\n int r9 = org.telegram.messenger.NotificationCenter.emojiLoaded\n if (r7 != r9) goto L_0x01ba\n android.view.ViewGroup r7 = r6.messageContainer\n if (r7 == 0) goto L_0x01c5\n int r7 = r7.getChildCount()\n L_0x0192:\n if (r3 >= r7) goto L_0x01c5\n android.view.ViewGroup r8 = r6.messageContainer\n android.view.View r8 = r8.getChildAt(r3)\n java.lang.Object r9 = r8.getTag()\n java.lang.Integer r9 = (java.lang.Integer) r9\n int r9 = r9.intValue()\n if (r9 != r2) goto L_0x01b7\n r9 = 301(0x12d, float:4.22E-43)\n java.lang.Integer r9 = java.lang.Integer.valueOf(r9)\n android.view.View r8 = r8.findViewWithTag(r9)\n android.widget.TextView r8 = (android.widget.TextView) r8\n if (r8 == 0) goto L_0x01b7\n r8.invalidate()\n L_0x01b7:\n int r3 = r3 + 1\n goto L_0x0192\n L_0x01ba:\n int r9 = org.telegram.messenger.NotificationCenter.contactsDidLoad\n if (r7 != r9) goto L_0x01c5\n int r7 = r6.lastResumedAccount\n if (r8 != r7) goto L_0x01c5\n r6.updateSubtitle()\n L_0x01c5:\n return\n */\n throw new UnsupportedOperationException(\"Method not decompiled: org.telegram.ui.PopupNotificationActivity.didReceivedNotification(int, int, java.lang.Object[]):void\");\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n super.onMessageReceived(remoteMessage);\n // [START_EXCLUDE]\n // There are two types of messages data messages and notification messages. Data messages are handled\n // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type\n // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app\n // is in the foreground. When the app is in the background an automatically generated notification is displayed.\n // When the user taps on the notification they are returned to the app. Messages containing both notification\n // and data payloads are treated as notification messages. The Firebase console always sends notification\n // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options\n // [END_EXCLUDE]\n\n // TODO(developer): Handle FCM messages here.\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.d(TAG, \"Message data payload: \" + remoteMessage.getData());\n\n if (/* Check if data needs to be processed by long running job */ true) {\n // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.\n scheduleJob();\n } else {\n // Handle message within 10 seconds\n handleNow();\n }\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n //Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\n// processData(remoteMessage);\n //sendNotification(remoteMessage.getNotification().getBody());\n //Toast.makeText(this, remoteMessage.getNotification().getBody(),Toast.LENGTH_SHORT).show();\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "public void onNotification(JsonObject body) {\r\n\t\tlogger.debug(\"HANDLING\" + body.toString());\r\n\t\tString from = body.getString(\"from\");\r\n\t\tString guid = body.getJsonObject(\"identity\").getJsonObject(\"userProfile\").getString(\"guid\");\r\n\r\n\t\tif (body.containsKey(\"external\") && body.getBoolean(\"external\")) {\r\n\t\t\tlogger.debug(\"EXTERNAL INVITE\");\r\n\t\t\tString streamID = body.getString(\"streamID\");\r\n\t\t\tString objURL = from.split(\"/subscription\")[0];\r\n\t\t\tFuture<String> CheckURL = findDataObjectStream(objURL, guid);\r\n\t\t\tCheckURL.setHandler(asyncResult -> {\r\n\t\t\t\tif (asyncResult.succeeded()) {\r\n\r\n\t\t\t\t\tif (asyncResult.result() == null) {\r\n\t\t\t\t\t\tFuture<Boolean> persisted = persistDataObjUserURL(streamID, guid, objURL, \"reporter\");\r\n\t\t\t\t\t\tpersisted.setHandler(res -> {\r\n\t\t\t\t\t\t\tif (res.succeeded()) {\r\n\t\t\t\t\t\t\t\tif (persisted.result()) {\r\n\t\t\t\t\t\t\t\t\tonChanges(objURL);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// oh ! we have a problem...\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t//\tonChanges(objURL);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// oh ! we have a problem...\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t} else {\r\n\t\t\tsubscribe(from, guid);\r\n\t\t}\r\n\t}", "@Override\n\tpublic void send(Message event) {\n\t\t// read and parse heyOOCSI message\n\t\tif (event.getRecipient().equals(\"heyOOCSI!\")) {\n\t\t\tsynchronized (clients) {\n\t\t\t\tevent.data.forEach((k, v) -> {\n\t\t\t\t\tif (v instanceof ObjectNode) {\n\t\t\t\t\t\tObjectNode on = ((ObjectNode) v);\n\n\t\t\t\t\t\t// seems we have an object, let's parse it\n\t\t\t\t\t\tOOCSIDevice od = new OOCSIDevice();\n\t\t\t\t\t\tod.name = k;\n\t\t\t\t\t\tod.deviceId = on.at(\"/properties/device_id\").asText(\"\");\n\t\t\t\t\t\ton.at(\"/components\").fields().forEachRemaining(e -> {\n\t\t\t\t\t\t\tDeviceEntity dc = new DeviceEntity();\n\t\t\t\t\t\t\tdc.name = e.getKey();\n\t\t\t\t\t\t\tJsonNode value = e.getValue();\n\t\t\t\t\t\t\tdc.channel = value.get(\"channel_name\").asText(\"\");\n\t\t\t\t\t\t\tdc.type = value.get(\"type\").asText(\"\");\n\t\t\t\t\t\t\tdc.icon = value.get(\"icon\").asText(\"\");\n\t\t\t\t\t\t\t// retrieve default value or state which are mutually exclusive\n\t\t\t\t\t\t\tif (value.has(\"value\")) {\n\t\t\t\t\t\t\t\tdc.value = value.get(\"value\").asText();\n\t\t\t\t\t\t\t} else if (value.has(\"state\")) {\n\t\t\t\t\t\t\t\tdc.value = value.get(\"state\").asText();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tod.components.add(dc);\n\t\t\t\t\t\t});\n\t\t\t\t\t\ton.at(\"/location\").fields().forEachRemaining(e -> {\n\t\t\t\t\t\t\tif (e.getValue().isArray()) {\n\t\t\t\t\t\t\t\tFloat[] locationComponents = new Float[2];\n\t\t\t\t\t\t\t\tlocationComponents[0] = new Float(((ArrayNode) e.getValue()).get(0).asDouble());\n\t\t\t\t\t\t\t\tlocationComponents[1] = new Float(((ArrayNode) e.getValue()).get(1).asDouble());\n\t\t\t\t\t\t\t\tod.locations.put(e.getKey(), locationComponents);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\ton.at(\"/properties\").fields().forEachRemaining(e -> {\n\t\t\t\t\t\t\tod.properties.put(e.getKey(), e.getValue().asText());\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// check contents of device\n\n\t\t\t\t\t\t// then add to clients\n\t\t\t\t\t\tclients.put(k, od);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tif (event.data.containsKey(\"clientHandle\")) {\n\t\t\t\tString clientHandle = (String) event.data.get(\"clientHandle\");\n\t\t\t\tif (clients.containsKey(clientHandle)) {\n\t\t\t\t\tOOCSIDevice od = clients.get(clientHandle);\n\t\t\t\t\tClient c = server.getClient(event.getSender());\n\t\t\t\t\tif (c != null) {\n\t\t\t\t\t\tc.send(new Message(token, event.getSender()).addData(\"clientHandle\", clientHandle)\n\t\t\t\t\t\t .addData(\"location\", od.serializeLocations())\n\t\t\t\t\t\t .addData(\"components\", od.serializeComponents())\n\t\t\t\t\t\t .addData(\"properties\", od.serializeProperties()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.data.containsKey(\"x\") && event.data.containsKey(\"y\")\n\t\t\t && event.data.containsKey(\"distance\")) {\n\t\t\t\ttry {\n\t\t\t\t\tfinal float x = ((Number) event.data.get(\"x\")).floatValue();\n\t\t\t\t\tfinal float y = ((Number) event.data.get(\"y\")).floatValue();\n\t\t\t\t\tfinal float distance = ((Number) event.data.get(\"distance\")).floatValue();\n\n\t\t\t\t\t// check if we need to truncate the client list, according to the \"n closest clients\"\n\t\t\t\t\tfinal int closest;\n\t\t\t\t\tif (event.data.containsKey(\"closest\")) {\n\t\t\t\t\t\tclosest = ((Number) event.data.get(\"closest\")).intValue();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclosest = 100;\n\t\t\t\t\t}\n\n\t\t\t\t\t// build list of all client within given distance\n\t\t\t\t\tMap<Double, String> clientNames = new HashMap<>();\n\t\t\t\t\tclients.values().stream().forEach(od -> {\n\t\t\t\t\t\tod.locations.entrySet().forEach(loc -> {\n\t\t\t\t\t\t\tFloat[] location = loc.getValue();\n\t\t\t\t\t\t\tdouble dist = Math.hypot(Math.abs(location[0] - x), Math.abs(location[1] - y));\n\t\t\t\t\t\t\tif (dist < distance) {\n\t\t\t\t\t\t\t\tclientNames.put(dist, od.deviceId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\t// create sorted list of clients, potentially truncated by \"closest\"\n\t\t\t\t\tList<String> cns = clientNames.entrySet().stream().sorted(Map.Entry.comparingByKey()).limit(closest)\n\t\t\t\t\t .map(e -> e.getValue()).collect(Collectors.toList());\n\n\t\t\t\t\t// assemble the clients within distance from reference point and send back\n\t\t\t\t\tClient c = server.getClient(event.getSender());\n\t\t\t\t\tif (c != null) {\n\t\t\t\t\t\tc.send(new Message(token, event.getSender()).addData(\"x\", x).addData(\"y\", y)\n\t\t\t\t\t\t .addData(\"distance\", distance).addData(\"clients\", cns.toArray(new String[] {})));\n\t\t\t\t\t}\n\t\t\t\t} catch (NumberFormatException | ClassCastException e) {\n\t\t\t\t\t// could not parse the coordinates or distance, do nothing\n\t\t\t\t}\n\t\t\t} else if (event.data.containsKey(\"location\")) {\n\t\t\t\tString location = ((String) event.data.get(\"location\")).trim();\n\t\t\t\tSet<String> clientNames = new HashSet<>();\n\t\t\t\tclients.values().stream().forEach(od -> {\n\t\t\t\t\tod.locations.keySet().forEach(loc -> {\n\t\t\t\t\t\tif (loc.equalsIgnoreCase(location)) {\n\t\t\t\t\t\t\tclientNames.add(od.deviceId);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\t// assemble the clients within given location and send back\n\t\t\t\tClient c = server.getClient(event.getSender());\n\t\t\t\tif (c != null) {\n\t\t\t\t\tc.send(new Message(token, event.getSender()).addData(\"location\", location).addData(\"clients\",\n\t\t\t\t\t clientNames.toArray(new String[] {})));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // [START_EXCLUDE]\n // There are two types of messages data messages and notification messages. Data messages are handled\n // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type\n // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app\n // is in the foreground. When the app is in the background an automatically generated notification is displayed.\n // When the user taps on the notification they are returned to the app. Messages containing both notification\n // and data payloads are treated as notification messages. The Firebase console always sends notification\n // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options\n // [END_EXCLUDE]\n\n // TODO(developer): Handle FCM messages here.\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Map<String,String> m = remoteMessage.getData();\n Log.d(TAG, \"Message data payload: \" + m);\n String id = remoteMessage.getMessageId();\n if(id == null)\n id = remoteMessage.getData().get(\"title\");\n handleData(id, m);\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n String id = remoteMessage.getMessageId();\n if(id == null)\n id = remoteMessage.getNotification().getTitle();\n handleNotification(id, remoteMessage.getNotification());\n }\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "@Override\n public void onMessageReceived(List<EMMessage> messages) {\n for (EMMessage message : messages) {\n String username = null;\n // group message\n if (message.getChatType() == ChatType.GroupChat || message.getChatType() == ChatType.ChatRoom) {\n username = message.getTo();\n } else {\n // single chat message\n username = message.getFrom();\n }\n // if the message is for current conversation\n if (username.equals(toChatUsername) || message.getTo().equals(toChatUsername) || message.conversationId().equals(toChatUsername)) {\n messageList.refreshSelectLast();\n EaseUI.getInstance().getNotifier().vibrateAndPlayTone(message);\n conversation.markMessageAsRead(message.getMsgId());\n } else {\n EaseUI.getInstance().getNotifier().onNewMsg(message);\n }\n }\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.d(TAG, \"Message Data Payload Received\");\n Log.d(TAG, \"Message data payload: \" + remoteMessage.getData());\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n //buildNotification(remoteMessage);\n Log.d(TAG, \"Message Notification Payload Received\");\n Log.d(TAG, \"Message Notification Title: \" + remoteMessage.getNotification().getTitle());\n Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n //TODO: this\n }", "@Override\n public void onConnectionReceived(Connection connection, byte[] data) {\n String command = new String(data).trim();\n System.err.println(command);\n switch (command) {\n case \"\":\n break;\n case \"hello\":\n try {\n send(connection, (\"hello my friend \" + connection.getPid().id + \"\\r\\n\").getBytes());\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n case \"close\":\n try {\n send(connection, (\"goodbye my friend \" + connection.getPid().id + \"\\r\\n\").getBytes());\n terminate(connection);\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n case \"reg\":\n try {\n ClientInfo clientInfo = new ClientInfo(\"mqtt\", \"3.1\", \"testCID\", \"testUname\", \"testMP/\", 300);\n register(connection, clientInfo);\n System.err.println(ClientInfo.toErlangDataType(clientInfo));\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n case \"pub\":\n try {\n Message message =\n new Message(\"testId\", 0, \"from\", \"mytopic\", \"pubmessage\".getBytes(), new BigInteger(\"\" + System.currentTimeMillis()));\n publish(connection, message);\n send(connection, (\"publish \" + message.toString()).getBytes());\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n case \"sub\":\n try {\n String topic = \"mytopic\";\n subscribe(connection, topic, 1);\n System.err.println(\"subscribe \" + topic);\n send(connection, (\"subscribe \" + topic + \" qos \" + 1).getBytes());\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n case \"unsub\":\n try {\n String unSubTop = \"mytopic\";\n unsubscribe(connection, unSubTop);\n System.err.println(\"subscribe \" + unSubTop);\n send(connection, (\"unsubscribe \" + unSubTop).getBytes());\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n case \"help\":\n try {\n send(connection, help.getBytes());\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n default:\n try {\n send(connection, (\"i don't know \" + command + \"\\r\\n\").getBytes());\n } catch (Exception e) {\n System.err.println(command + \" ERROR\");\n }\n break;\n }\n\n }", "@Override\n public void onMessageReceived(String from, Bundle bundle) {\n String title = bundle.getString(\"title\");\n Boolean isBackground = Boolean.valueOf(bundle.getString(\"is_background\"));\n String flag = bundle.getString(\"flag\");\n String data = bundle.getString(\"data\");\n Log.d(TAG, \"From: \" + from);\n Log.d(TAG, \"title: \" + title);\n Log.d(TAG, \"isBackground: \" + isBackground);\n Log.d(TAG, \"flag: \" + flag);\n Log.d(TAG, \"data: \" + data);\n\n if (flag == null)\n return;\n\n if (BaseApplication.getInstance().getPrefManager().getUser() == null) {\n // user is not logged in, skipping push notification\n Log.e(TAG, \"user is not logged in, skipping push notification\");\n return;\n }\n\n if (from.startsWith(\"/topics/\")) {\n // message received from some topic.\n } else {\n // normal downstream message.\n }\n\n switch (Integer.parseInt(flag)) {\n case Config.PUSH_TYPE_CHATROOM:\n // push notification belongs to a chat room\n processChatRoomPush(title, isBackground, data);\n break;\n case Config.PUSH_TYPE_GROUP_CHATROOM:\n processGroupMessage(title, isBackground, data);\n break;\n case Config.PUSH_TYPE_USER:\n // push notification is specific to user\n// processUserMessage(title, isBackground, data);\n break;\n case Config.PUSH_TYPE_USER_STATUS:\n processUserStatusPush(isBackground, data);\n break;\n }\n }", "@Override\n\t\tpublic void handleMessage(Message msg) {\n\t\t\tsuper.handleMessage(msg);\n\t\t\tswitch (msg.what) {\n\t\t\tcase SearchBluetoothActivity.DEVICE_DISCOVERIED:\n\t\t\t\tbdApdater.notifyDataSetChanged();\n\t\t\t\tToast.makeText(SearchBluetoothActivity.this, \"发现新设备:\" + devices.get(devices.size() - 1).getName(),\n\t\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t\t\tbreak;\n\t\t\tcase SearchBluetoothActivity.FINISH_DISCOVERIED:\n\t\t\t\tbt_searchBluetooth_searchBluetooth.setText(getResources().getString(R.string.bt_search_bluetooth_text));\n\t\t\t\tbreak;\n\t\t\tcase SearchBluetoothActivity.REFRESH_LISTVIEW:\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}", "@Override\r\n public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\r\n\r\n // Check if message contains a data payload.\r\n if (remoteMessage.getData().size() > 0) {\r\n Log.d(TAG, \"Message data payload: \" + remoteMessage.getData());\r\n\r\n }\r\n\r\n // Check if message contains a notification payload.\r\n if (remoteMessage.getNotification() != null) {\r\n //Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\r\n\r\n final String msg = remoteMessage.getNotification().getBody();\r\n\r\n Handler handler = new Handler(Looper.getMainLooper());\r\n handler.post(new Runnable() {\r\n\r\n @Override\r\n public void run() {\r\n Toast.makeText(MyService.this.getApplicationContext(), msg,Toast.LENGTH_SHORT).show();\r\n }\r\n });\r\n }\r\n\r\n }", "private void sendNotification() {\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n super.onMessageReceived(remoteMessage);\n //Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n Log.d(TAG, \"Notification Message Body: \" + remoteMessage.getData());\n\n long[] pattern = {500,500,500,500,500};\n\n Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n\n if (remoteMessage.getData() != null) {\n\n Intent intent;\n intent = new Intent(this, MainActivity.class);\n\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* request code */, intent, PendingIntent.FLAG_UPDATE_CURRENT);\n //NotificationManager notificationManager = new NotificationUtils(this).getManager();\n Notification notification = new Notification();\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n notification = new NotificationCompat.Builder(this)\n .setDefaults(Notification.DEFAULT_ALL)\n .setContentTitle(remoteMessage.getData().get(\"title\"))\n .setContentText(remoteMessage.getData().get(\"body\"))\n .setChannelId(\"com.example.fakenews.ANDROID\")\n .setSmallIcon(com.google.firebase.R.drawable.notify_panel_notification_icon_bg)\n .setAutoCancel(true)\n .setVibrate(pattern)\n .setLights(Color.BLUE, 1, 1)\n .setSound(defaultSoundUri)\n .setContentIntent(pendingIntent)\n .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)\n .build();\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n //Log.d(TAG, String.valueOf(notificationManager.getImportance()));\n\n //Log.d(TAG, \"notificacion: \" + notificationManager.getActiveNotifications().toString());\n }\n }\n\n NotificationManagerCompat manager = NotificationManagerCompat.from(getApplicationContext());\n manager.notify(new Random().nextInt(), notification);\n //manager.notify(0, notification);\n\n Log.d(TAG,notification.toString());\n Log.d(TAG, String.valueOf(manager.areNotificationsEnabled()));\n Log.d(TAG, String.valueOf(manager.getImportance()));\n\n\n\n }\n }", "@Override\n public void onPeersAvailable(SimWifiP2pDeviceList simWifiP2pDeviceList) {\n Collection<SimWifiP2pDevice> beaconsList = simWifiP2pDeviceList.getDeviceList();\n\n try {\n\n NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this.globalState.getBaseContext());\n\n if (beaconsList.size() == 0){\n this.command = \"leavingQueue\";\n this.beaconName = this.globalState.getLastKnownBeacon();\n this.globalState.setLastKnownBeacon(null);\n\n if(this.globalState.isLoggedIn()){\n NotificationCompat.Builder builder = new NotificationCompat.Builder(this.globalState.getBaseContext(), \"FoodIST\")\n .setSmallIcon(R.drawable.smallicon)\n .setContentTitle(\"FoodIST\")\n .setStyle(new NotificationCompat.BigTextStyle().bigText(\"Hey! You're not waiting in the queue anymore, are you? Take a picture of the food you're about to eat and rate it! Also, again, share it with your friends!\"))\n .setPriority(NotificationCompat.PRIORITY_DEFAULT);\n\n notificationManager.notify(100, builder.build());\n\n }\n\n } else {\n this.command = \"joiningQueue\";\n this.beaconName = (beaconsList.iterator().next()).deviceName;\n this.globalState.setLastKnownBeacon(this.beaconName);\n\n if(this.globalState.isLoggedIn()){\n NotificationCompat.Builder builder = new NotificationCompat.Builder(this.globalState.getBaseContext(), \"FoodIST\")\n .setSmallIcon(R.drawable.smallicon)\n .setContentTitle(\"FoodIST\")\n .setStyle(new NotificationCompat.BigTextStyle().bigText(\"Hey! Since you're in a queue, consider submitting the dish you're ordering to FoodIST! Or, of course, if it's there on the menu already, consider rating it and sharing with your friends!\"))\n .setPriority(NotificationCompat.PRIORITY_DEFAULT);\n\n notificationManager.notify(101, builder.build());\n\n }\n }\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n String action = intent.getAction();\n switch (action) {\n case RoosterConnectionService.NEW_MESSAGE:\n// k = RoosterConnectionService.NEW_MESSAGE;\n String from = intent.getStringExtra(RoosterConnectionService.BUNDLE_FROM_JID);\n String body = intent.getStringExtra(RoosterConnectionService.BUNDLE_MESSAGE_BODY);\n// if(body.toUpperCase().contains(\"V\".toUpperCase()) ) {\n message(body);\n// }\n return;\n\n case RoosterConnectionService.UI_AUTHENTICATED:\n Toast.makeText(getApplicationContext(), \"authenticated\", Toast.LENGTH_SHORT).show();\n// Log.d(TAG,\"Got a broadcast to show the main app window\");\n //Show the main app window\n// showProgress(false);\n// Intent i2 = new Intent(mContext,ContactListActivity.class);\n// startActivity(i2);\n// finish();\n\n break;\n }\n\n\n }", "@Override\n\t\t\tpublic void handleMessage(Message msg) {\n\t\t\t\tprocessBluetoothDeviceMessage(msg);\n\t\t\t}", "@Override\n public void onMessage(Message message) {\n try {\n // Generate data\n QueueProcessor processor = getBean(QueueProcessor.class);\n ServiceData serviceData = processor.parseResponseMessage(response, message);\n\n // If return is a DataList or Data, parse it with the query\n if (serviceData.getClientActionList() == null || serviceData.getClientActionList().isEmpty()) {\n serviceData = queryService.onSubscribeData(query, address, serviceData, parameterMap);\n } else {\n // Add address to client action list\n for (ClientAction action : serviceData.getClientActionList()) {\n action.setAddress(getAddress());\n }\n }\n\n // Broadcast data\n broadcastService.broadcastMessageToUID(address.getSession(), serviceData.getClientActionList());\n\n // Log sent message\n getLogger().log(QueueListener.class, Level.DEBUG,\n \"New message received from subscription to address {0}. Content: {1}\",\n getAddress().toString(), message.toString());\n } catch (AWException exc) {\n broadcastService.sendErrorToUID(address.getSession(), exc.getTitle(), exc.getMessage());\n\n // Log error\n getLogger().log(QueueListener.class, Level.ERROR, \"Error in message from subscription to address {0}. Content: {1}\", exc,\n getAddress().toString(), message.toString());\n } catch (Exception exc) {\n broadcastService.sendErrorToUID(address.getSession(), null, exc.getMessage());\n\n // Log error\n getLogger().log(QueueListener.class, Level.ERROR, \"Error in message from subscription to address {0}. Content: {1}\", exc,\n getAddress().toString(), message.toString());\n }\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.d(\"TAG\", \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n Log.d(\"TAG\", \"Message data payload: \" + remoteMessage.getData());\n\n if (/* Check if data needs to be processed by long running job */ true) {\n // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.\n scheduleJob();\n } else {\n // Handle message within 10 seconds\n handleNow();\n }\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.d(\"TAG\", \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "@Override\n public void handleMessage(Message msg) {\n\n Bundle bundle = msg.getData();\n if(bundle != null)\n {\n String cmd = bundle.getString(\"cmd\");\n\n writeToBle(cmd);\n }\n\n switch (msg.what) {\n case MSG_SET_TRACKING:\n setTracking(msg.arg1 == 1);\n break;\n case MSG_REGISTER_CLIENT:\n mClients.add(msg.replyTo);\n break;\n case MSG_UNREGISTER_CLIENT:\n mClients.remove(msg.replyTo);\n break;\n default:\n super.handleMessage(msg);\n }\n }", "@Override\n public void call(Object... args) {\n Message msg = mHanler.obtainMessage();\n msg.what = 2;\n msg.obj = args[0];\n msg.sendToTarget();\n LogTool.e(TAG + \" notification call\");\n }", "@Override\n public void notifySubscribers(Bundle notification) {\n for (ISubscriber subscriber : subscribers) {\n List<SubscriberFilter> filters = subscriber.getFilters();\n\n if (notification.getString(\"notificationType\").equals(subscriber.getNotificationType())) {\n if (notification.getString(\"userId\").equals(subscriber.getUser().getAuthUserID())) {\n if (!filters.isEmpty()) {\n List<Boolean> filterResults = new ArrayList<>();\n\n Object entity = notification.getSerializable(\"entity\");\n HashMap entityHashMap = (HashMap)entity;\n\n for (int index = 0; index < filters.size(); index++) {\n Object entityValue = entityHashMap.get(filters.get(index).getField());\n\n if (entityValue != null) {\n filterResults.add(filters.get(index).getValues().contains(entityValue));\n }\n }\n\n if (!filterResults.contains(false)) {\n entityHashMap.put(\"notificationId\", notification.getString(\"notificationId\"));\n entityHashMap.put(\"userId\", notification.getString(\"userId\"));\n subscriber.update(notification);\n }\n } else {\n subscriber.update(notification);\n }\n }\n }\n }\n }", "@Override\n public void broadcast(T msg) {\n for (Integer i : activeUsers.keySet()) {\n this.send(Integer.valueOf(i), msg);\n }\n\n }", "public void messageArrived(String s, MqttMessage mqttMessage) {\n LoCommand command = new Gson().fromJson(new String(mqttMessage.getPayload()), LoCommand.class);\n System.out.println(\"Device command received: \" + new Gson().toJson(command));\n\n LoCommand.LoCommandResponse response = new LoCommand.LoCommandResponse(new HashMap<>(), command.cid);\n response.res.put(\"my-ack\", \"this is my command acknowledge to \" + command.req);\n\n new Thread(() -> {\n try {\n\n String responseJson = new Gson().toJson(response);\n System.out.println(\"Publishing command acknowledge message: \" + responseJson);\n\n MqttMessage message = new MqttMessage(responseJson.getBytes());\n message.setQos(QOS);\n\n mqttClient.publish(MqttTopics.MQTT_TOPIC_RESPONSE_COMMAND, message);\n System.out.println(\"Command ack published\");\n\n } catch (MqttException me) {\n System.out.println(\"reason \" + me.getReasonCode());\n System.out.println(\"msg \" + me.getMessage());\n System.out.println(\"loc \" + me.getLocalizedMessage());\n System.out.println(\"cause \" + me.getCause());\n System.out.println(\"excep \" + me);\n me.printStackTrace();\n }\n }).start();\n }", "public static void getWatch() {\n for ( String nodeId : getNodes() ){\n Wearable.MessageApi.sendMessage(\n mGoogleApiClient, nodeId, \"GET_WATCH\", new byte[0]).setResultCallback(\n new ResultCallback<MessageApi.SendMessageResult>() {\n @Override\n public void onResult(MessageApi.SendMessageResult sendMessageResult) {\n if (!sendMessageResult.getStatus().isSuccess()) {\n Log.i(\"MessageApi\", \"Failed to send message with status code: \"\n + sendMessageResult.getStatus().getStatusCode());\n } else if (sendMessageResult.getStatus().isSuccess()) {\n Log.i(\"MessageApi\", \"onResult successful!\");\n }\n }\n }\n );\n }\n }", "private void notifyDevicesChanged() {\n runInAudioThread(new Runnable() {\n @Override\n public void run() {\n WritableArray data = Arguments.createArray();\n final boolean hasHeadphones = availableDevices.contains(DEVICE_HEADPHONES);\n for (String device : availableDevices) {\n if (hasHeadphones && device.equals(DEVICE_EARPIECE)) {\n // Skip earpiece when headphones are plugged in.\n continue;\n }\n WritableMap deviceInfo = Arguments.createMap();\n deviceInfo.putString(\"type\", device);\n deviceInfo.putBoolean(\"selected\", device.equals(selectedDevice));\n data.pushMap(deviceInfo);\n }\n getContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(DEVICE_CHANGE_EVENT, data);\n JitsiMeetLogger.i(TAG + \" Updating audio device list\");\n }\n });\n }", "private void uponChannelCreated(ChannelCreated notification, short sourceProto) {\n int cId = notification.getChannelId();\n // Allows this protocol to receive events from this channel.\n registerSharedChannel(cId);\n /*---------------------- Register Message Serializers ---------------------- */\n registerMessageSerializer(cId, FloodMessage.MSG_ID, FloodMessage.serializer);\n registerMessageSerializer(cId, PruneMessage.MSG_ID, PruneMessage.serializer);\n registerMessageSerializer(cId, IHaveMessage.MSG_ID, IHaveMessage.serializer);\n registerMessageSerializer(cId, GraftMessage.MSG_ID, GraftMessage.serializer);\n\n /*---------------------- Register Message Handlers -------------------------- */\n\n //Handler for FloodMessage\n try {\n registerMessageHandler(cId, FloodMessage.MSG_ID, this::uponBroadcastMessage, this::uponMsgFail);\n } catch (HandlerRegistrationException e) {\n logger.error(\"Error registering message handler: \" + e.getMessage());\n e.printStackTrace();\n System.exit(1);\n }\n\n //Handler for PruneMessage\n try {\n registerMessageHandler(cId, PruneMessage.MSG_ID, this::uponPruneMessage, this::uponMsgFail);\n } catch (HandlerRegistrationException e) {\n logger.error(\"Error registering message handler: \" + e.getMessage());\n e.printStackTrace();\n System.exit(1);\n }\n\n //Handler for IHaveMessage\n try {\n registerMessageHandler(cId, IHaveMessage.MSG_ID, this::uponIHaveMessage, this::uponMsgFail);\n } catch (HandlerRegistrationException e) {\n logger.error(\"Error registering message handler: \" + e.getMessage());\n e.printStackTrace();\n System.exit(1);\n }\n\n //Handler for GraftMessage\n try {\n registerMessageHandler(cId, GraftMessage.MSG_ID, this::uponGraftMessage, this::uponMsgFail);\n } catch (HandlerRegistrationException e) {\n logger.error(\"Error registering message handler: \" + e.getMessage());\n e.printStackTrace();\n System.exit(1);\n }\n\n\n try {\n registerTimerHandler(Timer.TIMER_ID, this::uponTimer);\n } catch (HandlerRegistrationException e) {\n e.printStackTrace();\n }\n\n\n //Now we can start sending messages\n channelReady = true;\n }", "@Subscribe(threadMode = ThreadMode.MAIN)\n public void onDevicesReceived(OnReceiverDevicesEvent event){\n //if(!devicesListAdapter.isEmpty()) devicesListAdapter.clear(); // clear old names\n\n\n devicesListAdapter.removeAll();\n Log.d(\"P2P\", \"Found something on events!\");\n //Toast.makeText(getContext(), \"Found something\", Toast.LENGTH_LONG).show();\n Collection<WifiP2pDevice> devs = event.getDevices().getDeviceList();\n devsList.addAll(devs);\n\n\n\n for(int i = 0; i < devsList.size(); i++){\n\n if(!devicesListAdapter.hasItem(devsList.get(i))){\n Log.d(\"P2P\", \"Device Found: \" + devsList.get(0).deviceName);\n devicesListAdapter.add(devsList.get(i).deviceName);\n devicesListAdapter.notifyDataSetChanged();\n }\n\n }\n\n\n }", "void notificationReceived(Notification notification);", "public void testRequestsAndNotifications() {\n final ArrayList<String> results = new ArrayList<String>();\n ArrayList<String> resultsExpected = new ArrayList<String>();\n resultsExpected.add(\"deliveredNotificationRequested\");\n resultsExpected.add(\"composingNotificationRequested\");\n resultsExpected.add(\"displayedNotificationRequested\");\n resultsExpected.add(\"offlineNotificationRequested\");\n resultsExpected.add(\"deliveredNotification\");\n resultsExpected.add(\"displayedNotification\");\n resultsExpected.add(\"composingNotification\");\n resultsExpected.add(\"cancelledNotification\");\n\n // Create a chat for each connection\n Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);\n\n MessageEventManager messageEventManager1 = new MessageEventManager(getConnection(0));\n messageEventManager1\n .addMessageEventNotificationListener(new MessageEventNotificationListener() {\n public void deliveredNotification(String from, String packetID) {\n results.add(\"deliveredNotification\");\n }\n\n public void displayedNotification(String from, String packetID) {\n results.add(\"displayedNotification\");\n }\n\n public void composingNotification(String from, String packetID) {\n results.add(\"composingNotification\");\n }\n\n public void offlineNotification(String from, String packetID) {\n results.add(\"offlineNotification\");\n }\n\n public void cancelledNotification(String from, String packetID) {\n results.add(\"cancelledNotification\");\n }\n });\n\n MessageEventManager messageEventManager2 = new MessageEventManager(getConnection(1));\n messageEventManager2\n .addMessageEventRequestListener(new DefaultMessageEventRequestListener() {\n public void deliveredNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.deliveredNotificationRequested(from, packetID, messageEventManager);\n results.add(\"deliveredNotificationRequested\");\n }\n\n public void displayedNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.displayedNotificationRequested(from, packetID, messageEventManager);\n results.add(\"displayedNotificationRequested\");\n }\n\n public void composingNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.composingNotificationRequested(from, packetID, messageEventManager);\n results.add(\"composingNotificationRequested\");\n }\n\n public void offlineNotificationRequested(\n String from,\n String packetID,\n MessageEventManager messageEventManager) {\n super.offlineNotificationRequested(from, packetID, messageEventManager);\n results.add(\"offlineNotificationRequested\");\n }\n });\n\n // Create the message to send with the roster\n Message msg = new Message();\n msg.setSubject(\"Any subject you want\");\n msg.setBody(\"An interesting body comes here...\");\n // Add to the message all the notifications requests (offline, delivered, displayed,\n // composing)\n MessageEventManager.addNotificationsRequests(msg, true, true, true, true);\n\n // Send the message that contains the notifications request\n try {\n chat1.sendMessage(msg);\n messageEventManager2.sendDisplayedNotification(getBareJID(0), msg.getPacketID());\n messageEventManager2.sendComposingNotification(getBareJID(0), msg.getPacketID());\n messageEventManager2.sendCancelledNotification(getBareJID(0), msg.getPacketID());\n // Wait up to 2 seconds\n long initial = System.currentTimeMillis();\n while (System.currentTimeMillis() - initial < 2000 &&\n (!results.containsAll(resultsExpected))) {\n Thread.sleep(100);\n }\n assertTrue(\n \"Test failed due to bad results (1)\" + resultsExpected,\n resultsExpected.containsAll(results));\n assertTrue(\n \"Test failed due to bad results (2)\" + results,\n results.containsAll(resultsExpected));\n\n } catch (Exception e) {\n fail(\"An error occured sending the message\");\n }\n }", "@RabbitListener(queues = RabbitMQConfiguration.EVENT_NOTIFICATION_QUEUE_NAME, containerFactory = \"batchContainerFactory\")\n\t@SuppressWarnings(\"rawtypes\")\n\tpublic void sendNotification(List<EventNotification> notifications) {\n\t\tMono<ResponseEntity> response = webClient.post()\n//\t\t\t\t\t.body(Mono.just(notifications), ArrayList.class)\n\t\t\t\t.accept(MediaType.APPLICATION_JSON)\n\t\t\t\t.bodyValue(notifications).retrieve()\n\t\t\t\t.onStatus(org.springframework.http.HttpStatus::is5xxServerError,\n\t\t\t\t\t\tclientResp -> Mono.error(new WrongSubscriptionDataException()))\n\t\t\t\t.bodyToMono(ResponseEntity.class).onErrorMap(Exception::new);\n//\t\t\t\t\t.timeout(Duration.ofMillis(10_00))\n\n\t\tresponse.subscribe(System.out::println); \n\t}", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // [START_EXCLUDE]\n // There are two types of messages data messages and notification messages. Data messages are handled\n // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type\n // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app\n // is in the foreground. When the app is in the background an automatically generated notification is displayed.\n // When the user taps on the notification they are returned to the app. Messages containing both notification\n // and data payloads are treated as notification messages. The Firebase console always sends notification\n // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options\n // [END_EXCLUDE]\n\n // TODO(developer): Handle FCM messages here.\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n int type = Integer.parseInt(remoteMessage.getData().get(\"type\"));\n Bundle bundle = new Bundle();\n ;\n if (type == 0) {\n Poll incomingPoll = new Poll();\n String sub_contact = remoteMessage.getData().get(\"sub_contact\");\n Box<User> userBox = App.getInstance().getBoxStore().boxFor(User.class);\n incomingPoll.subject.setTarget(userBox.query().equal(User_.contact, sub_contact).build().findFirst());\n String question = remoteMessage.getData().get(\"question\").replaceAll(\"<.*>\", incomingPoll.subject.getTarget().name);\n incomingPoll.setQuestion(question);\n incomingPoll.setType(1);\n incomingPoll.setPollHash(remoteMessage.getData().get(\"poll_hash\"));\n String[] options = remoteMessage.getData().get(\"options\").replace(\"[\", \"\").replace(\"]\", \"\").split(\",\");\n for (String option : options) {\n incomingPoll.insertOption(option);\n }\n Box<Poll> pollBoxBox = App.getInstance().getBoxStore().boxFor(Poll.class);\n pollBoxBox.put(incomingPoll);\n EventBus.getDefault().post(new UpdatePoll(\"You got new poll \"));\n sendNotification(\"New question asked to you\");\n\n }\n if (type == 1) {\n Box<Thread> threadBox = App.getInstance().getBoxStore().boxFor(Thread.class);\n Thread outgoingthreadCumPoll = threadBox.query().equal(Thread_.threadHash, remoteMessage.getData().get(\"poll_hash\")).build().findFirst();\n assert outgoingthreadCumPoll != null;\n outgoingthreadCumPoll.setUnreadCount(outgoingthreadCumPoll.getUnreadCount() + 1);\n outgoingthreadCumPoll.increamentVote_counts();\n outgoingthreadCumPoll.setResultString(remoteMessage.getData().get(\"option_count\").replace(\"[\", \"\").replace(\"]\", \"\"));\n threadBox.put(outgoingthreadCumPoll);\n EventBus.getDefault().post(new UpdatePoll(\"Got an upvote\"));\n EventBus.getDefault().post(new UpdateThread(1, outgoingthreadCumPoll));\n sendNotification(\"Someone anwsered your question\");\n\n }\n if (type == 2) {\n String contact = remoteMessage.getData().get(\"user_contact\");\n Box<User> userBox = App.getInstance().getBoxStore().boxFor(User.class);\n if (!userBox.find(User_.contact, contact).isEmpty()) {\n User user = userBox.find(User_.contact, contact).get(0);\n if (!user.getKnows_me()) {\n ArrayList<String> contacts = new ArrayList<String>();\n contacts.add(contact);\n try {\n ApiCalls.syncContacts(this, 1, contacts);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }\n sendNotification(contact + \" added you in his network\");\n\n }\n if (type == 3) {\n String contact = remoteMessage.getData().get(\"user_contact\");\n Box<User> userBox = App.getInstance().getBoxStore().boxFor(User.class);\n if (!userBox.find(User_.contact, contact).isEmpty()) {\n User user = userBox.find(User_.contact, contact).get(0);\n user.setKnows_me(true);\n userBox.put(user);\n }\n sendNotification(contact + \" accepted your request\");\n }\n\n if (type == 4) {\n Poll incomingOpenPoll = new Poll();\n String question = remoteMessage.getData().get(\"question\");\n incomingOpenPoll.setQuestion(question);\n incomingOpenPoll.setType(1);\n incomingOpenPoll.setPollHash(remoteMessage.getData().get(\"poll_hash\"));\n String[] options = remoteMessage.getData().get(\"options\").replace(\"[\", \"\").replace(\"]\", \"\").split(\",\");\n for (String option : options) {\n incomingOpenPoll.insertOption(option);\n }\n Box<Poll> pollBoxBox = App.getInstance().getBoxStore().boxFor(Poll.class);\n pollBoxBox.put(incomingOpenPoll);\n EventBus.getDefault().post(new UpdatePoll(\"You got new open poll \"));\n sendNotification(\"New question asked to you\");\n }\n if (type == 5) {\n Poll incomingThread = new Poll();\n String sub_contact = remoteMessage.getData().get(\"sub_contact\");\n Box<User> userBox = App.getInstance().getBoxStore().boxFor(User.class);\n incomingThread.subject.setTarget(userBox.query().equal(User_.contact, sub_contact).build().findFirst());\n String question = remoteMessage.getData().get(\"question\").replaceAll(\"<.*>\", incomingThread.subject.getTarget().name);\n incomingThread.setQuestion(question);\n incomingThread.setType(1);\n incomingThread.setSender(remoteMessage.getData().get(\"passkey\"));\n incomingThread.setThread(true);\n incomingThread.setPollHash(remoteMessage.getData().get(\"thread_hash\"));\n Box<Poll> pollBox = App.getInstance().getBoxStore().boxFor(Poll.class);\n pollBox.put(incomingThread);\n EventBus.getDefault().post(new UpdatePoll(\"You received a thread invitation \"));\n sendNotification(\"You received a thread invitation\");\n\n }\n\n if (type == 6) {\n Poll incomingOpenThread = new Poll();\n String question = remoteMessage.getData().get(\"question\");\n incomingOpenThread.setQuestion(question);\n incomingOpenThread.setType(1);\n incomingOpenThread.setThread(true);\n incomingOpenThread.setSender(remoteMessage.getData().get(\"passkey\"));\n incomingOpenThread.setPollHash(remoteMessage.getData().get(\"thread_hash\"));\n Box<Poll> pollBox = App.getInstance().getBoxStore().boxFor(Poll.class);\n pollBox.put(incomingOpenThread);\n EventBus.getDefault().post(new UpdatePoll(\"You received a thread invitation \"));\n sendNotification(\"You received a thread invitation\");\n }\n\n if (type == 7) {\n Box<Thread> threadBox = App.getInstance().getBoxStore().boxFor(Thread.class);\n Thread thread = threadBox.query().equal(Thread_.threadHash, remoteMessage.getData().get(\"thread_hash\")).build().findFirst();\n assert thread != null;\n Message message = new Message(remoteMessage.getData().get(\"message\"), remoteMessage.getData().get(\"passkey\") + thread.getPasskey());\n thread.setDialogPhoto(remoteMessage.getData().get(\"passkey\") + thread.getPasskey());\n thread.setLastMessage(message);\n thread.setUnreadCount(thread.getUnreadCount() + 1);\n threadBox.put(thread);\n EventBus.getDefault().post(new MessageList(message));\n EventBus.getDefault().post(new UpdateThread(1, thread));\n sendNotification(\"Message received\");\n }\n// if (/* Check if data needs to be processed by long running job */ false) {\n// // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.\n// scheduleJob();\n// } else {\n// // Handle message within 10 seconds\n// handleNow();\n// }\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getTitle());\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "CompletableFuture<List<Response>> sendAsTransientPush(PushNotification pushNotification);", "private void sendClientsChangedBroadcast() {\n Intent intent = new Intent(WifiHotspotManager.WIFI_HOTSPOT_CLIENTS_CHANGED_ACTION);\n intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);\n mContext.sendBroadcastAsUser(intent, UserHandle.ALL);\n }", "@Override\n public void onMessageReceived(MessageEvent messageEvent) {\n if (messageEvent.getPath().equals(\"/watch/newSmokeEvents\")) {\n\n /* ...retrieve the message */\n final byte[] receivedEvents = messageEvent.getData();\n\n Intent messageIntent = new Intent();\n messageIntent.setAction(Intent.ACTION_SEND);\n messageIntent.putExtra(\"NEW_EVENTS_DATA\", receivedEvents);\n\n /* Broadcast the received Data Layer messages locally -> send to Synchronize */\n LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);\n }\n else if (messageEvent.getPath().equals(\"/watch/newSensorData\")){\n\n Intent synchronizeServiceIntent = new Intent(this, SynchronizeService.class);\n synchronizeServiceIntent.putExtra(\"RECEIVED_SYNC_HASH_LIST_REQUEST\", true);\n SynchronizeService.enqueueWork(this, synchronizeServiceIntent);\n\n }\n else {\n super.onMessageReceived(messageEvent);\n }\n\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // [START_EXCLUDE]\n // There are two types of messages data messages and notification messages. Data messages are handled\n // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type\n // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app\n // is in the foreground. When the app is in the background an automatically generated notification is displayed.\n // When the user taps on the notification they are returned to the app. Messages containing both notification\n // and data payloads are treated as notification messages. The Firebase console always sends notification\n // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options\n // [END_EXCLUDE]\n\n // Not getting messages here? See why this may be: https://goo.gl/39bRNJ\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0)\n {\n if (/* Check if data needs to be processed by long running job */ false) {\n // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.\n scheduleJob();\n } else {\n // Handle message within 10 seconds\n handleNow(remoteMessage.getData());\n }\n\n }\n\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null)\n {\n\n }\n\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n }", "private void handleNotification() {\r\n\r\n Intent intent = getIntent();\r\n\r\n if (intent == null)\r\n return;\r\n\r\n fromNotification = intent.getBooleanExtra(Constants.FROM_NOTIFICATION, false);\r\n\r\n if (isFromNotification())\r\n sendNotificationAnalytics(feedId);\r\n\r\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n // TODO(developer): Handle FCM messages here.\n // If the application is in the foreground handle both data and notification messages here.\n // Also if you intend on generating your own notifications as a result of a received FCM\n // message, here is where that should be initiated. See sendNotification method below.\n //Log.e(TAG, \"From: \" + remoteMessage.getFrom());\n //Log.e(TAG, \"Notification Message Body: \" + remoteMessage.getNotification().getBody());\n MyPreferenceManager prefs = MyApplication.getInstance().getPrefManager();\n if(prefs.getNotificationsEnabled()) // If notifications are enabled, send it\n sendNotification(remoteMessage);\n\n }", "@Override\n public void onMessageReceived(String from, Bundle data) {\n Date now = new Date();\n long uniqueId = now.getTime();\n String message = \"\";\n try {\n message = data.getString(\"message\");\n\n try {\n mJSONObject = new JSONObject(message);\n strMessage = mJSONObject.getString(\"message\");\n\n strArrList.add(strMessage);\n\n } catch (JSONException e) {\n Log.e(LOG_TAG, \"JSONException Cause \" + e.getCause());\n Log.e(LOG_TAG, \"JSONException Error parsing data \" + e.toString());\n }\n sendNotification();\n\n } catch (Exception e) {\n\n Log.e(LOG_TAG, \"Exception : \" + e.toString());\n Rollbar.reportException(e, \"critical\", \"My Gcmlistener services crash\");\n Rollbar.reportMessage(\"GCM String Builder value : \" + strArrList.toString(), \"--GCM Message:-\" + message);\n }\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n if (intent.getAction().equals(\"registrationComplete\")) {\n // gcm successfully registered\n // now subscribe to `global` topic to receive app wide notifications\n FirebaseMessaging.getInstance().subscribeToTopic(\"VaahanMessages\");\n Toast.makeText(vehicle_list.this,\"Subscribed To Notification Server\",Toast.LENGTH_SHORT).show();\n\n } else if (intent.getAction().equals(\"pushNotification\")) {\n\n }\n }", "public interface NotificationProxy extends Remote {\n \n /**\n * Registers the calling client, allocating an auto-generate clientId through which \n * this server will reach the client in the future. \n * @param clientSocket \n * @return clientId - the auto-generated client id\n * @throws java.rmi.RemoteException\n */\n public String registerClient(String clientSocket) throws RemoteException;\n \n /**\n * Unregisters the client identified by the given client id\n * @param clientId \n * @throws java.rmi.RemoteException \n */\n public void unregisterClient(String clientId) throws RemoteException;\n \n \n /**\n * Subscribe the client to the specified topic.\n * If the topic does not exist, a new one is create\n * @param name the name of the topic\n * @param clientId\n * @throws Exception\n * @throws java.rmi.RemoteException\n */\n public void subscribe(String name, String clientId) throws Exception, RemoteException;\n \n /**\n * Unsubscribe the client from the specified topic.\n * If the topic does not exists, nothing happens\n * @param name the name of the topic\n * @param clientId\n * @throws java.rmi.RemoteException\n */\n public void unsubscribe(String name, String clientId) throws RemoteException;\n \n /**\n * Deletes the specified topic, without notifying the subscribers \n * that they were unsubscribed\n * @param nume the name of the topic\n * @throws java.rmi.RemoteException\n * @throws TopicDoesNotExistException - if the topic does not exist\n */\n public void deleteTopic(String nume) throws RemoteException;\n \n /**\n * Deletes the specified topic, and may be notifying all the subscribers \n * that they were unsubscribed\n * @param nume the name of the topic\n * @param notifySubscribers\n * @throws java.rmi.RemoteException\n * @throws TopicDoesNotExistException - if the topic does not exist\n */\n public void deleteTopic(String nume, boolean notifySubscribers) throws RemoteException;\n \n /**\n * Deletes the specified topic, notifying all the subscribers with the specified data\n * that they were unsubscribed\n * @param nume the name of the topic\n * @param data data for the subscribers\n * @throws java.rmi.RemoteException\n * @throws TopicDoesNotExistException - if the topic does not exist\n */\n public void deleteTopic(String nume, Object data) throws RemoteException;\n \n /**\n * Notifies all the subscribers of this topic that something happened\n * @param name - the name of the topic\n * @throws java.rmi.RemoteException\n * @throws TopicDoesNotExistException\n */\n public void notifyTopic(String name) throws RemoteException;\n \n /**\n * Send this data to all subscribers of specified topic\n * @param data - the data to be sent to the listeners\n * @param name - the name of the topic\n * @throws java.rmi.RemoteException\n * @throws TopicDoesNotExistException\n */\n public void dataNotifyTopic(Object data, String name) throws RemoteException;\n \n /**\n * Tests if the specified topic exists\n * @param topicName - the name of the topic\n * @return true - if the topic exists, false otherwise\n * @throws java.rmi.RemoteException\n */\n public boolean exists(String topicName) throws RemoteException;\n \n /**\n * \n * @param name - the name of the topic\n * @return the subscribers count of the specified topic\n * @throws java.rmi.RemoteException\n */\n public int getSubscribersCount(String name) throws RemoteException;\n \n}", "@Override\r\n public void onMessageReceived(RemoteMessage remoteMessage) {\n if(remoteMessage.getData().size()>0)\r\n {\r\n Log.d(TAG, \"Mensaje recibido: \"+ remoteMessage.getData());\r\n }\r\n //Checa si el mensaje contiene notificacion\r\n if(remoteMessage.getNotification() != null){\r\n String title = remoteMessage.getNotification().getTitle();\r\n String message = remoteMessage.getNotification().getBody();\r\n\r\n Log.d(TAG, \"Titulo del mensaje de notificación: \"+ title);\r\n Log.d(TAG, \"Cuerpo del mensaje de notificación: \"+message);\r\n\r\n mostrarNotificacion(title, message);\r\n }\r\n\r\n if(remoteMessage.getData() != null) {\r\n Log.d(\"FIREBASE\", \"DATOS RECIBIDOS\");\r\n Log.d(\"FIREBASE\", \"Usuario: \" + remoteMessage.getData().get(\"usuario\"));\r\n Log.d(\"FIREBASE\", \"Estado: \" + remoteMessage.getData().get(\"estado\"));\r\n }\r\n\r\n //super.onMessageReceived(remoteMessage);\r\n /*String from = remoteMessage.getFrom();\r\n String title = remoteMessage.getNotification().getTitle();\r\n String message = remoteMessage.getNotification().getBody();\r\n Log.d(TAG, \"Mensaje Recibido de: \"+ from + \"\\nTitulo:\"+title+\" Mensaje: \"+message);\r\n mostrarNotificacion(title, message);*/\r\n /*if(remoteMessage.getNotification()!=null)\r\n {\r\n Log.d(TAG, \"Notificacion: \"+ remoteMessage.getNotification().getBody());\r\n //mostrarNotificacion(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());\r\n }\r\n if(remoteMessage.getData().size()>0)\r\n {\r\n Log.d(TAG, \"data: \"+ remoteMessage.getData());\r\n }*/\r\n }", "public void subscribeForNotifications(String identifier, INotificationHandler handler){\n return;\n }", "@Override\n public void handleMessage(Message msg){\n BTRobotRemoteActivity activity = outer.get();\n\n //can't access main UI activity\n if(activity == null){return;}\n\n //find out what message was sent\n switch(msg.what){\n //bluetooth\n case BluetoothClientService.MESSAGE_STATE_CHANGE:{\n //update bluetooth connection status\n activity.setStatus(msg.arg1);\n break;\n }\n //service wrote data \n case BluetoothClientService.MESSAGE_WRITE:{\n //store data as a string\n String writeMessage = new String((byte[]) msg.obj);\n break;\n }\n //service read data\n case BluetoothClientService.MESSAGE_READ:{\n String readMessage = new String((byte[])msg.obj, 0, msg.arg1);\n break;\n }\n //service retreived device's name\n case BluetoothClientService.MESSAGE_DEVICE_NAME:{\n // save the connected device's name\n activity.setDeviceName(msg.getData().getString(DEVICE_NAME));\n Toast.makeText(activity.getApplicationContext(), \"Connected to \"\n + activity.getDeviceName(), Toast.LENGTH_SHORT).show();\n break;\n }\n //motion sensor\n case MotionMonitor.MESSAGE_MOTION:{\n if(msg.arg1 == MotionMonitor.ARG_ACCEL){\n Bundle b = (Bundle) msg.obj;\n if(b == null){Log.e(TAG, \"Failed to convert message object to bundle\");}\n float [] data = b.getFloatArray(MotionMonitor.KEY_ACCEL);\n activity.updateOrientation(data);\n }\n else if(msg.arg1 == MotionMonitor.ARG_GYRO){\n Bundle b = (Bundle) msg.obj;\n if(b == null){Log.e(TAG, \"Failed type message data to float []\");}\n //set data in gyrostats view \n float [] data = b.getFloatArray(MotionMonitor.KEY_ROTATE);\n TextView stats = (TextView) activity.findViewById(R.id.gyro_stats);\n stats.setText(String.format(\"%4f, %4f, %4f\", data[0], data[1], data[2]));\n }\n else{Log.e(TAG, \"Unsupported argument for MESSAGE_MOTION in handleMessage()\");}\n }\n //ignore other types\n default:{\n }}\n }", "@Override\n public void onEvent(EMNotifierEvent event) {\n message = (EMMessage) event.getData();\n messageBean.setGetMsgCode(MessageContant.receiveMsgByListChanged);\n messageBean.setEmMessage(message);\n\n eventBus.post(messageBean);\n }", "static void sendNotifications() {\n\t\testablishConnection();\n\t\tSystem.out.println(\"sending multiple notificatiosn\");\n\t}", "public interface IMessageService {\n\n /**\n * Notifies subscribed clients with the given message.\n *\n * @param m Message (e.g. object, status, warning)\n */\n void notify(Message m);\n\n /**\n * Notifies subscribed clients with the given message.\n *\n * @param m Message (e.g. object, status, warning)\n */\n void notify(PushMessage m);\n\n /**\n * Notifies subscribed clients with the given message and push-type (e.g. ALERT)\n * \n * @param data message which should be send to the client\n * @param type type of the notification (manual step, ...)\n */\n void notify(String data, PushType type);\n\n /**\n * Subscribes a client for push-notifications.\n *\n * @param id id of the client (address)\n */\n void subscribe(String id);\n\n /**\n * unsubscribes a client for push-notifications.\n *\n * @param id id of the client (address)\n */\n void unsubscribe(String id);\n\n /**\n * Informs all subscribed devices that something went wrong and the brewing process wasnt\n * successfull and could cause damage\n * \n * @param text message which should be shown to the user\n */\n void alarm(String text);\n}", "@Override\n\t\tpublic void onDeviceEventReceived(DeviceEvent ev, String client) {\n\t\t\t\n\t\t}", "@Override\n public void userEventTriggered(ChannelHandlerContext channelHandlerContext, Object evt) throws Exception {\n if (evt instanceof IdleStateEvent) {\n\n\n if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {\n\n NettyAndroidClient nettyAndroidClient = LUCIControl.luciSocketMap.get(ipadddress);\n LSSDPNodeDB mNodeDB1 = LSSDPNodeDB.getInstance();\n LSSDPNodes mNode = mNodeDB1.getTheNodeBasedOnTheIpAddress(ipadddress);\n //Log.d(\"Scan_Netty\", \"Triggered Heartbeeat check\") ;\n if (nettyAndroidClient==null) {\n\n return;\n }\n if(mNode != null) {\n LibreLogger.d(this, \"HeartBeatHandler Last Notified Time \" + nettyAndroidClient.getLastNotifiedTime() +\n \" For the Ip \" + nettyAndroidClient.getRemotehost() + \"Device Name \" + mNode.getFriendlyname()) ;\n }else{\n LibreLogger.d(this, \"HeartBeatHandler Last Notified Time \" + nettyAndroidClient.getLastNotifiedTime() +\n \" For the Ip \" + nettyAndroidClient.getRemotehost());\n }\n\n /* If we are Missing 6 Alive notification */\n if(( System.currentTimeMillis()- (nettyAndroidClient.getLastNotifiedTime()))>60000){\n /*\n Removing the connection as we have not got any notiication from long time\n */\n\n\t\t\t\t\t/* Commented for New TCP based Discovery , where Ping is not required*/\n //if(!ping(ipadddress))\n {\n /*Commenting As per the HAri Comments*/\n //RemovingTheCorrespondingSceneMapFromCentralDB(channelHandlerContext,ipadddress,mNode);\n\n // Send Commands To UI that Device is Removed .\n Log.d(\"Scan_Netty\", ipadddress + \"Socket removed becuase we did not get notification since last 11 second\");\n Log.d(HeartbeatHandler.class.getName(), ipadddress + \"Socket removed becuase we did not get notification since last 11 second\");\n }\n }\n }\n }\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n }", "@Override\n public void onMessage(String data) {\n\n log.e(\"ipcChannel received message: [\" + data + \"]\");\n\n try {\n JSONObject json = new JSONObject(data);\n\n onIpcMessage(json);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "@Override\n\t\tpublic int onMessage(int srcId, int requestId, int subject, int cmd, Object payload) {\n\t\t\treturn 0;\n\t\t}", "@Override\n public void onMessageReceived(String from, Bundle data) {\n\n Log.d(TAG, data.toString());\n Log.d(TAG, from);\n int typePush = -1;\n try {\n typePush = Integer.parseInt(data.getString(FIELD_PUSH_TYPE));\n } catch (NumberFormatException ex) {\n Log.e(TAG, ex.getMessage());\n }\n if (typePush == PUSH_TYPE_CHAT) {\n processChatNotification(data);\n } else {\n showNotificationCourse(data);\n }\n\n }", "@Override\r\n public void onMessageReceived(final RemoteMessage remoteMessage) {\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\r\n Log.d(TAG, \"Notification Message Body: \" + remoteMessage.getNotification().getBody());\r\n Handler handler = new Handler(Looper.getMainLooper());\r\n handler.post(new Runnable() {\r\n public void run() {\r\n Toast.makeText(getApplicationContext(), \"Push notification received:\\n\"\r\n + remoteMessage.getNotification().getBody(), Toast.LENGTH_LONG).show();\r\n }\r\n });\r\n\r\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n if (remoteMessage.getData().size() > 0) {\n }\n\n String click_action = remoteMessage.getNotification().getClickAction();\n\n if (remoteMessage.getNotification() != null) {\n sendNotification(remoteMessage.getNotification().getTitle(),remoteMessage.getNotification().getBody(),remoteMessage.getData(),click_action);\n }\n\n }", "@Override\r\n\tpublic void sendNotifications() {\n\r\n\t}", "@Override\n public void notificationReceived(OSNotification notification) {\n Log.e(\"oneSignal\",\"new Notification\");\n\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage2) {\n Log.i(TAG, \"알림 메시지\" + remoteMessage2);\n\n remoteMessage = remoteMessage2;\n if(remoteMessage.getData().get(\"title\").equals(\"NEW!\")){\n sendNotificationNewDevice(remoteMessage.getData().get(\"body\"));\n }\n //String now = dateFormat.format (System.currentTimeMillis());\n else {\n sendNotificationDangerAlert();\n }\n }", "@Override\r\n\tpublic void OnMicQueueNotify(List<stMicInfo> micinfolists) {\n\t\t\r\n\t\tString tempIDS[] = new String[micinfolists.size()];\r\n\t\tString uniqueIDS[] = new String[micinfolists.size()];\r\n\t\r\n\t\tint j = 0;\r\n\t\tfor (Iterator<stMicInfo> i = micinfolists.iterator(); i.hasNext();)\r\n\t\t{ \r\n\t\t\tstMicInfo userinfoRef = i.next(); \r\n\t\t\ttempIDS[j] = String.valueOf(userinfoRef.getTempid());\r\n\t\t\tuniqueIDS[j] = userinfoRef.getUniqueid();\r\n\t\t\tj++;\r\n\t\t} \r\n\t\tMicQueueResult(tempIDS,uniqueIDS);\r\n\t}", "public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.d(TAG, \"FCM Message Id: \" + remoteMessage.getMessageId());\n Log.d(TAG, \"FCM Notification Message: \" + remoteMessage.getNotification());\n Log.d(TAG, \"FCM Data Message: \" + remoteMessage.getData());\n\n Map<String, String> payload = remoteMessage.getData();\n\n if (payload != null) {\n String payloadType = payload.get(\"type\");\n\n switch (payloadType) {\n case \"invitation\":\n Intent inviteIntent = new Intent();\n inviteIntent.setAction(BroadcastHelper.INVITE_REQUEST);\n inviteIntent.putExtra(BroadcastHelper.ADMIN, payload.get(\"sender\"));\n inviteIntent.putExtra(BroadcastHelper.GAME_NAME, payload.get(\"game\"));\n inviteIntent.putExtra(BroadcastHelper.PLAYER_NAME, payload.get(\"receiver\"));\n sendBroadcast(inviteIntent);\n break;\n case \"game_start\":\n Intent gameStartIntent = new Intent();\n gameStartIntent.setAction(BroadcastHelper.GAME_START);\n gameStartIntent.putExtra(BroadcastHelper.ADMIN, payload.get(\"admin\"));\n gameStartIntent.putExtra(BroadcastHelper.GAME_NAME, payload.get(\"game\"));\n// gameStartIntent.putExtra(BroadcastHelper.SENDER, payload.get(\"sender\"));\n// gameStartIntent.putExtra(BroadcastHelper.PLAYER_NAME, payload.get(\"player\"));\n sendBroadcast(gameStartIntent);\n break;\n case \"invite_response\":\n Intent inviteResponseIntent = new Intent();\n inviteResponseIntent.setAction(BroadcastHelper.INVITE_RESPONSE);\n inviteResponseIntent.putExtra(BroadcastHelper.PLAYER_NAME, payload.get(\"player_name\")); // TODO: Complete Cloud Fxn\n sendBroadcast(inviteResponseIntent);\n break;\n case \"new_player_joined\":\n Intent newPlayerJoinedIntent = new Intent();\n newPlayerJoinedIntent.setAction(BroadcastHelper.NEW_PLAYER_JOINED);\n newPlayerJoinedIntent.putExtra(BroadcastHelper.PLAYER_NAME, payload.get(\"player_name\")); // TODO: Complete Cloud Fxn\n // newPlayerJoinedIntent.putExtra(BroadcastHelper.LOCATION, payload.get(\"location\")); // TODO: Complete Cloud Fxn\n sendBroadcast(newPlayerJoinedIntent);\n break;\n case \"game_end_message\":\n Intent gameEndIntent = new Intent();\n gameEndIntent.setAction(BroadcastHelper.GAME_ENDS);\n gameEndIntent.putExtra(BroadcastHelper.WINNING_TEAM, payload.get(\"winner\"));\n gameEndIntent.putExtra(BroadcastHelper.RESULT_MESSAGE, payload.get(\"message\"));\n sendBroadcast(gameEndIntent);\n // TODO: PASS NAME OF WINNING TEAM AND THE GAME MESSAGE (SEE FXN)\n break;\n default:\n Log.d(TAG, \"Intent error\");\n }\n }\n\n }", "@Override\n public void onMessageReceived(String from, Bundle data) {\n Log.i(TAG,\"###### onMessageReceived, data: \" + data.toString());\n String message = data.getString(\"message\");\n if (message != null) {\n Log.d(TAG, \"** GCM message From: \" + from);\n Log.d(TAG, \"Message: \" + message);\n sendNotification(message);\n return;\n }\n// message = data.getString(\"track\");\n// if (message != null) {\n// LocationTrackerDTO m = GSON.fromJson(message, LocationTrackerDTO.class);\n// Log.d(TAG, \"** GCM track message From: \" + from);\n// Log.d(TAG, \"Track: \" + message);\n// sendNotification(m);\n// return;\n// }\n// message = data.getString(\"simpleMessage\");\n// if (message != null) {\n// SimpleMessageDTO m = GSON.fromJson(message, SimpleMessageDTO.class);\n// m.setDateReceived(new Date().getTime());\n// if (m.getLocationRequest() == null) {\n// m.setLocationRequest(Boolean.FALSE);\n// }\n// Log.d(TAG, \"** GCM simpleMessage From: \" + from);\n// Log.d(TAG, \"SimpleMessage: \" + m.getMessage());\n// broadcastMessage(m);\n// return;\n// }\n\n }", "private void sendNotification() {\n ParsePush parsePush = new ParsePush();\n String id = ParseInstallation.getCurrentInstallation().getInstallationId();\n Log.d(\"Debug_id\", id);\n Log.d(\"Debug_UserName\", event.getHost().getUsername()); // host = event.getHost().getUsername();\n ParseQuery pQuery = ParseInstallation.getQuery(); // <-- Installation query\n Log.d(\"Debug_pQuery\", pQuery.toString());\n pQuery.whereEqualTo(\"username\", event.getHost().getUsername());// <-- you'll probably want to target someone that's not the current user, so modify accordingly\n parsePush.sendMessageInBackground(\"Hey your Event: \" + event.getTitle() + \" has a subscriber\", pQuery);\n\n }", "protected abstract void sendInternal(List<String> messages) throws NotificationException;", "@Override\n public void onReceive(Context context, Intent intent) {\n String message = intent.getStringExtra(\"message\");\n Log.d(\"receiver\", \"Got message: \" + message);\n filterDayWise();\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n if (intent.getAction().equals(Config.REGISTRATION_COMPLETE)) {\n // gcm successfully registered\n // now subscribe to `global` topic to receive app wide notifications\n FirebaseMessaging.getInstance().subscribeToTopic(Config.TOPIC_GLOBAL);\n\n displayFirebaseRegId();\n\n } else if (intent.getAction().equals(Config.PUSH_NOTIFICATION)) {\n // new push notification is received\n\n String message = intent.getStringExtra(\"message\");\n\n\n// txtMessage.setText(message);\n getlist();\n adapter.notifyDataSetChanged();\n }\n }", "public void receivePushNotification() {\n mBroadcastReceiver = new BroadcastReceiver() {\n @Override\n public void onReceive(Context context, Intent intent) {\n\n // checking for type intent filter\n if (intent.getAction().equals(Config.REGISTRATION_COMPLETE)) {\n // FCM successfully registered\n // now subscribe to `global` topic to receive app wide notifications\n FirebaseMessaging.getInstance().subscribeToTopic(Config.TOPIC_GLOBAL);\n\n\n } else if (intent.getAction().equals(Config.PUSH_NOTIFICATION)) {\n // new push notification is received\n\n String message = intent.getStringExtra(\"message\");\n\n String JSON_DATA = sessionManager.getPushNotification();\n\n try {\n JSONObject jsonObject = new JSONObject(JSON_DATA);\n\n if (jsonObject.getJSONObject(\"custom\").has(\"chat_status\") && jsonObject.getJSONObject(\"custom\").getJSONObject(\"chat_status\").getString(\"status\").equals(\"New message\")) {\n\n //getChatConversationList();\n String cumessage = jsonObject.getJSONObject(\"custom\").getJSONObject(\"chat_status\").getString(\"message\");\n ReceiveDateModel receiveDateModel;//=new ReceiveDateModel();\n String dateResp = String.valueOf(jsonObject.getJSONObject(\"custom\").getJSONObject(\"chat_status\").getJSONObject(\"received_date_time\"));\n changeChatIcon(1);\n //Resumes the Fragement and Gets the data from Api\n Fragment fragment = myAdapter.getFragment(2);\n if (fragment != null) {\n //fragment.onResume();\n fragment.setUserVisibleHint(true);\n }\n }\n if (jsonObject.getJSONObject(\"custom\").has(\"match_status\") && jsonObject.getJSONObject(\"custom\").getJSONObject(\"match_status\").getString(\"match_status\").equals(\"Yes\")){\n changeChatIcon(1);\n //Resumes the Fragement and Gets the data from Api\n Fragment fragment = myAdapter.getFragment(2);\n if (fragment != null) {\n //fragment.onResume();\n fragment.setUserVisibleHint(true);\n }\n }\n\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }\n };\n }", "@Override\r\n public void onReceiveResult(Message message) {\r\n switch (message.what) {\r\n //TODO\r\n }\r\n }", "public void readNotification()\n {\n userFan.readNotification();\n }", "@Override\n public void onReceive(Context context, Intent intent)\n {\n Log.d(TAG, \"Received BLE Update\");\n // Get the MAC address and action from the intent\n String deviceAddress = intent.getStringExtra(BluetoothLeConnectionService.INTENT_DEVICE);\n String action = intent.getStringExtra(BluetoothLeConnectionService.INTENT_EXTRA);\n\n Log.d(TAG, \"Received BLE Update ACTION=====\"+ action);\n\n /*\n * The action holds what type of update we are dealing with. For each action, we\n * need to update the TT update receiver.\n */\n switch (action)\n {\n case BluetoothLeConnectionService.GATT_STATE_CONNECTING:\n TexTronicsUpdateReceiver.update(mContext, deviceAddress, TexTronicsUpdate.ble_connecting);\n break;\n case BluetoothLeConnectionService.GATT_STATE_CONNECTED:\n TexTronicsUpdateReceiver.update(mContext, deviceAddress, TexTronicsUpdate.ble_connected);\n // Once connected, we need to discover the services to find our characteristics\n mBleService.discoverServices(deviceAddress);\n\n MainActivity.CONNECTED = true;\n break;\n case BluetoothLeConnectionService.GATT_STATE_DISCONNECTING:\n TexTronicsUpdateReceiver.update(mContext, deviceAddress, TexTronicsUpdate.ble_disconnecting);\n\n // Before we disconnect, we need to publish any exercise data. Get the disconnecting device\n TexTronicsDevice disconnectingDevice = mTexTronicsList.get(deviceAddress);\n\n //TODO: DEBUG ME!!!!!\n\n // Send to Server via MQTT\n if(mMqttServiceBound && DeviceExerciseFragment.START_LOG)\n {\n try\n {\n byte[] buffer = IOUtil.readFile(disconnectingDevice.getCsvFile());\n String json = MqttConnectionService.generateJson(disconnectingDevice.getDate(),\n disconnectingDevice.getDeviceAddress(),\n Choice.toString(disconnectingDevice.getChoice()) ,\n disconnectingDevice.getExerciseID(),\n disconnectingDevice.getRoutineID(),\n new String(buffer));\n Log.d(\"SmartGlove\", \"JSON: \" + json);\n mMqttService.publishMessage(json);\n DeviceExerciseFragment.START_LOG = false;\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n break;\n case BluetoothLeConnectionService.GATT_STATE_DISCONNECTED:\n TexTronicsUpdateReceiver.update(mContext, deviceAddress, TexTronicsUpdate.ble_disconnected);\n\n // It has now been disconnected and we've published the data, now we remove the device from our list\n TexTronicsDevice disconnectDevice = mTexTronicsList.get(deviceAddress);\n if(disconnectDevice == null) {\n Log.w(TAG, \"Device not Found\");\n return;\n }\n mTexTronicsList.remove(deviceAddress);\n\n MainActivity.CONNECTED = false;\n\n break;\n case BluetoothLeConnectionService.GATT_DISCOVERED_SERVICES:\n // Enable notifications on our RX characteristic which sends our data packets\n\n if(deviceAddress.equals(GattDevices.LEFT_GLOVE_ADDR)){\n BluetoothGattCharacteristic characteristic = mBleService.getCharacteristic(deviceAddress, GattServices.UART_SERVICE2, GattCharacteristics.RX_CHARACTERISTIC2);\n if (characteristic != null) {\n mBleService.enableNotifications(deviceAddress, characteristic);\n }\n }\n if(deviceAddress.equals(GattDevices.RIGHT_GLOVE_ADDR)||deviceAddress.equals(GattDevices.LEFT_SHOE_ADDR)||deviceAddress.equals(GattDevices.RIGHT_SHOE_ADDR)) {\n BluetoothGattCharacteristic characteristic = mBleService.getCharacteristic(deviceAddress, GattServices.UART_SERVICE, GattCharacteristics.RX_CHARACTERISTIC);\n if (characteristic != null) {\n mBleService.enableNotifications(deviceAddress, characteristic);\n }\n }\n\n\n// // Write to the txChar to notify the device\n// BluetoothGattCharacteristic txChar = mBleService.getCharacteristic(deviceAddress, GattServices.UART_SERVICE, GattCharacteristics.TX_CHARACTERISTIC);/**---------------------------------------------------------------------------------------------------------*/\n// /**\n// * added to sent 1 or 2 or 3 to the bluetooth device\n// */\n// if(ExerciseInstructionFragment.flag==1)\n// {mBleService.writeCharacteristic(deviceAddress, txChar, new byte[] {0x01});\n// Log.d(TAG, \"Data sent via flex\");}\n// else if(ExerciseInstructionFragment.flag==2)\n// {mBleService.writeCharacteristic(deviceAddress, txChar, new byte[] {0x02});\n// Log.d(TAG, \"Data sent via imu\");}\n// else if(ExerciseInstructionFragment.flag==3)\n// {mBleService.writeCharacteristic(deviceAddress, txChar, new byte[] {0x03});}\n//\n// /*-----------------------------------------------------------------------------------------------------------------------------------------*/\n\n break;\n case BluetoothLeConnectionService.GATT_CHARACTERISTIC_NOTIFY:\n /* Called whenever the value of our RX characteristic is changed, which\n * is equal to the sampling rate of our connected device.\n */\n UUID characterUUID = UUID.fromString(intent.getStringExtra(BluetoothLeConnectionService.INTENT_CHARACTERISTIC));\n if(characterUUID.equals(GattCharacteristics.RX_CHARACTERISTIC)||characterUUID.equals(GattCharacteristics.RX_CHARACTERISTIC2))\n {\n // Get the data packet\n Log.d(TAG, \"Data Received\");\n byte[] data = intent.getByteArrayExtra(BluetoothLeConnectionService.INTENT_DATA);\n\n // Find out the exercise mode (i.e what type of data we are collecting)\n TexTronicsDevice device = mTexTronicsList.get(deviceAddress);\n\n\n //String exerciseMode = null;\n String exerciseMode = null;\n if(device != null)\n //exerciseMode1 = device.getExerciseMode();\n exerciseMode = MainActivity.exercise_mode;\n\n if(exerciseMode != null)\n {\n try\n {\n /** alli edit - how the csv files is logged */\n /* if(exerciseMode.equals(\"Flex + Imu\")){\n device.setThumbFlex((((data[0] & 0x00FF) << 8) | ((data[1] & 0x00FF))));\n device.setIndexFlex((((data[2] & 0x00FF) << 8) | ((data[3] & 0x00FF))));\n device.setAccX(((data[4] & 0x00FF) << 8) | ((data[5] & 0x00FF)));\n device.setAccY(((data[6] & 0x00FF) << 8) | ((data[7] & 0x00FF)));\n device.setAccZ(((data[8] & 0x00FF) << 8) | ((data[9] & 0x00FF)));\n device.setGyrX(((data[10] & 0x00FF) << 8) | ((data[11] & 0x00FF)));\n device.setGyrY(((data[12] & 0x00FF) << 8) | ((data[13] & 0x00FF)));\n device.setGyrZ(((data[14] & 0x00FF) << 8) | ((data[15] & 0x00FF)));\n\n Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n\n // If in exercise, log this data to CSV file\n if(DeviceExerciseFragment.START_LOG){\n device.logData(mContext);\n } else {\n Log.w(TAG, \"Invalid Data Packet\");\n return;\n }\n }*/\n// else if(exerciseMode.equals(\"Flex Only\")){\n// Log.e(\"MODE:::--\" ,exerciseMode);\n// device.setThumbFlex((((data[1] & 0x00FF) << 8) | ((data[0] & 0x00FF))));\n// device.setIndexFlex((((data[3] & 0x00FF) << 8) | ((data[2] & 0x00FF))));\n// device.setMiddleFlex((((data[5] & 0x00FF) << 8) | ((data[4] & 0x00FF))));\n// device.setRingFlex((((data[7] & 0x00FF) << 8) | ((data[6] & 0x00FF))));\n// device.setPinkyFlex((((data[9] & 0x00FF) << 8) | ((data[8] & 0x00FF))));\n//\n// Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n//\n// if(DeviceExerciseFragment.START_LOG)\n// device.logData(mContext);\n//\n//\n// // Second Data Set\n// //device.setTimestamp((((data[6] & 0x00FF) << 8) | ((data[7] & 0x00FF))));\n// device.setThumbFlex((((data[11] & 0x00FF) << 8) | ((data[10] & 0x00FF))));\n// device.setIndexFlex((((data[13] & 0x00FF) << 8) | ((data[12] & 0x00FF))));\n// device.setMiddleFlex((((data[15] & 0x00FF) << 8) | ((data[14] & 0x00FF))));\n// device.setRingFlex((((data[17] & 0x00FF) << 8) | ((data[16] & 0x00FF))));\n// device.setPinkyFlex((((data[19] & 0x00FF) << 8) | ((data[18] & 0x00FF))));\n// Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n//\n// if(DeviceExerciseFragment.START_LOG)\n// device.logData(mContext);\n// }\n// else if(exerciseMode.equals(\"Imu Only\")){\n// Log.e(\"MODE:::--\" ,exerciseMode);\n// device.setAccX(((data[1] & 0x00FF) << 8) | ((data[0] & 0x00FF)));\n// device.setAccY(((data[3] & 0x00FF) << 8) | ((data[2] & 0x00FF)));\n// device.setAccZ(((data[5] & 0x00FF) << 8) | ((data[4] & 0x00FF)));\n// device.setGyrX(((data[7] & 0x00FF) << 8) | ((data[6] & 0x00FF)));\n// device.setGyrY(((data[9] & 0x00FF) << 8) | ((data[8] & 0x00FF)));\n// device.setGyrZ(((data[11] & 0x00FF) << 8) | ((data[10] & 0x00FF)));\n//\n// Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n//\n// if(DeviceExerciseFragment.START_LOG)\n// device.logData(mContext);\n//\n //}\n\n Log.e(\"MODE\",MainActivity.exercise_mode);\n Log.e(\"MODE:::--\" ,device.getExerciseMode().toString());\n\n switch (exerciseMode)\n {\n case \"Flex + IMU\":\n // Move data processing into Data Model?\n// //if (data[0] == PACKET_ID_1) {\n\n device.setTimestamp(((data[1] & 0x00FF) << 8) | ((data[0] & 0x00FF)));// | ((data[3] & 0x00FF) << 8) | (data[4] & 0x00FF));\n device.setThumbFlex((((data[3] & 0x00FF) << 8) | ((data[2] & 0x00FF))));\n device.setIndexFlex((((data[5] & 0x00FF) << 8) | ((data[4] & 0x00FF))));\n device.setRingFlex((((data[7] & 0x00FF) << 8) | ((data[6] & 0x00FF))));\n device.setAccX((short)(((data[9] & 0x00FF) << 8) | ((data[8] & 0x00FF))));\n device.setAccY((short)(((data[11] & 0x00FF) << 8) | ((data[10] & 0x00FF))));\n device.setAccZ((short)(((data[13] & 0x00FF) << 8) | ((data[12] & 0x00FF))));\n device.setGyrX((short)(((data[15] & 0x00FF) << 8) | ((data[14] & 0x00FF))));\n device.setGyrY((short)(((data[17] & 0x00FF) << 8) | ((data[16] & 0x00FF))));\n device.setGyrZ((short)(((data[19] & 0x00FF) << 8) | ((data[18] & 0x00FF))));\n\n\n\n Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n\n // If in exercise, log this data to CSV file\n if(DeviceExerciseFragment.START_LOG){\n device.logData(mContext);\n } else {\n Log.w(TAG, \"Invalid Data Packet\");\n return;\n }\n break;\n case \"Flex Only\":\n // First Data Set\n //device.setTimestamp((((data[0] & 0x00FF) << 8) | ((data[1] & 0x00FF))));\n\n device.setThumbFlex((((data[1] & 0x00FF) << 8) | ((data[0] & 0x00FF))));\n device.setIndexFlex((((data[3] & 0x00FF) << 8) | ((data[2] & 0x00FF))));\n device.setMiddleFlex((((data[5] & 0x00FF) << 8) | ((data[4] & 0x00FF))));\n device.setRingFlex((((data[7] & 0x00FF) << 8) | ((data[6] & 0x00FF))));\n device.setPinkyFlex((((data[9] & 0x00FF) << 8) | ((data[8] & 0x00FF))));\n\n Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n\n if(DeviceExerciseFragment.START_LOG)\n device.logData(mContext);\n\n\n // Second Data Set\n //device.setTimestamp((((data[6] & 0x00FF) << 8) | ((data[7] & 0x00FF))));\n device.setThumbFlex((((data[11] & 0x00FF) << 8) | ((data[10] & 0x00FF))));\n device.setIndexFlex((((data[13] & 0x00FF) << 8) | ((data[12] & 0x00FF))));\n device.setMiddleFlex((((data[15] & 0x00FF) << 8) | ((data[14] & 0x00FF))));\n device.setRingFlex((((data[17] & 0x00FF) << 8) | ((data[16] & 0x00FF))));\n device.setPinkyFlex((((data[19] & 0x00FF) << 8) | ((data[18] & 0x00FF))));\n Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n\n if(DeviceExerciseFragment.START_LOG)\n device.logData(mContext);\n break;\n // Third Data Set\n //device.setTimestamp((((data[12] & 0x00FF) << 8) | ((data[13] & 0x00FF))));\n //device.setThumbFlex((((data[14] & 0x00FF) << 8) | ((data[15] & 0x00FF))));\n //device.setIndexFlex((((data[16] & 0x00FF) << 8) | ((data[17] & 0x00FF))));\n\n // If in exercise, log data to CSV\n //if(DeviceExerciseFragment.START_LOG)\n // device.logData(mContext);\n\n case \"Imu Only\":\n device.setAccX((short) (((data[1] & 0x00FF) << 8) | ((data[0] & 0x00FF))));\n device.setAccY(( short)(((data[3] & 0x00FF) << 8) | ((data[2] & 0x00FF))));\n device.setAccZ((short)(((data[5] & 0x00FF) << 8) | ((data[4] & 0x00FF))));\n device.setGyrX(( short)(((data[7] & 0x00FF) << 8) | ((data[6] & 0x00FF))));\n device.setGyrY(( short)(((data[9] & 0x00FF) << 8) | ((data[8] & 0x00FF))));\n device.setGyrZ(( short)(((data[11] & 0x00FF) << 8) | ((data[10] & 0x00FF))));\n\n Log.d(\"START_LOG:::--\" ,String.valueOf(DeviceExerciseFragment.START_LOG));\n\n if(DeviceExerciseFragment.START_LOG)\n device.logData(mContext);\n break;\n }\n } catch (IllegalDeviceType | IOException e) {\n Log.e(TAG, e.toString());\n // TODO Handle Error Event\n return;\n }\n }\n }\n break;\n case BluetoothLeConnectionService.GATT_CHARACTERISTIC_READ:\n break;\n case BluetoothLeConnectionService.GATT_DESCRIPTOR_WRITE:\n break;\n case BluetoothLeConnectionService.GATT_NOTIFICATION_TOGGLED:\n break;\n case BluetoothLeConnectionService.GATT_DEVICE_INFO_READ:\n break;\n }\n }", "public void consumeNotifications() {\n\t\tif (!consumerTopics.contains(NOTIFICATION_TOPIC)) {\n\t\t\tconsumerTopics.add(NOTIFICATION_TOPIC);\n\t\t}\n\n\t\tif (logger.isInfoEnabled()) {\n\t\t\tlogger.info(\"Consuming notification messages\");\n\t\t}\n\n\t\tstartPolling();\n\t}", "public void onRecvServerChatMsg(WsMessage.ServerPushChatMsg msg) {\n if (msg != null && msg.list != null && msg.list.size() > 0) {\n for (int i = 0; i < msg.list.size(); i++) {\n WsMessage.ChatMsg chatMsg = msg.list.get(i);\n ChatManager.GetInstance().onReceiveChatMsg(chatMsg.username, chatMsg.msg, \"\", chatMsg.userid, chatMsg.admin);\n }\n ((Activity) this.mContext).runOnUiThread(new Runnable() {\n public void run() {\n ChatManager.GetInstance().notifyChatHistoryDataSetChanged();\n }\n });\n }\n }", "private void onReceiveChatMessages() {\n\n//\t\tL.debug(\"onReceiveChatMessages\");\n//\n//\t\t// called from NetworkChangeReceiver whenever the user is logged in\n//\t\t// will always be called whenever there is a change in network state,\n//\t\t// will always check if the app is connected to server,\n//\t\tXMPPConnection connection = XMPPLogic.getInstance().getConnection();\n//\n//\t\tif (connection == null || !connection.isConnected()) {\n//\t\t\tSQLiteHandler db = new SQLiteHandler(getApplicationContext());\n//\t\t\tdb.openToWrite();\n//\n//\t\t\t// db.updateBroadcasting(0);\n//\t\t\t// db.updateBroadcastTicker(0);\n//\n//\t\t\tAccount ac = new Account();\n//\t\t\tac.LogInChatAccount(db.getUsername(), db.getEncryptedPassword(), db.getEmail(), new OnXMPPConnectedListener() {\n//\n//\t\t\t\t@Override\n//\t\t\t\tpublic void onXMPPConnected(XMPPConnection con) {\n//\t\t\t\t\t\n//\t\t\t\t\t//addPacketListener(con);\n//\t\t\t\t}\n//\n//\t\t\t});\n//\n//\t\t\tdb.close();\n//\t\t} else {\n//\n//\t\t\t//addPacketListener(connection);\n//\n//\t\t}\n\t}", "public void onMessage(Session session);", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n\n // Check if message contains a data payload.\n if (remoteMessage.getData().size() > 0) {\n //Log.d(TAG, \"Message data payload: \" + remoteMessage.getData().values().toArray()[0]);\n String text = (String) remoteMessage.getData().values().toArray()[0];\n sendMessageToActivity(text);\n\n }\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n Log.d(TAG, \"Message Notification Body: \" + remoteMessage.getNotification().getBody());\n }\n }", "public void onMessageReceived(RemoteMessage remoteMessage) {\n if (remoteMessage.getData().size() > 0) {\n Log.e(\"ORM\", \"Message data payload: \" + remoteMessage.getData());\n }\n PreferenceManager.getDefaultSharedPreferences(getBaseContext());\n // Check if message contains a notification payload.\n if (remoteMessage.getNotification() != null) {\n // for foreground\n Map<String, String> data = null;\n if (remoteMessage.getData().get(\"type\") != null) {\n data = remoteMessage.getData();\n Log.i(TAG, \"onMessageReceived: type = \" + remoteMessage.getData().get(\"type\"));\n Log.i(TAG, \"onMessageReceived: time = \" + remoteMessage.getSentTime());\n sendNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody(), data);\n }\n } else {\n // for background\n if (remoteMessage.getData().size() > 0) {\n switch (remoteMessage.getData().get(\"type\")) {\n case \"alarm_alert\":\n String[] request_link = remoteMessage.getData().get(\"api\").split(\"\\\\?\");\n new JSONResponse(this, request_link[0], request_link[1], new JSONResponse.onComplete() {\n @Override\n public void onComplete(JSONObject json) {\n Log.i(TAG, \"onComplete: alarm_alert data json = \" + json);\n try {\n JSONArray jsonArr = json.getJSONArray(\"data\");\n for (int i = 0; i < jsonArr.length(); i++) {\n JSONObject obj = jsonArr.getJSONObject(i);\n String time = obj.getString(\"day\") + \" \" + obj.getString(\"time\");\n String task = \"\";\n for (int j = 0; j < obj.getJSONArray(\"task\").length(); j++) {\n if (j != 0) {\n task += \",\";\n }\n task += obj.getJSONArray(\"task\").getString(j);\n }\n String title = obj.getString(\"stage\");\n Log.i(TAG, \"onComplete: alarm_alert time = \" + time);\n Log.i(TAG, \"onComplete: alarm_alert task = \" + task);\n String value = obj.getString(\"value\");\n String[] a = time.split(\" \");\n String requestCode = a[0].replace(\"-\", \"\") + a[1].replace(\":\", \"\");\n requestCode = requestCode.substring(2, 12);\n int rc = Integer.parseInt(requestCode);\n Log.i(TAG, \"onComplete: requestCode = \" + rc);\n long delta = calculateDelay(time);\n boolean enable = value.equals(\"on\");\n if (delta >= 0) {\n sendMsgForAlertSystem(title, task, delta, rc, enable);\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n });\n break;\n case \"nutrition\":\n String[] request_link1 = remoteMessage.getData().get(\"api\").split(\"\\\\?\");\n Log.i(TAG, \"onMessageReceived: \" + request_link1);\n new JSONResponse(this, request_link1[0], request_link1[1], new JSONResponse.onComplete() {\n @Override\n public void onComplete(JSONObject json) {\n Log.i(TAG, \"onComplete: json = \" + json);\n try {\n int rc = json.getInt(\"rc\");\n if (rc == 0) {\n JSONArray data = json.getJSONObject(\"data\").getJSONArray(\"data\");\n Log.i(TAG, \"onComplete: json data = \" + data);\n for (int i = 0; i < data.length(); i++) {\n JSONObject obj = data.getJSONObject(i);\n Log.i(TAG, \"onComplete: json data item = \" + obj);\n String title = obj.getString(\"title\");\n String time = obj.getString(\"time\");\n String content = \"\";\n JSONArray food = obj.getJSONArray(\"food\");\n JSONArray quantity = obj.getJSONArray(\"quantity\");\n for (int j = 0; j < food.length(); j++) {\n content += food.getString(j) + \" \" + quantity.getString(j);\n if (j < food.length() - 1) {\n content += \",\";\n }\n }\n Log.i(TAG, \"onComplete: json data content = \" + content);\n String today = getRealFormat(\"yyyy-MM-dd\").format(new Date());\n if (time != null && isTime(time) && !title.equals(\"\") && !content.equals(\" \")) {\n long delta = calculateDelay(today + \" \" + (time.length() < 6 ? time + \":00\" : time));\n delta -= delta - 10 * 60 * 1000; // 10min before\n String requestCode = today.replace(\"-\", \"\") + i;\n int resC = Integer.parseInt(requestCode.substring(2));\n if (delta >= 0) {\n// sendMsgForNutrition(title, content, time, delta, resC, i);\n sendMsgFor(API.ACTION_NUTRITION, title, content, time, delta, resC, i);\n } else {\n delta = delta + 24 * 60 * 60 * 1000;\n Date tmp = new Date();\n tmp.setTime(new Date().getTime() + 24 * 60 * 60 * 1000);\n String tomorrow = getRealFormat(\"yyyy-MM-dd\").format(tmp);\n requestCode = tomorrow.replace(\"-\", \"\") + i;\n resC = Integer.parseInt(requestCode.substring(2));\n// sendMsgForNutrition(title, content, time, delta, resC, i);\n sendMsgFor(API.ACTION_NUTRITION, title, content, time, delta, resC, i);\n }\n }\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n });\n break;\n case \"client_alert\":\n String[] request_link2 = remoteMessage.getData().get(\"api\").split(\"\\\\?\");\n Log.i(TAG, \"onMessageReceived: \" + request_link2);\n new JSONResponse(this, request_link2[0], request_link2[1], new JSONResponse.onComplete() {\n @Override\n public void onComplete(JSONObject json) {\n Log.i(TAG, \"onComplete: json = \" + json);\n try {\n int rc = json.getInt(\"rc\");\n if (rc == 0) {\n JSONArray data = json.getJSONObject(\"data\").getJSONArray(\"data\");\n Log.i(TAG, \"onComplete: json data = \" + data);\n for (int i = 0; i < data.length(); i++) {\n JSONObject obj = data.getJSONObject(i);\n Log.i(TAG, \"onComplete: json data item = \" + obj);\n String title = obj.getString(\"title\");\n String time = obj.getString(\"time\");\n String content = \"\";\n JSONArray contentArr = obj.getJSONArray(\"content\");\n for (int j = 0; j < contentArr.length(); j++) {\n content += contentArr.getString(j);\n if (j < contentArr.length() - 1) {\n content += \",\";\n }\n }\n Log.i(TAG, \"onComplete: json data content = \" + content);\n String today = getRealFormat(\"yyyy-MM-dd\").format(new Date());\n Log.i(TAG, \"onComplete: isTime = \" + isTime(time));\n if (time != null && isTime(time) && !title.equals(\"\") && !content.equals(\" \")) {\n long delta = calculateDelay(today + \" \" + (time.length() < 6 ? time + \":00\" : time));\n delta -= delta - 10 * 60 * 1000; // 10min before\n String requestCode = today.replace(\"-\", \"\") + (i + 10);\n int resC = Integer.parseInt(requestCode.substring(2));\n if (delta >= 0) {\n// sendMsgForClientAlert(title, content, time, delta, resC, i);\n sendMsgFor(API.ACTION_CLIENT_ALERT, title, content, time, delta, resC, i);\n } else {\n delta = delta + 24 * 60 * 60 * 1000;\n Date tmp = new Date();\n tmp.setTime(new Date().getTime() + 24 * 60 * 60 * 1000);\n String tomorrow = getRealFormat(\"yyyy-MM-dd\").format(tmp);\n requestCode = tomorrow.replace(\"-\", \"\") + (i + 10);\n resC = Integer.parseInt(requestCode.substring(2));\n// sendMsgForClientAlert(title, content, time, delta, resC, i);\n sendMsgFor(API.ACTION_CLIENT_ALERT, title, content, time, delta, resC, i);\n }\n }\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n });\n break;\n }\n }\n }\n }", "public interface INotificationFactory {\n\n /**\n * Implements a query to get user's device list, that is, mobile device unique ID value.\n *\n * @param idUser the ID of user\n * @param type the ID of notification type\n * @return the set of String,devices list\n */\n @Deprecated\n Set<NotificationMessageContainer> getUserDevice(long idUser, int type, EnumOperationSystem os);\n\n /**\n * Implements a query to get a user's follower mobile device ID to \"push notification\"\n *\n * @param idUser the ID of user\n * @param idChannel the ID of channel, if channel is private we get only the channel memberships device list\n * @param isPrivately define should device list generated for private push notification\n * @param type the type of notification activity\n * @return the set of String of devices\n */\n Set<NotificationMessageContainer> getUserMultiDevice(long idUser, long idChannel, boolean isPrivately, int type, EnumOperationSystem os);\n\n /**\n * Implements a query to get a user's follower mobile device ID to \"push LIVE notification\"\n *\n * @param idUserFrom the ID of user\n * @param idChannel the ID of channel, if channel is private we get only the channel memberships device list\n * @param key key for redis store\n * @param isPrivately define should device list generated for private push notification\n */\n Long setLiveNotificationUsers(long idUserFrom, long idChannel, long key, boolean isPrivately);\n}", "private void subscribe() {\n Log.i(TAG, \"Subscribing\");\n mNearbyDevicesArrayAdapter.clear();\n SubscribeOptions options = new SubscribeOptions.Builder()\n .setStrategy(PUB_SUB_STRATEGY)\n .setCallback(new SubscribeCallback() {\n @Override\n public void onExpired() {\n super.onExpired();\n Log.i(TAG, \"No longer subscribing\");\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mSubscribeSwitch.setChecked(false);\n }\n });\n }\n }).build();\n\n Nearby.Messages.subscribe(mGoogleApiClient, mMessageListener, options)\n .setResultCallback(new ResultCallback<Status>() {\n @Override\n public void onResult(@NonNull Status status) {\n if (status.isSuccess()) {\n Log.i(TAG, \"Subscribed successfully.\");\n } else {\n logAndShowSnackbar(\"Could not subscribe, status = \" + status);\n mSubscribeSwitch.setChecked(false);\n }\n }\n });\n }", "public void onUnscuuessNotificationUpdate(String message);", "@Override\n\tpublic void onMessageRecieved(Message arg0) {\n\t\t\n\t}", "@Override\n public void onMessageReceived(String from, Bundle data)\n {\n //FCM Handling start\n// Bundle bundle = data.getParcelable(\"notification\");\n// String message = bundle.getString(\"body\");\n //FCM Handling end\n\n String message = data.getString(\"message\");\n\n Log.d(TAG, \"From: \" + from);\n Log.d(TAG, \"Message: \" + message);\n\n try\n {\n GcmMessage gcmMessage = new Gson().fromJson(message, GcmMessage.class);\n\n ArrayList<String> eventTypes = gcmMessage.getEventTypes();\n\n for(String eventType : eventTypes)\n {\n GcmEventFactory.getEventCommand(eventType).run();\n }\n }\n catch(Exception e)\n {\n Log.d(TAG, \"Failed to process GCM message: \" + e.getMessage());\n }\n }", "@Override\n public void onReceive(Context context, Intent intent)\n {\n String typeOfMessage = intent.getStringExtra(\"type\");\n\n //The WS sent us the name of the sender\n String sender = intent.getStringExtra(\"sender\");\n\n String username = intent.getStringExtra(\"username\");\n\n String messageText = intent.getStringExtra(\"message\");\n\n ActivityManager.RunningAppProcessInfo appProcessInfo = new ActivityManager.RunningAppProcessInfo();\n ActivityManager.getMyMemoryState(appProcessInfo);\n\n if (appProcessInfo.importance == IMPORTANCE_FOREGROUND || appProcessInfo.importance == IMPORTANCE_VISIBLE)\n {\n //app is in the foreground so send the message to the active Activities\n Log.d(\"PUSHY\", \"Message received in foreground: \" + messageText);\n\n //create an Intent to broadcast a message to other parts of the app.\n Intent i = new Intent(RECEIVED_NEW_MESSAGE);\n i.putExtra(\"TYPE\", typeOfMessage);\n i.putExtra(\"SENDER\", sender);\n i.putExtra(\"MESSAGE\", messageText);\n i.putExtras(intent.getExtras());\n\n Log.e(\"PUSHY RECEIVED \", i.getStringExtra(\"TYPE\"));\n Log.e(\"PUSHY RECEIVED \", i.getStringExtra(\"SENDER\"));\n Log.e(\"PUSHY RECEIVED \", i.getStringExtra(\"MESSAGE\"));\n\n context.sendBroadcast(i);\n\n }\n else if(messageText.compareTo(\"Deletion\") != 0)\n {\n //app is in the background so create and post a notification\n Log.d(\"PUSHY\", \"Message received in background: \" + messageText);\n\n Intent i = new Intent(context, LoginActivity.class);\n i.putExtras(intent.getExtras());\n\n PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);\n\n //research more on notifications the how to display them\n //https://developer.android.com/guide/topics/ui/notifiers/notifications\n NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID);\n builder.setAutoCancel(true);\n builder.setSmallIcon(R.drawable.ic_chat_notification);\n if(username != null)\n {\n if(messageText.compareTo(\"Your Friends List has recently been modified.\") == 0)\n {\n builder.setContentTitle(\"Friend Notification from: \" + username);\n }\n else {\n builder.setContentTitle(\"Message Notification from: \" + username);\n }\n }\n else if(messageText.compareTo(\"One of your friends has added you to a chat!\") == 0)\n {\n builder.setContentTitle(\"Chat Notification: \");\n }\n\n\n builder.setContentText(messageText);\n builder.setPriority(NotificationCompat.PRIORITY_DEFAULT);\n builder.setContentIntent(pendingIntent);\n\n // Automatically configure a ChatMessageNotification Channel for devices running Android O+\n Pushy.setNotificationChannel(builder, context);\n\n // Get an instance of the NotificationManager service\n NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);\n\n // Build the notification and display it\n notificationManager.notify(1, builder.build());\n }\n }", "public void notify(String userId);", "public void processPingRequest(String clientID) {\n MQTTopics mqtTopics = topicSubscriptions.get(clientID);\n\n //This could be a publisher based topic subscription that processed the ping\n if (null != mqtTopics) {\n Set<Integer> unackedMessages = mqtTopics.getUnackedMessages(messageIdList);\n\n for (Integer messageID : unackedMessages) {\n MQTTSubscription subscription = mqtTopics.getSubscription(messageID);\n onMessageNack(messageID, subscription.getSubscriptionChannel());\n if(log.isDebugEnabled()){\n log.debug(\"Message null ack sent to message id \"+messageID);\n }\n }\n }\n\n }", "private void processCustomMessage(Context context, Bundle bundle) {\n//\t\tif (MainActivity.isForeground) {\n\t\t\tString message = bundle.getString(JPushInterface.EXTRA_MESSAGE);\n\t\t\tString extras = bundle.getString(JPushInterface.EXTRA_EXTRA);\n//\t\t\tIntent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);\n//\t\t\tmsgIntent.putExtra(MainActivity.KEY_MESSAGE, message);\n//\t\t\tif (!ExampleUtil.isEmpty(extras)) {\n\t\t\t\ttry {\n\t\t\t\t\tJSONObject extraJson = new JSONObject(extras);\n//\t\t\t\t\tif (extraJson.length() > 0) {\n//\t\t\t\t\t\tmsgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);\n//\t\t\t\t\t}\n\t\t\t\t} catch (JSONException e) {\n\n\t\t\t\t}\n\n//\t\t\t}\n//\t\t\tLocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);\n//\t\t}\n\t}", "public abstract void sendNotification(String sendFrom, List<Object> sendTo, String sendToProperty, NoticeTemplate noticeTemplate, Object noticeData);", "private void sendNotifications() {\n this.sendNotifications(null);\n }", "@Override\n public void onMessageReceived(RemoteMessage remoteMessage) {\n Log.d(TAG, \"From: \" + remoteMessage.getFrom());\n Log.d(TAG, \"Notification Message Body: \" + remoteMessage.getNotification().getBody());\n\n NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);\n mBuilder.setSmallIcon(R.drawable.logo);\n mBuilder.setContentTitle(remoteMessage.getNotification().getTitle());\n mBuilder.setContentText(remoteMessage.getNotification().getBody());\n\n NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);\n\n // notificationID allows you to update the notification later on.\n mNotificationManager.notify(14, mBuilder.build());\n }", "void notify(PushMessage m);", "protected abstract void sendMessage(UUID[] players, String[] messages, IntConsumer response);", "private void receiveAndDispatchMessage() {\n String response = null;\n try {\n while((response = bufferedReader.readLine()) != null) {\n System.out.println(\"received message from server: \" + response);\n String messageKind = \"\";\n if(response.contains(\":\")) {\n messageKind = response.substring(0, response.indexOf(\":\"));\n } else {\n messageKind = response;\n }\n Bundle bundle = new Bundle();\n bundle.putString(\"response\", response);\n switch (messageKind) {\n case ClientMessageKind.SIGNUPDENIED:\n case ClientMessageKind.SIGNUPOK:\n if(resultReceiverMap.keySet().contains(ActivityNames.COMMONSIGNUPACTIVITY)) {\n resultReceiverMap.get(ActivityNames.COMMONSIGNUPACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.SIGNINDENIED:\n case ClientMessageKind.SIGNINOK:\n if(resultReceiverMap.keySet().contains(ActivityNames.COMMONSIGNINACTIVITY)) {\n resultReceiverMap.get(ActivityNames.COMMONSIGNINACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.DRIVERLOC:\n if(resultReceiverMap.keySet().contains(ActivityNames.PASSENGERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.PASSENGERLOC:\n if(resultReceiverMap.keySet().contains(ActivityNames.DRIVERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.CHATFROMDRIVER:\n if(resultReceiverMap.keySet().contains(ActivityNames.PASSENGERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.CHATFROMPASSENGER:\n if(resultReceiverMap.keySet().contains(ActivityNames.DRIVERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.PASSENGERDEST:\n if(resultReceiverMap.containsKey(ActivityNames.DRIVERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.STARTRIDE:\n if(resultReceiverMap.containsKey(ActivityNames.PASSENGERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n } else if(resultReceiverMap.containsKey(ActivityNames.DRIVERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.ENDRIDE:\n if(resultReceiverMap.containsKey(ActivityNames.PASSENGERENDSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERENDSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.DRIVERCANCEL:\n if(resultReceiverMap.containsKey(ActivityNames.PASSENGERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.PASSENGERCANCEL:\n if(resultReceiverMap.containsKey(ActivityNames.DRIVERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.UPDATEPASSENGERPROFILEDENIED:\n case ClientMessageKind.UPDATEPASSENGERPROFILEOKAY:\n if(resultReceiverMap.containsKey(ActivityNames.PASSENGERUPDATEPROFILEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERUPDATEPROFILEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.UPDATEDRIVERPROFILEDENIED:\n case ClientMessageKind.UPDATEDRIVERPROFILEOKAY:\n if(resultReceiverMap.containsKey(ActivityNames.DRIVERUPDATEPROFILEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERUPDATEPROFILEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.DRIVERREQUESTLOC:\n if(resultReceiverMap.containsKey(ActivityNames.PASSENGERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.PASSENGERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n case ClientMessageKind.PASSENGERREQUESTLOC:\n if(resultReceiverMap.containsKey(ActivityNames.DRIVERSTARTSERVICEACTIVITY)) {\n resultReceiverMap.get(ActivityNames.DRIVERSTARTSERVICEACTIVITY).send(\n ResultCode.RESULTCODE,\n bundle\n );\n }\n break;\n default:\n break;\n }\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "@Override\n public void receivedSensor(SensorData sensor) {\n synchronized(_sensorListeners) {\n if (!_sensorListeners.containsKey(sensor.channel)) return;\n }\n \n try {\n // Construct message\n Response resp = new Response(UdpConstants.NO_TICKET, DUMMY_ADDRESS);\n resp.stream.writeUTF(UdpConstants.COMMAND.CMD_SEND_SENSOR.str);\n UdpConstants.writeSensorData(resp.stream, sensor);\n \n // Send to all listeners\n synchronized(_sensorListeners) {\n Map<SocketAddress, Integer> _listeners = _sensorListeners.get(sensor.channel);\n _udpServer.bcast(resp, _listeners.keySet());\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Failed to serialize sensor \" + sensor.channel);\n }\n }", "@Override\n\tpublic void pushMessage(NotificationAttentionMessageDTO notification, DeviceType deviceType) {\n\t\tswitch (deviceType) {\n\t\tcase ANDROID:\n\t\t\tsimpleMsgTemplate.convertAndSend(webSocketEndpointProperties.getFullPushAndroid(), notification);\n\t\t\tbreak;\n\t\tcase IOS:\n\t\t\tsimpleMsgTemplate.convertAndSend(webSocketEndpointProperties.getFullPushIOS(), notification);\n\t\t\tbreak;\n\t\t}\n\t}", "private void sendNotificationAPI26(RemoteMessage remoteMessage) {\n Map<String,String> data = remoteMessage.getData();\n String title = data.get(\"title\");\n String message = data.get(\"message\");\n\n //notification channel\n NotificationHelper helper;\n Notification.Builder builder;\n\n Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n helper = new NotificationHelper(this);\n builder = helper.getHawkerNotification(title,message,defaultSoundUri);\n\n helper.getManager().notify(new Random().nextInt(),builder.build());\n }", "@Override\n public void onReceive(Object msg) throws Exception {\n }", "@Override\n public void notifyUsers(String authorName, String messageContent) {\n if (!messageContent.equals(IChat.SEND_MESSAGE_COMMAND)) {\n Message message = new Message(authorName, messageContent);\n this.chatMessages.add(message);\n for (Socket socket : getChatUsers()) {\n try {\n PrintWriter messageOut = new PrintWriter(socket.getOutputStream(), true);\n messageOut.println(message.toString());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }" ]
[ "0.625814", "0.59923756", "0.5935336", "0.58732873", "0.5866304", "0.5864618", "0.58565974", "0.5829044", "0.5809247", "0.5803461", "0.5749803", "0.5746646", "0.57394207", "0.57371145", "0.5734778", "0.5719245", "0.5709673", "0.5701233", "0.56726086", "0.5671781", "0.5656573", "0.5625944", "0.5625552", "0.56209487", "0.5612151", "0.560249", "0.5591436", "0.55913514", "0.55808866", "0.55779725", "0.55585665", "0.5555194", "0.5540358", "0.55371803", "0.5533033", "0.55256987", "0.5515967", "0.55001897", "0.5499175", "0.54755193", "0.5475407", "0.5463193", "0.5439948", "0.54260397", "0.54206103", "0.5420422", "0.54183954", "0.5409534", "0.5404706", "0.53967124", "0.53937113", "0.53918266", "0.5391396", "0.53815347", "0.5381049", "0.5374272", "0.5361242", "0.53521323", "0.5349124", "0.5341994", "0.5337582", "0.53350294", "0.5334056", "0.53315485", "0.5315775", "0.5310181", "0.5300622", "0.52991015", "0.52849996", "0.5281952", "0.52803725", "0.5269769", "0.52691853", "0.5265653", "0.52521443", "0.5246911", "0.524163", "0.52397704", "0.52389055", "0.5235633", "0.52324575", "0.52316105", "0.5231523", "0.5227356", "0.52206516", "0.521275", "0.5204756", "0.5204272", "0.52032775", "0.52027786", "0.5200989", "0.51996887", "0.5198481", "0.51971805", "0.5189119", "0.51794237", "0.5177", "0.5167827", "0.5167078", "0.5166334" ]
0.5232158
81
This method serves to ensure that only the button at lowest possible location will be turned red/yellow
public int checkLowestPossible(int j, int m){ for(int i =5; i>=0; i--){ if(board[i][j]==0){ board[i][j] = m; return i; } } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void setButtonsColor(){\r\n for(MyButton b: mylist.getAllButtons()){\r\n if(!b.isChosen()){\r\n b.resetColor();\r\n }\r\n }\r\n \r\n for (MyButton b1: mylist.getAllButtons()){\r\n if(b1.isChosen()){\r\n for(MyButton b2 : mylist.getAllButtons()){\r\n if(!b1.equals(b2)){ \r\n if (b2.block.isSameType(b1.block)){ \r\n b2.setCannotBeChosen();\r\n }\r\n else if (!b2.isChosen() && b2.block.isAtSameTime(b1.block)){\r\n b2.setCannotBeChosen();\r\n }\r\n }\r\n }\r\n }\r\n } \r\n }", "public void solve(){\n\t\tfor(int i = 1; i < 26; i++){\n\t\t\tp.getButton(i).setBackground(Color.white);\n\t\t}\n\t}", "private void RedWin() {\n for (int row = 0; row < 8; row++) {\n for (int col = 0; col < 9; col++) {\n buttons[row][col].setClickable(false);\n }\n }\n redPoints++;\n Toast redWins = Toast.makeText(this, \"Red Wins!\", Toast.LENGTH_SHORT);\n redWins.setGravity(Gravity.TOP, 0, 200);\n redWins.show();\n updatePoints();\n reset();\n }", "public PJam_ColorGame() {\n initComponents();\n //Basic window formatting\n setLayout(null);\n setTitle(\"Color Game\");\n setPreferredSize(new Dimension(600, 400));\n setLocationRelativeTo(null);\n setDefaultCloseOperation(EXIT_ON_CLOSE);\n setResizable(false);\n \n //Label is given random color and random string\n buttonColor = colorArr[(int) (Math.random() * 5)];\n currentText = colorTxtArr[(int) (Math.random() * 5)];\n colorText.setForeground(buttonColor);\n colorText.setText(currentText);\n \n //Set highscore and rounds remaining label to base values\n highscoreLabel.setText(\"Highscore = \" + highscore);\n roundsLabel.setText(\"Rounds Remaining: \" + roundsRemaining);\n \n //Set up buttons to be at random locations\n //BLUE BUTTON location\n int blueLocationX = randomXLocations[(int) (Math.random() * xSize)];\n int blueLocationY = randomYLocations[(int) (Math.random() * ySize)];\n System.out.println(\"Blue X = \" + blueLocationX + \", Blue Y = \" + blueLocationY);\n chosenXLocations.add(blueLocationX);\n \n buttonBlue.setLocation(blueLocationX, blueLocationY);\n boolean added = false;\n //RED BUTTON location\n int redLocationX = randomXLocations[(int) (Math.random() * xSize)];\n \n //used to prevent overlap of other buttons\n while(!added) {\n if (chosenXLocations.contains(redLocationX)) {\n redLocationX = randomXLocations[(int) (Math.random() * xSize)];\n }\n else {\n chosenXLocations.add(redLocationX);\n added = true;\n }\n }\n \n int redLocationY = randomYLocations[(int) (Math.random() * ySize)];\n System.out.println(\"Red X = \" + redLocationX + \", Red Y = \" + redLocationY);\n \n buttonRed.setLocation(redLocationX, redLocationY);\n \n //YELLOW BUTTON location\n added = false;\n int yellowLocationX = randomXLocations[(int) (Math.random() * xSize)];\n //used to prevent overlap of other buttons \n while(!added) {\n if (chosenXLocations.contains(yellowLocationX)) {\n yellowLocationX = randomXLocations[(int) (Math.random() * xSize)];\n }\n else {\n chosenXLocations.add(yellowLocationX);\n added = true;\n }\n }\n int yellowLocationY = randomYLocations[(int) (Math.random() * ySize)];\n System.out.println(\"Yellow X = \" + yellowLocationX + \", Yellow Y = \" + yellowLocationY);\n \n buttonYellow.setLocation(yellowLocationX, yellowLocationY);\n \n \n //GREEN BUTTON location\n added = false;\n int greenLocationX = randomXLocations[(int) (Math.random() * xSize)];\n //used to prevent overlap of other buttons\n while(!added) {\n if (chosenXLocations.contains(greenLocationX)) {\n greenLocationX = randomXLocations[(int) (Math.random() * xSize)];\n }\n else {\n chosenXLocations.add(greenLocationX);\n added = true;\n }\n }\n int greenLocationY = randomYLocations[(int) (Math.random() * ySize)];\n System.out.println(\"Green X = \" + greenLocationX + \", Green Y = \" + greenLocationY);\n \n buttonGreen.setLocation(greenLocationX, greenLocationY);\n \n //PURPLE BUTTON location\n added = false;\n int purpleLocationX = randomXLocations[(int) (Math.random() * xSize)];\n //used to prevent overlap of other buttons\n while(!added) {\n if (chosenXLocations.contains(purpleLocationX)) {\n purpleLocationX = randomXLocations[(int) (Math.random() * xSize)];\n }\n else {\n chosenXLocations.add(purpleLocationX);\n added = true;\n }\n }\n int purpleLocationY = randomYLocations[(int) (Math.random() * ySize)];\n System.out.println(\"Purple X = \" + purpleLocationX + \", Purple Y = \" + purpleLocationY);\n \n buttonPurple.setLocation(purpleLocationX, purpleLocationY);\n //add to frame\n this.pack();\n startClock();\n }", "protected void drawPossibleMoves(){\n if (selectedPiece == null) return;\n Pair<Integer,Integer> coord = getJButtonCoord(selectedPiece);\n int startRow = coord.getKey();\n int startCol = coord.getValue();\n for(int row = 0;row < ROWS;row ++){\n for(int col = 0; col < COLS ;col++){\n if (board.canMove(startRow,startCol,row,col)){\n buttonGrid[row][col].setBackground(Color.GREEN);\n }\n }\n }\n\n\n }", "@Override\r\n\t\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\tString command =e.getActionCommand();\r\n\t\t\t\t\tJButton button =(JButton) e.getSource();\r\n\t\t\t\t\tif(command.equals(\"north\")) {\r\n\t\t\t\t\t\tbutton.setBackground(Color.gray);\r\n\t\t\t\t }\telse if (command.equals(\"south\")) {\r\n\t\t\t\t\t\tbutton.setBackground(Color.BLUE);\r\n\t\t\t\t\t}else if (command.equals(\"east\")) {\r\n\t\t\t\t\t\tbutton.setBackground(Color.yellow);\r\n\t\t\t\t\t}else if (command.equals(\"center\")) {\r\n\t\t\t\t\t\tJOptionPane.showMessageDialog(Myframe.this,\"aa,bb,cc\");\r\n\t\t\t\t\t}else if (command.equals(\"west\")) {\r\n\t\t\t\t\t\tbutton.setBackground(Color.PINK);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}", "void highlightCheckSquare(boolean highlight, Button button, int row, int column, CenterPiece piece);", "private void checkButton(ActionEvent e) {\n List<PuzzleButton> selectedButtons = buttons.stream()\n .filter(PuzzleButton::isSelectedButton)\n .collect(Collectors.toList());\n PuzzleButton currentButton = (PuzzleButton) e.getSource();// getting current button\n currentButton.setSelectedButton(true);\n int currentButtonIndex = buttons.indexOf(currentButton);\n //if no button are selected, do not update collection of PuzzleButton\n if (selectedButtons.size() == 1) {\n int lastClickedButtonIndex = 0;\n\n for (PuzzleButton button : buttons) {\n if (button.isSelectedButton() && !button.equals(currentButton)) {\n lastClickedButtonIndex = buttons.indexOf(button);\n }\n }\n Collections.swap(buttons, lastClickedButtonIndex, currentButtonIndex);\n updateButtons();\n }\n }", "public void highlight(){\n\t\tbutton.addActionListener(new ActionListener() {\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\n\t\t\t//if(!clicked){\t\n\t\t\t\t\n\t\t\t\tfirsttime=true;\n\t\t\t\tclicked=true;\n\t\t\t\tif(piece!=null){\n\t\t\t\t\txyMovment=piece.xyPossibleMovments(xPosition, yPosition);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t}", "public int checkMenuButtons() {\n\n // computing the coordinates of the cursor\n\n mouseX = (float) ((currentPos.x * 1.0f - window.getWidth() / 2f) / (window.getWidth() / 2f));\n mouseY = (float) ((currentPos.y * 1.0f - window.getHeight() / 2f) / (window.getHeight() / 2f));\n\n float checkX = ((2f - 0.4f * boxRatio) / 2) - 1;\n int checkButton = 0;\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > -0.24f && mouseY < -0.157f) {\n checkButton = 11;\n }\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > -0.24f && mouseY < -0.157f && isLeftButtonPressed()) {\n checkButton = 12;\n }\n\n\n // coordinates of the 2nd button\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > -0.098f && mouseY < -0.0098f) {\n checkButton = 21;\n }\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > -0.098f && mouseY < -0.0098f && isLeftButtonPressed()) {\n checkButton = 22;\n }\n\n\n // coordinates of the 3rd button\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > 0.05f && mouseY < 0.144f) {\n checkButton = 31;\n }\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > 0.05f && mouseY < 0.144f && isLeftButtonPressed()) {\n checkButton = 32;\n }\n\n // coordinates of the 1st button\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > 0.2f && mouseY < 0.29f) {\n checkButton = 41;\n }\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > 0.2f && mouseY < 0.29f && isLeftButtonPressed()) {\n checkButton = 42;\n }\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > 0.35f && mouseY < 0.44f) {\n checkButton = 51;\n }\n\n if (checkX < mouseX && mouseX < (checkX + 0.4f * boxRatio) && mouseY > 0.35f && mouseY < 0.44f && isLeftButtonPressed()) {\n checkButton = 52;\n }\n\n return checkButton;\n }", "private void lightAvailable(Cell myCell, Button myButton) {\n Platform.runLater(() -> {\n ArrayList<Cell> cells = new ArrayList<>();\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n bt[i][j].setDisable(true);\n }\n }\n int x = myCell.getX();\n int y = myCell.getY();\n myButton.setDisable(false);\n myButton.setStyle(\"-fx-border-color:red\");\n myButton.setDisable(true);\n for (int i = x - 1; i < x + 2; i++) {\n for (int j = y - 1; j < y + 2; j++) {\n //control if the cell exists\n if (((i != x) || (j != y)) && (i >= 0) && (i <= 4) && (j >= 0) && (j <= 4)) {\n //control there is not dome\n if ((!getTable().getTableCell(i, j).isComplete())) {\n //control there is not a pawn of my same team\n if (!((getTable().getTableCell(i, j).getPawn() != null) &&\n (getTable().getTableCell(i, j).getPawn().getIdGamer() == myCell.getPawn().getIdGamer()))) {\n cells.add(getTable().getTableCell(i, j));\n }\n }\n }\n }\n }\n if (getGod().getName().equalsIgnoreCase(\"zeus\") && effetto && currentMove.getAction() == Mossa.Action.BUILD) {\n myButton.setStyle(\"-fx-border-color:blue\");\n myButton.setDisable(false);\n myButton.setOnMouseEntered(e -> {\n Button button;\n button = (Button) e.getSource();\n button.setStyle(\"-fx-border-color:yellow\");\n });\n myButton.setOnMouseExited(e -> {\n Button button;\n button = (Button) e.getSource();\n button.setStyle(\"-fx-border-color:blue\");\n });\n } else {\n for (Cell lightMe : cells) {\n\n bt[lightMe.getX()][lightMe.getY()].setDisable(false);\n bt[lightMe.getX()][lightMe.getY()].setStyle(\"-fx-border-color:yellow\");\n int a = lightMe.getX();\n int b = lightMe.getY();\n initButtons();\n bt[a][b].setOnAction(e -> {\n for (int c = 0; c < 5; c++) {\n for (int d = 0; d < 5; d++) {\n bt[c][d].setStyle(\"-fx-border-color:trasparent\");\n initButtons();\n }\n }\n Button button;\n button = (Button) e.getSource();\n button.setStyle(\"-fx-border-color:red\");\n button.setOnMouseClicked(null);\n button.setOnMouseEntered(null);\n button.setOnMouseExited(null);\n int x1 = GridPane.getRowIndex(button);\n int y1 = GridPane.getColumnIndex(button);\n aggiornaMossa(table.getTableCell(x1, y1));\n Platform.runLater(() -> {\n submitAction.setDisable(false);\n });\n });\n\n }\n }\n });\n }", "private boolean checkColor(boolean walkingHere) {\n\t\tint x = getMouse().getPosition().x,\n\t\t\ty = getMouse().getPosition().y + 1,\n\t\t\ti = 0;\n\t\t\n\t\tdo {\n\t\t\tsleep(10);\n\t\t\tc = getColorPicker().colorAt(x, y);\n\t\t\tif (c.getRed() == 255 && c.getGreen() == 0 && c.getBlue() == 0) {\n\t\t\t\tdebug(\"Interact color check: \"+(walkingHere ? \"failure\" : \"success\")+\" (red)!\");\n\t\t\t\treturn walkingHere ? false : true;\n\t\t\t}\n\t\t\tif (c.getRed() == 255 && c.getGreen() == 255 && c.getBlue() == 0) {\n\t\t\t\twarning(\"Interact color check: \"+(!walkingHere ? \"failure\" : \"success\")+\" (yellow)!\");\n\t\t\t\treturn walkingHere ? true : false;\n\t\t\t}\n\t\t} while (i++ < 50);\n\t\t\n\t\t// Default to true, as no color we want was found!\n\t\twarning(\"Interact color check: defaulted\");\n\t\treturn true;\n\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tJButton btn = (JButton)e.getSource();\n\t\t\t\tString num = btn.getText();\n\t\t\t\t\n\t\t\t\t//check if pressed btn is orange\n\t\t\t\tif(btn.getBackground()!=Color.orange){\n\t\t\t\t\ttfNums[numIndex].setText(num);\n\t\t\t\t\tbtn.setBackground(Color.orange);\n\t\t\t\t\t\n\t\t\t\t\tif(enteredNums[numIndex]!=null){\n\t\t\t\t\t\tbtns[enteredNums[numIndex]-1].setBackground(Color.white);\n\t\t\t\t\t}\n\t\t\t\t\tenteredNums[numIndex]=Integer.parseInt(num);\n\t\t\t\t\t\n\t\t\t\t\tif(numIndex==5){\n\t\t\t\t\t\tnumIndex=0;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tnumIndex++;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t//cancel num\n\t\t\t\t\tbtn.setBackground(Color.white);\n\t\t\t\t\tfor(JTextField tf : tfNums){\n\t\t\t\t\t\tif(tf.getText().equals(num)){\n\t\t\t\t\t\t\ttf.setText(\"\");\n\t\t\t\t\t\t\ttf.setBackground(Color.white);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tpublic void mouseClicked(MouseEvent e) {\r\n\t\tSystem.out.println(e.getX()/100 + \", \" + e.getY()/100);\r\n\t\tif (board[e.getX()/100][e.getY()/100].equals(Color.blue)) {\r\n\t\t\tif (turn%2 == 0) {\r\n\t\t\t\tboard[e.getX()/100][e.getY()/100] = Color.yellow;\r\n\t\t\t} else {\r\n\t\t\t\tboard[e.getX()/100][e.getY()/100] = Color.red;\r\n\t\t\t}\r\n\t\t\tturn++;\r\n\t\t\t\r\n\t\t\t//win condition\r\n\t\t\tif(board[0][0] == Color.yellow && board[0][1] == Color.yellow && board[0][2] == Color.yellow && board[0][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[1][0] == Color.yellow && board[1][1] == Color.yellow && board[1][2] == Color.yellow && board[1][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[2][0] == Color.yellow && board[2][1] == Color.yellow && board[2][2] == Color.yellow && board[2][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.yellow && board[1][0] == Color.yellow && board[2][0] == Color.yellow && board[3][0] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][1] == Color.yellow && board[1][1] == Color.yellow && board[2][1] == Color.yellow && board[3][1] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][2] == Color.yellow && board[1][2] == Color.yellow && board[2][2] == Color.yellow && board[3][2] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.yellow && board[1][1] == Color.yellow && board[2][2] == Color.yellow && board[3][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[3][0] == Color.yellow && board[1][2] == Color.yellow && board[2][1] == Color.yellow && board[0][3] == Color.yellow){\r\n\t\t\t\tboard[0][0] = Color.yellow;\r\n\t\t\t\tboard[0][1] = Color.yellow;\r\n\t\t\t\tboard[0][2] = Color.yellow;\r\n\t\t\t\tboard[0][3] = Color.yellow;\r\n\t\t\t\tboard[1][0] = Color.yellow;\r\n\t\t\t\tboard[1][1] = Color.yellow;\r\n\t\t\t\tboard[1][2] = Color.yellow;\r\n\t\t\t\tboard[1][3] = Color.yellow;\r\n\t\t\t\tboard[2][0] = Color.yellow;\r\n\t\t\t\tboard[2][1] = Color.yellow;\r\n\t\t\t\tboard[2][2] = Color.yellow;\r\n\t\t\t\tboard[2][3] = Color.yellow;\r\n\t\t\t\tboard[3][0] = Color.yellow;\r\n\t\t\t\tboard[3][1] = Color.yellow;\r\n\t\t\t\tboard[3][2] = Color.yellow;\r\n\t\t\t\tboard[3][3] = Color.yellow;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.red && board[0][1] == Color.red && board[0][2] == Color.red && board[0][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[1][0] == Color.red && board[1][1] == Color.red && board[1][2] == Color.red && board[1][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[2][0] == Color.red && board[2][1] == Color.red && board[2][2] == Color.red && board[2][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.red && board[1][0] == Color.red && board[2][0] == Color.red && board[3][0] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][1] == Color.red && board[1][1] == Color.red && board[2][1] == Color.red && board[3][1] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][2] == Color.red && board[1][2] == Color.red && board[2][2] == Color.red && board[3][2] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[0][0] == Color.red && board[1][1] == Color.red && board[2][2] == Color.red && board[3][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(board[3][0] == Color.red && board[1][2] == Color.red && board[2][1] == Color.red && board[0][3] == Color.red){\r\n\t\t\t\tboard[0][0] = Color.red;\r\n\t\t\t\tboard[0][1] = Color.red;\r\n\t\t\t\tboard[0][2] = Color.red;\r\n\t\t\t\tboard[0][3] = Color.red;\r\n\t\t\t\tboard[1][0] = Color.red;\r\n\t\t\t\tboard[1][1] = Color.red;\r\n\t\t\t\tboard[1][2] = Color.red;\r\n\t\t\t\tboard[1][3] = Color.red;\r\n\t\t\t\tboard[2][0] = Color.red;\r\n\t\t\t\tboard[2][1] = Color.red;\r\n\t\t\t\tboard[2][2] = Color.red;\r\n\t\t\t\tboard[2][3] = Color.red;\r\n\t\t\t\tboard[3][0] = Color.red;\r\n\t\t\t\tboard[3][1] = Color.red;\r\n\t\t\t\tboard[3][2] = Color.red;\r\n\t\t\t\tboard[3][3] = Color.red;\r\n\t\t\t}\r\n\t\t\trepaint();\r\n\t\t}\r\n\t}", "private void createBottomButtons() {\n // Create a composite that will contain the control buttons.\n Composite bottonBtnComposite = new Composite(shell, SWT.NONE);\n GridLayout gl = new GridLayout(3, true);\n gl.horizontalSpacing = 10;\n bottonBtnComposite.setLayout(gl);\n GridData gd = new GridData(GridData.FILL_HORIZONTAL);\n bottonBtnComposite.setLayoutData(gd);\n\n // Create the Interpolate button.\n gd = new GridData(GridData.FILL_HORIZONTAL);\n interpolateBtn = new Button(bottonBtnComposite, SWT.PUSH);\n interpolateBtn.setText(\"Interpolate\");\n interpolateBtn.setLayoutData(gd);\n interpolateBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n ColorData upperColorData = upperColorWheel.getColorData();\n ColorData lowerColorData = lowerColorWheel.getColorData();\n\n colorBar.interpolate(upperColorData, lowerColorData, rgbRdo\n .getSelection());\n undoBtn.setEnabled(true);\n updateColorMap();\n }\n });\n\n // Create the Undo button.\n gd = new GridData(GridData.FILL_HORIZONTAL);\n undoBtn = new Button(bottonBtnComposite, SWT.PUSH);\n undoBtn.setText(\"Undo\");\n undoBtn.setEnabled(false);\n undoBtn.setLayoutData(gd);\n undoBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n undoBtn.setEnabled(colorBar.undoColorBar());\n updateColorMap();\n redoBtn.setEnabled(true);\n }\n });\n\n // Create the Redo button.\n gd = new GridData(GridData.FILL_HORIZONTAL);\n redoBtn = new Button(bottonBtnComposite, SWT.PUSH);\n redoBtn.setText(\"Redo\");\n redoBtn.setEnabled(false);\n redoBtn.setLayoutData(gd);\n redoBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n redoBtn.setEnabled(colorBar.redoColorBar());\n updateColorMap();\n undoBtn.setEnabled(true);\n }\n });\n\n // Create the Revert button.\n gd = new GridData(GridData.FILL_HORIZONTAL);\n revertBtn = new Button(bottonBtnComposite, SWT.PUSH);\n revertBtn.setText(\"Revert\");\n revertBtn.setLayoutData(gd);\n revertBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n colorBar.revertColorBar();\n updateColorMap();\n undoBtn.setEnabled(false);\n redoBtn.setEnabled(false);\n }\n });\n\n // Create the Save button.\n gd = new GridData(GridData.FILL_HORIZONTAL);\n saveBtn = new Button(bottonBtnComposite, SWT.PUSH);\n saveBtn.setText(\"Save\");\n saveBtn.setLayoutData(gd);\n if( seldCmapName == null ) {\n saveBtn.setEnabled(false);\n }\n \n saveBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n ColorMap cm = (ColorMap) cmapParams.getColorMap();\n seldCmapName = selCmapCombo.getText();\n \n// int sepIndx = seldCmapName.indexOf(File.separator);\n// String cmapCat = seldCmapName.substring(0,seldCmapName.indexOf(File.separator));\n// String cmapName = seldCmapName.substring( seldCmapName.indexOf(File.separator));\n if (lockedCmaps != null && lockedCmaps.isLocked(seldCmapName)) {\n \tMessageDialog confirmDlg = new MessageDialog( \n \t\t\tNcDisplayMngr.getCaveShell(), \n \t\t\t\"Save Colormap\", null, \n \t\t\t\"Colormap \" +seldCmapCat+File.separator +seldCmapName + \n \t\t\t\" already exists and is locked.\\n\\n\" +\n \t\t\t\"You cannot overwrite it.\",\n \t\t\tMessageDialog.INFORMATION, new String[]{\"OK\"}, 0);\n \tconfirmDlg.open();\n \tcolorBar.undoColorBar();\n updateColorMap();\n \treturn;\n } \n else if( ColorMapUtil.colorMapExists( seldCmapCat, seldCmapName ) ) {\n \tMessageDialog confirmDlg = new MessageDialog( \n \t\t\tNcDisplayMngr.getCaveShell(), \n \t\t\t\"Save Colormap\", null, \n \t\t\t\"Colormap \" +seldCmapCat+File.separator +seldCmapName + \n \t\t\t\" already exists.\\n\\n\" +\n \t\t\t\"Do you want to overwrite it?\",\n \t\t\tMessageDialog.QUESTION, new String[]{\"Yes\", \"No\"}, 0);\n \tconfirmDlg.open();\n\n \tif( confirmDlg.getReturnCode() == MessageDialog.CANCEL ) {\n \t\treturn;\n \t}\n }\n\n try {\n ColorMapUtil.saveColorMap( cm, seldCmapCat, seldCmapName );\n \n MessageDialog msgDlg = new MessageDialog( \n \t\t\tNcDisplayMngr.getCaveShell(), \n \t\t\t\"Colormap Saved\", null, \n \t\t\t\"Colormap \" +seldCmapCat+File.separator +seldCmapName + \n \t\t\t\" Saved.\",\n \t\t\tMessageDialog.INFORMATION, new String[]{\"OK\"}, 0);\n \tmsgDlg.open();\n } catch (VizException e) {\n MessageDialog msgDlg = new MessageDialog( \n \t\t\tNcDisplayMngr.getCaveShell(), \n \t\t\t\"Error\", null, \n \t\t\t\"Error Saving Colormap \" +seldCmapCat+File.separator +seldCmapName + \n \t\t\t\"\\n\"+e.getMessage(),\n \t\t\tMessageDialog.ERROR, new String[]{\"OK\"}, 0);\n \tmsgDlg.open();\n }\n\n completeSave();\n }\n });\n\n\n // \n // Create the Delete button.\n gd = new GridData(GridData.FILL_HORIZONTAL);\n gd.grabExcessHorizontalSpace = false;\n deleteBtn = new Button(bottonBtnComposite, SWT.PUSH);\n deleteBtn.setText(\"Delete\");\n deleteBtn.setLayoutData(gd);\n deleteBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n \tdeleteColormap();\n }\n });\n Label sep = new Label(shell, SWT.SEPARATOR|SWT.HORIZONTAL);\n gd = new GridData(GridData.FILL_HORIZONTAL);\n sep.setLayoutData(gd);\n\n // \n // Create the Delete button.\n gd = new GridData(GridData.HORIZONTAL_ALIGN_END);\n Button closeBtn = new Button(shell, SWT.PUSH);\n closeBtn.setText(\" Close \");\n closeBtn.setLayoutData(gd);\n closeBtn.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent event) {\n \tshell.dispose();\n }\n });\n }", "@Override\r\n public void actionPerformed(ActionEvent event) {\r\n if (event.getSource() == redInput ||\r\n event.getSource() == greenInput ||\r\n event.getSource() == blueInput) {\r\n int value;\r\n int red = currentColor.getRed();\r\n int green = currentColor.getGreen();\r\n int blue = currentColor.getBlue();\r\n try {\r\n value = Integer.parseInt((String) event.getActionCommand());\r\n } catch (Exception e) {\r\n value = -1;\r\n }\r\n if (event.getSource() == redInput) {\r\n if (value >= 0 && value < 256)\r\n red = value;\r\n else\r\n redInput.setText(String.valueOf(red));\r\n } else if (event.getSource() == greenInput) {\r\n if (value >= 0 && value < 256)\r\n green = value;\r\n else\r\n greenInput.setText(String.valueOf(green));\r\n } else if (event.getSource() == blueInput) {\r\n if (value >= 0 && value < 256)\r\n blue = value;\r\n else\r\n blueInput.setText(String.valueOf(blue));\r\n }\r\n currentColor = new Color(red, green, blue);\r\n newSwatch.setForeground(currentColor);\r\n colorCanvas.setColor(currentColor);\r\n } else if (event.getSource() == okButton) {\r\n // Send action event to all color listeners\r\n if (colorListeners != null) {\r\n ActionEvent new_event = new ActionEvent(this,\r\n ActionEvent.ACTION_PERFORMED,\r\n CHANGE_ACTION);\r\n colorListeners.actionPerformed(new_event);\r\n }\r\n setVisible(false);\r\n } else if (event.getSource() == cancelButton) {\r\n if (colorListeners != null) {\r\n ActionEvent new_event = new ActionEvent(this,\r\n ActionEvent.ACTION_PERFORMED,\r\n CANCEL_ACTION);\r\n colorListeners.actionPerformed(new_event);\r\n }\r\n currentColor = null;\r\n setVisible(false);\r\n }\r\n }", "void highlightSquare(boolean highlight, Button button, int row, int column, ChessPiece piece);", "@Override\n public void actionPerformed(ActionEvent e) {\n\n btnAdicionar.setBackground(new Color(176, 196, 222));\n btnCalcular.setBackground(new Color(176, 196, 222));\n btnLimpar.setBackground(new Color(176, 196, 222));\n btnRemover.setBackground(new Color(176, 196, 222));\n }", "public void changeColourButton(Color color) {\n //goes through to each button\n for (int i = 0; i < 7; i++) {\n Inputbuttons[i].setForeground(color);\n }\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tlp.drawColor = Color.RED;\n\t\t\t}", "private void revalidateColorPanel() {\n colorPickerCurrent.setValue(colorsQueue.getFirst());\n buttonRecentFirst.setBackground(new Background(new BackgroundFill(colorsQueue.get(1), null, null)));\n buttonRecentSecond.setBackground(new Background(new BackgroundFill(colorsQueue.get(2), null, null)));\n buttonRecentThird.setBackground(new Background(new BackgroundFill(colorsQueue.get(3), null, null)));\n buttonRecentFourth.setBackground(new Background(new BackgroundFill(colorsQueue.get(4), null, null)));\n buttonRecentFifth.setBackground(new Background(new BackgroundFill(colorsQueue.get(5), null, null)));\n }", "public void actionPerformed(ActionEvent e) \n {\n JFrame dialogBox;\n \n // Use a nested for loop to loop through the buttons and find which\n // one was clicked.\n for (int row = 0; row < 15; row++) \n {\n for (int col = 0; col < 15; col++) \n {\n // If the button is valid, continue, otherwise, show an error.\n if (_self[row][col] == e.getSource() && \n _self[row][col].getBackground() == Color.WHITE)\n {\n dialogBox = new JFrame();\n \n // Display a coordinate message.\n JOptionPane.showMessageDialog(dialogBox, \n \"Coordinates: \" + row + \", \" + col, \n \"Button Coordinates\", JOptionPane.INFORMATION_MESSAGE);\n \n // Needs to know which player to use, we also need to change the color of the selected cell based off of response\n boolean result = _currentPlayer.takeATurn(row, col); //0 for miss 1 for hit? \n \n // KIRSTEN/NOAH HERE, Using currentPlayer, call function in Player that sets the status of color grid in the Grid class if takeATurn returns as a hit\n // Then Based on that color setbackground to Red if its a hit\n \n //works if current player is initialized \n _currentPlayer.setColorGrid(row, col, result ? Color.ORANGE : Color.WHITE);\n \n _buttonGrid[row][col].setBackground(result ? Color.ORANGE : Color.WHITE);\n \n // changeGridColor(row, col, result);\n // switchPlayer();\n }\n \n else if (_self[row][col] == e.getSource() && \n _self[row][col].getBackground() == Color.WHITE)\n {\n dialogBox = new JFrame();\n \n // Display an error message.\n JOptionPane.showMessageDialog(dialogBox, \n \"Button already chosen\", \"Invalid Button\", \n JOptionPane.ERROR_MESSAGE);\n }\n }\n }\n }", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\n\t\tif (e.getSource() == b1) {\n\n\t\t\tJOptionPane.showMessageDialog(null, \"why did the chicken cross the road?\");\n\t\t\tb2.setEnabled(true);\n\t\t\tb1.setOpaque(false);\n\t\t\tb2.setBackground(Color.GREEN);\n\t\t\t\n\t\t\t\n\t\t} else if (e.getSource() == b2) {\n\t\t\t\n\t\t\tJOptionPane.showMessageDialog(null, \"to get to the other side\");\n\t\t\tb2.setOpaque(false);\n\t\t\t\n\t\t}\n\t}", "public void mouseClicked(MouseEvent e) {\n \t Color current = model.getColor();\r\n \t //this will be better as a separate function but later\r\n \t if (current==Color.red){ //if red\r\n \t\t model.setColor(Color.blue);\r\n \t }\r\n \t else if (current==Color.blue){\r\n \t\t model.setColor(Color.green);\r\n \t }\r\n \t else if (current==Color.green) {\r\n \t\t model.setColor(Color.white);\r\n \t }\r\n \t else{ //anything but red or blue or green\r\n \t\t model.setColor(Color.red);\r\n \t }\r\n \t view.resetView(model);\r\n \t view.updateSquare();\r\n }", "private void initializeSetColorButton() {\n\n setColorTextLabel = new JLabel(\"Set New Color\");\n setColorTextLabel.setBounds(250, 250,150, 25);\n setColorTextLabel.setFont(new Font(\"Arial\", Font.PLAIN, 20));\n this.add(setColorTextLabel);\n\n greenButton = new JButton();\n greenButton.setBackground(java.awt.Color.green);\n greenButton.setBounds(400, 250, 60, 25);\n this.add(greenButton);\n\n redButton = new JButton();\n redButton.setBackground(java.awt.Color.red);\n redButton.setBounds(460, 250, 60, 25);\n this.add(redButton);\n\n yellowButton = new JButton();\n yellowButton.setBackground(java.awt.Color.yellow);\n yellowButton.setBounds(520, 250, 60, 25);\n this.add(yellowButton);\n\n blueButton = new JButton();\n blueButton.setBackground(java.awt.Color.blue);\n blueButton.setBounds(580, 250, 60, 25);\n this.add(blueButton);\n\n setColorTextLabel.setVisible(false);\n greenButton.setVisible(false);\n blueButton.setVisible(false);\n redButton.setVisible(false);\n yellowButton.setVisible(false);\n }", "@Override\r\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tif(e.getSource()==but1)\r\n\t\t\tpanel.setBackground(Color.YELLOW);\r\n\t\telse if(e.getSource()==but2)\r\n\t\t\tpanel.setBackground(Color.BLUE);\r\n\t}", "public void onRowMajorFillButtonClick()\n {\n for ( int row = 0; row < theGrid.numRows(); row++ )\n {\n for ( int column = 0; column < theGrid.numCols(); column++ )\n {\n placeColorBlock(row, column);\n }\n }\n }", "@Override\n\t\t\tpublic void mousePressed(MouseEvent e) {\n\t\t\t\tActionCell.this.setBackground(new Color(.35f, .58f, .92f));\n\t\t\t}", "@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tsetBackground(color);\t\r\n\t\t\t\tvazioSouth.setBackground(color);\r\n\t\t\t\tvazioEast.setBackground(color);\r\n\t\t\t\tbtsPaintJPanel.setBackground(color);\r\n\t\t\t\tbotaoJPanel.setBackground(color);\r\n\t\t\t}", "@Override\r\n public void mousePressed(MouseEvent e) {\n setBackground(Color.BLUE);\r\n \r\n \r\n }", "private void checkColors(){\r\n\t\tpaintCorner(RED);\r\n\t\tif(leftIsClear()){\r\n\t\t\tturnLeft();\r\n\t\t\tmove();\r\n\t\t\tif(cornerColorIs(null)){\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnLeft();\r\n\t\t\t\tpaintCorner(GREEN);\r\n\t\t\t}else{\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnLeft();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(rightIsClear()){\r\n\t\t\tturnRight();\r\n\t\t\tmove();\r\n\t\t\tif(cornerColorIs(null)){\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnRight();\r\n\t\t\t\tpaintCorner(GREEN);\r\n\t\t\t}else{\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnRight();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(frontIsClear()){\r\n\t\t\tmove();\r\n\t\t\tif(cornerColorIs(null)) {\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tpaintCorner(GREEN);\r\n\t\t\t\tturnAround();\r\n\t\t\t}else{\r\n\t\t\t\tmoveBack();\r\n\t\t\t\tturnAround();\r\n\t\t\t}\r\n\t\t}\r\n\t\tmakeMove();\r\n\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tlp.drawColor = Color.BLACK;\n\t\t\t}", "public static void GameOverEffect(ArrayList<JButton> myGameButton){\n enableButtons(myGameButton);\n for(int i=0; i<myGameButton.size(); ++i){\n myGameButton.get(i).setBackground(Color.red); // set buttons back-ground color\n myGameButton.get(i).setForeground(Color.white); // set buttons fore-ground color\n } \n }", "@Override\r\n\t\tpublic void stateChanged(ChangeEvent e) {\n\t\t\tif(bBrushSizeMode){\r\n\t\t\t\tboolean bAllOff = true;\r\n\t\t\t\tfor(AbstractButton jButton:jButtons){\r\n\t\t\t\t\tif(jButton.isSelected()){\r\n\t\t\t\t\t\tbAllOff = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(bAllOff){\r\n\t\t\t\t\tbBrushSizeMode = false;\r\n\t\t\t\t\tif(cursorChanger != null){\r\n\t\t\t\t\t\tcursorChanger.changeCursors();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "public void buttonPressed(){\r\n\t\tsetBorder(new BevelBorder(10));\r\n\t}", "public static void turnButtonVisible(Labeled button){\n button.setStyle(\"-fx-background-color:#FFFFFF\"); //turn button white\n button.setTextFill(black); //turn text black\n }", "@SuppressLint(\"NewApi\")\n\tprivate void ResetBoard() {\n\t\tButton btnBottom_left = (Button) findViewById(R.id.btnBottom_left);\n\t\tButton btnBottom_center = (Button) findViewById(R.id.btnBottom_center);\n\t\tButton btnBottom_right = (Button) findViewById(R.id.btnBottom_right);\n\t\tButton btnTop_left = (Button) findViewById(R.id.btnTop_left);\n\t\tButton btnTop_center = (Button) findViewById(R.id.btnTop_center);\n\t\tButton btnTop_right = (Button) findViewById(R.id.btnTop_right);\n\t\tButton btnCenter_left = (Button) findViewById(R.id.btnCenter_left);\n\t\tButton btnCenter_center = (Button) findViewById(R.id.btnCenter_center);\n\t\tButton btnCenter_right = (Button) findViewById(R.id.btnCenter_right);\n\t\t\n\t\tbtnBottom_left.setEnabled(true);\n\t\tbtnBottom_left.setVisibility(View.VISIBLE);\n\t\tbtnBottom_left.setBackground(null);\n\t\t\n\t\tbtnBottom_center.setEnabled(true);\n\t\tbtnBottom_center.setVisibility(View.VISIBLE);\n\t\tbtnBottom_center.setBackground(null);\n\t\t\n\t\tbtnBottom_right.setEnabled(true);\n\t\tbtnBottom_right.setVisibility(View.VISIBLE);\n\t\tbtnBottom_right.setBackground(null);\n\t\t\n\t\tbtnTop_left.setEnabled(true);\n\t\tbtnTop_left.setVisibility(View.VISIBLE);\n\t\tbtnTop_left.setBackground(null);\n\t\t\n\t\tbtnTop_center.setEnabled(true);\n\t\tbtnTop_center.setVisibility(View.VISIBLE);\n\t\tbtnTop_center.setBackground(null);\n\t\t\n\t\tbtnTop_right.setEnabled(true);\n\t\tbtnTop_right.setVisibility(View.VISIBLE);\n\t\tbtnTop_right.setBackground(null);\n\t\t\n\t\tbtnCenter_left.setEnabled(true);\n\t\tbtnCenter_left.setVisibility(View.VISIBLE);\n\t\tbtnCenter_left.setBackground(null);\n\t\t\n\t\tbtnCenter_center.setEnabled(true);\n\t\tbtnCenter_center.setVisibility(View.VISIBLE);\n\t\tbtnCenter_center.setBackground(null);\n\t\t\n\t\tbtnCenter_right.setEnabled(true);\n\t\tbtnCenter_right.setVisibility(View.VISIBLE);\n\t\tbtnCenter_right.setBackground(null);\n\t\t\n\t\tfor(int i = 0;i<9;i++){\n\t\t\tgameBoard[i]=0;\n\t\t\tsquare_empty[i]= true;\n\t\t}\n\t}", "@Override\n\t\t\t\t\t\tpublic void onClick(DialogInterface dialog, int which) {\n\t\t\t\t\t\t\tswitch (which) {\n\t\t\t\t\t\t\tcase 0:cz1.setcolor(0);break;\n\t\t\t\t\t\t\tcase 1:cz1.setcolor(1);break;\n case 2:cz1.setcolor(2);break;\n case 3:cz1.setcolor(3);break;\n case 4:cz1.setcolor(4);break;\n case 5:cz1.setcolor(5);break;\n default:\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "void changeResumeButtonColor(Color color);", "public void actionPerformed(ActionEvent e) {\n float zufall = (float) Math.random(); \n Color grauton = new Color(zufall,zufall,zufall);\n c.setBackground(grauton); // Zugriff auf c moeglich, da\n }", "@Override\n public void touchAction() {\n if (!isDisabled()) {\n if (colorAction != null)\n opponentLabel.removeAction(colorAction);\n colorAction = MyActions.getTouchAction(LightBlocksGame.COLOR_FOCUSSED_ACTOR, getColor());\n opponentLabel.addAction(colorAction);\n }\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tlp.drawColor = Color.BLUE;\n\t\t\t}", "@Override\r\n\t\tpublic void actionPerformed(ActionEvent actionevent)\r\n\t\t{\n\t\t\tColor c = (Color) getValue( \"Color\" );\r\n\t\t\tsetBackground( c );\r\n\t\t}", "private void buttonRedMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_buttonRedMouseEntered\n buttonRed.setBackground(new Color(255, 100, 100));\n repaint();\n }", "@Override\n public void onClick(View V){\n int r = 0; int c = 0;\n boolean broke = false;\n //finds the coordinates of the button that was clicked\n for(; r < 4; r++){\n for(c = 0; c < 4; c++){\n if(V.getId() == grid.getIDAt(r, c)) {\n broke = true;\n break;\n }\n }\n if(broke)\n break;\n }\n if(!broke)\n return;\n broke = false;\n int rBlank = 0;\n int cBlank = 0;\n //checks to see if the move is legal, and performs it if it is\n for(; rBlank < 4; rBlank++){\n for(cBlank = 0; cBlank < 4; cBlank++){\n if(grid.getButtonAt(rBlank, cBlank).getText() == \"\") {\n broke = true;\n if((r == rBlank && c == cBlank+1) || (r == rBlank && c == cBlank-1)\n || (r == rBlank+1 && c == cBlank) || (r == rBlank-1 && c == cBlank)){\n CharSequence tmp = grid.getButtonAt(r, c).getText();\n grid.getButtonAt(r, c).setText(grid.getButtonAt(rBlank, cBlank).getText());\n grid.getButtonAt(rBlank, cBlank).setText(tmp);\n }\n break;\n }\n }\n if(broke)\n break;\n }\n solved = grid.checkCorrect(correct);\n }", "private void resetButton() {\n for(int x=0;x<buttons.size();x++) {\n if(buttons.get(x).isOpaque())\n buttons.get(x).setOpaque(false);\n }\n }", "@Override\n public void update(Integer pushValue) {\n List cells = gridPane.getChildren();\n if (orientation.equals(\"HORIZONTAL\")){\n Button button = (Button) cells.get(10*row + column + pushValue);\n button.setStyle(\"-fx-background-color: #ff0000\");\n System.out.println(\"HIT\");\n }\n if (orientation.equals(\"VERTICAL\")){\n Button button = (Button) cells.get(10*(row + pushValue) + column);\n button.setStyle(\"-fx-background-color: #ff0000\");\n System.out.println(\"HIT\");\n }\n }", "private void triggerB1ChangeButton(JButton button) {\n if (!Objects.equals(button, previousB1Button)) {\n previousB1Button.setBackground(MOUSE_B1_EXITED_COLOR);\n previousB1Button.setForeground(BUTTON_B1_DEFAULT_COLOR);\n }\n }", "public void highlightButton(ImageButton imageButtonClicked) {\n imageButtonClicked.setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);\n\n if (buttonNemo(imageButtonClicked))\n AppController.getInstance().setCover(1);\n else if (buttonPets(imageButtonClicked))\n AppController.getInstance().setCover(0);\n }", "@Override\r\npublic void mouseClicked(MouseEvent e) {\n\t\r\n\tb1.setBackground(Color.pink);\r\n\t\r\n}", "private void setPressedStyle() {\n this.setStyle(BUTTON_PRESSED);\n this.setPrefHeight(43);\n this.setLayoutY(getLayoutY() + 4);\n }", "private void notifyForbiddenTile(){\n\t\t\tJPanel pnl = EditorGUI.current;\n\t\t\tColor oldColor = pnl.getBackground();\n\t\t\t\n\t\t\tpnl.setBackground(new Color(240,125,125));\n\t\t\tnew Timer(delay, new ActionListener() {\t\n\t\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\tpnl.setBackground(oldColor);\n\t\t\t\t\t((Timer) e.getSource()).stop();\n\t\t\t\t}\n\t\t\t}).start();\n\t\t}", "private void changeButtonBackground(final int row, final int col, final boolean mode){\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n if(mode)\n buttons[row][col].setBackground(new BitmapDrawable(getResources(), buttons[row][col].getBitmap()));\n\n else{\n buttons[row][col].setBackgroundResource(android.R.drawable.btn_default);\n }\n }\n });\n }", "public void actionPerformed(ActionEvent e)\n {\n//this is called when an action event occurs\n\n\n String cmd = e.getActionCommand();\n if (cmd.equals(\"Red\"))\n c.setBackground(Color.red);\n if (cmd.equals(\"Blue\"))\n c.setBackground(Color.blue);\n }", "private void updateBtnMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_updateBtnMousePressed\n updateBtn.setBackground(Color.decode(\"#1e5837\"));\n }", "private void buttonClicked(int c){\r\n boardRep[currentFilled[c]][c] = blackToPlay ? 1:-1; //adjust board rep\r\n if (blackToPlay){\r\n boardSquares[5-currentFilled[c]][c].setBackground(Color.BLACK);\r\n for (int i = 0; i < 7; i++) {\r\n moveSelect[i].setBackground(Color.RED);\r\n }\r\n int y = 5-currentFilled[c];\r\n \r\n \r\n for (int i = 0; i < 4; i++) { //check horizontal for black win\r\n if ((c-3 + i)>-1 && c-3+i<4){\r\n horizontal4s[y][c-3+i]++;\r\n if (horizontal4s[y][c-3+i] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check vertical for black win\r\n if (y-3+i>-1 && y-3+i<3){\r\n vertical4s[y-3+i][c]++;\r\n if (vertical4s[y-3+i][c] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TLBR diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c-3+i>-1 && c-3+i<4){\r\n diagonalTLBR4s[y-3+i][c-3+i]++;\r\n if (diagonalTLBR4s[y-3+i][c-3+i] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TRBL diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c+3-i>-1 && c+3-i < 4){\r\n diagonalTRBL4s[y-3+i][c+3-i]++;\r\n if (diagonalTRBL4s[y-3+i][c+3-i] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n \r\n \r\n }\r\n else{\r\n boardSquares[5-currentFilled[c]][c].setBackground(Color.RED);\r\n for (int i = 0; i < 7; i++) {\r\n moveSelect[i].setBackground(Color.BLACK);\r\n }\r\n \r\n int y = 5-currentFilled[c];\r\n \r\n \r\n for (int i = 0; i < 4; i++) { //check horizontal for black win\r\n if ((c-3 + i)>-1 && c-3+i<4){\r\n horizontal4s[y][c-3+i]--;\r\n if (horizontal4s[y][c-3+i] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check vertical for black win\r\n if (y-3+i>-1 && y-3+i<3){\r\n vertical4s[y-3+i][c]--;\r\n if (vertical4s[y-3+i][c] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TLBR diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c-3+i>-1 && c-3+i<4){\r\n diagonalTLBR4s[y-3+i][c-3+i]--;\r\n if (diagonalTLBR4s[y-3+i][c-3+i] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TRBL diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c+3-i>-1 && c+3-i < 4){\r\n diagonalTRBL4s[y-3+i][c+3-i]--;\r\n if (diagonalTRBL4s[y-3+i][c+3-i] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n \r\n }\r\n blackToPlay = !blackToPlay;\r\n currentFilled[c]++;\r\n if(currentFilled[c] == 6)\r\n moveSelect[c].setEnabled(false);\r\n }", "private void updateGenerateButton() {\r\n\r\n\t\ttry {\r\n\t\t\txDim = Integer.valueOf(xDimField.getText());\r\n\t\t\tyDim = Integer.valueOf(yDimField.getText());\r\n\t\t\tscale = Integer.valueOf(scaleField.getText());\r\n\t\t} catch (NumberFormatException exc) {\r\n\t\t\tactionButton.setEnabled(false);\r\n\t\t\tvalidCoords = false;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (xDim < XDIM_MIN || yDim < YDIM_MIN || \r\n\t\t\t\txDim > XDIM_MAX || yDim > YDIM_MAX ||\r\n\t\t\t\tscale < SCALE_MIN || scale > SCALE_MAX) {\r\n\t\t\tactionButton.setEnabled(false);\r\n\t\t\tvalidCoords = false;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tactionButton.setEnabled(true);\r\n\t\tvalidCoords = true;\r\n\t}", "private void onColorClick() {\n Integer colorFrom = getResources().getColor(R.color.animated_color_from);\r\n Integer colorTo = getResources().getColor(R.color.animated_color_to);\r\n ValueAnimator colorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);\r\n colorAnimator.setDuration(animationDuration);\r\n colorAnimator.setRepeatCount(1);\r\n colorAnimator.setRepeatMode(ValueAnimator.REVERSE);\r\n colorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {\r\n\r\n @Override\r\n public void onAnimationUpdate(ValueAnimator animator) {\r\n animatedArea.setBackgroundColor((Integer)animator.getAnimatedValue());\r\n }\r\n\r\n });\r\n colorAnimator.start();\r\n }", "public void actionPerformed(ActionEvent event) {\r\n\t\t\t\tstatusValue.setText(\"Odbieram\");\r\n\t\t\t\tcolorChangeListener.set_receive(!colorChangeListener\r\n\t\t\t\t\t\t.is_receive());\r\n\t\t\t\ttry {\r\n\t\t\t\t\t// obiekt realizująca zmianę kolorów w wybranych elementach\r\n\t\t\t\t\t// GUI\r\n\t\t\t\t\t\r\n\t\t\t\t\tList<ColorChangeExecutor> executors = new ArrayList<ColorChangeExecutor>();\r\n\t\t\t\t\texecutors.add(ColorChangeExecutorFactory.createCanvasColorChangeExecutor(canvas));\r\n\t\t\t\t\tList<JSlider> sliders = new ArrayList<JSlider>();\r\n\t\t\t\t\tsliders.add(sliderR);\r\n\t\t\t\t\tsliders.add(sliderG);\r\n\t\t\t\t\tsliders.add(sliderB);\r\n\t\t\t\t\texecutors.add(ColorChangeExecutorFactory.createSlidersColorChangeExecutor(sliders));\r\n\t\t\t\t\t\r\n\t\t\t\t\t// metoda uruchamia: @1 watek realizujacy nasluchiwanie na\r\n\t\t\t\t\t// zmiane kolorow @2 watek reagujacy na odbior zmiany koloru\r\n\t\t\t\t\tengine.receiveColor(executors);\r\n\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tSystem.out.println(this.getClass() + \" \" + e.getClass()\r\n\t\t\t\t\t\t\t+ \" \" + e.getMessage());\r\n\r\n\t\t\t\t} catch (ClassNotFoundException e) {\r\n\t\t\t\t\tSystem.out.println(this.getClass() + \" \" + e.getClass()\r\n\t\t\t\t\t\t\t+ \" \" + e.getMessage());\r\n\t\t\t\t}\r\n\r\n\t\t\t}", "private void updateButtonBounds(){\n\t\tactionButton.setVisible(true);\n\t\tactionButton.setToolTipText(toolTips[boundIndex]);\n\t\tactionButton.setBounds(buttonBounds[boundIndex]);\n\t\texitButton.setBounds(exitBounds);\n\t}", "public void lightMyPawns() {\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n Cell cell = table.getTableCell(i, j);\n if (cell.getPawn() != null && cell.getPawn().getIdGamer() == getID() && cell.getPawn().getICanPlay()) {\n bt[i][j].setStyle(\"-fx-border-color:red\");\n bt[i][j].setOnMouseEntered(e -> {\n Button button;\n button = (Button) e.getSource();\n int x = GridPane.getRowIndex(button);\n int y = GridPane.getColumnIndex(button);\n bt[x][y].setStyle(\"-fx-border-color:yellow\");\n });\n bt[i][j].setOnMouseExited(e -> {\n Button button;\n button = (Button) e.getSource();\n int x = GridPane.getRowIndex(button);\n int y = GridPane.getColumnIndex(button);\n bt[x][y].setStyle(\"-fx-border-color:red\");\n });\n bt[i][j].setDisable(false);\n bt[i][j].setOnAction(e -> {\n Button bOne;\n bOne = (Button) e.getSource();\n int x = GridPane.getRowIndex(bOne);\n int y = GridPane.getColumnIndex(bOne);\n for (int i1 = 0; i1 < 5; i1++) {\n for (int j1 = 0; j1 < 5; j1++) {\n Cell cell1 = table.getTableCell(i1, j1);\n if (cell1.getPawn() != null && cell1.getPawn().getIdGamer() == getID()) {\n if (i1 == x && j1 == y) {\n bt[i1][j1].setStyle(\"-fx-border-color:red\");\n bt[i1][j1].setDisable(true);\n\n } else {\n bt[i1][j1].setStyle(\"-fx-border-color:transparent\");\n bt[i1][j1].setDisable(true);\n }\n }\n }\n }\n\n System.out.print(\"***Id pedina: \" + table.getTableCell(x, y).getPawn().getIdPawn());\n System.out.println(\"\\tId Giocatore: \" + table.getTableCell(x, y).getPawn().getIdGamer() + \"***\\n\");\n currentMove.setIdPawn(table.getTableCell(x, y).getPawn().getIdPawn());\n currentPawn = currentMove.getIdPawn();\n lightAvailable(table.getTableCell(x, y), bOne);\n });\n }\n }\n }\n }", "public int checkAllertBox() {\n mouseX = (float) ((currentPos.x * 1.0f - window.getWidth() / 2f) / (window.getWidth() / 2f));\n mouseY = (float) ((currentPos.y * 1.0f - window.getHeight() / 2f) / (window.getHeight() / 2f));\n\n float checkLeftButtonOnLeft = -0.475f * boxRatio * 0.8f;\n float checkLeftButtonOnRight = -0.075f * boxRatio * 0.8f;\n\n float checkRightButtonOnLeft = 0.075f * boxRatio * 0.8f;\n float checkRightButtonOnRight = 0.475f * boxRatio * 0.8f;\n\n int checkButton = 0;\n\n if (checkLeftButtonOnLeft < mouseX && mouseX < checkLeftButtonOnRight && mouseY > -0.079f && mouseY < -0.003f) {\n checkButton = 11;\n }\n\n if (checkLeftButtonOnLeft < mouseX && mouseX < checkLeftButtonOnRight && mouseY > -0.079f && mouseY < -0.003f && isLeftButtonPressed()) {\n checkButton = 12;\n }\n\n if (checkRightButtonOnLeft < mouseX && mouseX < checkRightButtonOnRight && mouseY > -0.079f && mouseY < -0.003f) {\n checkButton = 21;\n }\n\n if (checkRightButtonOnLeft < mouseX && mouseX < checkRightButtonOnRight && mouseY > -0.079f && mouseY < -0.003f && isLeftButtonPressed()) {\n checkButton = 22;\n }\n\n return checkButton;\n }", "@FXML\n public void highlightSinglePlayer()\n {\n singlePlayerButton.setOnMouseEntered(mouseEvent -> singlePlayerButton.setTextFill(Color.valueOf(\"#FFD700\")));\n }", "private void triggerB2ChangeButton(JButton button) {\n if (!Objects.equals(button, previousB2Button)) {\n previousB2Button.setBackground(MOUSE_B2_EXITED_COLOR);\n previousB2Button.setForeground(BUTTON_B2_DEFAULT_COLOR);\n }\n }", "public void highlightEnable() {\n actualFillColor = new Color(0, 255, 0, 150);\n repaint();\n revalidate();\n }", "public void VerifyButtons(){\n if (currentTurn.getSiguiente() == null){\n next_turn.setEnabled(false);\n } else{\n next_turn.setEnabled(true);\n }\n if (currentTurn.getAnterior() == null){\n prev_turn.setEnabled(false);\n } else{\n prev_turn.setEnabled(true);\n }\n if (current.getSiguiente() == null){\n next_game.setEnabled(false);\n } else{\n next_game.setEnabled(true);\n }\n if (current.getAnterior() == null){\n prev_game.setEnabled(false);\n } else{\n prev_game.setEnabled(true);\n }\n }", "@Focus\n\tpublic void setFocus() \n\t{\n\t\t\tfor(int r = Board.LENGTH - 1; r >= 0; r--)\n\t\t\t{\t\n\t\t\t\t\tfor(int c=0;c<Board.LENGTH;c++)\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsquares[r][c+1].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(((Square) squares[r][c+1].getData()).isLegal())//It returns the legal attribute wrong\n\t\t\t\t\t\t{squares[r][c+1].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));}\n\t\t\t\t\t\t\n\t\t\t\t\t\tPiece piece = ((Square) squares[r][c+1].getData()).getPiece();\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(piece == null)\t\n\t\t\t\t\t\t\tsquares[r][c+1].setImage(IconHandler.getBlankIcon());\t\t\t\t\t\t\t\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsquares[r][c+1].setImage(piece.getIcon());\t\t\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t}\t\t\n\t}", "@Override\n public void mousePressed(MouseEvent arg0) {\n yourBoardPanel[xx][yy].setBackground(new Color(175, 175, 0));\n }", "protected void attemptGridPaintSelection() {\n/* 314 */ Color c = JColorChooser.showDialog(this, localizationResources.getString(\"Grid_Color\"), Color.blue);\n/* */ \n/* 316 */ if (c != null) {\n/* 317 */ this.gridPaintSample.setPaint(c);\n/* */ }\n/* */ }", "public void actionPerformed( ActionEvent e )\n {\n if (e.getSource() == theButton )\n {\n changeColor();\n }\n }", "public void checkMouse(){\n if(Greenfoot.mouseMoved(null)){\n mouseOver = Greenfoot.mouseMoved(this);\n }\n //Si esta encima se volvera transparente el boton en el que se encuentra\n if(mouseOver){\n adjTrans(MAX_TRANS/2);\n }\n else{\n adjTrans(MAX_TRANS);\n }\n \n }", "private void updateBtnMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_updateBtnMouseExited\n updateBtn.setBackground(Color.decode(\"#4fc482\"));\n }", "public void selectButton(int i, int j)\n {\n buttColor[i][j] = changeColor(buttons[i][j], buttColor[i][j]);\n if((i-1) >= 0)\n buttColor[i-1][j] = changeColor(buttons[i-1][j], buttColor[i-1][j]);\n if(i+1 < 4)\n buttColor[i+1][j] = changeColor(buttons[i+1][j], buttColor[i+1][j]);\n if(j-1 >= 0)\n buttColor[i][j-1] = changeColor(buttons[i][j-1], buttColor[i][j-1]);\n if(j+1 < 4)\n buttColor[i][j+1] = changeColor(buttons[i][j+1], buttColor[i][j+1]);\n\n counter-=1;\n tv = (TextView)findViewById(R.id.counter);\n tv.setTextColor(Color.RED);\n tv.setText(\"steps: \" + String.valueOf(counter));\n\n checkGreen();\n }", "private void setupButtons()\n\t{\n\t\tequals.setText(\"=\");\n\t\tequals.setBackground(Color.RED);\n\t\tequals.setForeground(Color.WHITE);\n\t\tequals.setOpaque(true);\n\t\tequals.setFont(new Font(\"Lucida Grande\", Font.PLAIN, 50));\n\t\tequals.setBorder(new CompoundBorder(new LineBorder(Color.LIGHT_GRAY, 5), new LineBorder(Color.BLACK, 3)));\n\t\tclear.setText(\"C\");\n\t\tclear.setBackground(new Color(0, 170, 100));\n\t\tclear.setForeground(Color.WHITE);\n\t\tclear.setOpaque(true);\n\t\tclear.setFont(new Font(\"Lucida Grande\", Font.PLAIN, 50));\n\t\tclear.setBorder(new CompoundBorder(new LineBorder(Color.LIGHT_GRAY, 5), new LineBorder(Color.BLACK, 3)));\n\t\tbackspace.setText(\"<--\");\n\t\tbackspace.setBackground(new Color(0, 170, 100));\n\t\tbackspace.setForeground(Color.WHITE);\n\t\tbackspace.setOpaque(true);\n\t\tbackspace.setFont(new Font(\"Lucida Grande\", Font.PLAIN, 35));\n\t\tbackspace.setBorder(new CompoundBorder(new LineBorder(Color.LIGHT_GRAY, 5), new LineBorder(Color.BLACK, 3)));\n\t\tnegative.setText(\"+/-\");\n\t\tnegative.setBackground(Color.GRAY);\n\t\tnegative.setForeground(Color.WHITE);\n\t\tnegative.setOpaque(true);\n\t\tnegative.setFont(new Font(\"Lucida Grande\", Font.PLAIN, 35));\n\t\tnegative.setBorder(new CompoundBorder(new LineBorder(Color.LIGHT_GRAY, 5), new LineBorder(Color.BLACK, 3)));\n\t}", "private boolean isRed(Point pos){\r\n Cells aux = model.getValueAt(pos);\r\n return (aux == Cells.RED || aux == Cells.RED_QUEEN);\r\n }", "@Override\r\npublic void mousePressed(MouseEvent arg0) {\n\t\r\n\tb1.setBackground(Color.pink);\r\n\t\r\n}", "private void checkButtonVisibility() {\n\n if (leftBlockIndex > 0) {\n buttonLeft.setVisibility(View.VISIBLE);\n } else {\n buttonLeft.setVisibility(View.INVISIBLE);\n }\n\n if (leftBlockIndex < blockCount - 2) {\n buttonRight.setVisibility(View.VISIBLE);\n } else {\n buttonRight.setVisibility(View.INVISIBLE);\n }\n\n }", "private void chooseTo5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseTo5ActionPerformed\n chooseTo5.setBackground(Color.black);\n }", "private void chooseTo7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseTo7ActionPerformed\n chooseTo7.setBackground(Color.black);\n }", "protected int forceDrawButtons(int buttonPressed) {\n return buttonPressed;\n }", "public void colorClicked(View view) {\n //Selecting a colour\n if(view != currColor) {\n handwritingView.setErase(false); // Selecting a color switches to write mode\n ImageButton btnView = (ImageButton)view;\n String selColor = view.getTag().toString();\n handwritingView.changeColor(selColor);\n\n //Visually change selected color\n btnView.setAlpha((float) 0.50);\n currColor.setAlpha((float) 1.00);\n currColor = (ImageButton)view;\n }\n }", "@FXML\n public void highlightMultiplayer()\n {\n multiplayerButton.setOnMouseEntered(mouseEvent -> multiplayerButton.setTextFill(Color.valueOf(\"#FFD700\")));\n }", "@Override\r\n\t\t\t public void onClick(View v) {\n\t\t\t\t if( bFlagQiuzhi == false )\r\n\t\t\t\t {\r\n\t\t\t\t\t btn_qiuzhi_switch.setBackgroundResource(R.drawable.btn_anniu_b);\r\n\t\t\t\t }\r\n\t\t\t\t else\r\n\t\t\t\t {\r\n\t\t\t\t\t btn_qiuzhi_switch.setBackgroundResource(R.drawable.btn_anniu_a);\r\n\t\t\t\t }\r\n\t\t\t\t bFlagQiuzhi = !bFlagQiuzhi;\r\n\r\n\t\t\t }", "void killButton() {\n //goes through all columns\n for (int i = 0; i < 7; i++) {\n //if the not of valid move is true, disable the buttons\n if (!Checker.validMove(currentBoard, i)) {\n Inputbuttons[i].setEnabled(false);\n }\n }\n }", "public void initButtons() {\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n bt[i][j].setOnMouseEntered(e -> {\n Button button;\n button = (Button) e.getSource();\n button.setStyle(\"-fx-border-color:yellow\");\n });\n bt[i][j].setOnMouseExited(e -> {\n Button button;\n button = (Button) e.getSource();\n button.setStyle(\"-fx-border-color:trasparent\");\n });\n\n }\n }\n }", "private static void checkCollisions(MyButton button){\r\n for(MyButton b : mylist.getAllButtons()){\r\n if(!button.equals(b)){ \r\n if(b.block.isSameType(button.block)){\r\n b.setCannotBeChosen();\r\n }\r\n }\r\n }\r\n }", "public static void scheduleButtonListener(ActionEvent evt){\r\n MyButton button = (MyButton) evt.getSource();\r\n button.switchChosen();\r\n if(button.isChosen()){\r\n checkCollisions(button);\r\n }\r\n setButtonsColor();\r\n }", "@Override\n public void excute() {\n drawable.setColor(color);\n }", "private void chooseTo4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseTo4ActionPerformed\n chooseTo4.setBackground(Color.black);\n }", "private void createRedButtons() {\r\n\t\tint y = 40;\r\n\t\tfor (int i = 60; i < 65; i++) {\r\n\t\t\tarray[i] = createRedButton(y);\r\n\t\t\ty += 40;\r\n\t\t}\r\n\t}", "private void chooseTo8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseTo8ActionPerformed\n chooseTo8.setBackground(Color.black);\n }", "void testColorChecker(Tester t) {\r\n initData();\r\n Cell topLeft = (Cell) this.game7.indexHelp(0, 0);\r\n Cell topRight = (Cell) this.game7.indexHelp(1, 0);\r\n Cell botLeft = (Cell) this.game7.indexHelp(0, 1);\r\n Cell botRight = (Cell) this.game7.indexHelp(1, 1);\r\n t.checkExpect(topLeft.flooded, true);\r\n t.checkExpect(topRight.flooded, false);\r\n t.checkExpect(botLeft.flooded, false);\r\n t.checkExpect(botRight.flooded, false);\r\n\r\n topRight.colorChecker(topLeft.color);\r\n t.checkExpect(topRight.flooded, true);\r\n t.checkExpect(botRight.flooded, true);\r\n t.checkExpect(botLeft.flooded, false);\r\n t.checkExpect(topLeft.flooded, true);\r\n }", "private void rHintButton(Button button){\r\n button.getStyleClass().remove(\"closedButton\");\r\n button.getStyleClass().add(\"chooseButtons\");\r\n button.setMouseTransparent(false);\r\n }", "@Override\n public void onClick(View v) {\n String checkBoulder = (String) completeBoulder.getText();\n // if button says \"Topped out!\"\n if (checkBoulder.equals(getResources().getString(R.string.topout_complete))){\n //do nothing\n }\n else {\n tries_title.setBackgroundColor(getResources().getColor(R.color.colorGreen));\n tries_title.setText(R.string.good_job);\n showTriesBox();\n }\n }", "@Override\n public void handle(ActionEvent event) {\n canvasState.changeFillColor(fillercolor.getValue());\n redrawCanvas();\n }", "public void resetSelected(){\n\t\tfor(int x =0; x<9; x++){\n\t\t\tClientWindow.retButtons()[x].setBackground(Color.LIGHT_GRAY);\n\t\t}\n\t}", "private void updateBtnMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_updateBtnMouseEntered\n updateBtn.setBackground(Color.decode(\"#339966\"));\n }", "private void checkIntruder() {\r\n\t\tif(togGrp.getSelectedToggle().equals(radioOn)) {\r\n\t\t\tsetStyle(\"-fx-background-color: red\");\r\n\t\t\tmediaPlayer.play();\r\n\t\t};\r\n\t}", "public void setActivingColor(){\n this.setBackground(new Color( 213, 228, 242));\n this.forceupdateUI();\n }", "private void updateTileButtons() {\n Board board = boardManager.getBoard();\n int nextPos = 0;\n for (Button b : tileButtons) {\n int row = nextPos / Board.NUM_ROWS;\n int col = nextPos % Board.NUM_COLS;\n if (bitmapList == null) {\n b.setBackgroundResource(board.getTile(row, col).getBackground());\n } else if (board.getTile(row, col).getId() != Board.NUM_COLS * Board.NUM_ROWS) {\n BitmapDrawable d = new BitmapDrawable(getResources(), bitmapList.get(board.getTile(row, col).getId()));\n b.setBackground(d);\n } else {\n b.setBackgroundResource(R.drawable.tile_grey);\n }\n nextPos++;\n }\n }", "public abstract void setBackgroundPressed(final int rgba);" ]
[ "0.67935747", "0.64528584", "0.644425", "0.63673043", "0.63002086", "0.62935823", "0.6291535", "0.62806374", "0.61793625", "0.61237913", "0.6123112", "0.6119282", "0.6110097", "0.60961545", "0.608377", "0.6052848", "0.60176915", "0.5987466", "0.59867525", "0.5954904", "0.595193", "0.5950635", "0.59417194", "0.5940374", "0.5931895", "0.5930024", "0.59169334", "0.59151334", "0.5911216", "0.5903427", "0.5900979", "0.5897031", "0.58844197", "0.58821046", "0.58741975", "0.5866075", "0.58606523", "0.58603054", "0.58536303", "0.5845549", "0.5843449", "0.5824522", "0.5816493", "0.5816039", "0.57994103", "0.5796228", "0.5770003", "0.5767783", "0.5767568", "0.57667166", "0.5762617", "0.57614666", "0.5757988", "0.57578045", "0.57505053", "0.5750475", "0.57417715", "0.574077", "0.5739475", "0.5719026", "0.5717702", "0.5712253", "0.57091147", "0.5709075", "0.57080954", "0.5701595", "0.56971335", "0.56966895", "0.56951684", "0.56930345", "0.5691466", "0.5690037", "0.568518", "0.5682545", "0.56768614", "0.5676091", "0.56731933", "0.5668433", "0.5667474", "0.56672126", "0.565487", "0.5640982", "0.5640091", "0.5636808", "0.5636662", "0.5636626", "0.56364137", "0.56362045", "0.56276995", "0.5623262", "0.5619861", "0.5617956", "0.561717", "0.56134427", "0.56133115", "0.5611952", "0.5600818", "0.5599795", "0.55953854", "0.5591915", "0.55897754" ]
0.0
-1
This methods checks to see if there is a winner. Every nested for loop works in the same way in that it goes through and sees if there are four integers in the board array that are the same, if they aren't 0. If so, the applicable buttons in the GBoard[][] will be turned into a star, the wonYet variable will be set to true, and method will return true. check diagonals
public boolean winCheck(){ for(int i=0; i<3; i++){//goes through rows for(int j=0; j<4; j++){//goes through columns if(board[i][j+3] != 0 && board[i+1][j+2] != 0 && board[i+2][j+1] != 0 && board[i+3][j] != 0) if(board[i][j+3]==(board[i+1][j+2])) if(board[i][j+3]==(board[i+2][j+1])) if(board[i][j+3]==(board[i+3][j])){ GBoard[i][j+3].setIcon(star); GBoard[i+1][j+2].setIcon(star); GBoard[i+2][j+1].setIcon(star); GBoard[i+3][j].setIcon(star); wonYet=true; return true; } } } //checks for subdiagonals for(int i=0; i<3; i++){//goes through rows for(int j=0; j<4; j++){//goes through columns if(board[i][j] != 0 && board[i+1][j+1] != 0 && board[i+2][j+2] != 0 && board[i+3][j+3] != 0) if(board[i][j] == (board[i+1][j+1])) if(board[i][j] == (board[i+2][j+2])) if(board[i][j] == (board[i+3][j+3])){ GBoard[i][j].setIcon(star); GBoard[i+1][j+1].setIcon(star); GBoard[i+2][j+2].setIcon(star); GBoard[i+3][j+3].setIcon(star); wonYet=true; return true; } } } //check horizontals for(int i=0; i<6; i++){//goes through rows for(int j=0; j<4; j++){//goes through columns if(board[i][j] != 0 && board[i][j+1] != 0 && board[i][j+2] != 0 && board[i][j+3] != 0){ if(board[i][j]==(board[i][j+1])) if(board[i][j]==(board[i][j+2])) if(board[i][j]==(board[i][j+3])){ GBoard[i][j].setIcon(star); GBoard[i][j+1].setIcon(star); GBoard[i][j+2].setIcon(star); GBoard[i][j+3].setIcon(star); wonYet=true; return true; } } } } //checks for vertical wins for(int i=0; i<3; i++){//checks rows for(int j=0; j<7; j++){//checks columns if(board[i][j] != 0 && board[i+1][j] != 0 && board[i+2][j] != 0 && board[i+3][j] != 0){ if(board[i][j]==(board[i+1][j])) if(board[i][j]==(board[i+2][j])) if(board[i][j]==(board[i+3][j])){ GBoard[i][j].setIcon(star); GBoard[i+1][j].setIcon(star); GBoard[i+2][j].setIcon(star); GBoard[i+3][j].setIcon(star); wonYet=true; return true; } } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean checkForWinner(String player) {\r\n\t\t\r\n\t\t// check rows\r\n\t\tfor (int row = 0; row < board.length; row++) {\r\n\t\t\tint markCounter = 0;\r\n\t\t\tfor (int col = 0; col < board[row].length; col++) {\r\n\t\t\t\tif (board[row][col].getText().contains(player)) {\r\n\t\t\t\t\tmarkCounter++;\r\n\t\t\t\t}\r\n\t\t\t\telse if(! (board[row][col].getText().contains(player)) ) {\r\n\t\t\t\t\tmarkCounter = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (markCounter == connectX) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t// check columns\r\n\t\tfor (int col = 0; col < 7; col++) {\r\n\t\t\tint markCounter = 0;\r\n\t\t\tfor (int row = board.length - 1; row >= 0; row--) {\r\n\t\t\t\tif(board[row][col].getText().contains(player)) {\r\n\t\t\t\t\tmarkCounter++;\r\n\t\t\t\t}\r\n\t\t\t\telse if(! (board[row][col].getText().contains(player)) ) {\r\n\t\t\t\t\tmarkCounter = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (markCounter == connectX) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * This algorithm checks the right side of the second diagonal on the board. The while loop iterates four times from bottom \r\n\t\t * to top, right to left. \r\n\t\t * The reason it only iterates four times is because after a certain point, it is impossible for a player to connect four\r\n\t\t * so the code does'nt have to check the corners.\r\n\t\t * \t\tO X X X O O O\r\n\t\t * \t\tO O X X X O O\r\n\t\t * \t\tO O O X X X O\r\n\t\t *\t\tO O O O X X X\r\n\t\t * \t\tO O O O O X X\r\n\t\t * \t\tO O O O O O X\r\n\t\t * \r\n\t\t */\r\n\t\tint diag2Count = 0;\r\n\t\tint row = board.length - 1;\r\n\t\tint col = 6;\r\n\t\tint iteration = 0;\r\n\t\tint rowPlace = row;\r\n\t\twhile (iteration < 4) {\r\n\t\t\trow = rowPlace;\r\n\t\t\tcol = 6;\r\n\t\t\twhile (row >= 0 && col >= 1) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiag2Count++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiag2Count = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diag2Count == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol--;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\trowPlace--;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Checks the left hand side of the secondary diagonal. Iterates only 3 times.\r\n\t\t * of the board.\r\n\t\t * \t\t\tX O O O O O O\r\n\t\t * \t\t\tX X O O O O O\r\n\t\t * \t\t\tX X X O O O O\r\n\t\t * \t\t\tO X X X O O O\r\n\t\t * \t\t\tO O X X X O O\r\n\t\t * \t\t\tO O O X X X O\r\n\t\t */\r\n\t\trow = board.length - 1;\r\n\t\tcol = 3;\r\n\t\titeration = 0;\r\n\t\tint colPlace = col;\r\n\t\twhile (iteration < 4) {\r\n\t\t\tcol = colPlace;\r\n\t\t\trow = board.length -1;\r\n\t\t\twhile (row >= 0 && col >= 0) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiag2Count++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiag2Count = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diag2Count == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol--;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\tcolPlace++;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Checks the left hand main Diagonals and iterates 3 times.\r\n\t\t * \t\t\tO O O X X X O\r\n\t\t * \t\t\tO O X X X O O\r\n\t\t * \t\t\tO X X X O O O \r\n\t\t * \t\t\tX X X O O O O\r\n\t\t * \t\t\tX X O O O O O\r\n\t\t * \t\t\tX O O O O O O\r\n\t\t * \r\n\t\t */\r\n\t\trow = 3;\r\n\t\tcol = 0;\r\n\t\trowPlace = row;\r\n\t\titeration = 0;\r\n\t\tint diagMainCounter = 0;\r\n\t\twhile (iteration < 3) {\r\n\t\t\trow = rowPlace;\r\n\t\t\tcol = 0;\r\n\t\t\twhile (row >= 0 && col <= 6) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiagMainCounter++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiagMainCounter = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diagMainCounter == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol++;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\trowPlace++;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Checks the right hand side of the main diagonal and iterates 4 times.\r\n\t\t * \r\n\t\t *\t\t\tO O O O O O X\r\n\t\t *\t\t\tO O O O O X X\r\n\t\t *\t\t\tO O O O X X X\r\n\t\t *\t\t\tO O O X X X O\r\n\t\t *\t\t\tO O X X X O O\r\n\t\t *\t\t\tO X X X O O O\r\n\t\t */\r\n\t\trow = board.length -1;\r\n\t\tcol = 0;\r\n\t\tcolPlace = col;\r\n\t\titeration = 0;\r\n\t\tdiagMainCounter = 0;\r\n\t\twhile (iteration < 4) {\r\n\t\t\tcol = colPlace;\r\n\t\t\trow = board.length -1;\r\n\t\t\twhile (row >= 0 && col <= 6) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiagMainCounter++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiagMainCounter = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diagMainCounter == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol++;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\tcolPlace++;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean checkForWin()\n {\n //Horizontal win\n for (int r = 0; r <= 5; r++)\n {\n for (int c = 0; c <= 3; c++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r] == player_turn &&\n current_board[c+2][r] == player_turn &&\n current_board[c+3][r] == player_turn)\n return true;\n }\n }\n //Vertical win\n for (int c = 0; c <= 6; c++)\n {\n for (int r = 0; r <= 2; r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c][r+1] == player_turn &&\n current_board[c][r+2] == player_turn &&\n current_board[c][r+3] == player_turn)\n return true;\n }\n }\n //Shortest diagonals/anti diagonals (cell length == 4)\n //postive slope\n if (current_board[0][2] == player_turn && current_board[1][3] == player_turn && current_board[2][4] == player_turn && current_board[3][5] == player_turn)\n return true;\n if (current_board[3][0] == player_turn && current_board[4][1] == player_turn && current_board[5][2] == player_turn && current_board[6][3] == player_turn)\n return true;\n //negative slope\n if (current_board[0][3] == player_turn && current_board[1][2] == player_turn && current_board[2][1] == player_turn && current_board[3][0] == player_turn)\n return true;\n if (current_board[3][5] == player_turn && current_board[4][4] == player_turn && current_board[5][3] == player_turn && current_board[6][2] == player_turn)\n return true;\n\n //Medium-length diagonals/anti diagonals (cell length == 5)\n //positive slope\n if (current_board[0][1] == player_turn && current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn)\n return true;\n if (current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn && current_board[4][5] == player_turn)\n return true;\n if (current_board[2][0] == player_turn && current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn)\n return true;\n if (current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn && current_board[6][4] == player_turn)\n return true;\n //negative slope\n if (current_board[0][4] == player_turn && current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn)\n return true;\n if (current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn && current_board[4][0] == player_turn)\n return true;\n if (current_board[2][5] == player_turn && current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn)\n return true;\n if (current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn && current_board[6][1] == player_turn)\n return true;\n\n //Longest diagonals/anti diagonals (cell length == 6)\n //positive slope\n for (int c=0, r=0; c <= 2 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n for (int c=1, r=0; c <= 3 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n //negative slope\n for (int c=0, r=5; c <= 2 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n for (int c=1, r=5; c <= 3 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n\n return false;\n }", "public static void checkWinner() {\n for (int i = 0; i < 3; i++) {\r\n if (winner) {\r\n break;\r\n }\r\n for (int j = 0; j < 3; j++) {\r\n // Check each row\r\n if (output[i][0] == output[i][1] && output[i][0] == output[i][2]) {\r\n if (output[i][0] != ' ') {\r\n System.out.println(output[i][0] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n break;\r\n }\r\n // Check each column\r\n else if (output[0][j] == output[1][j] && output[0][j] == output[2][j]) {\r\n if (output[0][j] != ' ') {\r\n System.out.println(output[0][j] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n // Check Diagonals\r\n if (output[0][0] == output[1][1] && output[0][0] == output[2][2]) {\r\n if (output[0][0] != ' ') {\r\n System.out.println(output[0][0] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n\r\n } else if (output[2][0] == output[1][1] && output[2][0] == output[0][2]) {\r\n if (output[2][0] != ' ') {\r\n System.out.println(output[2][0] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n\r\n } else if (winner = false) {\r\n System.out.println(\"Draw\");\r\n System.exit(0);\r\n }\r\n }", "boolean diagonalWin(){\n\t\tint match_counter=0;\n\t\tboolean flag=false;\n\t\tfor(int row=8; row>=3;row--){\n\t\t\tfor(int column=0;column<25;column++){\n\t\t\t\tif(Board[row][column]!='\\u0000'){\n\t\t\t\t\tif(Board[row][column]!='O'){\n\t\t\t\t\t\tif(Board[row][column]==Board[row-1][column+1]&& \n\t\t\t\t\t\t Board[row-1][column+1]== Board[row-2][column+2]&&\n\t\t\t\t\t\t Board[row-2][column+2]==Board[row-3][column+3]){\n\t\t\t\t\t\t\tflag=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflag=false;\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tif (flag == true)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn flag;\t\n\t}", "private boolean diagWin(){ \r\n\t\treturn ((checkValue (board[0][0],board[1][1],board[2][2]) == true) || \r\n\t\t\t\t(checkValue (board[0][2], board[1][1], board[2][0]) == true)); \r\n\t}", "public boolean hasWinner() {\n\t\tint[][] board = myGameBoard.getBoard();\n\t\t\n\t\t// check for vertical win\n\t\tfor(int i = 0; i < board[0].length; i++) {\n\t\t\tfor(int j = 0; j < board.length - 3; j++) {\n\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\tif(thisSlot == GameBoard.EMPTY) continue;\n\t\t\t\t\n\t\t\t\tif(thisSlot == board[j+1][i]) {\n\t\t\t\t\tif(thisSlot == board[j+2][i]) {\n\t\t\t\t\t\tif(thisSlot == board[j+3][i]) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for horizontal win\n\t\tfor(int i = 0; i < board[0].length - 3; i++) {\n\t\t\tfor(int j = 0; j < board.length; j++) {\n\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\tif(thisSlot == GameBoard.EMPTY) continue;\n\t\t\t\t\n\t\t\t\tif(thisSlot == board[j][i+1]) {\n\t\t\t\t\tif(thisSlot == board[j][i+2]) {\n\t\t\t\t\t\tif(thisSlot == board[j][i+3]) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for diagonal win left to right, upwards\n\t\tfor(int i = 0; i < board[0].length - 3; i++) {\n\t\t\tfor(int j = 3; j < board.length; j++) {\n\t\t\t\tif(board[j][i] != GameBoard.EMPTY) {\n\t\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\t\t\n\t\t\t\t\tif(board[j-1][i+1] == thisSlot) {\n\t\t\t\t\t\tif(board[j-2][i+2] == thisSlot) {\n\t\t\t\t\t\t\tif(board[j-3][i+3] == thisSlot) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for diagonal win right to left, upwards\n\t\tfor(int i = 3; i < board[0].length; i++) {\n\t\t\tfor(int j = 3; j < board.length; j++) {\n\t\t\t\tif(board[j][i] != GameBoard.EMPTY) {\n\t\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\t\t\n\t\t\t\t\tif(board[j-1][i-1] == thisSlot) {\n\t\t\t\t\t\tif(board[j-2][i-2] == thisSlot) {\n\t\t\t\t\t\t\tif(board[j-3][i-3] == thisSlot) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "private boolean checkWinner() {\n\t\tboolean frontDiagWin = !myBoard.isEmpty(0, 0);\n\t\tchar frontDiagToken = myBoard.getCell(0, 0);\n\t\tboolean backDiagWin = !myBoard.isEmpty(0, Board.BOARD_SIZE - 1);\n\t\tchar backDiagToken = myBoard.getCell(0, Board.BOARD_SIZE - 1);\n\t\tfor (int i = 0; i < Board.BOARD_SIZE; i++) {\n\t\t\t// check Diagonals\n\t\t\tfrontDiagWin = myBoard.getCell(i, i) == frontDiagToken ? frontDiagWin\n\t\t\t\t\t: false;\n\t\t\tbackDiagWin = myBoard.getCell(i, (Board.BOARD_SIZE - 1) - i) == backDiagToken ? backDiagWin\n\t\t\t\t\t: false;\n\t\t\t// check Rows and Columns\n\t\t\tboolean rowWin = !myBoard.isEmpty(i, 0);\n\t\t\tchar startRowToken = myBoard.getCell(i, 0);\n\t\t\tboolean colWin = !myBoard.isEmpty(0, i);\n\t\t\tchar startColToken = myBoard.getCell(0, i);\n\t\t\tfor (int j = 0; j < Board.BOARD_SIZE; j++) {\n\t\t\t\trowWin = myBoard.getCell(i, j) == startRowToken ? rowWin\n\t\t\t\t\t\t: false;\n\t\t\t\tcolWin = myBoard.getCell(j, i) == startColToken ? colWin\n\t\t\t\t\t\t: false;\n\t\t\t}\n\t\t\tif (rowWin || colWin) {\n\t\t\t\tSystem.out.println(\"\\\"\"\n\t\t\t\t\t\t+ (rowWin ? startRowToken : startColToken)\n\t\t\t\t\t\t+ \"\\\" wins the game!\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tif (frontDiagWin || backDiagWin) {\n\t\t\tSystem.out.println(\"\\\"\"\n\t\t\t\t\t+ (frontDiagWin ? frontDiagToken : backDiagToken)\n\t\t\t\t\t+ \"\\\" wins the game!\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean isWinner() {\n\t\t//initialize row, column, and depth\n\t\tint row = 0;\n\t\tint col = 0;\n\t\tint dep = 0;\n\t\t\n\t\t//Checks for a vertical four in a row\n\t\t//row is restriced from the full size to >=3 to avoid\n\t\t//an out of bounds exception\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = 0; col < size; col ++)\n\t\t\t\tfor(dep = 0; dep < size; dep ++) {\n\t\t\t\t\t//a variable check is made to save lines\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\t//checks if the value is a player, and it\n\t\t\t\t\t//qualifies as a vertical win. If it does,\n\t\t\t\t\t//the for loop returns true.\n\t\t\t\t\tif (check != -1\n\t\t\t\t\t\t && check == board[row - 1][col][dep] &&\n\t\t\t\t\t\t\tcheck == board[row - 2][col][dep] &&\n\t\t\t\t\t\t\tcheck == board[row - 3][col][dep] )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t//check for horizontal four in a row\n\t\t//col is restriced and increasing (+)\n\t\tfor (dep = 0; dep < size; dep ++)\n\t\t\tfor(row = size - 1; row >= 0; row --)\n\t\t\t\tfor(col = 0; col < size - 3; col ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row][col + 1][dep]\n\t\t\t\t\t\t\t&& check == board[row][col + 2][dep] \n\t\t\t\t\t\t\t&& check == board[row][col + 3][dep])\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\t\t//check for x,y upDiagnol four in a row on each depth\n\t\t//row is restricted and decreasing (-)\n\t\t//col is restricted and increasing (+)\n\t\tfor (dep = 0; dep < size; dep ++)\n\t\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\t\tfor(col = 0; col < size - 3; col ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row - 1][col + 1][dep]\n\t\t\t\t\t\t\t&& check == board[row - 2][col + 2][dep]\n\t\t\t\t\t\t\t&& check == board[row - 3][col + 3][dep])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y downDiagnol four in a row on each depth\n\t\t//row is restricted and increasing (+)\n\t\t//col is restricted and increasing (+)\n\t\tfor (dep = 0; dep < size; dep ++)\n\t\t\tfor(row = 0; row < size - 3; row ++)\n\t\t\t\tfor(col = 0; col < size - 3; col ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row + 1][col + 1][dep]\n\t\t\t\t\t\t\t&& check == board[row + 2][col + 2][dep]\n\t\t\t\t\t\t\t&& check == board[row + 3][col + 3][dep])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,z horizontal four in a row on each column\n\t\t//dep is restricted and increasing (+)\n\t\tfor(col = 0; col < size; col ++)\n\t\t\tfor(row = size - 1; row >= 0; row --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row][col][dep + 1]\n\t\t\t\t\t\t\t&& check == board[row][col][dep + 2]\n\t\t\t\t\t\t\t&& check == board[row][col][dep + 3])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,z upDiagnol four in a row on ecah column\n\t\t//row is restricted and decreasing (-)\n\t\t//dep is restricted and increasing (+)\n\t\tfor(col = 0; col < size; col ++)\n\t\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row - 1][col][dep + 1]\n\t\t\t\t\t\t\t&& check == board[row - 2][col][dep + 2]\n\t\t\t\t\t\t\t&& check == board[row - 3][col][dep + 3])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,z downDiagnol four in a row\n\t\t// dep +, row +\n\t\tfor(col = 0; col < size; col ++)\n\t\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row + 1][col][dep + 1]\n\t\t\t\t\t\t\t&& check == board[row + 2][col][dep + 2]\n\t\t\t\t\t\t\t&& check == board[row + 3][col][dep + 3])\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the top right\n\t\t//row -, col +, dep +\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col + 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row - 2][col + 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row - 3][col + 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the top left\n\t\t//row -, col -, dep +\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col - 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row - 2][col - 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row - 3][col - 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the down left\n\t\t//row -, col -, dep -\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col - 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row - 2][col - 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row - 3][col - 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the down right\n\t\t//row -, col +, dep -\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col + 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row - 2][col + 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row - 3][col + 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//Same as above, but now row increases rather than decreasing\n\t\t//check for down diagnol from top left to center\n\t\t//row +, col +, dep +\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1\n\t\t\t\t\t\t&& check == board[row + 1][col + 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row + 2][col + 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row + 3][col + 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for down diagnol from top right to center\n\t\t//row + , col -, dep +\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row + 1][col - 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row + 2][col - 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row + 3][col - 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for down diagnol from bottom left to center\n\t\t//row +, col -, dep -\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row + 1][col - 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row + 2][col - 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row + 3][col - 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for down diagnol from bottom right to center\n\t\t//row +, col +, dep -\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row + 1][col + 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row + 2][col + 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row + 3][col + 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t//check for diagonals where row stays the same, but x,z change\n\t\t//depth up diagnol, col +, dep +\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col + 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row][col + 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row][col + 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t//depth down diagnol, col +, dep -\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col + 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row][col + 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row][col + 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t// depth down left diagnol, col -, dep +\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = size - 1; col >= 3; col --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col - 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row][col - 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row][col - 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t//depth down right diagnol, col -, dep -\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = size - 1; col >= 3; col --)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col - 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row][col - 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row][col - 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//returns false if none of the above return true\n\t\treturn false;\n\t}", "public void checkBoard(){\n\n //check horizontally for a winner\n for(int i = 0; i < 3; i++) {\n if (boardStatus[i][0].equals(boardStatus[i][1]) && boardStatus[i][1].equals(boardStatus[i][2])) {\n if (boardStatus[i][0].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n break;\n } else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n break;\n\n }\n }\n\n\n }\n\n //check vertically for a winner\n for(int i = 0; i < 3; i++) {\n if (boardStatus[0][i].equals(boardStatus[1][i]) && boardStatus[1][i].equals(boardStatus[2][i])) {\n if (boardStatus[0][i].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n break;\n } else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n break;\n }\n }\n }\n\n //diagonally\n\n if((boardStatus[0][0].equals(boardStatus[1][1])) && (boardStatus[0][0].equals(boardStatus[2][2]))){\n\n if (boardStatus[0][0].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n\n }\n else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n\n }\n\n }\n\n //diagonally\n if (boardStatus[0][2].equals(boardStatus[1][1]) && (boardStatus[0][2].equals(boardStatus[2][0]))) {\n\n if (boardStatus[0][2].equals(\"X\")) {\n winnerResults = playerOne + \" has won the game!\";\n winnerName = playerOne;\n userExists();\n\n } else {\n winnerResults = playerTwo + \" has won the game!\";\n winnerName = playerTwo;\n userExists();\n\n }\n }\n\n //If all the locations on the board have been played but no win conditions have been met\n //the game will end without a winner\n if(boardStatus[0][0] != \"a\" && boardStatus[0][1] != \"b\" && boardStatus[0][2] != \"c\" &&\n boardStatus[1][0] != \"d\" && boardStatus[1][1] != \"e\" && boardStatus[1][2] != \"f\" &&\n boardStatus[2][0] != \"g\" && boardStatus[2][1] != \"h\" && boardStatus[2][2] != \"i\"){\n NoWinnerDialog dialog = new NoWinnerDialog();\n dialog.show(getSupportFragmentManager(), \"NoWinner\");\n }\n\n\n\n\n }", "private boolean winningBoard(char[][] board){\n for(int i = 0; i < boardHeight; i++ ){\n for(int j = 0; j < boardWidth; j++) {\n\n //if white was made it to the other side\n if(board[i][j] == 'P' && i == 0){\n return true;\n }\n\n //if black has made it to the other side\n if(board[i][j] == 'p' && i == boardHeight -1){\n return true;\n }\n }\n }\n //no winners\n return false;\n }", "public boolean win() {\r\n\t\tfor (int n = 0; n < 3; n++) {\r\n\t\t\tfor (int m = 0; m < 7; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n + 1][m] == board[n][m] && board[n + 2][m] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n + 3][m] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 1][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 2][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 3][m].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 0; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n][m + 1] == board[n][m] && board[n][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 3].setText(\"X\");\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 0; n < 3; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n + 1][m + 1] == board[n][m] && board[n + 2][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n + 3][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 1][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 2][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 3][m + 3].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 3; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n - 1][m + 1] == board[n][m] && board[n - 2][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n - 3][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 1][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 2][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 3][m + 3].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\r\n\t}", "private void checkForWin(int x, int y, String s) {\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (grid[x][i].getText() != s)\n\t\t\t\tbreak;\n\t\t\tif (i == 3 - 1) {\n\t\t\t\tgameOver = true;\n\n\t\t\t\tif (grid[x][i].getText() == \"X\")\n\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\telse\n\t\t\t\t\twinner = \"Player 2\";\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// check row\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (grid[i][y].getText() != s)\n\t\t\t\tbreak;\n\t\t\tif (i == 3 - 1) {\n\t\t\t\tgameOver = true;\n\n\t\t\t\tif (grid[i][y].getText() == \"X\")\n\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\telse\n\t\t\t\t\twinner = \"Player 2\";\n\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// check diag\n\t\tif (x == y) {\n\t\t\t// we're on a diagonal\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tif (grid[i][i].getText() != s)\n\t\t\t\t\tbreak;\n\t\t\t\tif (i == 3 - 1) {\n\t\t\t\t\tgameOver = true;\n\n\t\t\t\t\tif (grid[i][i].getText() == \"X\")\n\t\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\t\telse\n\t\t\t\t\t\twinner = \"Player 2\";\n\t\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// check anti diag (thanks rampion)\n\t\tif (x + y == 3 - 1) {\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tif (grid[i][(3 - 1) - i].getText() != s)\n\t\t\t\t\tbreak;\n\t\t\t\tif (i == 3 - 1) {\n\t\t\t\t\tgameOver = true;\n\n\t\t\t\t\tif (grid[i][(3 - 1) - i].getText() == \"X\")\n\t\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\t\telse\n\t\t\t\t\t\twinner = \"Player 2\";\n\t\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private boolean checkDiagonalForWinner(String mark,int buttonId)\n {\n \tint rows =3;\n \tint columns = 3;\n \tboolean winStatus=false;\n \tint columnNumber = buttonId%columns;\n \tint rownumber = buttonId/rows;\n \tint rowIndex= 0;\n \tint columnIndex = 0;\n \tint index;\n \tif(columnNumber==rownumber)\n \t{\n \t\t//int index; \n\t \twhile (rowIndex<rows)\n\t \t{\n\t \t\tindex = getIndex(rowIndex,columnIndex,columns);\n\t \t\tif(movesPlayed[index]!=mark|| movesPlayed[index]==\"\")\n\t \t\t{\n\t \t\t\treturn winStatus;\n\t \t\t}\n\t \t\telse\n\t \t\t{\n\t \t\t\trowIndex++;\n\t \t\t\tcolumnIndex++;\n\t \t\t}\n\t \t}\n\t \twinStatus=true;\n\t \treturn winStatus;\n \t}\n \t//Detect right to left diagonal\n \tint sum = columnNumber + rownumber;\n \tif(sum==rows-1)\n \t{\n \t\trowIndex = 0;\n \t\tcolumnIndex = columns-1;\n \t\twhile (rowIndex<rows)\n\t \t{\n\t \t\tindex = getIndex(rowIndex,columnIndex,columns);\n\t \t\tif(movesPlayed[index]!=mark|| movesPlayed[index]==\"\")\n\t \t\t{\n\t \t\t\treturn winStatus;\n\t \t\t}\n\t \t\telse\n\t \t\t{\n\t \t\t\trowIndex++;\n\t \t\t\tcolumnIndex--;\n\t \t\t}\n\t \t}\n\t \twinStatus=true;\n\t \treturn winStatus;\n \t}\n \t\n \treturn false;\n }", "private boolean checkIfGameIsWon() {\n\n //loop through rows\n for(int i = 0; i < NUMBER_OF_ROWS; i++) {\n //gameIsWon = this.quartoBoard.checkRow(i);\n if (this.quartoBoard.checkRow(i)) {\n System.out.println(\"Win via row: \" + (i) + \" (zero-indexed)\");\n return true;\n }\n\n }\n //loop through columns\n for(int i = 0; i < NUMBER_OF_COLUMNS; i++) {\n //gameIsWon = this.quartoBoard.checkColumn(i);\n if (this.quartoBoard.checkColumn(i)) {\n System.out.println(\"Win via column: \" + (i) + \" (zero-indexed)\");\n return true;\n }\n\n }\n\n //check Diagonals\n if (this.quartoBoard.checkDiagonals()) {\n System.out.println(\"Win via diagonal\");\n return true;\n }\n\n return false;\n }", "public static boolean diagonalJudge(String playerMarker, int row, int column){\n\n boolean victoryFlag = false;\n\n int subRow = 0;\n int subColumn = 0;\n int victoryCounter = 0;\n\n // Checking first Diagonal\n // North West\n\n subRow = row;\n subColumn = column;\n\n // Store the player's latest move's coordinates\n\n winList.add(subColumn);\n winList.add(subColumn);\n\n while ( subRow >= 0 && subColumn >= 0 && !victoryFlag ){\n\n subRow--;\n subColumn--;\n\n if ( subRow >= 0 && subColumn >= 0 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n // South East\n\n subRow = row;\n subColumn = column;\n\n while ( subRow < 6 && subColumn < 7 && !victoryFlag ){\n\n subRow++;\n subColumn++;\n\n if ( subRow < 6 && subColumn < 7 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n if ( !victoryFlag ){\n winList.clear(); // reset the list, if no one won\n }\n else{\n winDirection = \"Left Diagonal\";\n }\n\n // Checking the other diagonal\n // North East\n\n victoryCounter = 0;\n subRow = row;\n subColumn = column;\n winList.add(subRow);\n winList.add(subColumn);\n\n while ( subRow >= 0 && subColumn < 7 && !victoryFlag ){\n\n subRow--;\n subColumn++;\n\n if ( subRow >= 0 && subColumn < 7 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n winDirection = \"Right Diagonal\";\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n // South East\n\n subRow = row;\n subColumn = column;\n\n while ( subRow < 6 && subColumn >= 0 && !victoryFlag ){\n\n subRow++;\n subColumn--;\n\n if ( subRow <= 5 && subColumn >= 0 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n winDirection = \"Right Diagonal\";\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n if ( !victoryFlag ){\n winList.clear();\n }\n\n return victoryFlag;\n }", "public static boolean checkForObviousMove(char[][] a){\r\n int rowNumber = a.length;\r\n int colNumber = a[0].length;\r\n //AI obvious to win\r\n for (int i = 0; i<rowNumber; i++){\r\n for (int j = 0; j<colNumber; j++){\r\n //check if on diagnol\r\n if (i == j && countDiag1(a, 'o')== (rowNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n if (i+j == rowNumber-1 && countDiag2(a,'o')==(rowNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n //check on a row\r\n if(countRow(a[i], 'o') == (colNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n //check on a column\r\n if(countCol(a,j,'o') == (rowNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n }\r\n }\r\n //when user obvious to win\r\n for (int i = 0; i<rowNumber; i++){\r\n for (int j = 0; j<colNumber; j++){\r\n //check if on diagnol\r\n if (i == j && countDiag1(a, 'x')== (rowNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n if (i+j == rowNumber-1 && countDiag2(a,'x')==(rowNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n //check on a row\r\n if(countRow(a[i], 'x') == (colNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n //check on a column\r\n if(countCol(a,j,'x') == (rowNumber-1) && spotIsEmpty(a[i][j])){\r\n writeOnBoard(a,'o',i,j);\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }", "public boolean check2DDiagnolWinner(Cell play) {\n\t\tfor(int dim = 0; dim < board.length; dim++) { // for dim\n\t\t\tif(board[dim][0][0] == board[dim][1][1] && board[dim][1][1]==board[dim][2][2] && board[dim][2][2]==board[dim][3][3] && board[dim][3][3].equals(play)||\n\t\t\t\t\tboard[dim][0][3] == board[dim][1][2] && board[dim][1][2]==board[dim][2][1] && board[dim][2][1]==board[dim][3][0] && board[dim][3][0].equals(play)) { //for col & row || col & #-row\n\t\t\t\t//\t\t\t\tSystem.out.println(\" 3 Dimensional diagnol win by \"+play.toString()+ \" at dim=\" + dim);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\n\t}", "public void checkWinner(){\n \n if ((board[0][0] == 'X' && board[0][1] == 'X' && board[0][2] == 'X')||(board[1][0] == 'X' && board[1][1] == 'X' && board[1][2] == 'X')||(board[2][0] == 'X' && board[2][1] == 'X' && board[2][2] == 'X')){\n winner();\n }\n else if ((board[0][0] == 'X' && board[1][0] == 'X' && board[2][0] == 'X')||(board[0][1] == 'X' && board[1][1] == 'X' && board[2][1] == 'X')||(board[0][2] == 'X' && board[1][2] == 'X' && board[2][2] == 'X')){\n winner();\n }\n else if ((board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X')||(board[0][2] == 'X' && board[1][1] == 'X' && board[2][0] == 'X')){\n winner();\n }\n else if ((board[0][0] == 'O' && board[0][1] == 'O' && board[0][2] == 'O')||(board[1][0] == 'O' && board[1][1] == 'O' && board[1][2] == 'O')||(board[2][0] == 'O' && board[2][1] == 'O' && board[2][2] == 'O')){\n winner();\n }\n else if ((board[0][0] == 'O' && board[1][0] == 'O' && board[2][0] == 'O')||(board[0][1] == 'O' && board[1][1] == 'O' && board[2][1] == 'O')||(board[0][2] == 'O' && board[1][2] == 'O' && board[2][2] == 'O')){\n winner();\n }\n else if ((board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O')||(board[0][2] == 'O' && board[1][1] == 'O' && board[2][0] == 'O')){\n winner();\n }\n \n }", "public static boolean checkDiagonal(){\nif(gamebd[0][0]==gamebd[1][1]&&gamebd[1][1]==gamebd[2][2]&&gamebd[0][0]>0)\r\n{\r\n\tif(gamebd[0][0]==player1)\r\n\t\tSystem.out.println(\"Player 1 won\");\r\n\telse\r\n\t\tSystem.out.println(\"Player 2 won\");\r\nreturn true;\t\t\r\n}\r\nif(gamebd[0][2]==gamebd[1][1]&&gamebd[1][1]==gamebd[2][0]&&gamebd[0][2]>0)\r\n{\r\n\tif(gamebd[0][2]==player1)\r\n\t\tSystem.out.println(\"Player 1 won\");\r\n\telse\r\n\t\tSystem.out.println(\"Player 2 won\");\r\n\treturn true;\t\r\n}\r\n\treturn false;\r\n}", "private int checkWin(int x) {\n for (int row = 0; row < 8; row++) {\n for (int col = 0; col < 9; col++) {\n //Black = 1, Red = 0\n\n //Checks Vertically\n if ((buttons[row][col].getText() == \"O\") && (buttons[row][col+1].getText() == \"O\") && (buttons[row][col+2].getText() == \"O\") && (buttons[row][col+3].getText() == \"O\")) {\n return 0;\n }\n if ((buttons[row][col].getText() == \"X\") && (buttons[row][col+1].getText() == \"X\") && (buttons[row][col+2].getText() == \"X\") && (buttons[row][col+3].getText() == \"X\")) {\n return 1;\n }\n\n //Checks Vertically\n if ((buttons[row][col].getText() == \"O\") && (buttons[row+1][col].getText() == \"O\") && (buttons[row+2][col].getText() == \"O\") && (buttons[row+3][col].getText() == \"O\")) {\n return 0;\n }\n\n if ((buttons[row][col].getText() == \"X\") && (buttons[row+1][col].getText() == \"X\") && (buttons[row+2][col].getText() == \"X\") && (buttons[row+3][col].getText() == \"X\")) {\n return 1;\n }\n\n //Diagonal Top left to bottom right checker\n if((buttons[row][col].getText() == \"O\") && (buttons[row+1][col+1].getText() == \"O\") && (buttons[row+2][col+2].getText() == \"O\") && (buttons[row+3][col+3].getText() == \"O\")) {\n return 0;\n }\n if((buttons[row][col].getText() == \"X\") && (buttons[row+1][col+1].getText() == \"X\") && (buttons[row+2][col+2].getText() == \"X\") && (buttons[row+3][col+3].getText() == \"X\")) {\n return 1;\n }\n\n //Diagonal Bottom left to top right checker\n if((buttons[row][col].getText() == \"O\") && (buttons[row-1][col+1].getText() == \"O\") && (buttons[row-2][col+2].getText() == \"O\") && (buttons[row-3][col+3].getText() == \"O\")) {\n return 0;\n }\n if((buttons[row][col].getText() == \"X\") && (buttons[row-1][col+1].getText() == \"X\") && (buttons[row-2][col+2].getText() == \"X\") && (buttons[row-3][col+3].getText() == \"X\")) {\n return 1;\n }\n }\n }\n return 2;\n }", "int checkWinner(char mark) {\n\t\tint row, col;\n\t\tint result = 0;\n\n\t\tfor (row = 0; result == 0 && row < 3; row++) {\n\t\t\tint row_result = 1;\n\t\t\tfor (col = 0; row_result == 1 && col < 3; col++)\n\t\t\t\tif (theBoard[row][col] != mark)\n\t\t\t\t\trow_result = 0;\n\t\t\tif (row_result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\n\t\t\n\t\tfor (col = 0; result == 0 && col < 3; col++) {\n\t\t\tint col_result = 1;\n\t\t\tfor (row = 0; col_result != 0 && row < 3; row++)\n\t\t\t\tif (theBoard[row][col] != mark)\n\t\t\t\t\tcol_result = 0;\n\t\t\tif (col_result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\n\t\tif (result == 0) {\n\t\t\tint diag1Result = 1;\n\t\t\tfor (row = 0; diag1Result != 0 && row < 3; row++)\n\t\t\t\tif (theBoard[row][row] != mark)\n\t\t\t\t\tdiag1Result = 0;\n\t\t\tif (diag1Result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\t\tif (result == 0) {\n\t\t\tint diag2Result = 1;\n\t\t\tfor (row = 0; diag2Result != 0 && row < 3; row++)\n\t\t\t\tif (theBoard[row][3 - 1 - row] != mark)\n\t\t\t\t\tdiag2Result = 0;\n\t\t\tif (diag2Result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\t\treturn result;\n\t}", "private boolean checkDiagonalWin(BoardPosition lastPos){\r\n int i, j, k, countTop, countBottom;\r\n int check = 5;\r\n\r\n //checking for diagonals from top to bottom\r\n for(i = 0; i < (yMax-yMax)+5; i++){\r\n for(j = 0; j < (xMax / 2); j++){\r\n countTop = 0;\r\n for(k = 0; k < check; k++){\r\n if(grid[i+k][j+(2*k)] == lastPos.getPlayer()) {\r\n countTop++;\r\n }\r\n }\r\n if(countTop == win) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n //checking for diagonals from bottom to top\r\n for(i = yMax-1; i > (yMax-yMax)+3; i--){\r\n for(j = 0; j < (xMax / 2); j++){\r\n countBottom = 0;\r\n for(k = 0; k < check; k++){\r\n if(grid[i-k][j+(2*k)] == lastPos.getPlayer()) {\r\n countBottom++;\r\n }\r\n }\r\n if(countBottom == win) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }", "static boolean checkForDiagonalPositions(int i, int j, String[][] board, boolean playerWins) {\r\n\t\tif ((board[i][j].equals(board[0][2]) && board[0][2].equals(\"*\") && board[i][j].equals(board[1][1])\r\n\t\t\t\t&& board[1][1].equals(\"*\") && board[i][j].equals(board[2][0]) && board[2][0].equals(\"*\"))\r\n\t\t\t\t|| (board[i][j].equals(board[0][0]) && board[0][0].equals(\"*\") && board[i][j].equals(board[1][1])\r\n\t\t\t\t\t\t&& board[1][1].equals(\"*\") && board[i][j].equals(board[2][2]) && board[2][2].equals(\"*\"))) {\r\n\t\t\tplayerWins = true;\r\n\t\t}\r\n\t\treturn playerWins;\r\n\t}", "public static boolean checkWinner(){\n \n if(board[0][0] == board[0][1] && board[0][1] == board[0][2] && (board[0][0] == 'x' || board [0][0] == 'o'))\n return true;\n else if(board[1][0] == board[1][1] && board[1][1] == board[1][2] && (board[1][0] == 'x' || board[1][0] == 'o'))\n return true;\n else if(board[2][0] == board[2][1] && board[2][1] == board[2][2] && (board[2][0] == 'x' || board[2][0] == 'o'))\n return true;\n else if(board[0][0] == board[1][0] && board[1][0] == board[2][0] && (board[0][0] == 'x' || board[0][0] == 'o'))\n return true;\n else if(board[0][1] == board[1][1] && board[1][1] == board[2][1] && (board[0][1] == 'x' || board[0][1] == 'o'))\n return true;\n else if(board[0][2] == board[1][2] && board[1][2] == board[2][2] && (board[0][2] == 'x' || board[0][2] == 'o'))\n return true;\n else if(board[0][0] == board[1][1] && board[1][1] == board[2][2] && (board[0][0] == 'x' || board[0][0] == 'o'))\n return true;\n else if(board[0][2] == board[1][1] && board[1][1] == board[2][0] && (board[0][2] == 'x' || board[0][2] == 'o'))\n return true;\n else\n return false;\n \n }", "private boolean checkIfGameIsWon() {\n\t\t//loop through rows\n\t\tfor (int i = 0; i < NUMBER_OF_ROWS; i++) {\n\t\t\t//gameIsWon = this.quartoBoard.checkRow(i);\n\t\t\tif (this.quartoBoard.checkRow(i)) {\n\t\t\t\tSystem.out.println(\"Win via row: \" + (i) + \" (zero-indexed)\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//loop through columns\n\t\tfor (int i = 0; i < NUMBER_OF_COLUMNS; i++) {\n\t\t\t//gameIsWon = this.quartoBoard.checkColumn(i);\n\t\t\tif (this.quartoBoard.checkColumn(i)) {\n\t\t\t\tSystem.out.println(\"Win via column: \" + (i) + \" (zero-indexed)\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//check Diagonals\n\t\tif (this.quartoBoard.checkDiagonals()) {\n\t\t\tSystem.out.println(\"Win via diagonal\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public static boolean isBlackWin(char[][] board){\r\n for (int r= 0; r < 6; r++ ){\r\n for (int c = 0; c < 7; c++){\r\n if (r < 3){\r\n if (board [r][c] =='b' && board [r + 1][c] =='b' && board [r + 2][c] =='b' && board [r + 3][c] =='b' ){\r\n return true;\r\n }\r\n }\r\n if (c < 4){\r\n if (board [r][c] =='b' && board [r][c + 1] =='b' && board [r ][c + 2] =='b' && board [r][c + 3] =='b' ){\r\n return true;\r\n }\r\n }\r\n\r\n \r\n }\r\n }\r\n \r\n for (int r = 0; r < 3; r++){\r\n for (int c = 0; c < 4; c++){\r\n if (board [r][c] =='b' && board [r + 1][c +1 ] =='b' && board [r + 2][c +2] =='b' && board [r + 3][c +3 ] =='b' ){\r\n return true; }\r\n }\r\n }\r\n\r\n for (int r = 0; r < 3 ; r++){\r\n for (int c = 6; c > 2; c--){\r\n if (board [r][c] =='b' && board [r + 1][c - 1 ] =='b' && board [r + 2][c - 2] =='b' && board [r + 3][c - 3 ] =='b' ){\r\n return true; }\r\n }\r\n }\r\n return false;\r\n }", "public int checkWin(){\n //check for horizontal and vertical wins\n for(int i=0; i<3; i++){\n if(gameBoard[i][0].equals(\"O\") && gameBoard[i][1].equals(\"O\") && gameBoard[i][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[i][0].equals(\"X\") && gameBoard[i][1].equals(\"X\") && gameBoard[i][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][i].equals(\"O\") && gameBoard[1][i].equals(\"O\") && gameBoard[2][i].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][i].equals(\"X\") && gameBoard[1][i].equals(\"X\") && gameBoard[2][i].equals(\"X\")){\n return 2;\n }\n }\n //check for both diagonal cases\n if(gameBoard[0][0].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][2].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][0].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][0].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][2].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][0].equals(\"X\")){\n return 2;\n }\n return 0;\n }", "public boolean isWinner(int player) {\n\n\t\tint winnerCounter1 = 0;\n\t\tint winnerCounter2 = 0;\n\t\tint winnerCounter3 = 0;\n\t\tint delta = 0;\n\n//\t\t * grid [size][size] där size = 4;\n//\t\t * for (int x = 0; x < grid.length; x++)\n//\t\t * for (int y = 0; y < grid[x].length; y++)\n//\t\t * Här förklarar jag hur funkar de här två forloop:\n//\t\t * nummert efter siffran är indexet\n//\t\t * X0Y0 X1Y0 X2Y0 X3Y0\n//\t\t * X0Y1 X1Y1 X2Y1 X3Y1\n//\t\t * X0Y2 X1Y2 X2Y2 X3Y2\n//\t\t * X0Y3 X1Y3 X2Y3 X3Y3\n\n\t\tfor (int x = 0; x < getSize(); x++) {\n\t\t\tfor (int y = 0; y < getSize(); y++) {\n\t\t\t\tif (grid[y][x] == player)\n\t\t\t\t\twinnerCounter1++;\n\t\t\t\telse\n\t\t\t\t\twinnerCounter1 = 0;\n\t\t\t\tif (winnerCounter1 >= INROW) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (grid[x][y] == player)\n\t\t\t\t\twinnerCounter2++;\n\t\t\t\telse\n\t\t\t\t\twinnerCounter2 = 0;\n\t\t\t\tif (winnerCounter2 >= INROW) {\n\t\t\t\t\tSystem.out.println(\"2\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twinnerCounter1 = 0;\n\t\t\twinnerCounter2 = 0;\n\t\t}\n\n\t\tfor (int x = 0; x < getSize(); x++) { // diagonally\n\t\t\tfor (int y = 0; y < getSize(); y++) {\n\t\t\t\twhile (x + delta < grid.length - 1 && y + delta < grid.length - 1) {\n\t\t\t\t\tif (grid[x + delta][y + delta] == player) {\n\t\t\t\t\t\twinnerCounter3++;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t\tif (winnerCounter3 == INROW) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\twinnerCounter3 = 0;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\twinnerCounter3 = 0;\n\t\t\t\tdelta = 0;\n\t\t\t\twhile (x - delta >= 0 && y + delta < grid.length - 1) {\n\t\t\t\t\tif (grid[x - delta][y + delta] == player) {\n\t\t\t\t\t\twinnerCounter3++;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t\tif (winnerCounter3 == INROW) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\twinnerCounter3 = 0;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn false;\n\n\t}", "private int[] nextDiagWin(){ \r\n\t\t//left diagonal\r\n\t\tif (board[0][0] == board[1][1] && board[2][2] == '-' && board[0][0] != '-'){\r\n\t\t\tdiagWin[0] = 2; \r\n\t\t\tdiagWin[1] = 2;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\telse if (board[1][1] == board[2][2] && board[0][0] == '-' && board[1][1] != '-'){\r\n\t\t\tdiagWin[0] = 0; \r\n\t\t\tdiagWin[1] = 0;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\telse if (board[0][0] == board[2][2] && board[1][1] == '-' && board[0][0] != '-'){\r\n\t\t\tdiagWin[0] = 1; \r\n\t\t\tdiagWin[1] = 1;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\t//right diagonal\r\n\t\telse if (board[0][2] == board[2][0] && board[1][1] == '-' && board[0][2] != '-'){\r\n\t\t\tdiagWin[0] = 1; \r\n\t\t\tdiagWin[1] = 1;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\telse if (board[0][2] == board[1][1] && board[2][0] == '-' && board[0][2] != '-'){\r\n\t\t\tdiagWin[0] = 2; \r\n\t\t\tdiagWin[1] = 0;\r\n\t\t\treturn diagWin;\r\n\t\t}\t\t\r\n\t\telse if (board[1][1] == board[2][0] && board[0][2] == '-' && board[1][1] != '-'){\r\n\t\t\tdiagWin[0] = 0; \r\n\t\t\tdiagWin[1] = 2;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\treturn diagWin;\r\n\t}", "private void winConditionCheck()\r\n {\r\n boolean win;\r\n char mark;\r\n for(int row = 0; row < 3; row++)\r\n {\r\n win = true;\r\n mark = buttons[row][0].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int column = 0; column < 3; column++)\r\n {\r\n if(mark != buttons[row][column].getText().charAt(0))\r\n {\r\n win = false;\r\n break;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n }\r\n for(int column = 0; column < 3; column++)\r\n {\r\n win = true;\r\n mark = buttons[0][column].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int row = 0; row < 3; row++)\r\n {\r\n if(mark != buttons[row][column].getText().charAt(0))\r\n {\r\n win = false;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n }\r\n win = false;\r\n mark = buttons[0][0].getText().charAt(0);\r\n if(mark != ' ')\r\n {\r\n for(int i = 0; i < 3; i++)\r\n {\r\n if(buttons[i][i].getText().charAt(0) != mark)\r\n {\r\n win = false;\r\n break;\r\n }\r\n else\r\n {\r\n win = true;\r\n }\r\n }\r\n if(win)\r\n {\r\n gameEnd(mark);\r\n }\r\n }\r\n mark = buttons[1][1].getText().charAt(0);\r\n if((buttons[0][2].getText().charAt(0) == buttons[1][1].getText().charAt(0)) && (buttons[1][1].getText().charAt(0) == buttons[2][0].getText().charAt(0)) && (buttons[1][1].getText().charAt(0) != ' '))\r\n {\r\n gameEnd(mark);\r\n }\r\n }", "private void checkVictory() {\n\t\tboolean currentWin = true;\n\t\t\n\t\t//Vertical win\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][yGuess] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Horizontal win\n\t\tcurrentWin = true;\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[xGuess][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Top left bottom right diagonal win\n\t\tcurrentWin = true;\n\t\tif (xGuess == yGuess){\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t}\n\t\t\n\t\t//Bottom left top right diagonal win\n\t\tcurrentWin = true;\n\t\tif (yGuess + xGuess == DIVISIONS - 1){\n\t\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\t\tif (gameArray[i][(DIVISIONS - 1) -i] != currentPlayer){\n\t\t\t\t\tcurrentWin = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentWin){\n\t\t\t\tgameWon = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public boolean isWinTurn() {\n for (int col = 0; col < mColsCount; col++) {\n if (isFourConnected(getCurrentPlayer(), 0, 1, 0, col, 0)\n || isFourConnected(getCurrentPlayer(), 1, 1, 0, col, 0)\n || isFourConnected(getCurrentPlayer(), -1, 1, 0, col, 0)) {\n hasWinner = true;\n return true;\n }\n }\n\n for (int row = 0; row < mRowsCount; row++) {\n if (isFourConnected(getCurrentPlayer(), 1, 0, row, 0, 0)\n || isFourConnected(getCurrentPlayer(), 1, 1, row, 0, 0)\n || isFourConnected(getCurrentPlayer(), -1, 1, row, mColsCount - 1, 0)) {\n hasWinner = true;\n return true;\n }\n }\n\n return false;\n }", "public static boolean checkWin(int[][] board) {\n boolean win = true;\n\n //loops through rows\n for (int i = 0; i < board.length; i++) {\n int checkrow[] = new int[9];\n int checkcol[] = new int[9];\n\n //loops through columns and stores the numbers in that row and in that column\n for (int j = 0; j < board.length; j++) {\n checkrow[j] = board[i][j];\n checkcol[j] = board[j][i];\n }\n\n Arrays.sort(checkrow);//sorts the numbers\n Arrays.sort(checkcol);\n\n //checks the sorted numbers to see if there is a winnner by checking the values of the\n //sorted array. first number in the array with 1, second with 2, third with 3 etc...\n // if the numbers dont match at any point then there was not a winner and the program returns\n //false.\n for (int x = 1; x < board.length; x++) {\n if (checkrow[x] != x + 1 || checkcol[x] != x + 1) {\n win = false;\n return win;\n }\n }\n }\n\n return win;\n }", "public boolean checkWin() {\n for (int i = 0; i <= 7; i++) {\n for (int j = 0; j <= 4; j++) {\n if (grid[i][j].equals(\"X\") && grid[i][j + 1].equals(\"X\") && grid[i][j + 2].equals(\"X\") && grid[i][j + 3].equals(\"X\")) {\n return true;\n }\n\n\n }\n\n }\n return false;\n }", "private boolean win(int row, int col, int player)\n {\n int check;\n // horizontal line\n // Start checking at a possible and valid leftmost point\n for (int start = Math.max(col - 3, 0); start <= Math.min(col,\n COLUMNS - 4); start++ )\n {\n // Check 4 chess horizontally from left to right\n for (check = 0; check < 4; check++ )\n {\n // The coordinate of column increases 1 every time\n if (chessBoard[row][start + check] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n\n // vertical line\n // Start checking at the point inputed if there exists at least 3 rows under\n // it.\n if (row + 3 < ROWS)\n {\n // Check another 3 chess vertically from top to bottom\n for (check = 1; check < 4; check++ )\n {\n // The coordinate of row increases 1 every time\n // Check if the chess all belong to the player\n if (chessBoard[row + check][col] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n\n // diagonal line \"\\\"\n // Start checking at a possible and valid leftmost and upmost point\n for (int start = Math.max(Math.max(col - 3, 0), col - row); start <= Math\n .min(Math.min(col, COLUMNS - 4), col + ROWS - row - 4); start++ )\n {\n // Check 4 chess diagonally from left and top to right and bottom\n for (check = 0; check < 4; check++ )\n {\n // The coordinate of row increases 1 every time\n // The coordinate of column increases 1 every time\n // Check if the chess all belong to the player\n if (chessBoard[row - col + start + check][start + check] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n\n // diagonal line \"/\"\n // Start checking at a possible and valid leftmost and downmost point\n for (int start = Math.max(Math.max(col - 3, 0),\n col - ROWS + row + 1); start <= Math.min(Math.min(col, COLUMNS - 4),\n col + row - 3); start++ )\n {\n // Check 4 chess diagonally from left and bottom to right and up\n for (check = 0; check < 4; check++ )\n {\n // The coordinate of row decreases 1 every time\n // The coordinate of column increases 1 every time\n // Check if the chess all belong to the player\n if (chessBoard[row + col - start - check][start + check] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n // no checking passed, not win\n return false;\n }", "boolean isWinner() {\n if(checkTopLeftDownDiag('X') || checkTopLeftDownDiag('O')) {\n return true;\n } else if (checkBottomLeftUpDiag('X') || checkBottomLeftUpDiag('O')) {\n return true;\n } else if (checkRows('X') || checkRows('O')){\n return true;\n }\n else if (checkColumns('X') || checkColumns('O')){\n return true;\n }\n\n return false;\n }", "public boolean check2DDimWinner(Cell play) {\n\t\tfor(int row = 0; row < board.length; row++) {// for row\n\t\t\tfor(int col = 0; col < board.length; col++) {// for col\n\t\t\t\tif(board[0][row][col] == board[1][row][col] && board[1][row][col]==board[2][row][col] && board[2][row][col]==board[3][row][col] && board[3][row][col].equals(play)) \n\t\t\t\t{\n\t\t\t\t\t//\t\t\t\t\tSystem.out.println(\"Dimensional win by \"+play.toString()+ \" at row=\" + row +\" & col= \" + col);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "private boolean isWin() {\n int continueCount = 1; // number of continue ticTacToees\n \t// west direction\n for (int x = xIndex - 1; x >= 0; x--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, yIndex, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// east direction\n for (int x = xIndex + 1; x <= ROWS; x++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, yIndex, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n \t\n \t// north direction\n for (int y = yIndex - 1; y >= 0; y--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(xIndex, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// south direction\n for (int y = yIndex + 1; y <= ROWS; y++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(xIndex, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n \t// northeast direction\n for (int x = xIndex + 1, y = yIndex - 1; y >= 0 && x <= COLS; x++, y--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// southeast direction\n for (int x = xIndex - 1, y = yIndex + 1; y <= ROWS && x >= 0; x--, y++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n \t// northwest direction\n for (int x = xIndex - 1, y = yIndex - 1; y >= 0 && x >= 0; x--, y--) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n \t// southwest direction\n for (int x = xIndex + 1, y = yIndex + 1; y <= ROWS && x <= COLS; x++, y++) {\n Color c = isBlack ? Color.black : Color.white;\n if (getTicTacToe(x, y, c) != null) {\n continueCount++;\n } \n else\n break;\n }\n if (continueCount >= 3) {\n return true;\n } \n else\n continueCount = 1;\n \n return false;\n }", "private boolean winsByDiagonalTopLeftToBottomRight(char symbol){\n int max_diagonal_count = 0;\n\n // Deals with the diagonals below the midpoint in the array. Iterates through diagonals from last row to the\n // first row.\n for (int i = this.boardRows - 1; i > 0; i--) {\n\n // reset counter at each new diagonal\n int count = 0;\n\n // Iterates through the diagonal with origin (top left point) at first element of row i\n for (int j = 0, x = i; x < this.boardRows; j++, x++) {\n\n // If j surpasses the number of available cols we break out the inner for loop. This happens when the\n // num of rows and cols in the array are different\n if (j>=this.boardColumns){\n break;\n }\n // If char symbol is the same as the element in the diagonal, we increment counter by 1 and update\n // max_diagonal_count if possible.\n if(symbol == this.gameBoard[x][j]){\n count+=1;\n\n if (count>max_diagonal_count){\n max_diagonal_count=count;\n }\n }\n //Otherwise, we reset the counter to 0\n else {\n count = 0;\n }\n }\n }\n\n // Deals with the diagonals at and after the midpoint in the array. Iterates through diagonals from first column to the\n // last column\n for (int i = 0; i < this.boardColumns; i++) {\n\n // Resets counter for each new diagonal\n int count = 0;\n\n // Iterates through diagonal values with origin (top left point) at first element of col i\n for (int j = 0, y = i; y < this.boardColumns; j++, y++) {\n\n // If j surpasses the number of available cols we break out the inner for loop. This happens when the\n // num of rows and cols in the array are different\n if (j>=this.boardRows){\n break;\n }\n\n // If char symbol is the same as the element in the diagonal, we increment counter by 1 and update\n // max_diagonal_count if possible.\n if(symbol == this.gameBoard[j][y]){\n count+=1;\n\n if (count>max_diagonal_count){\n max_diagonal_count=count;\n }\n }\n //Otherwise, we reset the counter to 0\n else {\n count = 0;\n }\n }\n }\n\n // If the max_diagonal_count is greater than or equal to tilesNeeded, then we have sufficient tiles in a diagonal\n // for char symbol to win so we return true. Otherwise, we return false.\n if (max_diagonal_count >= this.tilesNeeded){\n return true;\n }\n else {\n return false;\n }\n\n }", "public static boolean ai_NESW(int[][] gameGrid, int pieceTracker, int colNum) //Minor\n\t{\n\t\tint streakBonus = 0;\n\t\tcounter++; //Used to make variations in the AI move logic\n\t\tint rowNum = 0; //Used to store the row when finding the row we need to check for win condition\n\t\t//The loop below is used to find the row of last piece dropped to find exact position\n\t\tfor (int posTracker = 0; posTracker < ConnectFour.getRows(); posTracker++)\n\t\t{\n\t\t\t\n\t\t\tif (gameGrid[posTracker][colNum] != 0)\n\t\t\t{\n\t\t\t\trowNum = posTracker;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int rowTracker = rowNum + 1, colTracker = colNum - 1; colTracker >= 0 && rowTracker < ConnectFour.getRows(); rowTracker++ ,colTracker--)\n\t\t{\t\n\t\t\tif (counter %2 == 0) //Used to make the switch in the AI move logic\n\t\t\t\tbreak;\n\t\t\tif (gameGrid[rowTracker][colTracker] == pieceTracker) //Increments the streak if consecutive pieces are found\n\t\t\t{\n\t\t\t\tstreakBonus++; \n\t\t\t\tif (streakBonus >= 2)\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker - 1 > 0) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker-1); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker - 2 > 0) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker-2); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse \n\t\t\t\tstreakBonus = 0;\n\t\t}\n\t\tfor (int colTracker = colNum + 1, rowTracker = rowNum - 1; colTracker < ConnectFour.getCols() && rowTracker >= 0; rowTracker--, colTracker++)\n\t\t{\n\t\t\tif (gameGrid[rowTracker][colTracker] == pieceTracker) //Increments the streak if consecutive pieces are found\n\t\t\t{\n\t\t\t\tstreakBonus++;\n\t\t\t\tif (streakBonus >= 2)\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker + 1 < ConnectFour.getCols()) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker+1); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker + 2 < ConnectFour.getCols()) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker+2); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse \n\t\t\t\tstreakBonus = 0;\n\t\t}\n\t\treturn false; //if steak is not found\n\t}", "boolean isWinner() {\n boolean win = true;\n // first method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if ((state[i][j] == 'X' && stateGame[i][j] != '*') || (state[i][j] != 'X' && stateGame[i][j] == '*'))\n win = false;\n }\n }\n if (win)\n return true;\n\n win = true;\n // second method to win\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if (state[i][j] == '.' && stateGame[i][j] == '.')\n win = false;\n }\n }\n return win;\n }", "public boolean isGameOver() {\n if (winner == null) {\n Piece[] diagOne = new Piece[this.size];\n Piece[] diagTwo = new Piece[this.size];\n for (int col = 0; col < _board.length; col += 1) {\n diagOne[col] = _board[col][col];\n diagTwo[col] = _board[col][this.size - 1 - col];\n if (isWinning(_board[col])) {\n alternatePlayer(currPlayer);\n winner = currPlayer;\n return true;\n }\n }\n this.transpose();\n for (int row = 0; row < _board[0].length; row += 1) {\n if (isWinning(this._board[row])) {\n this.transpose();\n alternatePlayer(currPlayer);\n winner = currPlayer;\n return true;\n }\n }\n\n this.transpose();\n\n if (isWinning(diagOne) || isWinning(diagTwo)) {\n alternatePlayer(currPlayer);\n winner = currPlayer;\n return true;\n }\n if (checkTie()) {\n return true;\n }\n }\n return false;\n }", "@Override\r\n\t\t\tpublic boolean isWinner() {\r\n\t\t\t\tif(isWinnerInRow() || isWinnerInCol() || isWinnerInDownwardDiag() || isWinnerInUpwardDiag()){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}", "private boolean checkWinner(){\n String [][] field = new String[3][3];\n for(int i = 0; i<3; i++){\n for(int j = 0; j<3; j++){\n field[i][j] = buttons[i][j].getText().toString();\n }\n }\n\n //check the vertical is win\n for(int i = 0; i<3; i++){\n if (field[i][0].equals(field[i][1])\n && field[i][0].equals(field[i][2])\n && !field[i][0].equals(\"\")){\n buttons[i][0].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[i][1].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[i][2].setTextColor(Color.parseColor(\"#FFD145\"));\n return true;\n }\n }\n\n //check the horizontal is win\n for(int i = 0; i<3; i++){\n if (field[0][i].equals(field[1][i])\n && field[0][i].equals(field[2][i])\n && !field[0][i].equals(\"\")){\n buttons[0][i].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[1][i].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[2][i].setTextColor(Color.parseColor(\"#FFD145\"));\n return true;\n }\n }\n\n //check the slash case 1(\"\\\") is win\n for(int i = 0; i<3; i++){\n if (field[0][0].equals(field[1][1])\n && field[0][0].equals(field[2][2])\n && !field[0][0].equals(\"\")){\n buttons[0][0].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[1][1].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[2][2].setTextColor(Color.parseColor(\"#FFD145\"));\n return true;\n }\n }\n\n //check the slash case 2(\"/\") is win\n for(int i = 0; i<3; i++){\n if (field[0][2].equals(field[1][1])\n && field[0][2].equals(field[2][0])\n && !field[0][2].equals(\"\")){\n buttons[0][2].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[1][1].setTextColor(Color.parseColor(\"#FFD145\"));\n buttons[2][0].setTextColor(Color.parseColor(\"#FFD145\"));\n return true;\n }\n }\n return false;\n }", "public boolean win() {\n for (int i = 0; i < getBoard().length; i++) {\n for (int j = 0; j < getBoard()[i].length; j++) {\n if (!getBoard(i, j).getClicked() && !getBoard(i, j).getMine()) {\n return false;\n }\n }\n }\n for (int i = 0; i < getBoard().length; i++) {\n for (int j = 0; j < getBoard()[i].length; j++) {\n if (getBoard(i, j).getMine()) {\n getBoard(i, j).setFlagged();\n getBoard(i, j).repaint();\n }\n }\n }\n return true;\n }", "public int terminalTest(int[][] gameBoard) {\n for (int col = 0; col < gameBoard.length; col++) {\n for (int row = 0; row < gameBoard[col].length - 3; row++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col][row + 1] == 1 &&\n gameBoard[col][row + 2] == 1 &&\n gameBoard[col][row + 3] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col][row + 1] == 2 &&\n gameBoard[col][row + 2] == 2 &&\n gameBoard[col][row + 3] == 2) {\n return 2;\n }\n }\n }\n\n // check for horizontal win (searching to the right)\n for (int row = 0; row < gameBoard[0].length; row++) {\n for (int col = 0; col < gameBoard.length - 3; col++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col + 1][row] == 1 &&\n gameBoard[col + 2][row] == 1 &&\n gameBoard[col + 3][row] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col + 1][row] == 2 &&\n gameBoard[col + 2][row] == 2 &&\n gameBoard[col + 3][row] == 2) {\n return 2;\n }\n }\n }\n\n // check for diagonal win (searching down + right)\n for (int col = 0; col < gameBoard.length - 3; col++) {\n for (int row = 0; row < gameBoard[col].length - 3; row++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col + 1][row + 1] == 1 &&\n gameBoard[col + 2][row + 2] == 1 &&\n gameBoard[col + 3][row + 3] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col + 1][row + 1] == 2 &&\n gameBoard[col + 2][row + 2] == 2 &&\n gameBoard[col + 3][row + 3] == 2) {\n return 2;\n }\n }\n }\n\n // check for diagonal win (searching down + left)\n for (int col = gameBoard.length - 1; col >= 3; col--) {\n for (int row = 0; row < gameBoard[col].length - 3; row++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col - 1][row + 1] == 1 &&\n gameBoard[col - 2][row + 2] == 1 &&\n gameBoard[col - 3][row + 3] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col - 1][row + 1] == 2 &&\n gameBoard[col - 2][row + 2] == 2 &&\n gameBoard[col - 3][row + 3] == 2) {\n return 2;\n }\n }\n }\n\n return 0; // neither player has won\n }", "private static String gameStatus(char[][] board){\n\t\t\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\t// check horizontal lines && vertical lines for player x\n\t\t\tif ((board[i][0] == 'X' && board[i][1] == 'X' && board[i][2] == 'X') || \n\t\t\t\t\t(board[0][i] == 'X' && board[1][i] == 'X' && board[2][i] == 'X')){\n\t\t\t\twinner = 'X';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for x\n\t\tif ((board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X') || \n\t\t\t\t(board[0][2] == 'X' && board[1][1] == 'X' && board[2][0] == 'X')){\n\t\t\twinner = 'X';\n\t\t\treturn \"true\";\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 3 ; i++) {\n\t\t\t// check horizontal and vertical lines for player o\n\t\t\tif ((board[i][0] == 'O' && board[i][1] == 'O' && board[i][2] == 'O') || \n\t\t\t\t\t(board[0][i] == 'O' && board[1][i] == 'O' && board[2][i] == 'O')){\n\t\t\t\twinner = 'O';\n\t\t\t\treturn \"true\";\n\t\t\t}\n\t\t}\n\t\t//check diags for o\n\t\tif ((board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O') || \n\t\t\t\t(board[0][2] == 'O' && board[1][1] == 'O' && board[2][0] == 'O')){\n\t\t\twinner = 'O';\n\t\t\treturn \"true\";\n\t\t}\n\n\t\t// check for tie\n\t\tint emptyCells = 9;\n\t\tfor (int i = 0; i < 3; i++){\n\t\t\tfor (int j = 0; j < 3; j++){\n\t\t\t\tif (board[i][j]!='\\0') emptyCells -= 1;\t\t\n\t\t\t}\n\t\t}\n\t\t// if all cells are filled, game is over with a tie\n\t\tif (emptyCells == 0) return \"tie\";\n\n\t\t// otherwise game is not over and return false\n\t\t//printBoard(board);\n\n\t\treturn \"false\";\n\t}", "private boolean colWin(){ \r\n\t\tfor (int i=0; i<3; i++){ \r\n\t\t\tif (checkValue (board[0][i], board[1][i], board[2][i]))\r\n\t\t\t\treturn true; \r\n\t\t}\r\n\t\treturn false; \r\n\t}", "private boolean checkPlayerOneWin()\n {\n boolean playerOneWin = false;\n \n if( board[0][0] == \"X\" && board[0][1] == \"X\" && board[0][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[1][0] == \"X\" && board[1][1] == \"X\" && board[1][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[2][0] == \"X\" && board[2][1] == \"X\" && board[2][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][0] == \"X\" && board[1][0] == \"X\" && board[2][0] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][1] == \"X\" && board[1][1] == \"X\" && board[2][1] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[2][0] == \"X\" && board[2][1] == \"X\" && board[2][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][0] == \"X\" && board[1][1] == \"X\" && board[2][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][2] == \"X\" && board[1][1] == \"X\" && board[2][0] == \"X\" )\n {\n playerOneWin = true;\n }\n \n return playerOneWin;\n }", "private int checkWinner() {\n if (this.turnCount >= 2) {\n int colWin = this.checkColumn();\n if (colWin > 0) {\n return colWin;\n }\n\n int rowWin = this.checkRow();\n if (rowWin > 0) {\n return rowWin;\n }\n\n int diagWin = checkDiagonal();\n if (diagWin > 0) {\n return diagWin;\n }\n }\n return 0;\n }", "private boolean winCheck(int x, int y, char symbol){\n\t\t/* Horizontal */\n\t\tif(y>=2 && board[x][y-2]==symbol && board[x][y-1]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(y>=1 && y+1<size && board[x][y-1]==symbol && board[x][y]==symbol && board[x][y+1]==symbol)\n\t\t\treturn true;\n\t\tif(y+2<size && board[x][y]==symbol && board[x][y+1]==symbol && board[x][y+2]==symbol)\n\t\t\treturn true;\n\t\t\n\t\t/* Vertical */\n\t\tif(x>=2 && board[x-2][y]==symbol && board[x-1][y]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(x>=1 && x+1<size && board[x-1][y]==symbol && board[x][y]==symbol && board[x+1][y]==symbol)\n\t\t\treturn true;\n\t\tif(x+2<size && board[x][y]==symbol && board[x+1][y]==symbol && board[x+2][y]==symbol)\n\t\t\treturn true;\n\t\t\n\t\t/* Main Diagonal */\n\t\tif(x>=2 && y>=2 && board[x-2][y-2]==symbol && board[x-1][y-1]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(x>=1 && x+1<size && y>=1 && y+1<size && board[x-1][y-1]==symbol && board[x][y]==symbol && board[x+1][y+1]==symbol)\n\t\t\treturn true;\n\t\tif(x+2<size && y+2<size && board[x][y]==symbol && board[x+1][y+1]==symbol && board[x+2][y+2]==symbol)\n\t\t\treturn true;\n\t\t\n\t\t/* Anti Diagonal */\n\t\tif(x>=2 && y+2<size && board[x-2][y+2]==symbol && board[x-1][y+1]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(x>=1 && x+1<size && y>=1 && y+1<size && board[x+1][y-1]==symbol && board[x][y]==symbol && board[x-1][y+1]==symbol)\n\t\t\treturn true;\n\t\tif(x+2<size && y>=2 && board[x][y]==symbol && board[x+1][y-1]==symbol && board[x+2][y-2]==symbol)\n\t\t\treturn true;\n\t\t\n\t\treturn false;\n\t}", "public static boolean hasWinningMove(int[][] gamePlay){\n\t\tfor(int i=0;i<4;i++){\n\t\t\tfor(int j=0;j<4;j++){\n\t\t\t\tif(gamePlay[i][j]==1){\n\t\t\t\t\tfor(int k=1;k<9;k++){\n\t\t\t\t\t\tint[] root={i,j};\n\t\t\t\t\t\tint[] root1={i,j};\n\t\t\t\t\t\tint[] source=root;\n\t\t\t\t\t\tsource=calculatePosition(root,k);\n\t\t\t\t\t\t//System.out.println(\"Looking in direction \"+k+\" For root\"+i+\",\"+j);\n\t\t\t\t\t\tif(isValidLocation(source)){ \n\t\t\t\t\t\t\tif(gamePlay[source[0]][source[1]]==1){\n\t\t\t\t\t\t\t\tint[] newSource=calculatePosition(source,k);\n\t//System.out.println(\"Two contigous isValid:\"+isValidLocation(newSource)+\"newSource(\"+newSource[0]+\",\"+newSource[1]+\")\"+\" gamePlay:\"+(isValidLocation(newSource)?gamePlay[newSource[0]][newSource[1]]:-1));\n\t\t\t\t\t\t\t\tif(isValidLocation(newSource)){ \n\t\t\t\t\t\t\t\t\tif(gamePlay[newSource[0]][newSource[1]]==0){\n\t\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t//System.out.println(\"Looking in opposite direction\");\n\t\t\t\t\t\t\t\t\t//Lookup in opposite direction\n\t\t\t\t\t\t\t\t\tnewSource=calculatePosition(root1,9-k);\n\t\t\t\t\t\t\t\t\tif(isValidLocation(newSource) && gamePlay[newSource[0]][newSource[1]]==1){\n\t\t\t\t\t\t\t\t\t\t//System.out.println(\"Valid Location:\"+newSource[0]+\" \"+newSource[1]+\" gamePlay\"+gamePlay[newSource[0]][newSource[1]]);\n\t\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t}\t\t\n\t\t\t\t\t\t\t}else if(gamePlay[source[0]][source[1]]==0){\n\t\t\t\t\t\t\t\t\t//System.out.println(\"Looking for alternate\");\n\t\t\t\t\t\t\t\t\tsource=calculatePosition(source,k);\n\t\t\t\t\t\t\t\t\tif(isValidLocation(source) && gamePlay[source[0]][source[1]]==1){\n\t\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t//System.out.println(\"Invalid direction or no move here isValid:\"+isValidLocation(source)+\"Source(\"+source[0]+\",\"+source[1]+\")\"+\" gamePlay:\"+(isValidLocation(source)?gamePlay[source[0]][source[1]]:-1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\t\n\t\t\t\t}\t\t\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private boolean fourstonesReached() {\n\t\t\n\t\t\n\t\t//TO-DO: evtl. Abbruch, wenn ein freies Feld entdeckt wird\n\t\t\n\t\tint counter=0;\n\t\t\n\t\t//check horizontal lines\n\t\tfor(int i=0; i<horizontal;i++ ) {\n\t\t\t\n\t\t\tfor(int j=0; j<vertical;j++ ) {\n\t\t\t\t\n\t\t\t\tif(board[i][j] == player.ordinal()) {\n\t\t\t\t\tcounter++;\n\t\t\t\t\tif(counter == 4) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\tcounter=0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\tcounter=0;\n\t\t}\n\t\t\n\t\t\n\t\t//check vertical lines\n\t\tfor(int i=0; i<vertical;i++ ) {\n\t\t\t\n\t\t\tfor(int j=0; j<horizontal;j++ ) {\n\t\t\t\t\n\t\t\t\tif(board[j][i] == player.ordinal()) {\n\t\t\t\t\tcounter++;\n\t\t\t\t\tif(counter == 4) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\tcounter=0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\tcounter=0;\n\t\t}\n\t\t\n\t\t//check diagonal \n\t\tint ordinal = player.ordinal();\n\t\t\n\t\tif( //checking lines from up-left to down-right\n\t\t\t(board[3][0] == ordinal && board[2][1] == ordinal && board[1][2] == ordinal && board[0][3] == ordinal) || \n\t\t\t(board[4][0] == ordinal && board[3][1] == ordinal && board[2][2] == ordinal && board[1][3] == ordinal) ||\n\t\t\t(board[3][1] == ordinal && board[2][2] == ordinal && board[1][3] == ordinal && board[0][4] == ordinal) ||\n\t\t\t(board[5][0] == ordinal && board[4][1] == ordinal && board[3][2] == ordinal && board[2][3] == ordinal) ||\n\t\t\t(board[4][1] == ordinal && board[3][2] == ordinal && board[2][3] == ordinal && board[1][4] == ordinal) ||\n\t\t\t(board[3][2] == ordinal && board[2][3] == ordinal && board[1][4] == ordinal && board[0][5] == ordinal) ||\n\t\t\t(board[5][1] == ordinal && board[4][2] == ordinal && board[3][3] == ordinal && board[2][4] == ordinal) ||\n\t\t\t(board[4][2] == ordinal && board[3][3] == ordinal && board[2][4] == ordinal && board[1][5] == ordinal) ||\n\t\t\t(board[3][3] == ordinal && board[2][4] == ordinal && board[1][5] == ordinal && board[0][6] == ordinal) ||\n\t\t\t(board[5][2] == ordinal && board[4][3] == ordinal && board[3][4] == ordinal && board[2][5] == ordinal) ||\n\t\t\t(board[4][3] == ordinal && board[3][4] == ordinal && board[2][5] == ordinal && board[1][6] == ordinal) ||\n\t\t\t(board[5][3] == ordinal && board[4][4] == ordinal && board[3][5] == ordinal && board[2][6] == ordinal) ||\n\t\t\t\n\t\t\t//checking lines from up-right to down-left\n\t\t\t(board[2][0] == ordinal && board[3][1] == ordinal && board[4][2] == ordinal && board[5][3] == ordinal) ||\n\t\t\t(board[1][0] == ordinal && board[2][1] == ordinal && board[3][2] == ordinal && board[4][3] == ordinal) ||\n\t\t\t(board[2][1] == ordinal && board[3][2] == ordinal && board[4][3] == ordinal && board[5][4] == ordinal) ||\n\t\t\t(board[0][0] == ordinal && board[1][1] == ordinal && board[2][2] == ordinal && board[3][3] == ordinal) ||\n\t\t\t(board[1][1] == ordinal && board[2][2] == ordinal && board[3][3] == ordinal && board[4][4] == ordinal) ||\n\t\t\t(board[2][2] == ordinal && board[3][3] == ordinal && board[4][4] == ordinal && board[5][5] == ordinal) ||\n\t\t\t(board[0][1] == ordinal && board[1][2] == ordinal && board[2][3] == ordinal && board[3][4] == ordinal) ||\n\t\t\t(board[1][2] == ordinal && board[2][3] == ordinal && board[3][4] == ordinal && board[4][5] == ordinal) ||\n\t\t\t(board[2][3] == ordinal && board[3][4] == ordinal && board[4][5] == ordinal && board[5][6] == ordinal) ||\n\t\t\t(board[0][2] == ordinal && board[1][3] == ordinal && board[2][4] == ordinal && board[3][5] == ordinal) ||\n\t\t\t(board[1][3] == ordinal && board[2][4] == ordinal && board[3][5] == ordinal && board[4][6] == ordinal) ||\n\t\t\t(board[0][3] == ordinal && board[1][4] == ordinal && board[2][5] == ordinal && board[3][6] == ordinal)) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "private boolean isWinner(byte player) {\n for (int row = 0; row <= 2; row++) {\n if (board[row][0] == player && board[row][1] == player && board[row][2] == player) {\n return true;\n }\n }\n for (int column = 0; column <= 2; column++) {\n if (board[0][column] == player && board[1][column] == player && board[2][column] == player) {\n return true;\n }\n }\n if (board[0][0] == player && board[1][1] == player && board[2][2] == player) {\n return true;\n } else if (board[0][2] == player && board[1][1] == player && board[2][0] == player) {\n return true;\n } else {\n return false;\n }\n }", "boolean horizontalWin(){\n\t\tint match_counter=1;\n\t\tboolean flag=false;\n\t\tfor(int row=0;row<9;row++){\n\t\t\tfor(int column=0;column<25;column++){\n\t\t\t\tif(Board[row][column]!='\\u0000'){\n\t\t\t\t\tif(Board[row][column]!='O'){\n\t\t\t\t\t\tif (Board[row][column]==Board[row][column+1]){\n\t\t\t\t\t\t\tmatch_counter++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(match_counter==4){\n\t\t\t\t\tflag=true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (flag == true)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn flag;\n\t}", "private boolean hasColWin() {\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n if (getBoard()[i][j] != null) {\n\n boolean colWin = colHasFour(i, j);\n if (colWin) {\n return true;\n }\n\n }\n }\n }\n return false;\n }", "public void actionPerformed(ActionEvent evt) {\n if ( player == 0 ) { // Player O - blackstone\n if (jButton[j].getIcon().equals(B)) {\n jButton[j].setIcon(O); // value of current button read left to right and then top to bottom\n \n board[j/csize][j%csize] = 0;\n int win = 1;\n win = checkrow(board,j/csize,0);\n if ( win == 0 ) {\n win = checkcol(board,j%csize,0);\n }\n if ( win == 0 ) {\n win = checkdiag(board,0 , j/csize, j%csize);\n }\n player = 1; // switches player\n markers++;\n\n if ( win == 1 ) {\n exitAction(\"Blackstone wins!\\n\");\n }\n if ( markers == gsize ) { // if all blocks have been taken\n exitAction(\"Draw!\\n\");\n }\n } \n } else { // Player X - whitestone = 1\n if (jButton[j].getIcon().equals(B)) {\n jButton[j].setIcon(X);\n board[j/csize][j%csize] = 1;\n int win = 1;\n win = checkrow(board,j/csize,1);\n if ( win == 0 ) {\n win = checkcol(board,j%csize,1);\n }\n if ( win == 0 ) {\n win = checkdiag(board, 1, j/csize, j%csize );\n }\n player = 0;\n markers++;\n\n if ( win == 1 ) {\n exitAction(\"Whitestone wins!\\n\");\n }\n if ( markers == gsize ) {\n exitAction(\"Draw!\\n\");\n }\n } \n }\n }", "private void buttonClicked(int c){\r\n boardRep[currentFilled[c]][c] = blackToPlay ? 1:-1; //adjust board rep\r\n if (blackToPlay){\r\n boardSquares[5-currentFilled[c]][c].setBackground(Color.BLACK);\r\n for (int i = 0; i < 7; i++) {\r\n moveSelect[i].setBackground(Color.RED);\r\n }\r\n int y = 5-currentFilled[c];\r\n \r\n \r\n for (int i = 0; i < 4; i++) { //check horizontal for black win\r\n if ((c-3 + i)>-1 && c-3+i<4){\r\n horizontal4s[y][c-3+i]++;\r\n if (horizontal4s[y][c-3+i] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check vertical for black win\r\n if (y-3+i>-1 && y-3+i<3){\r\n vertical4s[y-3+i][c]++;\r\n if (vertical4s[y-3+i][c] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TLBR diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c-3+i>-1 && c-3+i<4){\r\n diagonalTLBR4s[y-3+i][c-3+i]++;\r\n if (diagonalTLBR4s[y-3+i][c-3+i] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TRBL diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c+3-i>-1 && c+3-i < 4){\r\n diagonalTRBL4s[y-3+i][c+3-i]++;\r\n if (diagonalTRBL4s[y-3+i][c+3-i] == 4){\r\n winnerText.setText(\"BLACK WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n \r\n \r\n }\r\n else{\r\n boardSquares[5-currentFilled[c]][c].setBackground(Color.RED);\r\n for (int i = 0; i < 7; i++) {\r\n moveSelect[i].setBackground(Color.BLACK);\r\n }\r\n \r\n int y = 5-currentFilled[c];\r\n \r\n \r\n for (int i = 0; i < 4; i++) { //check horizontal for black win\r\n if ((c-3 + i)>-1 && c-3+i<4){\r\n horizontal4s[y][c-3+i]--;\r\n if (horizontal4s[y][c-3+i] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check vertical for black win\r\n if (y-3+i>-1 && y-3+i<3){\r\n vertical4s[y-3+i][c]--;\r\n if (vertical4s[y-3+i][c] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TLBR diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c-3+i>-1 && c-3+i<4){\r\n diagonalTLBR4s[y-3+i][c-3+i]--;\r\n if (diagonalTLBR4s[y-3+i][c-3+i] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < 4; i++) { //check TRBL diag for black win\r\n if (y-3+i>-1 && y-3+i<3 && c+3-i>-1 && c+3-i < 4){\r\n diagonalTRBL4s[y-3+i][c+3-i]--;\r\n if (diagonalTRBL4s[y-3+i][c+3-i] == -4){\r\n winnerText.setText(\"RED WINS\");\r\n disableMoves();\r\n }\r\n }\r\n }\r\n \r\n \r\n }\r\n blackToPlay = !blackToPlay;\r\n currentFilled[c]++;\r\n if(currentFilled[c] == 6)\r\n moveSelect[c].setEnabled(false);\r\n }", "public boolean checkWin(int x, int y, int player)\n {\n int[][] area = new int[REGION_SIZE][REGION_SIZE];\n // Copy region of board to do win checking\n for (int i = REGION_START; i <= REGION_STOP; i++) {\n for (int j = REGION_START; j <= REGION_STOP; j++) {\n area[i - REGION_START][j - REGION_START] = getTile(x + i, y + j);\n }\n }\n \n //Check Horizontal\n int count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[4][i] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n //Check Vertical\n count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[i][4] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n //Check Diagonal '/'\n count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[REGION_SIZE - 1 - i][i] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n //Check Diagonal '\\'\n count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[i][i] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n return false;\n }", "public int isConnectFour(){\n if(values.length < 4 && values[0].length < 4)\r\n return 0;\r\n // horizontal check\r\n for(int i = 0; i < values.length; i++){\r\n for(int j = 0; j < values[0].length - 3; j++){ // only check to 4th last column\r\n if(values[i][j] == 0)\r\n continue;\r\n else if(values[i][j] == 1 && values[i][j] == values[i][j + 1] && values[i][j] == values[i][j + 2] && values[i][j] == values[i][j + 3] ){ // check for 4 consecutive 1 matches\r\n tokenArray[i][j].setWinner(true); // set 4 tokens as winners\r\n tokenArray[i][j + 1].setWinner(true);\r\n tokenArray[i][j + 2].setWinner(true);\r\n tokenArray[i][j + 3].setWinner(true);\r\n return 1;\r\n }\r\n else if(values[i][j] == 2 && values[i][j] == values[i][j + 1] && values[i][j] == values[i][j + 2] && values[i][j] == values[i][j + 3] ){ // check for 4 consecutive 2 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i][j + 1].setWinner(true);\r\n tokenArray[i][j + 2].setWinner(true);\r\n tokenArray[i][j + 3].setWinner(true);\r\n return 2;\r\n }\r\n }\r\n }\r\n // vertical check\r\n for(int i = 0; i < values.length - 3; i++){ // only check to 4th last row\r\n for(int j = 0; j < values[0].length; j++){\r\n if(values[i][j] == 0)\r\n continue;\r\n else if(values[i][j] == 1 && values[i][j] == values[i + 1][j] && values[i][j] == values[i + 2][j] && values[i][j] == values[i + 3][j] ){ // check for 4 consecutive 1 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i + 1][j].setWinner(true);\r\n tokenArray[i + 2][j].setWinner(true);\r\n tokenArray[i + 3][j].setWinner(true);\r\n return 1;\r\n }\r\n else if(values[i][j] == 2 && values[i][j] == values[i + 1][j] && values[i][j] == values[i + 2][j] && values[i][j] == values[i + 3][j] ){ // check for 4 consecutive 2 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i + 1][j].setWinner(true);\r\n tokenArray[i + 2][j].setWinner(true);\r\n tokenArray[i + 3][j].setWinner(true);\r\n return 2;\r\n }\r\n }\r\n }\r\n // diagonal check (top-left to bottom-right)\r\n for(int i = 0; i < values.length - 3; i++){ // only check to 4th last row\r\n for(int j = 0; j < values[0].length - 3; j++){ // only check to 4th last column\r\n if(values[i][j] == 0)\r\n continue;\r\n else if(values[i][j] == 1 && values[i][j] == values[i + 1][j + 1] && values[i][j] == values[i + 2][j + 2] && values[i][j] == values[i + 3][j + 3] ){ // check for 4 consecutive 1 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i + 1][j + 1].setWinner(true);\r\n tokenArray[i + 2][j + 2].setWinner(true);\r\n tokenArray[i + 3][j + 3].setWinner(true);\r\n return 1;\r\n }\r\n else if(values[i][j] == 2 && values[i][j] == values[i + 1][j + 1] && values[i][j] == values[i + 2][j + 2] && values[i][j] == values[i + 3][j + 3] ){ // check for 4 consecutive 2 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i + 1][j + 1].setWinner(true);\r\n tokenArray[i + 2][j + 2].setWinner(true);\r\n tokenArray[i + 3][j + 3].setWinner(true);\r\n return 2;\r\n }\r\n }\r\n }\r\n // diagonal check (top-right to bottom-left)\r\n for(int i = 0; i < values.length - 3; i++){\r\n for(int j = 3; j < values[0].length; j++){\r\n if(values[i][j] == 0)\r\n continue;\r\n else if(values[i][j] == 1 && values[i][j] == values[i + 1][j - 1] && values[i][j] == values[i + 2][j - 2] && values[i][j] == values[i + 3][j - 3] ){ // check for 4 consecutive 1 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i + 1][j - 1].setWinner(true);\r\n tokenArray[i + 2][j - 2].setWinner(true);\r\n tokenArray[i + 3][j - 3].setWinner(true);\r\n return 1;\r\n }\r\n else if(values[i][j] == 2 && values[i][j] == values[i + 1][j - 1] && values[i][j] == values[i + 2][j - 2] && values[i][j] == values[i + 3][j - 3] ){ // check for 4 consecutive 2 matches\r\n tokenArray[i][j].setWinner(true);\r\n tokenArray[i + 1][j - 1].setWinner(true);\r\n tokenArray[i + 2][j - 2].setWinner(true);\r\n tokenArray[i + 3][j - 3].setWinner(true);\r\n return 2;\r\n }\r\n }\r\n }\r\n return 0;\r\n }", "public static void checkWinner() {\n\t\tcontinueGame = false;\n\t\tfor (int k = 0; k < secretWordLength; k++) {\n\t\t\tif (!unseenBoard.get(k).equals(\"*\")) {\n\t\t\t\tcontinueGame = true;\n\t\t\t}\n\t\t}\n\t}", "private Boolean win(int counter) {\n \n winner = false;\n //if the counter is greater than 8, recognizes that it is a draw\n if (counter >= 8) {\n announce.setText(\"Draw\");\n turn.setText(\"\"); //game ends and is no ones turn\n }\n //list of all of the winning options\n if ((tBoard[0] == tBoard[1] && tBoard[1] == tBoard[2] && tBoard[0] != 2)\n || (tBoard[0] == tBoard[3] && tBoard[3] == tBoard[6] && tBoard[0] != 2)\n || (tBoard[3] == tBoard[4] && tBoard[4] == tBoard[5] && tBoard[3] != 2)\n || (tBoard[6] == tBoard[7] && tBoard[7] == tBoard[8] && tBoard[6] != 2)\n || (tBoard[1] == tBoard[4] && tBoard[4] == tBoard[7] && tBoard[1] != 2)\n || (tBoard[2] == tBoard[5] && tBoard[5] == tBoard[8] && tBoard[2] != 2)\n || (tBoard[0] == tBoard[4] && tBoard[4] == tBoard[8] && tBoard[0] != 2)\n || (tBoard[2] == tBoard[4] && tBoard[4] == tBoard[6] && tBoard[2] != 2)) {\n //if counter is even then recognizes that it is the person who has the X symbol and knows that X won \n if (counter % 2 == 0) {\n announce.setText(\"X is the Winner\"); //announces that X has won\n turn.setText(\"\"); //no ones turn anymore\n } //if it is not X, O has won the game and recognizes\n else {\n announce.setText(\"O is the Winner\"); //announces that O has won\n turn.setText(\"\"); //no ones turn anymore\n\n }\n //winner is set to true and stops allowing user to press other squares through pressed method\n winner = true;\n\n }\n //returns winner\n return winner;\n\n }", "private static void winnerOrTie()\n\t{\n\t\t//Check each row for winning or tie condition.\n\t\tif(tictactoeBoard[0] == tictactoeBoard[1] && tictactoeBoard[1] == tictactoeBoard[2] && tictactoeBoard[0] != 1)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\tif(tictactoeBoard[3] == tictactoeBoard[4] && tictactoeBoard[4] == tictactoeBoard[5] && tictactoeBoard[3] != 4)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\tif(tictactoeBoard[6] == tictactoeBoard[7] && tictactoeBoard[7] == tictactoeBoard[8] && tictactoeBoard[6] != 7)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\t//Check diagonally for winning or tie condition.\n\t\tif(tictactoeBoard[0] == tictactoeBoard[4] && tictactoeBoard[4] == tictactoeBoard[8] && tictactoeBoard[0] != 1)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\tif(tictactoeBoard[6] == tictactoeBoard[4] && tictactoeBoard[4] == tictactoeBoard[2] && tictactoeBoard[6] != 7)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//nobody has won yet.\n\t\t\t//changeTurn();\n\t\t}\n\t}", "public static boolean ai_EW(int[][] gameGrid, int pieceTracker, int colNum)\n\t{\n\t\tcounter++; //Used to make variations in the AI move logic\n\t\tint rowNum = 0; //Used to store the row when finding the row we need to check for win condition\n\t\t//The loop below is used to find the row of last piece dropped to find exact position\n\t\tfor (int posTracker = 0; posTracker < ConnectFour.getRows(); posTracker++)\n\t\t{\n\t\t\t\n\t\t\tif (gameGrid[posTracker][colNum] != 0)\n\t\t\t{\n\t\t\t\trowNum= posTracker;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tint streakBonus = 0; \n\t\tfor (int tracker = ConnectFour.getCols()-1; tracker > 0; tracker--) //CHECKS THE LEFT\n\t\t{\n\t\t\tif (counter %2 == 0) //Used to make the switch in the AI move logic\n\t\t\t\tbreak;\n\t\t\tif (gameGrid[rowNum][tracker] == pieceTracker) //Increments the streak if consecutive pieces are found\n\t\t\t{\n\t\t\t\tstreakBonus++;\n\t\t\t\tif (streakBonus >= 2)\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tsetCoords(tracker-1);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (tracker + 2 < ConnectFour.getCols()) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(tracker+1); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse \n\t\t\t\tstreakBonus = 0;\n\t\t}\n\t\tfor (int tracker = 0; tracker < ConnectFour.getCols(); tracker++) //CHECKS THE RIGHT\n\t\t{\n\t\t\t\n\t\t\tif (gameGrid[rowNum][tracker] == pieceTracker) //Increments the streak if consecutive pieces are found\n\t\t\n\t\t\t{\n\t\t\t\tstreakBonus++;\n\t\t\t\tif (streakBonus >= 2)\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tsetCoords(tracker+1);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (tracker - 2 > 0) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(tracker-1);//###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse \n\t\t\t\tstreakBonus = 0;\n\t\t}\n\t\treturn false; //if steak is not found\n\t}", "public static int check(char[][] board) {\n for (int i=0; i<SIZE; i++) { //checks all the horizontal rolls\n int j=0;\n if (board[i][j] !=' '&& board[i][j]==board[i][j+1]&& board[i][j+1]==board[i][j+2]) {\n return 0;\n }\n }\n for (int i=0; i<SIZE; i++) { //checks all the vertical rolls\n int j=0;\n if (board[j][i] !=' '&& board[j][i]==board[j+1][i]&& board[j+1][i]==board[j+2][i]) {\n return 0;\n }\n }\n if (board[0][0] !=' '&& board[0][0]==board[1][1] && board[1][1]==board[2][2]) {\n //checks 1 of the 2 diagonal rolls\n return 0;\n }\n if (board[0][2] !=' '&&board[0][2]==board[1][1] && board[1][1]==board[2][0]) {\n //checks 1 of the 2 diagonal rolls\n return 0;\n }\n return 1; //if all the above didn't happen, return 1 and the game continues\n }", "public static char checkForWinner(char[][] a){\r\n //check AI 'o' first\r\n for (int b = 0; b<a.length; b++){\r\n for (int j = 0; j<a[b].length; j++){\r\n if (b == j && countDiag1(a,'o')==a.length){\r\n return 'o';\r\n }\r\n if (b+j== a.length-1 && countDiag2(a,'o')==a.length){\r\n return 'o';\r\n } \r\n if (countRow(a[b],'o')==a[b].length || countCol(a, b, 'o')==a.length){\r\n return 'o';\r\n } \r\n }\r\n }\r\n //then check user 'x'\r\n for (int p = 0; p<a.length; p++){\r\n for (int q = 0; q<a[p].length; q++){\r\n if (p == q && countDiag1(a,'x')==a.length){\r\n return 'x';\r\n }\r\n if (p+q== a.length-1 && countDiag2(a,'x')==a.length){\r\n return 'x';\r\n }\r\n if (countRow(a[p],'x')==a[p].length || countCol(a, p, 'x')==a.length){\r\n return 'x';\r\n } \r\n }\r\n } \r\n return ' ';\r\n }", "public boolean check3DDiagnolWinner(Cell play) {\n\t\t// for dim & row & col || dim & #-row & col || dim & #-row & #-col || dim & row & #-col\n\t\tif(board[0][0][0] == board[1][1][1] && board[1][1][1]==board[2][2][2] && board[2][2][2]==board[3][3][3] && board[3][3][3].equals(play) ||\n\t\t\t\tboard[0][0][3] == board[1][1][2] && board[1][1][2]==board[2][2][1] && board[2][2][1]==board[3][3][0] && board[3][3][0].equals(play) ||\n\t\t\t\tboard[0][3][3] == board[1][2][2] && board[1][2][2]==board[2][1][1] && board[2][1][1]==board[3][0][0] && board[3][0][0].equals(play) ||\n\t\t\t\tboard[0][3][0] == board[1][2][1] && board[1][2][1]==board[2][1][2] && board[2][1][2]==board[3][0][3] && board[3][0][3].equals(play)){\n\t\t\t//\t\t\t\t\t\t\t\tSystem.out.println(\"3D Diagnol win by \"+play.toString());\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}", "public void checkWin(){\n if(gameBoard[0][0].getText().equals(\"x\") && gameBoard[0][1].getText().equals(\"x\")\n && gameBoard[0][2].getText().equals(\"x\") && gameBoard[0][3].getText().equals(\"o\") \n && gameBoard[0][4].getText().equals(\"o\") && gameBoard[0][5].getText().equals(\"x\")\n && gameBoard[0][6].getText().equals(\"x\") && gameBoard[0][7].getText().equals(\"x\")\n && gameBoard[1][0].getText().equals(\"x\") && gameBoard[1][1].getText().equals(\"o\")\n && gameBoard[1][2].getText().equals(\"x\") && gameBoard[1][3].getText().equals(\"x\")\n && gameBoard[1][4].getText().equals(\"x\") && gameBoard[1][5].getText().equals(\"x\")\n && gameBoard[1][6].getText().equals(\"o\") && gameBoard[1][7].getText().equals(\"x\")\n && gameBoard[2][0].getText().equals(\"o\") && gameBoard[2][1].getText().equals(\"x\")\n && gameBoard[2][2].getText().equals(\"x\") && gameBoard[2][3].getText().equals(\"x\")\n && gameBoard[2][4].getText().equals(\"x\") && gameBoard[2][5].getText().equals(\"x\")\n && gameBoard[2][6].getText().equals(\"x\") && gameBoard[2][7].getText().equals(\"o\")\n && gameBoard[3][0].getText().equals(\"x\") && gameBoard[3][1].getText().equals(\"x\")\n && gameBoard[3][2].getText().equals(\"o\") && gameBoard[3][3].getText().equals(\"x\")\n && gameBoard[3][4].getText().equals(\"x\") && gameBoard[3][5].getText().equals(\"o\")\n && gameBoard[3][6].getText().equals(\"x\") && gameBoard[3][7].getText().equals(\"x\")\n && gameBoard[4][0].getText().equals(\"x\") && gameBoard[4][1].getText().equals(\"x\")\n && gameBoard[4][2].getText().equals(\"x\") && gameBoard[4][3].getText().equals(\"o\")\n && gameBoard[5][0].getText().equals(\"x\") && gameBoard[5][1].getText().equals(\"x\")\n && gameBoard[5][2].getText().equals(\"o\") && gameBoard[5][3].getText().equals(\"x\")\n && gameBoard[6][0].getText().equals(\"x\") && gameBoard[6][1].getText().equals(\"o\")\n && gameBoard[6][2].getText().equals(\"x\") && gameBoard[6][3].getText().equals(\"x\")\n && gameBoard[7][0].getText().equals(\"o\") && gameBoard[7][1].getText().equals(\"x\")\n && gameBoard[7][2].getText().equals(\"x\") && gameBoard[7][3].getText().equals(\"x\")){\n System.out.println(\"Congratulations, you won the game! ! !\");\n System.exit(0);\n } \n }", "public boolean isWon(int row, int column, char piece) {\n int matches = 0;\n int tempCol = column;\n int tempRow = row;\n //Check below\n if (row < 3) {\n for (int i = 1; board[row + i][column] == piece; i++) {\n if (i == 3) {\n return true;\n }\n }\n }\n //Check horizontal\n while (tempCol > 0 && board[row][tempCol - 1] == piece) {\n matches++;\n tempCol--;\n }\n tempCol = column;\n while (tempCol < 6 && board[row][tempCol + 1] == piece) {\n matches++;\n tempCol++;\n }\n if (matches >= 3) {\n return true;\n }\n matches = 0;\n tempCol = column;\n \n //Check left diagonal\n while(tempRow < 5 && tempCol > 0 && board[tempRow + 1][tempCol - 1] == piece) {\n matches++;\n tempRow++;\n tempCol--;\n }\n tempCol = column;\n tempRow = row;\n while (tempRow > 0 && tempCol < 6 && board[tempRow - 1][tempCol + 1] == piece) {\n matches++;\n tempRow--;\n tempCol++;\n }\n if (matches >= 3) {\n return true;\n }\n matches = 0;\n tempCol = column;\n tempRow = row;\n //Check right diagonal\n while(tempRow < 5 && tempCol < 6 && board[tempRow + 1][tempCol + 1] == piece) {\n matches++;\n tempRow++;\n tempCol++;\n }\n tempCol = column;\n tempRow = row;\n while (tempRow > 0 && tempCol > 0 && board[tempRow - 1][tempCol - 1] == piece) {\n matches++;\n tempRow--;\n tempCol--;\n }\n if (matches >= 3) {\n return true;\n }\n return false;\n\t}", "public int checkWin() {\r\n\t int diagSum1 = 0;\r\n\t int diagSum2 = 0;\r\n\t int colSum = 0;\r\n\t int rowSum = 0;\r\n\t int j = 0;\r\n\t String winner = \"\";\r\n\t \r\n\t \r\n\r\n\t diagSum1 = buttons[0][2].getValue() + buttons[1][1].getValue() + buttons[2][0].getValue();\r\n\t diagSum2 = buttons[0][0].getValue() + buttons[1][1].getValue() + buttons[2][2].getValue();\r\n\r\n\t if(diagSum1 == 3 || diagSum2 == 3) {\r\n\t winner = \"computer\";\r\n\t \t message.setText(\"COMPUTER WINS!\");\r\n\t setPanelEnabled(board, false);\r\n\t\t aiscore.setText(Integer.toString(computerscore+=2));\r\n\t\t restart.setVisible(true);\r\n\t\t j=1;\r\n\r\n\t }\r\n\t if(diagSum1 == -3 || diagSum2 == -3) {\r\n\t winner = \"you win\";\r\n\t setPanelEnabled(board, false);\r\n\t \tmessage.setText(\"YOU WIN\");\r\n\t humanscore.setText(Integer.toString(playerscore+=2));\r\n\t restart.setVisible(true);\r\n\t j=1;\r\n\t }\r\n\r\n\t for(int x = 0; x<3; x++) {\r\n\t for(int y = 0; y<3; y++) {\r\n\t rowSum += buttons[x][y].getValue(); \r\n\t colSum += buttons[y][x].getValue();\r\n\t }\r\n\t if(rowSum == 3 || colSum == 3 && winner.equals(\"\")) { \r\n\t setPanelEnabled(board, false);\r\n\t restart.setVisible(true);\r\n\t\t // frame.add(better);\r\n\t winner = \"Computer wins!\";\r\n\t \t message.setText(\"COMPUTER WINS!\");\r\n\t\t\t aiscore.setText(Integer.toString(computerscore+=2));\r\n\t\t\t j=1;\r\n\t }\r\n\t else if(rowSum == -3 || colSum == -3 && winner.equals(\"\")) {\r\n\t setPanelEnabled(board, false);\r\n\t\t // frame.add(restart);\r\n\t winner = \"You win\";\r\n\t \tmessage.setText(\"YOU WIN\");\r\n\t\t humanscore.setText(Integer.toString(playerscore+=2));\r\n\t\t restart.setVisible(true);\r\n\t\t // frame.add(better);\r\n\t\t j=1;\r\n\t }\r\n\t rowSum = 0;\r\n\t colSum = 0;\r\n\t }\r\n\t \r\n\t if(clicks >= 9 && winner.equals(\"\")) {\r\n winner = \"draw\";\r\n\t setPanelEnabled(board, false);\r\n\t restart.setVisible(true);\r\n\t // frame.add(better);\r\n\t message.setText(\"IT'S A DRAW!\");\r\n\t humanscore.setText(Integer.toString(playerscore+=1));\r\n\t\t aiscore.setText(Integer.toString(computerscore+=1));\r\n\t\t j=1;\r\n\t }\r\n\t return j;\r\n\t }", "private void checkWinningMove(TicTacToeElement element,int x,int y) {\n int logicalSize = boardProperties.getBoardLength()-1;\r\n // Check column (only the one we just played)\r\n for(int i=0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[x][i] != element.getValue()){\r\n break;\r\n }\r\n // Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n\r\n }\r\n // Check row (only the one we just played)\r\n for(int i=0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[i][y] != element.getValue()){\r\n break;\r\n }\r\n // Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n }\r\n // Check diagonal\r\n // normal diagonal\r\n for(int i= 0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[i][i] != element.getValue()){\r\n break;\r\n }\r\n // Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n }\r\n // anti diagonal\r\n for(int i= 0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[i][logicalSize-i] != element.getValue()){\r\n break;\r\n }\r\n //Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n }\r\n // check draw\r\n if(gameState.getMoveCount() == Math.pow(logicalSize,2)-1){\r\n gameState.setDraw(true);\r\n }\r\n\r\n }", "public static String checkWinner(String[][] f)\n {\n //look for the first type of winning line, a horizontal line\n\n for (int i = 0; i < 6; i++)\n {\n\n for (int j = 0; j < 7; j += 2)\n {\n\n if ((f[i][j+1] != \" \")\n\n && (f[i][j+3] != \" \")\n \n && (f[i][j+5] != \" \")\n\n && (f[i][j+7] != \" \")\n\n && ((f[i][j+1] == f[i][j+3])\n\n && (f[i][j+3] == f[i][j+5])\n\n && (f[i][j+5] == f[i][j+7])))\n\n //If we found a same-colored pattern, we'll return the color so that we will know who won.\n\n return f[i][j+1]; \n }\n\n }\n\n //Now, let's first loop over each odd-numbered column by incrementing with 2\n\n //and check for consecutive boxes in the same column that are the same color\n\n for (int i=1;i<15;i+=2)\n {\n\n for (int j =0;j<3;j++)\n {\n\n if((f[j][i] != \" \")\n\n && (f[j+1][i] != \" \")\n\n && (f[j+2][i] != \" \")\n\n && (f[j+3][i] != \" \")\n\n && ((f[j][i] == f[j+1][i])\n\n && (f[j+1][i] == f[j+2][i])\n\n && (f[j+2][i] == f[j+3][i])))\n\n return f[j][i]; \n } \n\n }\n\n //For the left-up to right-down diagonal line\n\n //We'll have to loop over the 3 uppermost\n\n //rows and then go from left to right column-wise\n\n for (int i = 0; i < 3; i++)\n {\n\n for (int j = 1; j < 9; j += 2)\n\n {\n\n if((f[i][j] != \" \")\n\n && (f[i+1][j+2] != \" \")\n\n && (f[i+2][j+4] != \" \")\n\n && (f[i+3][j+6] != \" \")\n\n && ((f[i][j] == f[i+1][j+2])\n\n && (f[i+1][j+2] == f[i+2][j+4])\n\n && (f[i+2][j+4] == f[i+3][j+6])))\n\n return f[i][j]; \n } \n\n }\n\n //Similar to the method above, but we're just reversing\n\n for (int i = 0; i < 3; i++)\n\n {\n for (int j = 7; j < 15; j += 2)\n\n {\n\n if((f[i][j] != \" \")\n\n && (f[i+1][j-2] != \" \")\n\n && (f[i+2][j-4] != \" \")\n \n && (f[i+3][j-6] != \" \")\n\n && ((f[i][j] == f[i+1][j-2])\n\n && (f[i+1][j-2] == f[i+2][j-4])\n\n && (f[i+2][j-4] == f[i+3][j-6])))\n\n return f[i][j]; \n } \n\n }\n\n //If after going over the table and we didn't find a winning color\n\n return null;\n }", "public boolean CheckVictory()\n {\n\n for (int i = 0; i < 6; i++) {\n if(isFiveAligned(\n getCell(i, 0),\n getCell(i, 1),\n getCell(i, 2),\n getCell(i, 3),\n getCell(i, 4),\n getCell(i, 5) )){\n Winner=getCell(i, 2);\n return true;\n }\n }\n\n for (int i = 0; i < 6; i++) {\n if(isFiveAligned(\n getCell(0,i),\n getCell(1,i),\n getCell(2,i),\n getCell(3,i),\n getCell(4,i),\n getCell(5,i) )){\n Winner=getCell(2, i);\n return true;\n }\n }\n CellType[] arrTypes={getCell(0, 0),getCell(1, 1),getCell(2, 2),getCell(3, 3),\n getCell(4, 4),getCell(5, 5)};\n\n \n if(isFiveAligned(arrTypes))\n {\n Winner=arrTypes[2];\n return true;\n }\n\n CellType[] REVERSE_arrTypes={getCell(0, 5),getCell(1, 4),getCell(2, 3),getCell(3, 2),\n getCell(4, 1),getCell(5, 0)};\n\n \n\n if(isFiveAligned(REVERSE_arrTypes))\n {\n Winner=REVERSE_arrTypes[2]; \n return true;\n }\n\n\n if(isFiveAligned(new CellType[]{getCell(0, 1),\n getCell(1, 2),\n getCell(2, 3),\n getCell(3, 4),\n getCell(4, 5),\n CellType.None\n })) {\n Winner=getCell(3, 4);\n return true;\n }\n \n if(isFiveAligned(new CellType[]{getCell(1, 0),\n getCell(2, 1),\n getCell(3, 2),\n getCell(4, 3),\n getCell(5, 4),\n CellType.None\n })) {\n Winner=getCell(4, 3);\n return true;\n }\n\n if(isFiveAligned(new CellType[]{\n getCell(4, 0),\n getCell(3, 1),\n getCell(2, 2),\n getCell(1, 3),\n getCell(0, 4),\n CellType.None\n \n })){\n Winner=getCell(2, 2);\n return true;}\n\n if(isFiveAligned(new CellType[]{\n getCell(5, 1),\n getCell(4, 2),\n getCell(3, 3),\n getCell(2, 4),\n getCell(1, 5),\n CellType.None\n \n })){\n Winner=getCell(3, 3);\n return true;}\n\n \n \n\n\n \n\n return false;\n }", "public boolean check2DRowWinner(Cell play) {\n\n\t\tfor(int dim = 0; dim < board.length; dim++) {// for dim\n\t\t\tfor(int row = 0; row < board.length; row++) { //for row\n\t\t\t\t//\t\t\t\tfor(int col = 0; col < board.length; col++) {// for col\n\n\t\t\t\tif(board[dim][row][0] == board[dim][row][1] && board[dim][row][1]==board[dim][row][2] && board[dim][row][2]==board[dim][row][3] && board[dim][row][3].equals(play)) { \n\t\t\t\t\t//\t\t\t\t\t\tSystem.out.println(\"Row win by \"+play.toString()+ \" at dim=\" + dim +\" & row= \" + row); \n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "public Player checkWin ()\n {\n //checks rows\n for (int row = 0; row < 3; row++)\n if (getGridElement(row, 0).getPlayer() == getGridElement(row, 1).getPlayer() &&\n getGridElement(row, 1).getPlayer() == getGridElement(row, 2).getPlayer() &&\n getGridElement(row, 0).getPlayer() != Player.NONE)\n return getGridElement(row, 0).getPlayer();\n\n //checks columns\n for (int column = 0; column < 3; column++)\n if (getGridElement(0, column).getPlayer() == getGridElement(1, column).getPlayer() &&\n getGridElement(1, column).getPlayer() == getGridElement(2, column).getPlayer() &&\n getGridElement(0, column).getPlayer() != Player.NONE)\n return getGridElement(0, column).getPlayer();\n\n //checks diagonals\n if (getGridElement(0, 0).getPlayer() == getGridElement(1, 1).getPlayer() &&\n getGridElement(1, 1).getPlayer() == getGridElement(2, 2).getPlayer() &&\n getGridElement(0, 0).getPlayer() != Player.NONE)\n return getGridElement(0, 0).getPlayer();\n if (getGridElement(2, 0).getPlayer() == getGridElement(1, 1).getPlayer() &&\n getGridElement(1, 1).getPlayer() == getGridElement(0, 2).getPlayer() &&\n getGridElement(0, 0).getPlayer() != Player.NONE)\n return getGridElement(2, 0).getPlayer();\n\n return Player.NONE;\n }", "public static char playerHasWon(char[][] board) {\r\n\r\n\t //Check each row\r\n\t for(int i = 0; i < 3; i++) {\r\n\t if(board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != '-') {\r\n\t return board[i][0];\r\n\t }\r\n\t }\r\n\r\n\t //Check each column\r\n\t for(int j = 0; j < 3; j++) {\r\n\t if(board[0][j] == board[1][j] && board[1][j] == board[2][j] && board[0][j] != '-') {\r\n\t return board[0][j];\r\n\t }\r\n\t }\r\n\r\n\t //Check the diagonals\r\n\t if(board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != '-') {\r\n\t return board[0][0];\r\n\t }\r\n\t if(board[2][0] == board[1][1] && board[1][1] == board[0][2] && board[2][0] != '-') {\r\n\t return board[2][0];\r\n\t }\r\n\r\n\t //Otherwise nobody has not won yet\r\n\t return ' ';\r\n\t }", "private int checkWinner(int[] arr) {\n for (int i = 0; i <= 6; i += 3) {\n int sum = arr[i] + arr[i + 1] + arr[i + 2];\n if (sum == 3) {\n return 1;\n } else if (sum == -3) {\n return 2;\n }\n }\n\n // Check verticals\n for (int i = 0; i < 3; i++) {\n int sum = arr[i] + arr[i + 3] + arr[i + 6];\n if (sum == 3) {\n return 1;\n } else if (sum == -3) {\n return 2;\n }\n }\n\n // Check diagonals\n int sum = arr[0] + arr[4] + arr[8];\n if (sum == 3) {\n return 1;\n } else if (sum == -3) {\n return 2;\n }\n\n sum = arr[2] + arr[4] + arr[6];\n if (sum == 3) {\n return 1;\n } else if (sum == -3) {\n return 2;\n }\n\n return 0;\n }", "public final boolean checkForWin() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n result = true;\r\n for(Tile tile : rail.getTiles()) {\r\n tile.setBackground(Color.GREEN);\r\n player = tile.getText();\r\n }\r\n if (player.equals(\"X\")) {\r\n winningPlayer = \"X\";\r\n this.xWins++;\r\n } else if (player.equals(\"0\")) {\r\n winningPlayer = \"0\";\r\n this.oWins++;\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return result;\r\n }", "private boolean hasRowWin() {\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n if (getBoard()[i][j] != null) {\n boolean rowWin = rowHasFour(i, j);\n if (rowWin) {\n return true;\n }\n\n }\n }\n }\n return false;\n }", "public boolean isWinner(Coordinates guess, String playerSymbol){\n //idea for antidiag win test from\n // https://stackoverflow.com/questions/1056316/algorithm-for-determining-tic-tac-toe-game-over\n for (int i = 0; i < 3; i++) {\n if (board[guess.getRow()][i].getSymbol() != playerSymbol) {\n break;\n }\n if (i == 3 - 1) {\n return true;\n }\n }\n\n for (int j = 0; j < 3; j++) {\n if (board[j][guess.getColumn()].getSymbol() != playerSymbol) {\n break;\n }\n if (j==3-1) {\n return true;\n }\n }\n\n if (guess.getColumn()==guess.getRow()){\n for(int k = 0; k < 3; k++){\n if(board[k][k].getSymbol() != playerSymbol)\n break;\n if(k == 3-1){\n return true;\n }\n }\n }\n\n if (guess.getColumn()+guess.getRow()==3-1){\n for (int l = 0; l < 3; l++) {\n if(board[l][3-1-l].getSymbol()!= playerSymbol){\n break;\n }\n if (l==3-1){\n return true;\n }\n }\n }\n\n return false;\n }", "public int determineWinner() {\n\t\tif(board[1][1] != 0 && (\n\t\t\t(board[1][1] == board[0][0] && board[1][1] == board[2][2]) ||\n\t\t\t(board[1][1] == board[0][2] && board[1][1] == board[2][0]) ||\n\t\t\t(board[1][1] == board[0][1] && board[1][1] == board[2][1]) ||\n\t\t\t(board[1][1] == board[1][0] && board[1][1] == board[1][2]))){\n\t\t\treturn board[1][1];\n\t\t}\n\t\telse if (board[0][0] != 0 &&(\n\t\t\t(board[0][0] == board[0][1] && board[0][0] == board[0][2]) ||\n\t\t\t(board[0][0] == board[1][0] && board[0][0] == board[2][0]))){\n\t\t\treturn board[0][0];\n\t\t}\n\t\telse if (board [2][2] != 0 && (\n\t\t\t(board[2][2] == board[2][0] && board[2][2] == board[2][1]) ||\n\t\t\t(board[2][2] == board[0][2] && board[2][2] == board[1][2]))) {\n\t\t\treturn board[2][2];\n\t\t}\n\t\t\n\t\t//See if every square has been marked, return still in progress if not\n\t\tfor(int i = 0; i < 3; ++i) {\n\t\t\tfor(int j = 0; j < 3; ++j) {\n\t\t\t\tif (board[i][j] == 0)\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Return tie\n\t\treturn 3;\n\t}", "public boolean win(){\r\n for(int row = 0; row<map.length; row++){\r\n for(int col = 0; col<map[0].length; col++){\r\n if(map[row][col].getSafe() == false && (map[row][col].getVisual().equals(square) || map[row][col].getVisual().equals(bomb))){\r\n return false;\r\n }\r\n if(map[row][col].getSafe() == true && map[row][col].getVisual().equals(flag)){\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }", "private boolean winsByDiagonalTopRightToBottomLeft(char symbol){\n int max_diagonal_count = 0;\n\n // Iterates through diagonals from top right to bottom left\n for(int k = 0 ; k <= this.boardColumns - 1 + this.boardRows - 1; k++) {\n\n // Reset counter for each new diagonal\n int count = 0;\n\n // Iterates through values in the diagonal. The sum of their indices is equal to k (the index\n // of the column) so we can easily calculate i by iterating through j (up to and equal to k) and subtracting\n // j from k to get i.\n for(int j = 0 ; j <= k ; j++) {\n int i = k - j;\n\n // If i surpasses the number of available rows or j surpasses the number of available columns, we\n // break out the inner for loop. This happens when the num of rows and cols in the array are different\n if (i >= this.boardRows || j >= this.boardColumns){\n continue;\n }\n // Check if char symbol is equal to the element in the diagonal. If so, we increment count by 1 and update\n // max_diagonal_count if possible.\n if (symbol == this.gameBoard[i][j]){\n count+=1;\n if (count>max_diagonal_count){\n max_diagonal_count = count;\n }\n }\n // Otherwise, we reset the counter to 0\n else {\n count =0;\n }\n }\n }\n\n // If the max_diagonal_count is greater than or equal to tilesNeeded, then we have sufficient tiles in a diagonal\n // for char symbol to win so we return true. Otherwise, we return false.\n if (max_diagonal_count >= this.tilesNeeded){\n return true;\n }\n else {\n return false;\n }\n\n }", "public int AI(){\n for(int i=0; i<3; i++){\n for(int j=0; j<7; j++){\n if(board[i][j]==0 && board[i+1][j]==2 && board[i+2][j]==2 && board[i+3][j]==2){\n return j;\n \n }\n }\n }\n //checks for horizontals (Y-YY)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==2 && board[i][j+1]==0 && board[i][j+2]==2 && board[i][j+3]==2){\n if((i==5)||\n (i==4&&board[5][j+1]!=0) ||\n (i==3&&board[5][j+1]!=0&&board[4][j+1]!=0) ||\n (i==2&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0) ||\n (i==1&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0) ||\n (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0) ||\n (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0&&board[0][j+1]!=0)){\n return j+1;\n }\n }\n }\n }\n //checks for horizontals (YY-Y)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==2 && board[i][j+1]==2 && board[i][j+2]==0 && board[i][j+3]==2){\n if((i==5)||\n (i==4&&board[5][j+2]!=0) ||\n (i==3&&board[5][j+2]!=0&&board[4][j+2]!=0) ||\n (i==2&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0) ||\n (i==1&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0) ||\n (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0) ||\n (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0&&board[0][j+2]!=0)){\n return j+2;\n }\n }\n }\n }\n //checks for horizontals (-YYY)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==0 && board[i][j+1]==2 && board[i][j+2]==2 && board[i][j+3]==2){\n if((i==5)||\n (i==4&&board[5][j]!=0) ||\n (i==3&&board[5][j]!=0&&board[4][j]!=0) ||\n (i==2&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0) ||\n (i==1&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0) ||\n (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0) ||\n (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0&&board[0][j]!=0)){\n return j;\n }\n }\n }\n }\n //checks for horizontals (YYY-)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==2 && board[i][j+1]==2 && board[i][j+2]==2 && board[i][j+3]==0){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+3;\n }\n }\n }\n }\n //checks for diagonal (-YYY)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==0 && board[i+2][j+1]==2 && board[i+1][j+2]==2 && board[i][j+3]==2){\n if((i+3==5)||\n (i+2==4&&board[5][j]!=0)||\n (i+1==3&&board[5][j]!=0&&board[4][j]!=0)||\n (i==2&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0)||\n (i==1&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0)||\n (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0)){\n return j;\n }\n }\n }\n }\n //checks for diagonal (Y-YY)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==2 && board[i+2][j+1]==0 && board[i+1][j+2]==2 && board[i][j+3]==2){\n if((i==2&&board[5][j+1]!=0)||\n (i==1&&board[5][j+1]!=0&&board[4][j+1]!=0)||\n (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0)){\n return j+1;\n }\n }\n }\n }\n //checks for diagonal (YY-Y)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==2 && board[i+2][j+1]==2 && board[i+1][j+2]==0 && board[i][j+3]==2){\n if((i==2&&board[5][j+2]!=0&&board[4][j+2]!=0)||\n (i==1&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0)||\n (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0)){\n return j+2;\n }\n }\n }\n }\n //checks for diagonal (YYY-)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==2 && board[i+2][j+1]==2 && board[i+1][j+2]==2 && board[i][j+3]==0){\n if((i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0)||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0)||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0)){\n return j+3;\n }\n }\n }\n }\n //checks for subdiagonal (-YYY)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==0 && board[i+1][j+1]==2 && board[i+2][j+2]==2 && board[i+3][j+3]==2){\n if((i==0&&board[1][j]!=0)||\n (i==1&&board[2][j]!=0)||\n (i==2&&board[3][j]!=0)){\n return j;\n }\n }\n }\n }\n //checks for subdiagonal (Y-YY)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==2 && board[i+1][j+1]==0 && board[i+2][j+2]==2 && board[i+3][j+3]==2){\n if((i==0&&board[2][j+1]!=0)||\n (i==1&&board[3][j+1]!=0)||\n (i==2&&board[4][j+1]!=0)){\n return j+1;\n }\n }\n }\n }\n //checks for subdiagonal (YY-Y)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==2 && board[i+1][j+1]==2 && board[i+2][j+2]==0 && board[i+3][j+3]==2){\n if((i==0&&board[3][j+2]!=0)||\n (i==1&&board[4][j+2]!=0)||\n (i==2&&board[5][j+2]!=0)){\n return j+2;\n }\n }\n }\n }\n //checks for subdiagonal (YYY-)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==2 && board[i+1][j+1]==2 && board[i+2][j+2]==2 && board[i+3][j+3]==0){\n if((i==0&&board[4][j+3]!=0)||\n (i==1&&board[5][j+3]!=0)||\n (i==2)){\n return j+3;\n }\n }\n }\n }\n //BLOCK CHECKER\n //columns\n for(int i=0; i<3; i++){\n for(int j=0; j<7; j++){\n if(board[i][j]==0 && board[i+1][j]==1 && board[i+2][j]==1 && board[i+3][j]==1){\n return j; \n }\n }\n }\n //Checks for blocks horizontal (R-RR)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==1 && board[i][j+1]==0 && board[i][j+2]==1 && board[i][j+3]==1){\n if((i==5)||\n (i==4&&board[5][j+1]!=0) ||\n (i==3&&board[5][j+1]!=0&&board[4][j+1]!=0) ||\n (i==2&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0) ||\n (i==1&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0) ||\n (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0) ||\n (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0&&board[0][j+1]!=0)){\n return j+1;\n }\n }\n }\n }\n //checks for horizontal blocks (RR-R)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==1 && board[i][j+1]==1 && board[i][j+2]==0 && board[i][j+3]==1){\n if((i==5)||\n (i==4&&board[5][j+2]!=0) ||\n (i==3&&board[5][j+2]!=0&&board[4][j+2]!=0) ||\n (i==2&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0) ||\n (i==1&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0) ||\n (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0) ||\n (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0&&board[0][j+2]!=0)){\n return j+2;\n }\n }\n }\n }\n \n //checks for horizontals (-RRR)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==0 && board[i][j+1]==1 && board[i][j+2]==1 && board[i][j+3]==1){\n if((i==5)||\n (i==4&&board[5][j]!=0) ||\n (i==3&&board[5][j]!=0&&board[4][j]!=0) ||\n (i==2&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0) ||\n (i==1&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0) ||\n (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0) ||\n (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0&&board[0][j]!=0)){\n return j;\n }\n }\n }\n }\n //checks for horizontals (RRR-)\n for(int i=0; i<6; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==1 && board[i][j+1]==1 && board[i][j+2]==1 && board[i][j+3]==0){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+3;\n }\n }\n }\n }\n //checks for diagonal (-RRR)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==0 && board[i+2][j+1]==1 && board[i+1][j+2]==1 && board[i][j+3]==1){\n if((i+3==5)||\n (i+2==4&&board[i+3][j]!=0)||\n (i+1==3&&board[i+3][j]!=0&&board[i+2][j]!=0)||\n (i==2&&board[i+3][j]!=0&&board[i+2][j]!=0&&board[i+1][j]!=0)||\n (i==1&&board[i+3][j]!=0&&board[i+2][j]!=0&&board[i+1][j]!=0&&board[i][j]!=0)||\n (i==0&&board[i+3][j]!=0&&board[i+2][j]!=0&&board[i+1][j]!=0&&board[i][j]!=0&&board[i-1][j]!=0)){\n return j;\n }\n }\n }\n }\n //checks for diagonal (R-RR)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==1 && board[i+2][j+1]==0 && board[i+1][j+2]==1 && board[i][j+3]==1){\n if((i+2==4&&board[i+3][j+1]!=0)||\n (i+1==3&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0)||\n (i==2&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0&&board[i+1][j+1]!=0)||\n (i==1&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0&&board[i+1][j+1]!=0&&board[i][j+1]!=0)||\n (i==0&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0&&board[i+1][j+1]!=0&&board[i][j+1]!=0&&board[i-1][j+1]!=0)){\n return j+1;\n }\n }\n }\n }\n //checks for diagonal (RR-R)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==1 && board[i+2][j+1]==1 && board[i+1][j+2]==0 && board[i][j+3]==1){\n if((i==2&&board[i+2][j+2]!=0)){//||\n return j+2;\n }\n }\n }\n }\n //checks for diagonal (RRR-)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i+3][j]==1 && board[i+2][j+1]==1 && board[i+1][j+2]==1 && board[i][j+3]==0){\n if((i==0&&board[1][j+3]!=0)||\n (i==1&&board[2][j+3]!=0)||\n (i==2&&board[3][j+3]!=0)){\n return j+3;\n }\n }\n }\n }\n //checks for subdiagonal blocks(-RRR)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==0 && board[i+1][j+1]==1 && board[i+2][j+2]==1 && board[i+3][j+3]==1){\n if((i==0&&board[1][j]!=0)||\n (i==1&&board[2][j]!=0)||\n (i==2&&board[3][j]!=0)){\n return j;\n }\n }\n }\n }\n //checks for subdiagonal blocks(Y-YY)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==1 && board[i+1][j+1]==0 && board[i+2][j+2]==1 && board[i+3][j+3]==1){\n if((i==0&&board[2][j+1]!=0)||\n (i==1&&board[3][j+1]!=0)||\n (i==2&&board[4][j+1]!=0)){\n return j+1;\n }\n }\n }\n }\n //checks for subdiagonal blocks(YY-Y)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==1 && board[i+1][j+1]==1 && board[i+2][j+2]==0 && board[i+3][j+3]==1){\n if((i==0&&board[3][j+2]!=0)||\n (i==1&&board[4][j+2]!=0)||\n (i==2&&board[5][j+2]!=0)){\n return j+2;\n }\n }\n }\n }\n //checks for subdiagonal blocks(YYY-)\n for(int i=0; i<3; i++){\n for(int j=0; j<4; j++){\n if(board[i][j]==1 && board[i+1][j+1]==1 && board[i+2][j+2]==1 && board[i+3][j+3]==0){\n if((i==0&&board[4][j+3]!=0)||\n (i==1&&board[5][j+3]!=0)||\n (i==2)){\n return j+3;\n }\n }\n }\n }\n //INTERMEDIATE BLOCKING\n //If horizontal (RR--) make it (RRY-)\n for(int i=0; i<6; i++){\n for(int j=0; j<3; j++){\n if(board[i][j]==1 && board[i][j+1]==1 && board[i][j+2]==0){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+2;\n }\n }\n }\n }\n //If horizontal (--RR) make it (-YRR)\n for(int i=0; i<6; i++){\n for(int j=0; j<3; j++){\n if(board[i][j+1]==0 && board[i][j+2]==1 && board[i][j+3]==1){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+1;\n }\n }\n }\n }\n //The following attempts to set the computer up for a win, instead of first just generating a random number\n for(int i=0; i<3; i++){\n for(int j=0; j<7; j++){\n if(board[i+1][j]==0 && board[i+2][j]==2 && board[i+3][j]==2){\n return j;\n \n }\n }\n }\n //If horizontal (-YY-) make it (-YYY)\n for(int i=0; i<6; i++){\n for(int j=0; j<3; j++){\n if(board[i][j]==0 && board[i][j+1]==2 && board[i][j+2]==2 && board[i][j+3]==0){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+3;\n }\n }\n }\n }\n //If horizontal (YY--) make it (YYY-)\n for(int i=0; i<6; i++){\n for(int j=0; j<3; j++){\n if(board[i][j]==2 && board[i][j+1]==2 && board[i][j+2]==0 && board[i][j+3]==0){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+2;\n }\n }\n }\n }\n //If horizontal (--YY) make it (-YYY)\n for(int i=0; i<6; i++){\n for(int j=0; j<3; j++){\n if(board[i][j]==0 && board[i][j+1]==0 && board[i][j+2]==2 && board[i][j+3]==2){\n if((i==5)||\n (i==4&&board[5][j+3]!=0) ||\n (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) ||\n (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) ||\n (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) ||\n (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){\n return j+1;\n }\n }\n }\n }\n boolean sent = false;\n //The following code will simply generate a random number.\n int x = (int)((Math.random())*7);\n if(!wonYet){ \n while(!sent){\n if(board[0][x]!=0)\n x = (int)((Math.random())*7);\n else if(board[1][x]!=0)\n x = (int)((Math.random())*7);\n else if(board[2][x]!=0)\n x = (int)((Math.random())*7);\n else if(board[3][x]!=0)\n x = (int)((Math.random())*7);\n else if(board[4][x]!=0)\n x = (int)((Math.random())*7);\n else if(board[5][x]!=0)\n x = (int)((Math.random())*7);\n sent = true;\n } \n return x;\n }\n return -1; \n }", "public boolean isLegalDiag(MoveDirection dir){\r\n GamePosition curPos = currentGame.getCurrentPosition();\n\t\tPlayer white = currentGame.getWhitePlayer();\n\t\t\n\t\tPlayer toMove;\n\t\tPlayer oppo;\n\n\t\tint col, row;\n\t\tif(curPos.getPlayerToMove().equals(white)) {\n\t\t\n\t\t\tcol = curPos.getWhitePosition().getTile().getColumn();\n\t\t\trow = curPos.getWhitePosition().getTile().getRow();\n\t\t\t\n\t\t\ttoMove = white;\n\t\t\toppo = currentGame.getBlackPlayer();\n\t\t} else {\n\t\t\tcol = curPos.getBlackPosition().getTile().getColumn();\n\t\t\trow = curPos.getBlackPosition().getTile().getRow();\n\t\t\t\n\t\t\toppo = white;\n\t\t\ttoMove = currentGame.getBlackPlayer();\n\t\t}\n\t\t\n\t\tif (dir == MoveDirection.NorthEast) {\n\t\t\tif(col==9 || row ==1) return false;\n\t\t} else if(dir == MoveDirection.NorthWest) {\n\t\t\tif(col==1 || row ==1) return false;\n\t\t} else if(dir == MoveDirection.SouthEast) {\n\t\t\tif(col==9 || row ==9) return false;\n\t\t} else if(dir == MoveDirection.SouthWest) {\n\t\t\tif(col==1 || row ==9) return false;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t\t//Tiles are drawn by row then by column. 0= row1 col1, \n\t\t\n\t\t//Checking the has opponent first\n\t\tboolean correct = false;\n\t\t//Check down\n\t\tif(QuoridorController.hasOpponent(1, 0)) {\n\t\t\tif(QuoridorController.noWallBlock(toMove, 1, 0)) {\n\t\t\t\tif(QuoridorController.noWallBlock(oppo, 1, 0) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, 0, -1)) {\n\t\t\t\t\t\t//Jump diagonal- check left\n\t\t\t\t\t\tif(dir == MoveDirection.SouthWest) return true;\n\t\t\t\t\t\t\n\t\t\t\t\t} \n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, 0, 1)) {\n\t\t\t\t\t\t//Jump diagonal- check right\n\t\t\t\t\t\tif(dir == MoveDirection.SouthEast) return true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t//Check up\n\t\t} else if(QuoridorController.hasOpponent(-1, 0)) {\n\t\t\tif(QuoridorController.noWallBlock(toMove, -1, 0)) {\n\t\t\t\tif(QuoridorController.noWallBlock(oppo, -1, 0) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, 0, -1)) {\n\t\t\t\t\t\t//Jump diagonal- check left\n\t\t\t\t\t\tif(dir == MoveDirection.NorthWest) return true;\n\t\t\t\t\t\t\n\t\t\t\t\t} \n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, 0, 1)) {\n\t\t\t\t\t\t//Jump diagonal- check right\n\t\t\t\t\t\tif(dir == MoveDirection.NorthEast) return true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t//Check right\n\t\t} else if(QuoridorController.hasOpponent(0, 1)) {\n\t\t\tif(QuoridorController.noWallBlock(toMove, 0, 1)) {\n\t\t\t\tif(QuoridorController.noWallBlock(oppo, 0, 1) ) {\n\t\t\t\t\t//Jump straight allowed\n\t\t\t\t\treturn false;\t\n\t\t\t\t} else {\n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, -1, 0)) {\n\t\t\t\t\t\t//Jump diagonal- check up\n\t\t\t\t\t\tif(dir == MoveDirection.NorthEast) return true;\n\t\t\t\t\t} \n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, 1, 0)) {\n\t\t\t\t\t\t//Jump diagonal- check down\n\t\t\t\t\t\tif(dir == MoveDirection.SouthEast) return true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t//Check left\n\t\t} else if(QuoridorController.hasOpponent(0, -1)) {\n\t\t\tif(QuoridorController.noWallBlock(toMove, 0, -1)) {\n\t\t\t\tif(QuoridorController.noWallBlock(oppo, 0, -1) ) {\n\t\t\t\t\t//Jump straight allowed\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, -1, 0)) {\n\t\t\t\t\t\t//Jump diagonal- check up\n\t\t\t\t\t\tif(dir == MoveDirection.NorthWest) return true;\n\t\t\t\t\t} \n\t\t\t\t\tif(QuoridorController.noWallBlock(oppo, 1, 0)) {\n\t\t\t\t\t\t//Jump diagonal- check down\n\t\t\t\t\t\tif(dir == MoveDirection.SouthWest) return true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\r\n }", "void seeIfTrue() {\n\t\tfor (int i = 0; i < boardSize; i++) {\n\t\t\tfor (int j = 0; j < boardSize; j++) {\n\t\t\t\tint tempCounter = 0;\n\t\t\t\tfor (int k = 0; k < boardSize; k++) {\n\t\t\t\t\tif (availMoves[i][j][k] == true) {\n\t\t\t\t\t\ttempCounter++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (tempCounter == 1) {\n\t\t\t\t\tSystem.out.println(\"FOUND A SQUARE WITH ONLY ONE POSSIBLE OPTION\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//checking every vertical line if there is some number that has only one number available\n\t\t//for every number\n\t\tfor (int i = 0; i < boardSize; i++) {\n\t\t\t//for every line\n\t\t\tfor (int j = 0; j < boardSize; j++) {\n\t\t\t\t//for every square\n\t\t\t\tint tempCounter = 0;\n\t\t\t\tfor (int k = 0; k < boardSize; k++) {\n\t\t\t\t\tif (availMoves[j][k][i] == true) {\n\t\t\t\t\t\ttempCounter++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (tempCounter == 1) {\n\t\t\t\t\tSystem.out.println(\"found a vertical line that had an optional input the number \" + (i + 1) + \" at line: \" + j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//checking every vertical line if there is some number that has only one number available\n\t\t//for every number\n\t\tfor (int i = 0; i < boardSize; i++) {\n\t\t\t//for every line\n\t\t\tfor (int j = 0; j < boardSize; j++) {\n\t\t\t\t//for every square\n\t\t\t\tint tempCounter = 0;\n\t\t\t\tfor (int k = 0; k < boardSize; k++) {\n\t\t\t\t\tif (availMoves[k][j][i] == true) {\n\t\t\t\t\t\ttempCounter++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (tempCounter == 1) {\n\t\t\t\t\tSystem.out.println(\"found a horizontal line that had an optional input the number \" + (i + 1) + \" at line: \" + j);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}", "private boolean rowWin (){ \r\n\t\tfor (int i=0; i<3; i++){ \r\n\t\t\tif (checkValue (board[i][0], board[i][1], board[i][2])){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false; \r\n\t}", "private static void winner()\n {\n if ((board[1] == userLetter && board[2] == userLetter && board[3] == userLetter) ||\n (board[4] == userLetter && board[5] == userLetter && board[6] == userLetter) ||\n (board[7] == userLetter && board[8] == userLetter && board[9] == userLetter) ||\n (board[1] == userLetter && board[5] == userLetter && board[9] == userLetter) ||\n (board[3] == userLetter && board[5] == userLetter && board[7] == userLetter))\n {\n showBoard();\n System.out.println(\"Player win the game\");\n System.exit(0);\n }\n }", "public int checkForWinner() {\n\n // Check horizontal wins\n for (int i = 0; i <= 6; i += 3)\t{\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+1] == HUMAN_PLAYER &&\n mBoard[i+2]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+1]== COMPUTER_PLAYER &&\n mBoard[i+2] == COMPUTER_PLAYER)\n return 3;\n }\n\n // Check vertical wins\n for (int i = 0; i <= 2; i++) {\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+3] == HUMAN_PLAYER &&\n mBoard[i+6]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+3] == COMPUTER_PLAYER &&\n mBoard[i+6]== COMPUTER_PLAYER)\n return 3;\n }\n\n // Check for diagonal wins\n if ((mBoard[0] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[8] == HUMAN_PLAYER) ||\n (mBoard[2] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[6] == HUMAN_PLAYER))\n return 2;\n if ((mBoard[0] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[8] == COMPUTER_PLAYER) ||\n (mBoard[2] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[6] == COMPUTER_PLAYER))\n return 3;\n\n // Check for tie\n for (int i = 0; i < BOARD_SIZE; i++) {\n // If we find a number, then no one has won yet\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER)\n return 0;\n }\n\n // If we make it through the previous loop, all places are taken, so it's a tie\n return 1;\n }", "public CellSigns gameWinner(){\n for (int i = 0; i < size; i++) {\n var firstSign = gameField[i][0].getCurrentSign();\n int j;\n for (j = 1; j < size; j++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(j == size)\n return firstSign;\n }\n\n //Check vertical lines\n for (int j = 0; j < size; j++) {\n var firstSign = gameField[0][j].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(i == size)\n return firstSign;\n }\n\n //Check diagonal lines\n\n var mainDiagonalSign = gameField[0][0].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n if(mainDiagonalSign != gameField[i][i].getCurrentSign())\n break;\n }\n if(i == size)\n return mainDiagonalSign;\n\n var secondaryDiagonalSign = gameField[0][size-1].getCurrentSign();\n for (i = 1; i < size; i++) {\n if(secondaryDiagonalSign!= gameField[i][size-1-i].getCurrentSign())\n break;\n }\n if(i==size)\n return secondaryDiagonalSign;\n\n //No winner\n return CellSigns.EMPTY;\n }", "private boolean winner(int player) {\r\n\t\treturn (board[0][0] == player && board[0][1] == player && board[0][2] == player)\r\n\t\t\t\t|| (board[1][0] == player && board[1][1] == player && board[1][2] == player)\r\n\t\t\t\t|| (board[2][0] == player && board[2][1] == player && board[2][2] == player)\r\n\t\t\t\t|| (board[0][0] == player && board[1][0] == player && board[2][0] == player)\r\n\t\t\t\t|| (board[0][1] == player && board[1][1] == player && board[2][1] == player)\r\n\t\t\t\t|| (board[0][2] == player && board[1][2] == player && board[2][2] == player)\r\n\t\t\t\t|| (board[0][0] == player && board[1][1] == player && board[2][2] == player)\r\n\t\t\t\t|| (board[0][2] == player && board[1][1] == player && board[2][0] == player);\r\n\t}", "private int[] nextColWin(){ \r\n\t\tfor (int r=0; r<3; r++){ \r\n\t\t\tif (board[0][r] == board[1][r] && board[2][r] == '-' && board[0][r] != '-'){\r\n\t\t\t\tcolWin[0] = 2;\r\n\t\t\t\tcolWin[1] = r;\r\n\t\t\t\treturn colWin;\r\n\t\t\t}\r\n\t\t\telse if (board[1][r] == board[2][r] && board[0][r] == '-' && board[0][r] != '-'){\r\n\t\t\t\tcolWin[0] = 0;\r\n\t\t\t\tcolWin[1] = r;\r\n\t\t\t\treturn colWin;\r\n\t\t\t}\r\n\t\t\telse if (board[0][r] == board[2][r] && board[1][r] == '-' && board[0][r] != '-'){\r\n\t\t\t\tcolWin[0] = 1;\r\n\t\t\t\tcolWin[1] = r;\r\n\t\t\t\treturn colWin;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn colWin;\r\n\t\t\r\n\t}", "public boolean isBoardSolved() {\n for (int goal : goalCells) {\n if (!((board[goal] & 15) == BOX_ON_GOAL)) {\n return false;\n }\n }\n return true;\n }", "public boolean isWinner(int player) {\n\t\tfor (int i = 0; i < board.length; i++) {\n\t\t\tfor (int j = 0; j < board[i].length; j++) {\n\t\t\t\tif (board[i][j] != player) {\n\t\t\t\t\t// Player has no mark here,\n\t\t\t\t\t// continue with next cell.\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (checkHorizontal(player, i, j)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (checkVertical(player, i, j)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (checkSouthEast(player, i, j)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (checkNorthEast(player, i, j)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "public boolean haveWinner(int row, int col) {\n\n if (numFreeSquares > 4) return false;\n\n // check row \"row\"\n if (boardData[row][0].equals(boardData[row][1]) && boardData[row][0].equals(boardData[row][2])) return true;\n\n // check column \"col\"\n\n if (boardData[0][col].equals(boardData[1][col]) && boardData[0][col].equals(boardData[2][col])) return true;\n\n // if row=col check one diagonal\n\n if (row == col)\n if (boardData[0][0].equals(boardData[1][1]) && boardData[0][0].equals(boardData[2][2])) return true;\n\n // if row=2-col check other diagonal\n\n if (row == 2 - col)\n if (boardData[0][2].equals(boardData[1][1]) && boardData[0][2].equals(boardData[2][0])) return true;\n // no winner yet\n return false;\n }", "public boolean determineWinner(){\n // search top down\n for(int x = 0; x < SIZE; x++){\n if(!stacks[x][0].isEmpty()){\n Point startingPoint = new Point(x, 0);\n ArrayList<Point> visited = new ArrayList<>();\n visited.add(startingPoint);\n TakTree<TakPiece> tree = new TakTree<>();\n tree.addRoot(getTop(startingPoint));\n treeBuilder(tree, startingPoint, visited);\n }\n\n if(whiteWins && blackWins){ // Only exit if we have found that both win\n return true;\n }\n }\n\n for(int y = 1; y < SIZE; y++){\n if(!stacks[0][y].isEmpty()){\n Point startingPoint = new Point(0, y);\n ArrayList<Point> visited = new ArrayList<>();\n visited.add(startingPoint);\n TakTree<TakPiece> tree = new TakTree<>();\n tree.addRoot(getTop(startingPoint));\n treeBuilder(tree, startingPoint, visited);\n }\n\n if(whiteWins && blackWins){ // Only exit if we have found that both win\n return true;\n }\n }\n\n // did we find a winner?\n return whiteWins || blackWins;\n }", "public boolean diagonalRight(){\n\t\t\r\n\t\tfor (int j = 1; j < Board.length-1; j++){\r\n\t\t\t\tint k = j-1;\t\t\t\t\r\n\t\t\t\tif (Board[j][k].charAt(2) != Board[j+1][k+1].charAt(2))\r\n\t\t\t\t\tbreak;\r\n\t\t\t\telse if (Board[j][k].charAt(2) == '_')\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tif ((j == Board.length-2) && (k == Board.length-3)){\r\n\t\t\t\t\tthis.winner = Board[j][k].charAt(2);\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean checkDiagonal() {\n\t\t// conditions fo player X\n\t\tif ((bt[0].getText().equals(\"X\") && bt[4].getText().equals(\"X\") && bt[8].getText().equals(\"X\"))\n\t\t\t\t|| (bt[2].getText().equals(\"X\") && bt[4].getText().equals(\"X\") && bt[6].getText().equals(\"X\"))) {\n\t\t\tjtf.setText(\" PLAYER X WON!\");\n\t\t\tjtf.setForeground(Color.red);\n\t\t\tjtf.setFont(new Font(\"Arial Black\", Font.BOLD, 50));\n\t\t\tfor (i = 0; i < xo.length; i++) {\n\t\t\t\tbt[i].setEnabled(false);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\t// conditions fo player O\n\t\tif ((bt[0].getText().equals(\"O\") && bt[4].getText().equals(\"O\") && bt[8].getText().equals(\"O\"))\n\t\t\t\t|| (bt[2].getText().equals(\"O\") && bt[4].getText().equals(\"O\") && bt[6].getText().equals(\"O\"))) {\n\t\t\tjtf.setText(\" PLAYER O WON!\");\n\t\t\tjtf.setForeground(Color.blue);\n\t\t\tjtf.setFont(new Font(\"Arial Black\", Font.BOLD, 50));\n\t\t\tfor (i = 0; i < xo.length; i++) {\n\t\t\t\tbt[i].setEnabled(false);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public void MovesRemainingExists() {\n InsideMovesRemainingExists = 1;\n NoMovesRemaining = 1;\n Beginning:\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n previousX = i;\n previousY = j + 1;\n if ((i + 1) < 9) {\n ValidSwitch(i + 1, j + 1);\n if (NoMovesRemaining == 0) { //checks the candies to the right\n ResetState();\n break Beginning; //breaks the loop\n }\n }\n\n if ((i - 1) >= 0) {\n ValidSwitch(i - 1, j + 1);\n if (NoMovesRemaining == 0) { //checks the candies to the left\n ResetState();\n break Beginning;\n }\n }\n\n if ((j + 1) < 9) {\n ValidSwitch(i, j + 2);\n if (NoMovesRemaining == 0) { //checks the candies on the bottom\n ResetState();\n break Beginning;\n }\n }\n\n if ((j - 1) >= 0) {\n ValidSwitch(i, j);\n if (NoMovesRemaining == 0) { //checks the candies at the top\n ResetState();\n break Beginning;\n }\n }\n }\n\n }\n InsideMovesRemainingExists = 0;\n\n}", "boolean verticalWin(){\n\t\tint match_counter=1;\n\t\tboolean flag=false;\n\t\tfor(int column=0;column<25;column++){\n\t\t\tfor(int row=8;row>=0;row--){\n\t\t\t\tif(Board[row][column]!='\\u0000'){\n\t\t\t\t\tif(Board[row][column]!='O'){\n\t\t\t\t\t\tif(Board[row][column]==Board[row+1][column])\n\t\t\t\t\t\t\tmatch_counter++;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflag=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(match_counter==4){\n\t\t\t\t\tflag=true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (flag == true)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn flag;\n\t}" ]
[ "0.76808673", "0.7676943", "0.75713795", "0.75407284", "0.7531781", "0.752648", "0.74821734", "0.74299294", "0.74128234", "0.7391343", "0.7368067", "0.7356322", "0.7342707", "0.72748566", "0.7274512", "0.7236196", "0.7233697", "0.7211992", "0.7188406", "0.7187419", "0.71790373", "0.7166945", "0.7162867", "0.714872", "0.7124437", "0.7123397", "0.7075472", "0.70509183", "0.7037801", "0.70107216", "0.7000183", "0.6980635", "0.6978916", "0.6956818", "0.6910259", "0.6905937", "0.68876", "0.688547", "0.68806267", "0.68547946", "0.6821801", "0.6820796", "0.68105227", "0.6805286", "0.6800894", "0.6799838", "0.67979366", "0.67965555", "0.67814666", "0.67801726", "0.6775403", "0.67577106", "0.6740211", "0.6731419", "0.67170644", "0.67124116", "0.66992927", "0.66793704", "0.667475", "0.66716605", "0.6649625", "0.66415095", "0.66253114", "0.66231173", "0.661097", "0.66079664", "0.6607602", "0.65965647", "0.65960824", "0.65943074", "0.6592116", "0.6585091", "0.65812844", "0.6577743", "0.6575726", "0.65685344", "0.65603983", "0.6560123", "0.65504956", "0.65481365", "0.65292275", "0.6512413", "0.6508148", "0.6488863", "0.64861596", "0.6477468", "0.64673823", "0.64668256", "0.6465432", "0.64640063", "0.64626247", "0.6457779", "0.6454739", "0.6453716", "0.645266", "0.64511967", "0.6446668", "0.64420336", "0.64319843", "0.6426418" ]
0.8556861
0
/This method only returns one integer, referring to one column a "chip will be dropped into". It first sees to if it can win anywhere (verticals, all horizontals, all diagnonals, and all sub subdiagonals). If if can't win anywhere, it will then see if the user is one move away from winning by checking for all verticals, all horizontals, all diagnonals, and all sub subdiagonals, and will block it. It also of course makes sure that when blocking that there is nothing below the space for where it would have to have the chip. Since it would be too easy to beat the computer by simply putting 3 red chips in a row with nothing on either side, the computer checks for that and will block (RR) on the left. Since a smart real player would attempt to set itself up for a win if it couldn't win or block on a given turn, if the computer has no other moves it will try and itself up for a vertical or horizontal win by connecting 3. If and only if none of this is possible, the computer will then generate a random number. only checks for columns
public int AI(){ for(int i=0; i<3; i++){ for(int j=0; j<7; j++){ if(board[i][j]==0 && board[i+1][j]==2 && board[i+2][j]==2 && board[i+3][j]==2){ return j; } } } //checks for horizontals (Y-YY) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==2 && board[i][j+1]==0 && board[i][j+2]==2 && board[i][j+3]==2){ if((i==5)|| (i==4&&board[5][j+1]!=0) || (i==3&&board[5][j+1]!=0&&board[4][j+1]!=0) || (i==2&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0) || (i==1&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0) || (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0) || (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0&&board[0][j+1]!=0)){ return j+1; } } } } //checks for horizontals (YY-Y) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==2 && board[i][j+1]==2 && board[i][j+2]==0 && board[i][j+3]==2){ if((i==5)|| (i==4&&board[5][j+2]!=0) || (i==3&&board[5][j+2]!=0&&board[4][j+2]!=0) || (i==2&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0) || (i==1&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0) || (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0) || (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0&&board[0][j+2]!=0)){ return j+2; } } } } //checks for horizontals (-YYY) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==0 && board[i][j+1]==2 && board[i][j+2]==2 && board[i][j+3]==2){ if((i==5)|| (i==4&&board[5][j]!=0) || (i==3&&board[5][j]!=0&&board[4][j]!=0) || (i==2&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0) || (i==1&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0) || (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0) || (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0&&board[0][j]!=0)){ return j; } } } } //checks for horizontals (YYY-) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==2 && board[i][j+1]==2 && board[i][j+2]==2 && board[i][j+3]==0){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+3; } } } } //checks for diagonal (-YYY) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==0 && board[i+2][j+1]==2 && board[i+1][j+2]==2 && board[i][j+3]==2){ if((i+3==5)|| (i+2==4&&board[5][j]!=0)|| (i+1==3&&board[5][j]!=0&&board[4][j]!=0)|| (i==2&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0)|| (i==1&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0)|| (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0)){ return j; } } } } //checks for diagonal (Y-YY) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==2 && board[i+2][j+1]==0 && board[i+1][j+2]==2 && board[i][j+3]==2){ if((i==2&&board[5][j+1]!=0)|| (i==1&&board[5][j+1]!=0&&board[4][j+1]!=0)|| (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0)){ return j+1; } } } } //checks for diagonal (YY-Y) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==2 && board[i+2][j+1]==2 && board[i+1][j+2]==0 && board[i][j+3]==2){ if((i==2&&board[5][j+2]!=0&&board[4][j+2]!=0)|| (i==1&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0)|| (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0)){ return j+2; } } } } //checks for diagonal (YYY-) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==2 && board[i+2][j+1]==2 && board[i+1][j+2]==2 && board[i][j+3]==0){ if((i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0)|| (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0)|| (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0)){ return j+3; } } } } //checks for subdiagonal (-YYY) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==0 && board[i+1][j+1]==2 && board[i+2][j+2]==2 && board[i+3][j+3]==2){ if((i==0&&board[1][j]!=0)|| (i==1&&board[2][j]!=0)|| (i==2&&board[3][j]!=0)){ return j; } } } } //checks for subdiagonal (Y-YY) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==2 && board[i+1][j+1]==0 && board[i+2][j+2]==2 && board[i+3][j+3]==2){ if((i==0&&board[2][j+1]!=0)|| (i==1&&board[3][j+1]!=0)|| (i==2&&board[4][j+1]!=0)){ return j+1; } } } } //checks for subdiagonal (YY-Y) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==2 && board[i+1][j+1]==2 && board[i+2][j+2]==0 && board[i+3][j+3]==2){ if((i==0&&board[3][j+2]!=0)|| (i==1&&board[4][j+2]!=0)|| (i==2&&board[5][j+2]!=0)){ return j+2; } } } } //checks for subdiagonal (YYY-) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==2 && board[i+1][j+1]==2 && board[i+2][j+2]==2 && board[i+3][j+3]==0){ if((i==0&&board[4][j+3]!=0)|| (i==1&&board[5][j+3]!=0)|| (i==2)){ return j+3; } } } } //BLOCK CHECKER //columns for(int i=0; i<3; i++){ for(int j=0; j<7; j++){ if(board[i][j]==0 && board[i+1][j]==1 && board[i+2][j]==1 && board[i+3][j]==1){ return j; } } } //Checks for blocks horizontal (R-RR) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==1 && board[i][j+1]==0 && board[i][j+2]==1 && board[i][j+3]==1){ if((i==5)|| (i==4&&board[5][j+1]!=0) || (i==3&&board[5][j+1]!=0&&board[4][j+1]!=0) || (i==2&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0) || (i==1&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0) || (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0) || (i==0&&board[5][j+1]!=0&&board[4][j+1]!=0&&board[3][j+1]!=0&&board[2][j+1]!=0&&board[1][j+1]!=0&&board[0][j+1]!=0)){ return j+1; } } } } //checks for horizontal blocks (RR-R) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==1 && board[i][j+1]==1 && board[i][j+2]==0 && board[i][j+3]==1){ if((i==5)|| (i==4&&board[5][j+2]!=0) || (i==3&&board[5][j+2]!=0&&board[4][j+2]!=0) || (i==2&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0) || (i==1&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0) || (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0) || (i==0&&board[5][j+2]!=0&&board[4][j+2]!=0&&board[3][j+2]!=0&&board[2][j+2]!=0&&board[1][j+2]!=0&&board[0][j+2]!=0)){ return j+2; } } } } //checks for horizontals (-RRR) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==0 && board[i][j+1]==1 && board[i][j+2]==1 && board[i][j+3]==1){ if((i==5)|| (i==4&&board[5][j]!=0) || (i==3&&board[5][j]!=0&&board[4][j]!=0) || (i==2&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0) || (i==1&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0) || (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0) || (i==0&&board[5][j]!=0&&board[4][j]!=0&&board[3][j]!=0&&board[2][j]!=0&&board[1][j]!=0&&board[0][j]!=0)){ return j; } } } } //checks for horizontals (RRR-) for(int i=0; i<6; i++){ for(int j=0; j<4; j++){ if(board[i][j]==1 && board[i][j+1]==1 && board[i][j+2]==1 && board[i][j+3]==0){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+3; } } } } //checks for diagonal (-RRR) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==0 && board[i+2][j+1]==1 && board[i+1][j+2]==1 && board[i][j+3]==1){ if((i+3==5)|| (i+2==4&&board[i+3][j]!=0)|| (i+1==3&&board[i+3][j]!=0&&board[i+2][j]!=0)|| (i==2&&board[i+3][j]!=0&&board[i+2][j]!=0&&board[i+1][j]!=0)|| (i==1&&board[i+3][j]!=0&&board[i+2][j]!=0&&board[i+1][j]!=0&&board[i][j]!=0)|| (i==0&&board[i+3][j]!=0&&board[i+2][j]!=0&&board[i+1][j]!=0&&board[i][j]!=0&&board[i-1][j]!=0)){ return j; } } } } //checks for diagonal (R-RR) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==1 && board[i+2][j+1]==0 && board[i+1][j+2]==1 && board[i][j+3]==1){ if((i+2==4&&board[i+3][j+1]!=0)|| (i+1==3&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0)|| (i==2&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0&&board[i+1][j+1]!=0)|| (i==1&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0&&board[i+1][j+1]!=0&&board[i][j+1]!=0)|| (i==0&&board[i+3][j+1]!=0&&board[i+2][j+1]!=0&&board[i+1][j+1]!=0&&board[i][j+1]!=0&&board[i-1][j+1]!=0)){ return j+1; } } } } //checks for diagonal (RR-R) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==1 && board[i+2][j+1]==1 && board[i+1][j+2]==0 && board[i][j+3]==1){ if((i==2&&board[i+2][j+2]!=0)){//|| return j+2; } } } } //checks for diagonal (RRR-) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i+3][j]==1 && board[i+2][j+1]==1 && board[i+1][j+2]==1 && board[i][j+3]==0){ if((i==0&&board[1][j+3]!=0)|| (i==1&&board[2][j+3]!=0)|| (i==2&&board[3][j+3]!=0)){ return j+3; } } } } //checks for subdiagonal blocks(-RRR) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==0 && board[i+1][j+1]==1 && board[i+2][j+2]==1 && board[i+3][j+3]==1){ if((i==0&&board[1][j]!=0)|| (i==1&&board[2][j]!=0)|| (i==2&&board[3][j]!=0)){ return j; } } } } //checks for subdiagonal blocks(Y-YY) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==1 && board[i+1][j+1]==0 && board[i+2][j+2]==1 && board[i+3][j+3]==1){ if((i==0&&board[2][j+1]!=0)|| (i==1&&board[3][j+1]!=0)|| (i==2&&board[4][j+1]!=0)){ return j+1; } } } } //checks for subdiagonal blocks(YY-Y) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==1 && board[i+1][j+1]==1 && board[i+2][j+2]==0 && board[i+3][j+3]==1){ if((i==0&&board[3][j+2]!=0)|| (i==1&&board[4][j+2]!=0)|| (i==2&&board[5][j+2]!=0)){ return j+2; } } } } //checks for subdiagonal blocks(YYY-) for(int i=0; i<3; i++){ for(int j=0; j<4; j++){ if(board[i][j]==1 && board[i+1][j+1]==1 && board[i+2][j+2]==1 && board[i+3][j+3]==0){ if((i==0&&board[4][j+3]!=0)|| (i==1&&board[5][j+3]!=0)|| (i==2)){ return j+3; } } } } //INTERMEDIATE BLOCKING //If horizontal (RR--) make it (RRY-) for(int i=0; i<6; i++){ for(int j=0; j<3; j++){ if(board[i][j]==1 && board[i][j+1]==1 && board[i][j+2]==0){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+2; } } } } //If horizontal (--RR) make it (-YRR) for(int i=0; i<6; i++){ for(int j=0; j<3; j++){ if(board[i][j+1]==0 && board[i][j+2]==1 && board[i][j+3]==1){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+1; } } } } //The following attempts to set the computer up for a win, instead of first just generating a random number for(int i=0; i<3; i++){ for(int j=0; j<7; j++){ if(board[i+1][j]==0 && board[i+2][j]==2 && board[i+3][j]==2){ return j; } } } //If horizontal (-YY-) make it (-YYY) for(int i=0; i<6; i++){ for(int j=0; j<3; j++){ if(board[i][j]==0 && board[i][j+1]==2 && board[i][j+2]==2 && board[i][j+3]==0){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+3; } } } } //If horizontal (YY--) make it (YYY-) for(int i=0; i<6; i++){ for(int j=0; j<3; j++){ if(board[i][j]==2 && board[i][j+1]==2 && board[i][j+2]==0 && board[i][j+3]==0){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+2; } } } } //If horizontal (--YY) make it (-YYY) for(int i=0; i<6; i++){ for(int j=0; j<3; j++){ if(board[i][j]==0 && board[i][j+1]==0 && board[i][j+2]==2 && board[i][j+3]==2){ if((i==5)|| (i==4&&board[5][j+3]!=0) || (i==3&&board[5][j+3]!=0&&board[4][j+3]!=0) || (i==2&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0) || (i==1&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0) || (i==0&&board[5][j+3]!=0&&board[4][j+3]!=0&&board[3][j+3]!=0&&board[2][j+3]!=0&&board[1][j+3]!=0&&board[0][j+3]!=0)){ return j+1; } } } } boolean sent = false; //The following code will simply generate a random number. int x = (int)((Math.random())*7); if(!wonYet){ while(!sent){ if(board[0][x]!=0) x = (int)((Math.random())*7); else if(board[1][x]!=0) x = (int)((Math.random())*7); else if(board[2][x]!=0) x = (int)((Math.random())*7); else if(board[3][x]!=0) x = (int)((Math.random())*7); else if(board[4][x]!=0) x = (int)((Math.random())*7); else if(board[5][x]!=0) x = (int)((Math.random())*7); sent = true; } return x; } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int checkWinner() {\n if (this.turnCount >= 2) {\n int colWin = this.checkColumn();\n if (colWin > 0) {\n return colWin;\n }\n\n int rowWin = this.checkRow();\n if (rowWin > 0) {\n return rowWin;\n }\n\n int diagWin = checkDiagonal();\n if (diagWin > 0) {\n return diagWin;\n }\n }\n return 0;\n }", "public Player checkWin ()\n {\n //checks rows\n for (int row = 0; row < 3; row++)\n if (getGridElement(row, 0).getPlayer() == getGridElement(row, 1).getPlayer() &&\n getGridElement(row, 1).getPlayer() == getGridElement(row, 2).getPlayer() &&\n getGridElement(row, 0).getPlayer() != Player.NONE)\n return getGridElement(row, 0).getPlayer();\n\n //checks columns\n for (int column = 0; column < 3; column++)\n if (getGridElement(0, column).getPlayer() == getGridElement(1, column).getPlayer() &&\n getGridElement(1, column).getPlayer() == getGridElement(2, column).getPlayer() &&\n getGridElement(0, column).getPlayer() != Player.NONE)\n return getGridElement(0, column).getPlayer();\n\n //checks diagonals\n if (getGridElement(0, 0).getPlayer() == getGridElement(1, 1).getPlayer() &&\n getGridElement(1, 1).getPlayer() == getGridElement(2, 2).getPlayer() &&\n getGridElement(0, 0).getPlayer() != Player.NONE)\n return getGridElement(0, 0).getPlayer();\n if (getGridElement(2, 0).getPlayer() == getGridElement(1, 1).getPlayer() &&\n getGridElement(1, 1).getPlayer() == getGridElement(0, 2).getPlayer() &&\n getGridElement(0, 0).getPlayer() != Player.NONE)\n return getGridElement(2, 0).getPlayer();\n\n return Player.NONE;\n }", "private int[] nextColWin(){ \r\n\t\tfor (int r=0; r<3; r++){ \r\n\t\t\tif (board[0][r] == board[1][r] && board[2][r] == '-' && board[0][r] != '-'){\r\n\t\t\t\tcolWin[0] = 2;\r\n\t\t\t\tcolWin[1] = r;\r\n\t\t\t\treturn colWin;\r\n\t\t\t}\r\n\t\t\telse if (board[1][r] == board[2][r] && board[0][r] == '-' && board[0][r] != '-'){\r\n\t\t\t\tcolWin[0] = 0;\r\n\t\t\t\tcolWin[1] = r;\r\n\t\t\t\treturn colWin;\r\n\t\t\t}\r\n\t\t\telse if (board[0][r] == board[2][r] && board[1][r] == '-' && board[0][r] != '-'){\r\n\t\t\t\tcolWin[0] = 1;\r\n\t\t\t\tcolWin[1] = r;\r\n\t\t\t\treturn colWin;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn colWin;\r\n\t\t\r\n\t}", "public int checkForWin() \r\n {\r\n \twinner = null;\r\n \tint winrole = -1;\r\n \tif(isBoardFull()){\r\n \t\tint white = 0;\r\n \t\tint black = 0;\r\n\t\t\tfor(int i = 0; i < boardsize; ++i){\r\n\t\t\t\tfor(int j = 0; j<boardsize; ++j){\r\n\t\t\t\t\tif(board[i][j] == 0){\r\n\t\t\t\t\t\twhite++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(board[i][j] == 1){\r\n\t\t\t\t\t\tblack++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(white > black){\r\n\t\t\t\twinrole = 0;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\t\r\n\t\t\telse if(black > white){\r\n\t\t\t\twinrole = 1;\r\n\t\t\t\twinner = agent[winrole];\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\twinrole=2;\r\n\t\t\t}\r\n\t\t\treturn winrole;\r\n \t}\r\n \treturn -1;\r\n }", "@Override\n public int getWinner() {\n /*\n * To please the test as well as the game\n * Temporarily change the turn colour\n */\n int temp;\n if (whoseTurn() == RED) {\n temp = YELLOW;\n } else {\n temp = RED;\n }\n\n //test horizontally\n //set x to 1 as the placed counter will always be correct\n int x = 1;\n int i = 1;\n //to check if zero has been found\n boolean leftZeroFound = false;\n boolean rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check to right of last placed\n if (!rightZeroFound && inBounds(0, i)\n && board[lastPlacedRow][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check to left of last placed\n if (!leftZeroFound && inBounds(0, -i)\n && board[lastPlacedRow][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check vertically\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n boolean zeroFound = false;\n while (!zeroFound) {\n //check below last placed\n if (inBounds(-i, 0) && board[lastPlacedRow - i][lastPlacedCol] == temp) {\n x++;\n } else {\n zeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top right diagonal\n //reset x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top right diagonal\n if (!rightZeroFound && inBounds(i, i)\n && board[lastPlacedRow + i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n //check bottom left\n if (!leftZeroFound && inBounds(-i, -i)\n && board[lastPlacedRow - i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n i++;\n }\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //check top left\n //set x to 1 as the placed counter will always be correct\n x = 1;\n i = 1;\n //to check if zero has been found\n leftZeroFound = false;\n rightZeroFound = false;\n while (!rightZeroFound || !leftZeroFound) {\n //check top left\n if (!leftZeroFound && inBounds(i, -i)\n && board[lastPlacedRow + i][lastPlacedCol - i] == temp) {\n x++;\n } else {\n leftZeroFound = true;\n }\n\n //check bottom right\n if (!rightZeroFound && inBounds(-i, i)\n && board[lastPlacedRow - i][lastPlacedCol + i] == temp) {\n x++;\n } else {\n rightZeroFound = true;\n }\n\n i++;\n }\n //return the winning colour if a row has been found\n if (x >= NUM_IN_A_ROW_TO_WIN) {\n return temp;\n }\n\n //return Empty if a winner has not been found\n return EMPTY;\n }", "private boolean colWin(){ \r\n\t\tfor (int i=0; i<3; i++){ \r\n\t\t\tif (checkValue (board[0][i], board[1][i], board[2][i]))\r\n\t\t\t\treturn true; \r\n\t\t}\r\n\t\treturn false; \r\n\t}", "public char findWinner() {\n char[] winners = {\n checkRowVictory(getTopRow()),\n checkRowVictory(getMidRow()),\n checkRowVictory(getLowRow()),\n checkRowVictory(getVerticalMidRow()),\n checkRowVictory(getVerticalLeftRow()),\n checkRowVictory(getVerticalRightRow()),\n checkDiagonalVictory()\n };\n\n for (char winner : winners) {\n if (winner != 0) {\n return winner;\n }\n }\n\n return 0;\n }", "public String computerMove() {\n\t\t// Look to win in a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win in a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to win a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == -2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a row\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tif (rowSum[r] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a col\n\t\tfor (int c = 0; c < 3; c++) {\n\t\t\tif (colSum[c] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Look to block a diag\n\t\tfor (int d = 0; d < 2; d++) {\n\t\t\tif (diagSum[d] == 2) {\n\t\t\t\t// Find the empty space\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tint c = d == 0 ? r : 2 - r;\n\t\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\t\treturn done(r, c);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Find the non-full row and col w/ least val\n\t\tint bestR = -1;\n\t\tint bestC = -1;\n\t\tint minSum = 10;\n\t\tfor (int r = 0; r < 3; r++) {\n\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\tif (board[r][c] == 0) {\n\t\t\t\t\tint sum = rowSum[r] + colSum[c];\n\t\t\t\t\tif (sum < minSum) {\n\t\t\t\t\t\tminSum = sum;\n\t\t\t\t\t\tbestR = r;\n\t\t\t\t\t\tbestC = c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn done(bestR, bestC);\n\t}", "private int[] nextRowWin(){ \r\n\t\tfor (int r=0; r<3; r++){ \r\n\t\t\tif (board[r][0] == board[r][1] && board[r][2] == '-' && board[r][0] != '-') {\r\n\t\t\t\trowWin[0] = r; \r\n\t\t\t\trowWin[1] = 2;\r\n\t\t\t\treturn rowWin; \r\n\t\t\t}\r\n\t\t\telse if (board[r][1] == board[r][2] && board[r][0] == '-' && board[r][1] != '-') {\r\n\t\t\t\trowWin[0] = r;\r\n\t\t\t\trowWin[1] = 0;\r\n\t\t\t\treturn rowWin; \r\n\t\t\t}\r\n\t\t\telse if (board[r][0] == board[r][2] && board[r][1] == '-' && board[r][0] != '-'){\r\n\t\t\t\trowWin[0] = r;\r\n\t\t\t\trowWin[1] = 1;\r\n\t\t\t\treturn rowWin; \r\n\t\t\t}\r\n\t\t}\r\n\t\treturn rowWin;\r\n\t}", "public int getComputerMove()\n {\n int move;\n\n // First see if there's a move O can make to win\n for (int i = 0; i < BOARD_SIZE; i++) {\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER) {\n char curr = mBoard[i];\n mBoard[i] = COMPUTER_PLAYER;\n if (checkForWinner() == 3) {\n mBoard[i] = curr;\n return i;\n }\n else\n mBoard[i] = curr;\n }\n }\n\n // See if there's a move O can make to block X from winning\n for (int i = 0; i < BOARD_SIZE; i++) {\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER) {\n char curr = mBoard[i]; // Save the current number\n mBoard[i] = HUMAN_PLAYER;\n if (checkForWinner() == 2) {\n //mBoard[i] = COMPUTER_PLAYER;\n mBoard[i] = curr;\n return i;\n }\n else\n mBoard[i] = curr;\n }\n }\n\n // Generate random move\n do\n {\n move = mRand.nextInt(BOARD_SIZE);\n } while (mBoard[move] == HUMAN_PLAYER || mBoard[move] == COMPUTER_PLAYER);\n\n return move;\n }", "public int checkWin(){\n //check for horizontal and vertical wins\n for(int i=0; i<3; i++){\n if(gameBoard[i][0].equals(\"O\") && gameBoard[i][1].equals(\"O\") && gameBoard[i][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[i][0].equals(\"X\") && gameBoard[i][1].equals(\"X\") && gameBoard[i][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][i].equals(\"O\") && gameBoard[1][i].equals(\"O\") && gameBoard[2][i].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][i].equals(\"X\") && gameBoard[1][i].equals(\"X\") && gameBoard[2][i].equals(\"X\")){\n return 2;\n }\n }\n //check for both diagonal cases\n if(gameBoard[0][0].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][2].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][2].equals(\"O\") && gameBoard[1][1].equals(\"O\") && gameBoard[2][0].equals(\"O\")){\n return 1;\n }\n else if(gameBoard[0][0].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][2].equals(\"X\")){\n return 2;\n }\n else if(gameBoard[0][2].equals(\"X\") && gameBoard[1][1].equals(\"X\") && gameBoard[2][0].equals(\"X\")){\n return 2;\n }\n return 0;\n }", "public int determineWinner() {\n\t\tif(board[1][1] != 0 && (\n\t\t\t(board[1][1] == board[0][0] && board[1][1] == board[2][2]) ||\n\t\t\t(board[1][1] == board[0][2] && board[1][1] == board[2][0]) ||\n\t\t\t(board[1][1] == board[0][1] && board[1][1] == board[2][1]) ||\n\t\t\t(board[1][1] == board[1][0] && board[1][1] == board[1][2]))){\n\t\t\treturn board[1][1];\n\t\t}\n\t\telse if (board[0][0] != 0 &&(\n\t\t\t(board[0][0] == board[0][1] && board[0][0] == board[0][2]) ||\n\t\t\t(board[0][0] == board[1][0] && board[0][0] == board[2][0]))){\n\t\t\treturn board[0][0];\n\t\t}\n\t\telse if (board [2][2] != 0 && (\n\t\t\t(board[2][2] == board[2][0] && board[2][2] == board[2][1]) ||\n\t\t\t(board[2][2] == board[0][2] && board[2][2] == board[1][2]))) {\n\t\t\treturn board[2][2];\n\t\t}\n\t\t\n\t\t//See if every square has been marked, return still in progress if not\n\t\tfor(int i = 0; i < 3; ++i) {\n\t\t\tfor(int j = 0; j < 3; ++j) {\n\t\t\t\tif (board[i][j] == 0)\n\t\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Return tie\n\t\treturn 3;\n\t}", "public int checkWin() {\n\t\t// Check rows\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (Math.abs(rowSum[i]) == 3) {\n\t\t\t\tover = true;\n\t\t\t\treturn rowSum[i] / Math.abs(rowSum[i]);\n\t\t\t}\n\t\t}\n\n\t\t// Check cols\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (Math.abs(colSum[i]) == 3) {\n\t\t\t\tover = true;\n\t\t\t\treturn colSum[i] / Math.abs(colSum[i]);\n\t\t\t}\n\t\t}\n\n\t\t// Check diags\n\t\tfor (int i = 0; i < 2; i++) {\n\t\t\tif (Math.abs(diagSum[i]) == 3) {\n\t\t\t\tover = true;\n\t\t\t\treturn diagSum[i] / Math.abs(diagSum[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn 0;\n\t}", "public boolean checkForWin()\n {\n //Horizontal win\n for (int r = 0; r <= 5; r++)\n {\n for (int c = 0; c <= 3; c++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r] == player_turn &&\n current_board[c+2][r] == player_turn &&\n current_board[c+3][r] == player_turn)\n return true;\n }\n }\n //Vertical win\n for (int c = 0; c <= 6; c++)\n {\n for (int r = 0; r <= 2; r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c][r+1] == player_turn &&\n current_board[c][r+2] == player_turn &&\n current_board[c][r+3] == player_turn)\n return true;\n }\n }\n //Shortest diagonals/anti diagonals (cell length == 4)\n //postive slope\n if (current_board[0][2] == player_turn && current_board[1][3] == player_turn && current_board[2][4] == player_turn && current_board[3][5] == player_turn)\n return true;\n if (current_board[3][0] == player_turn && current_board[4][1] == player_turn && current_board[5][2] == player_turn && current_board[6][3] == player_turn)\n return true;\n //negative slope\n if (current_board[0][3] == player_turn && current_board[1][2] == player_turn && current_board[2][1] == player_turn && current_board[3][0] == player_turn)\n return true;\n if (current_board[3][5] == player_turn && current_board[4][4] == player_turn && current_board[5][3] == player_turn && current_board[6][2] == player_turn)\n return true;\n\n //Medium-length diagonals/anti diagonals (cell length == 5)\n //positive slope\n if (current_board[0][1] == player_turn && current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn)\n return true;\n if (current_board[1][2] == player_turn && current_board[2][3] == player_turn && current_board[3][4] == player_turn && current_board[4][5] == player_turn)\n return true;\n if (current_board[2][0] == player_turn && current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn)\n return true;\n if (current_board[3][1] == player_turn && current_board[4][2] == player_turn && current_board[5][3] == player_turn && current_board[6][4] == player_turn)\n return true;\n //negative slope\n if (current_board[0][4] == player_turn && current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn)\n return true;\n if (current_board[1][3] == player_turn && current_board[2][2] == player_turn && current_board[3][1] == player_turn && current_board[4][0] == player_turn)\n return true;\n if (current_board[2][5] == player_turn && current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn)\n return true;\n if (current_board[3][4] == player_turn && current_board[4][3] == player_turn && current_board[5][2] == player_turn && current_board[6][1] == player_turn)\n return true;\n\n //Longest diagonals/anti diagonals (cell length == 6)\n //positive slope\n for (int c=0, r=0; c <= 2 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n for (int c=1, r=0; c <= 3 && r <= 2; c++, r++)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r+1] == player_turn &&\n current_board[c+2][r+2] == player_turn &&\n current_board[c+3][r+3] == player_turn)\n return true;\n }\n //negative slope\n for (int c=0, r=5; c <= 2 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n for (int c=1, r=5; c <= 3 && r >= 3; c++, r--)\n {\n if (current_board[c][r] == player_turn &&\n current_board[c+1][r-1] == player_turn &&\n current_board[c+2][r-2] == player_turn &&\n current_board[c+3][r-3] == player_turn)\n return true;\n }\n\n return false;\n }", "public int checkForWinner() {\n\n // Check horizontal wins\n for (int i = 0; i <= 6; i += 3)\t{\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+1] == HUMAN_PLAYER &&\n mBoard[i+2]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+1]== COMPUTER_PLAYER &&\n mBoard[i+2] == COMPUTER_PLAYER)\n return 3;\n }\n\n // Check vertical wins\n for (int i = 0; i <= 2; i++) {\n if (mBoard[i] == HUMAN_PLAYER &&\n mBoard[i+3] == HUMAN_PLAYER &&\n mBoard[i+6]== HUMAN_PLAYER)\n return 2;\n if (mBoard[i] == COMPUTER_PLAYER &&\n mBoard[i+3] == COMPUTER_PLAYER &&\n mBoard[i+6]== COMPUTER_PLAYER)\n return 3;\n }\n\n // Check for diagonal wins\n if ((mBoard[0] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[8] == HUMAN_PLAYER) ||\n (mBoard[2] == HUMAN_PLAYER &&\n mBoard[4] == HUMAN_PLAYER &&\n mBoard[6] == HUMAN_PLAYER))\n return 2;\n if ((mBoard[0] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[8] == COMPUTER_PLAYER) ||\n (mBoard[2] == COMPUTER_PLAYER &&\n mBoard[4] == COMPUTER_PLAYER &&\n mBoard[6] == COMPUTER_PLAYER))\n return 3;\n\n // Check for tie\n for (int i = 0; i < BOARD_SIZE; i++) {\n // If we find a number, then no one has won yet\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER)\n return 0;\n }\n\n // If we make it through the previous loop, all places are taken, so it's a tie\n return 1;\n }", "public int evalBoard(){\n if (wins('o')){\n return 3;\n }\n // Return 0 if human wins\n else if (wins('b')){\n return 0;\n }\n //Return 2 if game is draw\n else if (isDraw()){\n return 2;\n }\n // Game is not a draw and no player has won. Game is still undecided.\n else {\n return 1;\n }\n }", "private int checkColumn() {\n for (int i = 0; i < 3; i++) {\n if ((this.board[i][0] == this.board[i][1]) && (this.board[i][0] == this.board[i][2])) {\n return this.board[i][0];\n }\n }\n return 0;\n }", "private char isWonButForChars() {\n for (int y = 0; y < wonBoards.length; y++) {\n if (checkRow(y) != ' ') {\n return checkRow(y);\n }\n }\n for (int x = 0; x < wonBoards[0].length; x++) {\n if (checkColumn(x) != ' ') {\n return checkColumn(x);\n }\n }\n if (wonBoards[0][0] == wonBoards[1][1] && wonBoards[1][1] == wonBoards[2][2]) {\n if (wonBoards[0][0] != ' ') {\n return wonBoards[0][0];\n }\n }\n if (wonBoards[2][0] == wonBoards[1][1] && wonBoards[1][1] == wonBoards[0][2]) {\n if (wonBoards[2][0] != ' ') {\n return wonBoards[2][0];\n }\n }\n\n return ' ';\n }", "private boolean diagWin(){ \r\n\t\treturn ((checkValue (board[0][0],board[1][1],board[2][2]) == true) || \r\n\t\t\t\t(checkValue (board[0][2], board[1][1], board[2][0]) == true)); \r\n\t}", "private void checkVictory() {\n\t\tboolean currentWin = true;\n\t\t\n\t\t//Vertical win\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][yGuess] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Horizontal win\n\t\tcurrentWin = true;\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[xGuess][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t\n\t\t//Top left bottom right diagonal win\n\t\tcurrentWin = true;\n\t\tif (xGuess == yGuess){\n\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\tif (gameArray[i][i] != currentPlayer){\n\t\t\t\tcurrentWin = false;\n\t\t\t}\n\t\t}\n\t\tif (currentWin){\n\t\t\tgameWon = true;\n\t\t}\n\t\t}\n\t\t\n\t\t//Bottom left top right diagonal win\n\t\tcurrentWin = true;\n\t\tif (yGuess + xGuess == DIVISIONS - 1){\n\t\t\tfor (int i = 0; i<DIVISIONS; i++){\n\t\t\t\tif (gameArray[i][(DIVISIONS - 1) -i] != currentPlayer){\n\t\t\t\t\tcurrentWin = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentWin){\n\t\t\t\tgameWon = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "private boolean win(int row, int col, int player)\n {\n int check;\n // horizontal line\n // Start checking at a possible and valid leftmost point\n for (int start = Math.max(col - 3, 0); start <= Math.min(col,\n COLUMNS - 4); start++ )\n {\n // Check 4 chess horizontally from left to right\n for (check = 0; check < 4; check++ )\n {\n // The coordinate of column increases 1 every time\n if (chessBoard[row][start + check] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n\n // vertical line\n // Start checking at the point inputed if there exists at least 3 rows under\n // it.\n if (row + 3 < ROWS)\n {\n // Check another 3 chess vertically from top to bottom\n for (check = 1; check < 4; check++ )\n {\n // The coordinate of row increases 1 every time\n // Check if the chess all belong to the player\n if (chessBoard[row + check][col] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n\n // diagonal line \"\\\"\n // Start checking at a possible and valid leftmost and upmost point\n for (int start = Math.max(Math.max(col - 3, 0), col - row); start <= Math\n .min(Math.min(col, COLUMNS - 4), col + ROWS - row - 4); start++ )\n {\n // Check 4 chess diagonally from left and top to right and bottom\n for (check = 0; check < 4; check++ )\n {\n // The coordinate of row increases 1 every time\n // The coordinate of column increases 1 every time\n // Check if the chess all belong to the player\n if (chessBoard[row - col + start + check][start + check] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n\n // diagonal line \"/\"\n // Start checking at a possible and valid leftmost and downmost point\n for (int start = Math.max(Math.max(col - 3, 0),\n col - ROWS + row + 1); start <= Math.min(Math.min(col, COLUMNS - 4),\n col + row - 3); start++ )\n {\n // Check 4 chess diagonally from left and bottom to right and up\n for (check = 0; check < 4; check++ )\n {\n // The coordinate of row decreases 1 every time\n // The coordinate of column increases 1 every time\n // Check if the chess all belong to the player\n if (chessBoard[row + col - start - check][start + check] != player)\n {\n break;\n }\n }\n // If the checking passed, win\n if (check == 4)\n {\n return true;\n }\n }\n // no checking passed, not win\n return false;\n }", "private boolean rowWin (){ \r\n\t\tfor (int i=0; i<3; i++){ \r\n\t\t\tif (checkValue (board[i][0], board[i][1], board[i][2])){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false; \r\n\t}", "private void checkForWin(int x, int y, String s) {\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (grid[x][i].getText() != s)\n\t\t\t\tbreak;\n\t\t\tif (i == 3 - 1) {\n\t\t\t\tgameOver = true;\n\n\t\t\t\tif (grid[x][i].getText() == \"X\")\n\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\telse\n\t\t\t\t\twinner = \"Player 2\";\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// check row\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (grid[i][y].getText() != s)\n\t\t\t\tbreak;\n\t\t\tif (i == 3 - 1) {\n\t\t\t\tgameOver = true;\n\n\t\t\t\tif (grid[i][y].getText() == \"X\")\n\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\telse\n\t\t\t\t\twinner = \"Player 2\";\n\n\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// check diag\n\t\tif (x == y) {\n\t\t\t// we're on a diagonal\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tif (grid[i][i].getText() != s)\n\t\t\t\t\tbreak;\n\t\t\t\tif (i == 3 - 1) {\n\t\t\t\t\tgameOver = true;\n\n\t\t\t\t\tif (grid[i][i].getText() == \"X\")\n\t\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\t\telse\n\t\t\t\t\t\twinner = \"Player 2\";\n\t\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\t// check anti diag (thanks rampion)\n\t\tif (x + y == 3 - 1) {\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tif (grid[i][(3 - 1) - i].getText() != s)\n\t\t\t\t\tbreak;\n\t\t\t\tif (i == 3 - 1) {\n\t\t\t\t\tgameOver = true;\n\n\t\t\t\t\tif (grid[i][(3 - 1) - i].getText() == \"X\")\n\t\t\t\t\t\twinner = \"Player 1\";\n\t\t\t\t\telse\n\t\t\t\t\t\twinner = \"Player 2\";\n\t\t\t\t\tfor (int r = 0; r < 3; r++) {\n\t\t\t\t\t\tfor (int c = 0; c < 3; c++) {\n\t\t\t\t\t\t\tgrid[r][c].setEnabled(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private int[] nextDiagWin(){ \r\n\t\t//left diagonal\r\n\t\tif (board[0][0] == board[1][1] && board[2][2] == '-' && board[0][0] != '-'){\r\n\t\t\tdiagWin[0] = 2; \r\n\t\t\tdiagWin[1] = 2;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\telse if (board[1][1] == board[2][2] && board[0][0] == '-' && board[1][1] != '-'){\r\n\t\t\tdiagWin[0] = 0; \r\n\t\t\tdiagWin[1] = 0;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\telse if (board[0][0] == board[2][2] && board[1][1] == '-' && board[0][0] != '-'){\r\n\t\t\tdiagWin[0] = 1; \r\n\t\t\tdiagWin[1] = 1;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\t//right diagonal\r\n\t\telse if (board[0][2] == board[2][0] && board[1][1] == '-' && board[0][2] != '-'){\r\n\t\t\tdiagWin[0] = 1; \r\n\t\t\tdiagWin[1] = 1;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\telse if (board[0][2] == board[1][1] && board[2][0] == '-' && board[0][2] != '-'){\r\n\t\t\tdiagWin[0] = 2; \r\n\t\t\tdiagWin[1] = 0;\r\n\t\t\treturn diagWin;\r\n\t\t}\t\t\r\n\t\telse if (board[1][1] == board[2][0] && board[0][2] == '-' && board[1][1] != '-'){\r\n\t\t\tdiagWin[0] = 0; \r\n\t\t\tdiagWin[1] = 2;\r\n\t\t\treturn diagWin;\r\n\t\t}\r\n\t\treturn diagWin;\r\n\t}", "public int sides1() {\n for (int row = 0; row < board.length; row++)\n for (int col = 0; col < board.length; col++) {\n // left-border (excluding corners - check 3 sides only)\n if (row != 0 && row != board.length - 1 && col == 0) {\n if (board[row - 1][col] != null && board[row][col + 1] != null && board[row + 1][col] != null\n && board[row][col] != null)\n if (board[row - 1][col].getPlayerNumber() != board[row][col].getPlayerNumber()\n && board[row - 1][col].getPlayerNumber() != board[row][col].getPlayerNumber() &&\n board[row][col + 1].getPlayerNumber() != board[row][col].getPlayerNumber())\n if (playersArray[board[row][col].getPlayerNumber()] != -3)\n return board[row][col].getPlayerNumber();\n\n }\n // right-border (excluding corners - check 3 sides only)\n if (row != 0 && row != board.length - 1 && col == board.length - 1) {\n if (board[row - 1][col] != null && board[row][col - 1] !=\n null && board[row + 1][col] != null&& board[row][col] != null)\n if (board[row - 1][col].getPlayerNumber() != board[row][col].getPlayerNumber()\n && board[row][col].getPlayerNumber() != board[row+1][col] .getPlayerNumber() &&\n board[row][col - 1].getPlayerNumber() != board[row][col].getPlayerNumber())\n if (playersArray[board[row][col].getPlayerNumber()] != -3)\n return board[row][col].getPlayerNumber();\n }\n // above-border (excluding corners - check 3 sides only)\n if (col != 0 && col != board.length - 1 && row == 0) {\n if (board[row][col - 1] != null && board[row][col + 1] !=\n null && board[row + 1][col] != null&& board[row][col] != null)\n if (board[row][col].getPlayerNumber() == board[row][col + 1].getPlayerNumber()\n && board[row + 1][col].getPlayerNumber() != board[row][col].getPlayerNumber() &&\n board[row][col - 1].getPlayerNumber() != board[row][col].getPlayerNumber())\n if (playersArray[board[row][col].getPlayerNumber()] != -3)\n return board[row][col].getPlayerNumber();\n }\n // bottom-border (excluding corners - check 3 sides only)\n if (col != 0 && col != board.length - 1 && row == board.length - 1) {\n if (board[row][col - 1] != null && board[row][col + 1] != null && board[row - 1][col] != null&&\n board[row][col]!= null)\n if (board[row][col].getPlayerNumber() != board[row][col + 1].getPlayerNumber()\n && board[row - 1][col].getPlayerNumber() != board[row][col].getPlayerNumber() &&\n board[row][col - 1].getPlayerNumber() != board[row][col].getPlayerNumber())\n return board[row][col - 1].getPlayerNumber();\n }\n\n }\n return -2;\n\n }", "private boolean hasColWin() {\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n if (getBoard()[i][j] != null) {\n\n boolean colWin = colHasFour(i, j);\n if (colWin) {\n return true;\n }\n\n }\n }\n }\n return false;\n }", "private int checkWin(int x) {\n for (int row = 0; row < 8; row++) {\n for (int col = 0; col < 9; col++) {\n //Black = 1, Red = 0\n\n //Checks Vertically\n if ((buttons[row][col].getText() == \"O\") && (buttons[row][col+1].getText() == \"O\") && (buttons[row][col+2].getText() == \"O\") && (buttons[row][col+3].getText() == \"O\")) {\n return 0;\n }\n if ((buttons[row][col].getText() == \"X\") && (buttons[row][col+1].getText() == \"X\") && (buttons[row][col+2].getText() == \"X\") && (buttons[row][col+3].getText() == \"X\")) {\n return 1;\n }\n\n //Checks Vertically\n if ((buttons[row][col].getText() == \"O\") && (buttons[row+1][col].getText() == \"O\") && (buttons[row+2][col].getText() == \"O\") && (buttons[row+3][col].getText() == \"O\")) {\n return 0;\n }\n\n if ((buttons[row][col].getText() == \"X\") && (buttons[row+1][col].getText() == \"X\") && (buttons[row+2][col].getText() == \"X\") && (buttons[row+3][col].getText() == \"X\")) {\n return 1;\n }\n\n //Diagonal Top left to bottom right checker\n if((buttons[row][col].getText() == \"O\") && (buttons[row+1][col+1].getText() == \"O\") && (buttons[row+2][col+2].getText() == \"O\") && (buttons[row+3][col+3].getText() == \"O\")) {\n return 0;\n }\n if((buttons[row][col].getText() == \"X\") && (buttons[row+1][col+1].getText() == \"X\") && (buttons[row+2][col+2].getText() == \"X\") && (buttons[row+3][col+3].getText() == \"X\")) {\n return 1;\n }\n\n //Diagonal Bottom left to top right checker\n if((buttons[row][col].getText() == \"O\") && (buttons[row-1][col+1].getText() == \"O\") && (buttons[row-2][col+2].getText() == \"O\") && (buttons[row-3][col+3].getText() == \"O\")) {\n return 0;\n }\n if((buttons[row][col].getText() == \"X\") && (buttons[row-1][col+1].getText() == \"X\") && (buttons[row-2][col+2].getText() == \"X\") && (buttons[row-3][col+3].getText() == \"X\")) {\n return 1;\n }\n }\n }\n return 2;\n }", "public int checkWinner(int player, int row, int col) {\n // Just check for extra 3 count since current board[row][col] is already counted as 1.\n \n // check horizontal\n int count = getConnectedCount(player, row, -1, col, 0) // left\n + getConnectedCount(player, row, 1, col, 0); // right\n if (count == 3) return player;\n\n // check vertical\n count = getConnectedCount(player, row, 0, col, -1) // up\n + getConnectedCount(player, row, 0, col, 1); // down\n if (count == 3) return player;\n\n // check top left to bottom right\n count = getConnectedCount(player, row, -1, col, -1) // top left\n + getConnectedCount(player, row, 1, col, 1); // bottom right\n if (count == 3) return player;\n\n // check top right to bottom left\n count = getConnectedCount(player, row, -1, col, 1) // top right\n + getConnectedCount(player, row, 1, col, -1); // bottom left\n if (count == 3) return player;\n\n return -1;\n }", "public boolean win() {\r\n\t\tfor (int n = 0; n < 3; n++) {\r\n\t\t\tfor (int m = 0; m < 7; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n + 1][m] == board[n][m] && board[n + 2][m] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n + 3][m] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 1][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 2][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 3][m].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 0; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n][m + 1] == board[n][m] && board[n][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n][m + 3].setText(\"X\");\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 0; n < 3; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n + 1][m + 1] == board[n][m] && board[n + 2][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n + 3][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 1][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 2][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n + 3][m + 3].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (int n = 3; n < 6; n++) {\r\n\t\t\tfor (int m = 0; m < 4; m++) {\r\n\t\t\t\tif (board[n][m] != 'X') {\r\n\t\t\t\t\tif (board[n - 1][m + 1] == board[n][m] && board[n - 2][m + 2] == board[n][m]\r\n\t\t\t\t\t\t\t&& board[n - 3][m + 3] == board[n][m]) {\r\n\t\t\t\t\t\tsquares[n][m].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 1][m + 1].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 2][m + 2].setText(\"X\");\r\n\t\t\t\t\t\tsquares[n - 3][m + 3].setText(\"X\");\r\n\r\n\t\t\t\t\t\twinnerChip = board[n][m];\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\r\n\t}", "boolean diagonalWin(){\n\t\tint match_counter=0;\n\t\tboolean flag=false;\n\t\tfor(int row=8; row>=3;row--){\n\t\t\tfor(int column=0;column<25;column++){\n\t\t\t\tif(Board[row][column]!='\\u0000'){\n\t\t\t\t\tif(Board[row][column]!='O'){\n\t\t\t\t\t\tif(Board[row][column]==Board[row-1][column+1]&& \n\t\t\t\t\t\t Board[row-1][column+1]== Board[row-2][column+2]&&\n\t\t\t\t\t\t Board[row-2][column+2]==Board[row-3][column+3]){\n\t\t\t\t\t\t\tflag=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflag=false;\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tif (flag == true)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn flag;\t\n\t}", "public int checkChasingPlayer()\n {\n if(stunCountdown > 0)\n {\n chasingPlayer = false;\n return stunCountdown;\n }\n if(Game.getInstance().getPlayer().getCurrentRoom().isControlRoom())\n {\n chasingPlayer = false;\n return(-1);\n }\n else\n {\n List<Exit> neighbors = getCurrentRoom().getCollectionOfExits();\n for(Exit neighbor : neighbors)\n {\n if(getCurrentRoom().getExit(neighbor).equals(Game.getInstance().getPlayer().getCurrentRoom()) && neighbor.isOperating())\n {\n chasingPlayer = true;\n return(5 + (int) Math.floor(Math.random() * 6));\n }\n }\n chasingPlayer = false;\n return(-1);\n }\n }", "public int winner(){\n getValidMoves();\n if(check(1)!=0) return 1;\n else if(check(-1)!=0) return -1;\n else if(validX.size()==0) return 2;\n else return 0;\n }", "private Boolean canWinInColumn(PentagoBoard b, int column, Color who) {\n\t\tint amount=0;\n \tfor(int i=0; i<b.getSize(); i++) {\n\t\t\tif(b.getState(column,i) == Color.EMPTY || b.getState(column,i) == who) {\n\t\t\t\tamount++;\n\t\t\t}\n\t\t\telse\n\t\t\t\tamount=0;\n \t}\n \tif(amount>4)\n \t\treturn true;\n \telse\n \t\treturn false;\n }", "public char checkWinner() {\r\n // Vertical\r\n if (board[0][0] == board[0][1] && board[0][1] == board[0][2] && board[0][0] != '-') {\r\n return board[0][0];\r\n }\r\n else if (board[1][0] == board[1][1] && board[1][1] == board[1][2] && board[1][0] != '-') {\r\n return board[1][0];\r\n }\r\n else if (board[2][0] == board[2][1] && board[2][1] == board[2][2] && board[2][0] != '-') {\r\n return board[2][0];\r\n }\r\n // Horizontal\r\n else if (board[0][0] == board[1][0] && board[1][0] == board[2][0] && board[0][0] != '-') {\r\n return board[0][0];\r\n }\r\n else if (board[0][1] == board[1][1] && board[1][1] == board[2][1] && board[0][1] != '-') {\r\n return board[0][1];\r\n }\r\n else if (board[0][2] == board[1][2] && board[1][2] == board[2][2] && board[0][2] != '-') {\r\n return board[0][2];\r\n }\r\n // Diagonal\r\n else if (board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != '-') {\r\n return board[0][0];\r\n }\r\n else if (board[0][2] == board[1][1] && board[1][1] == board[2][0] && board[0][2] != '-') {\r\n return board[0][2];\r\n }\r\n // Tie\r\n else {\r\n for (int y = 0; y < 3; y++) {\r\n for (int x = 0; x < 3; x++) {\r\n if (board[x][y] == '-')\r\n return 'N';\r\n }\r\n }\r\n return 'T';\r\n }\r\n }", "public int dropPiece(int column_dropped)\n {\n int row_landed = -1;\n if (column_dropped >= 0 && column_dropped <= 6)\n {\n for (int row = 0; row <= 5; row++)\n {\n if (current_board[column_dropped][row] == 0)\n {\n current_board[column_dropped][row] = player_turn;\n total_moves++;\n row_landed = row;\n break;\n }\n }\n }\n return row_landed;\n }", "private WinScenario getWinningScenario() {\n Diagonal primaryDiagonal = new Diagonal(this, true);\n if (primaryDiagonal.isWon()) {\n return primaryDiagonal;\n }\n\n // Check for secondary diagonal\n Diagonal secondaryDiagonal = new Diagonal(this, false);\n if (secondaryDiagonal.isWon()) {\n return secondaryDiagonal;\n }\n\n // Check for a winning row or colum\n for (int i = 0; i < 3; i++) {\n Row row = new Row(this, i);\n if (row.isWon()) {\n return row;\n }\n\n Column column = new Column(this, i);\n if (column.isWon()) {\n return column;\n }\n }\n\n return null;\n }", "private boolean checkWinner() {\n\t\tboolean frontDiagWin = !myBoard.isEmpty(0, 0);\n\t\tchar frontDiagToken = myBoard.getCell(0, 0);\n\t\tboolean backDiagWin = !myBoard.isEmpty(0, Board.BOARD_SIZE - 1);\n\t\tchar backDiagToken = myBoard.getCell(0, Board.BOARD_SIZE - 1);\n\t\tfor (int i = 0; i < Board.BOARD_SIZE; i++) {\n\t\t\t// check Diagonals\n\t\t\tfrontDiagWin = myBoard.getCell(i, i) == frontDiagToken ? frontDiagWin\n\t\t\t\t\t: false;\n\t\t\tbackDiagWin = myBoard.getCell(i, (Board.BOARD_SIZE - 1) - i) == backDiagToken ? backDiagWin\n\t\t\t\t\t: false;\n\t\t\t// check Rows and Columns\n\t\t\tboolean rowWin = !myBoard.isEmpty(i, 0);\n\t\t\tchar startRowToken = myBoard.getCell(i, 0);\n\t\t\tboolean colWin = !myBoard.isEmpty(0, i);\n\t\t\tchar startColToken = myBoard.getCell(0, i);\n\t\t\tfor (int j = 0; j < Board.BOARD_SIZE; j++) {\n\t\t\t\trowWin = myBoard.getCell(i, j) == startRowToken ? rowWin\n\t\t\t\t\t\t: false;\n\t\t\t\tcolWin = myBoard.getCell(j, i) == startColToken ? colWin\n\t\t\t\t\t\t: false;\n\t\t\t}\n\t\t\tif (rowWin || colWin) {\n\t\t\t\tSystem.out.println(\"\\\"\"\n\t\t\t\t\t\t+ (rowWin ? startRowToken : startColToken)\n\t\t\t\t\t\t+ \"\\\" wins the game!\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tif (frontDiagWin || backDiagWin) {\n\t\t\tSystem.out.println(\"\\\"\"\n\t\t\t\t\t+ (frontDiagWin ? frontDiagToken : backDiagToken)\n\t\t\t\t\t+ \"\\\" wins the game!\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean checkPlayerOneWin()\n {\n boolean playerOneWin = false;\n \n if( board[0][0] == \"X\" && board[0][1] == \"X\" && board[0][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[1][0] == \"X\" && board[1][1] == \"X\" && board[1][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[2][0] == \"X\" && board[2][1] == \"X\" && board[2][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][0] == \"X\" && board[1][0] == \"X\" && board[2][0] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][1] == \"X\" && board[1][1] == \"X\" && board[2][1] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[2][0] == \"X\" && board[2][1] == \"X\" && board[2][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][0] == \"X\" && board[1][1] == \"X\" && board[2][2] == \"X\" )\n {\n playerOneWin = true;\n }\n else if( board[0][2] == \"X\" && board[1][1] == \"X\" && board[2][0] == \"X\" )\n {\n playerOneWin = true;\n }\n \n return playerOneWin;\n }", "private int checkRow() {\n for (int i = 0; i < 3; i++) {\n if ((this.board[0][i] == this.board[1][i]) && (this.board[0][i] == this.board[2][i])) {\n return this.board[0][i];\n }\n }\n return 0;\n }", "public int terminalTest(int[][] gameBoard) {\n for (int col = 0; col < gameBoard.length; col++) {\n for (int row = 0; row < gameBoard[col].length - 3; row++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col][row + 1] == 1 &&\n gameBoard[col][row + 2] == 1 &&\n gameBoard[col][row + 3] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col][row + 1] == 2 &&\n gameBoard[col][row + 2] == 2 &&\n gameBoard[col][row + 3] == 2) {\n return 2;\n }\n }\n }\n\n // check for horizontal win (searching to the right)\n for (int row = 0; row < gameBoard[0].length; row++) {\n for (int col = 0; col < gameBoard.length - 3; col++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col + 1][row] == 1 &&\n gameBoard[col + 2][row] == 1 &&\n gameBoard[col + 3][row] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col + 1][row] == 2 &&\n gameBoard[col + 2][row] == 2 &&\n gameBoard[col + 3][row] == 2) {\n return 2;\n }\n }\n }\n\n // check for diagonal win (searching down + right)\n for (int col = 0; col < gameBoard.length - 3; col++) {\n for (int row = 0; row < gameBoard[col].length - 3; row++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col + 1][row + 1] == 1 &&\n gameBoard[col + 2][row + 2] == 1 &&\n gameBoard[col + 3][row + 3] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col + 1][row + 1] == 2 &&\n gameBoard[col + 2][row + 2] == 2 &&\n gameBoard[col + 3][row + 3] == 2) {\n return 2;\n }\n }\n }\n\n // check for diagonal win (searching down + left)\n for (int col = gameBoard.length - 1; col >= 3; col--) {\n for (int row = 0; row < gameBoard[col].length - 3; row++) {\n if (gameBoard[col][row] == 1 &&\n gameBoard[col - 1][row + 1] == 1 &&\n gameBoard[col - 2][row + 2] == 1 &&\n gameBoard[col - 3][row + 3] == 1) {\n return 1;\n } else if (gameBoard[col][row] == 2 &&\n gameBoard[col - 1][row + 1] == 2 &&\n gameBoard[col - 2][row + 2] == 2 &&\n gameBoard[col - 3][row + 3] == 2) {\n return 2;\n }\n }\n }\n\n return 0; // neither player has won\n }", "public GameState won() {\n if ( (board[0][0] != TileState.BLANK) && (board[0][0] == board[0][1]) && (board[0][0] == board[0][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[1][0] != TileState.BLANK) && (board[1][0] == board[1][1]) && (board[1][0] == board[1][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[2][0] != TileState.BLANK) && (board[2][0] == board[2][1]) && (board[2][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][1]) && (board[0][0] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ( (board[0][2] != TileState.BLANK) && (board[0][2] == board[1][1]) && (board[0][2] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][0] != TileState.BLANK) && (board[0][0] == board[1][0]) && (board[0][0] == board[2][0])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][1] != TileState.BLANK) && (board[0][1] == board[1][1]) && (board[0][1] == board[2][1])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if ((board[0][2] != TileState.BLANK) && (board[0][2] == board[1][2]) && (board[0][2] == board[2][2])) {\n if (playerOneTurn)\n return GameState.PLAYER_TWO;\n else\n return GameState.PLAYER_ONE;\n } else if (movesPlayed == 9)\n return GameState.DRAW;\n return GameState.IN_PROGRESS;\n }", "public int getComMove() {\n\n int move;\n\n // Checks if a computer played a move in that spot\n for (int i = 0; i < getBoardSize(); i++) {\n if (playBoard[i] != REAL_PLAYER && playBoard[i] != COM_PLAYER) {\n char currPlace = playBoard[i];\n playBoard[i] = COM_PLAYER;\n\n if (winCheck() == 3) {\n setMove(COM_PLAYER, i);\n return i;\n }\n else {\n playBoard[i] = currPlace;\n }\n }\n }\n\n // Check to block human player from winning\n for (int i = 0; i < getBoardSize(); i++) {\n if (playBoard[i] != REAL_PLAYER && playBoard[i] != COM_PLAYER) {\n char currPlace = playBoard[i];\n playBoard[i] = REAL_PLAYER;\n\n if (winCheck() == 2) {\n setMove(COM_PLAYER, i);\n return i;\n }\n else {\n playBoard[i] = currPlace;\n }\n }\n }\n\n // If play spot is empty, then make move\n do {\n move = randMove.nextInt(getBoardSize());\n } while (playBoard[move] == REAL_PLAYER || playBoard[move] == COM_PLAYER);\n setMove(COM_PLAYER, move);\n\n return move;\n }", "public int getCorners() {\n //top-left corner case\n if (board[0][1] != null && board[1][0] != null&& board[0][0]!= null) {\n if (board[0][1].getPlayerNumber() == board[1][0].getPlayerNumber()\n && board[0][1].getPlayerNumber() != board[0][0].getPlayerNumber())\n return board[0][1].getPlayerNumber();\n }\n\n //top-right corner case\n if (board[0][board.length - 2] != null && board[1][board.length - 1] != null) {\n if (board[0][board.length - 2].getPlayerNumber() == board[1][board.length - 1].getPlayerNumber()\n && board[1][board.length - 1].getPlayerNumber() != board[0][board.length - 1].getPlayerNumber())\n return board[0][board.length - 2].getPlayerNumber();\n }\n\n //bottom-left corner case\n if (board[board.length - 2][0] != null && board[board.length - 1][1] != null) {\n if (board[board.length - 2][0].getPlayerNumber() == board[board.length - 1][1].getPlayerNumber()\n && board[board.length - 1][1].getPlayerNumber() != board[board.length - 1][0].getPlayerNumber())\n return board[board.length - 1][1].getPlayerNumber();\n }\n\n //bottom-right corner case\n if (board[board.length - 1][board.length - 2] != null && board[board.length - 2][board.length - 1] != null) {\n if (board[board.length - 1][board.length - 2].getPlayerNumber() == board[board.length - 2][board.length - 1].getPlayerNumber()\n && board[board.length - 2][board.length - 1].getPlayerNumber() != board[board.length - 1][board.length - 1].getPlayerNumber())\n return board[board.length - 1][board.length - 2].getPlayerNumber();\n }\n return -1;\n }", "public boolean isWinner() {\n\t\t//initialize row, column, and depth\n\t\tint row = 0;\n\t\tint col = 0;\n\t\tint dep = 0;\n\t\t\n\t\t//Checks for a vertical four in a row\n\t\t//row is restriced from the full size to >=3 to avoid\n\t\t//an out of bounds exception\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = 0; col < size; col ++)\n\t\t\t\tfor(dep = 0; dep < size; dep ++) {\n\t\t\t\t\t//a variable check is made to save lines\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\t//checks if the value is a player, and it\n\t\t\t\t\t//qualifies as a vertical win. If it does,\n\t\t\t\t\t//the for loop returns true.\n\t\t\t\t\tif (check != -1\n\t\t\t\t\t\t && check == board[row - 1][col][dep] &&\n\t\t\t\t\t\t\tcheck == board[row - 2][col][dep] &&\n\t\t\t\t\t\t\tcheck == board[row - 3][col][dep] )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t//check for horizontal four in a row\n\t\t//col is restriced and increasing (+)\n\t\tfor (dep = 0; dep < size; dep ++)\n\t\t\tfor(row = size - 1; row >= 0; row --)\n\t\t\t\tfor(col = 0; col < size - 3; col ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row][col + 1][dep]\n\t\t\t\t\t\t\t&& check == board[row][col + 2][dep] \n\t\t\t\t\t\t\t&& check == board[row][col + 3][dep])\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\t\t//check for x,y upDiagnol four in a row on each depth\n\t\t//row is restricted and decreasing (-)\n\t\t//col is restricted and increasing (+)\n\t\tfor (dep = 0; dep < size; dep ++)\n\t\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\t\tfor(col = 0; col < size - 3; col ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row - 1][col + 1][dep]\n\t\t\t\t\t\t\t&& check == board[row - 2][col + 2][dep]\n\t\t\t\t\t\t\t&& check == board[row - 3][col + 3][dep])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y downDiagnol four in a row on each depth\n\t\t//row is restricted and increasing (+)\n\t\t//col is restricted and increasing (+)\n\t\tfor (dep = 0; dep < size; dep ++)\n\t\t\tfor(row = 0; row < size - 3; row ++)\n\t\t\t\tfor(col = 0; col < size - 3; col ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row + 1][col + 1][dep]\n\t\t\t\t\t\t\t&& check == board[row + 2][col + 2][dep]\n\t\t\t\t\t\t\t&& check == board[row + 3][col + 3][dep])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,z horizontal four in a row on each column\n\t\t//dep is restricted and increasing (+)\n\t\tfor(col = 0; col < size; col ++)\n\t\t\tfor(row = size - 1; row >= 0; row --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row][col][dep + 1]\n\t\t\t\t\t\t\t&& check == board[row][col][dep + 2]\n\t\t\t\t\t\t\t&& check == board[row][col][dep + 3])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,z upDiagnol four in a row on ecah column\n\t\t//row is restricted and decreasing (-)\n\t\t//dep is restricted and increasing (+)\n\t\tfor(col = 0; col < size; col ++)\n\t\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row - 1][col][dep + 1]\n\t\t\t\t\t\t\t&& check == board[row - 2][col][dep + 2]\n\t\t\t\t\t\t\t&& check == board[row - 3][col][dep + 3])\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,z downDiagnol four in a row\n\t\t// dep +, row +\n\t\tfor(col = 0; col < size; col ++)\n\t\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t\t&& check == board[row + 1][col][dep + 1]\n\t\t\t\t\t\t\t&& check == board[row + 2][col][dep + 2]\n\t\t\t\t\t\t\t&& check == board[row + 3][col][dep + 3])\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the top right\n\t\t//row -, col +, dep +\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col + 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row - 2][col + 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row - 3][col + 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the top left\n\t\t//row -, col -, dep +\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col - 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row - 2][col - 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row - 3][col - 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the down left\n\t\t//row -, col -, dep -\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col - 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row - 2][col - 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row - 3][col - 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for x,y,z up diagnol to the down right\n\t\t//row -, col +, dep -\n\t\tfor(row = size - 1; row >= 3; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row - 1][col + 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row - 2][col + 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row - 3][col + 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//Same as above, but now row increases rather than decreasing\n\t\t//check for down diagnol from top left to center\n\t\t//row +, col +, dep +\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1\n\t\t\t\t\t\t&& check == board[row + 1][col + 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row + 2][col + 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row + 3][col + 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for down diagnol from top right to center\n\t\t//row + , col -, dep +\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row + 1][col - 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row + 2][col - 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row + 3][col - 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for down diagnol from bottom left to center\n\t\t//row +, col -, dep -\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = size -1; col >= 3; col --)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row + 1][col - 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row + 2][col - 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row + 3][col - 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//check for down diagnol from bottom right to center\n\t\t//row +, col +, dep -\n\t\tfor(row = 0; row > size - 3; row ++)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row + 1][col + 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row + 2][col + 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row + 3][col + 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t//check for diagonals where row stays the same, but x,z change\n\t\t//depth up diagnol, col +, dep +\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col + 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row][col + 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row][col + 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t//depth down diagnol, col +, dep -\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = 0; col < size - 3; col ++)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col + 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row][col + 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row][col + 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t// depth down left diagnol, col -, dep +\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = size - 1; col >= 3; col --)\n\t\t\t\tfor(dep = 0; dep < size - 3; dep ++) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col - 1][dep + 1]\n\t\t\t\t\t\t&& check == board[row][col - 2][dep + 2]\n\t\t\t\t\t\t&& check == board[row][col - 3][dep + 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\n\t\t//depth down right diagnol, col -, dep -\n\t\tfor(row = size - 1; row >= 0 ; row --)\n\t\t\tfor(col = size - 1; col >= 3; col --)\n\t\t\t\tfor(dep = size - 1; dep >= 3; dep --) {\n\t\t\t\t\tint check = board[row][col][dep];\n\t\t\t\t\tif(check != -1 \n\t\t\t\t\t\t&& check == board[row][col - 1][dep - 1]\n\t\t\t\t\t\t&& check == board[row][col - 2][dep - 2]\n\t\t\t\t\t\t&& check == board[row][col - 3][dep - 3])\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t//returns false if none of the above return true\n\t\treturn false;\n\t}", "public static boolean diagonalJudge(String playerMarker, int row, int column){\n\n boolean victoryFlag = false;\n\n int subRow = 0;\n int subColumn = 0;\n int victoryCounter = 0;\n\n // Checking first Diagonal\n // North West\n\n subRow = row;\n subColumn = column;\n\n // Store the player's latest move's coordinates\n\n winList.add(subColumn);\n winList.add(subColumn);\n\n while ( subRow >= 0 && subColumn >= 0 && !victoryFlag ){\n\n subRow--;\n subColumn--;\n\n if ( subRow >= 0 && subColumn >= 0 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n // South East\n\n subRow = row;\n subColumn = column;\n\n while ( subRow < 6 && subColumn < 7 && !victoryFlag ){\n\n subRow++;\n subColumn++;\n\n if ( subRow < 6 && subColumn < 7 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n if ( !victoryFlag ){\n winList.clear(); // reset the list, if no one won\n }\n else{\n winDirection = \"Left Diagonal\";\n }\n\n // Checking the other diagonal\n // North East\n\n victoryCounter = 0;\n subRow = row;\n subColumn = column;\n winList.add(subRow);\n winList.add(subColumn);\n\n while ( subRow >= 0 && subColumn < 7 && !victoryFlag ){\n\n subRow--;\n subColumn++;\n\n if ( subRow >= 0 && subColumn < 7 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n winDirection = \"Right Diagonal\";\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n // South East\n\n subRow = row;\n subColumn = column;\n\n while ( subRow < 6 && subColumn >= 0 && !victoryFlag ){\n\n subRow++;\n subColumn--;\n\n if ( subRow <= 5 && subColumn >= 0 ){\n\n if ( gameBoard[subRow][subColumn].equals(playerMarker) ){\n winList.add(subRow);\n winList.add(subColumn);\n victoryCounter++;\n\n if ( victoryCounter == 3){\n winDirection = \"Right Diagonal\";\n victoryFlag = true;\n }\n }\n\n else{\n break;\n }\n }\n }\n\n if ( !victoryFlag ){\n winList.clear();\n }\n\n return victoryFlag;\n }", "public int getWinner() {\n //checks corner cells\n if (getCorners() != -1)\n return getCorners();\n\n //checks border cells\n if (getBorders() != -1)\n return getBorders();\n\n //check middle cases\n if (getMiddle() != -1)\n return getMiddle();\n\n return -1;\n }", "private boolean checkRowColWin(char symbol) {\n boolean cols, rows;\n\n for (int col = 0; col < SIZE; col++) {\n cols = true;\n rows = true;\n\n for (int row = 0; row < SIZE; row++) {\n cols &= (gameField[col][row] == symbol);\n rows &= (gameField[row][col] == symbol);\n }\n if (cols || rows) {\n return true;\n }\n }\n return false;\n }", "public static int checkForWinner(ArrayList<Integer> brd) {\n int Slot1 = brd.get(0); // get is a method of ArrayList\n int Slot2 = brd.get(1);\n int Slot3 = brd.get(2);\n int Slot4 = brd.get(3);\n int Slot5 = brd.get(4);\n int Slot6 = brd.get(5);\n int Slot7 = brd.get(6);\n int Slot8 = brd.get(7);\n int Slot9 = brd.get(8);\n\n // row check\n if (Slot1 == Slot2 && Slot1 == Slot3) {\n return Slot1; // return the player who won\n }\n if (Slot4 == Slot5 && Slot4 == Slot6) {\n return Slot4; // return the player who won\n }\n if (Slot7 == Slot8 && Slot7 == Slot9) {\n return Slot7; // return the player who won\n }\n // column check\n if (Slot1 == Slot4 && Slot1 == Slot7) {\n return Slot1; // return the player who won\n }\n if (Slot2 == Slot5 && Slot2 == Slot8) {\n return Slot2; // return the player who won\n }\n if (Slot3 == Slot6 && Slot3 == Slot9) {\n return Slot3; // return the player who won\n }\n\n // cross check\n if (Slot1 == Slot5 && Slot1 == Slot9) {\n return Slot1; // return the player who won\n }\n if (Slot3 == Slot5 && Slot3 == Slot7) {\n return Slot3; // return the player who won\n }\n\n // check for tie\n for (int i = 0; i < brd.size(); i++) {\n if (brd.get(i) == 0) {\n return 0; // game isnt over yet\n }\n }\n return 3; // tie\n }", "public boolean checkForWinner(String player) {\r\n\t\t\r\n\t\t// check rows\r\n\t\tfor (int row = 0; row < board.length; row++) {\r\n\t\t\tint markCounter = 0;\r\n\t\t\tfor (int col = 0; col < board[row].length; col++) {\r\n\t\t\t\tif (board[row][col].getText().contains(player)) {\r\n\t\t\t\t\tmarkCounter++;\r\n\t\t\t\t}\r\n\t\t\t\telse if(! (board[row][col].getText().contains(player)) ) {\r\n\t\t\t\t\tmarkCounter = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (markCounter == connectX) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t// check columns\r\n\t\tfor (int col = 0; col < 7; col++) {\r\n\t\t\tint markCounter = 0;\r\n\t\t\tfor (int row = board.length - 1; row >= 0; row--) {\r\n\t\t\t\tif(board[row][col].getText().contains(player)) {\r\n\t\t\t\t\tmarkCounter++;\r\n\t\t\t\t}\r\n\t\t\t\telse if(! (board[row][col].getText().contains(player)) ) {\r\n\t\t\t\t\tmarkCounter = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (markCounter == connectX) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * This algorithm checks the right side of the second diagonal on the board. The while loop iterates four times from bottom \r\n\t\t * to top, right to left. \r\n\t\t * The reason it only iterates four times is because after a certain point, it is impossible for a player to connect four\r\n\t\t * so the code does'nt have to check the corners.\r\n\t\t * \t\tO X X X O O O\r\n\t\t * \t\tO O X X X O O\r\n\t\t * \t\tO O O X X X O\r\n\t\t *\t\tO O O O X X X\r\n\t\t * \t\tO O O O O X X\r\n\t\t * \t\tO O O O O O X\r\n\t\t * \r\n\t\t */\r\n\t\tint diag2Count = 0;\r\n\t\tint row = board.length - 1;\r\n\t\tint col = 6;\r\n\t\tint iteration = 0;\r\n\t\tint rowPlace = row;\r\n\t\twhile (iteration < 4) {\r\n\t\t\trow = rowPlace;\r\n\t\t\tcol = 6;\r\n\t\t\twhile (row >= 0 && col >= 1) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiag2Count++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiag2Count = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diag2Count == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol--;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\trowPlace--;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Checks the left hand side of the secondary diagonal. Iterates only 3 times.\r\n\t\t * of the board.\r\n\t\t * \t\t\tX O O O O O O\r\n\t\t * \t\t\tX X O O O O O\r\n\t\t * \t\t\tX X X O O O O\r\n\t\t * \t\t\tO X X X O O O\r\n\t\t * \t\t\tO O X X X O O\r\n\t\t * \t\t\tO O O X X X O\r\n\t\t */\r\n\t\trow = board.length - 1;\r\n\t\tcol = 3;\r\n\t\titeration = 0;\r\n\t\tint colPlace = col;\r\n\t\twhile (iteration < 4) {\r\n\t\t\tcol = colPlace;\r\n\t\t\trow = board.length -1;\r\n\t\t\twhile (row >= 0 && col >= 0) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiag2Count++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiag2Count = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diag2Count == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol--;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\tcolPlace++;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Checks the left hand main Diagonals and iterates 3 times.\r\n\t\t * \t\t\tO O O X X X O\r\n\t\t * \t\t\tO O X X X O O\r\n\t\t * \t\t\tO X X X O O O \r\n\t\t * \t\t\tX X X O O O O\r\n\t\t * \t\t\tX X O O O O O\r\n\t\t * \t\t\tX O O O O O O\r\n\t\t * \r\n\t\t */\r\n\t\trow = 3;\r\n\t\tcol = 0;\r\n\t\trowPlace = row;\r\n\t\titeration = 0;\r\n\t\tint diagMainCounter = 0;\r\n\t\twhile (iteration < 3) {\r\n\t\t\trow = rowPlace;\r\n\t\t\tcol = 0;\r\n\t\t\twhile (row >= 0 && col <= 6) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiagMainCounter++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiagMainCounter = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diagMainCounter == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol++;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\trowPlace++;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Checks the right hand side of the main diagonal and iterates 4 times.\r\n\t\t * \r\n\t\t *\t\t\tO O O O O O X\r\n\t\t *\t\t\tO O O O O X X\r\n\t\t *\t\t\tO O O O X X X\r\n\t\t *\t\t\tO O O X X X O\r\n\t\t *\t\t\tO O X X X O O\r\n\t\t *\t\t\tO X X X O O O\r\n\t\t */\r\n\t\trow = board.length -1;\r\n\t\tcol = 0;\r\n\t\tcolPlace = col;\r\n\t\titeration = 0;\r\n\t\tdiagMainCounter = 0;\r\n\t\twhile (iteration < 4) {\r\n\t\t\tcol = colPlace;\r\n\t\t\trow = board.length -1;\r\n\t\t\twhile (row >= 0 && col <= 6) {\r\n\t\t\t\tif (board[row][col].getText().contains(currPlayer)) {\r\n\t\t\t\t\tdiagMainCounter++;\r\n\t\t\t\t}\r\n\t\t\t\tif (!(board[row][col].getText().contains(player))) {\r\n\t\t\t\t\tdiagMainCounter = 0; //If there is a chip which does not belong to a player in the sequence, the counter is reset.\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (diagMainCounter == connectX) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trow--;\r\n\t\t\t\tcol++;\r\n\t\t\t}\r\n\t\t\titeration++;\r\n\t\t\tcolPlace++;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public static int checkForWin(BitSet state, BitSet theirBoard) {\n \n BitSet[] myWins = Shifts.doShifts(state, 5, true);\n BitSet[] theirWins = Shifts.doShifts(theirBoard, 5, true);\n\n\n boolean iWon = !myWins[0].isEmpty() || !myWins[1].isEmpty() || !myWins[2].isEmpty() || !myWins[3].isEmpty();\n boolean theyWon = !theirWins[0].isEmpty() || !theirWins[1].isEmpty() || !theirWins[2].isEmpty() || !theirWins[3].isEmpty();\n \n if (iWon && theyWon) {\n //draw, we both have a win\n return 0;\n }\n else if (iWon) {\n return 3000; \n }\n else if (theyWon){\n return -3000;\n }\n else {\n return 13;\n }\n }", "public static boolean checkWin(int[][] board) {\n boolean win = true;\n\n //loops through rows\n for (int i = 0; i < board.length; i++) {\n int checkrow[] = new int[9];\n int checkcol[] = new int[9];\n\n //loops through columns and stores the numbers in that row and in that column\n for (int j = 0; j < board.length; j++) {\n checkrow[j] = board[i][j];\n checkcol[j] = board[j][i];\n }\n\n Arrays.sort(checkrow);//sorts the numbers\n Arrays.sort(checkcol);\n\n //checks the sorted numbers to see if there is a winnner by checking the values of the\n //sorted array. first number in the array with 1, second with 2, third with 3 etc...\n // if the numbers dont match at any point then there was not a winner and the program returns\n //false.\n for (int x = 1; x < board.length; x++) {\n if (checkrow[x] != x + 1 || checkcol[x] != x + 1) {\n win = false;\n return win;\n }\n }\n }\n\n return win;\n }", "public int getIntelligentMove(int[] availableMoves, int[] board){\n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = 1;\n int result = checkWinner(tempBoard);\n if (result == 1){\n return move;\n }\n \n }\n \n // Check if user can win, if so then block\n \n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = -1;\n int result = checkWinner(tempBoard);\n if (result == 2){\n return move;\n }\n \n }\n \n // If middle is available, take it\n for (int move: availableMoves){\n if (move == 4){\n return move;\n }\n }\n \n // Move into a corner in a row/col that the user is in\n int cornerMove = checkCorners(board, availableMoves);\n if (cornerMove >= 0){\n \n }\n \n // Otherwise, take random move\n Random rand = new Random();\n int possibleMoves = availableMoves.length;\n int moveIndex = rand.nextInt(possibleMoves);\n \n return availableMoves[moveIndex];\n \n \n }", "public int winner() {\n if(humanPlayerHits == 17) {\n return 1;\n }\n if(computerPlayerHits == 17){\n return 2;\n }\n return 0;\n }", "public boolean winCheck(){\n for(int i=0; i<3; i++){//goes through rows\n for(int j=0; j<4; j++){//goes through columns\n if(board[i][j+3] != 0 && board[i+1][j+2] != 0 && board[i+2][j+1] != 0 && \n board[i+3][j] != 0)\n if(board[i][j+3]==(board[i+1][j+2]))\n if(board[i][j+3]==(board[i+2][j+1]))\n if(board[i][j+3]==(board[i+3][j])){\n GBoard[i][j+3].setIcon(star);\n GBoard[i+1][j+2].setIcon(star);\n GBoard[i+2][j+1].setIcon(star);\n GBoard[i+3][j].setIcon(star);\n wonYet=true;\n return true;\n }\n }\n }\n //checks for subdiagonals\n for(int i=0; i<3; i++){//goes through rows\n for(int j=0; j<4; j++){//goes through columns\n if(board[i][j] != 0 && board[i+1][j+1] != 0 && board[i+2][j+2] != 0 &&\n board[i+3][j+3] != 0)\n if(board[i][j] == (board[i+1][j+1]))\n if(board[i][j] == (board[i+2][j+2]))\n if(board[i][j] == (board[i+3][j+3])){\n GBoard[i][j].setIcon(star);\n GBoard[i+1][j+1].setIcon(star);\n GBoard[i+2][j+2].setIcon(star);\n GBoard[i+3][j+3].setIcon(star);\n wonYet=true;\n return true;\n } \n }\n }\n //check horizontals\n for(int i=0; i<6; i++){//goes through rows\n for(int j=0; j<4; j++){//goes through columns\n if(board[i][j] != 0 && board[i][j+1] != 0 && board[i][j+2] != 0 && \n board[i][j+3] != 0){\n if(board[i][j]==(board[i][j+1]))\n if(board[i][j]==(board[i][j+2]))\n if(board[i][j]==(board[i][j+3])){\n GBoard[i][j].setIcon(star);\n GBoard[i][j+1].setIcon(star);\n GBoard[i][j+2].setIcon(star);\n GBoard[i][j+3].setIcon(star);\n wonYet=true;\n return true;\n }\n }\n }\n }\n //checks for vertical wins\n for(int i=0; i<3; i++){//checks rows\n for(int j=0; j<7; j++){//checks columns\n if(board[i][j] != 0 && board[i+1][j] != 0 && board[i+2][j] != 0 && \n board[i+3][j] != 0){\n if(board[i][j]==(board[i+1][j]))\n if(board[i][j]==(board[i+2][j]))\n if(board[i][j]==(board[i+3][j])){\n GBoard[i][j].setIcon(star);\n GBoard[i+1][j].setIcon(star);\n GBoard[i+2][j].setIcon(star);\n GBoard[i+3][j].setIcon(star);\n wonYet=true;\n return true;\n }\n }\n }\n }\n return false; \n }", "public static int whoseTurn(int[][] board){\n int[] oneBoard = twoToOne(board);\n int countOne =0;\n int countTwo =0;\n for(int i=0; i<ROW*COLUMN; i++){\n if(oneBoard[i]==1){\n countOne++;\n }\n else if(oneBoard[i]==2){\n countTwo++;\n }\n }\n if(countOne>countTwo)\n return 2;\n else if(countOne<countTwo)\n return 1;\n else\n //neutral board, hardcode player=computer\n return 1;\n \n }", "public int winningPlayerIndex(int[][] board, Move lastMove) {\n int m = board.length;\n int n = board[0].length;\n\n\n int player = lastMove.playerIndex;\n int curRow = lastMove.row;\n int curCol = lastMove.col;\n\n\n int start = Math.max(0, curCol - 3);\n for (int i = start; i + 3 < n; i++) {\n if (board[curRow][i] == player && board[curRow][i + 1] == player\n && board[curRow][i + 2] == player && board[curRow][i + 3] == player) {\n return player;\n }\n }\n\n int startRow = Math.max(0, curRow - 3);\n for (int i = start; i + 3 < m; i++) {\n if (board[i][curCol] == player && board[i + 1][curCol] == player\n && board[i + 2][curCol] == player && board[i + 3][curCol] == player) {\n return player;\n }\n }\n\n int count = 0;\n int x = curRow;\n int y = curCol;\n while (x >= 0 && y >= 0) {\n if (board[x][y] == player) {\n count++;\n x--;\n y--;\n if (count >= 4) {\n return player;\n }\n } else {\n break;\n }\n }\n\n x = curRow + 1;\n y = curCol + 1;\n while (x < m && y < n) {\n if (board[x][y] == player) {\n count++;\n x++;\n y++;\n if (count >= 4) {\n return player;\n }\n } else {\n break;\n }\n }\n\n int count1 = 0;\n int x1 = curRow;\n int y1 = curCol;\n while (x1 < m && y1 >= 0) {\n if (board[x1][y1] == player) {\n count1++;\n x1++;\n y1--;\n if (count1 >= 4) {\n return player;\n }\n } else {\n break;\n }\n }\n\n x1 = curRow - 1;\n y1 = curCol + 1;\n while (x1 >= 0 && y1 < n) {\n if (board[x1][y1] == player) {\n count1++;\n x1--;\n y1++;\n if (count1 >= 4) {\n return player;\n }\n } else {\n break;\n }\n }\n\n\n\n// //horizontal\n// for (int i = 0; i < m; i++) {\n// for (int j = 0; j + 3 < n; j++) {\n// if (board[i][j] == player && board[i][j + 1] == player && board[i][j + 2] == player && board[i][j + 3] == player) {\n// return player;\n// }\n// }\n// }\n\n// //vertical\n// for (int i = 0; i + 3 < m; i++) {\n// for (int j = 0; j < n; j++) {\n// if (board[i][j] == player && board[i + 1][j] == player && board[i + 2][j] == player && board[i + 3][j] == player) {\n// return player;\n// }\n// }\n// }\n\n// //diagonal from upper left to lower right\n// for (int i = 3; i < m; i++) {\n// for (int j = 3; j < n; j++) {\n// if (board[i][j] == player && board[i - 1][j - 1] == player && board[i - 2][j - 2] == player && board[i - 3][j - 3] == player) {\n// return player;\n// }\n// }\n// }\n\n// //diagnoal from lower left to upper right\n// for (int i = 3; i < m; i++) {\n// for (int j = 0; j + 3 < n; j++) {\n// if (board[i][j] == player && board[i - 1][j + 1] == player && board[i - 2][j + 2] == player && board[i - 3][j + 3] == player) {\n// return player;\n// }\n// }\n// }\n\n return -1;\n }", "private void checkWinningMove(TicTacToeElement element,int x,int y) {\n int logicalSize = boardProperties.getBoardLength()-1;\r\n // Check column (only the one we just played)\r\n for(int i=0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[x][i] != element.getValue()){\r\n break;\r\n }\r\n // Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n\r\n }\r\n // Check row (only the one we just played)\r\n for(int i=0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[i][y] != element.getValue()){\r\n break;\r\n }\r\n // Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n }\r\n // Check diagonal\r\n // normal diagonal\r\n for(int i= 0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[i][i] != element.getValue()){\r\n break;\r\n }\r\n // Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n }\r\n // anti diagonal\r\n for(int i= 0;i<=logicalSize;i++){\r\n if( gameState.getBoard()[i][logicalSize-i] != element.getValue()){\r\n break;\r\n }\r\n //Be sure to be at the last index\r\n if(i == logicalSize){\r\n gameState.setWinner(element);\r\n }\r\n }\r\n // check draw\r\n if(gameState.getMoveCount() == Math.pow(logicalSize,2)-1){\r\n gameState.setDraw(true);\r\n }\r\n\r\n }", "public int check(int player) {\n for(int i=0;i<3;i++){\n if(board[0][i]+board[1][i]+board[2][i]==3*player) return i+1;\n if(board[i][0]+board[i][1]+board[i][2]==3*player) return i+4;\n }\n //diagonal checks returns 7,8 for right and left diagonal respectively\n if(board[0][0]+board[1][1]+board[2][2]==3*player) return 7;\n else if(board[0][2]+board[1][1]+board[2][0]==3*player) return 8;\n\n //returns 0 for nothing\n return 0;\n }", "public int whoWin(){\r\n int winner = -1;\r\n \r\n int highest = 0;\r\n \r\n for(Player player : discWorld.getPlayer_HASH().values()){\r\n if(getPlayerPoints(player) > highest){\r\n highest = getPlayerPoints(player);\r\n winner = player.getID();\r\n }\r\n \r\n }\r\n \r\n return winner;\r\n }", "public interface IGameBoard {\r\n int getNumRows();\r\n int getNumColumns();\r\n int getNumToWin();\r\n void placeToken(char p, int c);\r\n boolean checkHorizWin(int r, int c, char p);\r\n boolean checkVertWin(int r, int c, char p);\r\n boolean checkDiagWin(int r, int c, char p);\r\n char whatsAtPos(int r, int c);\r\n\r\n /**\r\n * @pre c > 0, c <= number of columns\r\n * @param c is the column the user selected on the most recent turn\r\n * @return true if the top of the column is free\r\n */\r\n default boolean checkIfFree(int c){ // this function checks the top of each row\r\n if (whatsAtPos(getNumRows()-1, c) == ' ') // if the top of the row is blank, return true (because there is space in the column)\r\n return true;\r\n else\r\n return false;\r\n }\r\n\r\n /**\r\n * @pre c > 0, c <= number of columns\r\n * @param c is the column the user selected on the most recent turn\r\n * @return true if either player won horizontally, vertically, or diagonally\r\n */\r\n default boolean checkForWin(int c){ // this function checks for a win horizontally, vertically, and diagonally\r\n int row = 0;\r\n// for(int i = 0; i < getNumRows(); i++) { // this loop finds the last placed token in the last column chosen (COUNTING UP)\r\n// if (whatsAtPos(i, c) == ' ') {\r\n// row = i - 1;\r\n// break;\r\n// }\r\n// }\r\n for(int i = getNumRows()-1; i >= 0; i--){ // this loop finds the last placed token in the last column chosen (COUNTING DOWN)\r\n if(whatsAtPos(i, c) != ' '){\r\n row = i;\r\n break;\r\n }\r\n }\r\n char player = whatsAtPos(row, c); // set temporary variable player to the last placed token\r\n\r\n if(checkHorizWin(row, c, player)){ // check for win horizontally\r\n return true;\r\n }\r\n if(checkVertWin(row, c, player)){ // check for win vertically\r\n return true;\r\n }\r\n else if(checkDiagWin(row, c, player)){ // check for win diagonally\r\n return true;\r\n }\r\n else{return false;} // return false if none of these are true\r\n }\r\n\r\n /**\r\n * @pre whatsAtPos == 'X', 'O', or ' '\r\n * @return true if board is full\r\n */\r\n default boolean checkTie() { // this function checks for a tie (if the board is full)\r\n int count = 0;\r\n for(int c = 0; c < getNumColumns(); c++) { // check the top of each column\r\n if (!checkIfFree(c)){ // if it is full, increment count\r\n count++;\r\n }\r\n }\r\n if(count == getNumColumns()){ // if count reaches the number of columns, all columns are full; it's tie\r\n return true; // return true\r\n }\r\n else{return false;} // if any columns are not full, then it is not a tie\r\n }\r\n}", "private int Win_Move() {\n\t\tfinal int POSSIBLE_WIN = 8;\n\t\tint move = NO_MOVE;\n\t\tif(( gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_LEFT] == EMPTY){\n\t\t\t\tmove = TOP_LEFT;\n\t\t\t}else if (gameBoard[TOP_CENTER] == EMPTY){\n\t\t\t\tmove = TOP_CENTER;\n\t\t\t}else if (gameBoard[TOP_RIGHT] == EMPTY){\n\t\t\t\tmove = TOP_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[CTR_LEFT] + gameBoard[CTR_CENTER] + gameBoard[CTR_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[CTR_LEFT] == EMPTY){\n\t\t\t\tmove = CTR_LEFT;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[CTR_RIGHT] == EMPTY){\n\t\t\t\tmove = CTR_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[BTM_LEFT] + gameBoard[BTM_CENTER] + gameBoard[BTM_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[BTM_LEFT] == EMPTY){\n\t\t\t\tmove = BTM_LEFT;\n\t\t\t}else if (gameBoard[BTM_CENTER] == EMPTY){\n\t\t\t\tmove = BTM_CENTER;\n\t\t\t}else if (gameBoard[BTM_RIGHT] == EMPTY){\n\t\t\t\tmove = BTM_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_LEFT] + gameBoard[BTM_LEFT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_LEFT] == EMPTY){\n\t\t\t\tmove = TOP_LEFT;\n\t\t\t}else if (gameBoard[CTR_LEFT] == EMPTY){\n\t\t\t\tmove = CTR_LEFT;\n\t\t\t}else if (gameBoard[BTM_LEFT] == EMPTY){\n\t\t\t\tmove = BTM_LEFT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_CENTER] + gameBoard[CTR_CENTER] + gameBoard[BTM_CENTER]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_CENTER] == EMPTY){\n\t\t\t\tmove = TOP_CENTER;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[BTM_CENTER] == EMPTY){\n\t\t\t\tmove = BTM_CENTER;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_RIGHT] == EMPTY){\n\t\t\t\tmove = TOP_RIGHT;\n\t\t\t}else if (gameBoard[CTR_RIGHT] == EMPTY){\n\t\t\t\tmove = CTR_RIGHT;\n\t\t\t}else if (gameBoard[BTM_RIGHT] == EMPTY){\n\t\t\t\tmove = BTM_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_LEFT] + gameBoard[CTR_CENTER] + gameBoard[BTM_RIGHT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_LEFT] == EMPTY){\n\t\t\t\tmove = TOP_LEFT;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[BTM_RIGHT] == EMPTY){\n\t\t\t\tmove = BTM_RIGHT;\n\t\t\t}\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_CENTER] + gameBoard[BTM_LEFT]) == POSSIBLE_WIN){\n\t\t\tif(gameBoard[TOP_RIGHT] == EMPTY){\n\t\t\t\tmove = TOP_RIGHT;\n\t\t\t}else if (gameBoard[CTR_CENTER] == EMPTY){\n\t\t\t\tmove = CTR_CENTER;\n\t\t\t}else if (gameBoard[BTM_LEFT] == EMPTY){\n\t\t\t\tmove = BTM_LEFT;\n\t\t\t}\n\t\t}\n\t\treturn move;\n\t}", "int checkWinner(char mark) {\n\t\tint row, col;\n\t\tint result = 0;\n\n\t\tfor (row = 0; result == 0 && row < 3; row++) {\n\t\t\tint row_result = 1;\n\t\t\tfor (col = 0; row_result == 1 && col < 3; col++)\n\t\t\t\tif (theBoard[row][col] != mark)\n\t\t\t\t\trow_result = 0;\n\t\t\tif (row_result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\n\t\t\n\t\tfor (col = 0; result == 0 && col < 3; col++) {\n\t\t\tint col_result = 1;\n\t\t\tfor (row = 0; col_result != 0 && row < 3; row++)\n\t\t\t\tif (theBoard[row][col] != mark)\n\t\t\t\t\tcol_result = 0;\n\t\t\tif (col_result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\n\t\tif (result == 0) {\n\t\t\tint diag1Result = 1;\n\t\t\tfor (row = 0; diag1Result != 0 && row < 3; row++)\n\t\t\t\tif (theBoard[row][row] != mark)\n\t\t\t\t\tdiag1Result = 0;\n\t\t\tif (diag1Result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\t\tif (result == 0) {\n\t\t\tint diag2Result = 1;\n\t\t\tfor (row = 0; diag2Result != 0 && row < 3; row++)\n\t\t\t\tif (theBoard[row][3 - 1 - row] != mark)\n\t\t\t\t\tdiag2Result = 0;\n\t\t\tif (diag2Result != 0)\n\t\t\t\tresult = 1;\n\t\t}\n\t\treturn result;\n\t}", "public int evaluate(int[][] gameBoard) {\n for (int r = 0; r < 3; r++) {\n if (gameBoard[r][0] == gameBoard[r][1] && gameBoard[r][1] == gameBoard[r][2]) {\n if (gameBoard[r][0] == ai)\n return +10;\n else if (gameBoard[r][0] == human)\n return -10;\n }\n }\n // Checking for Columns for victory.\n for (int c = 0; c < 3; c++) {\n if (gameBoard[0][c] == gameBoard[1][c] && gameBoard[1][c] == gameBoard[2][c]) {\n //gameLogic.getWinType();\n if (gameBoard[0][c] == ai)\n return +10;\n else if (gameBoard[0][c] == human)\n return -10;\n }\n }\n // Checking for Diagonals for victory.\n if (gameBoard[0][0] == gameBoard[1][1] && gameBoard[1][1] == gameBoard[2][2]) {\n if (gameBoard[0][0] == ai)\n return +10;\n else if (gameBoard[0][0] == human)\n return -10;\n }\n if (gameBoard[0][2] == gameBoard[1][1] && gameBoard[1][1] == gameBoard[2][0]) {\n if (gameBoard[0][2] == ai)\n return +10;\n else if (gameBoard[0][2] == human)\n return -10;\n }\n // Else if none of them have won then return 0\n return 0;\n }", "public int decideRandomMove() {\n return (int) (Math.random() * 4);\n }", "public boolean isWon(int row, int column, char piece) {\n int matches = 0;\n int tempCol = column;\n int tempRow = row;\n //Check below\n if (row < 3) {\n for (int i = 1; board[row + i][column] == piece; i++) {\n if (i == 3) {\n return true;\n }\n }\n }\n //Check horizontal\n while (tempCol > 0 && board[row][tempCol - 1] == piece) {\n matches++;\n tempCol--;\n }\n tempCol = column;\n while (tempCol < 6 && board[row][tempCol + 1] == piece) {\n matches++;\n tempCol++;\n }\n if (matches >= 3) {\n return true;\n }\n matches = 0;\n tempCol = column;\n \n //Check left diagonal\n while(tempRow < 5 && tempCol > 0 && board[tempRow + 1][tempCol - 1] == piece) {\n matches++;\n tempRow++;\n tempCol--;\n }\n tempCol = column;\n tempRow = row;\n while (tempRow > 0 && tempCol < 6 && board[tempRow - 1][tempCol + 1] == piece) {\n matches++;\n tempRow--;\n tempCol++;\n }\n if (matches >= 3) {\n return true;\n }\n matches = 0;\n tempCol = column;\n tempRow = row;\n //Check right diagonal\n while(tempRow < 5 && tempCol < 6 && board[tempRow + 1][tempCol + 1] == piece) {\n matches++;\n tempRow++;\n tempCol++;\n }\n tempCol = column;\n tempRow = row;\n while (tempRow > 0 && tempCol > 0 && board[tempRow - 1][tempCol - 1] == piece) {\n matches++;\n tempRow--;\n tempCol--;\n }\n if (matches >= 3) {\n return true;\n }\n return false;\n\t}", "public int corners1() {\n //above left\n if (board[0][1] != null && board[1][0] != null) {\n if (board[0][1].getPlayerNumber() != board[0][0].getPlayerNumber()\n && board[1][0].getPlayerNumber() != board[0][0].getPlayerNumber())\n return board[0][0].getPlayerNumber();\n }\n //left bottom\n if (board[0][board.length - 2] != null && board[1][board.length - 1] != null) {\n if (board[1][board.length - 1].getPlayerNumber() != board[0][board.length - 1].getPlayerNumber() &&\n board[0][board.length - 2].getPlayerNumber() != board[0][board.length - 1].getPlayerNumber())\n return board[0][board.length - 1].getPlayerNumber();\n }\n //right top\n if (board[board.length - 2][0] != null && board[board.length - 1][1] != null) {\n if (board[board.length - 1][1].getPlayerNumber() != board[board.length - 1][0].getPlayerNumber() &&\n board[board.length - 2][0].getPlayerNumber() != board[board.length - 1][0].getPlayerNumber())\n return board[board.length - 1][0].getPlayerNumber();\n }\n //right bottom\n if (board[board.length - 1][board.length - 2] != null && board[board.length - 2][board.length - 1] != null) {\n if (board[board.length - 2][board.length - 1].getPlayerNumber() !=\n board[board.length - 1][board.length - 1].getPlayerNumber() &&\n board[board.length - 1][board.length - 2].getPlayerNumber() !=\n board[board.length - 1][board.length - 1].getPlayerNumber()) {\n return board[board.length - 1][board.length - 1].getPlayerNumber();\n }\n }\n return -2;\n\n }", "public final boolean checkForWin() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n result = true;\r\n for(Tile tile : rail.getTiles()) {\r\n tile.setBackground(Color.GREEN);\r\n player = tile.getText();\r\n }\r\n if (player.equals(\"X\")) {\r\n winningPlayer = \"X\";\r\n this.xWins++;\r\n } else if (player.equals(\"0\")) {\r\n winningPlayer = \"0\";\r\n this.oWins++;\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return result;\r\n }", "public boolean isWinTurn() {\n for (int col = 0; col < mColsCount; col++) {\n if (isFourConnected(getCurrentPlayer(), 0, 1, 0, col, 0)\n || isFourConnected(getCurrentPlayer(), 1, 1, 0, col, 0)\n || isFourConnected(getCurrentPlayer(), -1, 1, 0, col, 0)) {\n hasWinner = true;\n return true;\n }\n }\n\n for (int row = 0; row < mRowsCount; row++) {\n if (isFourConnected(getCurrentPlayer(), 1, 0, row, 0, 0)\n || isFourConnected(getCurrentPlayer(), 1, 1, row, 0, 0)\n || isFourConnected(getCurrentPlayer(), -1, 1, row, mColsCount - 1, 0)) {\n hasWinner = true;\n return true;\n }\n }\n\n return false;\n }", "public Result determineOutcome() {\n for (int row = 0; row < TicTacToeModel.BOARD_DIMENSION; row++) {\n if (rowScore[row] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (rowScore[row] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n for (int col = 0; col < TicTacToeModel.BOARD_DIMENSION; col++) {\n if (colScore[col] == TicTacToeModel.BOARD_DIMENSION){\n return Result.WIN;\n } else if (colScore[col] == -TicTacToeModel.BOARD_DIMENSION) {\n return Result.LOSE;\n }\n }\n\n if (leftDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (rightDiagScore == TicTacToeModel.BOARD_DIMENSION) return Result.WIN;\n if (leftDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n if (rightDiagScore == -TicTacToeModel.BOARD_DIMENSION) return Result.LOSE;\n\n if (freeSpace == 0) return Result.DRAW;\n\n return Result.INCOMPLETE;\n }", "private int gameState() {\n\t\t\n\t\tint gameNotOver = 0;\n\t\tint gameOverWinnerX = 1;\n\t\tint gameOverWinnerO = 2;\n\t\tint gameOverTie = 3;\n\t\t\n\t\t\n\t\t\n\t\t//Win Vertically \n\t\t// 0 3 6 , 1 4 7 , 2 5 8\n\t\t\t\t\n\t\t//Win Horizontally\n\t\t//0 1 2 , 3 4 5 , 6 7 8 \n\t\t\t\t\n\t\t//Win Diagonally\n\t\t// 0 4 8 , 2 4 6\n\t\t\t\t\n\t\t//Assuming it's an equal grid\n\t\t\t\t\n\t\tMark winningMark = null;\n\t\t\t\t\n\t\tboolean hasFoundWinner = false;\n\t\t\t\t\n\t\tint row = 0;\n\t\tint column = 0;\n\t\t\t\t\n\t\t//Horizontal Winner Test\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\tcolumn ++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tcolumn = 0;\n\t\t\trow++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// Vertical Winner Test\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\n\t\twhile (!hasFoundWinner && column < COLUMN_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[ROW_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\trow = 0;\n\t\t\tcolumn++;\t\n\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Winner Test \"\\\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = 0;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn++;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t//Diagonal Test \"/\"\n\t\t\t\t\n\t\trow = 0;\n\t\tcolumn = COLUMN_COUNT - 1;\n\t\t\t\t\n\t\twhile (!hasFoundWinner && row < ROW_COUNT) {\n\t\t\t\t\t\n\t\t\tMark[] markArray = new Mark[COLUMN_COUNT];\n\t\t\t\t\t\n\t\t\tint index = 0;\n\t\t\t\t\t\n\t\t\twhile (row < ROW_COUNT) {\n\t\t\t\t\t\t\n\t\t\t\tmarkArray[index] = getMark(row, column);\n\t\t\t\trow++;\n\t\t\t\tcolumn--;\n\t\t\t\tindex++;\n\t\t\t\t\t\t\n\t\t\t}\n\t\t\t\t\t\n\t\t\tif (allElementsEqual(markArray)) {\n\t\t\t\thasFoundWinner = true;\n\t\t\t\twinningMark = markArray[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\tif (hasFoundWinner) {\n\t\t\tif (winningMark == Mark.X) {\n\t\t\t\treturn gameOverWinnerX;\n\t\t\t}\n\t\t\tif (winningMark == Mark.O) {\n\t\t\t\treturn gameOverWinnerO;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If there are no moves left, and there is no winner, game ends inn a tie \n\t\t\n\t\tboolean foundNoMove = false;\n\t\tfor (int i = 0; i < movesArray.length; i++) {\n\t\t\tif (movesArray[i] == NO_MOVE) {\n\t\t\t\tfoundNoMove = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!foundNoMove && !hasFoundWinner) {\n\t\t\treturn gameOverTie;\n\t\t}\n\t\t\n\t\t// If there is no winner and there are still moves left, game is not over\n\t\t\n\t\treturn gameNotOver;\n\t\t\n\t}", "public boolean checkWin(int x, int y, int player)\n {\n int[][] area = new int[REGION_SIZE][REGION_SIZE];\n // Copy region of board to do win checking\n for (int i = REGION_START; i <= REGION_STOP; i++) {\n for (int j = REGION_START; j <= REGION_STOP; j++) {\n area[i - REGION_START][j - REGION_START] = getTile(x + i, y + j);\n }\n }\n \n //Check Horizontal\n int count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[4][i] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n //Check Vertical\n count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[i][4] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n //Check Diagonal '/'\n count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[REGION_SIZE - 1 - i][i] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n //Check Diagonal '\\'\n count = 0;\n for (int i = 0; i < REGION_SIZE; i++) {\n if (area[i][i] == player) {\n count++;\n } else {\n count = 0;\n }\n if (count == 5) {\n return true;\n }\n }\n return false;\n }", "private static boolean checkWin() {\n\t\tfor (int i = 0; i < nRows; i++)\n\t\t\tfor (int j = 0; j < nColumns; j++) {\n\t\t\t\tCell cell = field.getCellAt(i, j);\n\t\t\t\tif (cell.hasMine() && !cell.hasSign())\t // if the cell has a mine\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// but has no flag\n\t\t\t\t\treturn false;\n\t\t\t\tif (cell.getFlag() >= 0 && !cell.getVisiblity()) // if the cell has no\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// mine in it but\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// it is not visible\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\twin = gameOver = true;\n\t\treturn true;\n\t}", "private boolean checkWin(Integer playerMove, Location loc)\n\t{\n\t\tboolean isWinAcross = true, isWinDown = true, isWinDiag1 = true, isWinDiag2 = true;\n\t\tfor (int col = 0; col < super.getRows() && isWinAcross; col++) //ends loop after isWinAcross is true\n\t\t\tif (grid[loc.getRow()][col] == null || !grid[loc.getRow()][col].equals(playerMove))\n\t\t\t\tisWinAcross = false;\n\t\tfor (int row = 0; row < super.getCols() && isWinDown; row++) //ends loop after isWinDown is true\n\t\t\tif (grid[row][loc.getCol()] == null || !grid[row][loc.getCol()].equals(playerMove))\n\t\t\t\tisWinDown = false;\n\t\tfor (int diagonal = 0; diagonal < super.getCols() && isWinDiag1; diagonal++) //ends loop after isWinDiag1 is true\n\t\t\tif (grid[diagonal][diagonal] == null || !grid[diagonal][diagonal].equals(playerMove))\n\t\t\t\tisWinDiag1 = false;\n\t\tfor (int diagonal2 = 0; diagonal2 < super.getCols() && isWinDiag2; diagonal2++) //ends loop after isWinDiag2 is true\n\t\t\tif (grid[getCols() - diagonal2 - 1][diagonal2] == null || !grid[getCols() - diagonal2 - 1][diagonal2].equals(playerMove))\n\t\t\t\tisWinDiag2 = false;\n\t\treturn isWinAcross || isWinDown || isWinDiag1 || isWinDiag2;\n\t}", "public static boolean ai_NESW(int[][] gameGrid, int pieceTracker, int colNum) //Minor\n\t{\n\t\tint streakBonus = 0;\n\t\tcounter++; //Used to make variations in the AI move logic\n\t\tint rowNum = 0; //Used to store the row when finding the row we need to check for win condition\n\t\t//The loop below is used to find the row of last piece dropped to find exact position\n\t\tfor (int posTracker = 0; posTracker < ConnectFour.getRows(); posTracker++)\n\t\t{\n\t\t\t\n\t\t\tif (gameGrid[posTracker][colNum] != 0)\n\t\t\t{\n\t\t\t\trowNum = posTracker;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int rowTracker = rowNum + 1, colTracker = colNum - 1; colTracker >= 0 && rowTracker < ConnectFour.getRows(); rowTracker++ ,colTracker--)\n\t\t{\t\n\t\t\tif (counter %2 == 0) //Used to make the switch in the AI move logic\n\t\t\t\tbreak;\n\t\t\tif (gameGrid[rowTracker][colTracker] == pieceTracker) //Increments the streak if consecutive pieces are found\n\t\t\t{\n\t\t\t\tstreakBonus++; \n\t\t\t\tif (streakBonus >= 2)\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker - 1 > 0) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker-1); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker - 2 > 0) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker-2); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse \n\t\t\t\tstreakBonus = 0;\n\t\t}\n\t\tfor (int colTracker = colNum + 1, rowTracker = rowNum - 1; colTracker < ConnectFour.getCols() && rowTracker >= 0; rowTracker--, colTracker++)\n\t\t{\n\t\t\tif (gameGrid[rowTracker][colTracker] == pieceTracker) //Increments the streak if consecutive pieces are found\n\t\t\t{\n\t\t\t\tstreakBonus++;\n\t\t\t\tif (streakBonus >= 2)\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker + 1 < ConnectFour.getCols()) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker+1); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (ConnectFour.getFlag()) //Used to prevent same AI move, causing overflow\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (colTracker + 2 < ConnectFour.getCols()) //###\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsetCoords(colTracker+2); //###\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse \n\t\t\t\tstreakBonus = 0;\n\t\t}\n\t\treturn false; //if steak is not found\n\t}", "private boolean winCheck(int x, int y, char symbol){\n\t\t/* Horizontal */\n\t\tif(y>=2 && board[x][y-2]==symbol && board[x][y-1]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(y>=1 && y+1<size && board[x][y-1]==symbol && board[x][y]==symbol && board[x][y+1]==symbol)\n\t\t\treturn true;\n\t\tif(y+2<size && board[x][y]==symbol && board[x][y+1]==symbol && board[x][y+2]==symbol)\n\t\t\treturn true;\n\t\t\n\t\t/* Vertical */\n\t\tif(x>=2 && board[x-2][y]==symbol && board[x-1][y]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(x>=1 && x+1<size && board[x-1][y]==symbol && board[x][y]==symbol && board[x+1][y]==symbol)\n\t\t\treturn true;\n\t\tif(x+2<size && board[x][y]==symbol && board[x+1][y]==symbol && board[x+2][y]==symbol)\n\t\t\treturn true;\n\t\t\n\t\t/* Main Diagonal */\n\t\tif(x>=2 && y>=2 && board[x-2][y-2]==symbol && board[x-1][y-1]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(x>=1 && x+1<size && y>=1 && y+1<size && board[x-1][y-1]==symbol && board[x][y]==symbol && board[x+1][y+1]==symbol)\n\t\t\treturn true;\n\t\tif(x+2<size && y+2<size && board[x][y]==symbol && board[x+1][y+1]==symbol && board[x+2][y+2]==symbol)\n\t\t\treturn true;\n\t\t\n\t\t/* Anti Diagonal */\n\t\tif(x>=2 && y+2<size && board[x-2][y+2]==symbol && board[x-1][y+1]==symbol && board[x][y]==symbol)\n\t\t\treturn true;\n\t\tif(x>=1 && x+1<size && y>=1 && y+1<size && board[x+1][y-1]==symbol && board[x][y]==symbol && board[x-1][y+1]==symbol)\n\t\t\treturn true;\n\t\tif(x+2<size && y>=2 && board[x][y]==symbol && board[x+1][y-1]==symbol && board[x+2][y-2]==symbol)\n\t\t\treturn true;\n\t\t\n\t\treturn false;\n\t}", "public boolean playerOneWin()\n\t{\n\t\tif( (board[ 1 ] == \"X\") && (board[ 2 ] == \"X\") && (board[ 3 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 1 ] == \"X\") && (board[ 2 ] == \"X\") && (board[ 3 ] == \"X\") )\n\t\t\n\t\telse if( (board[ 4 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 6 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 4 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 6 ] == \"X\") ) \n\t\t\n\t\telse if( (board[ 7 ] == \"X\") && (board[ 8 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 7 ] == \"X\") && (board[ 8 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t\n\t\telse if( (board[ 1 ] == \"X\") && (board[ 4 ] == \"X\") && (board[ 7 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 1 ] == \"X\") && (board[ 4 ] == \"X\") && (board[ 7 ] == \"X\") )\n\t\t\n\t\telse if( (board[ 2 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 8 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 2 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 8 ] == \"X\") )\n\t\t\n\t\telse if( (board[ 3 ] == \"X\") && (board[ 6 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 3 ] == \"X\") && (board[ 6 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t\n\t\telse if( (board[ 1 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t}// end of if( (board[ 1 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t\n\t\telse if( (board[ 7 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t{\n\t\t\treturn true;\n\t\t} // end of if( (board[ 7 ] == \"X\") && (board[ 5 ] == \"X\") && (board[ 9 ] == \"X\") )\n\t\t\n\t\treturn false;\n\t}", "public int performDuel(){\n Random rand = new Random();\n int intRand;\n intRand = rand(6);\n while(this.engine.getGameInformation().cards[intRand][intRand] == 0 ){\n intRand = rand(6);\n }\n return intRand;\n }", "public static char playerHasWon(char[][] board) {\r\n\r\n\t //Check each row\r\n\t for(int i = 0; i < 3; i++) {\r\n\t if(board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != '-') {\r\n\t return board[i][0];\r\n\t }\r\n\t }\r\n\r\n\t //Check each column\r\n\t for(int j = 0; j < 3; j++) {\r\n\t if(board[0][j] == board[1][j] && board[1][j] == board[2][j] && board[0][j] != '-') {\r\n\t return board[0][j];\r\n\t }\r\n\t }\r\n\r\n\t //Check the diagonals\r\n\t if(board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != '-') {\r\n\t return board[0][0];\r\n\t }\r\n\t if(board[2][0] == board[1][1] && board[1][1] == board[0][2] && board[2][0] != '-') {\r\n\t return board[2][0];\r\n\t }\r\n\r\n\t //Otherwise nobody has not won yet\r\n\t return ' ';\r\n\t }", "public int checkWin(Piece piece) {\n\t\t//check winning and losing\n\t\tint color=piece.getColor();\n\t\tif(piece.isRabbit()) {\n\t\t\tif(((Rabbit)piece).isOtherSide()) {\n\t\t\t\treturn color;\n\t\t\t}\n\t\t}\n\t\tif(rabbitcount[color]<=0) {\n\t\t\treturn 3-color;//the opponent wins\n\t\t}\n\t\treturn 0;\n\t}", "public static void turnOfComp() {\n int row, col, num;\n\n row = getRandCell();\n col = getRandCell();\n while (isTakenCell(row, col)) {\n row = getRandCell();\n col = getRandCell();\n }\n\n num = getRandOdd();\n while (isUsedNumber(num)) {\n num = getRandOdd();\n }\n board[row - 1][col - 1] = num;\n System.out.print(\"\\nComputer's turn.\\n\"); // Print to tell the user that the board below is from computer's turn\n printBoard();\n }", "boolean horizontalWin(){\n\t\tint match_counter=1;\n\t\tboolean flag=false;\n\t\tfor(int row=0;row<9;row++){\n\t\t\tfor(int column=0;column<25;column++){\n\t\t\t\tif(Board[row][column]!='\\u0000'){\n\t\t\t\t\tif(Board[row][column]!='O'){\n\t\t\t\t\t\tif (Board[row][column]==Board[row][column+1]){\n\t\t\t\t\t\t\tmatch_counter++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(match_counter==4){\n\t\t\t\t\tflag=true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (flag == true)\n\t\t\t\tbreak;\n\t\t}\n\t\treturn flag;\n\t}", "private boolean checkBoardVictory() {\n boolean topRowStatus = checkRowVictory(getTopRow()) != 0;\n boolean midRowStatus = checkRowVictory(getMidRow()) != 0;\n boolean vertMidStatus = checkRowVictory(getVerticalMidRow()) != 0;\n boolean lowRowStatus = checkRowVictory(getLowRow()) != 0;\n boolean leftMidStatus = checkRowVictory(getVerticalLeftRow()) != 0;\n boolean rightMidStatus = checkRowVictory(getVerticalRightRow()) != 0;\n\n return topRowStatus || midRowStatus || vertMidStatus || lowRowStatus || leftMidStatus\n || rightMidStatus;\n }", "public boolean hasWinner() {\n\t\tint[][] board = myGameBoard.getBoard();\n\t\t\n\t\t// check for vertical win\n\t\tfor(int i = 0; i < board[0].length; i++) {\n\t\t\tfor(int j = 0; j < board.length - 3; j++) {\n\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\tif(thisSlot == GameBoard.EMPTY) continue;\n\t\t\t\t\n\t\t\t\tif(thisSlot == board[j+1][i]) {\n\t\t\t\t\tif(thisSlot == board[j+2][i]) {\n\t\t\t\t\t\tif(thisSlot == board[j+3][i]) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for horizontal win\n\t\tfor(int i = 0; i < board[0].length - 3; i++) {\n\t\t\tfor(int j = 0; j < board.length; j++) {\n\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\tif(thisSlot == GameBoard.EMPTY) continue;\n\t\t\t\t\n\t\t\t\tif(thisSlot == board[j][i+1]) {\n\t\t\t\t\tif(thisSlot == board[j][i+2]) {\n\t\t\t\t\t\tif(thisSlot == board[j][i+3]) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for diagonal win left to right, upwards\n\t\tfor(int i = 0; i < board[0].length - 3; i++) {\n\t\t\tfor(int j = 3; j < board.length; j++) {\n\t\t\t\tif(board[j][i] != GameBoard.EMPTY) {\n\t\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\t\t\n\t\t\t\t\tif(board[j-1][i+1] == thisSlot) {\n\t\t\t\t\t\tif(board[j-2][i+2] == thisSlot) {\n\t\t\t\t\t\t\tif(board[j-3][i+3] == thisSlot) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check for diagonal win right to left, upwards\n\t\tfor(int i = 3; i < board[0].length; i++) {\n\t\t\tfor(int j = 3; j < board.length; j++) {\n\t\t\t\tif(board[j][i] != GameBoard.EMPTY) {\n\t\t\t\t\tint thisSlot = board[j][i];\n\t\t\t\t\t\n\t\t\t\t\tif(board[j-1][i-1] == thisSlot) {\n\t\t\t\t\t\tif(board[j-2][i-2] == thisSlot) {\n\t\t\t\t\t\t\tif(board[j-3][i-3] == thisSlot) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public abstract Chip checkWinner();", "public boolean getWin() {\n if (targetDistance == 25) {\n if (missDistance <= 1 && missDistance >= -1) { //checks 25m win\n return true;\n }\n else {\n return false;\n }\n }\n else if (targetDistance == 50) { //checks 50m win\n if (missDistance <= 2 && missDistance >= -2) {\n return true;\n }\n else {\n return false;\n }\n }\n else { //checks 100m win\n if (missDistance <= 3 && missDistance >= -3) {\n return true;\n }\n else {\n return false;\n }\n }\n }", "public TileState choose(int row, int column) {\n if (playerOneTurn){\n if (board[row][column] == TileState.BLANK) {\n playerOneTurn = false;\n movesPlayed++;\n board[row][column] = TileState.CROSS;\n return TileState.CROSS;\n } else {\n return TileState.INVALID;\n }\n } else {\n if (board[row][column] == TileState.BLANK) {\n playerOneTurn = true;\n movesPlayed++;\n board[row][column] = TileState.CIRCLE;\n return TileState.CIRCLE;\n } else {//(board[row][column] != TileState.BLANK) {\n return TileState.INVALID;\n }\n }\n }", "private boolean winningBoard(char[][] board){\n for(int i = 0; i < boardHeight; i++ ){\n for(int j = 0; j < boardWidth; j++) {\n\n //if white was made it to the other side\n if(board[i][j] == 'P' && i == 0){\n return true;\n }\n\n //if black has made it to the other side\n if(board[i][j] == 'p' && i == boardHeight -1){\n return true;\n }\n }\n }\n //no winners\n return false;\n }", "public boolean isWinner(int player) {\n\n\t\tint winnerCounter1 = 0;\n\t\tint winnerCounter2 = 0;\n\t\tint winnerCounter3 = 0;\n\t\tint delta = 0;\n\n//\t\t * grid [size][size] där size = 4;\n//\t\t * for (int x = 0; x < grid.length; x++)\n//\t\t * for (int y = 0; y < grid[x].length; y++)\n//\t\t * Här förklarar jag hur funkar de här två forloop:\n//\t\t * nummert efter siffran är indexet\n//\t\t * X0Y0 X1Y0 X2Y0 X3Y0\n//\t\t * X0Y1 X1Y1 X2Y1 X3Y1\n//\t\t * X0Y2 X1Y2 X2Y2 X3Y2\n//\t\t * X0Y3 X1Y3 X2Y3 X3Y3\n\n\t\tfor (int x = 0; x < getSize(); x++) {\n\t\t\tfor (int y = 0; y < getSize(); y++) {\n\t\t\t\tif (grid[y][x] == player)\n\t\t\t\t\twinnerCounter1++;\n\t\t\t\telse\n\t\t\t\t\twinnerCounter1 = 0;\n\t\t\t\tif (winnerCounter1 >= INROW) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif (grid[x][y] == player)\n\t\t\t\t\twinnerCounter2++;\n\t\t\t\telse\n\t\t\t\t\twinnerCounter2 = 0;\n\t\t\t\tif (winnerCounter2 >= INROW) {\n\t\t\t\t\tSystem.out.println(\"2\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twinnerCounter1 = 0;\n\t\t\twinnerCounter2 = 0;\n\t\t}\n\n\t\tfor (int x = 0; x < getSize(); x++) { // diagonally\n\t\t\tfor (int y = 0; y < getSize(); y++) {\n\t\t\t\twhile (x + delta < grid.length - 1 && y + delta < grid.length - 1) {\n\t\t\t\t\tif (grid[x + delta][y + delta] == player) {\n\t\t\t\t\t\twinnerCounter3++;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t\tif (winnerCounter3 == INROW) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\twinnerCounter3 = 0;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\twinnerCounter3 = 0;\n\t\t\t\tdelta = 0;\n\t\t\t\twhile (x - delta >= 0 && y + delta < grid.length - 1) {\n\t\t\t\t\tif (grid[x - delta][y + delta] == player) {\n\t\t\t\t\t\twinnerCounter3++;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t\tif (winnerCounter3 == INROW) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\twinnerCounter3 = 0;\n\t\t\t\t\t\tdelta++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn false;\n\n\t}", "public ArrayList<Integer> compChoice(ArrayList<ArrayList<String>> board) {\n // winning move available\n if (this.aboutToWin(board, 1) != null) {\n return this.aboutToWin(board, 1);\n\n // threat winning pay\n } else if (playerCanWin(board) != null) {\n return playerCanWin(board);\n\n // center square \n } else if (board.size() % 2 == 1 && board.get(board.size()/2).get(board.size()/2).isEmpty()) {\n return new ArrayList<Integer>(Arrays.asList(board.size()/2, board.size()/2));\n \n // random\n } else {\n Random rand = new Random();\n String text = \"temp\";\n int r1 = 0, r2 = 0;\n while (!text.isEmpty()) {\n r1 = rand.nextInt(board.size());\n r2 = rand.nextInt(board.size());\n text = board.get(r1).get(r2);\n }\n return new ArrayList<Integer>(Arrays.asList(r1, r2));\n }\n }", "private Boolean canWinInRow(PentagoBoard b, int row, Color who) {\n \tint amount=0;\n \tfor(int i=0; i<b.getSize(); i++) {\n\t\t\tif(b.getState(i,row) == Color.EMPTY || b.getState(i,row) == who) {\n\t\t\t\tamount++;\n\t\t\t}\n\t\t\telse\n\t\t\t\tamount=0;\n \t}\n \tif(amount>4)\n \t\treturn true;\n \telse\n \t\treturn false;\n }", "boolean isWinner() {\n if(checkTopLeftDownDiag('X') || checkTopLeftDownDiag('O')) {\n return true;\n } else if (checkBottomLeftUpDiag('X') || checkBottomLeftUpDiag('O')) {\n return true;\n } else if (checkRows('X') || checkRows('O')){\n return true;\n }\n else if (checkColumns('X') || checkColumns('O')){\n return true;\n }\n\n return false;\n }", "private boolean checkDiagonalWin(BoardPosition lastPos){\r\n int i, j, k, countTop, countBottom;\r\n int check = 5;\r\n\r\n //checking for diagonals from top to bottom\r\n for(i = 0; i < (yMax-yMax)+5; i++){\r\n for(j = 0; j < (xMax / 2); j++){\r\n countTop = 0;\r\n for(k = 0; k < check; k++){\r\n if(grid[i+k][j+(2*k)] == lastPos.getPlayer()) {\r\n countTop++;\r\n }\r\n }\r\n if(countTop == win) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n //checking for diagonals from bottom to top\r\n for(i = yMax-1; i > (yMax-yMax)+3; i--){\r\n for(j = 0; j < (xMax / 2); j++){\r\n countBottom = 0;\r\n for(k = 0; k < check; k++){\r\n if(grid[i-k][j+(2*k)] == lastPos.getPlayer()) {\r\n countBottom++;\r\n }\r\n }\r\n if(countBottom == win) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }", "public void challengeMove(){\n int maxOutcome = -1;\n int returnIndex = -1;\n Hole lastHole;\n Hole selectedHole;\n ArrayList<Hole> availableHoles = availableMoves(nextToPlay);\n for(int i = 0; i < availableHoles.size(); i++){\n selectedHole = availableHoles.get(i);\n lastHole = holes[(selectedHole.getHoleIndex() + selectedHole.getNumberOfKoorgools() - 1) % 18];\n if(lastHole.getOwner() != nextToPlay){\n int numOfKorgools = lastHole.getNumberOfKoorgools() +1;\n if(numOfKorgools == 3 && !nextToPlay.hasTuz()){\n int otherTuzIndex = getPlayerTuz(Side.WHITE);\n if(otherTuzIndex == -1 || ((otherTuzIndex + 9) != lastHole.getHoleIndex())) {\n redistribute(selectedHole.getHoleIndex());\n return;\n }\n redistribute(selectedHole.getHoleIndex());\n return;\n }\n if(numOfKorgools % 2 == 0 && numOfKorgools > maxOutcome){\n maxOutcome = numOfKorgools;\n returnIndex = selectedHole.getHoleIndex();\n }\n }\n }\n if(returnIndex <= -1){\n randomMove();\n return;\n }\n redistribute(returnIndex);\n }", "public Winner whoWins(){\r\n\r\n /* transfer the matrix to an array */\r\n Sign[] flatBoard = flattenBoard();\r\n\r\n /* check if someone has won */\r\n if (CompPlayer.compWon(flatBoard))\r\n return Winner.COMPUTER;\r\n else if (CompPlayer.playerWon(flatBoard))\r\n return Winner.PLAYER;\r\n else\r\n return Winner.NON;\r\n }", "private boolean hasRowWin() {\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n if (getBoard()[i][j] != null) {\n boolean rowWin = rowHasFour(i, j);\n if (rowWin) {\n return true;\n }\n\n }\n }\n }\n return false;\n }", "private void checkForPlayerChance()\n\t\t\t{\n\t\t\t\tf = false;\n\t\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (win[j] == 2 && lose[j] == 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tf = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\tif (f == false)\n\t\t\t\t\tj = 10;\n\n\t\t\t}", "static int waysToGiveACheck(char[][] board) {\n\t\tint[] pawnPos = new int[2];\n\t\tint[] bkPos = new int[2];\n\t\tint[] wkPos = new int[2];\n\t\tint[] forthPos = new int[2];\n\t\tchar fourth = 'x';\n\t\tint answerCount = 0;\n\t\tint hashCount = 0;\n\t\tfor(int board_i = 0; board_i < 8; board_i++){\n\t\t\tfor(int board_j = 0; board_j < 8; board_j++){\n\t\t\t\tswitch(board[board_i][board_j]){\n\t\t\t\tcase 35:\n\t\t\t\t\thashCount++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 80:\n\t\t\t\t\t{pawnPos[0] = board_i;\n\t\t\t\t\tpawnPos[1] = board_j;\n\t\t\t\t\tbreak;}\n\t\t\t\tcase 107:\n\t\t\t\t\t{bkPos[0] = board_i;\n\t\t\t\t\tbkPos[1] = board_j;\n\t\t\t\t\tbreak;}\n\t\t\t\tcase 75:\n\t\t\t\t\t{wkPos[0] = board_i;\n\t\t\t\t\twkPos[1] = board_j;\n\t\t\t\t\tbreak;}\n\t\t\t\tdefault:\n\t\t\t\t\t{forthPos[0] = board_i;\n\t\t\t\t\tforthPos[1] = board_j;\n\t\t\t\t\tfourth = board[board_i][board_j];\n\t\t\t\t\tbreak;}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tint xdistPk = Math.abs(pawnPos[0] - bkPos[0]);\n\t\tint ydistPk = Math.abs(pawnPos[1] - bkPos[1]);\n\n\t\tif(xdistPk == ydistPk)\n\t\t\tanswerCount = answerCount+2;\n\t\tif(xdistPk==0)\n\t\t\tanswerCount++;\n\t\tif(ydistPk ==0)\n\t\t\tanswerCount++;\n\t\tif((xdistPk == 2 && ydistPk==1) || (xdistPk == 1 && ydistPk==2) )\n\t\t\tanswerCount++;\n\n\t\treturn answerCount;\n\n\t}", "public void startSinglePlayerGame() {\n\n Scanner scanner = new Scanner(System.in);\n\n while (true) {\n\n //show map.\n printMap();\n //show scoreboard.\n displayScoreBoard();\n\n System.out.println();\n System.out.println(\"Choose your cell :\");\n System.out.println(\"------------------\");\n System.out.println();\n\n //enter column.\n System.out.println(\"Column (from A-H) : \");\n String column = scanner.next();\n\n //enter row.\n System.out.println(\"Row (from 1-8) : \");\n int row = scanner.nextInt();\n\n //set player 1.\n setplayer1('●');\n\n //call move method.\n move(column.charAt(0), row);\n\n if (!gameOver()) {\n endGame();\n return;\n }\n String chars = \"ABCDEFGH\";\n\n //set player 2.\n setplayer1('◯');\n //find a random column and row.\n while (true) {\n Random random = new Random();\n int column3 = 0;\n char column2 = chars.charAt(random.nextInt(chars.length()));\n int row2 = random.nextInt(8);\n\n //change char to number.\n if (column2 == 'A') column3 = 0;\n if (column2 == 'B') column3 = 1;\n if (column2 == 'C') column3 = 2;\n if (column2 == 'D') column3 = 3;\n if (column2 == 'E') column3 = 4;\n if (column2 == 'F') column3 = 5;\n if (column2 == 'G') column3 = 6;\n if (column2 == 'H') column3 = 7;\n\n //check if the random block is allowed or not.\n if (isAllowedMove(row2, column3) && isBlockEmpty(row2, column3)) {\n System.out.println();\n System.out.println(\"Computer choosed cell in Column <\" + column2 + \"> and Row <\" + (row2 + 1) + \">\");\n System.out.println();\n move(column2, row2 + 1);\n break;\n }\n }\n //check end game.\n if (!gameOver()) {\n System.out.println();\n printMap();\n displayScoreBoard();\n endGame();\n return;\n }\n }\n\n }", "private boolean checkIfGameIsWon() {\n\n //loop through rows\n for(int i = 0; i < NUMBER_OF_ROWS; i++) {\n //gameIsWon = this.quartoBoard.checkRow(i);\n if (this.quartoBoard.checkRow(i)) {\n System.out.println(\"Win via row: \" + (i) + \" (zero-indexed)\");\n return true;\n }\n\n }\n //loop through columns\n for(int i = 0; i < NUMBER_OF_COLUMNS; i++) {\n //gameIsWon = this.quartoBoard.checkColumn(i);\n if (this.quartoBoard.checkColumn(i)) {\n System.out.println(\"Win via column: \" + (i) + \" (zero-indexed)\");\n return true;\n }\n\n }\n\n //check Diagonals\n if (this.quartoBoard.checkDiagonals()) {\n System.out.println(\"Win via diagonal\");\n return true;\n }\n\n return false;\n }", "private boolean isWinner(byte player) {\n for (int row = 0; row <= 2; row++) {\n if (board[row][0] == player && board[row][1] == player && board[row][2] == player) {\n return true;\n }\n }\n for (int column = 0; column <= 2; column++) {\n if (board[0][column] == player && board[1][column] == player && board[2][column] == player) {\n return true;\n }\n }\n if (board[0][0] == player && board[1][1] == player && board[2][2] == player) {\n return true;\n } else if (board[0][2] == player && board[1][1] == player && board[2][0] == player) {\n return true;\n } else {\n return false;\n }\n }", "public CellSigns gameWinner(){\n for (int i = 0; i < size; i++) {\n var firstSign = gameField[i][0].getCurrentSign();\n int j;\n for (j = 1; j < size; j++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(j == size)\n return firstSign;\n }\n\n //Check vertical lines\n for (int j = 0; j < size; j++) {\n var firstSign = gameField[0][j].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n var currentSign = gameField[i][j].getCurrentSign();\n if(firstSign !=currentSign)\n break;\n }\n if(i == size)\n return firstSign;\n }\n\n //Check diagonal lines\n\n var mainDiagonalSign = gameField[0][0].getCurrentSign();\n int i;\n for (i = 1; i < size; i++) {\n if(mainDiagonalSign != gameField[i][i].getCurrentSign())\n break;\n }\n if(i == size)\n return mainDiagonalSign;\n\n var secondaryDiagonalSign = gameField[0][size-1].getCurrentSign();\n for (i = 1; i < size; i++) {\n if(secondaryDiagonalSign!= gameField[i][size-1-i].getCurrentSign())\n break;\n }\n if(i==size)\n return secondaryDiagonalSign;\n\n //No winner\n return CellSigns.EMPTY;\n }" ]
[ "0.7284139", "0.7104654", "0.6932534", "0.68327767", "0.6809983", "0.6788454", "0.6765939", "0.65822726", "0.65763813", "0.65308684", "0.6508098", "0.6497964", "0.6475624", "0.6444424", "0.641199", "0.6384879", "0.63818955", "0.6364739", "0.6362011", "0.63601094", "0.6342892", "0.63273895", "0.63072467", "0.6274136", "0.6261048", "0.62606627", "0.6258372", "0.62547123", "0.6233357", "0.6231753", "0.62264216", "0.62256217", "0.6213752", "0.62065387", "0.6194892", "0.61773026", "0.61647505", "0.61605203", "0.6154531", "0.6141077", "0.6138337", "0.6105174", "0.60999334", "0.60959876", "0.6088571", "0.6086185", "0.60787964", "0.60702014", "0.6058826", "0.6057384", "0.60451883", "0.6043893", "0.6039497", "0.60349953", "0.60240316", "0.60239774", "0.60231435", "0.60179937", "0.6014094", "0.6003666", "0.6000746", "0.599667", "0.5994311", "0.59888583", "0.59872055", "0.5986901", "0.59853065", "0.5982986", "0.5981189", "0.5968709", "0.59596604", "0.59538823", "0.5935335", "0.5934348", "0.59335047", "0.5928541", "0.59279674", "0.5927595", "0.5927577", "0.5925626", "0.5918123", "0.5915313", "0.5912369", "0.5909203", "0.5905796", "0.5902308", "0.5901622", "0.5898077", "0.58875227", "0.58724713", "0.5866459", "0.58597356", "0.58580863", "0.5845895", "0.5842098", "0.58353966", "0.58236015", "0.5817972", "0.5817772", "0.5817714", "0.58175415" ]
0.0
-1
TODO Autogenerated method stub
@Override public void keyPressed() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
For wildcard or type variable, the first bound determines the runtime type.
public final Class<? super T> getRawType() { Class<?> rawType = getRawTypes().iterator().next(); @SuppressWarnings("unchecked") // raw type is |T| Class<? super T> result = (Class<? super T>) rawType; return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\r\n public void testParameterizedTypeWithWildcardWithTypeVariableBound()\r\n {\r\n Type typeVariable = Types.createTypeVariable(\"E\");\r\n Type wildcardType = Types.createWildcardType(\r\n null, new Type[]{typeVariable});\r\n Type parameterizedType = \r\n Types.createParameterizedType(List.class, null, wildcardType);\r\n test(parameterizedType);\r\n }", "@Override\n public boolean isLowerBound(Type argType, Substitution<ReferenceType> subst) {\n ReferenceType boundType = this.boundType.apply(subst);\n if (boundType.equals(JavaTypes.NULL_TYPE)) {\n return true;\n }\n if (argType.isParameterized()) {\n if (!(boundType instanceof ClassOrInterfaceType)) {\n return false;\n }\n InstantiatedType argClassType = (InstantiatedType) argType.applyCaptureConversion();\n InstantiatedType boundSuperType =\n ((ClassOrInterfaceType) boundType)\n .getMatchingSupertype(argClassType.getGenericClassType());\n if (boundSuperType == null) {\n return false;\n }\n boundSuperType = boundSuperType.applyCaptureConversion();\n return boundSuperType.isInstantiationOf(argClassType);\n }\n return boundType.isSubtypeOf(argType);\n }", "@Override\r\n\tpublic TypeBinding literalType(BlockScope scope) {\n\t\treturn null;\r\n\t}", "static Object resolveGeneric (FXLocal.Context context, Type typ) {\n if (typ instanceof ParameterizedType) {\n ParameterizedType ptyp = (ParameterizedType) typ;\n Type raw = ptyp.getRawType();\n Type[] targs = ptyp.getActualTypeArguments();\n if (raw instanceof Class) {\n String rawName = ((Class) raw).getName();\n if (FXClassType.SEQUENCE_CLASSNAME.equals(rawName) &&\n targs.length == 1) {\n return new FXSequenceType(context.makeTypeRef(targs[0]));\n }\n if (FXClassType.OBJECT_VARIABLE_CLASSNAME.equals(rawName) &&\n targs.length == 1) {\n return context.makeTypeRef(targs[0]);\n }\n if (FXClassType.SEQUENCE_VARIABLE_CLASSNAME.equals(rawName) &&\n targs.length == 1) {\n return new FXSequenceType(context.makeTypeRef(targs[0]));\n }\n if (rawName.startsWith(FXClassType.FUNCTION_CLASSNAME_PREFIX)) {\n FXType[] prtypes = new FXType[targs.length-1];\n for (int i = prtypes.length; --i >= 0; )\n prtypes[i] = context.makeTypeRef(targs[i+1]);\n FXType rettype;\n if (targs[0] == java.lang.Void.class)\n rettype = FXPrimitiveType.voidType;\n else\n rettype = context.makeTypeRef(targs[0]);\n return new FXFunctionType(prtypes, rettype);\n }\n }\n \n typ = raw;\n }\n if (typ instanceof WildcardType) {\n WildcardType wtyp = (WildcardType) typ;\n Type[] upper = wtyp.getUpperBounds();\n Type[] lower = wtyp.getLowerBounds();\n typ = lower.length > 0 ? lower[0] : wtyp.getUpperBounds()[0];\n if (typ instanceof Class) {\n String rawName = ((Class) typ).getName();\n // Kludge, because generics don't handle primitive types.\n FXType ptype = context.getPrimitiveType(rawName);\n if (ptype != null)\n return ptype;\n }\n return context.makeTypeRef(typ);\n }\n if (typ instanceof GenericArrayType) {\n FXType elType = context.makeTypeRef(((GenericArrayType) typ).getGenericComponentType());\n return new FXJavaArrayType(elType);\n }\n if (typ instanceof TypeVariable) {\n // KLUDGE\n typ = Object.class;\n }\n return typ;\n }", "public abstract Binding getCommonType(Binding b);", "public TypeBinding resolveType(ClassScope scope) {\n\tthis.constant = Constant.NotAConstant;\n\tif (this.resolvedType != null) // is a shared type reference which was already resolved\n\t\treturn this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error\n\n\tTypeBinding type = this.resolvedType = getTypeBinding(scope);\n\tif (this.resolvedType == null)\n\t\treturn null; // detected cycle while resolving hierarchy\t\n\tif (!this.resolvedType.isValidBinding()) {\n\t\treportInvalidType(scope);\n\t\treturn null;\n\t}\n\tif (isTypeUseDeprecated(this.resolvedType, scope))\n\t\treportDeprecatedType(scope);\n\ttype = scope.environment().convertToRawType(type);\n\tif (type.isRawType() \n\t\t\t&& (this.bits & IgnoreRawTypeCheck) == 0 \n\t\t\t&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {\n\t\tscope.problemReporter().rawTypeReference((/*@OwnPar*/ /*@NoRep*/ TypeReference)this, type);\n\t}\t\t\t\n\treturn this.resolvedType = type;\t\n}", "public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {\n\tthis.constant = Constant.NotAConstant;\n\tif (this.resolvedType != null) // is a shared type reference which was already resolved\n\t\treturn this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error\n\n\tTypeBinding type = this.resolvedType = getTypeBinding(scope);\n\tif (this.resolvedType == null)\n\t\treturn null; // detected cycle while resolving hierarchy\t\n\tif (!this.resolvedType.isValidBinding()) {\n\t\treportInvalidType(scope);\n\t\treturn null;\n\t}\n\tif (isTypeUseDeprecated(this.resolvedType, scope))\n\t\treportDeprecatedType(scope);\n\ttype = scope.environment().convertToRawType(type);\n\tif (type.isRawType() \n\t\t\t&& (this.bits & IgnoreRawTypeCheck) == 0 \n\t\t\t&& scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {\t\n\t\tscope.problemReporter().rawTypeReference((/*@OwnPar*/ /*@NoRep*/ TypeReference)this, type);\n\t}\t\t\t\n\treturn this.resolvedType = type;\n}", "private Type adaptBoundRecursively(Type bound, Adaptation previous) {\n\t\tif (bound.isLinkedToFormalType()) {\n\t\t\tint pos = bound.getFormalType().getPosition();\n\t\t\treturn previous.get(pos);\n\t\t}\n\n\t\tif (bound.isGeneric()) {\n\t\t\t// build a new type definition\n\t\t\tType adaptedBound = new Type(bound.getName(), bound.getIntro());\n\n\t\t\tfor (Type gt : bound.getGenericTypes()) {\n\t\t\t\t// Adapt generic type and replace formal types by previous\n\t\t\t\t// adaptation\n\t\t\t\tType adaptedGt = adaptBoundRecursively(gt, previous);\n\t\t\t\tadaptedBound.addGenericType(adaptedGt);\n\t\t\t}\n\t\t\treturn adaptedBound;\n\t\t}\n\t\treturn bound;\n\t}", "@Override\n public boolean isUpperBound(Type argType, Substitution<ReferenceType> subst) {\n ReferenceType boundType = this.boundType.apply(subst);\n if (boundType.equals(JavaTypes.OBJECT_TYPE)) {\n return true;\n }\n if (boundType.isParameterized()) {\n if (!(argType instanceof ClassOrInterfaceType)) {\n return false;\n }\n InstantiatedType boundClassType = (InstantiatedType) boundType.applyCaptureConversion();\n InstantiatedType argSuperType =\n ((ClassOrInterfaceType) argType)\n .getMatchingSupertype(boundClassType.getGenericClassType());\n if (argSuperType == null) {\n return false;\n }\n argSuperType = argSuperType.applyCaptureConversion();\n return argSuperType.isInstantiationOf(boundClassType);\n }\n return argType.isSubtypeOf(boundType);\n }", "@Override\r\n\tpublic Node visitVarType(VarTypeContext ctx) {\n\t\treturn super.visitVarType(ctx);\r\n\t}", "public abstract TypeBindings bindingsForBeanType();", "public TypeBinding resolveSuperType(ClassScope scope) {\n\tif (resolveType(scope) == null) return null;\n\n\tif (this.resolvedType.isTypeVariable()) {\n\t\tthis.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding) this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);\n\t\treportInvalidType(scope);\n\t\treturn null;\n\t}\n\treturn this.resolvedType;\n}", "Type<?> get(String name);", "public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex) {\n/* 241 */ return new TypeReference(sort << 24 | paramIndex << 16 | boundIndex << 8);\n/* */ }", "public abstract Type getSpecializedType(Type type);", "public VarTypeNative getFieldVarType();", "private void internalResolve(Scope scope, boolean staticContext) {\n\t\tif (this.binding != null) {\n\t\t\tBinding existingType = scope.parent.getBinding(this.name, Binding.TYPE, (/*@OwnPar*/ /*@NoRep*/ TypeParameter)this, false);\n\t\t\tif (existingType != null \n\t\t\t\t\t&& this.binding != existingType \n\t\t\t\t\t&& existingType.isValidBinding()\n\t\t\t\t\t&& (existingType.kind() != Binding.TYPE_PARAMETER || !staticContext)) {\n\t\t\t\tscope.problemReporter().typeHiding((/*@OwnPar*/ /*@NoRep*/ TypeParameter)this, existingType);\n\t\t\t}\n\t\t}\n\t}", "public final void typeBound() throws RecognitionException {\n int typeBound_StartIndex = input.index();\n try { dbg.enterRule(getGrammarFileName(), \"typeBound\");\n if ( getRuleLevel()==0 ) {dbg.commence();}\n incRuleLevel();\n dbg.location(241, 1);\n\n try {\n if ( state.backtracking>0 && alreadyParsedRule(input, 13) ) { return ; }\n // Java.g:242:5: ( type ( '&' type )* )\n dbg.enterAlt(1);\n\n // Java.g:242:9: type ( '&' type )*\n {\n dbg.location(242,9);\n pushFollow(FOLLOW_type_in_typeBound580);\n type();\n\n state._fsp--;\n if (state.failed) return ;\n dbg.location(242,14);\n // Java.g:242:14: ( '&' type )*\n try { dbg.enterSubRule(22);\n\n loop22:\n do {\n int alt22=2;\n try { dbg.enterDecision(22);\n\n int LA22_0 = input.LA(1);\n\n if ( (LA22_0==43) ) {\n alt22=1;\n }\n\n\n } finally {dbg.exitDecision(22);}\n\n switch (alt22) {\n \tcase 1 :\n \t dbg.enterAlt(1);\n\n \t // Java.g:242:15: '&' type\n \t {\n \t dbg.location(242,15);\n \t match(input,43,FOLLOW_43_in_typeBound583); if (state.failed) return ;\n \t dbg.location(242,19);\n \t pushFollow(FOLLOW_type_in_typeBound585);\n \t type();\n\n \t state._fsp--;\n \t if (state.failed) return ;\n\n \t }\n \t break;\n\n \tdefault :\n \t break loop22;\n }\n } while (true);\n } finally {dbg.exitSubRule(22);}\n\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n if ( state.backtracking>0 ) { memoize(input, 13, typeBound_StartIndex); }\n }\n dbg.location(243, 5);\n\n }\n finally {\n dbg.exitRule(getGrammarFileName(), \"typeBound\");\n decRuleLevel();\n if ( getRuleLevel()==0 ) {dbg.terminate();}\n }\n\n return ;\n }", "@Override\n\tpublic void visit(NumericBind arg0) {\n\t\t\n\t}", "private static boolean matchParameter(IType type, @NotNull PsiType candidate, @NotNull Map<String, IType> typeVarMap, @Nullable PsiSubstitutor substitutor, boolean isStatic) {\n boolean result = false;\n\n if (type instanceof IMetaType) {\n type = ((IMetaType) type).getType();\n }\n\n IType basicPattern = type.isParameterizedType() ? type.getGenericType() : type;\n String patternName = basicPattern.getName();\n IType candidateType;\n\n if( candidate instanceof PsiEllipsisType ) {\n candidate = ((PsiEllipsisType)candidate).toArrayType();\n }\n\n if( candidate instanceof PsiArrayType && type.isArray() ) {\n return matchParameter( type.getComponentType(), ((PsiArrayType)candidate).getComponentType(), typeVarMap, substitutor, isStatic );\n }\n\n if (candidate instanceof PsiClassType) {\n PsiClassType candidateAsPsiClass = (PsiClassType) candidate;\n PsiClass resolvedCandidate = candidateAsPsiClass.resolve();\n String candidateName;\n if (resolvedCandidate != null) {\n if (resolvedCandidate instanceof PsiTypeParameter && substitutor != null) {\n resolvedCandidate = maybeSubstituteType(resolvedCandidate, substitutor);\n if (isStatic) {\n resolvedCandidate = stripToBoundingType((PsiTypeParameter) resolvedCandidate);\n }\n }\n if (resolvedCandidate instanceof PsiTypeParameter) {\n candidateName = resolvedCandidate.getName();\n } else {\n candidateName = resolvedCandidate.getQualifiedName();\n }\n } else {\n candidateName = candidate.getCanonicalText();\n }\n candidateType = typeVarMap.get(candidateName);\n if (candidateType != null) {\n result = type.equals(candidateType);\n }\n if( !result ) {\n result = candidateName.equals(patternName);\n if (result) {\n if( type instanceof ITypeVariableType && resolvedCandidate instanceof PsiTypeParameter ) {\n PsiClassType boundingType = JavaPsiFacadeUtil.getElementFactory( resolvedCandidate.getProject() ).createType( stripToBoundingType( (PsiTypeParameter)resolvedCandidate ) );\n result = matchParameter( TypeLord.getPureGenericType( ((ITypeVariableType)type).getBoundingType() ), boundingType, typeVarMap, substitutor, isStatic ) ||\n matchParameter( ((ITypeVariableType)type).getBoundingType(), boundingType, typeVarMap, substitutor, isStatic );\n }\n else {\n PsiType[] candidateTypeParams = candidateAsPsiClass.getParameters();\n IType[] patternTypeParams = type.getTypeParameters();\n int candidateTypeParamLength = candidateTypeParams != null ? candidateTypeParams.length : 0;\n int patternTypeParamLength = patternTypeParams != null ? patternTypeParams.length : 0;\n if (patternTypeParamLength == candidateTypeParamLength) {\n for (int i = 0; i < patternTypeParamLength; i++) {\n if (!matchParameter(patternTypeParams[i], candidateTypeParams[i], typeVarMap, substitutor, isStatic)) {\n result = false;\n break;\n }\n }\n } else {\n result = false;\n }\n }\n }\n }\n } else {\n PsiType unboundedCandidate = removeBounds(candidate);\n candidateType = typeVarMap.get(unboundedCandidate.getCanonicalText());\n if (candidateType != null) {\n result = type.equals(candidateType);\n } else {\n result = unboundedCandidate.equalsToText(patternName);\n }\n }\n if (!result && type instanceof IShadowingType) {\n return matchShadowedTypes((IShadowingType) type, candidate, typeVarMap, substitutor, isStatic);\n }\n return result;\n }", "private String resolveRawTypeName(String typeName) {\n\t\tif (typeName == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\tboolean isArray = typeName.startsWith(StringPool.LEFT_SQ_BRACKET);\n\t\tif (isArray) {\n\t\t\ttypeName = typeName.substring(1);\n\t\t}\n\n\t\tString rawTypeName;\n\n\t\tif (generics.containsKey(typeName)) {\n\t\t\trawTypeName = generics.get(typeName);\n\t\t}\n\t\telse {\n\t\t\trawTypeName = targetClassInfo.getGenerics().getOrDefault(typeName, typeName);\n\t\t}\n\n\t\tif (isArray) {\n\t\t\trawTypeName = '[' + rawTypeName;\n\t\t}\n\n\t\treturn rawTypeName;\n\t}", "@Override\n public String visit(WildcardType n, Object arg) {\n return null;\n }", "public interface n {\n void a(au<?> auVar);\n}", "public abstract TypeLiteral<?> toTypeLiteral(Type type);", "Binding<T> withAnyQualifier();", "public abstract BoundType a();", "ReferenceBound(ReferenceType boundType) {\n this.boundType = boundType;\n }", "public interface Binding {\n\n /**\n * Get the declared type of the variable\n * @return the declared type\n */\n\n public SequenceType getRequiredType();\n\n /**\n * Evaluate the variable\n * @param context the XPath dynamic evaluation context\n * @return the result of evaluating the variable\n */\n\n public ValueRepresentation evaluateVariable(XPathContext context) throws XPathException;\n\n /**\n * Indicate whether the binding is local or global. A global binding is one that has a fixed\n * value for the life of a query or transformation; any other binding is local.\n * @return true if the binding is global\n */\n\n public boolean isGlobal();\n\n /**\n * If this is a local variable held on the local stack frame, return the corresponding slot number.\n * In other cases, return -1.\n * @return the slot number on the local stack frame\n */\n\n public int getLocalSlotNumber();\n\n /**\n * Get the name of the variable\n * @return the name of the variable, as a structured QName\n */\n\n public StructuredQName getVariableQName();\n\n}", "public void setAnyType(java.lang.Object param) {\n this.localAnyType = param;\n }", "public Binding getGenericType(List<Binding> types) {\r\n assert types == types;\r\n return null;\r\n }", "public final void typeParameter() throws RecognitionException {\n int typeParameter_StartIndex = input.index();\n try { dbg.enterRule(getGrammarFileName(), \"typeParameter\");\n if ( getRuleLevel()==0 ) {dbg.commence();}\n incRuleLevel();\n dbg.location(237, 1);\n\n try {\n if ( state.backtracking>0 && alreadyParsedRule(input, 12) ) { return ; }\n // Java.g:238:5: ( Identifier ( 'extends' typeBound )? )\n dbg.enterAlt(1);\n\n // Java.g:238:9: Identifier ( 'extends' typeBound )?\n {\n dbg.location(238,9);\n match(input,Identifier,FOLLOW_Identifier_in_typeParameter546); if (state.failed) return ;\n dbg.location(238,20);\n // Java.g:238:20: ( 'extends' typeBound )?\n int alt21=2;\n try { dbg.enterSubRule(21);\n try { dbg.enterDecision(21);\n\n int LA21_0 = input.LA(1);\n\n if ( (LA21_0==38) ) {\n alt21=1;\n }\n } finally {dbg.exitDecision(21);}\n\n switch (alt21) {\n case 1 :\n dbg.enterAlt(1);\n\n // Java.g:238:21: 'extends' typeBound\n {\n dbg.location(238,21);\n match(input,38,FOLLOW_38_in_typeParameter549); if (state.failed) return ;\n dbg.location(238,31);\n pushFollow(FOLLOW_typeBound_in_typeParameter551);\n typeBound();\n\n state._fsp--;\n if (state.failed) return ;\n\n }\n break;\n\n }\n } finally {dbg.exitSubRule(21);}\n\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n if ( state.backtracking>0 ) { memoize(input, 12, typeParameter_StartIndex); }\n }\n dbg.location(239, 5);\n\n }\n finally {\n dbg.exitRule(getGrammarFileName(), \"typeParameter\");\n decRuleLevel();\n if ( getRuleLevel()==0 ) {dbg.terminate();}\n }\n\n return ;\n }", "public interface MagicType extends Type {\n\n\t/**\n\t * Given that we are a type specified in a replacement rule (e.g. a Var or\n\t * Atom), can we consume a submatch of the given type in the match?\n\t *\n\t * Alternatively, we could have overriden .equals().\n\t */\n\tboolean replacementfor(Type o);\n}", "public T caseType(Type object) {\r\n\t\treturn null;\r\n\t}", "public T caseType(Type object) {\n\t\treturn null;\n\t}", "public String TypeOf(String name) {\n\t\tValues tmp = currScope.get(name);\n\t\t\n\t\tif(tmp != null)\n\t\t\treturn tmp.getType();\n\t\t\n\t\tif(currScope != classScope) {\n\t\t\ttmp = classScope.get(name);\n\t\t\tif(tmp != null)\n\t\t\t\treturn tmp.getType();\n\t\t}\n\t\t\n\t\treturn null;\n\t}", "public T caseTypeAlias(TypeAlias object) {\r\n\t\treturn null;\r\n\t}", "public abstract BoundType b();", "public static boolean hasNoExplicitBound(final AnnotatedTypeMirror wildcard) {\n return ((Type.WildcardType) wildcard.getUnderlyingType()).isUnbound();\n }", "public ITypeBinding getType() {\n\t\treturn binding;\n\t}", "@Override\n\tpublic ValueList caseATypeBind(ATypeBind bind, ObjectContext ctxt)\n\t\t\tthrows AnalysisException\n\t{\n\t\treturn new ValueList();\n\t}", "public void any_type() {\n if (var_type()) {\n return;\n }\n if (lexer.token != Symbol.VOID) {\n error.signal(\"Wrong type\");\n }\n lexer.nextToken();\n }", "private static String type(String arg) {\n if ( arg.contains(\".\") )\n return \"ip\";\n try {\n Integer.parseInt(arg);\n return \"port\";\n } catch (NumberFormatException ignored) {\n return arg;\n }\n }", "public T caseTypeParameter(TypeParameter object) {\n\t\treturn null;\n\t}", "private String getSqLiteType(Class<?> value){\r\n\t\tString sn = value.getSimpleName();\r\n\t\tif(sn.equalsIgnoreCase(\"String\"))\r\n\t\t\treturn \"text\";\r\n\t\tif(sn.equalsIgnoreCase(\"int\") || sn.equalsIgnoreCase(\"Integer\") || \r\n\t\t sn.equalsIgnoreCase(\"long\") || sn.equalsIgnoreCase(\"Long\") || \r\n\t\t sn.equalsIgnoreCase(\"BigDecimal\")){\r\n\t\t\treturn \"integer\";\r\n\t\t}\r\n\t\tif(sn.equalsIgnoreCase(\"double\") || sn.equalsIgnoreCase(\"Double\") || \r\n\t\t sn.equalsIgnoreCase(\"float\") || sn.equalsIgnoreCase(\"Float\")){\r\n\t\t\treturn \"integer\";\r\n\t\t}\r\n\t\tif(sn.equalsIgnoreCase(\"byte[]\") || sn.equalsIgnoreCase(\"Byte[]\")){\r\n\t\t\treturn \"blob\";\r\n\t\t}\r\n\t\tthrow new NullPointerException(\"type not found \" + sn);\r\n\t}", "public Parameter getTypeParameter(StratmasObject object)\n {\n // Find youngest base type with a mapping\n for (Type walker = object.getType(); \n walker != null; walker = walker.getBaseType()) {\n ParameterFactory parameterFactory = (ParameterFactory) getTypeMapping().get(walker);\n if (parameterFactory != null) {\n return parameterFactory.getParameter(object);\n }\n }\n\n return null;\n }", "public T caseDatatype(Datatype object)\n {\n return null;\n }", "private boolean checkForType(IfStmt ifStmt, FieldDeclaration compareVariable) {\n boolean isOfType = false;\n BinaryExpr ifAsBinary = ifStmt.getCondition().asBinaryExpr();\n String comparedTypeName = compareVariable.getVariables().get(0).getNameAsString();\n if (!ifAsBinary.getLeft().isNullLiteralExpr()) {\n isOfType |= ifAsBinary.getLeft().asNameExpr().getNameAsString().equals(\n comparedTypeName);\n }\n if (!ifAsBinary.getRight().isNullLiteralExpr()) {\n isOfType |= ifAsBinary.getRight().asNameExpr().getNameAsString().equals(\n comparedTypeName);\n }\n return isOfType;\n }", "protected <T> T getValue(String key, T defaultVal, Bound<? extends Number> bound) {\r\n return getValue(key, null, defaultVal, bound);\r\n }", "public static boolean isUnboundedOrSuperBounded(final AnnotatedWildcardType wildcardType) {\n return ((Type.WildcardType) wildcardType.getUnderlyingType()).isSuperBound();\n }", "public void addLowerConstraint(String type) {\n\t\tfinal JvmLowerBound constraint = this.jvmTypesFactory.createJvmLowerBound();\n\t\tconstraint.setTypeReference(newTypeRef(this.context, type));\n\t\tgetJvmTypeParameter().getConstraints().add(constraint);\n\t}", "private void checkTypes(Variable first, Variable second) throws OutmatchingParameterType {\n VariableVerifier.VerifiedTypes firstType = first.getType();\n VariableVerifier.VerifiedTypes secondType = second.getType();\n\n if (!firstType.equals(secondType)) {\n throw new OutmatchingParameterType();\n }\n }", "@Generated(value={\"edu.jhu.cs.bsj.compiler.utils.generator.SourceGenerator\"})\npublic interface TypeParameterNode extends Node, TypeNameBindingNode\n{\n /**\n * Gets the base type name for the parameter.\n * @return The base type name for the parameter.\n * @throws ClassCastException If the value of this property is a special node.\n */\n public IdentifierNode getIdentifier()throws ClassCastException;\n \n /**\n * Gets the union object for the base type name for the parameter.\n * @return A union object representing The base type name for the parameter.\n */\n public NodeUnion<? extends IdentifierNode> getUnionForIdentifier();\n \n /**\n * Changes the base type name for the parameter.\n * @param identifier The base type name for the parameter.\n */\n public void setIdentifier(IdentifierNode identifier);\n \n /**\n * Changes the base type name for the parameter.\n * @param identifier The base type name for the parameter.\n * @throws NullPointerException If the provided value is <code>null</code>.\n * Node union values may have <code>null</code>\n * contents but are never <code>null</code>\n * themselves.\n */\n public void setUnionForIdentifier(NodeUnion<? extends IdentifierNode> identifier) throws NullPointerException;\n \n /**\n * Gets the bounds over the base type.\n * @return The bounds over the base type.\n * @throws ClassCastException If the value of this property is a special node.\n */\n public DeclaredTypeListNode getBounds()throws ClassCastException;\n \n /**\n * Gets the union object for the bounds over the base type.\n * @return A union object representing The bounds over the base type.\n */\n public NodeUnion<? extends DeclaredTypeListNode> getUnionForBounds();\n \n /**\n * Changes the bounds over the base type.\n * @param bounds The bounds over the base type.\n */\n public void setBounds(DeclaredTypeListNode bounds);\n \n /**\n * Changes the bounds over the base type.\n * @param bounds The bounds over the base type.\n * @throws NullPointerException If the provided value is <code>null</code>.\n * Node union values may have <code>null</code>\n * contents but are never <code>null</code>\n * themselves.\n */\n public void setUnionForBounds(NodeUnion<? extends DeclaredTypeListNode> bounds) throws NullPointerException;\n \n /**\n * Generates a deep copy of this node.\n * @param factory The node factory to use to create the deep copy.\n * @return The resulting deep copy node.\n */\n @Override\n public TypeParameterNode deepCopy(BsjNodeFactory factory);\n \n}", "Type_use getType_use();", "public static boolean hasExplicitSuperBound(final AnnotatedTypeMirror wildcard) {\n final Type.WildcardType wildcardType = (Type.WildcardType) wildcard.getUnderlyingType();\n return wildcardType.isSuperBound() && !((WildcardType) wildcard.getUnderlyingType()).isUnbound();\n }", "type getType();", "public abstract Type getGeneralizedType(Type type);", "private void createImplicitVariableType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {\n\t\tcreateImplicitVarValType(resource, acceptor, XtendVariableDeclaration.class,\n\t\t\tit -> it.getType(),\n\t\t\tit -> {\n\t\t\t\tLightweightTypeReference type = getLightweightType(it.getRight());\n\t\t\t\tif (type.isAny()) {\n\t\t\t\t\ttype = getTypeForVariableDeclaration(it.getRight());\n\t\t\t\t}\n\t\t\t\treturn type.getSimpleName();\n\t\t\t},\n\t\t\tit -> it.getRight(),\n\t\t\t() -> this.grammar.getXVariableDeclarationAccess().getRightAssignment_3_1());\n\t}", "public static void bindTypes(Binder binder) {\n //array converter\n binder.convertToTypes(new ArrayMatcher(String.class), STRING_ARRAY_CONVERTER);\n binder.convertToTypes(new ArrayMatcher(int.class), INT_ARRAY_CONVERTER);\n binder.convertToTypes(new ArrayMatcher(boolean.class), BOOLEAN_ARRAY_CONVERTER);\n binder.convertToTypes(new ArrayMatcher(double.class), DOUBLE_ARRAY_CONVERTER);\n //files\n binder.convertToTypes(new ClazzMatcher(File.class), new FileTypeConverter());\n //URL\n binder.convertToTypes(new ClazzMatcher(URL.class), new URLTypeConverter());\n //URI\n binder.convertToTypes(new ClazzMatcher(URI.class), new URITypeConverter());\n //DateFormat\n binder.convertToTypes(new ClazzMatcher(DateFormat.class), new DateFormatTypeConverter());\n //Date\n binder.convertToTypes(new ClazzMatcher(Date.class), new DateTypeConverter());\n }", "public String getVariableType(String key) {\n for (Map.Entry<PlainGraph, Map<String, PlainNode>> entry :graphNodeMap.entrySet()) {\n if (entry.getValue().containsKey(key)) {\n PlainNode node = entry.getValue().get(key);\n PlainEdge edge = entry.getKey().outEdgeSet(node).stream()\n .filter(e -> e.label().toString().contains(\"type:\"))\n .collect(Collectors.toList())\n .get(0);\n if (edge.label().toString().contains(SHARP_TYPE)) {\n return edge.label().toString().replace(String.format(\"%s:%s\",TYPE, SHARP_TYPE), \"\");\n } else {\n return edge.label().toString().replace(String.format(\"%s:\",TYPE), \"\");\n }\n }\n }\n // The variable key does not exist yet, it is only declared in the syntax tree\n return null;\n }", "private void computeSourceClass(JClassType type) {\n if (type == null || alreadyRan.contains(type)) {\n return;\n }\n \n alreadyRan.add(type);\n \n /*\n * IMPORTANT: Visit my supertype first. The implementation of\n * com.google.gwt.lang.Cast.wrapJSO() depends on all superclasses having\n * typeIds that are less than all their subclasses. This allows the same\n * JSO to be wrapped stronger but not weaker.\n */\n computeSourceClass(type.extnds);\n \n if (!program.typeOracle.isInstantiatedType(type)) {\n return;\n }\n \n // Find all possible query types which I can satisfy\n Set/* <JReferenceType> */yesSet = null;\n for (Iterator iter = queriedTypes.keySet().iterator(); iter.hasNext();) {\n JReferenceType qType = (JReferenceType) iter.next();\n Set/* <JReferenceType> */querySet = (Set) queriedTypes.get(qType);\n if (program.typeOracle.canTriviallyCast(type, qType)) {\n for (Iterator it = querySet.iterator(); it.hasNext();) {\n JReferenceType argType = (JReferenceType) it.next();\n if (program.typeOracle.canTriviallyCast(type, argType)) {\n if (yesSet == null) {\n yesSet = new HashSet/* <JReferenceType> */();\n }\n yesSet.add(qType);\n break;\n }\n }\n }\n }\n \n /*\n * Weird: JavaScriptObjects MUST have a typeId, the implementation of\n * Cast.wrapJSO depends on it.\n */\n if (yesSet == null && !program.isJavaScriptObject(type)) {\n return; // won't satisfy anything\n }\n \n // use an array to sort my yes set\n JReferenceType[] yesArray = new JReferenceType[nextQueryId];\n if (yesSet != null) {\n for (Iterator it = yesSet.iterator(); it.hasNext();) {\n JReferenceType yesType = (JReferenceType) it.next();\n Integer boxedInt = (Integer) queryIds.get(yesType);\n yesArray[boxedInt.intValue()] = yesType;\n }\n }\n \n // create a sparse lookup object\n JsonObject jsonObject = new JsonObject(program);\n for (int i = 0; i < nextQueryId; ++i) {\n if (yesArray[i] != null) {\n JIntLiteral labelExpr = program.getLiteralInt(i);\n JIntLiteral valueExpr = program.getLiteralInt(1);\n jsonObject.propInits.add(new JsonPropInit(program, labelExpr,\n valueExpr));\n }\n }\n \n // add an entry for me\n classes.add(type);\n jsonObjects.add(jsonObject);\n }", "private String getTypeVariableNamePrefix(String string)\r\n {\r\n string = string.trim();\r\n for (String typeVariableName : typeVariableNames)\r\n {\r\n if (string.equals(typeVariableName))\r\n {\r\n return typeVariableName;\r\n }\r\n if (string.startsWith(typeVariableName+\" \"))\r\n {\r\n return typeVariableName;\r\n }\r\n }\r\n return null;\r\n }", "@Test\n public void untypedLambda1() {\n DependentLink A = param(\"A\", Universe(0));\n Expression type = Pi(params(A, param(\"a\", Reference(A))), Nat());\n List<Binding> context = new ArrayList<>();\n context.add(new TypedBinding(\"f\", type));\n typeCheckExpr(context, \"\\\\lam x1 x2 => f x1 x2\", null);\n }", "public abstract int getBindingVariable();", "@Override\n\tpublic boolean visit(SimpleName node) {\n\t\tIBinding b = node.resolveBinding();\n\t\tif (b != null) {\n\t\t\tif (b instanceof IVariableBinding) {\n\t\t\t\tIVariableBinding vb = (IVariableBinding) b;\n\t\t\t\tITypeBinding tb = vb.getType();\n\t\t\t\tif (tb != null) {\n\t\t\t\t\ttb = tb.getTypeDeclaration();\n\t\t\t\t\tif (tb.isLocal() || tb.getQualifiedName().isEmpty())\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tthis.fullTokens.append(\" \" + getQualifiedName(tb) + \" \");\n\t\t\t\t\tthis.partialTokens.append(\" \" + getName(tb) + \" \");\n\t\t\t\t}\n\t\t\t} else if (b instanceof ITypeBinding) {\n\t\t\t\tITypeBinding tb = (ITypeBinding) b;\n\t\t\t\ttb = tb.getTypeDeclaration();\n\t\t\t\tif (tb.isLocal() || tb.getQualifiedName().isEmpty())\n\t\t\t\t\treturn false;\n\t\t\t\tthis.fullTokens.append(\" \" + getQualifiedName(tb) + \" \");\n\t\t\t\tthis.partialTokens.append(\" \" + getName(tb) + \" \");\n\t\t\t}\n\t\t} else {\n\t\t\tthis.fullTokens.append(\" \" + node.getIdentifier() + \" \");\n\t\t\tthis.partialTokens.append(\" \" + node.getIdentifier() + \" \");\n\t\t}\n\t\treturn false;\n\t}", "public default Type lowerBound() throws LookupException {\n return this;\n }", "public abstract JavaType resolveType(java.lang.reflect.Type jdkType);", "public int getTypeParameterBoundIndex() {\n/* 377 */ return (this.value & 0xFF00) >> 8;\n/* */ }", "public TypeMirror newTypeMirror(Binding binding) {\n switch(binding.kind()) {\n case Binding.FIELD:\n case Binding.LOCAL:\n case Binding.VARIABLE:\n // For variables, return the type of the variable\n return newTypeMirror(((VariableBinding) binding).type);\n case Binding.PACKAGE:\n return getNoType(TypeKind.PACKAGE);\n case Binding.IMPORT:\n //$NON-NLS-1$\n throw new UnsupportedOperationException(\"NYI: import type \" + binding.kind());\n case Binding.METHOD:\n return new ExecutableTypeImpl(_env, (MethodBinding) binding);\n case Binding.TYPE:\n case Binding.RAW_TYPE:\n case Binding.GENERIC_TYPE:\n case Binding.PARAMETERIZED_TYPE:\n ReferenceBinding referenceBinding = (ReferenceBinding) binding;\n if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {\n return getErrorType(referenceBinding);\n }\n return new DeclaredTypeImpl(_env, (ReferenceBinding) binding);\n case Binding.ARRAY_TYPE:\n return new ArrayTypeImpl(_env, (ArrayBinding) binding);\n case Binding.BASE_TYPE:\n BaseTypeBinding btb = (BaseTypeBinding) binding;\n switch(btb.id) {\n case TypeIds.T_void:\n return getNoType(TypeKind.VOID);\n case TypeIds.T_null:\n return getNullType();\n default:\n return getPrimitiveType(btb);\n }\n case Binding.WILDCARD_TYPE:\n case // TODO compatible, but shouldn't it really be an intersection type?\n Binding.INTERSECTION_TYPE:\n return new WildcardTypeImpl(_env, (WildcardBinding) binding);\n case Binding.TYPE_PARAMETER:\n return new TypeVariableImpl(_env, (TypeVariableBinding) binding);\n }\n return null;\n }", "public static boolean hasExplicitExtendsBound(final AnnotatedTypeMirror wildcard) {\n final Type.WildcardType wildcardType = (Type.WildcardType) wildcard.getUnderlyingType();\n return wildcardType.isExtendsBound() && !((WildcardType) wildcard.getUnderlyingType()).isUnbound();\n }", "Binding<T> fixed();", "public static boolean isExplicitlyExtendsBounded(final AnnotatedWildcardType wildcardType) {\n return ((Type.WildcardType) wildcardType.getUnderlyingType()).isExtendsBound() &&\n !((Type.WildcardType) wildcardType.getUnderlyingType()).isUnbound();\n }", "public static boolean isExplicitlySuperBounded(final AnnotatedWildcardType wildcardType) {\n return ((Type.WildcardType) wildcardType.getUnderlyingType()).isSuperBound() &&\n !((Type.WildcardType) wildcardType.getUnderlyingType()).isUnbound();\n }", "public abstract void mo24206b(@C5937f C12292n0<? super T> n0Var);", "@org.junit.Test(timeout = 10000)\n public void annotatedWildcardTypeNameWithExtends_cf27968() {\n java.lang.String expected = (\"? extends @\" + (com.squareup.javapoet.AmplAnnotatedTypeNameTest.NN)) + \" java.lang.String\";\n com.squareup.javapoet.TypeName type = com.squareup.javapoet.TypeName.get(java.lang.String.class).annotated(NEVER_NULL);\n java.lang.String actual = com.squareup.javapoet.WildcardTypeName.subtypeOf(type).toString();\n // AssertGenerator replace invocation\n boolean o_annotatedWildcardTypeNameWithExtends_cf27968__8 = // StatementAdderMethod cloned existing statement\n type.isBoxedPrimitive();\n // AssertGenerator add assertion\n org.junit.Assert.assertFalse(o_annotatedWildcardTypeNameWithExtends_cf27968__8);\n org.junit.Assert.assertEquals(expected, actual);\n }", "Binding<T> unqualified();", "public List<Ref<? extends Type>> typeVariables();", "InstrumentedType withTypeVariable(TypeVariableToken typeVariable);", "public final void rule__JvmWildcardTypeReference__ConstraintsAssignment_2_1() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \n try {\n // ../org.xtext.lwc.instances.ui/src-gen/org/xtext/lwc/instances/ui/contentassist/antlr/internal/InternalInstances.g:13567:1: ( ( ruleJvmLowerBound ) )\n // ../org.xtext.lwc.instances.ui/src-gen/org/xtext/lwc/instances/ui/contentassist/antlr/internal/InternalInstances.g:13568:1: ( ruleJvmLowerBound )\n {\n // ../org.xtext.lwc.instances.ui/src-gen/org/xtext/lwc/instances/ui/contentassist/antlr/internal/InternalInstances.g:13568:1: ( ruleJvmLowerBound )\n // ../org.xtext.lwc.instances.ui/src-gen/org/xtext/lwc/instances/ui/contentassist/antlr/internal/InternalInstances.g:13569:1: ruleJvmLowerBound\n {\n if ( state.backtracking==0 ) {\n before(grammarAccess.getJvmWildcardTypeReferenceAccess().getConstraintsJvmLowerBoundParserRuleCall_2_1_0()); \n }\n pushFollow(FOLLOW_ruleJvmLowerBound_in_rule__JvmWildcardTypeReference__ConstraintsAssignment_2_127272);\n ruleJvmLowerBound();\n\n state._fsp--;\n if (state.failed) return ;\n if ( state.backtracking==0 ) {\n after(grammarAccess.getJvmWildcardTypeReferenceAccess().getConstraintsJvmLowerBoundParserRuleCall_2_1_0()); \n }\n\n }\n\n\n }\n\n }\n catch (RecognitionException re) {\n reportError(re);\n recover(input,re);\n }\n finally {\n\n \trestoreStackSize(stackSize);\n\n }\n return ;\n }", "public void setchrtypVar(String value) {\n setNamedWhereClauseParam(\"chrtypVar\", value);\n }", "public static void main(String[] args) {\t\n\t\t// \"A wildcard parameterized type is not a concrete type that could appear in a new expression.\"\n\t\t// in https://howtodoinjava.com/java/generics/complete-java-generics-tutorial/\n\t\tList<Number> ls = new ArrayList<>(); //this is right \n\t\tList<? extends Number> ls2 = new ArrayList<Long>(); //this is also right, but now there is no inference typing in the new expression. You have to be explicit\n\t\tList<? extends Number> ls3 = new ArrayList<>(); //this is confusing. What is the type of this List?\n\t\t//List<Number> ls = new ArrayList<Integer>(); //this is wrong and will give a compile error\n\t\t\n\t\tInteger n = Integer.valueOf(20);\n\t\tDouble d = Double.valueOf(20.0);\n\t\tls.add(n);\n\t\tls.add(d);\n\t\t\n\t\tSystem.out.println(n instanceof Number);\n\t\tSystem.out.println(n instanceof Integer);\t\t\n\t\t\n\t\tList<Integer> li = Arrays.asList(1, 2, 3);\n\t\tSystem.out.println(\"sum = \" + sumOfList(li));\t\n\t}", "public T caseBinding(Binding object)\n {\n return null;\n }", "private @Nullable Type resolveType(@NotNull String typeName) {\n QnTypeRef typeRef = new QnTypeRef(Qn.fromDotSeparated(typeName));\n return (Type) typesResolver.resolve(typeRef);\n }", "public static boolean isUnboundedOrExtendsBounded(final AnnotatedWildcardType wildcardType) {\n return ((Type.WildcardType) wildcardType.getUnderlyingType()).isExtendsBound();\n }", "@Test\n public void testTypeOf() throws ValueDoesNotMatchTypeException {\n TestEvaluationContext context = new TestEvaluationContext();\n DecisionVariableDeclaration decl = new DecisionVariableDeclaration(\"x\", IntegerType.TYPE, null);\n ConstantValue c0 = new ConstantValue(ValueFactory.createValue(IntegerType.TYPE, 0));\n ConstraintSyntaxTree cst = new OCLFeatureCall(\n new Variable(decl), IntegerType.LESS_EQUALS_INTEGER_INTEGER.getName(), c0);\n EvaluationAccessor cValue = Utils.createValue(ConstraintType.TYPE, context, cst);\n Utils.testTypeOf(context, ConstraintType.TYPE_OF, cValue);\n cValue.release();\n }", "public static ParameterExpression variable(Class type) { throw Extensions.todo(); }", "static int type_of_inx(String passed){\n\t\treturn 1;\n\t}", "public void yAddBind(String bind_name, ObservableValue<? extends Number> bind);", "@SuppressWarnings(\"unchecked\")\r\n // we check type of defaultVal but compiler still complains about a cast to T\r\n protected <T> T getValue(Property prop, T defaultVal, Bound<? extends Number> bound) {\r\n checkInitialized();\r\n\r\n final @Nonnull Bound<? extends Number> realbound;\r\n if (bound != null) {\r\n realbound = bound;\r\n setBounds(prop, realbound);\r\n } else {\r\n realbound = Bound.MAX_BOUND;\r\n }\r\n\r\n addCommentDetails(prop, realbound);\r\n\r\n if (defaultVal instanceof Integer) {\r\n Bound<Integer> b = Bound.of(realbound.min.intValue(), realbound.max.intValue());\r\n return (T) boundValue(prop, b, (Integer) defaultVal);\r\n }\r\n if (defaultVal instanceof Float) {\r\n Bound<Float> b = Bound.of(realbound.min.floatValue(), realbound.max.floatValue());\r\n return (T) boundValue(prop, b, (Float) defaultVal);\r\n }\r\n if (defaultVal instanceof Double) {\r\n Bound<Double> b = Bound.of(realbound.min.doubleValue(), realbound.max.doubleValue());\r\n return (T) boundValue(prop, b, (Double) defaultVal);\r\n }\r\n if (defaultVal instanceof Boolean) {\r\n return (T) Boolean.valueOf(prop.getBoolean());\r\n }\r\n if (defaultVal instanceof int[]) {\r\n return (T) prop.getIntList();\r\n }\r\n if (defaultVal instanceof String) {\r\n return (T) prop.getString();\r\n }\r\n if (defaultVal instanceof String[]) {\r\n return (T) prop.getStringList();\r\n }\r\n\r\n throw new IllegalArgumentException(\"default value is not a config value type.\");\r\n }", "private static void a(Object param0, Class<?> param1) {\n }", "public MapExecutionScope bind(Type type, Object binding) {\n return bind(Key.get(type), binding);\n }", "@Ignore\n @Test\n public void untypedLambda2() {\n DependentLink A = param(\"A\", Universe(0));\n DependentLink params = params(A, param(\"B\", Pi(Reference(A), Universe(0))), param(\"a\", Reference(A)));\n Expression type = Pi(params, Apps(Reference(params.getNext()), Reference(params.getNext().getNext())));\n List<Binding> context = new ArrayList<>();\n context.add(new TypedBinding(\"f\", type));\n\n CheckTypeVisitor.Result result = typeCheckExpr(context, \"\\\\lam x1 x2 x3 => f x1 x2 x3\", null);\n assertEquals(type, result.type);\n }", "TypeDescription resolve(TypeDescription instrumentedType, TypeDescription.Generic parameterType);", "int getPlaceholderTypeValue();", "@Override\n\tpublic BasicType resolveCastTargetType(String name) {\n\t\torg.hibernate.type.BasicType ormBasicType = (org.hibernate.type.BasicType) sessionFactory.getTypeHelper().heuristicType( name );\n\t\tif ( ormBasicType == null ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn resolveBasicType( ormBasicType.getReturnedClass() );\n\t}", "@Override\r\n\t\tpublic final INamedElement resolveTypeForValueContext() {\n\t\t\treturn null;\r\n\t\t}", "BParameterTyping createBParameterTyping();", "public Type typeOf(Context ctxt, TypeEnv locals)\n throws Failure {\n TypeEnv te = ctxt.findVar(name, locals);\n loc = te.getLoc();\n return type = te.getType();\n }", "@Test\n void rawType_rawType() {\n var ref = new TypeRef<String>() {};\n assertEquals(String.class, ref.rawType());\n }", "public int getNumTypeBound() {\n return getTypeBoundList().getNumChild();\n }", "private void resolveSingularAttributeTypeInformation(SingularAttributeBinding attributeBinding) {\r\n if (attributeBinding.getHibernateTypeDescriptor().getResolvedTypeMapping() != null) {\r\n return;\r\n }\r\n // we can determine the Hibernate Type if either:\r\n // \t\t1) the user explicitly named a Type in a HibernateTypeDescriptor\r\n // \t\t2) we know the java type of the attribute\r\n Type resolvedType;\r\n resolvedType = determineSingularTypeFromDescriptor(attributeBinding.getHibernateTypeDescriptor());\r\n if (resolvedType == null) {\r\n if (!attributeBinding.getAttribute().isSingular()) {\r\n throw new AssertionFailure(\"SingularAttributeBinding object has a plural attribute: \" + attributeBinding.getAttribute().getName());\r\n }\r\n final SingularAttribute singularAttribute = (SingularAttribute) attributeBinding.getAttribute();\r\n if (singularAttribute.getSingularAttributeType() != null) {\r\n resolvedType = getHeuristicType(\r\n singularAttribute.getSingularAttributeType().getClassName(), new Properties()\r\n );\r\n }\r\n }\r\n if (resolvedType != null) {\r\n pushHibernateTypeInformationDownIfNeeded(attributeBinding, resolvedType);\r\n }\r\n }", "java.lang.String getType();" ]
[ "0.5873269", "0.58136857", "0.5732055", "0.55127215", "0.54531866", "0.5448836", "0.54032785", "0.5390001", "0.53781074", "0.5319641", "0.5310277", "0.5235763", "0.5187563", "0.51568156", "0.51051575", "0.5082757", "0.50807315", "0.50397736", "0.49919072", "0.49791312", "0.4977188", "0.49359646", "0.4933283", "0.49245644", "0.4921908", "0.49112192", "0.4910811", "0.48992887", "0.48875064", "0.48803687", "0.48777726", "0.48659182", "0.48335245", "0.4832204", "0.48304772", "0.48300773", "0.48227623", "0.48215902", "0.48203138", "0.480668", "0.47835", "0.47834796", "0.47761077", "0.4766556", "0.47654963", "0.47625184", "0.47463617", "0.47451422", "0.4738246", "0.47346222", "0.47259247", "0.4724286", "0.4724234", "0.47209904", "0.47202492", "0.47149596", "0.47123328", "0.47112048", "0.47087353", "0.47068956", "0.4701691", "0.46923053", "0.46883872", "0.46859738", "0.46802682", "0.46674392", "0.46605617", "0.46504623", "0.46477214", "0.46432456", "0.46422663", "0.46265578", "0.4623436", "0.4622948", "0.4615512", "0.46128833", "0.46043956", "0.4592494", "0.45912027", "0.45897302", "0.45892036", "0.45805296", "0.45795736", "0.45664865", "0.4562557", "0.45551723", "0.45550722", "0.4549579", "0.4548771", "0.4548185", "0.45446745", "0.45445406", "0.45401323", "0.45371392", "0.45329133", "0.4532684", "0.4529869", "0.45272657", "0.45227683", "0.4515035", "0.45092133" ]
0.0
-1
TODO Autogenerated method stub
public static void main(String[] args) { List<String> x=getCompanyNames(); for(String y:x){ System.out.println(y); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
GET All User's Current Location
@RequestMapping(value = "/current_location/all", method = RequestMethod.GET) public ResponseEntity<List<CurrentLocation>> getAllFavoriteZones() { List<CurrentLocation> currentLocationList = currentLocationService.findAllCurrentLocation(); if(currentLocationList.isEmpty()){ return new ResponseEntity<List<CurrentLocation>>(HttpStatus.NO_CONTENT); } return new ResponseEntity<List<CurrentLocation>>(currentLocationList, HttpStatus.OK); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Location getUserLocation()\n {\n\n return userLocation;\n }", "public List<LocationInfo> getAllLocation() {\n return allLocation;\n }", "com.google.ads.googleads.v6.resources.UserLocationView getUserLocationView();", "Map<UUID, Optional<Location>> getAllCurrentLocations();", "public Location getCurrentLocation();", "private void getUserCurrentLocation()\n\t {\n\t NicerLocationManager locationMgr = new NicerLocationManager(this.getApplicationContext());\n\t if (locationMgr.isAnyLocationServicesAvailble())\n\t {\n\t Log.i(\"MAIN\",\"retrieving current location...\");\n\n\t // get current location\n\t locationMgr.getBestGuessLocation(1000,\n\t new NicerLocationListener() {\n\n\t @Override\n\t public void locationLoaded(final Location location)\n\t {\n\t // parse the current site forecast for users current\n\t // location in the background\n\t //LocationForecastSetup currentForecast = new LocationForecastSetup();\n\t //currentForecast.execute(location);\n\n\t // QLog.i(\"location loaded. finding nearest location...\");\n\t //\n\t // // find nearest weather location\n\t // Site nearestLocation =\n\t // Utils.findNearestSite(mApp, location);\n\t //\n\t // // insert the new current user location site\n\t // SitesProviderHelper.addSavedSite(mApp,\n\t // Long.valueOf(nearestLocation.getmSiteId()), true);\n\t //\n\t Log.i(\"MAIN\",\"location found \"+location.getLatitude()+\" \"+location.getLongitude());\n\t dS.lat=(float) location.getLatitude();\n\t dS.lon=(float) location.getLongitude();\n\t //TextView versionText = (TextView) findViewById(R.id.info_area_string);\n\t //versionText.setText(\"lat \" + location.getLatitude()+\" lon \"+location.getLongitude());\n\t \n\t //\n\t // /*\n\t // * add blank site if user has no saved sites. a blank site\n\t // * forecast is also added in the WeatherService class\n\t // * (runWeatherService method) to display correctly in the\n\t // * view pager.this is later removed when a user adds a\n\t // site\n\t // * and added again when user removes last site.\n\t // */\n\t // SitesProviderHelper.addBlankSavedSite(mApp);\n\t //\n\t // // re-order sites so current location is first\n\t // SitesProviderHelper.setSiteOrder(mApp,\n\t // nearestLocation.getmSiteId(), \"0\");\n\t // SitesProviderHelper.setSiteOrder(mApp,\n\t // Consts.BLANK_SITE_ID, \"1\");\n\n\t }\n\n\t @Override\n\t public void error()\n\t {\n\t // give option to change location settings or select a\n\t // location manually\n\t Log.e(\"MAIN\",\"Error finding best guess location\");\n dS.lat=0;\n dS.lon=0;\n if(once)\n {\n\t //promptSetLocationService(MainActivity.this);\n }\n once=false;\n\t }\n\n\t @Override\n\t public void onFinished()\n\t {\n\t //runUpdateService(false, false);\n\t \tLog.i(\"MAIN\",\"onFinished\");\n\t }\n\t });\n\n\t }\n\t else\n\t {\n\t \n\t \tdS.lat=0;\n dS.lon=0;\n\t \n\t }\n\n\t }", "LocationsClient getLocations();", "private void getLocation() {\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n\t\t\tif (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tFusedLocationProviderClient locationProviderClient = LocationServices.getFusedLocationProviderClient(getApplicationContext());\n\t\tlocationProviderClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {\n\t\t\t@Override\n\t\t\tpublic void onSuccess(Location location) {\n\t\t\t\t\n\t\t\t\tfinal Location finalLocation = location;\n\t\t\t\t\n\t\t\t\tbtnGoToYou.setOnClickListener(new View.OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tLatLng userLocation = new LatLng(finalLocation.getLatitude(), finalLocation.getLongitude());\n\t\t\t\t\t\tmMap.addMarker(new MarkerOptions().position(userLocation).title(\"You are Here!\"));\n\t\t\t\t\t\tmMap.moveCamera(CameraUpdateFactory.newLatLng(userLocation));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t\t\n\t}", "Location getLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "private void getUsersGeolocalisation(User user) {\n System.out.println(\"##########Getting \".concat(user.getScreenName()).concat(\" Location ##########\"));\n String[] place = user.getLocation().split(\",\");\n if (place != null && place.length != 0) {\n\n addEdgesToGraph(user.getScreenName(), place);\n }\n\n\n }", "List<String> locations();", "public Cursor getAllLocationsLoc(){\n if (mDB != null)\n return mDB.query(LOCNODE_TABLE, new String[] { FIELD_ROW_ID, FIELD_NAME, FIELD_ADDY, FIELD_LAT , FIELD_LNG, FIELD_TIMESVISITED }, null, null, null, null, null);\n Cursor c = null;\n return c;\n }", "public abstract Location[] retrieveLocation();", "@Transactional\n\tpublic List<Location> listAllLocation() {\n\n\t\tCriteriaBuilder builder = getSession().getCriteriaBuilder();\n\t\tCriteriaQuery<Location> criteriaQuery = builder.createQuery(Location.class);\n\t\tRoot<Location> root = criteriaQuery.from(Location.class);\n\t\tcriteriaQuery.select(root);\n\t\tQuery<Location> query = getSession().createQuery(criteriaQuery);\n\n\t\t// query.setFirstResult((page - 1) * 5);\n\t\t// query.setMaxResults(5);\n\t\treturn query.getResultList();\n\t}", "@SuppressWarnings(\"unused\")\n Location getCurrentLocation();", "public String getUserLocation(String systemUserAuthToken, String userId) {\n String path = mgmtUserPath + userId + \"/locations\";\n return sendRequest(getResponseType, systemUserAuthToken, path, allResult, statusCode200);\n }", "public Location[] getLocation() {\r\n return locations;\r\n }", "private LatLng getCurrentLocation() {\n if (ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\n return new LatLng(0, 0);\n }\n LocationManager locationManager = (LocationManager) getSystemService(this.LOCATION_SERVICE);\n Location current_location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);\n if (current_location == null) {\n return new LatLng(0, 0);\n }\n return new LatLng(current_location.getLatitude(), current_location.getLongitude());\n }", "public static void listGeolocations()\n {\n {\n JSONArray listGeolocations = new JSONArray();\n List<User> users = User.findAll();\n for (User user : users)\n {\n listGeolocations.add(Arrays.asList(user.firstName, user.latitude, user.longitude));\n }\n renderJSON(listGeolocations);\n }\n }", "LocationTracker getTracker();", "public Cursor getAllLocations()\n\t{\n\t\treturn db.query(DATABASE_TABLE, new String[] {\n\t\t\t\tKEY_DATE,KEY_LAT,KEY_LNG},\n\t\t\t\tnull,null,null,null,null);\n\t}", "public String getCurrentLocation() {\n return currentLocation;\n }", "@SuppressWarnings({\"MissingPermission\"})\n void getMyLocation() {\n mGoogleMap.setMyLocationEnabled(true);\n FusedLocationProviderClient locationClient = getFusedLocationProviderClient(getContext());\n locationClient.getLastLocation()\n .addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n onLocationChanged(location);\n moveCamera();\n drawCircle();\n drawMarkers();\n }\n }\n })\n .addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.d(\"MapDemoActivity\", \"Error trying to get last GPS location\");\n e.printStackTrace();\n }\n });\n }", "public List<String> getLocationAndCity(){\n\t\treturn jtemp.queryForList(\"SELECT location_id||city FROM locations\", String.class);\n\t}", "public static MapLocation myLocation() {\n return RC.getLocation();\n }", "Optional<VisitedLocation> getUserLocation(String userName) throws UserNotFoundException;", "public Cursor getAllLocations(){\n if (mDB != null)\n return mDB.query(DATABASE_TABLE, new String[] { FIELD_ROW_ID, FIELD_LAT , FIELD_LNG, FIELD_ACC, FIELD_TIME } , null, null, null, null, null);\n Cursor c = null;\n return c;\n }", "@GetMapping(path=\"/all\")\n public @ResponseBody Iterable<driverlocation> getAllUsers() {\n return locationRepository.findAll();\n }", "public Location getCurrentLocation()\n\t{\n\t\treturn currentLocation;\n\t}", "public Location getCurrentUserPosition() {\n if (ActivityCompat.checkSelfPermission(getContext(),\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(getContext(),\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n String[] permissions = {Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION};\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissions, ACCESS_COARSE_LOCATION);\n }\n return null;\n }\n locationManager.requestLocationUpdates(\n LocationManager.GPS_PROVIDER, 5000, 10, this);\n return locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);\n }", "private void getCurrentLocation() {\n try {\n if (locationPermissionGranted) {\n Task<Location> locationResult = fusedLocationClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n lastKnownLocation = task.getResult();\n if (lastKnownLocation != null) {\n map.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(lastKnownLocation.getLatitude(),\n lastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n updateCameraBearing(map, location.getBearing());\n }\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage(), e);\n }\n }", "private void showCurrentLocation() {\n if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {\n LocationRequest locationRequest = LocationRequest.create();\n locationRequest.setInterval(10000);\n locationRequest.setFastestInterval(5000);\n locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n\n LocationCallback mLocationCallback = new LocationCallback() {\n @Override\n public void onLocationResult(LocationResult locationResult) {\n if (locationResult == null) {\n return;\n }\n for (Location location : locationResult.getLocations()) {\n if (location != null) {\n LatLng current = new LatLng(location.getLatitude(), location.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(current, 18));\n if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {\n mMap.setMyLocationEnabled(true);\n }\n\n }\n }\n }\n };\n\n LocationServices.getFusedLocationProviderClient(this).requestLocationUpdates(locationRequest, mLocationCallback, null);\n\n } else { // Show default location\n requestLocationPermission();\n\n LatLng current = new LatLng(34.180972800611016, -117.32337489724159);\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(current, 18));\n }\n }", "public Location getLocation() {\n return getLocation(null);\n }", "public List<String> locations() {\n return this.locations;\n }", "void getDeviceLocation() {\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(getActivity(), new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful() && task.getResult()!=null) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n getProfile(mLastKnownLocation);\n } else {\n Log.d(\"Map\", \"Current location is null. Using defaults.\");\n Log.e(\"Map\", \"Exception: %s\", task.getException());\n googleMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n googleMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "@RequestMapping(value = \"/current_location/{user_id}\", method = RequestMethod.GET)\n public ResponseEntity<CurrentLocation> getAboutMe(@PathVariable String user_id) {\n\n CurrentLocation currentLocation = currentLocationService.findMyCurrentLocation(user_id);\n\n if (currentLocation == null) {\n System.out.println(\"User with id \" + user_id + \" not found\");\n return new ResponseEntity<CurrentLocation>(HttpStatus.NOT_FOUND);\n }\n\n return new ResponseEntity<CurrentLocation>(currentLocation, HttpStatus.OK);\n }", "private void getMyLocation() {\n LatLng latLng = new LatLng(latitude, longitude);\n CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 18);\n googleMap.animateCamera(cameraUpdate);\n }", "private UserLocation getLocation() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {\n Toast.makeText(this, \"The Location Permission is needed to show the weather \", Toast.LENGTH_SHORT).show();\n } else {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n REQUEST_LOCATION_CODE_PERMISSION);\n }\n }\n\n } else {\n Log.d(TAG, \"getLocation: Permission Granted\");\n mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n msLocation = location;\n userLocation.setLat(location.getLatitude());\n userLocation.setLon(location.getLongitude());\n\n mLocationText.setText(getString(R.string.location_text\n , msLocation.getLatitude()\n , msLocation.getLongitude()\n , msLocation.getTime()));\n RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n params.addRule(RelativeLayout.CENTER_HORIZONTAL);\n mLocationText.setGravity(Gravity.CENTER_HORIZONTAL);\n mLocationText.setLayoutParams(params);\n mLocationText.setTextSize(24);\n\n } else {\n mLocationText.setText(R.string.no_location);\n }\n }\n });\n\n }\n return userLocation;\n }", "URI getLocation();", "Collection<L> getLocations ();", "public FrillLoc getLocation() {\n return MyLocation;\n }", "private void getLocation() {\n //if you don't have permission for location services yet, ask\n if (ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this, new String[]\n {Manifest.permission.ACCESS_FINE_LOCATION},\n REQUEST_LOCATION_PERMISSION);\n //have the app ask for location permission\n } else {\n fusedLocationClient.requestLocationUpdates\n (getLocationRequest(), mLocationCallback,\n null /* Looper */);\n //uses the type of request and the location callback to update the location\n /**fusedLocationClient.getLastLocation().addOnSuccessListener(\n new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n TextView error = findViewById(R.id.errorMsg);\n error.setVisibility(View.VISIBLE);\n\n if (location != null) {\n lastLocation = location;\n error.setText(\"location: \" + lastLocation.getLatitude());\n } else {\n error.setText(\"location not available\");\n }\n }\n });**/\n }\n }", "public ArrayList getLocations()\r\n\t\t{\r\n\t\t\treturn locations;\r\n\t\t}", "public Result getUserLocations(long userID){\n\t\tfinal JsonNode[] result = {null};\n\t\tString userID2 = \"\" + userID;\n\n\t\tSQLTools.StatementFiller sf = stmt -> stmt.setString(1, userID2);\n\t\tSQLTools.ResultSetProcessor rp = rs -> result[0] = SQLTools.columnsAndRowsToJSON(rs);\n\n\t\ttry{\n\t\t\tSQLTools.doPreparedStatement(db, \"SELECT l.location_id, l.name, l.location_type FROM Locations AS l, User_locations AS ul WHERE l.location_id = ul.location_id AND ul.user_id = ?\", sf, rp);\n\t\t} catch (SQLException e){\n\t\t\treturn internalServerError(\"coudn't load users locations\");\n\t\t}\n\n\t\treturn ok(result[0]);\n\t}", "@RequestMapping(value=\"/locations\", method=RequestMethod.GET)\n\t@ResponseBody\n\tpublic Iterable<Location> getLocations(){\n\t\treturn lr.findAll();\n\t}", "public String getLocation(){\r\n return Location;\r\n }", "private void getlocation() {\n\t\t\t\ttry {\n\n\t\t\t\t\tgps = new GPSTracker(RegisterActivity.this);\n\t\t\t\t\tLog.d(\"LOgggg\", \"inCurrentlocation\");\n\n\t\t\t\t\t// check if GPS enabled\n\t\t\t\t\tif (gps.canGetLocation()) {\n\n\t\t\t\t\t\tlatitude = gps.getLatitude();\n\t\t\t\t\t\tlongitude = gps.getLongitude();\n\n\t\t\t\t\t\tLog.i(\"latitude\", \"\" + latitude);\n\t\t\t\t\t\tLog.i(\"longitude\", \"\" + longitude);\n\n\t\t\t\t\t\tnew getLoc().execute(\"\");\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgps.showSettingsAlert();\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}", "com.google.ads.googleads.v14.common.LocationInfo getLocation();", "public List<Location> getLocations() {\n\t\treturn locations;\n\t}", "@Override\n\tpublic List<Historic_siteVO> MainLocation() throws Exception {\n\t\treturn dao.MainLocation();\n\t}", "LiveData<List<Location>> getAllLocations() {\n return mAllLocations;\n }", "@Test\n\tpublic void listLocations(){\n\t\tList<Location> lists = locationService.queryLoctionsByLat(29.8679775, 121.5450105);\n\t\t//System.out.println(lists.size()) ;\n\t\tfor(Location loc : lists){\n\t\t\tSystem.out.println(loc.getAddress_cn());\n\t\t}\n\t}", "@GetMapping(\"/locations\")\n public List<Location> getLocations(){\n return service.getAll();\n }", "@Override\n public Iterable<Location> listLocations() {\n return ImmutableSet.<Location>of();\n }", "public void getLocation() {\n\n\t\t// If Google Play Services is available\n\t\tif (servicesConnected()) {\n\t\t\t// Get the current location\n\t\t\tLocation currentLocation = mLocationClient.getLastLocation();\n\n\t\t\t// Display the current location in the UI\n\t\t\tmLatLng.setText(LocationUtils.getLatLng(this, currentLocation));\n\n\t\t\tlatCurrent=(float) currentLocation.getLatitude();\n\t\t\tlntCurrent=(float) currentLocation.getLongitude();\n\n\t\t}\n\t}", "public String getLocation(){\r\n return location;\r\n }", "@Override\n public List<Location> getAll() {\n\n List<Location> locations = new ArrayList<>();\n \n Query query = new Query(\"Location\");\n PreparedQuery results = ds.prepare(query);\n\n for (Entity entity : results.asIterable()) {\n double lat = (double) entity.getProperty(\"lat\");\n double lng = (double) entity.getProperty(\"lng\");\n String title = (String) entity.getProperty(\"title\");\n String note = (String) entity.getProperty(\"note\");\n int voteCount = ((Long) entity.getProperty(\"voteCount\")).intValue();\n String keyString = KeyFactory.keyToString(entity.getKey()); \n // TODO: Handle situation when one of these properties is missing\n\n Location location = new Location(title, lat, lng, note, voteCount, keyString);\n locations.add(location);\n }\n return locations;\n }", "public Location getLocation(){\n return location;\n }", "private void getDeviceLocation() {\n try {\n if (mLocationPermissionGranted) {\n Task locationResult = fusedLocationClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful() && task.getResult() != null) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n Log.d(TAG,\"Current location is null. Using defaults.\");\n Log.e(TAG, task.getException().toString());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch(SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "com.google.ads.googleads.v6.resources.LocationView getLocationView();", "public int getCurrentLocation() {\n\t\treturn currentLocation;\n\t}", "public LatLng getLocation() {\n LocationManager locationManager = (LocationManager) getActivity().getSystemService(LOCATION_SERVICE);\n String locationProvider = LocationManager.NETWORK_PROVIDER;\n Location location = locationManager.getLastKnownLocation(locationProvider);\n\n Double lat,lon;\n try {\n lat = location.getLatitude();\n lon = location.getLongitude();\n return new LatLng(lat, lon);\n }\n catch (NullPointerException e){\n e.printStackTrace();\n return null;\n }\n\n\n\n }", "@SuppressLint({\"MissingPermission\", \"DefaultLocale\"})\n private void requestCurrentLocation() {\n mFusedLocationClient\n .getCurrentLocation(PRIORITY_HIGH_ACCURACY, cancellationTokenSource.getToken())\n .addOnCompleteListener(this, task -> {\n if (task.isSuccessful() && task.getResult() != null) {\n Location result = task.getResult();\n Log.d(TAG, String.format(\"getCurrentLocation() result: %s\", result.toString()));\n logOutputToScreen(String.format(\n \"Location (success): %f, %f\",\n result.getLatitude(), result.getLongitude()\n ));\n } else {\n Log.e(TAG, String.format(\"Location (failure): %s\", task.getException()));\n }\n });\n }", "@Nullable\n public Location getCurrentLocation() {\n if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return null;\n }\n LocationManager mLocationManager = (LocationManager) getActivity().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);\n List<String> providers = mLocationManager.getProviders(true);\n Location bestLocation = null;\n for (String provider : providers) {\n Location l = mLocationManager.getLastKnownLocation(provider);\n if (l == null) {\n continue;\n }\n if (bestLocation == null || l.getAccuracy() < bestLocation.getAccuracy()) {\n // Found best last known location: %s\", l);\n bestLocation = l;\n }\n }\n return bestLocation;\n }", "@Override\n public void onLocationResult(LocationResult locationResult) {\n Log.d(TAG, \"onSuccess: Location : \" + locationResult);\n if (locationResult == null) {\n return;\n }\n for (Location location : locationResult.getLocations()) {\n // Update UI with location data\n Toast.makeText(MainActivity.this, \"Location : \" + location, Toast.LENGTH_SHORT).show();\n }\n }", "List<String> getSubscribedLocations(String userName) throws DatabaseException;", "public ArrayList<LocationDetail> getLocations() throws LocationException;", "@SuppressLint(\"MissingPermission\")\n @AfterPermissionGranted(PERMISSION_LOCATION_ID)\n private void getCurrentLocation() {\n Task<Location> task = fusedLocationProviderClient.getLastLocation();\n task.addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if(location != null) {\n currentLat = location.getLatitude();\n currentLong = location.getLongitude();\n\n String placeType = \"museum\";\n\n int radius = ProfileFragment.getRadius();\n\n String url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json\" +\n \"?location=\" + currentLat + \",\" + currentLong +\n \"&radius=\" + radius +\n \"&type=\" + placeType +\n \"&key=\" + getResources().getString(R.string.maps_api_key);\n\n new NearbyMuseumTask().execute(url);\n\n mapFragment.getMapAsync(new OnMapReadyCallback() {\n @Override\n public void onMapReady(GoogleMap googleMap) {\n map = googleMap;\n setMapUISettings();\n\n map.animateCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(currentLat,currentLong), 12\n ));\n }\n });\n }\n }\n });\n }", "private void Location() {\n\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_ACCESS_FINE_LOCATION);\n }\n\n //Google Play Location stored in loc variable\n fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);\n fusedLocationClient.getLastLocation()\n .addOnSuccessListener(this, new OnSuccessListener<Location>() {\n\n\n @Override\n public void onSuccess(Location location) {\n\n // Got last known location. In some rare situations this can be null.\n if (location != null) {\n loc = location;\n getAddressFromLocation(loc.getLatitude(), loc.getLongitude());\n\n }\n }\n });\n }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(getActivity(), new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public Location location()\n {\n return myLoc;\n }", "private void getLocation() {\n if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.INTERNET}\n , 10);\n }\n return;\n }\n\n //Update location\n locationManager.requestLocationUpdates(\"gps\", 5000, 0, listener);\n }", "public Location getCurrentLocation() { return entity.getLocation(); }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n showCurrentPlace();\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n Log.e(TAG, \"Exception: %s\", task.getException());\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public String getLocation() {\n\t\tString longitude = request.getParameter(\"longitude\");\n\t\tString latitude = request.getParameter(\"latitude\");\n\t\trequest.getSession().setAttribute(\"longitude\", longitude);\n\t\trequest.getSession().setAttribute(\"latitude\", latitude);\n\t\t// 调用登录方法\n\t\tloginCommons.thirdType = \"W\";\n\t\texecute();\n\t\tJSONObject mem = HttpRequestUtils.httpGetx(\"http://1829840kl0.iask.in/cardcolv4/smemberwx!loadMex.asp\");\n\t\trequest.setAttribute(\"member\", mem);\n\t\treturn \"loadMe\";\n\t}", "public Location getLocation() {\n\n if (isPermissionGranted()) {\n try\n {\n\n lastKnownLocation = LocationServices.FusedLocationApi\n .getLastLocation(googleApiClient);\n\n Log.e(TAG, \"getLocation: LAST KNOWN LOCATION\" + (lastKnownLocation==null));\n return lastKnownLocation;\n }\n catch (SecurityException e)\n {\n e.printStackTrace();\n }\n }\n\n return null;\n\n }", "SiteLocation getLocatedAt();", "private void getDeviceLocation() {\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(getActivity(), new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the customer_map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n getNearestDriver();\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n Log.e(TAG, \"Exception: %s\", task.getException());\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "private void getDeviceLocation() {\n /*\n * Request location permission, so that we can get the location of the\n * device. The result of the permission request is handled by a callback,\n * onRequestPermissionsResult.\n */\n if (ContextCompat.checkSelfPermission(this.getApplicationContext(),\n android.Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mLocationPermissionGranted = true;\n } else {\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);\n }\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n if (mLocationPermissionGranted) {\n mLastKnownLocation = LocationServices.FusedLocationApi\n .getLastLocation(mGoogleApiClient);\n if (world.geoHome == null && mLastKnownLocation != null) {\n world.geoHome = new Vector2f(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude());\n }\n }\n\n // Set the map's camera position to the current location of the device.\n /*if (mCameraPosition != null) {\n mMap.moveCamera(CameraUpdateFactory.newCameraPosition(mCameraPosition));\n } else if (mLastKnownLocation != null) {\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), mMap.getCameraPosition().zoom));\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }*/\n }", "public ArrayList<Location> getLocations() {\n return locations;\n }", "public String getProfile_location()\r\n\t{\r\n\t\treturn profile_location;\r\n\t}", "public ViewObjectImpl getLocations() {\n return (ViewObjectImpl)findViewObject(\"Locations\");\n }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnSuccessListener(this, new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = location;\n Log.d(TAG, \"Latitude: \" + mLastKnownLocation.getLatitude());\n Log.d(TAG, \"Longitude: \" + mLastKnownLocation.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n }\n\n getCurrentPlaceLikelihoods();\n }\n });\n }\n } catch (Exception e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public String getLocation(){\n return location;\n }", "private List<LatLng> getCoordinates() {\n\n List<LatLng> list = new ArrayList<>();\n SharedPreferences.Editor editor = walkingSharedPreferences.edit();\n int size = walkingSharedPreferences.getInt(user.getUsername(), 0);\n for(int actual = 0; actual < size; actual++) {\n String pos = walkingSharedPreferences.getString(user.getUsername() + \"_\" + actual, \"\");\n editor.remove(user.getUsername() + \"_\" + actual);\n String[] splitPos = pos.split(\" \");\n LatLng latLng = new LatLng(Double.parseDouble(splitPos[LAT]), Double.parseDouble(splitPos[LNG]));\n list.add(latLng);\n }\n editor.remove(user.getUsername());\n editor.apply();\n return list;\n\n }", "public Location getLocation() {\n return loc;\n }", "public Location getLocation() {\n return loc;\n }", "private void getLocation() {\n LocationRequest mLocationRequestHighAccuracy = new LocationRequest();\n mLocationRequestHighAccuracy.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n mLocationRequestHighAccuracy.setInterval(UPDATE_INTERVAL);\n mLocationRequestHighAccuracy.setFastestInterval(FASTEST_INTERVAL);\n\n if (ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n stopSelf();\n return;\n } else\n mFusedLocationClient.requestLocationUpdates(mLocationRequestHighAccuracy, new LocationCallback() {\n @Override\n public void onLocationResult(LocationResult locationResult) {\n\n Log.d(TAG, \"onLocationResult: got location result.\");\n\n Location location = locationResult.getLastLocation();\n if (location != null) {\n db.getReference(\"Users\").child(FirebaseAuth.getInstance().getCurrentUser().getUid()).addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n user=snapshot.getValue(User.class);\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n\n }\n });\n\n\n LocationModel geoPoint = new LocationModel(location.getLatitude(), location.getLongitude());\n UserLocation userLocation = new UserLocation(geoPoint, user);\n saveUserLocation(userLocation);\n }\n\n /*if (location != null) {\n DocumentReference u = db.collection(\"Users\").document(FirebaseAuth.getInstance().getCurrentUser().getUid());\n u.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {\n @Override\n public void onComplete(@NonNull Task<DocumentSnapshot> task) {\n if (task.isSuccessful()) {\n user = task.getResult().toObject(User.class);\n }\n }\n });\n\n GeoPoint geoPoint = new GeoPoint(location.getLatitude(), location.getLongitude());\n UserLocation userLocation = new UserLocation(geoPoint, null, user);\n saveUserLocation(userLocation);\n }*/\n\n }\n },\n Looper.myLooper()); // Looper.myLooper tells this to repeat forever until thread is destroyed\n }", "private void getDeviceLocation(){\n mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);\n\n try {\n if (mLocationPermissionsGranted) {\n\n final Task location = mFusedLocationProviderClient.getLastLocation();\n location.addOnCompleteListener(new OnCompleteListener() {\n @Override\n public void onComplete(@NonNull Task task) {\n if(task.isSuccessful()){\n\n Location currentLocation = (Location) task.getResult();\n\n if (currentLocation == null) {\n\n // Provide default current location\n\n currentLocation = new Location(\"\");\n currentLocation.setLatitude(51.454514);\n currentLocation.setLongitude(-2.587910);\n }\n\n } else {\n Helpers.showToast(getApplicationContext(), \"Could not get current location\");\n }\n }\n });\n }\n } catch (SecurityException e) {\n Helpers.showToast(getApplicationContext(), \"Could not get current location\");\n }\n }", "String getLocation();", "String getLocation();", "String getLocation();", "private void getUserLocation()\n {\n Log.i(\"values\",getArguments().getString(\"type\"));\n fetchStores(placeID);\n }", "public LatLng getLocation() {\n\t\treturn location;\n\t}", "@Override\n public geo_location getLocation() {\n return location;\n }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnSuccessListener(this, new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = location;\n Log.d(TAG, \"Latitude: \" + mLastKnownLocation.getLatitude());\n Log.d(TAG, \"Longitude: \" + mLastKnownLocation.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n }\n\n }\n });\n }\n } catch (Exception e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "com.google.ads.googleads.v6.resources.UserLocationViewOrBuilder getUserLocationViewOrBuilder();", "private void getDeviceLocation( ) {\n\n if (searchLocationMarker != null) {\n searchLocationMarker.remove();\n }\n\n mFusedLocationProviderClient =\n LocationServices.getFusedLocationProviderClient(this);\n //Task locationResult = mFusedLocationProviderClient.getLastLocation();\n try {\n if (mLocationPermissionGranted) {\n Task locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener() {\n @Override\n public void onComplete(@NonNull Task task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n System.out.println(\"Current location retrieved successfully!\");\n mLastKnownLocation = (Location) task.getResult(); // location?\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n searchLocationMarker = mMap.addMarker(new MarkerOptions()\n .position(new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()))\n .title(\"Current Location\")\n .icon(BitmapDescriptorFactory.fromBitmap(\n getBitmapFromVectorDrawable(\n MainActivity.this, R.drawable.ic_current_location_marker))));\n getNearbyStations(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude());\n\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n Log.e(TAG, \"Exception: %s\", task.getException());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n searchLocationMarker = mMap.addMarker(new MarkerOptions()\n .position(mDefaultLocation)\n .title(\"Current Location\")\n .icon(BitmapDescriptorFactory.fromBitmap(\n getBitmapFromVectorDrawable(\n MainActivity.this, R.drawable.ic_current_location_marker))));\n }\n }\n });\n }\n } catch(SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n\n }" ]
[ "0.7027496", "0.70127463", "0.69614536", "0.68853545", "0.6871158", "0.6867586", "0.66958594", "0.66261953", "0.65846604", "0.65846604", "0.65846604", "0.65846604", "0.65215224", "0.65211505", "0.6516885", "0.6474377", "0.6432292", "0.6408678", "0.6399806", "0.63953745", "0.63654566", "0.6363369", "0.6342169", "0.63358504", "0.62949353", "0.62718683", "0.6271329", "0.62448835", "0.62428296", "0.6220128", "0.62052363", "0.62012285", "0.6190073", "0.61884826", "0.61809105", "0.6144117", "0.614293", "0.6139505", "0.6132192", "0.61264104", "0.61236554", "0.6116207", "0.6112108", "0.6104279", "0.6095514", "0.60914725", "0.6088413", "0.60875046", "0.6078166", "0.6074729", "0.60616064", "0.60444295", "0.60310775", "0.6027707", "0.60268617", "0.60244644", "0.6020007", "0.600475", "0.59955573", "0.59923285", "0.59839493", "0.5982697", "0.59785205", "0.5978115", "0.5973735", "0.596628", "0.5965792", "0.596323", "0.5962398", "0.5960205", "0.59555346", "0.5955366", "0.5952963", "0.59518194", "0.59518", "0.59488654", "0.5947356", "0.59466547", "0.5944148", "0.5938911", "0.5937778", "0.59356314", "0.59311676", "0.5930594", "0.59242487", "0.5908554", "0.5899819", "0.58989215", "0.5897306", "0.5897306", "0.5896862", "0.5889712", "0.5884477", "0.5884477", "0.5884477", "0.58719087", "0.5869581", "0.58687484", "0.58634037", "0.5862937", "0.5861635" ]
0.0
-1
GET My Current Location
@RequestMapping(value = "/current_location/{user_id}", method = RequestMethod.GET) public ResponseEntity<CurrentLocation> getAboutMe(@PathVariable String user_id) { CurrentLocation currentLocation = currentLocationService.findMyCurrentLocation(user_id); if (currentLocation == null) { System.out.println("User with id " + user_id + " not found"); return new ResponseEntity<CurrentLocation>(HttpStatus.NOT_FOUND); } return new ResponseEntity<CurrentLocation>(currentLocation, HttpStatus.OK); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Location getCurrentLocation();", "URI getLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "@SuppressWarnings(\"unused\")\n Location getCurrentLocation();", "String location();", "String location();", "String location();", "String location();", "String location();", "String location();", "String location();", "String location();", "public String getCurrentLocation() {\n return currentLocation;\n }", "String getLocation();", "String getLocation();", "String getLocation();", "public URL getLocation() {\n return location;\n }", "public static MapLocation myLocation() {\n return RC.getLocation();\n }", "public String getLocation(){\r\n return Location;\r\n }", "java.lang.String getLocation();", "public Location getCurrentLocation()\n\t{\n\t\treturn currentLocation;\n\t}", "public java.lang.String getLocation() {\n return location;\n }", "public Location getLocation() {\n return getLocation(null);\n }", "SiteLocation getLocatedAt();", "public String getLocation(){\r\n return location;\r\n }", "public java.lang.String getLocation() {\n return location;\n }", "public String getLocation() { return location; }", "public String getLocation() { return location; }", "public String getLocation()\n {\n return location;\n }", "@SuppressWarnings(\"WeakerAccess\")\n public Location getCurrentLocation() {\n final LocationClient locationClient = getLocationClient();\n return locationClient == null ? null: locationClient.getCurrentLocation();\n }", "public String getLocation() {\n return location;\n }", "public String getLocation(){\n return location;\n }", "public FrillLoc getLocation() {\n return MyLocation;\n }", "public String getLocation() {\r\n return location;\r\n }", "public final String getLocation() {\n return location;\n }", "public String getLocation() {\r\n\t\treturn location; \r\n\t}", "public URI getLocation()\r\n/* 293: */ {\r\n/* 294:441 */ String value = getFirst(\"Location\");\r\n/* 295:442 */ return value != null ? URI.create(value) : null;\r\n/* 296: */ }", "private void getUserCurrentLocation()\n\t {\n\t NicerLocationManager locationMgr = new NicerLocationManager(this.getApplicationContext());\n\t if (locationMgr.isAnyLocationServicesAvailble())\n\t {\n\t Log.i(\"MAIN\",\"retrieving current location...\");\n\n\t // get current location\n\t locationMgr.getBestGuessLocation(1000,\n\t new NicerLocationListener() {\n\n\t @Override\n\t public void locationLoaded(final Location location)\n\t {\n\t // parse the current site forecast for users current\n\t // location in the background\n\t //LocationForecastSetup currentForecast = new LocationForecastSetup();\n\t //currentForecast.execute(location);\n\n\t // QLog.i(\"location loaded. finding nearest location...\");\n\t //\n\t // // find nearest weather location\n\t // Site nearestLocation =\n\t // Utils.findNearestSite(mApp, location);\n\t //\n\t // // insert the new current user location site\n\t // SitesProviderHelper.addSavedSite(mApp,\n\t // Long.valueOf(nearestLocation.getmSiteId()), true);\n\t //\n\t Log.i(\"MAIN\",\"location found \"+location.getLatitude()+\" \"+location.getLongitude());\n\t dS.lat=(float) location.getLatitude();\n\t dS.lon=(float) location.getLongitude();\n\t //TextView versionText = (TextView) findViewById(R.id.info_area_string);\n\t //versionText.setText(\"lat \" + location.getLatitude()+\" lon \"+location.getLongitude());\n\t \n\t //\n\t // /*\n\t // * add blank site if user has no saved sites. a blank site\n\t // * forecast is also added in the WeatherService class\n\t // * (runWeatherService method) to display correctly in the\n\t // * view pager.this is later removed when a user adds a\n\t // site\n\t // * and added again when user removes last site.\n\t // */\n\t // SitesProviderHelper.addBlankSavedSite(mApp);\n\t //\n\t // // re-order sites so current location is first\n\t // SitesProviderHelper.setSiteOrder(mApp,\n\t // nearestLocation.getmSiteId(), \"0\");\n\t // SitesProviderHelper.setSiteOrder(mApp,\n\t // Consts.BLANK_SITE_ID, \"1\");\n\n\t }\n\n\t @Override\n\t public void error()\n\t {\n\t // give option to change location settings or select a\n\t // location manually\n\t Log.e(\"MAIN\",\"Error finding best guess location\");\n dS.lat=0;\n dS.lon=0;\n if(once)\n {\n\t //promptSetLocationService(MainActivity.this);\n }\n once=false;\n\t }\n\n\t @Override\n\t public void onFinished()\n\t {\n\t //runUpdateService(false, false);\n\t \tLog.i(\"MAIN\",\"onFinished\");\n\t }\n\t });\n\n\t }\n\t else\n\t {\n\t \n\t \tdS.lat=0;\n dS.lon=0;\n\t \n\t }\n\n\t }", "public int getCurrentLocation() {\n\t\treturn currentLocation;\n\t}", "public String getLocation() {\r\n return location;\r\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "@Override\n\tpublic String getLocation() {\n\t\treturn location;\n\t}", "public String getLocation() {\r\n\t\treturn location;\r\n\t}", "protected String getLocation(){\r\n return this.location;\r\n }", "public String getLocation() {\n\t\treturn location;\n\t}", "private void getLocation() {\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n\t\t\tif (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tFusedLocationProviderClient locationProviderClient = LocationServices.getFusedLocationProviderClient(getApplicationContext());\n\t\tlocationProviderClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {\n\t\t\t@Override\n\t\t\tpublic void onSuccess(Location location) {\n\t\t\t\t\n\t\t\t\tfinal Location finalLocation = location;\n\t\t\t\t\n\t\t\t\tbtnGoToYou.setOnClickListener(new View.OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tLatLng userLocation = new LatLng(finalLocation.getLatitude(), finalLocation.getLongitude());\n\t\t\t\t\t\tmMap.addMarker(new MarkerOptions().position(userLocation).title(\"You are Here!\"));\n\t\t\t\t\t\tmMap.moveCamera(CameraUpdateFactory.newLatLng(userLocation));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t\t\n\t}", "private void getlocation() {\n\t\t\t\ttry {\n\n\t\t\t\t\tgps = new GPSTracker(RegisterActivity.this);\n\t\t\t\t\tLog.d(\"LOgggg\", \"inCurrentlocation\");\n\n\t\t\t\t\t// check if GPS enabled\n\t\t\t\t\tif (gps.canGetLocation()) {\n\n\t\t\t\t\t\tlatitude = gps.getLatitude();\n\t\t\t\t\t\tlongitude = gps.getLongitude();\n\n\t\t\t\t\t\tLog.i(\"latitude\", \"\" + latitude);\n\t\t\t\t\t\tLog.i(\"longitude\", \"\" + longitude);\n\n\t\t\t\t\t\tnew getLoc().execute(\"\");\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgps.showSettingsAlert();\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}", "public void getLocation() {\n\n\t\t// If Google Play Services is available\n\t\tif (servicesConnected()) {\n\t\t\t// Get the current location\n\t\t\tLocation currentLocation = mLocationClient.getLastLocation();\n\n\t\t\t// Display the current location in the UI\n\t\t\tmLatLng.setText(LocationUtils.getLatLng(this, currentLocation));\n\n\t\t\tlatCurrent=(float) currentLocation.getLatitude();\n\t\t\tlntCurrent=(float) currentLocation.getLongitude();\n\n\t\t}\n\t}", "@Override\n\tpublic String getLocation() {\n\t\treturn this.location;\n\t}", "public String getLocation() {\n\t\t\treturn location;\n\t\t}", "@SuppressLint({\"MissingPermission\", \"DefaultLocale\"})\n private void requestCurrentLocation() {\n mFusedLocationClient\n .getCurrentLocation(PRIORITY_HIGH_ACCURACY, cancellationTokenSource.getToken())\n .addOnCompleteListener(this, task -> {\n if (task.isSuccessful() && task.getResult() != null) {\n Location result = task.getResult();\n Log.d(TAG, String.format(\"getCurrentLocation() result: %s\", result.toString()));\n logOutputToScreen(String.format(\n \"Location (success): %f, %f\",\n result.getLatitude(), result.getLongitude()\n ));\n } else {\n Log.e(TAG, String.format(\"Location (failure): %s\", task.getException()));\n }\n });\n }", "private void getMyLocation() {\n LatLng latLng = new LatLng(latitude, longitude);\n CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 18);\n googleMap.animateCamera(cameraUpdate);\n }", "public native final String location() /*-{\n\t\treturn this[\"location\"];\n\t}-*/;", "Location getUserLocation()\n {\n\n return userLocation;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation(){\n return this.location;\n }", "public Location getLocation() \n\t{\n\t\treturn location;\n\t}", "public Location getLocation() {\n return loc;\n }", "public Location getLocation() {\n return loc;\n }", "public abstract String getLocation();", "private void getCurrentLocation() {\n try {\n if (locationPermissionGranted) {\n Task<Location> locationResult = fusedLocationClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n lastKnownLocation = task.getResult();\n if (lastKnownLocation != null) {\n map.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(lastKnownLocation.getLatitude(),\n lastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n updateCameraBearing(map, location.getBearing());\n }\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage(), e);\n }\n }", "public void getLocation() {\n\t\tLocationResult locationResult = new LocationResult() {\n\t\t\t@Override\n\t\t\tpublic void gotLocation(Location location) {\n\t\t\t\tLog.d(TAG, \"Got location!\");\n\t\t\t\tmyLocation = location;\n\t\t\t}\n\t\t};\n\t\tMyLocation myLocation = new MyLocation();\n\t\tmyLocation.getLocation(this, locationResult);\n\t}", "public String getLocation() {\n\t\tString longitude = request.getParameter(\"longitude\");\n\t\tString latitude = request.getParameter(\"latitude\");\n\t\trequest.getSession().setAttribute(\"longitude\", longitude);\n\t\trequest.getSession().setAttribute(\"latitude\", latitude);\n\t\t// 调用登录方法\n\t\tloginCommons.thirdType = \"W\";\n\t\texecute();\n\t\tJSONObject mem = HttpRequestUtils.httpGetx(\"http://1829840kl0.iask.in/cardcolv4/smemberwx!loadMex.asp\");\n\t\trequest.setAttribute(\"member\", mem);\n\t\treturn \"loadMe\";\n\t}", "public String getLocation() {\n return this.location;\n }", "public String getLocation() {\n return this.location;\n }", "public String getLocation() {\n return this.location;\n }", "public String getLocation() {\n return this.location;\n }", "public String getLocation() {\n return this.location;\n }", "public String getLocation() {\n\t\treturn mLocation;\n\t}", "@Override\n public String getLocation() {\n return location;\n }", "public Location location()\n {\n return myLoc;\n }", "public Location getLocation() {\n\t\treturn loc;\n\t}", "public URL getServerLocation() {\n return serverLocation;\n }", "public String getLocation() {\n return mLocation;\n }", "public String getLocation() {\n return this.location;\n }", "@SuppressWarnings({\"MissingPermission\"})\n void getMyLocation() {\n mGoogleMap.setMyLocationEnabled(true);\n FusedLocationProviderClient locationClient = getFusedLocationProviderClient(getContext());\n locationClient.getLastLocation()\n .addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n onLocationChanged(location);\n moveCamera();\n drawCircle();\n drawMarkers();\n }\n }\n })\n .addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.d(\"MapDemoActivity\", \"Error trying to get last GPS location\");\n e.printStackTrace();\n }\n });\n }", "public Location getCurrentLocation() { return entity.getLocation(); }", "protected Location getLocation()\n {\n return location;\n }", "protected Location getLocation()\n {\n return location;\n }", "public Location getLocation(){\n return location;\n }", "public int getLocation()\r\n {\n }", "private void obtainCurrentLocation(boolean add_current_location_on) {\n\t\tif (add_current_location_on) {\n\t\t\t// If Google Play Services is available\n\t\t\tif (servicesConnected()) {\n\t\t\t\t// mProgressBar_location.setVisibility(View.VISIBLE);\n\t\t\t\t// Get the current location\n\t\t\t\tLocation currentLocation = mLocationClient.getLastLocation();\n\t\t\t\tlink_to_global_report.setReporter_geopoint(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()));\n\t\t\t\t// mProgressBar_location.setVisibility(View.GONE);\n\t\t\t\tLog.e(DEBUG, \"current_location_add:\" + currentLocation);\n\t\t\t}\n\n\t\t} else {\n\t\t\tToast.makeText(this, DEBUG + \"off ... supposed to delete loc!\", Toast.LENGTH_SHORT).show();\n\t\t\t// mProgressBar_location.setVisibility(View.GONE);\n\t\t}\n\t}", "private LatLng getCurrentLocation() {\n if (ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\n return new LatLng(0, 0);\n }\n LocationManager locationManager = (LocationManager) getSystemService(this.LOCATION_SERVICE);\n Location current_location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);\n if (current_location == null) {\n return new LatLng(0, 0);\n }\n return new LatLng(current_location.getLatitude(), current_location.getLongitude());\n }", "public Location getLocation() {\n\t\treturn location;\n\t}", "com.google.ads.googleads.v14.common.LocationInfo getLocation();", "public Location getLocation() {\r\n\t\treturn location;\r\n\t}", "public Location getLocation() {\r\n\t\treturn location;\r\n\t}" ]
[ "0.7912868", "0.77893895", "0.77008957", "0.77008957", "0.77008957", "0.77008957", "0.75745404", "0.7512766", "0.7512766", "0.7512766", "0.7512766", "0.7512766", "0.7512766", "0.7512766", "0.7512766", "0.7507328", "0.74938804", "0.74938804", "0.74938804", "0.7357591", "0.7270066", "0.7198036", "0.7192349", "0.71807575", "0.71292114", "0.7121562", "0.7107164", "0.708982", "0.7083333", "0.7081501", "0.7081501", "0.70559025", "0.7034705", "0.70333374", "0.7020584", "0.7015149", "0.7012834", "0.701168", "0.7010954", "0.7005316", "0.70022213", "0.6985183", "0.69622695", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.6936466", "0.69311845", "0.6922838", "0.6918896", "0.6918824", "0.6910487", "0.6908006", "0.68961513", "0.68943876", "0.68638504", "0.6851488", "0.6851449", "0.6846577", "0.6836361", "0.683599", "0.6827118", "0.6818542", "0.68149483", "0.68149483", "0.6800336", "0.6784958", "0.67830175", "0.6779891", "0.677857", "0.677857", "0.677857", "0.677857", "0.677857", "0.6776103", "0.67598945", "0.67583114", "0.6755707", "0.67496556", "0.67299116", "0.6729824", "0.6724125", "0.672272", "0.6719953", "0.6719953", "0.67101616", "0.66883457", "0.66882145", "0.6669416", "0.66519547", "0.66471803", "0.66465694", "0.66465694" ]
0.0
-1
Created by TW on 2017/7/14.
public interface GoodsDao { @Select("SELECT g.id, g.NAME, g.caption, g.image, g.price FROM xx_goods g LEFT JOIN " + " xx_product_category p on g.product_category = p.id LEFT JOIN xx_goods_tag t on g.id=t.goods " + " where p.tree_path LIKE ',${categoryId},%' AND t.tags = #{tagId} and g.is_marketable=1 order by g.id LIMIT #{limit}") List<Goods> findHotGoods(@Param(value = "categoryId") Integer categoryId, @Param(value = "tagId")Integer tagId, @Param(value = "limit")Integer limit); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n public void init() {\n\n }", "@Override\n protected void initialize() {\n\n \n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "public final void mo51373a() {\n }", "@Override\n void init() {\n }", "@Override\n protected void initialize() \n {\n \n }", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n public void init() {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "private void poetries() {\n\n\t}", "private static void cajas() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public void init() {}", "public void mo38117a() {\n }", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "private void init() {\n\n\t}", "@Override\n public int describeContents() { return 0; }", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void init() {}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\n public void initialize() { \n }", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void init()\n\t{\n\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t}", "private TMCourse() {\n\t}", "@Override\n public void initialize() {\n \n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "Petunia() {\r\n\t\t}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "private void m50366E() {\n }", "@Override\n public int getSize() {\n return 1;\n }", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n public void settings() {\n // TODO Auto-generated method stub\n \n }" ]
[ "0.60549164", "0.59378976", "0.5798452", "0.5762114", "0.5741649", "0.57081324", "0.57081324", "0.5665461", "0.5643025", "0.56324536", "0.5617877", "0.55715424", "0.5548387", "0.5535888", "0.55287606", "0.55274373", "0.5522739", "0.5522739", "0.5522739", "0.5522739", "0.5522739", "0.5522739", "0.5521073", "0.55158806", "0.5510583", "0.55088633", "0.55015814", "0.54890025", "0.54890025", "0.54890025", "0.54890025", "0.54890025", "0.5484612", "0.5483112", "0.54825276", "0.54819643", "0.5462164", "0.5443338", "0.54348457", "0.54327446", "0.54319763", "0.54313046", "0.54271483", "0.542708", "0.542708", "0.54234", "0.54229", "0.5419532", "0.54163307", "0.54163307", "0.5415682", "0.54024136", "0.54024136", "0.54024136", "0.5394872", "0.538518", "0.53837216", "0.53837216", "0.5377906", "0.5376065", "0.5376065", "0.5376065", "0.5370636", "0.5370636", "0.5370636", "0.53642446", "0.53526247", "0.53439474", "0.5340915", "0.53317827", "0.5309798", "0.5308575", "0.5304695", "0.5300582", "0.5298996", "0.5296056", "0.52946115", "0.5289997", "0.5286075", "0.52848333", "0.52848333", "0.52848333", "0.52848333", "0.52848333", "0.52848333", "0.52848333", "0.5284815", "0.52827895", "0.52827895", "0.52827895", "0.5262939", "0.5255454", "0.52509844", "0.52509844", "0.5247067", "0.5231407", "0.5231252", "0.5229613", "0.52288026", "0.52288026", "0.52272815" ]
0.0
-1
Creates a new empty instance of DailyQuoteSeries.
public Series() { super(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private XYSeries createSeries() {\r\n return createSeries(0);\r\n }", "public DateAxis() { this(null); }", "public BasicOrderedSeries()\n\t{\n\t\tsuper();\n\t}", "public Series () {\n super();\n this.price = RandomFill.generateNumber(5,15);\n this.listSeason = RandomFill.generateListSeason();\n }", "public ICareDailyDietChart() {\n\n\t}", "public LineChart() {\n init();\n }", "public HumidityChart() {\n this(new XYSeriesCollection());\n }", "public MutualMarketTop10Daily() {\n this(\"mutual_market_top10_daily\", null);\n }", "private ListSeries getTodayData() {\n\t\tListSeries dollarEarning = new ListSeries();\n\t\tdouble number = 0;\n\t\tnumber = controler.getTodaysTransactionSummary();\n\t\tdollarEarning.addData(number);\n\t\t\n\t\treturn dollarEarning;\n\t}", "protected XSSFChart() {\n\t\tsuper();\n\t\tcreateChart();\n\t}", "private XYDataset createDataset() {\n final XYSeriesCollection dataset = new XYSeriesCollection();\n //dataset.addSeries(totalDemand);\n dataset.addSeries(cerContent);\n //dataset.addSeries(cerDemand);\n dataset.addSeries(comContent);\n //dataset.addSeries(comDemand);\n dataset.addSeries(activation);\n dataset.addSeries(resolutionLevel);\n \n return dataset;\n }", "public DayPeriod() {\n\t}", "private Chart(){}", "private static JFreeChart createChart(XYDataset dataset) {\n\n chart = ChartFactory.createTimeSeriesChart(\n \"Stromzählerübersicht\", // Titel\n \"Datum\", // x-Achse label\n \"kWh\", // y-Achse label\n dataset);\n\n chart.setBackgroundPaint(Color.WHITE);\n\n XYPlot plot = (XYPlot) chart.getPlot();\n plot.setBackgroundPaint(Color.LIGHT_GRAY);\n plot.setDomainGridlinePaint(Color.WHITE);\n plot.setRangeGridlinePaint(Color.WHITE);\n plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));\n plot.setDomainCrosshairVisible(true);\n plot.setRangeCrosshairVisible(true);\n\n XYItemRenderer r = plot.getRenderer();\n if (r instanceof XYLineAndShapeRenderer) {\n XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;\n renderer.setDefaultShapesVisible(false);\n renderer.setDefaultShapesFilled(false);\n renderer.setDrawSeriesLineAsPath(true);\n }\n\n DateAxis axis = (DateAxis) plot.getDomainAxis();\n axis.setDateFormatOverride(new SimpleDateFormat(\"dd-MM-yyyy\"));\n\n return chart;\n\n }", "public AlbumSeriesRecord() {\n super(AlbumSeries.ALBUM_SERIES);\n }", "private static MarketDataSet createTestMarketData() {\n final MarketDataSet dataSet = MarketDataSet.empty();\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"AUDUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 1.8);\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"NZDUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 2.2);\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"GBPUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 1.5);\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"GBP1Y\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)),\n ImmutableLocalDateDoubleTimeSeries.builder()\n .putAll(new LocalDate[] {LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 2)}, new double[] {0.01, 0.02}).build());\n return dataSet;\n }", "Quote createQuote();", "public CrlSeries()\n {\n super();\n }", "Dates() {\n clear();\n }", "public MarketHistoricalState() {\n\t\tthis(MarketHistoricalSnapshot.newBuilder());\n\t}", "public BasicOrderedSeries( final int initialCapacity )\n\t{\n\t\tsuper( initialCapacity );\n\t}", "public TradeData() {\r\n\r\n\t}", "public StoredDay(LocalDate date) {\n this.date = date;\n this.recipes = new StoredRecipe[0];\n }", "static <R,C> DataFrame<R,C> empty() {\n return DataFrame.factory().empty();\n }", "public Quotes() {\n\t\tthis(\"quotes\", null);\n\t}", "private void createChart() {\n LineChart lineChart = (LineChart) findViewById(R.id.line_chart);\n\n // LineChart DataSet\n ArrayList<LineDataSet> dataSets = new ArrayList<>();\n\n // x-coordinate format value\n XAxis xAxis = lineChart.getXAxis();\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n xAxis.setGranularity(1f); // only intervals of 1 day\n// xAxis.setValueFormatter(new DayAxisValueFormatter(lineChart));\n\n\n // x-coordinate value\n ArrayList<String> xValues = new ArrayList<>();\n xValues.add(\"No.1\");\n xValues.add(\"No.2\");\n xValues.add(\"No.3\");\n xValues.add(\"No.4\");\n xValues.add(\"No.5\");\n\n // value\n ArrayList<Entry> value = new ArrayList<>();\n String measureItemName = \"\";\n value.add(new Entry(100, 0));\n value.add(new Entry(120, 1));\n value.add(new Entry(150, 2));\n value.add(new Entry(250, 3));\n value.add(new Entry(500, 4));\n\n\n // add value to LineChart's DataSet\n LineDataSet valueDataSet = new LineDataSet(value, measureItemName);\n dataSets.add(valueDataSet);\n\n // set LineChart's DataSet to LineChart\n// lineChart.setData(new LineData(xValues, dataSets));\n lineChart.setData(new LineData(valueDataSet));\n }", "public PeriodFactoryImpl() {\n\t\tsuper();\n\t}", "@Override\n\tprotected final JFreeChart createChart() {\n\t\tJFreeChart jFreeChart=null;\n\t\tIntervalXYDataset dataset=createDataset();\n\t\t\n\t\tjFreeChart=ChartFactory.createXYBarChart(title,xalabel, dateAxis, yalabel,dataset, por, legend, tooltips, urls);\n\t\t\n\t\tXYPlot plot=(XYPlot)jFreeChart.getPlot();\n\t\tpreRender(plot);\n\t\treturn jFreeChart; \n\t}", "private XYChart.Series<Number, Number> getTenSeries() {\n //Create new series\n XYChart.Series<Number, Number> series = new XYChart.Series<>();\n series.setName(\"Chemical Concentration\");\n Random rand = new Random();\n int c = 5; // Constant for x-axis scale\n for (int i = 0; i < 17; i++) {\n int y = rand.nextInt() % 3 + 2;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n series.getData().add(new XYChart.Data<>(17 * c, 4));\n series.getData().add(new XYChart.Data<>(18 * c, 5));\n series.getData().add(new XYChart.Data<>(19 * c-2,8));\n series.getData().add(new XYChart.Data<>(19 * c, 10));\n series.getData().add(new XYChart.Data<>(19 * c+2,8));\n series.getData().add(new XYChart.Data<>(20 * c, 6));\n series.getData().add(new XYChart.Data<>(21 * c, 4));\n\n for (int i = 22; i < 30; i++) {\n int y = rand.nextInt() % 3 + 2;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n return series;\n }", "public SalesRecords() {\n super();\n }", "public Qs() {\n this(\"qs\", null);\n }", "private XYChart.Series<Number, Number> getFortySeries() {\n //Create new series\n XYChart.Series<Number, Number> series = new XYChart.Series<>();\n series.setName(\"Chemical Concentration\");\n Random rand = new Random();\n int c = 5; // Constant for x-axis scale\n for (int i = 0; i < 17; i++) {\n int y = rand.nextInt() % 5 + 10;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n series.getData().add(new XYChart.Data<>(17 * c, 17));\n series.getData().add(new XYChart.Data<>(18 * c, 21));\n series.getData().add(new XYChart.Data<>(19 * c, 40));\n series.getData().add(new XYChart.Data<>(20 * c, 39));\n series.getData().add(new XYChart.Data<>(21 * c, 36));\n series.getData().add(new XYChart.Data<>(22 * c, 21));\n\n for (int i = 23; i < 30; i++) {\n int y = rand.nextInt() % 5 + 10;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n return series;\n }", "public SalesRecord() {\n super(Sales.SALES);\n }", "public Chart initializeChart();", "public static TickUnitSource createStandardDateTickUnits() {\n/* 1139 */ return createStandardDateTickUnits(TimeZone.getDefault(), \n/* 1140 */ Locale.getDefault());\n/* */ }", "public Trade() {\n\t}", "public Stock() {\n // initialize _stock array in max size\n _stock = new FoodItem[MAX_STOCK_SIZE];\n // set _noOfItem to 0 - no items yet\n _noOfItems = 0;\n }", "public Stock() {\n }", "private DefaultPieDataset getChartDataset() {\n if (this.pieDataset == null) {\n pieDataset = new DefaultPieDataset();\n List<String> model = this.handler.getSchema();\n model.stream().forEach((key) -> {\n pieDataset.setValue(key, 0d);\n });\n }\n return pieDataset;\n }", "public TradingDayInfo(String ticker, String date, double openingPrice, double highPrice, double lowPrice, double closingPrice) {\n this.ticker = ticker;\n this.date = date;\n this.openingPrice = openingPrice;\n this.highPrice = highPrice;\n this.lowPrice = lowPrice;\n this.closingPrice = closingPrice;\n \n \n return;\n }", "private void initializeChart(final List<DateCounter> data)\n {\n final XYSeries series = new XYSeries(TITLE_XY_SERIES);\n\n //Adding data to the chart\n addDataToXYSeries(data, series);\n\n //Finalizing the chart\n final XYSeriesCollection coll = new XYSeriesCollection(series);\n final JFreeChart chart = ChartFactory.createXYLineChart(TITLE_CHART, X_AXIS_TITLE,\n Y_AXIS_TITLE, coll, PlotOrientation.VERTICAL, true, true, false);\n final ChartPanel chartPanel = new ChartPanel(chart);\n chartPanel.setPreferredSize(new java.awt.Dimension(SIZE_CHART_PANEL, SIZE_CHART_PANEL));\n this.add(chartPanel, BorderLayout.CENTER);\n }", "private XYDataset createDataset() {\n\t\tfinal XYSeriesCollection dataset = new XYSeriesCollection( ); \n\t\tdataset.addSeries(trainErrors); \n\t\tdataset.addSeries(testErrors);\n\t\treturn dataset;\n\t}", "private void todayReport() {\n\t\tListSeries dollarEarning = new ListSeries();\n\t\tString[] dates = new String[1];\n\t\t/* Create a DateField with the default style. */\n Calendar calendar=Calendar.getInstance();\n\t\t\n\t\tvReportDisplayLayout.removeAllComponents();\n\t\tdates[0] = String.valueOf(calendar.get(Calendar.MONTH)+1) + \"/\" + \n\t\t\t\tString.valueOf(calendar.get(Calendar.DATE)) + \"/\" + \n\t\t\t\tString.valueOf(calendar.get(Calendar.YEAR));\n\t\tdollarEarning = getTodayData();\n\t\t\n\t\tdisplayChart chart = new displayChart();\n\t\t\n\t\tdReportPanel.setContent(chart.getDisplayChart(dates, dollarEarning));\n\t\tvReportDisplayLayout.addComponent(dReportPanel);\n\t}", "public static LogEvent createEmptyEvent()\n\t{\n\t\treturn new LogEvent();\n\t}", "Series<double[]> makeSeries(int dimension);", "public WebhookTriggerSeries() {\n this(DSL.name(\"webhook_trigger_series\"), null);\n }", "QuoteItem createQuoteItem();", "public StockExchange()\n {\n stocks = new ArrayList<Stock>();\n }", "private static XYDataset createDataset(Double[] x, Double[] y) {\n\t\tlogger.info(\"Creating Dataset\");\n\t\tXYSeries s1 = new XYSeries(Double.valueOf(1));\n\t\tif (x.length != y.length) {\n\t\t\tlogger.error(\"Error in createDataset of ScatterDialog. \" +\n\t\t\t\t\t\"Could not create a dataset for the scatter plot -- missing data\");\n\t\t\treturn null;\n\t\t}\n\t\tfor (int i = 0; i < x.length; i++) {\n\t\t\tif (y[i] != null) {\n\t\t\t\ts1.add(x[i], y[i]);\n\t\t\t}\n\t\t}\n\t\tXYSeriesCollection dataset = new XYSeriesCollection();\n\t\tdataset.addSeries(s1);\n\t\treturn dataset;\n\t}", "private void onCreateMoneyXYPlot(DateDoubleSeries coffeeExpenditureSeries, DateDoubleSeries teaExpenditureSeries) {\n // refreshes the chart (it will be loaded with default vals at this point)\n moneyXYPlot.clear();\n moneyXYPlot.redraw();\n\n // default graph: supports y from $0.00 to $20.00 in increments of $2.50, but this can be\n // overridden by very large values, in which case it's MAX_VALUE rounded to next\n // increment of $2.50, in increments of MAX_VALUE / 8\n double maxRange = 20;\n double maxYValue = Double.max(coffeeExpenditureSeries.getMaxYValue(), teaExpenditureSeries.getMaxYValue());\n if (maxYValue > 20) {\n if (maxYValue % 5 != 0) maxRange = maxYValue + (5 - (maxYValue % 5));\n else maxRange = maxYValue;\n }\n\n // formatting: add extra vals at beg/end (7 days +1 on each end = 9) to create a margin for the bars\n moneyXYPlot.setRangeStep(StepMode.SUBDIVIDE, 8);\n moneyXYPlot.setRangeBoundaries(0, maxRange, BoundaryMode.FIXED);\n moneyXYPlot.setDomainStep(StepMode.SUBDIVIDE, 10);\n\n // format the lines (color, smoothing, removing fill)\n LineAndPointFormatter coffeeLineFormatter = new LineAndPointFormatter(Color.parseColor(\"#ac9782\"),\n null, null, null);\n coffeeLineFormatter.getLinePaint().setStrokeWidth(8);\n coffeeLineFormatter.setInterpolationParams(new CatmullRomInterpolator.Params(20,\n CatmullRomInterpolator.Type.Centripetal)); // smooths out the lines\n coffeeLineFormatter.setFillPaint(null); // to prevent lines from filling .. may break in the future?\n LineAndPointFormatter teaLineFormatter = new LineAndPointFormatter(Color.parseColor(\"#4d7d55\"),\n null, null, null);\n teaLineFormatter.getLinePaint().setStrokeWidth(8);\n teaLineFormatter.setInterpolationParams(new CatmullRomInterpolator.Params(20,\n CatmullRomInterpolator.Type.Centripetal)); // smooths out the lines\n teaLineFormatter.setFillPaint(null);\n\n moneyXYPlot.addSeries(coffeeExpenditureSeries, coffeeLineFormatter);\n moneyXYPlot.addSeries(teaExpenditureSeries, teaLineFormatter);\n\n // initialize line and point renderer (must be done after set formatter and add series to the plot)\n moneyXYPlotRenderer = moneyXYPlot.getRenderer(LineAndPointRenderer.class);\n\n // X-AXIS = date values, formatted as \"10/27\"\n moneyXYPlot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).setFormat(new xAxisDateFormat());\n\n // Y-AXIS = dollar values, formatted as \"$50\"\n moneyXYPlot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.LEFT).setFormat(new Format() {\n @Override\n public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {\n // trying to format #'s like $13.50, but doesn't work for numbers ending in .0\n // double number = Double.parseDouble(String.format(\"%.2f\", ((Number) obj).doubleValue()));\n int number = ((Number) obj).intValue();\n return new StringBuffer(\"$\" + number);\n }\n\n @Override\n public Number parseObject(String string, ParsePosition position) {\n throw new UnsupportedOperationException(\"Not yet implemented.\");\n }\n });\n }", "private DefaultCategoryDataset createDataset() {\n\t\t\n\t\tdataset.clear();\n\t\t\n\t\t// Query HIM to submit data for bar chart display \n\t\tHistoricalInfoMgr.getChartDataset(expNum);\n\n\n\t\treturn dataset; // add the data point (y-value, variable, x-value)\n\t}", "protected BasicOrderedSeries( final BasicOrderedSeries< V > series )\n\t{\n\t\tsuper( series );\n\t}", "@Override\n\tpublic int getDatapointSeriesCount() {\n\t\treturn 0;\n\t}", "SeriesType createSeriesType();", "private void initChart() {\n Cartesian cartesian = AnyChart.line();\n\n cartesian.animation(true);\n\n cartesian.padding(10d, 20d, 5d, 20d);\n\n cartesian.crosshair().enabled(true);\n cartesian.crosshair()\n .yLabel(true)\n // TODO ystroke\n .yStroke((Stroke) null, null, null, (String) null, (String) null);\n\n cartesian.tooltip().positionMode(TooltipPositionMode.POINT);\n\n cartesian.title(\"Steps taken in this week and last week\");\n\n cartesian.yAxis(0).title(\"Steps\");\n cartesian.xAxis(0).labels().padding(5d, 5d, 5d, 5d);\n\n List<DataEntry> seriesData = new ArrayList<>();\n Log.d(\"Size This Week\",stepsTakenModelsThisWeek.size()+\"\");\n for(int i = 0 ; i<7 ; i++){\n CustomDataEntry c = new CustomDataEntry(days[i],stepsTakenModelsLastWeek.get(i).getSteps());\n if(i<stepsTakenModelsThisWeek.size()){\n c.setValue(\"value2\",stepsTakenModelsThisWeek.get(i).getSteps());\n }else{\n if(DateUtilities.getDayInAbbBySelectedDate(stepsTakenModelsLastWeek.get(i).getDate()).equals(\n DateUtilities.getCurrentDayInAbb()))\n {\n c.setValue(\"value2\",stepsToday);\n }else{\n c.setValue(\"value2\",0);\n }\n }\n seriesData.add(c);\n }\n\n Set set = Set.instantiate();\n set.data(seriesData);\n Mapping series1Mapping = set.mapAs(\"{ x: 'x', value: 'value' }\");\n Mapping series2Mapping = set.mapAs(\"{ x: 'x', value: 'value2' }\");\n\n Line series1 = cartesian.line(series1Mapping);\n series1.name(\"Last Week\");\n series1.hovered().markers().enabled(true);\n series1.hovered().markers()\n .type(MarkerType.CIRCLE)\n .size(4d);\n series1.tooltip()\n .position(\"right\")\n .anchor(Anchor.LEFT_CENTER)\n .offsetX(5d)\n .offsetY(5d);\n\n Line series2 = cartesian.line(series2Mapping);\n series2.name(\"This Week\");\n series2.hovered().markers().enabled(true);\n series2.hovered().markers()\n .type(MarkerType.CIRCLE)\n .size(4d);\n series2.tooltip()\n .position(\"right\")\n .anchor(Anchor.LEFT_CENTER)\n .offsetX(5d)\n .offsetY(5d);\n\n\n cartesian.legend().enabled(true);\n cartesian.legend().fontSize(13d);\n cartesian.legend().padding(0d, 0d, 10d, 0d);\n\n chart.setChart(cartesian);\n }", "public Stock(String sym)\n\t{\n\t\tthis(sym, 0);\n\t}", "public DailyMessagesChart(final String title, final List<DateCounter> data)\n {\n super(title);\n initializeChart(data);\n }", "private static KafkaUserQuotas emptyQuotas() {\n KafkaUserQuotas emptyQuotas = new KafkaUserQuotas();\n emptyQuotas.setProducerByteRate(null);\n emptyQuotas.setConsumerByteRate(null);\n emptyQuotas.setRequestPercentage(null);\n emptyQuotas.setControllerMutationRate(null);\n\n return emptyQuotas;\n }", "public SlotSeries build() {\n if (this.configuredSlots.size() == 0) {\n return new SlotSeries(new ArrayList<>(0));\n }\n\n final int slotCount = configuredSlots.lastKey() + 1;\n final List<Integer> slotList = new ArrayList<>(slotCount);\n\n for (int slotIndex = 0; slotIndex < slotCount; slotIndex++) {\n slotList.add(\n slotIndex,\n this.configuredSlots.getOrDefault(slotIndex, 0));\n }\n\n return new SlotSeries(slotList);\n }", "private void setupDailyBarChart() {\r\n BarChart chart = findViewById(R.id.chart);\r\n chart.getDescription().setEnabled(false);\r\n chart.setExtraOffsets(0, 0, 0, 10);\r\n chart.setNoDataText(getResources().getString(R.string.loading_graph));\r\n chart.getPaint(Chart.PAINT_INFO).setTextSize(Utils.convertDpToPixel(16f));\r\n chart.getLegend().setEnabled(false);\r\n\r\n // Show time on x-axis at three hour intervals\r\n XAxis xAxis = chart.getXAxis();\r\n xAxis.setValueFormatter(new IAxisValueFormatter() {\r\n @Override\r\n public String getFormattedValue(float value, AxisBase axis) {\r\n int valueInt = (int) value;\r\n if(valueInt == 0) {\r\n return \"12am\";\r\n } else if(valueInt > 0 && valueInt < 12) {\r\n return valueInt + \"am\";\r\n } else if(valueInt == 12) {\r\n return \"12pm\";\r\n } else {\r\n return (valueInt - 12) + \"pm\";\r\n }\r\n }\r\n });\r\n\r\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\r\n xAxis.setDrawGridLines(false);\r\n xAxis.setTextSize(14f);\r\n // show label for every three hours\r\n xAxis.setGranularity(3.0f);\r\n xAxis.setLabelCount(8);\r\n xAxis.setGranularityEnabled(true);\r\n\r\n // Show non-sedentary hours on left y-axis\r\n YAxis yAxisLeft = chart.getAxisLeft();\r\n yAxisLeft.setAxisMinimum(0f);\r\n yAxisLeft.setTextSize(14f);\r\n yAxisLeft.setGranularity(1.0f); // show integer values on y axis\r\n yAxisLeft.setGranularityEnabled(true);\r\n\r\n YAxis yAxisRight = chart.getAxisRight();\r\n yAxisRight.setEnabled(false);\r\n }", "public DataTable() {\n\n\t\t// In this application, we use HashMap data structure defined in\n\t\t// java.util.HashMap\n\t\tdc = new HashMap<String, DataColumn>();\n\t}", "public XYSeries(String name) {\n\t\tthis.name = name;\n\t\tpointList = new ArrayList<Point2D>(1024);\n\t}", "public TradeList() {\n this.trades = new ArrayList<>();\n }", "public java.util.List<Series> getSeries() { \n\t\tif (mySeries == null) {\n\t\t\tmySeries = new java.util.ArrayList<Series>();\n\t\t}\n\t\treturn mySeries;\n\t}", "public CoreChart()\n {\n super(\"org.apache.myfaces.trinidad.Chart\");\n }", "static Set createEmpty() {\n return new EmptySet();\n }", "public Series addSeries() {\n\t\tSeries newType = new Series();\n\t\tgetSeries().add(newType);\n\t\treturn newType; \n\t}", "public FillDate() {\n }", "public HighLowChart() {\n }", "private Object createDataset(final ChartConfiguration config) {\n final CategoryChart chart = (CategoryChart) config.chart;\n for (final Fields key: config.fields) {\n chart.addSeries(key.getLocalizedName(), new double[1], new double[1]);\n }\n populateDataset(config);\n return null;\n }", "public BreweriesAdapter() {\n }", "public LocalDateAdapter() {\r\n\t\tsuper();\r\n\t}", "public DateList() {\n DateNode ln = new DateNode(null);\n first = ln;\n last = ln;\n }", "private JFreeChart createChart ( final XYDataset dataset1, final XYDataset dataset2 ) {\n final JFreeChart result = ChartFactory.createTimeSeriesChart( null, \"\", \"\", dataset1, true, true, false );\n final XYPlot plot = result.getXYPlot();\n final XYItemRenderer renderer1 = new XYLineAndShapeRenderer( true, false );\n final XYItemRenderer renderer2 = new XYLineAndShapeRenderer( true, false );\n plot.setDomainPannable( true );\n plot.setRangePannable( true );\n plot.setDataset( SPEED_SERIES_DATASET, dataset2 );\n plot.mapDatasetToRangeAxis( SPEED_SERIES_DATASET, SPEED_SERIES_DATASET );\n plot.setRenderer( SPEED_SERIES_DATASET, renderer1 );\n plot.setDataset( POSITION_SERIES_DATASET, dataset1 );\n plot.mapDatasetToRangeAxis( POSITION_SERIES_DATASET, POSITION_SERIES_DATASET );\n plot.setRenderer( POSITION_SERIES_DATASET, renderer2 );\n plot.setBackgroundPaint( StartUI.MAIN_BACKGROUND_COLOR );\n plot.setDomainGridlinePaint( Color.decode(\"0x3b4246\") );\n plot.setRangeGridlinePaint( Color.decode(\"0x3b4246\") );\n plot.setRangeGridlineStroke( new BasicStroke( 0.8f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL ) );\n plot.setDomainGridlineStroke( new BasicStroke( 0.8f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL ) );\n renderer1.setSeriesPaint( 0, Color.decode( \"#AAFF44\" ) );\n renderer2.setSeriesPaint( 0, Color.decode( \"#EEDD00\" ) );\n result.setBackgroundPaint( null );\n result.removeLegend();\n return result;\n }", "private CreateScanRetentionTimeQCPlotData(){}", "public java.util.List<SeriesInstance> getInstance() { \n\t\tif (myInstance == null) {\n\t\t\tmyInstance = new java.util.ArrayList<SeriesInstance>();\n\t\t}\n\t\treturn myInstance;\n\t}", "public DateAxis(String label, TimeZone zone, Locale locale) {\n/* 402 */ super(label, createStandardDateTickUnits(zone, locale));\n/* 403 */ this.tickUnit = new DateTickUnit(DateTickUnitType.DAY, true, new SimpleDateFormat());\n/* */ \n/* 405 */ setAutoRangeMinimumSize(2.0D);\n/* */ \n/* 407 */ setRange(DEFAULT_DATE_RANGE, false, false);\n/* 408 */ this.dateFormatOverride = null;\n/* 409 */ this.timeZone = zone;\n/* 410 */ this.locale = locale;\n/* 411 */ this.timeline = DEFAULT_TIMELINE;\n/* */ }", "public SimpleDataPointImpl(DataSet dataSet){\n\t\tvalues = new HashMap<String, Double>();\n\t\tmDataSet = dataSet;\n\t}", "public static Query empty() {\n return new Query();\n }", "public static Metrics createDetached() {\n return new Metrics();\n }", "public Builder clearStocks() {\n if (stocksBuilder_ == null) {\n stocks_ = java.util.Collections.emptyList();\n bitField0_ = (bitField0_ & ~0x00000001);\n onChanged();\n } else {\n stocksBuilder_.clear();\n }\n return this;\n }", "public QuantDataHashTable() {\n\t\t\n\t\tquantData = new Hashtable<String, Double>();\n\t\t\n\t}", "public DanceChart build();", "public Quote(String ticker, String idfinam) {\n this.ticker = ticker;\n this.idfinam = idfinam;\n }", "public HourlyRecord() {\n\t\tthis(\"hourly_record\", null);\n\t}", "public static SupplyStock createEntity(EntityManager em) {\n SupplyStock supplyStock = new SupplyStock()\n .name(DEFAULT_NAME)\n .amount(DEFAULT_AMOUNT);\n return supplyStock;\n }", "public static < T > BasicOrderedSeries< T > copy( final BasicOrderedSeries< T > series )\n\t{\n\t\tRequire.notNull( series );\n\t\tfinal BasicOrderedSeries< T > copy = new BasicOrderedSeries< T >( series.size() );\n\t\t\n\t\tfor( BasicOrderedSeries.Entry< Double, T > entry : series )\n\t\t{\n\t\t\tcopy.add( entry.getKey(), entry.getElement() );\n\t\t}\n\t\t\n\t\treturn copy;\n\t}", "public UIXChart()\n {\n super(\"org.apache.myfaces.trinidad.Chart\");\n }", "public Quarter() { // note: null fields exist for this option\n courses = new ArrayList<Course>();\n }", "private XYMultipleSeriesDataset getdemodataset() {\n\t\t\tdataset1 = new XYMultipleSeriesDataset();// xy轴数据源\n\t\t\tseries = new XYSeries(\"温度 \");// 这个事是显示多条用的,显不显示在上面render设置\n\t\t\t// 这里相当于初始化,初始化中无需添加数据,因为如果这里添加第一个数据的话,\n\t\t\t// 很容易使第一个数据和定时器中更新的第二个数据的时间间隔不为两秒,所以下面语句屏蔽\n\t\t\t// 这里可以一次更新五个数据,这样的话相当于开始的时候就把五个数据全部加进去了,但是数据的时间是不准确或者间隔不为二的\n\t\t\t// for(int i=0;i<5;i++)\n\t\t\t// series.add(1, Math.random()*10);//横坐标date数据类型,纵坐标随即数等待更新\n\n\t\t\tdataset1.addSeries(series);\n\t\t\treturn dataset1;\n\t\t}", "QuoteType createQuoteType();", "private XYSeries createSeries(int scaleIndex) {\r\n // TODO: Bubble and time graphs ought to respect scaleIndex, but XYValueSeries\r\n // and TimeSeries don't expose the (String title, int scaleNumber) constructor.\r\n if (scaleIndex > 0 && !Graph.TYPE_XY.equals(mData.getType())) {\r\n throw new IllegalArgumentException(\"This series does not support a secondary y axis\");\r\n }\r\n\r\n if (Graph.TYPE_TIME.equals(mData.getType())) {\r\n return new TimeSeries(\"\");\r\n }\r\n if (Graph.TYPE_BUBBLE.equals(mData.getType())) {\r\n return new RangeXYValueSeries(\"\");\r\n }\r\n return new XYSeries(\"\", scaleIndex);\r\n }", "private void createChart() {\n\t\tchartSpace = CTChartSpace.Factory.newInstance();\n\t\tchart = chartSpace.addNewChart();\n\t\tCTPlotArea plotArea = chart.addNewPlotArea();\n\n\t\tplotArea.addNewLayout();\n\t\tchart.addNewPlotVisOnly().setVal(true);\n\n\t\tCTPrintSettings printSettings = chartSpace.addNewPrintSettings();\n\t\tprintSettings.addNewHeaderFooter();\n\n\t\tCTPageMargins pageMargins = printSettings.addNewPageMargins();\n\t\tpageMargins.setB(0.75);\n\t\tpageMargins.setL(0.70);\n\t\tpageMargins.setR(0.70);\n\t\tpageMargins.setT(0.75);\n\t\tpageMargins.setHeader(0.30);\n\t\tpageMargins.setFooter(0.30);\n\t\tprintSettings.addNewPageSetup();\n\t}", "public CellaredDrink() {\n\t\tthis(\"cellared_drink\", null);\n\t}", "public RDataframe() {\n\t\tsuper();\n\t}", "QuoteTerm createQuoteTerm();", "QuoteNote createQuoteNote();", "public TbStock() {\r\n\t\tsuper();\r\n\t}", "public OrderLine() {\n products = new ArrayList<>();\n price = new BigDecimal(0);\n }", "@Override\n public EventData next() {\n StockTick tick = new StockTick(names[RandomHelper.getIntFromRange(0, 4)]);\n tick.setTime(System.currentTimeMillis());\n tick.setPrice(MathHelper.getDouble(RandomHelper.getDoubleFromRange(34, 39), \"#.##\"));\n\n Map<String, Object> dataMap = new HashMap<>();\n dataMap.put(\"stockSymbol\", tick.getStockSymbol());\n dataMap.put(\"price\", tick.getPrice());\n dataMap.put(\"time\", tick.getTime());\n\n EventData edata = new EventData(\"StockTick\", dataMap);\n edata.addData(\"stockSymbol\", tick.getStockSymbol());\n edata.addData(\"price\", tick.getPrice());\n edata.addData(\"time\", tick.getTime());\n return edata;\n }" ]
[ "0.66558605", "0.60162497", "0.6010112", "0.57146883", "0.56819767", "0.54534674", "0.54357696", "0.53980863", "0.5316092", "0.529453", "0.5289731", "0.5283593", "0.5273274", "0.5261185", "0.52505434", "0.52478236", "0.5228155", "0.5222818", "0.52124697", "0.5108033", "0.5105942", "0.50713104", "0.5066853", "0.5046466", "0.50369614", "0.50348216", "0.50042886", "0.49828315", "0.49634302", "0.49529657", "0.49480304", "0.49440968", "0.4940839", "0.49198198", "0.49146572", "0.48988584", "0.48848417", "0.48753616", "0.4871647", "0.48708364", "0.48615712", "0.48455837", "0.4838955", "0.48364547", "0.4812503", "0.4811995", "0.47966427", "0.47634748", "0.47545153", "0.47539872", "0.47453126", "0.47438577", "0.47423977", "0.4736797", "0.47300637", "0.47217155", "0.47028202", "0.47022343", "0.46969363", "0.46876466", "0.4680855", "0.46726704", "0.4664134", "0.46626726", "0.46302915", "0.4612686", "0.46126306", "0.460962", "0.45957074", "0.45932615", "0.4585442", "0.458388", "0.45834497", "0.45814833", "0.45807332", "0.45774987", "0.4575833", "0.45754078", "0.4559568", "0.45562443", "0.4553501", "0.45430025", "0.45425883", "0.45419976", "0.45330504", "0.4531388", "0.45266977", "0.45210323", "0.45142433", "0.45110276", "0.45107865", "0.45054883", "0.45036873", "0.45000556", "0.4499403", "0.44976455", "0.4493078", "0.4491523", "0.44911164", "0.44907743" ]
0.6124297
1
Creates a new instance of DailyQuoteSeries from a collection.
public Series(Collection<Integer> series) { readCollection(series); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private XYDataset createDataset() {\n final XYSeriesCollection dataset = new XYSeriesCollection();\n //dataset.addSeries(totalDemand);\n dataset.addSeries(cerContent);\n //dataset.addSeries(cerDemand);\n dataset.addSeries(comContent);\n //dataset.addSeries(comDemand);\n dataset.addSeries(activation);\n dataset.addSeries(resolutionLevel);\n \n return dataset;\n }", "private XYSeries createSeries() {\r\n return createSeries(0);\r\n }", "private TaskSeriesCollection createCollection1() {\n TaskSeriesCollection result = new TaskSeriesCollection();\n TaskSeries s1 = new TaskSeries(\"S1\");\n s1.add(new Task(\"Task 1\", new Date(1), new Date(2)));\n s1.add(new Task(\"Task 2\", new Date(3), new Date(4)));\n result.add(s1);\n TaskSeries s2 = new TaskSeries(\"S2\");\n s2.add(new Task(\"Task 3\", new Date(5), new Date(6)));\n result.add(s2);\n return result;\n }", "public Series( String name, SortedMap<String, Long> dateCounters ) {\n\t\tthis.name = name;\n\t\tthis.type = DEFAULT_TYPE;\n\t\tdata = new ArrayList<Double[]>();\n\t\tfor ( Entry<String, Long> dateCounter : dateCounters.entrySet() ) {\n\t\t\tlong timestamp = DateConverter.dateStringToTimestamp( dateCounter.getKey() );\n\t\t\tdata.add( new Double [] { new Double(timestamp), new Double(dateCounter.getValue()) } );\n\t\t}\n\t}", "public Series () {\n super();\n this.price = RandomFill.generateNumber(5,15);\n this.listSeason = RandomFill.generateListSeason();\n }", "public Series()\n {\n super();\n }", "public StoredDay(LocalDate date) {\n this.date = date;\n this.recipes = new StoredRecipe[0];\n }", "Series<double[]> makeSeries(int dimension);", "public EventAdapter(ArrayList<Event> myDataset) {\n\t\tmDataset = myDataset;\n\t}", "private TaskSeriesCollection createCollection3() {\n Task sub1 = new Task(\"Sub1\", new Date(11), new Date(111));\n Task sub2 = new Task(\"Sub2\", new Date(22), new Date(222));\n Task sub3 = new Task(\"Sub3\", new Date(33), new Date(333));\n Task sub4 = new Task(\"Sub4\", new Date(44), new Date(444));\n Task sub5 = new Task(\"Sub5\", new Date(55), new Date(555));\n Task sub6 = new Task(\"Sub6\", new Date(66), new Date(666));\n sub1.setPercentComplete(0.111);\n sub2.setPercentComplete(0.222);\n sub3.setPercentComplete(0.333);\n sub4.setPercentComplete(0.444);\n sub5.setPercentComplete(0.555);\n sub6.setPercentComplete(0.666);\n TaskSeries seriesA = new TaskSeries(\"Series A\");\n Task taskA1 = new Task(\"Task 1\", new SimpleTimePeriod(new Date(100), new Date(200)));\n taskA1.setPercentComplete(0.1);\n taskA1.addSubtask(sub1);\n Task taskA2 = new Task(\"Task 2\", new SimpleTimePeriod(new Date(220), new Date(350)));\n taskA2.setPercentComplete(0.2);\n taskA2.addSubtask(sub2);\n taskA2.addSubtask(sub3);\n seriesA.add(taskA1);\n seriesA.add(taskA2);\n TaskSeries seriesB = new TaskSeries(\"Series B\");\n Task taskB2 = new Task(\"Task 2\", new SimpleTimePeriod(new Date(2220), new Date(3350)));\n taskB2.setPercentComplete(0.3);\n taskB2.addSubtask(sub4);\n taskB2.addSubtask(sub5);\n taskB2.addSubtask(sub6);\n seriesB.add(taskB2);\n TaskSeriesCollection tsc = new TaskSeriesCollection();\n tsc.add(seriesA);\n tsc.add(seriesB);\n return tsc;\n }", "private Object createDataset(final ChartConfiguration config) {\n final CategoryChart chart = (CategoryChart) config.chart;\n for (final Fields key: config.fields) {\n chart.addSeries(key.getLocalizedName(), new double[1], new double[1]);\n }\n populateDataset(config);\n return null;\n }", "public static < T > BasicOrderedSeries< T > copy( final BasicOrderedSeries< T > series )\n\t{\n\t\tRequire.notNull( series );\n\t\tfinal BasicOrderedSeries< T > copy = new BasicOrderedSeries< T >( series.size() );\n\t\t\n\t\tfor( BasicOrderedSeries.Entry< Double, T > entry : series )\n\t\t{\n\t\t\tcopy.add( entry.getKey(), entry.getElement() );\n\t\t}\n\t\t\n\t\treturn copy;\n\t}", "public DateAxis() { this(null); }", "public Series( String name, SortedMap<String, Long> dateCounters, SortedMap<String, Long> totalCounters ) {\n\t\tthis.name = name;\n\t\tthis.type = DEFAULT_TYPE;\n\t\tdata = new ArrayList<Double[]>();\n\t\tfor ( Entry<String, Long> dateCounter : dateCounters.entrySet() ) {\n\t\t\tlong timestamp = DateConverter.dateStringToTimestamp( dateCounter.getKey() );\n\t\t\t// get the total count for this date\n\t\t\tlong total = totalCounters.get( dateCounter.getKey() );\n\t\t\t// Avoid a divide by 0 if we simply don't have data for this time\n\t\t\tif ( total != 0 ) {\n\t\t\t\tdata.add( new Double [] { new Double(timestamp), new Double((double)dateCounter.getValue() / (double)total) * 100d } );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdata.add( new Double [] { new Double(timestamp), 0d } );\n\t\t\t}\n\t\t}\n\t}", "public BasicOrderedSeries()\n\t{\n\t\tsuper();\n\t}", "private static MarketDataSet createTestMarketData() {\n final MarketDataSet dataSet = MarketDataSet.empty();\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"AUDUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 1.8);\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"NZDUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 2.2);\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"GBPUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 1.5);\n dataSet.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"GBP1Y\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)),\n ImmutableLocalDateDoubleTimeSeries.builder()\n .putAll(new LocalDate[] {LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 2)}, new double[] {0.01, 0.02}).build());\n return dataSet;\n }", "private XYDataset createDataset() {\n\t\tfinal XYSeriesCollection dataset = new XYSeriesCollection( ); \n\t\tdataset.addSeries(trainErrors); \n\t\tdataset.addSeries(testErrors);\n\t\treturn dataset;\n\t}", "public StockRecyclerViewAdapter(ArrayList<StockData> myDataset) {\n mDataset = myDataset;\n }", "ArrayList<Serie> getSeries(){\n\n Uri builtUri = Uri.parse(seriesURL)\n .buildUpon()\n .build();\n String url = builtUri.toString();\n\n return doCallSerie(url);\n }", "static <R,C> DataFrame<R,C> ofDoubles(Iterable<R> rowKeys, C colKey) {\n return DataFrame.factory().from(rowKeys, Index.singleton(colKey), Double.class);\n }", "public SeriesModel(String title, LinkedHashMap<String, Episode> episodes) {\n\t\tsuper(title, episodes);\n\t}", "protected abstract Set<Event> createEvents(String[] dataset);", "private ListSeries getTodayData() {\n\t\tListSeries dollarEarning = new ListSeries();\n\t\tdouble number = 0;\n\t\tnumber = controler.getTodaysTransactionSummary();\n\t\tdollarEarning.addData(number);\n\t\t\n\t\treturn dollarEarning;\n\t}", "private void createChart() {\n LineChart lineChart = (LineChart) findViewById(R.id.line_chart);\n\n // LineChart DataSet\n ArrayList<LineDataSet> dataSets = new ArrayList<>();\n\n // x-coordinate format value\n XAxis xAxis = lineChart.getXAxis();\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n xAxis.setGranularity(1f); // only intervals of 1 day\n// xAxis.setValueFormatter(new DayAxisValueFormatter(lineChart));\n\n\n // x-coordinate value\n ArrayList<String> xValues = new ArrayList<>();\n xValues.add(\"No.1\");\n xValues.add(\"No.2\");\n xValues.add(\"No.3\");\n xValues.add(\"No.4\");\n xValues.add(\"No.5\");\n\n // value\n ArrayList<Entry> value = new ArrayList<>();\n String measureItemName = \"\";\n value.add(new Entry(100, 0));\n value.add(new Entry(120, 1));\n value.add(new Entry(150, 2));\n value.add(new Entry(250, 3));\n value.add(new Entry(500, 4));\n\n\n // add value to LineChart's DataSet\n LineDataSet valueDataSet = new LineDataSet(value, measureItemName);\n dataSets.add(valueDataSet);\n\n // set LineChart's DataSet to LineChart\n// lineChart.setData(new LineData(xValues, dataSets));\n lineChart.setData(new LineData(valueDataSet));\n }", "private static XYDataset createDataset(Double[] x, Double[] y) {\n\t\tlogger.info(\"Creating Dataset\");\n\t\tXYSeries s1 = new XYSeries(Double.valueOf(1));\n\t\tif (x.length != y.length) {\n\t\t\tlogger.error(\"Error in createDataset of ScatterDialog. \" +\n\t\t\t\t\t\"Could not create a dataset for the scatter plot -- missing data\");\n\t\t\treturn null;\n\t\t}\n\t\tfor (int i = 0; i < x.length; i++) {\n\t\t\tif (y[i] != null) {\n\t\t\t\ts1.add(x[i], y[i]);\n\t\t\t}\n\t\t}\n\t\tXYSeriesCollection dataset = new XYSeriesCollection();\n\t\tdataset.addSeries(s1);\n\t\treturn dataset;\n\t}", "static <R,C> DataFrame<R,C> ofDoubles(Iterable<R> rowKeys, Iterable<C> colKeys) {\n return DataFrame.factory().from(rowKeys, colKeys, Double.class);\n }", "public SalesRecord() {\n super(Sales.SALES);\n }", "public Series( String t, String s, String r){\n title = t;\n studio = s;\n rating = r;\n}", "public static final AbstractChart getLineChart(XYMultipleSeriesDataset dataset,\n XYMultipleSeriesRenderer renderer) {\n checkParameters(dataset, renderer);\n return new LineChart(dataset, renderer);\n }", "public SalesRecords() {\n super();\n }", "public CategoryDataset createDataset() {\n\t\tfinal DefaultCategoryDataset dataset = new DefaultCategoryDataset();\n\t\tProjectManagement projectManagement = new ProjectManagement();\n\t\tif (this.chartName == \"Earned Value\") {\n\t\t\tfor (LocalDate date : dateList) {\n\t\t\t\tdataset.addValue(projectManagement.getEarnedValue(date), \"Earned Value\", date);\n\t\t\t}\n\t\t} else if (this.chartName == \"Schedule Variance\") {\n\t\t\tfor (LocalDate date : dateList) {\n\t\t\t\tdataset.addValue(projectManagement.getScheduleVariance(date), \"Schedule Variance\", date);\n\t\t\t}\n\n\t\t} else {// Cost Variance\n\t\t\tfor (LocalDate date : dateList) {\n\t\t\t\tdataset.addValue(projectManagement.getCostVariance(date), \"Cost Variance\", date);\n\t\t\t}\n\t\t}\n\t\treturn dataset;\n\t}", "private XYDataset createDataset(String WellID, String lang) {\n final TimeSeries eur = createEURTimeSeries(WellID, lang);\n final TimeSeriesCollection dataset = new TimeSeriesCollection();\n dataset.addSeries(eur);\n return dataset;\n }", "public void initSalesList() {\n\n String sql = \"SELECT menu.id_product, menu.name, menu.price,size.size, COUNT(orders_menu.id_order) \"\n + \"FROM menu, orders_menu, orders, size WHERE menu.id_product=orders_menu.id_product \"\n + \"AND orders.id_order=orders_menu.id_order AND orders.id_status=4 \"\n + \"AND size.id_size=menu.id_size GROUP BY menu.id_product\";\n\n Session session = HibernateUtil.getSessionFactory().getCurrentSession();\n\n session.beginTransaction();\n List<Object[]> empDepts = session.createNativeQuery(sql).list();\n\n salesFxObservableList.clear();\n for (Object[] objects : empDepts) {\n SalesFx salesFx = new SalesFx();\n salesFx.setIdProduct((Integer) objects[0]);\n salesFx.setName((String) objects[1]);\n salesFx.setPrice((Integer) objects[2]);\n salesFx.setSize((String) objects[3]);\n BigInteger bigInteger = (BigInteger) objects[4];\n salesFx.setSale(bigInteger.intValue());\n salesFxObservableList.add(salesFx);\n }\n\n session.getTransaction().commit();\n }", "public MutualMarketTop10Daily() {\n this(\"mutual_market_top10_daily\", null);\n }", "public SurveyAdapter(List<Object> items) {\n this.items = items;\n }", "public Series addSeries() {\n\t\tSeries newType = new Series();\n\t\tgetSeries().add(newType);\n\t\treturn newType; \n\t}", "@Override\r\n\tpublic List<XChart> bindChart() {\n\t\tList<XChart> lst = new ArrayList<XChart>();\r\n\t\tlst.add(chart);\r\n\t\treturn lst;\r\n\t}", "QuoteItem createQuoteItem();", "public AlbumSeriesRecord() {\n super(AlbumSeries.ALBUM_SERIES);\n }", "public AlbumSeriesRecord(Long pk, Long albumFk, Long seriesFk, Boolean favorite) {\n super(AlbumSeries.ALBUM_SERIES);\n\n set(0, pk);\n set(1, albumFk);\n set(2, seriesFk);\n set(3, favorite);\n }", "Quote createQuote();", "public interface StockPriceDataSource {\n\n /**\n * daily prices\n * @param date required date, can be today\n * @return list of deals for the day\n */\n List<StockTrade> getDayPrices(LocalDate date) throws IOException;\n}", "private TaskSeriesCollection createCollection2() {\n TaskSeriesCollection result = new TaskSeriesCollection();\n TaskSeries s1 = new TaskSeries(\"S1\");\n Task t1 = new Task(\"Task 1\", new Date(10), new Date(20));\n t1.addSubtask(new Task(\"Task 1A\", new Date(10), new Date(15)));\n t1.addSubtask(new Task(\"Task 1B\", new Date(16), new Date(20)));\n t1.setPercentComplete(0.10);\n s1.add(t1);\n Task t2 = new Task(\"Task 2\", new Date(30), new Date(40));\n t2.addSubtask(new Task(\"Task 2A\", new Date(30), new Date(35)));\n t2.addSubtask(new Task(\"Task 2B\", new Date(36), new Date(40)));\n t2.setPercentComplete(0.20);\n s1.add(t2);\n result.add(s1);\n TaskSeries s2 = new TaskSeries(\"S2\");\n Task t3 = new Task(\"Task 3\", new Date(50), new Date(60));\n t3.addSubtask(new Task(\"Task 3A\", new Date(50), new Date(55)));\n t3.addSubtask(new Task(\"Task 3B\", new Date(56), new Date(60)));\n t3.setPercentComplete(0.30);\n s2.add(t3);\n result.add(s2);\n return result;\n }", "public ICareDailyDietChart() {\n\n\t}", "static <R,C> DataFrame<R,C> ofDoubles(Iterable<R> rowKeys, Iterable<C> colKeys, ToDoubleFunction<DataFrameValue<R,C>> initials) {\n return DataFrame.factory().from(rowKeys, colKeys, Double.class).applyDoubles(initials);\n }", "private LineDataSet createSet(){\n LineDataSet set = new LineDataSet(null, \"SPL Db\");\n set.setDrawCubic(true);\n set.setCubicIntensity(0.2f);\n set.setAxisDependency(YAxis.AxisDependency.LEFT);\n set.setColor(ColorTemplate.getHoloBlue());\n set.setLineWidth(2f);\n set.setCircleSize(4f);\n set.setFillAlpha(65);\n set.setFillColor(ColorTemplate.getHoloBlue());\n set.setHighLightColor(Color.rgb(244,117,177));\n set.setValueTextColor(Color.WHITE);\n set.setValueTextSize(10f);\n\n return set;\n }", "private Chart(){}", "private void createTestData(OHLCSeriesCollection seriesCollection) {\n\t OHLCSeries series = seriesCollection.getSeries(0);\n\t for (int i = 0; i < 10; i++) {\n\t // Generate new bar time\n\t Calendar cal = Calendar.getInstance();\n\t cal.add(Calendar.MINUTE, i);\n\t FixedMillisecond fm = new FixedMillisecond(cal.getTime());\n\t // Add bar to the data. Let's repeat the same bar\n\t series.add(fm, 100, 110, 90, 105);\n\t }\n\t}", "SeriesType createSeriesType();", "public static final AbstractChart getScatterChart(XYMultipleSeriesDataset dataset,\n XYMultipleSeriesRenderer renderer) {\n checkParameters(dataset, renderer);\n return new ScatterChart(dataset, renderer);\n }", "private DefaultCategoryDataset createDataset() {\n\t\t\n\t\tdataset.clear();\n\t\t\n\t\t// Query HIM to submit data for bar chart display \n\t\tHistoricalInfoMgr.getChartDataset(expNum);\n\n\n\t\treturn dataset; // add the data point (y-value, variable, x-value)\n\t}", "public Series(String title, String description, int duration, Distributor distributor, String[] country, double score, Date productionDate, String type, String[] actors, double price, ArrayList<Season> listSeason) {\n super(title, description, duration, distributor, country, score, productionDate, type, actors);\n this.price = price;\n this.listSeason = listSeason;\n }", "private XYChart.Series<Number, Number> getTenSeries() {\n //Create new series\n XYChart.Series<Number, Number> series = new XYChart.Series<>();\n series.setName(\"Chemical Concentration\");\n Random rand = new Random();\n int c = 5; // Constant for x-axis scale\n for (int i = 0; i < 17; i++) {\n int y = rand.nextInt() % 3 + 2;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n series.getData().add(new XYChart.Data<>(17 * c, 4));\n series.getData().add(new XYChart.Data<>(18 * c, 5));\n series.getData().add(new XYChart.Data<>(19 * c-2,8));\n series.getData().add(new XYChart.Data<>(19 * c, 10));\n series.getData().add(new XYChart.Data<>(19 * c+2,8));\n series.getData().add(new XYChart.Data<>(20 * c, 6));\n series.getData().add(new XYChart.Data<>(21 * c, 4));\n\n for (int i = 22; i < 30; i++) {\n int y = rand.nextInt() % 3 + 2;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n return series;\n }", "public XYSeries getXYSeries(String serie_name){ \n XYSeries serie = new XYSeries(serie_name); \n Point2D[] points_bezier = getPoint2DArray(); \n for(int j = 0 ; j < points_bezier.length; j++){ \n \n serie.add(points_bezier[j].getX(),points_bezier[j].getY()); \n } \n return serie; \n}", "public abstract LocalDateDoubleTimeSeries getTimeSeries(ObservableKey key);", "private QuoteItem createQuoteItemsFromCommerceItem(\n\t\t\tfinal SiebelCommerceItem sblCommerceItem) {\n\t\tQuoteItem quoteItem = new QuoteItem();\n\t\tString id = (!StringUtils.isBlank(sblCommerceItem.getQuoteItemId()))?sblCommerceItem.getQuoteItemId():sblCommerceItem.getId();\n\t\tquoteItem.setId(id);\n\t\tfor (SiebelCommerceItem childCommerceItem : (List<SiebelCommerceItem>) sblCommerceItem\n\t\t\t\t.getCommerceItems()) {\n\t\t\tQuoteItem childQuote = createQuoteItemsFromCommerceItem(childCommerceItem);\n\t\t\tquoteItem.getQuoteItem().add(childQuote);\n\t\t}\n\t\treturn quoteItem;\n\t}", "public StockExchange()\n {\n stocks = new ArrayList<Stock>();\n }", "public static < T > BasicOrderedSeries< T > copy( final IntegerOrderedSeries< T > series )\n\t{\n\t\tRequire.notNull( series );\n\t\tfinal BasicOrderedSeries< T > copy = new BasicOrderedSeries< T >( series.size() );\n\t\t\n\t\tfor( BasicOrderedSeries.Entry< Integer, T > entry : series )\n\t\t{\n\t\t\tcopy.add( (double)(int)entry.getKey(), entry.getElement() );\n\t\t}\n\t\t\n\t\treturn copy;\n\t}", "public interface TimeSeriesCollection {\n\n /** The getData() methods returns List of objects of this Class */\n public Class getDataClass();\n\n /** Get number of points in the series */\n public int getNumTimes();\n\n /** get the time of the nth point. */\n public double getTime(int timePt);\n\n /**\n * Get the units of Calendar time.\n * To get a Date, from a time value, call DateUnit.getStandardDate(double value).\n * To get units as a String, call DateUnit.getUnitsString().\n */\n public ucar.nc2.units.DateUnit getTimeUnits();\n\n /** Get the data for the nth point. @return Object of type getDataClass() */\n public Object getData(int timePt);\n}", "public Dataset from(Iri... iris) {\n\t\taddElements(SparqlBuilder::from, iris);\n\n\t\treturn this;\n\t}", "protected abstract Collection createCollection();", "public MockAggregateEvent(List<QuoteEvent> inCompositeEvents)\n {\n this(new Date(),\n new Equity(\"METC\"));\n compositeEvents.addAll(inCompositeEvents);\n }", "public Series (String t, String s){\n title = t;\n studio = s;\n rating = \"PG\";\n}", "public HumidityChart() {\n this(new XYSeriesCollection());\n }", "Dates() {\n clear();\n }", "protected abstract SingleTypeAdapter<E> createAdapter( final List<E> items );", "private XYDataset createDataset() {\n\t \tXYSeriesCollection dataset = new XYSeriesCollection();\n\t \t\n\t \t//Definir cada Estacao\n\t\t XYSeries aes1 = new XYSeries(\"Estação1\");\n\t\t XYSeries aes2 = new XYSeries(\"Estação2\");\n\t\t XYSeries aes3 = new XYSeries(\"Estação3\");\n\t\t XYSeries aes4 = new XYSeries(\"Estação4\");\n\t\t XYSeries aes5 = new XYSeries(\"Estação5\");\n\t\t XYSeries aes6 = new XYSeries(\"Estação6\");\n\t\t XYSeries aes7 = new XYSeries(\"Estação7\");\n\t\t XYSeries aes8 = new XYSeries(\"Estação8\");\n\t\t XYSeries aes9 = new XYSeries(\"Estação9\");\n\t\t XYSeries aes10 = new XYSeries(\"Estação10\");\n\t\t XYSeries aes11 = new XYSeries(\"Estação11\");\n\t\t XYSeries aes12 = new XYSeries(\"Estação12\");\n\t\t XYSeries aes13 = new XYSeries(\"Estação13\");\n\t\t XYSeries aes14 = new XYSeries(\"Estação14\");\n\t\t XYSeries aes15 = new XYSeries(\"Estação15\");\n\t\t XYSeries aes16 = new XYSeries(\"Estação16\");\n\t\t \n\t\t //Definir numero de utilizadores em simultaneo para aparece na Interface\n\t\t XYSeries au1 = new XYSeries(\"AU1\");\n\t\t XYSeries au2 = new XYSeries(\"AU2\");\n\t\t XYSeries au3 = new XYSeries(\"AU3\");\n\t\t XYSeries au4 = new XYSeries(\"AU4\");\n\t\t XYSeries au5 = new XYSeries(\"AU5\");\n\t\t XYSeries au6 = new XYSeries(\"AU6\");\n\t\t XYSeries au7 = new XYSeries(\"AU7\");\n\t\t XYSeries au8 = new XYSeries(\"AU8\");\n\t\t XYSeries au9 = new XYSeries(\"AU9\");\n\t\t XYSeries au10 = new XYSeries(\"AU10\");\n\t\t \n\t\t //Colocar estacoes no gráfico\n\t\t aes1.add(12,12);\n\t\t aes2.add(12,37);\n\t\t aes3.add(12,62);\n\t\t aes4.add(12,87);\n\t\t \n\t\t aes5.add(37,12);\n\t\t aes6.add(37,37);\n\t\t aes7.add(37,62);\n\t\t aes8.add(37,87);\n\t\t \n\t\t aes9.add(62,12); \n\t\t aes10.add(62,37);\n\t\t aes11.add(62,62);\n\t\t aes12.add(62,87);\n\t\t \n\t\t aes13.add(87,12);\n\t\t aes14.add(87,37);\n\t\t aes15.add(87,62);\n\t\t aes16.add(87,87);\n\t\t \n\t\t//Para a bicicleta 1\n\t\t \t\n\t\t\t for(Entry<String, String> entry : position1.entrySet()) {\n\t\t\t\t String key = entry.getKey();\n\t\t\t\t \n\t\t\t\t String[] part= key.split(\",\");\n\t\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t\t \n\t\t\t\t au1.add(keyX,keyY);\n\t\t\t }\n\t\t \n\t\t\t //Para a bicicleta 2\n\t\t for(Entry<String, String> entry : position2.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au2.add(keyX,keyY);\n\t\t }\n\t\t \n\t\t //Para a bicicleta 3\n\t\t for(Entry<String, String> entry : position3.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au3.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position4.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au4.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position5.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au5.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position6.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au6.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position7.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au7.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position8.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au8.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position9.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au9.add(keyX,keyY);\n\t\t }\n\t\t for(Entry<String, String> entry : position10.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t \n\t\t\t String[] part= key.split(\",\");\n\t\t\t double keyX=Double.valueOf(part[0]);\n\t\t\t double keyY=Double.valueOf(part[1]);\n\t\t\t \n\t\t\t au10.add(keyX,keyY);\n\t\t }\n\t\t \n\t\t //Add series to dataset\n\t\t dataset.addSeries(au1);\n\t\t dataset.addSeries(au2);\n\t\t dataset.addSeries(au3);\n\t\t dataset.addSeries(au4);\n\t\t dataset.addSeries(au5);\n\t\t dataset.addSeries(au6);\n\t\t dataset.addSeries(au7);\n\t\t dataset.addSeries(au8);\n\t\t dataset.addSeries(au9);\n\t\t dataset.addSeries(au10);\n\t\t \n\t\t \n\t\t dataset.addSeries(aes1);\n\t\t dataset.addSeries(aes2);\n\t\t dataset.addSeries(aes3);\n\t\t dataset.addSeries(aes4);\n\t\t dataset.addSeries(aes5);\n\t\t dataset.addSeries(aes6);\n\t\t dataset.addSeries(aes7);\n\t\t dataset.addSeries(aes8);\n\t\t dataset.addSeries(aes9);\n\t\t dataset.addSeries(aes10);\n\t\t dataset.addSeries(aes11);\n\t\t dataset.addSeries(aes12);\n\t\t dataset.addSeries(aes13);\n\t\t dataset.addSeries(aes14);\n\t\t dataset.addSeries(aes15);\n\t\t dataset.addSeries(aes16);\n\t\t \n\t\t return dataset;\n\t }", "private JPanel createChartPanel(XYSeriesCollection li) {\n\n String chartTitle = \" Movement Chart\";\n String xAxisLabel = \"Matrix Size\";\n String yAxisLabel = \"time in ms\";\n\n XYSeriesCollection dataset = li;\n // System.out.println(\"tesst count \" + dataset.getSeriesCount());\n\n //XYDataset dataset = createDataset(li);\n JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset);\n XYPlot plot = chart.getXYPlot();\n XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();\n plot.setRenderer(renderer);\n\n return new ChartPanel(chart);\n }", "private XYChart.Series<Number, Number> getFortySeries() {\n //Create new series\n XYChart.Series<Number, Number> series = new XYChart.Series<>();\n series.setName(\"Chemical Concentration\");\n Random rand = new Random();\n int c = 5; // Constant for x-axis scale\n for (int i = 0; i < 17; i++) {\n int y = rand.nextInt() % 5 + 10;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n series.getData().add(new XYChart.Data<>(17 * c, 17));\n series.getData().add(new XYChart.Data<>(18 * c, 21));\n series.getData().add(new XYChart.Data<>(19 * c, 40));\n series.getData().add(new XYChart.Data<>(20 * c, 39));\n series.getData().add(new XYChart.Data<>(21 * c, 36));\n series.getData().add(new XYChart.Data<>(22 * c, 21));\n\n for (int i = 23; i < 30; i++) {\n int y = rand.nextInt() % 5 + 10;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n return series;\n }", "public IndexedSetView(final Collection<T> items) {\n\t\tthis(items, Random.class);\n\t}", "public Frequency(ArrayList<LottoDay> list) {\n\n\t\tfill(list);//fill the maps\n\t}", "public MyAdapter(ArrayList<MyData> myDataset) {\n\n mDataset = myDataset;\n }", "private XYMultipleSeriesDataset getdemodataset() {\n\t\t\tdataset1 = new XYMultipleSeriesDataset();// xy轴数据源\n\t\t\tseries = new XYSeries(\"温度 \");// 这个事是显示多条用的,显不显示在上面render设置\n\t\t\t// 这里相当于初始化,初始化中无需添加数据,因为如果这里添加第一个数据的话,\n\t\t\t// 很容易使第一个数据和定时器中更新的第二个数据的时间间隔不为两秒,所以下面语句屏蔽\n\t\t\t// 这里可以一次更新五个数据,这样的话相当于开始的时候就把五个数据全部加进去了,但是数据的时间是不准确或者间隔不为二的\n\t\t\t// for(int i=0;i<5;i++)\n\t\t\t// series.add(1, Math.random()*10);//横坐标date数据类型,纵坐标随即数等待更新\n\n\t\t\tdataset1.addSeries(series);\n\t\t\treturn dataset1;\n\t\t}", "public LineChart() {\n init();\n }", "protected XSSFChart() {\n\t\tsuper();\n\t\tcreateChart();\n\t}", "public TimeSeries getTimeSeries(String serie_name){ \n //First, we create the TimeSeries to return \n TimeSeries time_serie= new TimeSeries(serie_name,Second.class); \n \n //Gets the Bezier curves \n Point2D[] points_bezier = getPoint2DArray(); \n \n for(int j = 0 ; j < points_bezier.length; j++){ \n //System.out.println(j + \" X --> \" + points_bezier[j].getX()); \n //time_serie.add(RegularTimePeriod.createInstance(Second.class,new Date((long)points_bezier[j].getX()),RegularTimePeriod.DEFAULT_TIME_ZONE),points_bezier[j].getY()); \n time_serie.add(new Second(new Date((long)points_bezier[j].getX())),points_bezier[j].getY()); \n } \n \n \n return time_serie; \n}", "public void addDailyReport(GregorianCalendar date, LinkedList<Reading> readings){\r\n LinkedList<Double> loRainfall = new LinkedList<>();\r\n LinkedList<Double> loTemp = new LinkedList<>();\r\n for(Reading read : readings)\r\n loRainfall.add(read.getRainfall());\r\n for(Reading read : readings)\r\n loTemp.add(read.getTemp());\r\n dailyReports.add(new DailyWeatherReport(date, loTemp, loRainfall));\r\n }", "ResourceCollection<SubscriptionDailyUsageRecord> get();", "private void initChart() {\n Cartesian cartesian = AnyChart.line();\n\n cartesian.animation(true);\n\n cartesian.padding(10d, 20d, 5d, 20d);\n\n cartesian.crosshair().enabled(true);\n cartesian.crosshair()\n .yLabel(true)\n // TODO ystroke\n .yStroke((Stroke) null, null, null, (String) null, (String) null);\n\n cartesian.tooltip().positionMode(TooltipPositionMode.POINT);\n\n cartesian.title(\"Steps taken in this week and last week\");\n\n cartesian.yAxis(0).title(\"Steps\");\n cartesian.xAxis(0).labels().padding(5d, 5d, 5d, 5d);\n\n List<DataEntry> seriesData = new ArrayList<>();\n Log.d(\"Size This Week\",stepsTakenModelsThisWeek.size()+\"\");\n for(int i = 0 ; i<7 ; i++){\n CustomDataEntry c = new CustomDataEntry(days[i],stepsTakenModelsLastWeek.get(i).getSteps());\n if(i<stepsTakenModelsThisWeek.size()){\n c.setValue(\"value2\",stepsTakenModelsThisWeek.get(i).getSteps());\n }else{\n if(DateUtilities.getDayInAbbBySelectedDate(stepsTakenModelsLastWeek.get(i).getDate()).equals(\n DateUtilities.getCurrentDayInAbb()))\n {\n c.setValue(\"value2\",stepsToday);\n }else{\n c.setValue(\"value2\",0);\n }\n }\n seriesData.add(c);\n }\n\n Set set = Set.instantiate();\n set.data(seriesData);\n Mapping series1Mapping = set.mapAs(\"{ x: 'x', value: 'value' }\");\n Mapping series2Mapping = set.mapAs(\"{ x: 'x', value: 'value2' }\");\n\n Line series1 = cartesian.line(series1Mapping);\n series1.name(\"Last Week\");\n series1.hovered().markers().enabled(true);\n series1.hovered().markers()\n .type(MarkerType.CIRCLE)\n .size(4d);\n series1.tooltip()\n .position(\"right\")\n .anchor(Anchor.LEFT_CENTER)\n .offsetX(5d)\n .offsetY(5d);\n\n Line series2 = cartesian.line(series2Mapping);\n series2.name(\"This Week\");\n series2.hovered().markers().enabled(true);\n series2.hovered().markers()\n .type(MarkerType.CIRCLE)\n .size(4d);\n series2.tooltip()\n .position(\"right\")\n .anchor(Anchor.LEFT_CENTER)\n .offsetX(5d)\n .offsetY(5d);\n\n\n cartesian.legend().enabled(true);\n cartesian.legend().fontSize(13d);\n cartesian.legend().padding(0d, 0d, 10d, 0d);\n\n chart.setChart(cartesian);\n }", "public void addSeries(DataSeries aSeries) { _dataSet.addSeries(aSeries); }", "public BasicOrderedSeries( final int initialCapacity )\n\t{\n\t\tsuper( initialCapacity );\n\t}", "public List<Quote> getQuoteHistory(Instrument instrument, Period period, \r\n \t\tDate fromDate, Date toDate)\r\n throws PersistenceException;", "public static Sale fromArray(String[] line) {\n\t\tSale sale = new Sale();\n\t\tsale.setId(Long.parseLong(line[1]));\n\n\t\t// Parse and calculate Sale value\n\t\tdouble totalSale = 0;\n\t\tString[] strItems = line[2].replace(\"[\", \"\").replace(\"]\", \"\").split(\",\");\n\t\tif (strItems.length > 0){\n\t\t\tfor(String strItem : strItems){\n\t\t\t\tString[] itemSplit = strItem.split(\"-\");\n\t\t\t\tif (itemSplit.length == 3){\n\t\t\t\t\tdouble totalItem = Double.parseDouble(itemSplit[1]) * Double.parseDouble(itemSplit[2]);\n\t\t\t\t\ttotalSale += totalItem;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsale.setTotal(totalSale);\n\t\treturn sale;\n\n\t}", "private static void insertTimeSeriesOneDim(final ScriptEngine engine,\r\n final DataArray data) throws Exception {\r\n List<DataEntry> time = data.getDate();\r\n int freq = TimeUtils.getFrequency(time);\r\n List<Double> doubleList = data.getDouble();\r\n double[] doubleArray = new double[doubleList.size()];\r\n for (int i = 0; i < doubleList.size(); i++) {\r\n doubleArray[i] = doubleList.get(i);\r\n }\r\n engine.put(\"my_double_vector\", doubleArray);\r\n engine.eval(\"ts_0 <- ts(my_double_vector, frequency = \"\r\n + freq + \")\");\r\n }", "public Literature convertToSeries() {\n BookSeries bookSeries = new BookSeries(getTitle(), getPublisher(), getGenre(), getAuthor());\n bookSeries.addBookToSeries(this);\n return bookSeries;\n }", "static <R,C> DataFrame<R,C> ofObjects(Iterable<R> rowKeys, C colKey) {\n return DataFrame.factory().from(rowKeys, Index.singleton(colKey), Object.class);\n }", "public DailyReport genDailyReport(GregorianCalendar date) \n\t\t\tthrows SQLException, ClassNotFoundException, IOException\n\t{\n\t\tif(this.conn == null)\n\t\t\tthis.conn = JDBCConnection.getConnection();\n\n\t\tString sql = \"SELECT I.upc, \\n\" +\n\t\t\t\t \t \" I.category, \\n\" +\n\t\t\t\t \t \" I.price, \\n\" +\n\t\t\t\t \t \" PI.quantity, \\n\" +\n\t\t\t\t \t \" I.price * PI.quantity \\n\" +\n\t\t\t\t \t \"FROM Purchase P, PurchaseItem PI, Item I \\n\" +\n\t\t\t\t \t \"WHERE P.receiptId = PI.receiptId AND \\n\" +\n\t\t\t\t \t \" PI.upc = I.upc AND \\n\" +\n\t\t\t\t \t \" P.pDate = ? \\n\" +\n\t\t\t\t \t \"ORDER BY I.category \\n\";\n\t\tPreparedStatement stmt = conn.prepareStatement(sql);\n\t\tDate temp = new Date(date.get(Calendar.YEAR) - 1900, \n\t\t\t\t\t\t\t date.get(Calendar.MONTH) - 1, \n\t\t\t\t\t\t\t date.get(Calendar.DAY_OF_MONTH));\n\t\tstmt.setDate(1, temp);\n\t\t\n\t\ttry\n\t\t{\n\t\t\tResultSet result = stmt.executeQuery();\n\t\t\tArrayList<Triple<String, ArrayList<ReportItem>, Double>>\n\t\t\t\ttuples = new ArrayList<Triple<String, ArrayList<ReportItem>, Double>>();\n\n\t\t\tif(!result.next())\n\t\t\t//if empty resultset, return empty report\n\t\t\t\treturn new DailyReport(tuples);\n\t\t\t\n\t\t\t//3 Passes:\n\t\t\t//1st: Store everything on the list\n\t\t\tArrayList<ReportItem> raw_list = new ArrayList<ReportItem>();\n\t\t\tdo\n\t\t\t{\n\t\t\t\tString upc = result.getString(1);\n\t\t\t\tString cat = result.getString(2);\n\t\t\t\tdouble price_$ = result.getDouble(3);\n\t\t\t\tint qty_sold = result.getInt(4);\n\t\t\t\tdouble total_$ = result.getDouble(5);\n\n\t\t\t\tReportItem item = new ReportItem(upc, cat, price_$, qty_sold, total_$);\n\t\t\t\traw_list.add(item);\t\n\t\t\t}while(result.next());\n\t\t\t\n\t\t\t//2nd: combine any duplicate item\n\t\t\tArrayList<ReportItem> lst_no_dup = new ArrayList<ReportItem>();\n\t\t\tfor(int row = 0; row < raw_list.size(); row++)\n\t\t\t{\n\t\t\t\tString current_upc = raw_list.get(row).getUPC();\n\t\t\t\tint unit_sold = raw_list.get(row).getUnits();\n\t\t\t\tdouble item_total = raw_list.get(row).getTotalSale();\n\t\t\t\tfor(int fol_row = row + 1; \n\t\t\t\t\tfol_row < raw_list.size() && \n\t\t\t\t\t\t\traw_list.get(fol_row).getUPC().equals(current_upc); \n\t\t\t\t\tfol_row++)\n\t\t\t\t{\n\t\t\t\t\tunit_sold += raw_list.get(fol_row).getUnits();\n\t\t\t\t\titem_total += raw_list.get(fol_row).getTotalSale();\n\t\t\t\t\trow = fol_row;\n\t\t\t\t}\n\t\t\t\tReportItem itm = new ReportItem(raw_list.get(row).getUPC(),\n\t\t\t\t\t\t\t\t\t\t\t\traw_list.get(row).getCategory(),\n\t\t\t\t\t\t\t\t\t\t\t\traw_list.get(row).getUnitPrices(),\n\t\t\t\t\t\t\t\t\t\t\t\tunit_sold, item_total);\n\t\t\t\tlst_no_dup.add(itm);\n\t\t\t}\n\t\t\t\n\t\t\t//3rd: accounting for each category\n\t\t\tfor(int row = 0; row < lst_no_dup.size(); row++)\n\t\t\t{\n\t\t\t\tString current_cat = lst_no_dup.get(row).getCategory();\n\t\t\t\tdouble cat_total = lst_no_dup.get(row).getTotalSale();\n\t\t\t\tint start_ind = row;\n\t\t\t\tint end_ind = row;\n\t\t\t\tfor(int fol_row = row + 1; \n\t\t\t\t\tfol_row < lst_no_dup.size() && \n\t\t\t\t\tlst_no_dup.get(fol_row).getCategory().equals(current_cat);\n\t\t\t\t\tfol_row++)\n\t\t\t\t{\n\t\t\t\t\tcat_total += lst_no_dup.get(fol_row).getTotalSale();\n\t\t\t\t\trow = fol_row;\n\t\t\t\t\tend_ind++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//make a sublist:\n\t\t\t\tArrayList<ReportItem> sublist = new ArrayList<ReportItem>();\n\t\t\t\tfor(int col = start_ind; col <= end_ind; col++)\n\t\t\t\t\tsublist.add(lst_no_dup.get(col));\n\t\t\t\t\n\t\t\t\tTriple<String, ArrayList<ReportItem>, Double>\n\t\t\t\ta_tuple = new Triple<String, ArrayList<ReportItem>, Double>\n\t\t\t\t\t\t\t\t(current_cat, sublist, new Double(cat_total));\n\t\t\t\ttuples.add(a_tuple);\n\t\t\t}\n\t\t\t\n\t\t\treturn new DailyReport(tuples);\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tstmt.close();\n\t\t}\n\t}", "static <R,C> DataFrame<R,C> ofDoubles(R rowKey, Iterable<C> colKeys) {\n return DataFrame.factory().from(Index.singleton(rowKey), colKeys, Double.class);\n }", "public static Dataset createDataset(RepositoryConnection connection)\n {\n DatasetGraph dsg = new JenaSesameDatasetGraph(connection) ;\n return DatasetFactory.wrap(dsg) ;\n }", "public TradingDayInfo(String ticker, String date, double openingPrice, double highPrice, double lowPrice, double closingPrice) {\n this.ticker = ticker;\n this.date = date;\n this.openingPrice = openingPrice;\n this.highPrice = highPrice;\n this.lowPrice = lowPrice;\n this.closingPrice = closingPrice;\n \n \n return;\n }", "public XYSeries(String name) {\n\t\tthis.name = name;\n\t\tpointList = new ArrayList<Point2D>(1024);\n\t}", "public FeedCustomAdapter(List<Post> dataSet) {\n outfitDataSet = dataSet;\n }", "@Override\n\tpublic void addSeries(final String title, final double[] xs,\n\t\t\tfinal double[] ys) {\n\t\tXYSeries series = new XYSeries(title, false, true);\n\t\tfor (int i = 0, n = Math.min(xs.length, ys.length); i < n; i++) {\n\t\t\tseries.add(xs[i], ys[i]);\n\t\t}\n\t\tthis.dataset.addSeries(series);\n\t}", "@NonNull\n default T feed(\n @NonNull Iterator<Map<String, Object>> feeder, Function<Session, Integer> numberOfRecords) {\n return ScalaFeeds.apply(this, feeder, numberOfRecords);\n }", "public ServiceIndexesPerDateRecord() {\n super(ServiceIndexesPerDate.SERVICE_INDEXES_PER_DATE);\n }", "@Override\r\n\tpublic boolean addAll(Collection<? extends SeriesEntry> c)\r\n\t{\n\t\tthrow new UnsupportedOperationException(\"Series collection doesn't support this operation.\");\r\n\t}", "protected void readCollection(Collection<Integer> series)\n {\n size = series.size();\n if(size==0)\n return;\n x = new double[size];\n Iterator<Integer> i = series.iterator();\n for(int t = 0; i.hasNext(); t++)\n x[t] = (i.next()).doubleValue();\n if(size<2)\n return;\n r = new double[size - 1];\n for(int t = 1; t<size; t++)\n r[t - 1] = Math.log(x[t]/x[t - 1]); \n }", "public DailyMessagesChart(final String title, final List<DateCounter> data)\n {\n super(title);\n initializeChart(data);\n }", "public static ComicCollectionEntity create(String name, int id, Date dateCreated) {\n return new ComicCollectionEntity(name, id, dateCreated);\n }", "public static LinkedList<LinkedList<EventInstance>> convertToEventInstances(LinkedList<HistoricalTrace> positiveTraces, EpqlContext ctx) {\n\t\tLinkedList<LinkedList<EventInstance>> tracesAsEventInstances = new LinkedList<LinkedList<EventInstance>>();\n\n\t\tfor (HistoricalTrace t : positiveTraces) {\n\t\t\tLinkedList<EventInstance> currentTraceAsEventInstances = new LinkedList<EventInstance>();\n\n\t\t\tfor (GenericEvent e : t.getEvents()) {\n\t\t\t\tHashMap<String, Value> nominalAttributes = new HashMap<String, Value>();\n\n\t\t\t\t// use the event type as a nominal attribute as well\n\t\t\t\tnominalAttributes.put(EventInstance.PREFIX_FOR_EVENTTYPE_NAME + \"EventTypeName\", new Value(e.getTypeName()));\n\n\t\t\t\tIterator<String> iterator = e.getAttributes().keySet().iterator();\n\t\t\t\twhile (iterator.hasNext()) {\n\t\t\t\t\tString attrName = iterator.next();\n\t\t\t\t\tValue attrValue = e.getAttributeValue(attrName);\n\t\t\t\t\tif (!ctx.isONLY_USE_STRINGS_FOR_RELEVANT_EVENT_INSTANCES() || attrValue.getType().equals(EValueType.STRING)) {\n\t\t\t\t\t\tnominalAttributes.put(attrName, attrValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcurrentTraceAsEventInstances.add(new EventInstance(nominalAttributes, e.getTypeName()));\n\t\t\t}\n\n\t\t\ttracesAsEventInstances.add(currentTraceAsEventInstances);\n\t\t}\n\n\t\treturn tracesAsEventInstances;\n\t}" ]
[ "0.5225168", "0.51628864", "0.5085745", "0.50808245", "0.4996711", "0.4959507", "0.48796365", "0.4837174", "0.48033255", "0.47983602", "0.46557888", "0.46286884", "0.4625884", "0.4601717", "0.45996085", "0.45935482", "0.4593343", "0.45831278", "0.45741603", "0.45392412", "0.45005393", "0.44986185", "0.44932243", "0.4468518", "0.44547212", "0.44325194", "0.44244862", "0.4422791", "0.4418785", "0.4417251", "0.44151545", "0.43966398", "0.43885392", "0.4379054", "0.43632656", "0.43555626", "0.4353824", "0.43292078", "0.43139938", "0.43016937", "0.42974886", "0.4291279", "0.4289776", "0.42749596", "0.42730713", "0.42728552", "0.42697045", "0.42644727", "0.4259399", "0.4258324", "0.42491174", "0.4225917", "0.4219888", "0.4219042", "0.42188913", "0.42164904", "0.42146945", "0.42124254", "0.4204868", "0.42001894", "0.41906232", "0.41851038", "0.41833276", "0.41675702", "0.41664314", "0.41523373", "0.4151658", "0.4147972", "0.4125532", "0.41152155", "0.4114549", "0.41123247", "0.41115588", "0.41100356", "0.4101277", "0.40968728", "0.40956986", "0.4094887", "0.40907928", "0.40884438", "0.40834257", "0.4083275", "0.40828285", "0.40813547", "0.40719435", "0.40684894", "0.40670082", "0.40666983", "0.4065746", "0.40635204", "0.40614885", "0.40550196", "0.40486428", "0.40481323", "0.40456888", "0.40414667", "0.40353227", "0.40285218", "0.4027985", "0.40220544" ]
0.5644957
0
Reads the series from a collection of floating point values in double precision.
protected void readCollection(Collection<Integer> series) { size = series.size(); if(size==0) return; x = new double[size]; Iterator<Integer> i = series.iterator(); for(int t = 0; i.hasNext(); t++) x[t] = (i.next()).doubleValue(); if(size<2) return; r = new double[size - 1]; for(int t = 1; t<size; t++) r[t - 1] = Math.log(x[t]/x[t - 1]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static double[] readDoubles() {\n return readAllDoubles();\n }", "public abstract void read_double_array(double[] value, int offset, int\nlength);", "public abstract double readAsDbl(int offset);", "double readDouble();", "double readDouble() throws IOException;", "private Data[] getFloats(double value, int npoints, int nattributes)\n\t{\n\t\tData[] data = new Data[npoints];\n\t\tfor (int i = 0; i < npoints; i++)\n\t\t\tdata[i] = nattributes == 1 ? new DataFloat((float) value)\n\t\t: new DataArrayOfFloats(new float[] { (float) value,\n\t\t\t\t(float) value });\n\t\t\treturn data;\n\t}", "public abstract double read_double();", "@Override\n\tpublic List<double[]> read(String fileName) {\n\t\tlogger.info(\"Loading data from \" + fileName);\n\t\tList<double[]> records = new ArrayList<double[]>();\n\t\tCsvReader csvReader = null;\n\t\ttry{\n\t\t\tcsvReader = new CsvReader(fileName);\n\t\t\t\n\t\t\t\n\t\t\twhile(csvReader.readRecord()){\n\t\t\t\tint cols = csvReader.getColumnCount();\n\t\t\t\tdouble[] record = new double[cols];\n\t\t\t\tfor(int i=0; i< cols; i++){\n\t\t\t\t\trecord[i] = Double.parseDouble(csvReader.get(i));\n\t\t\t\t}\n\t\t\t\trecords.add(record);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\tthrow new LoadDataException(e);\n\t\t}finally{\n\t\t\tif(csvReader != null){\n\t\t\t\tcsvReader.close();\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn records;\n\t}", "@Override\r\n\tpublic void setDataSeries(List<Double> factValues) {\n\r\n\t}", "public abstract void read_float_array(float[] value, int offset, int\nlength);", "float readFloat();", "public Iterable<Double> getDoubles(String key);", "public abstract double[] toDoubleArray();", "public Iterable<Float> getFloats(String key);", "java.util.List<java.lang.Double> getFileList();", "public double parseDouble()\r\n {\r\n String str = feed.findWithinHorizon( REAL_PATTERN, 0 );\r\n \r\n if( str == null )\r\n throw new NumberFormatException( \"[Line \" + lineNum + \"] Input did not match a real number\" );\r\n else if( str.length() == 0 )\r\n throw new NumberFormatException( \"[Line \" + lineNum + \"] Input did not match a real number\" );\r\n \r\n return Double.parseDouble( str );\r\n }", "String floatRead();", "public double[] getDoubleList();", "static public DoubleList readVector(BufferedReader reader) throws IOException {\r\n int dim = Integer.parseInt(reader.readLine());\r\n DoubleList vector = new DoubleArrayList(dim);\r\n for (int i = 0; i < dim; i++) {\r\n double v = Double.parseDouble(reader.readLine());\r\n vector.add(v);\r\n }\r\n return vector;\r\n }", "void writeDoubles(double[] d, int off, int len) throws IOException;", "private Data[] getDoubles(double value, int npoints, int nattributes)\n\t{\n\t\tData[] data = new Data[npoints];\n\t\tfor (int i = 0; i < npoints; i++)\n\t\t\tdata[i] = nattributes == 1 ? new DataDouble(value)\n\t\t: new DataArrayOfDoubles(new double[] { value, value });\n\t\t\treturn data;\n\t}", "public static java.util.Iterator<org.semanticwb.process.schema.Float> listFloats()\r\n {\r\n java.util.Iterator it=sclass.listInstances();\r\n return new org.semanticwb.model.GenericIterator<org.semanticwb.process.schema.Float>(it, true);\r\n }", "public static double[] readDoubleVector(DataInputStream input) throws IOException {\n int length = input.readInt();\n\n double[] ret = new double[length];\n\n for (int i = 0; i < length; i++) {\n double value = input.readDouble();\n ret[i] = value;\n }\n\n return ret;\n }", "public double[] getAsDoubles() {\n return (double[])data;\n }", "public void nextDoubles(double[] d) {\n real.nextDoubles(d);\n }", "public Object[] getScriptOfValuesAsDouble() {\r\n\t\tArrayList valueDouble;\r\n\t\tvalueDouble = new ArrayList<Double>();\r\n\r\n\t\tfor (DataVariable var : dataTestModel) {\r\n\t\t\tif (var.getType().equals(\"double\") || var.getType().equals(\"int\")) {\r\n\r\n\t\t\t\tif (var.getValue() != null && !var.getValue().equals(\"\") && !var.getValue().equals(\"NaN\")) {\r\n\r\n\t\t\t\t\tvalueDouble.add(var.getValue());\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvalueDouble.add(0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\tObject[] values = new Object[valueDouble.size()];\r\n\t\tint i = 0;\r\n\t\tfor (Object d : valueDouble) {\r\n\t\t\tif (d == null) {\r\n\t\t\t\td = 0.0;\r\n\t\t\t}\r\n\r\n\t\t\tvalues[i] = d;\r\n\r\n\t\t\ti++;\r\n\t\t}\r\n\t\treturn values;\r\n\r\n\t}", "public abstract float read_float();", "private static float[] readFloatArray( URL loc ) throws IOException {\n DataInputStream in =\n new DataInputStream( new BufferedInputStream( loc.openStream() ) );\n FloatList flist = new FloatList();\n try {\n while ( true ) {\n float value = in.readFloat();\n if ( value >= 0f && value <= 1f ) {\n flist.add( value );\n }\n else {\n throw new IOException( \"RGB values out of range\" );\n }\n }\n }\n catch ( EOFException e ) {\n return flist.toFloatArray();\n }\n finally {\n in.close();\n }\n }", "@Override\n public LinkedList<Double> call() {\n for (int string = 0; string < line.length; string++) {\n String numberString = super.cleanTextContent(line[string]);\n try {\n double number = Double.parseDouble(numberString);\n values.add(number);\n } catch (NumberFormatException numberFormatException) {\n numberFormatException.printStackTrace();\n }\n }\n Collections.sort(values);\n while (values.size() > valuesToKeep) {\n values.removeLast();\n }\n return values;\n }", "public double doubleValue(final int i) {\n if (!isInteger(i)) {\n return Float.intBitsToFloat((int) values[i]);\n }\n throw new ClassCastException(\"value #\" + i + \" is not a float in \" + this);\n }", "public ArrayDouble getRecordValues(State state) {\n return new ArrayDouble(opensimSimulationJNI.ExpressionBasedPointToPointForce_getRecordValues(swigCPtr, this, State.getCPtr(state), state), true);\n }", "public double[] getDoubleArray(String name)\r\n throws NumberFormatException\r\n {\r\n String[] data = getString(name).split(\",\");\r\n double[] value = new double[data.length];\r\n for( int i=0; i<data.length; i++ )\r\n value[i] = Double.parseDouble(data[i].trim());\r\n \r\n return value;\r\n }", "public us.ihmc.idl.IDLSequence.Float getValues()\n {\n return values_;\n }", "public float[] getFloatArray(String property)\n\tthrows PropertiesPlusException\n\t{\n\t\tString value = getProperty(property);\n\t\tif (value == null)\n\t\t\treturn null;\n\t\ttry\n\t\t{\n\t\t\tScanner in = new Scanner(value.trim().replaceAll(\",\", \" \"));\n\t\t\tArrayListFloat flt = new ArrayListFloat();\n\t\t\twhile (in.hasNext())\n\t\t\t\tflt.add(in.nextFloat());\n\t\t\tin.close();\n\n\t\t\treturn flt.toArray();\n\t\t}\n\t\tcatch (NumberFormatException ex)\n\t\t{\n\t\t\tthrow new PropertiesPlusException(String.format(\n\t\t\t\t\t\"%s = %s cannot be converted to type double[]\", property, value));\n\t\t}\n\t}", "double readDouble()\n throws IOException {\n return Double.longBitsToDouble( readLong() );\n }", "public abstract Double getDataValue();", "public Double filter(Double value) throws NullValueException, EmptyListException, IncorrectSizeException;", "public double readDouble() throws IOException {\n int token = fTokenizer.nextToken();\n if (token == StreamTokenizer.TT_NUMBER)\n return fTokenizer.nval;\n\n String msg = \"Double expected in line: \" + fTokenizer.lineno();\n throw new IOException(msg);\n }", "public static double readFloat() {\n return Float.parseFloat(readString());\n }", "private double readDouble() throws IOException {\n\t\treturn (isBigEndian ? ioReadDouble() : Double.longBitsToDouble(readLELong()));\n\t}", "private static List<Double> parse_line_double(String line, int d) throws Exception {\n\t List<Double> ans = new ArrayList<Double>();\n\t StringTokenizer st = new StringTokenizer(line, \" \");\n\t if (st.countTokens() != d) {\n\t throw new Exception(\"Bad line: [\" + line + \"]\");\n\t }\n\t while (st.hasMoreElements()) {\n\t String s = st.nextToken();\n\t try {\n\t ans.add(Double.parseDouble(s));\n\t } catch (Exception ex) {\n\t throw new Exception(\"Bad Integer in \" + \"[\" + line + \"]. \" + ex.getMessage());\n\t }\n\t }\n\t return ans;\n\t }", "public float[] getAsFloats() {\n return (float[])data;\n }", "public double readDouble() throws NumberFormatException {\r\n\t\treturn Double.parseDouble(scanner.nextLine());\r\n\t}", "public double[] ds() {\n double rval[] = new double[size()];\n for (int i = 0; i < rval.length; i++) {\n rval[i] = get(i) == null ? Double.NaN : get(i).doubleValue();\n }\n\n return rval;\n }", "protected abstract void setValues(double[] values);", "public List<Double> getDoubleList(final String key) {\n return getDoubleList(key, new ArrayList<>());\n }", "public double[] getDoubles()\r\n {\r\n return resultDoubles;\r\n }", "public static java.util.Iterator<org.semanticwb.process.schema.Float> listFloats(org.semanticwb.model.SWBModel model)\r\n {\r\n java.util.Iterator it=model.getSemanticObject().getModel().listInstancesOfClass(sclass);\r\n return new org.semanticwb.model.GenericIterator<org.semanticwb.process.schema.Float>(it, true);\r\n }", "double[][] asDouble();", "private double[] toDoubleArray(float[] arr) {\n\t\tif (arr == null)\n\t\t\treturn null;\n\t\tint n = arr.length;\n\t\tdouble[] outputFloat = new double[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\toutputFloat[i] = (double) arr[i];\n\n\t\t}\n\t\treturn outputFloat;\n\t}", "Series<double[]> makeSeries(int dimension);", "@Test\n public void testReadProperty() {\n DoubleArrayPropertyPersistenceHandler handler = new DoubleArrayPropertyPersistenceHandler();\n\n Element propertyTag = new Element(\"anyTag\"); //$NON-NLS-1$\n Element arrayTag = new Element(\n DoubleArrayPropertyPersistenceHandler.XML_ELEMENT_DOUBLE_ARRAY);\n propertyTag.addContent(arrayTag);\n\n arrayTag.addContent(new Element(\n DoubleArrayPropertyPersistenceHandler.XML_ELEMENT_DOUBLE)\n .setAttribute(XmlConstants.XML_ATTRIBUTE_VALUE, \"1.0\")); //$NON-NLS-1$\n arrayTag.addContent(new Element(\n DoubleArrayPropertyPersistenceHandler.XML_ELEMENT_DOUBLE)\n .setAttribute(XmlConstants.XML_ATTRIBUTE_VALUE, \"2.0\")); //$NON-NLS-1$\n arrayTag.addContent(new Element(\n DoubleArrayPropertyPersistenceHandler.XML_ELEMENT_DOUBLE)\n .setAttribute(XmlConstants.XML_ATTRIBUTE_VALUE, \"3.0\")); //$NON-NLS-1$\n arrayTag.addContent(new Element(\n DoubleArrayPropertyPersistenceHandler.XML_ELEMENT_DOUBLE)\n .setAttribute(XmlConstants.XML_ATTRIBUTE_VALUE, \"4.0\")); //$NON-NLS-1$\n\n Object propertyValue = handler.readProperty(propertyTag);\n\n assertTrue(propertyValue instanceof double[]);\n\n double[] doubleArray = (double[]) propertyValue;\n\n assertEquals(4, doubleArray.length);\n assertEquals(1.0, doubleArray[0], 0.001);\n assertEquals(2.0, doubleArray[1], 0.001);\n assertEquals(3.0, doubleArray[2], 0.001);\n assertEquals(4.0, doubleArray[3], 0.001);\n }", "Double getValue();", "private void _testLeadingPeriodFloat(String valueStr, double value, int bytesPerRead)\n throws Exception\n {\n\n JsonFactory f = new JsonFactory();\n String JSON = valueStr;\n AsyncReaderWrapper p = createParser(f, JSON, bytesPerRead);\n try {\n p.nextToken();\n p.currentText();\n fail(\"Should have thrown an exception for doc <\"+JSON+\">\");\n } catch (JsonParseException e) {\n verifyException(e, \"Unexpected character ('.'\");\n verifyException(e, \"expected a valid value\");\n } finally {\n p.close();\n }\n\n // and then verify it's ok when enabled\n f = JsonFactory.builder()\n .enable(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS)\n .build();\n p = createParser(f, JSON, bytesPerRead);\n assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());\n assertEquals(value, p.getDoubleValue());\n assertEquals(valueStr.trim(), p.currentText());\n p.close();\n }", "protected double[] getValues(String varName) {\n if (_dataMap == null) readAllData();\n double[] values = _dataMap.get(varName);\n return values;\n }", "public static PointD[] fillData() {\n ArrayList<PointD> vals = new ArrayList();\n while (scn.hasNextLine()) {\n String[] xandy = scn.nextLine().split(\"\\\\s*,\\\\s*\");\n vals.add(new PointD(Double.parseDouble(xandy[0]), Double.parseDouble(xandy[1])));\n }\n PointD[] vals2 = new PointD[vals.size()];\n for (int x = 0; x < vals.size(); x++) {\n vals2[x] = vals.get(x);\n }\n return vals2;\n }", "public float readFloat() {\n return Float.parseFloat(readNextLine());\n }", "public double[] readVector(String line, int index) {\n\n String[] list = line.split(\" \");\n int numColumns = Integer.parseInt(list[index]);\n double[] res = new double[numColumns];\n\n int num = index + 1;\n for (int j = 0; j < numColumns; j++) {\n res[j] = Double.parseDouble(list[num]);\n num++;\n }\n return res;\n }", "Double getDoubleValue();", "public double get(Double[] ipos);", "@Override protected void readDoublesIntoBuf(MathGate mathGate, double[] buffer) {\r\n\t\tif (myMathExpr != null) {\r\n\t\t\tmathGate.parseAndEvalExprToDoubleVec(myMathExpr, buffer);\r\n\t\t} else {\r\n\t\t\ttheLogger.debug(\"No expression found.\");\r\n\t\t}\r\n\t}", "public double[] getValues(String nodeType, int index)\r\n {\r\n\treturn getValues(nodeType, new NodeFilter()\r\n\t { public final boolean accept(Node n) { return true; }},\r\n\t\t\t index);\r\n }", "public long get(double val[])\n {\n\t\tSensorData d = data.get();\n\t\tdouble[] v = d.getValues();\n\t\tif (v == null) return 0;\n\t\tfor (int i=0; i<v.length; ++i)\n\t\t\tval[i] = v[i];\n\t\treturn d.getTimestamp();\n }", "private native float Df1_Read_Float(String plcAddress) throws Df1LibraryNativeException;", "public double[] LerValoresEsperados() throws FileNotFoundException {\n File treinamento = new File(\"resultado.csv\");\n\n String linha = new String();\n\n Scanner leitor = new Scanner(treinamento);\n\n while (leitor.hasNext()) {\n linha = leitor.nextLine();\n String[] valoresEntreVirgulas = linha.split(\";\");\n double[] valoresDouble = Arrays.stream(valoresEntreVirgulas).mapToDouble(Double::parseDouble).toArray();\n return valoresDouble;\n //System.out.println(valoresEntreVirgulas[0] + valoresEntreVirgulas[1] + valoresEntreVirgulas[2]);\n }\n\n return null;\n }", "private List<Double> getdata(FileReader fr, String sar_device,int i) throws IOException {\n\t\t System.out.println(\"sar_device in GetSarFileData:\"+sar_device);\n\t\t BufferedReader br = new BufferedReader(fr);\n\t\t List<Double> resultList = new ArrayList<Double>();\n\t String temp=null;\n\t String[] numbersArray;\n\t temp=br.readLine();\n\t while(temp!=null){ \n\t \tnumbersArray=temp.split(\"\\\\s+\"); \n\t \tif(numbersArray.length>2&&(!numbersArray[0].equals(\"Average:\"))&&numbersArray[2].equals(sar_device))\n\t \t{\n\t \t\tresultList.add(Double.parseDouble(numbersArray[i])); \n\t \t}\n\t \telse if(numbersArray.length>2&&(!numbersArray[0].equals(\"Average:\"))&&numbersArray[1].equals(sar_device)){\n\t \t\tresultList.add(Double.parseDouble(numbersArray[i-1])); \n\t \t}\n\t temp=br.readLine();\n\t }\n\t System.out.println(resultList);\n\t return resultList;\n\t}", "double[] getReferenceValues();", "void writeFloats(float[] f, int off, int len) throws IOException;", "public double readDouble() throws IOException {\n\n\t\tif (read(bb, 0, 8) < 8) {\n\t\t\tthrow new EOFException();\n\t\t}\n\n\t\tint i1 = bb[0] << 24 | (bb[1] & 0xFF) << 16 | (bb[2] & 0xFF) << 8\n\t\t\t\t| (bb[3] & 0xFF);\n\t\tint i2 = bb[4] << 24 | (bb[5] & 0xFF) << 16 | (bb[6] & 0xFF) << 8\n\t\t\t\t| (bb[7] & 0xFF);\n\n\t\treturn Double.longBitsToDouble(((long) i1) << 32\n\t\t\t\t| ((long) i2 & 0x00000000ffffffffL));\n\t}", "public abstract double[] getasDouble(int tuple);", "double getFloatingPointField();", "public float[] getSensorValues() {\n return mVal;\n }", "String doubleRead();", "float readFloat(int start)\n {\n int bits = readInt(start);\n\n return Float.intBitsToFloat(bits);\n }", "public double readDouble() throws IOException {\n return in.readDouble();\n }", "public double[] getDoubleArray(final String key) {\n return getDoubleArray(key, ArrayUtils.EMPTY_DOUBLE_ARRAY);\n }", "double getDouble(String key) throws KeyValueStoreException;", "public static synchronized List<Pair<String, double[]>> getDataFromFile(String fileName) throws Exception\r\n\t{\t\r\n\t\tValidationHelper.validateIfParameterIsNullOrEmpty(fileName, \"fileName\");\r\n\t\t\r\n\t\tif (_dataCache.containsKey(fileName)) \r\n\t\t\treturn _dataCache.get(fileName);\r\n\t\t\r\n\t\tFile file = new File(fileName);\r\n\t\t\r\n\t\tValidationHelper.validateIfFileParameterExists(file, fileName);\r\n\t\t\r\n\t\tArrayList<Pair<String, double[]>> inputData = new ArrayList<Pair<String, double[]>>();\r\n\t\t\r\n\t\tBufferedReader reader = new BufferedReader(new FileReader(file));\r\n\t\t\r\n\t\tString temp = null;\r\n\t\t\r\n\t\twhile ((temp = reader.readLine()) != null)\r\n\t\t{\r\n\t\t\ttemp = temp.replaceAll(\" \", \"\");\r\n\t\t\t\r\n\t\t\tString[] tokens = temp.split(\",\");\r\n\t\t\t\r\n\t\t\tif (tokens != null && tokens.length > 0)\r\n\t\t\t{\r\n\t\t\t\tdouble[] input = new double[tokens.length - 1];\r\n\t\t\t\tfor (int i = 0; i < tokens.length; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tString token = tokens[i];\r\n\r\n\t\t\t\t\tif (i == tokens.length-1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinputData.add(new Pair<String, double[]>(token, input));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (token.matches(\"-{0,1}[0-9]{1,}(.[0-9]{1,}){0,1}\"))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdouble data = Double.parseDouble(token);\r\n\t\t\t\t\t\t\tinput[i] = data;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (!_dataCache.containsKey(fileName))\r\n\t\t\t_dataCache.put(fileName, inputData);\r\n\t\t\r\n\t\treturn inputData;\r\n\t}", "public List<Double> getData( ) {\r\n return data;\r\n }", "protected double[] readFeature(String s, int dim) {\n\t\tdouble[] feature = new double[dim];\n\t\tStringTokenizer st = new StringTokenizer(s);\n\t\tif(st.countTokens() != dim) {\n\t\t\tSystem.out.println(\"Error in readFeature - number of tokens incorrect \" + st.countTokens() + \" vs \" + dim);\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t// Convert the string in array of double\n\t\tfor(int i=0; i<dim; i++) {\n\t\t\tfeature[i] = Double.parseDouble(st.nextToken());\n\t\t}\n\t\treturn feature;\n\t}", "public double[] getDoubleArray(String property)\n\tthrows PropertiesPlusException\n\t{\n\t\tString value = getProperty(property);\n\t\tif (value == null)\n\t\t\treturn null;\n\t\ttry\n\t\t{\n\t\t\tScanner in = new Scanner(value.trim().replaceAll(\",\", \" \"));\n\t\t\tArrayListDouble dbl = new ArrayListDouble();\n\t\t\twhile (in.hasNext())\n\t\t\t\tdbl.add(in.nextDouble());\n\t\t\tin.close();\n\n\t\t\treturn dbl.toArray();\n\t\t}\n\t\tcatch (NumberFormatException ex)\n\t\t{\n\t\t\tthrow new PropertiesPlusException(String.format(\n\t\t\t\t\t\"%s = %s cannot be converted to type double[]\", property, value));\n\t\t}\n\t}", "java.util.List<java.lang.Float> getInList();", "public static double[] parseDouble(String val[]) {\n\t\t\n\t\tif (val != null) {\n\t\t\tdouble ret[] = new double[val.length];\n\t\n\t\t\tfor (int i = 0; i < val.length; i++) {\n\t\t\t\tret[i] = parseDouble(val[i]);\n\t\t\t}\n\t\n\t\t\treturn ret;\n\t\t}else{\n\t\t\treturn null;\n\t\t}\n\t}", "public double getDouble(String name) {\n\t\tfinal Object val = values.get(name);\n\t\tif (val == null) {\n\t\t\tthrow new IllegalArgumentException(\"Float value required, but not specified\");\n\t\t}\n\t\tif (val instanceof Number) {\n\t\t\treturn ((Number) val).doubleValue();\n\t\t}\n\t\ttry {\n\t\t\treturn Double.parseDouble((String) val);\n\t\t} catch (Exception e) {\n\t\t\tthrow new IllegalArgumentException(\"Float value required, but found: \" + val);\n\t\t}\n\t}", "public static final Double getDouble(ClassFile cf, short cpiIndex) {\n DoubleInfo di = (DoubleInfo) cf.getCpInfo(cpiIndex);\n return Double.longBitsToDouble(((long) di.highBytes << 32) | (0xffffffffL & di.lowBytes));\n }", "public static Stats of(double... values) {\n/* 122 */ StatsAccumulator acummulator = new StatsAccumulator();\n/* 123 */ acummulator.addAll(values);\n/* 124 */ return acummulator.snapshot();\n/* */ }", "public double value(){\n\t return (double) this.f;\n }", "public ArrayList<Double> readFile(String m){\n ArrayList<Double> a = new ArrayList<Double>();\n Scanner r = null;\n try {\n File f = new File(m);\n r = new Scanner(f);\n String scan;\n while(r.hasNextLine()) {\n scan = r.nextLine();\n //System.out.println(scan);\n // look for comma because our price starts after comma\n int commaPosition = scan.indexOf(',');\n //go to next index of the string in one line\n int nextIndex = commaPosition + 1;\n // make a string named price to keep the price from one line\n //substring method takes two parameters- start point and end point(which is integers)\n //price = smaller string = \"2.50\", scan = bigger string = \"bananas,2.50\"\n String price = scan.substring(nextIndex,scan.length());\n double doublePrice = Double.parseDouble(price);\n //System.out.println(doublePrice);\n a.add(doublePrice);\n }\n } catch (FileNotFoundException ex) {\n\n } catch (IOException ex) {\n\n } finally {\n if(r!=null) r.close();\n }\n return a;\n\n }", "@Override\n\tpublic double[] toDoubleArray() {\n\t\treturn null;\n\t}", "public abstract float[] toFloatArray();", "public float readFloat()\r\n/* 447: */ {\r\n/* 448:460 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 449:461 */ return super.readFloat();\r\n/* 450: */ }", "public abstract void writeAsDbl(int offset, double d);", "public double readDouble()\r\n/* 453: */ {\r\n/* 454:466 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 455:467 */ return super.readDouble();\r\n/* 456: */ }", "private JsonArray datapoint(final Double value, final long ts) {\n\n if (value.isNaN()) {\n return arr();\n }\n return arr(value, ts);\n }", "public void load( String fileName ) {\n System.out.println( \"Loading: \" + fileName );\n this.name = fileName;\n Object obj = null;\n try {\n FileInputStream fis = new FileInputStream(fileName);\n ObjectInputStream oos = new ObjectInputStream( fis );\n obj = oos.readObject();\n dofs = (double[][]) obj;\n oos.close();\n fis.close();\n } catch ( Exception e ) {\n e.printStackTrace();\n } \n }", "public ArrayList<Double> getValues() {\n\n ArrayList<Double> values = new ArrayList<Double>(); //create new arraylist to return\n FreqNode tmpNode; //create temp node \n\n //traverse entire table \n for (FreqNode node : frequencyTable) {\n //set node \n tmpNode = node;\n while (true) {\n if (tmpNode == null) {\n break;\n } else {\n //add value to node in table and cast to double \n values.add((node.getValue() * 1.0));\n //set it to the next node \n tmpNode = tmpNode.getNext();\n } //end else \n }//end if \n }\n // Return the keys\n return values;\n }", "@Override\n\tpublic List<Double> computeValues() {\n\t\treturn null;\n\t}", "private static void insertTimeSeriesOneDim(final ScriptEngine engine,\r\n final DataArray data) throws Exception {\r\n List<DataEntry> time = data.getDate();\r\n int freq = TimeUtils.getFrequency(time);\r\n List<Double> doubleList = data.getDouble();\r\n double[] doubleArray = new double[doubleList.size()];\r\n for (int i = 0; i < doubleList.size(); i++) {\r\n doubleArray[i] = doubleList.get(i);\r\n }\r\n engine.put(\"my_double_vector\", doubleArray);\r\n engine.eval(\"ts_0 <- ts(my_double_vector, frequency = \"\r\n + freq + \")\");\r\n }", "Double getStartFloat();", "public List<Double> getData() {\n return data;\n }" ]
[ "0.6997097", "0.65448064", "0.6420158", "0.6241261", "0.6060583", "0.60147303", "0.6014709", "0.5972213", "0.59520096", "0.5931642", "0.59146595", "0.5903449", "0.5827682", "0.5804927", "0.57390577", "0.572967", "0.571828", "0.56917524", "0.5678745", "0.5654575", "0.5650003", "0.5638423", "0.5634269", "0.5631868", "0.5606968", "0.55791", "0.55708987", "0.55672044", "0.5564099", "0.5562579", "0.5553446", "0.5545063", "0.5542862", "0.5507536", "0.5506567", "0.54692245", "0.54290605", "0.54126734", "0.5408804", "0.5395052", "0.53930485", "0.5383527", "0.5372575", "0.5346211", "0.5319327", "0.53192556", "0.5317791", "0.531325", "0.5308824", "0.5308383", "0.52929926", "0.52900684", "0.52811193", "0.5278612", "0.526693", "0.5266018", "0.52526", "0.5235419", "0.52346015", "0.52272743", "0.52264774", "0.52199674", "0.52103823", "0.5204057", "0.5199738", "0.51930046", "0.5188536", "0.51876014", "0.5184464", "0.5184147", "0.518103", "0.5178687", "0.5168146", "0.516483", "0.515912", "0.51572007", "0.5154366", "0.5136094", "0.5129073", "0.5123523", "0.5119728", "0.5111548", "0.51104176", "0.51026696", "0.50969875", "0.5095122", "0.5094185", "0.509232", "0.50832766", "0.50775903", "0.50767606", "0.5074509", "0.50719416", "0.50716007", "0.5063926", "0.50512475", "0.5036494", "0.5030496", "0.50267446", "0.5021005" ]
0.6953889
1
Get the tth quote in the series.
public double getQuote(int t) { if(t<0 || t>=size) return 0.0; return x[t]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getTick() { // 3\n\t\treturn tic;\n\t}", "public String getQuote(){\n\t\tString quote = null;\n\t\ttry {\n\t\t\tcrs = qb.selectFrom(\"qotd\").all().executeQuery();\n\n\t\t\tif(crs.next()) {\n\t\t\t\tquote = crs.getString(\"qotd\");\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tcrs.close();\n\t\t\t} catch (SQLException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn quote;\n\t}", "public java.lang.Integer getThn() {\n return thn;\n }", "public java.lang.Integer getThn() {\n return thn;\n }", "public String getTrend() {\r\n return fTrend;\r\n }", "public Number getTramo() {\n return (Number) getAttributeInternal(TRAMO);\n }", "public String getTicker() {\n return this.ticker;\n }", "public int getQuarter () {\n return NQuarter;\n }", "public String getTicker() {\n\n return ticker.getText();\n }", "String getQuoteOfTheDay();", "public Integer getQuarter() {\r\n return QTR;\r\n }", "public int getQntd() {\r\n\t\treturn this.qntd;\r\n\t}", "public int getTON() {\r\n return ton;\r\n }", "public String getTradeNo() {\n\t\treturn tradeNo;\n\t}", "public BigDecimal getTRX_NO() {\r\n return TRX_NO;\r\n }", "public String getTaunt() {\n\t\tRandom rand = new Random();\n\t\tint n = rand.nextInt(3); // creates a random int\n\t\treturn taunts.get(n); // returns the taunt at that index\n\t}", "public String getQuote();", "public Trade getTrade()\n\t{\n\t\treturn m_trade;\n\t}", "public String getText(int index) {\r\n\t ChartDataHistogramDouble thCartData = ((ChartDataHistogramDouble) chartData);\r\n\t\tif (index < 0 || index >= this.getNumOfData()) return \"\";\r\n\t\telse return thCartData.getObservedString(index);\r\n\t}", "public String getTradeOrder() {\n\t\treturn tradeOrder;\n\t}", "public java.lang.String getTRADE() {\n return TRADE;\n }", "@Override\r\n\tpublic Trade getTrade() {\n\t\treturn trade;\r\n\t}", "public LocalQuote\t\tgetQuote();", "public String getQuarter() {\r\n return quarter;\r\n }", "public String getQuote() {\r\n\t\tString qt = this.getName() + \" (\" + this.getSymbol() + \")\\n\" + \"Price: \" + this.getLastPrice() + \"\\t\" + \"hi: \"\r\n\t\t\t\t+ this.getHighPrice() + \"\\t\" + \"low: \" + this.getLowPrice() + \"\\t\" + \"vol: \" + this.getVol() + \"\\n\";\r\n\t\tqt += \"Ask: \";\r\n\t\tif (!buy.isEmpty()) {\r\n\t\t\tqt += buy.peek().getPrice();\r\n\t\t\tqt += \" size: \" + buy.peek().getShares();\r\n\t\t} else\r\n\t\t\tqt += \"none \";\r\n\r\n\t\tqt += \"Bid: \";\r\n\t\tif (!sell.isEmpty()) {\r\n\t\t\tqt += sell.peek().getPrice();\r\n\t\t\tqt += \"size: \" + sell.peek().getShares();\r\n\t\t} else\r\n\t\t\tqt += \"none \";\r\n\t\treturn qt;\r\n\t}", "public String getTentSymbol(){ return tentSymbol;}", "public StockTicks getTicks() {\n if (getTicks == null)\n getTicks = new StockTicks(jsBase + \".ticks()\");\n\n return getTicks;\n }", "public double getSqrQuote(int t)\n {\n if(t<0 || t>=size)\n return 0.0;\n return x[t]*x[t];\n }", "private int getMQuote()\n {\n if (mQuote != 0)\n {\n return mQuote; // already calculated\n }\n\n// assert this.sign > 0;\n\n int d = -magnitude[magnitude.length - 1];\n\n// assert (d & 1) != 0;\n\n return mQuote = modInverse32(d);\n }", "public int getTick() {\r\n\t\treturn tick;\r\n\t}", "public TWord getTWordAt(int pos){\n\t\treturn sentence.get(pos);\n\t}", "public String getTitleFormula() {\n\t if(! chart.isSetTitle()) {\n\t return null;\n\t }\n\n\t CTTitle title = chart.getTitle();\n\t \n\t if (! title.isSetTx()) {\n\t return null;\n\t }\n\t \n\t CTTx tx = title.getTx();\n\t \n\t if (! tx.isSetStrRef()) {\n\t return null;\n\t }\n\t \n\t return tx.getStrRef().getF();\n\t}", "public String getTranno() {\n return tranno;\n }", "public String getTiempo() {\r\n return tiempo;\r\n }", "public TesisatTur getTesisatTur() {\r\n\t\treturn tesisatTur;\r\n\t}", "public java.lang.String getNumeroTramite() {\n return numeroTramite;\n }", "public double getT() {\r\n\t\treturn t;\t\r\n\t\t}", "public String getTutNum() {\n return tutNum;\n }", "public String getQuote(String weather){\n String quote = null;\n Random indexer = new Random();\n int index = indexer.nextInt(4);\n if(weather.equals(\"SUN\"))\n quote = String.format(\": %s\", this.sun[index]);\n else if(weather.equals(\"RAIN\"))\n quote = String.format(\": %s\", this.rain[index]);\n else if(weather.equals(\"FOG\"))\n quote = String.format(\": %s\", this.fog[index]);\n else if(weather.equals(\"SNOW\"))\n quote = String.format(\": %s\", this.snow[index]);\n\n return quote;\n }", "public static String randomQuote() {\n\t\tint i = (int) (Math.random() * quotes.length);\n\t\treturn quotes[i];\n\t}", "public String getQuotes() {\r\n\t\treturn this.quotes;\r\n\t}", "public String getNUM_TANQUE() {\n return NUM_TANQUE;\n }", "long getSymbol();", "public int getTick() {\r\n return tick;\r\n }", "public Short getTradeSeq() {\n\t\treturn tradeSeq;\n\t}", "public Integer getQuoteId() {\n\t\treturn quoteId;\n\t}", "private WebElement getTHead() {\r\n\t\tif (null == this.thead) {\r\n\t\t\ttry {\r\n\t\t\t\tthis.thead = this.findElement(By.xpath(HtmlTags.THEAD));\r\n\t\t\t}\r\n\t\t\tcatch (NotFoundException ex) {\r\n\t\t\t\tif (this.logger.isDebugEnabled()) {\r\n\t\t\t\t\tthis.logger.debug(ex.getMessage(), ex);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn this.thead;\r\n\t}", "public int getMyThick() {\n\t\treturn myThick;\n\t}", "Text getT();", "public int getTrangthaiChiTiet();", "public T getSecond() {\n\t\t\treturn t;\n\t\t}", "@JsonProperty(\"ticker\")\n public String getTicker() {\n return ticker;\n }", "public long getTick() {\n return tick;\n }", "public long getTick() {\n return tick;\n }", "public int getQuarters()\n {\n\treturn quarters;\n }", "public int getSeriesStart() { return _dataSet.getSeriesStart(); }", "public int getToxicity() {\n \t\treturn toxicity;\n \t}", "@Override\n\tpublic java.lang.String getMoTa() {\n\t\treturn _keHoachKiemDemNuoc.getMoTa();\n\t}", "public java.lang.String getTAX_CODE() {\r\n return TAX_CODE;\r\n }", "public String getSymbol()\n {\n return annot.getString(COSName.SY);\n }", "@Override\n public String hienThiTT() {\n String thongTin = \"\";\n thongTin = \"ho ten: \" + this.hoTen + \", tuoi: \" + this.tuoi + \", dia chi: \" + this.diaChi\n + \", sdt: \" + this.sdt + \", mon day: \" + this.monDay + \", to bo mon: \" + this.toBoMon;\n \n System.out.println(thongTin);\n return thongTin;\n }", "public BigDecimal getTrxAmt();", "public TipeToken getTkn() /*const*/{\n\t\treturn Tkn;\n\t}", "TradingProduct getTradingProduct();", "public double getPreTB() {\n return preTB;\n }", "public String getT() {\n\t\treturn t;\n\t}", "public String getwPrTradeNo() {\n return wPrTradeNo;\n }", "public String getMasechta() {\r\n\t\treturn masechtosBavli[masechtaNumber];\r\n\t}", "public String getTema() {\n return this.tema;\n }", "int getFirstTick();", "public org.drip.measure.stochastic.LabelCorrelation singleCurveTenorCorrelation()\n\t{\n\t\treturn _singleCurveTenorCorrelation;\n\t}", "public String getThenote() {\n return thenote;\n }", "public BigDecimal getTRS_NO() {\r\n return TRS_NO;\r\n }", "public BigDecimal getTRS_NO() {\r\n return TRS_NO;\r\n }", "public String getTensp() {\n return tensp;\n }", "public String getTitleID() {\n\t\treturn tid;\n\t}", "public java.lang.String getTAXJURCODE() {\r\n return TAXJURCODE;\r\n }", "public long gettNum() {\n return tNum;\n }", "public Number getCurrentQtr() {\r\n return (Number) getAttributeInternal(CURRENTQTR);\r\n }", "public int getShirt() {\n return shirt_;\n }", "public String randomQuote() {//gets a random quote from the listofQuotes\r\n\t\tint randomNumber = random.nextInt(listofQuotes.size());\r\n\t\tString randomQuote = listofQuotes.get(randomNumber);\r\n\t\treturn randomQuote;\r\n\t}", "public String getShirtNumber() {\n\t\treturn shirtNumber;\n\t}", "public int getShirt() {\n return shirt_;\n }", "public String getTextInNextTD() throws ParseException {\n return getTextInNextElement(\"td\");\n }", "public int get(long instant) {\n return BuddhistChronology.BE;\n }", "public String getString() {\n\t\treturn \"T\";\n\t}", "public void getQuote(String symbol)\r\n {\r\n brokerage.getQuote(symbol, this);\r\n }", "public int getToll() {\n\t\treturn toll;\n\t}", "public String getTen() {\n\t\treturn ten;\n\t}", "public float getTcintmprice()\r\n {\r\n return _tcintmprice;\r\n }", "public java.lang.Short getTollIndication() {\r\n return tollIndication;\r\n }", "public double getTaxa() {\n\t\treturn taxa;\n\t}", "public java.lang.Object getQuoteID() {\n return quoteID;\n }", "public String getMasechtaTransliterated() {\r\n\t\treturn masechtosBavliTransliterated[masechtaNumber];\r\n\t}", "public Timestamp getDateTrx();", "public Timestamp getDateTrx();", "public double getTax() {\n return tax_;\n }", "public int get_thema() {\n\t\treturn this.thema;\n\t}", "public String getToolTipText(int series, int item) {\n\n String result = null;\n\n if (series < getListCount()) {\n List tooltips = (List) this.toolTipSeries.get(series);\n if (tooltips != null) {\n if (item < tooltips.size()) {\n result = (String) tooltips.get(item);\n }\n }\n }\n\n return result;\n }", "public double getTax() {\n return tax_;\n }" ]
[ "0.604744", "0.5943398", "0.5878005", "0.58649635", "0.5774259", "0.576446", "0.57144666", "0.57097787", "0.56965274", "0.5662565", "0.55669814", "0.5560736", "0.55371404", "0.5530598", "0.54584324", "0.54466325", "0.5437523", "0.5423475", "0.5395896", "0.5327191", "0.5322363", "0.5322174", "0.52994156", "0.52773887", "0.5273788", "0.5251905", "0.52289414", "0.5228152", "0.52186483", "0.52106977", "0.51986784", "0.5188231", "0.5169239", "0.51073676", "0.5101211", "0.5086378", "0.5076948", "0.50763375", "0.50720215", "0.5057663", "0.5050599", "0.5043784", "0.50430924", "0.5041446", "0.5036678", "0.5017557", "0.50072414", "0.50010073", "0.4983492", "0.49813893", "0.49747172", "0.49667367", "0.49660066", "0.49660066", "0.4963569", "0.49568078", "0.4950864", "0.49476337", "0.49364468", "0.49264345", "0.4913648", "0.4907735", "0.49024794", "0.48957613", "0.48814425", "0.4878406", "0.4876182", "0.48747295", "0.48723546", "0.48687944", "0.4864459", "0.48629904", "0.48621675", "0.48621675", "0.48592478", "0.48555914", "0.48500133", "0.484436", "0.4837413", "0.48273963", "0.48270458", "0.48204163", "0.4819143", "0.48147163", "0.481358", "0.48123565", "0.480596", "0.48058084", "0.4803401", "0.48028722", "0.4799501", "0.47986194", "0.47980425", "0.4796962", "0.47813153", "0.47813153", "0.47803095", "0.4759755", "0.475619", "0.47453287" ]
0.6981264
0
Get the square of the tth quote in the series.
public double getSqrQuote(int t) { if(t<0 || t>=size) return 0.0; return x[t]*x[t]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getQuote(int t)\n {\n if(t<0 || t>=size)\n return 0.0;\n return x[t];\n }", "private int getMQuote()\n {\n if (mQuote != 0)\n {\n return mQuote; // already calculated\n }\n\n// assert this.sign > 0;\n\n int d = -magnitude[magnitude.length - 1];\n\n// assert (d & 1) != 0;\n\n return mQuote = modInverse32(d);\n }", "double getSquareNumber();", "public double getTick() { // 3\n\t\treturn tic;\n\t}", "private static double sq (double x) {\n return Math.pow(x, 2);\n }", "public double getS() { return s; }", "public int getQuarter () {\n return NQuarter;\n }", "public final double getS()\r\n\t{\r\n\t\treturn s;\r\n\t}", "public Number getTramo() {\n return (Number) getAttributeInternal(TRAMO);\n }", "public double getT() {\r\n\t\treturn t;\t\r\n\t\t}", "public double getSkew() {\n if (isReal) {\n return get(\"ts\");\n } else {\n return simTs.getDouble(0.0);\n }\n }", "private static int getSquarePosition(int index) {\n return (((index/3)%3)+1)+3*(((index/9)/3)+1);\n }", "public int getIthSroce(int ith) {\n if (ith <= 0 || ith > round) throw new IllegalArgumentException();\n return score[ith - 1];\n }", "public int getUnitPow(int index) {\n return _elements[index].getPow();\n }", "public int getTON() {\r\n return ton;\r\n }", "public int getS() {\n\t\treturn (Math.max(getSquare(tractor).getSand()-getK(),0));\n\t}", "public int getSingles() {\n return h-(d+t+hr);\n }", "public double get(CANTalon talon) {\n\t\treturn talon.get();\n\t}", "public double getSpreadTc() {\r\n return spreadTc;\r\n }", "private static int calculateThoriumSulfideQuantity(String string) {\n int result = 2;\n int[] numArr = Arrays.stream(string.split(\" \"))\n .mapToInt(Integer::parseInt).toArray();\n\n for (int n : numArr) {\n result *= n;\n }\n return result;\n }", "public int q(int t) {\n return map.get(map.floorKey(t));\n }", "public String getQuote(){\n\t\tString quote = null;\n\t\ttry {\n\t\t\tcrs = qb.selectFrom(\"qotd\").all().executeQuery();\n\n\t\t\tif(crs.next()) {\n\t\t\t\tquote = crs.getString(\"qotd\");\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tcrs.close();\n\t\t\t} catch (SQLException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn quote;\n\t}", "public BigDecimal getTrxAmt();", "protected int t(int n) {\r\n\t\treturn Math.floorDiv(n * (n - 1), 2);\r\n\t}", "public T getSecond() {\n\t\t\treturn t;\n\t\t}", "public java.lang.Integer getThn() {\n return thn;\n }", "public double topInt(double tenths) {\n double rounded = Math.floor(tenths)+1.0;\n\n return rounded;\n}", "public double GetTonnage() {\n if( LotSize != CurLotSize ) {\n double TonsPerShot = Tonnage / (double) LotSize;\n return CommonTools.RoundFractionalTons( TonsPerShot * (double) CurLotSize );\n }\n return Tonnage;\n }", "private static final int getPower(Parsing t) {\n\t\tchar s='+';\t\t// Exponent Sign\n\t\tint pow=0;\t\t// Exponent Value\n\t\tint inum=0;\t\t// Index of exponent\n\t\tint posini=t.pos;\n\t\t//System.out.print(\"....getPower on '\" + this + \"', pos=\" + pos + \": \");\n\t\tt.pos = t.length-1;\n\t\tif (Character.isDigit(t.a[t.pos])) {\n\t\t\twhile (Character.isDigit(t.a[t.pos])) --t.pos;\n\t\t\ts = t.a[t.pos];\n\t\t\tif ((s == '+') || (s == '-')) ;\t// Exponent starts here\n\t\t\telse ++t.pos;\n\t\t\tinum = t.pos;\n\t\t\tpow = t.parseInt();\n\t\t\t//System.out.print(\"found pow=\" + pow + \",pos=\" + pos);\n\t\t}\n\t\tif (pow != 0) {\t\t// Verify the power is meaningful\n\t\t\tif (t.a[0] == '(') {\n\t\t\t\tif (t.a[inum-1] != ')') pow = 0;\n\t\t\t}\n\t\t\telse {\t\t// could be e.g. m2\n\t\t\t\tfor (int i=0; i<inum; i++) {\n\t\t\t\t\t// Verify the unit is not a complex one\n\t\t\t\t\tif (!Character.isLetter(t.a[i])) pow = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pow == 0) t.pos = posini;\n\t\telse t.pos = inum;\n\t\t//System.out.println(\" pow=\" + pow + \", pos=\" + pos);\n\t\treturn(pow);\n\t}", "public Square getTractor() {\n\t\treturn tractor;\n\t}", "public java.lang.Integer getThn() {\n return thn;\n }", "double tirer();", "public double dollarTorp()\r\n\t{\r\n\t\treturn getAmount() * 14251.25;\r\n\t}", "public Integer getQuarter() {\r\n return QTR;\r\n }", "public static BigInteger getNth(long n)\n {\n if (n == 0 || n == 1) { return BigInteger.valueOf(n); }\n else { return power(atom, n - 1)[0][0]; } \n }", "public static double sq(double x) {\n return x * x;\n }", "TickerPrice getPrice(String symbol);", "public int getQntd() {\r\n\t\treturn this.qntd;\r\n\t}", "public double getSecond() {\n return second;\n }", "public double getFirst()\n {\n return first;\n }", "private static String getPrice(WebElement s) {\n\n\t\treturn s.findElement(By.xpath(\"following-sibling::td[1]\")).getText();\n\n\t}", "public double getFirst() {\n return first;\n }", "public float getTcintmprice()\r\n {\r\n return _tcintmprice;\r\n }", "@Field(26) \n\tpublic double TradePrice() {\n\t\treturn this.io.getDoubleField(this, 26);\n\t}", "long getSymbol();", "public double getChiSquare() {\r\n\t\treturn chisq;\r\n\t}", "String getQuoteOfTheDay();", "public int tget() {\n return denom_hi * 256 + denom_lo;\n }", "private double term(boolean get){\n\t\t// compute the left argument which has to be a primary value or an expression with a higher priority than products\n\t\tdouble left = pot(get);\n\t\tfor(;;){\n\t\t\tswitch(curr_tok){\n\t\t\t\tcase MUL:{\n\t\t\t\t\tleft*=pot(true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase DIV:{\n\t\t\t\t\tdouble d;\n\t\t\t\t\tif((d=pot(true)) != 0){\n\t\t\t\t\t\tleft/=d;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t//System.err.println(\"Error::TermParser::term(): Invalid operation. Division by 0.\");\n\t\t\t\t\treturn Double.NaN;\n\t\t\t\t}\n\t\t\t\tdefault:{\n\t\t\t\t\treturn left;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public double getThigh() {\n return thigh;\n }", "public BigDecimal getTRX_NO() {\r\n return TRX_NO;\r\n }", "public int getSquareNumber() {\n\t\treturn squareNumber;\n\t}", "public int getQuarters()\n {\n\treturn quarters;\n }", "private BigInteger squareKaratsuba() {\n int half = (mag.length+1) / 2;\n\n BigInteger xl = getLower(half);\n BigInteger xh = getUpper(half);\n\n BigInteger xhs = xh.square(); // xhs = xh^2\n BigInteger xls = xl.square(); // xls = xl^2\n\n // xh^2 << 64 + (((xl+xh)^2 - (xh^2 + xl^2)) << 32) + xl^2\n return xhs.shiftLeft(half*32).add(xl.add(xh).square().subtract(xhs.add(xls))).shiftLeft(half*32).add(xls);\n }", "public double getChiSquare() {\n\treturn chiSq;\n }", "public double getSecond()\n {\n return second;\n }", "public double sqRoot(double num) {\n double base = 0;\n while (base < num) {\n base++;\n if ((base * base) == num) {\n return base;\n }\n }\n\n double termInSequence = ((base * base) + num) / (2 * base);\n for (int i = 0; i < 10; i++) {\n termInSequence = ((termInSequence * termInSequence) + num) / (2 * termInSequence);\n }\n return Double.parseDouble(String.format(\"%.9f\", termInSequence));\n }", "public double getSquareLength() {\n return r * r + i * i;\n }", "public double getTiempoDijkstraSencillo()\n {\n return tiempoDijkstraSencillo;\n }", "int getFirstTick();", "public String getTaunt() {\n\t\tRandom rand = new Random();\n\t\tint n = rand.nextInt(3); // creates a random int\n\t\treturn taunts.get(n); // returns the taunt at that index\n\t}", "public double nextDoubleOpen() {\n\tdouble result = d1 / POW3_33;\n\tnextIterate();\n\treturn result;\n }", "public float squared(){\r\n\t\treturn this.dottedWith( this );\r\n\t}", "private double hypTan(double x){\n\t\t//System.out.print(\".\");\n\t\treturn (Math.tanh(k*x)*0.5) + 0.5;\t\n\t}", "public int getSymbology() {\r\n return Symbology;\r\n }", "public Number getQtyMulPrice() {\n return (Number)getAttributeInternal(QTYMULPRICE);\n }", "public static double termSlotwaarde(final int n, final int t, final double i)\n\t{\n\t\tdouble n1 = Math.floor(n * t);\n\t\tdouble r = 1d + termPercentage(t, t) / HON_PERCENT;\n\t\treturn Math.pow(r, n1);\n\t}", "public double getCost() {\n return this.product.getPrice() * quanity;\n }", "public double t1() {\n\t\treturn segments.size() - 1;\n\t}", "public long mo9755t() {\n return mo9762y();\n }", "public double tempoMedio(String t){\n\t\tt = t.toUpperCase();\n\t\tif(t == \"B\"){\n\t\t\treturn this.tempMB;\n\t\t}else if(t == \"S\"){\n\t\t\treturn this.tempMS;\n\t\t}else if(t == \"I\"){\n\t\t\treturn this.tempMI;\n\t\t}\n\t\n\t\treturn 0;\n\t}", "public Node term()\r\n\t{\r\n\t\tNode lhs = negaposi();\r\n\t\tif(lhs!=null)\r\n\t\t{\r\n\t\t\tint index = lexer.getPosition();\r\n\t\t\tLexer.Token token = lexer.getToken();\r\n\t\t\twhile(token == Lexer.Token.TIMES\r\n\t\t\t\t||token == Lexer.Token.DIVIDE)\r\n\t\t\t{\r\n\t\t\t\tNode rhs = negaposi(); \r\n\t\t\t\tif(rhs!=null)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(token == Lexer.Token.TIMES)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlhs = new Mul(lhs,rhs);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(token == Lexer.Token.DIVIDE)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlhs = new Div(lhs,rhs);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tindex = lexer.getPosition();\r\n\t\t\t\t\ttoken = lexer.getToken();\r\n\t\t\t\t}\r\n\t\t\t\telse break;\r\n\t\t\t}\r\n\t\t\tlexer.setPosition(index);\r\n\t\t}\r\n\t\treturn lhs;\r\n\t}", "public short mo34e() {\n return 41;\n }", "public double getSalario() {\r\n\t\treturn super.getSalario()-10000;\r\n\t}", "public int getTick() {\r\n\t\treturn tick;\r\n\t}", "public double getOperand1()\r\n\t{\r\n\t\tSystem.out.println(\"enter the operand 1:\");\r\n\t\tdouble op1=sc.nextDouble();\r\n\t\treturn op1;\r\n\t}", "public int mo9754s() {\n return mo9785x();\n }", "public String getTentSymbol(){ return tentSymbol;}", "public long mo9755t() {\n return mo9775y();\n }", "public double tongDoanhThu() {\n double doanhThu = 0;\n for (ChuyenXe cx : dsChuyenXe) {\n doanhThu += cx.doanhThu;\n }\n return doanhThu;\n }", "public short mo34e() {\n return 15;\n }", "public int get_thema() {\n\t\treturn this.thema;\n\t}", "public int calcTraderPrice() {\r\n Random r = new Random();\r\n return rtl + r.nextInt(rth - rtl);\r\n }", "private static double getSinSquare(Double value){\r\n\t\treturn Math.pow(Math.sin(value/2), 2);\r\n\r\n }", "private double square(double x) {\r\n return x * x;\r\n }", "public TesisatTur getTesisatTur() {\r\n\t\treturn tesisatTur;\r\n\t}", "public double getIndex()\n {\n index = 206.835 - 84.6 * syllables / words\n - 1.015 * words / sentences;\n\n return index;\n }", "public int mo23283Y() {\n return ((Integer) this.f13965a.mo23249a(C7196pb.f13884tb)).intValue();\n }", "public double visit(Stock stock) {\n\t\treturn stock.getPrice()*((double)stock.getQuantity());\n\t}", "public Double getHydrogenSulfide() {\n return hydrogenSulfide;\n }", "public short mo34e() {\n return 140;\n }", "public double getTip() {\r\n return tipCalculator.getCalculatedTip();\r\n }", "public double nextDouble() {\n\tdouble result = (d1 - 1.0) / (POW3_33 - 1.0);\n\tnextIterate();\n\treturn result;\n }", "public int getShirt() {\n return shirt_;\n }", "public StrColumn getExptl1HShiftTermUnits() {\n return delegate.getColumn(\"exptl_1H_shift_term_units\", DelegatingStrColumn::new);\n }", "public double SQ_LEFT(int c) {\n return (c % 10 == 6)\n ? 1.15 : 1;\n \n }", "public long mo9755t() {\n return mo9786y();\n }", "public String getTrend() {\r\n return fTrend;\r\n }", "public double getPreTB() {\n return preTB;\n }", "public BigDecimal getPriceStdWTax();" ]
[ "0.71790266", "0.5745889", "0.57217056", "0.5646441", "0.5483308", "0.5470933", "0.5394773", "0.53751916", "0.53218865", "0.5267231", "0.52542824", "0.5228414", "0.5223884", "0.52205426", "0.52074474", "0.51898354", "0.51624525", "0.5157856", "0.5126182", "0.5106508", "0.5065651", "0.50567055", "0.5035012", "0.5028609", "0.5010801", "0.49793848", "0.49744037", "0.4973418", "0.496927", "0.49680105", "0.496771", "0.49671236", "0.49591613", "0.49517635", "0.4941444", "0.49241775", "0.4914983", "0.4914236", "0.49087378", "0.48988608", "0.48896605", "0.487788", "0.4874709", "0.48600718", "0.48474914", "0.4846618", "0.4846253", "0.48433217", "0.48389426", "0.4838782", "0.48349184", "0.48329046", "0.48259076", "0.48255667", "0.48220322", "0.48192692", "0.48171848", "0.4803949", "0.48017555", "0.48012182", "0.479705", "0.47909474", "0.47813344", "0.4777647", "0.47769108", "0.47745928", "0.47671768", "0.47649452", "0.4750261", "0.47445822", "0.4744139", "0.4743292", "0.47410646", "0.47293365", "0.4722287", "0.47173837", "0.47077912", "0.47074226", "0.47043693", "0.46995786", "0.46979406", "0.4692962", "0.46905595", "0.46889108", "0.46854988", "0.4683517", "0.46812", "0.46803683", "0.4678822", "0.4675112", "0.46746066", "0.46724826", "0.46657813", "0.4663214", "0.46601275", "0.46581644", "0.46527", "0.46511382", "0.4645131", "0.46448678" ]
0.7119622
1
Returns the logreturn calculated on the tth environement of the series. The logreturn of environement x(t) of series X is defined as log(x(t)/x(t 1). For this reason, the first environement for which logreturn can be calculated is the one with index 1. Requesting a logreturn for an outofrange index does not cause an exception to be thrown, but the result is zero.
public double getLogReturn(int t) { if(t<1 || t>=size) return 0.0; return r[t - 1]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double logZero(double x);", "long getLastLogIndex();", "long getFirstLogIndex();", "public Series logarithmic()\n {\n Series logarithmic = new Series();\n logarithmic.x = new double[logarithmic.size = size];\n logarithmic.r = r;\n for(int t = 0; t<size; t++)\n logarithmic.x[t] = Math.log(x[t]);\n return logarithmic;\n }", "public static double [] logarithm (double [][]x){\n\t\tdouble [] log=new double [x.length-1];\n\t\t\n\t\tfor(int i=0; i<x.length-1;i++){\n\t\t\tdouble[] xk1=x[i+1];\n\t\t\tdouble[] xk=x[i];\n\t\t\tlog[i]=Math.log10(Math.max( Math.abs(xk1[0] - xk[0]), Math.abs(xk1[1] - xk[1]) ));\n\t\t\t\n\t\t}\n\t\t\n\t\treturn log;\n\t}", "@Override\n public double evaluate() throws Exception {\n return Math.log(getEx2().evaluate()) / Math.log(getEx2().evaluate());\n }", "public static double log(double x)\n\t{\n\t if (x < 1.0)\n\t return -log(1.0/x);\n\t \n\t double m=0.0;\n\t double p=1.0;\n\t while (p <= x) {\n\t m++;\n\t p=p*2;\n\t }\n\t \n\t m = m - 1;\n\t double z = x/(p/2);\n\t \n\t double zeta = (1.0 - z)/(1.0 + z);\n\t double n=zeta;\n\t double ln=zeta;\n\t double zetasup = zeta * zeta;\n\t \n\t for (int j=1; true; j++)\n\t {\n\t n = n * zetasup;\n\t double newln = ln + n / (2 * j + 1);\n\t double term = ln/newln;\n\t if (term >= LOWER_BOUND && term <= UPPER_BOUND)\n\t return m * ln2 - 2 * ln;\n\t ln = newln;\n\t }\n\t}", "static private float _log(float x) {\n \t\tif (!(x > 0f)) {\n \t\t\treturn Float.NaN;\n \t\t}\n \t\t//\n \t\tfloat f = 0f;\n \t\t//\n \t\tint appendix = 0;\n \t\twhile ((x > 0f) && (x <= 1f)) {\n \t\t\tx *= 2f;\n \t\t\tappendix++;\n \t\t}\n \t\t//\n \t\tx /= 2f;\n \t\tappendix--;\n \t\t//\n \t\tfloat y1 = x - 1f;\n \t\tfloat y2 = x + 1f;\n \t\tfloat y = y1 / y2;\n \t\t//\n \t\tfloat k = y;\n \t\ty2 = k * y;\n \t\t//\n \t\tfor (long i = 1; i < 10; i += 2) {\n \t\t\tf += k / i;\n \t\t\tk *= y2;\n \t\t}\n \t\t//\n \t\tf *= 2f;\n \t\tfor (int i = 0; i < appendix; i++) {\n \t\t\tf += FLOAT_LOGFDIV2;\n \t\t}\n \t\t//\n //\t\tlogger.info(\"exit _log\" + f);\n \t\treturn f;\n \t}", "public float nextLog ()\n {\n // Generate a non-zero uniformly-distributed random value.\n float u;\n while ((u = GENERATOR.nextFloat ()) == 0)\n {\n // try again if 0\n }\n\n return (float) (-m_fMean * Math.log (u));\n }", "public synchronized int lastEntryTerm() {\n if (this.lastEntryIndex() > 0) {\n return this.logs.get(lastIndex).getTerm();\n } else return -1;\n }", "@Override\r\n\tpublic double evaluate(double input1) throws ArithmeticException \r\n\t{\n\t\treturn Math.log(input1);\r\n\t}", "@Override\r\n\tpublic double t(double x) {\r\n\t\treturn Math.log( (x - this.getLower_bound() ) / (this.getUpper_bound() - x) );\r\n\t}", "private static int getlog(int operand, int base) {\n double answ = Math.log(operand)/Math.log(base);\n if (answ == Math.ceil(answ)) {\n return (int)answ;\n }\n else {\n return (int)answ+1;\n }\n }", "private double logSumExp(double x[]) {\n double maxx = Double.NEGATIVE_INFINITY;\n for (double d : x) {\n if (d > maxx) { maxx = d; }\n }\n double sum = 0.0;\n for (double d : x) {\n sum += Math.exp(d-maxx);\n }\n return maxx + Math.log(sum);\n }", "public double logResult(double f) {\n double r;\n try {\n r = 20 * Math.log10(result(f));\n } catch (Exception e) {\n r = -100;\n }\n if (Double.isInfinite(r) || Double.isNaN(r)) {\n r = -100;\n }\n return r;\n }", "static private float exact_log(float x) {\n \t\tif (!(x > 0f)) {\n \t\t\treturn Float.NaN;\n \t\t}\n \t\t//\n \t\tfloat f = 0f;\n \t\t//\n \t\tint appendix = 0;\n \t\twhile ((x > 0f) && (x <= 1f)) {\n \t\t\tx *= 2f;\n \t\t\tappendix++;\n \t\t}\n \t\t//\n \t\tx /= 2f;\n \t\tappendix--;\n \t\t//\n \t\tfloat y1 = x - 1f;\n \t\tfloat y2 = x + 1f;\n \t\tfloat y = y1 / y2;\n \t\t//\n \t\tfloat k = y;\n \t\ty2 = k * y;\n \t\t//\n \t\tfor (long i = 1; i < 50; i += 2) {\n \t\t\tf += k / i;\n \t\t\tk *= y2;\n \t\t}\n \t\t//\n \t\tf *= 2f;\n \t\tfor (int i = 0; i < appendix; i++) {\n \t\t\tf += FLOAT_LOGFDIV2;\n \t\t}\n \t\t//\n //\t\tlogger.info(\"exit _log\" + f);\n \t\treturn f;\n \t}", "public static final float log(float x) {\n \t\tif (!(x > 0f)) {\n \t\t\treturn Float.NaN;\n \t\t}\n \t\t//\n \t\tif (x == 1f) {\n \t\t\treturn 0f;\n \t\t}\n \t\t// Argument of _log must be (0; 1]\n \t\tif (x > 1f) {\n \t\t\tx = 1 / x;\n \t\t\treturn -_log(x);\n \t\t}\n \t\t;\n \t\t//\n \t\treturn _log(x);\n \t}", "public static double logarit(double value, double base) {\n\t\tif (base == Math.E)\n\t\t\treturn Math.log(value);\n\t\telse if (base == 10)\n\t\t\treturn Math.log10(value);\n\t\telse\n\t\t\treturn Double.NaN;\n\t\t\t\n\t}", "@Override\n public double calculateLogP() {\n\n double fastLogP = logLhoodAllGeneTreesInSMCTree(getInverseGammaMixture(),\n popPriorScaleInput.get().getValue(), false);\n\n if (debugFlag && numberofdebugchecks < maxnumberofdebugchecks) {\n double robustLogP = logLhoodAllGeneTreesInSMCTree(getInverseGammaMixture(),\n popPriorScaleInput.get().getValue(), true);\n if (Math.abs(fastLogP - robustLogP) > 1e-12) {\n System.err.println(\"BUG in calculateLogP() in PIOMSCoalescentDistribution\");\n throw new RuntimeException(\"Fatal STACEY error.\");\n\n }\n numberofdebugchecks++;\n }\n logP = fastLogP;\n return logP;\n }", "public static float log(float base, float arg) {\n return (nlog(arg)) / nlog(base);\n }", "@Test\n public void whenInvokeThenReturnsLogarithmValues() {\n Funcs funcs = new Funcs();\n\n List<Double> expected = Arrays.asList(0D, 0.301D, 0.477D);\n List<Double> result = funcs.range(1, 3,\n (pStart) -> {\n double resultValue = Math.log10(pStart);\n resultValue = Math.rint(resultValue * 1000) / 1000;\n return resultValue;\n });\n\n assertThat(result, is(expected));\n }", "public static String getLogEntry(int index){\n if(index < 0 || index >= log.size()){\n return \"\";\n }\n return log.get(index);\n }", "@SuppressWarnings(\"deprecation\")\n\t@Override\n public double calculateLogP() {\n logP = 0.0;\n // jeffreys Prior!\n if (jeffreys) {\n logP += -Math.log(getChainValue(0));\n }\n for (int i = 1; i < chainParameter.getDimension(); i++) {\n final double mean = getChainValue(i - 1);\n final double x = getChainValue(i);\n\n if (useLogNormal) {\n\t final double sigma = 1.0 / shape; // shape = precision\n\t // convert mean to log space\n\t final double M = Math.log(mean) - (0.5 * sigma * sigma);\n\t logNormal.setMeanAndStdDev(M, sigma);\n\t logP += logNormal.logDensity(x);\n } else {\n final double scale = mean / shape;\n gamma.setBeta(scale);\n logP += gamma.logDensity(x);\n }\n }\n return logP;\n }", "public static double sumInLogDomain(double[] logs) {\n\t\tdouble maxLog = logs[0];\n\t\tint idxMax = 0;\n\t\tfor (int i = 1; i < logs.length; i++) {\n\t\t\tif (maxLog < logs[i]) {\n\t\t\t\tmaxLog = logs[i];\n\t\t\t\tidxMax = i;\n\t\t\t}\n\t\t}\n\t\t// now calculate sum of exponent of differences\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < logs.length; i++) {\n\t\t\tif (i == idxMax) {\n\t\t\t\tsum++;\n\t\t\t} else {\n\t\t\t\tsum += Math.exp(logs[i] - maxLog);\n\t\t\t}\n\t\t}\n\t\t// and return log of sum\n\t\treturn maxLog + Math.log(sum);\n\t}", "public int divide(int x , int y ) {\n\t\tif( y == 0 )\n\t\t\tthrow new ArithmeticException(\"Divide by zero\");\n\t\tif( x == 0 )\n\t\t\treturn 0;\n\n\t\treturn exp[ log[x] + max_value - log[y] ];\n\t}", "public static double CalcLevel_Log(double SlopeStart, double SlopeStop,double FreqPoint)\r\n {\n double levelLog = 0.0;\r\n double tempY = 0.0;\r\n\r\n tempY = SlopeStart * (Math.log10(FreqPoint)) + SlopeStop;\r\n levelLog = (Math.pow(10, tempY));\r\n\r\n return levelLog;\r\n }", "public static double logBase2(double x){\n return Math.log(x)/Math.log(2);\n }", "private static double log2(double x) {\n return Math.log(x) / Math.log(2);\n }", "public double getEstimate()\n {\n assert list.length > 0: \"The list cannot be empty\";\n int R = list[0];\n \n //count how many are smaller or equal to R\n double counter = 0;\n for (int i = 1; i < k; i++) {\n if (list[i]<R)\n counter++;\n }\n return -Math.pow(2, R - 1) * Math.log(counter / (k-1)); }", "public double valueAt(double x) {\r\n \treturn ((f.valueAt(x+epsilon)/2- f.valueAt(x-epsilon)/2)/epsilon);\r\n }", "private static double lg(double x) {\n return Math.log(x) / Math.log(2.0);\n }", "public double[] LogSlope(double StartFreq, double StopFreq, double StartLevel, double StopLevel)\r\n {\n \r\n\tdouble levelM1 = 0.0;\r\n double levelB1 = 0.0;\r\n double levelFlag = 0.0;\r\n double[] logSLopeCalcValues = new double[7];\r\n\r\n //calculate M1 value\r\n // M1 = (Y2 - Y1) / (X2- X1)\r\n levelM1 = (Math.log10(StopLevel) - Math.log10(StartLevel)) / (Math.log10(StopFreq) - Math.log10(StartFreq));\r\n\r\n //calculate B1 value\r\n // B1 = Y2 -(M1 * X2)\r\n levelB1 = Math.log10(StopLevel) - (levelM1 * Math.log10(StopFreq));\r\n\r\n // put the values in the array to return it\r\n logSLopeCalcValues[0] = levelM1;\r\n logSLopeCalcValues[1] = levelB1;\r\n logSLopeCalcValues[2] = StartFreq;\r\n logSLopeCalcValues[3] = StopFreq;\r\n logSLopeCalcValues[4] = StartLevel;\r\n logSLopeCalcValues[5] = StopLevel;\r\n logSLopeCalcValues[6] = levelFlag;\r\n //return the array with the M1 and B1 values\r\n return logSLopeCalcValues;\r\n }", "public static double log(double a){ \n // migrated from jWMMG - the origin of the algorithm is not known.\n if (Double.isNaN(a) || a < 0) {\n return Double.NaN;\n } else if (a == Double.POSITIVE_INFINITY) {\n return Double.POSITIVE_INFINITY;\n } else if (a == 0) {\n return Double.NEGATIVE_INFINITY;\n }\n \n long lx;\n if (a > 1) {\n lx = (long)(0.75*a); // 3/4*x\n } else {\n lx = (long)(0.6666666666666666666666666666666/a); // 2/3/x\n }\n \n int ix;\n int power;\n if (lx > Integer.MAX_VALUE) {\n ix = (int) (lx >> 31);\n power = 31;\n } else {\n ix = (int) lx;\n power = 0;\n }\n \n while (ix != 0) {\n ix >>= 1;\n power++;\n }\n \n double ret;\n if (a > 1) {\n ret = lnInternal(a / ((long) 1<<power)) + power * LN_2;\n } else {\n ret = lnInternal(a * ((long) 1<<power)) - power * LN_2;\n }\n return ret;\n }", "public int inverse(int x ) {\n\t\treturn exp[max_value - log[x]];\n\t}", "public static double[] logarit(double[] data, double base) {\n\t\tdouble[] result = new double[data.length];\n\t\tfor (int i = 0; i < data.length; i++) {\n\t\t\tif (base == Math.E)\n\t\t\t\tresult[i] = Math.log(data[i]);\n\t\t\telse if (base == 10)\n\t\t\t\tresult[i] = Math.log10(data[i]);\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "public double get(int index) {\n\t\treturn 0;\n\t}", "public final void log() throws ArithmeticException {\n\t\tif ((mksa&_LOG) != 0) throw new ArithmeticException\n\t\t(\"****Unit: log(\" + symbol + \")\") ;\n\t\tvalue = AstroMath.log(value);\n\t\tmksa |= _log;\n\t\tif (symbol != null) \n\t\t\tsymbol = \"[\" + symbol + \"]\";\t// Enough to indicate log\n\t}", "@Override\n public Number getEndX(int series, int item) {\n assert 0 <= series && series < checkpoint.gcTraceSize();\n assert 0 <= item && item < checkpoint.size(series);\n\n return getEndXValue(series, item);\n }", "static int linearLogTime(int[] n, int[] m) {\n if(n == null || n.length == 0 || m == null || m.length == 0) return -1;\n int sum = 0;\n for(int i = 0; i < n.length; ++i) {\n sum += logTime(m, 0, m.length, 15);\n }\n return sum;\n }", "private void naturalLog()\n\t{\n\t\tif(Fun == null)\n\t\t{\n\t\t\tsetLeftValue();\n\t\t\tresult = calc.naturalLog ( );\n\t\t\tupdateText();\n\t\t}\n\t}", "public double getTimestamp() {\n switch (randomType) {\n case EXPONENT:\n return forArrive ? (-1d / LAMBDA) * Math.log(Math.random()) : (-1d / NU) * Math.log(Math.random());\n\n default:\n return 0;\n }\n }", "public static float nlog(float x) {\n if (x == 1) return 0;\n\n float agm = 1f;\n float g1 = 1 / (x * (1 << (DEFAULT_ACCURACY - 2)));\n float arithmetic;\n float geometric;\n\n for (int i = 0; i < 5; i++) {\n arithmetic = (agm + g1) / 2f;\n geometric = BAKSH_sqrt(agm * g1);\n agm = arithmetic;\n g1 = geometric;\n }\n\n return (PI / 2f) * (1 / agm) - DEFAULT_ACCURACY * LN2;\n }", "@Override\n public double evaluate(Map<String, Double> assignment) throws Exception {\n\n double res = Math.log(getEx2().evaluate(assignment)) / Math.log(getEx2().evaluate(assignment));\n return res;\n }", "public static int lastIndex(int input[], int x) {\n return lastIndex(input, x, 0, -1);\n\t}", "public T elementLog() {\n T c = createLike();\n ops.elementLog(mat, c.mat);\n return c;\n }", "@Override\n public double getXValue(int series, int item) {\n assert 0 <= series && series < checkpoint.gcTraceSize();\n assert 0 <= item && item < checkpoint.size(series);\n\n\n double startSec = getStartXValue(series, item);\n double endSec = getEndXValue(series, item);\n double ret = startSec + (endSec - startSec) / 2.0;\n return ret;\n }", "private static final int calcLog (int value)\n {\n // Shortcut for uncached_data_length\n if (value <= 1023 )\n {\n return MIN_CACHE;\n }\n else\n {\n return (int)(Math.floor (Math.log (value) / LOG2));\n }\n }", "public EventLogEntry getEventLogEntry(int index);", "public static double lg(double x) {\n return Math.log(x) / Math.log(2);\n }", "public synchronized int getLastTerm() {\n if(lastEntryIndex() <= 0) return 0;\n return getEntry(lastIndex).getTerm();\n }", "public double lo() {\n return lo;\n }", "private static double lnInternal(double x){\n double a = 1 - x;\n double s = -a;\n double t = a;\n \n for (int i = 2; i < 25; i++){\n t = t*a;\n s -= t/i;\n }\n return s;\n }", "private double lnGamma(double x) \n\t{\n\t\tdouble f = 0.0, z;\n\t\tif (x < 7) \n\t\t{\n\t\t\tf = 1;\n\t\t\tz = x - 1;\n\t\t\twhile (++z < 7)\n\t\t\t{\n\t\t\t\tf *= z;\n\t\t\t}\n\t\t\tx = z;\n\t\t\tf = -Math.log(f);\n\t\t}\n\t\tz = 1 / (x * x);\n\t\treturn\tf + (x - 0.5) * Math.log(x) - x + 0.918938533204673 +\n\t\t\t\t( ( ( -0.000595238095238 * z + 0.000793650793651 ) * z \n\t\t\t\t\t -0.002777777777778) * z + 0.083333333333333 ) / x;\n\t}", "private double f(double x) {\n return (1 / (1 + Math.exp(-x)));\n }", "public double getValue( double x )\n {\n if ( domain.contains( (float)x ) )\n {\n double sum = 0.0; \n for ( int i = parameters.length - 1; i >= 0; i-- )\n sum = x * sum + parameters[i];\n return sum; \n }\n else\n return 0; \n }", "public int getLevel(int index)\n\t{\n\t\tdouble value = (Math.log10(index/1.0)/Math.log10(2.0));\n\t\tint level = (int)Math.floor(value);\n\t\treturn level;\n\t}", "public double eval(double[] x) {\n\t\tdouble z = VectorOps.dot(this.weights, x); \t\t// z is still w dot x\n\t\tdouble log = 1.0 / (1.0 + Math.exp(-1 * z) ); \t// 1 / (1 + e^-z)\n\n\t\treturn log;\n\t\t\n\t}", "public static double[][] logarit(double[][] data, double base) {\n\t\tdouble[][] result = new double[data.length][];\n\t\t\n\t\tfor (int i = 0; i < data.length; i++) {\n\t\t\tresult[i] = logarit(data[i], base);\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "private double entropy(double x) {\r\n\t\tif (x > 0)\r\n\t\t\treturn -(x * (Math.log(x) / Math.log(2.0)));\r\n\t\telse\r\n\t\t\treturn 0.0;\r\n\t}", "int getBacklog();", "@Test\n public void whenLogarithmicFunctionThenLogarithmicResults() {\n FunctionMethod functionMethod = new FunctionMethod();\n List<Double> result = functionMethod.diapason(16, 18, x -> Math.log(x) / Math.log(2.0));\n List<Double> expected = Arrays.asList(4D, 4.08746284125034D);\n assertThat(result, is(expected));\n }", "public double trace(){\r\n \tdouble trac = 0.0D;\r\n \tfor(int i=0; i<Math.min(this.ncol,this.ncol); i++){\r\n \ttrac += this.matrix[i][i];\r\n \t}\r\n \treturn trac;\r\n \t}", "public double getLogProb(double value) {\n checkHasParams();\n if (value < 0) {\n return Double.NEGATIVE_INFINITY;\n } else {\n return logLambda - lambda * value;\n }\n }", "public Timestamp getLastLogintime() {\n return lastLogintime;\n }", "public int defaultAnomaly(int total);", "static int logTime(int[] n, int start, int end, int val) {\n if(n == null || n.length == 0) return -1;\n int mid = (start + end) / 2;\n if(val < n[mid]) logTime(n, 0, mid, val);\n if(val > n[mid]) logTime(n, mid + 1, n.length, val);\n return n[mid];\n }", "public SegaLogger getLog(){\r\n\t\treturn log;\r\n\t}", "@Override\n public double getXValue(int series, int item) {\n assert 0 <= series && series < datasets.size();\n \n return ((double) ((item + 1) / 2)) * xStep;\n }", "public int getLogHour(int index)\n {\n return m_Log.get(index).getHour();\n }", "public double getFirstExtreme(){\r\n return firstExtreme;\r\n }", "@Override\n public double getEndXValue(int series, int item) {\n assert 0 <= series && series < checkpoint.gcTraceSize();\n assert 0 <= item && item < checkpoint.size(series);\n\n double startSec = gcActivity(series, item).getStartSec();\n double durationSec = gcActivity(series, item).getDurationSec();\n return startSec + durationSec;\n }", "public static double predict(LinkedList<Double> series)\n\t{\n\t\tdouble nextValue = 0;\n\t\tdouble lastValue = 0;\n\t\tif (S0 == 0)\n\t\t{\n\t\t\tfor (int i=0; i<series.size()-1; i++)\n\t\t\t\tS0 += series.get(i);\n\t\t\tS0 /= series.size()-1;\t\n\t\t}\n\t\tlastValue = series.get(series.size()-1);\n\t\tnextValue = S0 + alpha * (lastValue - S0);\n\t\tS0 = nextValue;\n\t\treturn nextValue;\n\t}", "private double log2(double number){\n return (Math.log(number) / Math.log(2));\n }", "protected double forecast( double t )\n throws IllegalArgumentException\n {\n double previousTime = t - getTimeInterval();\n \n // As a starting point, we set the first forecast value to be\n // the same as the observed value\n if ( previousTime < getMinimumTimeValue()+TOLERANCE )\n return getObservedValue( t );\n \n try\n {\n double b = getSlope( previousTime );\n \n double forecast\n = alpha*getObservedValue(t)\n + (1.0-alpha)*(getForecastValue(previousTime)+b);\n \n return forecast;\n }\n catch ( IllegalArgumentException iaex )\n {\n double maxTimeValue = getMaximumTimeValue();\n \n double b = getSlope( maxTimeValue-getTimeInterval() );\n double forecast\n = getForecastValue(maxTimeValue)\n + (t-maxTimeValue)*b;\n \n return forecast;\n }\n }", "public static double log2(double x) {\n\t\tint base = 2;\n\t\treturn Math.log(x) / Math.log(base);\n\t}", "public static Matrix logN(double base, Matrix matrix)\n {\n Matrix result = null;\n try\n {\n result = logN(matrix, base);\n }\n catch (Exception ex)\n {\n }\n return result;\n }", "public Log_Expr_TElements getLog_Expr_TAccess() {\n\t\treturn (pLog_Expr_T != null) ? pLog_Expr_T : (pLog_Expr_T = new Log_Expr_TElements());\n\t}", "public int logs()\n {\n return m_Log.size();\n }", "@Override\n public double getStartYValue(int series, int item) {\n assert 0 <= series && series < checkpoint.gcTraceSize();\n assert 0 <= item && item < checkpoint.size(series);\n\n return 0.0;\n }", "public TicketLog getLogByPosition(int position) {\n\t\tint previousPosition = logList.size()-position;\n\t\treturn logList.get(previousPosition);\n\t}", "public Number getLogScore() {\r\n\t\treturn this.logScore;\r\n\t}", "public double getSlope() {\n if (n < 2) {\n return Double.NaN; //not enough data\n }\n if (Math.abs(sumXX) < 10 * Double.MIN_VALUE) {\n return Double.NaN; //not enough variation in x\n }\n return sumXY / sumXX;\n }", "public double log(double d){\r\n\r\n\t\tif(d == 0){\r\n\t\t\treturn 0.0;\r\n\t\t} else {\r\n\t\t\treturn Math.log(d)/Math.log(2);\r\n\t\t}\r\n\r\n\t}", "private Log getLog() {\n if (controller != null) {\n log = controller.getLog();\n } \n return log ;\n }", "static public int logaritam2(int x) {\r\n\t\tint lg = 0;\r\n\t\twhile(x != 1) {\r\n\t\t\tx /= 2;\r\n\t\t\tlg++;\r\n\t\t}\r\n\t\treturn lg;\r\n\t}", "public p207() {\n double target = 1/12345.0;\n double log2 = Math.log(2);\n\n for (int x = 2; x < 2000000; x++){\n double a = Math.floor(Math.log(x) / log2) / (x-1);\n if (a < target){\n System.out.println(x*(x-1L));\n break;\n }\n }\n }", "public abstract double log2Prior(double betaForDimension, int dimension);", "public long getRunningTimeFromLogFile(String url) \r\n\t{\r\n\t\tString line = null;\r\n\t\tlong startTiem = 0;\r\n\t\tlong endTme = 0;\r\n\t\tlong totalTiem = -1;\r\n\t\t\r\n\t\tLinkedList<String> stack = new LinkedList<>();\r\n\t\ttry {\r\n\t\t\tif (openLogFile(url))\r\n\t\t\t{\r\n\t\t\t\twhile ((line = logFileReader.readLine()) != null) {\r\n\t\t\t\t\tstack.push(line);\r\n\t\t\t\t\tif(line.startsWith(\"==>S\") && startTiem == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstartTiem = Long.parseLong(line.split(\" \")[1].split(\"\\\\.\")[0]);\r\n\t\t\t\t\t}\r\n\t\t\t\t }\r\n\t\t\t\t\r\n\t\t\t\twhile (true) {\r\n\t\t\t\t\tline = stack.pop();\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tif(line.startsWith(\"==>S\") && endTme == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tendTme = Long.parseLong(line.split(\" \")[1].split(\"\\\\.\")[0]);\r\n\t\t\t\t\t\t\tbreak; \r\n\t\t\t\t\t\t} }catch(NoSuchElementException e) { break; }\r\n\t\t\t\t }// end while\r\n\t\t\t\tif(startTiem != 0 && endTme !=0)\r\n\t\t\t\t{\r\n\t\t\t\t\ttotalTiem = endTme - startTiem;\r\n\t\t\t\t}\r\n\t\t\t\tcloseLogFile();\r\n\t\t\t} else System.out.println(\"The log file was not opened\");\r\n\t\t\t}catch(Exception e) \r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(e.getMessage());\r\n\t\t\t\tcloseLogFile();\r\n\t\t\t}\r\n\t\treturn totalTiem;\r\n\t}", "public double getSlope( ){\n if (x1 == x0){\n throw new ArithmeticException();\n }\n\n return (y1 - y0)/(x1 - x0);\n }", "public float evaluate() \n {\n return evaluate(expr, expr.length()-1);\n }", "public double findTSS(){\n\t\t\n\t\tdouble dMean; double dOut;\n\t\t\n\t\t//loading response variable\n\t\tdMean = 0;\n\t\tfor(double d:rgdY){\n\t\t\tdMean+=d;\n\t\t}\n\t\tdMean=dMean/((double) rgdY.length);\n\t\tdOut = 0;\n\t\tfor(double d:rgdY){\n\t\t\tdOut+=pow(d-dMean,2);\n\t\t}\n\t\treturn dOut;\n\t}", "public int power(int x , int power ) {\n\t\treturn exp[(log[x] * power)%max_value];\n\t}", "public Date getLastlogintime() {\n return lastlogintime;\n }", "static double[] normalizeLogP(double[] lnP){\n double[] p = new double[lnP.length];\n \n // find the maximum\n double maxLnP = lnP[0];\n for (int i=1 ; i<p.length ; ++i){\n if (lnP[i] > maxLnP){\n maxLnP = lnP[i];\n }\n }\n \n // subtract the maximum and exponentiate\n // sum is guaranted to be >= 1.0;\n double sum = 0.0;\n for (int i=0 ; i<p.length ; ++i){\n p[i] = Math.exp(lnP[i] - maxLnP);\n if (!Double.isFinite(p[i])){\n p[i] = 0.0;\n }\n sum = sum + p[i];\n }\n \n // normalize sum to 1\n for (int i=0 ; i<p.length ; ++i){\n p[i] = p[i]/sum;\n }\n return p;\n }", "@Override\r\n\tpublic Log getLog() {\n\t\treturn log;\r\n\t}", "private String getLog() {\n\n\t\tNexTask curTask = TaskHandler.getCurrentTask();\n\t\tif (curTask == null || curTask.getLog() == null) {\n\t\t\treturn \"log:0\";\n\t\t}\n\t\tString respond = \"task_log:1:\" + TaskHandler.getCurrentTask().getLog();\n\t\treturn respond;\n\t}", "public int getLogType(int index)\n {\n return m_Log.get(index).getType();\n }", "@Override\r\n\tpublic double getValue(int index) {\n\t\tif (data==null) return 0;\r\n\t\t\r\n\t\tdouble d = 0;\r\n\t\tint begin=index+pos;\r\n\t\tif (begin<0) begin=0;\r\n\t\tif (begin>data.size()-1) begin = data.size()-1;\r\n\t\td = data.get(begin).getOpen();\r\n\t\t\r\n\t\treturn d;\r\n\t}", "public static double sumLogProb (double a, double b)\n\t{\n\t\tif (a == Double.NEGATIVE_INFINITY) {\n\t\t\tif (b == Double.NEGATIVE_INFINITY)\n\t\t\t\treturn Double.NEGATIVE_INFINITY;\n return b;\n\t\t}\n\t\telse if (b == Double.NEGATIVE_INFINITY)\n\t\t\treturn a;\n\t\telse if (a > b)\n\t\t\treturn a + Math.log (1 + Math.exp(b-a));\n\t\telse\n\t\t\treturn b + Math.log (1 + Math.exp(a-b));\n\t}", "public double evaluate(int[] O) {\n\n\t\t// Forward Recursion with Scaling\n\n\t\tint T = O.length;\n\t\tdouble[] c = allocateVector(T);\n\t\tdouble[] alpha_hat_t = allocateVector(N);\n\t\tdouble[] alpha_hat_t_plus_1 = allocateVector(N);\n\t\tdouble[] temp_alpha = null;\n\t\tdouble log_likelihood = 0;\n\n\t\tfor (int t = 0; t < T; t++) {\n\t\t\tif (t == 0) {\n\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\talpha_hat_t[i] = pi[i] * B[i][O[0]];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tclearVector(alpha_hat_t_plus_1);\n\t\t\t\tfor (int j = 0; j < N; j++) {\n\t\t\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\t\t\talpha_hat_t_plus_1[j] += alpha_hat_t[i] * A[i][j] * B[j][O[t]];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttemp_alpha = alpha_hat_t;\n\t\t\t\talpha_hat_t = alpha_hat_t_plus_1;\n\t\t\t\talpha_hat_t_plus_1 = temp_alpha;\n\t\t\t}\n\t\t\tc[t] = 1.0 / sum(alpha_hat_t);\n\t\t\ttimesAssign(alpha_hat_t, c[t]);\n\t\t\tlog_likelihood -= Math.log(c[t]);\n\t\t}\n\n\t\treturn Math.exp(log_likelihood);\n\t}" ]
[ "0.5831289", "0.56712365", "0.5641109", "0.5636774", "0.5563027", "0.54627055", "0.5392971", "0.53246105", "0.53125197", "0.52770096", "0.52540725", "0.52529925", "0.5186798", "0.5183949", "0.51615274", "0.514997", "0.5132007", "0.50933486", "0.5060206", "0.5050792", "0.50493354", "0.5031708", "0.49309018", "0.48803443", "0.48538753", "0.48437873", "0.48360848", "0.48077112", "0.48069388", "0.47962296", "0.47944114", "0.47857445", "0.47715807", "0.4759242", "0.47476146", "0.47459733", "0.47366545", "0.473108", "0.47282243", "0.4725868", "0.4720762", "0.468457", "0.46808574", "0.46671942", "0.46593368", "0.46477947", "0.46440148", "0.46427706", "0.46364784", "0.4619901", "0.46155047", "0.4613742", "0.46027678", "0.45916042", "0.45746934", "0.4572328", "0.45708838", "0.45669293", "0.45571554", "0.4547715", "0.45333424", "0.45239604", "0.44982907", "0.44915858", "0.44670066", "0.4466776", "0.44666204", "0.44651848", "0.44621134", "0.44594666", "0.44448572", "0.44319996", "0.4426597", "0.44115022", "0.4396091", "0.43772885", "0.4371111", "0.43703246", "0.4369889", "0.43686482", "0.43663776", "0.43651184", "0.43646887", "0.43624133", "0.4361753", "0.43602484", "0.43569854", "0.4339057", "0.43382218", "0.433352", "0.4333102", "0.4326522", "0.4325498", "0.43170315", "0.43089962", "0.4295184", "0.42918962", "0.42914915", "0.42910343", "0.4289649" ]
0.6868315
0
Sample mean of the series.
public double mean() { double sum = 0.0; for(int t = 0; t<size; t++) sum += x[t]; return sum/size; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double mean() {\n double total = 0;\n for (int i = 0; i < sites.length; i++) {\n total += sites[i];\n }\n sampleMean = total / size / times;\n return sampleMean;\n }", "public double mean() {\r\n\t\treturn mean;\r\n\t}", "public double mean() {\n\t\treturn mean;\n\t}", "public double mean() {\n\t\treturn mean;\n\t}", "public double getMean() \r\n\t{\r\n\t\tlong tmp = lastSampleTime - firstSampleTime;\r\n\t\treturn ( tmp > 0 ? sumPowerOne / (double) tmp : 0);\r\n\t}", "public double mean() {\n return mean;\n }", "public double mean() {\n return StdStats.mean(stats);\r\n }", "public double sampleVarianceOfMean() {\n\t\treturn sampleVariance() * getWeight();\n\t}", "public final double getMean()\r\n\t{\r\n\t\treturn mean;\r\n\t}", "public static double meanVal(int[] sample){\n double total = 0;\n for (int i = 0; i < sample.length; i++){\n total = total + sample[i];\n }\n double mean = total/sample.length;\n return mean;\n }", "public Double getMean() {\n return mean;\n }", "public double mean()\n {\n return StdStats.mean(open);\n// return StdStats.sum(open) / count;\n }", "public double getMean() {\n return mean;\n }", "public void setMean(double mean) {\n this.mean = mean;\n }", "public double getMean(){\n\t\treturn (double)sampleSize * type1Size / populationSize;\n\t}", "public double mean() { \n return StdStats.mean(result);\n\n }", "public double mean() {\n return StdStats.mean(fraction);\n }", "public double mean() {\n\t\tif (count() > 0) {\n\t\t\treturn _sum.get() / (double) count();\n\t\t}\n\t\treturn 0.0;\n\t}", "public T mean();", "private void PeriodMeanEvaluation () {\n\n float x = 0;\n for(int i = 0; i < 3; i++)\n {\n for(int j = 0; j < numberOfSample; j++)\n {\n x = x + singleFrame[j][i];\n }\n meanOfPeriodCoord[i] = (x/numberOfSample);\n x = 0;\n }\n }", "private static double meanVal(double[] arrayOfSamples){\n\t\tdouble total = 0;\n\t\t for (double i :arrayOfSamples){\n\t\t \ttotal += i;\n\t\t }\n\t return total/arrayOfSamples.length;\n\t}", "public double mean() {\n return StdStats.mean(openSites) / times;\n }", "public double mean() {\n return StdStats.mean(trialResult);\n }", "public double mean() {\n return StdStats.mean(perThreshold);\n }", "public double mean() {\n\t\treturn StdStats.mean(results); \n\t}", "public double mean() {\n return mu;\n }", "public double mean() {\n/* 179 */ Preconditions.checkState((this.count != 0L));\n/* 180 */ return this.mean;\n/* */ }", "@Override\n\tpublic double mean() {\n\t\treturn 0;\n\t}", "public double mean() {\n\t\tint n = this.getAttCount();\n\t\tif (n == 0) return Constants.UNUSED;\n\t\t\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdouble v = this.getValueAsReal(i);\n\t\t\tsum += v;\n\t\t}\n\t\t\n\t\treturn sum / (double)n;\n\t}", "public String getMean()\n {\n return mean;\n }", "public double mean() {\n return StdStats.mean(results);\n }", "@Override\n\tpublic double getMean() {\n\t\treturn 1/this.lambda;\n\t}", "public double mean(){\n return StdStats.mean(percentage);\n }", "public double[] mean() {\n\t\tdouble[] mean = null;\n\t\tif(instances != null) {\n\t\t\tmean = new double[instances.get(0).length];\n\t\t\tfor(double[] instance : instances) {\n\t\t\t\tfor(int d=0; d<mean.length; d++) {\n\t\t\t\t\tmean[d] += instance[d];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdouble n = instances.size();\n\t\t\tfor(int d=0; d<mean.length; d++) {\n\t\t\t\tmean[d] /= n;\n\t\t\t}\n\t\t}\n\t\treturn mean;\n\t}", "int nextSample(final double mean);", "public double mean() {\n return StdStats.mean(this.openSites);\n }", "public double getNoiseMean() {\n\t\t\treturn NOISE_MEAN;\n\t\t}", "public double mean() {\n return StdStats.mean(thresholds);\n }", "public double mean() {\n return StdStats.mean(thresholds);\n }", "public double mean() {\n\t\treturn StdStats.mean(threshold);\n\t}", "@Override\n public Double average() {\n return (sum() / (double) count());\n }", "public double mean (List<? extends Number> a){\n\t\tint sum = sum(a);\n\t\tdouble mean = 0;\n\t\tmean = sum / (a.size() * 1.0);\n\t\treturn mean;\n\t}", "public double getMean(){\n\t\treturn Math.exp(location + scale * scale / 2);\n\t}", "public double mean(double data[]) {\r\n\t\tdouble mean = 0;\r\n\t\ttry {\r\n\t\t\tfor(int i=0;i<data.length;i++) {\r\n\t\t\t\tmean =mean+data[i];\r\n\t\t\t}\r\n\t\t\tmean = mean / data.length;\r\n\t\t}\r\n\t\tcatch(Exception e) {\r\n\t\t\tDataMaster.logger.warning(e.toString());\r\n\t\t\t//e.printStackTrace();\r\n\t\t}\r\n\t\treturn mean;\r\n\t}", "public double average(){\r\n\t\t//create variable to hold the values\r\n\t\tdouble average = 0;\r\n\t\t\r\n\t\tfor (int i = 0; i < this.data.length; i++){\r\n\t\t\t//add current index\r\n\t\t\taverage += this.data[i];\r\n\t\t\t}\r\n\t\treturn (average/this.data.length);\r\n\t}", "double avg(){\n\t\tdouble sum = 0.0;\n\t\tfor(int i=0;i<num.length;i++)\n\t\t\tsum+=num[i].doubleValue();\n\t\treturn sum/num.length;\n\t}", "public double getXMean() {\n\t\treturn xStats.mean();\n\t}", "@Override\n\tpublic double avg() {\n\t\treturn total()/4.0;\n\t}", "private void updateMean() {\r\n double tmp = 0.0;\r\n for (Tweet t : members) {\r\n tmp += t.getDateLong();\r\n }\r\n tmp = tmp / (double) members.size();\r\n this.mean = tmp;\r\n }", "double getMeanPrice() {\n List<Double> allPrices = new ArrayList<>();\n\n for (Firm firm : firms) {\n List<Double> pricesOfFirm = firm.getPrices();\n allPrices.addAll(pricesOfFirm.subList(pricesOfFirm.size() - SimulationManager.sizeOfExaminationInterval, pricesOfFirm.size()));\n }\n\n return Calculation.round(Calculation.getMean(allPrices), 2);\n }", "public static double mean(double[] x){\n\n //Declares and intializes mean and total to 0;\n double mean = 0;\n double total = 0;\n\n //Takes the total of all the numbers in every index\n for(int i = 0; i < x.length; i++){\n total += x[i];\n }\n //Divides total by 10\n mean = total / 10;\n\n //returns mean\n return mean;\n\n }", "public double arithmeticalMean(double[] arr) {\n return 0;\n }", "public double average(){\n double avg = 0;\n double sum = 0;\n for (T t : arr) {\n // sum += t.doubleValue();\n }\n\n return sum / arr.length;\n }", "private void calculateMean(float total){\r\n float averageBonds = total/accountInTotal;\r\n float averageAER = (averageBonds-startingBonds)/(startingBonds/100);\r\n\r\n Account averageAccount = new Account(startingBonds,averageBonds,averageAER);\r\n System.out.println(averageAccount.toString());\r\n\r\n }", "double getMeanQuantity() {\n ArrayList<Double> allQuantities = new ArrayList<>();\n\n for (Firm firm : firms) {\n List<Double> quantitiesOfFirm = firm.getQuantities();\n allQuantities.addAll(quantitiesOfFirm.subList(quantitiesOfFirm.size() - SimulationManager.sizeOfExaminationInterval, quantitiesOfFirm.size()));\n }\n\n return Calculation.round(Calculation.getMean(allQuantities), 2);\n }", "public double getMeanSquare() {\n return sumQ / count;\n }", "public double getMean() {\n double timeWeightedSum = 0;\n\n for (int i = 0; i < accumulate.size() - 1; i++) {\n timeWeightedSum += accumulate.get(i).value\n * (accumulate.get(i + 1).timeOfChange\n - accumulate.get(i).timeOfChange);\n\n }\n LOG_HANDLER.logger.finer(\"timeWeightedSum Value: \" + timeWeightedSum\n + \"totalOfQuueueEntries: \" + totalOfQueueEntries);\n return timeWeightedSum / totalOfQueueEntries;\n }", "public void showAverage() {\n System.out.println(\"Average: \" + createStream().average());\n }", "public double average() {\n return average(0.0);\n }", "public double getAverage(){\r\n\t\tdouble sum=0;\r\n\t\tfor(Iterator<T> it=this.iterator();it.hasNext();){\r\n\t\t\tsum+=it.next().doubleValue();\r\n\t\t}\r\n\t\treturn sum/this.size();\r\n\t}", "public static double meanOf(Iterable<? extends Number> values) {\n/* 393 */ return meanOf(values.iterator());\n/* */ }", "public void average() {\n\t\tif (averaged)\n\t\t\tthrow new AssertionError(\"can't average twice!!\");\n\t\t\n\t\tscale = 1.0/(double)t;\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (t+1.0)*w[i] - wupdates[i];\n\t\t\n\t\taveraged = true;\n\t\n\t}", "private double[] mean(Population pop) {\n double[] value = new double[pop.getIndividual(0).getNumGenes()];\n //for all individuals\n Iterator<Individual> it = pop.getIterator();\n while (it.hasNext()) {\n Individual ind = it.next();\n //sum the value of the gene\n for (int i = 0; i < value.length; i++) {\n value[i] += ind.getGeneValue(i);\n }\n }\n //divide by the number of individuals\n double factor = 1.0 / pop.getNumGenotypes();\n for (int i = 0; i < value.length; i++) {\n value[i] *=factor;\n }\n return value;\n }", "private int getMean(int[] times) {\n\n\t\t//Initialise mean and sum to 0\n\t\tint mean = 0;\n\t\tint sum = 0;\n\n\t\t//Loop through all the times\n\t\tfor (int i = 0; i < times.length; i++) {\n\n\t\t\t//Add to the sum\n\t\t\tsum += times[i];\n\t\t}\n\n\t\t//Calculate and return the mean\n\t\tmean = sum/times.length;\n\t\treturn mean;\n\t}", "public static double meanOf(double... values) {\n/* 433 */ Preconditions.checkArgument((values.length > 0));\n/* 434 */ double mean = values[0];\n/* 435 */ for (int index = 1; index < values.length; index++) {\n/* 436 */ double value = values[index];\n/* 437 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 439 */ mean += (value - mean) / (index + 1);\n/* */ } else {\n/* 441 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ } \n/* 444 */ return mean;\n/* */ }", "private Double getMean(Double[] values) {\n double sum = 0;\n int count = 0;\n for (Double d: values) {\n if (d != null) {\n sum += d;\n ++count;\n }\n }\n return count == 0 ? null : (sum / count);\n }", "public void getAvg()\n {\n this.avg = sum/intData.length;\n }", "double average();", "public double getAverage(){\n return getTotal()/array.length;\n }", "public static double meanOf(Iterator<? extends Number> values) {\n/* 407 */ Preconditions.checkArgument(values.hasNext());\n/* 408 */ long count = 1L;\n/* 409 */ double mean = ((Number)values.next()).doubleValue();\n/* 410 */ while (values.hasNext()) {\n/* 411 */ double value = ((Number)values.next()).doubleValue();\n/* 412 */ count++;\n/* 413 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 415 */ mean += (value - mean) / count; continue;\n/* */ } \n/* 417 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ \n/* 420 */ return mean;\n/* */ }", "public synchronized double getAverage() {\n return average;\n }", "public Quantity<Q> getAverage(Unit<Q> unit) {\n return average.to(unit);\n }", "public static double meanOf(int... values) {\n/* 457 */ Preconditions.checkArgument((values.length > 0));\n/* 458 */ double mean = values[0];\n/* 459 */ for (int index = 1; index < values.length; index++) {\n/* 460 */ double value = values[index];\n/* 461 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 463 */ mean += (value - mean) / (index + 1);\n/* */ } else {\n/* 465 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ } \n/* 468 */ return mean;\n/* */ }", "@Override\n\tpublic int avg() {\n\t\treturn (this.sum()/3);\n\t}", "public double populationMean()\n\t{\n\t\treturn null == _distPopulation ? java.lang.Double.NaN : _distPopulation.mean();\n\t}", "public static Double mean(ArrayList<Double> values) {\n\t\tDouble total = 0.0;\n\t\t// iterate through the values and add to the total\n\t\tfor (int i = 0; i < values.size(); i++) {\n\t\t\ttotal += values.get(i);\n\t\t}\n\t\t// return the total devided by the number of values\n\t\treturn total / values.size();\n\t}", "private List<Double> sumMeanX(List<Business> business, double avg) {\n\t\tList<Double> sumMean = new ArrayList<Double>();\n\n\t\tfor (Business biz : business) {\n\t\t\tint price = biz.getPrice();\n\t\t\tsumMean.add(price - avg);\n\t\t}\n\t\treturn sumMean;\n\t}", "public float getMean() {\r\n int sum = getSum(rbt.root);\r\n float mean = sum / rbt.size();\r\n return mean;\r\n }", "public double getAvg(){\n double avg=0;\n for(int x=0; x<max; x++){\n avg=avg+times[x];\n }\n avg=avg/max;\n return avg;\n }", "public double varianceOfMean() {\n\t\treturn variance() * getWeight();\n\t}", "public double getAverage() {\n return this.average;\n }", "public double average() {\n double average = 0;\n for (int i = 0; i < studentList.size(); i++) {\n Student student = studentList.get(i);\n average += student.average();\n }\n average /= studentList.size();\n return average;\n }", "public void addSample( final double value ) {\n\t\tfinal double weight = getWeight( ++_population );\n\t\t_mean = weight * value + ( 1 - weight ) * _mean;\n\t\t_meanSquare = weight * value * value + ( 1 - weight ) * _meanSquare;\n\t}", "public double getAverage()\n {\n return getSum() / 2.0;\n }", "private float calculateMean()\n { \n int numberEmployees = employees.size();\n float total = 0, meanGrossPay = 0;\n // Create an array of all gross pays\n float[] allGrossPay = new float[numberEmployees];\n \n // Call method to return an array of float containing all gross pays\n allGrossPay = calculateAllGrossPay();\n // Find total gross pay\n for (int i = 0; i < numberEmployees; i++)\n {\n total += allGrossPay[i];\n }\n // Find mean and return it\n if (numberEmployees > 0)\n {\n meanGrossPay = total/numberEmployees;\n \n }\n return meanGrossPay;\n }", "public MeanVar(double value) {\n\t\taddValue(value);\n\t}", "public MeanVar(double[] data) {\n\t\tfor (int i = 0; i < data.length; i++)\n\t\t\taddValue(data[i]);\n\t}", "public DMatrixRMaj getMean() {\n\t\treturn x;\n\t}", "public double mean() {\n\t\tdouble totalPercolationThershold = 0d;\n\t\tfor(double openedSite : openedSites){\n\t\t\ttotalPercolationThershold+= (double)(openedSite);\n\t\t}\n\t\treturn (totalPercolationThershold/trails);\n\t}", "public static float mean(float[] v) {\n\t\tfloat sum = 0;\n\t\tint count = 0;\n\t\tfor (float value : v) {\n\t\t\tif (Util.isUsed(value)) {\n\t\t\t\tsum += value;\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t\t\n\t\treturn sum / (float)count;\n\t}", "public double geoMean() {\n\t\tint product = 1;\n\t\tfor (Animal a : animals) {\n\t\t\tproduct *= a.getSize();\n\t\t}\n\t\treturn Math.pow(product, 1.0 / animals.size());\n\t}", "public static float getMean(float[] weatherArray){\n float mean = getTotal(weatherArray)/weatherArray.length;\n return mean;\n }", "void changeMean(double a) {\n mean = mean + (buffer - mean) * a;\n }", "public double mean() {\n double resultat = 0;\n for (int i = 0; i < tab.size(); i++) {\n for (int j = 0; j < tab.get(i).size(); j++) {\n resultat += Double.parseDouble(tab.get(i).get(j));\n }\n }\n resultat = (resultat / (tab.size() + tab.get(0).size() - 1));\n System.out.println(\"Mean colonne:\" + resultat);\n return resultat;\n }", "public float getAverage(){\r\n\t\treturn Average;\r\n\t}", "private double getAvg() {\n\n double sum = 0;\n\n for (Map.Entry<Integer, Double> entry : values.entrySet()) {\n sum += entry.getValue();\n }\n\n if (values.size() > 0) {\n return sum / values.size();\n } else {\n throw new IllegalStateException(\"no values\");\n }\n }", "public static double findMean(ArrayList<Integer> arr) {\n\t\tint length = arr.size();\n\t\tint sum = 0;\n\t\tfor(int i : arr) { sum += i; }\n\t\treturn (double)sum/length;\n\t}", "public void setMeanAnamoly(double value) {\n this.meanAnamoly = value;\n }", "public void average(){\n\t\tfor(PlayerWealthDataAccumulator w : _wealthData.values()){\n\t\t\tw.average();\n\t\t}\n\t}", "public void setMovingAverageSamples(int count)\n {\n NumAvgSamples = count;\n }" ]
[ "0.7463143", "0.72188044", "0.71837693", "0.71837693", "0.71716744", "0.71409225", "0.70390004", "0.7015413", "0.6967397", "0.6951795", "0.6949215", "0.6930485", "0.69242525", "0.68493843", "0.68419594", "0.68400085", "0.6834142", "0.68331766", "0.679127", "0.6757434", "0.67530155", "0.67400056", "0.6669648", "0.66572464", "0.6653602", "0.66361254", "0.66304564", "0.6626191", "0.66060925", "0.6597413", "0.6568741", "0.65686315", "0.65540725", "0.64964205", "0.64688194", "0.6463906", "0.6453068", "0.64189774", "0.64189774", "0.64171815", "0.6382354", "0.63700795", "0.6336814", "0.62668866", "0.6211435", "0.61814123", "0.6151642", "0.6109931", "0.6104459", "0.6096224", "0.60893077", "0.60583127", "0.6057924", "0.6053206", "0.60461026", "0.604591", "0.6032597", "0.6025505", "0.5993745", "0.5983533", "0.5967148", "0.5954967", "0.5954377", "0.5948855", "0.59430116", "0.5942622", "0.5929552", "0.59192246", "0.5891112", "0.5886223", "0.5878422", "0.58495194", "0.58431005", "0.5822931", "0.58222455", "0.5820088", "0.58198386", "0.58012915", "0.57933825", "0.57927555", "0.57890344", "0.5780722", "0.5769899", "0.57658446", "0.57591075", "0.57579565", "0.57497776", "0.57373047", "0.57325923", "0.57151806", "0.5701433", "0.569087", "0.5685777", "0.56824034", "0.5677997", "0.56771296", "0.5664083", "0.56491977", "0.56440854", "0.56368285" ]
0.69534713
9
Variance of the series w.r.t. a known mean.
public double variance(double m) { double var = 0.0; for(int t = 0; t<size; t++) { double dev = x[t] - m; var += dev*dev; } return var/size; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static double varianceVal(double[] arrayOfSamples, double mean){\n\t double v = 0;\n\t for(double i :arrayOfSamples)\n\t v += Math.pow((mean-i), 2);\n\t return v / arrayOfSamples.length;\n\t}", "public double varianceOfMean() {\n\t\treturn variance() * getWeight();\n\t}", "public double variance()\n {\n return variance(mean());\n }", "public double sampleVarianceOfMean() {\n\t\treturn sampleVariance() * getWeight();\n\t}", "public double getVariance()\r\n\t{\r\n\t\tlong tmp = lastSampleTime - firstSampleTime;\r\n\t\treturn ( tmp > 0 ? (sumPowerTwo/tmp - getMean()*getMean()) : 0);\r\n\t}", "public double variance() {\n final double average = average();\n final int size = size();\n\n int cnt = 0;\n double rval = 0;\n\n // Compute the variance\n for (int i = 0; i < size; i++) {\n final Number number = get(i);\n if (number == null) continue;\n if (Double.isNaN(number.doubleValue())) continue;\n\n rval += (average - number.doubleValue()) * (average - number.doubleValue());\n cnt++;\n }\n\n // If we haven't had any element, return 0\n if (cnt == 0) return 0;\n\n return rval / cnt;\n }", "public Double getVariance() {\n return variance;\n }", "public double sampleVariance() {\n/* 262 */ Preconditions.checkState((this.count > 1L));\n/* 263 */ if (Double.isNaN(this.sumOfSquaresOfDeltas)) {\n/* 264 */ return Double.NaN;\n/* */ }\n/* 266 */ return DoubleUtils.ensureNonNegative(this.sumOfSquaresOfDeltas) / (this.count - 1L);\n/* */ }", "public double getVariance(){\n\t\treturn (double)sampleSize * type1Size * (populationSize - type1Size) *\n\t\t\t(populationSize - sampleSize) / ( populationSize * populationSize * (populationSize - 1));\n\t}", "public static Double computeVariance(final Double[] values,\n\t\t\tfinal Double mean) {\n\t\treturn computeVariance(values, 0, values.length, mean);\n\t}", "public double getVariance(){\n\t\tdouble a = location + scale * scale;\n\t\treturn Math.exp(2 * a) - Math.exp(location + a);\n\t}", "private double[] varianceArray(){\n\t\tdouble[] varianceVals = new double[values.length];\n\t\tfor(int i = 0; i < values.length; i++){\n\t\t\tvarianceVals[i] = Math.pow(values[i] - mean , 2.0);\n\t\t}\n\t\treturn varianceVals;\n\t}", "public double empiricalVariance()\n\t{\n\t\treturn _dblEmpiricalVariance;\n\t}", "private void updateVariance() {\r\n double variance = 0.0;\r\n updateMean();\r\n for (Tweet t : members) {\r\n variance += ((t.getDateLong() - this.mean) * (t.getDateLong() - this.mean));\r\n }\r\n variance /= members.size();\r\n this.variance = variance;\r\n }", "public double populationVariance() {\n/* 215 */ Preconditions.checkState((this.count > 0L));\n/* 216 */ if (Double.isNaN(this.sumOfSquaresOfDeltas)) {\n/* 217 */ return Double.NaN;\n/* */ }\n/* 219 */ if (this.count == 1L) {\n/* 220 */ return 0.0D;\n/* */ }\n/* 222 */ return DoubleUtils.ensureNonNegative(this.sumOfSquaresOfDeltas) / count();\n/* */ }", "public static Double computeVariance(final Double[] values, int offset,\n\t\t\tfinal int number, final Double mean) {\n\t\tif (number < 2) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"The number of values to process must be two or larger.\");\n\t\t}\n\t\tDouble sum = 0.0;\n\t\tfinal int UNTIL = offset + number;\n\t\tdo {\n\t\t\tDouble diff = values[offset++] - mean;\n\t\t\tsum += diff * diff;\n\t\t} while (offset != UNTIL);\n\t\treturn sum / (number - 1);\n\t}", "private int getVariance (int[] times) {\n\n\t\t//Get the mean time of all the vehicles\n\t\tint mean = getMean(times);\n\t\t//Variable to store the sum of squares\n\t\tint sumOfSquares = 0;\n\n\t\t//Loop through all times in the array\n\t\tfor (int i = 0; i < times.length; i++) {\n\n\t\t\t//Calculate the sum of squares\n\t\t\tsumOfSquares += Math.pow((times[i] - mean), 2);\n\t\t}\n\n\t\t//Calculate and return the variance \n\t\tint variance = sumOfSquares/times.length;\n\t\treturn variance;\n\t}", "public double var() {\n\t\tint n = this.getAttCount();\n\t\tif (n < 2) return Constants.UNUSED;\n\n\t\tdouble mean = mean();\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdouble v = this.getValueAsReal(i);\n\t\t\tdouble deviation = v - mean;\n\t\t\tsum += deviation * deviation;\n\t\t}\n\t\treturn sum / (double)(n - 1);\n\t}", "public static Double computeVariance(final Double[] values) {\n\t\treturn computeVariance(values, 0, values.length);\n\t}", "protected void setVariance(double value) {\n\t variance = value;\n\t}", "protected void setVariance(double value) {\n\t variance = value;\n\t}", "private double computeVariance(Queue<Integer> q, int maxLength){ \n if(q.size() < maxLength-1) return Double.NaN; //we dont have a full queue yet, so dont output a valid variance\n Queue<Integer> q_tmp=new LinkedList(q);\n int sum = 0;\n int n=q.size();\n while(q_tmp.size()>0){\n sum = sum + q_tmp.remove();\n }\n double mean= sum/n;\n double vsum = 0;\n q_tmp=new LinkedList(q); // NB you have to do this to copy the queue and not just make a reference to it\n while(q_tmp.size()>0){\n int k = q_tmp.remove();\n vsum = vsum + Math.pow(k-mean,2);\n }\n return vsum/(n-1);\n }", "public double stdDev() {\n\t\tif (count() > 0) {\n\t\t\treturn sqrt(variance());\n\t\t}\n\t\treturn 0.0;\n\t}", "public double populationVariance()\n\t{\n\t\treturn null == _distPopulation ? java.lang.Double.NaN : _distPopulation.variance();\n\t}", "public double sampleStandardDeviation() {\n/* 288 */ return Math.sqrt(sampleVariance());\n/* */ }", "public double std(double data[], double mean) {\r\n\t\tdouble std = 0;\r\n\t\ttry {\r\n\t\t\tfor(int i=0;i<data.length;i++) {\r\n\t\t\t\tstd =std+((data[i]-mean)*(data[i]-mean));\r\n\t\t\t}\r\n\t\t\tstd = Math.sqrt(std / (data.length-1));\r\n\t\t}\r\n\t\tcatch(Exception e) {\r\n\t\t\tDataMaster.logger.warning(e.toString());\r\n\t\t\t//e.printStackTrace();\r\n\t\t}\r\n\t\treturn std;\r\n\t}", "public static double calculateVariance(double[][] targetVariables) {\r\n double[][] mean = FindPrototype.findOptimalPrototype(targetVariables);\r\n\r\n int N = targetVariables.length;\r\n\r\n double numerator = 0;\r\n\r\n for (int i = 0; i < N; i++) {\r\n numerator += EuclideanDistance.calculateEuclideanDistance(Gets.getRowFromMatix(i, targetVariables), mean);\r\n }\r\n \r\n if (N - 1 == 0) {\r\n return 0;\r\n } else {\r\n return numerator / (N - 1);\r\n }\r\n }", "public double getDefaultVariance()\n {\n return this.defaultVariance;\n }", "public double standarddeviation() {\n return Math.sqrt(variance());\n }", "private void updateMuVariance() {\n\t\tmu = train.getLocalMean(); \n\t\tsigma = train.getLocalVariance(); \n\t\t\n\t\t/*\n\t\t * If the ratio of data variance between dimensions is too small, it \n\t\t * will cause numerical errors. To address this, we artificially boost\n\t\t * the variance by epsilon, a small fraction of the standard deviation\n\t\t * of the largest dimension. \n\t\t * */\n\t\tupdateEpsilon(); \n\t\tsigma = MathUtils.add(sigma, epsilon); \n\t\t\n\t}", "public double mean() {\n return StdStats.mean(stats);\r\n }", "private void updateVarianceOfPrediction(int sensor_id){\n\t\t\n\t\tdouble N = current_sensor_readings[sensor_id] - predicted_sensor_readings[sensor_id][0];\n\t\tif(round_number==0){\n\t\t\t\n\t\t\tsigma[sensor_id] = N * N;\n\t\t\t\n\t\t}else if(round_number<=K){\n\t\t\t\n\t\t\tsigma[sensor_id] = (((round_number-1)*sigma[sensor_id]) + (N * N))/(round_number);\n\t\t\t\n\t\t}else{\n\t\t\t\n\t\t\tsigma[sensor_id] = (1-gamma)*sigma[sensor_id] + gamma * N * N;\n\t\t}\n\t}", "private void updateVariance(long value) {\n\t\tif (!varianceM.compareAndSet(-1, doubleToLongBits(value))) {\n\t\t\tboolean done = false;\n\t\t\twhile (!done) {\n\t\t\t\tfinal long oldMCas = varianceM.get();\n\t\t\t\tfinal double oldM = longBitsToDouble(oldMCas);\n\t\t\t\tfinal double newM = oldM + ((value - oldM) / count());\n\n\t\t\t\tfinal long oldSCas = varianceS.get();\n\t\t\t\tfinal double oldS = longBitsToDouble(oldSCas);\n\t\t\t\tfinal double newS = oldS + ((value - oldM) * (value - newM));\n\n\t\t\t\tdone = varianceM.compareAndSet(oldMCas, doubleToLongBits(newM)) &&\n\t\t\t\t\t\tvarianceS.compareAndSet(oldSCas, doubleToLongBits(newS));\n\t\t\t}\n\t\t}\n\t}", "protected MeanVar(int n, double mean, double s) {\n\t\tthis.n = n;\n\t\tthis.mean = mean;\n\t\tthis.s = s;\n\t}", "public double stddev() {\n\t\tdouble sum = 0;\n\t\tdouble mean = mean();\n\t\tfor(int i = 0; i<myData.length;i++)\n\t\t\tsum+=(myData[i]-mean)*(myData[i]-mean);\n\t\treturn (double) Math.sqrt(sum/(myData.length-1));\n\t}", "public double mean() {\r\n\t\treturn mean;\r\n\t}", "public double varianceBackcast()\n {\n double unconditionalVariance = variance(0.0);\n // why do they compute the unconditional variance if they don't\n // use it afterwards?\n \n double lambda = .7;\n double sigsum = 0.0;\n for(int t = 0; t<size; t++)\n sigsum += Math.pow(lambda, size - t - 1.0)*getSqrQuote(size - t);\n \n // This doesn't make sense to me...\n // looks like a convex hull of sigsum and something else,\n // except lambda is raised to the n-th power...\n return Math.pow(lambda, size) + (1.0 - lambda)*sigsum;\n }", "public double mean() {\n\t\treturn mean;\n\t}", "public double mean() {\n\t\treturn mean;\n\t}", "public MeanVar(double value) {\n\t\taddValue(value);\n\t}", "public static float getVariance(ArrayList<StatisticClass> classes, float[] classMiddles, float arithmeticMiddle,\n\t\t\tint sampleSize)\n\t{\n\t\tfloat result;\n\t\tfloat sigmaResult = 0;\n\n\t\tfor (int i = 0; i < classes.size(); i++)\n\t\t{\n\n\t\t\tfloat absOccurence = classes.get(i).getAbsoluteOccurences();\n\t\t\tfloat classMiddle = classMiddles[i];\n\n\t\t\tsigmaResult += absOccurence * Math.pow((classMiddle - arithmeticMiddle), 2);\n\n\t\t}\n\n\t\tresult = sigmaResult / (sampleSize - 1);\n\t\treturn result;\n\t}", "public double mean() { \n return StdStats.mean(result);\n\n }", "private static double meanVal(double[] arrayOfSamples){\n\t\tdouble total = 0;\n\t\t for (double i :arrayOfSamples){\n\t\t \ttotal += i;\n\t\t }\n\t return total/arrayOfSamples.length;\n\t}", "public Duration getStartVariance()\r\n {\r\n return (m_startVariance);\r\n }", "public double mean() {\n return mean;\n }", "public T mean();", "public double populationStandardDeviation() {\n/* 242 */ return Math.sqrt(populationVariance());\n/* */ }", "public double varianceExponent()\n\t{\n\t\treturn _dblVarianceExponent;\n\t}", "public double mean() {\n return StdStats.mean(fraction);\n }", "public static double meanVal(int[] sample){\n double total = 0;\n for (int i = 0; i < sample.length; i++){\n total = total + sample[i];\n }\n double mean = total/sample.length;\n return mean;\n }", "double average();", "double getVariation();", "public final double getMean()\r\n\t{\r\n\t\treturn mean;\r\n\t}", "public MeanVar(double[] data) {\n\t\tfor (int i = 0; i < data.length; i++)\n\t\t\taddValue(data[i]);\n\t}", "public double mean(){\n return StdStats.mean(percentage);\n }", "public void setMean(double mean) {\n this.mean = mean;\n }", "public double sd() {\n\t\treturn Math.sqrt(var());\n\t}", "public double stddev() {\n double sum = sampleMean;\n sum = 0;\n for (int i = 0; i < sites.length; i++) {\n// sum += (Double.parseDouble(sites[i] + \"\") / size - sampleMean) \n// * (Double.parseDouble(sites[i] + \"\") / size - sampleMean);\n sum += (sites[i]/size - sampleMean) \n * (sites[i]/size - sampleMean);\n }\n sampleStanDevi = Math.sqrt(sum / (times - 1));\n return sampleStanDevi;\n }", "@Override\n\tpublic int avg() {\n\t\treturn (this.sum()/3);\n\t}", "public void StandardDeviation(){\r\n\t\tAverage();\r\n\t\tif (count<=1){\r\n\t\t\tSystem.out.println(\"The Standard Deviation is \"+0.0);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tStandardDeviation=(float)Math.sqrt((Total2-Total*Total/count)/(count-1));\r\n\t\t}\r\n\t}", "public Double getMean() {\n return mean;\n }", "double avg(){\n\t\tdouble sum = 0.0;\n\t\tfor(int i=0;i<num.length;i++)\n\t\t\tsum+=num[i].doubleValue();\n\t\treturn sum/num.length;\n\t}", "public double mean() {\n double total = 0;\n for (int i = 0; i < sites.length; i++) {\n total += sites[i];\n }\n sampleMean = total / size / times;\n return sampleMean;\n }", "public double mean() {\n\t\treturn StdStats.mean(results); \n\t}", "public double stddev(){\n return StdStats.stddev(percentage);\n }", "public double getMean() {\n return mean;\n }", "protected double sigma(Vector3 v) {\n double c1, c2;\n switch (dominantAxis) {\n case X:\n c1 = v.y;\n c2 = v.z;\n break;\n case Y:\n c1 = v.x;\n c2 = v.z;\n break;\n case Z:\n c1 = v.x;\n c2 = v.y;\n break;\n default:\n return -1;\n }\n\n return Math.sqrt(c1 * c1 + c2 * c2);\n }", "public double getAverage(){\n return getTotal()/array.length;\n }", "public static void avevar(final double[] data, final $double ave, final $double var) {\n double s, ep;\r\n int j, n = data.length;\r\n ave.$(0.0);\r\n for (j = 0; j < n; j++)\r\n ave.$(ave.$() + data[j]);\r\n ave.$(ave.$() / n);\r\n var.$(ep = 0.0);\r\n for (j = 0; j < n; j++) {\r\n s = data[j] - ave.$();\r\n ep += s;\r\n var.$(var.$() + (s * s));\r\n }\r\n var.$((var.$() - ep * ep / n) / (n - 1)); // Corrected two-pass\r\n // formula (14.1.8).\r\n }", "public double average(){\n double avg = 0;\n double sum = 0;\n for (T t : arr) {\n // sum += t.doubleValue();\n }\n\n return sum / arr.length;\n }", "public double mean() {\n return StdStats.mean(perThreshold);\n }", "public double averageVolume() {\n if (numberOfIcosahedrons() == 0) {\n return 0;\n }\n else {\n return totalVolume() / numberOfIcosahedrons();\n }\n }", "public double average(){\r\n\t\t//create variable to hold the values\r\n\t\tdouble average = 0;\r\n\t\t\r\n\t\tfor (int i = 0; i < this.data.length; i++){\r\n\t\t\t//add current index\r\n\t\t\taverage += this.data[i];\r\n\t\t\t}\r\n\t\treturn (average/this.data.length);\r\n\t}", "public double mean()\n {\n double sum = 0.0;\n for(int t = 0; t<size; t++)\n sum += x[t];\n return sum/size;\n }", "@Override\n\tpublic double mean() {\n\t\treturn 0;\n\t}", "public double getMean(){\n\t\treturn (double)sampleSize * type1Size / populationSize;\n\t}", "public double mean() {\n return StdStats.mean(results);\n }", "public GetVarianceArray() {\n\t\tsuper(\"GET_VARIANCE_ARRAY\", Wetrn.WETRN, AppGlobalUnitAdjustment.APP_GLOBAL_UNIT_ADJUSTMENT, org.jooq.impl.DefaultDataType.getDefaultDataType(\"TABLE\"));\n\n\t\tsetReturnParameter(RETURN_VALUE);\n\t\taddInParameter(P_VEHICLE_IDS);\n\t\taddInParameter(P_VARIANCE);\n\t}", "public double mean() {\n return StdStats.mean(trialResult);\n }", "public float getAverage(){\r\n\t\treturn Average;\r\n\t}", "public double getNoiseMean() {\n\t\t\treturn NOISE_MEAN;\n\t\t}", "public double stddev() { \n return StdStats.stddev(result);\n }", "public static double getVarience(double[] dataArray) {\n\t\t\n\t\tdouble varience = 0.0;\n\t\tdouble average = getAverage(dataArray);\n\t\t\n\t\tfor (int i = 0; i <dataArray.length; i++) {\n\t\t\tvarience += Math.pow((dataArray[i]- average),2);\n\t\t}\n\t\t\n\t\tvarience = varience/dataArray.length;\n\t\treturn varience;\n\t}", "public void getAvg()\n {\n this.avg = sum/intData.length;\n }", "public static double standardDeviation(double[] x, double mean){\n \n //Goes through all the numbers of the array, doubles them, and assigns them into the index\n for ( int i =0; i < x.length; i++){\n double addedNumbers = Math.pow(x[i] - mean, 2);\n\n x[i] = addedNumbers;\n }\n\n //Declares y variable and initializes it to 0\n double total = 0;\n\n //goes through all the numbers and adds them to a total\n for(int j =0; j < x.length; j++){\n total += x[j];\n }\n\n //Divides the total then gets the squareRoot\n double squareRoot = total / 9 ;\n double SD = Math.sqrt(squareRoot);\n \n //Returns the standard deviation\n return SD;\n\n }", "public void setPVariance(String value) {\n\t\tsetValue(P_VARIANCE, value);\n\t}", "public double stddev() {\n\t\tif (experiments == 1)\n\t\t\treturn Double.NaN;\n\t\treturn stddev;\n\t}", "public void setMeanAnamoly(double value) {\n this.meanAnamoly = value;\n }", "public void calc_mean_covariance (double[][] range, double[] mean, double[][] covariance) {\n\n\t\t// Calculate means and variances\n\n\t\tfor (int n = 0; n < n_vars; ++n) {\n\n\t\t\tdouble mean_acc = 0.0;\n\t\t\tfor (int i = 0; i < n_values[n]; ++i) {\n\t\t\t\tmean_acc += (range[n][i] * marginal_probability[n][i]);\n\t\t\t}\n\t\t\tmean_acc = mean_acc / total_probability;\n\t\t\tmean[n] = mean_acc;\n\n\t\t\tdouble var_acc = 0.0;\n\t\t\tfor (int i = 0; i < n_values[n]; ++i) {\n\t\t\t\tdouble dev = range[n][i] - mean_acc;\n\t\t\t\tvar_acc += (dev * dev * marginal_probability[n][i]);\n\t\t\t}\n\t\t\tcovariance[n][n] = var_acc / total_probability;\n\t\t}\n\n\t\t// Calculate covariances\n\n\t\tfor (int n1 = 0; n1 < n_vars; ++n1) {\n\t\t\tfor (int n2 = 0; n2 < n_vars; ++n2) {\n\t\t\t\tif (n1 < n2) {\n\t\t\t\t\tdouble cov_acc = 0.0;\n\t\t\t\t\tfor (int i1 = 0; i1 < n_values[n1]; ++i1) {\n\t\t\t\t\t\tdouble dev1 = range[n1][i1] - mean[n1];\n\t\t\t\t\t\tfor (int i2 = 0; i2 < n_values[n2]; ++i2) {\n\t\t\t\t\t\t\tdouble dev2 = range[n2][i2] - mean[n2];\n\t\t\t\t\t\t\tcov_acc += (dev1 * dev2 * marginal_2d_probability[n1][n2][i1][i2]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcov_acc = cov_acc / total_probability;\n\t\t\t\t\tcovariance[n1][n2] = cov_acc;\n\t\t\t\t\tcovariance[n2][n1] = cov_acc;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn;\n\t}", "public double average() {\n return average(0.0);\n }", "public double stddev() {\n return StdStats.stddev(stats);\r\n }", "public double mean() {\n return mu;\n }", "public double mean() {\n\t\tif (count() > 0) {\n\t\t\treturn _sum.get() / (double) count();\n\t\t}\n\t\treturn 0.0;\n\t}", "public double stddev() {\n return sig;\n }", "public abstract double var (\n\t\tfinal int confidenceCount)\n\t\tthrows java.lang.Exception;", "public double getAverage()\n {\n return getSum() / 2.0;\n }", "public float getSDev() {\r\n int sumStdError = 0; // SIGMA(x_i - x_bar)\r\n int size = rbt.size() - 1;\r\n float mean = getMean();\r\n List<Integer> rbtArray = createArray(rbt.root);\r\n\r\n // calculate sumStdError\r\n for (int i = 0; i < rbtArray.size(); i++) {\r\n float gradeData = rbtArray.get(i);\r\n float error = gradeData - mean;\r\n sumStdError += error;\r\n }\r\n\r\n return (float) Math.sqrt((sumStdError ^ 2) / size);\r\n }", "private List<Double> sumMeanX(List<Business> business, double avg) {\n\t\tList<Double> sumMean = new ArrayList<Double>();\n\n\t\tfor (Business biz : business) {\n\t\t\tint price = biz.getPrice();\n\t\t\tsumMean.add(price - avg);\n\t\t}\n\t\treturn sumMean;\n\t}", "@Override\n\tpublic double avg() {\n\t\treturn total()/4.0;\n\t}", "public double stddev() {\n return StdStats.stddev(fraction);\n }" ]
[ "0.78710103", "0.78310233", "0.7800162", "0.7689536", "0.76676583", "0.762574", "0.75679225", "0.7541008", "0.7243375", "0.71831983", "0.71747977", "0.70331806", "0.6996695", "0.69443744", "0.68520516", "0.6732104", "0.6675919", "0.66715294", "0.6624185", "0.65689576", "0.65689576", "0.63608414", "0.6312834", "0.62604284", "0.6224228", "0.614706", "0.61209494", "0.6085785", "0.60564315", "0.604985", "0.6030622", "0.6029388", "0.5994629", "0.5925603", "0.58945936", "0.5891544", "0.5858621", "0.5819452", "0.5819452", "0.5810553", "0.5795522", "0.5790702", "0.577507", "0.5756329", "0.5747588", "0.5741828", "0.57397556", "0.57307714", "0.5716401", "0.5708883", "0.569601", "0.56824225", "0.5681078", "0.564999", "0.5633683", "0.5631994", "0.56062967", "0.55939007", "0.5593831", "0.5589071", "0.5584034", "0.55801433", "0.55603784", "0.5560355", "0.5556307", "0.55361426", "0.5522281", "0.55142266", "0.5511704", "0.55097973", "0.5508995", "0.5508484", "0.54926884", "0.54750454", "0.5466348", "0.5464609", "0.5453177", "0.54454046", "0.5433469", "0.5423384", "0.54160243", "0.54153246", "0.54076236", "0.5404176", "0.54016733", "0.53956443", "0.53892654", "0.5369947", "0.53470457", "0.5336521", "0.53166306", "0.5308965", "0.5306813", "0.5306681", "0.5301774", "0.5284629", "0.5278562", "0.52764153", "0.52620924", "0.52470165" ]
0.68469554
15
Variance of the series.
public double variance() { return variance(mean()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Double getVariance() {\n return variance;\n }", "public double variance() {\n final double average = average();\n final int size = size();\n\n int cnt = 0;\n double rval = 0;\n\n // Compute the variance\n for (int i = 0; i < size; i++) {\n final Number number = get(i);\n if (number == null) continue;\n if (Double.isNaN(number.doubleValue())) continue;\n\n rval += (average - number.doubleValue()) * (average - number.doubleValue());\n cnt++;\n }\n\n // If we haven't had any element, return 0\n if (cnt == 0) return 0;\n\n return rval / cnt;\n }", "public double getVariance()\r\n\t{\r\n\t\tlong tmp = lastSampleTime - firstSampleTime;\r\n\t\treturn ( tmp > 0 ? (sumPowerTwo/tmp - getMean()*getMean()) : 0);\r\n\t}", "public double getVariance(){\n\t\treturn (double)sampleSize * type1Size * (populationSize - type1Size) *\n\t\t\t(populationSize - sampleSize) / ( populationSize * populationSize * (populationSize - 1));\n\t}", "public double sampleVariance() {\n/* 262 */ Preconditions.checkState((this.count > 1L));\n/* 263 */ if (Double.isNaN(this.sumOfSquaresOfDeltas)) {\n/* 264 */ return Double.NaN;\n/* */ }\n/* 266 */ return DoubleUtils.ensureNonNegative(this.sumOfSquaresOfDeltas) / (this.count - 1L);\n/* */ }", "public double getVariance(){\n\t\tdouble a = location + scale * scale;\n\t\treturn Math.exp(2 * a) - Math.exp(location + a);\n\t}", "public double populationVariance() {\n/* 215 */ Preconditions.checkState((this.count > 0L));\n/* 216 */ if (Double.isNaN(this.sumOfSquaresOfDeltas)) {\n/* 217 */ return Double.NaN;\n/* */ }\n/* 219 */ if (this.count == 1L) {\n/* 220 */ return 0.0D;\n/* */ }\n/* 222 */ return DoubleUtils.ensureNonNegative(this.sumOfSquaresOfDeltas) / count();\n/* */ }", "public double empiricalVariance()\n\t{\n\t\treturn _dblEmpiricalVariance;\n\t}", "private double[] varianceArray(){\n\t\tdouble[] varianceVals = new double[values.length];\n\t\tfor(int i = 0; i < values.length; i++){\n\t\t\tvarianceVals[i] = Math.pow(values[i] - mean , 2.0);\n\t\t}\n\t\treturn varianceVals;\n\t}", "public double varianceOfMean() {\n\t\treturn variance() * getWeight();\n\t}", "private static double varianceVal(double[] arrayOfSamples, double mean){\n\t double v = 0;\n\t for(double i :arrayOfSamples)\n\t v += Math.pow((mean-i), 2);\n\t return v / arrayOfSamples.length;\n\t}", "public double variance(double m)\n {\n double var = 0.0;\n \n for(int t = 0; t<size; t++)\n {\n double dev = x[t] - m;\n var += dev*dev;\n }\n return var/size;\n }", "private int getVariance (int[] times) {\n\n\t\t//Get the mean time of all the vehicles\n\t\tint mean = getMean(times);\n\t\t//Variable to store the sum of squares\n\t\tint sumOfSquares = 0;\n\n\t\t//Loop through all times in the array\n\t\tfor (int i = 0; i < times.length; i++) {\n\n\t\t\t//Calculate the sum of squares\n\t\t\tsumOfSquares += Math.pow((times[i] - mean), 2);\n\t\t}\n\n\t\t//Calculate and return the variance \n\t\tint variance = sumOfSquares/times.length;\n\t\treturn variance;\n\t}", "public static Double computeVariance(final Double[] values) {\n\t\treturn computeVariance(values, 0, values.length);\n\t}", "public double populationVariance()\n\t{\n\t\treturn null == _distPopulation ? java.lang.Double.NaN : _distPopulation.variance();\n\t}", "private void updateVariance() {\r\n double variance = 0.0;\r\n updateMean();\r\n for (Tweet t : members) {\r\n variance += ((t.getDateLong() - this.mean) * (t.getDateLong() - this.mean));\r\n }\r\n variance /= members.size();\r\n this.variance = variance;\r\n }", "public double var() {\n\t\tint n = this.getAttCount();\n\t\tif (n < 2) return Constants.UNUSED;\n\n\t\tdouble mean = mean();\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdouble v = this.getValueAsReal(i);\n\t\t\tdouble deviation = v - mean;\n\t\t\tsum += deviation * deviation;\n\t\t}\n\t\treturn sum / (double)(n - 1);\n\t}", "protected void setVariance(double value) {\n\t variance = value;\n\t}", "protected void setVariance(double value) {\n\t variance = value;\n\t}", "public double sampleVarianceOfMean() {\n\t\treturn sampleVariance() * getWeight();\n\t}", "public double varianceBackcast()\n {\n double unconditionalVariance = variance(0.0);\n // why do they compute the unconditional variance if they don't\n // use it afterwards?\n \n double lambda = .7;\n double sigsum = 0.0;\n for(int t = 0; t<size; t++)\n sigsum += Math.pow(lambda, size - t - 1.0)*getSqrQuote(size - t);\n \n // This doesn't make sense to me...\n // looks like a convex hull of sigsum and something else,\n // except lambda is raised to the n-th power...\n return Math.pow(lambda, size) + (1.0 - lambda)*sigsum;\n }", "double getVariation();", "public static Double computeVariance(final Double[] values,\n\t\t\tfinal Double mean) {\n\t\treturn computeVariance(values, 0, values.length, mean);\n\t}", "private double computeVariance(Queue<Integer> q, int maxLength){ \n if(q.size() < maxLength-1) return Double.NaN; //we dont have a full queue yet, so dont output a valid variance\n Queue<Integer> q_tmp=new LinkedList(q);\n int sum = 0;\n int n=q.size();\n while(q_tmp.size()>0){\n sum = sum + q_tmp.remove();\n }\n double mean= sum/n;\n double vsum = 0;\n q_tmp=new LinkedList(q); // NB you have to do this to copy the queue and not just make a reference to it\n while(q_tmp.size()>0){\n int k = q_tmp.remove();\n vsum = vsum + Math.pow(k-mean,2);\n }\n return vsum/(n-1);\n }", "public double stdDev() {\n\t\tif (count() > 0) {\n\t\t\treturn sqrt(variance());\n\t\t}\n\t\treturn 0.0;\n\t}", "public double getDefaultVariance()\n {\n return this.defaultVariance;\n }", "public double standarddeviation() {\n return Math.sqrt(variance());\n }", "public Duration getStartVariance()\r\n {\r\n return (m_startVariance);\r\n }", "public static double calculateVariance(double[][] targetVariables) {\r\n double[][] mean = FindPrototype.findOptimalPrototype(targetVariables);\r\n\r\n int N = targetVariables.length;\r\n\r\n double numerator = 0;\r\n\r\n for (int i = 0; i < N; i++) {\r\n numerator += EuclideanDistance.calculateEuclideanDistance(Gets.getRowFromMatix(i, targetVariables), mean);\r\n }\r\n \r\n if (N - 1 == 0) {\r\n return 0;\r\n } else {\r\n return numerator / (N - 1);\r\n }\r\n }", "public static Double computeVariance(final Double[] values, int offset,\n\t\t\tfinal int number, final Double mean) {\n\t\tif (number < 2) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"The number of values to process must be two or larger.\");\n\t\t}\n\t\tDouble sum = 0.0;\n\t\tfinal int UNTIL = offset + number;\n\t\tdo {\n\t\t\tDouble diff = values[offset++] - mean;\n\t\t\tsum += diff * diff;\n\t\t} while (offset != UNTIL);\n\t\treturn sum / (number - 1);\n\t}", "private void updateVariance(long value) {\n\t\tif (!varianceM.compareAndSet(-1, doubleToLongBits(value))) {\n\t\t\tboolean done = false;\n\t\t\twhile (!done) {\n\t\t\t\tfinal long oldMCas = varianceM.get();\n\t\t\t\tfinal double oldM = longBitsToDouble(oldMCas);\n\t\t\t\tfinal double newM = oldM + ((value - oldM) / count());\n\n\t\t\t\tfinal long oldSCas = varianceS.get();\n\t\t\t\tfinal double oldS = longBitsToDouble(oldSCas);\n\t\t\t\tfinal double newS = oldS + ((value - oldM) * (value - newM));\n\n\t\t\t\tdone = varianceM.compareAndSet(oldMCas, doubleToLongBits(newM)) &&\n\t\t\t\t\t\tvarianceS.compareAndSet(oldSCas, doubleToLongBits(newS));\n\t\t\t}\n\t\t}\n\t}", "public GetVarianceArray() {\n\t\tsuper(\"GET_VARIANCE_ARRAY\", Wetrn.WETRN, AppGlobalUnitAdjustment.APP_GLOBAL_UNIT_ADJUSTMENT, org.jooq.impl.DefaultDataType.getDefaultDataType(\"TABLE\"));\n\n\t\tsetReturnParameter(RETURN_VALUE);\n\t\taddInParameter(P_VEHICLE_IDS);\n\t\taddInParameter(P_VARIANCE);\n\t}", "public double varianceExponent()\n\t{\n\t\treturn _dblVarianceExponent;\n\t}", "public double sampleStandardDeviation() {\n/* 288 */ return Math.sqrt(sampleVariance());\n/* */ }", "public double sd() {\n\t\treturn Math.sqrt(var());\n\t}", "public double populationStandardDeviation() {\n/* 242 */ return Math.sqrt(populationVariance());\n/* */ }", "public static double getVarience(double[] dataArray) {\n\t\t\n\t\tdouble varience = 0.0;\n\t\tdouble average = getAverage(dataArray);\n\t\t\n\t\tfor (int i = 0; i <dataArray.length; i++) {\n\t\t\tvarience += Math.pow((dataArray[i]- average),2);\n\t\t}\n\t\t\n\t\tvarience = varience/dataArray.length;\n\t\treturn varience;\n\t}", "private void updateVarianceOfPrediction(int sensor_id){\n\t\t\n\t\tdouble N = current_sensor_readings[sensor_id] - predicted_sensor_readings[sensor_id][0];\n\t\tif(round_number==0){\n\t\t\t\n\t\t\tsigma[sensor_id] = N * N;\n\t\t\t\n\t\t}else if(round_number<=K){\n\t\t\t\n\t\t\tsigma[sensor_id] = (((round_number-1)*sigma[sensor_id]) + (N * N))/(round_number);\n\t\t\t\n\t\t}else{\n\t\t\t\n\t\t\tsigma[sensor_id] = (1-gamma)*sigma[sensor_id] + gamma * N * N;\n\t\t}\n\t}", "public void setPVariance(String value) {\n\t\tsetValue(P_VARIANCE, value);\n\t}", "public double stddev() {\n\t\tdouble sum = 0;\n\t\tdouble mean = mean();\n\t\tfor(int i = 0; i<myData.length;i++)\n\t\t\tsum+=(myData[i]-mean)*(myData[i]-mean);\n\t\treturn (double) Math.sqrt(sum/(myData.length-1));\n\t}", "private void updateMuVariance() {\n\t\tmu = train.getLocalMean(); \n\t\tsigma = train.getLocalVariance(); \n\t\t\n\t\t/*\n\t\t * If the ratio of data variance between dimensions is too small, it \n\t\t * will cause numerical errors. To address this, we artificially boost\n\t\t * the variance by epsilon, a small fraction of the standard deviation\n\t\t * of the largest dimension. \n\t\t * */\n\t\tupdateEpsilon(); \n\t\tsigma = MathUtils.add(sigma, epsilon); \n\t\t\n\t}", "public abstract double var (\n\t\tfinal int confidenceCount)\n\t\tthrows java.lang.Exception;", "public static float getVariance(ArrayList<StatisticClass> classes, float[] classMiddles, float arithmeticMiddle,\n\t\t\tint sampleSize)\n\t{\n\t\tfloat result;\n\t\tfloat sigmaResult = 0;\n\n\t\tfor (int i = 0; i < classes.size(); i++)\n\t\t{\n\n\t\t\tfloat absOccurence = classes.get(i).getAbsoluteOccurences();\n\t\t\tfloat classMiddle = classMiddles[i];\n\n\t\t\tsigmaResult += absOccurence * Math.pow((classMiddle - arithmeticMiddle), 2);\n\n\t\t}\n\n\t\tresult = sigmaResult / (sampleSize - 1);\n\t\treturn result;\n\t}", "public static double[] calGenoVariance(GenotypeMatrix G) {\n\t\tdouble[] axsq = new double[G.getNumMarker()];\n\n\t\tfor (int i = 0; i < G.getNumMarker(); i++) {\n\t\t\tint cnt = 0;\n\t\t\tdouble sq = 0;\n\t\t\tdouble sm = 0;\n\t\t\tfor (int j = 0; j < G.getGRow(); j++) {\n\t\t\t\tint g = G.getAdditiveScore(j, i);\n\t\t\t\tif (g != ConstValues.MISSING_GENOTYPE) {\n\t\t\t\t\tsq += g * g;\n\t\t\t\t\tsm += g;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (cnt > 2) {\n\t\t\t\taxsq[i] = (sq - cnt * (sm / cnt) * (sm / cnt)) / (cnt - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn axsq;\n\t}", "public Duration getFinishVariance()\r\n {\r\n return (m_finishVariance);\r\n }", "public abstract double covariance(double x1, double x2);", "private double[] std(Population pop) {\n double[] value = new double[pop.getIndividual(0).getNumGenes()];\n double [] m = mean(pop);\n //for all individuals\n Iterator<Individual> it = pop.getIterator();\n while (it.hasNext()) {\n Individual ind = it.next();\n //sum the value of the gene\n for (int i = 0; i < value.length; i++) {\n value[i] += Math.pow( ind.getGeneValue(i) - m[i],2);\n }\n }\n //divide by the number of individuals - 1\n for (int i = 0; i < value.length; i++) {\n value[i] = Math.sqrt( value[i] /(pop.getNumGenotypes()-1));\n }\n return value;\n }", "@Override\r\n\tpublic void sub(float var) {\n\t\t\r\n\t}", "protected double sigma(Vector3 v) {\n double c1, c2;\n switch (dominantAxis) {\n case X:\n c1 = v.y;\n c2 = v.z;\n break;\n case Y:\n c1 = v.x;\n c2 = v.z;\n break;\n case Z:\n c1 = v.x;\n c2 = v.y;\n break;\n default:\n return -1;\n }\n\n return Math.sqrt(c1 * c1 + c2 * c2);\n }", "public void StandardDeviation(){\r\n\t\tAverage();\r\n\t\tif (count<=1){\r\n\t\t\tSystem.out.println(\"The Standard Deviation is \"+0.0);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tStandardDeviation=(float)Math.sqrt((Total2-Total*Total/count)/(count-1));\r\n\t\t}\r\n\t}", "public Double getEstimatedTransmittedPowerVariance() {\n return mEstimatedTransmittedPowerVariance;\n }", "public Double getEstimatedTransmittedPowerVariance() {\n return mEstimatedTransmittedPowerVariance;\n }", "public abstract double var (\n\t\tfinal double confidenceLevel)\n\t\tthrows java.lang.Exception;", "public double stddev(){\n return StdStats.stddev(percentage);\n }", "public void setStartVariance(Duration startVariance)\r\n {\r\n m_startVariance = startVariance;\r\n }", "public double stddev() {\n\t\tif (experiments == 1)\n\t\t\treturn Double.NaN;\n\t\treturn stddev;\n\t}", "public double getSigma() {\n return sigma;\n }", "public double std(double data[], double mean) {\r\n\t\tdouble std = 0;\r\n\t\ttry {\r\n\t\t\tfor(int i=0;i<data.length;i++) {\r\n\t\t\t\tstd =std+((data[i]-mean)*(data[i]-mean));\r\n\t\t\t}\r\n\t\t\tstd = Math.sqrt(std / (data.length-1));\r\n\t\t}\r\n\t\tcatch(Exception e) {\r\n\t\t\tDataMaster.logger.warning(e.toString());\r\n\t\t\t//e.printStackTrace();\r\n\t\t}\r\n\t\treturn std;\r\n\t}", "public double stddev() {\n double sum = sampleMean;\n sum = 0;\n for (int i = 0; i < sites.length; i++) {\n// sum += (Double.parseDouble(sites[i] + \"\") / size - sampleMean) \n// * (Double.parseDouble(sites[i] + \"\") / size - sampleMean);\n sum += (sites[i]/size - sampleMean) \n * (sites[i]/size - sampleMean);\n }\n sampleStanDevi = Math.sqrt(sum / (times - 1));\n return sampleStanDevi;\n }", "public double averageVolume() {\n if (numberOfIcosahedrons() == 0) {\n return 0;\n }\n else {\n return totalVolume() / numberOfIcosahedrons();\n }\n }", "public double getSigma() {\n return sigma;\n }", "public double stddev() {\n return StdStats.stddev(fraction);\n }", "public double stddev() { \n return StdStats.stddev(result);\n }", "public Double getEstimatedPathLossExponentVariance() {\n return mEstimatedPathLossExponentVariance;\n }", "public Double getEstimatedPathLossExponentVariance() {\n return mEstimatedPathLossExponentVariance;\n }", "public Matrix getCovariance() {\n return mCovariance;\n }", "public Matrix getCovariance() {\n return mCovariance;\n }", "public double getVolga() {\r\n return volga;\r\n }", "public double getCovariance(final int i, final int j) {\n double sum = 0;\n double meanI;\n double meanJ;\n int numPoints = getNumPoints();\n\n meanI = getMean(i);\n meanJ = getMean(j);\n\n for (int index = 0; index < numPoints; index++) {\n sum += ((getComponent(index, i) - meanI) * (getComponent(index, j) - meanJ));\n }\n\n return sum / (numPoints);\n }", "public double getVolume() {\n\n double volume = 0;\n\n double[] v = this.getVertices();\n int[] f = this.getFaces();\n\n for (int i = 0; i < f.length; i += 6) {\n Vector3D v0 = new Vector3D(v[3 * f[i]], v[3 * f[i] + 1], v[3 * f[i] + 2]);\n Vector3D v1 = new Vector3D(v[3 * f[i + 2]], v[3 * f[i + 2] + 1], v[3 * f[i + 2] + 2]);\n Vector3D v2 = new Vector3D(v[3 * f[i + 4]], v[3 * f[i + 4] + 1], v[3 * f[i + 4] + 2]);\n\n v0 = v0.crossProduct(v1);\n volume += v0.dotProduct(v2);\n }\n\n return Math.abs(volume / 6.0);\n }", "public double stddev() {\n return sig;\n }", "public double mleVar() {\n\t\tint n = this.getAttCount();\n\t\tif (n == 0) return Constants.UNUSED;\n\n\t\tdouble mean = mean();\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdouble v = this.getValueAsReal(i);\n\t\t\tdouble deviation = v - mean;\n\t\t\tsum += deviation * deviation;\n\t\t}\n\t\treturn sum / (double)n;\n\t}", "public float getSDev() {\r\n int sumStdError = 0; // SIGMA(x_i - x_bar)\r\n int size = rbt.size() - 1;\r\n float mean = getMean();\r\n List<Integer> rbtArray = createArray(rbt.root);\r\n\r\n // calculate sumStdError\r\n for (int i = 0; i < rbtArray.size(); i++) {\r\n float gradeData = rbtArray.get(i);\r\n float error = gradeData - mean;\r\n sumStdError += error;\r\n }\r\n\r\n return (float) Math.sqrt((sumStdError ^ 2) / size);\r\n }", "public abstract float volume();", "public double stddev() {\n return StdStats.stddev(stats);\r\n }", "public double se() {\n\t\tint n = this.getAttCount();\n\t\tif (n == 0)\n\t\t\treturn Constants.UNUSED;\n\t\telse\n\t\t\treturn Math.sqrt(var() / n);\n\t}", "@Test\n public void computeResult_addsNoiseToSum() {\n mockDoubleNoise(-10);\n // Mock the noise mechanism so that it adds noise to the count == 0.\n mockLongNoise(0);\n\n variance =\n BoundedVariance.builder()\n .epsilon(EPSILON)\n .delta(DELTA)\n .noise(noise)\n .maxPartitionsContributed(1)\n .maxContributionsPerPartition(1)\n .lower(-100)\n .upper(100)\n .build();\n\n variance.addEntry(10);\n variance.addEntry(10);\n // midpoint = (lower + upper) / 2 = 0,\n // noised_normalized_sum_of_squares = (x1 - midpoint)^2 + (x2 - midpoint)^2 + noise = 10^2 +\n // 10^2 - 10 = 190,\n // noised_normalized_sum = (x1 + x2) - midpoint * count + noise = 10 + 10 - 0 - 10 = 10,\n // noised_count = count + noise = 2 + 0 = 2,\n // BoundedVariance.computeResult() = noised_normalized_sum_of_squares / noised_count -\n // (noised_normalized_sum / noised_count)^2 = 190 / 2 - (10 / 2)^2 = 70\n assertThat(variance.computeResult()).isEqualTo(70.0);\n }", "@Test\n public void computeResult_clampsTooHighVariance() {\n mockDoubleNoise(1);\n // The noise added to count is 0.\n mockLongNoise(0);\n\n variance =\n BoundedVariance.builder()\n .epsilon(EPSILON)\n .delta(DELTA)\n .noise(noise)\n .maxPartitionsContributed(1)\n .maxContributionsPerPartition(1)\n .lower(0.0)\n .upper(0.25)\n .build();\n\n variance.addEntry(0.25);\n variance.addEntry(0.25);\n // midpoint = (lower + upper) / 2 = 0.125,\n // noised_normalized_sum_of_squares = (x1 - midpoint)^2 + (x2 - midpoint)^2 + noise = 1.03125,\n // noised_normalized_sum = (x1 + x2) - midpoint * count + noise = 0.25 + 0.25 - 0.125 * 2 + 1 =\n // 1.25,\n // noised_count = count + noise = 2 + 0 = 2,\n // non_clamped_variance = noised_normalized_sum_of_squares / noised_count -\n // (noised_normalized_sum / noised_count)^2 = 1.03125 / 2 - (1.25 / 2)^2 = 0.125\n // BoundedVariance.computeResult = clamp(non_clamped_variance) = (0.25 - 0)^2 / 4 = 0.015625\n // (upper bound).\n assertThat(variance.computeResult()).isEqualTo(0.015625);\n }", "@Override\n\tpublic double getvolume(){\n\t\tdouble[] ab_cross_ac = calculate_vcp(getVector_AB(),getVector_AC());\n\t\t\n\t\t//dot product of ab_cross_ac and ad\n\t\tdouble S = calculate_vdp(ab_cross_ac,getVector_AD());\n\t\t\n\t\t//formula of tetrahedron's volume\n\t\treturn Math.abs(S)/6;\t\n\t}", "public static void avevar(final double[] data, final $double ave, final $double var) {\n double s, ep;\r\n int j, n = data.length;\r\n ave.$(0.0);\r\n for (j = 0; j < n; j++)\r\n ave.$(ave.$() + data[j]);\r\n ave.$(ave.$() / n);\r\n var.$(ep = 0.0);\r\n for (j = 0; j < n; j++) {\r\n s = data[j] - ave.$();\r\n ep += s;\r\n var.$(var.$() + (s * s));\r\n }\r\n var.$((var.$() - ep * ep / n) / (n - 1)); // Corrected two-pass\r\n // formula (14.1.8).\r\n }", "@Override\n\tpublic int avg() {\n\t\treturn (this.sum()/3);\n\t}", "public double stddev() {\n return StdStats.stddev(perThreshold);\n }", "public double stddev() {\n\t\t return StdStats.stddev(results);\n\t }", "public double calcVolume(){\n double area=calcArea(); // calcArea of superclass used\r\n return area*h;\r\n }", "public double getStandardDeviation() {\r\n\t\tdouble standDev=0;\r\n\t\tdouble avgD=getAverageDuration();\r\n\t\tdouble zaehler=0;\r\n\t\tfor(int a=0;a<populationSize();a++) {\r\n\t\t\tzaehler+=Math.pow((avgD-getTour(a).getDuration()), 2);\r\n\t\t}\r\n\t\tstandDev=Math.pow((zaehler/populationSize()), 0.5);\r\n\t\treturn standDev;\r\n\t }", "public abstract double volume();", "public double average(){\n double avg = 0;\n double sum = 0;\n for (T t : arr) {\n // sum += t.doubleValue();\n }\n\n return sum / arr.length;\n }", "public void setVega(double value) {\r\n this.vega = value;\r\n }", "public double getAverage(){\n return getTotal()/array.length;\n }", "@Test\n public void testVar() {\n System.out.println(\"var\");\n NegativeBinomialDistribution instance = new NegativeBinomialDistribution(3, 0.3);\n instance.rand();\n assertEquals(7/0.3, instance.var(), 1E-7);\n }", "public java.lang.Double getVar202() {\n return var202;\n }", "public double getUnbiasedStandardDeviation() {\n return Math.sqrt(getUnBiasedVariance());\n }", "double average();", "public static double getArrayListDoubleVariance(ArrayList<Double> list) {\n\t\treturn 0;\n\t}", "public double stddev() {\n return StdStats.stddev(results);\n }", "public double getVega() {\r\n return vega;\r\n }", "public double stddev() {\n if (threshold.length == 1) {\n return Double.NaN;\n }\n return StdStats.stddev(threshold);\n }", "public MeanVar(double[] data) {\n\t\tfor (int i = 0; i < data.length; i++)\n\t\t\taddValue(data[i]);\n\t}", "public double stddev() {\r\n\t\treturn stddev;\r\n\t}", "public float getVolum() {\n return volum;\n }" ]
[ "0.8065374", "0.79044783", "0.789876", "0.7867054", "0.78445333", "0.7619414", "0.74946046", "0.74621403", "0.73266447", "0.7326475", "0.7306682", "0.72074115", "0.7050715", "0.7034852", "0.695394", "0.6889989", "0.68309194", "0.68229866", "0.68229866", "0.6811071", "0.67502046", "0.64829266", "0.6422191", "0.63580376", "0.6332046", "0.62869996", "0.62773645", "0.62491345", "0.6235065", "0.62225807", "0.62115663", "0.61936706", "0.6172433", "0.5938411", "0.5871854", "0.58055454", "0.57941085", "0.57559484", "0.57312644", "0.5690425", "0.56869864", "0.5661847", "0.5659864", "0.56329584", "0.56115264", "0.55193746", "0.54758847", "0.546921", "0.5430427", "0.54194295", "0.53923017", "0.53923017", "0.5374449", "0.53402054", "0.5315955", "0.5297637", "0.52920216", "0.5291435", "0.5267941", "0.5266743", "0.5242681", "0.5241832", "0.5240863", "0.5238952", "0.5238952", "0.52362967", "0.52362967", "0.5226492", "0.52185434", "0.51915884", "0.51798224", "0.5170778", "0.5163959", "0.51624113", "0.51596296", "0.51514155", "0.5150283", "0.51474315", "0.51436913", "0.5143263", "0.51337767", "0.51263034", "0.5110411", "0.5095414", "0.5087697", "0.5080905", "0.5079052", "0.5053608", "0.50488293", "0.50477433", "0.5033223", "0.5025534", "0.5024264", "0.5024099", "0.5011522", "0.5004125", "0.50034434", "0.4998536", "0.49901643", "0.49756598" ]
0.79914725
1
Exponential smoothing backcast for GARCH variance initialization. This method is a Java porting of Matlab function varbackcast by TradingLab.
public double varianceBackcast() { double unconditionalVariance = variance(0.0); // why do they compute the unconditional variance if they don't // use it afterwards? double lambda = .7; double sigsum = 0.0; for(int t = 0; t<size; t++) sigsum += Math.pow(lambda, size - t - 1.0)*getSqrQuote(size - t); // This doesn't make sense to me... // looks like a convex hull of sigsum and something else, // except lambda is raised to the n-th power... return Math.pow(lambda, size) + (1.0 - lambda)*sigsum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "double [] calcGamma(){\n\t\t\tgamma = new double [N];\n\t\t\tdouble [] gammaParam = new double [noLiveSites];\n\t\t\tint liveSite = 0;\n\t\t\tfor (int i = 0; i < N; i ++){\n\t\t\t\tgamma[i] = 1.0;\n\t\t\t\tif(aliveLattice[i]){\n\t\t\t\t\tdouble phi_i = 1.0 - fracDeadNbors[i];\n\t\t\t\t\tgammaParam[liveSite] = 1-phi_i*(1-alpha[i]);\n\t\t\t\t\tgamma[i] = gammaParam[liveSite];\n\t\t\t\t\tliveSite += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tdouble ave = MathTools.mean(gammaParam);\n\t\t\tdouble var = MathTools.variance(gammaParam);\n\t\t\tdouble [] ret = new double [2];\n\t\t\tret[0] = ave;\n\t\t\tret[1] = var;\n\t\t\treturn ret;\n\t\t}", "public TimeDecayingAverage(double phi, double average) {\n setPhi(phi);\n this.average = average;\n }", "public void resample_alpha_ESS(boolean supervised, MapWrapper[][] xsub, double[][] dict, Gamma rngG,\n Random rand, Normal rngN, PoissonModel2_RegCoef beta_model,\n boolean verbose, long start) {\n if (!supervised) {\n resample_alpha(supervised, xsub, dict, rngG, rand, beta_model, verbose, start);\n }else{\n double alpha_verbose = 0;\n double[][] alpha_prior = new double[N][P];\n for (int i = 0; i < N; i++) {\n for (int p = 0; p < this.P; p++) {\n alpha_prior[i][p] = resample_alpha_laplace(i, p, xsub, dict, rngG, rand);\n }\n }\n // elliptical slice sampling\n double[][] alpha_new = beta_model.ElipticalSliceSamplerJoint(rand, rngN, alpha_prior, this.alpha, start,\n verbose);\n// System.out.println(Arrays.toString(alpha_prior[0]));\n// System.out.println(Arrays.toString(alpha[0]));\n// System.out.println(Arrays.toString(alpha_new[0]));\n int count = 0;\n for (int i = 0; i < N; i++) {\n for (int p = 0; p < this.P; p++) {\n // todo: this truncation step does change the likelihood space, danger??\n if(alpha_new[i][p] < 0) count++;\n this.alpha[i][p] = Math.max(alpha_new[i][p], 0);\n }\n }\n if (verbose) {\n System.out.print(\"finish alpha: \");\n System.out.printf(\"%.2fmin, Mean %.2f\\n\", (double) (System.currentTimeMillis() - start) / 1000 / 60,\n (alpha_verbose + 0.0) / (P * N + 0.0));\n }\n }\n }", "private double[] varianceArray(){\n\t\tdouble[] varianceVals = new double[values.length];\n\t\tfor(int i = 0; i < values.length; i++){\n\t\t\tvarianceVals[i] = Math.pow(values[i] - mean , 2.0);\n\t\t}\n\t\treturn varianceVals;\n\t}", "void backpropagate(float[] inputs, float... targets);", "private static double calculateMovingAverage(JsArrayNumber history) {\n double[] vals = new double[history.length()];\n long size = history.length();\n double sum = 0.0;\n double mSum = 0.0;\n long mCount = 0;\n\n // Check for sufficient data\n if (size >= 8) {\n // Clone the array and Calculate sum of the values\n for (int i = 0; i < size; i++) {\n vals[i] = history.get(i);\n sum += vals[i];\n }\n double mean = sum / size;\n\n // Calculate variance for the set\n double varianceTemp = 0.0;\n for (int i = 0; i < size; i++) {\n varianceTemp += Math.pow(vals[i] - mean, 2);\n }\n double variance = varianceTemp / size;\n double standardDev = Math.sqrt(variance);\n\n // Standardize the Data\n for (int i = 0; i < size; i++) {\n vals[i] = (vals[i] - mean) / standardDev;\n }\n\n // Calculate the average excluding outliers\n double deviationRange = 2.0;\n\n for (int i = 0; i < size; i++) {\n if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {\n mCount++;\n mSum += history.get(i);\n }\n }\n\n } else {\n // Calculate the average (not enough data points to remove outliers)\n mCount = size;\n for (int i = 0; i < size; i++) {\n mSum += history.get(i);\n }\n }\n\n return mSum / mCount;\n }", "public TimeDecayingAverage(double phi) {\n this(phi, 0D);\n }", "public void decay()\n\t{\n\t\tprotons -= 2;\n\t\tneutrons -= 2;\n\t}", "public double varianceExponent()\n\t{\n\t\treturn _dblVarianceExponent;\n\t}", "public void decay() {\r\n\t\tprotons -= 2;\r\n\t\tneutrons -= 2;\r\n\t}", "public static void avevar(final double[] data, final $double ave, final $double var) {\n double s, ep;\r\n int j, n = data.length;\r\n ave.$(0.0);\r\n for (j = 0; j < n; j++)\r\n ave.$(ave.$() + data[j]);\r\n ave.$(ave.$() / n);\r\n var.$(ep = 0.0);\r\n for (j = 0; j < n; j++) {\r\n s = data[j] - ave.$();\r\n ep += s;\r\n var.$(var.$() + (s * s));\r\n }\r\n var.$((var.$() - ep * ep / n) / (n - 1)); // Corrected two-pass\r\n // formula (14.1.8).\r\n }", "@Override\n public void backward() {\n Tensor x = modInX.getOutput();\n Tensor tmp = new Tensor(yAdj); // copy\n tmp.elemDivide(x);\n modInX.getOutputAdj().elemAdd(tmp);\n }", "@Test\n public void test_0030() {\n AutoCovariance instance = new AutoCovariance(\n new ARIMAModel(\n new double[]{0.5},\n 0,\n new double[]{-0.8}),\n 1, 10);\n\n assertEquals(1.120000, instance.evaluate(0), 1e-5);\n assertEquals(-0.240000, instance.evaluate(1), 1e-5);\n assertEquals(-0.120000, instance.evaluate(2), 1e-5);\n assertEquals(-0.060000, instance.evaluate(3), 1e-5);\n assertEquals(-0.030000, instance.evaluate(4), 1e-5);\n assertEquals(-0.015000, instance.evaluate(5), 1e-5);\n assertEquals(-0.007500, instance.evaluate(6), 1e-5);\n assertEquals(-0.003750, instance.evaluate(7), 1e-5);\n assertEquals(-0.00187500, instance.evaluate(8), 1e-5);\n assertEquals(-0.00093750, instance.evaluate(9), 1e-5);\n assertEquals(-0.00046875, instance.evaluate(10), 1e-5);\n }", "public void predictLossForDayIndex(String destinationDescription, double lossAmount, boolean addBack, double addBackAmount, int dayIndex);", "public float[] BackSubstitution(){\n float[] solX = new float[this.NBrsEff];\n float temp;\n for (int i=this.NBrsEff-1; i>=0; i--){\n temp = this.M[i][this.NKolEff-1];\n for (int j=this.NKolEff-2; j>i; j--){\n temp -= solX[j] * this.M[i][j];\n }\n solX[i] = temp/this.M[i][i];\n System.out.println(\"SolX: \"+solX[i]);\n }\n return solX;\n }", "@Test\n public void test_0040() {\n AutoCovariance instance = new AutoCovariance(\n new ARIMAModel(new double[]{0.3, -0.2, 0.05, 0.04}, 0, new double[]{0.2, 0.5}),\n 1, 10);\n\n assertEquals(1.461338, instance.evaluate(0), 1e-5);\n assertEquals(0.764270, instance.evaluate(1), 1e-5);\n assertEquals(0.495028, instance.evaluate(2), 1e-5);\n assertEquals(0.099292, instance.evaluate(3), 1e-5);\n assertEquals(0.027449, instance.evaluate(4), 1e-5);\n assertEquals(0.043699, instance.evaluate(5), 1e-5);\n assertEquals(0.032385, instance.evaluate(6), 1e-5);\n assertEquals(0.006320, instance.evaluate(7), 1e-5);\n assertEquals(-0.001298186, instance.evaluate(8), 1e-5);\n assertEquals(0.001713744, instance.evaluate(9), 1e-5);\n assertEquals(0.002385183, instance.evaluate(10), 1e-5);\n }", "public void decay() {\r\n\t\tfor(int i=0;i<boxes[0];i++)\r\n\t\t\tfor(int j=0;j<boxes[1];j++)\r\n\t\t\t\tfor(int k=0;k<boxes[2];k++) quantity[i][j][k] *= (1 - decayRate*sim.getDt());\r\n\t}", "public static void main(String[] args)\r\n {\r\n //GammaDistribution gam = new GammaDistribution(10.0, 20.0);\r\n //double gamR = gam.sample();\r\n //System.out.println(gamR);\r\n \r\n for(String s : args)\r\n {\r\n System.out.println(s);\r\n }\r\n //if we run the code without any arguments then use default, else overwrite\r\n int lnth = args.length; \r\n if (lnth != 0 ) {\r\n int diff = 0;\r\n try {\r\n //totalT = Integer.valueOf(args[0+diff]);\r\n //totalY = Integer.valueOf(args[1+diff]);\r\n //totalYears = Integer.valueOf(args[2+diff]);\r\n dataSet = args[0+diff];\r\n yrs = Integer.valueOf(args[1+diff]);\r\n spreadYrs = Integer.valueOf(args[2+diff]);\r\n maxDepth = Integer.valueOf(args[3+diff]);\r\n popSize = Integer.valueOf(args[4+diff]);\r\n tournamentSize = (popSize / 100) - 1;\r\n mutProb = Double.valueOf(args[5+diff]);\r\n xoverProb = Double.valueOf(args[6+diff]); \r\n elitismPercentage = Double.valueOf(args[7+diff]);\r\n primProb = Double.valueOf(args[8+diff]);\r\n terminalNodeCrossBias = Double.valueOf(args[9+diff]);\r\n nGens = Integer.valueOf(args[10+diff]);\r\n lowerLowBound = Double.valueOf(args[11+diff]);\r\n lowerUpBound = Double.valueOf(args[12+diff]);\r\n upperLowBound = Double.valueOf(args[13+diff]);\r\n upperUpBound = Double.valueOf(args[14+diff]);\r\n movingAverage = Integer.valueOf(args[15+diff]);\r\n totalNumParams = 0;\r\n additionalParameters = 0;\r\n parameterIndex.add(0);\r\n for (int i = 16; i < args.length -1 + diff; i++) { // minus 1 as the last parameter is whether to use bound \r\n if (Integer.valueOf(args[i]) == 1) { \r\n totalNumParams++;\r\n parameterIndex.add(i-15); //parameterIndex starts from 1, becuase my pred value is in column 0\r\n if (i >= args.length -9 + diff) {//minus 1 to compensate for last value and minus 8 for the 9 parameters\r\n additionalParameters++;\r\n }\r\n } \r\n }\r\n lowerBound = Integer.valueOf(args[args.length - 1]); //last value is whether to use a lower bound\r\n } catch (ArrayIndexOutOfBoundsException t) {\r\n System.out.println(\"args not enough, please check\");\r\n }\r\n } else {\r\n for (int i = 0; i < totalNumParams; i++) {\r\n parameterIndex.add(i);\r\n }\r\n }\r\n FReader read = new FReader();\r\n header = read.readHeader(\"Data/header.txt\");\r\n parametersLength = header.length - 9; //take away the 9 parameters that will be calculated within GP\r\n \r\n Expr[] evolvedMethodParameters = new Expr[totalNumParams-1];\r\n eval = new PredictionEvaluatorTrue2(nRuns, contractLength, parameterIndex, parametersLength, additionalParameters);\r\n \r\n Function evolvedMethod = new Function(Double.TYPE, new Class[0]);\r\n TreeManager.evolvedMethod = evolvedMethod;\r\n \r\n \r\n for (int i=0; i<totalNumParams-1; i++) {\r\n \r\n evolvedMethodParameters[i] = new Parameter(i);\r\n } \r\n TreeManager.evolvedMethodParameters = evolvedMethodParameters;\r\n \r\n ArrayList methodSet = new ArrayList();\r\n methodSet.add(ADD);\r\n methodSet.add(SUB);\r\n methodSet.add(MUL);\r\n methodSet.add(DIV);\r\n methodSet.add(LOG);\r\n methodSet.add(SQRT);\r\n methodSet.add(POW);\r\n methodSet.add(MOD);\r\n //methodSet.add(SIN);\r\n //methodSet.add(COS);\r\n methodSet.add(EXP);\r\n\r\n\r\n Random r = new Random();\r\n ArrayList terminalSet = new ArrayList();\r\n// for (int i = 0; i < terminals; i++)\r\n// {\r\n// double rc = r.nextDouble();\r\n// terminalSet.add(new Constant(new Double(rc * 100.0D), Double.TYPE)); //Building in a function representing random numbers minimum and maximum, consider avearge\r\n// }\r\n// \r\n// //Add in numbers between 0 and 2 in blocks of 0.05 for the purpose of weights\r\n// \r\n// for (int i = 0; i < weights; i++)\r\n// {\r\n// double rc = (1 + i) * 0.05;\r\n// terminalSet.add(new Constant(new Double(rc), Double.TYPE));\r\n// }\r\n \r\n //terminalSet.add(new Constant(new Double(0.0D), Double.TYPE));\r\n //terminalSet.add(new Constant(new Double(3.141592653589793D), Double.TYPE));\r\n \r\n //For old data\r\n //Dynamically adds the number of parameters to be estimated, need to refer to data to input correct values\r\n //for (int i = 0; i < totalT; i++) {\r\n // terminalSet.add(new Parameter(i, Double.TYPE, Boolean.valueOf(true), \"Rain_t-\"+(i+1)));\r\n //}\r\n //for (int i = 0; i < totalY; i++) {\r\n // terminalSet.add(new Parameter(i+totalT, Double.TYPE, Boolean.valueOf(true), \"Year_t-\"+(i+1)));\r\n //}\r\n \r\n //For new data have headers read in and name accordingly.\r\n \r\n for (int i = 0; i < totalNumParams-1; i++) {\r\n terminalSet.add(new Parameter(i, Double.TYPE, Boolean.valueOf(true), header[parameterIndex.get(i)]));\r\n }\r\n \r\n \r\n //consider 3 ERC's one big range, 2 smaller ranges between -1 and 1\r\n terminalSet.add(new Constant(\"ERC\", Double.TYPE));\r\n terminalSet.add(new Constant(\"ERC2\", Double.TYPE));\r\n terminalSet.add(new Constant(\"ERC3\", Double.TYPE));\r\n \r\n double primProb = 0.6D;\r\n double terminalNodeCrossBias = 0.1D;\r\n TreeManager tm = new TreeManager(methodSet, terminalSet, primProb, maxInitialDepth, maxDepth, terminalNodeCrossBias);\r\n \r\n\r\n\r\n\r\n System.out.println(\"============= Experimental parameters =============\");\r\n System.out.println(\"Maximum initial depth: \" + maxInitialDepth);\r\n System.out.println(\"Maximum depth: \" + maxDepth);\r\n System.out.println(\"Primitive probability in Grow method: \" + primProb);\r\n System.out.println(\"Terminal node crossover bias: \" + terminalNodeCrossBias);\r\n System.out.println(\"No of generations: \" + nGens);\r\n System.out.println(\"Population size: \" + popSize);\r\n System.out.println(\"Tournament size: \" + tournamentSize);\r\n System.out.println(\"Crossover probability: \" + xoverProb);\r\n System.out.println(\"Reproduction probability: \" + (1.0D - xoverProb));\r\n System.out.println(\"Mutation probalitity: \" + mutProb);\r\n System.out.println(\"Elitism percentage: \" + elitismPercentage);\r\n System.out.println(\"===================================================\");\r\n \r\n \r\n \r\n \r\n \r\n StatisticalSummary.logExperimentSetup(methodSet, terminalSet, maxInitialDepth, maxDepth, primProb, terminalNodeCrossBias, nGens, popSize, tournamentSize, mutProb, xoverProb); \r\n \r\n StatisticalSummary stat = null;\r\n filenameS = \"Results/Results_\"+yrs+\"_\"+spreadYrs+\"_MA\"+movingAverage+\"_\"+contractLength;\r\n for (int i = 0; i < nRuns; i++)\r\n {\r\n System.out.println(\"========================== Experiment \" + i + \" ==================================\");\r\n File experiment = new File(filenameS + \"/Experiment \"+i);\r\n experiment.mkdirs();\r\n stat = new StatisticalSummary(nGens, popSize, i);\r\n alg = new GA(tm, eval, popSize, tournamentSize, stat, mutProb, elitismPercentage, xoverProb, nRuns);\r\n alg.evolve(nGens, i);\r\n System.out.println(\"===============================================================================\");\r\n }\r\n}", "public double[] runOptimizer() {\n List<Integer> sents = new ArrayList<Integer>();\n for(int i=0; i<sentNum; i++)\n sents.add(i);\n \n if(needShuffle)\n Collections.shuffle(sents);\n \n double oraMetric, oraScore, predMetric, predScore;\n double[] oraPredScore = new double[4];\n double eta = 1.0; //learning rate, will not be changed if run percep\n double avgEta = 0; //average eta, just for analysis\n double loss = 0;\n double featNorm = 0;\n double featDiffVal;\n double sumMetricScore = 0;\n double sumModelScore = 0;\n String oraFeat = \"\";\n String predFeat = \"\";\n String[] oraPredFeat = new String[2];\n String[] vecOraFeat;\n String[] vecPredFeat;\n String[] featInfo;\n boolean first = true;\n //int processedSent = 0;\n Iterator it;\n Integer diffFeatId;\n double[] avgLambda = new double[initialLambda.length]; //only needed if averaging is required\n for(int i=0; i<initialLambda.length; i++)\n avgLambda[i] = 0.0;\n\n //update weights\n for(Integer s : sents) {\n //find out oracle and prediction\n if(first)\n findOraPred(s, oraPredScore, oraPredFeat, initialLambda, featScale);\n else\n findOraPred(s, oraPredScore, oraPredFeat, finalLambda, featScale);\n \n //the model scores here are already scaled in findOraPred\n oraMetric = oraPredScore[0];\n oraScore = oraPredScore[1];\n predMetric = oraPredScore[2];\n predScore = oraPredScore[3];\n oraFeat = oraPredFeat[0];\n predFeat = oraPredFeat[1];\n \n //update the scale\n if(needScale) { //otherwise featscale remains 1.0\n sumMetricScore += java.lang.Math.abs(oraMetric+predMetric);\n sumModelScore += java.lang.Math.abs(oraScore+predScore)/featScale; //restore the original model score\n \n if(sumModelScore/sumMetricScore > scoreRatio)\n featScale = sumMetricScore/sumModelScore;\n\n /* a different scaling strategy \n if( (1.0*processedSent/sentNum) < sentForScale ) { //still need to scale\n double newFeatScale = java.lang.Math.abs(scoreRatio*sumMetricDiff / sumModelDiff); //to make sure modelScore*featScale/metricScore = scoreRatio\n \n //update the scale only when difference is significant\n if( java.lang.Math.abs(newFeatScale-featScale)/featScale > 0.2 )\n featScale = newFeatScale;\n }*/\n }\n// processedSent++;\n\n HashMap<Integer, Double> allOraFeat = new HashMap<Integer, Double>();\n HashMap<Integer, Double> allPredFeat = new HashMap<Integer, Double>();\n HashMap<Integer, Double> featDiff = new HashMap<Integer, Double>();\n\n vecOraFeat = oraFeat.split(\"\\\\s+\");\n vecPredFeat = predFeat.split(\"\\\\s+\");\n \n for (int i = 0; i < vecOraFeat.length; i++) {\n featInfo = vecOraFeat[i].split(\":\");\n diffFeatId = Integer.parseInt(featInfo[0]);\n allOraFeat.put(diffFeatId, Double.parseDouble(featInfo[1]));\n featDiff.put(diffFeatId, Double.parseDouble(featInfo[1]));\n }\n\n for (int i = 0; i < vecPredFeat.length; i++) {\n featInfo = vecPredFeat[i].split(\":\");\n diffFeatId = Integer.parseInt(featInfo[0]);\n allPredFeat.put(diffFeatId, Double.parseDouble(featInfo[1]));\n\n if (featDiff.containsKey(diffFeatId)) //overlapping features\n featDiff.put(diffFeatId, featDiff.get(diffFeatId)-Double.parseDouble(featInfo[1]));\n else //features only firing in the 2nd feature vector\n featDiff.put(diffFeatId, -1.0*Double.parseDouble(featInfo[1]));\n }\n\n if(!runPercep) { //otherwise eta=1.0\n featNorm = 0;\n\n Collection<Double> allDiff = featDiff.values();\n for(it =allDiff.iterator(); it.hasNext();) {\n featDiffVal = (Double) it.next();\n featNorm += featDiffVal*featDiffVal;\n }\n \n //a few sanity checks\n if(! evalMetric.getToBeMinimized()) {\n if(oraSelectMode==1 && predSelectMode==1) { //\"hope-fear\" selection\n /* ora_score+ora_metric > pred_score+pred_metric\n * pred_score-pred_metric > ora_score-ora_metric\n * => ora_metric > pred_metric */\n if(oraMetric+1e-10 < predMetric) {\n System.err.println(\"WARNING: for hope-fear selection, oracle metric score must be greater than prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n \n if(oraSelectMode==2 || predSelectMode==3) {\n if(oraMetric+1e-10 < predMetric) {\n System.err.println(\"WARNING: for max-metric oracle selection or min-metric prediction selection, the oracle metric \" +\n \t\t\"score must be greater than the prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n } else {\n if(oraSelectMode==1 && predSelectMode==1) { //\"hope-fear\" selection\n /* ora_score-ora_metric > pred_score-pred_metric\n * pred_score+pred_metric > ora_score+ora_metric\n * => ora_metric < pred_metric */\n if(oraMetric-1e-10 > predMetric) {\n System.err.println(\"WARNING: for hope-fear selection, oracle metric score must be smaller than prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n \n if(oraSelectMode==2 || predSelectMode==3) {\n if(oraMetric-1e-10 > predMetric) {\n System.err.println(\"WARNING: for min-metric oracle selection or max-metric prediction selection, the oracle metric \" +\n \"score must be smaller than the prediction metric score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n }\n \n if(predSelectMode==2) {\n if(predScore+1e-10 < oraScore) {\n System.err.println(\"WARNING: for max-model prediction selection, the prediction model score must be greater than oracle model score!\");\n System.err.println(\"Something is wrong!\");\n }\n }\n \n //cost - margin\n //remember the model scores here are already scaled\n loss = evalMetric.getToBeMinimized() ? //cost should always be non-negative \n (predMetric-oraMetric) - (oraScore-predScore)/featScale: \n (oraMetric-predMetric) - (oraScore-predScore)/featScale;\n \n if(loss<0)\n loss = 0;\n\n if(loss == 0)\n eta = 0;\n else\n //eta = C < loss/(featNorm*featScale*featScale) ? C : loss/(featNorm*featScale*featScale); //feat vector not scaled before\n eta = C < loss/(featNorm) ? C : loss/(featNorm); //feat vector not scaled before\n }\n \n avgEta += eta;\n\n Set<Integer> diffFeatSet = featDiff.keySet();\n it = diffFeatSet.iterator();\n\n if(first) {\n first = false;\n \n if(eta!=0) {\n while(it.hasNext()) {\n diffFeatId = (Integer)it.next();\n finalLambda[diffFeatId] = initialLambda[diffFeatId] + eta*featDiff.get(diffFeatId);\n }\n }\n }\n else {\n if(eta!=0) {\n while(it.hasNext()) {\n diffFeatId = (Integer)it.next();\n finalLambda[diffFeatId] = finalLambda[diffFeatId] + eta*featDiff.get(diffFeatId);\n }\n }\n }\n \n if(needAvg) {\n for(int i=0; i<avgLambda.length; i++)\n avgLambda[i] += finalLambda[i];\n }\n }\n \n if(needAvg) {\n for(int i=0; i<finalLambda.length; i++)\n finalLambda[i] = avgLambda[i]/sentNum;\n }\n \n avgEta /= sentNum;\n System.out.println(\"Average learning rate: \"+avgEta);\n\n // the intitialLambda & finalLambda are all trainable parameters\n //if (!trainMode.equals(\"3\")) // for mode 3, no need to normalize sparse\n // feature weights\n //normalizeLambda(finalLambda);\n //else\n //normalizeLambda_mode3(finalLambda);\n\n /*\n * for( int i=0; i<finalLambda.length; i++ ) System.out.print(finalLambda[i]+\" \");\n * System.out.println(); System.exit(0);\n */ \n\n double initMetricScore = computeCorpusMetricScore(initialLambda); // compute the initial corpus-level metric score\n double finalMetricScore = computeCorpusMetricScore(finalLambda); // compute final corpus-level metric score // the\n\n // prepare the printing info\n int numParamToPrint = 0;\n String result = \"\";\n\n if (trainMode.equals(\"1\") || trainMode.equals(\"4\")) {\n numParamToPrint = paramDim > 10 ? 10 : paramDim; // how many parameters\n // to print\n result = paramDim > 10 ? \"Final lambda(first 10): {\" : \"Final lambda: {\";\n\n for (int i = 1; i < numParamToPrint; i++)\n // in ZMERT finalLambda[0] is not used\n result += finalLambda[i] + \" \";\n } else {\n int sparseNumToPrint = 0;\n if (trainMode.equals(\"2\")) {\n result = \"Final lambda(regular feats + first 5 sparse feats): {\";\n for (int i = 1; i <= regParamDim; ++i)\n result += finalLambda[i] + \" \";\n\n result += \"||| \";\n\n sparseNumToPrint = 5 < (paramDim - regParamDim) ? 5 : (paramDim - regParamDim);\n\n for (int i = 1; i <= sparseNumToPrint; i++)\n result += finalLambda[regParamDim + i] + \" \";\n } else {\n result = \"Final lambda(first 10 sparse feats): {\";\n sparseNumToPrint = 10 < paramDim ? 10 : paramDim;\n\n for (int i = 1; i < sparseNumToPrint; i++)\n result += finalLambda[i] + \" \";\n }\n }\n\n output.add(result + finalLambda[numParamToPrint] + \"}\\n\" + \"Initial \"\n + evalMetric.get_metricName() + \": \" + initMetricScore + \"\\nFinal \"\n + evalMetric.get_metricName() + \": \" + finalMetricScore);\n\n // System.out.println(output);\n\n if (trainMode.equals(\"3\")) {\n // finalLambda = baseline(unchanged)+disc\n for (int i = 0; i < paramDim; i++)\n copyLambda[i + regParamDim + 1] = finalLambda[i];\n\n finalLambda = copyLambda;\n }\n\n return finalLambda;\n }", "public void driver() {\r\n \t// At the last time point assume exponentials are largely decayed and most of what is\r\n \t// left is the constant a[0] term.\r\n gues[0] = ySeries[ySeries.length-1];\r\n for (int i = 0; i < (a.length-1)/2; i++) {\r\n \tgues[2*i+1] = 1.0;\r\n \tgues[2*i+2] = -1.0;\r\n }\r\n super.driver();\r\n }", "private static native void rollingGuidanceFilter_0(long src_nativeObj, long dst_nativeObj, int d, double sigmaColor, double sigmaSpace, int numOfIter, int borderType);", "public void m1254a(eb[] ebVarArr) {\n Object obj = this.f777b;\n if (obj == null) {\n this.f777b = ebVarArr;\n } else if (ebVarArr != null && ebVarArr.length > 0) {\n Object obj2 = new eb[(obj.length + ebVarArr.length)];\n System.arraycopy(obj, 0, obj2, 0, obj.length);\n System.arraycopy(ebVarArr, 0, obj2, obj.length, ebVarArr.length);\n this.f777b = obj2;\n }\n }", "public double getVariance(){\n\t\tdouble a = location + scale * scale;\n\t\treturn Math.exp(2 * a) - Math.exp(location + a);\n\t}", "public void lagSkudd2() {\n\t}", "float[] feedForward(float... inputs);", "public abstract void recalcNormalizationExtrema();", "public String getForecastType()\n {\n return \"double exponential smoothing\";\n }", "public static void main(String args[]) {\n\n\tint nx = 200;\n int ny = 300;\n\n\tColorSurfaceData data = new SmoothData3D(nx,ny);\n\n double minX = -2;\n double minY = -3;\n double maxX = 2;\n double maxY = 3; \n\tdouble stepX = (maxX - minX)/(nx-1);\n double stepY = (maxY - minY)/(ny-1); \n\n\tdata.setMinMaxX(minX,maxX);\n\tdata.setMinMaxY(minY,maxY);\n\n\tdouble x,y,v;\n\n\tfor(int i = 0; i < nx; i++){\n\tfor(int j = 0; j < ny; j++){\n\t x = minX + i*stepX;\n\t y = minY + j*stepY;\n v = Math.exp(-(x*x+y*y));\n data.setValue(i,j,v);\n //data.addValue(x,y,v);\n\t}}\n\n\tdouble max_dev = 0;\n\tint i_max = 0, j_max = 0;\n\n\tfor(int i = 6; i < nx-6; i++){\n\tfor(int j = 6; j < ny-6; j++){\n\t x = i*stepX + minX + 0.5*stepX;\n\t y = j*stepY + minY + 0.5*stepY;\n v = Math.abs(Math.exp(-(x*x+y*y)) - data.getValue(x,y))/Math.exp(-(x*x+y*y));\n if(max_dev < v) {\n max_dev = v;\n\t i_max = i;\n\t j_max = j;\n\t }\n\t}} \n\n\tSystem.out.println(\"max dev [%] = \"+max_dev*100);\n\n\tdouble v_calc = 0;\n\tx = i_max*stepX + minX + 0.5*stepX;\n\ty = j_max*stepY + minY + 0.5*stepY; \n\tv = Math.exp(-(x*x+y*y));\n\tv_calc = data.getValue(x,y);\n \tSystem.out.println(\"stepX = \"+stepX);\n \tSystem.out.println(\"stepY = \"+stepY);\n \tSystem.out.println(\"i_max = \"+i_max);\n \tSystem.out.println(\"j_max = \"+j_max);\n \tSystem.out.println(\"x = \"+x);\n \tSystem.out.println(\"y = \"+y);\n \tSystem.out.println(\"v = \"+v);\n \tSystem.out.println(\"v_calc = \"+v_calc); \n\n }", "public void setBeta(double aBeta);", "public Adamax(Graph graph, float learningRate, float betaOne, float betaTwo, float epsilon) {\n super(graph);\n this.learningRate = learningRate;\n this.betaOne = betaOne;\n this.betaTwo = betaTwo;\n this.epsilon = epsilon;\n }", "private static final void silk_PLC_energy(/*final int[] energy1, final int[] shift1, final int[] energy2, final int[] shift2,*/\r\n\t\t\tfinal Jenergy_struct_aux aux,// java\r\n\t\t\tfinal int[] exc_Q14, final int[] prevGain_Q10, final int subfr_length, final int nb_subfr)\r\n\t{\r\n\t\t// SAVE_STACK;\r\n\t\tfinal short[] exc_buf = new short[subfr_length << 1];\r\n\t\t/* Find random noise component */\r\n\t\t/* Scale previous excitation signal */\r\n\t\tint exc_buf_ptr = 0;// exc_buf[ exc_buf_ptr ]\r\n\t\tfor( int k = 0; k < 2; k++ ) {\r\n\t\t\tfor( int i = 0; i < subfr_length; i++ ) {\r\n\t\t\t\tfinal int v = ((int)(((long)exc_Q14[ i + ( k + nb_subfr - 2 ) * subfr_length ] * prevGain_Q10[ k ]) >> 16)) << 8;// java\r\n\t\t\t\texc_buf[ exc_buf_ptr + i ] = (short)(v > Short.MAX_VALUE ? Short.MAX_VALUE : (v < Short.MIN_VALUE ? Short.MIN_VALUE : v));\r\n\t\t\t}\r\n\t\t\texc_buf_ptr += subfr_length;\r\n\t\t}\r\n\t\t/* Find the subframe with lowest energy of the last two and use that as random noise generator */\r\n\t\tfinal long energy_shift1 = silk_sum_sqr_shift( /*energy1, shift1,*/ exc_buf, 0, subfr_length );\r\n\t\tfinal long energy_shift2 = silk_sum_sqr_shift( /*energy2, shift2,*/ exc_buf, subfr_length, subfr_length );\r\n\t\t// RESTORE_STACK;\r\n\t\taux.energy1 = (int)(energy_shift1 >>> 32);\r\n\t\taux.shift1 = (int)energy_shift1;\r\n\t\taux.energy2 = (int)(energy_shift2 >>> 32);\r\n\t\taux.shift2 = (int)energy_shift2;\r\n\t}", "public void setNewAlpha(){\n\n\t\tretrieveAlpha();\n\t\tretrieveReducerOutput();\n\t\t\n\t\tdouble[] alphaVectorUpdate = new double[K];\n\t\tdouble[] alphaGradientVector = new double[K];\n\t\tdouble[] alphaHessianVector = new double[K];\n\n\t\tdouble[] alphaVector = oldAlpha.clone();\n\t\tdouble[] alphaSufficientStatistics = rDelta;\n\n\t\tint alphaUpdateIterationCount = 0;\n\n\t\t// update the alpha vector until converge\n\t\tboolean keepGoing = true;\n\t\ttry {\n\t\t\tint decay = 0;\n\n\t\t\tdouble alphaSum = 0;\n\t\t\tfor (int j = 0; j < K; j++) {\n\t\t\t\talphaSum += alphaVector[j];\n\t\t\t}\n\n\t\t\twhile (keepGoing) {\n\t\t\t\tdouble sumG_H = 0;\n\t\t\t\tdouble sum1_H = 0;\n\n\t\t\t\tfor (int i = 0; i < K; i++) {\n\t\t\t\t\t// compute alphaGradient\n\t\t\t\t\talphaGradientVector[i] = D\n\t\t\t\t\t\t\t* (Gamma.digamma(alphaSum) - Gamma.digamma(alphaVector[i]))\n\t\t\t\t\t\t\t+ alphaSufficientStatistics[i];\n\n\t\t\t\t\t// compute alphaHessian\n\t\t\t\t\talphaHessianVector[i] = -D * Gamma.trigamma(alphaVector[i]);\n\n\t\t\t\t\tif (alphaGradientVector[i] == Double.POSITIVE_INFINITY\n\t\t\t\t\t\t\t|| alphaGradientVector[i] == Double.NEGATIVE_INFINITY) {\n\t\t\t\t\t\tthrow new ArithmeticException(\"Invalid ALPHA gradient matrix...\");\n\t\t\t\t\t}\n\n\t\t\t\t\tsumG_H += alphaGradientVector[i] / alphaHessianVector[i];\n\t\t\t\t\tsum1_H += 1 / alphaHessianVector[i];\n\t\t\t\t}\n\n\t\t\t\tdouble z = D * Gamma.trigamma(alphaSum);\n\t\t\t\tdouble c = sumG_H / (1 / z + sum1_H);\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tboolean singularHessian = false;\n\n\t\t\t\t\tfor (int i = 0; i < K; i++) {\n\t\t\t\t\t\tdouble stepSize = Math.pow(Parameters.DEFAULT_ALPHA_UPDATE_DECAY_FACTOR, decay)\n\t\t\t\t\t\t\t\t* (alphaGradientVector[i] - c) / alphaHessianVector[i];\n\t\t\t\t\t\tif (alphaVector[i] <= stepSize) {\n\t\t\t\t\t\t\t// the current hessian matrix is singular\n\t\t\t\t\t\t\tsingularHessian = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\talphaVectorUpdate[i] = alphaVector[i] - stepSize;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (singularHessian) {\n\t\t\t\t\t\t// we need to further reduce the step size\n\t\t\t\t\t\tdecay++;\n\n\t\t\t\t\t\t// recover the old alpha vector\n\t\t\t\t\t\talphaVectorUpdate = alphaVector;\n\t\t\t\t\t\tif (decay > Parameters.DEFAULT_ALPHA_UPDATE_MAXIMUM_DECAY) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// we have successfully update the alpha vector\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// compute the alpha sum and check for alpha converge\n\t\t\t\talphaSum = 0;\n\t\t\t\tkeepGoing = false;\n\t\t\t\tfor (int j = 0; j < K; j++) {\n\t\t\t\t\talphaSum += alphaVectorUpdate[j];\n\t\t\t\t\tif (Math.abs((alphaVectorUpdate[j] - alphaVector[j]) / alphaVector[j]) >= Parameters.DEFAULT_ALPHA_UPDATE_CONVERGE_THRESHOLD) {\n\t\t\t\t\t\tkeepGoing = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (alphaUpdateIterationCount >= Parameters.DEFAULT_ALPHA_UPDATE_MAXIMUM_ITERATION) {\n\t\t\t\t\tkeepGoing = false;\n\t\t\t\t}\n\n\t\t\t\tif (decay > Parameters.DEFAULT_ALPHA_UPDATE_MAXIMUM_DECAY) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\talphaUpdateIterationCount++;\n\t\t\t\talphaVector = alphaVectorUpdate;\n\t\t\t}\n\t\t} catch (IllegalArgumentException iae) {\n\t\t\tSystem.err.println(iae.getMessage());\n\t\t\tiae.printStackTrace();\n\t\t} catch (ArithmeticException ae) {\n\t\t\tSystem.err.println(ae.getMessage());\n\t\t\tae.printStackTrace();\n\t\t}\n\n\t\tnewAlpha = alphaVector;\n\n\n\t}", "public Bitmap rgbAverageContrastAugmentationRS(Bitmap bmp) {\n\n\n\n RenderScript rs = RenderScript.create(getContext()); //Create base renderscript\n\n Allocation input = Allocation.createFromBitmap(rs, bmp); //Bitmap input\n Allocation output = Allocation.createTyped(rs, input.getType(), Allocation.USAGE_SCRIPT ); //Bitmap output\n\n ScriptC_histogram histoScript = new ScriptC_histogram(rs);\n\n histoScript.set_RGB(true);\n\n histoScript.set_size(bmp.getWidth() * bmp.getHeight());\n\n short[] LUTrgb;\n\n LUTrgb = histoScript.reduce_LUTCumulatedHistogram(input).get(); //Get result\n\n histoScript.destroy();\n\n ScriptC_computeLut lut = new ScriptC_computeLut(rs);\n\n lut.set_lutSingle(LUTrgb);\n\n lut.forEach_assignLutRGBAverage(input,output);\n\n\n //Keep only one chann\n output.copyTo(bmp);\n input.destroy();\n output.destroy();\n lut.destroy();\n rs.destroy();\n\n\n\n\n\n\n return bmp;\n }", "public ExpAverageDemo() {\r\n super();\r\n animateButton.addItemListener(this);\r\n weightSlider.addChangeListener(this);\r\n }", "private static double gser(double a, double x) {\r\n double gamser = 0.0;\r\n int n;\r\n double sum, del, ap;\r\n double gln = gammln(a);\r\n \r\n if(x <= 0.0) {\r\n if(x < 0.0){\r\n // nerror(\"x less than zero in series expansion gamma function\");\r\n }\r\n return gamser = 0.0;\r\n } else {\r\n ap = a;\r\n del = sum = 1.0/a;\r\n for(n = 1; n <= ITMAX; n++) {\r\n ++ap;\r\n del *= x/ap;\r\n sum += del;\r\n if(Math.abs(del) < (Math.abs(sum)*EPS)) {\r\n return gamser = sum*Math.exp(-x + (a*Math.log(x)) - (gln));\r\n }\r\n }\r\n // nerror(\"a is too large, ITMAX is too small, in series expansion gamma function\");\r\n return 0.0;\r\n }\r\n }", "public void setVega(double value) {\r\n this.vega = value;\r\n }", "double getGamma();", "public Adamax(\n Graph graph, String name, float learningRate, float betaOne, float betaTwo, float epsilon) {\n super(graph, name);\n this.learningRate = learningRate;\n this.betaOne = betaOne;\n this.betaTwo = betaTwo;\n this.epsilon = epsilon;\n }", "public double[] getConfigNrmse(double[] variance)\r\n\t{\r\n\t\tint i;\r\n\t\tdouble[] avg_error; \r\n\t\t\r\n\t\tavg_error = new double[_esn.getNumOutputNeurons()];\r\n\t\tif(_best_idx!=-1)\r\n\t\t{\r\n\t\t\tfor(i=0; i<avg_error.length; i++)\r\n\t\t\t{\r\n\t\t\t\tavg_error[i] = _pool_of_bests.get(_best_idx)._error_config.computeNrmse(variance);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(i=0; i<avg_error.length; i++)\r\n\t\t\t{\r\n\t\t\t\tavg_error[i] = Double.MAX_VALUE;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn avg_error;\r\n\t}", "private static native long createAMFilter_0(double sigma_s, double sigma_r, boolean adjust_outliers);", "public void param_value_max_SET(float src)\n { set_bytes(Float.floatToIntBits(src) & -1L, 4, data, 17); }", "public void mo31899a(C7300a aVar) {\n this.dBv = aVar;\n }", "@Generated\n @Selector(\"smoothness\")\n @NFloat\n public native double smoothness();", "public Expression getGammaValue();", "@Override\n public void train() {\n actual = observations.toArray();\n min_val_error = Double.MAX_VALUE;\n if (findDecayConstant)\n for (float alpha = 0f; alpha <= 1f; alpha += 0.01f)\n initializeAndTrainModel(alpha);\n else\n initializeAndTrainModel(optAlpha);\n }", "private void vignetteEffect(int barra) {\n float val = barra / 200f;\n Log.i(\"kike\", \"valor efecte: \" + val + \" barra: \" + barra);\n EffectFactory factory = effectContext.getFactory();\n effect = factory.createEffect(EffectFactory.EFFECT_VIGNETTE);\n effect.setParameter(\"scale\", val);\n effect.apply(textures[0], photoWidth, photoHeight, textures[1]);\n }", "@Override\n\tvoid bp_adam(double learning_rate, int epoch_num) {\n\t\t\n\t}", "public void unaverage() {\n\t\tif (!averaged)\n\t\t\tthrow new AssertionError(\"can't unaverage twice!!\");\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (w[i] + wupdates[i])/(t+1.0);\n\t\t\n\t\tscale = 1.0;\n\t\taveraged = false;\n\t}", "private static C13816g m42347a(C13816g[] gVarArr, C13816g[] gVarArr2, byte[] bArr, C13816g[] gVarArr3, C13816g[] gVarArr4, byte[] bArr2) {\n C13816g gVar;\n int max = Math.max(bArr.length, bArr2.length);\n C13816g k = gVarArr[0].mo35148f().mo35091k();\n int i = max - 1;\n C13816g gVar2 = k;\n int i2 = 0;\n while (i >= 0) {\n byte b = i < bArr.length ? bArr[i] : 0;\n byte b2 = i < bArr2.length ? bArr2[i] : 0;\n if ((b | b2) == 0) {\n i2++;\n } else {\n if (b != 0) {\n gVar = k.mo35134a((b < 0 ? gVarArr2 : gVarArr)[Math.abs(b) >>> 1]);\n } else {\n gVar = k;\n }\n if (b2 != 0) {\n gVar = gVar.mo35134a((b2 < 0 ? gVarArr4 : gVarArr3)[Math.abs(b2) >>> 1]);\n }\n if (i2 > 0) {\n gVar2 = gVar2.mo35138b(i2);\n i2 = 0;\n }\n gVar2 = gVar2.mo35145d(gVar);\n }\n i--;\n }\n return i2 > 0 ? gVar2.mo35138b(i2) : gVar2;\n }", "public static void main(String[] args) throws java.lang.Exception {\n double []averageTime = new double[3]; //double array to get average time\n MaxFlow m = new MaxFlow();\n Stopwatch stopwatch = new Stopwatch();\n\n getDataset();\n try{\n System.out.println(\"\\n\"+\"The maximum possible flow is \" + m.fordFulkerson(graph.getAddMatrix(), 0, graph.getNumOfNode()-1));\n for(int i =1; i<=3;i++){\n System.out.println(\"Time \"+i+\" : \"+stopwatch.elapsedTime());\n averageTime[i-1]= stopwatch.elapsedTime();\n }\n\n\n double a = averageTime[0]; //calculate the average time\n double b = averageTime[1];\n double c = averageTime[2];\n double average = (a+b+c)/3;\n System.out.println(\"\\nAverage Time: \"+average);\n\n graph.printArray();\n\n }catch (NullPointerException e){\n System.out.println(\"\");\n }\n }", "public void average() {\n\t\tif (averaged)\n\t\t\tthrow new AssertionError(\"can't average twice!!\");\n\t\t\n\t\tscale = 1.0/(double)t;\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (t+1.0)*w[i] - wupdates[i];\n\t\t\n\t\taveraged = true;\n\t\n\t}", "float xMax();", "static final float interp_energy(final float prev_e, final float next_e)\n\t{\n\t\treturn (float)Math.pow( 10.0, (Math.log10( prev_e ) + Math.log10( next_e )) / 2.0 );\n\t}", "public AverageEdgeWeight() {\n super(\"avrgEdgeWeight\");\n }", "private double kToEv(double value) {\n\t\treturn Converter.convertWaveVectorToEnergy(value, edgeEnergy);\n\t}", "public void mo10177a(C1838m<Range> mVar) throws Exception {\n ScaleRotateViewState a = C6028f.this.m17075a(z2, str3, scaleRotateViewState2);\n if (a == null) {\n mVar.mo9791K(null);\n return;\n }\n if (!TextUtils.isEmpty(str4)) {\n a.setFontPath(str4);\n }\n if (C8450a.m24466bk(C8762d.aMt().getTemplateID(str3))) {\n a.setAnimOn(true);\n } else {\n a.setAnimOn(AppPreferencesSetting.getInstance().getAppSettingBoolean(\"key_pref_anim_style_open\", true));\n }\n C6028f.this.mo28736g(a);\n C6028f.this.cGS = C6028f.this.adZ();\n if (!(C6028f.this.cGT == null || C6028f.this.cGT.aIc() == null)) {\n C6028f.this.cGS = C6028f.this.cGT.aIc().getmPosition();\n }\n Range range = new Range(C6028f.this.cGS, C6028f.this.mo28477cu(C6028f.this.cGS, a.mMinDuration));\n if (C6028f.this.mo28454a(C6028f.this.mo28455a(a, range)) == null) {\n mVar.mo9791K(null);\n return;\n }\n C6028f.this.mo28724a(a, str3, range.getmPosition(), range.getmTimeLength());\n mVar.mo9791K(range);\n }", "public void backprop(double[] inputs, FeedForwardNeuralNetwork net, boolean verbose)\n {\n //create variables that will be used later\n int[] sizes = net.getSizes();\n int biggestSize = 0;\n for(int k = 0; k < sizes.length; k++)\n {\n if(sizes[k] > biggestSize)\n {\n biggestSize = sizes[k];\n }\n }\n int hiddenLayers = sizes.length - 2;\n //if input or output wrong size, return\n if(inputs.length != sizes[0])\n {\n System.out.println(\"Invalid number of inputs\");\n return;\n }\n\n double[][] allOutputs = new double[sizes.length][biggestSize];\n double[][] allErrors = new double[sizes.length][biggestSize];\n\n //fill out first layer to temp output\n int lastLayer = sizes[0];\n for(int k = 0; k < lastLayer; k++)\n {\n allOutputs[0][k] = inputs[k];\n }\n\n //for each layer after the input\n for(int k = 1; k < hiddenLayers + 2; k++)\n {\n //for each node in that layer\n for(int a = 0; a < sizes[k]; a++)\n {\n //get sum and get activation function result and its derivative\n double sum = 0;\n for(int t = 0; t < lastLayer; t++)\n {\n sum += allOutputs[k - 1][t] * net.getWeight(k - 1, t, k, a);\n }\n sum += net.getBiasNum() * net.getWeight(-1, 0, k, a);\n if(k != hiddenLayers + 1)\n {\n allOutputs[k][a] = net.applyActivationFunction(sum, net.getHiddenActivationFunction());\n allErrors[k][a] = net.applyActivationFunctionDerivative(sum, net.getHiddenActivationFunction());\n }\n else\n {\n allOutputs[k][a] = net.applyActivationFunction(sum, net.getOutputActivationFunction());\n allErrors[k][a] = net.applyActivationFunctionDerivative(sum, net.getOutputActivationFunction());\n }\n }\n lastLayer = sizes[k];\n }\n\n if(verbose)\n {\n System.out.println(\"Outputs\");\n for(int k = 0; k < maxClusters; k++)\n {\n System.out.print(allOutputs[hiddenLayers + 1][k] + \", \");\n }\n System.out.println();\n }\n double[] expectedOutputs = new double[maxClusters];\n int cluster = 0;\n double max = 0;\n for(int k = 0; k < maxClusters; k++)\n {\n expectedOutputs[k] = allOutputs[hiddenLayers + 1][k];\n if(allOutputs[hiddenLayers + 1][k] > max)\n {\n cluster = k;\n max = allOutputs[hiddenLayers + 1][k];\n }\n }\n if(verbose)\n {\n System.out.println(\"Output \" + cluster + \" will be set to max value\");\n System.out.println();\n }\n\n expectedOutputs[cluster] = 4;\n\n\n //go backward from output to first hidden layer\n for(int k = hiddenLayers + 1; k > 0; k--)\n {\n //for each node in that layer\n for(int a = 0; a < sizes[k]; a++)\n {\n //compute error for not output layer\n if(k != hiddenLayers + 1)\n {\n double temp = allErrors[k][a];\n allErrors[k][a] = 0;\n for(int t = 0; t < sizes[k + 1]; t++)\n {\n allErrors[k][a] += net.getWeight(k, t, k + 1, a) * allErrors[k + 1][t];\n }\n allErrors[k][a] *= temp;\n }\n //compute error for output layer\n else\n {\n allErrors[k][a] *= (expectedOutputs[a] - allOutputs[k][a]);\n }\n\n //for each weight node takes as input\n for(int t = 0; t < sizes[k - 1]; t++)\n {\n //find the delta for the weight and apply\n int index = net.getIndex(k - 1, t, k, a);\n double delta = learningRate * allOutputs[k - 1][t] * allErrors[k][a]\n + momentum * lastDeltas[index];\n\n net.setWeight(k - 1, t, k, a, net.getWeight(k - 1, t, k, a) + delta);\n lastDeltas[index] = delta;\n }\n }\n }\n }", "double agression();", "public void mo35219b(C13816g[] gVarArr) {\n this.f30693b = gVarArr;\n }", "public void setDamping(double decay){damping = Math.exp(-decay);}", "@Test\n public void testPrediction1() throws Exception {\n\n final CalUtils.InstantGenerator instantGenerator =\n new LocalTimeMinutes(5);\n \n final double coreDailyVols[][] = new double[][] {\n new double[] {55219 , 262256 , 202661 , 218359 , 178244 , 99610 , 92348 , 124795 , 214370 , 153854 , 204116 , 173501 , 85390 , 156835 , 108070 , 23755 , 118573 , 70117 , 55768 , 52643 , 71485 , 407645 , 442909 , 129109 , 188896 , 79590 , 422121 , 290067 , 227955 , 69257 , 41634 , 446002 , 579188 , 86237 , 1606794 , 83676 , 166393 , 84987 , 875905 , 117013 , 399084 , 116190 , 149507 , 207221 , 60857 , 155612 , 448006 , 198637 , 67695 , 65423 , 180038 , 88774 , 80273 , 86065 , 85231 , 38867 , 29330 , 116353 , 26887 , 34170 , 102518 , 72246 , 21274 , 70752 , 37912 , 49367 , 100472 , 49461 , 41735 , 45795 , 36578 , 311945 , 249039 , 70487 , 121906 , 136424 , 195136 , 166308 , 331734 , 343180 , 419616 , 104613 , 1354058 , 162678 , 141067 , 147039 , 149115 , 271162 , 543989 , 184421 , 340679 , 201939 , 293860 , 171035 , 263964 , 260198 , 428087 , 565126 , 385874 , 547890 , 384416 , 256696 , 0 , 4738359},\n new double[] {1298630 , 678084 , 488607 , 224766 , 434263 , 356933 , 576571 , 219236 , 252805 , 414776 , 166828 , 174665 , 146281 , 110944 , 145234 , 179739 , 253111 , 175685 , 64925 , 216682 , 494507 , 100205 , 67371 , 101019 , 158026 , 316281 , 334067 , 954850 , 115547 , 163051 , 130303 , 107600 , 1407996 , 90357 , 110452 , 451866 , 238004 , 3096215 , 2672803 , 190170 , 111282 , 107135 , 453389 , 60821 , 98292 , 1310864 , 1132267 , 241907 , 89915 , 175676 , 61621 , 521553 , 212388 , 288651 , 193578 , 272161 , 256777 , 236382 , 802159 , 230248 , 387068 , 160647 , 106999 , 391933 , 465080 , 374577 , 340378 , 330708 , 416320 , 200347 , 251986 , 336664 , 311970 , 600559 , 508011 , 922379 , 311581 , 352459 , 508727 , 159316 , 1355635 , 246541 , 389672 , 805957 , 370754 , 382556 , 316971 , 564228 , 437166 , 277733 , 1284505 , 1763095 , 169661 , 280682 , 969102 , 540315 , 451895 , 308036 , 715130 , 642966 , 981563 , 900778 , 0 , 7155528},\n new double[] {679280 , 229518 , 346536 , 347215 , 316025 , 313890 , 235844 , 199995 , 1920617 , 129356 , 172084 , 207860 , 317578 , 10369008 , 480990 , 1403537 , 1021730 , 156125 , 94833 , 366987 , 145687 , 322957 , 328120 , 66657 , 176001 , 271003 , 133121 , 558624 , 264638 , 638663 , 165080 , 129439 , 5126344 , 5438632 , 248806 , 250616 , 112716 , 54523 , 198097 , 67772 , 1414565 , 244509 , 246205 , 151540 , 98584 , 51217 , 94193 , 111763 , 104726 , 45880 , 64242 , 78893 , 60706 , 48117 , 133085 , 101941 , 5103803 , 5084823 , 168230 , 75537 , 815036 , 73409 , 422412 , 437127 , 115802 , 326536 , 54707 , 81759 , 94420 , 208637 , 50361 , 1458556 , 84257 , 129114 , 54632 , 105873 , 57165 , 77578 , 233302 , 195560 , 134194 , 180928 , 140433 , 123154 , 221422 , 339866 , 1343886 , 114699 , 170052 , 150679 , 181731 , 160943 , 192590 , 125556 , 132656 , 154740 , 320932 , 140929 , 117889 , 381656 , 393635 , 306177 , 0 , 21629250},\n new double[] {526909 , 167180 , 199570 , 149154 , 142141 , 320881 , 223750 , 102275 , 258400 , 202197 , 120202 , 93404 , 178631 , 106401 , 346186 , 231729 , 163656 , 1622531 , 125689 , 2656587 , 5336032 , 2385985 , 335692 , 86118 , 130551 , 99047 , 81695 , 98846 , 238413 , 4831684 , 293262 , 124652 , 106642 , 112048 , 14284646 , 111209 , 2204635 , 128940 , 83395 , 134816 , 116320 , 65412 , 165020 , 126511 , 92217 , 111751 , 47320 , 82219 , 19044177 , 70827 , 21676 , 211214 , 103108 , 22771 , 61629 , 4816563 , 63806 , 33989 , 130104 , 146897 , 15046441 , 44977 , 40889 , 54584 , 54591 , 76634 , 238536 , 68583 , 110591 , 75012 , 503760 , 209479 , 217929 , 86397 , 102284 , 81878 , 252785 , 135884 , 129149 , 112760 , 266851 , 110863 , 67866 , 55205 , 150165 , 699438 , 184450 , 270270 , 4270036 , 345303 , 895116 , 217142 , 145398 , 301231 , 10260595 , 136317 , 442910 , 371357 , 189023 , 538928 , 438973 , 926728 , 9137 , 8879481},\n new double[] {1318228 , 1391326 , 574558 , 441739 , 719144 , 522626 , 404351 , 383602 , 490710 , 284952 , 2984474 , 216339 , 10220195 , 247067 , 166223 , 224310 , 10181837 , 126161 , 9764418 , 692337 , 25907353 , 1518741 , 1179929 , 120730 , 10173292 , 290045 , 19824327 , 402527 , 277859 , 3116841 , 7164061 , 332021 , 10560006 , 2334129 , 121753 , 200177 , 246402 , 10106648 , 1137272 , 2084673 , 461849 , 125108 , 465907 , 156972 , 139083 , 127389 , 237263 , 311691 , 156536 , 155322 , 133368 , 329715 , 256088 , 116835 , 5192615 , 823762 , 183836 , 1110239 , 2414836 , 385072 , 599637 , 387285 , 291580 , 2796924 , 12977051 , 338582 , 884415 , 525622 , 322587 , 223348 , 668858 , 143039 , 627590 , 239797 , 232788 , 256503 , 209425 , 375474 , 558106 , 290991 , 1176648 , 286550 , 149539 , 297435 , 602136 , 152733 , 212363 , 178992 , 179644 , 295428 , 933636 , 349405 , 660749 , 226061 , 868852 , 318539 , 469303 , 538061 , 273643 , 444084 , 347730 , 825808 , 12011 , 7792372}};\n\n final SimpleDateFormat dateBuilder = new SimpleDateFormat(\"yyyy-MM-dd\");\n final Calendar moments[] = new Calendar[] { Calendar.getInstance(), \n Calendar.getInstance(), Calendar.getInstance(), \n Calendar.getInstance(), Calendar.getInstance(),\n Calendar.getInstance() };\n\n moments[0].setTime(dateBuilder.parse(\"2011-10-26\"));\n moments[1].setTime(dateBuilder.parse(\"2011-10-27\"));\n moments[2].setTime(dateBuilder.parse(\"2011-10-28\"));\n moments[3].setTime(dateBuilder.parse(\"2011-10-30\"));\n moments[4].setTime(dateBuilder.parse(\"2011-11-01\"));\n moments[5].setTime(dateBuilder.parse(\"2011-11-02\"));\n\n // Nomralize data to sum 100 (i.e., have an expectance of 100/104)\n for(int i=0; i<5; i++) {\n double sum = 0;\n for(int j=0; j<104; j++) sum += coreDailyVols[i][j];\n for(int j=0; j<104; j++) {\n coreDailyVols[i][j] = coreDailyVols[i][j]*100 / sum;\n }\n }\n\n final double[][] synthesizedDailyVols = new double[\n coreDailyVols.length][instantGenerator.maxInstantValue()];\n final Calendar openTime = Calendar.getInstance();\n final int n = 9*60 / 5;\n final int m = n + coreDailyVols[0].length;\n for(int i=0; i<5; i++) {\n for(int j=0; j<n; j++) {\n synthesizedDailyVols[i][j] = Double.NaN;\n }\n for(int j=0; j<coreDailyVols[i].length; j++) {\n synthesizedDailyVols[i][j+n] = coreDailyVols[i][j];\n }\n for(int j=m; j<instantGenerator.maxInstantValue(); j++) {\n synthesizedDailyVols[i][j] = Double.NaN;\n }\n }\n\n\n final Predictor predictor = new PCAPredictorTransposed(\n instantGenerator, 5);\n for(int i=0; i<5; i++) {\n predictor.learnVector(moments[i], synthesizedDailyVols[i]);\n }\n final double prediction[] = predictor.predictVector(moments[5]);\n final double coreExpectedPrediction[] = new double[] {\n0.21383323, -0.08665493, -0.28527934, -0.45293966, -0.35525111, -0.49117788,\n-0.38114565, -0.60141152, -0.09029406, -0.44815719, -0.45152723, -0.58079146,\n-0.29110153, 1.54262599, -0.59900211, -0.48107804, -0.03280398, -0.59369964,\n-0.44886852, -0.43868587, 0.88745208, -0.10900099, -0.26251035, -0.71557572,\n-0.20051598, -0.57674404, 0.53793693, 0.15857465, -0.53212067, -0.13529962,\n-0.49171709, -0.32334222, 2.16101856, 0.46824882, 2.13337330, -0.48802957,\n-0.40084079, 1.62077396, 1.93080019, -0.59114756, -0.09429057, -0.68952951,\n-0.39819841, -0.63019599, -0.78762027, 0.12458423, 0.34847712, -0.52481068,\n0.69730449, -0.74290105, -0.68866588, -0.45964670, -0.69174165, -0.64825389,\n-0.49908622, -0.30049621, 0.35726449, 0.47210113, -0.25058065, -0.72112704,\n0.79345044, -0.73245678, -0.75581875, -0.40885896, -0.08033429, -0.56030291,\n-0.54967743, -0.63571829, -0.58889882, -0.71099478, -0.67055922, -0.03850658,\n-0.40339282, -0.43003588, -0.44813762, -0.14347007, -0.48441216, -0.48851502,\n-0.15427010, -0.39484463, 0.52701151, -0.61335693, 0.89776479, -0.18821502,\n-0.46457371, -0.39850394, -0.26234640, -0.21535441, 0.33669589, -0.48879971,\n0.43892192, 0.52101182, -0.42851659, -0.51364225, 0.85831207, -0.24052028,\n-0.04192086, -0.02287821, 0.01522206, 0.24307671, 0.27369478, 0.11058009,\n-0.95575786, 14.90733910 };\n final double synthesizedExpectedPrediction[] = new double[\n instantGenerator.maxInstantValue()];\n for(int j=0; j<n; j++) {\n synthesizedExpectedPrediction[j] = Double.NaN;\n }\n for(int j=0; j<coreExpectedPrediction.length; j++) {\n synthesizedExpectedPrediction[j+n] = coreExpectedPrediction[j];\n }\n for(int j=m; j<instantGenerator.maxInstantValue(); j++) {\n synthesizedExpectedPrediction[j] = Double.NaN;\n }\n\n assertEquals(prediction.length, synthesizedExpectedPrediction.length);\n\n for(int i=0; i<prediction.length; i++) {\n assertEquals(prediction[i], synthesizedExpectedPrediction[i], \n 0.0001d);\n }\n System.out.println(\"Ok\");\n }", "public void m21425b(as asVar, bc bcVar) throws bv {\n int i = 0;\n asVar = (ax) asVar;\n ar arVar = new ar(Ascii.VT, Ascii.FF, asVar.mo7199s());\n bcVar.f18795a = new HashMap(arVar.f18601c * 2);\n for (int i2 = 0; i2 < arVar.f18601c; i2++) {\n String v = asVar.mo7202v();\n bb bbVar = new bb();\n bbVar.mo7211a(asVar);\n bcVar.f18795a.put(v, bbVar);\n }\n bcVar.m21448a(true);\n BitSet b = asVar.mo7205b(2);\n if (b.get(0)) {\n aq aqVar = new aq(Ascii.FF, asVar.mo7199s());\n bcVar.f18796b = new ArrayList(aqVar.f18598b);\n while (i < aqVar.f18598b) {\n ba baVar = new ba();\n baVar.mo7211a(asVar);\n bcVar.f18796b.add(baVar);\n i++;\n }\n bcVar.m21452b(true);\n }\n if (b.get(1)) {\n bcVar.f18797c = asVar.mo7202v();\n bcVar.m21454c(true);\n }\n }", "public static double getVarience(double[] dataArray) {\n\t\t\n\t\tdouble varience = 0.0;\n\t\tdouble average = getAverage(dataArray);\n\t\t\n\t\tfor (int i = 0; i <dataArray.length; i++) {\n\t\t\tvarience += Math.pow((dataArray[i]- average),2);\n\t\t}\n\t\t\n\t\tvarience = varience/dataArray.length;\n\t\treturn varience;\n\t}", "public Double getVariance() {\n return variance;\n }", "static final float interp_energy2(final float prev_e, final float next_e, final float weight)\n\t{\n\t\treturn (float)(Math.pow( 10.0, (1.0 - (double)weight) * Math.log10( (double)prev_e ) + (double)weight * Math.log10( (double)next_e ) ));\n\t}", "public void mo35217a(C13816g[] gVarArr) {\n this.f30692a = gVarArr;\n }", "public abstract double calcSA();", "void mo67922a(AbstractC32732ag agVar, Throwable th);", "public FFANNAdaptiveBackPropagationJSP()\n\t{\n\t\t//run(network, numberInputNeurons, numberHiddenNeurons, numberOutputNeurons, trainingSet);\n\t}", "public void updateSMA(){\n audioInput.read(audioBuffer, 0, bufferSize);\n Complex [] FFTarr = doFFT(shortToDouble(audioBuffer));\n FFTarr = bandPassFilter(FFTarr);\n double sum = 0;\n for(int i = 0; i<FFTarr.length;i++){\n sum+=Math.abs(FFTarr[i].re()); // take the absolute value of the FFT raw value\n }\n double bandPassAverage = sum/FFTarr.length;\n Log.d(LOGTAG, \"bandPassAverage: \" + bandPassAverage);\n\n //Cut out loud samples, otherwise compute rolling average as usual\n if(bandPassAverage>THROW_OUT_THRESHOLD){\n mySMA.compute(mySMA.currentAverage());\n }else {\n mySMA.compute(bandPassAverage);\n }\n }", "private void updateMuVariance() {\n\t\tmu = train.getLocalMean(); \n\t\tsigma = train.getLocalVariance(); \n\t\t\n\t\t/*\n\t\t * If the ratio of data variance between dimensions is too small, it \n\t\t * will cause numerical errors. To address this, we artificially boost\n\t\t * the variance by epsilon, a small fraction of the standard deviation\n\t\t * of the largest dimension. \n\t\t * */\n\t\tupdateEpsilon(); \n\t\tsigma = MathUtils.add(sigma, epsilon); \n\t\t\n\t}", "private void method_252(int[] var1, int[] var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9, int var10, int var11, int var12, int var13, int var14) {\n boolean var21 = field_759;\n int var15 = 256 - var14;\n\n try {\n int var16 = var4;\n int var17 = -var9;\n if(var21 || var17 < 0) {\n do {\n int var18 = (var5 >> 16) * var12;\n int var19 = -var8;\n if(!var21 && var19 >= 0) {\n var5 += var11;\n var4 = var16;\n var6 += var7;\n var17 += var13;\n } else {\n do {\n label23: {\n var3 = var2[(var4 >> 16) + var18];\n if(var3 != 0) {\n int var20 = var1[var6];\n var1[var6++] = ((var3 & 16711935) * var14 + (var20 & 16711935) * var15 & -16711936) + ((var3 & '\\uff00') * var14 + (var20 & '\\uff00') * var15 & 16711680) >> 8;\n if(!var21) {\n break label23;\n }\n }\n\n ++var6;\n }\n\n var4 += var10;\n ++var19;\n } while(var19 < 0);\n\n var5 += var11;\n var4 = var16;\n var6 += var7;\n var17 += var13;\n }\n } while(var17 < 0);\n\n }\n } catch (Exception var22) {\n System.out.println(\"error in tran_scale\"); // authentic System.out.println\n }\n }", "public void populateNoiseArray(double[] p_76308_1_, double p_76308_2_, double p_76308_4_, double p_76308_6_, int p_76308_8_, int p_76308_9_, int p_76308_10_, double p_76308_11_, double p_76308_13_, double p_76308_15_, double p_76308_17_) {\n/* 81 */ if (p_76308_9_ == 1) {\n/* */ \n/* 83 */ boolean var64 = false;\n/* 84 */ boolean var65 = false;\n/* 85 */ boolean var21 = false;\n/* 86 */ boolean var68 = false;\n/* 87 */ double var70 = 0.0D;\n/* 88 */ double var73 = 0.0D;\n/* 89 */ int var75 = 0;\n/* 90 */ double var77 = 1.0D / p_76308_17_;\n/* */ \n/* 92 */ for (int var30 = 0; var30 < p_76308_8_; var30++) {\n/* */ \n/* 94 */ double var31 = p_76308_2_ + var30 * p_76308_11_ + this.xCoord;\n/* 95 */ int var78 = (int)var31;\n/* */ \n/* 97 */ if (var31 < var78)\n/* */ {\n/* 99 */ var78--;\n/* */ }\n/* */ \n/* 102 */ int var34 = var78 & 0xFF;\n/* 103 */ var31 -= var78;\n/* 104 */ double var35 = var31 * var31 * var31 * (var31 * (var31 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 106 */ for (int var37 = 0; var37 < p_76308_10_; var37++)\n/* */ {\n/* 108 */ double var38 = p_76308_6_ + var37 * p_76308_15_ + this.zCoord;\n/* 109 */ int var40 = (int)var38;\n/* */ \n/* 111 */ if (var38 < var40)\n/* */ {\n/* 113 */ var40--;\n/* */ }\n/* */ \n/* 116 */ int var41 = var40 & 0xFF;\n/* 117 */ var38 -= var40;\n/* 118 */ double var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D);\n/* 119 */ int var19 = this.permutations[var34] + 0;\n/* 120 */ int var66 = this.permutations[var19] + var41;\n/* 121 */ int var67 = this.permutations[var34 + 1] + 0;\n/* 122 */ int var22 = this.permutations[var67] + var41;\n/* 123 */ var70 = lerp(var35, func_76309_a(this.permutations[var66], var31, var38), grad(this.permutations[var22], var31 - 1.0D, 0.0D, var38));\n/* 124 */ var73 = lerp(var35, grad(this.permutations[var66 + 1], var31, 0.0D, var38 - 1.0D), grad(this.permutations[var22 + 1], var31 - 1.0D, 0.0D, var38 - 1.0D));\n/* 125 */ double var79 = lerp(var42, var70, var73);\n/* 126 */ int var10001 = var75++;\n/* 127 */ p_76308_1_[var10001] = p_76308_1_[var10001] + var79 * var77;\n/* */ }\n/* */ \n/* */ } \n/* */ } else {\n/* */ \n/* 133 */ int var19 = 0;\n/* 134 */ double var20 = 1.0D / p_76308_17_;\n/* 135 */ int var22 = -1;\n/* 136 */ boolean var23 = false;\n/* 137 */ boolean var24 = false;\n/* 138 */ boolean var25 = false;\n/* 139 */ boolean var26 = false;\n/* 140 */ boolean var27 = false;\n/* 141 */ boolean var28 = false;\n/* 142 */ double var29 = 0.0D;\n/* 143 */ double var31 = 0.0D;\n/* 144 */ double var33 = 0.0D;\n/* 145 */ double var35 = 0.0D;\n/* */ \n/* 147 */ for (int var37 = 0; var37 < p_76308_8_; var37++) {\n/* */ \n/* 149 */ double var38 = p_76308_2_ + var37 * p_76308_11_ + this.xCoord;\n/* 150 */ int var40 = (int)var38;\n/* */ \n/* 152 */ if (var38 < var40)\n/* */ {\n/* 154 */ var40--;\n/* */ }\n/* */ \n/* 157 */ int var41 = var40 & 0xFF;\n/* 158 */ var38 -= var40;\n/* 159 */ double var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 161 */ for (int var44 = 0; var44 < p_76308_10_; var44++) {\n/* */ \n/* 163 */ double var45 = p_76308_6_ + var44 * p_76308_15_ + this.zCoord;\n/* 164 */ int var47 = (int)var45;\n/* */ \n/* 166 */ if (var45 < var47)\n/* */ {\n/* 168 */ var47--;\n/* */ }\n/* */ \n/* 171 */ int var48 = var47 & 0xFF;\n/* 172 */ var45 -= var47;\n/* 173 */ double var49 = var45 * var45 * var45 * (var45 * (var45 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 175 */ for (int var51 = 0; var51 < p_76308_9_; var51++) {\n/* */ \n/* 177 */ double var52 = p_76308_4_ + var51 * p_76308_13_ + this.yCoord;\n/* 178 */ int var54 = (int)var52;\n/* */ \n/* 180 */ if (var52 < var54)\n/* */ {\n/* 182 */ var54--;\n/* */ }\n/* */ \n/* 185 */ int var55 = var54 & 0xFF;\n/* 186 */ var52 -= var54;\n/* 187 */ double var56 = var52 * var52 * var52 * (var52 * (var52 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 189 */ if (var51 == 0 || var55 != var22) {\n/* */ \n/* 191 */ var22 = var55;\n/* 192 */ int var69 = this.permutations[var41] + var55;\n/* 193 */ int var71 = this.permutations[var69] + var48;\n/* 194 */ int var72 = this.permutations[var69 + 1] + var48;\n/* 195 */ int var74 = this.permutations[var41 + 1] + var55;\n/* 196 */ int var75 = this.permutations[var74] + var48;\n/* 197 */ int var76 = this.permutations[var74 + 1] + var48;\n/* 198 */ var29 = lerp(var42, grad(this.permutations[var71], var38, var52, var45), grad(this.permutations[var75], var38 - 1.0D, var52, var45));\n/* 199 */ var31 = lerp(var42, grad(this.permutations[var72], var38, var52 - 1.0D, var45), grad(this.permutations[var76], var38 - 1.0D, var52 - 1.0D, var45));\n/* 200 */ var33 = lerp(var42, grad(this.permutations[var71 + 1], var38, var52, var45 - 1.0D), grad(this.permutations[var75 + 1], var38 - 1.0D, var52, var45 - 1.0D));\n/* 201 */ var35 = lerp(var42, grad(this.permutations[var72 + 1], var38, var52 - 1.0D, var45 - 1.0D), grad(this.permutations[var76 + 1], var38 - 1.0D, var52 - 1.0D, var45 - 1.0D));\n/* */ } \n/* */ \n/* 204 */ double var58 = lerp(var56, var29, var31);\n/* 205 */ double var60 = lerp(var56, var33, var35);\n/* 206 */ double var62 = lerp(var49, var58, var60);\n/* 207 */ int var10001 = var19++;\n/* 208 */ p_76308_1_[var10001] = p_76308_1_[var10001] + var62 * var20;\n/* */ } \n/* */ } \n/* */ } \n/* */ } \n/* */ }", "@Override\r\n\tpublic void sub(float var) {\n\t\t\r\n\t}", "private void updateVariance() {\r\n double variance = 0.0;\r\n updateMean();\r\n for (Tweet t : members) {\r\n variance += ((t.getDateLong() - this.mean) * (t.getDateLong() - this.mean));\r\n }\r\n variance /= members.size();\r\n this.variance = variance;\r\n }", "public double functionValue(double[] var) {\n\tdouble val = 0;\n\tfor (int i=0; i<numberOfParameters; i++) { val += p[i]*Math.pow(var[0], i+1); }\n\tval +=1.;\n\treturn val;\n }", "public void mo7214b(as asVar) throws bv {\n ((az) f18794i.get(asVar.mo7206y())).mo7210b().mo7208a(asVar, this);\n }", "public void as(lj ljVar) {\n while (true) {\n int af = ljVar.af(1804771424);\n if (af != 0) {\n al(ljVar, af, 413278078);\n } else {\n return;\n }\n }\n }", "private void method_253(int[] var1, int[] var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9, int var10, int var11, int var12, int var13, int var14) {\n boolean var25 = field_759;\n int var15 = var14 >> 16 & 255;\n int var16 = var14 >> 8 & 255;\n int var17 = var14 & 255;\n\n try {\n int var18 = var4;\n int var19 = -var9;\n if(var25 || var19 < 0) {\n do {\n int var20 = (var5 >> 16) * var12;\n int var21 = -var8;\n if(!var25 && var21 >= 0) {\n var5 += var11;\n var4 = var18;\n var6 += var7;\n var19 += var13;\n } else {\n do {\n label30: {\n var3 = var2[(var4 >> 16) + var20];\n if(var3 != 0) {\n int var22 = var3 >> 16 & 255;\n int var23 = var3 >> 8 & 255;\n int var24 = var3 & 255;\n if(var22 == var23 && var23 == var24) {\n var1[var6++] = (var22 * var15 >> 8 << 16) + (var23 * var16 >> 8 << 8) + (var24 * var17 >> 8);\n if(!var25) {\n break label30;\n }\n }\n\n var1[var6++] = var3;\n if(!var25) {\n break label30;\n }\n }\n\n ++var6;\n }\n\n var4 += var10;\n ++var21;\n } while(var21 < 0);\n\n var5 += var11;\n var4 = var18;\n var6 += var7;\n var19 += var13;\n }\n } while(var19 < 0);\n\n }\n } catch (Exception var26) {\n System.out.println(\"error in plot_scale\"); // authentic System.out.println\n }\n }", "void warmup(ConsolidatedSnapshot snapshot, double[] forecasts);", "public static void main(String[] args) throws Exception {\n File file = new File(\"out/gSeries\" + Interpolate.prefix + \"/zeros.dat\");\n// DataOutputStream out = Interpolate.outputStream( file);\n ZeroInfo zeroInput = null;\n int N = 1003814;\n double[] nextValues = null;\n double max = 70;\n int run = 0;\n int beginRun = 0;\n for (int i = 0; i < N ; i++) {\n zeroInput = readSingleZero( Interpolate.zeroIn, nextValues);\n nextValues = zeroInput.nextValues;\n// if(i>1003800){\n// if(Math.abs(zeroInput.lastZero[1])>max){\n// run = 0;\n// beginRun = i;\n// } else {\n// run++;\n// }\n// }\n// if(run>40){\n// //run at 1003813\n// System.out.println(\"run at \" + beginRun);\n// break;\n// }\n if(i<3792 ){\n continue;\n }\n final double z0 = zeroInput.lastZero[0];\n final double z1 = zeroInput.nextValues[0];\n final double d0 = zeroInput.lastZero[1];\n final double d1 = zeroInput.nextValues[1];\n final double maxFromInput = d0>0?zeroInput.lastZero[2]:-zeroInput.lastZero[2];\n if(i==3792 || i==1003813){\n //gSeries.begin 476.85026008636953\n Poly4 poly = new Poly4(z0,z1, d0,d1,maxFromInput);\n System.out.println(i + \", \" + Arrays.toString(zeroInput.lastZero) +\n \", \\n\" + \"positionMax \" + poly.positionMax \n + \", \" + poly.eval(poly.positionMax) \n + \", \\n\" + Arrays.toString(nextValues));\n }\n// for (int j = 0; j < zeroInput.lastZero.length; j++) {\n// out.writeDouble(zeroInput.lastZero[j]);\n// }\n// out.writeDouble(poly.positionMax);\n }\n// out.close();\n// DataInputStream in = Interpolate.dataInputStream( file);\n// double[] tmin = new double[4];\n// for (int i = 0; i < N-3792 ; i++) \n// {\n// for (int i1 = 0; i1 < tmin.length; i1++) \n// {\n// tmin[i1] = in.readDouble();\n// }\n// System.out.println(Arrays.toString(tmin));\n// }\n// in.close();\n }", "public double getBeta();", "public abstract float[] calcIntensityScaleExtrema(float maxRI, float minRI,\n float maxRaw, float minRaw,\n int sampleNbr);", "public double[] method_4317(int var1, float var2) {\r\n String[] var3 = class_752.method_4253();\r\n float var11;\r\n int var10000 = (var11 = this.method_406() - 0.0F) == 0.0F?0:(var11 < 0.0F?-1:1);\r\n if(var3 != null) {\r\n if(var10000 <= 0) {\r\n var2 = 0.0F;\r\n }\r\n\r\n var2 = 1.0F - var2;\r\n var10000 = this.field_3402 - var1 * 1 & 63;\r\n }\r\n\r\n int var4 = var10000;\r\n int var5 = this.field_3402 - var1 * 1 - 1 & 63;\r\n double[] var6 = new double[3];\r\n double var7 = this.field_3401[var4][0];\r\n double var9 = class_1715.method_9580(this.field_3401[var5][0] - var7);\r\n var6[0] = var7 + var9 * (double)var2;\r\n var7 = this.field_3401[var4][1];\r\n var9 = this.field_3401[var5][1] - var7;\r\n var6[1] = var7 + var9 * (double)var2;\r\n var6[2] = this.field_3401[var4][2] + (this.field_3401[var5][2] - this.field_3401[var4][2]) * (double)var2;\r\n return var6;\r\n }", "public void mo1508a(C0370g gVar) {\n gVar.mo1563a((C0386n) this, this.f1290b);\n if (mo1515d()) {\n m2011d(gVar);\n } else {\n this.f1281S.add(gVar);\n }\n }", "public XYSeriesCollection eulers(double t0, double tF, double stepSize,\n ArrayList<Argument> argumentList, ArrayList<Argument> variableArgList,\n ArrayList<StockObject> stockArrayList, ArrayList<FlowObject> flowArrayList, ArrayList<VariableObject> variableArrayList) {\n Argument[] aVarList = argumentList.toArray(new Argument[argumentList.size()]);\n //aTempVarList only created to later create the temparg array list\n Argument[] aTempVarList = new Argument[argumentList.size()];\n for (int j = 0; j < aVarList.length; j++) {\n aTempVarList[j] = aVarList[j].clone();\n }\n int numSteps = (int) ((tF - t0) / stepSize);\n double t = t0;\n //javax.swing.JProgressBar pbar = new javax.swing.JProgressBar(0,numSteps);\n //int cutoff = String.valueOf(t).length()-1;\n ArrayList<Argument> aTempArgArrayList = new ArrayList<Argument>();\n for (int j = 0; j < aVarList.length; j++) {\n aTempArgArrayList.add(aTempVarList[j]);\n }\n double[] dydt = new double[argumentList.size()];\n\n ArrayList<Double> k1 = new ArrayList<Double>();\n\n //idea is to set k1 to double 0\n for (int x = 0; x < stockArrayList.size(); x++) {\n k1.add(0.0);\n }\n\n //array list length of amount of stocks\n ArrayList<XYSeries> series = new ArrayList<XYSeries>();\n\n //create series to hold graph data\n for (int i = 0; i < stockArrayList.size(); i++) {\n XYSeries tempSeries = new XYSeries(stockArrayList.get(i).getObjName());\n series.add(tempSeries);\n }\n\n final XYSeriesCollection data = new XYSeriesCollection();\n //create strings to hold table data\n\n //add initial values to series\n for (int i = 0; i < stockArrayList.size(); i++) {\n series.get(i).add(0, argumentList.get(i).getArgumentValue());\n }\n int numOfStocks = stockArrayList.size();\n double value;\n // label the string array for columns\n String stockNames = \"Time,\";\n for (int x = 0; x < stockArrayList.size(); x++) {\n stockNames += argumentList.get(x).getArgumentName() + \",\";\n }\n String[] tableStrings = new String[stockArrayList.size() + 1];\n String columns[] = stockNames.split(\",\");\n tableModel = new DefaultTableModel(0, stockArrayList.size() + 1);\n tableModel.setColumnIdentifiers(columns); // set the labels\n\n for (int n = 0; n < numSteps; n++) {\n \n t = t0 + (n * stepSize);\n variableArgList.get(variableArgList.size() - 1).setArgumentValue(t);\n // t = Math.ceil(t * 10000) / 10000;\n\n //Let's find k1:\n dydt = RightHandSide(variableArgList, argumentList, flowArrayList, stockArrayList, variableArrayList);\n\n for (int i = 0; i < numOfStocks; i++) {\n\n k1.set(i, stepSize * dydt[i]);\n }\n\n for (int i = 0; i < numOfStocks; i++) {\n\n value = argumentList.get(i).getArgumentValue() + (k1.get(i));\n //value = Math.ceil(value * 10000) / 10000;\n argumentList.get(i).setArgumentValue(value);\n \n }\n\n int row = n + 1;\n //double tablex=row*stepSize;\n //tableStrings[0] = Double.toString(Math.floor(tablex*Math.pow(10,cutoff))/Math.pow(10,cutoff));\n tableStrings[0] = Double.toString(row * stepSize);\n for (int col = 0; col < stockArrayList.size(); col++) {\n tableStrings[col + 1] = Double.toString(argumentList.get(col).getArgumentValue());\n }\n tableModel.addRow(tableStrings);\n\n for (int i = 0; i < stockArrayList.size(); i++) {\n series.get(i).add(t, argumentList.get(i).getArgumentValue());\n }\n }\n for (int i = 0; i < stockArrayList.size(); i++) {\n data.addSeries(series.get(i));\n }\n return data;\n }", "private static native void fastGlobalSmootherFilter_0(long guide_nativeObj, long src_nativeObj, long dst_nativeObj, double lambda, double sigma_color, double lambda_attenuation, int num_iter);", "private static float[] delay(int lag, float[] x) {\n int nt = x.length;\n int itlo = max(0,lag); // 0 <= it-lag\n int ithi = min(nt,nt+lag); // it-lag < nt\n float[] y = new float[nt];\n for (int it=0; it<itlo; ++it)\n y[it] = 0.0f;\n for (int it=itlo; it<ithi; ++it)\n y[it] = x[it-lag];\n for (int it=ithi; it<nt; ++it)\n y[it] = 0.0f;\n return y;\n }", "float getPostGain();", "@Test\n public void testShadowBuffer(){\n numberOfTrees = 100;\n sampleSize = 256;\n dimensions = 3;\n randomSeed = 123;\n\n RandomCutForest newForest = RandomCutForest.builder()\n .numberOfTrees(numberOfTrees)\n .sampleSize(sampleSize)\n .dimensions(dimensions)\n .randomSeed(randomSeed)\n .centerOfMassEnabled(true)\n .storeSequenceIndexesEnabled(true)\n .build();\n\n dataSize = 10_000;\n\n baseMu = 0.0;\n baseSigma = 1.0;\n anomalyMu = 5.0;\n anomalySigma = 1.5;\n transitionToAnomalyProbability = 0.01;\n transitionToBaseProbability = 0.4;\n\n NormalMixtureTestData generator = new NormalMixtureTestData(baseMu, baseSigma, anomalyMu, anomalySigma,\n transitionToAnomalyProbability, transitionToBaseProbability);\n double[][] data = generator.generateTestData(dataSize, dimensions);\n\n for (int i = 0; i < dataSize; i++) {\n newForest.update(data[i]);\n }\n\n double [] point = new double [] {-8.0,-8.0,0.0};\n DiVector result=newForest.getAnomalyAttribution(point);\n double score=newForest.getAnomalyScore(point);\n assertEquals(score,result.getHighLowSum(),1E-10);\n assertTrue(score>2);\n assertTrue(result.getHighLowSum(2)<0.2);\n // the third dimension has little influence in classification\n\n // this is going to add {8,8,0} into the forest\n // but not enough to cause large scale changes\n // note the probability of a tree seeing a change is\n // 256/10_000\n for (int i = 0; i < 5; i++) {\n newForest.update(point);\n }\n\n DiVector newResult=newForest.getAnomalyAttribution(point);\n double newScore=newForest.getAnomalyScore(point);\n\n assertEquals(newScore,newResult.getHighLowSum(),1E-10);\n assertTrue(newScore<score);\n for(int j=0;j<3;j++){\n // relationship holds at larger values\n if (result.high[j]>0.2) {\n assertEquals(score * newResult.high[j], newScore * result.high[j], 0.1*score);\n } else {\n assertTrue(newResult.high[j]<0.2);\n }\n\n if (result.low[j]>0.2) {\n assertEquals(score * newResult.low[j], newScore * result.low[j], 0.1*score);\n } else {\n assertTrue(newResult.low[j]<0.2);\n }\n }\n\n // this will make the point an inlier\n for (int i = 0; i < 5000; i++) {\n newForest.update(point);\n }\n\n DiVector finalResult=newForest.getAnomalyAttribution(point);\n double finalScore=newForest.getAnomalyScore(point);\n assertTrue(finalScore<1);\n assertEquals(finalScore,finalResult.getHighLowSum(),1E-10);\n\n for(int j=0;j<3;j++){\n // relationship holds at larger values\n if (finalResult.high[j]>0.2) {\n assertEquals(score * finalResult.high[j], finalScore * result.high[j], 0.1*score);\n } else {\n assertTrue(newResult.high[j]<0.2);\n }\n\n if (finalResult.low[j]>0.2) {\n assertEquals(score * finalResult.low[j], finalScore * result.low[j], 0.1*score);\n } else {\n assertTrue(finalResult.low[j]<0.2);\n }\n }\n\n }", "protected void setVariance(double value) {\n\t variance = value;\n\t}", "protected void setVariance(double value) {\n\t variance = value;\n\t}", "public double[][] deconstructTimeSeries( ArrayList< Double > series, \n int numberOfVariables, \n int lag )\n {\n int N = series.size() - numberOfVariables * lag;\n while( N < 0 )\n {\n numberOfVariables--;\n N = series.size() - (numberOfVariables) * lag;\n }\n double[][] variables = new double[ numberOfVariables ][ N ];\n\n for( int i=0; i<numberOfVariables; i++ )\n {\n for( int j=0; j<N; j++ )\n {\n variables[ i ][ j ] = series.get( i * lag + j );\n }\n }\n\n return variables;\n }", "protected Element arrayVar(String suffix){\n\t\treturn el(\"bpws:variable\", new Node[]{\n\t\t\t\tattr(\"element\", \"wsa:addresses\"),\n\t\t\t\tattr(\"name\", ARRAY_VAR_PRFX + suffix)\n\t\t});\n\t}", "public Double getEstimatedPathLossExponentVariance() {\n return mEstimatedPathLossExponentVariance;\n }", "public Double getEstimatedPathLossExponentVariance() {\n return mEstimatedPathLossExponentVariance;\n }", "float getPreGain();", "public float getGamma();", "public Options varianceEpsilon(Float varianceEpsilon) {\n this.varianceEpsilon = varianceEpsilon;\n return this;\n }", "Series<double[]> makeSeries(int dimension);" ]
[ "0.51500094", "0.49908596", "0.49872848", "0.4832363", "0.4774074", "0.47540474", "0.46885556", "0.46764994", "0.46677428", "0.46667022", "0.46390954", "0.46076834", "0.46023986", "0.45800066", "0.45209542", "0.45164892", "0.44780508", "0.4475406", "0.44749272", "0.44710934", "0.44699392", "0.4465519", "0.44565794", "0.44520122", "0.44406196", "0.4440404", "0.44244504", "0.4411102", "0.4410474", "0.44027755", "0.4397997", "0.43785122", "0.43719286", "0.4371149", "0.435442", "0.4354248", "0.43518218", "0.4351608", "0.43468565", "0.4335568", "0.4328556", "0.43190557", "0.43183404", "0.4313424", "0.4296826", "0.42965558", "0.4293766", "0.42916745", "0.4281664", "0.42803982", "0.42751908", "0.42749807", "0.42688537", "0.42672095", "0.42641413", "0.42622262", "0.42577723", "0.42571965", "0.42493325", "0.4247083", "0.42433554", "0.42398253", "0.42385158", "0.4236978", "0.42347586", "0.42345455", "0.42344585", "0.42343625", "0.42268866", "0.42243898", "0.42205825", "0.42124087", "0.42080045", "0.42005828", "0.42002964", "0.41971064", "0.419501", "0.41934824", "0.4190998", "0.41847426", "0.41841543", "0.41791525", "0.4177964", "0.41778564", "0.41755602", "0.4167397", "0.41622737", "0.416126", "0.41609713", "0.41606003", "0.41537526", "0.41537526", "0.4153552", "0.41485342", "0.4146267", "0.4146267", "0.41442806", "0.41390005", "0.41367584", "0.41356003" ]
0.529897
0
Return a moving average for the series for the given day. The nday moving average, MA(n), is a very simple and popular delay technical indicator.
public double movingAverage(int periods, int t) { if(periods>t + 1 || periods<1) throw new IndexOutOfBoundsException("MA(" + periods + ") is undefined at time " + t); double sum = 0.0; for(int i = t - periods + 1; i<=t; i++) sum += x[i]; return sum/periods; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void MovingAverage() {\n\t\tList<Double> high = new ArrayList<Double>();\n\t\t// high = highPriceList();\n\t\tfor (Double data2 : high) {\n\t\t\tSystem.out.println(data2);\n\t\t}\n\t\t// double[] testData = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 };\n\t\tint[] windowSizes = { 3 };\n\n\t\tfor (int windSize : windowSizes) {\n\t\t\tStock_data_controller ma = new Stock_data_controller();\n\t\t\tma.Stock_controller(windSize);\n\t\t\tfor (double x : high) {\n\t\t\t\tma.newNum(x);\n\t\t\t\tSystem.out.println(\"Next number = \" + x + \", SimpleMovingAvg = \" + ma.getAvg());\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "private static double calculateMovingAverage(JsArrayNumber history) {\n double[] vals = new double[history.length()];\n long size = history.length();\n double sum = 0.0;\n double mSum = 0.0;\n long mCount = 0;\n\n // Check for sufficient data\n if (size >= 8) {\n // Clone the array and Calculate sum of the values\n for (int i = 0; i < size; i++) {\n vals[i] = history.get(i);\n sum += vals[i];\n }\n double mean = sum / size;\n\n // Calculate variance for the set\n double varianceTemp = 0.0;\n for (int i = 0; i < size; i++) {\n varianceTemp += Math.pow(vals[i] - mean, 2);\n }\n double variance = varianceTemp / size;\n double standardDev = Math.sqrt(variance);\n\n // Standardize the Data\n for (int i = 0; i < size; i++) {\n vals[i] = (vals[i] - mean) / standardDev;\n }\n\n // Calculate the average excluding outliers\n double deviationRange = 2.0;\n\n for (int i = 0; i < size; i++) {\n if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {\n mCount++;\n mSum += history.get(i);\n }\n }\n\n } else {\n // Calculate the average (not enough data points to remove outliers)\n mCount = size;\n for (int i = 0; i < size; i++) {\n mSum += history.get(i);\n }\n }\n\n return mSum / mCount;\n }", "protected static float[] computeMovingAverage(float[] values, int np) {\n\t\tfloat[] mm = new float[values.length - np];\n\t\tfor (int i = 0; i < mm.length; i++) {\n\t\t\tfloat sum = 0;\n\t\t\tfor (int j = 0; j < np; j++) {\n\t\t\t\tsum = sum + values[i + j];\n\t\t\t}\n\t\t\tmm[i] = sum / np;\n\t\t}\n\t\treturn mm;\n\t}", "public double averageSteps() {\n if (day==0) return 0;\n return (double) totalSteps / day;}", "public MovingAverage(int size) {\r\n this.size = size;\r\n }", "public MovingAverage(int size) {\n value = new int[size];\n }", "public static void calculateAverage(double[] inputArray, int limit)\r\n\t{\r\n\t\tIMovingAverage<Double> movingAvg = new MovingAverageImpl<Double>(limit);\r\n\t\tfor(double element : inputArray)\r\n\t\t{\r\n\t\t\tmovingAvg.add(element);\r\n\t\t\tSystem.out.println(\"Moving average is = \" +movingAvg.getAverage());\r\n\t\t}\r\n\t\tSystem.out.println(\"*********************************************************\");\r\n\t}", "public double average(){\r\n\t\t//create variable to hold the values\r\n\t\tdouble average = 0;\r\n\t\t\r\n\t\tfor (int i = 0; i < this.data.length; i++){\r\n\t\t\t//add current index\r\n\t\t\taverage += this.data[i];\r\n\t\t\t}\r\n\t\treturn (average/this.data.length);\r\n\t}", "private double calculateAverage(Candle[] cd) {\n double sum = 0; \r\n for(Candle c : cd) {\r\n sum += c.getClose();\r\n }\r\n return sum/cd.length;\r\n \r\n }", "@Test\r\n\tpublic void exerciseMovingAverage() {\n\t\tList<Integer> temparaturArray = Arrays.asList(8, 7, 6, 6, 7, 7, 8, 10, 13, 16, 10, 20, 23, 26, 30, 29, 27, 45, 24, 23, 20, 18, 15, 11);\r\n\t\tObservable<Integer> temparaturSequence = Observable\r\n\t\t\t\t.interval(0, 1L, TimeUnit.HOURS, testScheduler)\r\n\t\t\t\t.take(temparaturArray.size())\r\n\t\t\t\t.map(i -> temparaturArray.get(i.intValue()));\r\n\t\t\r\n\t\t// TODO: calculate the moving average (SMA) of the given temperature sequence (each hour of a single day).\r\n\t\t// use the previous three values for each data point.\r\n // HINT: use a suitable overload of the same method used in \"Batching\"\r\n // and then calculate the average of each batch using LINQ\r\n // HINT: don't forget to pass the scheduler\r\n\t\tObservable<Double> movingAverage = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<Double> testSubscriber = new TestSubscriber<>();\r\n\t\tmovingAverage.subscribe(testSubscriber);\r\n\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(1, TimeUnit.DAYS);\r\n\t\t\r\n\t\tlog(testSubscriber.getOnNextEvents());\r\n\t\t\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\t\r\n\t\t// expected values:\r\n\t\tList<Double> expected = Arrays.asList(\r\n\t\t\t\t7.0, 6.333333333333333, 6.333333333333333, 6.666666666666667, 7.333333333333333, \r\n\t\t\t\t8.333333333333334, 10.333333333333334, 13.0, 13.0, 15.333333333333334, \r\n\t\t\t\t17.666666666666668, 23.0, 26.333333333333332, 28.333333333333332, \r\n\t\t\t\t28.666666666666668, 33.666666666666664, 32.0, 30.666666666666668, \r\n\t\t\t\t22.333333333333332, 20.333333333333332, 17.666666666666668, 14.666666666666666, \r\n\t\t\t\t// the last two values have limited input, i.e.\r\n\t\t\t\t// (15+11)/2 and (11)/1\r\n\t\t\t\t13.0, 11.0);\r\n\t\ttestSubscriber.assertReceivedOnNext(expected);\r\n\t\t\r\n\t}", "public double averageDayDriveDistance(String day)\n\t{\n\t\tint dayCount = 0; //total days run through\n\t\tString currentDate = \"\";\n\t\tdouble totalDistance = 0;\n\t\tfor(int i = 0; i < saveData.size(); i++)\n\t\t{\n\t\t\t//figures out the number of days, then averages the total by that number\n\t\t\tif(day.equals(saveData.get(i).get(\"day\")))\n\t\t\t{\n\t\t\t\tif(currentDate.equals(\"\"))\n\t\t\t\t{\n\t\t\t\t\t//if there is no current date, we must have just started; set the variable\n\t\t\t\t\tcurrentDate = saveData.get(i).get(\"date\"); //.get(\"date\") to be replaced\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t\telse if(currentDate.equals(saveData.get(i).get(\"date\")))\n\t\t\t\t{\n\t\t\t\t\t//it's the same date, so add this distance to the total distance\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//it's a different date, so set the currentDate to this one,\n\t\t\t\t\t//increment the days counter;\n\t\t\t\t\tcurrentDate = saveData.get(i).get(\"date\");\n\t\t\t\t\tdayCount++;\n\t\t\t\t\t//add this drive to the total distance\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t//after all the indexes of saveData have been run through\n\t\t//clean up by increment the days counter\n\t\tdayCount++;\n\t\t//get the average by dividing the total distance by the days\n\t\tdouble averageDistancePerDay = this.totalDriveDistance()/dayCount;\n\t}", "public static void calculateAverage(int[] inputArray, int limit)\r\n\t{\r\n\t\tIMovingAverage<Integer> movingAvg = new MovingAverageImpl<Integer>(limit);\r\n\t\tfor(int element : inputArray)\r\n\t\t{\r\n\t\t\tmovingAvg.add(element);\r\n\t\t\tSystem.out.println(\"Moving average is = \" +movingAvg.getAverage());\r\n\t\t}\r\n\t\tSystem.out.println(\"*********************************************************\");\r\n\t}", "public MovingAveragefromDataStream(int size) {\n this.size = size;\n }", "static double average(double[] data){\n\n // Initializing total placeholder \n double total = 0;\n\n // Traversing data array and adding to total sum\n for (double d : data) {\n total += d;\n }\n\n // Computing average\n double average = (double) total / data.length;\n\n return average;\n }", "double average();", "public double getAvg(){\n double avg=0;\n for(int x=0; x<max; x++){\n avg=avg+times[x];\n }\n avg=avg/max;\n return avg;\n }", "public double MACDSignal(int t)\n {\n Series macd = new Series();\n macd.x = new double[macd.size = t + 1];\n for(int i = 0; i<=t; i++)\n macd.x[i] = MACD(i);\n return macd.expMovingAverage(9, t);\n }", "public static double average(double[] array){\n double sum = 0;\n for (int i = 0; i < array.length; i++) {\n sum += array[i];\n }\n return sum/array.length;\n }", "public static float[] returnMeanArray (float[] weatherArray){\n float[] meanArray = new float[12];\n for (int i = 0; i < 12; i++){\n meanArray[i] = weatherArray[i]/30;\n }\n return meanArray;\n }", "public static double meanOf(double... values) {\n/* 433 */ Preconditions.checkArgument((values.length > 0));\n/* 434 */ double mean = values[0];\n/* 435 */ for (int index = 1; index < values.length; index++) {\n/* 436 */ double value = values[index];\n/* 437 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 439 */ mean += (value - mean) / (index + 1);\n/* */ } else {\n/* 441 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ } \n/* 444 */ return mean;\n/* */ }", "public static double getAverage(int start, double[] d) {\n double average = 0;\n for (int i = 0; i < 110; i++) {\n average = average + d[i];\n }\n return average / 110;\n }", "private float calculateMean()\n { \n int numberEmployees = employees.size();\n float total = 0, meanGrossPay = 0;\n // Create an array of all gross pays\n float[] allGrossPay = new float[numberEmployees];\n \n // Call method to return an array of float containing all gross pays\n allGrossPay = calculateAllGrossPay();\n // Find total gross pay\n for (int i = 0; i < numberEmployees; i++)\n {\n total += allGrossPay[i];\n }\n // Find mean and return it\n if (numberEmployees > 0)\n {\n meanGrossPay = total/numberEmployees;\n \n }\n return meanGrossPay;\n }", "public MovingAverage(int size) {\n q = new LinkedList();\n this.size = size;\n sum = 0;\n }", "@Test\n\tpublic void averageWorksForModeSteps() {\n\t\tfinal FloatTimeSeries t0 = new FloatTreeTimeSeries();\n\t\tt0.addValues(TimeSeriesUtils.createStepFunction(10, 0, 10, 10, 0)); // constant function = 10\n\t\tfinal FloatTimeSeries t1 = new FloatTreeTimeSeries();\n\t\tt1.addValues(TimeSeriesUtils.createStepFunction(5, 20, 25, 20, 0)); // constant function = 20\n\t\tt0.setInterpolationMode(InterpolationMode.STEPS);\n\t\tt1.setInterpolationMode(InterpolationMode.STEPS);\n\t\tfinal ReadOnlyTimeSeries avg = MultiTimeSeriesUtils.getAverageTimeSeries(Arrays.<ReadOnlyTimeSeries> asList(t0, t1), 0, Long.MAX_VALUE, true, null, false);\n\t\t// one data point outside time range, one boundary value should be added\n\t\tAssert.assertEquals(\"Time series sum has wrong number of data points\", 13, avg.size());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 10, avg.getValue(7).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(23).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(100).getValue().getIntegerValue());\n\t}", "public static double meanOf(int... values) {\n/* 457 */ Preconditions.checkArgument((values.length > 0));\n/* 458 */ double mean = values[0];\n/* 459 */ for (int index = 1; index < values.length; index++) {\n/* 460 */ double value = values[index];\n/* 461 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 463 */ mean += (value - mean) / (index + 1);\n/* */ } else {\n/* 465 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ } \n/* 468 */ return mean;\n/* */ }", "public static double avg(double[] array) {\r\n\t\tdouble ret = sum(array);\r\n\t\treturn ret / array.length;\r\n\t}", "public void updateSMA(){\n audioInput.read(audioBuffer, 0, bufferSize);\n Complex [] FFTarr = doFFT(shortToDouble(audioBuffer));\n FFTarr = bandPassFilter(FFTarr);\n double sum = 0;\n for(int i = 0; i<FFTarr.length;i++){\n sum+=Math.abs(FFTarr[i].re()); // take the absolute value of the FFT raw value\n }\n double bandPassAverage = sum/FFTarr.length;\n Log.d(LOGTAG, \"bandPassAverage: \" + bandPassAverage);\n\n //Cut out loud samples, otherwise compute rolling average as usual\n if(bandPassAverage>THROW_OUT_THRESHOLD){\n mySMA.compute(mySMA.currentAverage());\n }else {\n mySMA.compute(bandPassAverage);\n }\n }", "public double getMean() {\n double timeWeightedSum = 0;\n\n for (int i = 0; i < accumulate.size() - 1; i++) {\n timeWeightedSum += accumulate.get(i).value\n * (accumulate.get(i + 1).timeOfChange\n - accumulate.get(i).timeOfChange);\n\n }\n LOG_HANDLER.logger.finer(\"timeWeightedSum Value: \" + timeWeightedSum\n + \"totalOfQuueueEntries: \" + totalOfQueueEntries);\n return timeWeightedSum / totalOfQueueEntries;\n }", "public static void main(String[] args) {\r\n double d = 3.5;\r\n int i = 2;\r\n System.out.println(d/i);\r\n MovingAverage movingAverage = new A0346MovingAveragefromDataStream().new MovingAverage(3);\r\n System.out.println(movingAverage.next(1));\r\n System.out.println(movingAverage.next(10));\r\n System.out.println(movingAverage.next(3));\r\n System.out.println(movingAverage.next(5));\r\n }", "public double arithmeticalMean(double[] arr) {\n return 0;\n }", "public Series removeDelayedTrend(int depth)\n {\n if(depth<1 || depth>=size)\n throw new IndexOutOfBoundsException();\n Series oscillator = new Series();\n oscillator.x = new double[oscillator.size = size - depth];\n if(oscillator.size>1)\n oscillator.r = new double[oscillator.size - 1];\n for(int t = 0; t<oscillator.size; t++)\n {\n oscillator.x[t] = x[t + depth] - movingAverage(depth, t + depth);\n if(t>0)\n oscillator.r[t - 1] = Math.log(oscillator.x[t]/oscillator.x[t - 1]);\n }\n return oscillator;\n }", "public TimeDecayingAverage(double phi, double average) {\n setPhi(phi);\n this.average = average;\n }", "public double getMean() \r\n\t{\r\n\t\tlong tmp = lastSampleTime - firstSampleTime;\r\n\t\treturn ( tmp > 0 ? sumPowerOne / (double) tmp : 0);\r\n\t}", "public double average() {\n return average(0.0);\n }", "public double averageTempForMonth(int month, int year) {\r\n int count = 0;\r\n double total = 0;\r\n double average;\r\n for(DailyWeatherReport report : dailyReports){\r\n if((report.getDate().get(GregorianCalendar.MONTH) == month) && (report.getDate() .get(GregorianCalendar.YEAR) == year)) {\r\n total += report.takeTempAvg();\r\n count++;\r\n }\r\n }\r\n if(total != 0){\r\n average = total / count;\r\n return average;\r\n }\r\n average = 0;\r\n return average;\r\n }", "double average(double[] doubles) {\n double total = 0.0;\n //int count = 0;\n for (double d: doubles) {\n total = total + d;\n //count = count + 1;\n }\n //return total / count;\n return total / doubles.length;\n }", "public int average()\n {\n int average = 0;\n int sum = 0;\n\n for ( int index = 0; index < data.length; index++ )\n {\n sum = sum + data[index];\n }\n average = sum / data.length;\n\n return average;\n }", "public static double doAvgTurnAroundTime() {\n if (count >= 1) {\n return turnaroundTimeTotal / count;\n } else {\n return -1;\n }\n }", "public double expMovingAverage(int periods, int t)\n {\n if(periods<1)\n throw new IndexOutOfBoundsException(\"EMA(\" + periods + \") is undefined at time \" + t);\n double alpha = 2.0/(periods + 1);\n double ema = 0.0;\n for(int i = 0; i<=t; i++)\n ema += alpha*(x[i] - ema);\n return ema;\n }", "void printAverageMeasurement(Station station, Sensor sensor, LocalDateTime since, LocalDateTime until, double average);", "public double averageOfArray() {\n double sum = 0;\n double average = 0;\n int i;\n for (i = 0; i < sirDeLa1La100.length; i++) {\n sum = sum + sirDeLa1La100[i];\n }\n average = sum / sirDeLa1La100.length;\n return average;\n }", "public double getAverage(){\n return getTotal()/array.length;\n }", "public static double averageOfNumbers(int n) {\n Scanner keyedInput = new Scanner(System.in);\n\n double total = 0;\n double[] values = new double[n];\n\n System.out.println(\"Please enter your values:\");\n for (int i = 0; i < n; i = i + 1) {\n values[i] = keyedInput.nextDouble();\n total = total + values[i];\n }\n double a = (double) Math.round((total / n) * 100) / 100;\n return a;\n }", "private float averageBeat(){\n float avgBeat = 0f;\n List<Float> beatRed = DataManager.getInstance().getBeatRed();\n List<Float> beatIR = DataManager.getInstance().getBeatIR();\n\n for(int i = 0; i < beatRed.size() && i < beatIR.size(); i ++ ){\n chartFragment.addRedData(beatRed.get(i));\n chartFragment.addIRData(beatIR.get(i));\n avgBeat += beatRed.get(i);\n avgBeat += beatIR.get(i);\n }\n avgBeat = avgBeat / (beatRed.size() + beatIR.size());\n\n if (tcpTask != null )\n this.tcpTask.addData(\"\" + avgBeat);\n beatLabel.setText(\"Beat : \" + avgBeat);\n return avgBeat;\n }", "public Double computeAverage(){\n\t\tdouble total = 0; //double used to keep total value of elements in arr to determine average\n\t\t\n\t\tfor(int i = 0; i < arr.length; i++)//loop through array and add the total\n\t\t{\n\t\t\ttotal += arr[i].doubleValue(); //add current value of element in arr to total's value\n\t\t}\n\t\t\n\t\tDouble result = total/arr.length; //returns the average as a Double\n\t\t\n\t\treturn result;\n\t}", "public static double rollingAvg(double value, double newEntry, double n, double weighting ) {\r\n return (value * n + newEntry * weighting)/(n + weighting);\r\n }", "public double mean()\n {\n double sum = 0.0;\n for(int t = 0; t<size; t++)\n sum += x[t];\n return sum/size;\n }", "public double mean(double data[]) {\r\n\t\tdouble mean = 0;\r\n\t\ttry {\r\n\t\t\tfor(int i=0;i<data.length;i++) {\r\n\t\t\t\tmean =mean+data[i];\r\n\t\t\t}\r\n\t\t\tmean = mean / data.length;\r\n\t\t}\r\n\t\tcatch(Exception e) {\r\n\t\t\tDataMaster.logger.warning(e.toString());\r\n\t\t\t//e.printStackTrace();\r\n\t\t}\r\n\t\treturn mean;\r\n\t}", "private void PeriodMeanEvaluation () {\n\n float x = 0;\n for(int i = 0; i < 3; i++)\n {\n for(int j = 0; j < numberOfSample; j++)\n {\n x = x + singleFrame[j][i];\n }\n meanOfPeriodCoord[i] = (x/numberOfSample);\n x = 0;\n }\n }", "public static double meanOf(long... values) {\n/* 482 */ Preconditions.checkArgument((values.length > 0));\n/* 483 */ double mean = values[0];\n/* 484 */ for (int index = 1; index < values.length; index++) {\n/* 485 */ double value = values[index];\n/* 486 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 488 */ mean += (value - mean) / (index + 1);\n/* */ } else {\n/* 490 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ } \n/* 493 */ return mean;\n/* */ }", "public ArrayList<Forecast> getForecastsForDay( int day ) {\n if (forecasts.size() == 0) {\n return null;\n }\n\n int startIndex = 0;\n int endIndex = 0;\n\n if (day < 8) {\n startIndex = dayIndices[day];\n }\n\n if (startIndex == -1) {\n return null;\n }\n\n if (day < 7) {\n endIndex = dayIndices[day+1];\n if (endIndex < 0) {\n endIndex = forecasts.size();\n }\n } else {\n endIndex = forecasts.size();\n }\n\n return new ArrayList<>(forecasts.subList(startIndex, endIndex));\n }", "public double average(){\n double avg = 0;\n double sum = 0;\n for (T t : arr) {\n // sum += t.doubleValue();\n }\n\n return sum / arr.length;\n }", "static double calculateAverage(int[] array) {\n\n double sum = 0;\n\n for (int i = 0; i < array.length; i++) {\n\n sum = sum + (double) array[i];\n\n\n }\n\n return sum / array.length;//returning average\n\n }", "private void calculateMean(float total){\r\n float averageBonds = total/accountInTotal;\r\n float averageAER = (averageBonds-startingBonds)/(startingBonds/100);\r\n\r\n Account averageAccount = new Account(startingBonds,averageBonds,averageAER);\r\n System.out.println(averageAccount.toString());\r\n\r\n }", "private int getMean(int[] times) {\n\n\t\t//Initialise mean and sum to 0\n\t\tint mean = 0;\n\t\tint sum = 0;\n\n\t\t//Loop through all the times\n\t\tfor (int i = 0; i < times.length; i++) {\n\n\t\t\t//Add to the sum\n\t\t\tsum += times[i];\n\t\t}\n\n\t\t//Calculate and return the mean\n\t\tmean = sum/times.length;\n\t\treturn mean;\n\t}", "public double getMean(final int d) {\n double sum = 0;\n int numPoints = getNumPoints();\n\n for (int i = 0; i < numPoints; i++) {\n sum += getComponent(i, d);\n }\n\n return sum / numPoints;\n }", "public static Double computeMean(Double[] values) {\n\t\treturn computeMean(values, 0, values.length);\n\t}", "public void setMovingAverageSamples(int count)\n {\n NumAvgSamples = count;\n }", "public double averageTempForMonth(int month, int year) {\n\t\tdouble sum = 0;\n\t\tint count = 0;\n\t\tfor(DailyWeatherReport report: reports.getReportsForMonth(month, year)) {\n\t\t\tsum += report.avgTempForDay();\n\t\t\tcount++;\n\t\t}\n\t\tif(count == 0) return 0;\n\t\treturn sum / count;\n\t}", "@Override\n public Double average() {\n return (sum() / (double) count());\n }", "public static double getAverage(double[][] array)\r\n\t{\r\n\t\tint count = 0;\r\n\t\tList<Double> lineSumList = new ArrayList<Double>();\r\n\t\tfor( int i = 0; i < array.length; i++ ) {\r\n\t\t\tdouble lineSum = Σ(array[i]);\r\n\t\t\tlineSumList.add(lineSum);\r\n\t\t\tcount += array[i].length;\r\n\t\t}\r\n\t\tdouble sum = Σ(lineSumList);\r\n\t\t\r\n\t\tif (sum == 0 || array.length == 0)\r\n\t\t\treturn 0;\r\n\t\treturn sum / count;\r\n\t}", "public static double getAverage(double[] dataArray) {\n\t\t\n\t\tdouble average = 0.0;\n\t\t\n\t\tfor (int i = 0; i <dataArray.length; i++) {\n\t\t\taverage += dataArray[i];\n\t\t}\n\t\t\n\t\taverage = average/dataArray.length;\n\t\t\n\t\treturn average;\n\t}", "private Double getMean(Double[] values) {\n double sum = 0;\n int count = 0;\n for (Double d: values) {\n if (d != null) {\n sum += d;\n ++count;\n }\n }\n return count == 0 ? null : (sum / count);\n }", "public double average(double alternative) {\n int cnt = 0;\n double sum = 0.0;\n\n // Compute the average of all values\n for (Number number : this) {\n if (number == null) continue;\n if (Double.isNaN(number.doubleValue())) continue;\n\n sum += number.doubleValue();\n cnt++;\n }\n\n // If we haven't had any element, return 0\n if (cnt == 0) return alternative;\n return sum / cnt;\n }", "public int avgTrafficPerDay(){\r\n \r\n int trav=apstate.gettravellers();\r\n\t\tint days=apstate.getdays();\r\n\t\tint items=apstate.getitems();\r\n \r\n int avg_traffic_per_day=trav/days;\r\n \r\n return avg_traffic_per_day;\r\n }", "double avg(){\n\t\tdouble sum = 0.0;\n\t\tfor(int i=0;i<num.length;i++)\n\t\t\tsum+=num[i].doubleValue();\n\t\treturn sum/num.length;\n\t}", "public static double arrayAverage(double[] array, double arraySize) {\r\n double averages = 0;\r\n for (int x = 0; x < arraySize; x++) {\r\n averages += array[x];\r\n }\r\n averages = (averages / arraySize);\r\n return averages;\r\n }", "public double mean()\n {\n return StdStats.mean(open);\n// return StdStats.sum(open) / count;\n }", "public static double getAverage(double[] array)\r\n\t{\r\n\t\tdouble sum = Σ(array);\r\n\r\n\t\tif (sum == 0 || array.length == 0)\r\n\t\t\treturn 0;\r\n\t\treturn sum / array.length;\r\n\t}", "public static int average(int[]data){\n \n int sum = 0;\n int n = 0;\n for(int i = 0; i < data.length-1; i++) {\n \n n++;\n sum += data[i];\n }\n\n return sum/n;\n }", "public double calcAvg() {\n\t\treturn (double)calcSum() / data.size();\n }", "public double average()\n\t{\n\t\tif (arraySize > 0)\n\t\t{\n\t\t\tdouble sum = this.sum();\n\t\t\treturn sum / arraySize;\n\t\t}\n\t\tSystem.out.println(\"Syntax error, array is empty.\");\n\t\treturn -1;\n\t}", "public static float getMean(float[] weatherArray){\n float mean = getTotal(weatherArray)/weatherArray.length;\n return mean;\n }", "private double getAvg() {\n\n double sum = 0;\n\n for (Map.Entry<Integer, Double> entry : values.entrySet()) {\n sum += entry.getValue();\n }\n\n if (values.size() > 0) {\n return sum / values.size();\n } else {\n throw new IllegalStateException(\"no values\");\n }\n }", "Execution getAverageExecutions();", "public static double average(int[] theArray) {\n\n double answer;\n double sum = IntegerArrays.sum(theArray);\n answer = sum / theArray.length;\n\n return answer;\n\n }", "public double getAverageDuration(){\r\n\t\t double sum=0;\r\n\t\t for(int a=0; a<populationSize();a++) {\r\n\t\t\t sum+=getTour(a).getDuration();\r\n\t\t }\r\n\t\t sum=sum/populationSize();\r\n\t\t return sum;\r\n\t }", "double average() { // used double b/c I want decimal places\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tsum = sum + array[i];\n\t\t}\n\t\tdouble average = (double) sum / array.length;\n\t\treturn average;\n\n\t}", "public static double average(int[] array) {\n\t\tif (array.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tdouble avg = 0;\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tavg += array[i];\n\t\t}\n\t\treturn avg / array.length;\n\t}", "public static double getAverage(int[] array) throws IOException {\r\n double arrayAverage = 0;\r\n arrayAverage = arrayTotal(array) / array.length;\r\n\r\n return arrayAverage;\r\n\r\n }", "public void calculateAverage() {\n\n if (turn == 1) {\n p1.setTotalScore(p1.getTotalScore() + turnScore);\n\n p1.setTotalDarts(p1.getTotalDarts() + 1);\n\n float p1Average = p1.getTotalScore() / p1.getTotalDarts();\n p1.setAverage(p1Average);\n\n } else if (turn == 2) {\n p2.setTotalDarts(p2.getTotalDarts() + 1);\n p2.setTotalScore(p2.getTotalScore() + turnScore);\n\n float p2Average = p2.getTotalScore() / p2.getTotalDarts();\n p2.setAverage(p2Average);\n }\n\n\n }", "public static double getAvg(String line){\n\t\tString[] parts = line.split(\"\\t\");\n\t\tdouble gamesPlayed = (Integer.parseInt(parts[1])) + (Integer.parseInt(parts[2]));\n\t\tdouble avg = (Integer.parseInt(parts[1])) / gamesPlayed;\n\t\treturn avg;\n\t}", "public static double getAverage(Number[] array)\r\n\t{\r\n\t\tdouble sum = Σ(array);\r\n\r\n\t\tif (sum == 0 || array.length == 0)\r\n\t\t\treturn 0;\r\n\t\treturn sum / array.length;\r\n\t}", "public double findSla_averageByMonthAndId(Integer year, Integer month, Integer sla_id) {\n\t\tString query = \"select avg(passed_record) from ops.sla_transaction where year(date)=:year and month(date)=:month and sla_id=:sla_id\";\n\t\tSQLQuery sql = getSession().createSQLQuery(query);\n\t\tsql.setParameter(\"year\", year);\n\t\tsql.setParameter(\"month\", month);\n\t\tsql.setParameter(\"sla_id\", sla_id);\t\t\n\t\t\n\t\tDouble tempAvegSla = (Double) sql.uniqueResult();\n\t\t\n\t\treturn tempAvegSla;\n\t}", "public void average(){\n\t\tfor(PlayerWealthDataAccumulator w : _wealthData.values()){\n\t\t\tw.average();\n\t\t}\n\t}", "public double mean() {\n double total = 0;\n for (int i = 0; i < sites.length; i++) {\n total += sites[i];\n }\n sampleMean = total / size / times;\n return sampleMean;\n }", "public double MACD(int slow, int fast, int t)\n {\n if(slow<=fast)\n throw new IndexOutOfBoundsException(\"MACD(\" + slow + \" - \" +\n fast + \") is undefined at time \" + t);\n return expMovingAverage(slow, t) - expMovingAverage(fast, t);\n }", "public double getAverage(){\n double total = 0;\n for(double s : scores)total += s;\n return total/scores.length;\n }", "public static double meanOf(Iterator<? extends Number> values) {\n/* 407 */ Preconditions.checkArgument(values.hasNext());\n/* 408 */ long count = 1L;\n/* 409 */ double mean = ((Number)values.next()).doubleValue();\n/* 410 */ while (values.hasNext()) {\n/* 411 */ double value = ((Number)values.next()).doubleValue();\n/* 412 */ count++;\n/* 413 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 415 */ mean += (value - mean) / count; continue;\n/* */ } \n/* 417 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ \n/* 420 */ return mean;\n/* */ }", "public void average() {\n\t\tif (averaged)\n\t\t\tthrow new AssertionError(\"can't average twice!!\");\n\t\t\n\t\tscale = 1.0/(double)t;\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (t+1.0)*w[i] - wupdates[i];\n\t\t\n\t\taveraged = true;\n\t\n\t}", "static double averageDoubleArray(double[] inputArray) {\n\t\tdouble doubleSum = 00.00;\n\t\tfor (double element : inputArray) { \n\t\t\tdoubleSum += element;\n\t\t}\n\t\tdouble average = doubleSum / inputArray.length; \n\t\treturn average;\n\t}", "public synchronized double getAverage() {\n return average;\n }", "public double cariMean(int[] mean) {\n\t\tint n = mean.length;\n\t\tdouble mea = 0.0;\n\t\tdouble jumlah = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tjumlah = jumlah + mean[i];\n\t\t}\n\t\tmea = jumlah / n;\n\t\treturn mea;\n\t}", "private static double countAverageRun(Runner sportsman) {\n double result = 0;\n for (int i = 0; i < sportsman.getNumberOfRuns(); i++) {\n result += sportsman.getDefiniteRunStat(i);\n }\n\n return result / sportsman.getNumberOfRuns();\n }", "public double mean() {\n return StdStats.mean(openSites) / times;\n }", "public static double calculateAverage (Scanner read){\n int sum = 0;\n int num;\n while(read.hasNextInt()){\n num = read.nextInt();\n sum += num;\n }\n \n return sum/5.0;\n }", "public static double meanVal(int[] sample){\n double total = 0;\n for (int i = 0; i < sample.length; i++){\n total = total + sample[i];\n }\n double mean = total/sample.length;\n return mean;\n }", "@Override\n public int[][] getStreakForMonth(CalendarDayModel day) {\n if (day.getMonth() == 7) {\n return streaks;\n }\n return new int[0][];\n }", "double computeMAE(int paraK) {\n\t\tdouble tempMae = 0;\n\t\tint tempTotalCount = 0;\n\t\t// Step 1. Predict the distribution\n\t\tfor (int i = 0; i < dataModel.uTeRateInds.length; i++) {\n\t\t\tfor (int j = 0; j < dataModel.uTeRateInds[i].length; j++) {\n\t\t\t\tint[] tempDistribution = predict(i, dataModel.uTeRateInds[i][j], paraK);\n\t\t\t\tif (tempDistribution == null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} // Of if\n\n\t\t\t\tdouble tempPrediction = 0;\n\t\t\t\tint tempCount = 0;\n\t\t\t\tfor (int k = 0; k < tempDistribution.length; k++) {\n\t\t\t\t\ttempPrediction += tempDistribution[k] * (k + 1);\n\t\t\t\t\ttempCount += tempDistribution[k];\n\t\t\t\t} // Of for k\n\t\t\t\ttempPrediction /= tempCount;\n\n\t\t\t\ttempMae += Math.abs(tempPrediction - dataModel.uTeRatings[i][j]);\n\t\t\t\ttempTotalCount++;\n\t\t\t} // of for\n\t\t} // of for i\n\n\t\tif (tempTotalCount > 1e-6) {\n\t\t\ttempMae /= tempTotalCount;\n\t\t} // of\n\n\t\treturn tempMae;\n\t}", "public void calcAvg(){\n\t\taverage = hits/atbat;\n\t\t\n\t}" ]
[ "0.6104358", "0.6029362", "0.5758788", "0.5700185", "0.56716883", "0.5554278", "0.5480909", "0.53541315", "0.53469783", "0.5338232", "0.5322921", "0.51918405", "0.5174072", "0.51092106", "0.49829495", "0.4951872", "0.49417424", "0.49314085", "0.48986727", "0.4876008", "0.4874314", "0.48491374", "0.48340732", "0.48122498", "0.4811792", "0.48105845", "0.47793886", "0.47763678", "0.4776004", "0.47570932", "0.47492695", "0.47491744", "0.47455147", "0.47352558", "0.47264904", "0.47210047", "0.47194114", "0.47185272", "0.46958753", "0.4694738", "0.4692315", "0.46904016", "0.46849152", "0.46778497", "0.46774712", "0.46718898", "0.4671279", "0.46682474", "0.46677533", "0.46550444", "0.46491987", "0.46432558", "0.46412584", "0.4634538", "0.4634536", "0.46254933", "0.4622875", "0.4622218", "0.46197024", "0.46169165", "0.4616681", "0.45943558", "0.458862", "0.4581178", "0.45781347", "0.45721146", "0.45717984", "0.45706004", "0.45661038", "0.45612398", "0.45533216", "0.4552257", "0.45445615", "0.45428064", "0.45359755", "0.45352462", "0.45338225", "0.45286804", "0.45285624", "0.4524055", "0.45074126", "0.4499684", "0.44933197", "0.44914967", "0.44894618", "0.44850516", "0.4480862", "0.44807652", "0.447942", "0.44696486", "0.44682422", "0.44622308", "0.44577834", "0.4453879", "0.44354784", "0.44342044", "0.4427792", "0.4422805", "0.44123164", "0.44120783" ]
0.5698314
4
Return an exponential moving average for the series for the given day. The nday exponential moving average, EMA(n), is a very popular delay technical indicator.
public double expMovingAverage(int periods, int t) { if(periods<1) throw new IndexOutOfBoundsException("EMA(" + periods + ") is undefined at time " + t); double alpha = 2.0/(periods + 1); double ema = 0.0; for(int i = 0; i<=t; i++) ema += alpha*(x[i] - ema); return ema; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double averageSteps() {\n if (day==0) return 0;\n return (double) totalSteps / day;}", "private static double calculateMovingAverage(JsArrayNumber history) {\n double[] vals = new double[history.length()];\n long size = history.length();\n double sum = 0.0;\n double mSum = 0.0;\n long mCount = 0;\n\n // Check for sufficient data\n if (size >= 8) {\n // Clone the array and Calculate sum of the values\n for (int i = 0; i < size; i++) {\n vals[i] = history.get(i);\n sum += vals[i];\n }\n double mean = sum / size;\n\n // Calculate variance for the set\n double varianceTemp = 0.0;\n for (int i = 0; i < size; i++) {\n varianceTemp += Math.pow(vals[i] - mean, 2);\n }\n double variance = varianceTemp / size;\n double standardDev = Math.sqrt(variance);\n\n // Standardize the Data\n for (int i = 0; i < size; i++) {\n vals[i] = (vals[i] - mean) / standardDev;\n }\n\n // Calculate the average excluding outliers\n double deviationRange = 2.0;\n\n for (int i = 0; i < size; i++) {\n if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {\n mCount++;\n mSum += history.get(i);\n }\n }\n\n } else {\n // Calculate the average (not enough data points to remove outliers)\n mCount = size;\n for (int i = 0; i < size; i++) {\n mSum += history.get(i);\n }\n }\n\n return mSum / mCount;\n }", "@Test\n\tpublic void MovingAverage() {\n\t\tList<Double> high = new ArrayList<Double>();\n\t\t// high = highPriceList();\n\t\tfor (Double data2 : high) {\n\t\t\tSystem.out.println(data2);\n\t\t}\n\t\t// double[] testData = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 };\n\t\tint[] windowSizes = { 3 };\n\n\t\tfor (int windSize : windowSizes) {\n\t\t\tStock_data_controller ma = new Stock_data_controller();\n\t\t\tma.Stock_controller(windSize);\n\t\t\tfor (double x : high) {\n\t\t\t\tma.newNum(x);\n\t\t\t\tSystem.out.println(\"Next number = \" + x + \", SimpleMovingAvg = \" + ma.getAvg());\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public Experiment getExp(int day, int index){ // istenen gun ve index de ki elemani getir.\r\n Node temp = head;\r\n int i = 0;\r\n Experiment ret = new Experiment();\r\n while( temp.next != null){\r\n while( temp.data.day == day ){ // gun bilgisi oldugu surece don\r\n if( i == index){ // index e gelince elemani dondur\r\n ret = temp.data;\r\n return ret;\r\n }\r\n i++;\r\n temp = temp.next;\r\n }\r\n temp = temp.nextDay;\r\n }\r\n return ret;\r\n }", "private Double[] getDayValue24(DayEM dayEm) {\n\n\t Double[] dayValues = new Double[24];\n\n\t /* OPF-610 정규화 관련 처리로 인한 주석\n\t dayValues[0] = (dayEm.getValue_00() == null ? 0 : dayEm.getValue_00());\n\t dayValues[1] = (dayEm.getValue_01() == null ? 0 : dayEm.getValue_01());\n\t dayValues[2] = (dayEm.getValue_02() == null ? 0 : dayEm.getValue_02());\n\t dayValues[3] = (dayEm.getValue_03() == null ? 0 : dayEm.getValue_03());\n\t dayValues[4] = (dayEm.getValue_04() == null ? 0 : dayEm.getValue_04());\n\t dayValues[5] = (dayEm.getValue_05() == null ? 0 : dayEm.getValue_05());\n\t dayValues[6] = (dayEm.getValue_06() == null ? 0 : dayEm.getValue_06());\n\t dayValues[7] = (dayEm.getValue_07() == null ? 0 : dayEm.getValue_07());\n\t dayValues[8] = (dayEm.getValue_08() == null ? 0 : dayEm.getValue_08());\n\t dayValues[9] = (dayEm.getValue_09() == null ? 0 : dayEm.getValue_09());\n\t dayValues[10] = (dayEm.getValue_10() == null ? 0 : dayEm.getValue_10());\n\t dayValues[11] = (dayEm.getValue_11() == null ? 0 : dayEm.getValue_11());\n\t dayValues[12] = (dayEm.getValue_12() == null ? 0 : dayEm.getValue_12());\n\t dayValues[13] = (dayEm.getValue_13() == null ? 0 : dayEm.getValue_13());\n\t dayValues[14] = (dayEm.getValue_14() == null ? 0 : dayEm.getValue_14());\n\t dayValues[15] = (dayEm.getValue_15() == null ? 0 : dayEm.getValue_15());\n\t dayValues[16] = (dayEm.getValue_16() == null ? 0 : dayEm.getValue_16());\n\t dayValues[17] = (dayEm.getValue_17() == null ? 0 : dayEm.getValue_17());\n\t dayValues[18] = (dayEm.getValue_18() == null ? 0 : dayEm.getValue_18());\n\t dayValues[19] = (dayEm.getValue_19() == null ? 0 : dayEm.getValue_19());\n\t dayValues[20] = (dayEm.getValue_20() == null ? 0 : dayEm.getValue_20());\n\t dayValues[21] = (dayEm.getValue_21() == null ? 0 : dayEm.getValue_21());\n\t dayValues[22] = (dayEm.getValue_22() == null ? 0 : dayEm.getValue_22());\n\t dayValues[23] = (dayEm.getValue_23() == null ? 0 : dayEm.getValue_23());\n\t\t\t*/\n\t \n\t return dayValues;\n\t }", "public double movingAverage(int periods, int t)\n {\n if(periods>t + 1 || periods<1)\n throw new IndexOutOfBoundsException(\"MA(\" + periods + \") is undefined at time \" + t);\n double sum = 0.0;\n for(int i = t - periods + 1; i<=t; i++)\n sum += x[i];\n return sum/periods;\n }", "static double expon(double mean) {\n return -mean * Math.log(Math.random());\n }", "public double average(){\r\n\t\t//create variable to hold the values\r\n\t\tdouble average = 0;\r\n\t\t\r\n\t\tfor (int i = 0; i < this.data.length; i++){\r\n\t\t\t//add current index\r\n\t\t\taverage += this.data[i];\r\n\t\t\t}\r\n\t\treturn (average/this.data.length);\r\n\t}", "public MovingAverage(int size) {\r\n this.size = size;\r\n }", "public Series removeDelayedTrend(int depth)\n {\n if(depth<1 || depth>=size)\n throw new IndexOutOfBoundsException();\n Series oscillator = new Series();\n oscillator.x = new double[oscillator.size = size - depth];\n if(oscillator.size>1)\n oscillator.r = new double[oscillator.size - 1];\n for(int t = 0; t<oscillator.size; t++)\n {\n oscillator.x[t] = x[t + depth] - movingAverage(depth, t + depth);\n if(t>0)\n oscillator.r[t - 1] = Math.log(oscillator.x[t]/oscillator.x[t - 1]);\n }\n return oscillator;\n }", "private float calculateMean()\n { \n int numberEmployees = employees.size();\n float total = 0, meanGrossPay = 0;\n // Create an array of all gross pays\n float[] allGrossPay = new float[numberEmployees];\n \n // Call method to return an array of float containing all gross pays\n allGrossPay = calculateAllGrossPay();\n // Find total gross pay\n for (int i = 0; i < numberEmployees; i++)\n {\n total += allGrossPay[i];\n }\n // Find mean and return it\n if (numberEmployees > 0)\n {\n meanGrossPay = total/numberEmployees;\n \n }\n return meanGrossPay;\n }", "private double calculateFeesEarnedEachDayOfWeek(ArrayList<Pair<Fees, Time>> timeslots, DayOfWeek day) {\n return daysOfWeek[day.ordinal()] * timeslots.stream()\n .filter(p -> convertDayOfWeek(p.getValue().getDay()).equals(day))\n .mapToDouble(p -> p.getValue().getTuitionHours() * p.getKey().getFeesValue())\n .sum();\n }", "public double averageDayDriveDistance(String day)\n\t{\n\t\tint dayCount = 0; //total days run through\n\t\tString currentDate = \"\";\n\t\tdouble totalDistance = 0;\n\t\tfor(int i = 0; i < saveData.size(); i++)\n\t\t{\n\t\t\t//figures out the number of days, then averages the total by that number\n\t\t\tif(day.equals(saveData.get(i).get(\"day\")))\n\t\t\t{\n\t\t\t\tif(currentDate.equals(\"\"))\n\t\t\t\t{\n\t\t\t\t\t//if there is no current date, we must have just started; set the variable\n\t\t\t\t\tcurrentDate = saveData.get(i).get(\"date\"); //.get(\"date\") to be replaced\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t\telse if(currentDate.equals(saveData.get(i).get(\"date\")))\n\t\t\t\t{\n\t\t\t\t\t//it's the same date, so add this distance to the total distance\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//it's a different date, so set the currentDate to this one,\n\t\t\t\t\t//increment the days counter;\n\t\t\t\t\tcurrentDate = saveData.get(i).get(\"date\");\n\t\t\t\t\tdayCount++;\n\t\t\t\t\t//add this drive to the total distance\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t//after all the indexes of saveData have been run through\n\t\t//clean up by increment the days counter\n\t\tdayCount++;\n\t\t//get the average by dividing the total distance by the days\n\t\tdouble averageDistancePerDay = this.totalDriveDistance()/dayCount;\n\t}", "@Test\r\n\tpublic void exerciseMovingAverage() {\n\t\tList<Integer> temparaturArray = Arrays.asList(8, 7, 6, 6, 7, 7, 8, 10, 13, 16, 10, 20, 23, 26, 30, 29, 27, 45, 24, 23, 20, 18, 15, 11);\r\n\t\tObservable<Integer> temparaturSequence = Observable\r\n\t\t\t\t.interval(0, 1L, TimeUnit.HOURS, testScheduler)\r\n\t\t\t\t.take(temparaturArray.size())\r\n\t\t\t\t.map(i -> temparaturArray.get(i.intValue()));\r\n\t\t\r\n\t\t// TODO: calculate the moving average (SMA) of the given temperature sequence (each hour of a single day).\r\n\t\t// use the previous three values for each data point.\r\n // HINT: use a suitable overload of the same method used in \"Batching\"\r\n // and then calculate the average of each batch using LINQ\r\n // HINT: don't forget to pass the scheduler\r\n\t\tObservable<Double> movingAverage = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<Double> testSubscriber = new TestSubscriber<>();\r\n\t\tmovingAverage.subscribe(testSubscriber);\r\n\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(1, TimeUnit.DAYS);\r\n\t\t\r\n\t\tlog(testSubscriber.getOnNextEvents());\r\n\t\t\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\t\r\n\t\t// expected values:\r\n\t\tList<Double> expected = Arrays.asList(\r\n\t\t\t\t7.0, 6.333333333333333, 6.333333333333333, 6.666666666666667, 7.333333333333333, \r\n\t\t\t\t8.333333333333334, 10.333333333333334, 13.0, 13.0, 15.333333333333334, \r\n\t\t\t\t17.666666666666668, 23.0, 26.333333333333332, 28.333333333333332, \r\n\t\t\t\t28.666666666666668, 33.666666666666664, 32.0, 30.666666666666668, \r\n\t\t\t\t22.333333333333332, 20.333333333333332, 17.666666666666668, 14.666666666666666, \r\n\t\t\t\t// the last two values have limited input, i.e.\r\n\t\t\t\t// (15+11)/2 and (11)/1\r\n\t\t\t\t13.0, 11.0);\r\n\t\ttestSubscriber.assertReceivedOnNext(expected);\r\n\t\t\r\n\t}", "public MovingAverage(int size) {\n value = new int[size];\n }", "double getYesterdaysExpenditureAmount() {\n Long time = new Date().getTime();\n Date date = new Date(time - time % (DAY_DURATION));\n return getExpenditureAmount(date.getTime() - DAY_DURATION, date.getTime());\n }", "public void findEasterDay()\n {\n while(year <= endYear)\n {\n EasterMath(year);\n for(int j = 0; j < 11; j++)\n {\n for(int k = 0; k < 30; k++)\n {\n if(month == j && day == k)\n {\n dates[j][k]++;\n }\n }\n }\n year++;\n }\n }", "double average();", "public Double getTempAvgDaily() {\r\n\t\treturn tempAvgDaily;\r\n\t}", "static double average(double[] data){\n\n // Initializing total placeholder \n double total = 0;\n\n // Traversing data array and adding to total sum\n for (double d : data) {\n total += d;\n }\n\n // Computing average\n double average = (double) total / data.length;\n\n return average;\n }", "protected static float[] computeMovingAverage(float[] values, int np) {\n\t\tfloat[] mm = new float[values.length - np];\n\t\tfor (int i = 0; i < mm.length; i++) {\n\t\t\tfloat sum = 0;\n\t\t\tfor (int j = 0; j < np; j++) {\n\t\t\t\tsum = sum + values[i + j];\n\t\t\t}\n\t\t\tmm[i] = sum / np;\n\t\t}\n\t\treturn mm;\n\t}", "@Test\n\tpublic void averageWorksForModeSteps() {\n\t\tfinal FloatTimeSeries t0 = new FloatTreeTimeSeries();\n\t\tt0.addValues(TimeSeriesUtils.createStepFunction(10, 0, 10, 10, 0)); // constant function = 10\n\t\tfinal FloatTimeSeries t1 = new FloatTreeTimeSeries();\n\t\tt1.addValues(TimeSeriesUtils.createStepFunction(5, 20, 25, 20, 0)); // constant function = 20\n\t\tt0.setInterpolationMode(InterpolationMode.STEPS);\n\t\tt1.setInterpolationMode(InterpolationMode.STEPS);\n\t\tfinal ReadOnlyTimeSeries avg = MultiTimeSeriesUtils.getAverageTimeSeries(Arrays.<ReadOnlyTimeSeries> asList(t0, t1), 0, Long.MAX_VALUE, true, null, false);\n\t\t// one data point outside time range, one boundary value should be added\n\t\tAssert.assertEquals(\"Time series sum has wrong number of data points\", 13, avg.size());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 10, avg.getValue(7).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(23).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(100).getValue().getIntegerValue());\n\t}", "private double calculateAverage(Candle[] cd) {\n double sum = 0; \r\n for(Candle c : cd) {\r\n sum += c.getClose();\r\n }\r\n return sum/cd.length;\r\n \r\n }", "private void PeriodMeanEvaluation () {\n\n float x = 0;\n for(int i = 0; i < 3; i++)\n {\n for(int j = 0; j < numberOfSample; j++)\n {\n x = x + singleFrame[j][i];\n }\n meanOfPeriodCoord[i] = (x/numberOfSample);\n x = 0;\n }\n }", "public double getElevationData(String date){\n\t\tJSONArray array = new JSONArray(elevHistory);\n\t\tfor(int i = 0; i<array.length();i++){\n\t\t\tJSONObject json = array.getJSONObject(i);\n\t\t\tif(json.get(\"dateTime\").equals(date))\n\t\t\t\treturn Double.parseDouble(json.get(\"value\").toString());\n\t\t}\n\t\treturn -1;\n\t}", "public static double average(double[] array){\n double sum = 0;\n for (int i = 0; i < array.length; i++) {\n sum += array[i];\n }\n return sum/array.length;\n }", "public TimeDecayingAverage(double phi, double average) {\n setPhi(phi);\n this.average = average;\n }", "public static void calculateAverage(double[] inputArray, int limit)\r\n\t{\r\n\t\tIMovingAverage<Double> movingAvg = new MovingAverageImpl<Double>(limit);\r\n\t\tfor(double element : inputArray)\r\n\t\t{\r\n\t\t\tmovingAvg.add(element);\r\n\t\t\tSystem.out.println(\"Moving average is = \" +movingAvg.getAverage());\r\n\t\t}\r\n\t\tSystem.out.println(\"*********************************************************\");\r\n\t}", "public double getMean() \r\n\t{\r\n\t\tlong tmp = lastSampleTime - firstSampleTime;\r\n\t\treturn ( tmp > 0 ? sumPowerOne / (double) tmp : 0);\r\n\t}", "public double MACDSignal(int t)\n {\n Series macd = new Series();\n macd.x = new double[macd.size = t + 1];\n for(int i = 0; i<=t; i++)\n macd.x[i] = MACD(i);\n return macd.expMovingAverage(9, t);\n }", "double average() { // used double b/c I want decimal places\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tsum = sum + array[i];\n\t\t}\n\t\tdouble average = (double) sum / array.length;\n\t\treturn average;\n\n\t}", "public static double rollingAvg(double value, double newEntry, double n, double weighting ) {\r\n return (value * n + newEntry * weighting)/(n + weighting);\r\n }", "static double userOnDay(final float rate, final int day) {\n return Math.pow(rate, day);\n }", "Execution getAverageExecutions();", "@DISPID(62)\r\n\t// = 0x3e. The runtime will prefer the VTID if present\r\n\t@VTID(60)\r\n\tint averageRunTime_Days();", "public double computeE(double temperature) throws Exception {\n int index = findPolynomial(temperature);\n if (index!=BadIndex) {\n double data = polynomials[index].compute(temperature);\n\n double correction = 0.0;\n if (exponential!=null && temperature>0) {\n // according to the function definition from NIST,\n // the exponential term is available only for type K when temperature > 0\n // Reference http://srdata.nist.gov/its90/download/download.html\n correction = exponential.compute(temperature);\n }\n return data + correction;\n }\n else {\n throw new Exception(getInputOutOrRangeMessage(temperature));\n }\n }", "public double average(double alternative) {\n int cnt = 0;\n double sum = 0.0;\n\n // Compute the average of all values\n for (Number number : this) {\n if (number == null) continue;\n if (Double.isNaN(number.doubleValue())) continue;\n\n sum += number.doubleValue();\n cnt++;\n }\n\n // If we haven't had any element, return 0\n if (cnt == 0) return alternative;\n return sum / cnt;\n }", "public static double avg(double[] array) {\r\n\t\tdouble ret = sum(array);\r\n\t\treturn ret / array.length;\r\n\t}", "public float calculateAverageHigh() {\n\t\t\n\t\tfloat sum = 0;\n\t\tfor (int i=0; i<temps.length; i++)\n\t\t\tsum += temps[i][0];\n\t\treturn sum /= temps.length;\n\t\t\n\t}", "public static double getAverage(double[] array)\r\n\t{\r\n\t\tdouble sum = Σ(array);\r\n\r\n\t\tif (sum == 0 || array.length == 0)\r\n\t\t\treturn 0;\r\n\t\treturn sum / array.length;\r\n\t}", "double computeMAE(int paraK) {\n\t\tdouble tempMae = 0;\n\t\tint tempTotalCount = 0;\n\t\t// Step 1. Predict the distribution\n\t\tfor (int i = 0; i < dataModel.uTeRateInds.length; i++) {\n\t\t\tfor (int j = 0; j < dataModel.uTeRateInds[i].length; j++) {\n\t\t\t\tint[] tempDistribution = predict(i, dataModel.uTeRateInds[i][j], paraK);\n\t\t\t\tif (tempDistribution == null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} // Of if\n\n\t\t\t\tdouble tempPrediction = 0;\n\t\t\t\tint tempCount = 0;\n\t\t\t\tfor (int k = 0; k < tempDistribution.length; k++) {\n\t\t\t\t\ttempPrediction += tempDistribution[k] * (k + 1);\n\t\t\t\t\ttempCount += tempDistribution[k];\n\t\t\t\t} // Of for k\n\t\t\t\ttempPrediction /= tempCount;\n\n\t\t\t\ttempMae += Math.abs(tempPrediction - dataModel.uTeRatings[i][j]);\n\t\t\t\ttempTotalCount++;\n\t\t\t} // of for\n\t\t} // of for i\n\n\t\tif (tempTotalCount > 1e-6) {\n\t\t\ttempMae /= tempTotalCount;\n\t\t} // of\n\n\t\treturn tempMae;\n\t}", "public double average() {\n return average(0.0);\n }", "public static double averageOfNumbers(int n) {\n Scanner keyedInput = new Scanner(System.in);\n\n double total = 0;\n double[] values = new double[n];\n\n System.out.println(\"Please enter your values:\");\n for (int i = 0; i < n; i = i + 1) {\n values[i] = keyedInput.nextDouble();\n total = total + values[i];\n }\n double a = (double) Math.round((total / n) * 100) / 100;\n return a;\n }", "public double average(){\n double avg = 0;\n double sum = 0;\n for (T t : arr) {\n // sum += t.doubleValue();\n }\n\n return sum / arr.length;\n }", "public static double[] berekenDagOmzet(double[] omzet) {\n double[] temp = new double[DAYS_IN_WEEK];\n \n for(int i = 0; i < DAYS_IN_WEEK; i++) {\n\n int j = 0;\n int counter = 0;\n while( omzet.length > (i + DAYS_IN_WEEK * j) ) {\n temp[i] += omzet[i + DAYS_IN_WEEK * j];\n \n j++;\n counter++;\n }\n temp[i] = temp[i] / counter;\n }\n return temp;\n }", "public Double computeAverage(){\n\t\tdouble total = 0; //double used to keep total value of elements in arr to determine average\n\t\t\n\t\tfor(int i = 0; i < arr.length; i++)//loop through array and add the total\n\t\t{\n\t\t\ttotal += arr[i].doubleValue(); //add current value of element in arr to total's value\n\t\t}\n\t\t\n\t\tDouble result = total/arr.length; //returns the average as a Double\n\t\t\n\t\treturn result;\n\t}", "public double getAvg(){\n double avg=0;\n for(int x=0; x<max; x++){\n avg=avg+times[x];\n }\n avg=avg/max;\n return avg;\n }", "public static double getAverage(Number[] array)\r\n\t{\r\n\t\tdouble sum = Σ(array);\r\n\r\n\t\tif (sum == 0 || array.length == 0)\r\n\t\t\treturn 0;\r\n\t\treturn sum / array.length;\r\n\t}", "double avg(){\n\t\tdouble sum = 0.0;\n\t\tfor(int i=0;i<num.length;i++)\n\t\t\tsum+=num[i].doubleValue();\n\t\treturn sum/num.length;\n\t}", "public double averageOfArray() {\n double sum = 0;\n double average = 0;\n int i;\n for (i = 0; i < sirDeLa1La100.length; i++) {\n sum = sum + sirDeLa1La100[i];\n }\n average = sum / sirDeLa1La100.length;\n return average;\n }", "double getMeanPrice() {\n List<Double> allPrices = new ArrayList<>();\n\n for (Firm firm : firms) {\n List<Double> pricesOfFirm = firm.getPrices();\n allPrices.addAll(pricesOfFirm.subList(pricesOfFirm.size() - SimulationManager.sizeOfExaminationInterval, pricesOfFirm.size()));\n }\n\n return Calculation.round(Calculation.getMean(allPrices), 2);\n }", "public static double arrayAverage(double[] array, double arraySize) {\r\n double averages = 0;\r\n for (int x = 0; x < arraySize; x++) {\r\n averages += array[x];\r\n }\r\n averages = (averages / arraySize);\r\n return averages;\r\n }", "public double arithmeticalMean(double[] arr) {\n return 0;\n }", "@WebMethod(operationName = \"average-increase-by-days\")\n String getAverageInc(@WebParam(name = \"days\") int days) throws JsonProcessingException;", "public MovingAveragefromDataStream(int size) {\n this.size = size;\n }", "public static float[] returnMeanArray (float[] weatherArray){\n float[] meanArray = new float[12];\n for (int i = 0; i < 12; i++){\n meanArray[i] = weatherArray[i]/30;\n }\n return meanArray;\n }", "double average(double[] doubles) {\n double total = 0.0;\n //int count = 0;\n for (double d: doubles) {\n total = total + d;\n //count = count + 1;\n }\n //return total / count;\n return total / doubles.length;\n }", "public double getMean() {\n double timeWeightedSum = 0;\n\n for (int i = 0; i < accumulate.size() - 1; i++) {\n timeWeightedSum += accumulate.get(i).value\n * (accumulate.get(i + 1).timeOfChange\n - accumulate.get(i).timeOfChange);\n\n }\n LOG_HANDLER.logger.finer(\"timeWeightedSum Value: \" + timeWeightedSum\n + \"totalOfQuueueEntries: \" + totalOfQueueEntries);\n return timeWeightedSum / totalOfQueueEntries;\n }", "public static double getAverage(int start, double[] d) {\n double average = 0;\n for (int i = 0; i < 110; i++) {\n average = average + d[i];\n }\n return average / 110;\n }", "static final float interp_energy(final float prev_e, final float next_e)\n\t{\n\t\treturn (float)Math.pow( 10.0, (Math.log10( prev_e ) + Math.log10( next_e )) / 2.0 );\n\t}", "public static double getAverage(double[][] array)\r\n\t{\r\n\t\tint count = 0;\r\n\t\tList<Double> lineSumList = new ArrayList<Double>();\r\n\t\tfor( int i = 0; i < array.length; i++ ) {\r\n\t\t\tdouble lineSum = Σ(array[i]);\r\n\t\t\tlineSumList.add(lineSum);\r\n\t\t\tcount += array[i].length;\r\n\t\t}\r\n\t\tdouble sum = Σ(lineSumList);\r\n\t\t\r\n\t\tif (sum == 0 || array.length == 0)\r\n\t\t\treturn 0;\r\n\t\treturn sum / count;\r\n\t}", "public static double average(double[] employeeSalaries) {\n\t\t double total=0;int month=0;\n\t\t for(int i=0;i<employeeSalaries.length;i++) {\n\t\t\t if (employeeSalaries[i]>0) {\n\t\t\t\t total+=employeeSalaries[i];\n\t\t\t\t month++;\n\t\t\t }\n\t\t\t }\n\t\t if (total==0) {\n\t\t\t throw new IllegalArgumentException(\"all values in the employeeSalaries array are zero.\");\n\t\t }\n\treturn total/month;\n\t}", "static double averageDoubleArray(double[] inputArray) {\n\t\tdouble doubleSum = 00.00;\n\t\tfor (double element : inputArray) { \n\t\t\tdoubleSum += element;\n\t\t}\n\t\tdouble average = doubleSum / inputArray.length; \n\t\treturn average;\n\t}", "public double getMean(){\n\t\treturn Math.exp(location + scale * scale / 2);\n\t}", "public void setTempAvgDaily(Double tempAvgDaily) {\r\n\t\tthis.tempAvgDaily = tempAvgDaily;\r\n\t}", "public double getAverage(){\n return getTotal()/array.length;\n }", "@Test\n\tpublic void averageWorksForModeNone() {\n\t\tfinal FloatTimeSeries t0 = new FloatTreeTimeSeries();\n\t\tt0.addValues(TimeSeriesUtils.createStepFunction(10, 0, 10, 10, 0)); // constant function = 10\n\t\tfinal FloatTimeSeries t1 = new FloatTreeTimeSeries();\n\t\tt1.addValues(TimeSeriesUtils.createStepFunction(5, 20, 25, 20, 0)); // constant function = 20\n\t\tfinal ReadOnlyTimeSeries avg = MultiTimeSeriesUtils.getAverageTimeSeries(Arrays.<ReadOnlyTimeSeries> asList(t0, t1), 0, Long.MAX_VALUE, true, null, false);\n\t\tAssert.assertEquals(\"Time series sum has wrong number of data points\", 13, avg.size());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(20).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 20, avg.getValue(45).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 10, avg.getValue(80).getValue().getIntegerValue());\n\t}", "public static double getAverage(double[] dataArray) {\n\t\t\n\t\tdouble average = 0.0;\n\t\t\n\t\tfor (int i = 0; i <dataArray.length; i++) {\n\t\t\taverage += dataArray[i];\n\t\t}\n\t\t\n\t\taverage = average/dataArray.length;\n\t\t\n\t\treturn average;\n\t}", "public static Double computeMean(Double[] values) {\n\t\treturn computeMean(values, 0, values.length);\n\t}", "private double[][] calculateExafsEnergiesConstantKStep() {\n\t\tdouble lowK = evToK(cEnergy);\n\t\tdouble highK = evToK(finalEnergy);\n\t\tdouble[][] kArray = createStepArray(lowK, highK, exafsStep, exafsTime, true, numberDetectors);\n\t\t// convert from k to energy in each element\n\t\tfor (int i = 0; i < kArray.length; i++)\n\t\t\tkArray[i][0] = kToEv(kArray[i][0]);\n\t\treturn kArray;\n\t}", "public MovingAverage(int size) {\n q = new LinkedList();\n this.size = size;\n sum = 0;\n }", "public int avgProhibitedItemsPerDay(){\r\n \r\n int trav=apstate.gettravellers();\r\n\t\tint days=apstate.getdays();\r\n\t\tint items=apstate.getitems();\r\n \r\n int avg_prohibited_items_per_day=items/days;\r\n \r\n return avg_prohibited_items_per_day;\r\n }", "private double getAvg() {\n\n double sum = 0;\n\n for (Map.Entry<Integer, Double> entry : values.entrySet()) {\n sum += entry.getValue();\n }\n\n if (values.size() > 0) {\n return sum / values.size();\n } else {\n throw new IllegalStateException(\"no values\");\n }\n }", "private double calc_E(KeplerElements a) {\n\t\tdouble sqrome2 = Math.sqrt(1.0 - a.e * a.e);\r\n\t\tdouble cta = Math.cos(a.ta);\r\n\t\tdouble sta = Math.sin(a.ta);\r\n\t\tdouble sine0 = (sqrome2 * sta) / (1.0 + a.e * cta);\r\n\t\tdouble cose0 = (a.e + cta) / (1.0 + a.e * cta);\r\n\t\tdouble e0 = Math.atan2(sine0, cose0);\r\n\t\treturn e0;\r\n\r\n\t}", "public final EObject entryRuleAverageOperator() throws RecognitionException {\n EObject current = null;\n\n EObject iv_ruleAverageOperator = null;\n\n\n try {\n // ../de.hs_rm.cs.vs.dsm.flow/src-gen/de/hs_rm/cs/vs/dsm/parser/antlr/internal/InternalFlow.g:2972:2: (iv_ruleAverageOperator= ruleAverageOperator EOF )\n // ../de.hs_rm.cs.vs.dsm.flow/src-gen/de/hs_rm/cs/vs/dsm/parser/antlr/internal/InternalFlow.g:2973:2: iv_ruleAverageOperator= ruleAverageOperator EOF\n {\n newCompositeNode(grammarAccess.getAverageOperatorRule()); \n pushFollow(FOLLOW_ruleAverageOperator_in_entryRuleAverageOperator6654);\n iv_ruleAverageOperator=ruleAverageOperator();\n\n state._fsp--;\n\n current =iv_ruleAverageOperator; \n match(input,EOF,FOLLOW_EOF_in_entryRuleAverageOperator6664); \n\n }\n\n }\n \n catch (RecognitionException re) { \n recover(input,re); \n appendSkippedTokens();\n } \n finally {\n }\n return current;\n }", "public final EObject entryRuleAverageFunction() throws RecognitionException {\r\n EObject current = null;\r\n\r\n EObject iv_ruleAverageFunction = null;\r\n\r\n\r\n try {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3257:2: (iv_ruleAverageFunction= ruleAverageFunction EOF )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3258:2: iv_ruleAverageFunction= ruleAverageFunction EOF\r\n {\r\n if ( state.backtracking==0 ) {\r\n newCompositeNode(grammarAccess.getAverageFunctionRule()); \r\n }\r\n pushFollow(FOLLOW_ruleAverageFunction_in_entryRuleAverageFunction6944);\r\n iv_ruleAverageFunction=ruleAverageFunction();\r\n\r\n state._fsp--;\r\n if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n current =iv_ruleAverageFunction; \r\n }\r\n match(input,EOF,FOLLOW_EOF_in_entryRuleAverageFunction6954); if (state.failed) return current;\r\n\r\n }\r\n\r\n }\r\n \r\n catch (RecognitionException re) { \r\n recover(input,re); \r\n appendSkippedTokens();\r\n } \r\n finally {\r\n }\r\n return current;\r\n }", "public double mean()\n {\n double sum = 0.0;\n for(int t = 0; t<size; t++)\n sum += x[t];\n return sum/size;\n }", "public double getMean(final int d) {\n double sum = 0;\n int numPoints = getNumPoints();\n\n for (int i = 0; i < numPoints; i++) {\n sum += getComponent(i, d);\n }\n\n return sum / numPoints;\n }", "private void calculateMean(float total){\r\n float averageBonds = total/accountInTotal;\r\n float averageAER = (averageBonds-startingBonds)/(startingBonds/100);\r\n\r\n Account averageAccount = new Account(startingBonds,averageBonds,averageAER);\r\n System.out.println(averageAccount.toString());\r\n\r\n }", "public ArrayList<Forecast> getForecastsForDay( int day ) {\n if (forecasts.size() == 0) {\n return null;\n }\n\n int startIndex = 0;\n int endIndex = 0;\n\n if (day < 8) {\n startIndex = dayIndices[day];\n }\n\n if (startIndex == -1) {\n return null;\n }\n\n if (day < 7) {\n endIndex = dayIndices[day+1];\n if (endIndex < 0) {\n endIndex = forecasts.size();\n }\n } else {\n endIndex = forecasts.size();\n }\n\n return new ArrayList<>(forecasts.subList(startIndex, endIndex));\n }", "public static double meanOf(double... values) {\n/* 433 */ Preconditions.checkArgument((values.length > 0));\n/* 434 */ double mean = values[0];\n/* 435 */ for (int index = 1; index < values.length; index++) {\n/* 436 */ double value = values[index];\n/* 437 */ if (Doubles.isFinite(value) && Doubles.isFinite(mean)) {\n/* */ \n/* 439 */ mean += (value - mean) / (index + 1);\n/* */ } else {\n/* 441 */ mean = StatsAccumulator.calculateNewMeanNonFinite(mean, value);\n/* */ } \n/* */ } \n/* 444 */ return mean;\n/* */ }", "private float averageBeat(){\n float avgBeat = 0f;\n List<Float> beatRed = DataManager.getInstance().getBeatRed();\n List<Float> beatIR = DataManager.getInstance().getBeatIR();\n\n for(int i = 0; i < beatRed.size() && i < beatIR.size(); i ++ ){\n chartFragment.addRedData(beatRed.get(i));\n chartFragment.addIRData(beatIR.get(i));\n avgBeat += beatRed.get(i);\n avgBeat += beatIR.get(i);\n }\n avgBeat = avgBeat / (beatRed.size() + beatIR.size());\n\n if (tcpTask != null )\n this.tcpTask.addData(\"\" + avgBeat);\n beatLabel.setText(\"Beat : \" + avgBeat);\n return avgBeat;\n }", "public double average()\n\t{\n\t\tif (arraySize > 0)\n\t\t{\n\t\t\tdouble sum = this.sum();\n\t\t\treturn sum / arraySize;\n\t\t}\n\t\tSystem.out.println(\"Syntax error, array is empty.\");\n\t\treturn -1;\n\t}", "public final EObject entryRuleExponentialFunction() throws RecognitionException {\r\n EObject current = null;\r\n\r\n EObject iv_ruleExponentialFunction = null;\r\n\r\n\r\n try {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3431:2: (iv_ruleExponentialFunction= ruleExponentialFunction EOF )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3432:2: iv_ruleExponentialFunction= ruleExponentialFunction EOF\r\n {\r\n if ( state.backtracking==0 ) {\r\n newCompositeNode(grammarAccess.getExponentialFunctionRule()); \r\n }\r\n pushFollow(FOLLOW_ruleExponentialFunction_in_entryRuleExponentialFunction7290);\r\n iv_ruleExponentialFunction=ruleExponentialFunction();\r\n\r\n state._fsp--;\r\n if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n current =iv_ruleExponentialFunction; \r\n }\r\n match(input,EOF,FOLLOW_EOF_in_entryRuleExponentialFunction7300); if (state.failed) return current;\r\n\r\n }\r\n\r\n }\r\n \r\n catch (RecognitionException re) { \r\n recover(input,re); \r\n appendSkippedTokens();\r\n } \r\n finally {\r\n }\r\n return current;\r\n }", "private double logSumExp(double x[]) {\n double maxx = Double.NEGATIVE_INFINITY;\n for (double d : x) {\n if (d > maxx) { maxx = d; }\n }\n double sum = 0.0;\n for (double d : x) {\n sum += Math.exp(d-maxx);\n }\n return maxx + Math.log(sum);\n }", "public static boolean emaMomentumExists(Stock stock, String date, boolean fractal) {\r\n\t\t\tdate = stock.getClosestDate(date);\r\n\r\n\t\t\tint timePeriod = stock.getTimePeriod();\r\n\t\t\tint startingIndex = stock.getDates().indexOf(date) - timePeriod + 1;\r\n\t\t\tint endingIndex = stock.getDates().indexOf(date);\r\n\t\t\tdouble rateOfChange = 0;\r\n\t\t\tdouble previousRateOfChange = 0;\r\n\t\t\tdouble[] ratesOfChange = new double[timePeriod];\r\n\t\t\tfor (int i = startingIndex; i < endingIndex; i++) {\r\n\t\t\t\tString iDate1 = stock.getDates().get(i);\r\n\t\t\t\tString iDate2 = stock.getDates().get(i + 1);\r\n\t\t\t\tdouble ema1 = stock.getEMA(iDate1);\r\n\t\t\t\tdouble ema2 = stock.getEMA(iDate2);\r\n\t\t\t\tdouble emaFifty1 = stock.getFiftyEMA(iDate1);\r\n\t\t\t\tdouble emaFifty2 = stock.getFiftyEMA(iDate2);\r\n\t\t\t\tdouble hist1 = ema1 - emaFifty1;\r\n\t\t\t\tdouble hist2 = ema2 - emaFifty2;\r\n\t\t\t\tdouble change = hist2 - hist1;\r\n\t\t\t\tratesOfChange[i - startingIndex] = change;\r\n\t\t\t}\r\n\r\n\t\t\tdouble multiplier = (2.0 / (double) (timePeriod + 1));\r\n\t\t\tpreviousRateOfChange = ratesOfChange[0];\r\n\t\t\tdouble ema = 0;\r\n\t\t\tfor (int i = 1; i < ratesOfChange.length; i++) {\r\n\t\t\t\trateOfChange = ratesOfChange[i];\r\n\t\t\t\tema = ((rateOfChange - previousRateOfChange) * multiplier) + previousRateOfChange;\r\n\t\t\t\tpreviousRateOfChange = ema;\r\n\t\t\t}\r\n\r\n\t\t\tif (!fractal && postiveCross(stock, date, stock.getTimePeriod()) && ema > .04) { \r\n\t\t\t\treturn true;\r\n\t\t\t} else if (fractal && ema > 0) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}", "@DISPID(67)\r\n\t// = 0x43. The runtime will prefer the VTID if present\r\n\t@VTID(65)\r\n\tint averageCPUTime_Days();", "public int avgTrafficPerDay(){\r\n \r\n int trav=apstate.gettravellers();\r\n\t\tint days=apstate.getdays();\r\n\t\tint items=apstate.getitems();\r\n \r\n int avg_traffic_per_day=trav/days;\r\n \r\n return avg_traffic_per_day;\r\n }", "Date NextEvent(Date d);", "public synchronized double getAverage() {\n return average;\n }", "double getTodaysExpenditureAmount() {\n Long time = new Date().getTime();\n Date date = new Date(time - time % (DAY_DURATION));\n return getExpenditureAmount(date.getTime(), date.getTime() + (DAY_DURATION));\n }", "public static Date averageDate(List<Date> theDates){\r\n\t\t\r\n\t\tif ((theDates == null) || (theDates.size() == 0)){\r\n\t\t\treturn new Date();\r\n\t\t}\r\n\t\t\r\n\t\tDate earliestDate = null;\r\n\t\tDate latestDate = null;\r\n\t\t\r\n\t\tfor (ListIterator li = theDates.listIterator(); li.hasNext();) {\r\n\t\t\tDate thisDate = (Date) li.next();\r\n\t\t\t\r\n\t\t\tif (earliestDate == null){\r\n\t\t\t\tearliestDate = thisDate;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (latestDate == null){\r\n\t\t\t\tlatestDate = thisDate;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (thisDate.before(earliestDate)){\r\n\t\t\t\tearliestDate = thisDate;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (latestDate.after(thisDate)){\r\n\t\t\t\tlatestDate = thisDate;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tlong averageOfExtremes = (earliestDate.getTime() + latestDate.getTime() ) /2;\r\n\t\t\r\n\t\treturn new Date(averageOfExtremes);\r\n\t}", "@Override\n public Double average() {\n return (sum() / (double) count());\n }", "public double getAverage(){\r\n\t\tdouble sum=0;\r\n\t\tfor(Iterator<T> it=this.iterator();it.hasNext();){\r\n\t\t\tsum+=it.next().doubleValue();\r\n\t\t}\r\n\t\treturn sum/this.size();\r\n\t}", "public ArrayList<Event> eventsInDay(LocalDate day) {\n ArrayList<Event> myList = new ArrayList<>();\n for (Event e : myAgenda) {\n if (e.isInDay(day)) {\n myList.add(e);\n }\n }\n return myList;\n }", "public double compute_dEdT(double temperature) throws Exception {\n int index = findPolynomial(temperature);\n if (index!=BadIndex) {\n double data = polynomials[index].compute_dEdT(temperature);\n\n double correction = 0.0;\n if (exponential!=null && temperature>0) {\n // according to the function definition from NIST,\n // the exponential term is available only for type K when temperature > 0\n // Reference http://srdata.nist.gov/its90/download/download.html\n correction = exponential.compute_dEdT(temperature);\n }\n return data + correction;\n }\n else {\n throw new Exception(getInputOutOrRangeMessage(temperature));\n }\n }", "private float calculateAverage(List<Float> tempVoltages) {\r\n\t\t\r\n\t\tfloat runningTotal = 0;\r\n\t\tfor(float i : tempVoltages){\r\n\t\t\trunningTotal += i;\r\n\t\t}\r\n\t\trunningTotal /= tempVoltages.size();\r\n\t\treturn runningTotal;\r\n\t}", "public double calcAvg() {\n\t\treturn (double)calcSum() / data.size();\n }", "public int average()\n {\n int average = 0;\n int sum = 0;\n\n for ( int index = 0; index < data.length; index++ )\n {\n sum = sum + data[index];\n }\n average = sum / data.length;\n\n return average;\n }", "public void advanceDay(long day) {\n clock = Clock.offset(clock, Duration.ofDays(day));\n }" ]
[ "0.57069635", "0.5461666", "0.5426084", "0.5391336", "0.5247684", "0.52086073", "0.5170173", "0.50805634", "0.5071065", "0.5043507", "0.5042026", "0.50237584", "0.50073195", "0.5001429", "0.49868557", "0.49804515", "0.49752748", "0.4914446", "0.4875539", "0.48647755", "0.48327154", "0.48134676", "0.48081124", "0.47969258", "0.4784239", "0.4746375", "0.4736118", "0.47204885", "0.47178856", "0.4686257", "0.46858785", "0.467238", "0.46512887", "0.4648858", "0.46468624", "0.4623239", "0.46212125", "0.461954", "0.4609381", "0.46039975", "0.46018547", "0.46013257", "0.46012196", "0.46007735", "0.459081", "0.45639697", "0.4563888", "0.45622343", "0.45434114", "0.45414641", "0.45366904", "0.45335954", "0.45283136", "0.4526826", "0.45220488", "0.45144668", "0.45122796", "0.45011646", "0.44915035", "0.44902357", "0.44812325", "0.44774565", "0.4469306", "0.44541204", "0.44459936", "0.44383106", "0.44378385", "0.4434803", "0.44246605", "0.4418783", "0.4405849", "0.44044164", "0.4400277", "0.43985334", "0.43933967", "0.43927702", "0.43882382", "0.4373712", "0.4367384", "0.43658206", "0.43654257", "0.43608052", "0.43526852", "0.43502873", "0.4345198", "0.43446356", "0.43433112", "0.43352878", "0.43227616", "0.4319989", "0.43194312", "0.43191683", "0.4316756", "0.43150687", "0.43135214", "0.4310991", "0.43056473", "0.43043956", "0.4302887", "0.43026772" ]
0.6108191
0
Returns the "standard" MACD for the series for the given day. Developed by Gerald Appel, Moving Average Convergence/Divergence (MACD) is one of the simplest and most reliable indicators available. MACD uses moving averages, which are lagging indicators, to include some trendfollowing characteristics. These lagging indicators are turned into a momentum oscillator by subtracting the longer moving average from the shorter moving average. The resulting plot forms a line that oscillates above and below zero, without any upper or lower limits. The "standard" formula for the MACD is the difference between a security's 26day and 12day Exponential Moving Averages (EMAs). This is the formula that is used in many popular technical analysis programs.
public double MACD(int t) { return MACD(26, 12, t); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double MACDSignal(int t)\n {\n Series macd = new Series();\n macd.x = new double[macd.size = t + 1];\n for(int i = 0; i<=t; i++)\n macd.x[i] = MACD(i);\n return macd.expMovingAverage(9, t);\n }", "@Override \r\n protected void calculate(int index, DataContext ctx)\r\n {\r\n DataSeries series = ctx.getDataSeries();\r\n boolean complete=true;\r\n \r\n /*\r\n int macdPeriod1 = getSettings().getInteger(MACD_PERIOD1, 12);\r\n int macdPeriod2 = getSettings().getInteger(MACD_PERIOD2, 26);\r\n Enums.MAMethod macdMethod = getSettings().getMAMethod(MACD_METHOD, Enums.MAMethod.EMA);\r\n Object macdInput = getSettings().getInput(MACD_INPUT, Enums.BarInput.CLOSE);\r\n if (index >= Util.max(macdPeriod1, macdPeriod2)) {\r\n Double MA1 = null, MA2 = null;\r\n MA1 = series.ma(macdMethod, index, macdPeriod1, macdInput);\r\n MA2 = series.ma(macdMethod, index, macdPeriod2, macdInput);\r\n \r\n double MACD = MA1 - MA2; \r\n series.setDouble(index, Values.MACD, MACD);\r\n\r\n int signalPeriod = getSettings().getInteger(Inputs.SIGNAL_PERIOD, 9);\r\n\r\n // Calculate moving average of MACD (signal line)\r\n Double signal = series.ma(getSettings().getMAMethod(Inputs.SIGNAL_METHOD, Enums.MAMethod.SMA), index, signalPeriod, Values.MACD);\r\n series.setDouble(index, Values.SIGNAL, signal);\r\n \r\n if (signal != null) series.setDouble(index, Values.HIST, MACD - signal);\r\n\r\n if (series.isBarComplete(index)) {\r\n // Check for signal events\r\n Coordinate c = new Coordinate(series.getStartTime(index), signal);\r\n if (crossedAbove(series, index, Values.MACD, Values.SIGNAL)) {\r\n MarkerInfo marker = getSettings().getMarker(Inputs.UP_MARKER);\r\n String msg = get(\"SIGNAL_MACD_CROSS_ABOVE\", MACD, signal);\r\n if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.BOTTOM, marker, msg));\r\n ctx.signal(index, Signals.CROSS_ABOVE, msg, signal);\r\n }\r\n else if (crossedBelow(series, index, Values.MACD, Values.SIGNAL)) {\r\n MarkerInfo marker = getSettings().getMarker(Inputs.DOWN_MARKER);\r\n String msg = get(\"SIGNAL_MACD_CROSS_BELOW\", MACD, signal);\r\n if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.TOP, marker, msg));\r\n ctx.signal(index, Signals.CROSS_BELOW, msg, signal);\r\n }\r\n }\r\n }\r\n else complete=false;\r\n \r\n int rsiPeriod = getSettings().getInteger(RSI_PERIOD);\r\n Object rsiInput = getSettings().getInput(RSI_INPUT);\r\n if (index < 1) return; // not enough data\r\n \r\n double diff = series.getDouble(index, rsiInput) - series.getDouble(index-1, rsiInput);\r\n double up = 0, down = 0;\r\n if (diff > 0) up = diff;\r\n else down = diff;\r\n \r\n series.setDouble(index, Values.UP, up);\r\n series.setDouble(index, Values.DOWN, Math.abs(down));\r\n \r\n if (index <= rsiPeriod +1) return;\r\n \r\n Enums.MAMethod method = getSettings().getMAMethod(RSI_METHOD);\r\n double avgUp = series.ma(method, index, rsiPeriod, Values.UP);\r\n double avgDown = series.ma(method, index, rsiPeriod, Values.DOWN);\r\n double RS = avgUp / avgDown;\r\n double RSI = 100.0 - ( 100.0 / (1.0 + RS));\r\n\r\n series.setDouble(index, Values.RSI, RSI);\r\n \r\n // Do we need to generate a signal?\r\n GuideInfo topGuide = getSettings().getGuide(Inputs.TOP_GUIDE);\r\n GuideInfo bottomGuide = getSettings().getGuide(Inputs.BOTTOM_GUIDE);\r\n if (crossedAbove(series, index, Values.RSI, topGuide.getValue())) {\r\n series.setBoolean(index, Signals.RSI_TOP, true);\r\n ctx.signal(index, Signals.RSI_TOP, get(\"SIGNAL_RSI_TOP\", topGuide.getValue(), round(RSI)), round(RSI));\r\n }\r\n else if (crossedBelow(series, index, Values.RSI, bottomGuide.getValue())) {\r\n series.setBoolean(index, Signals.RSI_BOTTOM, true);\r\n ctx.signal(index, Signals.RSI_BOTTOM, get(\"SIGNAL_RSI_BOTTOM\", bottomGuide.getValue(), round(RSI)), round(RSI));\r\n }\r\n */\r\n series.setComplete(index, complete);\r\n }", "public abstract int getDeviation(\n CalendarDate calendarDay,\n TZID tzid\n );", "public double MACD(int slow, int fast, int t)\n {\n if(slow<=fast)\n throw new IndexOutOfBoundsException(\"MACD(\" + slow + \" - \" +\n fast + \") is undefined at time \" + t);\n return expMovingAverage(slow, t) - expMovingAverage(fast, t);\n }", "public String[] defineDaysLine(String day) {\n int shiftPositions = -1;\n String[] definedDayLine = {Const.DAY_SUNDAY, Const.DAY_MONDAY, Const.DAY_TUESDAY, Const.DAY_WEDNESDAY,\n Const.DAY_THURSDAY, Const.DAY_FRIDAY, Const.DAY_SATURDAY};\n for (int i = 0; i < definedDayLine.length; i++) {\n if (day.equals(definedDayLine[i])) {\n shiftPositions = i;\n }\n }\n String[] tempArray = new String[definedDayLine.length];\n System.arraycopy(definedDayLine, shiftPositions, tempArray, 0, definedDayLine.length - shiftPositions);\n System.arraycopy(definedDayLine, 0, tempArray, definedDayLine.length - shiftPositions, shiftPositions);\n return tempArray;\n }", "@Test\n public void getSecurityPriceTechnicalsMacdTest() throws ApiException, NoSuchMethodException {\n String identifier = null;\n Integer fastPeriod = null;\n Integer slowPeriod = null;\n Integer signalPeriod = null;\n String priceKey = null;\n String startDate = null;\n String endDate = null;\n Integer pageSize = null;\n String nextPage = null;\n ApiResponseSecurityMovingAverageConvergenceDivergence response = api.getSecurityPriceTechnicalsMacd(identifier, fastPeriod, slowPeriod, signalPeriod, priceKey, startDate, endDate, pageSize, nextPage);\n\n // TODO: test validations\n }", "private Double[] getDayValue24(DayEM dayEm) {\n\n\t Double[] dayValues = new Double[24];\n\n\t /* OPF-610 정규화 관련 처리로 인한 주석\n\t dayValues[0] = (dayEm.getValue_00() == null ? 0 : dayEm.getValue_00());\n\t dayValues[1] = (dayEm.getValue_01() == null ? 0 : dayEm.getValue_01());\n\t dayValues[2] = (dayEm.getValue_02() == null ? 0 : dayEm.getValue_02());\n\t dayValues[3] = (dayEm.getValue_03() == null ? 0 : dayEm.getValue_03());\n\t dayValues[4] = (dayEm.getValue_04() == null ? 0 : dayEm.getValue_04());\n\t dayValues[5] = (dayEm.getValue_05() == null ? 0 : dayEm.getValue_05());\n\t dayValues[6] = (dayEm.getValue_06() == null ? 0 : dayEm.getValue_06());\n\t dayValues[7] = (dayEm.getValue_07() == null ? 0 : dayEm.getValue_07());\n\t dayValues[8] = (dayEm.getValue_08() == null ? 0 : dayEm.getValue_08());\n\t dayValues[9] = (dayEm.getValue_09() == null ? 0 : dayEm.getValue_09());\n\t dayValues[10] = (dayEm.getValue_10() == null ? 0 : dayEm.getValue_10());\n\t dayValues[11] = (dayEm.getValue_11() == null ? 0 : dayEm.getValue_11());\n\t dayValues[12] = (dayEm.getValue_12() == null ? 0 : dayEm.getValue_12());\n\t dayValues[13] = (dayEm.getValue_13() == null ? 0 : dayEm.getValue_13());\n\t dayValues[14] = (dayEm.getValue_14() == null ? 0 : dayEm.getValue_14());\n\t dayValues[15] = (dayEm.getValue_15() == null ? 0 : dayEm.getValue_15());\n\t dayValues[16] = (dayEm.getValue_16() == null ? 0 : dayEm.getValue_16());\n\t dayValues[17] = (dayEm.getValue_17() == null ? 0 : dayEm.getValue_17());\n\t dayValues[18] = (dayEm.getValue_18() == null ? 0 : dayEm.getValue_18());\n\t dayValues[19] = (dayEm.getValue_19() == null ? 0 : dayEm.getValue_19());\n\t dayValues[20] = (dayEm.getValue_20() == null ? 0 : dayEm.getValue_20());\n\t dayValues[21] = (dayEm.getValue_21() == null ? 0 : dayEm.getValue_21());\n\t dayValues[22] = (dayEm.getValue_22() == null ? 0 : dayEm.getValue_22());\n\t dayValues[23] = (dayEm.getValue_23() == null ? 0 : dayEm.getValue_23());\n\t\t\t*/\n\t \n\t return dayValues;\n\t }", "public void generateMahadashaAndAntardashaTable(Vector<MahaDashaBean> dasha, PdfContentByte canvas, String planetname, int tableX, float tableY,ColorElement mycolor) {\n\t\tFont font = new Font();\n\t\tfont.setSize(this.getTableDatafont());\n\t\tfont.setColor(mycolor.fillColor(getTableDataColor()));\n\t\t//Font font2 = new Font();\n\t\t// font2.setSize(this.getTableDatafont());\n\t\t// font2.setStyle(\"BOLD\");\n\t\tFont font3 = new Font();\n\t\tfont3.setSize(this.getSemiHeading());\n\t\tfont3.setColor(mycolor.fillColor(getTableHeadingColor()));\n\t\t// RashiHouseBean rashiBean=null;\n\t\tMahaDashaBean mahadashabean = null;\n\t\tPdfPTable mahadashaTable = null;\n\n\t\t//\tColumnText.showTextAligned(canvas, Element.ALIGN_CENTER,new Phrase(planetname,font3),tableX+10,tableY+15,0);\n\t\tmahadashaTable = new PdfPTable(3);\n\t\tmahadashaTable.setTotalWidth(140);\n\t\tString[] monthArr = new String[2];\n\t\tString month = null;\n\t\ttry {\n\t\t\tmahadashaTable.setWidths(new int[]{40, 50, 50});\n\t\t} catch (DocumentException ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"Antar\", font3)));\n\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"Beginning\", font3)));\n\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"Ending\", font3)));\n\n\n\t\tif (!StringUtils.isBlank(dasha.get(0).getYear())) {\n\t\t\t// logger.info(\"**************||||||||||||||||||Antardashaaaaaaaaaaaaaaaaaaa||||||||||||||||||\" + dasha.get(0).getYear());\n\t\t\tmonthArr = dasha.get(0).getYear().split(\"_\");\n\n\t\t\tColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(monthArr[0], font3), tableX + 20, tableY + 15, 0);\n\t\t\tColumnText.showTextAligned(canvas, Element.ALIGN_CENTER,\n\t\t\t\t\tnew Phrase(monthArr[1], font), tableX + 35, tableY + 4, 0);\n\n\t\t}\n\n\n\t\tfor (int loop = 0; loop < dasha.size(); loop++) {\n\t\t\t// rashiBean=(RashiHouseBean)dasha.get(loop);\n\t\t\tmahadashabean = (MahaDashaBean) dasha.get(loop);\n\t\t\tdrawLine1(canvas, tableX, tableY, tableX + 140, tableY);\n\t\t\tdrawLine1(canvas, tableX, (tableY - 15), tableX + 140, (tableY - 15));\n\t\t\tdrawLine1(canvas, tableX, (tableY - 125), tableX + 140, (tableY - 125));\n\n\t\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(mahadashabean.getPlanetName(), font)));\n\t\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\t\tString tm=mahadashabean.getStartTime();\n\t\t\tif(tm!=null && tm!=\"\")\n\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(tm.split(\" \")[0], font)));\n\t\t\telse\n\t\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"\", font)));\n\t\t\t\n\t\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\t\ttm=mahadashabean.getEndTime();\n\t\t\t\tif(tm!=null && tm!=\"\")\n\t\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(tm.split(\" \")[0], font)));\n\t\t\t\telse\n\t\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"\", font)));\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\t\t}\n\t\tmahadashaTable.writeSelectedRows(0, -1, tableX, tableY, writer.getDirectContent());\n\n\n\n\t}", "@Override\n\tpublic boolean testExitAtDay (StockData sd, int strategyId, int lookback) {\n\n\t\tboolean toReturn = false;\n\n\t\tMacD macdData = sd.getMacd494();\n\n\t\tdouble[] macd = macdData.getMacd();\n\t\tdouble[] signal = macdData.getSignal();\n\t\tdouble[] histogram = macdData.getHistogram();\n\n\t\t\t// If this is bullish strategy, in which case we are looking for the macd to cross up and over \n\t\t\t// center line or to cross back down the signal line (as a stop loss). We use the histogram to detect such\n\t\t\t// a signal line crossover.\n\t\tif (strategyId == 0) {\n\n\t\t\tif (((macd[lookback] > 0) && (macd[lookback + 1] < 0)) ||\n\t\t\t\t((histogram[lookback] < 0) && (histogram[lookback + 1] > 0)))\n\t\t\t\t\ttoReturn = true;\n\n\t\t}\n // This bullish strategy is just a slight modification -- it also exits if the MacD turns around at all.\n else if (strategyId == 1) {\n\n \t\tif (((macd[lookback] > 0) && (macd[lookback + 1] < 0)) ||\n\t\t\t\t((histogram[lookback] < 0) && (histogram[lookback + 1] > 0)) ||\n (macd[lookback] < macd[lookback + 1]))\n\t\t\t\t\ttoReturn = true;\n\n }\n\t\t\t// If this is bearish strategy, in which case we are looking for the macd to cross down and under the\n\t\t\t// center line or to cross back up the signal line (as a stop loss). We use the histogram to detect such\n\t\t\t// a signal line crossover.\n\t\telse if (strategyId == 2) {\n\n\t\t\tif (((macd[lookback] < 0) && (macd[lookback + 1] > 0)) ||\n\t\t\t\t((histogram[lookback] > 0) && (histogram[lookback + 1] < 0)))\n\t\t\t\t\ttoReturn = true;\n\n\t\t}\n // This bullish strategy is just a slight modification -- it also exits if the MacD turns around at all.\n else if (strategyId == 3) {\n\n \tif (((macd[lookback] < 0) && (macd[lookback + 1] > 0)) ||\n\t\t\t\t((histogram[lookback] > 0) && (histogram[lookback + 1] < 0)) ||\n (macd[lookback] > macd[lookback + 1]))\n\t\t\t\t\ttoReturn = true;\n\n }\n\n\t\treturn toReturn;\n\n\t}", "@SuppressWarnings(\"unchecked\")\n\t@External(readonly = true)\n\tpublic Map<String, String> get_daily_payouts(BigInteger day) {\n\t\t/***\n Get daily payouts for a game in a particular day\n :param day: Index of the day for which payouts is to be returned\n :type day: int\n :return: Payouts of the game in that particular day\n :rtype: int\n ***/\n\t\tif (day.compareTo(BigInteger.ONE)== -1) {\n\t\t\tBigInteger now = BigInteger.valueOf(Context.getBlockTimestamp());\t\t\n\t\t\tday = day.add(now.divide(U_SECONDS_DAY));\n\t\t}\n\t\t\n\n\t\tMap.Entry<String, String>[] payouts = new Map.Entry[this.get_approved_games().size()]; \n\n\t\tfor (int i=0; i<this.get_approved_games().size(); i++) {\n\t\t\tAddress game = this.get_approved_games().get(i);\n\t\t\tpayouts[i] = Map.entry(game.toString(), String.valueOf(this.payouts.at(day).get(game)));\n\t\t}\n\t\treturn Map.ofEntries(payouts);\n\t}", "public static void printDay(Day d) {\n\t\t\n\t\tUtility.printString(\"-----------------\\n\");\n\t\tUtility.printString(d.getDay() + \".\" + Utility.weekDayToString(d.getDay()) + \" (\" + d.getKcals() + \" Kcal)\" + \" \\n\");\n\t\t\n\t\t\n\t\tfor(MealTime mt : d.getMealTimes()) {\n\t\t\tprintMealtime(mt);\n\t\t}\n\t\t\n\t\t\n\t}", "public Double getDailySaleWithoutVat(int month, int day, int year, int storeCode) {\n\t\tDouble amount = getRawGross(month, day, year, storeCode)/getVatRate();\r\n\t\tlogger.debug(\"Raw Gross: \"+amount);\r\n\t\treturn amount;\r\n//\t\treturn dailySale+totDisc+vat;\r\n\t}", "public abstract double getCarbon();", "private Day getDay(int day, int month) {\n return mainForm.getDay(day, month);\n }", "public static String getMacAddress() {\n try {\n List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());\n for (NetworkInterface nif : all) {\n if (!nif.getName().equalsIgnoreCase(\"wlan0\")) continue;\n\n byte[] macBytes = nif.getHardwareAddress();\n if (macBytes == null) {\n return \"\";\n }\n\n StringBuilder res1 = new StringBuilder();\n for (byte b : macBytes) {\n res1.append(String.format(\"%02X:\",b));\n }\n\n if (res1.length() > 0) {\n res1.deleteCharAt(res1.length() - 1);\n }\n return res1.toString();\n }\n } catch (Exception ex) {\n }\n return \"02:00:00:00:00:00\";\n }", "public double averageDayDriveDistance(String day)\n\t{\n\t\tint dayCount = 0; //total days run through\n\t\tString currentDate = \"\";\n\t\tdouble totalDistance = 0;\n\t\tfor(int i = 0; i < saveData.size(); i++)\n\t\t{\n\t\t\t//figures out the number of days, then averages the total by that number\n\t\t\tif(day.equals(saveData.get(i).get(\"day\")))\n\t\t\t{\n\t\t\t\tif(currentDate.equals(\"\"))\n\t\t\t\t{\n\t\t\t\t\t//if there is no current date, we must have just started; set the variable\n\t\t\t\t\tcurrentDate = saveData.get(i).get(\"date\"); //.get(\"date\") to be replaced\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t\telse if(currentDate.equals(saveData.get(i).get(\"date\")))\n\t\t\t\t{\n\t\t\t\t\t//it's the same date, so add this distance to the total distance\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//it's a different date, so set the currentDate to this one,\n\t\t\t\t\t//increment the days counter;\n\t\t\t\t\tcurrentDate = saveData.get(i).get(\"date\");\n\t\t\t\t\tdayCount++;\n\t\t\t\t\t//add this drive to the total distance\n\t\t\t\t\ttotalDistance += saveData.get(i).get(\"distance\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t//after all the indexes of saveData have been run through\n\t\t//clean up by increment the days counter\n\t\tdayCount++;\n\t\t//get the average by dividing the total distance by the days\n\t\tdouble averageDistancePerDay = this.totalDriveDistance()/dayCount;\n\t}", "public byte[] macAlgorithm(SecretKey encryptionkey, byte[] message) throws Exception\n {\n Mac mac = Mac.getInstance(\"HmacMD5\");\t\t// MAC mode\n mac.init(encryptionkey);\t\t// Initialize mac\n\n byte[] digest = mac.doFinal(message);\t\t// Finish the MAC Operation\n return digest;\n }", "public Double getNetSalesWithoutVat(int month, int day, int year, int storeCode, int... hour) {\r\n\t\tDouble amt = getNetSales(month, day, year, storeCode, hour);\r\n\t\tDouble dlysale = (amt)/getVatRate();\r\n\t\t\r\n\t\treturn dlysale;\r\n\t}", "public void setDay(Date day) {\r\n this.day = day;\r\n }", "public void setDay(Date day) {\r\n this.day = day;\r\n }", "public void setDay(Date day) {\r\n this.day = day;\r\n }", "public void setDay(Date day) {\r\n this.day = day;\r\n }", "public void setDay(Date day) {\r\n this.day = day;\r\n }", "public static double[] berekenDagOmzet(double[] omzet) {\n double[] temp = new double[DAYS_IN_WEEK];\n \n for(int i = 0; i < DAYS_IN_WEEK; i++) {\n\n int j = 0;\n int counter = 0;\n while( omzet.length > (i + DAYS_IN_WEEK * j) ) {\n temp[i] += omzet[i + DAYS_IN_WEEK * j];\n \n j++;\n counter++;\n }\n temp[i] = temp[i] / counter;\n }\n return temp;\n }", "public void setDay(Date day) {\n this.day = day;\n }", "public void setMday(int value) {\n this.mday = value;\n }", "@Array({9}) \n\t@Field(16) \n\tpublic Pointer<Byte > TradingDay() {\n\t\treturn this.io.getPointerField(this, 16);\n\t}", "public void setDay(byte value) {\n this.day = value;\n }", "public void setDay(byte value) {\n this.day = value;\n }", "public void setDay(byte value) {\n this.day = value;\n }", "public void setDay(byte value) {\n this.day = value;\n }", "@BeforeClass\n\tpublic static void setUp() {\n\t\t\n\t\tdata = new ArrayList<>();\n\t\tdata.add(new StockTimeFrameData(\"1\", 0, 0, 0, 0, 0, 22.27, false)); \n\t\tdata.add(new StockTimeFrameData(\"2\", 0, 0, 0, 0, 0, 22.19, false)); \n\t\tdata.add(new StockTimeFrameData(\"3\", 0, 0, 0, 0, 0, 22.08, false)); \n\t\tdata.add(new StockTimeFrameData(\"4\", 0, 0, 0, 0, 0, 22.17, false));\t\n\t\tdata.add(new StockTimeFrameData(\"5\", 0, 0, 0, 0, 0, 22.18, false)); \n\t\tdata.add(new StockTimeFrameData(\"6\", 0, 0, 0, 0, 0, 22.13, false)); \n\t\tdata.add(new StockTimeFrameData(\"7\", 0, 0, 0, 0, 0, 22.23, false)); \t\n\t\tdata.add(new StockTimeFrameData(\"8\", 0, 0, 0, 0, 0, 22.43, false)); \n\t\tdata.add(new StockTimeFrameData(\"9\", 0, 0, 0, 0, 0, 22.24, false)); \n\t\tdata.add(new StockTimeFrameData(\"10\", 0, 0, 0, 0, 0, 22.29, false)); \n\t\tdata.add(new StockTimeFrameData(\"11\", 0, 0, 0, 0, 0, 22.15, false)); \n\t\tdata.add(new StockTimeFrameData(\"12\", 0, 0, 0, 0, 0, 22.39, false)); \n\t\tdata.add(new StockTimeFrameData(\"13\", 0, 0, 0, 0, 0, 22.38, false)); \n\t\tdata.add(new StockTimeFrameData(\"14\", 0, 0, 0, 0, 0, 22.61, false)); \n\t\t//data.add(new StockTimeFrameData(\"15\", 0, 0, 0, 0, 0, 23.36, false)); \n\n\t\tmacd = new MACD(data, 10, 4, 6);\n\t}", "public String getFormattedMACAddress() {\n String defaultReturn = \"00:00:00:00:00:00\";\n\n // Validate the data\n if (macAddress == null) {\n return defaultReturn;\n }\n String mac = macAddress.replace(\"-\", \"\");\n if (mac.length() != 12) {\n return defaultReturn;\n }\n\n List<String> parts = new ArrayList<>();\n for (int i = 0; i < 6; i++) {\n int offset = 2 * i;\n parts.add(mac.substring(offset, offset + 2));\n }\n\n return String.join(\":\", parts);\n }", "public void setDay(final short day) {\r\n\t\tthis.day = day;\r\n\t}", "@Override\n\tpublic double getCarbon() {\n\t\treturn 0;\n\t}", "private double calculateFeesEarnedEachDayOfWeek(ArrayList<Pair<Fees, Time>> timeslots, DayOfWeek day) {\n return daysOfWeek[day.ordinal()] * timeslots.stream()\n .filter(p -> convertDayOfWeek(p.getValue().getDay()).equals(day))\n .mapToDouble(p -> p.getValue().getTuitionHours() * p.getKey().getFeesValue())\n .sum();\n }", "public void setDay(byte value) {\n this.day = value;\n }", "public void setDay(byte value) {\r\n this.day = value;\r\n }", "public String getSomeDayInfo(int day){\n\t\tHashMap<String,String> hashMap = getSomeDaydata(day);\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(hashMap.get(\"日期\")+\" \"+hashMap.get(\"天气\")+\"\\n\");\n\t\tsb.append(\"最\"+hashMap.get(\"最高温\")+\"\\n\"+\"最\"+hashMap.get(\"最低温\"));\n\t\tsb.append(\"\\n风力:\"+hashMap.get(\"风力\"));\n\n\t\treturn sb.toString();\n\t}", "public final native double setDate(int dayOfMonth) /*-{\n this.setDate(dayOfMonth);\n return this.getTime();\n }-*/;", "public static String emptyDefaultDay(String day) {\n if (StringUtils.isEmpty(day)) {\n return new SimpleDateFormat(\"yyyy-MM-dd\").format(new Date());\n } else {\n return day;\n }\n }", "public void dayIsLike() \r\n\t{ \r\n\t\tswitch (day) \r\n\t\t{ \r\n\t\tcase MONDAY: \r\n\t\t\tSystem.out.println(\"Mondays are bad.\"); \r\n\t\t\tbreak; \r\n\t\tcase FRIDAY: \r\n\t\t\tSystem.out.println(\"Fridays are better.\"); \r\n\t\t\tbreak; \r\n\t\tcase SATURDAY: \r\n\t\t\tSystem.out.println(\"Saturdays are better.\"); \r\n\t\t\tbreak;\r\n\t\tcase SUNDAY: \r\n\t\t\tSystem.out.println(\"Weekends are best.\"); \r\n\t\t\tbreak; \r\n\t\tdefault: \r\n\t\t\tSystem.out.println(\"Midweek days are so-so.\"); \r\n\t\t\tbreak; \r\n\t\t} \r\n\t}", "public void setDay(String day) {\n\n\t\tthis.day = day;\n\t}", "public void dayNightCycle(boolean debug) {\r\n float distance;\r\n int timeUnit;\r\n float max;\r\n if (debug) {\r\n timeUnit = seconds - 5;\r\n max = 60 / 2f;\r\n } else {\r\n timeUnit = hours - 2;\r\n max = 24 / 2f;\r\n }\r\n\r\n if (timeUnit <= max) {\r\n distance = timeUnit;\r\n } else {\r\n distance = max - (timeUnit - max);\r\n }\r\n\r\n dayOpacity = distance / max;\r\n }", "public final double calculateCarbon() {\n\n if (calories > 2000) {\n allowedCarbonPerYear = 2200 * quantity;\n\n } else {\n allowedCarbonPerYear = 2000 * quantity;\n }\n allowedCarbonPerDay = (double) allowedCarbonPerYear / (double) 365;\n // String strDouble = String.format(\"%.2f\", allowedCarbonPerDay);\n // System.out.println(strDouble);\n return allowedCarbonPerDay;\n\n }", "public ArrayList<Forecast> getForecastsForDay( int day ) {\n if (forecasts.size() == 0) {\n return null;\n }\n\n int startIndex = 0;\n int endIndex = 0;\n\n if (day < 8) {\n startIndex = dayIndices[day];\n }\n\n if (startIndex == -1) {\n return null;\n }\n\n if (day < 7) {\n endIndex = dayIndices[day+1];\n if (endIndex < 0) {\n endIndex = forecasts.size();\n }\n } else {\n endIndex = forecasts.size();\n }\n\n return new ArrayList<>(forecasts.subList(startIndex, endIndex));\n }", "@Override\n public void cycleSlipDataSet(String nameSat, AbsoluteDate date, double value, Frequency freq) {\n super.cycleSlipDataSet(nameSat, date, value, freq);\n }", "public static DefaultTableModel getSensorDataTime(String day, int id, Date date) {\n ResultSet rs = null;\n DefaultTableModel DTm = null;\n try (\n PreparedStatement stmt = conn.prepareStatement(SENSOR_DATA_TIME, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);) {\n stmt.setString(1, day);\n stmt.setInt(2, id);\n stmt.setDate(3, date);\n stmt.setDate(4, date);\n\n rs = stmt.executeQuery();\n System.out.println(stmt.toString());\n DTm = buildTableModel(rs);\n\n } catch (SQLException e) {\n System.err.println(e);\n }\n return DTm;\n }", "public byte getDay() {\n return day;\n }", "public byte getDay() {\n return day;\n }", "public byte getDay() {\n return day;\n }", "public byte getDay() {\n return day;\n }", "public java.util.Calendar getBFSDAT() {\n return BFSDAT;\n }", "@Override\n public int[][] getStreakForMonth(CalendarDayModel day) {\n if (day.getMonth() == 7) {\n return streaks;\n }\n return new int[0][];\n }", "public MACAddress getMacAddress() \n\t{\n\t\treturn this.hwAddress;\n\t}", "public void setDay(int day) {\r\n this.day = day;\r\n }", "public void setDay(int day)\n {\n this.day = day;\n }", "public byte getDay() {\r\n return day;\r\n }", "public void setDay(int day) {\n\t\tthis.day = day;\n\t}", "public void setDay(int day) {\n\t\tthis.day = day;\n\t}", "public static void m10220a() {\n zzawb.m10214a(\"TinkMac\", new ii());\n zzavo.m10184a(f9059b);\n }", "@Override\n\tpublic boolean testStrategyAtDay(StockData sd, int strategyId, int lookBack) {\n\n\t\tboolean toReturn = false;\n\n\t\tMacD macdData = sd.getMacd494();\n\n\t\tdouble[] macd = macdData.getMacd();\n\t\tdouble[] histogram = macdData.getHistogram();\n\n\t\tif (strategyId <= 1) {\n\n\t\t\tif ((histogram[lookback] > 0) && (histogram[lookback + 1] < 0) && (macd[lookback] < 0))\n\t\t\t\ttoReturn = true;\n\n\t\t}\n\t\telse if (strategyId >= 2) {\n\n\t\t\tif ((histogram[lookback] < 0) && (histogram[lookback + 1] > 0) && (macd[lookback] > 0))\n\t\t\t\ttoReturn = true;\n\n\t\t}\n\n\n\t\treturn toReturn;\n\t}", "public io.dstore.values.TimestampValueOrBuilder getDayOrBuilder() {\n if (dayBuilder_ != null) {\n return dayBuilder_.getMessageOrBuilder();\n } else {\n return day_ == null ?\n io.dstore.values.TimestampValue.getDefaultInstance() : day_;\n }\n }", "DailyFlash getDailyFlashByDate(Store store, Date date);", "@GetMapping(\"/{symbol}/{date}\")\n public ModelAndView daily(@PathVariable(\"symbol\") String symbol, @PathVariable(\"date\") String date) throws ParseException {\n\n Date sdf = new SimpleDateFormat(\"yyyy-MM-dd\").parse(date);\n\n String beginOfTheMonth = date.substring(0, 7) + \"-00\";\n String endOfTheMonth = date.substring(0,7) + \"-31\";\n Map<String, Object> model = new HashMap<>();\n\n try{\n String[] resp = quoteRepository.daily(symbol, sdf).split(\",\");\n Double closingResp = quoteRepository.closingDay(symbol, sdf);\n String[] monthResp = quoteRepository.monthly(symbol, beginOfTheMonth, endOfTheMonth).split(\",\");\n Double closingMonth = quoteRepository.closingMonth(symbol, beginOfTheMonth, endOfTheMonth);\n\n DayRecord dr = new DayRecord(Double.parseDouble(resp[0]), Double.parseDouble(resp[1]), Integer.parseInt(resp[2]), date, symbol);\n DayRecord mr = new DayRecord(Double.parseDouble(monthResp[0]), Double.parseDouble(monthResp[1]), Integer.parseInt(monthResp[2]), beginOfTheMonth, symbol);\n\n model.put(\"daily\", dr);\n model.put(\"closing\", closingResp);\n model.put(\"monthly\", mr);\n model.put(\"closingMonthly\", closingMonth);\n\n\n return new ModelAndView(\"main\", model);\n\n } catch (Exception e) {\n return new ModelAndView(\"error\", model);\n }\n }", "public static void main(String[] args) {\n\t\tint d = Integer.parseInt(args[0]);\n\t\tint m = Integer.parseInt(args[1]);\n\t\tint y = Integer.parseInt(args[2]);\n\t\tint y1 = y - (14 - m) / 12;\n\t\tint x = y1 + y1 / 4 - y1 / 100 + y1 / 400;\n\t\tint m1 = m + 12 * ((14 - m) / 12) - 2;\n\t\tint d1 = (d + x + 31 * m1 / 12) % 7;\n\t\tSystem.out.println(\"day :\" + d1);\n\n\t\tswitch (d1) {\n\t\tcase 0:\n\t\t\tSystem.out.println(\"sunday\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tSystem.out.println(\"monday\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tSystem.out.println(\"tuesday\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tSystem.out.println(\"wednsday\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tSystem.out.println(\"thursday\");\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tSystem.out.println(\"friday\");\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tSystem.out.println(\"saturday\");\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tSystem.out.println(\"invalid output\");\n\t\t\tbreak;\n\t\t}\n\t}", "public void setCalDay() {\n\t\tfloat goal_bmr;\n\t\tif(gender==\"male\") {\n\t\t\tgoal_bmr= (float) (10 * (weight+loseGainPerWeek) + 6.25 * height - 5 * age + 5);\n\t\t}\n\t\telse {\n\t\t\tgoal_bmr=(float) (10 * (weight+loseGainPerWeek) + 6.25 * height - 5 * age - 161);\n\t\t}\n\t\tswitch (gymFrequency) {\n\t\tcase 0:calDay = goal_bmr*1.2;\n\t\t\t\tbreak;\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 3:calDay = goal_bmr*1.375;\n\t\t\t\tbreak;\n\t\tcase 4:\n\t\tcase 5:calDay = goal_bmr*1.55;\n\t\t\n\t\t\t\tbreak;\n\t\tcase 6:\n\t\tcase 7:calDay = goal_bmr*1.725;\n\t\t\t\tbreak;\n\t\t}\n\t}", "public Series removeDelayedTrend(int depth)\n {\n if(depth<1 || depth>=size)\n throw new IndexOutOfBoundsException();\n Series oscillator = new Series();\n oscillator.x = new double[oscillator.size = size - depth];\n if(oscillator.size>1)\n oscillator.r = new double[oscillator.size - 1];\n for(int t = 0; t<oscillator.size; t++)\n {\n oscillator.x[t] = x[t + depth] - movingAverage(depth, t + depth);\n if(t>0)\n oscillator.r[t - 1] = Math.log(oscillator.x[t]/oscillator.x[t - 1]);\n }\n return oscillator;\n }", "public String getDeviceSeriesName() {\r\n if(isMips32()) {\r\n String devname = getDeviceName();\r\n\r\n if(devname.startsWith(\"M\")) {\r\n return devname.substring(0, 3);\r\n } else if(devname.startsWith(\"USB\")) {\r\n return devname.substring(0, 5);\r\n } else {\r\n return devname.substring(0, 7);\r\n }\r\n } else {\r\n return getAtdfFamily();\r\n }\r\n }", "public double averageSteps() {\n if (day==0) return 0;\n return (double) totalSteps / day;}", "public byte getDay() {\n return day;\n }", "private void printDays() {\n for (int dayOfMonth = 1; dayOfMonth <= daysInMonth; ) {\n for (int j = ((dayOfMonth == 1) ? dayOfWeek - 1 : 0); j < 7 && (dayOfMonth <= daysInMonth); j++) {\n if (this.isDateChosen == true && date.getDate() == dayOfMonth) {\n String space = date.getDate() >= 10 ? \" \" : \" \";\n System.out.print(space + ANSI_GREEN + dayOfMonth + ANSI_RESET + \" \");\n } else {\n System.out.printf(\"%4d \", dayOfMonth);\n }\n dayOfMonth++;\n }\n System.out.println();\n }\n }", "private void calcDataInTable() {\n Calendar tempCal = (Calendar) cal.clone();\n\n tempCal.set(Calendar.DAY_OF_MONTH, 1);\n int dayOfWeek;\n\n if (tempCal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {\n dayOfWeek = 7;\n } else {\n dayOfWeek = tempCal.get(Calendar.DAY_OF_WEEK) - 1;\n }\n\n int dayOfMonth = tempCal.get(Calendar.DAY_OF_MONTH);\n\n for (int j = 0; j < 6; j++) {\n\n for (int i = 0; i < 7; i++) {\n\n if (j != 0) {\n if (dayOfMonth < 32) {\n parsedData[j][i] = Integer.toString(dayOfMonth);\n }\n\n if (dayOfMonth > cal.getActualMaximum(Calendar.DAY_OF_MONTH)) {\n parsedData[j][i] = \"\";\n }\n\n dayOfMonth++;\n\n } else {\n\n if ((j == 0) && (i >= dayOfWeek - 1)) {\n parsedData[j][i] = Integer.toString(dayOfMonth);\n dayOfMonth++;\n } else {\n parsedData[j][i] = \"\";\n }\n\n\n }\n\n }\n\n }\n}", "public void doMacrons(){\r\n\t\tDSElement<Verbum> w = words.first;\r\n\t\tint count = words.size(); // failsafe counter\r\n\t\twhile(count > 0){\r\n\t\t\t//Make sure word hasn't been macroned before\r\n\t\t\tif(w.getItem().macForm.isEmpty()){\r\n\t\t\t\t//delete nom endings\r\n\t\t\t\tdelNomFromMac(w.getItem());\r\n\t\t\t\t//insert macrons into forms\r\n\t\t\t\tmacsToForms(w.getItem());\r\n\t\t\t\t//System.out.println(w.getItem().macForm);\r\n\t\t\t\t//Insert special macrons \r\n\t\t\t\tspecialMacs(w.getItem());\r\n\t\t\t}\r\n\t\t\tw = w.getNext();\r\n\t\t\tif(w == null)\r\n\t\t\t\tw = words.first;\r\n\t\t\tcount--;\r\n\t\t}\r\n\t}", "private void adjustSunAndMoonData()\n\t{\n\t\tdouble toRad = Math.PI / 180.0;\n\t\t\n\t\t//find the number of days since the epoch 2000\n\t\tdouble D = ((userYear - 1990)* 365.3) + userDecimalDay + ((userMonth - 1) * 30);\n\t\tdouble sunEg = 279.403303; //at epoch\n\t\tdouble sunE = 0.016713;\n\t\tdouble sunW = 282.768422;\n\t\t//find mean anomaly of the sun (in degrees)\t\t\n\t\tdouble sunMeanAnomaly = ((360 / 365.242191) * D) + sunEg - sunW;\n\t\tsunMeanAnomaly = AdjustDegree(sunMeanAnomaly);\n\t\t//find true anomaly of the sun\n\t\tdouble temp = sunMeanAnomaly * toRad;\n\t\ttemp = Math.sin(temp);\n\t\tdouble sunEc = (360 / Math.PI) * sunE * temp;\n\t\tdouble sunTrueAnomaly = sunMeanAnomaly + sunEc;\n\t\tsunTrueAnomaly = AdjustDegree(sunTrueAnomaly);\n\t\t//find ecliptic longitude of the sun (in degrees)\n\t\tdouble sunEcLong = sunTrueAnomaly + sunW;\n\t\tsunEcLong = AdjustDegree(sunEcLong);\n\t\t//find sun declination and right ascension\n\t\ttemp = theCalculator.findPlanetDeclination(sunEg, 0.0, sunEcLong);\n\t\tsun.setDeclination(temp);\n\t\tdouble rightAsc = theCalculator.findPlanetRightAscension(sunEg, 0.0, sunEcLong);\n\t\tsun.setRightAscension(rightAsc);\n\t\ttemp = theCalculator.findHourAngle(rightAsc, userLocalTime);\n\t\tsun.setHourAngle(temp);\n\t\tsun.setMagnitude(-26.0);\n\t\t\n\t\t//find moon mean longitude (in degrees)\n\t\ttemp = 13.1763966 * D + 318.351648;\n\t\ttemp = AdjustDegree(temp);\n\t\tmoon.setMeanLongitude(temp);\n\t\t\n\t\t//find moon mean anomaly (in degrees)\n\t\ttemp = moon.getMeanLongitude() - (0.1114041 * D) - 36.340410;\n\t\ttemp = AdjustDegree(temp);\n\t\tdouble moonMeanAnomaly = temp;\n\t\t\n\t\t//find moon longitude of the node (in degrees)\n\t\ttemp = 318.510105 - 0.0529539 * D;\n\t\ttemp = AdjustDegree(temp);\n\t\tmoon.setLongitudeOfAscendingNode(temp);\n\t\t\n\t\t//calculate moons correction for evection (in degrees)\n\t\tdouble evectionCorrection = theCalculator.correctMoonEvection(sunEcLong, moon.getMeanLongitude(), moonMeanAnomaly);\n\t\t\n\t\t//calculate moons correction for the annual equation\n\t\ttemp = sunMeanAnomaly * toRad;\n\t\tdouble annualEquation = 0.1858 * Math.sin(temp);\n\t\t\n\t\t//find moon's third correction (in degrees)\n\t\tdouble A3 = 0.37 * Math.sin(temp);\n\t\t\n\t\t//find moon corrected anomaly (in degrees)\n\t\tdouble correctedAnomaly = moonMeanAnomaly + evectionCorrection - annualEquation - A3;\n\t\t\n\t\t//find moon's correction for the equation of the centre (in degrees)\n\t\ttemp = correctedAnomaly * toRad;\n\t\tdouble equationCentre = 6.2886 * Math.sin(temp);\n\t\t\n\t\t//find moon's 4th correction (in degrees)\n\t\tdouble A4 = 0.214 * Math.sin(2.0*temp);\n\t\t\n\t\t//find moon's corrected longitude (in degrees)\n\t\tdouble correctedLong = moon.getMeanLongitude() + evectionCorrection + equationCentre - annualEquation + A4;\n\t\t\n\t\t//correct moon's longitude for variation (in degrees)\n\t\ttemp = (2 * (correctedLong - sunEcLong)) * toRad;\n\t\tdouble variation = 0.6583 * Math.sin(temp);\n\t\t\n\t\t//find moon's true longitude (in degrees)\n\t\tdouble trueLong = correctedLong + variation;\n\t\t\n\t\t//calculate moon's corrected longitude of the node (in degrees)\n\t\ttemp = 0.16 * Math.sin(sunMeanAnomaly * toRad);\n\t\tdouble correctedLongNode = moon.getLongitudeOfAscendingNode() - temp;\n\t\t\n\t\t//find ecliptic longitude of moon (in degrees)\n\t\t//find y (in radians)\n\t\tdouble i = 5.145396 * toRad;\n\t\ttemp = (trueLong - correctedLongNode) * toRad;\n\t\tdouble y = Math.sin(temp) * Math.cos(i);\n\t\t//find x (in radians)\n\t\tdouble x = Math.cos(temp);\n\t\tdouble tan = Math.atan2(y, x);\n\t\tdouble eclipticLong = tan + correctedLongNode;\n\t\t\n\t\t//find ecliptic latitude of moon (in degrees)\n\t\tdouble eclipticLat = Math.asin(Math.sin(temp * Math.sin(i)));\n\t\t\n\t\t//find moon mean obliquity (in degrees)\n\t\tdouble T = (userJulianDate - epoch2000JD) / 36525.0;\n\t\tdouble obliquity = 23.439292 - (((46.815 * T) + (T * T * 0.0006) - (T * T * T * 0.00181))/3600.0);\n\t\t\n\t\t//find moon declination\n\t\tdouble declination = theCalculator.findPlanetDeclination(obliquity, eclipticLat, eclipticLong);\n\t\tmoon.setDeclination(declination);\n\t\t\n\t\t//find moon right ascension\n\t\trightAsc = theCalculator.findPlanetRightAscension(obliquity, eclipticLat, eclipticLong);\n\t\tmoon.setRightAscension(rightAsc);\n\t\t\n\t\t//find moon hour angle\n\t\tdouble hourAngle = theCalculator.findHourAngle(rightAsc, userLocalTime);\n\t\tmoon.setHourAngle(hourAngle);\n\t\t\n\t\t//find moon phase - book's method\n\t\tdouble phase = Math.abs((trueLong - sunEcLong) * toRad);\n\t\t\t\t\n\t\t//find moon phase\t\t \n\t\tif ( phase > 2.2 ) //full moon to third quarter\n\t\t{\t\t\t\n\t\t\tif (phase >= 2.7) //full\n\t\t\t\tmoon.setUnicodeIcon(\"m10.png\");\n\t\t\tif (phase >= 2.6) \n\t\t\t\tmoon.setUnicodeIcon(\"m11.png\");\n\t\t\tif (phase >= 2.5) \n\t\t\t\tmoon.setUnicodeIcon(\"m12.png\");\n\t\t\tif (phase >= 2.4) \n\t\t\t\tmoon.setUnicodeIcon(\"m13.png\");\n\t\t\tif (phase >= 2.3) \n\t\t\t\tmoon.setUnicodeIcon(\"m14.png\");\n\t\t\tif (phase >= 2.2) \n\t\t\t\tmoon.setUnicodeIcon(\"m15.png\");\n\t\t\telse\n\t\t\t\tmoon.setUnicodeIcon(\"m16.png\"); //third quarter\n\t\t} \n\t\telse if ( phase > 1.55 ) //third quarter to first quarter\n\t\t{\t\t\t \n\t\t\tif (phase >= 2.2) //third quarter\n\t\t\t\tmoon.setUnicodeIcon(\"m16.png\");\n\t\t\tif (phase >= 2.1) \n\t\t\t\tmoon.setUnicodeIcon(\"m17.png\");\n\t\t\tif (phase >= 2.0) \n\t\t\t\tmoon.setUnicodeIcon(\"m18.png\");\n\t\t\tif (phase >= 1.8) \n\t\t\t\tmoon.setUnicodeIcon(\"m08.png\");\n\t\t\tif (phase >= 1.7) \n\t\t\t\tmoon.setUnicodeIcon(\"m07.png\");\n\t\t\tif (phase >= 1.6) \n\t\t\t\tmoon.setUnicodeIcon(\"m06.png\");\n\t\t\telse\n\t\t\t\tmoon.setUnicodeIcon(\"m05.png\"); //first quarter\n\t\t} \n\t\telse if ( phase > 1.0 ) //first quarter\n\t\t{\t\t\t\n\t\t\tif (phase >= 1.5) //first quarter\n\t\t\t\tmoon.setUnicodeIcon(\"m07.png\");\n\t\t\tif (phase >= 1.4) \n\t\t\t\tmoon.setUnicodeIcon(\"m07.png\");\n\t\t\tif (phase >= 1.3) \n\t\t\t\tmoon.setUnicodeIcon(\"m06.png\");\n\t\t\tif (phase >= 1.2) \n\t\t\t\tmoon.setUnicodeIcon(\"m06.png\");\n\t\t\tif (phase >= 1.1) \n\t\t\t\tmoon.setUnicodeIcon(\"m05.png\");\n\t\t\telse\n\t\t\t\tmoon.setUnicodeIcon(\"m05.png\"); //first quarter\n\t\t} \n\t\telse \t //new moon to first quarter\n\t\t{\t\t\t\n\t\t\tif (phase >= 1.0) //first quarter\n\t\t\t\tmoon.setUnicodeIcon(\"m05.png\");\n\t\t\tif (phase >= 0.9) \n\t\t\t\tmoon.setUnicodeIcon(\"m04.png\");\n\t\t\tif (phase >= 0.8) \n\t\t\t\tmoon.setUnicodeIcon(\"m03.png\");\n\t\t\tif (phase >= 0.7) \n\t\t\t\tmoon.setUnicodeIcon(\"m02.png\");\n\t\t\tif (phase >= 0.6) \n\t\t\t\tmoon.setUnicodeIcon(\"m01.png\");\n\t\t\telse\n\t\t\t\tmoon.setUnicodeIcon(\"m00.png\"); //new moon\n\t\t} \n \t}", "public String calculateDay(String day) throws ParseException {\n\t\tSimpleDateFormat simpleDateformat = new SimpleDateFormat(\"EEEE\");\r\n\t\tint iYear = Calendar.getInstance().get(Calendar.YEAR);\r\n\t\tint iMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;\r\n\t\tString yourDate = 15 + \"/\" + iMonth + \"/\" + iYear;\r\n\t\t// String string = yourDate;\r\n\t\tDateFormat format = new SimpleDateFormat(\"dd/MM/yyyy\", Locale.ENGLISH);\r\n\t\tDate date = format.parse(yourDate);\r\n\t\tthis.calculatedDay = simpleDateformat.format(date);\r\n\t\t//System.out.println(\"Calculated Day :: \" + this.calculatedDay);\r\n\t\treturn calculatedDay;\r\n\t}", "double getTickBorderDashOffset();", "public void removeDay(int day){ // verilen gundeki tum experimentlar silinir.\r\n Node last = head;\r\n if( last.data.day == day ){ // ilk gun serisinden istenirse direk next day e atla.\r\n head = last.nextDay;\r\n }\r\n else{\r\n while( last.next != null ){ // gunun basini bul\r\n if( last.next.data.day == day ){ // removeExp ile sil.\r\n removeExp(day, 0);\r\n }\r\n else\r\n last = last.next; // ilerle.\r\n }\r\n }\r\n }", "@java.lang.Override public app.onepass.apis.DayOfWeek getDay() {\n @SuppressWarnings(\"deprecation\")\n app.onepass.apis.DayOfWeek result = app.onepass.apis.DayOfWeek.valueOf(day_);\n return result == null ? app.onepass.apis.DayOfWeek.UNRECOGNIZED : result;\n }", "public int determineDayRandomly() {\n\t\treturn 0;\r\n\t}", "static double userOnDay(final float rate, final int day) {\n return Math.pow(rate, day);\n }", "public io.dstore.values.StringValueOrBuilder getDayOrBuilder() {\n if (dayBuilder_ != null) {\n return dayBuilder_.getMessageOrBuilder();\n } else {\n return day_ == null ?\n io.dstore.values.StringValue.getDefaultInstance() : day_;\n }\n }", "public static void season(int month, int day) {\r\n if (month >= 12 && month <= 3 && day <= 16 && day <= 15) {\r\n System.out.println(\"Winter\");\r\n }\r\n if (month >= 3 && month <= 6 && day <= 16 && day <= 15) {\r\n System.out.println(\"Spring\");\r\n }\r\n if (month >= 6 && month <= 9 && day <= 16 && day <= 15) {\r\n System.out.println(\"Summer\");\r\n }\r\n if (month >= 9 && month <= 12 && day <= 16 && day <= 15) {\r\n System.out.println(\"Fall\");\r\n }\r\n }", "public void setDay(final int day) {\n\t\tthis.day = day;\n\t}", "@Override\r\n\tpublic void physics() {\n\t\tSystem.out.println(\"Every Thursday evening\");\r\n\t\t\r\n\t}", "public Double getCarbon() {\n return product.getCarbon() * weight / 100;\n }", "public double getDPad() {\n\t\treturn this.getRawAxis(6);\n\t}", "@java.lang.Override\n public app.onepass.apis.DayOfWeek getDay() {\n @SuppressWarnings(\"deprecation\")\n app.onepass.apis.DayOfWeek result = app.onepass.apis.DayOfWeek.valueOf(day_);\n return result == null ? app.onepass.apis.DayOfWeek.UNRECOGNIZED : result;\n }", "public void setMac(java.lang.String mac) {\n this.mac = mac;\n }", "public void unsetDay()\n {\n synchronized (monitor())\n {\n check_orphaned();\n get_store().remove_element(DAY$0, 0);\n }\n }", "public String readEthMAC() {\r\n\t\treturn mFactoryBurnUtil.readEthMAC();\r\n\t}", "public String format(MacAddress mac) {\n byte[] b = mac.getInternalBytes();\n Oui oui = _byHashCode.get(Oui.hashCode(mac.getInternalBytes()));\n StringBuilder buf = new StringBuilder();\n\n if (oui == null) {\n buf.append(String.format(\"Unknown-%02x-%02x-%02x\", b[0], b[1], b[2]));\n } else {\n buf.append(oui.getShortName());\n }\n buf.append('-');\n\n for (int i = 3; i < MacAddress.ETH_ALEN; ++i) {\n if (i > 3) buf.append(':');\n buf.append(String.format(\"%02x\", b[i]));\n }\n\n return buf.toString();\n }", "public Date getDay() {\r\n return day;\r\n }", "public Date getDay() {\r\n return day;\r\n }", "public Date getDay() {\r\n return day;\r\n }", "public Date getDay() {\r\n return day;\r\n }", "public Date getDay() {\r\n return day;\r\n }", "public static boolean isMac() {\n\t\tString platform = SWT.getPlatform();\n\t\t\n\t\treturn (platform.equalsIgnoreCase(\"carbon\") || platform.equalsIgnoreCase(\"cocoa\"));\n\t}", "public int deleteByPrimaryKey(Date day, String mscid) {\r\n DyMscMgwSccp key = new DyMscMgwSccp();\r\n key.setDay(day);\r\n key.setMscid(mscid);\r\n int rows = getSqlMapClientTemplate().delete(\"DY_MSC_MGW_SCCP.ibatorgenerated_deleteByPrimaryKey\", key);\r\n return rows;\r\n }", "public ICareDailyDietChart(String mDate, String mTime, String mFoodMenu,\n\t\t\tString mEventName, String mAlarm, String mProfile) {\n\t\tthis.mDate = mDate;\n\t\tthis.mTime = mTime;\n\t\tthis.mEventName = mEventName;\n\t\tthis.mFoodMenu = mFoodMenu;\n\t\tthis.mAlarm = mAlarm;\n\t\tthis.mProfileId = mProfile;\n\t}" ]
[ "0.5747135", "0.4984603", "0.4729237", "0.45979315", "0.45145375", "0.44193342", "0.44025046", "0.43632177", "0.43584004", "0.42650777", "0.42184192", "0.42168382", "0.4177957", "0.41522455", "0.41474697", "0.41410518", "0.41263267", "0.41074225", "0.408753", "0.408753", "0.408753", "0.408753", "0.408753", "0.4086408", "0.40584248", "0.4041589", "0.403596", "0.40359348", "0.40359348", "0.40359348", "0.40355793", "0.40264007", "0.40214884", "0.39824086", "0.39715427", "0.39713222", "0.39671573", "0.3955179", "0.3946059", "0.39434928", "0.3934206", "0.3926957", "0.39244264", "0.3914898", "0.39103815", "0.39072302", "0.38996863", "0.38948065", "0.3871529", "0.3867169", "0.3867169", "0.3867169", "0.38652304", "0.3865191", "0.38649097", "0.3858946", "0.3853994", "0.38404563", "0.38400856", "0.38400856", "0.38251036", "0.38237843", "0.38214988", "0.3819406", "0.38188013", "0.3812472", "0.3811218", "0.37998882", "0.37824652", "0.37814137", "0.3779635", "0.37760845", "0.3773072", "0.37719926", "0.3769606", "0.37646833", "0.37478605", "0.3747275", "0.37457624", "0.37384924", "0.37352934", "0.37228137", "0.37187764", "0.37146506", "0.3711766", "0.3710211", "0.37082627", "0.37074903", "0.3703323", "0.36941433", "0.36939615", "0.3691016", "0.36898544", "0.36898544", "0.36898544", "0.36898544", "0.36898544", "0.36889935", "0.3684801", "0.36780304" ]
0.500716
1
Returns the MACD technical indicator for the series for the given day. Developed by Gerald Appel, Moving Average Convergence/Divergence (MACD) is one of the simplest and most reliable indicators available. MACD uses moving averages, which are lagging indicators, to include some trendfollowing characteristics. These lagging indicators are turned into a momentum oscillator by subtracting the longer moving average from the shorter moving average. The resulting plot forms a line that oscillates above and below zero, without any upper or lower limits.
public double MACD(int slow, int fast, int t) { if(slow<=fast) throw new IndexOutOfBoundsException("MACD(" + slow + " - " + fast + ") is undefined at time " + t); return expMovingAverage(slow, t) - expMovingAverage(fast, t); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override \r\n protected void calculate(int index, DataContext ctx)\r\n {\r\n DataSeries series = ctx.getDataSeries();\r\n boolean complete=true;\r\n \r\n /*\r\n int macdPeriod1 = getSettings().getInteger(MACD_PERIOD1, 12);\r\n int macdPeriod2 = getSettings().getInteger(MACD_PERIOD2, 26);\r\n Enums.MAMethod macdMethod = getSettings().getMAMethod(MACD_METHOD, Enums.MAMethod.EMA);\r\n Object macdInput = getSettings().getInput(MACD_INPUT, Enums.BarInput.CLOSE);\r\n if (index >= Util.max(macdPeriod1, macdPeriod2)) {\r\n Double MA1 = null, MA2 = null;\r\n MA1 = series.ma(macdMethod, index, macdPeriod1, macdInput);\r\n MA2 = series.ma(macdMethod, index, macdPeriod2, macdInput);\r\n \r\n double MACD = MA1 - MA2; \r\n series.setDouble(index, Values.MACD, MACD);\r\n\r\n int signalPeriod = getSettings().getInteger(Inputs.SIGNAL_PERIOD, 9);\r\n\r\n // Calculate moving average of MACD (signal line)\r\n Double signal = series.ma(getSettings().getMAMethod(Inputs.SIGNAL_METHOD, Enums.MAMethod.SMA), index, signalPeriod, Values.MACD);\r\n series.setDouble(index, Values.SIGNAL, signal);\r\n \r\n if (signal != null) series.setDouble(index, Values.HIST, MACD - signal);\r\n\r\n if (series.isBarComplete(index)) {\r\n // Check for signal events\r\n Coordinate c = new Coordinate(series.getStartTime(index), signal);\r\n if (crossedAbove(series, index, Values.MACD, Values.SIGNAL)) {\r\n MarkerInfo marker = getSettings().getMarker(Inputs.UP_MARKER);\r\n String msg = get(\"SIGNAL_MACD_CROSS_ABOVE\", MACD, signal);\r\n if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.BOTTOM, marker, msg));\r\n ctx.signal(index, Signals.CROSS_ABOVE, msg, signal);\r\n }\r\n else if (crossedBelow(series, index, Values.MACD, Values.SIGNAL)) {\r\n MarkerInfo marker = getSettings().getMarker(Inputs.DOWN_MARKER);\r\n String msg = get(\"SIGNAL_MACD_CROSS_BELOW\", MACD, signal);\r\n if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.TOP, marker, msg));\r\n ctx.signal(index, Signals.CROSS_BELOW, msg, signal);\r\n }\r\n }\r\n }\r\n else complete=false;\r\n \r\n int rsiPeriod = getSettings().getInteger(RSI_PERIOD);\r\n Object rsiInput = getSettings().getInput(RSI_INPUT);\r\n if (index < 1) return; // not enough data\r\n \r\n double diff = series.getDouble(index, rsiInput) - series.getDouble(index-1, rsiInput);\r\n double up = 0, down = 0;\r\n if (diff > 0) up = diff;\r\n else down = diff;\r\n \r\n series.setDouble(index, Values.UP, up);\r\n series.setDouble(index, Values.DOWN, Math.abs(down));\r\n \r\n if (index <= rsiPeriod +1) return;\r\n \r\n Enums.MAMethod method = getSettings().getMAMethod(RSI_METHOD);\r\n double avgUp = series.ma(method, index, rsiPeriod, Values.UP);\r\n double avgDown = series.ma(method, index, rsiPeriod, Values.DOWN);\r\n double RS = avgUp / avgDown;\r\n double RSI = 100.0 - ( 100.0 / (1.0 + RS));\r\n\r\n series.setDouble(index, Values.RSI, RSI);\r\n \r\n // Do we need to generate a signal?\r\n GuideInfo topGuide = getSettings().getGuide(Inputs.TOP_GUIDE);\r\n GuideInfo bottomGuide = getSettings().getGuide(Inputs.BOTTOM_GUIDE);\r\n if (crossedAbove(series, index, Values.RSI, topGuide.getValue())) {\r\n series.setBoolean(index, Signals.RSI_TOP, true);\r\n ctx.signal(index, Signals.RSI_TOP, get(\"SIGNAL_RSI_TOP\", topGuide.getValue(), round(RSI)), round(RSI));\r\n }\r\n else if (crossedBelow(series, index, Values.RSI, bottomGuide.getValue())) {\r\n series.setBoolean(index, Signals.RSI_BOTTOM, true);\r\n ctx.signal(index, Signals.RSI_BOTTOM, get(\"SIGNAL_RSI_BOTTOM\", bottomGuide.getValue(), round(RSI)), round(RSI));\r\n }\r\n */\r\n series.setComplete(index, complete);\r\n }", "public double MACDSignal(int t)\n {\n Series macd = new Series();\n macd.x = new double[macd.size = t + 1];\n for(int i = 0; i<=t; i++)\n macd.x[i] = MACD(i);\n return macd.expMovingAverage(9, t);\n }", "public void visitToneIndicator( DevCat devCat ) {}", "@Override\n BackgroundLineChart generateLineChart() {\n\n final BackgroundLineChart lineChart;\n final NumberAxis xAxis = new NumberAxis();\n xAxis.setLabel(\"Time\");\n\n List<XYChart.Series<Number, Number>> seriesList = FXCollections.observableArrayList();\n\n for (DataPoint.Type type : DataPoint.Types.values()) {\n XYChart.Series<Number, Number> series = new XYChart.Series<>();\n series.setName(type.getName());\n seriesList.add(series);\n this.getSeriesMap().put(type, series);\n }\n\n lineChart = new BackgroundLineChart(this.captureSession, xAxis, new NumberAxis(), FXCollections.observableArrayList(seriesList));\n\n //@Source - https://stackoverflow.com/a/44957354 - Enables Toggle of Data Series by clicking on their icon in the legend\n for (Node n : lineChart.getChildrenUnmodifiable()) {\n if (n instanceof Legend) {\n Legend l = (Legend) n;\n for (Legend.LegendItem li : l.getItems()) {\n for (XYChart.Series<Number, Number> s : lineChart.getData()) {\n if (s.getName().equals(li.getText())) {\n li.getSymbol().setCursor(Cursor.HAND); // Hint user that legend symbol is clickable\n li.setText(li.getText() + \" On\");\n li.getSymbol().setOnMouseClicked(me -> {\n if (me.getButton() == MouseButton.PRIMARY) {\n s.getNode().setVisible(!s.getNode().isVisible()); // Toggle visibility of line\n\n String[] displayName = li.getText().split(\" \");\n li.setText(String.format(\"%s %s\", String.join(\" \", Arrays.copyOfRange(displayName, 0, displayName.length - 1)), (s.getNode().isVisible() ? \"On\" : \"Off\")));\n for (XYChart.Data<Number, Number> d : s.getData()) {\n if (d.getNode() != null) {\n d.getNode().setVisible(s.getNode().isVisible()); // Toggle visibility of every node in the series\n }\n }\n lineChart.redraw();\n }\n });\n break;\n }\n }\n }\n }\n }\n //---\n\n return lineChart;\n }", "public abstract double getCarbon();", "private void initChart() {\n Cartesian cartesian = AnyChart.line();\n\n cartesian.animation(true);\n\n cartesian.padding(10d, 20d, 5d, 20d);\n\n cartesian.crosshair().enabled(true);\n cartesian.crosshair()\n .yLabel(true)\n // TODO ystroke\n .yStroke((Stroke) null, null, null, (String) null, (String) null);\n\n cartesian.tooltip().positionMode(TooltipPositionMode.POINT);\n\n cartesian.title(\"Steps taken in this week and last week\");\n\n cartesian.yAxis(0).title(\"Steps\");\n cartesian.xAxis(0).labels().padding(5d, 5d, 5d, 5d);\n\n List<DataEntry> seriesData = new ArrayList<>();\n Log.d(\"Size This Week\",stepsTakenModelsThisWeek.size()+\"\");\n for(int i = 0 ; i<7 ; i++){\n CustomDataEntry c = new CustomDataEntry(days[i],stepsTakenModelsLastWeek.get(i).getSteps());\n if(i<stepsTakenModelsThisWeek.size()){\n c.setValue(\"value2\",stepsTakenModelsThisWeek.get(i).getSteps());\n }else{\n if(DateUtilities.getDayInAbbBySelectedDate(stepsTakenModelsLastWeek.get(i).getDate()).equals(\n DateUtilities.getCurrentDayInAbb()))\n {\n c.setValue(\"value2\",stepsToday);\n }else{\n c.setValue(\"value2\",0);\n }\n }\n seriesData.add(c);\n }\n\n Set set = Set.instantiate();\n set.data(seriesData);\n Mapping series1Mapping = set.mapAs(\"{ x: 'x', value: 'value' }\");\n Mapping series2Mapping = set.mapAs(\"{ x: 'x', value: 'value2' }\");\n\n Line series1 = cartesian.line(series1Mapping);\n series1.name(\"Last Week\");\n series1.hovered().markers().enabled(true);\n series1.hovered().markers()\n .type(MarkerType.CIRCLE)\n .size(4d);\n series1.tooltip()\n .position(\"right\")\n .anchor(Anchor.LEFT_CENTER)\n .offsetX(5d)\n .offsetY(5d);\n\n Line series2 = cartesian.line(series2Mapping);\n series2.name(\"This Week\");\n series2.hovered().markers().enabled(true);\n series2.hovered().markers()\n .type(MarkerType.CIRCLE)\n .size(4d);\n series2.tooltip()\n .position(\"right\")\n .anchor(Anchor.LEFT_CENTER)\n .offsetX(5d)\n .offsetY(5d);\n\n\n cartesian.legend().enabled(true);\n cartesian.legend().fontSize(13d);\n cartesian.legend().padding(0d, 0d, 10d, 0d);\n\n chart.setChart(cartesian);\n }", "private String getStatusDay(LunarDate date) {\n if (Locale.SIMPLIFIED_CHINESE.equals(Locale.getDefault())\n || Locale.TRADITIONAL_CHINESE.equals(Locale.getDefault())) {\n if (date.holidayIdx != -1) {\n return RenderHelper.getStringFromList(R.array.holiday_array,\n date.holidayIdx);\n }\n if (date.termIdx != -1) {\n return RenderHelper.getStringFromList(R.array.term_array, date.termIdx);\n }\n }\n return getDay(date);\n }", "double getTickBorderDashOffset();", "public void mo2201i(C0317d dVar) {\n Rect rect = new Rect();\n m1278j(dVar).mo2221a(rect);\n dVar.mo2178a((int) Math.ceil((double) mo2199h(dVar)), (int) Math.ceil((double) mo2195d(dVar)));\n dVar.setShadowPadding(rect.left, rect.top, rect.right, rect.bottom);\n }", "public String[] defineDaysLine(String day) {\n int shiftPositions = -1;\n String[] definedDayLine = {Const.DAY_SUNDAY, Const.DAY_MONDAY, Const.DAY_TUESDAY, Const.DAY_WEDNESDAY,\n Const.DAY_THURSDAY, Const.DAY_FRIDAY, Const.DAY_SATURDAY};\n for (int i = 0; i < definedDayLine.length; i++) {\n if (day.equals(definedDayLine[i])) {\n shiftPositions = i;\n }\n }\n String[] tempArray = new String[definedDayLine.length];\n System.arraycopy(definedDayLine, shiftPositions, tempArray, 0, definedDayLine.length - shiftPositions);\n System.arraycopy(definedDayLine, 0, tempArray, definedDayLine.length - shiftPositions, shiftPositions);\n return tempArray;\n }", "@Override\n public void cycleSlipDataSet(String nameSat, AbsoluteDate date, double value, Frequency freq) {\n super.cycleSlipDataSet(nameSat, date, value, freq);\n }", "public String getSomeDayInfo(int day){\n\t\tHashMap<String,String> hashMap = getSomeDaydata(day);\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(hashMap.get(\"日期\")+\" \"+hashMap.get(\"天气\")+\"\\n\");\n\t\tsb.append(\"最\"+hashMap.get(\"最高温\")+\"\\n\"+\"最\"+hashMap.get(\"最低温\"));\n\t\tsb.append(\"\\n风力:\"+hashMap.get(\"风力\"));\n\n\t\treturn sb.toString();\n\t}", "public void setGraph(ActionEvent event)\n {\n theLineGraph.getData().clear();\n double temporary=0;\n theLineGraph.getXAxis().setLabel(\"Days\");\n\n XYChart.Series<String, Number> theGraph = new XYChart.Series<String, Number>();\n\n for (int i=0; i<Driver.save.getLog().size();i++)\n {\n String myI=i+\"\";\n\n if (event.getSource()==caloriesButton)\n {\n temporary=Driver.save.getDayCalories(i);\n theLineGraph.getYAxis().setLabel(\"Calories\");\n\n } else if(event.getSource()==protienButton)\n {\n temporary=Driver.save.getDayProtein(i);\n theLineGraph.getYAxis().setLabel(\"protien\");\n }\n else if (event.getSource()==carbsButton)\n {\n temporary=Driver.save.getDayCarbo(i);\n theLineGraph.getYAxis().setLabel(\"Carbs\");\n }\n else if (event.getSource()==fatsButton)\n {\n temporary=Driver.save.getDayFats(i);\n theLineGraph.getYAxis().setLabel(\"Fats\");\n }\n else if (event.getSource()==bevButton)\n {\n temporary=Driver.save.getDayBevarage(i);\n theLineGraph.getYAxis().setLabel(\"Drinks in ml\");\n }\n\n theGraph.getData().add(new XYChart.Data<String, Number>(myI ,temporary));\n }\n theLineGraph.getData().addAll(theGraph);\n\n }", "private void onCreateMoneyXYPlot(DateDoubleSeries coffeeExpenditureSeries, DateDoubleSeries teaExpenditureSeries) {\n // refreshes the chart (it will be loaded with default vals at this point)\n moneyXYPlot.clear();\n moneyXYPlot.redraw();\n\n // default graph: supports y from $0.00 to $20.00 in increments of $2.50, but this can be\n // overridden by very large values, in which case it's MAX_VALUE rounded to next\n // increment of $2.50, in increments of MAX_VALUE / 8\n double maxRange = 20;\n double maxYValue = Double.max(coffeeExpenditureSeries.getMaxYValue(), teaExpenditureSeries.getMaxYValue());\n if (maxYValue > 20) {\n if (maxYValue % 5 != 0) maxRange = maxYValue + (5 - (maxYValue % 5));\n else maxRange = maxYValue;\n }\n\n // formatting: add extra vals at beg/end (7 days +1 on each end = 9) to create a margin for the bars\n moneyXYPlot.setRangeStep(StepMode.SUBDIVIDE, 8);\n moneyXYPlot.setRangeBoundaries(0, maxRange, BoundaryMode.FIXED);\n moneyXYPlot.setDomainStep(StepMode.SUBDIVIDE, 10);\n\n // format the lines (color, smoothing, removing fill)\n LineAndPointFormatter coffeeLineFormatter = new LineAndPointFormatter(Color.parseColor(\"#ac9782\"),\n null, null, null);\n coffeeLineFormatter.getLinePaint().setStrokeWidth(8);\n coffeeLineFormatter.setInterpolationParams(new CatmullRomInterpolator.Params(20,\n CatmullRomInterpolator.Type.Centripetal)); // smooths out the lines\n coffeeLineFormatter.setFillPaint(null); // to prevent lines from filling .. may break in the future?\n LineAndPointFormatter teaLineFormatter = new LineAndPointFormatter(Color.parseColor(\"#4d7d55\"),\n null, null, null);\n teaLineFormatter.getLinePaint().setStrokeWidth(8);\n teaLineFormatter.setInterpolationParams(new CatmullRomInterpolator.Params(20,\n CatmullRomInterpolator.Type.Centripetal)); // smooths out the lines\n teaLineFormatter.setFillPaint(null);\n\n moneyXYPlot.addSeries(coffeeExpenditureSeries, coffeeLineFormatter);\n moneyXYPlot.addSeries(teaExpenditureSeries, teaLineFormatter);\n\n // initialize line and point renderer (must be done after set formatter and add series to the plot)\n moneyXYPlotRenderer = moneyXYPlot.getRenderer(LineAndPointRenderer.class);\n\n // X-AXIS = date values, formatted as \"10/27\"\n moneyXYPlot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).setFormat(new xAxisDateFormat());\n\n // Y-AXIS = dollar values, formatted as \"$50\"\n moneyXYPlot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.LEFT).setFormat(new Format() {\n @Override\n public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {\n // trying to format #'s like $13.50, but doesn't work for numbers ending in .0\n // double number = Double.parseDouble(String.format(\"%.2f\", ((Number) obj).doubleValue()));\n int number = ((Number) obj).intValue();\n return new StringBuffer(\"$\" + number);\n }\n\n @Override\n public Number parseObject(String string, ParsePosition position) {\n throw new UnsupportedOperationException(\"Not yet implemented.\");\n }\n });\n }", "private void setDataLineChart() {\n\t\t\n\t\tchartLine.setTitle(\"Evolution du Solde\");\n\t\tchartLine.getData().clear();\n\t\t\n\t\tXYChart.Series series = new XYChart.Series();\n\t\tseries.getData().clear();\n\t\tseries.setName(\"Evolution du solde\");\n\t\t\n\t\tdouble solde = bal.getAmount();\n\t\tint currentYear = Calendar.getInstance().get(Calendar.YEAR);\n\t\tint currentMonth = Calendar.getInstance().get(Calendar.MONTH);\n\t\tint currentDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);\n\t\t\n\t\t\n\t\t// Create a calendar object and set year and month\n\t\tCalendar mycal = new GregorianCalendar(currentYear, currentMonth,\n\t\t\t\tcurrentDay);\n\t\t\n\t\t// Get the number of days in that month\n\t\tint daysInMonth = mycal.getActualMaximum(Calendar.DAY_OF_MONTH);\n\t\t\n\t\tif (!bal.getTransactions().isEmpty()) {\n\t\t\tfor (IOTransactionLogic transaction : bal.getTransactions()\n\t\t\t\t\t.get(currentYear)[currentMonth]) {\n\t\t\t\tsolde -= transaction.getAmount();\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < currentDay; ++i) {\n\t\t\tif (!bal.getTransactions().isEmpty()) {\n\t\t\t\tfor (IOTransactionLogic transaction : bal.getTransactions()\n\t\t\t\t\t\t.get(currentYear)[currentMonth]) {\n\t\t\t\t\tjava.sql.Date dat = transaction.getDate();\n\t\t\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\t\t\tcal.setTime(dat);\n\t\t\t\t\tif (cal.get(Calendar.DAY_OF_MONTH) - 1 == i) {\n\t\t\t\t\t\tsolde += transaction.getAmount();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tseries.getData()\n\t\t\t\t\t.add(new XYChart.Data(String.valueOf(i + 1), solde));\n\t\t}\n\t\t\n\t\tchartLine.getData().addAll(series);\n\t\tchartLine.setLegendVisible(false);\n\t}", "JFreeChart generateDot();", "@Override\n\tpublic boolean testExitAtDay (StockData sd, int strategyId, int lookback) {\n\n\t\tboolean toReturn = false;\n\n\t\tMacD macdData = sd.getMacd494();\n\n\t\tdouble[] macd = macdData.getMacd();\n\t\tdouble[] signal = macdData.getSignal();\n\t\tdouble[] histogram = macdData.getHistogram();\n\n\t\t\t// If this is bullish strategy, in which case we are looking for the macd to cross up and over \n\t\t\t// center line or to cross back down the signal line (as a stop loss). We use the histogram to detect such\n\t\t\t// a signal line crossover.\n\t\tif (strategyId == 0) {\n\n\t\t\tif (((macd[lookback] > 0) && (macd[lookback + 1] < 0)) ||\n\t\t\t\t((histogram[lookback] < 0) && (histogram[lookback + 1] > 0)))\n\t\t\t\t\ttoReturn = true;\n\n\t\t}\n // This bullish strategy is just a slight modification -- it also exits if the MacD turns around at all.\n else if (strategyId == 1) {\n\n \t\tif (((macd[lookback] > 0) && (macd[lookback + 1] < 0)) ||\n\t\t\t\t((histogram[lookback] < 0) && (histogram[lookback + 1] > 0)) ||\n (macd[lookback] < macd[lookback + 1]))\n\t\t\t\t\ttoReturn = true;\n\n }\n\t\t\t// If this is bearish strategy, in which case we are looking for the macd to cross down and under the\n\t\t\t// center line or to cross back up the signal line (as a stop loss). We use the histogram to detect such\n\t\t\t// a signal line crossover.\n\t\telse if (strategyId == 2) {\n\n\t\t\tif (((macd[lookback] < 0) && (macd[lookback + 1] > 0)) ||\n\t\t\t\t((histogram[lookback] > 0) && (histogram[lookback + 1] < 0)))\n\t\t\t\t\ttoReturn = true;\n\n\t\t}\n // This bullish strategy is just a slight modification -- it also exits if the MacD turns around at all.\n else if (strategyId == 3) {\n\n \tif (((macd[lookback] < 0) && (macd[lookback + 1] > 0)) ||\n\t\t\t\t((histogram[lookback] > 0) && (histogram[lookback + 1] < 0)) ||\n (macd[lookback] > macd[lookback + 1]))\n\t\t\t\t\ttoReturn = true;\n\n }\n\n\t\treturn toReturn;\n\n\t}", "@Test\n public void test35() throws Throwable {\n Line2D.Double line2D_Double0 = new Line2D.Double(67.227245, 67.227245, 67.227245, 0.18);\n line2D_Double0.setLine((-1200.58567454322), (-329.479065), (-238.92597), 90.0);\n line2D_Double0.x1 = 50.0;\n double double0 = line2D_Double0.getY1();\n NumberAxis numberAxis0 = new NumberAxis(\"\");\n CombinedRangeCategoryPlot combinedRangeCategoryPlot0 = new CombinedRangeCategoryPlot((ValueAxis) numberAxis0);\n StackedAreaRenderer stackedAreaRenderer0 = new StackedAreaRenderer();\n combinedRangeCategoryPlot0.setRenderer((CategoryItemRenderer) stackedAreaRenderer0);\n AxisLocation axisLocation0 = combinedRangeCategoryPlot0.getRangeAxisLocation();\n DefaultValueDataset defaultValueDataset0 = new DefaultValueDataset(50.0);\n ThermometerPlot thermometerPlot0 = new ThermometerPlot((ValueDataset) defaultValueDataset0);\n PlotOrientation plotOrientation0 = thermometerPlot0.getOrientation();\n RectangleEdge rectangleEdge0 = Plot.resolveRangeAxisLocation(axisLocation0, plotOrientation0);\n SubCategoryAxis subCategoryAxis0 = new SubCategoryAxis(\"GT-wuOa\");\n List list0 = combinedRangeCategoryPlot0.getCategoriesForAxis(subCategoryAxis0);\n combinedRangeCategoryPlot0.setRangeAxis(0, (ValueAxis) numberAxis0, true);\n SystemColor systemColor0 = SystemColor.windowText;\n StatisticalBarRenderer statisticalBarRenderer0 = new StatisticalBarRenderer();\n BasicStroke basicStroke0 = (BasicStroke)statisticalBarRenderer0.getErrorIndicatorStroke();\n CategoryMarker categoryMarker0 = null;\n try {\n categoryMarker0 = new CategoryMarker((Comparable) 90.0, (Paint) systemColor0, (Stroke) basicStroke0, (Paint) systemColor0, (Stroke) basicStroke0, (-2471.265F));\n } catch(IllegalArgumentException e) {\n //\n // The 'alpha' value must be in the range 0.0f to 1.0f\n //\n assertThrownBy(\"org.jfree.chart.plot.Marker\", e);\n }\n }", "@Array({9}) \n\t@Field(16) \n\tpublic Pointer<Byte > TradingDay() {\n\t\treturn this.io.getPointerField(this, 16);\n\t}", "public Paint getSeriesPaint() {\n return this.seriesPaint;\n}", "public void showMonth(String mon){\n\tboolean val = false;\n\tfor(int i =0;i<arch.length && !val;i++){\n\t\tif(arch[i]!=null){\n\t\t\tif(arch[i].getDate().getMonth().equalsIgnoreCase(mon)){\n\t\t\t\tSystem.out.println(\"Name: \"+arch[i].getName());\n\t\t\t\tSystem.out.println(\"Day: \"+arch[i].getDate().getDay());\n\t\t\t\tSystem.out.println(\"Candle color: \"+arch[i].getCandle().getColor());\n\t\t\t\tSystem.out.println(\"Candle essence: \"+arch[i].getCandle().getEssence());\n\t\t\t\tSystem.out.println(\"-----------------------------------\");\n\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tval=true;\n\t\t}\n\t}\n}", "private void setupDailyBarChart() {\r\n BarChart chart = findViewById(R.id.chart);\r\n chart.getDescription().setEnabled(false);\r\n chart.setExtraOffsets(0, 0, 0, 10);\r\n chart.setNoDataText(getResources().getString(R.string.loading_graph));\r\n chart.getPaint(Chart.PAINT_INFO).setTextSize(Utils.convertDpToPixel(16f));\r\n chart.getLegend().setEnabled(false);\r\n\r\n // Show time on x-axis at three hour intervals\r\n XAxis xAxis = chart.getXAxis();\r\n xAxis.setValueFormatter(new IAxisValueFormatter() {\r\n @Override\r\n public String getFormattedValue(float value, AxisBase axis) {\r\n int valueInt = (int) value;\r\n if(valueInt == 0) {\r\n return \"12am\";\r\n } else if(valueInt > 0 && valueInt < 12) {\r\n return valueInt + \"am\";\r\n } else if(valueInt == 12) {\r\n return \"12pm\";\r\n } else {\r\n return (valueInt - 12) + \"pm\";\r\n }\r\n }\r\n });\r\n\r\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\r\n xAxis.setDrawGridLines(false);\r\n xAxis.setTextSize(14f);\r\n // show label for every three hours\r\n xAxis.setGranularity(3.0f);\r\n xAxis.setLabelCount(8);\r\n xAxis.setGranularityEnabled(true);\r\n\r\n // Show non-sedentary hours on left y-axis\r\n YAxis yAxisLeft = chart.getAxisLeft();\r\n yAxisLeft.setAxisMinimum(0f);\r\n yAxisLeft.setTextSize(14f);\r\n yAxisLeft.setGranularity(1.0f); // show integer values on y axis\r\n yAxisLeft.setGranularityEnabled(true);\r\n\r\n YAxis yAxisRight = chart.getAxisRight();\r\n yAxisRight.setEnabled(false);\r\n }", "public void setLineData(ArrayList<Integer> allDay) {\r\n\r\n ArrayList<String> xVals = new ArrayList<String>();\r\n for (int i = 1; i <= 24; i++) {\r\n xVals.add((i) + \"\");\r\n }\r\n\r\n ArrayList<Entry> vals1 = new ArrayList<Entry>();\r\n\r\n for (int i = 1; i <= 24; i++) {\r\n vals1.add(new Entry(allDay.get(i-1), i));\r\n }\r\n Log.v(\"vals1\",vals1.toString());\r\n \t\r\n \t\r\n// \tint count = 45;\r\n// \tint range = 100; \r\n// \tArrayList<String> xVals = new ArrayList<String>();\r\n// for (int i = 0; i < count; i++) {\r\n// xVals.add((1990 +i) + \"\");\r\n// }\r\n//\r\n// ArrayList<Entry> vals1 = new ArrayList<Entry>();\r\n//\r\n// for (int i = 0; i < count; i++) {\r\n// float mult = (range + 1);\r\n// float val = (float) (Math.random() * mult) + 20;// + (float)\r\n// // ((mult *\r\n// // 0.1) / 10);\r\n// vals1.add(new Entry(val, i));\r\n// }\r\n// \r\n \t\r\n // create a dataset and give it a type\r\n LineDataSet set1 = new LineDataSet(vals1, \"DataSet 1\");\r\n set1.setDrawCubic(true);\r\n set1.setCubicIntensity(0.2f);\r\n set1.setDrawFilled(true);\r\n set1.setDrawCircles(false); \r\n set1.setLineWidth(2f);\r\n set1.setCircleSize(5f);\r\n set1.setHighLightColor(Color.rgb(244, 117, 117));\r\n set1.setColor(Color.rgb(104, 241, 175));\r\n\r\n ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();\r\n dataSets.add(set1);\r\n\r\n // create a data object with the datasets\r\n LineData data = new LineData(xVals, dataSets);\r\n\r\n // set data\r\n nChart.setData(data);\r\n }", "private Double[] getDayValue24(DayEM dayEm) {\n\n\t Double[] dayValues = new Double[24];\n\n\t /* OPF-610 정규화 관련 처리로 인한 주석\n\t dayValues[0] = (dayEm.getValue_00() == null ? 0 : dayEm.getValue_00());\n\t dayValues[1] = (dayEm.getValue_01() == null ? 0 : dayEm.getValue_01());\n\t dayValues[2] = (dayEm.getValue_02() == null ? 0 : dayEm.getValue_02());\n\t dayValues[3] = (dayEm.getValue_03() == null ? 0 : dayEm.getValue_03());\n\t dayValues[4] = (dayEm.getValue_04() == null ? 0 : dayEm.getValue_04());\n\t dayValues[5] = (dayEm.getValue_05() == null ? 0 : dayEm.getValue_05());\n\t dayValues[6] = (dayEm.getValue_06() == null ? 0 : dayEm.getValue_06());\n\t dayValues[7] = (dayEm.getValue_07() == null ? 0 : dayEm.getValue_07());\n\t dayValues[8] = (dayEm.getValue_08() == null ? 0 : dayEm.getValue_08());\n\t dayValues[9] = (dayEm.getValue_09() == null ? 0 : dayEm.getValue_09());\n\t dayValues[10] = (dayEm.getValue_10() == null ? 0 : dayEm.getValue_10());\n\t dayValues[11] = (dayEm.getValue_11() == null ? 0 : dayEm.getValue_11());\n\t dayValues[12] = (dayEm.getValue_12() == null ? 0 : dayEm.getValue_12());\n\t dayValues[13] = (dayEm.getValue_13() == null ? 0 : dayEm.getValue_13());\n\t dayValues[14] = (dayEm.getValue_14() == null ? 0 : dayEm.getValue_14());\n\t dayValues[15] = (dayEm.getValue_15() == null ? 0 : dayEm.getValue_15());\n\t dayValues[16] = (dayEm.getValue_16() == null ? 0 : dayEm.getValue_16());\n\t dayValues[17] = (dayEm.getValue_17() == null ? 0 : dayEm.getValue_17());\n\t dayValues[18] = (dayEm.getValue_18() == null ? 0 : dayEm.getValue_18());\n\t dayValues[19] = (dayEm.getValue_19() == null ? 0 : dayEm.getValue_19());\n\t dayValues[20] = (dayEm.getValue_20() == null ? 0 : dayEm.getValue_20());\n\t dayValues[21] = (dayEm.getValue_21() == null ? 0 : dayEm.getValue_21());\n\t dayValues[22] = (dayEm.getValue_22() == null ? 0 : dayEm.getValue_22());\n\t dayValues[23] = (dayEm.getValue_23() == null ? 0 : dayEm.getValue_23());\n\t\t\t*/\n\t \n\t return dayValues;\n\t }", "void plotLineDeltaA(int[] shades1, boolean tScreened1, int[] shades2,\n boolean tScreened2, int shadeIndex, int xA, int yA, int zA,\n int dxBA, int dyBA, int dzBA, boolean clipped) {\n x1t = xA;\n x2t = xA + dxBA;\n y1t = yA;\n y2t = yA + dyBA;\n z1t = zA;\n z2t = zA + dzBA;\n if (clipped)\n switch (getTrimmedLine()) {\n case VISIBILITY_OFFSCREEN:\n return;\n case VISIBILITY_UNCLIPPED:\n clipped = false;\n }\n plotLineClippedA(shades1, tScreened1, shades2, tScreened2, shadeIndex, xA,\n yA, zA, dxBA, dyBA, dzBA, clipped, 0, 0);\n }", "private void jBtnFuzzyActionPerformed(java.awt.event.ActionEvent evt) {\n int rv = 0;\n String relax = jRelaxTxt.getText();\n rv = Integer.valueOf(relax);\n String ideal = jIdealTxt.getText();\n int normal = 0;\n //System.out.println(rv);\n \n //read data using readExcel class\n readExcel exData = new readExcel();\n double[][] chartData = exData.readDataset(myFile);\n \n //Line Chart with Series --used to show simulation data\n// DefaultCategoryDataset ds = new DefaultCategoryDataset();\n// final String series1 = \"max\";\n// final String series2 = \"foodCount\";\n// final String series3 = \"min\";\n// for(int i=0;i<chartData[0].length;i++){\n// ds.addValue(chartData[0][i], series1, String.valueOf(i));\n// ds.addValue(chartData[1][i], series2, String.valueOf(i));\n// ds.addValue((chartData[0][i]-rv), series3, String.valueOf(i));\n// }\n// JFreeChart simchart = ChartFactory.createLineChart(\"Simulation Result\", \"Day\", \"Value\", ds, PlotOrientation.VERTICAL, true, true, false);\n// simchart.setBackgroundPaint(Color.white);\n// final CategoryPlot plot = (CategoryPlot) simchart.getPlot();\n// plot.setBackgroundPaint(Color.lightGray);\n// plot.setRangeGridlinePaint(Color.white);\n// ChartFrame fr = new ChartFrame(\"Simulation Result\", simchart);\n// fr.setVisible(true);\n// fr.setSize(1000, 400);\n \n //fuzzy result\n DefaultCategoryDataset dataset = new DefaultCategoryDataset();\n double fx, Dx;\n \n String choice = jCBFuzzyType.getSelectedItem().toString();\n if(choice == \"One Side\"){\n for(int i=1;i<chartData[0].length;i++){\n Dx = chartData[0][i]-chartData[1][i];\n //Dx = chartData[1][i]-chartData[0][i];\n if(Dx>rv)\n fx=0;\n else\n fx=((rv+1)-Dx)/(rv+1);\n dataset.setValue(fx, \"\", String.valueOf(i));\n }\n }\n else{\n normal = Integer.valueOf(ideal);\n for(int i=1;i<chartData[0].length;i++){\n Dx = chartData[1][i]-normal;\n //Dx = chartData[1][i]-chartData[0][i];\n if(Dx>rv || Dx< -rv)\n fx=0;\n else\n fx=((rv+1)-abs(Dx))/(rv+1);\n System.out.println(\"Hasil simulasi:\"+chartData[1][i]+\" & Dx:\"+Dx+\" & fx:\"+fx);\n dataset.setValue(fx, \"\", String.valueOf(i));\n }\n }\n \n JFreeChart chart = ChartFactory.createLineChart(\"Fuzzy Requirement Satisfaction\", \"Day\", \"Fuzzy Satisfaction\", dataset, PlotOrientation.VERTICAL, false, true, false);\n CategoryPlot p = chart.getCategoryPlot();\n p.setRangeGridlinePaint(Color.DARK_GRAY);\n ChartFrame frame = new ChartFrame(\"Fuzzy Representation\",chart);\n frame.setVisible(true);\n frame.setSize(1000,400);\n\n }", "@Override\n public void show() {\n // display same beginning interface as SetTimeView\n super.show();\n \n // show title\n clock.getDigit(2).setText(0, \"Set Alarm\");\n \n for(int i = 0; i < DAYS.length; i++) {\n clock.getDigit(2).setText(i+2, DAYS[i]);\n }\n String str;\n for(int i = 0; i < DAYS.length; i++){\n str = DAYS[i];\n if(days[i]){\n str = \">\"+DAYS[i]+\"<\";\n }\n clock.getDigit(2).setText(i+2,str); \n }\n\n }", "public abstract int getDeviation(\n CalendarDate calendarDay,\n TZID tzid\n );", "private void plotDato() {\n List<Entry> entriesMedidas = new ArrayList<Entry>();\n entriesMedidas.add(new Entry((float) dato.getYears(), (float) dato.getMeasures()[mag]));\n LineDataSet lineaMedidas = new LineDataSet(entriesMedidas, \"Medida\");\n lineaMedidas.setAxisDependency(YAxis.AxisDependency.LEFT);\n lineaMedidas.setColor(ColorTemplate.rgb(\"0A0A0A\"));\n lineaMedidas.setCircleColor(ColorTemplate.rgb(\"0A0A0A\"));\n todasMedidas.add(lineaMedidas);\n }", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tint month;\n\t\tdouble maxtempereture,monthlytempereture,mintempereture;\n\t\tResultSet rs;\n\t\tlib.MySQL mysql = new lib.MySQL();\n\t\trs = mysql.selectAll();\n\t\tDefaultCategoryDataset data = new DefaultCategoryDataset();\n\t\ttry{\n\t\t\twhile(rs.next()){\n\t\t\t\tmonth = rs.getInt(\"Month\");\n\t\t\t\tmaxtempereture = rs.getDouble(\"MaxTempereture\");\n\t\t\t\tmonthlytempereture = rs.getDouble(\"MonthkyTempereture\");\n\t\t\t\tmintempereture = rs.getDouble(\"MinTempereture\");\n System.out.println(\"月:\" + month);\n System.out.println(\"最高気温:\" + maxtempereture);\n System.out.println(\"月間平均気温:\" + monthlytempereture);\n System.out.println(\"最低気温:\" + mintempereture);\n data.addValue(maxtempereture,\"MaxTempereture\",month+\"\");\n data.addValue(monthlytempereture,\"MonthlyTempereture\",month+\"\");\n data.addValue(mintempereture,\"MinTempereture\",month+\"\");\n\t\t }\n\t\t}catch(SQLException et){}\n\t\t JFreeChart chart = \n\t\t\t ChartFactory.createLineChart(\"TOKYO TEMPERETURE\",\n\t\t\t \"month\",\n\t\t\t \"tempereture\",\n\t\t\t data,\n\t\t\t PlotOrientation.VERTICAL,\n\t\t\t true,\n\t\t\t false,\n\t\t\t false);\n \n\n ChartPanel cpanel = new ChartPanel(chart);\n panel1.add(cpanel);\n cardlayout.next(this);\n\t}", "private void invokeHistoricChart(StockData sd)\r\n {\r\n\r\n debug(\"invokeHistoricChart(\" + sd.getName().toString() + \") - preparing to change\");\r\n\r\n String fileName = getString(\"WatchListTableModule.edit.historic_details_basic_name\") + sd.getSymbol().getDataSz();\r\n java.io.File theFile = new java.io.File(fileName);\r\n\r\n // First signal the chart if we are demo mode, we really do not want a problem\r\n // Then create a new instance of our chart.\r\n com.stockmarket.chart.ohlc.HighLowStockChart.DEMO_MODE = this.DEMO_MODE;\r\n com.stockmarket.chart.ohlc.HighLowStockChart chart = new com.stockmarket.chart.ohlc.HighLowStockChart();\r\n // If we have historic data send it through\r\n if (theFile.exists())\r\n {\r\n debug(\"invokeHistoricChart() - \" + fileName + \" exists preparing the Historic Chart\");\r\n chart.displayHighLowChart(fileName);\r\n }\r\n else if (this.DEMO_MODE)\r\n {\r\n // If we are demo mode display the Chart. With its default data\r\n javax.swing.JOptionPane.showMessageDialog(\r\n null,\r\n \"Application is in DEMO Mode\\n\"\r\n + \"No historic data for \"\r\n + sd.getName().toString()\r\n + \" exists, displaying default graph.\");\r\n chart.displayHighLowChart(null);\r\n }\r\n else\r\n {\r\n // If we are live mode and no historic data - tell the user to try later.\r\n // This is the case where the user reached a item to display as a chart\r\n // before the program has finished downloading.\r\n javax.swing.JOptionPane.showMessageDialog(\r\n null,\r\n \"Application has no historic data for \" + sd.getName().toString() + \"\\nTry again later!\");\r\n }\r\n\r\n debug(\"invokeHistoricChart() - Processing completed\");\r\n }", "@GetMapping(\"/charts-medications/{id}\")\n @Timed\n public List<Chart> getAllChartMedicationsByDate(@PathVariable Long id) {\n log.debug(\"REST request to get all Charts By Facility and with medication by date\");\n return chartService.findAllMedicationsByDay(id);\n }", "@Test\n public void test05() throws Throwable {\n CategoryPlot categoryPlot0 = new CategoryPlot();\n List list0 = categoryPlot0.getAnnotations();\n JFreeChart jFreeChart0 = new JFreeChart((Plot) categoryPlot0);\n categoryPlot0.removeChangeListener(jFreeChart0);\n LogAxis logAxis0 = new LogAxis(\"\");\n categoryPlot0.setRangeAxis(0, (ValueAxis) logAxis0, false);\n Line2D.Double line2D_Double0 = new Line2D.Double(2679.0111898666, 0.0, 0.0, 1.0);\n double double0 = line2D_Double0.getY2();\n }", "public static DefaultTableModel getSensorDataTime(String day, int id, Date date) {\n ResultSet rs = null;\n DefaultTableModel DTm = null;\n try (\n PreparedStatement stmt = conn.prepareStatement(SENSOR_DATA_TIME, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);) {\n stmt.setString(1, day);\n stmt.setInt(2, id);\n stmt.setDate(3, date);\n stmt.setDate(4, date);\n\n rs = stmt.executeQuery();\n System.out.println(stmt.toString());\n DTm = buildTableModel(rs);\n\n } catch (SQLException e) {\n System.err.println(e);\n }\n return DTm;\n }", "public MonthPanel(DayPanel dp) {\n \t\tsuper(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);\n \t\t\n \t\tJPanel panel = new JPanel(new GridLayout(6,7));\n \n \t\tDayDto day = dp.getDay();\n \t\tthis.d = day.getDate();\n \t\t\n \t\t//GregorianCalendar cal = new GregorianCalendar();\n \t\tCalendar cal = GregorianCalendar.getInstance();\n \t\tcal.setTime(this.d);\n \t\t\n \t\t//cal.set(Calendar.DATE, 1);\n \t\t//cal.set(Calendar.MONTH, d.getMonth() - 1);\n \t\t//cal.set(Calendar.YEAR, d.getYear());\n \t\t\n \t\tint m= cal.get(Calendar.MONTH) + 1;\n \t\t\n \t\tString month = \"December\";\n \t\tif (m == 1) month = \"January\";\n \t\telse if (m == 2) month = \"February\";\n \t\telse if (m == 3) month = \"March\";\n \t\telse if (m == 4) month = \"April\";\n \t\telse if (m == 5) month = \"May\";\n \t\telse if (m == 6) month = \"June\";\n \t\telse if (m == 7) month = \"July\";\n \t\telse if (m == 8) month = \"August\";\n \t\telse if (m == 9) month = \"September\";\n \t\telse if (m == 10) month = \"October\";\n \t\telse if (m == 11) month = \"November\";\n \t\t\n \t\tmonth = month + \" \" + cal.get(Calendar.YEAR);\n \t\t\n \t\t//prevDays is the number of boxes in the upper left, before the first of the month, needed since the \n \t\t//calendar is going to be a 6x7 set of boxes. Calendar.SUNDAY is 1 and so forth, so we use day of week - 1\n \t\tint prevDays = cal.get(Calendar.DAY_OF_WEEK) - 1; \n \t\tint endDays = 42 - cal.getActualMaximum(Calendar.DAY_OF_MONTH) - prevDays;\n \t\t\n \t\t/*System.out.println(\"Calendar.DAY_OF_WEEK: \" + Calendar.DAY_OF_WEEK);\n \t\t//System.out.println(\"Calendar.DATE\" + Calendar.DATE);\n \t\t//System.out.println(\"Calendar.MONTH\" + cal.get(Calendar.MONTH));\n \t\t//System.out.println(\"Calendar.YEAR\" + cal.get(Calendar.YEAR));\n \t\t//System.out.println(\"prevDays: \" + prevDays);\n \t\t//System.out.println(\"endDays: \" + endDays);*/\n \t\t\n\t\tcal.roll(Calendar.MONTH, false);\n \t\t\n \t\tfor (int i = 1; i <= prevDays; i++) {\n\t\t\tCalendar c = new GregorianCalendar(cal.get(Calendar.MONTH) + 1, cal.getActualMaximum(Calendar.DAY_OF_MONTH) - prevDays + i, cal.get(Calendar.YEAR));\n \t\t\tjava.sql.Date date = new Date(c.getTime().getTime());\n \t\t\tpanel.add(new DayBlock(date, Color.LIGHT_GRAY));\n \t\t}\n\t\t\n\t\tcal.roll(Calendar.MONTH, true);\n\t\t\n \t\tfor (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {\n\t\t\tCalendar c = new GregorianCalendar(cal.get(Calendar.MONTH), i, cal.get(Calendar.YEAR));\n \t\t\tjava.sql.Date date = new Date(c.getTime().getTime());\n \t\t\tpanel.add(new DayBlock(date));\n \t\t}\n \t\t\n\t\tcal.roll(Calendar.MONTH, true);\n\t\t\n \t\tfor (int i = 1; i <= endDays; i++) {\n\t\t\tCalendar c = new GregorianCalendar(cal.get(Calendar.MONTH) + 1, i, cal.get(Calendar.YEAR));\n \t\t\tjava.sql.Date date = new Date(c.getTime().getTime());\n \t\t\tpanel.add(new DayBlock(date, Color.LIGHT_GRAY));\n \t\t}\n \t\t\n \t\tMonthHeadingPanel mhp = new MonthHeadingPanel(month);\n \t\tJPanel main = new JPanel(new BorderLayout());\n \t\tmain.add(mhp, BorderLayout.NORTH);\n \t\t\n \t\tmain.add(panel, BorderLayout.CENTER);\n \t\t\n \t\tsetViewportView(main);\n \t}", "public void dayNightCycle(boolean debug) {\r\n float distance;\r\n int timeUnit;\r\n float max;\r\n if (debug) {\r\n timeUnit = seconds - 5;\r\n max = 60 / 2f;\r\n } else {\r\n timeUnit = hours - 2;\r\n max = 24 / 2f;\r\n }\r\n\r\n if (timeUnit <= max) {\r\n distance = timeUnit;\r\n } else {\r\n distance = max - (timeUnit - max);\r\n }\r\n\r\n dayOpacity = distance / max;\r\n }", "private void createChart() {\n LineChart lineChart = (LineChart) findViewById(R.id.line_chart);\n\n // LineChart DataSet\n ArrayList<LineDataSet> dataSets = new ArrayList<>();\n\n // x-coordinate format value\n XAxis xAxis = lineChart.getXAxis();\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n xAxis.setGranularity(1f); // only intervals of 1 day\n// xAxis.setValueFormatter(new DayAxisValueFormatter(lineChart));\n\n\n // x-coordinate value\n ArrayList<String> xValues = new ArrayList<>();\n xValues.add(\"No.1\");\n xValues.add(\"No.2\");\n xValues.add(\"No.3\");\n xValues.add(\"No.4\");\n xValues.add(\"No.5\");\n\n // value\n ArrayList<Entry> value = new ArrayList<>();\n String measureItemName = \"\";\n value.add(new Entry(100, 0));\n value.add(new Entry(120, 1));\n value.add(new Entry(150, 2));\n value.add(new Entry(250, 3));\n value.add(new Entry(500, 4));\n\n\n // add value to LineChart's DataSet\n LineDataSet valueDataSet = new LineDataSet(value, measureItemName);\n dataSets.add(valueDataSet);\n\n // set LineChart's DataSet to LineChart\n// lineChart.setData(new LineData(xValues, dataSets));\n lineChart.setData(new LineData(valueDataSet));\n }", "@Test\n public void test76() throws Throwable {\n SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-614), \"\", 0, 0, 0, (-1), 0, 0, 3473, (-1));\n DateAxis dateAxis0 = new DateAxis(\"\", (TimeZone) simpleTimeZone0);\n CombinedRangeCategoryPlot combinedRangeCategoryPlot0 = new CombinedRangeCategoryPlot((ValueAxis) dateAxis0);\n DatasetRenderingOrder datasetRenderingOrder0 = combinedRangeCategoryPlot0.getDatasetRenderingOrder();\n CombinedRangeXYPlot combinedRangeXYPlot0 = new CombinedRangeXYPlot((ValueAxis) dateAxis0);\n BasicStroke basicStroke0 = (BasicStroke)combinedRangeXYPlot0.getDomainZeroBaselineStroke();\n PipedInputStream pipedInputStream0 = new PipedInputStream();\n PipedOutputStream pipedOutputStream0 = new PipedOutputStream(pipedInputStream0);\n DataOutputStream dataOutputStream0 = new DataOutputStream((OutputStream) pipedOutputStream0);\n ObjectOutputStream objectOutputStream0 = new ObjectOutputStream((OutputStream) dataOutputStream0);\n SerialUtilities.writeStroke(basicStroke0, objectOutputStream0);\n SystemColor systemColor0 = SystemColor.text;\n LookupPaintScale lookupPaintScale0 = new LookupPaintScale((double) 0, 1955.7194307587054, (Paint) systemColor0);\n PaintScaleLegend paintScaleLegend0 = new PaintScaleLegend((PaintScale) lookupPaintScale0, (ValueAxis) dateAxis0);\n AxisLocation axisLocation0 = paintScaleLegend0.getAxisLocation();\n combinedRangeCategoryPlot0.setDomainAxisLocation(334, axisLocation0);\n }", "public void fillCal(Model i)\n {\n for (int y = 0; y < 6; y++)\n {\n for (int j=0; j< 7; j++)\n {\n tableModel.setValueAt(null, y, j);\n }\n }\n int NumberOfDays = i.getMaxDayOfMonth();\n int DayOfWeek = i.getFdayOfWeek();\n JLabel xCord = new JLabel(String.valueOf(NumberOfDays));\n for (int x = 1; x <= NumberOfDays; x++)\n {\n int row = new Integer((x+ DayOfWeek - 2) / 7);\n int column = (x + DayOfWeek - 2) % 7;\n if(x == i.getDate() && i.getMonth() == i.realMonth())\n {\n String y = \"[\" + x + \"]\";\n tableModel.setValueAt(y, row, column);\n }\n else {\n tableModel.setValueAt(x, row, column);\n }\n }\n }", "public void generateMahadashaAndAntardashaTable(Vector<MahaDashaBean> dasha, PdfContentByte canvas, String planetname, int tableX, float tableY,ColorElement mycolor) {\n\t\tFont font = new Font();\n\t\tfont.setSize(this.getTableDatafont());\n\t\tfont.setColor(mycolor.fillColor(getTableDataColor()));\n\t\t//Font font2 = new Font();\n\t\t// font2.setSize(this.getTableDatafont());\n\t\t// font2.setStyle(\"BOLD\");\n\t\tFont font3 = new Font();\n\t\tfont3.setSize(this.getSemiHeading());\n\t\tfont3.setColor(mycolor.fillColor(getTableHeadingColor()));\n\t\t// RashiHouseBean rashiBean=null;\n\t\tMahaDashaBean mahadashabean = null;\n\t\tPdfPTable mahadashaTable = null;\n\n\t\t//\tColumnText.showTextAligned(canvas, Element.ALIGN_CENTER,new Phrase(planetname,font3),tableX+10,tableY+15,0);\n\t\tmahadashaTable = new PdfPTable(3);\n\t\tmahadashaTable.setTotalWidth(140);\n\t\tString[] monthArr = new String[2];\n\t\tString month = null;\n\t\ttry {\n\t\t\tmahadashaTable.setWidths(new int[]{40, 50, 50});\n\t\t} catch (DocumentException ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"Antar\", font3)));\n\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"Beginning\", font3)));\n\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"Ending\", font3)));\n\n\n\t\tif (!StringUtils.isBlank(dasha.get(0).getYear())) {\n\t\t\t// logger.info(\"**************||||||||||||||||||Antardashaaaaaaaaaaaaaaaaaaa||||||||||||||||||\" + dasha.get(0).getYear());\n\t\t\tmonthArr = dasha.get(0).getYear().split(\"_\");\n\n\t\t\tColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase(monthArr[0], font3), tableX + 20, tableY + 15, 0);\n\t\t\tColumnText.showTextAligned(canvas, Element.ALIGN_CENTER,\n\t\t\t\t\tnew Phrase(monthArr[1], font), tableX + 35, tableY + 4, 0);\n\n\t\t}\n\n\n\t\tfor (int loop = 0; loop < dasha.size(); loop++) {\n\t\t\t// rashiBean=(RashiHouseBean)dasha.get(loop);\n\t\t\tmahadashabean = (MahaDashaBean) dasha.get(loop);\n\t\t\tdrawLine1(canvas, tableX, tableY, tableX + 140, tableY);\n\t\t\tdrawLine1(canvas, tableX, (tableY - 15), tableX + 140, (tableY - 15));\n\t\t\tdrawLine1(canvas, tableX, (tableY - 125), tableX + 140, (tableY - 125));\n\n\t\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(mahadashabean.getPlanetName(), font)));\n\t\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\t\tString tm=mahadashabean.getStartTime();\n\t\t\tif(tm!=null && tm!=\"\")\n\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(tm.split(\" \")[0], font)));\n\t\t\telse\n\t\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"\", font)));\n\t\t\t\n\t\t\tmahadashaTable.getDefaultCell().setBorderWidth(0);\n\t\t\ttm=mahadashabean.getEndTime();\n\t\t\t\tif(tm!=null && tm!=\"\")\n\t\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(tm.split(\" \")[0], font)));\n\t\t\t\telse\n\t\t\t\tmahadashaTable.addCell(new Phrase(new Chunk(\"\", font)));\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\n\t\t}\n\t\tmahadashaTable.writeSelectedRows(0, -1, tableX, tableY, writer.getDirectContent());\n\n\n\n\t}", "public void plotData(boolean appendingData, boolean mean) {\n\n // Add data to existing plaot if appending.\n if (appendingData && chartpanel != null) {\n appendData();\n } else {\n String xaxisname = \"Plane\";\n // Create an chart empty.\n if (mean) {\n xaxisname = \"Length\";\n }\n final JFreeChart chart = createChart(xaxisname);\n chart.setBackgroundPaint(Color.WHITE); //DJ: 09/22/2014\n\n // Get the data.\n if (mean) {\n data = getLineDataset();\n } else {\n data = getDataset();\n }\n\n // Apply data to the plot\n MimsXYPlot xyplot = (MimsXYPlot) chart.getPlot();\n\n xyplot.setBackgroundPaint(Color.WHITE); //DJ: 09/22/2014\n\n xyplot.setDataset(data);\n xyplot.setRois(rois);\n xyplot.setParent(this);\n\n //DJ 09/22/2014\n final int numberOfSeries = xyplot.getSeriesCount();\n //System.out.println(\"number-of-series = \" + numberOfSeries);\n\n /*\n System.out.println(\"range up limit = \" + xyplot.getRangeAxis().getRange().getUpperBound());\n System.out.println(\"range down limit = \" + xyplot.getRangeAxis().getRange().getLowerBound());\n System.out.println(\"domain up limit = \" + xyplot.getDomainAxis().getRange().getUpperBound());\n System.out.println(\"domain down limit = \" + xyplot.getDomainAxis().getRange().getLowerBound());\n */\n // Generate the layout.\n //chartpanel = new MimsChartPanel(chart);\n chartpanel = new MimsChartPanel(chart);\n chartpanel.addMouseListener(this);\n chartpanel.setPreferredSize(new java.awt.Dimension(600, 400));\n String lastFolder = ui.getLastFolder();\n if (lastFolder != null) {\n if (new File(lastFolder).exists()) {\n chartpanel.setDefaultDirectoryForSaveAs(new File(lastFolder));\n }\n }\n this.add(chartpanel);\n\n chartpanel.setNumberOfSeries(numberOfSeries);\n\n // DJ: 09/22/2014\n // Add menu item for thikining or the plot lines\n // increase lines thikness\n JMenuItem incresaseLinesThikness = new JMenuItem(\"Increase Lines Thickness\");\n incresaseLinesThikness.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n //DJ\n\n lineThikness = chartpanel.getLineThikness();\n\n if (chartpanel.setLineThikness(lineThikness + 0.5f)) {\n lineThikness = chartpanel.getLineThikness();\n //if (lineThikness + 1.0f <= maxThikness) {\n // lineThikness += 1.0f;\n\n BasicStroke stroke = new BasicStroke(lineThikness);\n Plot plot = chart.getXYPlot();\n\n if (plot instanceof CategoryPlot) {\n CategoryPlot categoryPlot = chart.getCategoryPlot();\n CategoryItemRenderer cir = categoryPlot.getRenderer();\n try {\n for (int i = 0; i < numberOfSeries; i++) {\n cir.setSeriesStroke(i, stroke); //series line style\n }\n } catch (Exception ex) {\n System.err.println(ex);\n }\n } else if (plot instanceof XYPlot) {\n\n XYPlot xyPlot = chart.getXYPlot();\n XYItemRenderer xyir = xyPlot.getRenderer();\n try {\n for (int i = 0; i < numberOfSeries; i++) {\n xyir.setSeriesStroke(i, stroke); //series line style\n }\n } catch (Exception ex) {\n System.err.println(ex);\n }\n }\n }\n }\n });\n\n // increase lines thikness\n JMenuItem decreaseLinesThikness = new JMenuItem(\"Decrease Lines Thickness\");\n decreaseLinesThikness.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n //DJ\n lineThikness = chartpanel.getLineThikness();\n\n if (chartpanel.setLineThikness(lineThikness - 0.5f)) {\n lineThikness = chartpanel.getLineThikness();\n //if (lineThikness - 1.0f >= minThikness) {\n // lineThikness -= 1.0f;\n\n BasicStroke stroke = new BasicStroke(lineThikness);\n Plot plot = chart.getXYPlot();\n\n if (plot instanceof CategoryPlot) {\n CategoryPlot categoryPlot = chart.getCategoryPlot();\n CategoryItemRenderer cir = categoryPlot.getRenderer();\n try {\n for (int i = 0; i < numberOfSeries; i++) {\n cir.setSeriesStroke(i, stroke); //series line style\n }\n } catch (Exception ex) {\n System.err.println(ex);\n }\n } else if (plot instanceof XYPlot) {\n\n XYPlot xyPlot = chart.getXYPlot();\n XYItemRenderer xyir = xyPlot.getRenderer();\n try {\n for (int i = 0; i < numberOfSeries; i++) {\n xyir.setSeriesStroke(i, stroke); //series line style\n }\n } catch (Exception ex) {\n System.err.println(ex);\n }\n }\n }\n }\n });\n\n chartpanel.getPopupMenu().addSeparator();\n chartpanel.getPopupMenu().add(incresaseLinesThikness);\n chartpanel.getPopupMenu().add(decreaseLinesThikness);\n\n JMenu changePlotColor = new JMenu(\"Change Plot Color\");\n final JMenuItem black = new JMenuItem(\"BLACK\");\n final JMenuItem blue = new JMenuItem(\"BLUE\");\n final JMenuItem grey = new JMenuItem(\"GRAY\");\n final JMenuItem green = new JMenuItem(\"GREEN\");\n final JMenuItem red = new JMenuItem(\"RED\");\n final JMenuItem yellow = new JMenuItem(\"YELLOW\");\n final JMenuItem purple = new JMenuItem(\"PURPLE\");\n final JMenuItem brown = new JMenuItem(\"BROWN\");\n final JMenuItem orange = new JMenuItem(\"ORANGE\");\n final JMenuItem darkGreen = new JMenuItem(\"DARK GREEN\");\n final JMenuItem lightBlue = new JMenuItem(\"LIGHT BLUE\");\n\n black.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(black.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 97, 'a');\n chartpanel.keyPressed(ev);\n }\n });\n blue.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(blue.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 98, 'b');\n chartpanel.keyPressed(ev);\n }\n });\n grey.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(grey.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 101, 'e');\n chartpanel.keyPressed(ev);\n }\n });\n green.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(green.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 103, 'g');\n chartpanel.keyPressed(ev);\n }\n });\n red.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(red.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 114, 'r');\n chartpanel.keyPressed(ev);\n }\n });\n yellow.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(yellow.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 121, 'y');\n chartpanel.keyPressed(ev);\n }\n });\n purple.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(purple.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 112, 'p');\n chartpanel.keyPressed(ev);\n }\n });\n brown.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(brown.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 119, 'w');\n chartpanel.keyPressed(ev);\n }\n });\n orange.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(orange.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 111, 'o');\n chartpanel.keyPressed(ev);\n }\n });\n darkGreen.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(darkGreen.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 100, 'd');\n chartpanel.keyPressed(ev);\n }\n });\n lightBlue.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n KeyEvent ev = new KeyEvent(lightBlue.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), 108, 'l');\n chartpanel.keyPressed(ev);\n }\n });\n\n changePlotColor.add(black);\n changePlotColor.add(blue);\n changePlotColor.add(grey);\n changePlotColor.add(green);\n changePlotColor.add(red);\n changePlotColor.add(yellow);\n changePlotColor.add(purple);\n changePlotColor.add(brown);\n changePlotColor.add(orange);\n changePlotColor.add(darkGreen);\n changePlotColor.add(lightBlue);\n\n chartpanel.getPopupMenu().add(changePlotColor);\n\n // Add menu item for showing/hiding crosshairs.\n JMenuItem xhairs = new JMenuItem(\"Show/Hide Crosshairs\");\n xhairs.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n showHideCrossHairs(chartpanel);\n }\n });\n chartpanel.getPopupMenu().addSeparator();\n chartpanel.getPopupMenu().add(xhairs);\n // Add menu item for showing/hiding crosshairs.\n JMenuItem pointhairs = new JMenuItem(\"Add point roi at crosshairs\");\n pointhairs.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n if (pointX > 0 && pointY > 0) {\n ui.getRoiManager().add(new PointRoi(pointX, pointY));\n ui.updateAllImages();\n }\n }\n });\n chartpanel.getPopupMenu().add(pointhairs);\n // Add menu item for toggling between linear and log scales.\n JMenuItem logscale = new JMenuItem(\"Log/Linear scale\");\n logscale.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n MimsJFreeChart.logLinScale(chartpanel);\n }\n });\n chartpanel.getPopupMenu().add(logscale);\n\n // Add menu item for exporting plot to report.\n /*JMenuItem genreport = new JMenuItem(\"Generate Report\");\n genreport.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n generateReport();\n }\n });\n chartpanel.getPopupMenu().add(genreport);*/\n JMenuItem libreoffice = new JMenuItem(\"Add to Libreoffice\");\n libreoffice.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n mimsUno.insertGraph(getImage(), \"test\", \"test\", \"test\");\n }\n });\n chartpanel.getPopupMenu().add(libreoffice);\n\n // Replace Save As... menu item.\n chartpanel.getPopupMenu().remove(3);\n JMenuItem saveas = new JMenuItem(\"Save as...\");\n saveas.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n saveAs();\n }\n });\n chartpanel.getPopupMenu().add(saveas, 3);\n\n // Add an option for getting the underlying data\n JMenuItem asTextMenuItem = new javax.swing.JMenuItem(\"Display text\");\n asTextMenuItem.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n displayProfileData();\n }\n });\n chartpanel.getPopupMenu().add(asTextMenuItem, 2);\n\n // Add key listener.\n KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {\n public boolean dispatchKeyEvent(KeyEvent e) {\n if (e.getID() == KeyEvent.KEY_PRESSED && thisHasFocus()) {\n chartpanel.keyPressed(e);\n }\n return false;\n }\n });\n\n pack();\n setVisible(true);\n\n }\n }", "private void formData(final String label, final int datasetIndex, final int year, final int month, final int day, final LinkedHashMap<Long,Double> data)\n {\n if (thread != null)\n thread.interrupt();\n chart.clearValues();\n if(day==0)\n {\n chart.getXAxis().setValueFormatter(new ValueFormatter() {\n @Override\n public String getFormattedValue(float value)\n {\n String days[] =getResources().getStringArray(R.array.days);\n int day = (int) value % days.length;\n if(day<0)\n return \"\";\n else\n return days[day];\n }\n });\n thread = new Thread(new Runnable()\n {\n\n @Override\n public void run()\n {\n Double[] daysSumArray = {0.0,0.0 ,0.0 ,0.0 ,0.0 ,0.0 ,0.0 };\n SortedSet<Long> keys = new TreeSet<>(data.keySet());\n for (Long key : keys)\n {\n Double value = data.get(key);\n Date date = new Date(key);\n int day_to_show = getDayNumber(date); //days start at 1 which is SUN\n int year_to_show = getYearNumber(date);\n int month_to_show = getMonthNumber(date)+1; //months start ta 0 which is JAN\n\n\n /* YEAR | MONTH | DAY || GRAPH FILTER\n ----------------------------------------------------\n all | all | all || days\n ----------------------------------------------------\n 2020 | all | all || days->2020\n ----------------------------------------------------\n 2020 | jan | all || days->2020->jan\n ----------------------------------------------------\n all | jan | all || days->jan*/\n if(month==0 && year==0)\n daysSumArray[day_to_show-1] += value;\n else if(month==0 && year>0)\n {\n //days->2020\n if(year_to_show==year)\n daysSumArray[day_to_show-1] += value;\n }\n else if(month>0 && year>0)\n {\n //days->2020->jan\n if(year_to_show==year && month_to_show == month)\n daysSumArray[day_to_show-1] += value;\n }\n else if(month>0 && year==0)\n {\n //days->jan\n if(month_to_show == month)\n daysSumArray[day_to_show-1] += value;\n }\n\n\n }\n for(int c=0; c<=6; c++)\n getActivity().runOnUiThread(new OneShotTask(label, datasetIndex,(long)c+1,daysSumArray[c]));\n\n }\n });\n\n thread.start();\n }\n else if( day >0 && day <8)\n {\n chart.getXAxis().setValueFormatter(new ValueFormatter() {\n @Override\n public String getFormattedValue(float value)\n {\n String hours[] =getResources().getStringArray(R.array.hours_24);\n int hour = (int) value % hours.length;\n if(hour<0)\n return \"\";\n else\n return hours[hour];\n }\n });\n thread = new Thread(new Runnable()\n {\n\n @Override\n public void run()\n {\n\n Double[] hoursSumArray = {0.0,0.0 ,0.0 ,0.0 ,0.0 ,0.0 ,0.0, 0.0, 0.0, 0.0, 0.0, 0.0,0.0,0.0 ,0.0 ,0.0 ,0.0 ,0.0 ,0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };\n SortedSet<Long> keys = new TreeSet<>(data.keySet());\n for (Long key : keys)\n {\n Double value = data.get(key);\n Date date = new Date(key);\n int day_to_show = getDayNumber(date); //days start at 1 which is SUN\n int year_to_show = getYearNumber(date);\n int month_to_show = getMonthNumber(date)+1; //months start ta 0 which is JAN\n int hour_of_day = getHourNumber(date);\n\n\n /* YEAR | MONTH | DAY || GRAPH FILTER\n ----------------------------------------------------\n 2020 | jan | mon || hours->2020->jan->mon\n ----------------------------------------------------\n all | jan | mon || hours->jan->mon\n ----------------------------------------------------\n all | all | mon || hours->mon\n ----------------------------------------------------\n 2020 | all | mon || hours->2020->mon\n ----------------------------------------------------\n */\n if(month>0 && year>0 && day_to_show == day)\n {\n if(year_to_show==year && month_to_show == month)\n hoursSumArray[hour_of_day]+=value;\n }\n else if(month>0 && year==0 && day_to_show == day)\n {\n if(month_to_show == month)\n hoursSumArray[hour_of_day]+=value;\n }\n\n else if(month==0 && year==0 && day_to_show == day)\n hoursSumArray[hour_of_day]+=value;\n else if(month==0 && year>0 && day_to_show == day)\n {\n //days->2020\n if(year_to_show==year)\n hoursSumArray[hour_of_day]+=value;\n }\n\n }\n for(int c=0; c<=23; c++)\n getActivity().runOnUiThread(new OneShotTask(label, datasetIndex,(long)c,hoursSumArray[c]));\n\n\n }\n });\n\n thread.start();\n\n\n }\n else if( day == 8 && month !=13)\n {\n chart.getXAxis().setValueFormatter(new ValueFormatter() {\n @Override\n public String getFormattedValue(float value)\n {\n String months[] =getResources().getStringArray(R.array.months);\n int month = (int) value % months.length;\n if(month<0)\n return \"\";\n else\n return months[month];\n }\n });\n thread = new Thread(new Runnable() {\n\n @Override\n public void run()\n {\n Double monthsSumArray[] = {0.0,0.0 ,0.0 ,0.0 ,0.0 ,0.0 ,0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };\n SortedSet<Long> keys = new TreeSet<>(data.keySet());\n for (Long key : keys)\n {\n Double value = data.get(key);\n Date date = new Date(key);\n int day_to_show = getDayNumber(date); //days start at 1 which is SUN\n int year_to_show = getYearNumber(date);\n int month_to_show = getMonthNumber(date)+1; //months start ta 0 which is JAN\n\n /* YEAR | MONTH | DAY || GRAPH FILTER\n ----------------------------------------------------\n all | all | hide || months\n ----------------------------------------------------\n all | jan | hide || months->jan\n ----------------------------------------------------\n 2020 | jan | hide || months->jan->2020\n ----------------------------------------------------\n */\n if(month==0 && year==0)\n monthsSumArray[month_to_show-1] += value;\n else if(month>0 && year==0 && month==month_to_show)\n monthsSumArray[month_to_show-1] += value;\n else if(month>0 && year>0 && month==month_to_show)\n monthsSumArray[month_to_show-1] += value;\n\n\n }\n for(int c=0; c<=11; c++)\n getActivity().runOnUiThread(new OneShotTask(label, datasetIndex,(long)c+1,monthsSumArray[c]));\n\n }\n });\n thread.start();\n }\n else if(day==8 && month==13)\n {\n /* YEAR | MONTH | DAY || GRAPH FILTER\n ----------------------------------------------------\n all | hide | hide || years\n ----------------------------------------------------\n */\n chart.getXAxis().setValueFormatter(new ValueFormatter() {\n @Override\n public String getFormattedValue(float value)\n {\n return String.valueOf((int)value);\n }\n });\n thread = new Thread(new Runnable() {\n\n @Override\n public void run()\n {\n //REMEBER TO UPDATE STRING ARRAY FOR YEARS IN arrays.xml\n Double yearsSumArray[] = {0.0,0.0 };\n LinkedHashMap<Integer,Double > data_years = new LinkedHashMap<>();\n SortedSet<Long> keys = new TreeSet<>(data.keySet());\n for (Long key : keys)\n {\n Double value = data_years.get(key);\n Date date = new Date(key);\n int year = getYearNumber(date);\n if(data_years.get(year) == null)\n data_years.put(year,value);\n else\n data_years.put(year,data_years.get(year)+value);\n\n }\n Iterator iterator = data_years.entrySet().iterator();\n while (iterator.hasNext())\n {\n LinkedHashMap.Entry<Integer, Double>set = (LinkedHashMap.Entry<Integer, Double>) iterator.next();\n getActivity().runOnUiThread(new OneShotTask(label, datasetIndex,(long)set.getKey(),set.getValue()));\n }\n\n }\n });\n thread.start();\n }\n\n /*else if(monthly)\n {\n\n }\n else if(yearly)\n {\n\n }*/\n }", "public RenkoIndicator(TimeSeries series) {\r\n\t\tsuper(series);\r\n\t\tthis.series = series;\r\n\t}", "public static void show(int[] kd){\n final int NUM_OF_LINES = 5;\n\n Line[] lines = new Line[NUM_OF_LINES];\n\n //gives each array element the necessary memory\n for(int i = 0; i < NUM_OF_LINES; i++){\n lines[i] = new Line();\n }\n\n //in order to print\n lines[0].setLine(4,0,0);\n lines[1].setLine(3,1,2);\n lines[2].setLine(2,3,5);\n lines[3].setLine(1,6,9);\n lines[4].setLine(0,10,14);\n\n for(int i = 0; i < NUM_OF_LINES; i++){\n String tab = \"\";\n\n //creates the 'tab' effect based on position\n for(int j = 0; j < lines[i].getT(); j++){\n tab += \" \";\n }\n System.out.print(tab);\n\n for(int j = lines[i].getA(); j < lines[i].getB() + 1; j++){\n if(kd[j] == 0){\n System.out.print(\". \");\n }\n else{\n System.out.print(\"x \");\n }\n }\n System.out.println();\n }\n\n }", "private void setDayLabel() {\n dayFormat = new SimpleDateFormat(\"EEEE\");\n dayLabel = new JLabel();\n dayLabel.setFont(new Font(\"JetBrains Mono\", Font.BOLD, 40));\n dayLabel.setForeground(new Color(0x00FFFF));\n dayLabel.setBackground(Color.black);\n dayLabel.setOpaque(true);\n add(dayLabel);\n }", "@Test\n public void test08() throws Throwable {\n CategoryPlot categoryPlot0 = new CategoryPlot();\n categoryPlot0.clearDomainMarkers(44);\n BasicStroke basicStroke0 = (BasicStroke)categoryPlot0.getRangeGridlineStroke();\n ValueAxis[] valueAxisArray0 = new ValueAxis[6];\n ThermometerPlot thermometerPlot0 = new ThermometerPlot();\n NumberAxis numberAxis0 = (NumberAxis)thermometerPlot0.getRangeAxis();\n valueAxisArray0[0] = (ValueAxis) numberAxis0;\n LogarithmicAxis logarithmicAxis0 = new LogarithmicAxis(\"Null 'marker' not permitted.\");\n valueAxisArray0[1] = (ValueAxis) logarithmicAxis0;\n LogAxis logAxis0 = new LogAxis();\n valueAxisArray0[2] = (ValueAxis) logAxis0;\n CyclicNumberAxis cyclicNumberAxis0 = new CyclicNumberAxis(0.0, \"o>v!{PNMe{\");\n valueAxisArray0[3] = (ValueAxis) cyclicNumberAxis0;\n NumberAxis3D numberAxis3D0 = new NumberAxis3D(\"Null 'marker' not permitted.\");\n valueAxisArray0[4] = (ValueAxis) numberAxis3D0;\n NumberAxis numberAxis1 = (NumberAxis)thermometerPlot0.getRangeAxis();\n valueAxisArray0[5] = (ValueAxis) numberAxis1;\n XYPlot xYPlot0 = new XYPlot();\n RectangleInsets rectangleInsets0 = xYPlot0.getAxisOffset();\n cyclicNumberAxis0.setTickLabelInsets(rectangleInsets0);\n categoryPlot0.setRangeAxes(valueAxisArray0);\n categoryPlot0.setRangeCrosshairValue(3583.22971, false);\n LegendItemCollection legendItemCollection0 = categoryPlot0.getFixedLegendItems();\n float[] floatArray0 = new float[2];\n floatArray0[0] = (float) 44;\n floatArray0[1] = (float) 44;\n Font font0 = AbstractRenderer.DEFAULT_VALUE_LABEL_FONT;\n }", "private void setupDateTimeInterpreter(final boolean shortDate) {\r\n calendarView.setDateTimeInterpreter(new DateTimeInterpreter() {\r\n @Override\r\n public String interpretDate(Calendar date) {\r\n SimpleDateFormat weekdayNameFormat = new SimpleDateFormat(\"EEE\", Locale.getDefault());\r\n String weekday = weekdayNameFormat.format(date.getTime());\r\n SimpleDateFormat format = new SimpleDateFormat(\" M/d\", Locale.getDefault());\r\n\r\n // All android api level do not have a standard way of getting the first letter of\r\n // the week day name. Hence we get the first char programmatically.\r\n // Details: http://stackoverflow.com/questions/16959502/get-one-letter-abbreviation-of-week-day-of-a-date-in-java#answer-16959657\r\n if (shortDate)\r\n weekday = String.valueOf(weekday.charAt(0));\r\n return weekday.toUpperCase() + format.format(date.getTime());\r\n }\r\n\r\n @Override\r\n public String interpretTime(int hour) {\r\n return hour > 11 ? (hour - 12) + \" PM\" : (hour == 0 ? \"12 AM\" : hour + \" AM\");\r\n }\r\n });\r\n }", "public ICareDailyDietChart(String mDate, String mTime, String mFoodMenu,\n\t\t\tString mEventName, String mAlarm, String mProfile) {\n\t\tthis.mDate = mDate;\n\t\tthis.mTime = mTime;\n\t\tthis.mEventName = mEventName;\n\t\tthis.mFoodMenu = mFoodMenu;\n\t\tthis.mAlarm = mAlarm;\n\t\tthis.mProfileId = mProfile;\n\t}", "public final native double setDate(int dayOfMonth) /*-{\n this.setDate(dayOfMonth);\n return this.getTime();\n }-*/;", "public TrendVolatilityLineIndicator(Indicator<? extends MultipleMovingAverage> mmaIndicator, int index, TADecimal entry) {\n if (mmaIndicator == null) {\n throw new IllegalArgumentException(\"Supplied input Indicator is invalid: NULL\");\n }\n if (entry == null) {\n throw new IllegalArgumentException(\"Supplied input TADecimal entry is invalid: NULL\");\n }\n this.sustainability = Sustainability.UNKNOWN;\n this.mmaIndicator = mmaIndicator;\n this.entry = entry;\n this.tvls = new ArrayList<>();\n tvls.add(entry);\n }", "@RequiresApi(api = Build.VERSION_CODES.O)\n public void createNewLineChart() {\n\n ArrayList<Entry> yValues = new ArrayList<>();\n yValues.clear();\n\n //Todays Date\n Date date = new Date();\n LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();\n// String currentMonth = getMonthForInt(localDate.getMonthValue());\n if (monthSelectedAsInt > localDate.getMonthValue()){\n yValues.add(new Entry(0, 0));\n } else if (monthSelectedAsInt == localDate.getMonthValue()){\n for (int i = 1; i <= localDate.getDayOfMonth() ; i++) {\n yValues.add(new Entry(i, occupancyRate[i]));\n }\n } else {\n for (int i = 1; i <= numberOfDays ; i++) {\n yValues.add(new Entry(i, occupancyRate[i]));\n }\n }\n\n //chart.setOnChartValueSelectedListener(this);\n\n // enable scaling and dragging\n chart.setDragEnabled(true);\n chart.setScaleEnabled(true);\n\n // if disabled, scaling can be done on x- and y-axis separately\n chart.setPinchZoom(false);\n\n LineDataSet set1;\n\n set1 = new LineDataSet(yValues, \"Occupany Rate \");\n set1.setDrawCircles(false);\n set1.setDrawValues(false);\n set1.setColor(Color.RED);\n\n ArrayList <ILineDataSet> dataSets = new ArrayList<>();\n dataSets.add(set1);\n LineData dataLine = new LineData(set1);\n chart.getDescription().setEnabled(false);\n chart.getXAxis().setTextSize(10f);\n chart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);\n\n chart.getAxisLeft().setAxisMinimum(0);\n chart.getAxisLeft().setAxisMaximum(100);\n chart.getAxisRight().setAxisMinimum(0);\n chart.getAxisRight().setAxisMaximum(100);\n chart.getXAxis().setAxisMinimum(1);\n chart.getXAxis().setAxisMaximum(numberOfDays);\n\n chart.setData(dataLine);\n chart.invalidate();\n }", "private XYChart.Series<Number, Number> getTenSeries() {\n //Create new series\n XYChart.Series<Number, Number> series = new XYChart.Series<>();\n series.setName(\"Chemical Concentration\");\n Random rand = new Random();\n int c = 5; // Constant for x-axis scale\n for (int i = 0; i < 17; i++) {\n int y = rand.nextInt() % 3 + 2;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n series.getData().add(new XYChart.Data<>(17 * c, 4));\n series.getData().add(new XYChart.Data<>(18 * c, 5));\n series.getData().add(new XYChart.Data<>(19 * c-2,8));\n series.getData().add(new XYChart.Data<>(19 * c, 10));\n series.getData().add(new XYChart.Data<>(19 * c+2,8));\n series.getData().add(new XYChart.Data<>(20 * c, 6));\n series.getData().add(new XYChart.Data<>(21 * c, 4));\n\n for (int i = 22; i < 30; i++) {\n int y = rand.nextInt() % 3 + 2;\n series.getData().add(new XYChart.Data<>(i*5, y));\n }\n return series;\n }", "public void figure() {\r\n Currency nAdv = Currency.Zero;\r\n Currency nLow = Currency.NegativeOne;\r\n Currency nHigh = Currency.Zero;\r\n Currency nTotal = Currency.Zero;\r\n \r\n for(int i = 0; i < dayArray.size(); i++) {\r\n DayG dayG = (DayG) dayArray.get(i);\r\n Currency gross = dayG.getGross();\r\n \r\n nAdv = nAdv.add(gross);\r\n nTotal = nTotal.add(gross);\r\n if(nLow == Currency.NegativeOne || gross.lt(nLow)) {\r\n lowD = dayG;\r\n nLow = gross;\r\n }\r\n if(nHigh.lt(gross)) {\r\n highD = dayG;\r\n nHigh = gross;\r\n }\r\n }\r\n \r\n adverage = nAdv.divide(dayArray.size()).round();\r\n low = nLow.round();\r\n high = nHigh.round();\r\n \r\n //no need to round total, right?\r\n total = nTotal;\r\n }", "public void addDailyReport(GregorianCalendar date, LinkedList<Reading> readings){\r\n LinkedList<Double> loRainfall = new LinkedList<>();\r\n LinkedList<Double> loTemp = new LinkedList<>();\r\n for(Reading read : readings)\r\n loRainfall.add(read.getRainfall());\r\n for(Reading read : readings)\r\n loTemp.add(read.getTemp());\r\n dailyReports.add(new DailyWeatherReport(date, loTemp, loRainfall));\r\n }", "public String considerDiet() {\n if (diet.equals(\"carnivore\")) {\n printedDailyCarbon = allowedCarbonPerDay * 1;\n } else if (diet.equals(\"pescetarian\")) {\n printedDailyCarbon = allowedCarbonPerDay * 0.65;\n } else if (diet.equals(\"vegetarian\")) {\n printedDailyCarbon = allowedCarbonPerDay * 0.5;\n } else if (diet.equals(\"vegan\")) {\n printedDailyCarbon = ((double) allowedCarbonPerDay / (double) 6) * (double) 2;\n }\n String formattedDailyCarbonFigure = String.format(\"%.2f\", printedDailyCarbon);\n return formattedDailyCarbonFigure;\n }", "public void setMday(int value) {\n this.mday = value;\n }", "private void displayNonSedData(JSONObject[] jsonObjects) {\r\n final SharedPreferences sharedPref = getSharedPreferences(getString(R.string.pref_file_key),\r\n Context.MODE_PRIVATE);\r\n\r\n int[] stepsPerHour = new int[24];\r\n try {\r\n // Calculate steps per hour\r\n JSONArray jsonArray = jsonObjects[0].getJSONObject(\"activities-steps-intraday\")\r\n .getJSONArray(\"dataset\");\r\n\r\n int steps = 0, interval = 0, hour = 0;\r\n for(int i = 0; i < jsonArray.length(); i++) {\r\n // Step data is requested in 15 minute intervals so we add up the steps\r\n // in every four values to get the total for each hour\r\n steps += Integer.parseInt(jsonArray.getJSONObject(i).getString(\"value\"));\r\n interval++;\r\n if(interval == 4) {// we have reached the end of the hour\r\n stepsPerHour[hour] = steps;\r\n\r\n interval = 0;\r\n steps = 0;\r\n hour++;\r\n }\r\n }\r\n } catch(JSONException | NullPointerException e) {\r\n fitbitRequestError();\r\n return;\r\n }\r\n\r\n BarChart chart = findViewById(R.id.chart);\r\n\r\n ArrayList<BarEntry> entries = new ArrayList<>();\r\n int[] barColours = new int[24];\r\n\r\n // Get non-sedentary hours goal and step threshold for an hour to be non-sedentary\r\n int stepThreshold;\r\n int nonSedHoursGoal = sharedPref.getInt(getString(R.string.non_sed_goal_key), 0);\r\n if(nonSedHoursGoal == 0) {\r\n stepThreshold = 0;\r\n } else {\r\n stepThreshold = getResources().getInteger(R.integer.steps_threshold);\r\n }\r\n\r\n // For each hour in the day create a bar showing the data\r\n // If there is no data create a bar with value 0 so the hour is still shown on the graph\r\n for (int i = 0; i < 24; i++) {\r\n float yValue = (float) stepsPerHour[i];\r\n\r\n entries.add(new BarEntry((float) i, yValue));\r\n\r\n barColours[i] = getResources().getColor(getProgressColour((int) yValue, stepThreshold));\r\n }\r\n\r\n // Show data on chart\r\n BarDataSet dataSet = new BarDataSet(entries, \"\");\r\n dataSet.setColors(barColours);\r\n dataSet.setDrawValues(false);\r\n BarData barData = new BarData(dataSet);\r\n\r\n chart.setData(barData);\r\n chart.invalidate();\r\n\r\n // Show non-sedentary goal\r\n TextView textViewSummary = findViewById(R.id.tv_goal_summary);\r\n if(nonSedHoursGoal > 0) {\r\n textViewSummary.setText(getResources().getString(R.string.goal_hours_steps,\r\n nonSedHoursGoal, stepThreshold));\r\n } else {\r\n textViewSummary.setText(getResources().getString(R.string.no_goal_set));\r\n }\r\n }", "@Override\n\tpublic double getCarbon() {\n\t\treturn 0;\n\t}", "public void addDailyReport(GregorianCalendar date, LinkedList<Reading> readings) {\n\t\tLinkedList<Double> temps = new LinkedList<Double>();\n\t\tLinkedList<Double> rains = new LinkedList<Double>();\n\t\tfor(Reading reading: readings) {\n\t\t\ttemps.add(reading.getTemp());\n\t\t\trains.add(reading.getRainfall());\n\t\t}\n\t\treports.addReport(new DailyWeatherReport(date, temps, rains));\n\t}", "public void editChart(Integer day, boolean available) {\n chart.replace(day, available);\n }", "public abstract int getDy();", "public void drawChart() {\n ArrayList<Entry> confuse = new ArrayList<>();\n ArrayList<Entry> attention = new ArrayList<>();\n ArrayList<Entry> engagement = new ArrayList<>();\n ArrayList<Entry> joy = new ArrayList<>();\n ArrayList<Entry> valence = new ArrayList<>();\n // point = \"Brow Furrow: \\n\";\n String dum = null, dum2 = null;\n for (int i = 0; i < size; i++) {\n //point += (\"\" + Emotion.getBrowFurrow(i).getL() + \" seconds reading of \" + Emotion.getBrowFurrow(i).getR() + \"\\n\");\n dum2 = Emotion.getBrowFurrow(i).getL().toString();\n dum = Emotion.getBrowFurrow(i).getR().toString();\n confuse.add(new Entry((float)Double.parseDouble(dum2), Float.parseFloat(dum)));\n dum2 = Emotion.getAttention(i).getL().toString();\n dum = Emotion.getAttention(i).getR().toString();\n attention.add(new Entry((float)Double.parseDouble(dum2), Float.parseFloat(dum)));\n dum2 = Emotion.getEngagement(i).getL().toString();\n dum = Emotion.getEngagement(i).getR().toString();\n engagement.add(new Entry((float)Double.parseDouble(dum2), Float.parseFloat(dum)));\n dum2 = Emotion.getJoy(i).getL().toString();\n dum = Emotion.getJoy(i).getR().toString();\n joy.add(new Entry((float)Double.parseDouble(dum2), Float.parseFloat(dum)));\n dum2 = Emotion.getValence(i).getL().toString();\n dum = Emotion.getValence(i).getR().toString();\n valence.add(new Entry((float)Double.parseDouble(dum2), Float.parseFloat(dum)));\n }\n\n LineDataSet data1 = new LineDataSet(confuse,\"Confuse\");\n LineDataSet data2 = new LineDataSet(attention,\"Attention\");\n LineDataSet data3 = new LineDataSet(engagement,\"Engagement\");\n LineDataSet data4 = new LineDataSet(joy,\"Engagement\");\n LineDataSet data5 = new LineDataSet(valence,\"Valence\");\n data1.setColor(Color.BLUE);\n data1.setDrawCircles(false);\n data2.setColor(Color.YELLOW);\n data2.setDrawCircles(false);\n data3.setColor(Color.GRAY);\n data3.setDrawCircles(false);\n data4.setColor(Color.MAGENTA);\n data4.setDrawCircles(false);\n data5.setColor(Color.GREEN);\n data5.setDrawCircles(false);\n\n\n dataSets.add(data1);\n dataSets.add(data2);\n dataSets.add(data3);\n dataSets.add(data4);\n dataSets.add(data5);\n }", "public Double getDy();", "public void setDay(final short day) {\r\n\t\tthis.day = day;\r\n\t}", "private void printDays() {\n for (int dayOfMonth = 1; dayOfMonth <= daysInMonth; ) {\n for (int j = ((dayOfMonth == 1) ? dayOfWeek - 1 : 0); j < 7 && (dayOfMonth <= daysInMonth); j++) {\n if (this.isDateChosen == true && date.getDate() == dayOfMonth) {\n String space = date.getDate() >= 10 ? \" \" : \" \";\n System.out.print(space + ANSI_GREEN + dayOfMonth + ANSI_RESET + \" \");\n } else {\n System.out.printf(\"%4d \", dayOfMonth);\n }\n dayOfMonth++;\n }\n System.out.println();\n }\n }", "public Daisy(double stemLength, Date dateOfDelivery, DaisyColor color) {\n super(\"Daisy\", stemLength, dateOfDelivery, 0);\n switch (color) {\n case BLUE: {\n setPrice(BLUE_DAISY_PRICE*((int)(stemLength/30)+1));\n break;\n }\n case WHITE: {\n setPrice(WHITE_DAISY_PRICE*((int)(stemLength/30)+1));\n break;\n }\n }\n this.color = color;\n }", "public double getDPad() {\n\t\treturn this.getRawAxis(6);\n\t}", "@Test\n public void test41() throws Throwable {\n Line2D.Double line2D_Double0 = new Line2D.Double(407.99, (-371.62), (-371.62), 0.0);\n line2D_Double0.x1 = 0.0;\n line2D_Double0.setLine((-371.62), 3820.38477815176, 0.0, 3820.38477815176);\n DefaultValueDataset defaultValueDataset0 = new DefaultValueDataset(0.0);\n ThermometerPlot thermometerPlot0 = new ThermometerPlot((ValueDataset) defaultValueDataset0);\n NumberAxis numberAxis0 = (NumberAxis)thermometerPlot0.getRangeAxis();\n CombinedRangeCategoryPlot combinedRangeCategoryPlot0 = new CombinedRangeCategoryPlot((ValueAxis) numberAxis0);\n combinedRangeCategoryPlot0.setRangeCrosshairValue((-371.62));\n CategoryPointerAnnotation categoryPointerAnnotation0 = new CategoryPointerAnnotation(\"K(Jj1`SZJ!y81S;n?%Y\", (Comparable) (-371.62), 1834.808976, (-371.62));\n combinedRangeCategoryPlot0.addAnnotation(categoryPointerAnnotation0);\n DatasetRenderingOrder datasetRenderingOrder0 = combinedRangeCategoryPlot0.getDatasetRenderingOrder();\n float[][] floatArray0 = new float[9][0];\n float[] floatArray1 = new float[0];\n floatArray0[0] = floatArray1;\n float[] floatArray2 = new float[6];\n floatArray2[0] = Float.NEGATIVE_INFINITY;\n floatArray2[1] = 8.0F;\n floatArray2[2] = (-970.0398F);\n floatArray2[3] = (-2174.3F);\n floatArray2[4] = 0.0F;\n floatArray2[5] = 2953.279F;\n floatArray0[1] = floatArray2;\n float[] floatArray3 = new float[9];\n floatArray3[0] = 2953.279F;\n floatArray3[1] = (-970.0398F);\n floatArray3[2] = (-2174.3F);\n floatArray3[3] = (-970.0398F);\n floatArray3[4] = (-970.0398F);\n floatArray3[5] = 0.0F;\n floatArray3[6] = (-2174.3F);\n floatArray3[7] = 0.0F;\n floatArray3[8] = Float.NEGATIVE_INFINITY;\n floatArray0[2] = floatArray3;\n float[] floatArray4 = new float[0];\n floatArray0[3] = floatArray4;\n float[] floatArray5 = new float[7];\n floatArray5[0] = 8.0F;\n floatArray5[1] = 2953.279F;\n floatArray5[2] = (-966.2956F);\n floatArray5[3] = 8.0F;\n floatArray5[4] = 8.0F;\n floatArray5[5] = (-2174.3F);\n floatArray5[6] = (-2174.3F);\n floatArray0[4] = floatArray5;\n float[] floatArray6 = new float[6];\n floatArray6[0] = 0.0F;\n floatArray6[1] = Float.NEGATIVE_INFINITY;\n floatArray6[2] = (-966.2956F);\n floatArray6[3] = (-1797.876F);\n floatArray6[4] = (-966.2956F);\n floatArray6[5] = (-2174.3F);\n floatArray0[5] = floatArray6;\n float[] floatArray7 = new float[8];\n floatArray7[0] = 0.0F;\n floatArray7[1] = (-966.2956F);\n floatArray7[2] = 0.0F;\n floatArray7[3] = Float.NEGATIVE_INFINITY;\n floatArray7[4] = (-970.0398F);\n floatArray7[5] = (-970.0398F);\n floatArray7[6] = 0.0F;\n floatArray7[7] = (-970.0398F);\n floatArray0[6] = floatArray7;\n float[] floatArray8 = new float[3];\n floatArray8[0] = Float.NEGATIVE_INFINITY;\n floatArray8[1] = Float.NEGATIVE_INFINITY;\n floatArray8[2] = (-1797.876F);\n floatArray0[7] = floatArray8;\n float[] floatArray9 = new float[8];\n floatArray9[0] = 8.0F;\n floatArray9[1] = (-2209.7039F);\n floatArray9[2] = 0.0F;\n floatArray9[3] = (-2174.3F);\n floatArray9[4] = (-2174.3F);\n floatArray9[5] = Float.NEGATIVE_INFINITY;\n floatArray9[6] = 0.0F;\n floatArray9[7] = 2953.279F;\n floatArray0[8] = floatArray9;\n FastScatterPlot fastScatterPlot0 = new FastScatterPlot(floatArray0, (ValueAxis) numberAxis0, (ValueAxis) numberAxis0);\n BasicStroke basicStroke0 = (BasicStroke)fastScatterPlot0.getDomainGridlineStroke();\n combinedRangeCategoryPlot0.setRangeCrosshairStroke(basicStroke0);\n }", "@Test\n public void getSecurityPriceTechnicalsMacdTest() throws ApiException, NoSuchMethodException {\n String identifier = null;\n Integer fastPeriod = null;\n Integer slowPeriod = null;\n Integer signalPeriod = null;\n String priceKey = null;\n String startDate = null;\n String endDate = null;\n Integer pageSize = null;\n String nextPage = null;\n ApiResponseSecurityMovingAverageConvergenceDivergence response = api.getSecurityPriceTechnicalsMacd(identifier, fastPeriod, slowPeriod, signalPeriod, priceKey, startDate, endDate, pageSize, nextPage);\n\n // TODO: test validations\n }", "public abstract int daysInMonth(DMYcount DMYcount);", "public LineDash getLineDash(\n )\n {return lineDash;}", "private void onCreateCaffeineBarChart(DateIntegerSeries coffeeCaffeineSeries, DateIntegerSeries teaCaffeineSeries) {\n // refreshes the chart (it will be loaded with default vals at this point)\n caffeineBarChart.clear();\n caffeineBarChart.redraw();\n\n // default graph: supports y from 0 to 1000 in increments of 200, but this can be\n // overridden by very large values, in which case it's MAX_VALUE rounded to next\n // increment of 200, in increments of MAX_VALUE / 5\n int maxRange = 1000;\n int combinedMaxYValue = coffeeCaffeineSeries.getMaxYValue() + teaCaffeineSeries.getMaxYValue();\n if (combinedMaxYValue > 1000) {\n if (combinedMaxYValue % 200 != 0) maxRange = combinedMaxYValue + (200 - (combinedMaxYValue % 200));\n else maxRange = combinedMaxYValue;\n }\n\n caffeineBarChart.setRangeBoundaries(0, maxRange, BoundaryMode.FIXED);\n caffeineBarChart.setRangeStep(StepMode.SUBDIVIDE, 5);\n caffeineBarChart.addMarker(new YValueMarker(400, null)); // red line for 400 mg\n caffeineBarChart.setDomainStep(StepMode.SUBDIVIDE, 10);\n\n // had to hard code the colors because they're apparently translated into ints in the backend,\n // but the ints DON'T properly translate back into the original hex string ...\n BarFormatter coffeeBarFormatter = new BarFormatter(Color.parseColor(\"#ac9782\"), Color.WHITE);\n BarFormatter teaBarFormatter = new BarFormatter(Color.parseColor(\"#4d7d55\"), Color.WHITE);\n\n caffeineBarChart.addSeries(coffeeCaffeineSeries, coffeeBarFormatter);\n caffeineBarChart.addSeries(teaCaffeineSeries, teaBarFormatter);\n\n // initialize bar caffeineBarChartRenderer (must be done after set formatter and add series to the plot)\n caffeineBarChartRenderer = caffeineBarChart.getRenderer(BarRenderer.class);\n caffeineBarChartRenderer.setBarGroupWidth(BarRenderer.BarGroupWidthMode.FIXED_WIDTH, PixelUtils.dpToPix(25));\n caffeineBarChartRenderer.setBarOrientation(BarRenderer.BarOrientation.STACKED);\n\n // X-AXIS = date values, formatted as \"10/27\"\n caffeineBarChart.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).setFormat(new xAxisDateFormat());\n\n // Y-AXIS = caffeine values, formatted as \"800\"\n caffeineBarChart.getGraph().getLineLabelStyle(XYGraphWidget.Edge.LEFT).setFormat(new Format() {\n @Override\n public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {\n int intNumber = ((Number) obj).intValue();\n if (intNumber == 400) return new StringBuffer(\"[\" + intNumber + \"]\");\n else return new StringBuffer(Integer.toString(intNumber));\n }\n\n @Override\n public Number parseObject(String string, ParsePosition position) {\n throw new UnsupportedOperationException(\"Not yet implemented.\");\n }\n });\n }", "@Test(timeout = 4000)\n public void test14() throws Throwable {\n JDayChooser jDayChooser0 = new JDayChooser(true);\n jDayChooser0.setFocus();\n PDFDocumentGraphics2D pDFDocumentGraphics2D0 = new PDFDocumentGraphics2D();\n JDayChooser.DecoratorButton jDayChooser_DecoratorButton0 = jDayChooser0.new DecoratorButton();\n jDayChooser_DecoratorButton0.paint(pDFDocumentGraphics2D0);\n jDayChooser0.drawDays();\n XML11DTDConfiguration xML11DTDConfiguration0 = new XML11DTDConfiguration();\n Locale locale0 = xML11DTDConfiguration0.getLocale();\n jDayChooser0.setLocale(locale0);\n assertFalse(jDayChooser0.isDecorationBordersVisible());\n assertEquals(14, jDayChooser0.getDay());\n assertTrue(jDayChooser0.isDayBordersVisible());\n }", "public Holiday(int day, int month) {\n\t\tdate = LocalDate.of(2019,month,day);\n\t}", "private void makeChart() {\n\n Log.d(\"Chart\",\"Start Chart\");\n\n ArrayList<Entry> speedList = new ArrayList<>();\n ArrayList<Entry> avgSpeedList = new ArrayList<>();\n ArrayList<Entry> avgAltList = new ArrayList<>();\n\n int numberOfValues = trackingList.size();\n\n //Fills the data in the Arrays Entry (xValue,yValue)\n for(int i = 0; i < numberOfValues;i++){\n float avgSpeed = (float)averageSpeed;\n float avgAlt = (float)averageAlt;\n float curSpeed = (float)trackingList.get(i).getSpeed();\n\n Log.d(\"Chart\",\"CurSpeed: \" +curSpeed);\n\n avgSpeedList.add(new Entry(i*3,avgSpeed));\n speedList.add(new Entry(i*3,curSpeed));\n avgAltList.add(new Entry(i*3,avgAlt));\n }\n\n ArrayList<String> xAXES = new ArrayList<>();\n\n\n String[] xaxes = new String[xAXES.size()];\n for(int i=0; i<xAXES.size();i++){\n xaxes[i] = xAXES.get(i);\n }\n\n // More than one Array (Line in the Graph)\n ArrayList<ILineDataSet> lineDataSets = new ArrayList<>();\n\n //Speed Graph setup\n LineDataSet lineDataSet1 = new LineDataSet(speedList,\"Speed\");\n lineDataSet1.setDrawCircles(false);\n lineDataSet1.setColor(Color.BLUE);\n lineDataSet1.setLineWidth(2);\n\n //AvgSpeed setup\n LineDataSet lineDataSet2 = new LineDataSet(avgSpeedList,\"AvgSpeedLine\");\n lineDataSet2.setDrawCircles(false);\n lineDataSet2.setColor(Color.RED);\n lineDataSet2.setLineWidth(3);\n\n //AvgAlt setup\n LineDataSet lineDataSet3 = new LineDataSet(avgAltList,\"AvgAltLine\");\n lineDataSet3.setDrawCircles(false);\n lineDataSet3.setColor(Color.MAGENTA);\n lineDataSet3.setLineWidth(3);\n\n //Add them to the List\n lineDataSets.add(lineDataSet1);\n lineDataSets.add(lineDataSet2);\n lineDataSets.add(lineDataSet3);\n\n //setup for the xAxis\n XAxis xAxis = lineChart.getXAxis();\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n\n //Puts the data in the Graph\n lineChart.setData(new LineData(lineDataSets));\n lineChart.setVisibleXRangeMaximum(65f);\n\n //Chart description\n lineChart.getDescription().setText(\"All Speed\");\n\n //Shows timer information when clicked\n lineChart.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Toast.makeText(getApplicationContext(), \"Its measured every 3 seconds\",Toast.LENGTH_LONG).show();\n }\n });\n }", "public static JFreeChart createTimeSeriesChart (String xAxisTitle,\n String yAxisTitle,\n XYDataset tsc)\n {\n JFreeChart chart = ChartFactory.createTimeSeriesChart (null,\n xAxisTitle,\n yAxisTitle,\n tsc,\n true,\n true,\n true);\n\n XYPlot xyplot = (XYPlot) chart.getPlot ();\n xyplot.setBackgroundPaint (UIUtils.getComponentColor ());\n xyplot.setDomainGridlinePaint (UIUtils.getBorderColor ());\n xyplot.setRangeGridlinePaint (UIUtils.getBorderColor ());\n /*\n xyplot.setAxisOffset (new RectangleInsets (5D,\n 5D,\n 5D,\n 5D));\n */\n xyplot.setDomainCrosshairVisible (true);\n xyplot.setRangeCrosshairVisible (true);\n xyplot.setDomainGridlinePaint (UIUtils.getColor (\"#cfcfcf\"));\n xyplot.setRangeGridlinePaint (UIUtils.getColor (\"#cfcfcf\"));\n\n final SimpleDateFormat dateFormat = new SimpleDateFormat (\"dd MMM yyyy\");\n\n ((NumberAxis) xyplot.getRangeAxis ()).setNumberFormatOverride (Environment.getNumberFormatter ());\n\n XYLineAndShapeRenderer xyitemrenderer = new XYLineAndShapeRenderer (true,\n true);\n xyitemrenderer.setUseFillPaint (true);\n\n XYToolTipGenerator ttgen = new StandardXYToolTipGenerator ()\n {\n\n public String generateToolTip (XYDataset dataset,\n int series,\n int item)\n {\n\n TimeSeriesCollection tsc = (TimeSeriesCollection) dataset;\n\n TimeSeries ts = tsc.getSeries (series);\n\n Number n = ts.getValue (item);\n Number p = Integer.valueOf (0);\n\n if (item > 0)\n {\n\n p = ts.getValue (item - 1);\n\n }\n\n String suff = \"\";\n int v = n.intValue () - p.intValue ();\n\n if (v != 0)\n {\n\n String sufftype = added;\n int val = v;\n\n if (v < 0)\n {\n\n sufftype = removed;\n val *= -1;\n\n }\n\n suff = String.format (getUIString (charts,timeseries,suffixes,sufftype),\n Environment.formatNumber (val));\n\n }\n\n return String.format (getUIString (charts,timeseries,tooltip),\n dateFormat.format (ts.getTimePeriod (item).getEnd ()),\n Environment.formatNumber (n.intValue ()),\n suff);\n\n }\n\n };\n\n xyplot.setRenderer (xyitemrenderer);\n\n List colors = new ArrayList ();\n colors.add (UIUtils.getColor (\"#f5b800\"));\n colors.add (UIUtils.getColor (\"#7547ff\"));\n colors.add (UIUtils.getColor (\"#9c4f4f\"));\n colors.add (UIUtils.getColor (\"#99cc99\"));\n colors.add (UIUtils.getColor (\"#cc6600\"));\n\n for (int i = 0; i < tsc.getSeriesCount (); i++)\n {\n\n if (i < (colors.size () - 1))\n {\n\n xyitemrenderer.setSeriesPaint (i,\n (Color) colors.get (i));\n\n }\n\n xyitemrenderer.setSeriesStroke (i,\n new java.awt.BasicStroke (2f));\n xyitemrenderer.setSeriesShapesFilled (i,\n true);\n xyitemrenderer.setSeriesToolTipGenerator (i,\n ttgen);\n xyitemrenderer.setSeriesShape (i,\n new java.awt.geom.Ellipse2D.Float (-3,\n -3,\n 6,\n 6));\n /*\n if (i > 0)\n {\n\n xyitemrenderer.setSeriesShape (i,\n xyitemrenderer.lookupSeriesShape (0));\n\n }\n */\n }\n\n PeriodAxis periodaxis = new PeriodAxis (xAxisTitle);\n\n periodaxis.setAutoRangeTimePeriodClass (Day.class);\n\n PeriodAxisLabelInfo[] aperiodaxislabelinfo = new PeriodAxisLabelInfo[3];\n aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo (Day.class,\n new SimpleDateFormat (\"d\"));\n aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo (Month.class,\n new SimpleDateFormat (\"MMM\"));\n aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo (Year.class,\n new SimpleDateFormat (\"yyyy\"));\n periodaxis.setLabelInfo (aperiodaxislabelinfo);\n xyplot.setDomainAxis (periodaxis);\n\n return chart;\n\n }", "public void plotHumidities(FlatField weather, int seriesNo) {\n seriesH[seriesNo].clear();\n try {\n FunctionType functionType = (FunctionType) weather.getType();\n int index = findRangeComponentIndex(functionType, WeatherType.REL_HUMIDITY);\n if (index == -1) {\n throw new IllegalArgumentException(\"FlatField must contain REL_HUMIDITY.\");\n }\n\n final float[][] times = weather.getDomainSet().getSamples(false);\n final float[][] values = weather.getFloats(false);\n\n for (int i = 0; i < times[0].length; i++) {\n seriesH[seriesNo].add(times[0][i], values[index][i]);\n }\n plotDayNight();\n\n } catch (VisADException ex) {\n Exceptions.printStackTrace(ex);\n }\n }", "public byte getDay() {\n return day;\n }", "public Double getXAxis(String datePattern) {\n String[] bits = datePattern.split(\" \");\n double axis = Double.parseDouble(bits[0]);\n return axis + (Double.parseDouble(bits[bits.length - 1]) - 1) * getMultiplier(datePattern);\n }", "public KochLine getLineD(){\n\t\tKochLine lineD= new KochLine(p4,p5);\n\t\treturn lineD;\n\t\t\n\t}", "@Test\n public void test77() throws Throwable {\n CombinedDomainCategoryPlot combinedDomainCategoryPlot0 = new CombinedDomainCategoryPlot((CategoryAxis) null);\n combinedDomainCategoryPlot0.setDrawSharedDomainAxis(false);\n DecimalFormat decimalFormat0 = (DecimalFormat)NumberFormat.getCurrencyInstance();\n NumberTickUnit numberTickUnit0 = new NumberTickUnit((-28.552), (NumberFormat) decimalFormat0);\n Color color0 = (Color)Axis.DEFAULT_TICK_MARK_PAINT;\n boolean boolean0 = numberTickUnit0.equals((Object) null);\n TimeTableXYDataset timeTableXYDataset0 = new TimeTableXYDataset();\n RectangleEdge rectangleEdge0 = combinedDomainCategoryPlot0.getDomainAxisEdge();\n CyclicNumberAxis cyclicNumberAxis0 = new CyclicNumberAxis(0.0, 0.0);\n XYAreaRenderer2 xYAreaRenderer2_0 = new XYAreaRenderer2();\n XYPlot xYPlot0 = new XYPlot((XYDataset) timeTableXYDataset0, (ValueAxis) cyclicNumberAxis0, (ValueAxis) cyclicNumberAxis0, (XYItemRenderer) xYAreaRenderer2_0);\n BasicStroke basicStroke0 = (BasicStroke)xYPlot0.getRangeZeroBaselineStroke();\n CategoryMarker categoryMarker0 = new CategoryMarker((Comparable) numberTickUnit0, (Paint) color0, (Stroke) basicStroke0, (Paint) color0, cyclicNumberAxis0.DEFAULT_ADVANCE_LINE_STROKE, 0.85F);\n combinedDomainCategoryPlot0.addRangeMarker((Marker) categoryMarker0);\n int int0 = combinedDomainCategoryPlot0.getRangeAxisIndex(cyclicNumberAxis0);\n Layer layer0 = Layer.BACKGROUND;\n combinedDomainCategoryPlot0.addDomainMarker(0, categoryMarker0, layer0);\n combinedDomainCategoryPlot0.setRenderer((CategoryItemRenderer) null);\n boolean boolean1 = combinedDomainCategoryPlot0.isRangeZoomable();\n Point2D.Double point2D_Double0 = new Point2D.Double((-862.0), 1.0E-6);\n point2D_Double0.y = (double) 0;\n AxisLocation axisLocation0 = combinedDomainCategoryPlot0.getDomainAxisLocation((-2040));\n combinedDomainCategoryPlot0.setDomainAxisLocation(axisLocation0);\n }", "public void updatePredictions (long currTime, TimeSeries inputSeries)\n {\n\n// TODO: decide if this is necessary, it's in PPALg >>\n this.state.clearPredictionsFrom (currTime + stepSize);\n//this.state.clearPredictions();\n\n TimeSeries timeSeries = (TimeSeries) inputSeries.clone();\n\n // if timeSeries is shorter than the minimum stream do nothing.\n if (timeSeries.size() < minStreamLength)\n return;\n\n // trim the first <minPeriod> number of elements from the timeSeries.\n // this removes non-periodicity that is seen in simulators first few elements.\n\n timeSeries.trimFromStart(minPeriodLength);\n\n df.addText (\"First trim of time series : \" + timeSeries.shortToString());\n\n // find the best shift of the time series against iteself that leads to the most matching\n ArrayList shiftGraph = findBestShiftGraph (timeSeries);\n\n // trim the shifted graph to make sure we aren't starting in the middle of an event\n int amountTrimmed = trimShiftGraph (shiftGraph);\n\n df.addText (\"Trim amount : \" + amountTrimmed);\n df.addText (\"final, trimmed shift graph : \" + shiftGraph.toString());\n\n // the offset is the total amount of the time series we have discarded, it is the offset\n // to the leading edge of a periodic repeating occurence\n int offset = amountTrimmed + minPeriodLength;\n\n // create a new periodic event object\n PeriodicEvent pe = getPeriod (shiftGraph, offset);\n\n if (pe == null || pe.getEvent().isEmpty())\n {\n df.addText (\" Periodic event is null \");\n return;\n }\n\n df.addText (\" Periodic Event is : \" + pe.toString());\n\n // get the current time from which we will extrapolate\n long time = currTime;\n\n int period = pe.getPeriod();\n ArrayList event = pe.getEvent();\n\n // if we divide the timeSeries into portions the size of the time period, how much is left over?\n // for this we do not consider the trimmed amount.\n int timeSeriesSize = timeSeries.size() - amountTrimmed;\n\n if (timeSeriesSize <= period)\n return;\n int remainder = getRemainder (timeSeriesSize, period);\n df.addText (\"remainder is : \" + remainder);\n\n // cycle through the remaining portion of the last period adding any predictions based on\n // our periodic event that we have identified.\n // must subtract 1 since index is zero-base, & reaminder is one-based\n for (int i = remainder -1 ; i < event.size(); i++)\n {\n double prediction;\n\n time = time + timeSeries.getTimeIncrement();\n\n if (i >= 0 && event.get (i) != null)\n {\n prediction = ((Double) event.get(i)).doubleValue();\n\n state.addPrediction ( time, prediction);\n df.addText (\"Adding prediction : \" + prediction + \" for time : \" + time);\n }\n } // end for (i)\n\n int extrapolationCount = 2;\n\n // We make <j> additional extapolation into the future beyond the last period fragment\n while (extrapolationCount > 0)\n {\n for (int j = 0; j < event.size(); j++)\n {\n double prediction;\n\n time = time + timeSeries.getTimeIncrement();\n\n if (event.get (j) != null)\n {\n prediction = ((Double) event.get(j)).doubleValue();\n\n state.addPrediction ( time, prediction);\n df.addText (\"Adding prediction : \" + prediction + \" for time : \" + time);\n }\n } // end for (j)\n\n extrapolationCount--;\n } // end while (extapoliationCount)\n\n\n state.updateError (timeSeries, currTime);\n }", "public byte getDay() {\n return day;\n }", "public byte getDay() {\n return day;\n }", "public byte getDay() {\n return day;\n }", "public ArrayList<Forecast> getForecastsForDay( int day ) {\n if (forecasts.size() == 0) {\n return null;\n }\n\n int startIndex = 0;\n int endIndex = 0;\n\n if (day < 8) {\n startIndex = dayIndices[day];\n }\n\n if (startIndex == -1) {\n return null;\n }\n\n if (day < 7) {\n endIndex = dayIndices[day+1];\n if (endIndex < 0) {\n endIndex = forecasts.size();\n }\n } else {\n endIndex = forecasts.size();\n }\n\n return new ArrayList<>(forecasts.subList(startIndex, endIndex));\n }", "public Integer getSeriesCd() {\n\t\treturn seriesCd;\n\t}", "public Double getCarbon() {\n return product.getCarbon() * weight / 100;\n }", "public double MACD(int t)\n {\n return MACD(26, 12, t);\n }", "public MotionChartPanel () {\n super( null );\n\n // Data set.\n setLayout( new BorderLayout() );\n\n// setMaximumDrawWidth( Toolkit.getDefaultToolkit().getScreenSize().width );\n// setMaximumDrawHeight( Toolkit.getDefaultToolkit().getScreenSize().height );\n\n final DynamicTimeSeriesCollection dataset1 = new DynamicTimeSeriesCollection( 1, COUNT, new Second() );\n dataset1.setTimeBase( new Second( 0, 0, 0, 1, 1, 2011 ) );\n dataset1.addSeries( initialPositionData(), 0, POSITION_SERIES_TEXT );\n\n final DynamicTimeSeriesCollection dataset2 = new DynamicTimeSeriesCollection( 1, COUNT, new Second() );\n dataset2.setTimeBase( new Second( 0, 0, 0, 1, 1, 2011 ) );\n dataset2.addSeries( initialSpeedData(), 0, SPEED_SERIES_TEXT );\n\n // Create the chart.\n JFreeChart chart = createChart( dataset1, dataset2 );\n setChart( chart );\n setRangeBound( 200000, 2500 );\n setMouseZoomable( false );\n\n // Timer (Refersh the chart).\n timer = new Timer( 10, new ActionListener() {\n\n /**\n * The speed previous plotted.\n */\n private float prevSpeed;\n\n /**\n * The position previous plotted.\n */\n private float prevPosition;\n @Override\n public void actionPerformed ( ActionEvent e ) {\n if ( speedQueue.isEmpty() == false && positionQueue.isEmpty() == false ) {\n long time = System.currentTimeMillis();\n prevSpeed = speedQueue.poll();\n prevPosition = positionQueue.poll();\n dataset1.advanceTime();\n dataset2.advanceTime();\n dataset1.appendData( new float[]{ prevPosition } );\n dataset2.appendData( new float[]{ prevSpeed } );\n }\n\n// else {\n // Maintain previous record once no new record/enough record could show.\n// dataset1.appendData( new float[]{ prevPosition } );\n// dataset2.appendData( new float[]{ prevSpeed } );\n// }\n }\n } );\n }", "public byte getDay() {\r\n return day;\r\n }", "public static void m10220a() {\n zzawb.m10214a(\"TinkMac\", new ii());\n zzavo.m10184a(f9059b);\n }", "public float getDayOpacity() {\r\n //Gdx.app.debug(\"Clock\", \"h: \" + (24f * (seconds / 60f)));\r\n if (dayOpacity < 0.25) {\r\n return 0;\r\n } else if (dayOpacity < 0.5) {\r\n return (dayOpacity - 0.25f) / 0.25f;\r\n } else {\r\n return 1;\r\n }\r\n }", "private void drawVertical(GC gc, Rectangle drawingArea, TimeBarViewerDelegate delegate, boolean top,\n boolean printing) {\n int oy = drawingArea.y;\n\n int basex;\n int minorOff;\n int majorOff;\n int majorLabelOff;\n int dayOff;\n\n if (!top) {\n basex = drawingArea.x;\n minorOff = scaleX(MINORLENGTH);\n majorOff = scaleX(MAJORLENGTH);\n majorLabelOff = scaleX(22);\n dayOff = scaleX(34);\n } else {\n basex = drawingArea.x + drawingArea.width - 1;\n minorOff = scaleX(-MINORLENGTH);\n majorOff = scaleX(-MAJORLENGTH);\n majorLabelOff = scaleX(-10);\n dayOff = scaleX(-22);\n }\n int ox = basex;\n\n int height = drawingArea.height;\n JaretDate date = delegate.getStartDate().copy();\n\n int idx = TickScaler.getTickIdx(delegate.getPixelPerSecond() / getScaleY());\n\n int majTick = TickScaler.getMajorTickMinutes(idx);\n int minTick = TickScaler.getMinorTickMinutes(idx);\n TickScaler.Range range = TickScaler.getRange(idx);\n _lastRange = range;\n\n // clean starting date on a major tick minute position (starting with a\n // day)\n date.setMinutes(0);\n date.setHours(0);\n date.setSeconds(0);\n\n // if range is week take a week starting point\n if (range == Range.WEEK) {\n while (date.getDayOfWeek() != DateUtils.getFirstDayOfWeek()) {\n date.backDays(1.0);\n }\n } else if (range == Range.MONTH) {\n // month -> month starting point\n date.setDay(1);\n }\n JaretDate save = date.copy();\n\n if (printing) {\n gc.setLineWidth(1);\n }\n // draw top/bottom line\n gc.drawLine(ox, oy, ox, oy + height);\n\n // draw the minor ticks\n while (delegate.xForDate(date) < oy + height) {\n int y = delegate.xForDate(date);\n gc.drawLine(ox, y, ox + minorOff, y);\n if (range == Range.MONTH) {\n int adv = Math.round(minTick / APPROXSECONDSINMONTH);\n if (adv == 0) {\n adv = 1;\n }\n date.advanceMonths(adv);\n } else {\n date.advanceMinutes(minTick);\n }\n }\n\n date = save.copy();\n // draw the major ticks\n while (delegate.xForDate(date) < oy + height) {\n int y = delegate.xForDate(date);\n gc.drawLine(ox, y, ox + majorOff, y);\n if (range == Range.MONTH) {\n int adv = Math.round(majTick / APPROXSECONDSINMONTH);\n if (adv == 0) {\n adv = 1;\n }\n date.advanceMonths(adv);\n } else {\n date.advanceMinutes(majTick);\n }\n }\n\n gc.setLineWidth(1);\n\n // labels: draw every two major ticks\n date = save.copy();\n // Labels are drawn beyond the width. Otherwise when the beginning of\n // the labels\n // would not be drawn when the tick itself is out of sight\n while (delegate.xForDate(date) < drawingArea.y + drawingArea.height + 50) {\n int y = delegate.xForDate(date);\n if (date.getMinutes() % (majTick * 2) == 0) {\n // Second line\n String str = null;\n if (range == Range.HOUR) {\n // time\n str = date.toDisplayStringTime();\n } else if (range == Range.DAY) {\n // day\n str = date.getShortDayOfWeekString();\n } else if (range == Range.WEEK) {\n // week\n str = \"KW\" + date.getWeekOfYear();\n } else if (range == Range.MONTH) {\n // month\n str = Integer.toString(date.getYear());\n }\n // draw\n if (top) {\n SwtGraphicsHelper.drawStringRightAlignedVCenter(gc, str, drawingArea.x + drawingArea.width\n + majorOff, y);\n } else {\n SwtGraphicsHelper.drawStringLeftAlignedVCenter(gc, str, drawingArea.x + majorOff, y);\n }\n // // first line\n // if (range == Range.HOUR) {\n // if (date.getDay() != lastDay) {\n // str = date.getDay() + \". (\" + date.getDayOfWeekString() + \")\";\n // } else {\n // str = \"\";\n // }\n // lastDay = date.getDay();\n // } else if (range == Range.DAY || range == Range.WEEK) {\n // str = date.getDay() + \".\" + (third ? date.getShortMonthString() : \"\");\n // } else if (range == Range.MONTH) {\n // str = date.getMonthString();\n // }\n // second = !second;\n // third = count++ % 3 == 0;\n // SwtGraphicsHelper.drawStringCentered(gc, str, x, oy + dayOff);\n }\n if (range == Range.MONTH) {\n int adv = Math.round(majTick / APPROXSECONDSINMONTH);\n if (adv == 0) {\n adv = 1;\n }\n date.advanceMonths(adv);\n } else {\n date.advanceMinutes(majTick);\n }\n }\n }", "public Double getDailySaleWithoutVat(int month, int day, int year, int storeCode) {\n\t\tDouble amount = getRawGross(month, day, year, storeCode)/getVatRate();\r\n\t\tlogger.debug(\"Raw Gross: \"+amount);\r\n\t\treturn amount;\r\n//\t\treturn dailySale+totDisc+vat;\r\n\t}", "public String windTrendIcon() {\n String trendIcon = \" \";\n if (readings.size() >= 3) {\n float t1 = readings.get(readings.size() - 3).windSpeed;\n float t2 = readings.get(readings.size() - 2).windSpeed;\n float t3 = readings.get(readings.size() - 1).windSpeed;\n if (t3 > t2 && t2 > t1) {\n trendIcon += \" huge long arrow alternate up icon \";\n } else if (t3 < t2 && t2 < t1) {\n trendIcon += \" huge long arrow alternate down icon \";\n } else {\n trendIcon += \" huge arrows alternate horizontal icon\";\n }\n }\n return trendIcon;\n }", "@Test\n public void test61() throws Throwable {\n CategoryPlot categoryPlot0 = new CategoryPlot();\n categoryPlot0.setRangeGridlinesVisible(true);\n categoryPlot0.clearDomainAxes();\n JDBCXYDataset jDBCXYDataset0 = new JDBCXYDataset((Connection) null);\n MeterPlot meterPlot0 = new MeterPlot();\n JFreeChart jFreeChart0 = new JFreeChart((Plot) meterPlot0);\n ChartPanel chartPanel0 = new ChartPanel(jFreeChart0, true);\n String[] stringArray0 = new String[6];\n stringArray0[0] = \"[*tQy\\\"Ir)|..\";\n stringArray0[1] = \".\";\n stringArray0[2] = \"org.jfree.chart.annotations.TextAnnotation\";\n stringArray0[3] = \"Category_Plot\";\n stringArray0[4] = \"mt1@^eqB0HF9rLg\";\n stringArray0[5] = \"B9t}^@/]9\";\n JFreeChart.main(stringArray0);\n boolean boolean0 = jDBCXYDataset0.hasListener(chartPanel0);\n jDBCXYDataset0.setTimeSeries(false);\n DatasetChangeEvent datasetChangeEvent0 = new DatasetChangeEvent((Object) categoryPlot0, (Dataset) jDBCXYDataset0);\n categoryPlot0.datasetChanged(datasetChangeEvent0);\n AxisLocation axisLocation0 = categoryPlot0.getDomainAxisLocation(0);\n Rectangle2D.Double rectangle2D_Double0 = new Rectangle2D.Double((double) 0, (double) 0, (-2820.4), (-2820.4));\n int int0 = rectangle2D_Double0.outcode((double) 0, (-2820.4));\n CategoryAxis categoryAxis0 = new CategoryAxis();\n categoryPlot0.setDomainAxis(15, categoryAxis0);\n }", "private void setupDateTimeInterpreter(final boolean shortDate) {\n mWeekView.setDateTimeInterpreter(new DateTimeInterpreter() {\n @Override\n public String interpretDate(Calendar date) {\n SimpleDateFormat weekdayNameFormat = new SimpleDateFormat(\"EEE\", Locale.getDefault());\n String weekday = weekdayNameFormat.format(date.getTime());\n SimpleDateFormat format = new SimpleDateFormat(\" M/d\", Locale.getDefault());\n\n // All android api level do not have a standard way of getting the first letter of\n // the week day name. Hence we get the first char programmatically.\n // Details: http://stackoverflow.com/questions/16959502/get-one-letter-abbreviation-of-week-day-of-a-date-in-java#answer-16959657\n if (shortDate)\n weekday = String.valueOf(weekday.charAt(0));\n return weekday.toUpperCase() + format.format(date.getTime());\n }\n\n @Override\n public String interpretTime(int hour, int minutes) {\n String strMinutes = String.format(\"%02d\", minutes);\n if (hour > 11) {\n if (hour == 12) {\n return \"12:\" + strMinutes + \" PM\";\n } else {\n return (hour - 12) + \":\" + strMinutes + \" PM\";\n }\n } else {\n if (hour == 0) {\n return \"12:\" + strMinutes + \" AM\";\n } else {\n return hour + \":\" + strMinutes + \" AM\";\n }\n }\n }\n });\n }", "public void setDay(int day) {\r\n this.day = day;\r\n }", "private Day getDay(int day, int month) {\n return mainForm.getDay(day, month);\n }" ]
[ "0.5711288", "0.54807335", "0.4906584", "0.48030573", "0.45229852", "0.45071", "0.44453505", "0.44249108", "0.437002", "0.4330886", "0.4327715", "0.4313148", "0.43106163", "0.43103933", "0.4296545", "0.4292115", "0.42614692", "0.42514506", "0.42509276", "0.42502838", "0.42501482", "0.42123654", "0.4168841", "0.41596606", "0.414446", "0.41351682", "0.41001415", "0.40944514", "0.40913498", "0.40887535", "0.4079779", "0.40717757", "0.40707764", "0.40387583", "0.40308043", "0.40269172", "0.40208918", "0.4004382", "0.40003213", "0.39943978", "0.39842144", "0.39831564", "0.39791685", "0.39759254", "0.39656997", "0.3958057", "0.39562124", "0.39346212", "0.39304605", "0.39253056", "0.39178753", "0.3914414", "0.39084393", "0.3907968", "0.38983393", "0.38937432", "0.38932306", "0.38870594", "0.38795027", "0.38685128", "0.38665625", "0.38632903", "0.38629818", "0.38478008", "0.3845152", "0.38383716", "0.38305718", "0.38255686", "0.38248068", "0.38237962", "0.3821921", "0.38194925", "0.3818543", "0.38179186", "0.3816665", "0.38166314", "0.38141146", "0.38118866", "0.38111967", "0.3808931", "0.3807438", "0.38064694", "0.38060716", "0.38060716", "0.38060716", "0.38026762", "0.37922236", "0.37885574", "0.37855387", "0.37833345", "0.37810442", "0.37793985", "0.3778173", "0.377817", "0.377706", "0.37759644", "0.377552", "0.3774363", "0.3774332", "0.3769101" ]
0.4065727
33
Calculates the signal line for the MACD (Moving Average Convergence/Divergence), which is the difference between a short and a long term moving average for a field. The signal line is a moving average of the MACD used for generating entry/exit signals. The MACD signal line is a 9period exponential moving average of the MACD (Moving Average Convergence/Divergence). The current implementation is quite inefficient; if this method were to be called repeatedly for subsequent periods, the MACD series could be computed only once.
public double MACDSignal(int t) { Series macd = new Series(); macd.x = new double[macd.size = t + 1]; for(int i = 0; i<=t; i++) macd.x[i] = MACD(i); return macd.expMovingAverage(9, t); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override \r\n protected void calculate(int index, DataContext ctx)\r\n {\r\n DataSeries series = ctx.getDataSeries();\r\n boolean complete=true;\r\n \r\n /*\r\n int macdPeriod1 = getSettings().getInteger(MACD_PERIOD1, 12);\r\n int macdPeriod2 = getSettings().getInteger(MACD_PERIOD2, 26);\r\n Enums.MAMethod macdMethod = getSettings().getMAMethod(MACD_METHOD, Enums.MAMethod.EMA);\r\n Object macdInput = getSettings().getInput(MACD_INPUT, Enums.BarInput.CLOSE);\r\n if (index >= Util.max(macdPeriod1, macdPeriod2)) {\r\n Double MA1 = null, MA2 = null;\r\n MA1 = series.ma(macdMethod, index, macdPeriod1, macdInput);\r\n MA2 = series.ma(macdMethod, index, macdPeriod2, macdInput);\r\n \r\n double MACD = MA1 - MA2; \r\n series.setDouble(index, Values.MACD, MACD);\r\n\r\n int signalPeriod = getSettings().getInteger(Inputs.SIGNAL_PERIOD, 9);\r\n\r\n // Calculate moving average of MACD (signal line)\r\n Double signal = series.ma(getSettings().getMAMethod(Inputs.SIGNAL_METHOD, Enums.MAMethod.SMA), index, signalPeriod, Values.MACD);\r\n series.setDouble(index, Values.SIGNAL, signal);\r\n \r\n if (signal != null) series.setDouble(index, Values.HIST, MACD - signal);\r\n\r\n if (series.isBarComplete(index)) {\r\n // Check for signal events\r\n Coordinate c = new Coordinate(series.getStartTime(index), signal);\r\n if (crossedAbove(series, index, Values.MACD, Values.SIGNAL)) {\r\n MarkerInfo marker = getSettings().getMarker(Inputs.UP_MARKER);\r\n String msg = get(\"SIGNAL_MACD_CROSS_ABOVE\", MACD, signal);\r\n if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.BOTTOM, marker, msg));\r\n ctx.signal(index, Signals.CROSS_ABOVE, msg, signal);\r\n }\r\n else if (crossedBelow(series, index, Values.MACD, Values.SIGNAL)) {\r\n MarkerInfo marker = getSettings().getMarker(Inputs.DOWN_MARKER);\r\n String msg = get(\"SIGNAL_MACD_CROSS_BELOW\", MACD, signal);\r\n if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.TOP, marker, msg));\r\n ctx.signal(index, Signals.CROSS_BELOW, msg, signal);\r\n }\r\n }\r\n }\r\n else complete=false;\r\n \r\n int rsiPeriod = getSettings().getInteger(RSI_PERIOD);\r\n Object rsiInput = getSettings().getInput(RSI_INPUT);\r\n if (index < 1) return; // not enough data\r\n \r\n double diff = series.getDouble(index, rsiInput) - series.getDouble(index-1, rsiInput);\r\n double up = 0, down = 0;\r\n if (diff > 0) up = diff;\r\n else down = diff;\r\n \r\n series.setDouble(index, Values.UP, up);\r\n series.setDouble(index, Values.DOWN, Math.abs(down));\r\n \r\n if (index <= rsiPeriod +1) return;\r\n \r\n Enums.MAMethod method = getSettings().getMAMethod(RSI_METHOD);\r\n double avgUp = series.ma(method, index, rsiPeriod, Values.UP);\r\n double avgDown = series.ma(method, index, rsiPeriod, Values.DOWN);\r\n double RS = avgUp / avgDown;\r\n double RSI = 100.0 - ( 100.0 / (1.0 + RS));\r\n\r\n series.setDouble(index, Values.RSI, RSI);\r\n \r\n // Do we need to generate a signal?\r\n GuideInfo topGuide = getSettings().getGuide(Inputs.TOP_GUIDE);\r\n GuideInfo bottomGuide = getSettings().getGuide(Inputs.BOTTOM_GUIDE);\r\n if (crossedAbove(series, index, Values.RSI, topGuide.getValue())) {\r\n series.setBoolean(index, Signals.RSI_TOP, true);\r\n ctx.signal(index, Signals.RSI_TOP, get(\"SIGNAL_RSI_TOP\", topGuide.getValue(), round(RSI)), round(RSI));\r\n }\r\n else if (crossedBelow(series, index, Values.RSI, bottomGuide.getValue())) {\r\n series.setBoolean(index, Signals.RSI_BOTTOM, true);\r\n ctx.signal(index, Signals.RSI_BOTTOM, get(\"SIGNAL_RSI_BOTTOM\", bottomGuide.getValue(), round(RSI)), round(RSI));\r\n }\r\n */\r\n series.setComplete(index, complete);\r\n }", "public void updateSMA(){\n audioInput.read(audioBuffer, 0, bufferSize);\n Complex [] FFTarr = doFFT(shortToDouble(audioBuffer));\n FFTarr = bandPassFilter(FFTarr);\n double sum = 0;\n for(int i = 0; i<FFTarr.length;i++){\n sum+=Math.abs(FFTarr[i].re()); // take the absolute value of the FFT raw value\n }\n double bandPassAverage = sum/FFTarr.length;\n Log.d(LOGTAG, \"bandPassAverage: \" + bandPassAverage);\n\n //Cut out loud samples, otherwise compute rolling average as usual\n if(bandPassAverage>THROW_OUT_THRESHOLD){\n mySMA.compute(mySMA.currentAverage());\n }else {\n mySMA.compute(bandPassAverage);\n }\n }", "public double MACD(int slow, int fast, int t)\n {\n if(slow<=fast)\n throw new IndexOutOfBoundsException(\"MACD(\" + slow + \" - \" +\n fast + \") is undefined at time \" + t);\n return expMovingAverage(slow, t) - expMovingAverage(fast, t);\n }", "private void calcDVOWDNa(\n final Line line1,\n final Line line2,\n final Point point1,\n final Point point2) {\n\n\n double average_x = (point1.x + point2.x) / 2.0;\n\n this.p1 = new Point(\n (point1.x + average_x) / 2.0,\n line1.a * (point1.x + average_x) / 2.0 + line1.b);\n\n this.p3 = new Point(\n (point2.x + average_x) / 2.0,\n line2.a * (point2.x + average_x) / 2.0 + line2.b);\n\n Line median = Line.fromPoints(p1, p3);\n this.p2 = new Point(average_x, median.eval(average_x));\n\n assert p3.y <= Math.max(point2.y, point1.y);\n assert p1.y <= Math.max(point2.y, point1.y);\n assert p3.y >= Math.min(point2.y, point1.y);\n assert p1.y >= Math.min(point2.y, point1.y);\n\n this.type = Type.bernstein;\n this.p0 = new Point(point1);\n this.p4 = new Point(point2);\n\n //return(f);\n }", "@Override\r\n protected void calculateValues(DataContext ctx)\r\n {\r\n\t//Common MTF Inputs\r\n\tint mtfPeriod = getSettings().getInteger(MTF_MULTIPLIER);\r\n Object mtfInput = getSettings().getInput(SMI_INPUT, Enums.BarInput.CLOSE);\r\n \r\n int mtfSmooth = getSettings().getInteger(SMI_SMOOTH);\r\n int mtfSignal = getSettings().getInteger(SMI_SIGNAL);\r\n int mtfHLinc = getSettings().getInteger(SMI_HL_MTF_INC);\r\n int mtfMAinc = getSettings().getInteger(SMI_MA_MTF_INC);\r\n \r\n\tint mtfHL = getSettings().getInteger(SMI_HL1_MTF);\r\n\tint mtfMA = getSettings().getInteger(SMI_MA1_MTF);\r\n \r\n /* MTF Bar sizing */\r\n BarSize barSize = ctx.getChartBarSize(); //Gets the barsize off the chart\r\n int mtfbarint = barSize.getInterval(); //Gets the interval of the chart\r\n int barSizeint = mtfbarint * mtfPeriod; //Multiply the interval by the mtf multiplier\r\n \r\n //Calculates a longer period interval based upon the mtfPeriod\r\n BarSize barSizeNew = barSize.getBarSize(barSize.getType(), barSizeint); \r\n //Assembes the longer period timeframe series\r\n DataSeries series2 = ctx.getDataSeries(barSizeNew);\r\n\r\n String valStringOut; //variables for the return results\r\n String valStringD;\r\n String valStringHL;\r\n String valStringD_MA;\r\n String valStringHL_MA;\r\n int hlPeriodmtf;\r\n int maPeriodmtf;\r\n \r\n StudyHeader header = getHeader();\r\n boolean updates = getSettings().isBarUpdates() || (header != null && header.requiresBarUpdates());\r\n\r\n // Calculates Moving Average for the Secondary Data Series\r\n for(int i = 1; i < series2.size(); i++) {\r\n if (series2.isComplete(i)) continue;\r\n if (!updates && !series2.isBarComplete(i)) continue;\r\n //Double sma = series2.ma(MAMethod.SMA, i, mtfPeriod, mtfInput);\r\n \r\n //insert smi logic\r\n for(int j = 1; j <= 4; j++) {\r\n \t \r\n switch (j) {\r\n case 1:\r\n \t valStringOut \t = \"Values.MTF1\"; //D1, HL1, D_MA1, HL_MA1 mtfHLinc\r\n \t valStringD \t = \"Values.D1\";\r\n \t valStringHL \t = \"Values.HL1\";\r\n \t valStringD_MA\t = \"Values.D_MA1\";\r\n \t valStringHL_MA = \"Values.HL_MA1\";\r\n \t hlPeriodmtf = mtfHL; //Base HL\r\n \t maPeriodMA = mtfMA; //Base MA\r\n \t break;\r\n case 2:\r\n \t valStringOut = \"Values.MTF2\";\r\n \t valStringD \t = \"Values.D2\";\r\n \t valStringHL \t = \"Values.HL2\";\r\n \t valStringD_MA\t = \"Values.D_MA2\";\r\n \t valStringHL_MA = \"Values.HL_MA2\";\r\n \t hlPeriodmtf = mtfHL + mtfHLinc; //Base HL + Increment\r\n \t maPeriodMA = mtfMA + mtfMAinc; //Base MA + Increment \t \r\n \t break;\r\n case 3:\r\n \t valStringOut = \"Values.MTF3\";\r\n \t valStringD \t = \"Values.D3\";\r\n \t valStringHL \t = \"Values.HL3\";\r\n \t valStringD_MA\t = \"Values.D_MA3\";\r\n \t valStringHL_MA = \"Values.HL_MA3\";\r\n \t hlPeriodmtf = mtfHL + (mtfHLinc*2); //Base HL + Increment*2\r\n \t maPeriodMA = mtfMA + (mtfMAinc*2); //Base MA + Increment*2 \t \r\n \t break;\r\n case 4:\r\n \t valStringOut = \"Values.MTF4\";\r\n \t valStringD \t = \"Values.D4\";\r\n \t valStringHL \t = \"Values.HL4\";\r\n \t valStringD_MA\t = \"Values.D_MA4\";\r\n \t valStringHL_MA = \"Values.HL_MA4\";\r\n \t hlPeriodmtf = mtfHL + (mtfHLinc*3); //Base HL + Increment\r\n \t maPeriodMA = mtfMA + (mtfMAinc*3); //Base MA + Increment\r\n \t break;\r\n default:\r\n \t break;\t \r\n } //end switch\r\n \r\n //base HL period is mtfHL\r\n if (i < mtfHL) return;\r\n\r\n double HH = series2.highest(i, hlPeriodmtf, Enums.BarInput.HIGH);\r\n double LL = series2.lowest(i, hlPeriodmtf, Enums.BarInput.LOW);\r\n double M = (HH + LL)/2.0;\r\n double D = series2.getClose(i) - M;\r\n \r\n series.setDouble(i, valStringD, D);\r\n series.setDouble(i, valStringHL, HH - LL);\r\n \r\n int maPeriod = getSettings().getInteger(MA_PERIOD);\r\n if (index < hlPeriod + maPeriod) return;\r\n \r\n Enums.MAMethod method = getSettings().getMAMethod(Inputs.METHOD);\r\n series.setDouble(index, Values.D_MA, series.ma(method, index, maPeriod, Values.D));\r\n series.setDouble(index, Values.HL_MA, series.ma(method, index, maPeriod, Values.HL));\r\n \r\n int smoothPeriod= getSettings().getInteger(SMOOTH_PERIOD);\r\n if (index < hlPeriod + maPeriod + smoothPeriod) return;\r\n \r\n Double D_SMOOTH = series.ma(method, index, smoothPeriod, Values.D_MA);\r\n Double HL_SMOOTH = series.ma(method, index, smoothPeriod, Values.HL_MA);\r\n \r\n if (D_SMOOTH == null || HL_SMOOTH == null) return;\r\n double HL2 = HL_SMOOTH/2;\r\n double SMI = 0;\r\n if (HL2 != 0) SMI = 100 * (D_SMOOTH/HL2);\r\n\r\n series.setDouble(index, Values.SMI, SMI);\r\n\r\n int signalPeriod= getSettings().getInteger(Inputs.SIGNAL_PERIOD);\r\n if (index < hlPeriod + maPeriod + smoothPeriod + signalPeriod) return;\r\n\r\n Double signal = series.ma(method, index, signalPeriod, Values.SMI);\r\n if (signal == null) return;\r\n series.setDouble(index, Values.SMI_SIGNAL, signal);\r\n\r\n \r\n \r\n } //end j bracket\r\n \r\n \r\n \r\n \r\n \r\n series2.setDouble(i, Values.MTF, sma);\r\n }\r\n\r\n // Invoke the parent method to run the \"calculate\" method below for the primary (chart) data series\r\n super.calculateValues(ctx);\r\n }", "private void processSound() {\r\n if (!isEnabled) {\r\n return;\r\n }\r\n\r\n Thread.currentThread().setPriority(Thread.MAX_PRIORITY);\r\n\r\n byte[] data = new byte[line.available()];\r\n if (data.length == 0) {\r\n return;\r\n }\r\n\r\n line.read(data, 0, data.length);\r\n \r\n double[][] partitionedAndTransformedData =\r\n getPartitionedAndTransformedData(SOUND_PARTITIONS, data);\r\n \r\n double[] offMagnitudes = getPartitionedFrequencyMagnitudes(\r\n Constants.FREQUENCY_OFF,\r\n partitionedAndTransformedData,\r\n Constants.SAMPLE_RATE);\r\n double[] offOffsetMagnitudes = getPartitionedFrequencyMagnitudes(\r\n Constants.FREQUENCY_OFF + Constants.FREQUENCY_SECOND_OFFSET,\r\n partitionedAndTransformedData,\r\n Constants.SAMPLE_RATE);\r\n double[] onMagnitudes = getPartitionedFrequencyMagnitudes(\r\n Constants.FREQUENCY_ON,\r\n partitionedAndTransformedData,\r\n Constants.SAMPLE_RATE);\r\n double[] onOffsetMagnitudes = getPartitionedFrequencyMagnitudes(\r\n Constants.FREQUENCY_ON + Constants.FREQUENCY_SECOND_OFFSET,\r\n partitionedAndTransformedData,\r\n Constants.SAMPLE_RATE);\r\n \r\n double offMagnitudeSum = 0.0;\r\n double onMagnitudeSum = 0.0;\r\n \r\n for (int i = 0; i < SOUND_PARTITIONS; i++) {\r\n double offMagnitude = offMagnitudes[i] + offOffsetMagnitudes[i];\r\n double onMagnitude = onMagnitudes[i] + onOffsetMagnitudes[i];\r\n \r\n offMagnitudeSum += offMagnitude;\r\n onMagnitudeSum += onMagnitude;\r\n \r\n// System.out.printf(\"%.2f %.2f%n\", offMagnitude, onMagnitude);\r\n\r\n boolean value = onMagnitude > offMagnitude;\r\n \r\n audioSignalParser.addSignal(value);\r\n \r\n if (value) {\r\n offRunningAverage.add(offMagnitude);\r\n } else {\r\n onRunningAverage.add(onMagnitude);\r\n }\r\n }\r\n\r\n if (offRunningAverage.haveAverage() && onRunningAverage.haveAverage()) {\r\n double offMagnitudeAverage = offMagnitudeSum / SOUND_PARTITIONS;\r\n double onMagnitudeAverage = onMagnitudeSum / SOUND_PARTITIONS;\r\n\r\n boolean isLineFree = \r\n Statistics.isWithinAverage(\r\n onMagnitudeAverage,\r\n onRunningAverage.getAverage(),\r\n onRunningAverage.getStandardDeviation(),\r\n 3 /* deviations */)\r\n && Statistics.isWithinAverage(\r\n offMagnitudeAverage,\r\n offRunningAverage.getAverage(),\r\n offRunningAverage.getStandardDeviation(),\r\n 3 /* deviations */);\r\n lineActivity.add(isLineFree ? 0 : 1);\r\n }\r\n }", "public double MACD(int t)\n {\n return MACD(26, 12, t);\n }", "public void updatePredictions (long currTime, TimeSeries inputSeries)\n {\n\n// TODO: decide if this is necessary, it's in PPALg >>\n this.state.clearPredictionsFrom (currTime + stepSize);\n//this.state.clearPredictions();\n\n TimeSeries timeSeries = (TimeSeries) inputSeries.clone();\n\n // if timeSeries is shorter than the minimum stream do nothing.\n if (timeSeries.size() < minStreamLength)\n return;\n\n // trim the first <minPeriod> number of elements from the timeSeries.\n // this removes non-periodicity that is seen in simulators first few elements.\n\n timeSeries.trimFromStart(minPeriodLength);\n\n df.addText (\"First trim of time series : \" + timeSeries.shortToString());\n\n // find the best shift of the time series against iteself that leads to the most matching\n ArrayList shiftGraph = findBestShiftGraph (timeSeries);\n\n // trim the shifted graph to make sure we aren't starting in the middle of an event\n int amountTrimmed = trimShiftGraph (shiftGraph);\n\n df.addText (\"Trim amount : \" + amountTrimmed);\n df.addText (\"final, trimmed shift graph : \" + shiftGraph.toString());\n\n // the offset is the total amount of the time series we have discarded, it is the offset\n // to the leading edge of a periodic repeating occurence\n int offset = amountTrimmed + minPeriodLength;\n\n // create a new periodic event object\n PeriodicEvent pe = getPeriod (shiftGraph, offset);\n\n if (pe == null || pe.getEvent().isEmpty())\n {\n df.addText (\" Periodic event is null \");\n return;\n }\n\n df.addText (\" Periodic Event is : \" + pe.toString());\n\n // get the current time from which we will extrapolate\n long time = currTime;\n\n int period = pe.getPeriod();\n ArrayList event = pe.getEvent();\n\n // if we divide the timeSeries into portions the size of the time period, how much is left over?\n // for this we do not consider the trimmed amount.\n int timeSeriesSize = timeSeries.size() - amountTrimmed;\n\n if (timeSeriesSize <= period)\n return;\n int remainder = getRemainder (timeSeriesSize, period);\n df.addText (\"remainder is : \" + remainder);\n\n // cycle through the remaining portion of the last period adding any predictions based on\n // our periodic event that we have identified.\n // must subtract 1 since index is zero-base, & reaminder is one-based\n for (int i = remainder -1 ; i < event.size(); i++)\n {\n double prediction;\n\n time = time + timeSeries.getTimeIncrement();\n\n if (i >= 0 && event.get (i) != null)\n {\n prediction = ((Double) event.get(i)).doubleValue();\n\n state.addPrediction ( time, prediction);\n df.addText (\"Adding prediction : \" + prediction + \" for time : \" + time);\n }\n } // end for (i)\n\n int extrapolationCount = 2;\n\n // We make <j> additional extapolation into the future beyond the last period fragment\n while (extrapolationCount > 0)\n {\n for (int j = 0; j < event.size(); j++)\n {\n double prediction;\n\n time = time + timeSeries.getTimeIncrement();\n\n if (event.get (j) != null)\n {\n prediction = ((Double) event.get(j)).doubleValue();\n\n state.addPrediction ( time, prediction);\n df.addText (\"Adding prediction : \" + prediction + \" for time : \" + time);\n }\n } // end for (j)\n\n extrapolationCount--;\n } // end while (extapoliationCount)\n\n\n state.updateError (timeSeries, currTime);\n }", "public void calcAcceleration() {\n double firstSpeed = get(0).distanceTo(get(1)) / ((get(1).getTime() - get(0).getTime()) * INTER_FRAME_TIME);\n double lastSpeed = get(length() - 2).distanceTo(get(length() - 1))\n / ((get(length() - 1).getTime() - get(length() - 2).getTime()) * INTER_FRAME_TIME);\n avgAcceleration = (firstSpeed + lastSpeed) / ((get(length() - 1).getTime() - get(0).getTime()) * INTER_FRAME_TIME);\n }", "public double getSignal() {return _signal;}", "public float m1284a(ac acVar, ac acVar2) {\r\n double a = C0270y.m1729a(acVar.m825c());\r\n double a2 = C0270y.m1729a(acVar.m826d());\r\n double a3 = C0270y.m1729a(acVar2.m825c());\r\n a *= this.f768q;\r\n a2 *= this.f768q;\r\n a3 *= this.f768q;\r\n double a4 = C0270y.m1729a(acVar2.m826d()) * this.f768q;\r\n double sin = Math.sin(a);\r\n double sin2 = Math.sin(a2);\r\n a = Math.cos(a);\r\n a2 = Math.cos(a2);\r\n double sin3 = Math.sin(a3);\r\n double sin4 = Math.sin(a4);\r\n a3 = Math.cos(a3);\r\n a4 = Math.cos(a4);\r\n r17 = new double[3];\r\n double[] dArr = new double[]{a * a2, a2 * sin, sin2};\r\n dArr[0] = a4 * a3;\r\n dArr[1] = a4 * sin3;\r\n dArr[2] = sin4;\r\n return (float) (Math.asin(Math.sqrt((((r17[0] - dArr[0]) * (r17[0] - dArr[0])) + ((r17[1] - dArr[1]) * (r17[1] - dArr[1]))) + ((r17[2] - dArr[2]) * (r17[2] - dArr[2]))) / 2.0d) * 1.27420015798544E7d);\r\n }", "void plotLineDeltaA(int[] shades1, boolean tScreened1, int[] shades2,\n boolean tScreened2, int shadeIndex, int xA, int yA, int zA,\n int dxBA, int dyBA, int dzBA, boolean clipped) {\n x1t = xA;\n x2t = xA + dxBA;\n y1t = yA;\n y2t = yA + dyBA;\n z1t = zA;\n z2t = zA + dzBA;\n if (clipped)\n switch (getTrimmedLine()) {\n case VISIBILITY_OFFSCREEN:\n return;\n case VISIBILITY_UNCLIPPED:\n clipped = false;\n }\n plotLineClippedA(shades1, tScreened1, shades2, tScreened2, shadeIndex, xA,\n yA, zA, dxBA, dyBA, dzBA, clipped, 0, 0);\n }", "private void computeAverageFrequencyDelayValue() {\n\tthis.averageFrequencyDelayValue = value * this.averageDelay;\n }", "void hit(int frequency, double duration, double amplitude){\r\n \tSystem.out.println(\"Frequency: \"+frequency+\", Duration: \"+duration+\", Amplitude: \"+amplitude);\r\n \t\r\n\r\n\t\tadder.inputA.set(frequency); //fc !!!\r\n\t\tvibrato.frequency.set( frequency+80 ); // fm!!!\r\n\t\tvibrato.amplitude.set( (frequency+80)*2 ); // fm*2!!!\r\n \t\r\n\t\tint i=0;\r\n\t\tdata[i++] = 0.01;\t\t\t// Duration of first segment. \r\n\t\tdata[i++] = amplitude; \t\t// value \r\n\t\tdata[i++] = duration*0.13; \t// duration\r\n\t\t\tamplitude/=2;\r\n\t\tdata[i++] = amplitude; \t\t// value \r\n\t\tdata[i++] = duration*0.23; \t// duration \r\n\t\t\tamplitude/=2;\r\n\t\tdata[i++] = amplitude; \t\t// value \r\n\t\tdata[i++] = duration*0.23; \t// duration \r\n\t\t\tamplitude/=2;\r\n\t\tdata[i++] = amplitude; \t\t// value \r\n\t\tdata[i++] = duration*0.4; \t// duration \r\n\t\tdata[i++] = 0.0; \t\t\t// value \r\n\r\n\t\ti = 0;\r\n\t\tamplitude = 280*2;\r\n\t\tdata2[i++] = 0.01;\t\t\t// Duration of first segment. \r\n\t\tdata2[i++] = amplitude; \t\t// value \r\n\t\tdata2[i++] = duration*0.13; \t// duration\r\n\t\t\tamplitude/=2;\r\n\t\tdata2[i++] = amplitude; \t\t// value \r\n\t\tdata2[i++] = duration*0.23; \t// duration \r\n\t\t\tamplitude/=2;\r\n\t\tdata2[i++] = amplitude; \t\t// value \r\n\t\tdata2[i++] = duration*0.23; \t// duration \r\n\t\t\tamplitude/=2;\r\n\t\tdata2[i++] = amplitude; \t\t// value \r\n\t\tdata2[i++] = duration*0.4; \t// duration \r\n\t\tdata2[i++] = 0.0; \t\t\t// value \r\n\r\n\t\tenvData.write( 0, data, 0, i/2 );\r\n\t\tenvData2.write( 0, data2, 0, i/2 );\r\n \tenvPlayer.envelopePort.clear();\r\n \tenvPlayer2.envelopePort.clear();\r\n \tenvPlayer.envelopePort.queue( envData, 0, i/2 );\r\n \tenvPlayer2.envelopePort.queue( envData2, 0, i/2 );\r\n }", "public void addline(int Signal, String mac, String SSID, int frequncy) {\r\n\r\n\t\tthis.wifis.add(new wifi(Signal,mac,SSID,frequncy));\r\n\t\tnumOfScans++;\r\n\t}", "static double slope(Line line) {\n return (line.b == 1) ? -line.a : INF;\n }", "double getAvgTreatment();", "private double[][] calculateValues() throws ExafsScanPointCreatorException {\n\t\tscanTimes= new ArrayList<> ();\n\t\tdouble[][] preEdgeEnergies = createStepArray(initialEnergy, aEnergy, preEdgeStep, preEdgeTime, false,\n\t\t\t\tnumberDetectors);\n\t\tscanTimes.add(new ExafsScanRegionTime(\"PreEdge\", preEdgeEnergies.length, new double[]{preEdgeTime}));\n\t\tdouble[][] abEnergies = convertABSteps(aEnergy, bEnergy, preEdgeStep, edgeStep, preEdgeTime);\n\t\tscanTimes.add(new ExafsScanRegionTime(\"AbEdge\", abEnergies.length, new double[]{preEdgeTime}));\n\n\t\tdouble[][] bcEnergies = createStepArray(bEnergy+edgeStep, cEnergy, edgeStep, edgeTime, false, numberDetectors);\n\t\tscanTimes.add(new ExafsScanRegionTime(\"BcEnergy\", bcEnergies.length, new double[]{edgeTime}));\n\t\t// if varying time the temporarily set the exafs time to a fixed value\n\t\tif (!exafsConstantTime)\n\t\t\texafsTime = exafsFromTime;\n\n\t\tdouble[][] exafsEnergies;\n\t\tif (exafsConstantEnergyStep)\n\t\t\texafsEnergies = createStepArray(cEnergy, finalEnergy, exafsStep, exafsTime, true, numberDetectors);\n\t\telse\n\t\t\texafsEnergies = calculateExafsEnergiesConstantKStep();\n\t\t// now change all the exafs times if they vary\n\t\tif (!exafsConstantTime)\n\t\t\texafsEnergies = convertTimes(exafsEnergies, exafsFromTime, exafsToTime);\n\n\t\t// Smooth out the transition between edge and exafs region.\n\t\tfinal double[][][] newRegions = createEdgeToExafsSteps(cEnergy, exafsEnergies, edgeStep, exafsTime);\n\t\tfinal double[][] edgeToExafsEnergies = newRegions[0];\n\t\tif(edgeToExafsEnergies != null)\n\t\t\tscanTimes.add(new ExafsScanRegionTime(\"EdgetoExafs\", edgeToExafsEnergies.length, new double[]{exafsTime}));\n\t\texafsEnergies = newRegions[1];\n\n\t\t// The edgeToExafsEnergies replaces the first EXAFS_SMOOTH_COUNT\n\n\t\t// merge arrays\n\t\tdouble []exafsRegionTimeArray = new double[exafsEnergies.length];\n\t\tint k =0;\n\t\tfor(double[] exafsEnergy : exafsEnergies)\n\t\t\texafsRegionTimeArray[k++ ] = exafsEnergy[1];\n\t\tscanTimes.add(new ExafsScanRegionTime(\"Exafs\", 1, exafsRegionTimeArray));\n\t\tdouble[][] allEnergies = (double[][]) ArrayUtils.addAll(preEdgeEnergies, abEnergies);\n\t\tallEnergies = (double[][]) ArrayUtils.addAll(allEnergies, bcEnergies);\n\t\tif (edgeToExafsEnergies != null)\n\t\t\tallEnergies = (double[][]) ArrayUtils.addAll(allEnergies, edgeToExafsEnergies);\n\t\tallEnergies = (double[][]) ArrayUtils.addAll(allEnergies, exafsEnergies);\n\t\treturn allEnergies;\n\t}", "static double sawtoothWave(double timeInSeconds, double frequency) {\r\n\t\treturn 0;\t\t\r\n\t}", "public static double getGraidentBasedOnTradingDays(IGraphLine aLine, TreeSet<AbstractGraphPoint> listOfTradingDays) {\r\n double result = 0;\r\n if (null != aLine && null != listOfTradingDays) {\r\n AbstractGraphPoint myCurrStart = aLine.getCurrentC();\r\n AbstractGraphPoint myCurrEnd = aLine.getCurrentE();\r\n if (myCurrStart.getDateAsNumber() != myCurrEnd.getDateAsNumber()) {\r\n// TreeSet<AbstractGraphPoint> tDay = new TreeSet<AbstractGraphPoint>(AbstractGraphPoint.TimeComparator);\r\n// tDay.addAll(listOfTradingDays);\r\n //Calc P1\r\n //Get Market close time on start day\r\n Calendar endTrading = DTUtil.deepCopyCalendar(myCurrStart.getCalDate());\r\n endTrading.setTimeZone(DTConstants.EXCH_TIME_ZONE);\r\n endTrading.set(Calendar.HOUR_OF_DAY, DTConstants.EXCH_CLOSING_HOUR);\r\n endTrading.set(Calendar.MINUTE, DTConstants.EXCH_CLOSING_MIN);\r\n endTrading.set(Calendar.SECOND, DTConstants.EXCH_CLOSING_SEC);\r\n double p1 = endTrading.getTimeInMillis() - myCurrStart.getCalDate().getTimeInMillis();\r\n //double p1 = endTrading.getTimeInMillis() - (myCurrStart.getCalDate().getTimeInMillis() - DTConstants.MILLSECS_PER_HOUR);\r\n //Now calculate P2\r\n //Get Market open time on end day\r\n Calendar startTrading = DTUtil.deepCopyCalendar(myCurrEnd.getCalDate());\r\n startTrading.setTimeZone(DTConstants.EXCH_TIME_ZONE);\r\n startTrading.set(Calendar.HOUR_OF_DAY, DTConstants.EXCH_OPENING_HOUR);\r\n startTrading.set(Calendar.MINUTE, DTConstants.EXCH_OPENING_MIN);\r\n startTrading.set(Calendar.SECOND, DTConstants.EXCH_OPENING_SEC);\r\n double p2 = (myCurrEnd.getCalDate().getTimeInMillis() - startTrading.getTimeInMillis());\r\n //double p2 = (myCurrEnd.getCalDate().getTimeInMillis() - DTConstants.MILLSECS_PER_HOUR) - startTrading.getTimeInMillis();\r\n //Now calc P3\r\n //Get count of trading days from list\r\n// int currStartDay = myCurrStart.getDateAsNumber();\r\n// int currEndDay = myCurrEnd.getDateAsNumber();\r\n// NavigableSet<AbstractGraphPoint> subSet = new TreeSet<AbstractGraphPoint>();\r\n// for(AbstractGraphPoint currPoint : tDay){\r\n// int currDay = currPoint.getDateAsNumber();\r\n// if(currDay > currStartDay && currDay < currEndDay){\r\n// subSet.add(currPoint);\r\n// }\r\n// }\r\n NavigableSet<AbstractGraphPoint> subSet = listOfTradingDays.subSet(myCurrStart, false, myCurrEnd, false);\r\n ArrayList<AbstractGraphPoint> theSet = new ArrayList<AbstractGraphPoint>();\r\n theSet.addAll(subSet);\r\n for (AbstractGraphPoint currPoint : theSet) {\r\n if (currPoint.getDateAsNumber() == myCurrStart.getDateAsNumber() || currPoint.getDateAsNumber() == myCurrEnd.getDateAsNumber()) {\r\n subSet.remove(currPoint);\r\n }\r\n }\r\n double dayCount = subSet.size();\r\n double p3 = dayCount * DTUtil.msPerTradingDay();\r\n\r\n //Sum all three parts as deltaX\r\n double deltaX = p1 + p2 + p3;\r\n double deltaY = myCurrEnd.getLastPrice() - myCurrStart.getLastPrice();\r\n\r\n //Gradient is deltaY / deltaX\r\n result = deltaY / deltaX;\r\n\r\n System.out.println(\"Delta Y = \" + deltaY);\r\n System.out.println(\"Delta X = \" + deltaX);\r\n System.out.println(aLine.toString());\r\n } else {\r\n result = aLine.getGradient();\r\n System.out.println(aLine.toString());\r\n }\r\n }\r\n return result;\r\n }", "public double getCalcAverage(double a15m, double a1h, double a4h, double a12h, double a1d, double a2d, double a7d) {\r\n\t\tdouble avg = 0;\r\n\t\t\r\n\t\tavg += a7d * (_7dWeight / 100.);\r\n\t\tavg += a2d * (_2dWeight / 100.);\r\n\t\tavg += a1d * (_1dWeight / 100.);\r\n\t\tavg += a12h * (_12hWeight / 100.);\r\n\t\t\r\n\t\t//This part check on whether the lower averages were null(-1) and if so assigns their weight to the higher up averages\r\n\t\tif(a4h < 0) {\r\n\t\t\tavg += a12h * ((_4hWeight + _1hWeight + _15mWeight) / 100.);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tavg += a4h * (_4hWeight / 100.);\r\n\t\t\tif(a1h < 0) {\r\n\t\t\t\tavg += a4h * ((_1hWeight + _15mWeight) / 100.);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tavg += a1h * (_1hWeight / 100.);\r\n\t\t\t\tif(a15m < 0) {\r\n\t\t\t\t\tavg += a1h * ((_15mWeight) / 100.);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tavg += a15m * (_15mWeight / 100.);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn avg;\r\n\t}", "public ArrayList<Double> method1(int a, int b) {\n \tif(a > b) {\n \t\tint temp = a;\n \t\ta = b;\n \t\tb = temp;\n \t}\n \t\n int nnumberofFilters = 24;\t\n int nlifteringCoefficient = b;\t//earlier value was 22, now set to a-20\n boolean oisLifteringEnabled = true;\n boolean oisZeroThCepstralCoefficientCalculated = false;\n int nnumberOfMFCCParameters = a; //earlier value was 12, now set to a-10//without considering 0-th\n double dsamplingFrequency = 8000.0;\n int nFFTLength = 512;\n ArrayList<Double> mfcc_parameters = new ArrayList<Double>();\n \n if (oisZeroThCepstralCoefficientCalculated) {\n //take in account the zero-th MFCC\n nnumberOfMFCCParameters = nnumberOfMFCCParameters + 1;\n }\n else {\n nnumberOfMFCCParameters = nnumberOfMFCCParameters;\n }\n\n MFCC mfcc = new MFCC(nnumberOfMFCCParameters,\n dsamplingFrequency,\n nnumberofFilters,\n nFFTLength,\n oisLifteringEnabled,\n nlifteringCoefficient,\n oisZeroThCepstralCoefficientCalculated);\n //simulate a frame of speech\n double[] x = new double[160];\n Random rand = new Random();\n x[2]= rand.nextDouble(); x[4]= rand.nextDouble();\n double[] dparameters = mfcc.getParameters(x);\n for (int i = 0; i < dparameters.length; i++) \n {\n \tmfcc_parameters.add(dparameters[i]);\n }\n if(Preferences.DEBUG_MODE)\n\t\t\tSystem.out.println(\"DEBUG SET MFCC result: \"+mfcc_parameters);\t \t \n \n\t\treturn mfcc_parameters;\n }", "public double getCdragAnalytical (double cldin, double effaoa, double thickness, double camber)\n {\n double dragco = 0;\n int index,ifound; \n double dragCam0Thk5, dragCam5Thk5, dragCam10Thk5, dragCam15Thk5, dragCam20Thk5;\n double dragCam0Thk10, dragCam5Thk10, dragCam10Thk10, dragCam15Thk10, dragCam20Thk10;\n double dragCam0Thk15, dragCam5Thk15, dragCam10Thk15, dragCam15Thk15, dragCam20Thk15;\n double dragCam0Thk20, dragCam5Thk20, dragCam10Thk20, dragCam15Thk20, dragCam20Thk20;\n double dragThk5, dragThk10, dragThk15, dragThk20;\n double dragCam0, dragCam5, dragCam10, dragCam15, dragCam20; //used for the flat plate drag values\n\n if (current_part.foil == FOIL_JOUKOWSKI) //airfoil drag logic\n {\n //switch (in.opts.foil_drag_comp_method) {\n //case DRAG_COMP_POLY_FOILSIMORIG: {\n // thickness 5%\n dragCam0Thk5 = -9E-07*Math.pow(effaoa,3) + 0.0007*Math.pow(effaoa,2) + 0.0008*effaoa + 0.015;\n dragCam5Thk5 = 4E-08*Math.pow(effaoa,5) - 7E-07*Math.pow(effaoa,4) - 1E-05*Math.pow(effaoa,3) + 0.0009*Math.pow(effaoa,2) + 0.0033*effaoa + 0.0301;\n dragCam10Thk5 = -9E-09*Math.pow(effaoa,6) - 6E-08*Math.pow(effaoa,5) + 5E-06*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) - 0.0001*Math.pow(effaoa,2) - 0.0025*effaoa + 0.0615;\n dragCam15Thk5 = 8E-10*Math.pow(effaoa,6) - 5E-08*Math.pow(effaoa,5) - 1E-06*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) + 0.0008*Math.pow(effaoa,2) - 0.0027*effaoa + 0.0612;\n dragCam20Thk5 = 8E-9*Math.pow(effaoa,6) + 1E-8*Math.pow(effaoa,5) - 5E-6*Math.pow(effaoa,4) + 6E-6*Math.pow(effaoa,3) + 0.001*Math.pow(effaoa,2) - 0.001*effaoa + 0.1219;\n\n // thickness 10%\n dragCam0Thk10 = -1E-08*Math.pow(effaoa,6) + 6E-08*Math.pow(effaoa,5) + 6E-06*Math.pow(effaoa,4) - 2E-05*Math.pow(effaoa,3) - 0.0002*Math.pow(effaoa,2) + 0.0017*effaoa + 0.0196;\n dragCam5Thk10 = 3E-09*Math.pow(effaoa,6) + 6E-08*Math.pow(effaoa,5) - 2E-06*Math.pow(effaoa,4) - 3E-05*Math.pow(effaoa,3) + 0.0008*Math.pow(effaoa,2) + 0.0038*effaoa + 0.0159;\n dragCam10Thk10 = -5E-09*Math.pow(effaoa,6) - 3E-08*Math.pow(effaoa,5) + 2E-06*Math.pow(effaoa,4) + 1E-05*Math.pow(effaoa,3) + 0.0004*Math.pow(effaoa,2) - 3E-05*effaoa + 0.0624;\n dragCam15Thk10 = -2E-09*Math.pow(effaoa,6) - 2E-08*Math.pow(effaoa,5) - 5E-07*Math.pow(effaoa,4) + 8E-06*Math.pow(effaoa,3) + 0.0009*Math.pow(effaoa,2) + 0.0034*effaoa + 0.0993;\n dragCam20Thk10 = 2E-09*Math.pow(effaoa,6) - 3E-08*Math.pow(effaoa,5) - 2E-06*Math.pow(effaoa,4) + 2E-05*Math.pow(effaoa,3) + 0.0009*Math.pow(effaoa,2) + 0.0023*effaoa + 0.1581;\n\n // thickness 15%\n dragCam0Thk15 = -5E-09*Math.pow(effaoa,6) + 7E-08*Math.pow(effaoa,5) + 3E-06*Math.pow(effaoa,4) - 3E-05*Math.pow(effaoa,3) - 7E-05*Math.pow(effaoa,2) + 0.0017*effaoa + 0.0358;\n dragCam5Thk15 = -4E-09*Math.pow(effaoa,6) - 8E-09*Math.pow(effaoa,5) + 2E-06*Math.pow(effaoa,4) - 9E-07*Math.pow(effaoa,3) + 0.0002*Math.pow(effaoa,2) + 0.0031*effaoa + 0.0351;\n dragCam10Thk15 = 3E-09*Math.pow(effaoa,6) + 3E-08*Math.pow(effaoa,5) - 2E-06*Math.pow(effaoa,4) - 1E-05*Math.pow(effaoa,3) + 0.0009*Math.pow(effaoa,2) + 0.004*effaoa + 0.0543;\n dragCam15Thk15 = 3E-09*Math.pow(effaoa,6) + 5E-08*Math.pow(effaoa,5) - 2E-06*Math.pow(effaoa,4) - 3E-05*Math.pow(effaoa,3) + 0.0008*Math.pow(effaoa,2) + 0.0087*effaoa + 0.1167;\n dragCam20Thk15 = 3E-10*Math.pow(effaoa,6) - 3E-08*Math.pow(effaoa,5) - 6E-07*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) + 0.0006*Math.pow(effaoa,2) + 0.0008*effaoa + 0.1859;\n\n // thickness 20%\n dragCam0Thk20 = -3E-09*Math.pow(effaoa,6) + 2E-08*Math.pow(effaoa,5) + 2E-06*Math.pow(effaoa,4) - 8E-06*Math.pow(effaoa,3) - 4E-05*Math.pow(effaoa,2) + 0.0003*effaoa + 0.0416;\n dragCam5Thk20 = -3E-09*Math.pow(effaoa,6) - 7E-08*Math.pow(effaoa,5) + 1E-06*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) + 0.0004*Math.pow(effaoa,2) + 5E-05*effaoa + 0.0483;\n dragCam10Thk20 = 1E-08*Math.pow(effaoa,6) + 4E-08*Math.pow(effaoa,5) - 6E-06*Math.pow(effaoa,4) - 2E-05*Math.pow(effaoa,3) + 0.0014*Math.pow(effaoa,2) + 0.007*effaoa + 0.0692;\n dragCam15Thk20 = 3E-09*Math.pow(effaoa,6) - 9E-08*Math.pow(effaoa,5) - 3E-06*Math.pow(effaoa,4) + 4E-05*Math.pow(effaoa,3) + 0.001*Math.pow(effaoa,2) + 0.0021*effaoa + 0.139;\n dragCam20Thk20 = 3E-09*Math.pow(effaoa,6) - 7E-08*Math.pow(effaoa,5) - 3E-06*Math.pow(effaoa,4) + 4E-05*Math.pow(effaoa,3) + 0.0012*Math.pow(effaoa,2) + 0.001*effaoa + 0.1856;\n\n if (-20.0 <= camber && camber < -15.0)\n {\n dragThk5 = (camber/5 + 4)*(dragCam15Thk5 - dragCam20Thk5) + dragCam20Thk5;\n dragThk10 = (camber/5 + 4)*(dragCam15Thk10 - dragCam20Thk10) + dragCam20Thk10;\n dragThk15 = (camber/5 + 4)*(dragCam15Thk15 - dragCam20Thk15) + dragCam20Thk15;\n dragThk20 = (camber/5 + 4)*(dragCam15Thk20 - dragCam20Thk20) + dragCam20Thk20;\n \n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n { // dragco = two_pt(5.0, 10.0, dragThk5, dragThk10)\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (-15.0 <= camber && camber < -10.0)\n {\n dragThk5 = (camber/5 + 3)*(dragCam10Thk5 - dragCam15Thk5) + dragCam15Thk5;\n dragThk10 = (camber/5 + 3)*(dragCam10Thk10 - dragCam15Thk10) + dragCam15Thk10;\n dragThk15 = (camber/5 + 3)*(dragCam10Thk15 - dragCam15Thk15) + dragCam15Thk15;\n dragThk20 = (camber/5 + 3)*(dragCam10Thk20 - dragCam15Thk20) + dragCam15Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (-10.0 <= camber && camber < -5.0)\n {\n dragThk5 = (camber/5 + 2)*(dragCam5Thk5 - dragCam10Thk5) + dragCam10Thk5;\n dragThk10 = (camber/5 + 2)*(dragCam5Thk10 - dragCam10Thk10) + dragCam10Thk10;\n dragThk15 = (camber/5 + 2)*(dragCam5Thk15 - dragCam10Thk15) + dragCam10Thk15;\n dragThk20 = (camber/5 + 2)*(dragCam5Thk20 - dragCam10Thk20) + dragCam10Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (-5.0 <= camber && camber < 0)\n {\n dragThk5 = (camber/5 + 1)*(dragCam0Thk5 - dragCam5Thk5) + dragCam5Thk5;\n dragThk10 = (camber/5 + 1)*(dragCam0Thk10 - dragCam5Thk10) + dragCam5Thk10;\n dragThk15 = (camber/5 + 1)*(dragCam0Thk15 - dragCam5Thk15) + dragCam5Thk15;\n dragThk20 = (camber/5 + 1)*(dragCam0Thk20 - dragCam5Thk20) + dragCam5Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (0 <= camber && camber < 5)\n {\n dragThk5 = (camber/5)*(dragCam5Thk5 - dragCam0Thk5) + dragCam0Thk5;\n dragThk10 = (camber/5)*(dragCam5Thk10 - dragCam0Thk10) + dragCam0Thk10;\n dragThk15 = (camber/5)*(dragCam5Thk15 - dragCam0Thk15) + dragCam0Thk15;\n dragThk20 = (camber/5)*(dragCam5Thk20 - dragCam0Thk20) + dragCam0Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (5 <= camber && camber < 10)\n {\n dragThk5 = (camber/5 - 1)*(dragCam10Thk5 - dragCam5Thk5) + dragCam5Thk5;\n dragThk10 = (camber/5 - 1)*(dragCam10Thk10 - dragCam5Thk10) + dragCam5Thk10;\n dragThk15 = (camber/5 - 1)*(dragCam10Thk15 - dragCam5Thk15) + dragCam5Thk15;\n dragThk20 = (camber/5 - 1)*(dragCam10Thk20 - dragCam5Thk20) + dragCam5Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (10 <= camber && camber < 15)\n {\n dragThk5 = (camber/5 - 2)*(dragCam15Thk5 - dragCam10Thk5) + dragCam10Thk5;\n dragThk10 = (camber/5 - 2)*(dragCam15Thk10 - dragCam10Thk10) + dragCam10Thk10;\n dragThk15 = (camber/5 - 2)*(dragCam15Thk15 - dragCam10Thk15) + dragCam10Thk15;\n dragThk20 = (camber/5 - 2)*(dragCam15Thk20 - dragCam10Thk20) + dragCam10Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n else if (15 <= camber && camber <= 20)\n {\n dragThk5 = (camber/5 - 3)*(dragCam20Thk5 - dragCam15Thk5) + dragCam15Thk5;\n dragThk10 = (camber/5 - 3)*(dragCam20Thk10 - dragCam15Thk10) + dragCam15Thk10;\n dragThk15 = (camber/5 - 3)*(dragCam20Thk15 - dragCam15Thk15) + dragCam15Thk15;\n dragThk20 = (camber/5 - 3)*(dragCam20Thk20 - dragCam15Thk20) + dragCam15Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 15.0)\n {\n dragco = (thickness/5 - 2)*(dragThk15 - dragThk10) + dragThk10;\n }\n else if (15.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/5 - 3)*(dragThk20 - dragThk15) + dragThk15;\n }\n }\n } else if (current_part.foil == FOIL_ELLIPTICAL) //elliptical drag logic\n {\n dragCam0Thk5 = -6E-07*Math.pow(effaoa,3) + 0.0007*Math.pow(effaoa,2) + 0.0007*effaoa + 0.0428;\n dragCam10Thk5 = 5E-09*Math.pow(effaoa,6) - 7E-08*Math.pow(effaoa,5) - 3E-06*Math.pow(effaoa,4) + 5E-05*Math.pow(effaoa,3) + 0.0009*Math.pow(effaoa,2) - 0.0058*effaoa + 0.0758;\n dragCam20Thk5 = 1E-08*Math.pow(effaoa,6) - 2E-08*Math.pow(effaoa,5) - 7E-06*Math.pow(effaoa,4) + 1E-05*Math.pow(effaoa,3) + 0.0015*Math.pow(effaoa,2) + 0.0007*effaoa + 0.1594;\n \n dragCam0Thk10 = 3E-09*Math.pow(effaoa,6) + 4E-08*Math.pow(effaoa,5) - 3E-06*Math.pow(effaoa,4) - 9E-06*Math.pow(effaoa,3) + 0.0013*Math.pow(effaoa,2) + 0.0007*effaoa + 0.0112;\n dragCam10Thk10 = -4E-09*Math.pow(effaoa,6) - 9E-08*Math.pow(effaoa,5) + 2E-06*Math.pow(effaoa,4) + 7E-05*Math.pow(effaoa,3) + 0.0008*Math.pow(effaoa,2) - 0.0095*effaoa + 0.0657;\n dragCam20Thk10 = -8E-09*Math.pow(effaoa,6) - 9E-08*Math.pow(effaoa,5) + 3E-06*Math.pow(effaoa,4) + 6E-05*Math.pow(effaoa,3) + 0.0005*Math.pow(effaoa,2) - 0.0088*effaoa + 0.2088;\n\n dragCam0Thk20 = -7E-09*Math.pow(effaoa,6) - 1E-07*Math.pow(effaoa,5) + 4E-06*Math.pow(effaoa,4) + 6E-05*Math.pow(effaoa,3) + 0.0001*Math.pow(effaoa,2) - 0.0087*effaoa + 0.0596;\n dragCam10Thk20 = -2E-09*Math.pow(effaoa,6) + 2E-07*Math.pow(effaoa,5) + 1E-06*Math.pow(effaoa,4) - 6E-05*Math.pow(effaoa,3) + 0.0004*Math.pow(effaoa,2) - 7E-05*effaoa + 0.1114;\n dragCam20Thk20 = 4E-09*Math.pow(effaoa,6) - 7E-08*Math.pow(effaoa,5) - 3E-06*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) + 0.001*Math.pow(effaoa,2) - 0.0018*effaoa + 0.1925;\n\n if (-20.0 <= camber && camber < -10.0)\n {\n dragThk5 = (camber/10 + 2)*(dragCam10Thk5 - dragCam20Thk5) + dragCam20Thk5;\n dragThk10 = (camber/10 + 2)*(dragCam10Thk10 - dragCam20Thk10) + dragCam20Thk10;\n dragThk20 = (camber/10 + 2)*(dragCam10Thk20 - dragCam20Thk20) + dragCam20Thk20;\n \n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/10 - 1)*(dragThk20 - dragThk10) + dragThk10;\n }\n }\n else if (-10.0 <= camber && camber < 0)\n {\n dragThk5 = (camber/10 + 1)*(dragCam0Thk5 - dragCam10Thk5) + dragCam10Thk5;\n dragThk10 = (camber/10 + 1)*(dragCam0Thk10 - dragCam10Thk10) + dragCam10Thk10;\n dragThk20 = (camber/10 + 1)*(dragCam0Thk20 - dragCam10Thk20) + dragCam10Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/10 - 1)*(dragThk20 - dragThk10) + dragThk10;\n }\n }\n else if (0 <= camber && camber < 10)\n {\n dragThk5 = (camber/10)*(dragCam10Thk5 - dragCam0Thk5) + dragCam0Thk5;\n dragThk10 = (camber/10)*(dragCam10Thk10 - dragCam0Thk10) + dragCam0Thk10;\n dragThk20 = (camber/10)*(dragCam10Thk20 - dragCam0Thk20) + dragCam0Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/10 - 1)*(dragThk20 - dragThk10) + dragThk10;\n }\n }\n else if (10 <= camber && camber < 20)\n {\n dragThk5 = (camber/10 - 1)*(dragCam20Thk5 - dragCam10Thk5) + dragCam10Thk5;\n dragThk10 = (camber/10 - 1)*(dragCam20Thk10 - dragCam10Thk10) + dragCam10Thk10;\n dragThk20 = (camber/10 - 1)*(dragCam20Thk20 - dragCam10Thk20) + dragCam10Thk20;\n\n if (1.0 <= thickness && thickness <= 5.0)\n {\n dragco = dragThk5;\n }\n else if (5.0 < thickness && thickness <= 10.0)\n {\n dragco = (thickness/5 - 1)*(dragThk10 - dragThk5) + dragThk5;\n }\n else if (10.0 < thickness && thickness <= 20.0)\n {\n dragco = (thickness/10 - 1)*(dragThk20 - dragThk10) + dragThk10;\n }\n }\n\n } // end of FOIL_ELLIPTICAL\n else if (current_part.foil == FOIL_FLAT_PLATE) //flat plate drag logic\n {\n dragCam0 = -9E-07*Math.pow(effaoa,3) + 0.0007*Math.pow(effaoa,2) + 0.0008*effaoa + 0.015;\n dragCam5 = 1E-08*Math.pow(effaoa,6) + 4E-08*Math.pow(effaoa,5) - 9E-06*Math.pow(effaoa,4) - 1E-05*Math.pow(effaoa,3) + 0.0021*Math.pow(effaoa,2) + 0.0033*effaoa + 0.006;\n dragCam10 = -9E-09*Math.pow(effaoa,6) - 6E-08*Math.pow(effaoa,5) + 5E-06*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) - 0.0001*Math.pow(effaoa,2) - 0.0025*effaoa + 0.0615;\n dragCam15 = 8E-10*Math.pow(effaoa,6) - 5E-08*Math.pow(effaoa,5) - 1E-06*Math.pow(effaoa,4) + 3E-05*Math.pow(effaoa,3) + 0.0008*Math.pow(effaoa,2) - 0.0027*effaoa + 0.0612;\n dragCam20 = 8E-9*Math.pow(effaoa,6) + 1E-8*Math.pow(effaoa,5) - 5E-6*Math.pow(effaoa,4) + 6E-6*Math.pow(effaoa,3) + 0.001*Math.pow(effaoa,2) - 0.001*effaoa + 0.1219;\n\n if (-20.0 <= camber && camber < -15.0)\n {\n dragco = (camber/5 + 4)*(dragCam15 - dragCam20) + dragCam20;\n }\n else if (-15.0 <= camber && camber < -10.0)\n {\n dragco = (camber/5 + 3)*(dragCam10 - dragCam15) + dragCam15;\n }\n else if (-10.0 <= camber && camber < -5.0)\n {\n dragco = (camber/5 + 2)*(dragCam5 - dragCam10) + dragCam10;\n }\n else if (-5.0 <= camber && camber < 0)\n {\n dragco = (camber/5 + 1)*(dragCam0 - dragCam5) + dragCam5;\n }\n else if (0 <= camber && camber < 5)\n {\n dragco = (camber/5)*(dragCam5 - dragCam0) + dragCam0;\n }\n else if (5 <= camber && camber < 10)\n {\n dragco = (camber/5 - 1)*(dragCam10 - dragCam5) + dragCam5;\n }\n else if (10 <= camber && camber < 15)\n {\n dragco = (camber/5 - 2)*(dragCam15 - dragCam10) + dragCam10;\n }\n else if (15 <= camber && camber <= 20)\n {\n dragco = (camber/5 - 3)*(dragCam20 - dragCam15) + dragCam15;\n }\n\n } // end of FOIL_FLAT_PLATE\n return dragco;\n }", "private double estimateExecutionTimeSDLT(long sofar) {\n \tdouble estimate = 0;\r\n \tdouble theta = (double)sofar/1000000000L;\r\n \t/*bebe's formula*/\r\n \tSystem.out.println(\"Predict SD-LT: Elapsed time: \" + theta);\r\n \t/*should use a different formula for theta<meanX*/\r\n \tdouble xmax = 2700; //should be updated by observations during high-throughput\r\n \t\t\t\t\t\t//or read from user in conpaas\r\n \t\r\n \tdouble A = meanX/2/xmax; \r\n \t\r\n \tdouble t0 = 0.366;\r\n \tdouble sigma = 2*t0*t0*xmax;\r\n \testimate = (Math.sqrt(2*xmax*sigma)*Math.exp(-sigma/(2*xmax))-Math.sqrt(2*theta*sigma)*Math.exp(-sigma/(2*theta)))/\r\n \t\t\t\t(Math.sqrt(Math.PI)*(erfc(Math.sqrt(sigma/(2*xmax)))-erfc(Math.sqrt(sigma/(2*theta))))) \r\n \t\t\t\t- sigma;\r\n \t\r\n \treturn estimate;\r\n }", "public void computeLine ()\r\n {\r\n line = new BasicLine();\r\n\r\n for (GlyphSection section : glyph.getMembers()) {\r\n StickSection ss = (StickSection) section;\r\n line.includeLine(ss.getLine());\r\n }\r\n\r\n if (logger.isFineEnabled()) {\r\n logger.fine(\r\n line + \" pointNb=\" + line.getNumberOfPoints() +\r\n \" meanDistance=\" + (float) line.getMeanDistance());\r\n }\r\n }", "private double calculateAverage(Candle[] cd) {\n double sum = 0; \r\n for(Candle c : cd) {\r\n sum += c.getClose();\r\n }\r\n return sum/cd.length;\r\n \r\n }", "private double[][] calculateExafsEnergiesConstantKStep() {\n\t\tdouble lowK = evToK(cEnergy);\n\t\tdouble highK = evToK(finalEnergy);\n\t\tdouble[][] kArray = createStepArray(lowK, highK, exafsStep, exafsTime, true, numberDetectors);\n\t\t// convert from k to energy in each element\n\t\tfor (int i = 0; i < kArray.length; i++)\n\t\t\tkArray[i][0] = kToEv(kArray[i][0]);\n\t\treturn kArray;\n\t}", "public abstract double getCarbon();", "private double calculateT(Position lineStart, Position lineEnd, double lookaheadDistance) {\n Position d = Functions.Positions.subtract(lineEnd, lineStart);\n Position f = Functions.Positions.subtract(lineStart, currentCoord);\n double r = lookaheadDistance;\n\n double a = Functions.Positions.dot(d, d);\n double b = 2 * Functions.Positions.dot(f, d);\n double c = Functions.Positions.dot(f, f) - r * r;\n\n double discriminant = b * b - 4 * a * c;\n if (discriminant < 0) {\n // no intersection\n } else {\n // ray didn't totally miss sphere, so there is a solution to the equation.\n discriminant = Math.sqrt(discriminant);\n\n // either solution may be on or off the ray so need to test both\n // t1 is always the smaller value, because BOTH discriminant and a are nonnegative.\n double t1 = (-b - discriminant) / (2 * a);\n double t2 = (-b + discriminant) / (2 * a);\n\n // 3x HIT cases:\n // -o-> --|--> | | --|->\n // Impale(t1 hit,t2 hit), Poke(t1 hit,t2>1), ExitWound(t1<0, t2 hit),\n\n // 3x MISS cases:\n // -> o o -> | -> |\n // FallShort (t1>1,t2>1), Past (t1<0,t2<0), CompletelyInside(t1<0, t2>1)\n\n if (t1 >= 0 && t1 <= 1) {\n // t1 is the intersection, and it's closer than t2 (since t1 uses -b - discriminant)\n // Impale, Poke\n return t1;\n }\n\n if (t2 >= 0 && t2 <= 1) {\n return t2;\n }\n }\n return Double.NaN;\n }", "public PulseTransitTime() {\n currPTT = 0.0;\n hmPeakTimes = new ArrayList<>();\n //maf = new MovingAverage(WINDOW_SIZE);\n }", "public Line(float dT, float beginningAmplitude, float endAmplitude)\n\t{\n\t\tsuper();\n\t\tlineTime = dT;\n\t\tbegAmp = beginningAmplitude;\n\t\tamp = begAmp;\n\t\tendAmp = endAmplitude;\n\t\tlineNow = 0f;\n\t\tisActivated = false;\n\t\tMinim.debug(\" dampTime = \" + lineTime + \" begAmp = \" + begAmp + \" now = \" + lineNow);\n\t}", "double getAvgControl();", "public void decay() {\r\n\t\tfor(int i=0;i<boxes[0];i++)\r\n\t\t\tfor(int j=0;j<boxes[1];j++)\r\n\t\t\t\tfor(int k=0;k<boxes[2];k++) quantity[i][j][k] *= (1 - decayRate*sim.getDt());\r\n\t}", "public abstract double calcSA();", "public double updatePeriodic()\n {\n double Angle = getRawAngle();\n\n if (FirstCall)\n {\n AngleAverage = Angle;\n }\n\n AngleAverage -= AngleAverage / NumAvgSamples;\n AngleAverage += Angle / NumAvgSamples;\n\n return (AngleAverage);\n }", "private static double calculateMovingAverage(JsArrayNumber history) {\n double[] vals = new double[history.length()];\n long size = history.length();\n double sum = 0.0;\n double mSum = 0.0;\n long mCount = 0;\n\n // Check for sufficient data\n if (size >= 8) {\n // Clone the array and Calculate sum of the values\n for (int i = 0; i < size; i++) {\n vals[i] = history.get(i);\n sum += vals[i];\n }\n double mean = sum / size;\n\n // Calculate variance for the set\n double varianceTemp = 0.0;\n for (int i = 0; i < size; i++) {\n varianceTemp += Math.pow(vals[i] - mean, 2);\n }\n double variance = varianceTemp / size;\n double standardDev = Math.sqrt(variance);\n\n // Standardize the Data\n for (int i = 0; i < size; i++) {\n vals[i] = (vals[i] - mean) / standardDev;\n }\n\n // Calculate the average excluding outliers\n double deviationRange = 2.0;\n\n for (int i = 0; i < size; i++) {\n if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {\n mCount++;\n mSum += history.get(i);\n }\n }\n\n } else {\n // Calculate the average (not enough data points to remove outliers)\n mCount = size;\n for (int i = 0; i < size; i++) {\n mSum += history.get(i);\n }\n }\n\n return mSum / mCount;\n }", "public TrendVolatilityLineIndicator(Indicator<? extends MultipleMovingAverage> mmaIndicator, int index, TADecimal entry) {\n if (mmaIndicator == null) {\n throw new IllegalArgumentException(\"Supplied input Indicator is invalid: NULL\");\n }\n if (entry == null) {\n throw new IllegalArgumentException(\"Supplied input TADecimal entry is invalid: NULL\");\n }\n this.sustainability = Sustainability.UNKNOWN;\n this.mmaIndicator = mmaIndicator;\n this.entry = entry;\n this.tvls = new ArrayList<>();\n tvls.add(entry);\n }", "public void generateTone()\n throws LineUnavailableException {\n if ( clip!=null ) {\n clip.stop();\n clip.close();\n } else {\n clip = AudioSystem.getClip();\n }\n boolean addHarmonic = harmonic.isSelected();\n\n int intSR = ((Integer)sampleRate.getSelectedItem()).intValue();\n int intFPW = framesPerWavelength.getValue();\n\n float sampleRate = (float)intSR;\n\n // oddly, the sound does not loop well for less than\n // around 5 or so, wavelengths\n int wavelengths = 20;\n byte[] buf = new byte[2*intFPW*wavelengths];\n AudioFormat af = new AudioFormat(\n sampleRate,\n 8, // sample size in bits\n 2, // channels\n true, // signed\n false // bigendian\n );\n\n int maxVol = 127;\n for(int i=0; i<intFPW*wavelengths; i++){\n double angle = ((float)(i*2)/((float)intFPW))*(Math.PI);\n buf[i*2]=getByteValue(angle);\n if(addHarmonic) {\n buf[(i*2)+1]=getByteValue(2*angle);\n } else {\n buf[(i*2)+1] = buf[i*2];\n }\n }\n\n try {\n byte[] b = buf;\n AudioInputStream ais = new AudioInputStream(\n new ByteArrayInputStream(b),\n af,\n buf.length/2 );\n\n clip.open( ais );\n } catch(Exception e) {\n e.printStackTrace();\n }\n }", "void calcWave() {\n yoff += 0.01f;\n \n //For every x value, calculate a y value based on sine or cosine\n float x = yoff; //**OPTION #1****/\n //float x = 0.0f; //**OPTION #2****/\n for (int i = 0; i < yvalues.length; i++) {\n float n = 2*noise(x)-1.0f; //**OPTION #1****/ //scale noise to be between 1 and -1\n //float n = 2*noise(x,yoff)-1.0f; //**OPTION #2****/ //scale noise to be between 1 and -1\n yvalues[i] = n*amplitude;\n x+=dx;\n }\n }", "public double movingAverage(int periods, int t)\n {\n if(periods>t + 1 || periods<1)\n throw new IndexOutOfBoundsException(\"MA(\" + periods + \") is undefined at time \" + t);\n double sum = 0.0;\n for(int i = t - periods + 1; i<=t; i++)\n sum += x[i];\n return sum/periods;\n }", "double getSignalPeriod();", "public static double trace(Matrix amat){\r\n \tdouble trac = 0.0D;\r\n \tfor(int i=0; i<Math.min(amat.ncol,amat.ncol); i++){\r\n \ttrac += amat.matrix[i][i];\r\n \t}\r\n \treturn trac;\r\n \t}", "static double calculateAngle(Line2D line, ArrowEnd end) {\n \t\t// Translate the line to 0,0\n \t\tdouble x1 = line.getX1();\n \t\tdouble y1 = line.getY1();\n \t\tdouble x2 = line.getX2();\n \t\tdouble y2 = line.getY2();\n \t\tdouble opposite = y2-y1;\n \t\tdouble adjacent = x2-x1;\n \n \t\tdouble radians = Math.atan(opposite/adjacent);\n \n \t\tif (adjacent < 0) radians += Math.PI;\n \n \t\t// TODO: Flip for other end\n \t\treturn radians;\n \t}", "public double getAverageAcceleration() {\n return (leftEnc.getAcceleration() + rightEnc.getAcceleration()) / 2;\n }", "public double averageSteps() {\n if (day==0) return 0;\n return (double) totalSteps / day;}", "public void fluctuateLine(Random randomGenerator) {\n if (this.online == true) {\n if (randomGenerator.nextInt(100) > this.stability) {\n inputFluctuator.fluctuateFrequency();\n }\n if (randomGenerator.nextInt(100) > this.stability) {\n inputFluctuator.fluctuateAmplitude();\n }\n if (randomGenerator.nextInt(100) > this.stability) {\n inputFluctuator.fluctuatePhase();\n }\n updateOscilloscopeData();\n } \n }", "private double[] calculateLineEquation(Point p1, Point p2) {\n double m = ((double) p2.y - p1.y) / (p2.x - p1.x);\n double c = p1.y - (m * p1.x);\n return new double[]{m, c};\n }", "public void cal_FineFuelMoisture(){\r\n\tdouble DIF=dry-wet;\r\n\tfor (int i=1;i<=3; i++){\r\n\tif ((DIF-C[i])<=0){ \r\n\t\t\r\n\t\tFFM=B[i]*Math.exp(A[i]*DIF);\r\n\t}\r\n\t}\r\n}", "protected void framing(double inputSignal[]){\n double numFrames = (double)inputSignal.length / (double)(frameLength - shiftInterval);\n \n // unconditionally round up\n if ((numFrames / (int)numFrames) != 1){\n numFrames = (int)numFrames + 1;\n }\n \n // use zero padding to fill up frames with not enough samples\n double paddedSignal[] = new double[(int)numFrames * frameLength];\n for (int n = 0; n < inputSignal.length; n++){\n paddedSignal[n] = inputSignal[n];\n }\n\n frames = new double[(int)numFrames][frameLength];\n\n // break down speech signal into frames with specified shift interval to create overlap\n for (int m = 0; m < numFrames; m++){\n for (int n = 0; n < frameLength; n++){\n frames[m][n] = paddedSignal[m * (frameLength - shiftInterval) + n];\n }\n }\n }", "void oscEvent(OscMessage msg) throws IOException{\n\r\n\t\tObject[] arguments = msg.arguments();\t\t\r\n\t\t\r\n\t\tTimestamp timeStamp = new Timestamp(System.currentTimeMillis());\r\n\t\t\r\n\t\t//Muse EEG headband sends a lot of signals but we are only interested in Alpha, Beta, Gamma, Delta and Theta\r\n\t\t//For more information, visit: http://developer.choosemuse.com/tools/available-data\r\n\r\n\t\t\r\n\t\t//Checking if the signal is Alpha\r\n\t\t\r\n\t\tif(msg.checkAddrPattern(\"/muse/elements/alpha_absolute\")==true) {\r\n\t\t\r\n\t\t\tSystem.out.print(\"\\n\"+timeStamp+\",\");\r\n\t\t\t\r\n\t\t\targuments = msg.arguments();\r\n\t\t\tSystem.out.println(\"float\"+msg.get(0).floatValue()+\", int:\"+msg.get(0).intValue()+\",string:\"+msg.get(0).toString()+\",long:\"+msg.get(0).longValue()+\",double\"+msg.get(0).doubleValue());\r\n\t\t\t\r\n\t\t\t//printing it out into the .csv file in a way that the average is calculated and written\r\n\t\t\r\n\t\t\tSystem.out.print(\"=(\"+arguments[0]+\"+ \");\r\n\t\t\tSystem.out.print(arguments[1]+\"+\");\r\n\t\t\tSystem.out.print(arguments[2]+\"+\");\r\n\t\t\tSystem.out.print(arguments[3]+\")/4,\");\r\n\t\t}\t\r\n\t\r\n\t\t\r\n\t\t//Check for Beta signal\r\n\t\tif(msg.checkAddrPattern(\"/muse/elements/beta_absolute\")==true) {\r\n\t\t\t\r\n\t\t\targuments = msg.arguments();\r\n\t\t\t\r\n\t\t\tSystem.out.print(\"=(\"+arguments[0]+\"+ \");\r\n\t\t\tSystem.out.print(arguments[1]+\"+\");\r\n\t\t\tSystem.out.print(arguments[2]+\"+\");\r\n\t\t\tSystem.out.print(arguments[3]+\")/4,\");\r\n\t\t}\r\n\r\n\t\t//check for Delta signal\t\r\n\t\tif(msg.checkAddrPattern(\"/muse/elements/delta_absolute\")==true) {\r\n\t\t\t\r\n\t\t\targuments = msg.arguments();\r\n\t\t\r\n\t\t\tSystem.out.print(\"=(\"+arguments[0]+\"+ \");\r\n\t\t\tSystem.out.print(arguments[1]+\"+\");\r\n\t\t\tSystem.out.print(arguments[2]+\"+\");\r\n\t\t\tSystem.out.print(arguments[3]+\")/4,\");\r\n\t\t}\r\n\t\r\n\t\t//check for Gamma signal\t\r\n\t\tif(msg.checkAddrPattern(\"/muse/elements/gamma_absolute\")==true) {\r\n\t\t\t\r\n\t\t\targuments = msg.arguments();\r\n\t\t\t\r\n\t\t\tSystem.out.print(\"=(\"+arguments[0]+\"+ \");\r\n\t\t\tSystem.out.print(arguments[1]+\"+\");\r\n\t\t\tSystem.out.print(arguments[2]+\"+\");\r\n\t\t\tSystem.out.print(arguments[3]+\")/4,\");\r\n\t\t}\r\n\r\n\t\t//Check for Theta signal\r\n\t\tif(msg.checkAddrPattern(\"/muse/elements/theta_absolute\")==true) {\r\n\t\t\t\r\n\t\t\targuments = msg.arguments();\r\n\t\t\t\r\n\t\t\tSystem.out.print(\"=(\"+arguments[0]+\"+ \");\r\n\t\t\tSystem.out.print(arguments[1]+\"+\");\r\n\t\t\tSystem.out.print(arguments[2]+\"+\");\r\n\t\t\tSystem.out.print(arguments[3]+\")/4,\");\r\n\t\t}\t\r\n\t\t\r\n\t}", "public void detect_lines(float[] image,long width, long height, Lines contours, MutableLong num_result, double sigma, double low, double high, long mode, boolean compute_width, boolean correct_pos,boolean extend_lines, Junctions junctions)\r\n\t{\r\n\t byte[] ismax;\r\n\t float[] ev, n1, n2, p1, p2;\r\n\t float[][] k = new float[5][(int) (width*height)];\r\n\t \r\n\t// for (i=0;i<5;i++)\r\n\t// k[i] = xcalloc(width*height,sizeof(float));\r\n\t Convol convol = new Convol();\r\n\t convol.convolve_gauss(image,k[0],width,height,sigma,LinesUtil.DERIV_R);\r\n\t convol.convolve_gauss(image,k[1],width,height,sigma,LinesUtil.DERIV_C);\r\n\t convol.convolve_gauss(image,k[2],width,height,sigma,LinesUtil.DERIV_RR);\r\n\t convol.convolve_gauss(image,k[3],width,height,sigma,LinesUtil.DERIV_RC);\r\n\t \r\n\t convol.convolve_gauss(image,k[4],width,height,sigma,LinesUtil.DERIV_CC);\r\n\t\r\n\t ismax = new byte[(int) (width*height)];\r\n\t ev = new float[(int) (width*height)];\r\n\t n1 = new float[(int) (width*height)];\r\n\t n2 = new float[(int) (width*height)];\r\n\t p1 = new float[(int) (width*height)];\r\n\t p2 = new float[(int) (width*height)];\r\n\t /*\r\n\t * The C library function void *memset(void *str, int c, size_t n) \r\n\t * copies the character c (an unsigned char) to the first n characters \r\n\t * of the string pointed to by the argument str.\r\n\t */\r\n\t // memset(ismax,0,width*height*sizeof(*ismax));\r\n\t // memset(ev,0,width*height*sizeof(*ev));\r\n\t for(int j = 0; j < ismax.length; j++){\r\n\t\t ev[j] = 0;\r\n\t\t ismax[j] = 0;\r\n\t }\r\n\r\n\t compute_line_points(k,ismax,ev,n1,n2,p1,p2,width,height,low,high,mode);\r\n\t \r\n\t Link l = new Link();\r\n\t l.compute_contours(ismax,ev,n1,n2,p1,p2,k[0],k[1],contours,num_result,sigma,\r\n\t extend_lines,(int)mode,low,high,width,height,junctions);\r\n\t Width w = new Width();\r\n\t if (compute_width)\r\n\t w.compute_line_width(k[0],k[1],width,height,sigma,mode,correct_pos,contours,\r\n\t num_result);\r\n\r\n\t}", "public void resetLine() {\n reactorLine.setCurrentFrequency(reactorLine.getBaseFrequency());\n reactorLine.setCurrentAmplitude(reactorLine.getBaseAmplitude());\n reactorLine.setCurrentPhase(reactorLine.getBasePhase());\n inputAdjuster.setCurrentFrequency(inputAdjuster.getBaseFrequency());\n inputAdjuster.setCurrentAmplitude(inputAdjuster.getBaseAmplitude());\n inputAdjuster.setCurrentPhase(inputAdjuster.getBasePhase());\n this.updateOscilloscopeData();\n }", "public float getDCA();", "public double calculateObservedDisagreement();", "public double getTraceLineShapeArcLength()\n {\n if (_dataLineArcLength > 0) return _dataLineArcLength;\n Shape dataLineShape = ScatterTraceViewShapes.getLineShape(this, true);\n double arcLength = dataLineShape.getArcLength();\n return _dataLineArcLength = arcLength;\n }", "public void recalculateDistanceFunction()\r\n {\n findBoundaryGivenPhi();\r\n \r\n active.removeAllElements();\r\n\tfor(int i=0; i<pixelsWide; i++)\r\n\t\tfor(int j=0; j<pixelsHigh; j++)\r\n\t\t\t{\r\n if(!boundary.contains(new Int2d(i,j))) phi[i][j] = phiStart;\r\n //else System.out.println(\"Boundary point at i,j = \" + i + \", \" + j + \" with phi = \" + phi[i][j]);\r\n\t\t\t}\r\n \r\n //System.out.println(\"Building Initial Band\");\r\n\tbuildInitialBand(); \r\n \r\n //System.out.println(active.size());\r\n \r\n //System.out.println(\"Running Algorithm\");\r\n\twhile(active.size()>0)\r\n\t\t{\r\n\t\trunAlgorithmStep();\r\n\t\t}\r\n\t\r\n //System.out.println(\"Distance function calculated\");\r\n\t//maxPhi = findMaxPhi();\r\n }", "public void decay() {\r\n\t\tprotons -= 2;\r\n\t\tneutrons -= 2;\r\n\t}", "private void jBtnFuzzyActionPerformed(java.awt.event.ActionEvent evt) {\n int rv = 0;\n String relax = jRelaxTxt.getText();\n rv = Integer.valueOf(relax);\n String ideal = jIdealTxt.getText();\n int normal = 0;\n //System.out.println(rv);\n \n //read data using readExcel class\n readExcel exData = new readExcel();\n double[][] chartData = exData.readDataset(myFile);\n \n //Line Chart with Series --used to show simulation data\n// DefaultCategoryDataset ds = new DefaultCategoryDataset();\n// final String series1 = \"max\";\n// final String series2 = \"foodCount\";\n// final String series3 = \"min\";\n// for(int i=0;i<chartData[0].length;i++){\n// ds.addValue(chartData[0][i], series1, String.valueOf(i));\n// ds.addValue(chartData[1][i], series2, String.valueOf(i));\n// ds.addValue((chartData[0][i]-rv), series3, String.valueOf(i));\n// }\n// JFreeChart simchart = ChartFactory.createLineChart(\"Simulation Result\", \"Day\", \"Value\", ds, PlotOrientation.VERTICAL, true, true, false);\n// simchart.setBackgroundPaint(Color.white);\n// final CategoryPlot plot = (CategoryPlot) simchart.getPlot();\n// plot.setBackgroundPaint(Color.lightGray);\n// plot.setRangeGridlinePaint(Color.white);\n// ChartFrame fr = new ChartFrame(\"Simulation Result\", simchart);\n// fr.setVisible(true);\n// fr.setSize(1000, 400);\n \n //fuzzy result\n DefaultCategoryDataset dataset = new DefaultCategoryDataset();\n double fx, Dx;\n \n String choice = jCBFuzzyType.getSelectedItem().toString();\n if(choice == \"One Side\"){\n for(int i=1;i<chartData[0].length;i++){\n Dx = chartData[0][i]-chartData[1][i];\n //Dx = chartData[1][i]-chartData[0][i];\n if(Dx>rv)\n fx=0;\n else\n fx=((rv+1)-Dx)/(rv+1);\n dataset.setValue(fx, \"\", String.valueOf(i));\n }\n }\n else{\n normal = Integer.valueOf(ideal);\n for(int i=1;i<chartData[0].length;i++){\n Dx = chartData[1][i]-normal;\n //Dx = chartData[1][i]-chartData[0][i];\n if(Dx>rv || Dx< -rv)\n fx=0;\n else\n fx=((rv+1)-abs(Dx))/(rv+1);\n System.out.println(\"Hasil simulasi:\"+chartData[1][i]+\" & Dx:\"+Dx+\" & fx:\"+fx);\n dataset.setValue(fx, \"\", String.valueOf(i));\n }\n }\n \n JFreeChart chart = ChartFactory.createLineChart(\"Fuzzy Requirement Satisfaction\", \"Day\", \"Fuzzy Satisfaction\", dataset, PlotOrientation.VERTICAL, false, true, false);\n CategoryPlot p = chart.getCategoryPlot();\n p.setRangeGridlinePaint(Color.DARK_GRAY);\n ChartFrame frame = new ChartFrame(\"Fuzzy Representation\",chart);\n frame.setVisible(true);\n frame.setSize(1000,400);\n\n }", "void plotLineDelta(int argbA, boolean tScreenedA, int argbB,\n boolean tScreenedB, int xA, int yA, int zA, int dxBA,\n int dyBA, int dzBA, boolean clipped) {\n x1t = xA;\n x2t = xA + dxBA;\n y1t = yA;\n y2t = yA + dyBA;\n z1t = zA;\n z2t = zA + dzBA;\n if (clipped)\n switch (getTrimmedLine()) {\n case VISIBILITY_OFFSCREEN:\n return;\n case VISIBILITY_UNCLIPPED:\n clipped = false;\n break;\n }\n plotLineClipped(argbA, tScreenedA, argbB, tScreenedB, xA, yA, zA, dxBA,\n dyBA, dzBA, clipped, 0, 0);\n }", "@Test\n public void getSecurityPriceTechnicalsMacdTest() throws ApiException, NoSuchMethodException {\n String identifier = null;\n Integer fastPeriod = null;\n Integer slowPeriod = null;\n Integer signalPeriod = null;\n String priceKey = null;\n String startDate = null;\n String endDate = null;\n Integer pageSize = null;\n String nextPage = null;\n ApiResponseSecurityMovingAverageConvergenceDivergence response = api.getSecurityPriceTechnicalsMacd(identifier, fastPeriod, slowPeriod, signalPeriod, priceKey, startDate, endDate, pageSize, nextPage);\n\n // TODO: test validations\n }", "public double lineSlope() {\r\n //The formula to calculate the gradient.\r\n double slope;\r\n double dy = this.start.getY() - this.end.getY();\r\n double dx = this.start.getX() - this.end.getX();\r\n // line is vertical\r\n if (dx == 0 && dy != 0) {\r\n slope = Double.POSITIVE_INFINITY;\r\n return slope;\r\n }\r\n // line is horizontal\r\n if (dy == 0 && dx != 0) {\r\n slope = 0;\r\n return slope;\r\n }\r\n slope = dy / dx;\r\n return slope;\r\n }", "private float[] dynamicAccDiff(float[] acc, float[] gyr,float[] gravity, float[] oldAcc, float[] oldGyr)\n {\n float[] dynAccDiff = new float[]{0.0f, 0.0f, 0.0f};\n float[] accDiff = accDiff(oldAcc, acc);\n float[] gyrDiff = gyrDiff(oldGyr, gyr);\n float[] graDiff = graDiff(gravity, gyrDiff);\n\n for (int i = 0; i < 3; i++)\n {\n dynAccDiff[i] = accDiff[i]-graDiff[i];\n }\n\n return dynAccDiff;\n\n }", "private void computeHazardCurve() {\n\n //flag to initialise if Deterministic Model Calc have been completed\n deterministicCalcDone=false;\n\n //checks how many SA Periods has been completed\n this.numSA_PeriodValDone =0;\n\n //flag to check whether Hazard Curve Calc are done\n hazCalcDone = false;\n\n //gets the Label for the Y-axis for the earlier grph\n String oldY_AxisLabel=\"\";\n if(totalProbFuncs.getYAxisName() !=null)\n oldY_AxisLabel = totalProbFuncs.getYAxisName();\n\n // get the selected IMR\n AttenuationRelationship imr = (AttenuationRelationship)imrGuiBean.getSelectedIMR_Instance();\n\n // make a site object to pass to IMR\n Site site = siteGuiBean.getSite();\n\n // intialize the hazard function\n ArbitrarilyDiscretizedFunc hazFunction = new ArbitrarilyDiscretizedFunc();\n ArbitrarilyDiscretizedFunc tempHazFunction = new ArbitrarilyDiscretizedFunc();\n\n //what selection does the user have made, IML@Prob or Prob@IML\n String imlOrProb=imlProbGuiBean.getSelectedOption();\n //gets the IML or Prob value filled in by the user\n double imlProbValue=imlProbGuiBean.getIML_Prob();\n boolean imlAtProb = false, probAtIML = false;\n if(imlOrProb.equalsIgnoreCase(imlProbGuiBean.IML_AT_PROB)){\n //if the old Y axis Label not equal to the IML then clear plot and draw the chart again\n if(!this.IML.equalsIgnoreCase(oldY_AxisLabel))\n this.clearPlot(true);\n totalProbFuncs.setYAxisName(this.IML);\n imlAtProb=true;\n }\n else{\n //if the old Y axis Label not equal to the Prob then clear plot and draw the chart again\n if(!this.PROB_AT_EXCEED.equalsIgnoreCase(oldY_AxisLabel))\n this.clearPlot(true);\n totalProbFuncs.setYAxisName(this.PROB_AT_EXCEED);\n probAtIML=true;\n }\n\n //If the user has chosen the Probabilistic\n if(((String)probDeterSelection.getSelectedItem()).equalsIgnoreCase(this.PROBABILISTIC)){\n this.isEqkList = false;\n // whwther to show progress bar in case of update forecast\n erfGuiBean.showProgressBar(this.progressCheckBox.isSelected());\n // get the selected forecast model\n EqkRupForecastBaseAPI eqkRupForecast = null;\n try{\n //gets the instance of the selected ERF\n eqkRupForecast = erfGuiBean.getSelectedERF();\n }catch(Exception e){\n e.printStackTrace();\n }\n if(this.progressCheckBox.isSelected()) {\n progressClass = new CalcProgressBar(\"Hazard-Curve Calc Status\", \"Beginning Calculation \");\n progressClass.displayProgressBar();\n timer.start();\n }\n\n // check whether this forecast is a Forecast List\n // if this is forecast list , handle it differently\n boolean isEqkForecastList = false;\n if(eqkRupForecast instanceof ERF_EpistemicList) {\n handleForecastList(site, imr, eqkRupForecast,imlProbValue,imlAtProb,probAtIML);\n this.hazCalcDone = true;\n return;\n }\n\n // this is not a eqk list\n this.isEqkList = false;\n\n try{\n // set the value for the distance from the distance control panel\n if(distanceControlPanel!=null) calc.setMaxSourceDistance(distanceControlPanel.getDistance());\n }catch(RemoteException e){\n e.printStackTrace();\n }\n // initialize the values in condProbfunc with log values as passed in hazFunction\n initX_Values(tempHazFunction,imlProbValue,imlAtProb,probAtIML);\n\n try {\n //iterating over all the SA Periods for the IMR's\n for(int i=0;i< numSA_PeriodVals;++i){\n double saPeriodVal = ((Double)this.saPeriodVector.get(i)).doubleValue();\n imr.getParameter(this.SA_PERIOD).setValue(this.saPeriodVector.get(i));\n try{\n // calculate the hazard curve for each SA Period\n calc.getHazardCurve(tempHazFunction, site, imr, (EqkRupForecast)eqkRupForecast);\n }catch(RemoteException e){\n e.printStackTrace();\n }\n //number of SA Periods for which we have ran the Hazard Curve\n this.numSA_PeriodValDone =i;\n hazFunction.setInfo(\"\\n\"+getCurveParametersInfo()+\"\\n\");\n double val = getHazFuncIML_ProbValues(tempHazFunction,imlProbValue,imlAtProb,probAtIML);\n hazFunction.set(saPeriodVal,val);\n }\n }catch (RuntimeException e) {\n JOptionPane.showMessageDialog(this, e.getMessage(),\n \"Parameters Invalid\", JOptionPane.INFORMATION_MESSAGE);\n return;\n }\n }\n else{ //If the Deterministic has been chosen by the user\n imr.setSite(site);\n try{\n imr.setEqkRupture(this.erfRupSelectorGuiBean.getRupture());\n }catch (Exception ex) {\n timer.stop();\n JOptionPane.showMessageDialog(this, \"Rupture not allowed for the chosen IMR: \"+ex.getMessage());\n this.repaint();\n this.validate();\n return;\n }\n\n if(this.progressCheckBox.isSelected()) {\n progressClass = new CalcProgressBar(\"Hazard-Curve Calc Status\", \"Beginning Calculation \");\n progressClass.displayProgressBar();\n timer.start();\n }\n\n //if the user has selectde the Prob@IML\n if(probAtIML)\n //iterating over all the SA Periods for the IMR's\n for(int i=0;i< this.numSA_PeriodVals;++i){\n double saPeriodVal = ((Double)this.saPeriodVector.get(i)).doubleValue();\n imr.getParameter(this.SA_PERIOD).setValue(this.saPeriodVector.get(i));\n double imlLogVal = Math.log(imlProbValue);\n //double val = 0.4343*Math.log(imr.getExceedProbability(imlLogVal));\n double val = imr.getExceedProbability(imlLogVal);\n //adding values to the hazard function\n hazFunction.set(saPeriodVal,val);\n //number of SA Periods for which we have ran the Hazard Curve\n this.numSA_PeriodValDone =i;\n }\n else //if the user has selected IML@prob\n //iterating over all the SA Periods for the IMR\n for(int i=0;i<this.numSA_PeriodVals;++i){\n double saPeriodVal = ((Double)(saPeriodVector.get(i))).doubleValue();\n imr.getParameter(this.SA_PERIOD).setValue(this.saPeriodVector.get(i));\n imr.getParameter(imr.EXCEED_PROB_NAME).setValue(new Double(imlProbValue));\n //double val = 0.4343*imr.getIML_AtExceedProb();\n //adding values to the Hazard Function\n double val = Math.exp(imr.getIML_AtExceedProb());\n hazFunction.set(saPeriodVal,val);\n //number of SA Periods for which we have ran the Hazard Curve\n this.numSA_PeriodValDone =i;\n }\n this.deterministicCalcDone = true;\n }\n\n // add the function to the function list\n totalProbFuncs.add(hazFunction);\n //checks whether the Hazard Curve Calculation are complete\n hazCalcDone = true;\n // set the X-axis label\n totalProbFuncs.setXAxisName(X_AXIS_LABEL);\n\n }", "private void drawTimeLineForLine(Graphics2D g2d, RenderContext myrc, Line2D line, \n Composite full, Composite trans,\n int tl_x0, int tl_x1, int tl_w, int tl_y0, int tl_h, \n long ts0, long ts1) {\n g2d.setComposite(full); \n\t// Parametric formula for line\n double dx = line.getX2() - line.getX1(), dy = line.getY2() - line.getY1();\n\tdouble len = Utils.length(dx,dy);\n\tif (len < 0.001) len = 0.001; dx = dx/len; dy = dy/len; double pdx = dy, pdy = -dx;\n\tif (pdy < 0.0) { pdy = -pdy; pdx = -pdx; } // Always point down\n double gather_x = line.getX1() + dx*len/2 + pdx*40, gather_y = line.getY1() + dy*len/2 + pdy*40;\n\n\t// Find the bundles, for this with timestamps, construct the timeline\n\tSet<Bundle> set = myrc.line_to_bundles.get(line);\n\tIterator<Bundle> itb = set.iterator(); double x_sum = 0.0; int x_samples = 0;\n while (itb.hasNext()) {\n\t Bundle bundle = itb.next();\n\t if (bundle.hasTime()) { x_sum += (int) (tl_x0 + (tl_w*(bundle.ts0() - ts0))/(ts1 - ts0)); x_samples++; }\n }\n\tif (x_samples == 0) return;\n\tdouble x_avg = x_sum/x_samples;\n ColorScale timing_marks_cs = RTColorManager.getTemporalColorScale();\n itb = set.iterator();\n\twhile (itb.hasNext()) { \n\t Bundle bundle = itb.next();\n\n\t if (bundle.hasTime()) {\n double ratio = ((double) (bundle.ts0() - ts0))/((double) (ts1 - ts0));\n\t g2d.setColor(timing_marks_cs.at((float) ratio));\n\n\t int xa = (int) (tl_x0 + (tl_w*(bundle.ts0() - ts0))/(ts1 - ts0));\n // g2d.setComposite(full); \n g2d.draw(line);\n\t if (bundle.hasDuration()) {\n int xb = (int) (tl_x0 + (tl_w*(bundle.ts1() - ts0))/(ts1 - ts0)); \n double r = (tl_h-2)/2;\n g2d.fill(new Ellipse2D.Double(xa-r,tl_y0-tl_h/2-r,2*r,2*r));\n g2d.fill(new Ellipse2D.Double(xb-r,tl_y0-tl_h/2-r,2*r,2*r));\n if (xa != xb) g2d.fill(new Rectangle2D.Double(xa, tl_y0-tl_h/2-r, xb-xa, 2*r));\n\t if (xa != xb) { g2d.drawLine(xa,tl_y0-tl_h,xb,tl_y0); g2d.drawLine(xa,tl_y0, xb,tl_y0); }\n\t }\n\t g2d.drawLine(xa,tl_y0-tl_h,xa,tl_y0); // Make it slightly higher at the start\n double x0 = line.getX1() + dx * len * 0.1 + dx * len * 0.8 * ratio,\n\t y0 = line.getY1() + dy * len * 0.1 + dy * len * 0.8 * ratio;\n\t g2d.draw(new CubicCurve2D.Double(x0, y0, \n x0 + pdx*10, y0 + pdy*10,\n gather_x - pdx*10, gather_y - pdy*10,\n gather_x, gather_y));\n g2d.draw(new CubicCurve2D.Double(gather_x, gather_y, \n\t gather_x + pdx*40, gather_y + pdy*40,\n\t\t\t\t\t x_avg, tl_y0 - 10*tl_h, \n\t x_avg, tl_y0 - 8*tl_h));\n g2d.draw(new CubicCurve2D.Double(x_avg, tl_y0 - 8*tl_h,\n (x_avg+xa)/2, tl_y0 - 6*tl_h,\n xa, tl_y0 - 2*tl_h,\n xa, tl_y0 - tl_h/2));\n }\n\t}\n }", "public void updateChart() {\n\t\tdouble val_min = Double.MAX_VALUE;\n\t\tdouble val_max = -Double.MAX_VALUE;\n\t\tVector<CurveData> cdV = new Vector<CurveData>();\n\n\t\tint maxMarkLength = 1;\n\t\tint nClmns = barColumns.size();\n\t\tint nMaxLines = 0;\n\t\tfor ( final BarColumn bc : barColumns ) {\n\t\t\tif (bc.show()) {\n\t\t\t\tfor (int j = 0; j < bc.size(); j++) {\n\t\t\t\t\tif (val_min > bc.value(j)) {\n\t\t\t\t\t\tval_min = bc.value(j);\n\t\t\t\t\t}\n\t\t\t\t\tif (val_max < bc.value(j)) {\n\t\t\t\t\t\tval_max = bc.value(j);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (nMaxLines < bc.size()) {\n\t\t\t\tnMaxLines = bc.size();\n\t\t\t}\n\t\t\tif (maxMarkLength < bc.marker().length()) {\n\t\t\t\tmaxMarkLength = bc.marker().length();\n\t\t\t}\n\t\t}\n\n\t\tString tmp_str = \"\";\n\t\tfor (int i = 0; i < maxMarkLength; i++) {\n\t\t\ttmp_str = tmp_str + \" \";\n\t\t}\n\t\temptyStr = tmp_str;\n\n\t\t//System.out.println(\"debug =========== val_min=\" + val_min + \" val_max=\" + val_max);\n\n\t\tif (val_min * val_max > 0.) {\n\t\t\tif (val_min > 0.) {\n\t\t\t\tval_min = 0.;\n\t\t\t} else {\n\t\t\t\tval_max = 0.;\n\t\t\t}\n\t\t}\n\n\t\tint iMin = GP.getScreenX(GP.getCurrentMinX());\n\t\tint iMax = GP.getScreenX(GP.getCurrentMaxX());\n\t\t//System.out.println(\"debug iMin=\" + iMin + \" iMax=\" + iMax);\n\t\twidth = (int) ((iMax - iMin) / (1.9 * nMaxLines * nClmns));\n\t\t//System.out.println(\"debug width=\" + width);\n\t\tif (width < 1) {\n\t\t\twidth = 1;\n\t\t}\n\n\t\t//make line from\n\t\tCurveData cd = cvV.get(0);\n\t\tif (nClmns > 0) {\n\t\t\tcd.clear();\n\t\t\tcd.addPoint(0., 0.);\n\t\t\tcd.addPoint(1.0 * (nClmns + 1), 0.);\n\t\t\tcd.setColor(Color.black);\n\t\t\tcd.setLineWidth(1);\n\t\t\tcd.findMinMax();\n\t\t\tcdV.add(cd);\n\t\t}\n\n\t\tint cvCount = 1;\n\t\tfor (int i = 1; i <= nClmns; i++) {\n\t\t\tBarColumn bc = barColumns.get(i - 1);\n\t\t\tif (bc.show()) {\n\t\t\t\tdouble d_min = i - 0.35;\n\t\t\t\tdouble d_max = i + 0.35;\n\t\t\t\tint nL = bc.size();\n\t\t\t\tdouble st = (d_max - d_min) / nL;\n\t\t\t\tfor (int j = 0; j < nL; j++) {\n\t\t\t\t\tif (bc.show(j)) {\n\t\t\t\t\t\tif(cvCount < cvV.size()){\n\t\t\t\t\t\t\tcd = cvV.get(cvCount);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tcd = new CurveData();\n\t\t\t\t\t\t\tcvV.add(cd);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcd.clear();\n\t\t\t\t\t\tcd.addPoint(d_min + (j + 0.5) * st, 0.);\n\t\t\t\t\t\tcd.addPoint(d_min + (j + 0.5) * st, bc.value(j));\n\t\t\t\t\t\tcd.setLineWidth(width);\n\t\t\t\t\t\tif (bc.getColor(j) == null) {\n\t\t\t\t\t\t\tcd.setColor(bcColor.getColor(j));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcd.setColor(bc.getColor(j));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcd.findMinMax();\n\t\t\t\t\t\tcdV.add(cd);\n\t\t\t\t\t\tcvCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//System.out.println(\"debug ===========start plotting=============== nClmns= \" + nClmns);\n\t\tif (val_min < val_max) {\n\t\t\tformatter.makeAnalysis(val_min, val_max);\n\t\t\tGP.setNumberFormatY(formatter.getFormat());\n\t\t\tGP.setLimitsAndTicksY(formatter.getMin(), formatter.getMax(), formatter.getStep());\n\t\t}\n\n\t\tif (barColumns.size() >= 10) {\n\t\t\tGP.getCurrentGL().setXminOn(false);\n\t\t\tGP.getCurrentGL().setXmaxOn(false);\n\t\t}\n\n\t\tif (cdV.size() > 0) {\n\t\t\tGP.setCurveData(cdV);\n\t\t} else {\n\t\t\tGP.removeAllCurveData();\n\t\t}\n\t}", "double getAxon();", "void format05(String line, int lineCount) {\n\n float spldepDifference = 0f;\n\n // is this the first record in the file?\n checkFirstRecord(code, lineCount);\n\n String tmpStationId = \"\";\n String tmpSubdes = \"\";\n float tmpSpldep = -9999f;\n\n // get the data off the line\n java.util.StringTokenizer t = new java.util.StringTokenizer(line, \" \");\n String dummy = t.nextToken(); // get 'rid' of the code\n\n int subCode = 0;\n if (dataType == WATERWOD) {\n if (t.hasMoreTokens()) subCode = toInteger(t.nextToken());\n switch (subCode) {\n case 1: if (t.hasMoreTokens()) t.nextToken(); //watProfQC.setStationId(toString(t.nextToken()));\n if (t.hasMoreTokens()) //set profile temperature quality flag\n watProfQC.setTemperature((toInteger(t.nextToken())));\n if (t.hasMoreTokens()) //set profile salinity quality flag\n watProfQC.setSalinity((toInteger(t.nextToken())));\n if (t.hasMoreTokens()) //set profile disoxygen quality flag\n watProfQC.setDisoxygen((toInteger(t.nextToken())));\n break;\n\n } // switch (subCode)\n } // if (dataType = WATERWOD)\n if (dbg) System.out.println(\"format05: subCode = \" + subCode);\n\n if (dataType == CURRENTS) {\n\n //01 a2 format code always \"05\" n/a\n //02 a12 stnid station id: composed as for format 03 currents\n //03 f7.2 sample depth in m currents\n //04 i3 current dir in deg TN currents\n //05 f5.2 current speed in m/s currents\n\n if (t.hasMoreTokens()) currents.setStationId(toString(t.nextToken()));\n if (t.hasMoreTokens()) currents.setSpldep(toFloat(t.nextToken(), 1f));\n if (t.hasMoreTokens()) currents.setCurrentDir(toInteger(t.nextToken()));\n if (t.hasMoreTokens()) currents.setCurrentSpeed(toFloat(t.nextToken(), 1f));\n\n tmpStationId = currents.getStationId(\"\");\n tmpSubdes = currents.getSubdes(\"\");\n tmpSpldep = currents.getSpldep();\n\n } else if (dataType == SEDIMENT) {\n\n // This is a new sub-station record - set flags for code 06 to 13\n // to false\n code06Count = 0;\n code07Count = 0;\n //code08Count = 0;\n code09Count = 0;\n //code10Count = 0;\n code11Count = 0;\n code12Count = 0;\n code13Count = 0;\n\n //01 a2 format code always “05\" n/a\n //02 a12 stnid station id: composed as for format 03 sedphy\n //03 f7.2 sample depth in m sedphy\n //04 f6.3 cod mg O2 / litre sedphy\n //05 f8.4 dwf sedphy\n //06 i5 meanpz µns sedphy\n //07 i5 medipz µns sedphy\n //08 f8.3 kurt sedphy\n //09 f8.3 skew sedphy\n\n if (t.hasMoreTokens()) sedphy.setStationId(toString(t.nextToken()));\n if (t.hasMoreTokens()) sedphy.setSpldep(toFloat(t.nextToken(), 1f));\n if (t.hasMoreTokens()) sedphy.setCod(toFloat(t.nextToken(), 1f));\n if (t.hasMoreTokens()) sedphy.setDwf(toFloat(t.nextToken(), 1f));\n if (t.hasMoreTokens()) sedphy.setMeanpz(toInteger(t.nextToken()));\n if (t.hasMoreTokens()) sedphy.setMedipz(toInteger(t.nextToken()));\n if (t.hasMoreTokens()) sedphy.setKurt(toFloat(t.nextToken(), 1f));\n if (t.hasMoreTokens()) sedphy.setSkew(toFloat(t.nextToken(), 1f));\n\n tmpStationId = sedphy.getStationId(\"\");\n tmpSubdes = sedphy.getSubdes(\"\");\n tmpSpldep = sedphy.getSpldep();\n if (dbg) System.out.println(\"<br>format05: subdes = \" + subdes +\n \", sedphy.getSubdes() = \" + sedphy.getSubdes(\"\"));\n if (dbg) System.out.println(\"<br>format05: tmpSpldep = \" + tmpSpldep);\n\n } else if ((dataType == WATER) || (dataType == WATERWOD)) {\n\n // This is a new sub-station record - set flags for code 06 to 13\n // to false\n code06Count = 0;\n code07Count = 0;\n code08Count = 0;\n code09Count = 0;\n code10Count = 0;\n code11Count = 0;\n code12Count = 0;\n code13Count = 0;\n\n // subCode = 1 - ignore\n // subCode = 0 (WATER) or subCode = 2 (WATERWOD)\n if (subCode != 1) {\n //01 a2 format code always \"05\" n/a\n //02 a12 stnid station id: composed as for format 03 watphy\n //03 f7.2 sample depth in m watphy\n //04 f5.2 temperature in deg C watphy\n //05 f6.3 salinity in parts per thousand (?) watphy\n //06 f5.2 dis oxygen in ml / litre watphy\n\n if (t.hasMoreTokens()) watphy.setStationId(toString(t.nextToken()));\n if (t.hasMoreTokens()) watphy.setSpldep(toFloat(t.nextToken(), 1f));\n if ((dataType == WATERWOD) && (t.hasMoreTokens())) // set spldep quality flag\n watQC.setSpldep((toInteger(t.nextToken())));\n\n if (t.hasMoreTokens()) watphy.setTemperature(toFloat(t.nextToken(), 1f));\n if ((dataType == WATERWOD) && (t.hasMoreTokens())) // set temperature quality flag\n watQC.setTemperature((toInteger(t.nextToken())));\n\n if (t.hasMoreTokens()) watphy.setSalinity(toFloat(t.nextToken(), 1f));\n if ((dataType == WATERWOD) && (t.hasMoreTokens())) // set salinity quality flag\n watQC.setSalinity((toInteger(t.nextToken())));\n\n if (t.hasMoreTokens()) watphy.setDisoxygen(toFloat(t.nextToken(), 1f));\n if ((dataType == WATERWOD) && (t.hasMoreTokens())) // set disoxygen quality flag\n watQC.setDisoxygen((toInteger(t.nextToken())));\n\n if (t.hasMoreTokens()) watphy.setTurbidity(toFloat(t.nextToken(), 1f));\n if (t.hasMoreTokens()) watphy.setPressure(toFloat(t.nextToken(), 1f)); // ub09\n if (t.hasMoreTokens()) watphy.setFluorescence(toFloat(t.nextToken(), 1f)); // ub09\n\n if (watphy.getSpldep() == Tables.FLOATNULL) { // ub11\n if ((watphy.getPressure() != Tables.FLOATNULL) && // ub11\n (station.getLatitude() != Tables.FLOATNULL)) { // ub11\n watphy.setSpldep( // ub11\n calcDepth(watphy.getPressure(), // ub11\n station.getLatitude())); // ub11\n } // if ((watphy.getPressure() != Tables.FLOATNULL) && .// ub11\n } // if (watphy.getSpldep() == Tables.FLOATNULL) // ub11\n\n tmpStationId = watphy.getStationId(\"\");\n tmpSubdes = watphy.getSubdes(\"\");\n tmpSpldep = watphy.getSpldep();\n if (dbg) System.out.println(\"<br>format05: subdes = \" + subdes +\n \", watphy.getSubdes() = \" + watphy.getSubdes(\"\"));\n } // if (subCode != 1)\n\n } // if (dataType == CURRENTS)\n\n // subCode = 1 - ignore\n // subCode = 0 (WATER/CURRENTS/SEDIMENT) or subCode = 2 (WATERWOD)\n if (subCode != 1) {\n // station Id must match that of previous station record\n checkStationId(lineCount, tmpStationId);\n\n // samples must be at least 0.5 metre deeper than the previous.\n // If this is not the case, reject the sample.\n // Only valid for CTD-type data, not for XBT or currents\n if (\"CTD\".equals(tmpSubdes)) {\n if (\"U\".equals(upIndicator)) {\n spldepDifference = prevDepth - tmpSpldep;\n } else {\n spldepDifference = tmpSpldep - prevDepth;\n } // if (\"U\".equals(upIndicator))\n } else {\n spldepDifference = 1f;\n } // if (\"CTD\".equals(tmpSubdes))\n\n if ((spldepDifference < 0.5f) && (tmpSpldep != 0f) &&\n (prevDepth != 0f)) {\n rejectDepth = true;\n stationSampleRejectCount++;\n sampleRejectCount++;\n\n if ((dataType == WATER) || (dataType == WATERWOD)) {\n watchem1 = new MrnWatchem1();\n watchem1 = new MrnWatchem1();\n watchl = new MrnWatchl();\n watnut = new MrnWatnut();\n watpol1 = new MrnWatpol1();\n watpol2 = new MrnWatpol2();\n } // if ((dataType == WATER) || (dataType == WATERWOD))\n if (dataType == WATERWOD) {\n watQC = new MrnWatqc();\n } // if (dataType == WATERWOD)\n } else {\n rejectDepth = false;\n prevDepth = tmpSpldep;\n\n // update the minimum and maximum depth\n if (tmpSpldep < depthMin) {\n depthMin = tmpSpldep;\n } // if (tmpSpldep < depthMin)\n if (tmpSpldep > depthMax) {\n depthMax = tmpSpldep;\n } // if (tmpSpldep < depthMin)\n\n } // if ((spldepDifference < 0.5f) &&\n\n // update the counters\n sampleCount++;\n stationSampleCount++;\n\n if (dbg) System.out.println(\"<br>format05: depthMax = \" + depthMax);\n // keep the maximum depth for the station\n station.setMaxSpldep(depthMax);\n //if (dbg) System.out.println(\"format05: station = \" + station);\n if (dbg) {\n if (dataType == CURRENTS) {\n System.out.println(\"<br>format05: currents = \" + currents);\n } else if (dataType == SEDIMENT) {\n System.out.println(\"<br>format05: sedphy = \" + sedphy);\n } else if (dataType == WATER) {\n System.out.println(\"<br>format05: watphy = \" + watphy);\n } else if (dataType == WATERWOD) {\n System.out.println(\"format05: watProfQC = \" + watProfQC);\n System.out.println(\"format05: watQC = \" + watQC);\n System.out.println(\"format05: watphy = \" + watphy);\n } // if (dataType == CURRENTS)\n } // if (dbg)\n\n } // if (subCode != 1)\n\n }", "public void decay()\n\t{\n\t\tprotons -= 2;\n\t\tneutrons -= 2;\n\t}", "private double kToEv(double value) {\n\t\treturn Converter.convertWaveVectorToEnergy(value, edgeEnergy);\n\t}", "public KochLine getLineA(){\n\t\tKochLine lineA= new KochLine(p1,p2);\n\t\treturn lineA;\n\t\t\n\t}", "static void SKP_Silk_MA(short[] in, /* I: input signal */\n\t\tint in_offset, short[] B, /* I: MA coefficients, Q13 [order+1] */\n\t\tint[] S, /* I/O: state vector [order] */\n\t\tshort[] out, /* O: output signal */\n\t\tint out_offset, final int len, /* I: signal length */\n\t\tfinal int order /* I: filter order */\n\t)\n\t{\n\t\tint k, d, in16;\n\t\tint out32;\n\n\t\tfor (k = 0; k < len; k++) {\n\t\t\tin16 = in[in_offset + k];\n\t\t\tout32 = SKP_SMLABB(S[0], in16, B[0]);\n\t\t\tout32 = SigProcFIX.SKP_RSHIFT_ROUND(out32, 13);\n\n\t\t\tfor (d = 1; d < order; d++) {\n\t\t\t\tS[d - 1] = SKP_SMLABB(S[d], in16, B[d]);\n\t\t\t}\n\t\t\tS[order - 1] = SKP_SMULBB(in16, B[order]);\n\n\t\t\t/* Limit */\n\t\t\tout[out_offset + k] = (short) SigProcFIX.SKP_SAT16(out32);\n\t\t}\n\t}", "static void CALC_FCSLOT(OPL_CH CH, OPL_SLOT SLOT) {\n int ksr;\n\n /* frequency step counter */\n /*RECHECK*/\n SLOT.Incr = ((CH.fc * SLOT.mul) & 0xFFFFFFFFL);\n ksr = CH.kcode >> SLOT.KSR;\n\n if (SLOT.ksr != (ksr & 0xFF)) {\n /*RECHECK*/\n SLOT.ksr = ksr & 0xFF;\n /* attack , decay rate recalcration */\n SLOT.evsa = SLOT.AR.read(ksr);\n SLOT.evsd = SLOT.DR.read(ksr);\n SLOT.evsr = SLOT.RR.read(ksr);\n }\n SLOT.TLL = (int) (SLOT.TL + (CH.ksl_base >> SLOT.ksl));\n }", "@Override\n\tpublic void update(int timeStep)\n\t{\n\t\tthis.checkForNewAppliancesAndUpdateConstants();\n\n\t\tdouble[] ownersCostSignal = this.owner.getPredictedCostSignal();\n\t\tthis.dayPredictedCostSignal = Arrays.copyOfRange(ownersCostSignal, timeStep % ownersCostSignal.length, timeStep\n\t\t\t\t% ownersCostSignal.length + this.ticksPerDay);\n\n\t\tif (this.mainContext.logger.isTraceEnabled())\n\t\t{\n\t\t\tthis.mainContext.logger.trace(\"update\");\n\t\t}\n\n\t\tif (this.mainContext.logger.isTraceEnabled())\n\t\t{\n\t\t\tthis.mainContext.logger.trace(\"dayPredictedCostSignal: \" + Arrays.toString(this.dayPredictedCostSignal));\n\t\t}\n\n\t\tthis.dayPredictedCostSignal = ArrayUtils\n\t\t\t\t.offset(ArrayUtils.multiply(this.dayPredictedCostSignal, this.predictedCostToRealCostA), this.realCostOffsetb);\n\n\t\tif (this.mainContext.logger.isTraceEnabled())\n\t\t{\n\t\t\tthis.mainContext.logger.trace(\"afterOffset dayPredictedCostSignal: \" + Arrays.toString(this.dayPredictedCostSignal));\n\t\t}\n\n\t\tif (this.owner.isHasElectricalSpaceHeat())\n\t\t{\n\t\t\tthis.setPointProfile = Arrays.copyOf(this.owner.getSetPointProfile(), this.owner.getSetPointProfile().length);\n\t\t\tthis.optimisedSetPointProfile = Arrays.copyOf(this.setPointProfile, this.setPointProfile.length);\n\t\t\tthis.currentTempProfile = Arrays.copyOf(this.setPointProfile, this.setPointProfile.length);\n\t\t\tthis.heatPumpDemandProfile = this.calculateEstimatedSpaceHeatPumpDemand(this.setPointProfile);\n\t\t\t// (20/01/12) Check if sum of <heatPumpDemandProfile> is consistent\n\t\t\t// at end day\n\t\t\tif (this.mainContext.logger.isTraceEnabled())\n\t\t\t{\n\t\t\t\tthis.mainContext.logger\n\t\t\t\t\t\t.trace(\"Sum(Wattbox estimated heatPumpDemandProfile): \" + ArrayUtils.sum(this.heatPumpDemandProfile));\n\t\t\t}\nif (\t\t\tthis.mainContext.logger.isTraceEnabled()) {\n\t\t\tthis.mainContext.logger.trace(\"Sum(Wattbox estimated heatPumpDemandProfile): \"\n\t\t\t\t\t+ ArrayUtils.sum(this.calculateEstimatedSpaceHeatPumpDemand(this.optimisedSetPointProfile)));\n}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.heatPumpDemandProfile = Arrays.copyOf(this.noElecHeatingDemand, this.noElecHeatingDemand.length);\n\t\t}\n\n\t\tif (this.owner.isHasElectricalWaterHeat())\n\t\t{\n\t\t\tthis.hotWaterVolumeDemandProfile = Arrays.copyOfRange(this.owner.getBaselineHotWaterVolumeProfile(), (timeStep % this.owner\n\t\t\t\t\t.getBaselineHotWaterVolumeProfile().length), (timeStep % this.owner.getBaselineHotWaterVolumeProfile().length)\n\t\t\t\t\t+ this.ticksPerDay);\n\t\t\tthis.waterHeatDemandProfile = ArrayUtils.multiply(this.hotWaterVolumeDemandProfile, Consts.WATER_SPECIFIC_HEAT_CAPACITY\n\t\t\t\t\t/ Consts.KWH_TO_JOULE_CONVERSION_FACTOR\n\t\t\t\t\t* (this.owner.waterSetPoint - ArrayUtils.min(Consts.MONTHLY_MAINS_WATER_TEMP) / Consts.DOMESTIC_HEAT_PUMP_WATER_COP));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.waterHeatDemandProfile = Arrays.copyOf(this.noElecHeatingDemand, this.noElecHeatingDemand.length);\n\t\t}\n\n\t\tif (this.coldAppliancesControlled && this.owner.isHasColdAppliances())\n\t\t{\n\t\t\tthis.optimiseColdProfile(timeStep);\n\t\t}\n\n\t\tif (this.wetAppliancesControlled && this.owner.isHasWetAppliances())\n\t\t{\n\t\t\tthis.optimiseWetProfile(timeStep);\n\t\t}\n\n\t\t// Note - optimise space heating first. This is so that we can look for\n\t\t// absolute\n\t\t// heat pump limit and add the cost of using immersion heater (COP 0.9)\n\t\t// to top\n\t\t// up water heating if the heat pump is too great\n\t\tif (this.spaceHeatingControlled && this.owner.isHasElectricalSpaceHeat())\n\t\t{\n\t\t\tif (this.owner.hasStorageHeater)\n\t\t\t{\n\t\t\t\tthis.optimiseStorageChargeProfile();\n\t\t\t\tif (this.mainContext.logger.isTraceEnabled())\n\t\t\t\t{\n\t\t\t\t\tthis.mainContext.logger.trace(\"Optimised storage heater profile = \" + Arrays.toString(this.heatPumpOnOffProfile));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\tthis.optimiseSetPointProfile();\n\t\t\tif (this.mainContext.logger.isTraceEnabled())\n\t\t\t{\n\t\t\t\tthis.mainContext.logger.trace(\"Optimised set point profile = \" + Arrays.toString(this.heatPumpOnOffProfile));\n\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.waterHeatingControlled && this.owner.isHasElectricalWaterHeat())\n\t\t{\n\t\t\tthis.optimiseWaterHeatProfileWithSpreading();\n\t\t}\n\n\t\tif (this.eVehicleControlled && this.owner.isHasElectricVehicle())\n\t\t{\n\t\t\tthis.optimiseEVProfile();\n\t\t}\n\n\t\t// At the end of the step, set the temperature profile for today's\n\t\t// (which will be yesterday's when it is used)\n\t\tthis.priorDayExternalTempProfile = this.owner.getContext().getAirTemperature(timeStep, this.ticksPerDay);\n\t}", "protected double ABT() {\r\n\t\tDouble output = Double.MAX_VALUE;\r\n\t\tIterator<Double> bws = this.flowBandwidth.values().iterator();\r\n\t\twhile (bws.hasNext()) {\r\n\t\t\tdouble temp = bws.next();\r\n\t\t\tif (temp < output) {\r\n\t\t\t\toutput = temp;\r\n\t\t\t\t// System.out.println(\"[GeneralSimulator.ABT]: \" + output);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// System.out.println(\"[GeneralSimulator.ABT]: succfulCount \"\r\n\t\t// + this.successfulCount);\r\n\t\treturn output * this.successfulCount;\r\n\t}", "public float findFrequency(ArrayList<Float> wave){\n\r\n ArrayList<Float> newWave = new ArrayList<>();\r\n\r\n for(int i=0;i<wave.size()-4;i++){\r\n newWave.add((wave.get(i)+wave.get(i+1)+wave.get(i+2)+wave.get(i+4))/4f);\r\n }\r\n\r\n\r\n boolean isBelow = wave1.get(0)<triggerVoltage;\r\n\r\n ArrayList<Integer> triggerSamples = new ArrayList<>();\r\n\r\n\r\n System.out.println(\"starting f calc\");\r\n\r\n for(int i=1;i<newWave.size();i++){\r\n if(isBelow){\r\n if(newWave.get(i)>triggerVoltage){\r\n triggerSamples.add(i);\r\n isBelow=false;\r\n }\r\n }else{\r\n if(newWave.get(i)<triggerVoltage){\r\n triggerSamples.add(i);\r\n isBelow=true;\r\n }\r\n }\r\n }\r\n System.out.println(\"F len in \"+triggerSamples.size());\r\n\r\n ArrayList<Float> freqValues = new ArrayList<>();\r\n\r\n\r\n for(int i=0;i<triggerSamples.size()-2;i++){\r\n freqValues.add(1/(Math.abs(SecondsPerSample*(triggerSamples.get(i)-triggerSamples.get(i+2)))));\r\n }\r\n\r\n float finalAVG =0;\r\n for (Float f : freqValues) {\r\n finalAVG+=f;\r\n }\r\n finalAVG/=freqValues.size();\r\n\r\n\r\n return finalAVG;\r\n //System.out.println(finalAVG);\r\n }", "private static double fds_h(Vec v) { return 2*ASTMad.mad(new Frame(v), null, 1.4826)*Math.pow(v.length(),-1./3.); }", "private float averageBeat(){\n float avgBeat = 0f;\n List<Float> beatRed = DataManager.getInstance().getBeatRed();\n List<Float> beatIR = DataManager.getInstance().getBeatIR();\n\n for(int i = 0; i < beatRed.size() && i < beatIR.size(); i ++ ){\n chartFragment.addRedData(beatRed.get(i));\n chartFragment.addIRData(beatIR.get(i));\n avgBeat += beatRed.get(i);\n avgBeat += beatIR.get(i);\n }\n avgBeat = avgBeat / (beatRed.size() + beatIR.size());\n\n if (tcpTask != null )\n this.tcpTask.addData(\"\" + avgBeat);\n beatLabel.setText(\"Beat : \" + avgBeat);\n return avgBeat;\n }", "public void start() {\n enable = true;\n audioRecord.startRecording();\n Thread monitorThread = new Thread(new Runnable() {\n public void run() {\n char lastDtmf = ' ';\n do {\n audioRecord.read(recordBuffer, 0, BUFFER_SIZE, AudioRecord.READ_BLOCKING);\n im = zero.clone(); //memset, I hope?\n System.arraycopy(recordBuffer, 0, re, 0, BUFFER_SIZE); //memset, I presume\n fft.fft(re, im);\n int f1 = 0, f2 = 0;\n char dtmf = ' ';\n for (int i = 0; i < BUFFER_SIZE/2; i++) {\n if ((Math.abs(im[i]) > 10)) {\n if ((i > 258) && (i < 261))\n f1 = 697;\n if ((i > 285) && (i < 289))\n f1 = 770;\n if ((i > 315) && (i < 318))\n f1 = 852;\n if ((i > 349) && (i < 352))\n f1 = 941;\n if ((i > 446) && (i < 451))\n f2 = 1209;\n if ((i > 493) && (i < 505))\n f2 = 1336;\n if ((i > 544) && (i < 553))\n f2 = 1477;\n if ((i > 605) && (i < 608))\n f2 = 1633;\n }\n }\n if ((f1 == 697) && (f2 == 1209))\n dtmf = '1';\n if ((f1 == 697) && (f2 == 1336))\n dtmf = '2';\n if ((f1 == 697) && (f2 == 1477))\n dtmf = '3';\n if ((f1 == 697) && (f2 == 1633))\n dtmf = 'A';\n if ((f1 == 770) && (f2 == 1209))\n dtmf = '4';\n if ((f1 == 770) && (f2 == 1336))\n dtmf = '5';\n if ((f1 == 770) && (f2 == 1477))\n dtmf = '6';\n if ((f1 == 770) && (f2 == 1633))\n dtmf = 'B';\n if ((f1 == 852) && (f2 == 1209))\n dtmf = '7';\n if ((f1 == 852) && (f2 == 1336))\n dtmf = '8';\n if ((f1 == 852) && (f2 == 1477))\n dtmf = '9';\n if ((f1 == 852) && (f2 == 1633))\n dtmf = 'C';\n if ((f1 == 941) && (f2 == 1209))\n dtmf = '*';\n if ((f1 == 941) && (f2 == 1336))\n dtmf = '0';\n if ((f1 == 941) && (f2 == 1477))\n dtmf = '#';\n if ((f1 == 941) && (f2 == 1633))\n dtmf = 'D';\n\n if (dtmf == ' ') {\n lastDtmf = ' ';\n } else {\n if (listener != null)\n if (dtmf != lastDtmf) {\n lastDtmf = dtmf;\n listener.receivedDTMF(dtmf);\n }\n }\n } while (enable);\n audioRecord.stop();\n }\n });\n monitorThread.start();\n }", "static double triangleWave(double timeInSeconds, double frequency) {\r\n\t\treturn 0;\r\n\t}", "public double getMeanTimeBetweenCarArrivals() {\n return meanTimeBetweenCarArrivals;\n }", "private List< PlotData > valueOfDesireAlongLine( final Line line, final int which_one_my_master )\n\t{\n\t\tfinal Img< UnsignedShortType > img = ImagePlusAdapter.wrap( imgPlus );\n\t\tfinal Cursor< UnsignedShortType > cursor = img.cursor();\n\n\t\t// get 'line' as vector based at 0\n\t\tfinal double vec_x = line.x2 - line.x1;\n\t\tfinal double vec_y = line.y2 - line.y1;\n\t\t// direction of 'line' as normalized vecter at 0\n\t\tfinal Vector2D vec_line_direction = new Vector2D( vec_x, vec_y );\n\n\t\tfinal int frames = imgPlus.getDimensions()[ 4 ]; // 4 happens to be the\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// time-dimension...\n\t\tfinal List< PlotData > summed_intensities = new ArrayList< PlotData >();\n\t\tfinal List< PlotData > volume = new ArrayList< PlotData >();\n\t\tfinal List< PlotData > concentrations = new ArrayList< PlotData >();\n\n\t\tfor ( int i = 0; i < frames; i++ )\n\t\t{\n\t\t\tsummed_intensities.add( new PlotData( ( int ) Math.floor( line.getLength() ) ) );\n\t\t\tvolume.add( new PlotData( ( int ) Math.floor( line.getLength() ) ) );\n\t\t\tconcentrations.add( new PlotData( ( int ) Math.floor( line.getLength() ) ) );\n\t\t}\n\n\t\tdouble pixel_value;\n\t\tfinal double voxel_depth = this.imgPlus.getCalibration().getZ( 1.0 );\n\t\twhile ( cursor.hasNext() )\n\t\t{\n\t\t\tpixel_value = 0.0;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tpixel_value = cursor.next().get();\n\t\t\t}\n\t\t\tcatch ( final ClassCastException e )\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t\tIJ.error( \"ClassCastException\", \"Please make source image 16bit!\" );\n\t\t\t}\n\t\t\tfinal double xpos = cursor.getIntPosition( 0 ) - line.x1;\n\t\t\tfinal double ypos = cursor.getIntPosition( 1 ) - line.y1;\n\t\t\t// final int zpos = cursor.getIntPosition( 2 );\n\t\t\tfinal int tpos = cursor.getIntPosition( 3 );\n\n\t\t\t// vector to current pixel\n\t\t\tfinal Vector2D vec_pos = new Vector2D( xpos, ypos );\n\n\t\t\t// compute projection onto line-ROI\n\t\t\tfinal Vector2D lineProjection = vec_line_direction.project( vec_pos );\n\t\t\tfinal double fractional_slice_num = lineProjection.getLength();\n\t\t\t// don't do anything in case voxel is below or above line\n\t\t\tif ( lineProjection.dot( vec_line_direction ) < 0 || fractional_slice_num > vec_line_direction.getLength() )\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// add the shit\n\t\t\tif ( pixel_value > 0.0 )\n\t\t\t{\n\t\t\t\tsummed_intensities.get( tpos ).addValueToXValue( fractional_slice_num, pixel_value );\n\t\t\t\tvolume.get( tpos ).addValueToXValue( fractional_slice_num, voxel_depth );\n\t\t\t}\n\t\t}\n\n\t\t// compute concentrations (iterate over summed intensities and divide by\n\t\t// volume)\n\t\tfor ( int t = 0; t < summed_intensities.size(); t++ )\n\t\t{\n\t\t\tfor ( int i = 0; i < summed_intensities.get( t ).getXData().length; i++ )\n\t\t\t{\n\t\t\t\tdouble concentration = summed_intensities.get( t ).getYData()[ i ] / volume.get( t ).getYData()[ i ];\n\t\t\t\tif ( Double.isNaN( concentration ) )\n\t\t\t\t\tconcentration = 0.0;\n\t\t\t\tconcentrations.get( t ).addValueToXValue( summed_intensities.get( t ).getXData()[ i ], concentration );\n\t\t\t}\n\t\t}\n\n\t\tif ( which_one_my_master == WISH_CONCENTRATION )\n\t\t{\n\t\t\treturn concentrations;\n\t\t}\n\t\telse if ( which_one_my_master == WISH_SUM_INTENSITIES )\n\t\t{\n\t\t\treturn summed_intensities;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn volume;\n\t\t}\n\t}", "private double[] driveSpeed(double x1, double y1, double x2){\n double[] output = new double[4];\r\n\r\n if(x1==1.00 && y1==0.00){\r\n output[0]=1.00;\r\n output[1]=0.00;\r\n output[2]=-1.00;\r\n output[3]=0.00;\r\n }else if(x1==-1.00 && y1==0.00){\r\n output[0]=-1.00;\r\n output[1]=0.00;\r\n output[2]=1.00;\r\n output[3]=0.00;\r\n }else if(y1==1.00 && x1==0.00){\r\n output[0]=0.00;\r\n output[1]=1.00;\r\n output[2]=0.00;\r\n output[3]=-1.00;\r\n }else if(y1==-1.00 && x1==0.00){\r\n output[0]=0.00;\r\n output[1]=-1.00;\r\n output[2]=0.00;\r\n output[3]=1.00;\r\n }else{\r\n //\r\n output[0]=0.00;\r\n output[1]=0.00;\r\n output[2]=0.00;\r\n output[3]=0.00;\r\n }\r\n\r\n return output;\r\n\r\n }", "public void setSignal(double signal) {_signal = signal;}", "protected final double fa(double x, double ac, double ae) {return ac*Math.pow(x, ae)/K;}", "private Line getMiddleTrajectory() {\n Point startPoint;\n if (movingRight()) {\n startPoint = middleRight();\n } else if (movingLeft()) {\n startPoint = middleLeft();\n } else {\n return null;\n }\n\n return new Line(startPoint, this.velocity);\n }", "public void normalization(){\n normalization = processControlBlock[0].getArrivalTime();\n }", "private void getCal() {\n \t\t\n \t\tif(isnew) {\n \t\t\tString[] parts0, parts1, parts2, parts3, parts4, parts5, parts6;\n \t\t\t\n \t\t\tparts0 = asciiheader[9].split(\"\\t\");\n \t\t\tparts1 = asciiheader[10].split(\"\\t\");\n \t\t\tparts2 = asciiheader[11].split(\"\\t\");\n \t\t\tparts3 = asciiheader[12].split(\"\\t\");\n \t\t\tparts4 = asciiheader[13].split(\"\\t\");\n \t\t\tparts5 = asciiheader[14].split(\"\\t\");\n \t\t\tparts6 = asciiheader[15].split(\"\\t\");\n \t\t\t\n \t\t\tfor(int i = 0; i < 3; i++) {\n \t\t\t\tRGBcal[i] = Float.parseFloat(parts0[i]);\n \t\t\t\tvlam[i] = Float.parseFloat(parts1[i]);\n \t\t\t\tvp[i] = Float.parseFloat(parts2[i]);\n \t\t\t\tmel[i] = Float.parseFloat(parts3[i]);\n \t\t\t\tvmac[i] = Float.parseFloat(parts4[i]);\n \t\t\t\tsmac[i] = Float.parseFloat(parts5[i]);\n \t\t\t\tCLAcal[i] = Float.parseFloat(parts6[i]);\n \t\t\t}\n \t\t\tCLAcal[3] = Float.parseFloat(parts6[3]);\n \t\t\treturn;\n \n \t\t}\n \t\t\n \t\tint temp = 0;\n \t\tint j = 0;\n \t\tString workingDirectory = new String(System.getProperty(\"user.dir\")+ \"\\\\src\\\\data\");\n \t\t\n \t\tString[] s = loadStrings(workingDirectory + \"\\\\Day12_Cal_Values.txt\");\n \t\t\n \n \t\t//Scone/macula\n \t\tfor(int i = 0; i < s[1].length(); i++) {\n \t\t\tif(s[1].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\t//smac[j] = float(s[1].substring(temp, i));\n \t\t\t\t\tsmac[j] = Float.parseFloat(s[1].substring(temp, i));\n \t\t\t\t\tj++;\n \t\t\t\t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t\t}\n \t\tsmac[j] = Float.parseFloat(s[1].substring(temp, s[1].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \n \t\t//Vlamda/macula\n \t\tfor(int i = 0; i < s[2].length(); i++) {\n \t\t\tif(s[2].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\tvmac[j] = Float.parseFloat(s[2].substring(temp, i));\n \t\t\t\t\tj++;\n \t\t\t\t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t\t}\n \t\tvmac[j] = Float.parseFloat(s[2].substring(temp, s[2].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \n \t\t//Melanopsin\n \t\tfor(int i = 0; i < s[3].length(); i++) {\n \t\t\tif(s[3].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\tmel[j] = Float.parseFloat(s[3].substring(temp, i));\n \t\t\t\t\tj++;\n \t\t\t\t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t}\n \t\tmel[j] = Float.parseFloat(s[3].substring(temp, s[3].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \n \t\t//Vprime\n \t\tfor(int i = 0; i < s[4].length(); i++) {\n \t\t\tif(s[4].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\tvp[j] = Float.parseFloat(s[4].substring(temp, i));\n \t\t\t\t\tj++;\n \t\t\t\t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t\t}\n \t\tvp[j] = Float.parseFloat(s[4].substring(temp, s[4].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \n \t\t//Vlamda\n \t\tfor(int i = 0; i < s[5].length(); i++) {\n \t\t\tif(s[5].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\tvlam[j] = Float.parseFloat(s[5].substring(temp, i));\n \t\t\t\t\tj++;\n \t\t\t\t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t\t}\n \t\tvlam[j] = Float.parseFloat(s[5].substring(temp, s[5].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \n \t\t//CLA\n \t\tfor(int i = 0; i < s[8].length(); i++) {\n \t\t\tif(s[8].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\tCLAcal[j] = Float.parseFloat(s[8].substring(temp, i));\n \t\t\t\t\tj++;\n \t\t\t\t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t\t}\n \t\tCLAcal[j] = Float.parseFloat(s[8].substring(temp, s[8].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \n \t\t//RGBcal\n \t\ts = loadStrings(workingDirectory + \"\\\\Day12 RGB Values.txt\");\n \t\tfor(int i = 0; i < s[ID].length(); i++) {\n \t\t\tif(s[ID].charAt(i) == 9) {\n \t\t\t\tif(temp != 0) {\n \t\t\t\t\tRGBcal[j] = Float.parseFloat(s[ID].substring(temp, i));\n \t\t\t\t\tj++;\n \t}\n \t\t\t\ttemp = i;\n \t\t\t}\n \t}\n \t\tRGBcal[j] = Float.parseFloat(s[ID].substring(temp, s[ID].length()));\n \t\ttemp = 0;\n \t\tj = 0;\n \t}", "public void calculateMeanChordRatio(double cfcIn, double cfcOut) {\n\t\tsetMeanChordRatio((cfcIn + cfcOut)/2);\n\t}", "public void average() {\n\t\tif (averaged)\n\t\t\tthrow new AssertionError(\"can't average twice!!\");\n\t\t\n\t\tscale = 1.0/(double)t;\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (t+1.0)*w[i] - wupdates[i];\n\t\t\n\t\taveraged = true;\n\t\n\t}", "@Override\n public void runEffect(double[] fft) {\n\n\n for(int i = fft.length - 1; i - pitchMove >= 0; i--)\n {\n fft[i] = fft[i - pitchMove];\n }\n for(int i = 0; i < pitchMove; i++)\n fft[i] = fft[i]*0.5;\n// for(int i = 0, k = 0; i < fft.length; i+=2)\n// {\n// if(i < fft.length/2) {\n// fft2[fft.length / 2 + k - 1] = (fft[fft.length / 2 + i] + fft[fft.length / 2 + i]) / 2;\n// fft2[fft.length / 2 - k - 1] = (fft[fft.length / 2 - i] + fft[fft.length / 2 - i]) / 2;\n// }\n// //fft2[k] = 0;\n// //fft2[fft2.length - k -1] = 0;\n// k++;\n// }\n /*for(int i = 0; i < fft.length; i++)\n {\n fft[i] = Math.abs(fft[i]);\n if(fft[i] < 2){\n fft[i] = 0;\n }\n //Log.d(\"Log\", fft[i] + \" \");\n }*/\n }", "protected static double[] preEmphasis(short inputSignal[]){\n double outputSignal[] = new double[inputSignal.length];\n \n // apply pre-emphasis to each sample\n for (int n = 1; n < inputSignal.length; n++){\n outputSignal[n] = inputSignal[n] - preEmphasisAlpha * inputSignal[n - 1];\n }\n \n return outputSignal;\n }", "@Test\n\tpublic void averageWorksForModeSteps() {\n\t\tfinal FloatTimeSeries t0 = new FloatTreeTimeSeries();\n\t\tt0.addValues(TimeSeriesUtils.createStepFunction(10, 0, 10, 10, 0)); // constant function = 10\n\t\tfinal FloatTimeSeries t1 = new FloatTreeTimeSeries();\n\t\tt1.addValues(TimeSeriesUtils.createStepFunction(5, 20, 25, 20, 0)); // constant function = 20\n\t\tt0.setInterpolationMode(InterpolationMode.STEPS);\n\t\tt1.setInterpolationMode(InterpolationMode.STEPS);\n\t\tfinal ReadOnlyTimeSeries avg = MultiTimeSeriesUtils.getAverageTimeSeries(Arrays.<ReadOnlyTimeSeries> asList(t0, t1), 0, Long.MAX_VALUE, true, null, false);\n\t\t// one data point outside time range, one boundary value should be added\n\t\tAssert.assertEquals(\"Time series sum has wrong number of data points\", 13, avg.size());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 10, avg.getValue(7).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(23).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(100).getValue().getIntegerValue());\n\t}", "public void onAccVal (float ax, float ay, float az, long ts)\r\n\t{\r\n\t\t++nAccVal;\r\n\t\t++last_nAccVal;\r\n\t\t\t\t\r\n\t\tacc_val.accx = -ax;\r\n\t\tacc_val.accy = ay;\r\n\t\tacc_val.accz = az;\r\n\t\tacc_val.ms = ts;\r\n\t\t\t\r\n\t\tacc_val.roll = (float)Math.atan2 (ax,az);\r\n\t\tacc_val.pitch = (float)Math.atan2 (ay,az);\r\n\t\t\t\r\n\t\tacc_val.roll = (float)((acc_val.roll*180.0)/Math.PI);\r\n\t\tacc_val.pitch = (float)((acc_val.pitch*180.0)/Math.PI);\r\n\t\t\r\n\t\tif (true)\r\n\t\t{\r\n\t\t\tdouble coeff = 1/9.81;\r\n\t\t\tacc_val.accx=(float)(acc_val.accx*coeff);\r\n\t\t\tacc_val.accy=(float)(acc_val.accy*coeff);\r\n\t\t\tacc_val.accz=(float)(acc_val.accz*coeff);\r\n\t\t}\r\n\t\tif (ts-last_data_ts>(1000/3)*1000000)\r\n\t\t{\r\n\t\t\tUI_RefreshSensorData ();\r\n\t\t\tlast_data_ts=ts;\r\n\t\t}\r\n\t\tsynchronized (this)\r\n\t\t{\r\n\t\t\tif (_bbCanSend && _bbStartSend) sendData (acc_val);\r\n\t\t}\r\n\t}", "public double getAcuteAngle( final LineXY line ) {\n\t\t// get the intersection point\n\t\tfinal PointXY p1 = PointXY.getIntersectionPoint( this, line );\n\t\tif( p1 == null ) {\n\t\t\tthrow new IllegalArgumentException( format( \"No intersection found\" ) );\n\t\t}\n\t\t\n\t\t// get the points of both lines\n\t\tfinal PointXY pa1 = this.getBeginPoint();\n\t\tfinal PointXY pa2 = this.getEndPoint();\n\t\tfinal PointXY pb1 = line.getBeginPoint();\n\t\tfinal PointXY pb2 = line.getEndPoint();\n\t\t\n\t\tfinal PointXY p2 = PointXY.getFarthestPoint( p1, pa1, pa2 );\n\t\tfinal PointXY p3 = PointXY.getFarthestPoint( p1, pb1, pb2 );\n\t\t\n\t\t// are both lines orthogonal?\n\t\tif( this.isOrthogonal() && line.isOrthogonal() ) {\n\t\t\treturn this.isParallelTo( line ) ? 0 : Math.PI;\n\t\t}\n\t\t\n\t\t// is the either line orthogonal?\n\t\telse if( this.isOrthogonal() || line.isOrthogonal() ) {\n\t\t\t// cos t = ( -a^2 + b^2 - c^2 ) / 2cb \n\t\t\tfinal double a = getDistance( p1, p2 );\n\t\t\tfinal double b = getDistance( p1, p3 );\n\t\t\tfinal double c = getDistance( p2, p3 );;\n\t\t\treturn acos( ( -pow(a, 2d) + pow(b, 2d) - pow(c, 2d) ) / ( 2d * c * b ) );\n\t\t}\n\t\t\n\t\t// both must be angular\n\t\telse {\n\t\t\t// tan t = ( m1 - m2 ) / ( 1 + m1 * m2 ); where m2 > m1\n\t\t\tdouble m1 = this.getSlope();\n\t\t\tdouble m2 = line.getSlope();\n\t\t\tif( m1 > m2 ) {\n\t\t\t\tfinal double mt = m1;\n\t\t\t\tm1 = m2;\n\t\t\t\tm2 = mt;\n\t\t\t}\n\t\t\t\n\t\t\t// compute the angle\n\t\t\treturn atan( ( m1 - m2 ) / ( 1 + m1 * m2 ) );\n\t\t}\n\t}", "public synchronized double measure(double value, long when) {\n // compute difference to last time in (seconds)\n double dt = (when - this.when) / 1000.0D;\n if (dt < 0) {\n // if the time is negative, we just skip computation (happens if NTP sets the clock back)\n } else if (dt == 0) {\n // if no time went by we have the special case where the average is just corrected\n this.average = value * (1.0 - this.kappa) + this.average;\n } else {\n // a positive dt means reevalute fully\t\t\t\n this.kappa = Math.exp(dt * this.ln_phi);\n this.average = value * (1.0 - this.kappa) + this.average * this.kappa;\n this.when = when;\n }\n return average;\n }", "private static String addCIExtremes(String theLine){\n\n\t\t//System.out.println(\"1: \" + theLine);\n\n\t\tString[] splitLine = theLine.split(\";\");\n\n\t\tif(splitLine.length <= 8){\n\n\t\t\ttry{\n\t\t\t\tdouble avg = Double.parseDouble(splitLine[6]);\n\t\t\t\tdouble ci = Double.parseDouble(splitLine[7]);\n\n\t\t\t\ttheLine += ((avg-ci) + \";\" + (avg+ci) + \";\");\n\n\t\t\t\t//System.out.println(\"2: \" + theLine);\n\t\t\t}catch(NumberFormatException e){\n\t\t\t\tSystem.out.println(\"Impossible to add CI extremes. Skipping.\");\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\t//System.out.println(\"3: \" + theLine);\n\n\t\treturn theLine;\n\n\t}", "public void updateOscilloscopeData() {\n rmsSum = 0;\n boolean overshoot = false;\n int reactorFrequency = getReactorFrequency().intValue();\n int reactorAmplitude = getReactorAmplitude().intValue();\n double reactorPhase = getReactorPhase().doubleValue();\n int controlFrequency = getControlFrequency().intValue();\n int controlAmplitude = getControlAmplitude().intValue();\n double controlPhase = getControlPhase().doubleValue();\n for (int i = 0; i < 40; i++) { \n Double reactorValue = reactorAmplitude * Math.sin(2 * Math.PI * reactorFrequency * ((double) i * 5 / 10000) + reactorPhase);\n Double controlValue = controlAmplitude * Math.sin(2 * Math.PI * controlFrequency * ((double) i * 5 / 10000) + controlPhase);\n if (reactorValue + controlValue > 150) {\n this.outputData.get(0).getData().get(i).setYValue(149);\n overshoot = true;\n } else if (reactorValue + controlValue < -150) {\n this.outputData.get(0).getData().get(i).setYValue(-149);\n overshoot = true;\n } else {\n this.outputData.get(0).getData().get(i).setYValue(reactorValue + controlValue);\n }\n if (this.online == true) {\n this.rmsSum = this.rmsSum + Math.pow(reactorValue + controlValue, 2);\n }\n }\n calculateOutputPower();\n checkForInstability(overshoot);\n }", "public Series removeDelayedTrend(int depth)\n {\n if(depth<1 || depth>=size)\n throw new IndexOutOfBoundsException();\n Series oscillator = new Series();\n oscillator.x = new double[oscillator.size = size - depth];\n if(oscillator.size>1)\n oscillator.r = new double[oscillator.size - 1];\n for(int t = 0; t<oscillator.size; t++)\n {\n oscillator.x[t] = x[t + depth] - movingAverage(depth, t + depth);\n if(t>0)\n oscillator.r[t - 1] = Math.log(oscillator.x[t]/oscillator.x[t - 1]);\n }\n return oscillator;\n }", "protected static float[] computeMovingAverage(float[] values, int np) {\n\t\tfloat[] mm = new float[values.length - np];\n\t\tfor (int i = 0; i < mm.length; i++) {\n\t\t\tfloat sum = 0;\n\t\t\tfor (int j = 0; j < np; j++) {\n\t\t\t\tsum = sum + values[i + j];\n\t\t\t}\n\t\t\tmm[i] = sum / np;\n\t\t}\n\t\treturn mm;\n\t}", "public Builder setAvgTreatment(double value) {\n \n avgTreatment_ = value;\n onChanged();\n return this;\n }" ]
[ "0.6408273", "0.5388387", "0.50075793", "0.48845273", "0.47046033", "0.469359", "0.46626016", "0.46207273", "0.45988655", "0.44616583", "0.44593862", "0.43690953", "0.43485478", "0.43134356", "0.43045345", "0.4300377", "0.42951757", "0.4273741", "0.42725843", "0.42520598", "0.42383763", "0.42378178", "0.42131665", "0.42059305", "0.4198376", "0.41867712", "0.41748545", "0.41736683", "0.41656718", "0.41606912", "0.41501978", "0.41314045", "0.41157955", "0.41148508", "0.4088727", "0.408294", "0.40766007", "0.40737614", "0.40696794", "0.40660024", "0.40658614", "0.40635192", "0.40571484", "0.40528107", "0.4051517", "0.4040501", "0.40212354", "0.40123957", "0.4011412", "0.4004237", "0.4001573", "0.40011597", "0.4000336", "0.3996876", "0.39961952", "0.39846635", "0.39844662", "0.3982661", "0.3980403", "0.39731818", "0.39663568", "0.3965337", "0.39627996", "0.39590663", "0.39584598", "0.3951746", "0.39506558", "0.39506334", "0.39505523", "0.3943651", "0.39342067", "0.39328304", "0.3931511", "0.39216194", "0.39088914", "0.39063573", "0.3904588", "0.39045385", "0.38995573", "0.38980123", "0.38909248", "0.3889123", "0.38878012", "0.38871798", "0.38822865", "0.38822195", "0.38805035", "0.38743788", "0.387182", "0.3867198", "0.3857129", "0.38520986", "0.38509917", "0.38507488", "0.38472313", "0.3845813", "0.38440958", "0.38428012", "0.38427848", "0.3841824" ]
0.6478376
0
Computes the momentum technical indicator.
public double momentum(int periods, int t) { if(periods>t || periods<1) throw new IndexOutOfBoundsException("Momentum(" + periods + ") is undefined at time " + t); return x[t] - x[t - periods]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract double getCarbon();", "double getAcceleration ();", "public abstract float getMomentOfInertia();", "@Override\n\tpublic double getCarbon() {\n\t\treturn 0;\n\t}", "Measurement getAccumulation();", "public Momentum() {\r\n m1 = m2 = v1 = v2 = p1 = p2 = comx = cv = 0.0;\r\n xp1 = 0.0;\r\n xp2 = 900.0;\r\n m1 = 2.0;\r\n m2 = 1.0;\r\n v1 = 1.0;\r\n v2 = -1.0;\r\n\r\n //m1 = m2 = 1.0;\r\n //v1 = 2.0;\r\n //v2 = -4.0;\r\n d = dc = 8.0;\r\n }", "public Double getCarbon() {\n return product.getCarbon() * weight / 100;\n }", "FloatResource temperatureCoefficient();", "public double masse () {return this.volume()*this.element.masseVolumique();}", "public abstract Double getMontant();", "public abstract double getPreis();", "public void calcInc(int np)\n\t{\n \n findSpecEq();\n int nofc=numberOfComponents;\n fvec.timesEquals(0.0);\n fvec.set(nofc+1,0,1.0);\n Matrix dxds=Jac.solve(fvec);\n if (np<5)\n {\n double dp=0.01;\n ds=dp/dxds.get(nofc+1,0);\n Xgij.setMatrix(0,nofc+1,np-1,np-1,u);\n dxds.timesEquals(ds);\n // dxds.print(0,10);\n u.plusEquals(dxds);\n // Xgij.print(0,10);\n// u.print(0,10);\n }\n else\n {\n //System.out.println(\"iter \" +iter + \" np \" + np);\n if (iter>6)\n { \n ds *= 0.5;\n System.out.println(\"ds > 6\");\n }\n \n else\n {\n if (iter<3) {\n ds *= 1.5;\n }\n if (iter==3) {\n ds *= 1.1;\n }\n if (iter==4) {\n ds *= 1.0;\n }\n if (iter>4) {\n ds *= 0.5;\n }\n \n// Now we check wheater this ds is greater than dTmax and dPmax.\n if(Math.abs(system.getTemperature()*dxds.get(nofc,0)*ds)>dTmax){\n // System.out.println(\"true T\");\n ds=sign(dTmax/system.getTemperature()/Math.abs(dxds.get(nofc,0)),ds);\n }\n \n if(Math.abs(system.getPressure()*dxds.get(nofc+1,0)*ds)>dPmax)\n {\n ds=sign(dPmax/system.getPressure()/Math.abs(dxds.get(nofc+1,0)),ds);\n // System.out.println(\"true P\");\n }\n if (etterCP2) {\n etterCP2=false;\n ds = 0.5*ds;\n }\n \n Xgij.setMatrix(0,nofc+1,0,2,Xgij.getMatrix(0,nofc+1,1,3)); \n Xgij.setMatrix(0,nofc+1,3,3,u);\n s.setMatrix(0,0,0,3,Xgij.getMatrix(speceq,speceq,0,3));\n // s.print(0,10);\n // System.out.println(\"ds1 : \" + ds);\n calcInc2(np);\n // System.out.println(\"ds2 : \" + ds);\n \n// Here we find the next point from the polynomial.\n \n }\n }\n }", "private int[] calculateMomentum(byte state){\n //pull out each particle.\n\n //each particle has an x and y momentum based on its direction\n //1 x = 1, y = 0\n //2 x = cos(pi/3), y = sin(pi/3)\n //3 x = cos(2pi/3), y = sin(2pi/3)\n //4 x = -1, y = 0\n //5 x = cos(4pi/3), y = sin(4pi/3)\n //6 x = cos(5pi/3), y = sin(5pi/3)\n\n\n// double x = 0.0;\n// double y = 0.0;\n//\n// double arg = 0.0;\n// for(int n = 0; n < SMASKS.length; n++){\n// if((incomingState & SMASKS[n]) == SMASKS[n]){\n// arg = (n*Math.PI)/3;\n// x += BigDecimal.valueOf(Math.cos(arg)).setScale(5, BigDecimal.ROUND_DOWN).doubleValue();\n// y += BigDecimal.valueOf(Math.sin(arg)).setScale(5, BigDecimal.ROUND_DOWN).doubleValue();\n// }\n// }\n// return new double[]{x, y};\n\n //each particle has an x and y momentum based on its direction\n //1 x = 100, y = 0000\n //2 x = 050, y = 087\n //3 x = -050, y = 087\n //4 x = -100, y = 000\n //5 x = -050, y = -087\n //6 x = 050, y = -087\n\n int x = 0;\n int y = 0;\n\n for(int n = 0; n < SMASKS.length; n++){\n if((state & SMASKS[n]) == SMASKS[n]){\n x += xm[n];\n y += ym[n];\n }\n }\n return new int[]{x, y};\n }", "private float horisontalTicker() {\n\t\t\t\treturn (ticker_horisontal += 0.8f);\n\t\t\t}", "public double getVelocityRPM();", "float getNominalVoltageOutOfPhase();", "public float getDisp();", "protected void calcVelocity()\n\t{}", "Double getPreStress();", "@Override\n public Float compute() {\n\treturn calc();\n }", "public abstract double getMeasurement();", "public abstract double getMeasurement();", "public double getAtomicWeight() {\n }", "public static double thermalCaloriesToElectronVolts(double num){ return (num*9.223*Math.exp(18)); }", "public double get_thermal_reading() {\n\t\t\n\t\treturn 0;\n\t}", "abstract public double compute(Composition comp, double e0);", "@Override\n\tpublic double getMontant() {\n\t\treturn 0;\n\t}", "public double ElectricCurrent() {\n return OCCwrapJavaJNI.Units_Dimensions_ElectricCurrent(swigCPtr, this);\n }", "abstract double calculateCurrentDiscountRate();", "public float getVolum() {\n return volum;\n }", "float getSurfaceVolatility();", "public abstract double calcVolume();", "public abstract double calcVolume();", "@Override\n public double getCONSUMPTION() {\n if (status && brightValue != 0) {\n this.consumption = (super.DEFAULTCONSUMPTION + 2) + (brightValue / 100);\n } else if (status) {\n this.consumption = super.DEFAULTCONSUMPTION + 2;\n } else if (status != true) {\n this.consumption = super.DEFAULTCONSUMPTION;\n }\n\n return consumption;\n }", "protected abstract float getMeasurement();", "@Override\n\tpublic void calcularVolume() {\n\t\t\n\t}", "float getPreGain();", "public double calculateVelocity(){\n double storyPoints = 0.0; // number of story points completed in total\n double numWeeks = BoardManager.get().getCurrentBoard().getAge()/7.0;\n LinkedList<Card> allCompletedCards = BoardManager.get().getCurrentBoard().getCardsOf(Role.COMPLETED_WORK);\n for (Card card : allCompletedCards) {\n storyPoints += card.getStoryPoints();\n }\n if (storyPoints == 0.0){\n return 0.0;\n }\n return Math.round(storyPoints/numWeeks * 100D) / 100D;\n }", "public double getMon603r1() {\r\n\t\treturn mon603r1;\r\n\t}", "public double getTemp(){\n return currentTemp;\n }", "ObjectProperty<Double> criticalLowProperty();", "int getExposureCompensationPref();", "private void calcCalories()\n\t{\n\t\tif (getIntensity() == 1)\n\t\t{\n\t\t\tbikeCal = 10 * bikeTime; \n\t\t}\n\t\telse if (getIntensity() == 2)\n\t\t{\n\t\t\tbikeCal = 14.3 * bikeTime; \n\t\t}\n\t\telse {\n\t\t\tJOptionPane.showMessageDialog(null, \"error\");\n\t\t}\n\t}", "public double getAcceleration() {\r\n return acceleration;\r\n }", "double compute() {\r\ndouble b, e;\r\nb = (1 + rateOfRet/compPerYear);\r\ne = compPerYear * numYears;\r\nreturn principal * Math.pow(b, e);\r\n}", "public double getResistance() \n {\n //dummy return value.\n return 0;\n }", "private double calcuCMetric() {\n\t\treturn (p-1)/fcost;\n\t}", "public double getObjective() {\n return multiClassClassifierObj() + binaryObj();\n// +(1-temperature)*getEntropy();\n }", "public double getAcceleration() {\n return acceleration;\n }", "ObjectProperty<Double> criticalHighProperty();", "public void updateLorenzoIndicator(int indicator){\n\n }", "public Double getConcentration();", "Double getTensionForce();", "@Override\n public double getMeasure() {\n return getFuelEffieciency();\n }", "float getMainUtteranceDynamicGain();", "float getTemperature();", "double angMomentum();", "public double getMon603r() {\r\n\t\treturn this.mon603r;\r\n\t}", "private void calculateVolume() {\n\n\t\t/*\n\n\t\t */\n\t\tfor(int i=0; i<this._prismoidsLength.size(); i++) \n\t\t\tthis._prismoidsVolumes.add(\n\t\t\t\t\tAmount.valueOf(\n\t\t\t\t\t\t\tthis._prismoidsLength.get(i).divide(3)\n\t\t\t\t\t\t\t.times(\n\t\t\t\t\t\t\t\t\tthis._prismoidsSectionsAreas.get(i).getEstimatedValue()\n\t\t\t\t\t\t\t\t\t+ this._prismoidsSectionsAreas.get(i+1).getEstimatedValue()\n\t\t\t\t\t\t\t\t\t+ Math.sqrt(\n\t\t\t\t\t\t\t\t\t\t\tthis._prismoidsSectionsAreas.get(i)\n\t\t\t\t\t\t\t\t\t\t\t.times(this._prismoidsSectionsAreas.get(i+1))\n\t\t\t\t\t\t\t\t\t\t\t.getEstimatedValue()\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t).getEstimatedValue(),\n\t\t\t\t\t\t\tSI.CUBIC_METRE\n\t\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\n\t\tfor(int i=0; i<this._prismoidsVolumes.size(); i++)\n\t\t\tthis._fuelVolume = this._fuelVolume\n\t\t\t\t\t\t\t\t\t\t.plus(this._prismoidsVolumes.get(i));\n\t\tthis._fuelVolume = this._fuelVolume.times(2);\n\t\t\n\t}", "@Override\r\n\tdouble getBonificacao() {\n\t\treturn 0;\r\n\t}", "double getPressure();", "@ComputerMethod\n private FloatingLong getEnergyUsage() {\n return getActive() ? energyContainer.getEnergyPerTick() : FloatingLong.ZERO;\n }", "@Override \n\tpublic void periodic() {\n\t\tSmartDashboard.putBoolean(\"Mod 0 Motor Inversion\", mSwerveModules[0].getDriveMotor().getInverted());\n\t\tSmartDashboard.putBoolean(\"Mod 1 Motor Inversion\", mSwerveModules[1].getDriveMotor().getInverted());\n\t\tSmartDashboard.putBoolean(\"Mod 2 Motor Inversion\", mSwerveModules[2].getDriveMotor().getInverted());\n\t\tSmartDashboard.putBoolean(\"Mod 3 Motor Inversion\", mSwerveModules[3].getDriveMotor().getInverted());\n\t\tSmartDashboard.putNumber(\"Mod 0 Angle\", mSwerveModules[0].getCurrentAngle());\n\t\tSmartDashboard.putNumber(\"Mod 1 Angle\", mSwerveModules[1].getCurrentAngle());\n\t\tSmartDashboard.putNumber(\"Mod 2 Angle\", mSwerveModules[2].getCurrentAngle());\n\t\tSmartDashboard.putNumber(\"Mod 3 Angle\", mSwerveModules[3].getCurrentAngle());\n\t\tSmartDashboard.putNumber(\"Encoder Ticks in Inches: \", mSwerveModules[3].getInches());\n\t}", "public float getVolumeMultiplier();", "EDataType getReactivePower();", "float getVacationAccrualRate();", "@Override\n\tpublic double calculaImc() {\n\t\t imc = peso / (altura * altura);\n\t\treturn imc;\n\t}", "public double getPetroleumIntensityOfElectricityProduction() {\r\n\t\treturn petroleumIntensityOfElectricityProduction;\r\n\t}", "public double getFluctuation() { return fluctuation; }", "public Double getCarbonMonoxideConcentration() {\n return carbonMonoxideConcentration;\n }", "public void cal_AdjustedFuelMoist(){\r\n\tADFM=0.9*FFM+0.5+9.5*Math.exp(-BUO/50);\r\n}", "float getVoltageStepIncrementOutOfPhase();", "public double getTemperature() {return temperature;}", "public double getInitialElectricityProduction() {\r\n\t\treturn initialElectricityProduction;\r\n\t}", "public double getEnergy(){\n\t\t return energy;\n\t}", "public double getCurrentFuel();", "private VibrationEffect getVibrationEffect() {\n return VibrationEffect.startComposition()\n .addPrimitive(VibrationEffect.Composition.PRIMITIVE_THUD, 1.0f, 50)\n .compose();\n }", "public double getEnergy() { return energy; }", "@Override\n\tpublic double getRealDispersion() {\n\t\treturn 0;\n\t}", "public double getMon603a1() {\r\n\t\treturn mon603a1;\r\n\t}", "public double[] getCurrentMotorVelocitiesInCentimetersPerSecond()\n {\n return finchController.getCurrentMotorVelocitiesInCentimetersPerSecond();\n }", "public double getCoefficient();", "public double getVelocity() {\n return mV;\n }", "@Override\r\n double computeAccelerations() {\r\n double potentialEnergy;\r\n \r\n potentialEnergy = computeWallForces();\r\n assignMoleculesToCells(); \r\n potentialEnergy += computeForcesWithinCells();\r\n potentialEnergy += computeForcesWithNeighbourCells();\r\n \r\n return potentialEnergy;\r\n }", "public double getNu() {return nu;}", "@ComputerMethod\n private FloatingLong getEnergyUsage() {\n return energyContainer.getEnergyPerTick();\n }", "public IntegerProperty getTemp() {\n\t\treturn temperature;\n\t}", "public float obtenMotor(){\r\n return this.motor;\r\n }", "public double getCyclinderVolume();", "@Override\n\tpublic double calRate() {\n\t\treturn 0.9f;\n\t}", "int getEnergy();", "public void calculateMMage() {\n\t\t\n\t}", "public float getCohesion() {\n\treturn 0;\n }", "private double getRecEnergy(){\n\t\tdebugMatrix = new double[CELL_SIDE_COUNT][CELL_SIDE_COUNT];\n\t\tconvolutedMatrix = new Complex[CELL_SIDE_COUNT][CELL_SIDE_COUNT];\n\t\t//initiliaze the whole convolutedMatrix array to zero\n\t\tfor(int x = 0; x < CELL_SIDE_COUNT; x++)\n\t\t{\n\t\t\tfor(int y = 0; y < CELL_SIDE_COUNT; y++)\n\t\t\t{\n\t\t\t\tconvolutedMatrix[x][y] = Complex.zero;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Pg. 180 Lee[05]\n\t\tint indexTop = CELL_SIDE_COUNT * CELL_SIDE_COUNT;\n\t\t//Eq 19 Lee[05]\n\t\t//Also Eq 3.9 Essman[95]\n\t\tdouble sum = 0;\n\t\tint indtop = CELL_SIDE_COUNT * CELL_SIDE_COUNT;\n\t\tint midPoint = CELL_SIDE_COUNT / 2;\n\t\tif (midPoint << 1 < CELL_SIDE_COUNT) {\n\t\t\t++midPoint;\n\t\t}\n\t\t\n\t\tfor (int ind = 1; ind <= (indtop - 1); ++ind) {\n\t\t\t\n\t\t\tint y = ind / CELL_SIDE_COUNT + 1;\n\t\t\tint x = ind - (y - 1) * CELL_SIDE_COUNT + 1;\n\t\t\tint mXPrime = x - 1;\n\t\t\tif (x > midPoint) {\n\t\t\t\tmXPrime = x - 1 - CELL_SIDE_COUNT;\n\t\t\t}\n\t\t\tint mYPrime = y - 1;\n\t\t\tif (y > midPoint) {\n\t\t\t\tmYPrime = y - 1 - CELL_SIDE_COUNT;\n\t\t\t}\n\t\t\tdouble m = mXPrime * 1.0 + mYPrime * 1.0; //Was inverseMeshWidth - theory is reciprocal lattice vectors are for the entire cell U rather than one cell\n\t\t\tdouble mSquared = squared(mXPrime * 1.0) + squared(mYPrime * 1.0);\n\t\t\t\n\t\t\tdouble V = 1; //working in the unit mesh\n\t\t\tdouble bterm = M.bspmod[x]*M.bspmod[y];\n\t\t\tdouble eterm = Math.exp(-squared(Math.PI/ewaldCoefficient)*mSquared) / (bterm * Math.PI * V * mSquared);\n\t\t\t//Section 3.2.8 Lee[05]\n\t\t\tdouble inverseQPart = (squared(inverseFTQComplex[x-1][y-1].re())+squared(inverseFTQComplex[x-1][y-1].im())); //Lee[05]\n\t\t\tdouble thisContribution = eterm * inverseQPart;\n\t\t\tconvolutedMatrix[x-1][y-1] = inverseFTQComplex[x-1][y-1].scale(eterm); //Save this for the force calculation\n\t\t\tsum += thisContribution; //from the argument that F(Q(M))*F(Q(-M))=F-1(Q)^2\n\t\t}\n\t\treturn 0.5*sum;\n\t}", "public Vector2D getAcceleration()\n\t{\n\t\treturn acceleration;\n\t}", "public double initialNotional()\n\t{\n\t\treturn _lsPeriod.get (0).baseNotional();\n\t}", "public double getMon603a() {\r\n\t\treturn this.mon603a;\r\n\t}", "public float getEnergyRate() { return EnergyRate; }", "public double mleVar() {\n\t\tint n = this.getAttCount();\n\t\tif (n == 0) return Constants.UNUSED;\n\n\t\tdouble mean = mean();\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdouble v = this.getValueAsReal(i);\n\t\t\tdouble deviation = v - mean;\n\t\t\tsum += deviation * deviation;\n\t\t}\n\t\treturn sum / (double)n;\n\t}", "VariableAmount getExtremeSpikeIncrease();" ]
[ "0.5842511", "0.5621919", "0.55915004", "0.54739785", "0.53959656", "0.5384035", "0.5352019", "0.5313902", "0.5301976", "0.5283968", "0.52585053", "0.52410376", "0.52403766", "0.5226403", "0.5222235", "0.52209216", "0.5213842", "0.5205169", "0.51634383", "0.5163087", "0.5155868", "0.5155868", "0.51504993", "0.5144447", "0.5140738", "0.51384014", "0.51180077", "0.5108576", "0.5105583", "0.50995463", "0.5095312", "0.5092653", "0.5092653", "0.50882196", "0.50856453", "0.5070888", "0.50707716", "0.50658613", "0.5021987", "0.50217706", "0.50158024", "0.50129414", "0.50099415", "0.50077736", "0.5005167", "0.50007886", "0.49864835", "0.4980923", "0.4968647", "0.49615237", "0.4950573", "0.49486265", "0.49415848", "0.49409547", "0.49380016", "0.4935413", "0.4927121", "0.49241155", "0.49164328", "0.49151784", "0.49134904", "0.49121818", "0.49119964", "0.49112776", "0.49097705", "0.4909653", "0.49090555", "0.48980156", "0.48977086", "0.48859686", "0.48847228", "0.48844534", "0.48835585", "0.4879821", "0.48687628", "0.4866714", "0.4861181", "0.48582703", "0.4851215", "0.48489523", "0.48434705", "0.48365504", "0.4834599", "0.48320803", "0.483137", "0.48260748", "0.48255777", "0.4822902", "0.48166066", "0.48155951", "0.48150706", "0.48131073", "0.48059577", "0.48045975", "0.47987694", "0.47981733", "0.47980437", "0.47978854", "0.4792699", "0.47894958" ]
0.48180455
88
Computes the rate of change (or ROC) technical indicator.
public double rateOfChange(int periods, int t) { if(periods>t || periods<1) throw new IndexOutOfBoundsException("ROC(" + periods + ") is undefined at time " + t); return 100.0*(x[t] - x[t - periods])/x[t - periods]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract double calculateCurrentDiscountRate();", "float getVacationAccrualRate();", "public abstract double getDiscountRate();", "double getRate();", "@Override\n\tpublic double calRate() {\n\t\treturn 0.9f;\n\t}", "public double getRate() {\r\n\t\treturn (getRate(0)+getRate(1))/2.0;\r\n\t}", "public double getRate( ) {\nreturn monthlyInterestRate * 100.0 * MONTHS;\n}", "double calculateRate(Temperature temperature, double Hrxn);", "public double getInterest(){return this.interest_rate;}", "public static final double internalRateOfReturn (\n double irrEstimate,\n double [ ] cashFlows )\n //////////////////////////////////////////////////////////////////////\n {\n double irr = irrEstimate;\n\n double delta = -irr * 0.1;\n\n double oldNpv = 0.0;\n\n while ( true )\n {\n double npv = netPresentValue ( irr, cashFlows );\n\n if ( npv == 0.0 )\n {\n return irr;\n }\n\n if ( oldNpv < 0.0 )\n {\n if ( npv > 0.0 )\n {\n delta *= -0.9;\n }\n else if ( npv > oldNpv )\n {\n delta *= 1.1;\n }\n else if ( npv < oldNpv )\n {\n delta = -delta;\n }\n else\n {\n delta = 0.0;\n }\n }\n else if ( oldNpv > 0.0 )\n {\n if ( npv < 0.0 )\n {\n delta *= -0.9;\n }\n else if ( npv < oldNpv )\n {\n delta *= 1.1;\n }\n else if ( npv > oldNpv )\n {\n delta = -delta;\n }\n else\n {\n delta = 0.0;\n }\n }\n\n/*\nSystem.out.println ( \"irr = \" + irr + \", oldNpv = \" + oldNpv + \", npv = \" + npv + \", delta = \" + delta );\n\ntry{\nnew BufferedReader ( new InputStreamReader ( System.in ) ).readLine ( );\n}catch (Exception x ) { }\n*/\n\n if ( delta == 0.0 )\n {\n return irr;\n }\n\n irr += delta;\n\n oldNpv = npv;\n }\n }", "@Override\n\tpublic double getRate() {\n\t\treturn 7;\n\t}", "@Override\n public int accion() {\n return this.alcance*2/3*3;\n }", "public double calculateRate() {\n\t\tdouble rate = 0;\n\t\tfor (int i = 0; i < upgrades.size(); i++) {\n\t\t\trate += upgrades.get(i).getProduction();\n\t\t}\n\t\tbrain.setRate(rate);\n\t\treturn rate;\n\t}", "public double discountRate () {\n return discountRate;\n }", "double getTransRate();", "public double getRate() {\n return rate;\n }", "public double getRate() {\n return rate;\n }", "public float getRate() {\n\treturn durationStretch * nominalRate;\n }", "public Integer getRate() {\r\n return rate;\r\n }", "public float getRate(){\r\n return rate;\r\n }", "@Override\n\tpublic float calculateRunRate() {\n\t\tint remaingrun=Math.abs((super.getTarget()-super.getCurrentscore()));\n\t\tfloat remaingOver=20-super.getCurrentover();\n\t\treturn remaingrun/remaingOver;\n\t}", "public double getRate() {\n\t\treturn rate;\n\t}", "public static double getInterestRate(){\n\t\t return interest_rate;\r\n\t }", "private void determinationExciseRate(Vehicle vehicle) {\n if (vehicle.getEngineType().name().equals(\"petrol\") && vehicle.getCapacity() <= 3000) {\n vehicle.setExciseRate(serviceForNumber.roundingNumber(\n (double) 50 / 1000 * vehicle.getAgeCoefficient(),\n 2));\n\n } else if (vehicle.getEngineType().name().equals(\"petrol\") && vehicle.getCapacity() > 3000) {\n vehicle.setExciseRate(serviceForNumber.roundingNumber(\n (double) 100 / 1000 * vehicle.getAgeCoefficient(),\n 2));\n\n } else if (vehicle.getEngineType().name().equals(\"diesel\") && vehicle.getCapacity() <= 3500) {\n vehicle.setExciseRate(serviceForNumber.roundingNumber(\n (double) 75 / 1000 * vehicle.getAgeCoefficient(),\n 2));\n\n } else if (vehicle.getEngineType().name().equals(\"diesel\") && vehicle.getCapacity() > 3500) {\n vehicle.setExciseRate(serviceForNumber.roundingNumber(\n (double) 150 / 1000 * vehicle.getAgeCoefficient(),\n 2));\n\n } else if (vehicle.getEngineType().name().equals(\"electric\")) {\n vehicle.setExciseRate(1);\n }\n }", "public Double getChange();", "public java.math.BigDecimal getIndicativeExchangeRate() {\r\n return indicativeExchangeRate;\r\n }", "public int getRate() {\n return rate_;\n }", "@Override\n\tpublic float calculateRunRate() {\n\t\tint remaingrun=Math.abs((super.getTarget()-super.getCurrentscore()));\n\t\tfloat remaingOver=50-super.getCurrentover();\n\t\treturn remaingrun/remaingOver;\n\t}", "@Override\n\tpublic float calculateRunRate() {\n\t\tint remaingrun=Math.abs((super.getTarget()-super.getCurrentscore()));\n\t\tfloat remaingOver=30-super.getCurrentover();\n\t\treturn remaingrun/remaingOver;\n\t}", "public double getRise(\n )\n {return rise;}", "public double getInterestRate(){\n return interestRate;\n }", "public void updateRate(double r){\r\n rate *= r;\r\n }", "public int getChargeRate();", "public Rate rate() {\n _initialize();\n return rate;\n }", "@Override\n public double getDiscount() {\n return (30 /(1 + Math.exp(-1 * (this.years - 2) )))/100;\n }", "public double getInterestRate(){\n return annualInterestRate;\n }", "public double getAccruedInterest() {\n return _accruedInterest;\n }", "public double getAccruedInterest() {\n return _accruedInterest;\n }", "double getDiscountRate(int catalog_id, int customer_acc_no);", "public abstract double calcAvRating();", "public int getRate() {\n return rate_;\n }", "public Double getChange(int in);", "public double calculateRecall() {\n final long divisor = truePositive + falseNegative;\n if(divisor == 0) {\n return 0.0;\n } else {\n return truePositive / (double)divisor;\n }\n }", "@Override\n\tint getRateOfInterest() {\n\t\treturn 7;\n\t}", "public void setRate(double annualRate) {\nmonthlyInterestRate = annualRate / 100.0 / MONTHS;\n}", "public double getInterest()\n {\n return interestRate;\n }", "public float getRate() {\n\t\treturn rate;\n\t}", "public double rating() {\r\n double value = BASE_RATING * specialization * (1 / (1 + era)) \r\n * ((wins - losses + saves) / 30.0);\r\n return value;\r\n }", "public double impurity();", "public double tradeRate()\n\t{\n\t\treturn _dblTradeRate;\n\t}", "public BigDecimal getEXCH_RATE() {\r\n return EXCH_RATE;\r\n }", "public double getDiscountRate(){\n\t\t//only valid choices are 0 (std), 1(senior), 2(pref cust)\n\t\tDISCOUNT_RATE = 0.05;\n\t\tswitch (discount_type) {\n\t\t case 0:\n\t\t\t break;\n\t\t case 1:\n\t\t\t DISCOUNT_RATE += .10;\n\t\t break;\n\t\t case 2:\n\t\t ;\n\t\t DISCOUNT_RATE += .15;\n\t\t break;\n\t\t default:\n\t\t System.out.println(\"Invalid Discout Type. Only standard discount will be applied\");\n\t\t}\n\t\treturn DISCOUNT_RATE; \n\t}", "public double discountedPrice (){\n return basePrice - basePrice * discountRate;\n }", "public interface IRate {\n\t\n\t//writing the class outline\n\tpublic void setRate();\n\tpublic void increaseRate();\n}", "abstract protected BigDecimal getBasicTaxRate();", "public double getInterestRate()\n {\n return this.interestRate;\n }", "protected abstract Double getRate(T object);", "public double getInterestRate() {\n return interestRate;\n }", "@Override\n public double computeProfitUsingRisk() {\n return (getVehiclePerformance() / getVehiclePrice()) * evaluateRisk();\n }", "float getPreGain();", "@Override\n\tpublic double calcDiscount() {\n\t\treturn discount;\n\t}", "public float getPeriodicRateChange() {\n return periodicRateChange;\n }", "public abstract double getDepositDiscount();", "public abstract double getPreis();", "private Double getAdjRelativeRate(CurrencyType curr, int asOfDate, int interval) {\n CurrencySnapshot snap = curr.getSnapshotForDate(asOfDate);\n if (snap != null) {\n int snapDate = snap.getDateInt();\n // System.err.println(curr+\" \"+asOfDate+\" \"+interval+\" \"+snap);\n // First look in interval before the date: (T-I .. T]\n if ((DateUtil.incrementDate(asOfDate, 0, 0, -interval) < snapDate) && (snapDate <= asOfDate)) {\n return 1.0 / curr.adjustRateForSplitsInt(snapDate, snap.getRate());\n }\n // Now look in interval after the date: [T .. T+I)\n snap = curr.getSnapshotForDate(asOfDate + interval);\n if ((snap != null)\n && (asOfDate <= snapDate)\n && (snapDate < DateUtil.incrementDate(asOfDate, 0, 0, interval))) {\n return 1.0 / curr.adjustRateForSplitsInt(snapDate, snap.getRate());\n }\n }\n // No rate in interval\n return Double.NaN;\n }", "public abstract void setRate();", "public double getDiscount();", "float getDiscount();", "double calculateNewPrice(double discount_rate, double price);", "protected double getDataRate() {\n\t\treturn (double) getThroughput() / (double) getElapsedTime();\n\t}", "public void setRate();", "public float getCountRate() {\n return countMonitor.getRate();\n }", "double getReliability();", "public void InterestRate() {\n\t\t\tSystem.out.println(\"9 percent\");\n\t\t}", "public double getDiscountRate() {\n\t return discountRate;\n\t}", "double getChangePercent() {\n\t return 100 - (currentPrice * 100 / previousClosingPrice);\n\t }", "public double calcInterest(){\n double interest = (interestRate + 1) * balance;\n return interest;\n }", "public Double getReturnRate() {\r\n return returnRate;\r\n }", "public static double getXoRate() {\n\t\treturn xoRate;\n\t}", "int getMortgageRate();", "public int getCustomInformationTransferRate();", "public double getConversionRate() {\n return conversionRate;\n }", "@java.lang.Override\n public float getVacationAccrualRate() {\n return vacationAccrualRate_;\n }", "public double getReturnRate() {\n return returnRate;\n }", "@Override\n\tpublic double calcCompound(double amt, int year, float rate) {\n\t\tdouble ci = amt * Math.pow((1 + rate / 100), 2);\n\t\treturn ci-amt;\n\t}", "public double updateCosts( ) {\n\t\tif (BenefitDetails.getsDiscount(fname, lname)) {\n\t\t\tyearlyBenefitCost = BenefitDetails.dependentRate * BenefitDetails.discount;\n\t\t} else {\n\t\t\tyearlyBenefitCost = BenefitDetails.dependentRate;\n\t\t}\n\n\t\treturn yearlyBenefitCost;\n\t}", "public double calcAnnualIncome()\r\n {\r\n return ((hourlyWage * hoursPerWeek * weeksPerYear) * (1 - deductionsRate));\r\n }", "public abstract double applyDiscount(double p);", "@Override\r\n\tpublic double rideFare() {\r\n\t\tdouble trafficRate = 1;\r\n\t\tswitch(this.getTrafficKind()) {\r\n\t\t case Low:\r\n\t\t\ttrafficRate = 1;break;\r\n\t\t\tcase Medium:\r\n\t\t\t\ttrafficRate = 1.1;break;\r\n\t\t\tcase High:\r\n\t\t\t\ttrafficRate = 1.5;break;\r\n\t\t}\r\n\t\tdouble basicRate = 0;\r\n\t\tif (this.getLength() <5) { \r\n\t\t\tbasicRate = 3.3;\r\n\t\t} else if (10 > this.getLength()){\r\n\t\t\tbasicRate = 4.2;\r\n\t\t} else if (this.getLength() <20){\r\n\t\t\tbasicRate = 1.91;\r\n\t\t} else {\r\n\t\t\tbasicRate = 1.5;\r\n\t\t}\r\n\t\t\r\n\t\treturn basicRate * trafficRate * this.getLength();\r\n\t}", "public double getCoolingRate() {\r\n\t\treturn this.coolingRate;\r\n\t}", "String getReviewrate();", "Measurement getAccumulation();", "protected void onChange_EncounterRate() {\n onChange_EncounterRate_xjal( EncounterRate );\n }", "public double getAnnualInterestRate() {\n return annualInterestRate;\n }", "public double getAnnualInterestRate() {\n return annualInterestRate;\n }", "public double taxCharged (){\n return discountedPrice() * taxRate;\n }", "@java.lang.Override\n public float getVacationAccrualRate() {\n return vacationAccrualRate_;\n }", "public static void updateCalorieRate(Person person) {\n\n double calorieRate = person.getCalorieRate();\n updatePerson(person, \"usercaloryrate\", calorieRate);\n }", "@Override\r\n\tpublic double getRx() {\n\t\treturn 2 * this.a;\r\n\t}", "public Double getCalories() {\n return product.getCalories() * weight / 100;\n }" ]
[ "0.71553296", "0.6922983", "0.6765091", "0.67244434", "0.66893506", "0.6533797", "0.626141", "0.62270856", "0.6212958", "0.62019116", "0.61990136", "0.61549115", "0.615388", "0.6125401", "0.6111512", "0.6106158", "0.6106158", "0.6076298", "0.6076096", "0.60693413", "0.60600364", "0.6032932", "0.6021266", "0.60101175", "0.5991993", "0.5969966", "0.5951327", "0.59480584", "0.5945475", "0.59452224", "0.59370345", "0.5936541", "0.59361047", "0.59292287", "0.5926104", "0.5919761", "0.5914496", "0.5914496", "0.5913488", "0.5913142", "0.59093547", "0.59040326", "0.590039", "0.588048", "0.58659536", "0.5835368", "0.5827305", "0.58169806", "0.5814439", "0.5805468", "0.5799583", "0.5797921", "0.5790822", "0.57861185", "0.57713056", "0.575568", "0.5751221", "0.5750778", "0.5729037", "0.5728606", "0.5725016", "0.5722932", "0.5721572", "0.5720428", "0.57170355", "0.5716098", "0.5712327", "0.5709933", "0.5707002", "0.5702815", "0.5696954", "0.5690005", "0.5683215", "0.5676249", "0.5675642", "0.5658589", "0.56585824", "0.56553745", "0.5638166", "0.5633226", "0.56315184", "0.5613271", "0.5610961", "0.56070125", "0.5596631", "0.5589386", "0.5576446", "0.55727595", "0.55705905", "0.5544185", "0.55437785", "0.5543478", "0.55415666", "0.5538783", "0.5538783", "0.55366725", "0.5534713", "0.5530101", "0.55271655", "0.5499399" ]
0.58961135
43
Computes the relative strength index (RSI) with the given number of periods.
public double relativeStrengthIndex(int periods, int t) { double rs = upward().expMovingAverage(periods, t - 1)/downward().expMovingAverage(periods, t - 1); return 100.0 - 100.0/(1 + rs); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getRSI(double[] hArr) throws Exception {\n\t\tdouble up=0;\n\t\tdouble down=0;\n\t\tSystem.out.println(\"plz\" + hArr.length + \"?\" + period_day);\n\t\tfor(int i = 0; i < period_day; i++) {\n\t\t\t\n\t\t\tif(hArr[i] < hArr[i+1]) {\n\t\t\t\tup += hArr[i+1] - hArr[i];\n\t\t\t}\n\t\t\telse if(hArr[i] > hArr[i+1]){\n\t\t\t\tdown += hArr[i] - hArr[i+1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tdouble RS = (up/period_day) / (down/period_day);\n\t\t\n\t\tdouble RSI = up / (up+down) * 100.0;\n\t\tRSI = 100 - (100 / (1 + RS));\n\t\t//System.out.println(\"RSI test cnt : \" + cnt);\n\t\treturn RSI;\n\t}", "@Test\n public void getSecurityPriceTechnicalsRsiTest() throws ApiException, NoSuchMethodException {\n String identifier = null;\n Integer period = null;\n String priceKey = null;\n String startDate = null;\n String endDate = null;\n Integer pageSize = null;\n String nextPage = null;\n ApiResponseSecurityRelativeStrengthIndex response = api.getSecurityPriceTechnicalsRsi(identifier, period, priceKey, startDate, endDate, pageSize, nextPage);\n\n // TODO: test validations\n }", "public static void calculateRsiForDataSet(List<CandleStick> rsiCandleSticksList, int duration) {\n\t\tif (duration >= rsiCandleSticksList.size())\n\t\t\treturn;\n\t\tdouble sessionGainSum = 0;\n\t\tdouble sessionLossSum = 0;\n\t\tdouble sessionChange;\n\t\tfor (int i = 1; i <= duration; i++) { // calculate first RSI.\n\t\t\tsessionChange = rsiCandleSticksList.get(i).getClose() - rsiCandleSticksList.get(i - 1).getClose();\n\t\t\tif (sessionChange > 0) {\n\t\t\t\tsessionGainSum += sessionChange;\n\t\t\t} else {\n\t\t\t\tsessionLossSum += sessionChange;\n\t\t\t}\n\t\t}\n\t\tdouble averageGain = sessionGainSum / duration;\n\t\tdouble averageLoss = sessionLossSum / duration;\n\t\tdouble rs = (averageGain / -averageLoss);\n\t\tdouble rsi = 100 - (100 / (1 + rs)); // first RSI.\n\t\trsiCandleSticksList.get(duration).setRsi(rsi);\n\t\tfor (int i = duration + 1; i < rsiCandleSticksList.size(); i++) { // for\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// smoothing\n\t\t\tsessionChange = rsiCandleSticksList.get(i).getClose() - rsiCandleSticksList.get(i - 1).getClose();\n\t\t\tif (sessionChange > 0) {\n\t\t\t\taverageGain = (averageGain * (duration - 1) + sessionChange) / duration;\n\t\t\t\taverageLoss = (averageLoss * (duration - 1) + 0) / duration;\n\t\t\t} else {\n\t\t\t\taverageGain = (averageGain * (duration - 1) + 0) / duration;\n\t\t\t\taverageLoss = (averageLoss * (duration - 1) + sessionChange) / duration;\n\t\t\t}\n\t\t\trs = (averageGain / -averageLoss);\n\t\t\trsi = 100 - (100 / (1 + rs));\n\t\t\trsiCandleSticksList.get(i).setRsi(rsi);\n\t\t}\n\t}", "public double rateOfChange(int periods, int t)\n {\n if(periods>t || periods<1)\n throw new IndexOutOfBoundsException(\"ROC(\" + periods + \") is undefined at time \" + t);\n return 100.0*(x[t] - x[t - periods])/x[t - periods];\n }", "private float getRsiPotential() {\r\n\t\treturn 1F - (float)(stochRsiCalculator.getCurrentValue()/50.0);\r\n\t}", "private void getSA_PeriodForIMR(ScalarIntensityMeasureRelationshipAPI imr){\n ListIterator it =imr.getSupportedIntensityMeasuresIterator();\n while(it.hasNext()){\n DependentParameterAPI tempParam = (DependentParameterAPI)it.next();\n if(tempParam.getName().equalsIgnoreCase(this.SA_NAME)){\n ListIterator it1 = tempParam.getIndependentParametersIterator();\n while(it1.hasNext()){\n ParameterAPI independentParam = (ParameterAPI)it1.next();\n if(independentParam.getName().equalsIgnoreCase(this.SA_PERIOD)){\n saPeriodVector = ((DoubleDiscreteParameter)independentParam).getAllowedDoubles();\n numSA_PeriodVals = saPeriodVector.size();\n }\n }\n }\n }\n }", "private int getIndex(int... elements) {\n int index = 0;\n for (int i = 0; i < elements.length; i++) index += elements[i] * Math.pow(universeSize, i);\n return index;\n }", "public double alternatingSequence(int n)\r\n {\r\n double sum = 0;\r\n\r\n for (int i = 1; i <= n; i++)\r\n sum += Math.pow(-1, i - 1)/i;\r\n\r\n return sum;\r\n }", "public RSIIndicator(IndicatorType type, Symbol symbol, Period period) {\n super(RSIIndicator.class, type, symbol, period);\n }", "BigInteger getPeriod();", "double indexOfCoincidence(int length, int[] alphabet){\n\t\tdouble n=length;\n\t\tdouble IOC = 0;\n\t\tfor(int i=0;i<alphabet.length;i++){\n\t\t\tIOC+=alphabet[i]*(alphabet[i]-1);\n\t\t}\n\n\t\tdouble something = IOC/(length*(length-1));\n\n\t\tSystem.out.println(something);\n\t\treturn n;\n\t}", "private int getPeriodindexFromTime(long time, long period, int periodsPerSpan) {\n int index = (int) (time / period);\n return index;\n }", "public abstract HalfOpenIntRange approximateSpan();", "private double computeSxx(List<Integer> intList, double mean) {\n double total = 0;\n for (Integer i : intList) {\n total += Math.pow((i - mean), 2);\n }\n return total;\n }", "private static long nPr(int[] frequency, int i, int n, int r)\n { \n //nao ha mais posicoes disponiveis para incluir elementos de permutacao\n if (r == 0) return 1;\n \n //retornara o calculo de nPr\n long npr = 0;\n \n //numero de elementos que ainda sobrarao, no proximo nivel de recursao,\n //para serem distribuidos pelas posicoes restantes\n n = n - frequency[i]; \n \n //chama o metodo recursivamente enquanto o numero de elementos que \n //restarem para serem distribuidos for maior ou igual ao numero de \n //posicoes disponiveis no proximo nivel de recursao\n for (\n int assignedsElements = Math.min(r, frequency[i]); \n (assignedsElements >= 0) && (n >= r - assignedsElements);\n assignedsElements--\n )\n \n //nCr() retorna o numero de maneiras que se pode distribuir \n //<assignedsElements> elementos de permutacao em <r> posicoes\n //Eh multiplicado pelas permutacoes que ainda se pode fazer nas \n //posicoes restantes com os elementos restantes\n npr += nCr(r, assignedsElements)\n * \n nPr(frequency, i+1, n, r - assignedsElements);\n \n return npr;\n }", "public double integrate(long n) {\n long inside = 0;\n for (long i = 0; i < n; i++) {\n if (isInside(generateU01())) {\n ++inside;\n }\n }\n\n return inside / (double) n;\n }", "protected double residual(final Solution<P> currentEstimation, final int i) {\n //Model fitted internally is equal to:\n //Pr (dBm) = 10 * log(Pte * k^n / d^n) = 10*n*log(k) + 10*log(Pte) - 5*n*log(d^2)\n //where:\n //Pr is received, expressed in dBm\n //Pte is equivalent transmitted power, expressed in dBm\n //k is a constant equal to k = c^2 / (pi * f)^2, where c is speed of light\n //and d is equal to distance between fingerprint and estimated position\n final RssiReadingLocated<S, P> reading = mReadings.get(i);\n final double frequency = reading.getSource().getFrequency();\n\n final double pathLossExponent = currentEstimation.getEstimatedPathLossExponent();\n\n //compute k as the constant part of the isotropic received power formula\n //so that: Pr = Pte*k^n/d^n\n final double k = RssiRadioSourceEstimator.SPEED_OF_LIGHT /\n (4.0 * Math.PI * frequency);\n final double kdB = 10.0 * pathLossExponent * Math.log10(k);\n\n //get distance from estimated radio source position and reading position\n final P readingPosition = reading.getPosition();\n final P radioSourcePosition = currentEstimation.getEstimatedPosition();\n\n final double sqrDistance = radioSourcePosition.sqrDistanceTo(readingPosition);\n\n final double transmittedPowerdBm = currentEstimation.\n getEstimatedTransmittedPowerdBm();\n\n //compute expected received power assuming isotropic transmission\n //and compare agains measured RSSI at fingerprint location\n final double expectedRSSI = kdB + transmittedPowerdBm -\n 5.0 * pathLossExponent * Math.log10(sqrDistance);\n final double rssi = reading.getRssi();\n\n return Math.abs(expectedRSSI - rssi);\n }", "private int d(final int n) {\r\n Set<Long> set = new Factors(n).getProperDivisors();\r\n long sum = 0;\r\n for (long i : set) {\r\n sum += i;\r\n }\r\n return (int) sum;\r\n }", "public static double sum(double n) {\n\t\tdouble sum = 0;\t// Sum of the series\n\t\tfor (double i = 1; i <= n; i++) {\n\t\t\tsum += i / (i + 1);\n\t\t}\n\t\treturn sum;\n\t}", "public static final double internalRateOfReturn (\n double irrEstimate,\n double [ ] cashFlows )\n //////////////////////////////////////////////////////////////////////\n {\n double irr = irrEstimate;\n\n double delta = -irr * 0.1;\n\n double oldNpv = 0.0;\n\n while ( true )\n {\n double npv = netPresentValue ( irr, cashFlows );\n\n if ( npv == 0.0 )\n {\n return irr;\n }\n\n if ( oldNpv < 0.0 )\n {\n if ( npv > 0.0 )\n {\n delta *= -0.9;\n }\n else if ( npv > oldNpv )\n {\n delta *= 1.1;\n }\n else if ( npv < oldNpv )\n {\n delta = -delta;\n }\n else\n {\n delta = 0.0;\n }\n }\n else if ( oldNpv > 0.0 )\n {\n if ( npv < 0.0 )\n {\n delta *= -0.9;\n }\n else if ( npv < oldNpv )\n {\n delta *= 1.1;\n }\n else if ( npv > oldNpv )\n {\n delta = -delta;\n }\n else\n {\n delta = 0.0;\n }\n }\n\n/*\nSystem.out.println ( \"irr = \" + irr + \", oldNpv = \" + oldNpv + \", npv = \" + npv + \", delta = \" + delta );\n\ntry{\nnew BufferedReader ( new InputStreamReader ( System.in ) ).readLine ( );\n}catch (Exception x ) { }\n*/\n\n if ( delta == 0.0 )\n {\n return irr;\n }\n\n irr += delta;\n\n oldNpv = npv;\n }\n }", "public int periodIndex (\n\t\tfinal int iDate)\n\t\tthrows java.lang.Exception\n\t{\n\t\tint i = 0;\n\n\t\tfor (org.drip.analytics.cashflow.CompositePeriod period : periods()) {\n\t\t\tif (period.contains (iDate)) return i;\n\n\t\t\t++i;\n\t\t}\n\n\t\tthrow new java.lang.Exception (\"BondStream::periodIndex => Input date not in the period set range!\");\n\t}", "public double basis()\n\t{\n\t\treturn _lsPeriod.get (0).basis();\n\t}", "int getPeriod();", "static double root(double x, int n) {\n double err = Double.MAX_VALUE;\n\n double l = 1;\n double r = x;\n\n if (x >= 0 && x <= 1){\n l = x;\n r = 1;\n }\n\n double cur = (l + r)/2;\n\n while (err > OK_ERROR) {\n\n\n double powerNum = Math.pow(cur, n);\n\n err = Math.abs(powerNum - x);\n\n if (powerNum > x) {\n r = cur;\n } else {\n l = cur;\n }\n\n cur = (l + r)/2;\n }\n\n return cur;\n }", "public RankCircuit getRankCircuit(SInt[] numerators, SInt[] denominators, SInt numerator, SInt denominator, SInt rank);", "@Override\n\tpublic int resid() {\n\t\tfinal float rate = mProgress/mPeroid;\n\t\tint index = (int)(rate-(int)rate)*mArry.length;\n\t\tif(index >= mArry.length){\n\t\t\treturn mArry.length-1;\n\t\t}\n\t\treturn index;\n\t}", "public static int calculateSignalLevel(int rssi, int numLevels) {\n if (rssi <= MIN_RSSI) {\n return 0;\n } else if (rssi >= MAX_RSSI) {\n return numLevels - 1;\n } else {\n float inputRange = (MAX_RSSI - MIN_RSSI);\n float outputRange = (numLevels - 1);\n return (int) ((float) (rssi - MIN_RSSI) * outputRange / inputRange);\n }\n }", "public ArrayList<Integer> solve(int r, ArrayList<Integer> xs) {\n\t\t\t int minElem = Integer.MAX_VALUE;\n\t\t\t int minElemIdx = -1;\n\t\t\t for(int i= 0 ; i<xs.size();i++){\n\t\t\t\t if(xs.get(i) < minElem){\n\t\t\t\t\t minElem = xs.get(i);\n\t\t\t\t\t minElemIdx = i;\n\t\t\t\t }\n\t\t\t }\n\t\t\t int currCount = r/minElem;\n\t\t\t Integer[] resArr = new Integer[currCount];\n\t\t\t \n\t\t\t for(int k=0;k<currCount;k++){\n\t\t\t\t resArr[k] = minElemIdx;\n\t\t\t }\n\t\t\t int resSum = currCount*minElem;\n\t\t\t int subIdx = 0; //index for possible \n\t\t\t for(int i=0;i<=minElemIdx && subIdx<currCount;){\n\t\t\t\t if(xs.get(i) <= (r-(resSum-minElem))){\n\t\t\t\t\t\t resArr[subIdx++] = i;\n\t\t\t\t\t resSum = resSum-minElem+xs.get(i);\n\t\t\t\t }else{\n\t\t\t\t\t i++;\n\t\t\t\t }\n\t\t\t }\n\t\t\t return new ArrayList<Integer>(Arrays.asList(resArr));\n\t\t }", "public int getHowManyInPeriod();", "double noireCyclicValue(double x, double period) {\n double val = (Math.exp(Math.sin(x*x/2000.0*Math.PI)) - 0.36787944)*108.0;\n double variance = 0.001;\n \n return (variance*val);\n }", "private Double getAdjRelativeRate(CurrencyType curr, int asOfDate, int interval) {\n CurrencySnapshot snap = curr.getSnapshotForDate(asOfDate);\n if (snap != null) {\n int snapDate = snap.getDateInt();\n // System.err.println(curr+\" \"+asOfDate+\" \"+interval+\" \"+snap);\n // First look in interval before the date: (T-I .. T]\n if ((DateUtil.incrementDate(asOfDate, 0, 0, -interval) < snapDate) && (snapDate <= asOfDate)) {\n return 1.0 / curr.adjustRateForSplitsInt(snapDate, snap.getRate());\n }\n // Now look in interval after the date: [T .. T+I)\n snap = curr.getSnapshotForDate(asOfDate + interval);\n if ((snap != null)\n && (asOfDate <= snapDate)\n && (snapDate < DateUtil.incrementDate(asOfDate, 0, 0, interval))) {\n return 1.0 / curr.adjustRateForSplitsInt(snapDate, snap.getRate());\n }\n }\n // No rate in interval\n return Double.NaN;\n }", "private Rational computeDirectly() {\n BigInteger _26390k = _26390.multiply(BigInteger.valueOf(start));\n BigInteger _24591257856pk = _24591257856.pow(start);\n\n Rational sum = Rational.ZERO;\n\n for (int k = start; k < end; k++) {\n BigInteger num = Factorial.verified(BigInteger.valueOf(k << 2));\n num = num.multiply(_1103.add(_26390k));\n\n BigInteger den = Factorial.verified(BigInteger.valueOf(k)).pow(4);\n den = den.multiply(_24591257856pk);\n\n _26390k = _26390k.add(_26390);\n _24591257856pk = _24591257856pk.multiply(_24591257856);\n\n sum = sum.add(Rational.valueOf(num, den).dropTo(context));\n sum = sum.dropTo(context);\n }\n return sum;\n }", "static int nStairsRecur(int stairs, int hops) {\r\n if(stairs < 0) {\r\n return -1;\r\n }\r\n if(stairs == 0 || stairs == 1) {\r\n return 1;\r\n }\r\n int res = 0;\r\n for(int i = 1; i <= hops && i <= stairs; i++) {\r\n res += nStairsRecur(stairs - i, hops);\r\n }\r\n return res;\r\n }", "abstract public int getIncomeSegment( int hhIncomeInDollars );", "private int integrator(int[] inputs, int i){\n\t\tint synapSum = 0;\n\t\tint l = inputs.length;\n\t\tfor(int j = 0 ; j < l ; j++)\n\t\t\tsynapSum += inputs[j] * synapses[j*l+i];\n\t\treturn synapSum;\n\t}", "double getPeriod();", "public abstract int mo12579RS(int i);", "public double getEstimate()\n {\n assert list.length > 0: \"The list cannot be empty\";\n int R = list[0];\n \n //count how many are smaller or equal to R\n double counter = 0;\n for (int i = 1; i < k; i++) {\n if (list[i]<R)\n counter++;\n }\n return -Math.pow(2, R - 1) * Math.log(counter / (k-1)); }", "public abstract double calcSA();", "int getRadix(Object elementID) throws Exception;", "public static int getPeriod(int i) {\n int count = 1;\n int mod = 10 % i;\n //If i is not divisible by 2 or 5, compute.\n //If i is divisible by 2 or 5, it's period is had in a smaller number\n if(i%2!=0 && i%5 !=0) {\n //While mod is not 1, multiply by 10 and mod with i, increment period.\n while(mod != 1) {\n mod = mod * 10;\n mod = mod % i;\n count++;\n }\n }\n return count;\n \n }", "public static int calcNumBursts(final int numTimeseries) {\n int numVectors = 0;\n for (int i = 1; i <= numTimeseries; ++i) {\n numVectors += (i + (CORRELATION_NUM_PIPES - 1)) / CORRELATION_NUM_PIPES;\n }\n\n return (numVectors + (CORRELATION_NUM_VECTORS_PER_BURST - 1))\n / CORRELATION_NUM_VECTORS_PER_BURST;\n }", "double getSignalPeriod();", "static int findInteger(int arr[], int n) \n { \n int neg = 0, pos = 0; \n int sum = 0; \n \n for (int i = 0; i < n; i++) \n { \n sum += arr[i]; \n \n // If negative, then increment \n // neg count. \n if (arr[i] < 0) \n neg++; \n \n // Else increment pos count.. \n else\n pos++; \n } \n \n return (sum / Math.abs(neg - pos)); \n }", "public double getResult(){\n double x;\n x= (3+Math.sqrt(9-4*3*(1-numberOfStrands)))/(2*3);\n if(x<0){\n x= (3-Math.sqrt(9-(4*3*(1-numberOfStrands))))/6;\n\n }\n numberOfLayers=(float) x;\n diameter=((2*numberOfLayers)-1)*strandDiameter;\n phaseSpacing=(float)(Math.cbrt(ab*bc*ca));\n\n netRadius=diameter/2;\n\n\n\n //SGMD calculation\n float prod=1;\n for(int rand=0;rand<spacingSub.size();rand++){\n prod*=spacingSub.get(rand);\n }\n\n //SGMD calculation\n sgmd=Math.pow((Math.pow(netRadius,subconductors)*prod*prod),1/(subconductors*subconductors));\n capacitance=((8.854e-12*2*3.14)/Math.log(phaseSpacing/sgmd));\n Log.d(\"How\",\"phase spacing:\"+phaseSpacing+\" sgmd=\"+sgmd);\n return capacitance*1000;\n\n\n }", "public boolean irreducibleQuadratic(int rIndex, int sIndex) {\n for (int k = 0; k < cardinality() ; k++) {\n //System.out.println(\"rIndex = \" + rIndex + \", sIndex = \" + sIndex + \", k = \" + k);\n if (timesInt(k,k) == plusInt(timesInt(rIndex, k), sIndex)) return false;\n }\n return true;\n }", "double rpow(int x, int n) {\r\n\t\tif (n == 0)\r\n\t\t\treturn 1.0;\r\n\t\treturn x * rpow(x, n - 1);\r\n\t}", "private static int getTotient(int n) {\n int result = n;\n for(int i=2; i*i <=n; i++) {\n if(n % i == 0) {\n while(n % i == 0) n /= i;\n result -= result/i;\n }\n }\n if(n > 1) result -= result/n;\n return result;\n }", "long getSamplePeriod();", "@Test\n\tpublic void testUniformRWR() {\n\t\tlog.debug(\"Test logging\");\n\t\tint maxT = 10;\n\t\t\n\t\tAnnotatedGraph<String> g = brGraphs.get(0);\n\t\t\n\t\tTreeMap<String,Double> startVec = new TreeMap<String,Double>();\n\t\tstartVec.put(\"r0\",1.0);\n\t\tMap<String,Double> baseLineVec = myRWR(startVec,g,maxT);\n\t\tTreeMap<String,Double>uniformWeightVec = new TreeMap<String,Double>();\n\t\tuniformWeightVec.put(\"fromb\",1.0);\n\t\tuniformWeightVec.put(\"tob\",1.0);\n\t\tuniformWeightVec.put(\"fromr\",1.0);\n\t\tuniformWeightVec.put(\"tor\",1.0);\n\t\tuniformWeightVec.put(\"restart\",1.0);\n\t\tMap<String,Double> newVec = srw.rwrUsingFeatures(g, startVec, uniformWeightVec);\n\t\tequalScores(baseLineVec,newVec);\n\t}", "int getStrength(Unit unit);", "private void atimes( int n, double x[], double r[], boolean itrnsp, double sa[], int[] ija ) {\n if (itrnsp)\n dsprstx(sa, ija, x, r, n);\n else\n dsprsax(sa, ija, x, r, n);\n }", "public double computeExpectedSW(int numberOfSellers, List<Integer> fixedSellerIdx)\r\n\t{\r\n\t\tdouble expectedSW = 0.;\r\n\t\t\r\n\t\tif( numberOfSellers == 0 )\r\n\t\t{\r\n\t\t\treturn 0.;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tfor(int t = getMinNumberOfTuples(numberOfSellers-1); t <= getMaxNumberOfTuples(numberOfSellers-1); ++t)\r\n\t\t\t\tif( fixedSellerIdx.contains(numberOfSellers-1) )\r\n\t\t\t\t\texpectedSW += (getValue()*_actuallyAllocatedTuples.get(numberOfSellers-1) + computeExpectedSW( numberOfSellers - 1, fixedSellerIdx))\r\n\t\t\t\t\t *(1./(getMaxNumberOfTuples(numberOfSellers-1)-getMinNumberOfTuples(numberOfSellers-1)+1));\r\n\t\t\t\telse\r\n\t\t\t\t\texpectedSW += ((getValue()-getCost(numberOfSellers-1))*t + computeExpectedSW( numberOfSellers - 1, fixedSellerIdx))\r\n\t\t\t\t\t\t\t *(1./(getMaxNumberOfTuples(numberOfSellers-1)-getMinNumberOfTuples(numberOfSellers-1)+1));\r\n\t\t\t\r\n\t\t\treturn expectedSW;\r\n\t\t}\r\n\t}", "private double werteRekursivAus(int n) {\n double zwischenwert = 0;\n\n // Basisfall\n if (n <= 0) {\n return 0;\n }\n\n // Fall I\n if (n > 0) {\n zwischenwert = 1 / (werteRekursivAus(n - 1)) + werte[werte.length - n];\n }\n\n // Fall II\n if (n == 1) {\n zwischenwert = 1 / zwischenwert + werte[werte.length - 1];\n }\n return zwischenwert;\n }", "long getRsum(int n, int i, int k){\r\n return n-i>=k ? (n-i-k)+ssum(k-1): ssum(k-1) - ssum(k-n+i);\r\n }", "public double computeSupport(double N) {\r\n\t\treturn counter / N;\r\n\t}", "public double accumValue(int yearsElapsed) \n {\n double formulaPart2 = 1; // initialize the var that will store the value of (1 + r/n)^nt\n int timePerYear = 0; // initialize the var that will store how frequently the interest is calculated in a year.\n \n if (compMode.equalsIgnoreCase(\"daily\"))\n {\n timePerYear = 365; // For a daily compounded deposit, the interest is calculated 365 times a year\n }\n else if(compMode.equalsIgnoreCase(\"quarterly\"))\n {\n timePerYear = 4; // For a quarterly compounded deposit, the interest is calculated 4 times a year\n }\n else if(compMode.equalsIgnoreCase(\"monthly\"))\n {\n timePerYear = 12; // For a monthly compounded deposit, the interest is calculated 12 times a year\n }\n \n // a loop to calculate the power in (1 + r/n)^nt\n for (int i = 0; i < timePerYear * yearsElapsed; i++)\n {\n // formulaPart2 gets the value of itelf multiplied nt times\n formulaPart2 = formulaPart2 * (1 + interest/ 100 / timePerYear);\n }\n \n return principal * formulaPart2; // return p(1 + r/n)^nt\n }", "private double getSignal(double[] params, StejskalTannerScheme scheme, int i) {\r\n\r\n\t\tif (scheme.zero(i)) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\r\n\t\tdouble signal;\r\n\r\n\t\tdouble R = params[1];\r\n\t\tdouble b = scheme.getB_Value(i);\r\n\t\tdouble DELTA = scheme.getDELTA(i);\r\n\t\tdouble delta = scheme.getDelta(i);\r\n \tdouble modG = scheme.getModG(i);\r\n\t\tdouble[] ghat = scheme.getG_Dir(i);\r\n\t\tdouble[] G = new double[3];\r\n\t\tfor (int j = 0; j < G.length; j++) {\r\n\t\t\tG[j] = ghat[j] * modG;\r\n\t\t}\r\n\r\n\t\tdouble[] am1 = new double[am.length];\r\n\r\n\t\tfor (int i1 = 0; i1 < am.length; i1++) {\r\n\t\t\tam1[i1] = am[i1] / R;\r\n\r\n\t\t}\r\n\r\n\t\t/** calculating the sum for the perpendicular intra-cellular signal */\r\n\t\tdouble sum = 0;\r\n\t\tfor (int i1 = 0; i1 < am1.length; i1++) {\r\n\t\t\t// d*am^2\r\n\t\t\tdouble dam = params[0] * am1[i1] * am1[i1];\r\n\t\t\t// -d*am^2*delta\r\n\t\t\tdouble e11 = -dam * delta;\r\n\t\t\t// -d*am^2*DELTA\r\n\t\t\tdouble e2 = -dam * DELTA;\r\n\t\t\t// -d*am^2*(DELTA-delta)\r\n\t\t\tdouble dif = DELTA - delta;\r\n\t\t\tdouble e3 = -dam * dif;\r\n\t\t\t// -d*am^2*(DELTA+delta)\r\n\t\t\tdouble plus = DELTA + delta;\r\n\t\t\tdouble e4 = -dam * plus;\r\n\t\t\t// numerator of the fraction\r\n\t\t\tdouble nom = 2 * dam * delta - 2 + (2 * Math.exp(e11))\r\n\t\t\t\t\t+ (2 * Math.exp(e2)) - Math.exp(e3) - Math.exp(e4);\r\n\r\n\t\t\t// denominator\r\n\t\t\tdouble denom = dam * dam * am1[i1] * am1[i1]\r\n\t\t\t\t\t* (R * R * am1[i1] * am1[i1] - 1);\r\n\r\n\t\t\t// the sum of the fraction\r\n\t\t\tsum += (nom / denom);\r\n\t\t}\r\n\t\t// the perpendicular component\r\n\t\tdouble lperp = (-2 * GAMMA * GAMMA * sum);\r\n\r\n\t\t// parallel component\r\n\t\tdouble lpar = -b * 1/(modG*modG) * params[0];\r\n\r\n\t\t// the isotropic restricted signal\r\n\t\ttry {\r\n\t\t\tsignal = Math.sqrt(Math.PI) * 1\r\n\t\t\t\t\t/ (2 * modG * Math.sqrt(lperp - lpar))\r\n\t\t\t\t\t* Math.exp(modG * modG * lperp)\r\n\t\t\t\t\t* ErrorFunction.erf(modG * Math.sqrt((lperp - lpar)));\r\n\t\t} catch (ErrorFunctionException erfe) {\r\n\t\t\tthrow new LoggedException(erfe);\r\n\r\n\t\t}\r\n\r\n\t\treturn signal;\r\n\t}", "static double harmonicSum(int n) {\n\t\tif (n==1) \n\t\t\treturn 1.0; \n\t\telse\n\t\t{\n\t\t\treturn 1/n + harmonicSum(n-1);\n\t\t}\n\t}", "private double snrm( int n, double sx[], int itol ) {\n int isamax;\n double ans;\n\n if (itol <= 3) {\n ans = 0.0;\n for( int i = 0; i < n; i++ )\n ans += sx[i] * sx[i];\n return Math.sqrt(ans);\n } else {\n isamax = 0;\n for( int i = 0; i < n; i++ ) {\n if (Math.abs(sx[i]) > Math.abs(sx[isamax]))\n isamax = i;\n }\n return Math.abs(sx[isamax]);\n }\n }", "@Override\n\tprotected int getActiveCount(long units) {\n\t\treturn units % period == 0 ? 1 : 0;\n\t}", "private int rs(final int x) {\n assert(! leaf(x));\n return Math.min(2*x+2, n);\n }", "protected final int calculateInterst1(int pr){\n\t\t return pr*10*1/100;\n\t }", "public double updatePeriodic()\n {\n double Angle = getRawAngle();\n\n if (FirstCall)\n {\n AngleAverage = Angle;\n }\n\n AngleAverage -= AngleAverage / NumAvgSamples;\n AngleAverage += Angle / NumAvgSamples;\n\n return (AngleAverage);\n }", "private int advance(int[] n, int i) {\n i += n[i];\n i%=len;\n while (i<0) i+=len;\n return i;\n }", "public static double termSlotwaarde(final int n, final int t, final double i)\n\t{\n\t\tdouble n1 = Math.floor(n * t);\n\t\tdouble r = 1d + termPercentage(t, t) / HON_PERCENT;\n\t\treturn Math.pow(r, n1);\n\t}", "public long getSamplingPeriod();", "public static double totalSavings(double rI, double monthlySSI, double retiredReturn, double retiredYears) {\r\n\t\treturn (rI - monthlySSI) * (1 - (1 / Math.pow((1 + (retiredReturn / 100) / 12), (12 * retiredYears))))\r\n\t\t\t\t/ (retiredReturn / 100 / 12);\r\n\t}", "private float calculGainNumerical(KnowledgeBase kb, int attIndex) {\r\n\t\tArrayList<AttributeValue<Float>> possibleValue =findPossibleValueNumerical(kb,attIndex);\r\n\t\tArrayList<ArrayList<ArrayList<Integer>>> multiple_counters2D = new ArrayList<ArrayList<ArrayList<Integer>>>();\r\n\t\tfor(int i=0;i<possibleValue.size()-1;i++){\r\n\t\t\tmultiple_counters2D.add(kb.count2DNumeric(possibleValue.get(i),attIndex));\t\t\r\n\t\t}\r\n\t\tArrayList<Integer> counter1D = kb.count(kb.getIndexClass());\r\n\t\tfloat gini1D = calculImpurity(kb.getSamples().size(),counter1D);\r\n\t\tint indexBestSplit = find_bestSplit(kb,attIndex,multiple_counters2D);\r\n\t\t///\r\n\t\tArrayList<ArrayList<Integer>> counter2D = kb.count2DNumeric(attIndex, kb.getIndexClass(),possibleValue.get(indexBestSplit));\r\n\t\tfloat gini2D = calculImpurity2DForNumerical(kb,attIndex,counter2D,possibleValue.get(indexBestSplit));\r\n\t\treturn gini1D - gini2D;\r\n\t}", "public double findTSS(){\n\t\t\n\t\tdouble dMean; double dOut;\n\t\t\n\t\t//loading response variable\n\t\tdMean = 0;\n\t\tfor(double d:rgdY){\n\t\t\tdMean+=d;\n\t\t}\n\t\tdMean=dMean/((double) rgdY.length);\n\t\tdOut = 0;\n\t\tfor(double d:rgdY){\n\t\t\tdOut+=pow(d-dMean,2);\n\t\t}\n\t\treturn dOut;\n\t}", "public void initPeriodsSearch() {\n\n\t\t//init fundamentalFreq\n\t\tcalculatefundamentalFreq();\n\n\t\t//set the first search area\n\t\tfinal double confidenceLevel = 5 / 100.;\n\t\tnextPeriodSearchingAreaEnd = (int) Math.floor( hzToPeriod( fundamentalFreq ) * ( 1 + confidenceLevel ) );\n\t}", "private double getUnitWidth(int index)\n {\n return _weights.get(index) / _totalWeight;\n }", "private void calc_q0(double[] llr) {\n\t\tfor (int i=noffs; i<llr.length; i++)\n\t\t\tq0[i-noffs] = Math.exp(llr[i]) / (1 + Math.exp(llr[i])); // beliefs\t\t\t\n\t}", "public int[] getAsSRational(int index) {\n return ((int[][])data)[index];\n }", "public static int numXTriangle(int np, double[] angles){\n\t\t\n\t\tint num = 0;\n\t\tfor(int i=0;i<np;i++){\n\t\t\tdouble theUpper = angles[i]+180;\n\t\t\tif(theUpper>360) {theUpper = 360;}\n\t\t\t\n\t\t\tint j = binarySearchLessMax(angles, i+1, angles.length-1, theUpper);\n\t\t\t\n\t\t\t//\t\t\tSystem.out.println(angles[j]);\t\n\t\t\tif(j-i>1){\n\t\t\t\tnum += (j-i-1);\n\t\t\t}\n\t\t}\n\t\treturn num;\n\t}", "public double calculateRate() {\n\t\tdouble rate = 0;\n\t\tfor (int i = 0; i < upgrades.size(); i++) {\n\t\t\trate += upgrades.get(i).getProduction();\n\t\t}\n\t\tbrain.setRate(rate);\n\t\treturn rate;\n\t}", "BigInteger getRA();", "public abstract double getValue(R1Interval interval);", "public static int scoreVPs(int[] symbols) {\r\n\t\tint numSets, total = 0;\r\n\t\tnumSets = symbols[0];\r\n\t\ttotal = symbols[0] * symbols[0];\r\n\t\tfor (int i = 1; i < 3; i++) {\r\n\t\t\tif (symbols[i] < numSets)\r\n\t\t\t\tnumSets = symbols[i];\r\n\t\t\ttotal += symbols[i] * symbols[i];\r\n\t\t}\r\n\t\ttotal += numSets * 7;\r\n\t\treturn total;\r\n\t}", "static long nPolyNTime(int[] n) {\n int temp = n.length;\n long sum = 0;\n if(n == null || n.length == 0) return -1;\n for(int i = 0; i < n.length; ++i) {\n while(temp --> 0) {\n for(int j = 0; j < n.length; ++j) {\n sum += n[i] + n[j];\n }\n }\n }\n return sum;\n }", "public abstract int getIndexForAngle(float paramFloat);", "public static final double annualSavingsNeeded (\n double f,\n double r,\n double t )\n //////////////////////////////////////////////////////////////////////\n {\n return f * r / ( Math.pow ( 1.0 + r, t ) - 1.0 );\n }", "protected static Object[] calcGainRatios(InstanceList ilist, int[] instIndices, int minNumInsts)\n {\n int numInsts = instIndices.length;\n Alphabet dataDict = ilist.getDataAlphabet();\n LabelAlphabet targetDict = (LabelAlphabet) ilist.getTargetAlphabet();\n double[] targetCounts = new double[targetDict.size()];\n\n // Accumulate target label counts and make sure\n // the sum of each instance's target label is 1\n for (int ii = 0; ii < numInsts; ii++) {\n Instance inst = ilist.get(instIndices[ii]);\n Labeling labeling = inst.getLabeling();\n double labelWeightSum = 0;\n for (int ll = 0; ll < labeling.numLocations(); ll++) {\n int li = labeling.indexAtLocation(ll);\n double labelWeight = labeling.valueAtLocation(ll);\n labelWeightSum += labelWeight;\n targetCounts[li] += labelWeight;\n }\n assert(Maths.almostEquals(labelWeightSum, 1));\n }\n\n // Calculate the base entropy Info(D) and the the \n // label distribution of the given instances\n double[] targetDistribution = new double[targetDict.size()];\n double baseEntropy = 0;\n for (int ci = 0; ci < targetDict.size(); ci++) {\n double p = targetCounts[ci] / numInsts;\n targetDistribution[ci] = p;\n if (p > 0)\n baseEntropy -= p * Math.log(p) / log2;\n }\n\n LabelVector baseLabelDistribution = new LabelVector(targetDict, targetDistribution);\n double infoGainSum = 0;\n int totalNumSplitPoints = 0;\n double[] passTestTargetCounts = new double[targetDict.size()];\n // Maps feature index -> Hashtable, and each table \n // maps (split point) -> (info gain, split ratio)\n HashMap[] featureToInfo = new HashMap[dataDict.size()]; \n \n // Go through each feature's split points in ascending order\n for (int fi = 0; fi < dataDict.size(); fi++) {\n \n if ((fi+1) % 1000 == 0)\n logger.info(\"at feature \" + (fi+1) + \" / \" + dataDict.size());\n \n featureToInfo[fi] = new HashMap();\n Arrays.fill(passTestTargetCounts, 0);\n // Sort instances on this feature's values\n instIndices = sortInstances(ilist, instIndices, fi);\n\n // Iterate through the sorted instances\n for (int ii = 0; ii < numInsts-1; ii++) {\n Instance inst = ilist.get(instIndices[ii]);\n Instance instPlusOne = ilist.get(instIndices[ii+1]);\n FeatureVector fv1 = (FeatureVector) inst.getData();\n FeatureVector fv2 = (FeatureVector) instPlusOne.getData();\n double lower = fv1.value(fi);\n double higher = fv2.value(fi);\n\n // Accumulate the label weights for instances passing the test\n Labeling labeling = inst.getLabeling();\n for (int ll = 0; ll < labeling.numLocations(); ll++) {\n int li = labeling.indexAtLocation(ll);\n double labelWeight = labeling.valueAtLocation(ll);\n passTestTargetCounts[li] += labelWeight;\n }\n\n if (Maths.almostEquals(lower, higher) || inst.getLabeling().toString().equals(instPlusOne.getLabeling().toString()))\n continue;\n\n // For this (feature, spilt point) pair, calculate the \n // info gain of using this pair to split insts into those \n // with value of feature <= p versus > p\n totalNumSplitPoints++;\n double splitPoint = (lower + higher) / 2;\n double numPassInsts = ii+1;\n \n // If this split point creates a partition \n // with too few instances, ignore it\n double numFailInsts = numInsts - numPassInsts;\n if (numPassInsts < minNumInsts || numFailInsts < minNumInsts)\n continue;\n \n // If all instances pass or fail this test, it is useless\n double passProportion = numPassInsts / numInsts;\n if (Maths.almostEquals(passProportion, 0) || Maths.almostEquals(passProportion, 1))\n continue; \n \n // Calculate the entropy of instances passing and failing the test\n double passEntropy = 0;\n double failEntropy = 0;\n double p;\n \n for (int ci = 0; ci < targetDict.size(); ci++) {\n if (numPassInsts > 0) {\n p = passTestTargetCounts[ci] / numPassInsts;\n if (p > 0)\n passEntropy -= p * Math.log(p) / log2;\n }\n if (numFailInsts > 0) {\n double failTestTargetCount = targetCounts[ci] - passTestTargetCounts[ci];\n p = failTestTargetCount / numFailInsts;\n if (p > 0)\n failEntropy -= p * Math.log(p) / log2;\n }\n }\n \n // Calculate Gain(D, T), the information gained \n // by testing on this (feature, split-point) pair\n double gainDT = baseEntropy \n - passProportion * passEntropy\n - (1-passProportion) * failEntropy; \n infoGainSum += gainDT;\n // Calculate Split(D, T), the split information\n double splitDT = \n - passProportion * Math.log(passProportion) / log2\n - (1-passProportion) * Math.log(1-passProportion) / log2;\n // Calculate the gain ratio\n double gainRatio = gainDT / splitDT;\n featureToInfo[fi].put(Double.valueOf(splitPoint),\n new Point2D.Double(gainDT, gainRatio));\n } // End loop through sorted instances\n } // End loop through features\n\n // For each feature's split point with at least average gain, \n // get the maximum gain ratio and the associated split point\n // (using the info gain as tie breaker)\n double[] gainRatios = new double[dataDict.size()];\n double[] splitPoints = new double[dataDict.size()];\n int numSplitsForBestFeature = 0;\n\n // If all feature vectors are identical or no splits are worthy, return all 0s\n if (totalNumSplitPoints == 0 || Maths.almostEquals(infoGainSum, 0))\n return new Object[] {gainRatios, splitPoints, Double.valueOf(baseEntropy), \n baseLabelDistribution, Integer.valueOf(numSplitsForBestFeature)};\n\n double avgInfoGain = infoGainSum / totalNumSplitPoints;\n double maxGainRatio = 0;\n double gainForMaxGainRatio = 0; // tie breaker\n \n int xxx = 0;\n \n \n for (int fi = 0; fi < dataDict.size(); fi++) {\n double featureMaxGainRatio = 0;\n double featureGainForMaxGainRatio = 0;\n double bestSplitPoint = Double.NaN;\n\n for (Iterator iter = featureToInfo[fi].keySet().iterator(); iter.hasNext(); ) {\n Object key = iter.next();\n Point2D.Double pt = (Point2D.Double) featureToInfo[fi].get(key);\n double splitPoint = ((Double) key).doubleValue();\n double infoGain = pt.getX();\n double gainRatio = pt.getY();\n\n if (infoGain >= avgInfoGain) {\n if (gainRatio > featureMaxGainRatio || (gainRatio == featureMaxGainRatio && infoGain > featureGainForMaxGainRatio)) {\n featureMaxGainRatio = gainRatio;\n featureGainForMaxGainRatio = infoGain;\n bestSplitPoint = splitPoint;\n }\n }\n else {\n xxx++;\n }\n \n }\n assert(! Double.isNaN(bestSplitPoint));\n gainRatios[fi] = featureMaxGainRatio;\n splitPoints[fi] = bestSplitPoint;\n\n if (featureMaxGainRatio > maxGainRatio || (featureMaxGainRatio == maxGainRatio && featureGainForMaxGainRatio > gainForMaxGainRatio)) {\n maxGainRatio = featureMaxGainRatio;\n gainForMaxGainRatio = featureGainForMaxGainRatio;\n numSplitsForBestFeature = featureToInfo[fi].size();\n }\n }\n \n logger.info(\"label distrib:\\n\" + baseLabelDistribution);\n logger.info(\"base entropy=\" + baseEntropy + \", info gain sum=\" + infoGainSum + \", total num split points=\" + totalNumSplitPoints + \", avg info gain=\" + avgInfoGain + \", num splits with < avg gain=\" + xxx);\n \n return new Object[] {gainRatios, splitPoints, Double.valueOf(baseEntropy), \n baseLabelDistribution, Integer.valueOf(numSplitsForBestFeature)};\n }", "static double resultRPN(String[] s){\n\t\t\tif(s.length == 0)\treturn -1;\n\t\t\tStack<Double> stack = new Stack<Double>();\n\n\t\t\tdouble res = 0;\n\t\t\t\n\t\t\tfor(int i=0; i<s.length; i++){\n\t\t\t\tif(!isSign(s[i])){\n\t\t\t\t\tstack.push(Double.parseDouble(s[i]));\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tdouble val1 = stack.pop();\n\t\t\t\t\tdouble val2 = stack.pop();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif(s[i] == \"*\"){\n\t\t\t\t\t\tres = val2*val1;\n\t\t\t\t\t}\n\t\t\t\t\tif(s[i] == \"+\"){\n\t\t\t\t\t\tres = val2+val1;\n\t\t\t\t\t}\n\t\t\t\t\tif(s[i] == \"-\"){\n\t\t\t\t\t\tres = val2-val1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(s[i] == \"/\"){\n\t\t\t\t\t\tif(val1 == 0){\n\t\t\t\t\t\t\tthrow new ArithmeticException();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tres = val2/val1;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\tstack.push(res);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tres = stack.pop();\n\t\t\t\n\t\t\tif(!stack.isEmpty()){\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t\t}\n\t\t\t\n\t\t\treturn res;\n\n\t\t}", "public double getPER() {\n\t\tint nq = q0.length;\n double sum = 0.0;\n for (int i=0; i<nq; i++) sum += q0[i];\n\t\treturn Math.min(1.0, 0.5*(1.0-(sum/(double)nq))/initPER); // 0.5 * proba erreur\t\t\n\t}", "public static double getConfidenceIntervalSummand(double confidenceLevel, double standardDerivation, double sampleSize) { \n // calculate Z\n double z = AcklamStatUtil.getInvCDF(getInvCdfParam(confidenceLevel), true);\n \n // calculate result\n double result = (z * standardDerivation) / Math.sqrt(sampleSize); \n return result;\n }", "private int quantizeSpread(double spectralSpread) {\n\t\treturn (int) (spectralSpread / 1000) + 1;\n\t}", "private double getWeight(int index, double offset, double width)\n {\n double unitWidth = getUnitWidth(index);\n if (unitWidth == 0.0)\n {\n return 0.0;\n }\n\n double ringSegmentStart = getWidthUntil(index);\n double ringSegmentEnd = ringSegmentStart + unitWidth;\n\n // If cases where [offset, offset + width) wraps around the ring, we take the compliment of it to\n // calculate the inverse intersection ratio, and subtract that from 1 to get the actual ratio\n if (offset + width > 1.0)\n {\n double start = (offset + width) % 1.0;\n double end = offset;\n return 1D - (intersect(ringSegmentStart, ringSegmentEnd, start, end) / unitWidth);\n }\n else\n {\n return intersect(ringSegmentStart, ringSegmentEnd, offset, offset + width) / unitWidth;\n }\n }", "@Override\n\tpublic double calcularSalario() {\n\n\t\tdouble salario = 0;\n\n\t\tdouble porcentajeAnios = calcularPorcentajePorAntiguedad();\n\t\tporcentajeAnios = this.sueldoBasico* (porcentajeAnios / 100);\n\t\tsalario = this.sueldoBasico + porcentajeAnios;\n\t\treturn salario;\n\t}", "private int spinTheWheel()\r\n {\r\n\tint i;\r\n\t// generate a random number from 0 to 1\r\n\tdouble r = Math.random();\r\n\t// find the index where the random number lie in the \r\n\t// probability array\r\n\tfor(i = 0; i < prob.length && r > prob[i]; i++);\r\n\r\n\t// sometimes, due to the rounding error, the last \r\n\t// accumulate probability is less than 1 and the search\r\n\t// will fail. \r\n\t// when this case happen, return the last index\r\n\tif(i == prob.length)\r\n\t i--;\r\n\treturn i;\r\n }", "private int adjustIndex(int index)\n {\n int max = values.length;\n return ((index % max) + max) % max;\n }", "private int getNumberOfRounds(int changingAxiomsCount) {\n\t\treturn Math.min(maxRounds_,\n\t\t\t\t2 * (31 - Integer.numberOfLeadingZeros(changingAxiomsCount)));\n\t}", "public double getSIvalue() {\n\t\treturn(value*factor + offset);\n\t}", "public int divisorSum(int n) {\n\t\tint sum = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tint z = n % i;\n\t\t\tif (z == 0) {\n\t\t\t\tsum = sum + i;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}", "public abstract int mo12583RW(int i);", "public static double mathConst(double x, int n){\n double result = 0;\n double item;\n double nominator = 1;\n for(int i = 0; i <= n; i++){\n if(i == 0){\n nominator = 1;\n }else {\n nominator = nominator * x;\n }\n item = nominator / factorial(i);\n result = result + item;\n }\n return result;\n }", "public float getRainStrength(Point3d position){\r\n\t\treturn world.isRainingAt(new BlockPos(position.x, position.y + 1, position.z)) ? world.getRainStrength(1.0F) + world.getThunderStrength(1.0F) : 0.0F;\r\n\t}", "public abstract int mo12572RL(int i);", "public double computeExpectedSW(int numberOfSellers)\r\n\t{\r\n\t\tdouble expectedSW = 0.;\r\n\t\t\r\n\t\tif( numberOfSellers == 0 )\r\n\t\t{\r\n\t\t\treturn 0.;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//for(int t = getMinNumberOfTuples(numberOfSellers-1); t <= getMaxNumberOfTuples(numberOfSellers-1); ++t)\r\n\t\t\t//\texpectedSW += ((getValue()-getCost(numberOfSellers-1))*t + computeExpectedSW( numberOfSellers - 1))\r\n\t\t\t//\t\t\t *(1./(getMaxNumberOfTuples(numberOfSellers-1)-getMinNumberOfTuples(numberOfSellers-1)+1));\r\n\t\t\tList<Double> expectedCosts = computeExpectedCosts();\r\n\t\t\tdouble expectedTotalCost = 0.;\r\n\t\t\tfor(double c : expectedCosts)\r\n\t\t\t\texpectedTotalCost += c;\r\n\t\t\texpectedSW = computeExpectedValue(numberOfSellers) - expectedTotalCost;\r\n\t\t\treturn expectedSW;\r\n\t\t}\r\n\t}", "public double getSumResidualsSqr() {\n double[] params = getParams();\n if (params != null) {\n return params[numParams];\n } else {\n return Double.NaN;\n }\n }" ]
[ "0.6084087", "0.5116293", "0.50306547", "0.49412704", "0.48824358", "0.48582923", "0.47497806", "0.46959522", "0.4670009", "0.46693566", "0.4646477", "0.45650303", "0.4529743", "0.44942683", "0.4485951", "0.44691697", "0.44615254", "0.44497746", "0.44259173", "0.441421", "0.44140333", "0.44104305", "0.44090334", "0.4400537", "0.43974018", "0.43938896", "0.43722814", "0.43618336", "0.43594202", "0.43496025", "0.43469363", "0.43360013", "0.43296027", "0.43221435", "0.43204483", "0.43129265", "0.430664", "0.43038553", "0.4301158", "0.43011025", "0.4291444", "0.42892188", "0.42856947", "0.42854953", "0.42830408", "0.42830318", "0.42691845", "0.42645535", "0.42577255", "0.4244667", "0.42347878", "0.42309648", "0.42289096", "0.42254508", "0.42238316", "0.42075154", "0.4203611", "0.4198869", "0.41979057", "0.41949132", "0.41938382", "0.4184985", "0.41847962", "0.41753536", "0.4173296", "0.41673774", "0.416434", "0.41643143", "0.41631797", "0.41625553", "0.41614458", "0.4159917", "0.41552126", "0.4154268", "0.414726", "0.41459534", "0.41456628", "0.41364476", "0.4134818", "0.41330633", "0.4132472", "0.41222933", "0.4114878", "0.41134402", "0.41126323", "0.41070804", "0.4105136", "0.41010395", "0.4098239", "0.4095792", "0.4090674", "0.40906328", "0.40905374", "0.4088216", "0.40859047", "0.40836993", "0.4078501", "0.4074355", "0.40680075", "0.4067725" ]
0.6565824
0
Create a new historical series from this one by removing the trend by means of a moving average of the given depth. Because of the way the trend is removed from the series, the first depth quotes are lost.
public Series removeDelayedTrend(int depth) { if(depth<1 || depth>=size) throw new IndexOutOfBoundsException(); Series oscillator = new Series(); oscillator.x = new double[oscillator.size = size - depth]; if(oscillator.size>1) oscillator.r = new double[oscillator.size - 1]; for(int t = 0; t<oscillator.size; t++) { oscillator.x[t] = x[t + depth] - movingAverage(depth, t + depth); if(t>0) oscillator.r[t - 1] = Math.log(oscillator.x[t]/oscillator.x[t - 1]); } return oscillator; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static double calculateMovingAverage(JsArrayNumber history) {\n double[] vals = new double[history.length()];\n long size = history.length();\n double sum = 0.0;\n double mSum = 0.0;\n long mCount = 0;\n\n // Check for sufficient data\n if (size >= 8) {\n // Clone the array and Calculate sum of the values\n for (int i = 0; i < size; i++) {\n vals[i] = history.get(i);\n sum += vals[i];\n }\n double mean = sum / size;\n\n // Calculate variance for the set\n double varianceTemp = 0.0;\n for (int i = 0; i < size; i++) {\n varianceTemp += Math.pow(vals[i] - mean, 2);\n }\n double variance = varianceTemp / size;\n double standardDev = Math.sqrt(variance);\n\n // Standardize the Data\n for (int i = 0; i < size; i++) {\n vals[i] = (vals[i] - mean) / standardDev;\n }\n\n // Calculate the average excluding outliers\n double deviationRange = 2.0;\n\n for (int i = 0; i < size; i++) {\n if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {\n mCount++;\n mSum += history.get(i);\n }\n }\n\n } else {\n // Calculate the average (not enough data points to remove outliers)\n mCount = size;\n for (int i = 0; i < size; i++) {\n mSum += history.get(i);\n }\n }\n\n return mSum / mCount;\n }", "public Builder clearAvgTreatment() {\n \n avgTreatment_ = 0D;\n onChanged();\n return this;\n }", "public void unaverage() {\n\t\tif (!averaged)\n\t\t\tthrow new AssertionError(\"can't unaverage twice!!\");\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (w[i] + wupdates[i])/(t+1.0);\n\t\t\n\t\tscale = 1.0;\n\t\taveraged = false;\n\t}", "void decrementOldDepth() {\n mOldDepth--;\n }", "public Series removeLinearTrend(double c, double r)\n {\n Series oscillator = new Series();\n oscillator.x = new double[oscillator.size = size];\n if(size>1)\n oscillator.r = new double[size - 1];\n for(int t = 0; t<size; t++)\n {\n oscillator.x[t] = x[t] - c - r*t;\n if(t>0)\n oscillator.r[t - 1] = this.r[t - 1] - r;\n }\n return oscillator;\n }", "@Test\n\tpublic void MovingAverage() {\n\t\tList<Double> high = new ArrayList<Double>();\n\t\t// high = highPriceList();\n\t\tfor (Double data2 : high) {\n\t\t\tSystem.out.println(data2);\n\t\t}\n\t\t// double[] testData = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 };\n\t\tint[] windowSizes = { 3 };\n\n\t\tfor (int windSize : windowSizes) {\n\t\t\tStock_data_controller ma = new Stock_data_controller();\n\t\t\tma.Stock_controller(windSize);\n\t\t\tfor (double x : high) {\n\t\t\t\tma.newNum(x);\n\t\t\t\tSystem.out.println(\"Next number = \" + x + \", SimpleMovingAvg = \" + ma.getAvg());\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "void decrementNewDepth() {\n mNewDepth--;\n }", "public void clearYAvg() {\n\t\tyStats.clear();\n\t}", "public Builder clearAvgControl() {\n \n avgControl_ = 0D;\n onChanged();\n return this;\n }", "public Builder clearDepth() {\n \n depth_ = 0;\n onChanged();\n return this;\n }", "private XYSeries createSeries() {\r\n return createSeries(0);\r\n }", "public void undo() {\n firePropertyChange(\"undo\", null, \"enable\");\n final Drawing removeMe = myDrawingArray.get(myDrawingArray.size() - 1);\n myDrawingArray.remove(removeMe);\n myUndoStack.push(removeMe);\n myCurrentShape = new Drawing(new Line2D.Double(), Color.WHITE, 0);\n if (myDrawingArray.isEmpty()) {\n firePropertyChange(\"stack\", null, EMPTY_STRING);\n }\n repaint();\n }", "public void decreaseDepth() {\n currentDepth--;\n }", "private void drawChart() throws ParseException {\n Calendar cal = new GregorianCalendar();\n cal.setTime(new Date());\n cal.set(Calendar.DAY_OF_MONTH, -7);\n cal.set(Calendar.HOUR_OF_DAY, 0);\n cal.set(Calendar.MINUTE, 0);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n Date startTime = cal.getTime();\n Date dayEnd = new Date();\n\n historyChart.setBackgroundColor(Color.WHITE);\n historyChart.setDrawBorders(true);\n\n\n ArrayList<String> xAxis = new ArrayList<>();\n ArrayList<Float> calories = new ArrayList<>();\n ArrayList<Float> calcium = new ArrayList<>();\n ArrayList<Float> sodium = new ArrayList<>();\n ArrayList<Float> carbs = new ArrayList<>();\n ArrayList<Float> cholestrol = new ArrayList<>();\n ArrayList<Float> iron = new ArrayList<>();\n ArrayList<Float> protien = new ArrayList<>();\n ArrayList<Float> sugar = new ArrayList<>();\n ArrayList<Float> totalfat = new ArrayList<>();\n\n NutritionHistory instance = NutritionHistory.getInstance();\n NutritionHistory.getInstance().getNutritionInformation(startTime, dayEnd, nutritionInformation -> {\n DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();\n FirebaseUser mCurrentUser = FirebaseAuth.getInstance().getCurrentUser();\n mDatabase.child(\"account\").child(mCurrentUser.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n\n double caloriesNeeded = 2000L;\n for (DataSnapshot data : dataSnapshot.getChildren()) {\n switch (data.getKey()) {\n case \"calories\":\n caloriesNeeded = Double.parseDouble(String.valueOf(data.getValue()));\n }\n }\n\n NutrientConverter converter = new NutrientConverter(caloriesNeeded);\n\n NutritionInformation.NutritionInformationBuilder builder = new NutritionInformation.NutritionInformationBuilder();\n NutritionInformation current = builder.build();\n\n Long[] days = nutritionInformation.keySet().stream().toArray(Long[]::new);\n Arrays.sort(days);\n\n for(Long day: days) {\n xAxis.add(sdf2.format(new Date(day)).toString());\n calories.add(converter.convert(\"Calories\", (float) nutritionInformation.get(day).getCalories()));\n calcium.add(converter.convert(\"Calcium\", (float) nutritionInformation.get(day).getCalcium()));\n sodium.add(converter.convert(\"Sodium\", (float)nutritionInformation.get(day).getSodium()));\n carbs.add(converter.convert(\"Carbohydrates\", (float) nutritionInformation.get(day).getCarbohydrates()));\n cholestrol.add(converter.convert(\"Cholesterol\", (float)nutritionInformation.get(day).getCholesterol()));\n iron.add(converter.convert(\"Iron\", (float)nutritionInformation.get(day).getIron()));\n protien.add(converter.convert(\"Protein\", (float)nutritionInformation.get(day).getProtein()));\n sugar.add(converter.convert(\"Sugar\", (float)nutritionInformation.get(day).getSugar()));\n totalfat.add(converter.convert(\"Total Fat\", (float)nutritionInformation.get(day).getTotalFat()));\n }\n Log.i(\"HERE\", xAxis.toString());\n LineDataSet dataCalories = addValues(\"Calories\", calories);\n dataCalories.setColor(Color.RED);\n dataCalories.setLineWidth(2f);\n\n LineDataSet dataCalcium = addValues(\"Calcium\",calcium);\n dataCalcium.setColor(Color.rgb(181, 126\t, 220));\n dataCalcium.setLineWidth(2f);\n\n LineDataSet dataSodium = addValues(\"Sodium\", sodium);\n dataSodium.setColor(Color.BLUE);\n dataSodium.setLineWidth(2f);\n\n LineDataSet dataCarbs = addValues(\"Carbohydrates\",carbs);\n dataCarbs.setColor(Color.GREEN);\n dataCarbs.setLineWidth(2f);\n\n LineDataSet dataCholesterol = addValues(\"Cholesterol\", cholestrol);\n dataCholesterol.setColor(Color.YELLOW);\n dataCholesterol.setLineWidth(2f);\n\n LineDataSet dataIron = addValues(\"Iron\",iron);\n dataIron.setColor(Color.BLACK);\n dataIron.setLineWidth(2f);\n\n LineDataSet dataProtein = addValues(\"Protein\", protien);\n dataProtein.setColor(Color.CYAN);\n dataProtein.setLineWidth(2f);\n\n LineDataSet dataSugar = addValues(\"Sugar\",sugar);\n dataSugar.setColor(Color.MAGENTA);\n dataSugar.setLineWidth(2f);\n\n LineDataSet dataTotalFat = addValues(\"Total Fat\", totalfat);\n dataTotalFat.setColor(Color.rgb(248\t,131, 121));\n dataTotalFat.setLineWidth(2f);\n\n LineData lineData = new LineData(dataCalories, dataCalcium ,dataSodium, dataCarbs, dataIron, dataSugar, dataProtein, dataTotalFat, dataCholesterol);\n historyChart.setData(lineData);\n historyChart.getXAxis().setDrawAxisLine(true);\n historyChart.setVisibleXRange(0, xAxis.size() - 1);\n historyChart.getXAxis().setValueFormatter(new MyXAxisValueFormatter(xAxis));\n historyChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);\n historyChart.enableScroll();\n historyChart.getDescription().setEnabled(false);\n historyChart.getXAxis().setLabelCount(7, true);\n historyChart.setExtraBottomOffset(20f);\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n\n }\n });\n });\n\n designChart(xAxis);\n historyChart.invalidate();\n }", "public void removeRandomLimitedDepth(){\n Node[] nodes = getRandomNonterminalNode(true); //limited depth so suppress trunc's destructiveness.\n if (nodes == null)\n return;\n \n // Generate random DecisionNode to replace\n DecisionNode replacementNode = DecisionNode.getRandom();\n \n // Update prev reference\n if (nodes[PREV].left == nodes[CURR]){\n //U.pl(\"Truncing: \" + nodes[PREV] + \", \" + nodes[CURR] + \", \" + nodes[NEXT]);\n nodes[PREV].left = replacementNode;\n } else {\n //U.pl(\"Truncing: \" + nodes[PREV] + \", \" + nodes[CURR] + \", \" + nodes[NEXT]);\n nodes[PREV].right = replacementNode;\n }\n }", "private void DeleteBurnInsOnPreviousSamples() {\n\t\tif (gibbs_sample_num <= num_gibbs_burn_in + 1 && gibbs_sample_num >= 2){\n\t\t\tgibbs_samples_of_bart_trees[gibbs_sample_num - 2] = null;\n\t\t}\n\t}", "public void undoAll() {\n firePropertyChange(\"array\", null, EMPTY_STRING);\n myDrawingArray.clear();\n myUndoStack.clear();\n myCurrentShape = new Drawing(new Line2D.Double(), Color.WHITE, 0);\n repaint();\n }", "public Builder clearSeasonCaptureScore() {\n \n seasonCaptureScore_ = 0;\n onChanged();\n return this;\n }", "public void clearXAvg() {\n\t\txStats.clear();\n\t}", "public void StandardDeviation(){\r\n\t\tAverage();\r\n\t\tif (count<=1){\r\n\t\t\tSystem.out.println(\"The Standard Deviation is \"+0.0);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tStandardDeviation=(float)Math.sqrt((Total2-Total*Total/count)/(count-1));\r\n\t\t}\r\n\t}", "public static boolean removeLinearTrend( double[] array, double timestep ) {\r\n if ((array == null) || (array.length == 0) ||\r\n (Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return false;\r\n }\r\n int len = array.length;\r\n double[] time = makeTimeArray( timestep, len);\r\n SimpleRegression regression = new SimpleRegression();\r\n for(int i = 0; i < len; i++) {\r\n regression.addData(time[i], array[i]);\r\n }\r\n //Remove the trend from the array\r\n for (int i = 0; i < len; i++) {\r\n array [i] = array[i] - regression.predict(time[i]);\r\n }\r\n return true;\r\n }", "public void deleteHistory() {\n weatherRepo.deleteAll();\n }", "void incrementOldDepth() {\n mOldDepth++;\n }", "public MutableDouble subtract(double value) {\n\t\tmDouble -= value;\n\t\treturn this;\n\t}", "public Builder removeStocks(int index) {\n if (stocksBuilder_ == null) {\n ensureStocksIsMutable();\n stocks_.remove(index);\n onChanged();\n } else {\n stocksBuilder_.remove(index);\n }\n return this;\n }", "public void removeTopLevels() {\n for (Map.Entry<Hierarchy,HierarchyAccessImpl> entry\n : hierarchyGrants.entrySet())\n {\n final HierarchyAccessImpl hierarchyAccess = entry.getValue();\n if (hierarchyAccess.topLevel != null) {\n final HierarchyAccessImpl hierarchyAccessClone =\n new HierarchyAccessImpl(\n hierarchyAccess.hierarchy,\n hierarchyAccess.access,\n null,\n hierarchyAccess.bottomLevel,\n hierarchyAccess.rollupPolicy);\n hierarchyAccessClone.memberGrants.putAll(\n hierarchyAccess.memberGrants);\n entry.setValue(hierarchyAccessClone);\n }\n }\n }", "public static < T > BasicOrderedSeries< T > copy( final BasicOrderedSeries< T > series )\n\t{\n\t\tRequire.notNull( series );\n\t\tfinal BasicOrderedSeries< T > copy = new BasicOrderedSeries< T >( series.size() );\n\t\t\n\t\tfor( BasicOrderedSeries.Entry< Double, T > entry : series )\n\t\t{\n\t\t\tcopy.add( entry.getKey(), entry.getElement() );\n\t\t}\n\t\t\n\t\treturn copy;\n\t}", "private void renewPreview() {\r\n\t\tint start = 0;\r\n\t\tsurface.clear();\r\n\t\tfor (start = 0; start < myHistoryManager.historys.size(); start++) {\r\n\t\t\tAbstractHistory history = myHistoryManager.historys.get(start);\r\n\t\t\tif (history.getType() == \"AddHistory\") {\r\n\t\t\t\tPoint endPos = ((AddHistory) history).endPos;\r\n\t\t\t\tMyColor pathColor = ((AddHistory) history).pathColor;\r\n\t\t\t\tstrokeSize = ((AddHistory) history).strokeSize;\r\n\t\t\t\tdouble x = endPos.getVector2().getX();\r\n\t\t\t\tdouble y = endPos.getVector2().getY();\r\n\r\n\t\t\t\tif (strokePointCount == 1) {\r\n\t\t\t\t\t/* set stroke color, size, and shadow */\r\n\t\t\t\t\tcanvas_context.setStrokeStyle(pathColor.getColorCode());\r\n\t\t\t\t\tcanvas_context.setFillStyle(pathColor.getColorCode());\r\n\t\t\t\t\tcanvas_context.setLineWidth(strokeSize);\r\n\t\t\t\t\tcanvas_context.setLineCap(LineCap.ROUND);\r\n\t\t\t\t\tcanvas_context.setLineJoin(LineJoin.ROUND);\r\n\t\t\t\t\tcanvas_context.stroke();\r\n\t\t\t\t\tcanvas_context.beginPath();\r\n\t\t\t\t\tcanvas_context.moveTo(x, y);\r\n\t\t\t\t}\r\n\t\t\t\tcanvas_context.lineTo(x, y);\r\n\t\t\t\tstrokePointCount++;\r\n\t\t\t\t\r\n\t\t\t} else if (history.getType() == \"PathHeadHistory\") {\r\n\t\t\t\tstrokePointCount = 0; \r\n\t\t\t\tstrokePointCount++;\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tcanvas_context.stroke();\r\n\t\t\r\n\t}", "public double[][] deconstructTimeSeries( double[] series, \n int numberOfVariables, \n int N, \n int lag )\n {\n double[][] variables = new double[ numberOfVariables ][ N ];\n\n for( int i=0; i<numberOfVariables; i++ )\n {\n int c = 0;\n for( int j=0; j<N; j++ )\n {\n variables[ i ][ j ] = series[ i * lag + c++ ];\n }\n }\n\n return variables;\n }", "public void roundUndo() {\n roundsHistory.pop();\n updateGameDescriptorAfterUndo();\n }", "public BegsBuilder preserveEdgeAttribute(StdAttribute attribute) {\n return preserveEdgeAttribute(attribute.name());\n }", "public double[][] deconstructTimeSeries( double[] series, \n int numberOfVariables, \n int lag )\n {\n int N = series.length - numberOfVariables * lag;\n while( N < 0 )\n {\n numberOfVariables--;\n N = series.length - (numberOfVariables) * lag;\n }\n double[][] variables = new double[ numberOfVariables ][ N ];\n\n for( int i=0; i<numberOfVariables; i++ )\n {\n for( int j=0; j<N; j++ )\n {\n variables[ i ][ j ] = series[ i * lag + j ];\n }\n }\n\n return variables;\n }", "public Builder clearDepth() {\n bitField0_ = (bitField0_ & ~0x00000004);\n depth_ = 0F;\n onChanged();\n return this;\n }", "@Test\n\tpublic void averageWorksForModeNone() {\n\t\tfinal FloatTimeSeries t0 = new FloatTreeTimeSeries();\n\t\tt0.addValues(TimeSeriesUtils.createStepFunction(10, 0, 10, 10, 0)); // constant function = 10\n\t\tfinal FloatTimeSeries t1 = new FloatTreeTimeSeries();\n\t\tt1.addValues(TimeSeriesUtils.createStepFunction(5, 20, 25, 20, 0)); // constant function = 20\n\t\tfinal ReadOnlyTimeSeries avg = MultiTimeSeriesUtils.getAverageTimeSeries(Arrays.<ReadOnlyTimeSeries> asList(t0, t1), 0, Long.MAX_VALUE, true, null, false);\n\t\tAssert.assertEquals(\"Time series sum has wrong number of data points\", 13, avg.size());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(20).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 20, avg.getValue(45).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 10, avg.getValue(80).getValue().getIntegerValue());\n\t}", "protected void resetShapeTimeline(RMShape aShape)\n{\n RMTimeline timeline = aShape.getTimeline(); if(timeline==null) return;\n aShape.undoerDisable();\n int time = timeline.getTime(); timeline.setTime(0); timeline.setTime(time);\n aShape.undoerEnable();\n}", "public void resetStats() {\n recentStats = new Stats();\n }", "public static ArrayList<HistoPointData> parseHistoricalJson(String json) {\n \n ArrayList<HistoPointData> dailyData = new ArrayList<>();\n \n try {\n JSONObject jsonObj = new JSONObject(json);\n jsonObj = jsonObj.getJSONObject(\"query\").getJSONObject(\"results\");\n JSONArray jsonArr = jsonObj.getJSONArray(\"quote\");\n int length = jsonArr.length();\n for (int i = 0; i < length; i++) {\n // Do stuff...\n JSONObject currObj = jsonArr.optJSONObject(length - (i+1)); // I need to reverse the order so the date is acs\n HistoPointData currPoint = new HistoPointData(currObj);\n dailyData.add(currPoint);\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n return dailyData;\n }", "void resetStationStatistics() {\n\n if (dbg) System.out.println(\"<br>resetStationStatistics: \" +\n \"depthMin, depthMax = \" + depthMin + \" \" + depthMax);\n if (dbg) System.out.println(\"<br>resetStationStatistics: \" +\n \"sampleCount = \" + sampleCount);\n if (dbg) System.out.println(\"<br>resetStationStatistics: \" +\n \"stationSampleCount = \" + stationSampleCount);\n if (dbg) System.out.println(\"<br>resetStationStatistics: \" +\n \"sampleRejectCount = \" + sampleRejectCount);\n if (dbg) System.out.println(\"<br>resetStationStatistics: \" +\n \"stationSampleRejectCount = \" + stationSampleRejectCount);\n\n depthMin = 9999.99f;\n depthMax = -9999.99f;\n stationSampleCount = 0;\n stationSampleRejectCount = 0;\n prevDepth = 0f;\n\n }", "public double[][] deconstructTimeSeries( ArrayList< Double > series, \n int numberOfVariables, \n int N, \n int lag )\n {\n double[][] variables = new double[ numberOfVariables ][ N ];\n\n for( int i=0; i<numberOfVariables; i++ )\n {\n int c = 0;\n for( int j=0; j<N; j++ )\n {\n variables[ i ][ j ] = series.get( i * lag + c++ );\n }\n }\n\n return variables;\n }", "public Builder clearDepth() {\n bitField0_ = (bitField0_ & ~0x00000002);\n depth_ = 0F;\n onChanged();\n return this;\n }", "@Override\n void updateStockLevels(){\n for(OrderLine orderLine : products){\n Product p = orderLine.getProduct();\n //remove quantity ordered from stock levels\n p.updateNumInStock(-orderLine.getQuantity());\n }\n }", "private XYChart.Series<String, Double> resizeDataSeries(XYChart.Series<String, Double> series) {\n int adjustedNumPoints = MAX_DATA_POINTS - 2;\n int adjustedLength = series.getData().size() - 2;\n double divisor = adjustedLength - adjustedNumPoints + 1;\n double removeEvery = adjustedLength / divisor;\n double indexSum = removeEvery;\n int[] skippedIndices = new int[adjustedLength - adjustedNumPoints];\n int skippedIndex = (int) Math.ceil(indexSum);\n int i = 0;\n\n XYChart.Series<String, Double> resizedSeries = new XYChart.Series<>();\n XYChart.Data<String, Double> first = series.getData().get(0);\n XYChart.Data<String, Double> last = series.getData().get(series.getData().size() - 1);\n\n series.getData().remove(0);\n series.getData().remove(series.getData().size() - 1);\n resizedSeries.getData().add(first);\n\n while (skippedIndex < adjustedLength) {\n skippedIndices[i] = skippedIndex;\n indexSum += removeEvery;\n skippedIndex = (int) Math.ceil(indexSum);\n i += 1;\n }\n\n i = 0;\n skippedIndex = skippedIndices[i];\n\n for (int j = 0; j < series.getData().size(); j++) {\n if (j != skippedIndex) {\n resizedSeries.getData().add(series.getData().get(j));\n } else if (i < skippedIndices.length - 1) {\n i += 1;\n skippedIndex = skippedIndices[i];\n }\n }\n\n resizedSeries.getData().add(last);\n\n return resizedSeries;\n }", "@Generated(hash = 74421150)\n public synchronized void resetForecast() {\n forecast = null;\n }", "@Override\n protected void seriesRemoved(Series<X,Y> series) {\n for(XYChart.Data<X,Y> xydata : series.getData() ){\n Node holder = xydata.getNode();\n getPlotChildren().remove(holder);\n }\n removeSeriesFromDisplay(series);\n }", "private void disposeUndoHistory() {\n \t\tfHistory.dispose(fUndoContext, true, true, true);\n \t}", "@Deprecated\n public Graph getLineage(String hash, String direction, int maxDepth)\n {\n Graph result = new Graph();\n Vertex previousVertex = null;\n Vertex currentVertex = null;\n int depth = 0;\n Queue<Vertex> queue = new LinkedList<>();\n queue.add(getVertex(hash));\n while(!queue.isEmpty() && depth < maxDepth)\n {\n currentVertex = queue.remove();\n String currentHash = currentVertex.getAnnotation(\"hash\");\n if(DIRECTION_ANCESTORS.startsWith(direction.toLowerCase()))\n queue.addAll(getParents(currentHash).vertexSet());\n else if(DIRECTION_DESCENDANTS.startsWith(direction.toLowerCase()))\n queue.addAll(getChildren(currentHash).vertexSet());\n\n result.putVertex(currentVertex);\n if(previousVertex != null)\n result.putEdge(getEdge(previousVertex.getAnnotation(\"hash\"), currentHash));\n\n previousVertex = currentVertex;\n depth++;\n }\n\n return result;\n }", "private TimeSeries initMovingTimeSeries(int maxBarCount) {\n //TimeSeries series = CsvTradesLoader.loadBitstampSeries();\n //TimeSeries series = CsvTicksLoader.load(\"EURUSD_Daily_201701020000_201712290000.csv\");\n //TimeSeries series = CsvTicksLoader.load(\"2019_D.csv\");\n\n TimeSeries series = new BaseTimeSeries(selected.getPeriod().getName());\n\n for (PeriodBar periodBar : selected.getPeriod().getBars()) {\n ZonedDateTime time = periodBar.getEndTime();\n double open = periodBar.getOpenPrice().doubleValue();\n double close = periodBar.getClosePrice().doubleValue();\n double max = periodBar.getMaxPrice().doubleValue();\n double min = periodBar.getMinPrice().doubleValue();\n double vol = periodBar.getVolume().doubleValue();\n\n series.addBar(new BaseBar(time, open, max, min, close, vol));\n }\n\n System.out.print(\"Initial bar count: \" + series.getBarCount());\n // Limitating the number of bars to maxBarCount\n series.setMaximumBarCount(maxBarCount);\n LAST_BAR_CLOSE_PRICE = series.getBar(series.getEndIndex()).getClosePrice();\n System.out.println(\" (limited to \" + maxBarCount + \"), close price = \" + LAST_BAR_CLOSE_PRICE);\n\n //live = CsvTicksLoader.load(\"2020_D.csv\");\n //live = CsvTicksLoader.load(\"2020_D.csv\");\n\n live = new BaseTimeSeries(selected.getName());\n\n for (ForwardTestBar forwardTestBar : selected.getBars()) {\n ZonedDateTime time = forwardTestBar.getEndTime();\n double open = forwardTestBar.getOpenPrice().doubleValue();\n double close = forwardTestBar.getClosePrice().doubleValue();\n double max = forwardTestBar.getMaxPrice().doubleValue();\n double min = forwardTestBar.getMinPrice().doubleValue();\n double vol = forwardTestBar.getVolume().doubleValue();\n\n live.addBar(new BaseBar(time, open, max, min, close, vol));\n }\n\n return series;\n }", "public double getStandardDeviation() {\r\n\t\tdouble standDev=0;\r\n\t\tdouble avgD=getAverageDuration();\r\n\t\tdouble zaehler=0;\r\n\t\tfor(int a=0;a<populationSize();a++) {\r\n\t\t\tzaehler+=Math.pow((avgD-getTour(a).getDuration()), 2);\r\n\t\t}\r\n\t\tstandDev=Math.pow((zaehler/populationSize()), 0.5);\r\n\t\treturn standDev;\r\n\t }", "public double[][] deconstructTimeSeries( ArrayList< Double > series, \n int numberOfVariables, \n int lag )\n {\n int N = series.size() - numberOfVariables * lag;\n while( N < 0 )\n {\n numberOfVariables--;\n N = series.size() - (numberOfVariables) * lag;\n }\n double[][] variables = new double[ numberOfVariables ][ N ];\n\n for( int i=0; i<numberOfVariables; i++ )\n {\n for( int j=0; j<N; j++ )\n {\n variables[ i ][ j ] = series.get( i * lag + j );\n }\n }\n\n return variables;\n }", "public void resetGraph(){\n removeAllSeries();\n removeSeries(xySeries);\n removeSeries(currentPoint);\n xySeries = new PointsGraphSeries<>();\n currentPoint = new PointsGraphSeries<>();\n initGraph();\n }", "@Override\n\t\tpublic void update(Observable o, Object arg) {\n\t\t\tif (series.size() > HISTORY_SIZE) {\n\t\t\t\tseries.removeFirst();\n\t\t\t}\n\t\t\t// Get the signal strength as Asu level\n\t\t\tint ssAsu = ssSampler.getSignalStrength()\n\t\t\t\t\t.getGsmSignalStrength();\n\t\t\t// add the latest history sample:\n\t\t\tseries.addLast(null, ssAsu);\n\t\t\tplot.redraw();\n\t\t}", "public void updateLineChart()\r\n {\r\n hoursLoggedSeries = new XYChart.Series<>();\r\n hoursLoggedSeries.setName(Integer.toString(LocalDate.now().getYear()));\r\n lineChart.getData().clear();\r\n \r\n try{\r\n populateSeriesFromDB();\r\n }\r\n catch(SQLException e)\r\n {\r\n System.err.println(e.getMessage());\r\n }\r\n lineChart.getData().addAll(hoursLoggedSeries);\r\n }", "public void removeLayer(int index){\n history.removeIndex(index);\n historyValues.removeIndex(index);\n }", "void unsetDSTSavings();", "public void average() {\n\t\tif (averaged)\n\t\t\tthrow new AssertionError(\"can't average twice!!\");\n\t\t\n\t\tscale = 1.0/(double)t;\n\t\t\n\t\tfor (int i = 0; i < w.length; i++)\n\t\t\tw[i] = (t+1.0)*w[i] - wupdates[i];\n\t\t\n\t\taveraged = true;\n\t\n\t}", "@Override\n\tprotected IStorer<CommandEvent> createDataStorer() {\n\t\treturn null;\n\t}", "public static boolean removeLinearTrendFromSubArray( double[] array, \r\n double[] subarray, double timestep ) {\r\n if ((array == null) || (array.length == 0) || (subarray == null) ||\r\n (subarray.length == 0) ||(Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return false;\r\n }\r\n int lenfull = array.length;\r\n int lensub = subarray.length;\r\n double[] time = makeTimeArray( timestep, lensub);\r\n SimpleRegression regression = new SimpleRegression();\r\n for(int i = 0; i < lensub; i++) {\r\n regression.addData(time[i], subarray[i]);\r\n }\r\n //Remove the trend from the first array\r\n double[] fulltime = makeTimeArray( timestep, lenfull);\r\n for (int i = 0; i < lenfull; i++) {\r\n array [i] = array[i] - regression.predict(fulltime[i]);\r\n }\r\n return true;\r\n }", "private void invokeHistoricChart(StockData sd)\r\n {\r\n\r\n debug(\"invokeHistoricChart(\" + sd.getName().toString() + \") - preparing to change\");\r\n\r\n String fileName = getString(\"WatchListTableModule.edit.historic_details_basic_name\") + sd.getSymbol().getDataSz();\r\n java.io.File theFile = new java.io.File(fileName);\r\n\r\n // First signal the chart if we are demo mode, we really do not want a problem\r\n // Then create a new instance of our chart.\r\n com.stockmarket.chart.ohlc.HighLowStockChart.DEMO_MODE = this.DEMO_MODE;\r\n com.stockmarket.chart.ohlc.HighLowStockChart chart = new com.stockmarket.chart.ohlc.HighLowStockChart();\r\n // If we have historic data send it through\r\n if (theFile.exists())\r\n {\r\n debug(\"invokeHistoricChart() - \" + fileName + \" exists preparing the Historic Chart\");\r\n chart.displayHighLowChart(fileName);\r\n }\r\n else if (this.DEMO_MODE)\r\n {\r\n // If we are demo mode display the Chart. With its default data\r\n javax.swing.JOptionPane.showMessageDialog(\r\n null,\r\n \"Application is in DEMO Mode\\n\"\r\n + \"No historic data for \"\r\n + sd.getName().toString()\r\n + \" exists, displaying default graph.\");\r\n chart.displayHighLowChart(null);\r\n }\r\n else\r\n {\r\n // If we are live mode and no historic data - tell the user to try later.\r\n // This is the case where the user reached a item to display as a chart\r\n // before the program has finished downloading.\r\n javax.swing.JOptionPane.showMessageDialog(\r\n null,\r\n \"Application has no historic data for \" + sd.getName().toString() + \"\\nTry again later!\");\r\n }\r\n\r\n debug(\"invokeHistoricChart() - Processing completed\");\r\n }", "private void fill() {\n\t\tseries1.clear();\n\t\tint m = 50;\n\t\tdouble tmpX, tmpZ;\n\n\t\tfor (double x=-m; x <= +m; x++) {\n\t\t\ttmpX = MathUtils.sqr(x/30);\n\t\t\tfor (double z=-m; z <= +m; z++) {\n\t\t\t\ttmpZ = MathUtils.sqr(z/30);\n\t\t\t\ttmpZ = Math.sqrt(tmpX+tmpZ);\n\t\t\t\tseries1.add(x, 4*Math.cos(3*tmpZ)*Math.exp(-0.5*tmpZ), z);\n\t\t\t}\n\t\t}\n\t }", "public void decreaseCurrentDepth(){\n currentDepth--;\n if (this.children == null) generateChildren();\n else {\n for (Node child : this.children) child.decreaseCurrentDepth();\n }\n }", "public void setDepth(double depth) {\n\t\t this.depth = depth;\n\t }", "public void setAveragePosition(Double averagePosition) {\r\n this.averagePosition = averagePosition;\r\n }", "public TimeDecayingAverage(double phi, double average) {\n setPhi(phi);\n this.average = average;\n }", "public static Double getGaussian(final Double average, final Double relStdDeviation){\r\n\t\tDouble absStdDeviation = average * relStdDeviation;\r\n\t\treturn new Random().nextGaussian() * absStdDeviation + average; \r\n\t}", "public MachineState performDepthCharge(MachineState state, final int[] theDepth) throws TransitionDefinitionException, MoveDefinitionException, StateMachineException {\n int nDepth = 0;\n while(!isTerminal(state)) {\n nDepth++;\n\n //System.out.println(\"!\");\n //System.out.println(getRandomJointMove(state));\n //System.out.println(\"!\");\n\n state = getNextStateDestructively(state, getRandomJointMove(state));\n }\n if(theDepth != null)\n theDepth[0] = nDepth;\n return state;\n }", "public void setTempAvgNightly(Double tempAvgNightly) {\r\n\t\tthis.tempAvgNightly = tempAvgNightly;\r\n\t}", "public void unselect() {\n for (int i = 0; i < series.size(); i++) {\n series.setItemSliced(i, false, false, true);\n }\n }", "public double denormalize(double value, String attributeTag);", "public void reset() {\n this.count = 0;\n this.average = 0.0;\n }", "public void tegnTre() {\r\n tegneBrett.getChildren().clear();\r\n if (root != null) {\r\n tegnTre(root, tegneBrett.getWidth() / 2, høydeAvstand,\r\n tegneBrett.getWidth() / 4);\r\n }\r\n }", "public void disableDashedHighlightLine() { this.mHighlightDashPathEffect = null; }", "public final void dup() {\n\t\tif (size > 0) {\n\t\t\tdouble topMostValue = stack[index];\n\t\t\tpush(topMostValue);\n\t\t}\n\t}", "public void deleteMin() {\n if (isEmpty()) throw new NoSuchElementException(\"Symbol table underflow\");\n root = deleteMin(root);\n// TODO:adding check for assurance\n }", "protected void resetEstimatedSpan(int childIndex, int count) {\n while (--count >= 0) {\n ViewLayoutState child = getChild(childIndex);\n View childView = child.getView();\n if (childView instanceof EstimatedSpanView) {\n ((EstimatedSpanView)childView).setEstimatedSpan(false);\n }\n childIndex++;\n }\n }", "public Builder clearNormal() {\n \n normal_ = false;\n onChanged();\n return this;\n }", "public void setTempAvgDaily(Double tempAvgDaily) {\r\n\t\tthis.tempAvgDaily = tempAvgDaily;\r\n\t}", "@Test\n\tpublic void averageWorksForModeSteps() {\n\t\tfinal FloatTimeSeries t0 = new FloatTreeTimeSeries();\n\t\tt0.addValues(TimeSeriesUtils.createStepFunction(10, 0, 10, 10, 0)); // constant function = 10\n\t\tfinal FloatTimeSeries t1 = new FloatTreeTimeSeries();\n\t\tt1.addValues(TimeSeriesUtils.createStepFunction(5, 20, 25, 20, 0)); // constant function = 20\n\t\tt0.setInterpolationMode(InterpolationMode.STEPS);\n\t\tt1.setInterpolationMode(InterpolationMode.STEPS);\n\t\tfinal ReadOnlyTimeSeries avg = MultiTimeSeriesUtils.getAverageTimeSeries(Arrays.<ReadOnlyTimeSeries> asList(t0, t1), 0, Long.MAX_VALUE, true, null, false);\n\t\t// one data point outside time range, one boundary value should be added\n\t\tAssert.assertEquals(\"Time series sum has wrong number of data points\", 13, avg.size());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 10, avg.getValue(7).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(23).getValue().getIntegerValue());\n\t\tAssert.assertEquals(\"Unexpected value in time series sum\", 15, avg.getValue(100).getValue().getIntegerValue());\n\t}", "public TimeDecayingAverage(double phi) {\n this(phi, 0D);\n }", "public void resetAccumulatedDoseRate() throws ConnectionFailedException, NoSuchSimulationException\n\t{\n\t\tString jsonEvent = \"{\"\n\t\t\t\t+ \" \\\"Command\\\": \\\"reset accumulated dose rate\\\",\"\n\t\t\t\t+ \" \\\"Sensor\\\": \\\"i27\\\",\"\n\t\t\t\t+ \" \\\"Id\\\": \\\"\" + sessionID + \"\\\"\"\n\t\t\t\t+ \"}\";\n\t\tconnection.sendPOSTEvent(\"sensors/event\", jsonEvent);\n\t}", "@Override\n public void unDraw() {\n index--;\n }", "public static WeatherDataModel dailyForecastFromJson(final JSONObject jsonObject) throws JSONException {\n final WeatherDataModel model = new WeatherDataModel();\n List<WeatherDataModel> list = model.getDailyForecast();\n for(int i=0; i<jsonObject.getJSONArray(\"list\").length(); i++) {\n list.add(dailyWeatherElement(jsonObject.getJSONArray(\"list\").getJSONObject(i)));\n }\n return model;\n }", "private double calculateAverage(Candle[] cd) {\n double sum = 0; \r\n for(Candle c : cd) {\r\n sum += c.getClose();\r\n }\r\n return sum/cd.length;\r\n \r\n }", "public Builder clearNormal() {\n if (normalBuilder_ == null) {\n normal_ = null;\n onChanged();\n } else {\n normal_ = null;\n normalBuilder_ = null;\n }\n\n return this;\n }", "public static BigDecimal calculateMean(Position position) {\n BigDecimal meanStockPrice = new BigDecimal(\"0.0\");\n\n // Increment through the data and sum them all up\n for (int i = 0; i < position.getHistoricalDataSize(); i++) {\n meanStockPrice = meanStockPrice.add(position.getHistoricalData().get(i).getAdjClose());\n }\n\n meanStockPrice = meanStockPrice\n .divide(new BigDecimal(position.getHistoricalDataSize()), divisionScale, RoundingMode.UP);\n\n position.setMeanPrice(meanStockPrice);\n return meanStockPrice;\n }", "public double movingAverage(int periods, int t)\n {\n if(periods>t + 1 || periods<1)\n throw new IndexOutOfBoundsException(\"MA(\" + periods + \") is undefined at time \" + t);\n double sum = 0.0;\n for(int i = t - periods + 1; i<=t; i++)\n sum += x[i];\n return sum/periods;\n }", "private void removeOldestPoint() {\n PathPoint p = points.get(points.size() - length - 1);\n // if points has 5 points (0-4), length=3, then remove points(5-3-1)=points(1) leaving 2-4 which is correct\n float t = p.t - firstTimestamp;\n st -= t;\n sx -= p.x;\n sy -= p.y;\n stt -= t * t;\n sxt -= p.x * t;\n syt -= p.y * t;\n }", "public static Element undressAbsOld(F a, Ring ring){\n if (a.name==F.ABS){ \n if (a.X[0] instanceof F) {Element ee=undressAbs(((F)(a.X[0])), ring); if(ee!=null) return ee;}\n return a.X[0]; } \n Element[] nX=null; boolean flagAbs=false;\n if (a.name==F.MULTIPLY) { nX=new Element[a.X.length];\n for (int i = 0; i < a.X.length; i++) {\n if ((a.X[i] instanceof F)&&(((F)a.X[i]).name==F.ABS)) {\n Element ee=((F)a.X[i]).X[0];\n flagAbs=true;\n if (ee instanceof F){\n ee = undressAbs(((F)ee), ring);\n nX[i]= (ee==null)? ((F)a.X[i]).X[0]: ee;\n } else {\n nX[i] = ee;\n }\n }\n else if ((a.X[i].isItNumber(ring))&&(!a.X[i].isNegative())) nX[i]= a.X[i];\n else return null;\n } return (flagAbs)? new F (F.MULTIPLY, nX) : null;\n }\n if (a.name==F.DIVIDE) { nX=new Element[2];\n for (int i = 0; i < 2; i++) {\n if ((a.X[i] instanceof F)&&(((F)a.X[i]).name==F.ABS)){ Element ee=((F)a.X[i]).X[0]; flagAbs=true;\n if ( (ee instanceof F)){ ee= undressAbs(((F)ee), ring); nX[i]= (ee==null)? ((F)a.X[i]).X[0]:ee;}}\n else if ((a.X[i].isItNumber(ring))&&(!a.X[i].isNegative())) nX[i]= a.X[i];\n else return null;\n }\n return (flagAbs)? new F (F.DIVIDE, nX) : null;\n } return null;\n }", "public void clearDateALR() {\r\n\t\t//System.out.println(\"Clear= \" + counter);\r\n\t\twhile (historyDate.size() != counter) {\r\n\t\t\thistoryDate.removeLast();\r\n\t\t\thistoryAL.removeLast();\r\n\t\t}\r\n\t}", "public Builder setAvgTreatment(double value) {\n \n avgTreatment_ = value;\n onChanged();\n return this;\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Scheduler scheduler\r\n\t) {\r\n\t\treturn replay(source, 1, scheduler);\r\n\t}", "public void setMovingAverageSamples(int count)\n {\n NumAvgSamples = count;\n }", "public void deleteMin() {\n if (isEmpty()) throw new NoSuchElementException(\"Symbol table underflow\");\n root = deleteMin(root);\n }", "public static TwitterTrend convertTrend(JSONObject obj) throws JSONException\n\t{\n\t\tTwitterTrend res=new TwitterTrend();\t\t\n\t\tres.setName(obj.getString(\"name\"));\n\t\tres.setUrl(obj.getString(\"url\"));\n\t\t\n\t\treturn res;\n\t}", "public MovingAverage(int size) {\n q = new LinkedList();\n this.size = size;\n sum = 0;\n }", "private void removeGravity(SensorEvent event){\n\n final float alpha = 0.8f;\n\n // Isolate the force of gravity with the low-pass filter.\n mGravity[0] = alpha * mGravity[0] + (1 - alpha) * event.values[0];\n mGravity[1] = alpha * mGravity[1] + (1 - alpha) * event.values[1];\n mGravity[2] = alpha * mGravity[2] + (1 - alpha) * event.values[2];\n\n // Remove the gravity contribution with the high-pass filter.\n mLinearAcceleration[0] = event.values[0] - mGravity[0];\n mLinearAcceleration[1] = event.values[1] - mGravity[1];\n mLinearAcceleration[2] = event.values[2] - mGravity[2];\n\n }", "public Builder clearParentMonsterIndex() {\n \n parentMonsterIndex_ = 0;\n onChanged();\n return this;\n }", "@Test\r\n\tpublic void exerciseMovingAverage() {\n\t\tList<Integer> temparaturArray = Arrays.asList(8, 7, 6, 6, 7, 7, 8, 10, 13, 16, 10, 20, 23, 26, 30, 29, 27, 45, 24, 23, 20, 18, 15, 11);\r\n\t\tObservable<Integer> temparaturSequence = Observable\r\n\t\t\t\t.interval(0, 1L, TimeUnit.HOURS, testScheduler)\r\n\t\t\t\t.take(temparaturArray.size())\r\n\t\t\t\t.map(i -> temparaturArray.get(i.intValue()));\r\n\t\t\r\n\t\t// TODO: calculate the moving average (SMA) of the given temperature sequence (each hour of a single day).\r\n\t\t// use the previous three values for each data point.\r\n // HINT: use a suitable overload of the same method used in \"Batching\"\r\n // and then calculate the average of each batch using LINQ\r\n // HINT: don't forget to pass the scheduler\r\n\t\tObservable<Double> movingAverage = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<Double> testSubscriber = new TestSubscriber<>();\r\n\t\tmovingAverage.subscribe(testSubscriber);\r\n\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(1, TimeUnit.DAYS);\r\n\t\t\r\n\t\tlog(testSubscriber.getOnNextEvents());\r\n\t\t\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\t\r\n\t\t// expected values:\r\n\t\tList<Double> expected = Arrays.asList(\r\n\t\t\t\t7.0, 6.333333333333333, 6.333333333333333, 6.666666666666667, 7.333333333333333, \r\n\t\t\t\t8.333333333333334, 10.333333333333334, 13.0, 13.0, 15.333333333333334, \r\n\t\t\t\t17.666666666666668, 23.0, 26.333333333333332, 28.333333333333332, \r\n\t\t\t\t28.666666666666668, 33.666666666666664, 32.0, 30.666666666666668, \r\n\t\t\t\t22.333333333333332, 20.333333333333332, 17.666666666666668, 14.666666666666666, \r\n\t\t\t\t// the last two values have limited input, i.e.\r\n\t\t\t\t// (15+11)/2 and (11)/1\r\n\t\t\t\t13.0, 11.0);\r\n\t\ttestSubscriber.assertReceivedOnNext(expected);\r\n\t\t\r\n\t}", "public IntegrityHistory getTrend() {\n\t\tRunList<?> tempRuns = job.getBuilds();\n\t\treturn new IntegrityHistory(tempRuns);\n\t}", "public MovingAverage(int size) {\r\n this.size = size;\r\n }", "public MovingAverage(int size) {\n value = new int[size];\n }" ]
[ "0.50266796", "0.46697804", "0.46451804", "0.46282667", "0.4593762", "0.45455372", "0.44172737", "0.43962234", "0.420705", "0.41807774", "0.41794118", "0.41414747", "0.4132326", "0.41083792", "0.4102095", "0.40482166", "0.40200713", "0.39770633", "0.39330322", "0.3888552", "0.38744983", "0.38616708", "0.38515133", "0.38463315", "0.3831367", "0.38272756", "0.3823852", "0.3804518", "0.37999597", "0.37990287", "0.37955663", "0.37845546", "0.37834486", "0.378223", "0.3780065", "0.37795925", "0.37716323", "0.37687546", "0.37636375", "0.3758503", "0.3755686", "0.37487814", "0.37487075", "0.37466103", "0.3743315", "0.37385768", "0.373799", "0.37337118", "0.3733496", "0.37305784", "0.3727402", "0.3718563", "0.37076396", "0.37071705", "0.37067947", "0.36949974", "0.36949134", "0.36931637", "0.36928743", "0.36923942", "0.36822024", "0.36781627", "0.36757246", "0.36627218", "0.36585027", "0.36486536", "0.3646036", "0.36432406", "0.36307", "0.36297184", "0.36231965", "0.36190376", "0.36139902", "0.36137083", "0.36049145", "0.36039844", "0.36005375", "0.3596645", "0.3595232", "0.35803694", "0.35777017", "0.3576307", "0.3574009", "0.3573066", "0.3572284", "0.35714948", "0.35650814", "0.3560683", "0.35597587", "0.3558543", "0.3556684", "0.3555053", "0.35538927", "0.35485375", "0.35459593", "0.3543464", "0.35407162", "0.3525464", "0.3523865", "0.35224238" ]
0.7574231
0
Create a new historical series from this one by removing the given linear trend. This method is intended for use on logarithmic series only. Applying it to a linear series is possible, but would be a conceptual error.
public Series removeLinearTrend(double c, double r) { Series oscillator = new Series(); oscillator.x = new double[oscillator.size = size]; if(size>1) oscillator.r = new double[size - 1]; for(int t = 0; t<size; t++) { oscillator.x[t] = x[t] - c - r*t; if(t>0) oscillator.r[t - 1] = this.r[t - 1] - r; } return oscillator; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static boolean removeLinearTrend( double[] array, double timestep ) {\r\n if ((array == null) || (array.length == 0) ||\r\n (Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return false;\r\n }\r\n int len = array.length;\r\n double[] time = makeTimeArray( timestep, len);\r\n SimpleRegression regression = new SimpleRegression();\r\n for(int i = 0; i < len; i++) {\r\n regression.addData(time[i], array[i]);\r\n }\r\n //Remove the trend from the array\r\n for (int i = 0; i < len; i++) {\r\n array [i] = array[i] - regression.predict(time[i]);\r\n }\r\n return true;\r\n }", "public Series removeDelayedTrend(int depth)\n {\n if(depth<1 || depth>=size)\n throw new IndexOutOfBoundsException();\n Series oscillator = new Series();\n oscillator.x = new double[oscillator.size = size - depth];\n if(oscillator.size>1)\n oscillator.r = new double[oscillator.size - 1];\n for(int t = 0; t<oscillator.size; t++)\n {\n oscillator.x[t] = x[t + depth] - movingAverage(depth, t + depth);\n if(t>0)\n oscillator.r[t - 1] = Math.log(oscillator.x[t]/oscillator.x[t - 1]);\n }\n return oscillator;\n }", "public Series logarithmic()\n {\n Series logarithmic = new Series();\n logarithmic.x = new double[logarithmic.size = size];\n logarithmic.r = r;\n for(int t = 0; t<size; t++)\n logarithmic.x[t] = Math.log(x[t]);\n return logarithmic;\n }", "public static boolean removeLinearTrendFromSubArray( double[] array, \r\n double[] subarray, double timestep ) {\r\n if ((array == null) || (array.length == 0) || (subarray == null) ||\r\n (subarray.length == 0) ||(Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return false;\r\n }\r\n int lenfull = array.length;\r\n int lensub = subarray.length;\r\n double[] time = makeTimeArray( timestep, lensub);\r\n SimpleRegression regression = new SimpleRegression();\r\n for(int i = 0; i < lensub; i++) {\r\n regression.addData(time[i], subarray[i]);\r\n }\r\n //Remove the trend from the first array\r\n double[] fulltime = makeTimeArray( timestep, lenfull);\r\n for (int i = 0; i < lenfull; i++) {\r\n array [i] = array[i] - regression.predict(fulltime[i]);\r\n }\r\n return true;\r\n }", "@Override\n\t\tpublic void update(Observable o, Object arg) {\n\t\t\tif (series.size() > HISTORY_SIZE) {\n\t\t\t\tseries.removeFirst();\n\t\t\t}\n\t\t\t// Get the signal strength as Asu level\n\t\t\tint ssAsu = ssSampler.getSignalStrength()\n\t\t\t\t\t.getGsmSignalStrength();\n\t\t\t// add the latest history sample:\n\t\t\tseries.addLast(null, ssAsu);\n\t\t\tplot.redraw();\n\t\t}", "public void removeHistory(long _rowIndex) {\n\t// Delete the row.\n\t SQLiteDatabase db = SQLiteDatabase.openDatabase(context.getDatabasePath(DATABASE_NAME).getAbsolutePath(), null, SQLiteDatabase.CREATE_IF_NECESSARY);\n \n String sql = \"Delete from airtime_history where _id = \" + _rowIndex; \n db.execSQL(sql);\n db.close();\n }", "public void updateLineChart()\r\n {\r\n hoursLoggedSeries = new XYChart.Series<>();\r\n hoursLoggedSeries.setName(Integer.toString(LocalDate.now().getYear()));\r\n lineChart.getData().clear();\r\n \r\n try{\r\n populateSeriesFromDB();\r\n }\r\n catch(SQLException e)\r\n {\r\n System.err.println(e.getMessage());\r\n }\r\n lineChart.getData().addAll(hoursLoggedSeries);\r\n }", "private Line linearRegression(ArrayList<Point> points) {\n double sumx = 0.0, sumz = 0.0, sumx2 = 0.0;\n\n for (int i = 0; i < points.size(); i++) {\n Point curPoint = points.get(i);\n sumx += curPoint.x;\n sumz += curPoint.z;\n sumx2 += curPoint.x*curPoint.x;\n }\n\n double xbar = sumx/((double) points.size());\n double zbar = sumz/((double) points.size());\n\n double xxbar = 0.0, xzbar = 0.0;\n\n for (int i = 0; i < points.size(); i++) {\n Point curPoint = points.get(i);\n xxbar += (curPoint.x - xbar) * (curPoint.x - xbar);\n xzbar += (curPoint.x - xbar) * (curPoint.z - zbar);\n }\n\n double slope = xzbar / xxbar;\n double intercept = zbar - slope * xbar;\n\n return new Line(slope, intercept);\n }", "public void removePlotData() {\n\t\tif (xySeries != null) {\n\t\t\tfor (int i = 0; i < xySeries.length; i++) {\n\t\t\t\tif (xySeries[i] != null) {\n\t\t\t\t\txySeries[i].clear();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tseriesCount = 0;\n\t\txySeries = new XYSeries[seriesCount + 1];\n\t}", "public void excluirUltimaLinha() {\n valor = venda.BuscaultValor(ultimacod) - ultimoValor;\n int tempqte = venda.BuscaQte(ultimacod) + ultimaQte;\n SubMatRemove(ultimoValor, Double.parseDouble(jTxtSubTotal.getText()));\n AtulizaBanco(ultimacod, fun.getMatricula(), valor, tempqte);\n ((DefaultTableModel) jTable1.getModel()).removeRow(jTable1.getRowCount() - 1);\n }", "@Override\n\tpublic OnlineRegression copyNew() {\n\t\tBayesianLinearRegression copy = new BayesianLinearRegression(dimension, this.prioriMeans, prioriPrecision);\n\t\tcopy.weights = this.weights.copyNew();\n\t\tcopy.covariance = this.covariance.copyNew();\n\t\tcopy.b = this.b.copyNew();\n\t\tcopy.numTrainedInstances = this.numTrainedInstances;\n\t\treturn copy;\n\t}", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {9}, optParamIndex = {0, 1, 2, 3, 4, 5, 6, 7, 8}, javaType = {com.exceljava.com4j.excel.XlTrendlineType.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.Int32, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_I4, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"-4132\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add();", "void removeCalcValueListener(CalcValueListener l);", "public void removeCallLog(CallLog callLog);", "public NonLinear(double[] x, double[] y, RealValuedFunctionVA rf,\n\t\t\t Config config)\n\t{\n\t this(x, y, rf, config, null);\n\t}", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 2, 3, 4, 5, 6, 7, 9}, optParamIndex = {8}, javaType = {java.lang.Object.class}, nativeType = {NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR}, literal = {\"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object period,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object forward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object backward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object intercept,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object displayEquation,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object displayRSquared);", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 2, 9}, optParamIndex = {3, 4, 5, 6, 7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object period);", "public int removeHistory(String type, Date startDate, Date endDate);", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 2, 3, 9}, optParamIndex = {4, 5, 6, 7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object period,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object forward);", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 2, 3, 4, 5, 6, 9}, optParamIndex = {7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object period,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object forward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object backward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object intercept,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object displayEquation);", "private NonLinear(NonLinear existing) {\n\t this.rf = existing.rf;\n\t int n = existing.getNumberOfParameters();\n\t extendedParameters = new double[n+1];\n\t setParameters(new double[n]);\n\t}", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 2, 3, 4, 5, 9}, optParamIndex = {6, 7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object period,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object forward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object backward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object intercept);", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 9}, optParamIndex = {1, 2, 3, 4, 5, 6, 7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type);", "public static double[] findLinearTrend( double[] array, double timestep ) {\r\n if ((array == null) || (array.length == 0) ||\r\n (Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return new double[0];\r\n }\r\n int len = array.length;\r\n double[] time = makeTimeArray( timestep, len);\r\n SimpleRegression regression = new SimpleRegression();\r\n for(int i = 0; i < len; i++) {\r\n regression.addData(time[i], array[i]);\r\n }\r\n //Get the baseline function\r\n double[] baseline = new double[len];\r\n for (int i = 0; i < len; i++) {\r\n baseline[i] = regression.predict(time[i]);\r\n }\r\n return baseline;\r\n }", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 2, 3, 4, 9}, optParamIndex = {5, 6, 7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object period,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object forward,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object backward);", "public void clearHistory() {\n while (eqn != null) {\n eqn = eqn.next;\n }\n EquationList eqn = null;\n }", "public void removeTerm(Term oldTerm)\r\n\t{\r\n\t\tArrayList<Term> terms = new ArrayList<Term>(Arrays.asList(this.terms));\r\n\t\tterms.remove(oldTerm);\r\n\t\tthis.terms = terms.toArray(new Term[0]);\t\t\r\n\t}", "void clearHistoryData();", "@VTID(10)\n @UseDefaultValues(paramIndexMapping = {0, 1, 9}, optParamIndex = {2, 3, 4, 5, 6, 7, 8}, javaType = {java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {\"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\", \"80020004\"})\n @ReturnValue(index=9)\n com.exceljava.com4j.excel.Trendline add(\n @Optional @DefaultValue(\"-4132\") com.exceljava.com4j.excel.XlTrendlineType type,\n @Optional @MarshalAs(NativeType.VARIANT) java.lang.Object order);", "public void removeOldRecords();", "void unsetValuePeriod();", "public void removeJbdTravelPointLog2013(final String logId);", "public RenkoIndicator(TimeSeries series) {\r\n\t\tsuper(series);\r\n\t\tthis.series = series;\r\n\t}", "public void clearDateALR() {\r\n\t\t//System.out.println(\"Clear= \" + counter);\r\n\t\twhile (historyDate.size() != counter) {\r\n\t\t\thistoryDate.removeLast();\r\n\t\t\thistoryAL.removeLast();\r\n\t\t}\r\n\t}", "public void removeFinArFundsInActionAppliedHistory(FinArFundsInActionAppliedHistory finArFundsInActionAppliedHistory);", "public void removeReadingPointListener(ReadingPointListener l) {\n\t\tlisteners.remove(l);\n\t}", "public NonLinear(double[] x, double[] y, double sigma,\n\t\t\t RealValuedFunctionVA rf,\n\t\t\t Config config)\n\t{\n\t this(x, y, sigma, rf, config, null);\n\t}", "public NonLinear(double[] x, double[] y, double[] sigma,\n\t\t\t RealValuedFunctionVA rf,\n\t\t\t Config config)\n\t{\n\t this(x, y, sigma, rf, config, null);\n\t}", "public Builder clearLineage() {\n if (lineageBuilder_ == null) {\n lineage_ = alluxio.proto.journal.Lineage.LineageEntry.getDefaultInstance();\n onChanged();\n } else {\n lineageBuilder_.clear();\n }\n bitField0_ = (bitField0_ & ~0x00040000);\n return this;\n }", "public void removeJpmProductSaleNew(final Long uniNo);", "@Override\n @SuppressWarnings(\"fallthrough\")\n public Date remove(final int index) {\n final Date previous = get(index);\n switch (index) {\n case 0: date1 = date2; // Fallthrough\n case 1: date2 = Long.MIN_VALUE; break;\n }\n modCount++;\n return previous;\n }", "@Override\n protected void seriesRemoved(Series<X,Y> series) {\n for(XYChart.Data<X,Y> xydata : series.getData() ){\n Node holder = xydata.getNode();\n getPlotChildren().remove(holder);\n }\n removeSeriesFromDisplay(series);\n }", "public void removeLayer(int index){\n history.removeIndex(index);\n historyValues.removeIndex(index);\n }", "public void removeData(double x, double y) {\n if (n > 0) {\n double dx = x - xbar;\n double dy = y - ybar;\n sumXX -= dx * dx * (double) n / (n - 1d);\n sumYY -= dy * dy * (double) n / (n - 1d);\n sumXY -= dx * dy * (double) n / (n - 1d);\n xbar -= dx / (n - 1.0);\n ybar -= dy / (n - 1.0);\n sumX -= x;\n sumY -= y;\n n--;\n\n if (n > 2) {\n distribution.setDegreesOfFreedom(n - 2);\n }\n }\n }", "public final void undo() {\n\t\tthis.historyManager.undo();\n\t}", "private LinearAVF cloneLinearAVF() {\n LinearAVF avf = new LinearAVF();\n // value function\n Arrays.stream(Criterion.values())\n .forEach(\n c -> {\n if (c.hasBooleanDomain()) {\n avf.setInternalValueFunction(c, this.getInternalBooleanValueFunction(c));\n } else if (c.isDoubleCrescent()) {\n avf.setInternalValueFunction(c, this.getInternalLinearValueFunction(c));\n } else if (c.isDoubleDecrease()) {\n avf.setInternalValueFunction(c, this.getInternalReversedLinearValueFunction(c));\n }\n });\n // weights\n Arrays.stream(Criterion.values())\n .forEach(criterion -> avf.weight.put(criterion, this.weight.get(criterion)));\n return avf;\n }", "public void removeProgressListener() {\n this.listener = new SilentProgressListener();\n }", "public void unsetObservedLobeAnalysis() {\n this.observedLobeAnalysis = null;\n }", "public void removeJbdSendRecordHist(final String id);", "static Line pointSlopeToLine(PointDouble p, double slope) {\n Line line = new Line();\n line.a = -slope; // always -slope TODO: solve case slope=INFINITY\n line.b = 1; // always 1\n line.c = -((line.a * p.x) + (line.b * p.y));\n return line;\n }", "public void removeLines(ArrayList<Line> currentLines) {\n if (currentLines != null) {\n for (int i = 0; i < currentLines.size(); i++) {\n lines.remove(currentLines.get(i));\n }\n }\n }", "public void removeTrail(Trail removedTrail) {\n for(int i = 0; i < trails.size(); i++) {\n if(trails.get(i).getTrailCode() == removedTrail.getTrailCode()) {\n trails.remove(i);\n break;\n }\n }\n }", "public void stopChronometer(View view) throws IOException {\n timer.stop();\n timer_running = false;\n saveData();\n\t\tIntent intent = new Intent(this, MainActivity.class);\n\t\tstartActivity(intent);\n \n }", "public SfJdDocAudit unAuditFN(SfJdDocAudit qx, RequestMeta requestMeta) {\n wfEngineAdapter.rework(qx.getComment(), qx, requestMeta);\r\n return qx;\r\n }", "public abstract EventSeries removeEventSeries(User user, String id);", "public abstract void detatchHistoricalWrapper();", "public void setLinearOffset(Vector2 linearOffset) {\n jniSetLinearOffset(addr, linearOffset.x, linearOffset.y);\n }", "public Delta removeStat(String stat) {\n Map<String, Map<String, String>> parsedStat = StatsHolder.parseStat(stat);\n Map<String, Map<String, String>> currentStats = _removedStats.getMapFields();\n for (String statName : parsedStat.keySet()) {\n currentStats.put(statName, parsedStat.get(statName));\n }\n return this;\n }", "public ILoString removeFirst(int n) {\n if (n > 0) {\n return this.rest.removeFirst(n - 1);\n }\n\n else {\n return this;\n }\n }", "public static int removeTrendWithBestFit( double[] inarr, double timestep) {\r\n if ((inarr == null) || (inarr.length == 0) || \r\n (Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return -1;\r\n }\r\n //find trend with best fit and remove it. The order is determined from the\r\n // number of coefficients returned.\r\n double[] coefs = findTrendWithBestFit( inarr, timestep);\r\n removePolynomialTrend(inarr, coefs, timestep);\r\n return (coefs.length - 1);\r\n }", "private void setDataLineChart() {\n\t\t\n\t\tchartLine.setTitle(\"Evolution du Solde\");\n\t\tchartLine.getData().clear();\n\t\t\n\t\tXYChart.Series series = new XYChart.Series();\n\t\tseries.getData().clear();\n\t\tseries.setName(\"Evolution du solde\");\n\t\t\n\t\tdouble solde = bal.getAmount();\n\t\tint currentYear = Calendar.getInstance().get(Calendar.YEAR);\n\t\tint currentMonth = Calendar.getInstance().get(Calendar.MONTH);\n\t\tint currentDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);\n\t\t\n\t\t\n\t\t// Create a calendar object and set year and month\n\t\tCalendar mycal = new GregorianCalendar(currentYear, currentMonth,\n\t\t\t\tcurrentDay);\n\t\t\n\t\t// Get the number of days in that month\n\t\tint daysInMonth = mycal.getActualMaximum(Calendar.DAY_OF_MONTH);\n\t\t\n\t\tif (!bal.getTransactions().isEmpty()) {\n\t\t\tfor (IOTransactionLogic transaction : bal.getTransactions()\n\t\t\t\t\t.get(currentYear)[currentMonth]) {\n\t\t\t\tsolde -= transaction.getAmount();\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < currentDay; ++i) {\n\t\t\tif (!bal.getTransactions().isEmpty()) {\n\t\t\t\tfor (IOTransactionLogic transaction : bal.getTransactions()\n\t\t\t\t\t\t.get(currentYear)[currentMonth]) {\n\t\t\t\t\tjava.sql.Date dat = transaction.getDate();\n\t\t\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\t\t\tcal.setTime(dat);\n\t\t\t\t\tif (cal.get(Calendar.DAY_OF_MONTH) - 1 == i) {\n\t\t\t\t\t\tsolde += transaction.getAmount();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tseries.getData()\n\t\t\t\t\t.add(new XYChart.Data(String.valueOf(i + 1), solde));\n\t\t}\n\t\t\n\t\tchartLine.getData().addAll(series);\n\t\tchartLine.setLegendVisible(false);\n\t}", "private XYSeries createSeries() {\r\n return createSeries(0);\r\n }", "void removeFinancialStatements(int i);", "void unsetAppliesPeriod();", "static private void removeOldTerms(DataManager manager, List<Term> oldTerms, ArrayList<Term> newTerms) throws Exception\r\n\t{\r\n\t\t// Create a hash of all new terms\r\n\t\tHashMap<Integer,Term> newTermHash = new HashMap<Integer,Term>();\r\n\t\tfor(Term newTerm : newTerms) newTermHash.put(newTerm.getId(), newTerm);\r\n\r\n\t\t// Remove all terms which are no longer used\r\n\t\tfor(Term term : oldTerms)\r\n\t\t\tif(!newTermHash.containsKey(term.getId()))\r\n\t\t\t\tif(!manager.getSchemaElementCache().deleteSchemaElement(term.getId()))\r\n\t\t\t\t\tthrow new Exception(\"Failed to delete thesaurus term\");\r\n\t}", "void removeEndingHadithNo(Object oldEndingHadithNo);", "public void deleteHistory() {\n weatherRepo.deleteAll();\n }", "public LinearNode() {\r\n\t\t\r\n\t\tnext = null;\r\n\t\telement = null;\r\n\t\r\n\t}", "public boolean useHistoryAnomaly() {\n return false;\n }", "@Override\r\n public Polynomial derivative() {\r\n Polynomial x = this.filter(t -> {\r\n Term term = (Term) t;\r\n return term.getPower() != 0;\r\n }).map(t -> {\r\n Term term = (Term) t;\r\n return new Term(term.getCoefficient() * term.getPower(), term.getPower() - 1);\r\n });\r\n return x;\r\n }", "public void remLineNumber(){\n ((MvwDefinitionDMO) core).remLineNumber();\n }", "public void discardLastWeight() {\n this.weights.remove(this.weights.size() - 1);\n // meanwhile flip the accepting flag\n acceptWeight = true;\n }", "public synchronized void removeProgressListener (ProgressListener lsnr) {\n if (listeners == null) {\n return;\n }\n listeners.removeElement(lsnr);\n }", "@Override\n public Polynomial subtract(Polynomial q) {\n if (q == null)\n throw new NullPointerException(\"cannot subtract null polynomials\");\n\n return subSparse(this, toSparsePolynomial(q));\n }", "void unsetSearchRecurrenceStart();", "public static boolean removePolynomialTrend(double[] array, double[] coefs, \r\n double timestep) {\r\n if ((array == null) || (array.length == 0) || (coefs == null) ||\r\n (coefs.length == 0) || (Math.abs(timestep - 0.0) < OPS_EPSILON)) {\r\n return false;\r\n }\r\n int len = array.length;\r\n double[] time = makeTimeArray( timestep, len);\r\n PolynomialFunction poly = new PolynomialFunction( coefs );\r\n for (int i = 0; i < len; i++) {\r\n array[i] = array[i] - poly.value(time[i]);\r\n }\r\n return true;\r\n }", "public Builder clearMonthlySalary() {\n \n monthlySalary_ = 0F;\n onChanged();\n return this;\n }", "public void removeListener(final IHistoryStringBuilderListener listener) {\n m_listeners.removeListener(listener);\n }", "public void removeChangeListener(ChangeListener l) {\n\t\t//do nothing\n\t}", "private static List<Point> createLinearDataset() {\r\n List<Point> data = new ArrayList<Point>();\r\n add(data, 1, 100);\r\n add(data, 5, 200);\r\n add(data, 10, 300);\r\n add(data, 15, 400);\r\n return data;\r\n }", "public synchronized void resetSales() {\n sales = null;\n }", "public void subtract(MyDouble val) {\n this.setValue(this.getValue() - val.getValue());\n }", "JFreeChart generateHist();", "public void removeByTodoDouble(double todoDouble);", "public void keep(Lineage lin, String name)\n\t\t{\n\t\tTuple<Lineage,String> key=Tuple.make(lin, name);\n\t\tif(!oldnuc.containsKey(key))\n\t\t\t{\n\t\t\tLineage.Particle n=lin.particle.get(name);\n\t\t\tif(n!=null)\n\t\t\t\toldnuc.put(key, n.clone());\n\t\t\telse\n\t\t\t\toldnuc.put(key, null);\n\t\t\t}\n\t\tif(oldob.containsKey(lin))\n\t\t\toldob.put(lin, new ModObj(lin.coreMetadataModified, lin.dateLastModify));\n\t\t}", "public Spell removeAt(int pos) {\n\t\tif (pos < 0)\n\t\t\tthrow new IndexOutOfBoundsException();\n\n\t\tif (pos == 0)\n\t\t\treturn spell;\n\t\telse if (spell instanceof SpellDecorator) {\n\t\t\tspell = ((SpellDecorator) spell).removeAt(pos - 1);\n\t\t\treturn this;\n\t\t} else {\n\t\t\tthrow new IndexOutOfBoundsException();\n\t\t}\n\t}", "public Builder clearTraceTag() {\n bitField0_ = (bitField0_ & ~0x00004000);\n traceTag_ = 0L;\n onChanged();\n return this;\n }", "@Override\r\n public void resetAccount() {\r\n super.resetAccount();\r\n this.getNewSourceLine().setAmount(null);\r\n this.getNewSourceLine().setAccountLinePercent(new BigDecimal(0));\r\n }", "void removeStartingHadithNo(Object oldStartingHadithNo);", "public <V extends Number> FluentExp<V> minus (SQLExpression<V> expr)\n {\n return new Sub<V>(this, expr);\n }", "private void removeState(int position, int stateIndex) {\n\t\t\n\t\tif(position == -1) {\n\t\t\tthis.logPriors.remove(stateIndex);\n\t\t} else {\n\t\t\t// address transitions *to* the removed state\n\t\t\tConcurrentHashMap<Integer, Double> toStates;\n\t\t\tthis.inSupport.get(position).remove(stateIndex);\n\t\t\t\n\t\t\tfinal ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, Double>> map = this.logTransitions.get(position);\n\t\t\tDouble remove;\n\t\t\tfor (Integer fromState : map.keySet()) {\n\t\t\t\ttoStates = map.get(fromState);\n\t\t\t\tremove = toStates.remove(stateIndex); // state is gone: can't transition to it\n\t\t\t\t\t\n\t\t\t\tif (remove != null && toStates.isEmpty()) {\n\t\t\t\t\tfinal Set<Integer> set = posStateToRemove.get(position-1);\n\t\t\t\t\tsynchronized (set) {\n\t\t\t\t\t\tset.add(fromState);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// address transitions *from* the removed state\n\t\tthis.logTransitions.get(position+1).remove(stateIndex);\n\t}", "public Polynomial minus(Polynomial poly) {\n\t\tPolynomial a = this;\n\t\tPolynomial b = poly;\n\n\t\tPolynomial c = new Polynomial(0, Math.max(\n\t\t\t\ta.degree, b.degree), this.field);\n\t\tif (a.field == b.field) {\n\n\t\t\tfor (int i = 0; i <= a.degree; i++) {\n\t\t\t\tc.coefficients[i] += a.coefficients[i];\n\t\t\t}\n\n\t\t\tfor (int i = 0; i <= b.degree; i++) {\n\t\t\t\tc.coefficients[i] -= b.coefficients[i];\n\t\t\t}\n\n\t\t\tc = this.modField(c);\n\n\t\t} else {\n\t\t\t// TODO: throw exception or some such.\n\t\t}\n\n\t\treturn c;\n\t}", "public void remove(C0259ML ml) {\n this.f1003d.remove(ml);\n notifyDataSetChanged();\n }", "public DoubleColumn linear() {\n DoubleColumn result = col.asDoubleColumn();\n int last = -1;\n for (int i = 0; i < col.size(); i++) {\n if (!col.isMissing(i)) {\n if (last >= 0 && last != i - 1) {\n for (int j = last + 1; j < i; j++) {\n result.set(\n j,\n col.getDouble(last)\n + (col.getDouble(i) - col.getDouble(last)) * (j - last) / (i - last));\n }\n }\n last = i;\n }\n }\n return result;\n }", "public void removeJfiPayLog(final Long logId);", "public double[][] deconstructTimeSeries( double[] series, \n int numberOfVariables, \n int lag )\n {\n int N = series.length - numberOfVariables * lag;\n while( N < 0 )\n {\n numberOfVariables--;\n N = series.length - (numberOfVariables) * lag;\n }\n double[][] variables = new double[ numberOfVariables ][ N ];\n\n for( int i=0; i<numberOfVariables; i++ )\n {\n for( int j=0; j<N; j++ )\n {\n variables[ i ][ j ] = series[ i * lag + j ];\n }\n }\n\n return variables;\n }", "public static final double calculateIntercept(final double min, final double slope, final double validMin) {\r\n return (min - (slope * validMin));\r\n }", "public void removeScript() {\n scriptHistory = null;\n }", "public AcademicHistory() {\n listOfTerms = new ArrayList<Term>();\n }", "@Override\n\tpublic Retorno eliminarTramo(Double coordXi, Double coordYi, Double coordXf, Double coordYf) {\n\t\treturn new Retorno();\n\t}" ]
[ "0.5592576", "0.5246531", "0.51622653", "0.47355467", "0.47331023", "0.46588823", "0.46109483", "0.45942107", "0.4569927", "0.4534085", "0.44513577", "0.4449001", "0.4400845", "0.434282", "0.4329999", "0.4318406", "0.43067905", "0.43048805", "0.42989022", "0.428638", "0.42818314", "0.4270482", "0.42605063", "0.42505586", "0.42488995", "0.42184848", "0.42140555", "0.41903374", "0.419009", "0.41840717", "0.41547313", "0.4129455", "0.41291082", "0.4128418", "0.41216835", "0.40881944", "0.40880543", "0.4084405", "0.40788102", "0.40553424", "0.40487075", "0.40359432", "0.40212548", "0.40181872", "0.40066683", "0.39969966", "0.39888638", "0.3977465", "0.397555", "0.3969451", "0.3963241", "0.39589208", "0.3934281", "0.39259312", "0.39250398", "0.39194816", "0.39132756", "0.39066988", "0.39064208", "0.38944858", "0.38940504", "0.38755524", "0.387052", "0.38692835", "0.3865434", "0.38504148", "0.38433066", "0.3839695", "0.38383478", "0.38350385", "0.3828876", "0.3827159", "0.3827023", "0.3817349", "0.38156432", "0.38058716", "0.38045028", "0.38004538", "0.37975365", "0.379736", "0.37943864", "0.37899035", "0.37881333", "0.37878415", "0.37860963", "0.37764016", "0.37750715", "0.37742695", "0.37704864", "0.3768415", "0.3768357", "0.37627327", "0.3761915", "0.37616155", "0.37606865", "0.37543127", "0.3747337", "0.3746294", "0.374624", "0.3742797" ]
0.597564
0
Create a new historical series from this one by taking the logarithm of prices. The log returns of the new series are identical to those of the original series and equal the differences for the new series.
public Series logarithmic() { Series logarithmic = new Series(); logarithmic.x = new double[logarithmic.size = size]; logarithmic.r = r; for(int t = 0; t<size; t++) logarithmic.x[t] = Math.log(x[t]); return logarithmic; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setHistoryPrice(BigDecimal historyPrice) {\n this.historyPrice = historyPrice;\n }", "public ArrayList<History> getPriceHistory() { return priceHistory; }", "public BigDecimal getHistoryPrice() {\n return historyPrice;\n }", "public static double sumInLogDomain(double[] logs) {\n\t\tdouble maxLog = logs[0];\n\t\tint idxMax = 0;\n\t\tfor (int i = 1; i < logs.length; i++) {\n\t\t\tif (maxLog < logs[i]) {\n\t\t\t\tmaxLog = logs[i];\n\t\t\t\tidxMax = i;\n\t\t\t}\n\t\t}\n\t\t// now calculate sum of exponent of differences\n\t\tdouble sum = 0;\n\t\tfor (int i = 0; i < logs.length; i++) {\n\t\t\tif (i == idxMax) {\n\t\t\t\tsum++;\n\t\t\t} else {\n\t\t\t\tsum += Math.exp(logs[i] - maxLog);\n\t\t\t}\n\t\t}\n\t\t// and return log of sum\n\t\treturn maxLog + Math.log(sum);\n\t}", "public void setHistoryMarketPrice(BigDecimal historyMarketPrice) {\n this.historyMarketPrice = historyMarketPrice;\n }", "private ArrayList<Float> convertToLog(ArrayList<Float> list){\n ArrayList<Float> convertedList = new ArrayList<>();\n for (Float current:list){\n double temp = Math.log(current);\n float newValue = (float) temp;\n convertedList.add(newValue);\n }\n return convertedList;\n\n }", "private void updatePortfolioHistory(PortfolioRecord portRecord, List<StockData> stockDataUpdates) {\n List<DataPoint> newHistory = new ArrayList<>();\n Map<String, PortfolioRecord.Allocation> portAllocations = portRecord.getAllocations();\n int numDataPoints = ((HistoricalStockData) stockDataUpdates.get(0)).getHistory().size();\n double currMoneyInvested = portRecord.getCurrMoneyInvested();\n\n for (int i = 0; i < numDataPoints; i++) {\n LocalDate date = null;\n double openPortValue = 0;\n double closePortValue = 0;\n\n for (StockData stockData : stockDataUpdates) {\n HistoricalStockData historicalStockData = (HistoricalStockData) stockData;\n String ticker = historicalStockData.getTicker();\n DataPoint dataPoint = historicalStockData.getHistory().get(i);\n date = dataPoint.getDate();\n\n openPortValue += dataPoint.getMarketOpenValue() * portAllocations.get(ticker).getNumShares();\n closePortValue += dataPoint.getMarketCloseValue() * portAllocations.get(ticker).getNumShares();\n }\n\n newHistory.add(new PortfolioDataPoint(date, openPortValue, closePortValue, currMoneyInvested));\n }\n\n portRecord.addHistory(newHistory);\n }", "public double[] LogSlope(double StartFreq, double StopFreq, double StartLevel, double StopLevel)\r\n {\n \r\n\tdouble levelM1 = 0.0;\r\n double levelB1 = 0.0;\r\n double levelFlag = 0.0;\r\n double[] logSLopeCalcValues = new double[7];\r\n\r\n //calculate M1 value\r\n // M1 = (Y2 - Y1) / (X2- X1)\r\n levelM1 = (Math.log10(StopLevel) - Math.log10(StartLevel)) / (Math.log10(StopFreq) - Math.log10(StartFreq));\r\n\r\n //calculate B1 value\r\n // B1 = Y2 -(M1 * X2)\r\n levelB1 = Math.log10(StopLevel) - (levelM1 * Math.log10(StopFreq));\r\n\r\n // put the values in the array to return it\r\n logSLopeCalcValues[0] = levelM1;\r\n logSLopeCalcValues[1] = levelB1;\r\n logSLopeCalcValues[2] = StartFreq;\r\n logSLopeCalcValues[3] = StopFreq;\r\n logSLopeCalcValues[4] = StartLevel;\r\n logSLopeCalcValues[5] = StopLevel;\r\n logSLopeCalcValues[6] = levelFlag;\r\n //return the array with the M1 and B1 values\r\n return logSLopeCalcValues;\r\n }", "static double[] normalizeLogP(double[] lnP){\n double[] p = new double[lnP.length];\n \n // find the maximum\n double maxLnP = lnP[0];\n for (int i=1 ; i<p.length ; ++i){\n if (lnP[i] > maxLnP){\n maxLnP = lnP[i];\n }\n }\n \n // subtract the maximum and exponentiate\n // sum is guaranted to be >= 1.0;\n double sum = 0.0;\n for (int i=0 ; i<p.length ; ++i){\n p[i] = Math.exp(lnP[i] - maxLnP);\n if (!Double.isFinite(p[i])){\n p[i] = 0.0;\n }\n sum = sum + p[i];\n }\n \n // normalize sum to 1\n for (int i=0 ; i<p.length ; ++i){\n p[i] = p[i]/sum;\n }\n return p;\n }", "@SuppressWarnings(\"deprecation\")\n\t@Override\n public double calculateLogP() {\n logP = 0.0;\n // jeffreys Prior!\n if (jeffreys) {\n logP += -Math.log(getChainValue(0));\n }\n for (int i = 1; i < chainParameter.getDimension(); i++) {\n final double mean = getChainValue(i - 1);\n final double x = getChainValue(i);\n\n if (useLogNormal) {\n\t final double sigma = 1.0 / shape; // shape = precision\n\t // convert mean to log space\n\t final double M = Math.log(mean) - (0.5 * sigma * sigma);\n\t logNormal.setMeanAndStdDev(M, sigma);\n\t logP += logNormal.logDensity(x);\n } else {\n final double scale = mean / shape;\n gamma.setBeta(scale);\n logP += gamma.logDensity(x);\n }\n }\n return logP;\n }", "public void setLog(Logger newLog) {\r\n\t\tm_Log = newLog;\r\n\t}", "public void setLOG(Logger newLog)\r\n\t{\r\n\t\tlog = newLog;\r\n\t}", "@Override\n public void updateHistory() {\n List<Integer> allItemIds = determineItemIds();\n if (allItemIds == null || allItemIds.size() == 0) {\n Log.i(TAG, \"No Item Ids exists to create history data sets.\");\n return;\n }\n\n long processTs = System.currentTimeMillis();\n long startLastMonth;\n long endLastMonth;\n // determine the last month depending from the process timestamp. In the first iteration\n // the process timestamp is the current timestamp. With the second iteration,\n startLastMonth = DateHelper.startOfLastMonth(processTs);\n endLastMonth = DateHelper.endOfLastMonth(processTs);\n // iterate through all known IDs. This is required because we want to create a history entry\n // for each item\n for (int itemId : allItemIds) {\n updatePriceHistory(itemId, startLastMonth, endLastMonth);\n }\n }", "public BigDecimal getHistoryMarketPrice() {\n return historyMarketPrice;\n }", "@Override\n\tpublic CreditrepayplanLog getLogInstance() {\n\t\treturn new CreditrepayplanLog();\n\t}", "public float nextLog ()\n {\n // Generate a non-zero uniformly-distributed random value.\n float u;\n while ((u = GENERATOR.nextFloat ()) == 0)\n {\n // try again if 0\n }\n\n return (float) (-m_fMean * Math.log (u));\n }", "public final void log() throws ArithmeticException {\n\t\tif ((mksa&_LOG) != 0) throw new ArithmeticException\n\t\t(\"****Unit: log(\" + symbol + \")\") ;\n\t\tvalue = AstroMath.log(value);\n\t\tmksa |= _log;\n\t\tif (symbol != null) \n\t\t\tsymbol = \"[\" + symbol + \"]\";\t// Enough to indicate log\n\t}", "public LogEntry generateLogEntry() {\n long time = getTime();\n int bloodGlucose = getBloodGlucose();\n double bolus = getBolus();\n int carbohydrate = getCarbohydrate();\n return new LogEntry(time, bloodGlucose, bolus, carbohydrate);\n }", "public LogEvent newInstance()\n {\n return new LogEvent();\n }", "public MarketHistoricalState() {\n\t\tthis(MarketHistoricalSnapshot.newBuilder());\n\t}", "public static double [] logarithm (double [][]x){\n\t\tdouble [] log=new double [x.length-1];\n\t\t\n\t\tfor(int i=0; i<x.length-1;i++){\n\t\t\tdouble[] xk1=x[i+1];\n\t\t\tdouble[] xk=x[i];\n\t\t\tlog[i]=Math.log10(Math.max( Math.abs(xk1[0] - xk[0]), Math.abs(xk1[1] - xk[1]) ));\n\t\t\t\n\t\t}\n\t\t\n\t\treturn log;\n\t}", "@Test\n public void whenLogarithmicFunctionThenLogarithmicResults() {\n FunctionMethod functionMethod = new FunctionMethod();\n List<Double> result = functionMethod.diapason(16, 18, x -> Math.log(x) / Math.log(2.0));\n List<Double> expected = Arrays.asList(4D, 4.08746284125034D);\n assertThat(result, is(expected));\n }", "public static double log(double a){ \n // migrated from jWMMG - the origin of the algorithm is not known.\n if (Double.isNaN(a) || a < 0) {\n return Double.NaN;\n } else if (a == Double.POSITIVE_INFINITY) {\n return Double.POSITIVE_INFINITY;\n } else if (a == 0) {\n return Double.NEGATIVE_INFINITY;\n }\n \n long lx;\n if (a > 1) {\n lx = (long)(0.75*a); // 3/4*x\n } else {\n lx = (long)(0.6666666666666666666666666666666/a); // 2/3/x\n }\n \n int ix;\n int power;\n if (lx > Integer.MAX_VALUE) {\n ix = (int) (lx >> 31);\n power = 31;\n } else {\n ix = (int) lx;\n power = 0;\n }\n \n while (ix != 0) {\n ix >>= 1;\n power++;\n }\n \n double ret;\n if (a > 1) {\n ret = lnInternal(a / ((long) 1<<power)) + power * LN_2;\n } else {\n ret = lnInternal(a * ((long) 1<<power)) - power * LN_2;\n }\n return ret;\n }", "private void updatePriceHistory(final int itemId,\n final long from,\n final long till) {\n try {\n // select all item prices to the given id in the range\n List<ItemPriceEntity> prices = mDatabaseAccess.itemsDAO().\n selectItemPricesInRange(itemId, from, till);\n if (prices != null && prices.size() > 0) {\n //Log.v(TAG, \"Update price history entry for the itemId \" + itemId);\n // creates a history entry from all prices in the time range\n ItemPriceHistoryEntity history = ItemPriceHistoryEntity.from(itemId, from, prices);\n // insert the history entry\n mDatabaseAccess.itemsDAO().insertItemPriceHistory(history);\n // delete all prices in the time range\n mDatabaseAccess.itemsDAO().deleteItemPricesInRange(itemId, from, till);\n Log.v(TAG, \"Remaining to delete: \" + mDatabaseAccess.itemsDAO()\n .selectPricesInRange(from, till));\n } else {\n //Log.d(TAG, \"The history prices for the itemId \" + itemId + \" are up to date.\");\n }\n } catch (Exception ex) {\n Log.e(TAG, \"A general failure has occurred while trying to update the price history.\",\n ex);\n }\n }", "public void FindPriceState(ArrayList<Float> prices) {\n\t\t\n\t\tint window_size = 4;\n\t\tfor(int i=0; i<grad.length; i++) {\n\t\t\t\n\t\t\tif(window_size <= prices.size()) {\n\t\t\t\tLinearRegression.Regression(prices, prices.size() - window_size, prices.size());\n\t\t\t\tgrad[i] = (int) (LinearRegression.gradient * 8);\n\t\t\t}\n\t\t\t\n\t\t\twindow_size <<= 1;\n\t\t}\n\t}", "public double logZero(double x);", "public static DataSet getLogData(DataSet aDataSet, boolean doLogX, boolean doLogY)\n {\n // Get DataX\n DataType dataType = aDataSet.getDataType();\n int pointCount = aDataSet.getPointCount();\n boolean hasZ = dataType.hasZ();\n double[] dataX = new double[pointCount];\n double[] dataY = new double[pointCount];\n double[] dataZ = hasZ ? new double[pointCount] : null;\n for (int i=0; i<pointCount; i++) {\n double valX = aDataSet.getX(i);\n double valY = aDataSet.getY(i);\n double valZ = hasZ ? aDataSet.getZ(i) : 0;\n\n dataX[i] = doLogX ? ChartViewUtils.log10(valX) : valX;\n dataY[i] = doLogY ? ChartViewUtils.log10(valY) : valY;\n if (hasZ)\n dataZ[i] = valZ;\n }\n\n // Return new DataSet for type and values\n return DataSet.newDataSetForTypeAndValues(dataType, dataX, dataY, dataZ);\n }", "public static double[] logarit(double[] data, double base) {\n\t\tdouble[] result = new double[data.length];\n\t\tfor (int i = 0; i < data.length; i++) {\n\t\t\tif (base == Math.E)\n\t\t\t\tresult[i] = Math.log(data[i]);\n\t\t\telse if (base == 10)\n\t\t\t\tresult[i] = Math.log10(data[i]);\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "public HistoryAuction(String name, ArrayList<Product> products, ArrayList<String> participants) {\n super(name, products, participants);\n priceHistory = new ArrayList<>(products.size());\n }", "private double logSumExp(double x[]) {\n double maxx = Double.NEGATIVE_INFINITY;\n for (double d : x) {\n if (d > maxx) { maxx = d; }\n }\n double sum = 0.0;\n for (double d : x) {\n sum += Math.exp(d-maxx);\n }\n return maxx + Math.log(sum);\n }", "private void log(Complex[] F) {\r\n\r\n\t\tF[0].setReal(Math.log10(1 + F[0].getReal()));\r\n\t\tmaX = F[0].getReal();\r\n\r\n\t\tmiN = F[0].getReal();\r\n\r\n\t\tfor (int i = 1; i < F.length; i++) {\r\n\t\t\tF[i].setReal(Math.log10(1 + F[i].getReal()));\r\n\t\t\tif (F[i].getReal() > maX) {\r\n\t\t\t\tmaX = F[i].getReal();\r\n\t\t\t}\r\n\t\t\tif (F[i].getReal() < miN) {\r\n\t\t\t\tmiN = F[i].getReal();\r\n\t\t\t}\r\n\r\n\t\t} \r\n\r\n\t}", "public static double genExp(double a) {\r\n\t\tdouble x = 1 - generator.nextDouble();\r\n\t\tdouble exp = -1 * Math.log(x) * a;\r\n\t\treturn exp;\r\n\r\n\t}", "@Test\n public void whenInvokeThenReturnsLogarithmValues() {\n Funcs funcs = new Funcs();\n\n List<Double> expected = Arrays.asList(0D, 0.301D, 0.477D);\n List<Double> result = funcs.range(1, 3,\n (pStart) -> {\n double resultValue = Math.log10(pStart);\n resultValue = Math.rint(resultValue * 1000) / 1000;\n return resultValue;\n });\n\n assertThat(result, is(expected));\n }", "public SpeedAlertsHistory() {\n this(DSL.name(\"speed_alerts_history\"), null);\n }", "protected Log getLog()\n/* */ {\n/* 59 */ return log;\n/* */ }", "@Test\n public void testAbsEqual() { \n assertTrue(!Double.isNaN(sLog.fromReal(Double.POSITIVE_INFINITY)));\n assertTrue(Double.isNaN(sLog.fromReal(Double.NEGATIVE_INFINITY)));\n {\n double v1 = sLog.fromReal(3);\n double v2 = sLog.fromReal(-3);\n double sum = sLog.plus(v1, v2);\n System.out.printf(\"%0#16x\\n\", Double.doubleToRawLongBits(sum));\n assertEquals(0l | Double.doubleToRawLongBits(Double.NEGATIVE_INFINITY), Double.doubleToRawLongBits(sum));\n assertFalse(Double.isNaN(sum));\n assertFalse(Double.isNaN(sLog.toReal(sum)));\n }\n {\n double v1 = sLog.fromReal(-3);\n double v2 = sLog.fromReal(3);\n double sum = sLog.plus(v1, v2);\n System.out.printf(\"%0#16x\\n\", Double.doubleToRawLongBits(sum));\n assertEquals(1l | Double.doubleToRawLongBits(Double.NEGATIVE_INFINITY), Double.doubleToRawLongBits(sum));\n assertTrue(Double.isNaN(sum));\n assertFalse(Double.isNaN(sLog.toReal(sum)));\n }\n }", "public BigDecimal getPriceStdOld();", "public static double CalcLevel_Log(double SlopeStart, double SlopeStop,double FreqPoint)\r\n {\n double levelLog = 0.0;\r\n double tempY = 0.0;\r\n\r\n tempY = SlopeStart * (Math.log10(FreqPoint)) + SlopeStop;\r\n levelLog = (Math.pow(10, tempY));\r\n\r\n return levelLog;\r\n }", "public BigDecimal getPriceListOld();", "private void updatePriceStats(double newPrice) {\n this.currentPrice = newPrice;\n this.currentAvgPrice = Double.parseDouble(decimalFormat.format(computeSMA(newPrice, currentAvgPrice, priceHistory)));\n this.priceChangePCT = Double.parseDouble(decimalFormat.format(computeDifferentialPCT(newPrice, currentAvgPrice)));\n }", "public SensorLog(Date when, Float temperature) {\n this.when = when;\n this.temperature = temperature;\n }", "public static double logarit(double value, double base) {\n\t\tif (base == Math.E)\n\t\t\treturn Math.log(value);\n\t\telse if (base == 10)\n\t\t\treturn Math.log10(value);\n\t\telse\n\t\t\treturn Double.NaN;\n\t\t\t\n\t}", "public ProductWarehouseWithHistory(String productName, double capacity, double initialBalance){\n super(productName, capacity);\n this.inventoryHistory = new ChangeHistory();\n this.addToWarehouse(initialBalance);\n }", "private double log2(double number){\n return (Math.log(number) / Math.log(2));\n }", "@Override\r\n\tpublic void addLog(Log log) throws RuntimeException {\n\t\tlogMapper.addLog(log);\r\n\t}", "public Element NewexpandLog(Element func, Ring ring){\n if (func instanceof F) {\n F f = (F) func;\n Element[] NEWARGS = new Element[f.X.length];\n for (int j = 0; j < NEWARGS.length; j++) NEWARGS[j] = NewexpandLog(f.X[j], ring); \n Element[] argLog2=null; boolean notTaken=true; int name=0;\n switch (f.name) {\n case F.LOG: argLog2=f.X; notTaken=false; name=F.LOG; argLog2[1]=NEWARGS[1]; argLog2[0]=NEWARGS[0];\n case F.LG: if (notTaken){ argLog2=new Element[2]; \n argLog2[0]=NumberZ.TEN; argLog2[1]=NEWARGS[0]; notTaken=false; name = F.LG;}\n case F.LN: if (notTaken){ argLog2=new Element[2]; \n argLog2[0]=Element.CONSTANT_E; argLog2[1]=NEWARGS[0]; notTaken=false;name = F.LN;} \n Element osn = argLog2[0];//основание \n Element argument = argLog2[1];//аргумент;\n boolean flagAbs = false;\n if(argument instanceof F) {\n argument = undressAbs((F) argument, ring);\n if(argument == null) {\n argument = argLog2[1];\n } else {\n flagAbs = true;\n }\n }\n Element pol = ring.CForm.ElementConvertToPolynom(argument);\n return toSumOfLogs(pol, osn, name, flagAbs, ring);\n// if(argument instanceof Polynom){\n// Polynom p=(Polynom)argument; FactorPol fp=p.factorOfPol_inQ(false, ring);\n// if(fp.multin.length>1){ Element[] mm= new Element[fp.multin.length];\n// for (int i = 0; i < fp.multin.length; i++) \n// mm[i]=(name==F.LOG)? \n// new F(name, argLog2[0], fp.multin[i]): new F(name, fp.multin[i]) ; \n// for (int i = 0; i < fp.multin.length; i++) \n// if(fp.powers[i]>1)\n// mm[i]=new F(F.MULTIPLY, new NumberZ(fp.powers[i]),mm[i]); \n// return new F(F.ADD, mm);\n// } else return (name==F.LOG)? new F(name, argLog2): new F(name, argLog2[1]); \n// }// end of polynom ----------------------------------------------------------- \n// Element[] argN=null;\n// if (name==F.LOG){\n// if((NEWARGS[1] instanceof F)&& (((F)NEWARGS[1]).name==F.MULTIPLY) ) {F f3=(F)NEWARGS[1];\n// argN=new Element[f3.X.length]; \n// for (int i = 0; i < argN.length; i++) argN[i]= new F(name, NEWARGS[0], f3.X[i]);\n// return new F(F.ADD, argN);}}\n// else if ((NEWARGS[0] instanceof F)&& (((F)NEWARGS[0]).name==F.MULTIPLY) ) {F f3=(F)NEWARGS[0];\n// argN=new Element[f3.X.length]; \n// for (int i = 0; i < argN.length; i++) {\n// if( (f3.X[i] instanceof F) && \n// ( (((F)f3.X[i]).name == F.POW) ||(((F)f3.X[i]).name == F.intPOW) ) ) {\n// argN[i]= new F(F.MULTIPLY, ((F)f3.X[i]).X[1], new F(name, ((F)f3.X[i]).X[0]) );\n// } else {\n// argN[i]= new F(name, f3.X[i]);\n// }\n// }\n// return new F(F.ADD, argN);\n// } else return new F(name, NEWARGS); \n case F.ID: return NEWARGS[0] ; \n case F.ADD:\n Element[] newArg= new Element[NEWARGS.length];\n Element sum=ring.numberZERO; int j=0;\n for (int i = 0; i < NEWARGS.length; i++) { \n if (NEWARGS[i].numbElementType() <= Ring.Polynom){sum = sum.add(NEWARGS[i], ring);\n } else {newArg[j++] = NEWARGS[i];}\n } \n if(!sum.isZero(ring)) {newArg[j++]=sum;}\n if ((j<NEWARGS.length)||(!sum.isZero(ring))) {if (j==NEWARGS.length) return new F(F.ADD, newArg);\n Element[] newArg1= new Element[j];\n System.arraycopy(newArg, 0, newArg1, 0, j); return (j>1)? new F(F.ADD, newArg1):newArg1[0]; \n }else return new F(F.ADD, newArg);\n case F.DIVIDE:\n // Сокращаем дробь.\n Element el = new F(F.DIVIDE, NEWARGS);\n el = ring.CForm.ElementConvertToPolynom(el);\n return ring.CForm.ElementToF(el);\n case F.intPOW:\n case F.POW:\n if((NEWARGS[0] instanceof F)&&(((F)NEWARGS[0]).name==F.MULTIPLY)){\n Element[] ee1=((F)NEWARGS[0]).X;\n for (int i = 0; i < ee1.length; i++) {\n if(ee1[i] instanceof F){\n F sf=(F)ee1[i];\n Element pow1= ((sf.name==F.intPOW)||(sf.name==F.POW))? NEWARGS[1].multiply(sf.X[1],ring):NEWARGS[1];\n ee1[i]=((sf.name==F.intPOW)||(sf.name==F.POW))? new F(sf.name, sf.X[0], pow1):\n new F(f.name, sf, pow1);\n }else ee1[i]= new F(f.name, ee1[i], NEWARGS[1]);\n }\n return new F(F.MULTIPLY, ee1);\n }else return new F(f.name, NEWARGS);\n \n case F.ABS: Element ARG=NEWARGS[0]; Element RES=null; \n if(ARG instanceof F){ F f1=(F)ARG;\n if ((f1.name==F.POW)||(f1.name==F.intPOW))\n return new F(f1.name, new F(F.ABS,f1.X[0] ),f1.X[1]);\n if (f1.name==F.MULTIPLY){\n Element[] nAr=new Element[f1.X.length];\n for (int i = 0; i < nAr.length; i++) {\n if ((f1.X[i] instanceof F)&& \n ((((F)f1.X[i]).name==F.POW)||(((F)f1.X[i]).name==F.intPOW))){\n F f2=(F)f1.X[i];\n nAr[i]= new F(f2.name, new F(F.ABS,f2.X[0]),f2.X[1]);}\n else nAr[i]= new F(F.ABS, f1.X[i]); }\n return new F(((F)ARG).name, nAr); \n }}else return new F(F.ABS, ARG);\n default:\n return new F(f.name,NEWARGS);\n }\n } \n if(func instanceof Fraction){\n if(func.isItNumber()) {\n return func;\n }\n Fraction frac = (Fraction)func;\n if( ( frac.num instanceof F) ||\n ( frac.denom instanceof F) ) {\n Element el = new F(F.DIVIDE, frac.num, frac.denom);\n return NewexpandLog(el, ring);\n }\n return frac.cancel(ring);\n }\n return func; // Fname, числа ,полиномы, матрицы и вектора он оставляет без изменений\n }", "public String trade_history(String pair, int since) {\n\t\treturn this.apiCall(\"trade_history\", pair, (\"since,\" + since), false);\n\t}", "public static final float log(float x) {\n \t\tif (!(x > 0f)) {\n \t\t\treturn Float.NaN;\n \t\t}\n \t\t//\n \t\tif (x == 1f) {\n \t\t\treturn 0f;\n \t\t}\n \t\t// Argument of _log must be (0; 1]\n \t\tif (x > 1f) {\n \t\t\tx = 1 / x;\n \t\t\treturn -_log(x);\n \t\t}\n \t\t;\n \t\t//\n \t\treturn _log(x);\n \t}", "public Hypergeometric(LogFactorialSerie logFactorial) {\n this.logFactorial = logFactorial;\n }", "void log(Log log);", "@Override\r\n\tpublic ItemLog createItemLog() {\n\t\treturn new HpLog();\r\n\t}", "public File newLogFile() {\n File flog = null;\n try {\n this.logFileName = getTimestamp() + \".xml\";\n this.pathToLogFile = logFileFolder + logFileName;\n URL logURL = new URL(this.pathToLogFile);\n flog = new File(logURL.toURI());\n if (!flog.exists()) {\n flog.createNewFile();\n }\n } catch (Exception ex) {\n log.error(\"newLogFile :\"+ ex.getMessage());\n } finally{\n this.fLogFile = flog;\n return flog;\n }\n }", "public static double QESPRLOG(double val) {\n\t\treturn (8.0 + Math.log10(QESPR(val)))/ 8.0;\n\t}", "public void addLog(Log p) {\n logs.add(p);\n }", "static final float interp_energy(final float prev_e, final float next_e)\n\t{\n\t\treturn (float)Math.pow( 10.0, (Math.log10( prev_e ) + Math.log10( next_e )) / 2.0 );\n\t}", "public final EObject ruleNaturalLogarithmFunction() throws RecognitionException {\r\n EObject current = null;\r\n\r\n Token otherlv_1=null;\r\n Token otherlv_3=null;\r\n EObject lv_operator_0_0 = null;\r\n\r\n EObject lv_value_2_0 = null;\r\n\r\n\r\n enterRule(); \r\n \r\n try {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3594:28: ( ( ( (lv_operator_0_0= ruleNaturalLogarithmOperator ) ) otherlv_1= '(' ( (lv_value_2_0= ruleNumberExpression ) ) otherlv_3= ')' ) )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3595:1: ( ( (lv_operator_0_0= ruleNaturalLogarithmOperator ) ) otherlv_1= '(' ( (lv_value_2_0= ruleNumberExpression ) ) otherlv_3= ')' )\r\n {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3595:1: ( ( (lv_operator_0_0= ruleNaturalLogarithmOperator ) ) otherlv_1= '(' ( (lv_value_2_0= ruleNumberExpression ) ) otherlv_3= ')' )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3595:2: ( (lv_operator_0_0= ruleNaturalLogarithmOperator ) ) otherlv_1= '(' ( (lv_value_2_0= ruleNumberExpression ) ) otherlv_3= ')'\r\n {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3595:2: ( (lv_operator_0_0= ruleNaturalLogarithmOperator ) )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3596:1: (lv_operator_0_0= ruleNaturalLogarithmOperator )\r\n {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3596:1: (lv_operator_0_0= ruleNaturalLogarithmOperator )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3597:3: lv_operator_0_0= ruleNaturalLogarithmOperator\r\n {\r\n if ( state.backtracking==0 ) {\r\n \r\n \t newCompositeNode(grammarAccess.getNaturalLogarithmFunctionAccess().getOperatorNaturalLogarithmOperatorParserRuleCall_0_0()); \r\n \t \r\n }\r\n pushFollow(FOLLOW_ruleNaturalLogarithmOperator_in_ruleNaturalLogarithmFunction7653);\r\n lv_operator_0_0=ruleNaturalLogarithmOperator();\r\n\r\n state._fsp--;\r\n if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n \t if (current==null) {\r\n \t current = createModelElementForParent(grammarAccess.getNaturalLogarithmFunctionRule());\r\n \t }\r\n \t\tset(\r\n \t\t\tcurrent, \r\n \t\t\t\"operator\",\r\n \t\tlv_operator_0_0, \r\n \t\t\"NaturalLogarithmOperator\");\r\n \t afterParserOrEnumRuleCall();\r\n \t \r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n otherlv_1=(Token)match(input,43,FOLLOW_43_in_ruleNaturalLogarithmFunction7665); if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n \tnewLeafNode(otherlv_1, grammarAccess.getNaturalLogarithmFunctionAccess().getLeftParenthesisKeyword_1());\r\n \r\n }\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3617:1: ( (lv_value_2_0= ruleNumberExpression ) )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3618:1: (lv_value_2_0= ruleNumberExpression )\r\n {\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3618:1: (lv_value_2_0= ruleNumberExpression )\r\n // ../eu.artist.postmigration.nfrvt.lang.gml/src-gen/eu/artist/postmigration/nfrvt/lang/gml/parser/antlr/internal/InternalGML.g:3619:3: lv_value_2_0= ruleNumberExpression\r\n {\r\n if ( state.backtracking==0 ) {\r\n \r\n \t newCompositeNode(grammarAccess.getNaturalLogarithmFunctionAccess().getValueNumberExpressionParserRuleCall_2_0()); \r\n \t \r\n }\r\n pushFollow(FOLLOW_ruleNumberExpression_in_ruleNaturalLogarithmFunction7686);\r\n lv_value_2_0=ruleNumberExpression();\r\n\r\n state._fsp--;\r\n if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n \t if (current==null) {\r\n \t current = createModelElementForParent(grammarAccess.getNaturalLogarithmFunctionRule());\r\n \t }\r\n \t\tset(\r\n \t\t\tcurrent, \r\n \t\t\t\"value\",\r\n \t\tlv_value_2_0, \r\n \t\t\"NumberExpression\");\r\n \t afterParserOrEnumRuleCall();\r\n \t \r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n otherlv_3=(Token)match(input,44,FOLLOW_44_in_ruleNaturalLogarithmFunction7698); if (state.failed) return current;\r\n if ( state.backtracking==0 ) {\r\n\r\n \tnewLeafNode(otherlv_3, grammarAccess.getNaturalLogarithmFunctionAccess().getRightParenthesisKeyword_3());\r\n \r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n if ( state.backtracking==0 ) {\r\n leaveRule(); \r\n }\r\n }\r\n \r\n catch (RecognitionException re) { \r\n recover(input,re); \r\n appendSkippedTokens();\r\n } \r\n finally {\r\n }\r\n return current;\r\n }", "public double log(double d){\r\n\r\n\t\tif(d == 0){\r\n\t\t\treturn 0.0;\r\n\t\t} else {\r\n\t\t\treturn Math.log(d)/Math.log(2);\r\n\t\t}\r\n\r\n\t}", "public static List<OptionPricing> getPriceHistory(Date startTradeDate, Date endTradeDate, Date expiration, double strike, String callPut) {\r\n\t\t\r\n\t\tEntityManagerFactory emf = Persistence.createEntityManagerFactory(\"JPAOptionsTrader\");\r\n\t\tEntityManager em = emf.createEntityManager();\r\n\t\t\r\n\t\t// Note: table name refers to the Entity Class and is case sensitive\r\n\t\t// field names are property names in the Entity Class\r\n\t\tQuery query = em.createQuery(\"select opt from \" + TradeProperties.SYMBOL_FOR_QUERY + \" opt where \"\r\n\t\t\t\t+ \"opt.trade_date >= :startTradeDate \" \r\n\t\t\t\t+ \"and opt.trade_date <= :endTradeDate \" \r\n\t\t\t\t+ \"and opt.expiration=:expiration \"\t\r\n\t\t\t\t+ \"and opt.call_put = :call_put \"\r\n\t\t\t\t+ \"and opt.strike = :strike \"\r\n\t\t\t\t+ \" order by opt.trade_date\");\r\n\t\t\r\n\t\tquery.setParameter(\"startTradeDate\", startTradeDate);\r\n\t\tquery.setParameter(\"endTradeDate\", endTradeDate);\r\n\t\tquery.setParameter(\"expiration\", expiration);\r\n\t\tquery.setParameter(\"call_put\", callPut);\r\n\t\tquery.setParameter(\"strike\", strike);\r\n\t\t\r\n\t\tquery.setHint(\"odb.read-only\", \"true\");\r\n\r\n\t\t@SuppressWarnings(\"unchecked\")\r\n\t\tList<OptionPricing> options = query.getResultList();\r\n\t\t\r\n\t\tem.close();\r\n\t\t\r\n\t\treturn options;\r\n\t}", "public double logResult(double f) {\n double r;\n try {\n r = 20 * Math.log10(result(f));\n } catch (Exception e) {\n r = -100;\n }\n if (Double.isInfinite(r) || Double.isNaN(r)) {\n r = -100;\n }\n return r;\n }", "public History(ArrayList<Order> orders) {\n this.orders = orders;\n }", "static private float _log(float x) {\n \t\tif (!(x > 0f)) {\n \t\t\treturn Float.NaN;\n \t\t}\n \t\t//\n \t\tfloat f = 0f;\n \t\t//\n \t\tint appendix = 0;\n \t\twhile ((x > 0f) && (x <= 1f)) {\n \t\t\tx *= 2f;\n \t\t\tappendix++;\n \t\t}\n \t\t//\n \t\tx /= 2f;\n \t\tappendix--;\n \t\t//\n \t\tfloat y1 = x - 1f;\n \t\tfloat y2 = x + 1f;\n \t\tfloat y = y1 / y2;\n \t\t//\n \t\tfloat k = y;\n \t\ty2 = k * y;\n \t\t//\n \t\tfor (long i = 1; i < 10; i += 2) {\n \t\t\tf += k / i;\n \t\t\tk *= y2;\n \t\t}\n \t\t//\n \t\tf *= 2f;\n \t\tfor (int i = 0; i < appendix; i++) {\n \t\t\tf += FLOAT_LOGFDIV2;\n \t\t}\n \t\t//\n //\t\tlogger.info(\"exit _log\" + f);\n \t\treturn f;\n \t}", "private void generateTrades() {\n\t\tSystem.out.println(\"\\nGenerating fake trade records for stock: \" + stockSymbol);\n Random rd = new Random();\n \n for (int i = 0; i < 5; i++) {\n // Create arbitrary timestamp and TradeRecord data \n \t// within the last 20 minutes\n \n int minutes = rd.nextInt(21);\n int sharesQty = rd.nextInt(100) + 1;\n boolean isBuy = rd.nextBoolean();\n double price = (rd.nextDouble() + 0.1) * 100;\n // truncate price to 2 decimal places\n String tmpPrc = String.format(Locale.ENGLISH, \"%.2f\", price);\n price = Double.parseDouble(tmpPrc);\n TradeRecordType indicator = isBuy ? TradeRecordType.BUY : TradeRecordType.SELL;\n \n Calendar cal = Calendar.getInstance();\n cal.add(Calendar.MINUTE, -minutes);\n Date date = cal.getTime();\n \n // Create and save fake trade record\n TradeRecord rec = new TradeRecord(date, sharesQty, indicator, price);\n System.out.println(rec);\n this.stockTrades.put(date, rec);\n }\n }", "public void setPriceStdOld (BigDecimal PriceStdOld);", "void stockPriceChanged(Stock stock, double oldValue, double newValue);", "@Override\n public List<Member> apply(List<Member> expression) {\n Double a, x;\n try {\n a = ((Number) expression.get(getPositionFirstOperand())).getDoubleValue();\n x = ((Number) expression.get(getPositionSecondOperand())).getDoubleValue();\n } catch (ClassCastException e) {\n throw new InputException(\n expression.get(position).getValue() + \" \" +\n expression.get(getPositionFirstOperand()).getValue() + \" \" +\n expression.get(getPositionSecondOperand()).getValue() + \" \");\n }\n\n if ((x > 0d) && (a > 0d) && (a != 1d)) {\n Double log10X = Math.log10(x);\n Double log10A = Math.log10(a);\n Double result = log10X / log10A;\n\n List<Member> resultList = new LinkedList<>(expression);\n resultList.remove(getPositionSecondOperand());\n resultList.remove(getPositionFirstOperand());\n resultList.remove(position);\n resultList.add(position, new Number(result.toString()));\n\n return resultList;\n } else {\n throw new ArithmeticException(\"Logarithm log(b,x) must meet next conditions: b!=1, b>0, x>0.\");\n }\n\n }", "private TicketLog createLog() throws SQLException {\n\t\t\t\t\treturn new TicketLog(rs.getLong(1), rs.getString(2),\n\t\t\t\t\t\t\trs.getLong(3),\n\t\t\t\t\t\t\tTicketLog.Action.valueOf(rs.getString(4)),\n\t\t\t\t\t\t\trs.getInt(5));\n\t\t\t\t}", "public LastSale(String id, Turn when, int price) {\n setId(id);\n this.when = when;\n this.price = price;\n }", "private ListSeries getTodayData() {\n\t\tListSeries dollarEarning = new ListSeries();\n\t\tdouble number = 0;\n\t\tnumber = controler.getTodaysTransactionSummary();\n\t\tdollarEarning.addData(number);\n\t\t\n\t\treturn dollarEarning;\n\t}", "public SolarlogData5Min cloneSolarlogData5Min(SolarlogData5Min orig, Instant recordTimestamp, int recordVersion) {\n SolarlogData5Min newSolarlog = new SolarlogData5Min();\n newSolarlog.setHeatpump(orig.getHeatpump());\n newSolarlog.setInverters(orig.getInverters());\n newSolarlog.setPhases(orig.getPhases());\n newSolarlog.setEAcInverterDay(orig.getEAcInverterDay());\n newSolarlog.setPAcInverter(orig.getPAcInverter());\n newSolarlog.setPAcUsage(orig.getPAcUsage());\n newSolarlog.setRecordState(orig.getRecordState());\n newSolarlog.setWeather(orig.getWeather());\n\n String recordTimeStampString = SolarlogData5Min.getISOStringFromInstant(recordTimestamp);\n\n newSolarlog.setRecordTimestamp(recordTimeStampString);\n newSolarlog.setRecordVersion(recordVersion);\n\n Instant updateTimestamp = newSolarlog.getRecordTimestampAsInstant().plusSeconds(90);\n String updateTimestampString = SolarlogData5Min.getISOStringFromInstant(updateTimestamp);\n newSolarlog.setUpdateTimestamp(updateTimestampString);\n\n return newSolarlog;\n }", "public void computeLogLikelihood(double[] betas, Instances instances) {\n //Basic implementation done in the prior class.\n super.computelogLikelihood(betas, instances);\n }", "public static void main(String[] args) {\n Account anushaAccount = new Account(456123, \"SBIK1014\", 100);\n Account priyaAccount = new Account(789456, \"SBIK1014\", 200);\n Account dhanuAccount = new Account(951753, \"SBIK1014\", 300);\n\n ArrayList<Account> accounts = new ArrayList<>();\n\n accounts.add(anushaAccount);\n accounts.add(priyaAccount);\n accounts.add(dhanuAccount);\n\n TransactionHistory anuTranHist1 = new TransactionHistory(\"8-Jun-2018\", \"savaings\", 25000);\n TransactionHistory anuTranHist2 = new TransactionHistory(\"28-nov-2018\", \"current\", 50000);\n TransactionHistory anuTranHist3 = new TransactionHistory(\"15-Mar-2018\", \"savaings\", 5000);\n\n TransactionHistory priyaTranHist1 = new TransactionHistory(\"8-Jun-2018\", \"savaings\", 25000);\n TransactionHistory priyaTranHist2 = new TransactionHistory(\"28-nov-2018\", \"current\", 50000);\n TransactionHistory priyaTranHist3 = new TransactionHistory(\"15-Mar-2018\", \"savaings\", 5000);\n\n TransactionHistory dhanuTranHist1 = new TransactionHistory(\"8-Jun-2018\", \"savaings\", 25000);\n TransactionHistory dhanuTranHist2 = new TransactionHistory(\"28-nov-2018\", \"current\", 50000);\n TransactionHistory dhanuTranHist3 = new TransactionHistory(\"15-Mar-2018\", \"savaings\", 5000);\n\n\n ArrayList<TransactionHistory> anuTransactionHistory = new ArrayList<>();\n anuTransactionHistory.add(anuTranHist1);\n anuTransactionHistory.add(anuTranHist2);\n anuTransactionHistory.add(anuTranHist3);\n\n ArrayList<TransactionHistory> priyaTransactionHistory = new ArrayList<>();\n anuTransactionHistory.add(priyaTranHist1);\n anuTransactionHistory.add(priyaTranHist2);\n anuTransactionHistory.add(priyaTranHist3);\n\n ArrayList<TransactionHistory> dhanuTransactionHistory = new ArrayList<>();\n anuTransactionHistory.add(dhanuTranHist1);\n anuTransactionHistory.add(dhanuTranHist2);\n anuTransactionHistory.add(dhanuTranHist3);\n\n //useless code\n //you have already instantiated arraylist above and filled it with objects.. you can use that\n // List<Account> accountDetails=Arrays.asList(anushaAccount,priyaAccount,dhanuAccount);\n //List<TransactionHistory> transHistory=Arrays.asList(anuTranHist1,anuTranHist2,anuTranHist3);\n\n Customer anusha = new Customer(\"anusha\", 26, \"28-mar-92\", anushaAccount, anuTransactionHistory);\n Customer priya = new Customer(\"priya\", 22, \"15-oct-96\", priyaAccount, priyaTransactionHistory);\n Customer dhanu = new Customer(\"dhanu\", 32, \"05-jan-82\", dhanuAccount, dhanuTransactionHistory);\n\n anusha.setAccount(anushaAccount);\n priya.setAccount(priyaAccount);\n dhanu.setAccount(dhanuAccount);\n\n List<Customer> customerDetails = Arrays.asList(anusha, priya, dhanu);\n\n\n Bank bank = new Bank(\"SBI\", \"BNGLR\", customerDetails);\n\n// use the utitlity class here and output the customer object with the highest amount\n // check if your logic is running fine and fix this by morning. I have to finish work, and will leave it to you.\n Customer highestAmountCustomer = BankUtility.getCustomerWithHighestDeposit(bank);\n\n System.out.println(\"Customer with highest bank balance is \"+ highestAmountCustomer.getName() + \" with value \"+highestAmountCustomer.getAccount().getAmount());\n }", "public void setPriceListOld (BigDecimal PriceListOld);", "@Override\r\n\tpublic double evaluate(double input1) throws ArithmeticException \r\n\t{\n\t\treturn Math.log(input1);\r\n\t}", "public static double[][] logarit(double[][] data, double base) {\n\t\tdouble[][] result = new double[data.length][];\n\t\t\n\t\tfor (int i = 0; i < data.length; i++) {\n\t\t\tresult[i] = logarit(data[i], base);\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "public void setHistoryRebate(BigDecimal historyRebate) {\n this.historyRebate = historyRebate;\n }", "private static double log2(double x) {\n return Math.log(x) / Math.log(2);\n }", "private static void writeToFilePriceHistory() throws IOException {\n FileWriter write = new FileWriter(path3, append);\n PrintWriter print_line = new PrintWriter(write);\n ArrayList<Product> stock = Inventory.getStock();\n for (int i = 0; i < stock.size(); i++) {\n Product product = (Product) stock.get(i);\n int UPC = product.getUpc();\n ArrayList<String> priceH = product.price.getArrayPriceHistory();\n for (int j = 0; j < priceH.size(); j++) {\n String price = priceH.get(j);\n textLine = UPC + \" \" + price;\n print_line.printf(\"%s\" + \"%n\", textLine);\n }\n }\n print_line.close();\n }", "@Override\n public ProductBacklog createNewBacklog(ProductBacklog productBacklog) {\n return backlogRepository.save(productBacklog);\n }", "public void setLog(XLog log) {\n\n\t}", "public T elementLog() {\n T c = createLike();\n ops.elementLog(mat, c.mat);\n return c;\n }", "public static float log(float base, float arg) {\n return (nlog(arg)) / nlog(base);\n }", "@Test\n public void testLogP() {\n System.out.println(\"logP\");\n NegativeBinomialDistribution instance = new NegativeBinomialDistribution(3, 0.3);\n instance.rand();\n assertEquals(Math.log(0.027), instance.logp(0), 1E-7);\n assertEquals(Math.log(0.0567), instance.logp(1), 1E-7);\n assertEquals(Math.log(0.07938), instance.logp(2), 1E-7);\n assertEquals(Math.log(0.09261), instance.logp(3), 1E-7);\n assertEquals(Math.log(0.05033709), instance.logp(10), 1E-7);\n }", "private void naturalLog()\n\t{\n\t\tif(Fun == null)\n\t\t{\n\t\t\tsetLeftValue();\n\t\t\tresult = calc.naturalLog ( );\n\t\t\tupdateText();\n\t\t}\n\t}", "private TraceableFloat mutateGene(TraceableFloat a, float new_a_value, EvolutionState state){\n\n if(a.getValue() == new_a_value)//return the original gene if the value was not altered\n return a;\n\n double influence_factor_mut = Math.abs(a.getValue() - new_a_value) / (Math.abs(a.getValue()) + Math.abs(a.getValue() - new_a_value));\n double influence_factor_old = 1 - influence_factor_mut;\n\n List<TraceTuple> a_traceVector = new ArrayList<TraceTuple>();\n\n int i = 0; //index for this traceVector\n\n //check if we accumulate and the first element is already the mutation\n if(state.getAccumulateMutatioImpact() && a.getTraceVector().get(0).getTraceID() == state.getMutationCounter()){//if we accumulate mutation and the gene is influenced by mutation, accumulate that\n double oldScaledMutImpact = a.getTraceVector().get(0).getImpact() * influence_factor_old;\n a_traceVector.add(new TraceTuple(state.getMutationCounter(), influence_factor_mut + oldScaledMutImpact));\n i++; //increment i, as the first element of the traceList from a is already added\n } else { //add the new mutation ID if we don't accumulate or there is no mutation present bevore\n a_traceVector.add(new TraceTuple(state.getMutationCounter(), influence_factor_mut));\n }\n\n while(i < a.getTraceVector().size()){ //this iterates over the traceVector of this individual\n int currentAID = a.getTraceVector().get(i).getTraceID();\n double currentAImpact = a.getTraceVector().get(i).getImpact();\n\n a_traceVector.add(new TraceTuple(currentAID, influence_factor_old * currentAImpact));\n i++;\n }\n\n return new TraceableFloat(new_a_value, a_traceVector);\n }", "Stream<DataPoint> getHistoryData(Symbol symbol, LocalDateTime startTime, LocalDateTime endTime, int numberOfPoints);", "public void createNewStock(Stock stock) throws DuplicateEntry, InvalidDateEntry {\n\t\tif (!validateDate(stock.getDate())) {\n\t\t\tlog.error(\"Date entered is a future date for:\" + stock.getStock() + \"date given : \" + stock.getDate());\n\t\t\tthrow new InvalidDateEntry(\n\t\t\t\t\t\"Date entered is a future date for: \" + stock.getStock() + \" date given : \" + stock.getDate());\n\t\t}\n\n\t\tif (checkForDuplicates(new StockId(stock.getStock(), stock.getDate()))) {\n\t\t\tlog.error(\"Duplcate Record for :\" + stock.getStock() + \"on \" + stock.getDate());\n\t\t\tthrow new DuplicateEntry(\"Duplcate Record for : \" + stock.getStock() + \" on \" + stock.getDate());\n\t\t}\n\n\t\tstockRepo.save(stock);\n\n\t}", "public void setOriginalPrice(Float OriginalPrice) {\n this.OriginalPrice = OriginalPrice;\n }", "public List<Sale> getSalesLog() {\n return salesLog;\n }", "@Override\n\tpublic int addLog(Log l) {\n\t\tString sql = \"INSERT INTO t_log(fTime,fTel,fType,fDocld,fResult)values(?,?,?,?,?)\";\n\t\tint result = 0;\n\t\tObject[] params = {l.getfTime(),l.getfTel(),l.getfType(),l.getfDocld(),l.getfResult()};\n\t\ttry {\n\t\t\tresult = qr.update(sql,params);\n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn result;\n\t}", "private static int getlog(int operand, int base) {\n double answ = Math.log(operand)/Math.log(base);\n if (answ == Math.ceil(answ)) {\n return (int)answ;\n }\n else {\n return (int)answ+1;\n }\n }", "public PetAttributeValueHistory() {\n\t\tsuper(\"pet_attribute_value_history\", com.petpace.db.jooq.Rigel.RIGEL);\n\t}", "@Override\n\tpublic OnlineRegression copyNew() {\n\t\tBayesianLinearRegression copy = new BayesianLinearRegression(dimension, this.prioriMeans, prioriPrecision);\n\t\tcopy.weights = this.weights.copyNew();\n\t\tcopy.covariance = this.covariance.copyNew();\n\t\tcopy.b = this.b.copyNew();\n\t\tcopy.numTrainedInstances = this.numTrainedInstances;\n\t\treturn copy;\n\t}", "public void updatePurchaseHistory(Cart newPurchases) {\n for (Map.Entry<Integer, ShoppingItem> newItem : newPurchases.getItems().entrySet()) {\n purchaseHistory.put(newItem.getKey(), newItem.getValue());\n }\n }", "private void setDataLineChart() {\n\t\t\n\t\tchartLine.setTitle(\"Evolution du Solde\");\n\t\tchartLine.getData().clear();\n\t\t\n\t\tXYChart.Series series = new XYChart.Series();\n\t\tseries.getData().clear();\n\t\tseries.setName(\"Evolution du solde\");\n\t\t\n\t\tdouble solde = bal.getAmount();\n\t\tint currentYear = Calendar.getInstance().get(Calendar.YEAR);\n\t\tint currentMonth = Calendar.getInstance().get(Calendar.MONTH);\n\t\tint currentDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);\n\t\t\n\t\t\n\t\t// Create a calendar object and set year and month\n\t\tCalendar mycal = new GregorianCalendar(currentYear, currentMonth,\n\t\t\t\tcurrentDay);\n\t\t\n\t\t// Get the number of days in that month\n\t\tint daysInMonth = mycal.getActualMaximum(Calendar.DAY_OF_MONTH);\n\t\t\n\t\tif (!bal.getTransactions().isEmpty()) {\n\t\t\tfor (IOTransactionLogic transaction : bal.getTransactions()\n\t\t\t\t\t.get(currentYear)[currentMonth]) {\n\t\t\t\tsolde -= transaction.getAmount();\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < currentDay; ++i) {\n\t\t\tif (!bal.getTransactions().isEmpty()) {\n\t\t\t\tfor (IOTransactionLogic transaction : bal.getTransactions()\n\t\t\t\t\t\t.get(currentYear)[currentMonth]) {\n\t\t\t\t\tjava.sql.Date dat = transaction.getDate();\n\t\t\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\t\t\tcal.setTime(dat);\n\t\t\t\t\tif (cal.get(Calendar.DAY_OF_MONTH) - 1 == i) {\n\t\t\t\t\t\tsolde += transaction.getAmount();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tseries.getData()\n\t\t\t\t\t.add(new XYChart.Data(String.valueOf(i + 1), solde));\n\t\t}\n\t\t\n\t\tchartLine.getData().addAll(series);\n\t\tchartLine.setLegendVisible(false);\n\t}", "public void setSalesLog(List<Sale> salesLogToSet) {\n salesLog = salesLogToSet;\n }", "public void updateLineChart()\r\n {\r\n hoursLoggedSeries = new XYChart.Series<>();\r\n hoursLoggedSeries.setName(Integer.toString(LocalDate.now().getYear()));\r\n lineChart.getData().clear();\r\n \r\n try{\r\n populateSeriesFromDB();\r\n }\r\n catch(SQLException e)\r\n {\r\n System.err.println(e.getMessage());\r\n }\r\n lineChart.getData().addAll(hoursLoggedSeries);\r\n }", "public void setLog(LogService log) {\n\tthis.log = log;\n }", "public List<cn.zyj.dbexporter.jooq.db_mall.tables.pojos.TOfferGoods> fetchByOldRent(BigDecimal... values) {\n return fetch(TOfferGoods.T_OFFER_GOODS.OLD_RENT, values);\n }", "public void NewTrail(float[] positions, float trailLength)\n {\n float distanceBetweenEffects = trailLength / instantiateNumber;\n Log.d(\"--WTF--\",\"tl \" + trailLength + \"dbe \" + distanceBetweenEffects);\n //trail.clear();\n trail.get(0).Set(getWorldCoords(new Vec2(positions[0], positions[1]))); // początek\n\n float currUnusedLength = 0f;\n int effects = 1;\n for (int i = 2; i < positions.length; i=i+2)\n {\n // reszta odl. z poprzednich punktow + dystans miedzy tym pkt a poprzednim\n Vec2 A = new Vec2(positions[i-2],positions[i-1]);\n Vec2 B = new Vec2(positions[i],positions[i+1]);\n float distanceBetweenPoints = GetPointsDistance(A,B);\n currUnusedLength = currUnusedLength + distanceBetweenPoints;\n if(currUnusedLength > distanceBetweenEffects)\n {\n // jest wiekszy od odleglosci miedzy kolejnymi efektami, oznacza to ze\n // juz nie czas na umieszczenie kolejnego efektu\n float d = distanceBetweenPoints - (currUnusedLength-distanceBetweenEffects);\n float Xac = d * (B.X()-A.X())/distanceBetweenPoints;\n float Yac = d * (B.Y()-A.Y())/distanceBetweenPoints;\n\n if(effects < instantiateNumber)trail.get(effects).Set(getWorldCoords(new Vec2(A.X()+Xac, A.Y()+Yac)));\n else break;\n\n effects++;\n currUnusedLength = (currUnusedLength-distanceBetweenEffects);\n }\n }\n if(effects <= instantiateNumber)sqNumber = effects;\n else sqNumber = instantiateNumber;\n showThem = true;\n showBigStar = false;\n }", "@Override\n public boolean createSalesCallLog(SalesCallLog salescalllog) {\n salescalllog.setGendate(C_Util_Date.generateDate());\n return in_salescalllogdao.createSalesCallLog(salescalllog);\n }" ]
[ "0.56701726", "0.53513", "0.534101", "0.5295705", "0.5287103", "0.5275227", "0.5236696", "0.52333117", "0.5215374", "0.5162313", "0.5141226", "0.5138028", "0.512332", "0.5031366", "0.4976179", "0.49663207", "0.4875819", "0.48569795", "0.4848211", "0.48299852", "0.48278138", "0.48210165", "0.4819103", "0.48168245", "0.4813026", "0.47987938", "0.47860873", "0.47813514", "0.47509846", "0.47380722", "0.47320268", "0.472756", "0.47121578", "0.46609366", "0.46540397", "0.46514523", "0.46453947", "0.46430165", "0.4619309", "0.46151003", "0.46022996", "0.45839682", "0.45815694", "0.45711932", "0.45706585", "0.4565281", "0.4536392", "0.45360374", "0.45348907", "0.45345917", "0.4527821", "0.45261267", "0.45139208", "0.45111337", "0.45087636", "0.45022473", "0.4498136", "0.4497419", "0.44965515", "0.44964558", "0.44964418", "0.44894883", "0.4485887", "0.44838566", "0.44823092", "0.4482012", "0.4468335", "0.4466537", "0.44656956", "0.44556686", "0.44299692", "0.44273925", "0.44261274", "0.4424523", "0.442381", "0.4423596", "0.44201365", "0.44169965", "0.4411606", "0.44055432", "0.4402052", "0.4400455", "0.43970218", "0.4394012", "0.43902987", "0.43893328", "0.43804538", "0.43718305", "0.4357737", "0.43443948", "0.43426645", "0.43410692", "0.43389803", "0.43380573", "0.4335043", "0.43332213", "0.43308774", "0.4327975", "0.4315148", "0.4311264" ]
0.681108
0